├── .gitattributes ├── CSWM ├── 182 │ ├── AMXX.cpp │ └── AMXX.h ├── 18X │ └── Config.h ├── CSWM.cpp ├── CSWM.h ├── CSWM.sln ├── CSWM │ ├── CSWM.vcxproj │ ├── CSWM.vcxproj.filters │ ├── CSWM.vcxproj.user │ ├── Resource.aps │ ├── Resource.h │ └── Resource.rc ├── CStrike.h ├── FakeCMD.cpp ├── FakeCMD.h ├── HEFW.cpp ├── HEFW.h ├── HashMap.h ├── List.h ├── Makefile ├── Module.cpp ├── Module.h └── OSDep.h ├── LICENSE ├── README.md └── SDK ├── cssdk ├── activity.h ├── alerttype.h ├── archtypes.h ├── basemonster.h ├── basetypes.h ├── buttons.h ├── cbase.h ├── cdstatus.h ├── cldll.h ├── clientdata.h ├── clienttextmessage.h ├── colordef.h ├── const.h ├── crc.h ├── cssdk.h ├── customization.h ├── cvar.h ├── dllfunctions.h ├── edict.h ├── enginecallback.h ├── enginefuncs.h ├── entitystate.h ├── entitytable.h ├── entvars.h ├── eventflags.h ├── fieldtypes.h ├── flags.h ├── forcetype.h ├── globalvars.h ├── hintmessage.h ├── hudtextparms.h ├── keyvaluedata.h ├── krender.h ├── levellist.h ├── link.h ├── localstate.h ├── locksound.h ├── material.h ├── message.h ├── minimath.h ├── monsterevent.h ├── newdllfunctions.h ├── plane.h ├── player.h ├── printtype.h ├── resource.h ├── resourcetype.h ├── saverestore.h ├── sentenceentry.h ├── sequencecommandline.h ├── sequenceentiry.h ├── sequenceentry.h ├── studio.h ├── tempent.h ├── togglestate.h ├── trace.h ├── traceresult.h ├── typedescription.h ├── unisignals.h ├── usetype.h ├── util.h ├── utlmemory.h ├── utlvector.h ├── vector.h ├── weapondata.h ├── weapons.h └── weapontype.h └── metamod ├── dllapi.h ├── engineapi.h ├── gamedllfuncs.h ├── ginfo.h ├── metadllfuncs.h ├── metafunctions.h ├── metaglobals.h ├── metamod.h ├── metares.h ├── mutil.h └── plinfo.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /CSWM/CSWM.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CSWM_H 2 | #define INCLUDE_CSWM_H 3 | 4 | #include "List.h" 5 | #include "182/AMXX.h" 6 | 7 | #if defined WIN32 8 | #define __FC __fastcall 9 | #else 10 | #define __FC 11 | #endif 12 | 13 | typedef void(__FC *FN_WEAPON_SPAWN) (CBasePlayerWeapon *); 14 | typedef BOOL(__FC *FN_WEAPON_DEPLOY) (CBasePlayerWeapon *); 15 | typedef void(__FC *FN_WEAPON_PRIMARYATTACK) (CBasePlayerWeapon *); 16 | typedef void(__FC *FN_WEAPON_SECONDARYATTACK) (CBasePlayerWeapon *); 17 | typedef void(__FC *FN_WEAPON_RELOAD) (CBasePlayerWeapon *); 18 | typedef void(__FC *FN_WEAPON_POSTFRAME) (CBasePlayerWeapon *); 19 | typedef void(__FC *FN_WEAPON_IDLE) (CBasePlayerWeapon *); 20 | typedef float(__FC *FN_WEAPON_GET_MAXSPEED) (CBasePlayerWeapon *); 21 | typedef void(__FC *FN_WEAPON_PLAY_EMPTY_SOUND) (CBasePlayerWeapon *); 22 | typedef void(__FC *FN_WEAPON_RESET_EMPTY_SOUND) (CBasePlayerWeapon *); 23 | typedef void(__FC *FN_WEAPONBOX_SPAWN) (CWeaponBox *); 24 | typedef void(__FC *FN_GRENADE_SPAWN) (CGrenade *); 25 | typedef void(__FC *FN_THINK) (CBaseEntity *); 26 | 27 | #if defined _WIN32 28 | typedef BOOL(__FC *FN_WEAPON_ADDTOPLAYER) (CBasePlayerWeapon *, int, CBasePlayer *); 29 | typedef void(__fastcall *FN_WEAPON_HOLSTER) (CBasePlayerWeapon *, int, int); 30 | typedef int(__fastcall *FN_WEAPON_EXTRACT_AMMO) (CBasePlayerWeapon *, int, CBasePlayerWeapon *); 31 | typedef void(__fastcall *FN_WEAPON_SEND_WEAPON_ANIM) (CBasePlayerWeapon *, int, int, int); 32 | typedef BOOL(__fastcall *FN_TAKEDAMAGE) (CBaseEntity *, int, entvars_t *, entvars_t *, float, int); 33 | typedef void(__fastcall *FN_TRACEATTACK) (CBaseEntity *, int, entvars_t *, float, Vector, TraceResult *, int); 34 | typedef void(__fastcall *FN_TOUCH) (CBaseEntity *, int, CBaseEntity *); 35 | #else 36 | typedef BOOL(__FC *FN_WEAPON_ADDTOPLAYER) (CBasePlayerWeapon *, CBasePlayer *); 37 | typedef void(*FN_WEAPON_HOLSTER) (CBasePlayerWeapon *, int); 38 | typedef int(*FN_WEAPON_EXTRACT_AMMO) (CBasePlayerWeapon *, CBasePlayerWeapon *); 39 | typedef void(*FN_WEAPON_SEND_WEAPON_ANIM) (CBasePlayerWeapon *, int, int); 40 | typedef BOOL(*FN_TAKEDAMAGE) (CBaseEntity *, entvars_t *, entvars_t *, float, int); 41 | typedef void(*FN_TRACEATTACK) (CBaseEntity *, entvars_t *, float, Vector, TraceResult *, int); 42 | typedef void(*FN_TOUCH) (CBaseEntity *, CBaseEntity *); 43 | #endif 44 | 45 | /* Only Used To Call/Declare Multiple Argument Based Functions */ 46 | 47 | #if defined _WIN32 48 | #define DECLFUNC_OS(Return, Name, First, ...) Return __fastcall Name(First, int, ##__VA_ARGS__) 49 | #define CALLFUNC_OS(Function, First, ...) Function(First, 0, ##__VA_ARGS__) 50 | #define CALLFUNC_GAME(Type, Function, Caller, ...) ((Type)Function)(Caller, 0, ##__VA_ARGS__) 51 | #else 52 | #define DECLFUNC_OS(Return, Name, First, ...) Return Name(First, ##__VA_ARGS__) 53 | #define CALLFUNC_OS(Function, First, ...) Function(First, ##__VA_ARGS__) 54 | #define CALLFUNC_GAME(Type, Function, Caller, ...) ((Type)Function)(Caller, ##__VA_ARGS__) 55 | #endif 56 | 57 | enum 58 | { 59 | DETECT_DRAW, 60 | DETECT_SHOOT, 61 | DETECT_RELOAD, 62 | }; 63 | 64 | enum 65 | { 66 | BUILD_VIEW, 67 | BUILD_WEAP, 68 | BUILD_WORLD, 69 | BUILD_LIST, 70 | }; 71 | 72 | enum 73 | { 74 | PLIMITED_TOUCH = 1, 75 | PLIMITED_TIME, 76 | }; 77 | 78 | enum 79 | { 80 | ELIMITED_TIME = 1, 81 | }; 82 | 83 | enum WType 84 | { 85 | Pistol, 86 | Shotgun, 87 | Rifle, 88 | Sniper, 89 | }; 90 | 91 | enum WForward 92 | { 93 | SpawnPre, 94 | SpawnPost, 95 | DeployPre, 96 | DeployPrePost, 97 | DeployPost, 98 | PrimaryAttackPre, 99 | PrimaryAttackPrePost, 100 | PrimaryAttackPost, 101 | SecondaryAttackPre, 102 | SecondaryAttackPost, 103 | ReloadPre, 104 | ReloadPost, 105 | HolsterPost, 106 | DropPost, 107 | DamagePre, 108 | DamagePost, 109 | MAX_WEAPON_FORWARDS, 110 | }; 111 | 112 | enum WReturn 113 | { 114 | IGNORED, 115 | SUPERCEDE, 116 | }; 117 | 118 | enum WShotgunReloadType 119 | { 120 | M3Style = -1, 121 | XM1014Style, 122 | RifleStyle, 123 | }; 124 | 125 | enum WData 126 | { 127 | WD_VModel, 128 | WD_PModel, 129 | WD_Model, 130 | WD_Name, 131 | WD_FireSound, 132 | WD_WModel, 133 | WD_GModel, 134 | WD_Type, 135 | WD_AnimD, 136 | WD_AnimS, 137 | WD_AnimR, 138 | WD_Clip, 139 | WD_AmmoID, 140 | WD_Deploy, 141 | WD_Reload, 142 | WD_Delay, 143 | WD_Damage, 144 | WD_Recoil, 145 | WD_Flags, 146 | WD_A2I, 147 | WD_Speed, 148 | WD_Forwards, 149 | WD_DurationList, 150 | }; 151 | 152 | enum WEData 153 | { 154 | WED_Custom, 155 | WED_FID, 156 | WED_Key, 157 | WED_CurBurst, 158 | WED_A2, 159 | WED_A2_Offset, 160 | WED_INA2, 161 | WED_INA2_Delay, 162 | WED_INBurst, 163 | WED_Flags, 164 | }; 165 | 166 | enum WLimit 167 | { 168 | MAX_WEAPON_TYPES = 4, 169 | MAX_HOOKS = 12, 170 | MAX_MODEL_NAME = 24, 171 | MAX_MODEL_PATH_NAME = 64, 172 | }; 173 | 174 | enum 175 | { 176 | Zoom_Rifle, 177 | Zoom_SniperF, 178 | Zoom_SniperS, 179 | Zoom_SniperB, 180 | }; 181 | 182 | enum WAttack2 183 | { 184 | A2_None, 185 | A2_Zoom, 186 | A2_Switch, 187 | A2_Burst, 188 | A2_MultiShot, 189 | A2_AutoPistol, 190 | A2_KnifeAttack, 191 | A2_InstaSwitch, 192 | A2_ZoomCustom, 193 | }; 194 | 195 | struct Attack2; 196 | 197 | #define WA2_ZOOM_MODE 0 198 | 199 | #define WA2_SWITCH_ANIM_A 0 200 | #define WA2_SWITCH_ANIM_B 1 201 | #define WA2_SWITCH_ANIM_IDLE 2 202 | #define WA2_SWITCH_ANIM_DRAW 3 203 | #define WA2_SWITCH_ANIM_SHOOT 4 204 | #define WA2_SWITCH_ANIM_RELOAD 5 205 | #define WA2_SWITCH_ANIM_A_DURATION 6 206 | #define WA2_SWITCH_ANIM_B_DURATION 7 207 | #define WA2_SWITCH_ANIM_DRAW_DURATION 8 208 | #define WA2_SWITCH_ANIM_SHOOT_DURATION 9 209 | #define WA2_SWITCH_ANIM_RELOAD_DURATION 10 210 | #define WA2_SWITCH_DELAY 11 211 | #define WA2_SWITCH_DAMAGE 12 212 | #define WA2_SWITCH_RECOIL 13 213 | #define WA2_SWITCH_FSOUND 14 214 | 215 | #define WA2_BURST_VALUE 0 216 | 217 | #define WA2_MULTISHOT_VALUE 0 218 | 219 | #define WA2_AUTOPISTOL_ANIM 0 220 | #define WA2_AUTOPISTOL_DELAY 1 221 | #define WA2_AUTOPISTOL_RECOIL 2 222 | 223 | #define WA2_KNIFEATTACK_ANIMATION 0 224 | #define WA2_KNIFEATTACK_DELAY 1 225 | #define WA2_KNIFEATTACK_DURATION 2 226 | #define WA2_KNIFEATTACK_RADIUS 3 227 | #define WA2_KNIFEATTACK_DAMAGE_MIN 4 228 | #define WA2_KNIFEATTACK_DAMAGE_MAX 5 229 | #define WA2_KNIFEATTACK_KNOCKBACK 6 230 | #define WA2_KNIFEATTACK_MULTI 7 231 | #define WA2_KNIFEATTACK_SOUND 8 232 | 233 | #define WA2_INSTASWITCH_ANIM_SHOOT 0 234 | #define WA2_INSTASWITCH_DELAY 1 235 | #define WA2_INSTASWITCH_DAMAGE 2 236 | #define WA2_INSTASWITCH_RECOIL 3 237 | #define WA2_INSTASWITCH_NAME 4 238 | #define WA2_INSTASWITCH_NAME2 5 239 | 240 | #define WA2_ZOOM_CUSTOM_FOV 0 241 | 242 | #define GetAttack2Data(Type, Data, Offset) *(Type *)((int *)Data + Offset) 243 | 244 | struct CWeapon 245 | { 246 | string_t VModel, PModel; 247 | const char *Model, *Name, *FireSound, *WModel, *GModel; 248 | WType Type; 249 | int AnimI; 250 | int AnimD; 251 | List AnimS; 252 | int AnimR; 253 | 254 | int Clip; 255 | AmmoType AmmoID; 256 | 257 | float Deploy; 258 | float Reload; 259 | float Delay; 260 | float Damage; 261 | float Recoil; 262 | 263 | int Flags; 264 | int A2I; 265 | Attack2 *A2V; 266 | float Speed; 267 | cell Forwards[MAX_WEAPON_FORWARDS]; 268 | List DurationList; 269 | int WBody; 270 | }; 271 | 272 | struct CAmmo 273 | { 274 | int Cost; 275 | int Amount; 276 | int Max; 277 | const char *Name; 278 | }; 279 | 280 | struct CProjectile 281 | { 282 | const char *Model; 283 | float Gravity; 284 | float Speed; 285 | float Duration; 286 | cell Forward; 287 | }; 288 | 289 | struct CEffect 290 | { 291 | const char *Model; 292 | string_t ModelIndex; 293 | float Speed; 294 | float Duration; 295 | cell Forward; 296 | }; 297 | 298 | struct CCleaveDamageInfo 299 | { 300 | Vector Origin; 301 | Vector VAngles; 302 | float FOV; 303 | BOOL Accurate; 304 | float Damage; 305 | float Radius; 306 | entvars_t *Inflictor; 307 | entvars_t *Attacker; 308 | int DamageType; 309 | }; 310 | 311 | struct CKnockbackInfo 312 | { 313 | float PushPower; 314 | float JumpPower; 315 | }; 316 | 317 | struct CParam 318 | { 319 | char *Name; 320 | int Type; 321 | int Offset; 322 | }; 323 | 324 | enum ParamType 325 | { 326 | TYPE_INT, 327 | TYPE_FLOAT, 328 | TYPE_STRING, 329 | TYPE_ARRAY, 330 | TYPE_STRINT, 331 | TYPE_OTHER1, 332 | TYPE_OTHER2, 333 | TYPE_OTHER3, 334 | }; 335 | 336 | enum ZoomType 337 | { 338 | CS_SECOND_AWP_ZOOM = 10, 339 | CS_SECOND_NONAWP_ZOOM = 15, 340 | CS_FIRST_ZOOM = 40, 341 | CS_AUGSG552_ZOOM = 55, 342 | CS_NO_ZOOM = 90, 343 | }; 344 | 345 | #define IS_USER_ALIVE(x) (x->v.deadflag == DEAD_NO) && (x->v.health > 0) 346 | #define IS_USER_DEAD(x) (x->v.deadflag != DEAD_NO) || (x->v.health < 1) 347 | 348 | extern edict_t *SVGame_Edicts; 349 | #define NUM_FOR_EDICT(Edict) (int)(Edict - SVGame_Edicts) 350 | #define EDICT_FOR_NUM(Edict) (SVGame_Edicts + Edict) 351 | 352 | #define BIT(x) (1 << x) 353 | 354 | enum WFlag 355 | { 356 | NoHUD = BIT(0), 357 | AutoReload = BIT(1), 358 | NoDecal = BIT(2), 359 | NoSmoke = BIT(3), 360 | ShotgunCustomReloadSound = BIT(4), 361 | CustomPrimaryAttack = BIT(5), 362 | AutoSniper = BIT(6), 363 | CustomIdleAnim = BIT(7), 364 | SoloClip = BIT(8), 365 | DisableReload = BIT(9), 366 | ReloadKeepFOV = BIT(10), 367 | 368 | Zoom_NoSound = BIT(10), 369 | ZoomCustom_NoSound = BIT(10), 370 | SwitchMode_BarTime = BIT(10), 371 | SwitchMode_NoText = BIT(11), 372 | AutoPistol_NoSceenShake = BIT(10), 373 | KnifeAttack_ScreenShake = BIT(10), 374 | KnifeAttack_Penetration = BIT(11), 375 | KnifeAttack_Accurate = BIT(12), 376 | KnifeAttack_Knockback = BIT(13), 377 | KnifeAttack_NoSound = BIT(14), 378 | }; 379 | 380 | enum RDFlag 381 | { 382 | Penetration = BIT(0), 383 | IgnoreSelf = BIT(1), 384 | Knockback = BIT(2), 385 | KnockAny = BIT(3), 386 | }; 387 | 388 | enum 389 | { 390 | XM1014_IDLE, 391 | XM1014_FIRE1, 392 | XM1014_FIRE2, 393 | XM1014_RELOAD, 394 | XM1014_PUMP, 395 | XM1014_START_RELOAD, 396 | XM1014_DRAW, 397 | }; 398 | 399 | inline BOOL InvalidEntity(edict_t *Edict) 400 | { 401 | if (!Edict || !Edict->pvPrivateData) 402 | return TRUE; 403 | 404 | return FALSE; 405 | } 406 | 407 | #define GetAMXAddr(ValueA, ValueB) (cell *)(ValueA->base + (int)(((AMX_HEADER *)ValueA->base)->dat + ValueB)) 408 | #define CellToFloat(Value) (*(REAL *)&Value) 409 | #define FloatToCell(Value) (*(cell *)&Value) 410 | 411 | #ifndef VectorSub 412 | inline void VectorSub(Vector &InA, Vector &InB, Vector &Out) 413 | { 414 | Out.x = InA.x - InB.x; 415 | Out.y = InA.y - InB.y; 416 | Out.z = InA.z - InB.z; 417 | } 418 | #endif 419 | 420 | #ifndef VectorMulScalar 421 | inline void VectorMulScalar(Vector &InA, float Scale, Vector &Out) 422 | { 423 | Out.x = InA.x * Scale; 424 | Out.y = InA.y * Scale; 425 | Out.z = InA.z * Scale; 426 | } 427 | #endif 428 | 429 | #ifndef VectorSum 430 | inline void VectorSum(Vector &InA, Vector &InB, Vector &Out) 431 | { 432 | Out.x = InA.x + InB.x; 433 | Out.y = InA.y + InB.y; 434 | Out.z = InA.z + InB.z; 435 | } 436 | #endif 437 | 438 | 439 | extern size_t PEV_Offset; 440 | /* Entity Vars From Private Data */ 441 | #define EV_FROM_PD(Data) (*(entvars_t **)((char *)Data + PEV_Offset)) 442 | /* Edict From Private Data */ 443 | #define ED_FROM_PD(Data) (*(entvars_t **)((char *)Data + PEV_Offset))->pContainingEntity 444 | /* Edict Index From Private Data */ 445 | #define EDI_FROM_PD(Data) NUM_FOR_EDICT((*(entvars_t **)((char *)Data + PEV_Offset))->pContainingEntity) 446 | 447 | #ifdef _WIN32 448 | #define GetPrivateData(Type, Data, Offset, Diff) (*(Type *)((char *)Data + Offset)) 449 | #define GetPrivateDataEx(Type, Data, Offset1, Offset2, Diff) (*(Type *)((char *)Data + Offset1 + Offset2 * 4)) 450 | #define GetPrivateDataPointer(Type, Data, Offset, Diff) (Type *)((char *)Data + Offset) 451 | #else 452 | #define GetPrivateData(Type, Data, Offset, Diff) (*(Type *)((char *)Data + Offset + (Diff * 4))) 453 | #define GetPrivateDataEx(Type, Data, Offset1, Offset2, Diff) (*(Type *)((char *)Data + Offset1 + Offset2 * 4 + (Diff * 4))) 454 | #define GetPrivateDataPointer(Type, Data, Offset, Diff) (Type *)((char *)Data + Offset + (Diff * 4)) 455 | #endif 456 | 457 | #define CUSTOM_WEAPON(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_Ammo338MAG, 5) 458 | #define WEAPON_FID(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_Ammo57MM, 5) 459 | #define WEAPON_KEY(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_AmmoBuckshot, 5) 460 | #define WEAPON_CURBURST(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_Ammo556Nato, 5) 461 | 462 | #define WEAPON_A2(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_MaxAmmo57MM, 5) 463 | #define WEAPON_A2_OFFSET(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_Ammo9MM, 5) 464 | #define WEAPON_INA2(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_MaxAmmo50AE, 5) 465 | #define WEAPON_INA2_DELAY(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_MaxAmmo762Nato, 5) 466 | 467 | #define WEAPON_INBURST(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_MaxAmmo556Nato, 5) 468 | #define WEAPON_FLAGS(BaseWeapon) GetPrivateData(int, BaseWeapon, CBaseEntity_MaxAmmo338MAG, 5) 469 | #define WEAPON_KEY_EX(BaseWeaponEnt) BaseWeaponEnt->v.iuser3 470 | #define WEAPON_CLIP(BaseWeapon) GetPrivateData(int, BaseWeapon, CBasePlayerWeapon_Clip, 4) 471 | #define WEAPON_ID(BaseWeapon) GetPrivateData(int, BaseWeapon, CBasePlayerItem_ID, 4) 472 | #define WEAPON_AMMO_TYPE(BaseWeapon) GetPrivateData(int, BaseWeapon, CBasePlayerWeapon_PrimaryAmmoType, 4) 473 | 474 | #define PROJECTILE_TYPE(BaseEntity) GetPrivateData(int, BaseEntity, CBaseEntity_Ammo338MAG, 5) 475 | #define PROJECTILE_FORWARD(BaseWeaponEnt) GetPrivateData(int, BaseEntity, CBaseEntity_MaxAmmo338MAG, 5) 476 | #define EFFECT_TYPE(BaseEntity) GetPrivateData(int, BaseEntity, CBaseEntity_Ammo338MAG, 5) 477 | #define EFFECT_FORWARD(BaseWeaponEnt) GetPrivateData(int, BaseEntity, CBaseEntity_MaxAmmo338MAG, 5) 478 | #define EFFECT_EXPIRE_TIME(BaseEntity) EV_FROM_PD(BaseEntity)->fuser4 479 | #define EFFECT_MAX_FRAMES(EntityVars) EntityVars->fuser3 480 | #define EFFECT_LAST_TIME(EntityVars) EntityVars->fuser2 481 | 482 | 483 | // CSWM.cpp 484 | 485 | edict_t *GiveWeaponByName(edict_t *PlayerEdict, const char *Name); 486 | edict_t *GiveWeapon(edict_t *PlayerEdict, int Index); 487 | void UpdateAmmoList(); 488 | void SendWeaponAnim(CBasePlayerWeapon *BaseWeapon, int Anim); 489 | cell ShootProjectileTimed(edict_t *LauncherEdict, int ProjectileID); 490 | cell ShootProjectileContact(edict_t *LauncherEdict, int ProjectileID); 491 | cell ShootEffect(edict_t *LauncherEdict, int EffectID); 492 | int Player_GiveAmmoByID(CBasePlayer *BasePlayer, int AmmoID, int Amount); 493 | void PlayerKnockback(edict_t *VictimEdict, Vector &Origin); 494 | BOOL InViewCone(edict_t *PlayerEdict, Vector &Origin, BOOL Accurate); 495 | BOOL InViewCone(Vector &SelfOrigin, Vector &VAngles, float FOV, Vector &Origin, BOOL Accurate); 496 | 497 | // Attack2-CSWM.cpp 498 | 499 | static void Attack2_Zoom(CBasePlayer *BasePlayer, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 500 | static void Attack2_Switch(CBasePlayer *BasePlayer, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 501 | static void Attack2_Burst(CBasePlayer *BasePlayer, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 502 | static void Attack2_MultiShot(CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 503 | static void Attack2_KnifeAttack(CBasePlayer *BasePlayer, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 504 | static void Attack2_KnifeAttackPerform(CBasePlayerWeapon *BaseWeapon); 505 | static void Attack2_InstaSwitch(edict_t *Playeredict, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 506 | static void Attack2_ZoomCustom(CBasePlayer *BasePlayer, CBasePlayerWeapon *BaseWeapon, CWeapon &Weapon); 507 | 508 | // Module.cpp 509 | 510 | void LoadAmmos(void); 511 | void LoadWeapons(void); 512 | void SetAnimation(edict_t *PlayerEdict, int Animation, Activity ACT, float FrameRate); 513 | void CheckAmmo(CAmmo &Ammo, int Index); 514 | void CheckWeapon(CWeapon &Weapon); 515 | void RecordWeaponDurationList(CWeapon &Weapon); 516 | 517 | #endif -------------------------------------------------------------------------------- /CSWM/CSWM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSWM", "CSWM\CSWM.vcxproj", "{88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Debug|x64.ActiveCfg = Release|Win32 17 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Debug|x64.Build.0 = Release|Win32 18 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Debug|x86.ActiveCfg = Release|Win32 19 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Debug|x86.Build.0 = Release|Win32 20 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Release|x64.ActiveCfg = Release|Win32 21 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Release|x64.Build.0 = Release|Win32 22 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Release|x86.ActiveCfg = Release|Win32 23 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {B041B6C6-D6E7-48B0-A911-50960C78958F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /CSWM/CSWM/CSWM.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {88C50D10-FE42-4BE5-A9E2-9922FC3C29B8} 23 | CSWM 24 | 8.1 25 | 26 | 27 | 28 | DynamicLibrary 29 | true 30 | v120 31 | NotSet 32 | false 33 | 34 | 35 | DynamicLibrary 36 | false 37 | v120 38 | true 39 | NotSet 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v141 51 | true 52 | NotSet 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | D:\CSDS\cstrike\addons\amxmodx\modules\ 74 | D:\CSDS\cstrike\addons\amxmodx\modules\int_cswm\ 75 | ..\;..\18X;..\..\SDK\;..\..\SDK\public;..\..\SDK\public\amtl;..\..\SDK\metamod;..\..\SDK\cssdk;..\..\SDK\cssdk\public;..\..\SDK\cssdk\pm_shared;..\..\SDK\cssdk\game_shared;..\..\SDK\cssdk\engine;..\..\SDK\cssdk\dlls;..\..\SDK\cssdk\common;$(IncludePath) 76 | cswm_amxx 77 | true 78 | AllRules.ruleset 79 | 80 | 81 | false 82 | 83 | 84 | D:\CSDS\cstrike\addons\amxmodx\modules\ 85 | D:\CSDS\cstrike\addons\amxmodx\modules\int_cswm\ 86 | cswm_amxx 87 | ..\;..\..\SDK\;..\..\SDK\cssdk\;..\..\SDK\metamod\;$(IncludePath) 88 | AllRules.ruleset 89 | 90 | 91 | false 92 | 93 | 94 | D:\CSDS\cstrike\addons\amxmodx\modules\ 95 | D:\CSDS\cstrike\addons\amxmodx\modules\int_cswm\ 96 | cswm_amxx 97 | ..\;..\18X;..\..\SDK\;..\..\SDK\public;..\..\SDK\public\amtl;..\..\SDK\metamod;..\..\SDK\cssdk;..\..\SDK\cssdk\public;..\..\SDK\cssdk\pm_shared;..\..\SDK\cssdk\game_shared;..\..\SDK\cssdk\engine;..\..\SDK\cssdk\dlls;..\..\SDK\cssdk\common;$(IncludePath) 98 | AllRules.ruleset 99 | 100 | 101 | 102 | 103 | AllRules.ruleset 104 | 105 | 106 | 107 | 108 | 109 | Level4 110 | Disabled 111 | HAVE_STDINT_H;NDEBUG;_NDEBUG;_CRT_SECURE_NO_WARNINGS;__METAMOD_BUILD__;SDK_UTIL_H;%(PreprocessorDefinitions) 112 | %(AdditionalIncludeDirectories);$(IncludePath) 113 | false 114 | 115 | 116 | Default 117 | Speed 118 | false 119 | EditAndContinue 120 | AssemblyAndSourceCode 121 | None 122 | false 123 | 124 | 125 | NoErrorReport 126 | true 127 | $(OutDir)$(TargetName).pdb 128 | false 129 | false 130 | false 131 | false 132 | LinkVerboseCLR 133 | MachineX86 134 | 135 | 136 | 137 | 138 | Level3 139 | Disabled 140 | true 141 | 142 | 143 | 144 | 145 | None 146 | None 147 | %(AdditionalIncludeDirectories);$(IncludePath) 148 | HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 149 | true 150 | Speed 151 | AssemblyAndSourceCode 152 | Full 153 | Level4 154 | false 155 | false 156 | 157 | 158 | NotSet 159 | false 160 | NoErrorReport 161 | 162 | 163 | 164 | true 165 | 166 | 167 | 168 | 169 | Level3 170 | MaxSpeed 171 | true 172 | true 173 | true 174 | None 175 | CSWM_EXPORTS;__METAMOD_BUILD__;HAVE_STDINT_H;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 176 | %(AdditionalIncludeDirectories);$(IncludePath) 177 | 178 | 179 | true 180 | true 181 | false 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /CSWM/CSWM/CSWM.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {3d12a34e-4dfb-475b-8d60-27cfdf038784} 14 | 15 | 16 | {dc7d72f8-d478-499a-92b6-b803d980cf3d} 17 | 18 | 19 | 20 | 21 | 18X 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 18X\AMXX 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | Source Files 48 | 49 | 50 | 18X\AMXX 51 | 52 | 53 | Source Files 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /CSWM/CSWM/CSWM.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CSWM/CSWM/Resource.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kodpact/CSWM/ccf4eabe74bd1b3f05d7975a37aec8deaca2670e/CSWM/CSWM/Resource.aps -------------------------------------------------------------------------------- /CSWM/CSWM/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Resource.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /CSWM/CSWM/Resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kodpact/CSWM/ccf4eabe74bd1b3f05d7975a37aec8deaca2670e/CSWM/CSWM/Resource.rc -------------------------------------------------------------------------------- /CSWM/FakeCMD.cpp: -------------------------------------------------------------------------------- 1 | #include "Module.h" 2 | 3 | #pragma warning (disable : 4459) 4 | 5 | char ArgS[256]; 6 | const char *ArgV[3]; 7 | int ArgC; 8 | BOOL Fake; 9 | 10 | const char *Cmd_Args(void) 11 | { 12 | if (Fake) 13 | RETURN_META_VALUE(MRES_SUPERCEDE, (ArgC > 1) ? ArgS : ArgV[0]); 14 | 15 | RETURN_META_VALUE(MRES_IGNORED, NULL); 16 | } 17 | 18 | const char *Cmd_Argv(int ArgC) 19 | { 20 | if (Fake) 21 | RETURN_META_VALUE(MRES_SUPERCEDE, (ArgC < 3) ? ArgV[ArgC] : ""); 22 | 23 | RETURN_META_VALUE(MRES_IGNORED, NULL); 24 | } 25 | 26 | int Cmd_Argc(void) 27 | { 28 | if (Fake) 29 | RETURN_META_VALUE(MRES_SUPERCEDE, ArgC); 30 | 31 | RETURN_META_VALUE(MRES_IGNORED, 0); 32 | } 33 | 34 | void UTIL_FakeClientCommand(edict_t *PlayerEdict, const char *Command, const char *Arg1, const char *Arg2) 35 | { 36 | ArgV[0] = Command; 37 | 38 | if (Arg2) 39 | { 40 | ArgC = 3; 41 | ArgV[1] = Arg1; 42 | ArgV[2] = Arg2; 43 | sprintf(ArgS, "%s %s", Arg1, Arg2); 44 | } 45 | else if (Arg1) 46 | { 47 | ArgC = 2; 48 | ArgV[1] = Arg1; 49 | sprintf(ArgS, "%s", Arg1); 50 | } 51 | else 52 | { 53 | ArgC = 1; 54 | } 55 | 56 | Fake = TRUE; 57 | MDLL_ClientCommand(PlayerEdict); 58 | Fake = FALSE; 59 | } -------------------------------------------------------------------------------- /CSWM/FakeCMD.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void UTIL_FakeClientCommand(edict_t *PlayerEdict, const char *Command, const char *Arg1 = NULL, const char *Arg2 = NULL); 4 | -------------------------------------------------------------------------------- /CSWM/HEFW.cpp: -------------------------------------------------------------------------------- 1 | #include "Module.h" 2 | 3 | #ifndef _WIN32 4 | #define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1)) 5 | #endif 6 | 7 | extern meta_globals_t *META_GLOBALS; 8 | extern gamedll_funcs_t *META_GAMEDLLFUNCS; 9 | extern mutil_funcs_t *META_UTILFUNCS; 10 | 11 | void HookEntityFW(const char ClassName[], int Offset, void *Function, void **Forward) 12 | { 13 | edict_t *Edict = CREATE_ENTITY(); 14 | CALL_GAME_ENTITY(PLID, ClassName, &Edict->v); 15 | 16 | if (Edict->pvPrivateData == NULL) 17 | { 18 | REMOVE_ENTITY(Edict); 19 | return; 20 | } 21 | 22 | void **VTable = *((void ***)((char *)Edict->pvPrivateData)); 23 | 24 | REMOVE_ENTITY(Edict); 25 | 26 | if (VTable == NULL) 27 | return; 28 | 29 | int **IVTable = (int **)VTable; 30 | 31 | *Forward = (void *)IVTable[Offset]; 32 | 33 | #if defined(_WIN32) 34 | DWORD OldFlags; 35 | VirtualProtect(&IVTable[Offset], sizeof(int *), PAGE_READWRITE, &OldFlags); 36 | #else 37 | void *Address = (void *)ALIGN(&IVTable[Offset]); 38 | mprotect(Address, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE); 39 | #endif 40 | 41 | IVTable[Offset] = (int *)Function; 42 | } 43 | 44 | void HookEntityFWByVTable(void **VTable, int Offset, void *Function, void **Forward) 45 | { 46 | int **IVTable = (int **)VTable; 47 | *Forward = (void *)IVTable[Offset]; 48 | 49 | #if defined(_WIN32) 50 | DWORD OldFlags; 51 | VirtualProtect(&IVTable[Offset], sizeof(int *), PAGE_READWRITE, &OldFlags); 52 | #else 53 | void *Address = (void *)ALIGN(&IVTable[Offset]); 54 | mprotect(Address, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE); 55 | #endif 56 | 57 | IVTable[Offset] = (int *)Function; 58 | } 59 | 60 | void ResetEntityFW(const char ClassName[], int Offset, void *Function, void *Forward) 61 | { 62 | edict_t *Edict = CREATE_ENTITY(); 63 | CALL_GAME_ENTITY(PLID, ClassName, &Edict->v); 64 | 65 | if (Edict->pvPrivateData == NULL) 66 | { 67 | REMOVE_ENTITY(Edict); 68 | return; 69 | } 70 | 71 | void **VTable = *((void ***)((char *)Edict->pvPrivateData)); 72 | int **IVTable = (int **)VTable; 73 | 74 | REMOVE_ENTITY(Edict); 75 | 76 | #if defined(_WIN32) 77 | DWORD OldFlags; 78 | VirtualProtect(&IVTable[Offset], sizeof(int *), PAGE_READWRITE, &OldFlags); 79 | #else 80 | void *Address = (void *)ALIGN(&IVTable[Offset]); 81 | mprotect(Address, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE); 82 | #endif 83 | 84 | IVTable[Offset] = (int *)Forward; 85 | 86 | #if defined(_WIN32) 87 | VirtualFree(Function, 0, MEM_RELEASE); 88 | #else 89 | munmap(Function, sizeof(int)); 90 | #endif 91 | } 92 | 93 | void ResetEntityFWByVTable(void **VTable, int Offset, void *Function, void *&Forward) 94 | { 95 | int **IVTable = (int **)VTable; 96 | 97 | #if defined(_WIN32) 98 | DWORD OldFlags; 99 | VirtualProtect(&IVTable[Offset], sizeof(int *), PAGE_READWRITE, &OldFlags); 100 | #else 101 | void *Address = (void *)ALIGN(&IVTable[Offset]); 102 | mprotect(Address, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE); 103 | #endif 104 | 105 | IVTable[Offset] = (int *)Forward; 106 | 107 | #if defined(_WIN32) 108 | VirtualFree(Function, 0, MEM_RELEASE); 109 | #else 110 | munmap(Function, sizeof(int)); 111 | #endif 112 | } 113 | 114 | void *GetEntityFW(const char ClassName[], int Offset) 115 | { 116 | edict_t *Edict = CREATE_ENTITY(); 117 | CALL_GAME_ENTITY(PLID, ClassName, &Edict->v); 118 | void **VTable = *(void ***)Edict->pvPrivateData; 119 | REMOVE_ENTITY(Edict); 120 | 121 | if (VTable == NULL) 122 | { 123 | LOG_CONSOLE(PLID, "[CSWM] Virtual table is invalid! (Class = '%s', Offset = '%i')", ClassName, Offset); 124 | return NULL; 125 | } 126 | 127 | if (!VTable[Offset]) 128 | { 129 | LOG_CONSOLE(PLID, "[CSWM] Virtual table is invalid! (Update HLDS or remove module)"); 130 | return NULL; 131 | } 132 | 133 | return VTable[Offset]; 134 | } 135 | 136 | -------------------------------------------------------------------------------- /CSWM/HEFW.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void HookEntityFW(const char ClassName[], int Offset, void *Function, void **Forward); 4 | void HookEntityFWByVTable(void **VTable, int Offset, void *Function, void **Forward); 5 | void ResetEntityFW(const char ClassName[], int Offset, void *Function, void *Forward); 6 | void ResetEntityFWByVTable(void **VTable, int Offset, void *Function, void **Forward); 7 | void *GetEntityFW(const char ClassName[], int Offset); 8 | 9 | #include "CStrike.h" -------------------------------------------------------------------------------- /CSWM/HashMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class StringHashMap 6 | { 7 | public: 8 | StringHashMap() 9 | {} 10 | 11 | ~StringHashMap() 12 | { 13 | StringHashNode *Next, *HashNode; 14 | int Index = BucketCount; 15 | 16 | while (Index--) 17 | { 18 | HashNode = Buckets[Index]; 19 | 20 | while (HashNode) 21 | { 22 | Next = HashNode->Next; 23 | free(HashNode); 24 | HashNode = Next; 25 | } 26 | } 27 | 28 | free(Buckets); 29 | } 30 | 31 | BOOL Retrieve(const char *Key, int *Output = NULL) 32 | { 33 | StringHashNode **Result = GetReference(Key); 34 | 35 | if (Result) 36 | { 37 | if (Output) 38 | *Output = (*Result)->Value; 39 | 40 | return TRUE; 41 | } 42 | 43 | return FALSE; 44 | } 45 | 46 | int Insert(const char *Key, int Value) 47 | { 48 | int Index; 49 | StringHashNode **NextHashNode, *HashNode; 50 | 51 | NextHashNode = GetReference(Key); 52 | 53 | if (NextHashNode) 54 | { 55 | (*NextHashNode)->Value = Value; 56 | return 0; 57 | } 58 | 59 | HashNode = CreateNode(Key, Value); 60 | 61 | if (HashNode == NULL) 62 | goto Fail; 63 | 64 | if (NodeCount >= BucketCount) 65 | { 66 | Index = (BucketCount > 0) ? (BucketCount << 1) : 1; 67 | 68 | if (Resize(Index)) 69 | goto Fail; 70 | } 71 | 72 | AddNode(HashNode); 73 | NodeCount++; 74 | return 0; 75 | 76 | Fail: 77 | if (HashNode) 78 | free(HashNode); 79 | 80 | return -1; 81 | } 82 | 83 | void Remove(const char *Key) 84 | { 85 | StringHashNode *HashNode; 86 | StringHashNode **Next = GetReference(Key); 87 | 88 | if (Next) 89 | { 90 | HashNode = *Next; 91 | *Next = (*Next)->Next; 92 | free(HashNode); 93 | NodeCount--; 94 | } 95 | } 96 | 97 | int Length() 98 | { 99 | return NodeCount; 100 | } 101 | 102 | static uint32_t HashValue(const char *Key) 103 | { 104 | uint32_t Hash = 0; 105 | 106 | while (*Key) 107 | Hash = Hash * 101 + *Key++; 108 | 109 | return Hash; 110 | } 111 | 112 | private: 113 | struct StringHashNode 114 | { 115 | char *Key; 116 | int Value; 117 | uint32_t Hash; 118 | StringHashNode *Next; 119 | }; 120 | 121 | StringHashNode **Buckets = NULL; 122 | int BucketCount = 0, NodeCount = 0; 123 | 124 | StringHashNode *CreateNode(const char *Key, int Value) 125 | { 126 | StringHashNode *HashNode; 127 | HashNode = (StringHashNode *)malloc(sizeof(StringHashNode)); 128 | HashNode->Key = strdup(Key); 129 | HashNode->Value = Value; 130 | HashNode->Hash = HashValue(HashNode->Key); 131 | return HashNode; 132 | } 133 | 134 | int GetBucketIndex(uint32_t Hash) 135 | { 136 | return Hash & (BucketCount - 1); 137 | } 138 | 139 | 140 | void AddNode(StringHashNode *HashNode) 141 | { 142 | int Index = GetBucketIndex(HashNode->Hash); 143 | HashNode->Next = Buckets[Index]; 144 | Buckets[Index] = HashNode; 145 | } 146 | 147 | 148 | int Resize(int NewBucketCount) 149 | { 150 | StringHashNode *HashNodes, *HashNode, *Next; 151 | StringHashNode **NewBuckets; 152 | int Index = BucketCount; 153 | 154 | HashNodes = NULL; 155 | 156 | while (Index--) 157 | { 158 | HashNode = (Buckets)[Index]; 159 | 160 | while (HashNode) 161 | { 162 | Next = HashNode->Next; 163 | HashNode->Next = HashNodes; 164 | HashNodes = HashNode; 165 | HashNode = Next; 166 | } 167 | } 168 | 169 | if (!Buckets || *Buckets == NULL) 170 | NewBuckets = (StringHashNode **)malloc(sizeof(*Buckets) * NewBucketCount); 171 | else 172 | NewBuckets = (StringHashNode **)realloc(Buckets, sizeof(*Buckets) * NewBucketCount); 173 | 174 | if (NewBuckets != NULL) 175 | { 176 | Buckets = NewBuckets; 177 | BucketCount = NewBucketCount; 178 | } 179 | 180 | if (Buckets) 181 | { 182 | memset(Buckets, 0, sizeof(*Buckets) * BucketCount); 183 | 184 | HashNode = HashNodes; 185 | 186 | while (HashNode) 187 | { 188 | Next = HashNode->Next; 189 | AddNode(HashNode); 190 | HashNode = Next; 191 | } 192 | } 193 | 194 | return (NewBuckets == NULL) ? -1 : 0; 195 | } 196 | 197 | 198 | StringHashNode **GetReference(const char *Key) 199 | { 200 | uint32_t Hash = HashValue(Key); 201 | StringHashNode **Next; 202 | 203 | if (BucketCount > 0) 204 | { 205 | Next = &Buckets[GetBucketIndex(Hash)]; 206 | 207 | while (*Next) 208 | { 209 | if ((*Next)->Hash == Hash && !strcmp((*Next)->Key, Key)) 210 | return Next; 211 | 212 | Next = &(*Next)->Next; 213 | } 214 | } 215 | return NULL; 216 | } 217 | }; -------------------------------------------------------------------------------- /CSWM/List.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template struct List 4 | { 5 | public: 6 | int Length = 0; 7 | T *Data = NULL; 8 | 9 | template int Append(U &&Item) 10 | { 11 | T *NewData = new T[Length + 1]; 12 | 13 | if (Data) 14 | { 15 | memcpy(NewData, Data, Length * sizeof(T)); 16 | delete[] Data; 17 | } 18 | 19 | Data = NewData; 20 | Data[Length] = Item; 21 | Length++; 22 | return 0; 23 | } 24 | 25 | T& Get(int Index) 26 | { 27 | return Data[Index]; 28 | } 29 | 30 | void Clear() 31 | { 32 | if (Data) 33 | { 34 | delete[] Data; 35 | Data = NULL; 36 | } 37 | 38 | Length = 0; 39 | } 40 | 41 | T& operator[] (int Index) 42 | { 43 | return Data[Index]; 44 | } 45 | }; -------------------------------------------------------------------------------- /CSWM/Makefile: -------------------------------------------------------------------------------- 1 | edit: 2 | g++-4.8 -shared -mtune=i386 -O3 -m32 \ 3 | -I ./ \ 4 | -I ../ \ 5 | -I ../SDK/ \ 6 | -I ../SDK/metamod/ \ 7 | -I ../SDK/cssdk \ 8 | -D HAVE_STDINT_H \ 9 | -D _CRT_SECURE_NO_WARNINGS \ 10 | 182/AMXX.cpp Module.cpp CSWM.cpp HEFW.cpp FakeCMD.cpp \ 11 | -o cswm_amxx_i386.so -------------------------------------------------------------------------------- /CSWM/Module.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "OSDep.h" 5 | 6 | #include "18X/Config.h" 7 | #include "182/AMXX.h" 8 | 9 | #include "cssdk.h" 10 | #include "metamod.h" 11 | 12 | #include "CSWM.h" 13 | #include "CStrike.h" 14 | #include "HEFW.h" 15 | #include "FakeCMD.h" 16 | #include "HashMap.h" 17 | 18 | extern enginefuncs_t g_engfuncs; 19 | extern globalvars_t *gpGlobals; 20 | 21 | extern DLL_FUNCTIONS *g_pFunctionTable; 22 | extern DLL_FUNCTIONS *g_pFunctionTable_Post; 23 | extern enginefuncs_t *g_pengfuncsTable; 24 | extern enginefuncs_t *g_pengfuncsTable_Post; 25 | extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; 26 | extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; 27 | 28 | extern meta_globals_t *META_GLOBALS; 29 | extern gamedll_funcs_t *META_GAMEDLLFUNCS; 30 | extern mutil_funcs_t *META_UTILFUNCS; 31 | -------------------------------------------------------------------------------- /CSWM/OSDep.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_OSDEP_H 2 | #define INCLUDE_OSDEP_B 3 | 4 | #ifdef _WIN32 5 | #include 6 | #else 7 | #include 8 | #include 9 | #include 10 | 11 | #define stricmp strcasecmp 12 | 13 | typedef unsigned long DWORD; 14 | typedef int BOOL; 15 | typedef unsigned char BYTE; 16 | typedef unsigned short WORD; 17 | typedef unsigned char byte; 18 | #endif 19 | 20 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [CSWM](https://forums.alliedmods.net/showthread.php?t=308229) 2 | 3 | Counter-Strike Weapon Mod :gun: 4 | 5 |

6 | 7 | - Infinite amount of weapons 8 | - Custom ammo types 9 | - Presets for Attack2 10 | - Forwards and flags for custom weapon 11 | - For any Mod (ZP, BB, Classic...) 12 | 13 | # [Wiki](https://github.com/BeqaGurgenidze/CSWM/wiki) 14 |
15 | 16 | # Known Issues 17 | - Crosshair isn't working properly. 18 |



19 | -------------------------------------------------------------------------------- /SDK/cssdk/activity.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ACTIVITY_H 2 | #define INCLUDE_ACTIVITY_H 3 | 4 | typedef enum Activity_s 5 | { 6 | ACT_INVALID = -1, 7 | ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity 8 | ACT_IDLE, 9 | ACT_GUARD, 10 | ACT_WALK, 11 | ACT_RUN, 12 | ACT_FLY, 13 | ACT_SWIM, 14 | ACT_HOP, 15 | ACT_LEAP, 16 | ACT_FALL, 17 | ACT_LAND, 18 | ACT_STRAFE_LEFT, 19 | ACT_STRAFE_RIGHT, 20 | ACT_ROLL_LEFT, 21 | ACT_ROLL_RIGHT, 22 | ACT_TURN_LEFT, 23 | ACT_TURN_RIGHT, 24 | ACT_CROUCH, 25 | ACT_CROUCHIDLE, 26 | ACT_STAND, 27 | ACT_USE, 28 | ACT_SIGNAL1, 29 | ACT_SIGNAL2, 30 | ACT_SIGNAL3, 31 | ACT_TWITCH, 32 | ACT_COWER, 33 | ACT_SMALL_FLINCH, 34 | ACT_BIG_FLINCH, 35 | ACT_RANGE_ATTACK1, 36 | ACT_RANGE_ATTACK2, 37 | ACT_MELEE_ATTACK1, 38 | ACT_MELEE_ATTACK2, 39 | ACT_RELOAD, 40 | ACT_ARM, 41 | ACT_DISARM, 42 | ACT_EAT, 43 | ACT_DIESIMPLE, 44 | ACT_DIEBACKWARD, 45 | ACT_DIEFORWARD, 46 | ACT_DIEVIOLENT, 47 | ACT_BARNACLE_HIT, 48 | ACT_BARNACLE_PULL, 49 | ACT_BARNACLE_CHOMP, 50 | ACT_BARNACLE_CHEW, 51 | ACT_SLEEP, 52 | ACT_INSPECT_FLOOR, 53 | ACT_INSPECT_WALL, 54 | ACT_IDLE_ANGRY, 55 | ACT_WALK_HURT, 56 | ACT_RUN_HURT, 57 | ACT_HOVER, 58 | ACT_GLIDE, 59 | ACT_FLY_LEFT, 60 | ACT_FLY_RIGHT, 61 | ACT_DETECT_SCENT, 62 | ACT_SNIFF, 63 | ACT_BITE, 64 | ACT_THREAT_DISPLAY, 65 | ACT_FEAR_DISPLAY, 66 | ACT_EXCITED, 67 | ACT_SPECIAL_ATTACK1, 68 | ACT_SPECIAL_ATTACK2, 69 | ACT_COMBAT_IDLE, 70 | ACT_WALK_SCARED, 71 | ACT_RUN_SCARED, 72 | ACT_VICTORY_DANCE, 73 | ACT_DIE_HEADSHOT, 74 | ACT_DIE_CHESTSHOT, 75 | ACT_DIE_GUTSHOT, 76 | ACT_DIE_BACKSHOT, 77 | ACT_FLINCH_HEAD, 78 | ACT_FLINCH_CHEST, 79 | ACT_FLINCH_STOMACH, 80 | ACT_FLINCH_LEFTARM, 81 | ACT_FLINCH_RIGHTARM, 82 | ACT_FLINCH_LEFTLEG, 83 | ACT_FLINCH_RIGHTLEG, 84 | ACT_FLINCH, 85 | ACT_LARGE_FLINCH, 86 | ACT_HOLDBOMB, 87 | ACT_IDLE_FIDGET, 88 | ACT_IDLE_SCARED, 89 | ACT_IDLE_SCARED_FIDGET, 90 | ACT_FOLLOW_IDLE, 91 | ACT_FOLLOW_IDLE_FIDGET, 92 | ACT_FOLLOW_IDLE_SCARED, 93 | ACT_FOLLOW_IDLE_SCARED_FIDGET, 94 | ACT_CROUCH_IDLE, 95 | ACT_CROUCH_IDLE_FIDGET, 96 | ACT_CROUCH_IDLE_SCARED, 97 | ACT_CROUCH_IDLE_SCARED_FIDGET, 98 | ACT_CROUCH_WALK, 99 | ACT_CROUCH_WALK_SCARED, 100 | ACT_CROUCH_DIE, 101 | ACT_WALK_BACK, 102 | ACT_IDLE_SNEAKY, 103 | ACT_IDLE_SNEAKY_FIDGET, 104 | ACT_WALK_SNEAKY, 105 | ACT_WAVE, 106 | ACT_YES, 107 | ACT_NO, 108 | } Activity; 109 | 110 | typedef struct 111 | { 112 | int type; 113 | char *name; 114 | 115 | } activity_map_t; 116 | 117 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/alerttype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ALERTTYPE_H 2 | #define INCLUDE_ALERTTYPE_H 3 | 4 | enum ALERT_TYPE 5 | { 6 | at_notice, 7 | at_console, // same as at_notice, but forces a ConPrintf, not a message box 8 | at_aiconsole, // same as at_console, but only shown if developer level is 2! 9 | at_warning, 10 | at_error, 11 | at_logged // Server print to console ( only in multiplayer games ). 12 | }; 13 | 14 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/archtypes.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ARCHTYPES_H 2 | #define INCLUDE_ARCHTYPES_H 3 | 4 | #if defined( _WIN32 ) && (! defined( __MINGW32__ )) 5 | typedef __int8 int8; 6 | typedef unsigned __int8 uint8; 7 | typedef __int16 int16; 8 | typedef unsigned __int16 uint16; 9 | typedef __int32 int32; 10 | typedef unsigned __int32 uint32; 11 | typedef __int64 int64; 12 | typedef unsigned __int64 uint64; 13 | typedef __int32 intp; // intp is an integer that can accomodate a pointer 14 | typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) 15 | #else 16 | typedef char int8; 17 | typedef unsigned char uint8; 18 | typedef short int16; 19 | typedef unsigned short uint16; 20 | typedef int int32; 21 | typedef unsigned int uint32; 22 | typedef long long int64; 23 | typedef unsigned long long uint64; 24 | typedef int intp; 25 | typedef unsigned int uintp; 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /SDK/cssdk/basemonster.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_BASEMONSTER_H 2 | #define INCLUDE_BASEMONSTER_H 3 | 4 | class EHANDLE; 5 | 6 | enum MONSTERSTATE 7 | { 8 | MONSTERSTATE_NONE = 0, 9 | MONSTERSTATE_IDLE, 10 | MONSTERSTATE_COMBAT, 11 | MONSTERSTATE_ALERT, 12 | MONSTERSTATE_HUNT, 13 | MONSTERSTATE_PRONE, 14 | MONSTERSTATE_SCRIPT, 15 | MONSTERSTATE_PLAYDEAD, 16 | MONSTERSTATE_DEAD 17 | }; 18 | 19 | class CBaseToggle; 20 | class CBaseMonster; 21 | 22 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/basetypes.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_BASETYPES_H 2 | #define INCLUDE_BASETYPES_H 3 | 4 | #ifndef TRUE 5 | #define FALSE 0 6 | #define TRUE 1 7 | #endif 8 | 9 | #ifndef qboolean 10 | typedef int qboolean; 11 | #endif 12 | 13 | typedef float vec_t; 14 | typedef unsigned int func_t; 15 | typedef unsigned int string_t; 16 | typedef int EOFFSET; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /SDK/cssdk/buttons.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_BUTTONS_H 2 | #define INCLUDE_BUTTONS_H 3 | 4 | enum 5 | { 6 | IN_ATTACK = (1 << 0), 7 | IN_JUMP = (1 << 1), 8 | IN_DUCK = (1 << 2), 9 | IN_FORWARD = (1 << 3), 10 | IN_BACK = (1 << 4), 11 | IN_USE = (1 << 5), 12 | IN_CANCEL = (1 << 6), 13 | IN_LEFT = (1 << 7), 14 | IN_RIGHT = (1 << 8), 15 | IN_MOVELEFT = (1 << 9), 16 | IN_MOVERIGHT = (1 << 10), 17 | IN_ATTACK2 = (1 << 11), 18 | IN_RUN = (1 << 12), 19 | IN_RELOAD = (1 << 13), 20 | IN_ALT1 = (1 << 14), 21 | IN_SCORE = (1 << 15), // Used by client.dll for when scoreboard is held down 22 | }; 23 | 24 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/cbase.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CBASE_H 2 | #define INCLUDE_CBASE_H 3 | 4 | #define MAX_MULTI_TARGETS 16 5 | #define MS_MAX_TARGETS 32 6 | 7 | #define SF_WORLD_DARK 0x0001 // Fade from black at startup 8 | #define SF_WORLD_TITLE 0x0002 // Display game title at startup 9 | #define SF_WORLD_FORCETEAM 0x0004 // Force teams 10 | 11 | class CSave; 12 | class CRestore; 13 | class CBasePlayer; 14 | class CBaseEntity; 15 | class CBaseMonster; 16 | class CBasePlayerItem; 17 | class CSquadMonster; 18 | class CCSEntity; 19 | class CBaseEntity; 20 | class CPointEntity; 21 | class CBaseDelay; 22 | class CBaseAnimating; 23 | class CBaseToggle; 24 | class CBaseButton; 25 | class CMultiSource; 26 | class CWorld; 27 | 28 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/cdstatus.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CDSTATUS_H 2 | #define INCLUDE_CDSTATUS_H 3 | 4 | // CD audio status 5 | typedef struct 6 | { 7 | int fPlaying;// is sound playing right now? 8 | int fWasPlaying;// if not, CD is paused if WasPlaying is true. 9 | int fInitialized; 10 | int fEnabled; 11 | int fPlayLooping; 12 | float cdvolume; 13 | //BYTE remap[100]; 14 | int fCDRom; 15 | int fPlayTrack; 16 | } CDStatus; 17 | 18 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/cldll.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CLDLL_H 2 | #define INCLUDE_CLDLL_H 3 | 4 | #define MAX_WEAPON_SLOTS 5 // hud item selection slots 5 | #define MAX_ITEM_TYPES 6 // hud item selection slots 6 | 7 | #define MAX_ITEMS 4 // hard coded item types 8 | 9 | #define DEFAULT_FOV 90 // the default field of view 10 | 11 | #define HIDEHUD_WEAPONS (1<<0) 12 | #define HIDEHUD_FLASHLIGHT (1<<1) 13 | #define HIDEHUD_ALL (1<<2) 14 | #define HIDEHUD_HEALTH (1<<3) 15 | #define HIDEHUD_TIMER (1<<4) 16 | #define HIDEHUD_MONEY (1<<5) 17 | #define HIDEHUD_CROSSHAIR (1<<6) 18 | #define HIDEHUD_OBSERVER_CROSSHAIR (1<<7) 19 | 20 | #define STATUSICON_HIDE 0 21 | #define STATUSICON_SHOW 1 22 | #define STATUSICON_FLASH 2 23 | 24 | #define HUD_PRINTNOTIFY 1 25 | #define HUD_PRINTCONSOLE 2 26 | #define HUD_PRINTTALK 3 27 | #define HUD_PRINTCENTER 4 28 | #define HUD_PRINTRADIO 5 29 | 30 | #define STATUS_NIGHTVISION_ON 1 31 | #define STATUS_NIGHTVISION_OFF 0 32 | 33 | #define ITEM_STATUS_NIGHTVISION (1<<0) 34 | #define ITEM_STATUS_DEFUSER (1<<1) 35 | 36 | #define SCORE_STATUS_DEAD (1<<0) 37 | #define SCORE_STATUS_BOMB (1<<1) 38 | #define SCORE_STATUS_VIP (1<<2) 39 | 40 | #define SIGNAL_BUY (1<<0) 41 | #define SIGNAL_BOMB (1<<1) 42 | #define SIGNAL_RESCUE (1<<2) 43 | #define SIGNAL_ESCAPE (1<<3) 44 | #define SIGNAL_VIPSAFETY (1<<4) 45 | 46 | // player data iuser3 47 | #define PLAYER_CAN_SHOOT (1<<0) 48 | #define PLAYER_FREEZE_TIME_OVER (1<<1) 49 | #define PLAYER_IN_BOMB_ZONE (1<<2) 50 | #define PLAYER_HOLDING_SHIELD (1<<3) 51 | 52 | #define MENU_KEY_1 (1<<0) 53 | #define MENU_KEY_2 (1<<1) 54 | #define MENU_KEY_3 (1<<2) 55 | #define MENU_KEY_4 (1<<3) 56 | #define MENU_KEY_5 (1<<4) 57 | #define MENU_KEY_6 (1<<5) 58 | #define MENU_KEY_7 (1<<6) 59 | #define MENU_KEY_8 (1<<7) 60 | #define MENU_KEY_9 (1<<8) 61 | #define MENU_KEY_0 (1<<9) 62 | 63 | #define MAX_AMMO_SLOTS 32 // not really slots 64 | 65 | #define HUD_PRINTNOTIFY 1 66 | #define HUD_PRINTCONSOLE 2 67 | #define HUD_PRINTTALK 3 68 | #define HUD_PRINTCENTER 4 69 | 70 | #define WEAPON_SUIT 31 71 | #define WEAPON_ALLWEAPONS (~(1 << WEAPON_SUIT)) 72 | 73 | // custom enum 74 | enum VGUIMenu 75 | { 76 | VGUI_Menu_Team = 2, 77 | VGUI_Menu_MapBriefing = 4, 78 | 79 | VGUI_Menu_Class_T = 26, 80 | VGUI_Menu_Class_CT, 81 | VGUI_Menu_Buy, 82 | VGUI_Menu_Buy_Pistol, 83 | VGUI_Menu_Buy_ShotGun, 84 | VGUI_Menu_Buy_Rifle, 85 | VGUI_Menu_Buy_SubMachineGun, 86 | VGUI_Menu_Buy_MachineGun, 87 | VGUI_Menu_Buy_Item, 88 | }; 89 | 90 | // custom enum 91 | enum VGUIMenuSlot 92 | { 93 | VGUI_MenuSlot_Buy_Pistol = 1, 94 | VGUI_MenuSlot_Buy_ShotGun, 95 | VGUI_MenuSlot_Buy_SubMachineGun, 96 | VGUI_MenuSlot_Buy_Rifle, 97 | VGUI_MenuSlot_Buy_MachineGun, 98 | VGUI_MenuSlot_Buy_PrimAmmo, 99 | VGUI_MenuSlot_Buy_SecAmmo, 100 | VGUI_MenuSlot_Buy_Item, 101 | }; 102 | 103 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/clientdata.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CLIENTDATA_H 2 | #define INCLUDE_CLIENTDATA_H 3 | 4 | #define MAX_PHYSINFO_STRING 256 5 | 6 | typedef struct clientdata_s 7 | { 8 | vec3_t origin; 9 | vec3_t velocity; 10 | 11 | int viewmodel; 12 | vec3_t punchangle; 13 | int flags; 14 | int waterlevel; 15 | int watertype; 16 | vec3_t view_ofs; 17 | float health; 18 | 19 | int bInDuck; 20 | 21 | int weapons; // remove? 22 | 23 | int flTimeStepSound; 24 | int flDuckTime; 25 | int flSwimTime; 26 | int waterjumptime; 27 | 28 | float maxspeed; 29 | 30 | float fov; 31 | int weaponanim; 32 | 33 | int m_iId; 34 | int ammo_shells; 35 | int ammo_nails; 36 | int ammo_cells; 37 | int ammo_rockets; 38 | float m_flNextAttack; 39 | 40 | int tfstate; 41 | 42 | int pushmsec; 43 | 44 | int deadflag; 45 | 46 | char physinfo[ MAX_PHYSINFO_STRING ]; 47 | 48 | // For mods 49 | int iuser1; 50 | int iuser2; 51 | int iuser3; 52 | int iuser4; 53 | float fuser1; 54 | float fuser2; 55 | float fuser3; 56 | float fuser4; 57 | vec3_t vuser1; 58 | vec3_t vuser2; 59 | vec3_t vuser3; 60 | vec3_t vuser4; 61 | } clientdata_t; 62 | 63 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/clienttextmessage.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CLIENTTEXTMESSAGE_H 2 | #define INCLUDE_CLIENTTEXTMESSAGE_H 3 | 4 | typedef struct client_textmessage_s 5 | { 6 | int effect; 7 | byte r1, g1, b1, a1; 8 | byte r2, g2, b2, a2; 9 | float x; 10 | float y; 11 | float fadein; 12 | float fadeout; 13 | float holdtime; 14 | float fxtime; 15 | const char *pName; 16 | const char *pMessage; 17 | } client_textmessage_t; 18 | 19 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/colordef.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_COLORDEF_H 2 | #define INCLUDE_COLORDEF_H 3 | 4 | typedef struct 5 | { 6 | byte r, g, b; 7 | } color24; 8 | 9 | typedef struct 10 | { 11 | unsigned r, g, b, a; 12 | } colorVec; 13 | 14 | typedef struct 15 | { 16 | unsigned short r, g, b, a; 17 | } PackedColorVec; 18 | 19 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/const.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CONST_H 2 | #define INCLUDE_CONST_H 3 | 4 | // Max # of clients allowed in a server. 5 | #define MAX_CLIENTS 32 6 | 7 | // How many bits to use to encode an edict. 8 | #define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts 9 | // Max # of edicts in a level (2048) 10 | #define MAX_EDICTS (1<movetype values 27 | #define MOVETYPE_NONE 0 // never moves 28 | //#define MOVETYPE_ANGLENOCLIP 1 29 | //#define MOVETYPE_ANGLECLIP 2 30 | #define MOVETYPE_WALK 3 // Player only - moving on the ground 31 | #define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this 32 | #define MOVETYPE_FLY 5 // No gravity, but still collides with stuff 33 | #define MOVETYPE_TOSS 6 // gravity/collisions 34 | #define MOVETYPE_PUSH 7 // no clip to world, push and crush 35 | #define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity 36 | #define MOVETYPE_FLYMISSILE 9 // extra size to monsters 37 | #define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces 38 | #define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity 39 | #define MOVETYPE_FOLLOW 12 // track movement of aiment 40 | #define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision) 41 | 42 | // edict->solid values 43 | // NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves 44 | // SOLID only effects OTHER entities colliding with this one when they move - UGH! 45 | #define SOLID_NOT 0 // no interaction with other objects 46 | #define SOLID_TRIGGER 1 // touch on edge, but not blocking 47 | #define SOLID_BBOX 2 // touch on edge, block 48 | #define SOLID_SLIDEBOX 3 // touch on edge, but not an onground 49 | #define SOLID_BSP 4 // bsp clip, touch on edge, block 50 | #define SOLID_CUSTOM 5 51 | 52 | // edict->deadflag values 53 | #define DEAD_NO 0 // alive 54 | #define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground 55 | #define DEAD_DEAD 2 // dead. lying still. 56 | #define DEAD_RESPAWNABLE 3 57 | #define DEAD_DISCARDBODY 4 58 | 59 | #define DAMAGE_NO 0 60 | #define DAMAGE_YES 1 61 | #define DAMAGE_AIM 2 62 | 63 | // entity effects 64 | #define EF_BRIGHTFIELD 1 // swirling cloud of particles 65 | #define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0 66 | #define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin 67 | #define EF_DIMLIGHT 8 // player flashlight 68 | #define EF_INVLIGHT 16 // get lighting from ceiling 69 | #define EF_NOINTERP 32 // don't interpolate the next frame 70 | #define EF_LIGHT 64 // rocket flare glow sprite 71 | #define EF_NODRAW 128 // don't draw entity 72 | #define EF_NIGHTVISION 256 // player nightvision 73 | #define EF_SNIPERLASER 512 // sniper laser effect 74 | #define EF_FIBERCAMERA 1024// fiber camera 75 | 76 | // contents of a spot in the world 77 | #define CONTENTS_EMPTY -1 78 | #define CONTENTS_SOLID -2 79 | #define CONTENTS_WATER -3 80 | #define CONTENTS_SLIME -4 81 | #define CONTENTS_LAVA -5 82 | #define CONTENTS_SKY -6 83 | /* These additional contents constants are defined in bspfile.h 84 | #define CONTENTS_ORIGIN -7 // removed at csg time 85 | #define CONTENTS_CLIP -8 // changed to contents_solid 86 | #define CONTENTS_CURRENT_0 -9 87 | #define CONTENTS_CURRENT_90 -10 88 | #define CONTENTS_CURRENT_180 -11 89 | #define CONTENTS_CURRENT_270 -12 90 | #define CONTENTS_CURRENT_UP -13 91 | #define CONTENTS_CURRENT_DOWN -14 92 | 93 | #define CONTENTS_TRANSLUCENT -15 94 | */ 95 | #define CONTENTS_LADDER -16 96 | 97 | #define CONTENT_FLYFIELD -17 98 | #define CONTENT_GRAVITY_FLYFIELD -18 99 | #define CONTENT_FOG -19 100 | 101 | #define CONTENT_EMPTY -1 102 | #define CONTENT_SOLID -2 103 | #define CONTENT_WATER -3 104 | #define CONTENT_SLIME -4 105 | #define CONTENT_LAVA -5 106 | #define CONTENT_SKY -6 107 | 108 | // channels 109 | #define CHAN_AUTO 0 110 | #define CHAN_WEAPON 1 111 | #define CHAN_VOICE 2 112 | #define CHAN_ITEM 3 113 | #define CHAN_BODY 4 114 | #define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area 115 | #define CHAN_STATIC 6 // allocate channel from the static area 116 | #define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network 117 | #define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). 118 | #define CHAN_BOT 501 // channel used for bot chatter. 119 | 120 | // attenuation values 121 | #define ATTN_NONE 0 122 | #define ATTN_NORM 0.8f 123 | #define ATTN_IDLE 2.f 124 | #define ATTN_STATIC 1.25f 125 | 126 | // pitch values 127 | #define PITCH_NORM 100 // non-pitch shifted 128 | #define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high 129 | #define PITCH_HIGH 120 130 | 131 | // volume values 132 | #define VOL_NORM 1.0 133 | 134 | // plats 135 | #define PLAT_LOW_TRIGGER 1 136 | 137 | // Trains 138 | #define SF_TRAIN_WAIT_RETRIGGER 1 139 | #define SF_TRAIN_START_ON 4 // Train is initially moving 140 | #define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains 141 | 142 | // Break Model Defines 143 | 144 | #define BREAK_TYPEMASK 0x4F 145 | #define BREAK_GLASS 0x01 146 | #define BREAK_METAL 0x02 147 | #define BREAK_FLESH 0x04 148 | #define BREAK_WOOD 0x08 149 | 150 | #define BREAK_SMOKE 0x10 151 | #define BREAK_TRANS 0x20 152 | #define BREAK_CONCRETE 0x40 153 | #define BREAK_2 0x80 154 | 155 | // Colliding temp entity sounds 156 | 157 | #define BOUNCE_GLASS BREAK_GLASS 158 | #define BOUNCE_METAL BREAK_METAL 159 | #define BOUNCE_FLESH BREAK_FLESH 160 | #define BOUNCE_WOOD BREAK_WOOD 161 | #define BOUNCE_SHRAP 0x10 162 | #define BOUNCE_SHELL 0x20 163 | #define BOUNCE_CONCRETE BREAK_CONCRETE 164 | #define BOUNCE_SHOTSHELL 0x80 165 | 166 | // Temp entity bounce sound types 167 | #define TE_BOUNCE_NULL 0 168 | #define TE_BOUNCE_SHELL 1 169 | #define TE_BOUNCE_SHOTSHELL 2 170 | 171 | #define eoNullEntity 0 // Testing the three types of "entity" for nullity 172 | #define iStringNull 0 // Testing strings for nullity 173 | 174 | #define cchMapNameMost 32 175 | 176 | #define CBSENTENCENAME_MAX 16 177 | #define CVOXFILESENTENCEMAX 1536 // max number of sentences in game. NOTE: this must match CVOXFILESENTENCEMAX in engine\sound.h 178 | 179 | #define GROUP_OP_AND 0 180 | #define GROUP_OP_NAND 1 181 | 182 | // Use this instead of ALLOC_STRING on constant strings 183 | #define STRING(offset) (const char *)((const char *)gpGlobals->pStringBase + (int)(offset)) 184 | #define MAKE_STRING(str) ((intptr_t)(str) - (intptr_t)(STRING(0))) 185 | 186 | // Dot products for view cone checking 187 | #define VIEW_FIELD_FULL -1.0 // +-180 degrees 188 | #define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks 189 | #define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks 190 | #define VIEW_FIELD_ULTRA_NARROW 0.9 // +-25 degrees, more narrow check used to set up ranged attacks 191 | 192 | #define SND_SPAWNING (1<<8) // duplicated in protocol.h we're spawing, used in some cases for ambients 193 | #define SND_STOP (1<<5) // duplicated in protocol.h stop sound 194 | #define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol 195 | #define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch 196 | 197 | // All monsters need this data 198 | #define DONT_BLEED -1 199 | #define BLOOD_COLOR_RED (byte)247 200 | #define BLOOD_COLOR_YELLOW (byte)195 201 | #define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW 202 | 203 | #define GERMAN_GIB_COUNT 4 204 | #define HUMAN_GIB_COUNT 6 205 | #define ALIEN_GIB_COUNT 4 206 | 207 | #define LANGUAGE_ENGLISH 0 208 | #define LANGUAGE_GERMAN 1 209 | #define LANGUAGE_FRENCH 2 210 | #define LANGUAGE_BRITISH 3 211 | 212 | #define SVC_TEMPENTITY 23 213 | #define SVC_INTERMISSION 30 214 | #define SVC_CDTRACK 32 215 | #define SVC_WEAPONANIM 35 216 | #define SVC_ROOMTYPE 37 217 | #define SVC_DIRECTOR 51 218 | 219 | #define VEC_HULL_MIN_Z Vector(0, 0, -36) 220 | #define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18) 221 | 222 | #define VEC_HULL_MIN Vector(-16, -16, -36) 223 | #define VEC_HULL_MAX Vector(16, 16, 36) 224 | 225 | #define VEC_VIEW Vector(0, 0, 17) 226 | 227 | #define VEC_DUCK_HULL_MIN Vector(-16, -16, -18) 228 | #define VEC_DUCK_HULL_MAX Vector(16, 16, 32) 229 | #define VEC_DUCK_VIEW Vector(0, 0, 12) 230 | 231 | // These are caps bits to indicate what an object's capabilities (currently used for save/restore and level transitions) 232 | #define FCAP_CUSTOMSAVE 0x00000001 233 | #define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions 234 | #define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore 235 | #define FCAP_DONT_SAVE 0x80000000 // Don't save this 236 | #define FCAP_IMPULSE_USE 0x00000008 // can be used by the player 237 | #define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player 238 | #define FCAP_ONOFF_USE 0x00000020 // can be used by the player 239 | #define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains) 240 | #define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource) 241 | 242 | // UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!! 243 | #define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions 244 | 245 | // for Classify 246 | #define CLASS_NONE 0 247 | #define CLASS_MACHINE 1 248 | #define CLASS_PLAYER 2 249 | #define CLASS_HUMAN_PASSIVE 3 250 | #define CLASS_HUMAN_MILITARY 4 251 | #define CLASS_ALIEN_MILITARY 5 252 | #define CLASS_ALIEN_PASSIVE 6 253 | #define CLASS_ALIEN_MONSTER 7 254 | #define CLASS_ALIEN_PREY 8 255 | #define CLASS_ALIEN_PREDATOR 9 256 | #define CLASS_INSECT 10 257 | #define CLASS_PLAYER_ALLY 11 258 | #define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players 259 | #define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace 260 | #define CLASS_VEHICLE 14 261 | #define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures. 262 | 263 | #define SF_NORESPAWN (1 << 30) // set this bit on guns and stuff that should never respawn. 264 | 265 | #define DMG_GENERIC 0 // generic damage was done 266 | #define DMG_CRUSH (1<<0) // crushed by falling or moving object 267 | #define DMG_BULLET (1<<1) // shot 268 | #define DMG_SLASH (1<<2) // cut, clawed, stabbed 269 | #define DMG_BURN (1<<3) // heat burned 270 | #define DMG_FREEZE (1<<4) // frozen 271 | #define DMG_FALL (1<<5) // fell too far 272 | #define DMG_BLAST (1<<6) // explosive blast damage 273 | #define DMG_CLUB (1<<7) // crowbar, punch, headbutt 274 | #define DMG_SHOCK (1<<8) // electric shock 275 | #define DMG_SONIC (1<<9) // sound pulse shockwave 276 | #define DMG_ENERGYBEAM (1<<10) // laser or other high energy beam 277 | #define DMG_NEVERGIB (1<<12) // with this bit OR'd in, no damage type will be able to gib victims upon death 278 | #define DMG_ALWAYSGIB (1<<13) // with this bit OR'd in, any damage type can be made to gib victims upon death 279 | #define DMG_DROWN (1<<14) // Drowning 280 | #define DMG_CUSTOM (1<<15) // custom 281 | 282 | // time-based damage 283 | #define DMG_TIMEBASED (~(0x3FFF)) // mask for time-based damage 284 | 285 | #define DMG_PARALYZE (1<<15) // slows affected creature down 286 | #define DMG_NERVEGAS (1<<16) // nerve toxins, very bad 287 | #define DMG_POISON (1<<17) // blood poisioning 288 | #define DMG_RADIATION (1<<18) // radiation exposure 289 | #define DMG_DROWNRECOVER (1<<19) // drowning recovery 290 | #define DMG_ACID (1<<20) // toxic chemicals or acid burns 291 | #define DMG_SLOWBURN (1<<21) // in an oven 292 | #define DMG_SLOWFREEZE (1<<22) // in a subzero freezer 293 | #define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar) 294 | #define DMG_EXPLOSION (1<<24) 295 | 296 | // these are the damage types that are allowed to gib corpses 297 | #define DMG_GIB_CORPSE (DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB) 298 | 299 | // these are the damage types that have client hud art 300 | #define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK) 301 | 302 | // when calling KILLED(), a value that governs gib behavior is expected to be 303 | // one of these three values 304 | #define GIB_NORMAL 0 // gib if entity was overkilled 305 | #define GIB_NEVER 1 // never gib, no matter how much death damage is done ( freezing, etc ) 306 | #define GIB_ALWAYS 2 // always gib ( Houndeye Shock, Barnacle Bite ) 307 | 308 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/crc.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CRC_H 2 | #define INCLUDE_CRC_H 3 | 4 | typedef struct 5 | { 6 | unsigned int buf[4]; 7 | unsigned int bits[2]; 8 | unsigned char in[64]; 9 | } MD5Context_t; 10 | 11 | typedef unsigned int CRC32_t; 12 | 13 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/cssdk.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CSSDK_H 2 | #define INCLUDE_CSSDK_H 3 | 4 | #define INTERFACE_VERSION 140 5 | #define ENGINE_INTERFACE_VERSION 138 6 | 7 | #define ENGINEFUNCS g_engfuncs 8 | #define GLOBALVARS gpGlobals 9 | 10 | #include "basetypes.h" 11 | #include "vector.h" 12 | #include "minimath.h" 13 | #include "link.h" 14 | #include "entvars.h" 15 | #include "edict.h" 16 | #include "archtypes.h" 17 | #include "levellist.h" 18 | #include "alerttype.h" 19 | #include "cdstatus.h" 20 | #include "cvar.h" 21 | #include "entitytable.h" 22 | #include "fieldtypes.h" 23 | #include "material.h" 24 | #include "forcetype.h" 25 | #include "globalvars.h" 26 | #include "keyvaluedata.h" 27 | #include "newdllfunctions.h" 28 | #include "printtype.h" 29 | #include "saverestore.h" 30 | #include "traceresult.h" 31 | #include "typedescription.h" 32 | #include "plane.h" 33 | #include "trace.h" 34 | #include "flags.h" 35 | #include "colordef.h" 36 | #include "buttons.h" 37 | #include "locksound.h" 38 | #include "togglestate.h" 39 | #include "crc.h" 40 | #include "const.h" 41 | #include "krender.h" 42 | #include "message.h" 43 | #include "tempent.h" 44 | #include "monsterevent.h" 45 | #include "cldll.h" 46 | #include "weapondata.h" 47 | #include "entitystate.h" 48 | #include "clientdata.h" 49 | #include "localstate.h" 50 | #include "clienttextmessage.h" 51 | #include "sequencecommandline.h" 52 | #include "sequenceentry.h" 53 | #include "sentenceentry.h" 54 | #include "resourcetype.h" 55 | #include "resource.h" 56 | #include "customization.h" 57 | #include "hudtextparms.h" 58 | #include "enginecallback.h" 59 | #include "util.h" 60 | #include "eventflags.h" 61 | #include "enginefuncs.h" 62 | 63 | extern enginefuncs_t ENGINEFUNCS; 64 | extern globalvars_t *GLOBALVARS; 65 | 66 | #include "dllfunctions.h" 67 | #include "weapontype.h" 68 | #include "activity.h" 69 | #include "usetype.h" 70 | #include "cbase.h" 71 | #include "unisignals.h" 72 | #include "utlmemory.h" 73 | #include "utlvector.h" 74 | #include "hintmessage.h" 75 | #include "basemonster.h" 76 | #include "weapons.h" 77 | #include "player.h" 78 | #include "studio.h" 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /SDK/cssdk/customization.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CUSTOMIZATION_H 2 | #define INCLUDE_CUSTOMIZATION_H 3 | 4 | typedef struct customization_s 5 | { 6 | qboolean bInUse; 7 | resource_t resource; 8 | qboolean bTranslated; 9 | int nUserData1; 10 | int nUserData2; 11 | void *pInfo; 12 | void *pBuffer; 13 | struct customization_s *pNext; 14 | } customization_t; 15 | 16 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/cvar.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CVAR_H 2 | #define INCLUDE_CVAR_H 3 | 4 | #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc 5 | #define FCVAR_USERINFO (1<<1) // changes the client's info string 6 | #define FCVAR_SERVER (1<<2) // notifies players when changed 7 | #define FCVAR_EXTDLL (1<<3) // defined by external DLL 8 | #define FCVAR_CLIENTDLL (1<<4) // defined by the client dll 9 | #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value 10 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 11 | #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 12 | #define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log 13 | #define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar 14 | 15 | typedef struct cvar_s 16 | { 17 | const char *name; 18 | char *string; 19 | int flags; 20 | float value; 21 | struct cvar_s *next; 22 | } cvar_t; 23 | 24 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/dllfunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_DLLFUNCTIONS_H 2 | #define INCLUDE_DLLFUNCTIONS_H 3 | 4 | typedef struct 5 | { 6 | // Initialize/shutdown the game (one-time call after loading of game .dll ) 7 | void(*pfnGameInit) (void); 8 | int(*pfnSpawn) (edict_t *pent); 9 | void(*pfnThink) (edict_t *pent); 10 | void(*pfnUse) (edict_t *pentUsed, edict_t *pentOther); 11 | void(*pfnTouch) (edict_t *pentTouched, edict_t *pentOther); 12 | void(*pfnBlocked) (edict_t *pentBlocked, edict_t *pentOther); 13 | void(*pfnKeyValue) (edict_t *pentKeyvalue, KeyValueData *pkvd); 14 | void(*pfnSave) (edict_t *pent, SAVERESTOREDATA *pSaveData); 15 | int(*pfnRestore) (edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity); 16 | void(*pfnSetAbsBox) (edict_t *pent); 17 | 18 | void(*pfnSaveWriteFields) (SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int); 19 | void(*pfnSaveReadFields) (SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int); 20 | 21 | void(*pfnSaveGlobalState) (SAVERESTOREDATA *); 22 | void(*pfnRestoreGlobalState) (SAVERESTOREDATA *); 23 | void(*pfnResetGlobalState) (void); 24 | 25 | qboolean(*pfnClientConnect) (edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]); 26 | 27 | void(*pfnClientDisconnect) (edict_t *pEntity); 28 | void(*pfnClientKill) (edict_t *pEntity); 29 | void(*pfnClientPutInServer) (edict_t *pEntity); 30 | void(*pfnClientCommand) (edict_t *pEntity); 31 | void(*pfnClientUserInfoChanged)(edict_t *pEntity, char *infobuffer); 32 | 33 | void(*pfnServerActivate) (edict_t *pEdictList, int edictCount, int clientMax); 34 | void(*pfnServerDeactivate) (void); 35 | 36 | void(*pfnPlayerPreThink) (edict_t *pEntity); 37 | void(*pfnPlayerPostThink) (edict_t *pEntity); 38 | 39 | void(*pfnStartFrame) (void); 40 | void(*pfnParmsNewLevel) (void); 41 | void(*pfnParmsChangeLevel) (void); 42 | 43 | // Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life 44 | const char *(*pfnGetGameDescription)(void); 45 | 46 | // Notify dll about a player customization. 47 | void(*pfnPlayerCustomization) (edict_t *pEntity, customization_t *pCustom); 48 | 49 | // Spectator funcs 50 | void(*pfnSpectatorConnect) (edict_t *pEntity); 51 | void(*pfnSpectatorDisconnect) (edict_t *pEntity); 52 | void(*pfnSpectatorThink) (edict_t *pEntity); 53 | 54 | // Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. 55 | void(*pfnSys_Error) (const char *error_string); 56 | 57 | void(*pfnPM_Move) (struct playermove_s *ppmove, qboolean server); 58 | void(*pfnPM_Init) (struct playermove_s *ppmove); 59 | char(*pfnPM_FindTextureType)(char *name); 60 | void(*pfnSetupVisibility)(struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas); 61 | void(*pfnUpdateClientData) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd); 62 | int(*pfnAddToFullPack)(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet); 63 | void(*pfnCreateBaseline) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs); 64 | void(*pfnRegisterEncoders) (void); 65 | int(*pfnGetWeaponData) (struct edict_s *player, struct weapon_data_s *info); 66 | 67 | void(*pfnCmdStart) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed); 68 | void(*pfnCmdEnd) (const edict_t *player); 69 | 70 | // Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max 71 | // size of the response_buffer, so you must zero it out if you choose not to respond. 72 | int(*pfnConnectionlessPacket) (const struct netadr_s *net_from_, const char *args, char *response_buffer, int *response_buffer_size); 73 | 74 | // Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise 75 | int(*pfnGetHullBounds) (int hullnumber, float *mins, float *maxs); 76 | 77 | // Create baselines for certain "unplaced" items. 78 | void(*pfnCreateInstancedBaselines) (void); 79 | 80 | // One of the pfnForceUnmodified files failed the consistency check for the specified player 81 | // Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters ) 82 | int(*pfnInconsistentFile)(const struct edict_s *player, const char *filename, char *disconnect_message); 83 | 84 | // The game .dll should return 1 if lag compensation should be allowed ( could also just set 85 | // the sv_unlag cvar. 86 | // Most games right now should return 0, until client-side weapon prediction code is written 87 | // and tested for them. 88 | int(*pfnAllowLagCompensation)(void); 89 | } DLL_FUNCTIONS; 90 | 91 | typedef int(*APIFUNCTION)(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); 92 | typedef int(*APIFUNCTION2)(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); 93 | 94 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/edict.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_EDICT_H 2 | #define INCLUDE_EDICT_H 3 | 4 | #define MAX_ENT_LEAFS 48 5 | 6 | struct edict_s 7 | { 8 | qboolean free; 9 | int serialnumber; 10 | link_t area; 11 | 12 | int headnode; 13 | int num_leafs; 14 | short leafnums[MAX_ENT_LEAFS]; 15 | 16 | float freetime; 17 | 18 | void* pvPrivateData; 19 | 20 | entvars_t v; 21 | }; 22 | 23 | typedef struct edict_s edict_t; 24 | 25 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/enginecallback.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENGINECALLBACK_H 2 | #define INCLUDE_ENGINECALLBACK_H 3 | 4 | #ifdef SERVER_EXECUTE 5 | #undef SERVER_EXECUTE 6 | #endif 7 | 8 | #define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId) 9 | #define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel) 10 | #define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound) 11 | #define PRECACHE_GENERIC (*g_engfuncs.pfnPrecacheGeneric) 12 | #define SET_MODEL (*g_engfuncs.pfnSetModel) 13 | #define MODEL_INDEX (*g_engfuncs.pfnModelIndex) 14 | #define MODEL_FRAMES (*g_engfuncs.pfnModelFrames) 15 | #define SET_SIZE (*g_engfuncs.pfnSetSize) 16 | #define CHANGE_LEVEL (*g_engfuncs.pfnChangeLevel) 17 | #define GET_SPAWN_PARMS (*g_engfuncs.pfnGetSpawnParms) 18 | #define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms) 19 | #define VEC_TO_YAW (*g_engfuncs.pfnVecToYaw) 20 | #define VEC_TO_ANGLES (*g_engfuncs.pfnVecToAngles) 21 | #define MOVE_TO_ORIGIN (*g_engfuncs.pfnMoveToOrigin) 22 | #define oldCHANGE_YAW (*g_engfuncs.pfnChangeYaw) 23 | #define CHANGE_PITCH (*g_engfuncs.pfnChangePitch) 24 | #define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors) 25 | #define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity) 26 | #define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity) 27 | #define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity) 28 | #define MAKE_STATIC (*g_engfuncs.pfnMakeStatic) 29 | #define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor) 30 | #define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor) 31 | #define WALK_MOVE (*g_engfuncs.pfnWalkMove) 32 | #define SET_ORIGIN (*g_engfuncs.pfnSetOrigin) 33 | #define EMIT_SOUND (*g_engfuncs.pfnEmitSound) 34 | #define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg) 35 | #define TRACE_LINE (*g_engfuncs.pfnTraceLine) 36 | #define TRACE_TOSS (*g_engfuncs.pfnTraceToss) 37 | #define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull) 38 | #define TRACE_HULL (*g_engfuncs.pfnTraceHull) 39 | #define TRACE_MODEL (*g_engfuncs.pfnTraceModel) 40 | #define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector) 41 | #define SERVER_COMMAND (*g_engfuncs.pfnServerCommand) 42 | #define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute) 43 | #define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand) 44 | #define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect) 45 | #define LIGHT_STYLE (*g_engfuncs.pfnLightStyle) 46 | #define DECAL_INDEX (*g_engfuncs.pfnDecalIndex) 47 | #define POINT_CONTENTS (*g_engfuncs.pfnPointContents) 48 | #define CRC32_INIT (*g_engfuncs.pfnCRC32_Init) 49 | #define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer) 50 | #define CRC32_PROCESS_BYTE (*g_engfuncs.pfnCRC32_ProcessByte) 51 | #define CRC32_FINAL (*g_engfuncs.pfnCRC32_Final) 52 | #define RANDOM_LONG (*g_engfuncs.pfnRandomLong) 53 | #define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat) 54 | #define ADD_SERVER_COMMAND (*g_engfuncs.pfnAddServerCommand) 55 | #define SET_CLIENT_LISTENING (*g_engfuncs.pfnVoice_SetClientListening) 56 | #define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId) 57 | #define GET_FILE_SIZE (*g_engfuncs.pfnGetFileSize) 58 | #define GET_APPROX_WAVE_PLAY_LEN (*g_engfuncs.pfnGetApproxWavePlayLen) 59 | #define IS_CAREER_MATCH (*g_engfuncs.pfnIsCareerMatch) 60 | #define GET_LOCALIZED_STRING_LENGTH (*g_engfuncs.pfnGetLocalizedStringLength) 61 | #define REGISTER_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnRegisterTutorMessageShown) 62 | #define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown) 63 | #define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm) 64 | #define ANGLEVECTORS (*g_engfuncs.pfnAngleVectors) 65 | #define CLIENT_PRINT (*g_engfuncs.pfnClientPrintf) 66 | #define CVAR_DIRECTSET (*g_engfuncs.pfnCvar_DirectSet) 67 | #define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening) 68 | #define RUNPLAYERMOVE (*g_engfuncs.pfnRunPlayerMove) 69 | #define SETCLIENTLISTENING (*g_engfuncs.pfnVoice_SetClientListening) 70 | #define SETCLIENTMAXSPEED (*g_engfuncs.pfnSetClientMaxspeed) 71 | #define MESSAGE_BEGIN (*g_engfuncs.pfnMessageBegin) 72 | #define MESSAGE_END (*g_engfuncs.pfnMessageEnd) 73 | #define WRITE_BYTE (*g_engfuncs.pfnWriteByte) 74 | #define WRITE_CHAR (*g_engfuncs.pfnWriteChar) 75 | #define WRITE_SHORT (*g_engfuncs.pfnWriteShort) 76 | #define WRITE_LONG (*g_engfuncs.pfnWriteLong) 77 | #define WRITE_ANGLE (*g_engfuncs.pfnWriteAngle) 78 | #define WRITE_COORD (*g_engfuncs.pfnWriteCoord) 79 | #define WRITE_STRING (*g_engfuncs.pfnWriteString) 80 | #define WRITE_ENTITY (*g_engfuncs.pfnWriteEntity) 81 | #define CVAR_REGISTER (*g_engfuncs.pfnCVarRegister) 82 | #define CVAR_GET_FLOAT (*g_engfuncs.pfnCVarGetFloat) 83 | #define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString) 84 | #define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat) 85 | #define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString) 86 | #define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer) 87 | #define ALERT (*g_engfuncs.pfnAlertMessage) 88 | #define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf) 89 | #define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData) 90 | #define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData) 91 | //#define STRING (*g_engfuncs.pfnSzFromIndex) 92 | #define ALLOC_STRING (*g_engfuncs.pfnAllocString) 93 | #define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString) 94 | #define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum) 95 | #define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere) 96 | #define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS) 97 | #define FIND_ENTITY_IN_PVS (*g_engfuncs.pfnEntitiesInPVS) 98 | #define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound) 99 | #define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr) 100 | #define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg) 101 | #define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition) 102 | #define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName) 103 | #define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction) 104 | #define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture) 105 | #define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf) 106 | #define SERVER_PRINT (*g_engfuncs.pfnServerPrint) 107 | #define CMD_ARGS (*g_engfuncs.pfnCmd_Args) 108 | #define CMD_ARGC (*g_engfuncs.pfnCmd_Argc) 109 | #define CMD_ARGV (*g_engfuncs.pfnCmd_Argv) 110 | #define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment) 111 | #define SET_VIEW (*g_engfuncs.pfnSetView) 112 | #define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle) 113 | #define LOAD_FILE_FOR_ME (*g_engfuncs.pfnLoadFileForMe) 114 | #define FREE_FILE (*g_engfuncs.pfnFreeFile) 115 | #define END_SECTION (*g_engfuncs.pfnEndSection) 116 | #define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime) 117 | #define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir) 118 | #define SET_CLIENT_MAXSPEED (*g_engfuncs.pfnSetClientMaxspeed) 119 | #define CREATE_FAKE_CLIENT (*g_engfuncs.pfnCreateFakeClient) 120 | #define PLAYER_RUN_MOVE (*g_engfuncs.pfnRunPlayerMove) 121 | #define NUMBER_OF_ENTITIES (*g_engfuncs.pfnNumberOfEntities) 122 | #define GET_INFO_BUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) 123 | #define GET_KEY_VALUE (*g_engfuncs.pfnInfoKeyValue) 124 | #define SET_KEY_VALUE (*g_engfuncs.pfnSetKeyValue) 125 | #define SET_CLIENT_KEY_VALUE (*g_engfuncs.pfnSetClientKeyValue) 126 | #define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid) 127 | #define STATIC_DECAL (*g_engfuncs.pfnStaticDecal) 128 | #define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer) 129 | #define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent) 130 | #define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent) 131 | #define ENGINE_SET_PVS (*g_engfuncs.pfnSetFatPVS) 132 | #define ENGINE_SET_PAS (*g_engfuncs.pfnSetFatPAS) 133 | #define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility) 134 | #define DELTA_SET (*g_engfuncs.pfnDeltaSetField) 135 | #define DELTA_UNSET (*g_engfuncs.pfnDeltaUnsetField) 136 | #define DELTA_ADDENCODER (*g_engfuncs.pfnDeltaAddEncoder) 137 | #define ENGINE_CURRENT_PLAYER (*g_engfuncs.pfnGetCurrentPlayer) 138 | #define ENGINE_CANSKIP (*g_engfuncs.pfnCanSkipPlayer) 139 | #define DELTA_FINDFIELD (*g_engfuncs.pfnDeltaFindField) 140 | #define DELTA_SETBYINDEX (*g_engfuncs.pfnDeltaSetFieldByIndex) 141 | #define DELTA_UNSETBYINDEX (*g_engfuncs.pfnDeltaUnsetFieldByIndex) 142 | #define REMOVE_KEY_VALUE (*g_engfuncs.pfnInfo_RemoveKey) 143 | #define SET_PHYSICS_KEY_VALUE (*g_engfuncs.pfnSetPhysicsKeyValue) 144 | #define ENGINE_GETPHYSINFO (*g_engfuncs.pfnGetPhysicsInfoString) 145 | #define ENGINE_SETGROUPMASK (*g_engfuncs.pfnSetGroupMask) 146 | #define ENGINE_INSTANCE_BASELINE (*g_engfuncs.pfnCreateInstancedBaseline) 147 | #define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified) 148 | #define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats) 149 | 150 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/enginefuncs.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENGINEFUNCS_H 2 | #define INCLUDE_ENGINEFUNCS_H 3 | 4 | // Engine hands this to DLLs for functionality callbacks 5 | typedef struct enginefuncs_s 6 | { 7 | int (*pfnPrecacheModel) (const char* s); 8 | int (*pfnPrecacheSound) (const char* s); 9 | void (*pfnSetModel) (edict_t *e, const char *m); 10 | int (*pfnModelIndex) (const char *m); 11 | int (*pfnModelFrames) (int modelIndex); 12 | void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax); 13 | void (*pfnChangeLevel) (const char* s1, const char* s2); 14 | void (*pfnGetSpawnParms) (edict_t *ent); 15 | void (*pfnSaveSpawnParms) (edict_t *ent); 16 | float (*pfnVecToYaw) (const float *rgflVector); 17 | void (*pfnVecToAngles) (const float *rgflVectorIn, float *rgflVectorOut); 18 | void (*pfnMoveToOrigin) (edict_t *ent, const float *pflGoal, float dist, int iMoveType); 19 | void (*pfnChangeYaw) (edict_t* ent); 20 | void (*pfnChangePitch) (edict_t* ent); 21 | edict_t* (*pfnFindEntityByString) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); 22 | int (*pfnGetEntityIllum) (edict_t* pEnt); 23 | edict_t* (*pfnFindEntityInSphere) (edict_t *pEdictStartSearchAfter, const float *org, float rad); 24 | edict_t* (*pfnFindClientInPVS) (edict_t *pEdict); 25 | edict_t* (*pfnEntitiesInPVS) (edict_t *pplayer); 26 | void (*pfnMakeVectors) (const float *rgflVector); 27 | void (*pfnAngleVectors) (const float *rgflVector, float *forward, float *right, float *up); 28 | edict_t* (*pfnCreateEntity) (void); 29 | void (*pfnRemoveEntity) (edict_t* e); 30 | edict_t* (*pfnCreateNamedEntity) (int className); 31 | void (*pfnMakeStatic) (edict_t *ent); 32 | int (*pfnEntIsOnFloor) (edict_t *e); 33 | int (*pfnDropToFloor) (edict_t* e); 34 | int (*pfnWalkMove) (edict_t *ent, float yaw, float dist, int iMode); 35 | void (*pfnSetOrigin) (edict_t *e, const float *rgflOrigin); 36 | void (*pfnEmitSound) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); 37 | void (*pfnEmitAmbientSound) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); 38 | void (*pfnTraceLine) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); 39 | void (*pfnTraceToss) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); 40 | int (*pfnTraceMonsterHull) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); 41 | void (*pfnTraceHull) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); 42 | void (*pfnTraceModel) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); 43 | const char *(*pfnTraceTexture) (edict_t *pTextureEntity, const float *v1, const float *v2 ); 44 | void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); 45 | void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn); 46 | void (*pfnServerCommand) (const char* str); 47 | void (*pfnServerExecute) (void); 48 | void (*pfnClientCommand) (edict_t* pEdict, const char* szFmt, ...); 49 | void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count); 50 | void (*pfnLightStyle) (int style, const char* val); 51 | int (*pfnDecalIndex) (const char *name); 52 | int (*pfnPointContents) (const float *rgflVector); 53 | void (*pfnMessageBegin) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); 54 | void (*pfnMessageEnd) (void); 55 | void (*pfnWriteByte) (int iValue); 56 | void (*pfnWriteChar) (int iValue); 57 | void (*pfnWriteShort) (int iValue); 58 | void (*pfnWriteLong) (int iValue); 59 | void (*pfnWriteAngle) (float flValue); 60 | void (*pfnWriteCoord) (float flValue); 61 | void (*pfnWriteString) (const char *sz); 62 | void (*pfnWriteEntity) (int iValue); 63 | void (*pfnCVarRegister) (cvar_t *pCvar); 64 | float (*pfnCVarGetFloat) (const char *szVarName); 65 | const char* (*pfnCVarGetString) (const char *szVarName); 66 | void (*pfnCVarSetFloat) (const char *szVarName, float flValue); 67 | void (*pfnCVarSetString) (const char *szVarName, const char *szValue); 68 | void (*pfnAlertMessage) (ALERT_TYPE atype, const char *szFmt, ...); 69 | void (*pfnEngineFprintf) (void *pfile, const char *szFmt, ...); 70 | void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, int32 cb); 71 | void* (*pfnPvEntPrivateData) (edict_t *pEdict); 72 | void (*pfnFreeEntPrivateData) (edict_t *pEdict); 73 | const char* (*pfnSzFromIndex) (int iString); 74 | int (*pfnAllocString) (const char *szValue); 75 | struct entvars_s* (*pfnGetVarsOfEnt) (edict_t *pEdict); 76 | edict_t* (*pfnPEntityOfEntOffset) (int iEntOffset); 77 | int (*pfnEntOffsetOfPEntity) (const edict_t *pEdict); 78 | int (*pfnIndexOfEdict) (const edict_t *pEdict); 79 | edict_t* (*pfnPEntityOfEntIndex) (int iEntIndex); 80 | edict_t* (*pfnFindEntityByVars) (struct entvars_s* pvars); 81 | void* (*pfnGetModelPtr) (edict_t* pEdict); 82 | int (*pfnRegUserMsg) (const char *pszName, int iSize); 83 | void (*pfnAnimationAutomove) (const edict_t* pEdict, float flTime); 84 | void (*pfnGetBonePosition) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); 85 | uint32 (*pfnFunctionFromName) ( const char *pName ); 86 | const char *(*pfnNameForFunction) ( uint32 function ); 87 | void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients 88 | void (*pfnServerPrint) ( const char *szMsg ); 89 | const char *(*pfnCmd_Args) ( void ); // these 3 added 90 | const char *(*pfnCmd_Argv) ( int argc ); // so game DLL can easily 91 | int (*pfnCmd_Argc) ( void ); // access client 'cmd' strings 92 | void (*pfnGetAttachment) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); 93 | void (*pfnCRC32_Init) (CRC32_t *pulCRC); 94 | void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len); 95 | void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch); 96 | CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC); 97 | int32 (*pfnRandomLong) (int32 lLow, int32 lHigh); 98 | float (*pfnRandomFloat) (float flLow, float flHigh); 99 | void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent ); 100 | float (*pfnTime) ( void ); 101 | void (*pfnCrosshairAngle) (const edict_t *pClient, float pitch, float yaw); 102 | byte * (*pfnLoadFileForMe) (const char *filename, int *pLength); 103 | void (*pfnFreeFile) (void *buffer); 104 | void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection 105 | int (*pfnCompareFileTime) (char *filename1, char *filename2, int *iCompare); 106 | void (*pfnGetGameDir) (char *szGetGameDir); 107 | void (*pfnCvar_RegisterVariable) (cvar_t *variable); 108 | void (*pfnFadeClientVolume) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); 109 | void (*pfnSetClientMaxspeed) (edict_t *pEdict, float fNewMaxspeed); 110 | edict_t * (*pfnCreateFakeClient) (const char *netname); // returns NULL if fake client can't be created 111 | void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); 112 | int (*pfnNumberOfEntities) (void); 113 | char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo 114 | char* (*pfnInfoKeyValue) (char *infobuffer, const char *key); 115 | void (*pfnSetKeyValue) (char *infobuffer, const char *key, const char *value); 116 | void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, const char *key, const char *value); 117 | int (*pfnIsMapValid) (const char *filename); 118 | void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); 119 | int (*pfnPrecacheGeneric) (const char* s); 120 | int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients 121 | void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); 122 | int (*pfnIsDedicatedServer) (void);// is this a dedicated server? 123 | cvar_t *(*pfnCVarGetPointer) (const char *szVarName); 124 | unsigned int (*pfnGetPlayerWONId) (edict_t *e); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients 125 | 126 | // YWB 8/1/99 TFF Physics additions 127 | void (*pfnInfo_RemoveKey) ( char *s, const char *key ); 128 | const char *(*pfnGetPhysicsKeyValue) ( const edict_t *pClient, const char *key ); 129 | void (*pfnSetPhysicsKeyValue) ( const edict_t *pClient, const char *key, const char *value ); 130 | const char *(*pfnGetPhysicsInfoString) ( const edict_t *pClient ); 131 | unsigned short (*pfnPrecacheEvent) ( int type, const char*psz ); 132 | void (*pfnPlaybackEvent) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); 133 | 134 | unsigned char *(*pfnSetFatPVS) ( float *org ); 135 | unsigned char *(*pfnSetFatPAS) ( float *org ); 136 | 137 | int (*pfnCheckVisibility ) ( edict_t *entity, unsigned char *pset ); 138 | 139 | void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); 140 | void (*pfnDeltaUnsetField) ( struct delta_s *pFields, const char *fieldname ); 141 | void (*pfnDeltaAddEncoder) ( const char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); 142 | int (*pfnGetCurrentPlayer) ( void ); 143 | int (*pfnCanSkipPlayer) ( const edict_t *player ); 144 | int (*pfnDeltaFindField) ( struct delta_s *pFields, const char *fieldname ); 145 | void (*pfnDeltaSetFieldByIndex) ( struct delta_s *pFields, int fieldNumber ); 146 | void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); 147 | 148 | void (*pfnSetGroupMask) ( int mask, int op ); 149 | 150 | int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline ); 151 | void (*pfnCvar_DirectSet) ( struct cvar_s *var, const char *value ); 152 | 153 | // Forces the client and server to be running with the same version of the specified file 154 | // ( e.g., a player model ). 155 | // Calling this has no effect in single player 156 | void (*pfnForceUnmodified) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); 157 | 158 | void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss ); 159 | 160 | void (*pfnAddServerCommand) ( const char *cmd_name, void (*function) (void) ); 161 | 162 | // For voice communications, set which clients hear eachother. 163 | // NOTE: these functions take player entity indices (starting at 1). 164 | qboolean (*pfnVoice_GetClientListening)(int iReceiver, int iSender); 165 | qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen); 166 | 167 | const char *(*pfnGetPlayerAuthId) ( edict_t *e ); 168 | 169 | // PSV: Added for CZ training map 170 | // const char *(*pfnKeyNameForBinding) ( const char* pBinding ); 171 | 172 | sequenceEntry_s* (*pfnSequenceGet) ( const char* fileName, const char* entryName ); 173 | sentenceEntry_s* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked ); 174 | 175 | // LH: Give access to filesize via filesystem 176 | int (*pfnGetFileSize) ( const char *filename ); 177 | 178 | unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath); 179 | // MDC: Added for CZ career-mode 180 | int (*pfnIsCareerMatch) ( void ); 181 | 182 | // BGC: return the number of characters of the localized string referenced by using "label" 183 | int (*pfnGetLocalizedStringLength) (const char *label); 184 | 185 | // BGC: added to facilitate persistent storage of tutor message decay values for 186 | // different career game profiles. Also needs to persist regardless of mp.dll being 187 | // destroyed and recreated. 188 | void (*pfnRegisterTutorMessageShown) (int mid); 189 | int (*pfnGetTimesTutorMessageShown) (int mid); 190 | void (*pfnProcessTutorMessageDecayBuffer) (int *buffer, int bufferLength); 191 | void (*pfnConstructTutorMessageDecayBuffer) (int *buffer, int bufferLength); 192 | void (*pfnResetTutorMessageDecayData) ( void ); 193 | 194 | // Added 2005/08/11 (no SDK update): 195 | void(*pfnQueryClientCvarValue) (const edict_t *player, const char *cvarName); 196 | 197 | // Added 2005/11/21 (no SDK update): 198 | void(*pfnQueryClientCvarValue2) (const edict_t *player, const char *cvarName, int requestID); 199 | 200 | // Added 2009/06/19 (no SDK update): 201 | int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext); 202 | } enginefuncs_t; 203 | 204 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/entitystate.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENTITYSTATE_H 2 | #define INCLUDE_ENTITYSTATE_H 3 | 4 | // For entityType below 5 | #define ENTITY_NORMAL (1<<0) 6 | #define ENTITY_BEAM (1<<1) 7 | 8 | // Entity state is used for the baseline and for delta compression of a packet of 9 | // entities that is sent to a client. 10 | typedef struct entity_state_s entity_state_t; 11 | 12 | struct entity_state_s 13 | { 14 | // Fields which are filled in by routines outside of delta compression 15 | int entityType; 16 | // Index into cl_entities array for this entity. 17 | int number; 18 | float msg_time; 19 | 20 | // Message number last time the player/entity state was updated. 21 | int messagenum; 22 | 23 | // Fields which can be transitted and reconstructed over the network stream 24 | vec3_t origin; 25 | vec3_t angles; 26 | 27 | int modelindex; 28 | int sequence; 29 | float frame; 30 | int colormap; 31 | short skin; 32 | short solid; 33 | int effects; 34 | float scale; 35 | 36 | byte eflags; 37 | 38 | // Render information 39 | int rendermode; 40 | int renderamt; 41 | color24 rendercolor; 42 | int renderfx; 43 | 44 | int movetype; 45 | float animtime; 46 | float framerate; 47 | int body; 48 | byte controller[4]; 49 | byte blending[4]; 50 | vec3_t velocity; 51 | 52 | // Send bbox down to client for use during prediction. 53 | vec3_t mins; 54 | vec3_t maxs; 55 | 56 | int aiment; 57 | // If owned by a player, the index of that player ( for projectiles ). 58 | int owner; 59 | 60 | // Friction, for prediction. 61 | float friction; 62 | // Gravity multiplier 63 | float gravity; 64 | 65 | // PLAYER SPECIFIC 66 | int team; 67 | int playerclass; 68 | int health; 69 | qboolean spectator; 70 | int weaponmodel; 71 | int gaitsequence; 72 | // If standing on conveyor, e.g. 73 | vec3_t basevelocity; 74 | // Use the crouched hull, or the regular player hull. 75 | int usehull; 76 | // Latched buttons last time state updated. 77 | int oldbuttons; 78 | // -1 = in air, else pmove entity number 79 | int onground; 80 | int iStepLeft; 81 | // How fast we are falling 82 | float flFallVelocity; 83 | 84 | float fov; 85 | int weaponanim; 86 | 87 | // Parametric movement overrides 88 | vec3_t startpos; 89 | vec3_t endpos; 90 | float impacttime; 91 | float starttime; 92 | 93 | // For mods 94 | int iuser1; 95 | int iuser2; 96 | int iuser3; 97 | int iuser4; 98 | float fuser1; 99 | float fuser2; 100 | float fuser3; 101 | float fuser4; 102 | vec3_t vuser1; 103 | vec3_t vuser2; 104 | vec3_t vuser3; 105 | vec3_t vuser4; 106 | }; 107 | 108 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/entitytable.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENTITYTABLE_H 2 | #define INCLUDE_ENTITYTABLE_H 3 | 4 | #define FENTTABLE_PLAYER 0x80000000 5 | #define FENTTABLE_REMOVED 0x40000000 6 | #define FENTTABLE_MOVEABLE 0x20000000 7 | #define FENTTABLE_GLOBAL 0x10000000 8 | 9 | typedef struct 10 | { 11 | int id; // Ordinal ID of this entity (used for entity <--> pointer conversions) 12 | edict_t *pent; // Pointer to the in-game entity 13 | 14 | int location; // Offset from the base data of this entity 15 | int size; // Byte size of this entity's data 16 | int flags; // This could be a short -- bit mask of transitions that this entity is in the PVS of 17 | string_t classname; // entity class name 18 | 19 | } ENTITYTABLE; 20 | 21 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/entvars.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENTVARS_H 2 | #define INCLUDE_ENTVARS_H 3 | 4 | #define vec3_t Vector 5 | 6 | typedef struct entvars_s 7 | { 8 | string_t classname; 9 | string_t globalname; 10 | 11 | vec3_t origin; 12 | vec3_t oldorigin; 13 | vec3_t velocity; 14 | vec3_t basevelocity; 15 | vec3_t clbasevelocity; // Base velocity that was passed in to server physics so 16 | // client can predict conveyors correctly. Server zeroes it, so we need to store here, too. 17 | vec3_t movedir; 18 | 19 | vec3_t angles; // Model angles 20 | vec3_t avelocity; // angle velocity (degrees per second) 21 | vec3_t punchangle; // auto-decaying view angle adjustment 22 | vec3_t v_angle; // Viewing angle (player only) 23 | 24 | // For parametric entities 25 | vec3_t endpos; 26 | vec3_t startpos; 27 | float impacttime; 28 | float starttime; 29 | 30 | int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity 31 | float idealpitch; 32 | float pitch_speed; 33 | float ideal_yaw; 34 | float yaw_speed; 35 | 36 | int modelindex; 37 | string_t model; 38 | 39 | int viewmodel; // player's viewmodel 40 | int weaponmodel; // what other players see 41 | 42 | vec3_t absmin; // BB max translated to world coord 43 | vec3_t absmax; // BB max translated to world coord 44 | vec3_t mins; // local BB min 45 | vec3_t maxs; // local BB max 46 | vec3_t size; // maxs - mins 47 | 48 | float ltime; 49 | float nextthink; 50 | 51 | int movetype; 52 | int solid; 53 | 54 | int skin; 55 | int body; // sub-model selection for studiomodels 56 | int effects; 57 | 58 | float gravity; // % of "normal" gravity 59 | float friction; // inverse elasticity of MOVETYPE_BOUNCE 60 | 61 | int light_level; 62 | 63 | int sequence; // animation sequence 64 | int gaitsequence; // movement animation sequence for player (0 for none) 65 | float frame; // % playback position in animation sequences (0..255) 66 | float animtime; // world time when frame was set 67 | float framerate; // animation playback rate (-8x to 8x) 68 | byte controller[4]; // bone controller setting (0..255) 69 | byte blending[2]; // blending amount between sub-sequences (0..255) 70 | 71 | float scale; // sprite rendering scale (0..255) 72 | 73 | int rendermode; 74 | float renderamt; 75 | vec3_t rendercolor; 76 | int renderfx; 77 | 78 | float health; 79 | float frags; 80 | int weapons; // bit mask for available weapons 81 | float takedamage; 82 | 83 | int deadflag; 84 | vec3_t view_ofs; // eye position 85 | 86 | int button; 87 | int impulse; 88 | 89 | struct edict_s *chain; // Entity pointer when linked into a linked list 90 | struct edict_s *dmg_inflictor; 91 | struct edict_s *enemy; 92 | struct edict_s *aiment; // entity pointer when MOVETYPE_FOLLOW 93 | struct edict_s *owner; 94 | struct edict_s *groundentity; 95 | 96 | int spawnflags; 97 | int flags; 98 | 99 | int colormap; // lowbyte topcolor, highbyte bottomcolor 100 | int team; 101 | 102 | float max_health; 103 | float teleport_time; 104 | float armortype; 105 | float armorvalue; 106 | int waterlevel; 107 | int watertype; 108 | 109 | string_t target; 110 | string_t targetname; 111 | string_t netname; 112 | string_t message; 113 | 114 | float dmg_take; 115 | float dmg_save; 116 | float dmg; 117 | float dmgtime; 118 | 119 | string_t noise; 120 | string_t noise1; 121 | string_t noise2; 122 | string_t noise3; 123 | 124 | float speed; 125 | float air_finished; 126 | float pain_finished; 127 | float radsuit_finished; 128 | 129 | struct edict_s *pContainingEntity; 130 | 131 | int playerclass; 132 | float maxspeed; 133 | 134 | float fov; 135 | int weaponanim; 136 | 137 | int pushmsec; 138 | 139 | int bInDuck; 140 | int flTimeStepSound; 141 | int flSwimTime; 142 | int flDuckTime; 143 | int iStepLeft; 144 | float flFallVelocity; 145 | 146 | int gamestate; 147 | 148 | int oldbuttons; 149 | 150 | int groupinfo; 151 | 152 | // For mods 153 | int iuser1; 154 | int iuser2; 155 | int iuser3; 156 | int iuser4; 157 | float fuser1; 158 | float fuser2; 159 | float fuser3; 160 | float fuser4; 161 | vec3_t vuser1; 162 | vec3_t vuser2; 163 | vec3_t vuser3; 164 | vec3_t vuser4; 165 | struct edict_s *euser1; 166 | struct edict_s *euser2; 167 | struct edict_s *euser3; 168 | struct edict_s *euser4; 169 | } entvars_t; 170 | 171 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/eventflags.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_EVENTFLAGS_H 2 | #define INCLUDE_EVENTFLAGS_H 3 | 4 | // Skip local host for event send. 5 | #define FEV_NOTHOST (1<<0) 6 | 7 | // Send the event reliably. You must specify the origin and angles and use 8 | // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything 9 | // that depends on the event origin/angles. I.e., the origin/angles are not 10 | // taken from the invoking edict for reliable events. 11 | #define FEV_RELIABLE (1<<1) 12 | 13 | // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC 14 | // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). 15 | #define FEV_GLOBAL (1<<2) 16 | 17 | // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate 18 | // 19 | #define FEV_UPDATE (1<<3) 20 | 21 | // Only send to entity specified as the invoker 22 | #define FEV_HOSTONLY (1<<4) 23 | 24 | // Only send if the event was created on the server. 25 | #define FEV_SERVER (1<<5) 26 | 27 | // Only issue event client side ( from shared code ) 28 | #define FEV_CLIENT (1<<6) 29 | 30 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/fieldtypes.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_FIELDTYPES_H 2 | #define INCLUDE_FIELDTYPES_H 3 | 4 | #if !defined(offsetof) && !defined(GNUC) 5 | #define offsetof(s,m) (size_t)&(((s *)0)->m) 6 | #endif 7 | 8 | #define _FIELD(type,name,fieldtype,count,flags) { fieldtype, #name, offsetof(type, name), count, flags } 9 | #define DEFINE_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, 0) 10 | #define DEFINE_ARRAY(type,name,fieldtype,count) _FIELD(type, name, fieldtype, count, 0) 11 | #define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, 0 ) 12 | #define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL ) 13 | #define DEFINE_GLOBAL_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL ) 14 | 15 | typedef enum _fieldtypes 16 | { 17 | FIELD_FLOAT = 0, // Any floating point value 18 | FIELD_STRING, // A string ID (return from ALLOC_STRING) 19 | FIELD_ENTITY, // An entity offset (EOFFSET) 20 | FIELD_CLASSPTR, // CBaseEntity * 21 | FIELD_EHANDLE, // Entity handle 22 | FIELD_EVARS, // EVARS * 23 | FIELD_EDICT, // edict_t *, or edict_t * (same thing) 24 | FIELD_VECTOR, // Any vector 25 | FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically) 26 | FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER 27 | FIELD_INTEGER, // Any integer or enum 28 | FIELD_FUNCTION, // A class function pointer (Think, Use, etc) 29 | FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression 30 | FIELD_SHORT, // 2 byte integer 31 | FIELD_CHARACTER, // a byte 32 | FIELD_TIME, // a floating point time (these are fixed up automatically too!) 33 | FIELD_MODELNAME, // Engine string that is a model name (needs precache) 34 | FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache) 35 | 36 | FIELD_TYPECOUNT, // MUST BE LAST 37 | } FIELDTYPE; 38 | 39 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/flags.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_FLAG_H 2 | #define INCLUDE_FLAG_H 3 | 4 | // edict->flags 5 | #define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground 6 | #define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) 7 | #define FL_CONVEYOR (1<<2) 8 | #define FL_CLIENT (1<<3) 9 | #define FL_INWATER (1<<4) 10 | #define FL_MONSTER (1<<5) 11 | #define FL_GODMODE (1<<6) 12 | #define FL_NOTARGET (1<<7) 13 | #define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself 14 | #define FL_ONGROUND (1<<9) // At rest / on the ground 15 | #define FL_PARTIALGROUND (1<<10) // not all corners are valid 16 | #define FL_WATERJUMP (1<<11) // player jumping out of water 17 | #define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera 18 | #define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them 19 | #define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched 20 | #define FL_FLOAT (1<<15) // Apply floating force to this entity when in water 21 | #define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection 22 | 23 | // UNDONE: Do we need these? 24 | #define FL_IMMUNE_WATER (1<<17) 25 | #define FL_IMMUNE_SLIME (1<<18) 26 | #define FL_IMMUNE_LAVA (1<<19) 27 | 28 | #define FL_PROXY (1<<20) // This is a spectator proxy 29 | #define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) 30 | #define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum) 31 | #define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set 32 | #define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction. 33 | #define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) 34 | #define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc. 35 | #define FL_CUSTOMENTITY (1<<29) // This is a custom entity 36 | #define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time 37 | #define FL_DORMANT (1<<31) // Entity is dormant, no updates to client 38 | 39 | // SV_EmitSound2 flags 40 | #define SND_EMIT2_NOPAS (1<<0) // never to do check PAS 41 | #define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker 42 | 43 | // Engine edict->spawnflags 44 | #define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file 45 | 46 | // Goes into globalvars_t.trace_flags 47 | #define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box 48 | 49 | // entity flags 50 | #define EFLAG_SLERP 1 // do studio interpolation of this entity 51 | 52 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/forcetype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_FORCETYPE_H 2 | #define INCLUDE_FORCETYPE_H 3 | 4 | enum FORCE_TYPE 5 | { 6 | force_exactfile, // File on client must exactly match server's file 7 | force_model_samebounds, // For model files only, the geometry must fit in the same bbox 8 | force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox 9 | force_model_specifybounds_if_avail, // For Steam model files only, the geometry must fit in the specified bbox (if the file is available) 10 | }; 11 | 12 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/globalvars.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_GLOBALVARS_H 2 | #define INCLUDE_GLOBALVARS_H 3 | 4 | typedef struct globalvars_s 5 | { 6 | float time; 7 | float frametime; 8 | float force_retouch; 9 | string_t mapname; 10 | string_t startspot; 11 | float deathmatch_; 12 | float coop_; 13 | float teamplay; 14 | float serverflags; 15 | float found_secrets; 16 | vec3_t v_forward; 17 | vec3_t v_up; 18 | vec3_t v_right; 19 | float trace_allsolid; 20 | float trace_startsolid; 21 | float trace_fraction; 22 | vec3_t trace_endpos; 23 | vec3_t trace_plane_normal; 24 | float trace_plane_dist; 25 | edict_t *trace_ent; 26 | float trace_inopen; 27 | float trace_inwater; 28 | int trace_hitgroup; 29 | int trace_flags; 30 | int msg_entity; 31 | int cdAudioTrack; 32 | int maxClients; 33 | int maxEntities; 34 | const char *pStringBase; 35 | 36 | void *pSaveData; 37 | vec3_t vecLandmarkOffset; 38 | } globalvars_t; 39 | 40 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/hintmessage.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_HINTMESSAGE_H 2 | #define INCLUDE_HINTMESSAGE_H 3 | 4 | #define DHF_ROUND_STARTED (1<<1) 5 | #define DHF_HOSTAGE_SEEN_FAR (1<<2) 6 | #define DHF_HOSTAGE_SEEN_NEAR (1<<3) 7 | #define DHF_HOSTAGE_USED (1<<4) 8 | #define DHF_HOSTAGE_INJURED (1<<5) 9 | #define DHF_HOSTAGE_KILLED (1<<6) 10 | #define DHF_FRIEND_SEEN (1<<7) 11 | #define DHF_ENEMY_SEEN (1<<8) 12 | #define DHF_FRIEND_INJURED (1<<9) 13 | #define DHF_FRIEND_KILLED (1<<10) 14 | #define DHF_ENEMY_KILLED (1<<11) 15 | #define DHF_BOMB_RETRIEVED (1<<12) 16 | #define DHF_AMMO_EXHAUSTED (1<<15) 17 | #define DHF_IN_TARGET_ZONE (1<<16) 18 | #define DHF_IN_RESCUE_ZONE (1<<17) 19 | #define DHF_IN_ESCAPE_ZONE (1<<18) 20 | #define DHF_IN_VIPSAFETY_ZONE (1<<19) 21 | #define DHF_NIGHTVISION (1<<20) 22 | #define DHF_HOSTAGE_CTMOVE (1<<21) 23 | #define DHF_SPEC_DUCK (1<<22) 24 | 25 | #define DHM_ROUND_CLEAR (DHF_ROUND_STARTED | DHF_HOSTAGE_KILLED | DHF_FRIEND_KILLED | DHF_BOMB_RETRIEVED) 26 | #define DHM_CONNECT_CLEAR (DHF_HOSTAGE_SEEN_FAR | DHF_HOSTAGE_SEEN_NEAR | DHF_HOSTAGE_USED | DHF_HOSTAGE_INJURED | DHF_FRIEND_SEEN | DHF_ENEMY_SEEN | DHF_FRIEND_INJURED | DHF_ENEMY_KILLED | DHF_AMMO_EXHAUSTED | DHF_IN_TARGET_ZONE | DHF_IN_RESCUE_ZONE | DHF_IN_ESCAPE_ZONE | DHF_IN_VIPSAFETY_ZONE | DHF_HOSTAGE_CTMOVE | DHF_SPEC_DUCK) 27 | 28 | class CHintMessage { 29 | public: 30 | CHintMessage(const char *hintString, bool isHint, CUtlVector *args, float duration); 31 | ~CHintMessage(); 32 | public: 33 | float GetDuration() const { return m_duration; } 34 | void Send(CBaseEntity *client); 35 | 36 | private: 37 | const char *m_hintString; 38 | bool m_isHint; 39 | CUtlVector m_args; 40 | float m_duration; 41 | }; 42 | 43 | class CHintMessageQueue { 44 | public: 45 | void Reset(); 46 | void Update(CBaseEntity *client); 47 | bool AddMessage(const char *message, float duration, bool isHint, CUtlVector *args); 48 | bool IsEmpty() const { return m_messages.Count() == 0; } 49 | 50 | private: 51 | float m_tmMessageEnd; 52 | CUtlVector m_messages; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/hudtextparms.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_HUDTEXTPARMS_H 2 | #define INCLUDE_HUDTEXTPARMS_H 3 | 4 | typedef struct hudtextparms_s 5 | { 6 | float x; 7 | float y; 8 | int effect; 9 | byte r1,g1,b1,a1; 10 | byte r2,g2,b2,a2; 11 | float fadeinTime; 12 | float fadeoutTime; 13 | float holdTime; 14 | float fxTime; 15 | int channel; 16 | 17 | } hudtextparms_t; 18 | 19 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/keyvaluedata.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_KEYVALUEDATA_H 2 | #define INCLUDE_KEYVALUEDATA_H 3 | 4 | // Passed to pfnKeyValue 5 | typedef struct 6 | { 7 | char *szClassName; // in: entity classname 8 | char *szKeyName; // in: name of key 9 | char *szValue; // in: value of key 10 | qboolean fHandled; // out: DLL sets to true if key-value pair was understood 11 | } KeyValueData; 12 | 13 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/krender.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_KRENDER_H 2 | #define INCLUDE_KRENDER_H 3 | 4 | // Rendering constants 5 | enum kRender 6 | { 7 | kRenderNormal, // src 8 | kRenderTransColor, // c*a+dest*(1-a) 9 | kRenderTransTexture, // src*a+dest*(1-a) 10 | kRenderGlow, // src*a+dest -- No Z buffer checks 11 | kRenderTransAlpha, // src*srca+dest*(1-srca) 12 | kRenderTransAdd, // src*a+dest 13 | }; 14 | 15 | enum kRenderFx 16 | { 17 | kRenderFxNone = 0, 18 | kRenderFxPulseSlow, 19 | kRenderFxPulseFast, 20 | kRenderFxPulseSlowWide, 21 | kRenderFxPulseFastWide, 22 | kRenderFxFadeSlow, 23 | kRenderFxFadeFast, 24 | kRenderFxSolidSlow, 25 | kRenderFxSolidFast, 26 | kRenderFxStrobeSlow, 27 | kRenderFxStrobeFast, 28 | kRenderFxStrobeFaster, 29 | kRenderFxFlickerSlow, 30 | kRenderFxFlickerFast, 31 | kRenderFxNoDissipation, 32 | kRenderFxDistort, // Distort/scale/translate flicker 33 | kRenderFxHologram, // kRenderFxDistort + distance fade 34 | kRenderFxDeadPlayer, // kRenderAmt is the player index 35 | kRenderFxExplode, // Scale up really big! 36 | kRenderFxGlowShell, // Glowing Shell 37 | kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!) 38 | kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier 39 | }; 40 | 41 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/levellist.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_LEVELLIST_H 2 | #define INCLUDE_LEVELLIST_H 3 | 4 | #define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags 5 | 6 | typedef struct 7 | { 8 | char mapName[ 32 ]; 9 | char landmarkName[ 32 ]; 10 | edict_t *pentLandmark; 11 | vec3_t vecLandmarkOrigin; 12 | } LEVELLIST; 13 | 14 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/link.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_LINK_H 2 | #define INCLUDE_LINK_H 3 | 4 | typedef struct link_s 5 | { 6 | struct link_s *prev, *next; 7 | } link_t; 8 | 9 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/localstate.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_LOCALSTATE_H 2 | #define INCLUDE_LOCALSTATE_H 3 | 4 | typedef struct local_state_s 5 | { 6 | entity_state_t playerstate; 7 | clientdata_t client; 8 | weapon_data_t weapondata[ 64 ]; 9 | } local_state_t; 10 | 11 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/locksound.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_LOCKSOUND_H 2 | #define INCLUDE_LOCKSOUND_H 3 | 4 | typedef struct locksounds 5 | { 6 | string_t sLockedSound; 7 | string_t sLockedSentence; 8 | string_t sUnlockedSound; 9 | string_t sUnlockedSentence; 10 | int iLockedSentence; 11 | int iUnlockedSentence; 12 | float flwaitSound; 13 | float flwaitSentence; 14 | byte bEOFLocked; 15 | byte bEOFUnlocked; 16 | 17 | } locksound_t; 18 | 19 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/material.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_MATERIAL_H 2 | #define INCLUDE_MATERIAL_H 3 | 4 | #define CTEXTURESMAX 1024 // max number of textures loaded 5 | #define CBTEXTURENAMEMAX 17 // only load first n chars of name 6 | 7 | #define CHAR_TEX_CONCRETE 'C' // texture types 8 | #define CHAR_TEX_METAL 'M' 9 | #define CHAR_TEX_DIRT 'D' 10 | #define CHAR_TEX_VENT 'V' 11 | #define CHAR_TEX_GRATE 'G' 12 | #define CHAR_TEX_TILE 'T' 13 | #define CHAR_TEX_SLOSH 'S' 14 | #define CHAR_TEX_WOOD 'W' 15 | #define CHAR_TEX_COMPUTER 'P' 16 | #define CHAR_TEX_GRASS 'X' 17 | #define CHAR_TEX_GLASS 'Y' 18 | #define CHAR_TEX_FLESH 'F' 19 | #define CHAR_TEX_SNOW 'N' 20 | 21 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/message.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_MESSAGE_H 2 | #define INCLUDE_MESSAGE_H 3 | 4 | #define MSG_BROADCAST 0 // unreliable to all 5 | #define MSG_ONE 1 // reliable to one (msg_entity) 6 | #define MSG_ALL 2 // reliable to all 7 | #define MSG_INIT 3 // write to the init string 8 | #define MSG_PVS 4 // Ents in PVS of org 9 | #define MSG_PAS 5 // Ents in PAS of org 10 | #define MSG_PVS_R 6 // Reliable to PVS 11 | #define MSG_PAS_R 7 // Reliable to PAS 12 | #define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped ) 13 | #define MSG_SPEC 9 // Sends to all spectator proxies 14 | 15 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/minimath.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_MINIMATH_H 2 | #define INCLUDE_MINIMATH_H 3 | 4 | #define M_PI 3.14159265358979323846 5 | 6 | #ifndef min 7 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 8 | #endif 9 | 10 | #ifndef max 11 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 12 | #endif 13 | 14 | #ifndef clamp 15 | #define clamp(a,b,c) (((a) > (c)) ? (c) : (((a) < (b)) ? (b) : (a))) 16 | #endif 17 | 18 | #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} 19 | #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} 20 | #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} 21 | #define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;} 22 | #define VectorScale(a,b,c){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;} 23 | 24 | typedef float vec_t; 25 | typedef vec_t vec3_t[3]; 26 | typedef vec_t vec4_t[4]; 27 | typedef int fixed16_t; 28 | 29 | typedef union DLONG_u 30 | { 31 | int i[2]; 32 | double d; 33 | float f; 34 | } DLONG; 35 | 36 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/monsterevent.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_MONSTEREVENT_H 2 | #define INCLUDE_MONSTEREVENT_H 3 | 4 | typedef struct MonsterEvent_s 5 | { 6 | int event; 7 | char *options; 8 | 9 | } MonsterEvent_t; 10 | 11 | #define EVENT_SPECIFIC 0 12 | #define EVENT_SCRIPTED 1000 13 | #define EVENT_SHARED 2000 14 | #define EVENT_CLIENT 5000 15 | 16 | #define MONSTER_EVENT_BODYDROP_LIGHT 2001 17 | #define MONSTER_EVENT_BODYDROP_HEAVY 2002 18 | #define MONSTER_EVENT_SWISHSOUND 2010 19 | 20 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/newdllfunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_NEWDLLFUNCTIONS_H 2 | #define INCLUDE_NEWDLLFUNCTIONS_H 3 | 4 | #define NEW_DLL_FUNCTIONS_VERSION 1 5 | 6 | typedef struct 7 | { 8 | // Called right before the object's memory is freed. 9 | // Calls its destructor. 10 | void(*pfnOnFreeEntPrivateData)(edict_t *pEnt); 11 | void(*pfnGameShutdown)(void); 12 | int(*pfnShouldCollide)(edict_t *pentTouched, edict_t *pentOther); 13 | void(*pfnCvarValue)(const edict_t *pEnt, const char *value); 14 | void(*pfnCvarValue2)(const edict_t *pEnt, int requestID, const char *cvarName, const char *value); 15 | } NEW_DLL_FUNCTIONS; 16 | typedef int(*NEW_DLL_FUNCTIONS_FN)(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); 17 | 18 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/plane.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_PLANE_H 2 | #define INCLUDE_PLANE_H 3 | 4 | typedef struct 5 | { 6 | vec3_t normal; 7 | float dist; 8 | } plane_t; 9 | 10 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/player.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_PLAYER_H 2 | #define INCLUDE_PLAYER_H 3 | 4 | #include 5 | 6 | #define MIN_BUY_TIME 15 // the minimum threshold values for cvar mp_buytime 15 sec's 7 | #define MAX_BUFFER_MENU 175 8 | #define MAX_BUFFER_MENU_BRIEFING 50 9 | #define MAX_PLAYER_NAME_LENGTH 32 10 | #define MAX_AUTOBUY_LENGTH 256 11 | #define MAX_REBUY_LENGTH 256 12 | #define MAX_LOCATION_LENGTH 32 13 | #define MAX_RECENT_PATH 20 14 | #define MAX_HOSTAGE_ICON 4 // the maximum number of icons of the hostages in the HUD 15 | 16 | #define SUITUPDATETIME 3.5 17 | #define SUITFIRSTUPDATETIME 0.1 18 | 19 | #define PLAYER_FATAL_FALL_SPEED 1100.0f 20 | #define PLAYER_MAX_SAFE_FALL_SPEED 500.0f 21 | #define PLAYER_USE_RADIUS 64.0f 22 | 23 | #define ARMOR_RATIO 0.5 // Armor Takes 50% of the damage 24 | #define ARMOR_BONUS 0.5 // Each Point of Armor is work 1/x points of health 25 | 26 | #define FLASH_DRAIN_TIME 1.2 // 100 units/3 minutes 27 | #define FLASH_CHARGE_TIME 0.2 // 100 units/20 seconds (seconds per unit) 28 | 29 | // damage per unit per second. 30 | #define DAMAGE_FOR_FALL_SPEED 100.0f / (PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED) 31 | #define PLAYER_MIN_BOUNCE_SPEED 350.0f 32 | 33 | // won't punch player's screen/make scrape noise unless player falling at least this fast. 34 | #define PLAYER_FALL_PUNCH_THRESHHOLD 250.0f 35 | 36 | // Money blinks few of times on the freeze period 37 | // NOTE: It works for CZ 38 | #define MONEY_BLINK_AMOUNT 30 39 | 40 | // Player physics flags bits 41 | // CBasePlayer::m_afPhysicsFlags 42 | #define PFLAG_ONLADDER (1<<0) 43 | #define PFLAG_ONSWING (1<<0) 44 | #define PFLAG_ONTRAIN (1<<1) 45 | #define PFLAG_ONBARNACLE (1<<2) 46 | #define PFLAG_DUCKING (1<<3) // In the process of ducking, but totally squatted yet 47 | #define PFLAG_USING (1<<4) // Using a continuous entity 48 | #define PFLAG_OBSERVER (1<<5) // player is locked in stationary cam mode. Spectators can move, observers can't. 49 | 50 | #define TRAIN_OFF 0x00 51 | #define TRAIN_NEUTRAL 0x01 52 | #define TRAIN_SLOW 0x02 53 | #define TRAIN_MEDIUM 0x03 54 | #define TRAIN_FAST 0x04 55 | #define TRAIN_BACK 0x05 56 | 57 | #define TRAIN_ACTIVE 0x80 58 | #define TRAIN_NEW 0xc0 59 | 60 | #define SIGNAL_BUY (1<<0) 61 | #define SIGNAL_BOMB (1<<1) 62 | #define SIGNAL_RESCUE (1<<2) 63 | #define SIGNAL_ESCAPE (1<<3) 64 | #define SIGNAL_VIPSAFETY (1<<4) 65 | 66 | #define IGNOREMSG_NONE 0 67 | #define IGNOREMSG_ENEMY 1 68 | #define IGNOREMSG_TEAM 2 69 | 70 | // max of 4 suit sentences queued up at any time 71 | #define CSUITPLAYLIST 4 72 | 73 | #define SUIT_GROUP TRUE 74 | #define SUIT_SENTENCE FALSE 75 | 76 | #define SUIT_REPEAT_OK 0 77 | #define SUIT_NEXT_IN_30SEC 30 78 | #define SUIT_NEXT_IN_1MIN 60 79 | #define SUIT_NEXT_IN_5MIN 300 80 | #define SUIT_NEXT_IN_10MIN 600 81 | #define SUIT_NEXT_IN_30MIN 1800 82 | #define SUIT_NEXT_IN_1HOUR 3600 83 | 84 | #define TEAM_NAME_LENGTH 16 85 | 86 | #define MAX_ID_RANGE 2048.0f 87 | #define MAX_SPECTATOR_ID_RANGE 8192.0f 88 | #define SBAR_STRING_SIZE 128 89 | 90 | #define SBAR_TARGETTYPE_TEAMMATE 1 91 | #define SBAR_TARGETTYPE_ENEMY 2 92 | #define SBAR_TARGETTYPE_HOSTAGE 3 93 | 94 | #define CHAT_INTERVAL 1.0f 95 | #define CSUITNOREPEAT 32 96 | 97 | #define AUTOAIM_2DEGREES 0.0348994967025f 98 | #define AUTOAIM_5DEGREES 0.08715574274766f 99 | #define AUTOAIM_8DEGREES 0.1391731009601f 100 | #define AUTOAIM_10DEGREES 0.1736481776669f 101 | 102 | #define SOUND_FLASHLIGHT_ON "items/flashlight1.wav" 103 | #define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav" 104 | 105 | // custom enum 106 | enum RewardType 107 | { 108 | RT_NONE, 109 | RT_ROUND_BONUS, 110 | RT_PLAYER_RESET, 111 | RT_PLAYER_JOIN, 112 | RT_PLAYER_SPEC_JOIN, 113 | RT_PLAYER_BOUGHT_SOMETHING, 114 | RT_HOSTAGE_TOOK, 115 | RT_HOSTAGE_RESCUED, 116 | RT_HOSTAGE_DAMAGED, 117 | RT_HOSTAGE_KILLED, 118 | RT_TEAMMATES_KILLED, 119 | RT_ENEMY_KILLED, 120 | RT_INTO_GAME, 121 | RT_VIP_KILLED, 122 | RT_VIP_RESCUED_MYSELF 123 | }; 124 | 125 | enum PLAYER_ANIM 126 | { 127 | PLAYER_IDLE, 128 | PLAYER_WALK, 129 | PLAYER_JUMP, 130 | PLAYER_SUPERJUMP, 131 | PLAYER_DIE, 132 | PLAYER_ATTACK1, 133 | PLAYER_ATTACK2, 134 | PLAYER_FLINCH, 135 | PLAYER_LARGE_FLINCH, 136 | PLAYER_RELOAD, 137 | PLAYER_HOLDBOMB 138 | }; 139 | 140 | enum _Menu 141 | { 142 | Menu_OFF, 143 | Menu_ChooseTeam, 144 | Menu_IGChooseTeam, 145 | Menu_ChooseAppearance, 146 | Menu_Buy, 147 | Menu_BuyPistol, 148 | Menu_BuyRifle, 149 | Menu_BuyMachineGun, 150 | Menu_BuyShotgun, 151 | Menu_BuySubMachineGun, 152 | Menu_BuyItem, 153 | Menu_Radio1, 154 | Menu_Radio2, 155 | Menu_Radio3, 156 | Menu_ClientBuy 157 | }; 158 | 159 | enum TeamName 160 | { 161 | UNASSIGNED, 162 | TERRORIST, 163 | CT, 164 | SPECTATOR, 165 | }; 166 | 167 | enum ModelName 168 | { 169 | MODEL_UNASSIGNED, 170 | MODEL_URBAN, 171 | MODEL_TERROR, 172 | MODEL_LEET, 173 | MODEL_ARCTIC, 174 | MODEL_GSG9, 175 | MODEL_GIGN, 176 | MODEL_SAS, 177 | MODEL_GUERILLA, 178 | MODEL_VIP, 179 | MODEL_MILITIA, 180 | MODEL_SPETSNAZ, 181 | MODEL_AUTO 182 | }; 183 | 184 | enum JoinState 185 | { 186 | JOINED, 187 | SHOWLTEXT, 188 | READINGLTEXT, 189 | SHOWTEAMSELECT, 190 | PICKINGTEAM, 191 | GETINTOGAME 192 | }; 193 | 194 | enum TrackCommands 195 | { 196 | CMD_SAY = 0, 197 | CMD_SAYTEAM, 198 | CMD_FULLUPDATE, 199 | CMD_VOTE, 200 | CMD_VOTEMAP, 201 | CMD_LISTMAPS, 202 | CMD_LISTPLAYERS, 203 | CMD_NIGHTVISION, 204 | COMMANDS_TO_TRACK, 205 | }; 206 | 207 | struct RebuyStruct 208 | { 209 | int m_primaryWeapon; 210 | int m_primaryAmmo; 211 | int m_secondaryWeapon; 212 | int m_secondaryAmmo; 213 | int m_heGrenade; 214 | int m_flashbang; 215 | int m_smokeGrenade; 216 | int m_defuser; 217 | int m_nightVision; 218 | ArmorType m_armor; 219 | }; 220 | 221 | enum ThrowDirection 222 | { 223 | THROW_NONE, 224 | THROW_FORWARD, 225 | THROW_BACKWARD, 226 | THROW_HITVEL, 227 | THROW_BOMB, 228 | THROW_GRENADE, 229 | THROW_HITVEL_MINUS_AIRVEL 230 | }; 231 | 232 | enum sbar_data 233 | { 234 | SBAR_ID_TARGETTYPE = 1, 235 | SBAR_ID_TARGETNAME, 236 | SBAR_ID_TARGETHEALTH, 237 | SBAR_END 238 | }; 239 | 240 | enum MusicState { SILENT, CALM, INTENSE }; 241 | 242 | class CCSPlayer; 243 | 244 | class CStripWeapons; 245 | class CInfoIntermission; 246 | class CDeadHEV; 247 | class CSprayCan; 248 | class CBloodSplat; 249 | class CBasePlayer; 250 | class CWShield; 251 | 252 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/printtype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_PRINTTYPE_H 2 | #define INCLUDE_PRINTTYPE_H 3 | 4 | enum PRINT_TYPE 5 | { 6 | print_notify = 1, 7 | print_console, 8 | print_chat, 9 | print_center, 10 | print_radio /* Counter-Strike only */ 11 | }; 12 | 13 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_RESOURCE_H 2 | #define INCLUDE_RESOURCE_H 3 | 4 | #define MAX_QPATH 64 5 | 6 | typedef struct resource_s 7 | { 8 | char szFileName[MAX_QPATH]; 9 | resourcetype_t type; 10 | int nIndex; 11 | int nDownloadSize; 12 | unsigned char ucFlags; 13 | 14 | unsigned char rgucMD5_hash[16]; 15 | unsigned char playernum; 16 | 17 | unsigned char rguc_reserved[32]; 18 | struct resource_s *pNext; 19 | struct resource_s *pPrev; 20 | } resource_t; 21 | 22 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/resourcetype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_RESOURCETYPE_H 2 | #define INCLUDE_RESOURCETYPE_H 3 | 4 | typedef enum 5 | { 6 | t_sound = 0, 7 | t_skin, 8 | t_model, 9 | t_decal, 10 | t_generic, 11 | t_eventscript, 12 | t_world, 13 | } resourcetype_t; 14 | 15 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/saverestore.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_SAVERESTORE_H 2 | #define INCLUDE_SAVERESTORE_H 3 | 4 | typedef struct saverestore_s SAVERESTOREDATA; 5 | 6 | #ifdef _WIN32 7 | typedef 8 | #endif 9 | 10 | struct saverestore_s 11 | { 12 | char *pBaseData; // Start of all entity save data 13 | char *pCurrentData; // Current buffer pointer for sequential access 14 | int size; // Current data size 15 | int bufferSize; // Total space for data 16 | int tokenSize; // Size of the linear list of tokens 17 | int tokenCount; // Number of elements in the pTokens table 18 | char **pTokens; // Hash table of entity strings (sparse) 19 | int currentIndex; // Holds a global entity table ID 20 | int tableCount; // Number of elements in the entity table 21 | int connectionCount;// Number of elements in the levelList[] 22 | ENTITYTABLE *pTable; // Array of ENTITYTABLE elements (1 for each entity) 23 | LEVELLIST levelList[ MAX_LEVEL_CONNECTIONS ]; // List of connections from this level 24 | 25 | // smooth transition 26 | int fUseLandmark; 27 | char szLandmarkName[20];// landmark we'll spawn near in next level 28 | vec3_t vecLandmarkOffset;// for landmark transitions 29 | float time; 30 | char szCurrentMapName[32]; // To check global entities 31 | 32 | } 33 | 34 | #ifdef _WIN32 35 | SAVERESTOREDATA 36 | #endif 37 | ; 38 | 39 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/sentenceentry.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_SENTENCEENTRY_H 2 | #define INCLUDE_SENTENCEENTRY_H 3 | 4 | typedef struct sentenceEntry sentenceEntry_s; 5 | 6 | struct sentenceEntry 7 | { 8 | char* data; 9 | sentenceEntry_s* nextEntry; 10 | qboolean isGlobal; 11 | unsigned int index; 12 | }; 13 | 14 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/sequencecommandline.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_SEQUENCECOMMANDLINE_H 2 | #define INCLUDE_SEQUENCECOMMANDLINE_H 3 | 4 | typedef struct sequenceCommandLine sequenceCommandLine_t; 5 | 6 | struct sequenceCommandLine 7 | { 8 | int commandType; 9 | client_textmessage_t clientMessage; 10 | char* speakerName; 11 | char* listenerName; 12 | char* soundFileName; 13 | char* sentenceName; 14 | char* fireTargetNames; 15 | char* killTargetNames; 16 | float delay; 17 | int repeatCount; 18 | int textChannel; 19 | int modifierBitField; 20 | sequenceCommandLine_t* nextCommandLine; 21 | }; 22 | 23 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/sequenceentiry.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_SEQUENCEENTRY_H 2 | #define INCLUDE_SEQUENCEENTRY_H 3 | 4 | typedef struct sequenceEntry sequenceEntry_t; 5 | 6 | typedef struct sequenceEntry 7 | { 8 | char* fileName; 9 | char* entryName; 10 | sequenceCommandLine_s* firstCommand; 11 | sequenceEntry_t* nextEntry; 12 | qboolean isGlobal; 13 | }; 14 | 15 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/sequenceentry.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_SEQUENCEENTRY_H 2 | #define INCLUDE_SEQUENCEENTRY_H 3 | 4 | typedef struct sequenceEntry sequenceEntry_s; 5 | 6 | struct sequenceEntry 7 | { 8 | char* fileName; 9 | char* entryName; 10 | sequenceCommandLine_t* firstCommand; 11 | sequenceEntry_s* nextEntry; 12 | qboolean isGlobal; 13 | }; 14 | 15 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/studio.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_STUDIO_H 2 | #define INCLUDE_STUDIO_H 3 | 4 | #define MAXSTUDIOTRIANGLES 20000 // TODO: tune this 5 | #define MAXSTUDIOVERTS 2048 // TODO: tune this 6 | #define MAXSTUDIOSEQUENCES 2048 // total animation sequences 7 | #define MAXSTUDIOSKINS 100 // total textures 8 | #define MAXSTUDIOSRCBONES 512 // bones allowed at source movement 9 | #define MAXSTUDIOBONES 128 // total bones actually used 10 | #define MAXSTUDIOMODELS 32 // sub-models per model 11 | #define MAXSTUDIOBODYPARTS 32 12 | #define MAXSTUDIOGROUPS 16 13 | #define MAXSTUDIOANIMATIONS 2048 // per sequence 14 | #define MAXSTUDIOMESHES 256 15 | #define MAXSTUDIOEVENTS 1024 16 | #define MAXSTUDIOPIVOTS 256 17 | #define MAXSTUDIOCONTROLLERS 8 18 | 19 | typedef struct 20 | { 21 | int id; 22 | int version; 23 | 24 | char name[64]; 25 | int length; 26 | 27 | vec3_t eyeposition; // ideal eye position 28 | vec3_t min; // ideal movement hull size 29 | vec3_t max; 30 | 31 | vec3_t bbmin; // clipping bounding box 32 | vec3_t bbmax; 33 | 34 | int flags; 35 | 36 | int numbones; // bones 37 | int boneindex; 38 | 39 | int numbonecontrollers; // bone controllers 40 | int bonecontrollerindex; 41 | 42 | int numhitboxes; // complex bounding boxes 43 | int hitboxindex; 44 | 45 | int numseq; // animation sequences 46 | int seqindex; 47 | 48 | int numseqgroups; // demand loaded sequences 49 | int seqgroupindex; 50 | 51 | int numtextures; // raw textures 52 | int textureindex; 53 | int texturedataindex; 54 | 55 | int numskinref; // replaceable textures 56 | int numskinfamilies; 57 | int skinindex; 58 | 59 | int numbodyparts; 60 | int bodypartindex; 61 | 62 | int numattachments; // queryable attachable points 63 | int attachmentindex; 64 | 65 | int soundtable; 66 | int soundindex; 67 | int soundgroups; 68 | int soundgroupindex; 69 | 70 | int numtransitions; // animation node to animation node transition graph 71 | int transitionindex; 72 | } studiohdr_t; 73 | 74 | // header for demand loaded sequence group data 75 | typedef struct 76 | { 77 | int id; 78 | int version; 79 | 80 | char name[64]; 81 | int length; 82 | } studioseqhdr_t; 83 | 84 | // bones 85 | typedef struct 86 | { 87 | char name[32]; // bone name for symbolic links 88 | int parent; // parent bone 89 | int flags; // ?? 90 | int bonecontroller[6]; // bone controller index, -1 == none 91 | float value[6]; // default DoF values 92 | float scale[6]; // scale for delta DoF values 93 | } mstudiobone_t; 94 | 95 | 96 | // bone controllers 97 | typedef struct 98 | { 99 | int bone; // -1 == 0 100 | int type; // X, Y, Z, XR, YR, ZR, M 101 | float start; 102 | float end; 103 | int rest; // byte index value at rest 104 | int index; // 0-3 user set controller, 4 mouth 105 | } mstudiobonecontroller_t; 106 | 107 | // intersection boxes 108 | typedef struct 109 | { 110 | int bone; 111 | int group; // intersection group 112 | vec3_t bbmin; // bounding box 113 | vec3_t bbmax; 114 | } mstudiobbox_t; 115 | 116 | // demand loaded sequence groups 117 | typedef struct 118 | { 119 | char label[32]; // textual name 120 | char name[64]; // file name 121 | int32 unused1; // was "cache" - index pointer 122 | int unused2; // was "data" - hack for group 0 123 | } mstudioseqgroup_t; 124 | 125 | // sequence descriptions 126 | typedef struct 127 | { 128 | char label[32]; // sequence label 129 | 130 | float fps; // frames per second 131 | int flags; // looping/non-looping flags 132 | 133 | int activity; 134 | int actweight; 135 | 136 | int numevents; 137 | int eventindex; 138 | 139 | int numframes; // number of frames per sequence 140 | 141 | int numpivots; // number of foot pivots 142 | int pivotindex; 143 | 144 | int motiontype; 145 | int motionbone; 146 | vec3_t linearmovement; 147 | int automoveposindex; 148 | int automoveangleindex; 149 | 150 | vec3_t bbmin; // per sequence bounding box 151 | vec3_t bbmax; 152 | 153 | int numblends; 154 | int animindex; // mstudioanim_t pointer relative to start of sequence group data 155 | // [blend][bone][X, Y, Z, XR, YR, ZR] 156 | 157 | int blendtype[2]; // X, Y, Z, XR, YR, ZR 158 | float blendstart[2]; // starting value 159 | float blendend[2]; // ending value 160 | int blendparent; 161 | 162 | int seqgroup; // sequence group for demand loading 163 | 164 | int entrynode; // transition node at entry 165 | int exitnode; // transition node at exit 166 | int nodeflags; // transition rules 167 | 168 | int nextseq; // auto advancing sequences 169 | } mstudioseqdesc_t; 170 | 171 | // events 172 | typedef struct mstudioevent_s 173 | { 174 | int frame; 175 | int event; 176 | int type; 177 | char options[64]; 178 | } mstudioevent_t; 179 | 180 | /* 181 | typedef struct 182 | { 183 | int frame; 184 | int event; 185 | int type; 186 | char options[64]; 187 | } mstudioevent_t; 188 | */ 189 | 190 | // pivots 191 | typedef struct 192 | { 193 | vec3_t org; // pivot point 194 | int start; 195 | int end; 196 | } mstudiopivot_t; 197 | 198 | // attachment 199 | typedef struct 200 | { 201 | char name[32]; 202 | int type; 203 | int bone; 204 | vec3_t org; // attachment point 205 | vec3_t vectors[3]; 206 | } mstudioattachment_t; 207 | 208 | typedef struct 209 | { 210 | unsigned short offset[6]; 211 | } mstudioanim_t; 212 | 213 | // animation frames 214 | typedef union 215 | { 216 | struct { 217 | byte valid; 218 | byte total; 219 | } num; 220 | short value; 221 | } mstudioanimvalue_t; 222 | 223 | 224 | 225 | // body part index 226 | typedef struct 227 | { 228 | char name[64]; 229 | int nummodels; 230 | int base; 231 | int modelindex; // index into models array 232 | } mstudiobodyparts_t; 233 | 234 | 235 | 236 | // skin info 237 | typedef struct 238 | { 239 | char name[64]; 240 | int flags; 241 | int width; 242 | int height; 243 | int index; 244 | } mstudiotexture_t; 245 | 246 | 247 | // skin families 248 | // short index[skinfamilies][skinref] 249 | 250 | // studio models 251 | typedef struct 252 | { 253 | char name[64]; 254 | 255 | int type; 256 | 257 | float boundingradius; 258 | 259 | int nummesh; 260 | int meshindex; 261 | 262 | int numverts; // number of unique vertices 263 | int vertinfoindex; // vertex bone info 264 | int vertindex; // vertex vec3_t 265 | int numnorms; // number of unique surface normals 266 | int norminfoindex; // normal bone info 267 | int normindex; // normal vec3_t 268 | 269 | int numgroups; // deformation groups 270 | int groupindex; 271 | } mstudiomodel_t; 272 | 273 | 274 | // vec3_t boundingbox[model][bone][2]; // complex intersection info 275 | 276 | 277 | // meshes 278 | typedef struct 279 | { 280 | int numtris; 281 | int triindex; 282 | int skinref; 283 | int numnorms; // per mesh normals 284 | int normindex; // normal vec3_t 285 | } mstudiomesh_t; 286 | 287 | // triangles 288 | #if 0 289 | typedef struct 290 | { 291 | short vertindex; // index into vertex array 292 | short normindex; // index into normal array 293 | short s,t; // s,t position on skin 294 | } mstudiotrivert_t; 295 | #endif 296 | 297 | #define STUDIO_DYNAMIC_LIGHT 0x0100 // dynamically get lighting from floor or ceil (flying monsters) 298 | #define STUDIO_TRACE_HITBOX 0x0200 // always use hitbox trace instead of bbox 299 | 300 | // lighting options 301 | #define STUDIO_NF_FLATSHADE 0x0001 302 | #define STUDIO_NF_CHROME 0x0002 303 | #define STUDIO_NF_FULLBRIGHT 0x0004 304 | #define STUDIO_NF_NOMIPS 0x0008 305 | #define STUDIO_NF_ALPHA 0x0010 306 | #define STUDIO_NF_ADDITIVE 0x0020 307 | #define STUDIO_NF_MASKED 0x0040 308 | 309 | // motion flags 310 | #define STUDIO_X 0x0001 311 | #define STUDIO_Y 0x0002 312 | #define STUDIO_Z 0x0004 313 | #define STUDIO_XR 0x0008 314 | #define STUDIO_YR 0x0010 315 | #define STUDIO_ZR 0x0020 316 | #define STUDIO_LX 0x0040 317 | #define STUDIO_LY 0x0080 318 | #define STUDIO_LZ 0x0100 319 | #define STUDIO_AX 0x0200 320 | #define STUDIO_AY 0x0400 321 | #define STUDIO_AZ 0x0800 322 | #define STUDIO_AXR 0x1000 323 | #define STUDIO_AYR 0x2000 324 | #define STUDIO_AZR 0x4000 325 | #define STUDIO_TYPES 0x7FFF 326 | #define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance 327 | 328 | // sequence flags 329 | #define STUDIO_LOOPING 0x0001 330 | 331 | // bone flags 332 | #define STUDIO_HAS_NORMALS 0x0001 333 | #define STUDIO_HAS_VERTICES 0x0002 334 | #define STUDIO_HAS_BBOX 0x0004 335 | #define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them 336 | 337 | #define RAD_TO_STUDIO (32768.0/M_PI) 338 | #define STUDIO_TO_RAD (M_PI/32768.0) 339 | 340 | 341 | #define STUDIO_NUM_HULLS 128 342 | #define STUDIO_NUM_PLANES (STUDIO_NUM_HULLS * 6) 343 | #define STUDIO_CACHE_SIZE 16 344 | 345 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/togglestate.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_TOGGLESTATE_H 2 | #define INCLUDE_TOGGLESTATE_H 3 | 4 | enum TOGGLE_STATE 5 | { 6 | TS_AT_TOP, 7 | TS_AT_BOTTOM, 8 | TS_GOING_UP, 9 | TS_GOING_DOWN 10 | }; 11 | 12 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/trace.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_TRACE_H 2 | #define INCLUDE_TRACE_H 3 | 4 | typedef struct 5 | { 6 | qboolean allsolid; // if true, plane is not valid 7 | qboolean startsolid; // if true, the initial point was in a solid area 8 | qboolean inopen, inwater; 9 | float fraction; // time completed, 1.0 = didn't hit anything 10 | vec3_t endpos; // final position 11 | plane_t plane; // surface normal at impact 12 | edict_t * ent; // entity the surface is on 13 | int hitgroup; // 0 == generic, non zero is specific body part 14 | } trace_t; 15 | 16 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/traceresult.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_TRACERESULT_H 2 | #define INCLUDE_TRACERESULT_H 3 | 4 | // Returned by TraceLine 5 | struct TraceResult 6 | { 7 | int fAllSolid; // if true, plane is not valid 8 | int fStartSolid; // if true, the initial point was in a solid area 9 | int fInOpen; 10 | int fInWater; 11 | float flFraction; // time completed, 1.0 = didn't hit anything 12 | vec3_t vecEndPos; // final position 13 | float flPlaneDist; 14 | vec3_t vecPlaneNormal; // surface normal at impact 15 | edict_t *pHit; // entity the surface is on 16 | int iHitgroup; // 0 == generic, non zero is specific body part 17 | }; 18 | 19 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/typedescription.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_TYPEDESCRIPTION_H 2 | #define INCLUDE_TYPEDESCRIPTION_H 3 | 4 | #define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore 5 | 6 | typedef struct 7 | { 8 | FIELDTYPE fieldType; 9 | char *fieldName; 10 | int fieldOffset; 11 | short fieldSize; 12 | short flags; 13 | } TYPEDESCRIPTION; 14 | 15 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/unisignals.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_UNISIGNALS_H 2 | #define INCLUDE_UNISIGNALS_H 3 | 4 | class CUnifiedSignals 5 | { 6 | public: 7 | CUnifiedSignals() 8 | { 9 | m_flSignal = 0; 10 | m_flState = 0; 11 | } 12 | 13 | public: 14 | inline void Update() { m_flState = m_flSignal; m_flSignal = 0; } 15 | inline void Signal(int flags) { m_flSignal |= flags; } 16 | inline int GetSignal() const { return m_flSignal; } 17 | inline int GetState() const { return m_flState; } 18 | 19 | public: 20 | int m_flSignal; 21 | int m_flState; 22 | }; 23 | 24 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/usetype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_USETYPE_H 2 | #define INCLUDE_USETYPE_H 3 | 4 | enum USE_TYPE 5 | { 6 | USE_OFF, 7 | USE_ON, 8 | USE_SET, 9 | USE_TOGGLE 10 | }; 11 | 12 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/util.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_UTIL_H 2 | #define INCLUDE_UTIL_H 3 | 4 | #define FStrEq(x,y) (strcmp(x,y) == 0) 5 | #define ENT(x) x->pContainingEntity 6 | #define EMIT_SOUND_SHORT(ent, chan, snd) EMIT_SOUND(ent, chan, snd, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 7 | #define STOP_SOUND(ent, chan, snd) EMIT_SOUND(ent, chan, snd, 0, 0, SND_STOP, PITCH_NORM) 8 | 9 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/utlmemory.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_UTLMEMORY_H 2 | #define INCLUDE_UTLMEMORY_H 3 | 4 | #pragma warning (disable:4100) 5 | #pragma warning (disable:4514) 6 | 7 | /*template 8 | inline void Construct(T *pMemory) 9 | { 10 | ::new(pMemory) T; 11 | } 12 | 13 | template 14 | inline void CopyConstruct(T *pMemory,T const& src) 15 | { 16 | ::new(pMemory) T(src); 17 | } 18 | 19 | template 20 | inline void Destruct(T *pMemory) 21 | { 22 | pMemory->~T(); 23 | 24 | #ifdef _DEBUG 25 | memset(pMemory,0xDD,sizeof(T)); 26 | #endif 27 | }*/ 28 | //----------------------------------------------------------------------------- 29 | // The CUtlMemory class: 30 | // A growable memory class which doubles in size by default. 31 | //----------------------------------------------------------------------------- 32 | template< class T > 33 | class CUtlMemory 34 | { 35 | public: 36 | // constructor, destructor 37 | CUtlMemory(int nGrowSize = 0, int nInitSize = 0); 38 | CUtlMemory(T* pMemory, int numElements); 39 | ~CUtlMemory(); 40 | 41 | // element access 42 | T& operator[](int i); 43 | T const& operator[](int i) const; 44 | T& Element(int i); 45 | T const& Element(int i) const; 46 | 47 | // Can we use this index? 48 | bool IsIdxValid(int i) const; 49 | 50 | // Gets the base address (can change when adding elements!) 51 | T* Base(); 52 | T const* Base() const; 53 | 54 | // Attaches the buffer to external memory.... 55 | void SetExternalBuffer(T* pMemory, int numElements); 56 | 57 | // Size 58 | int NumAllocated() const; 59 | int Count() const; 60 | 61 | // Grows the memory, so that at least allocated + num elements are allocated 62 | void Grow(int num = 1); 63 | 64 | // Makes sure we've got at least this much memory 65 | void EnsureCapacity(int num); 66 | 67 | // Memory deallocation 68 | void Purge(); 69 | 70 | // is the memory externally allocated? 71 | bool IsExternallyAllocated() const; 72 | 73 | // Set the size by which the memory grows 74 | void SetGrowSize(int size); 75 | 76 | private: 77 | enum 78 | { 79 | EXTERNAL_BUFFER_MARKER = -1, 80 | }; 81 | 82 | T* m_pMemory; 83 | int m_nAllocationCount; 84 | int m_nGrowSize; 85 | }; 86 | 87 | 88 | //----------------------------------------------------------------------------- 89 | // constructor, destructor 90 | //----------------------------------------------------------------------------- 91 | template< class T > 92 | CUtlMemory::CUtlMemory(int nGrowSize, int nInitAllocationCount) : m_pMemory(0), 93 | m_nAllocationCount(nInitAllocationCount), m_nGrowSize(nGrowSize) 94 | { 95 | if (nGrowSize < 0 || nGrowSize == EXTERNAL_BUFFER_MARKER) 96 | return; 97 | 98 | if (m_nAllocationCount) 99 | { 100 | m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); 101 | } 102 | } 103 | 104 | template< class T > 105 | CUtlMemory::CUtlMemory(T* pMemory, int numElements) : m_pMemory(pMemory), 106 | m_nAllocationCount(numElements) 107 | { 108 | // Special marker indicating externally supplied memory 109 | m_nGrowSize = EXTERNAL_BUFFER_MARKER; 110 | } 111 | 112 | template< class T > 113 | CUtlMemory::~CUtlMemory() 114 | { 115 | Purge(); 116 | } 117 | 118 | 119 | //----------------------------------------------------------------------------- 120 | // Attaches the buffer to external memory.... 121 | //----------------------------------------------------------------------------- 122 | template< class T > 123 | void CUtlMemory::SetExternalBuffer(T* pMemory, int numElements) 124 | { 125 | // Blow away any existing allocated memory 126 | Purge(); 127 | 128 | m_pMemory = pMemory; 129 | m_nAllocationCount = numElements; 130 | 131 | // Indicate that we don't own the memory 132 | m_nGrowSize = EXTERNAL_BUFFER_MARKER; 133 | } 134 | 135 | 136 | //----------------------------------------------------------------------------- 137 | // element access 138 | //----------------------------------------------------------------------------- 139 | template< class T > 140 | inline T& CUtlMemory::operator[](int i) 141 | { 142 | return m_pMemory[i]; 143 | } 144 | 145 | template< class T > 146 | inline T const& CUtlMemory::operator[](int i) const 147 | { 148 | return m_pMemory[i]; 149 | } 150 | 151 | template< class T > 152 | inline T& CUtlMemory::Element(int i) 153 | { 154 | return m_pMemory[i]; 155 | } 156 | 157 | template< class T > 158 | inline T const& CUtlMemory::Element(int i) const 159 | { 160 | return m_pMemory[i]; 161 | } 162 | 163 | 164 | //----------------------------------------------------------------------------- 165 | // is the memory externally allocated? 166 | //----------------------------------------------------------------------------- 167 | template< class T > 168 | bool CUtlMemory::IsExternallyAllocated() const 169 | { 170 | return m_nGrowSize == EXTERNAL_BUFFER_MARKER; 171 | } 172 | 173 | 174 | template< class T > 175 | void CUtlMemory::SetGrowSize(int nSize) 176 | { 177 | m_nGrowSize = nSize; 178 | } 179 | 180 | 181 | //----------------------------------------------------------------------------- 182 | // Gets the base address (can change when adding elements!) 183 | //----------------------------------------------------------------------------- 184 | template< class T > 185 | inline T* CUtlMemory::Base() 186 | { 187 | return m_pMemory; 188 | } 189 | 190 | template< class T > 191 | inline T const* CUtlMemory::Base() const 192 | { 193 | return m_pMemory; 194 | } 195 | 196 | 197 | //----------------------------------------------------------------------------- 198 | // Size 199 | //----------------------------------------------------------------------------- 200 | template< class T > 201 | inline int CUtlMemory::NumAllocated() const 202 | { 203 | return m_nAllocationCount; 204 | } 205 | 206 | template< class T > 207 | inline int CUtlMemory::Count() const 208 | { 209 | return m_nAllocationCount; 210 | } 211 | 212 | 213 | //----------------------------------------------------------------------------- 214 | // Is element index valid? 215 | //----------------------------------------------------------------------------- 216 | template< class T > 217 | inline bool CUtlMemory::IsIdxValid(int i) const 218 | { 219 | return (i >= 0) && (i < m_nAllocationCount); 220 | } 221 | 222 | 223 | //----------------------------------------------------------------------------- 224 | // Grows the memory 225 | //----------------------------------------------------------------------------- 226 | template< class T > 227 | void CUtlMemory::Grow(int num) 228 | { 229 | if (IsExternallyAllocated()) 230 | { 231 | // Can't grow a buffer whose memory was externally allocated 232 | return; 233 | } 234 | 235 | // Make sure we have at least numallocated + num allocations. 236 | // Use the grow rules specified for this memory (in m_nGrowSize) 237 | int nAllocationRequested = m_nAllocationCount + num; 238 | while (m_nAllocationCount < nAllocationRequested) 239 | { 240 | if (m_nAllocationCount != 0) 241 | { 242 | if (m_nGrowSize) 243 | { 244 | m_nAllocationCount += m_nGrowSize; 245 | } 246 | else 247 | { 248 | m_nAllocationCount += m_nAllocationCount; 249 | } 250 | } 251 | else 252 | { 253 | // Compute an allocation which is at least as big as a cache line... 254 | m_nAllocationCount = (31 + sizeof(T)) / sizeof(T); 255 | } 256 | } 257 | 258 | if (m_pMemory) 259 | { 260 | m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T)); 261 | } 262 | else 263 | { 264 | m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); 265 | } 266 | } 267 | 268 | 269 | //----------------------------------------------------------------------------- 270 | // Makes sure we've got at least this much memory 271 | //----------------------------------------------------------------------------- 272 | template< class T > 273 | inline void CUtlMemory::EnsureCapacity(int num) 274 | { 275 | if (m_nAllocationCount >= num) 276 | return; 277 | 278 | if (IsExternallyAllocated()) 279 | { 280 | // Can't grow a buffer whose memory was externally allocated 281 | return; 282 | } 283 | 284 | m_nAllocationCount = num; 285 | if (m_pMemory) 286 | { 287 | m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T)); 288 | } 289 | else 290 | { 291 | m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); 292 | } 293 | } 294 | 295 | 296 | //----------------------------------------------------------------------------- 297 | // Memory deallocation 298 | //----------------------------------------------------------------------------- 299 | template< class T > 300 | void CUtlMemory::Purge() 301 | { 302 | if (!IsExternallyAllocated()) 303 | { 304 | if (m_pMemory) 305 | { 306 | free((void*)m_pMemory); 307 | m_pMemory = 0; 308 | } 309 | m_nAllocationCount = 0; 310 | } 311 | } 312 | 313 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/utlvector.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_UTLVECTOR_H 2 | #define INCLUDE_UTLVECTOR_H 3 | 4 | template 5 | class CUtlVector 6 | { 7 | public: 8 | typedef T ElemType_t; 9 | 10 | // constructor, destructor 11 | CUtlVector(int growSize = 0, int initSize = 0); 12 | CUtlVector(T* pMemory, int numElements); 13 | ~CUtlVector(); 14 | 15 | // Copy the array. 16 | CUtlVector& operator=(const CUtlVector &other); 17 | 18 | // element access 19 | T& operator[](int i); 20 | T const& operator[](int i) const; 21 | T& Element(int i); 22 | T const& Element(int i) const; 23 | 24 | // Gets the base address (can change when adding elements!) 25 | T* Base(); 26 | T const* Base() const; 27 | 28 | // Returns the number of elements in the vector 29 | // SIZE IS DEPRECATED! 30 | int Count() const; 31 | int Size() const; // don't use me! 32 | 33 | // Is element index valid? 34 | bool IsValidIndex(int i) const; 35 | static int InvalidIndex(void); 36 | 37 | // Adds an element, uses default constructor 38 | int AddToHead(); 39 | int AddToTail(); 40 | int InsertBefore(int elem); 41 | int InsertAfter(int elem); 42 | 43 | // Adds an element, uses copy constructor 44 | int AddToHead(T const& src); 45 | int AddToTail(T const& src); 46 | int InsertBefore(int elem, T const& src); 47 | int InsertAfter(int elem, T const& src); 48 | 49 | // Adds multiple elements, uses default constructor 50 | int AddMultipleToHead(int num); 51 | int AddMultipleToTail(int num, const T *pToCopy=NULL); 52 | int InsertMultipleBefore(int elem, int num, const T *pToCopy=NULL); // If pToCopy is set, then it's an array of length 'num' and 53 | int InsertMultipleAfter(int elem, int num); 54 | 55 | // Calls RemoveAll() then AddMultipleToTail. 56 | void SetSize(int size); 57 | void SetCount(int count); 58 | 59 | // Calls SetSize and copies each element. 60 | void CopyArray(T const *pArray, int size); 61 | 62 | // Add the specified array to the tail. 63 | int AddVectorToTail(CUtlVector const &src); 64 | 65 | // Finds an element (element needs operator== defined) 66 | int Find(T const& src) const; 67 | 68 | bool HasElement(T const& src); 69 | 70 | // Makes sure we have enough memory allocated to store a requested # of elements 71 | void EnsureCapacity(int num); 72 | 73 | // Makes sure we have at least this many elements 74 | void EnsureCount(int num); 75 | 76 | // Element removal 77 | void FastRemove(int elem); // doesn't preserve order 78 | void Remove(int elem); // preserves order, shifts elements 79 | void FindAndRemove(T const& src); // removes first occurrence of src, preserves order, shifts elements 80 | void RemoveMultiple(int elem, int num); // preserves order, shifts elements 81 | void RemoveAll(); // doesn't deallocate memory 82 | 83 | // Memory deallocation 84 | void Purge(); 85 | 86 | // Purges the list and calls delete on each element in it. 87 | void PurgeAndDeleteElements(); 88 | 89 | // Set the size by which it grows when it needs to allocate more memory. 90 | void SetGrowSize(int size); 91 | 92 | protected: 93 | // Can't copy this unless we explicitly do it! 94 | CUtlVector(CUtlVector const& vec) { } 95 | 96 | // Grows the vector 97 | void GrowVector(int num = 1); 98 | 99 | // Shifts elements.... 100 | void ShiftElementsRight(int elem, int num = 1); 101 | void ShiftElementsLeft(int elem, int num = 1); 102 | 103 | // For easier access to the elements through the debugger 104 | void ResetDbgInfo(); 105 | 106 | CUtlMemory m_Memory; 107 | int m_Size; 108 | 109 | // For easier access to the elements through the debugger 110 | // it's in release builds so this can be used in libraries correctly 111 | T *m_pElements; 112 | }; 113 | 114 | //----------------------------------------------------------------------------- 115 | // For easier access to the elements through the debugger 116 | //----------------------------------------------------------------------------- 117 | 118 | template< class T > 119 | inline void CUtlVector::ResetDbgInfo() 120 | { 121 | m_pElements = m_Memory.Base(); 122 | } 123 | 124 | //----------------------------------------------------------------------------- 125 | // constructor, destructor 126 | //----------------------------------------------------------------------------- 127 | 128 | template< class T > 129 | inline CUtlVector::CUtlVector(int growSize, int initSize) : 130 | m_Memory(growSize, initSize), m_Size(0) 131 | { 132 | ResetDbgInfo(); 133 | } 134 | 135 | template< class T > 136 | inline CUtlVector::CUtlVector(T* pMemory, int numElements) : 137 | m_Memory(pMemory, numElements), m_Size(0) 138 | { 139 | ResetDbgInfo(); 140 | } 141 | 142 | template< class T > 143 | inline CUtlVector::~CUtlVector() 144 | { 145 | Purge(); 146 | } 147 | 148 | template 149 | inline CUtlVector& CUtlVector::operator=(const CUtlVector &other) 150 | { 151 | CopyArray(other.Base(), other.Count()); 152 | return *this; 153 | } 154 | 155 | //----------------------------------------------------------------------------- 156 | // element access 157 | //----------------------------------------------------------------------------- 158 | 159 | template< class T > 160 | inline T& CUtlVector::operator[](int i) 161 | { 162 | return m_Memory[i]; 163 | } 164 | 165 | template< class T > 166 | inline T const& CUtlVector::operator[](int i) const 167 | { 168 | return m_Memory[i]; 169 | } 170 | 171 | template< class T > 172 | inline T& CUtlVector::Element(int i) 173 | { 174 | return m_Memory[i]; 175 | } 176 | 177 | template< class T > 178 | inline T const& CUtlVector::Element(int i) const 179 | { 180 | return m_Memory[i]; 181 | } 182 | 183 | //----------------------------------------------------------------------------- 184 | // Gets the base address (can change when adding elements!) 185 | //----------------------------------------------------------------------------- 186 | 187 | template< class T > 188 | inline T* CUtlVector::Base() 189 | { 190 | return m_Memory.Base(); 191 | } 192 | 193 | template< class T > 194 | inline T const* CUtlVector::Base() const 195 | { 196 | return m_Memory.Base(); 197 | } 198 | 199 | //----------------------------------------------------------------------------- 200 | // Count 201 | //----------------------------------------------------------------------------- 202 | 203 | template< class T > 204 | inline int CUtlVector::Size() const 205 | { 206 | return m_Size; 207 | } 208 | 209 | template< class T > 210 | inline int CUtlVector::Count() const 211 | { 212 | return m_Size; 213 | } 214 | 215 | //----------------------------------------------------------------------------- 216 | // Is element index valid? 217 | //----------------------------------------------------------------------------- 218 | 219 | template< class T > 220 | inline bool CUtlVector::IsValidIndex(int i) const 221 | { 222 | return (i >= 0) && (i < m_Size); 223 | } 224 | 225 | //----------------------------------------------------------------------------- 226 | // Returns in invalid index 227 | //----------------------------------------------------------------------------- 228 | template< class T > 229 | inline int CUtlVector::InvalidIndex(void) 230 | { 231 | return -1; 232 | } 233 | 234 | //----------------------------------------------------------------------------- 235 | // Grows the vector 236 | //----------------------------------------------------------------------------- 237 | template< class T > 238 | void CUtlVector::GrowVector(int num) 239 | { 240 | if (m_Size + num - 1 >= m_Memory.NumAllocated()) 241 | { 242 | m_Memory.Grow(m_Size + num - m_Memory.NumAllocated()); 243 | } 244 | 245 | m_Size += num; 246 | ResetDbgInfo(); 247 | } 248 | 249 | //----------------------------------------------------------------------------- 250 | // Makes sure we have enough memory allocated to store a requested # of elements 251 | //----------------------------------------------------------------------------- 252 | template< class T > 253 | void CUtlVector::EnsureCapacity(int num) 254 | { 255 | m_Memory.EnsureCapacity(num); 256 | ResetDbgInfo(); 257 | } 258 | 259 | //----------------------------------------------------------------------------- 260 | // Makes sure we have at least this many elements 261 | //----------------------------------------------------------------------------- 262 | template< class T > 263 | void CUtlVector::EnsureCount(int num) 264 | { 265 | if (Count() < num) 266 | AddMultipleToTail(num - Count()); 267 | } 268 | 269 | //----------------------------------------------------------------------------- 270 | // Shifts elements 271 | //----------------------------------------------------------------------------- 272 | template< class T > 273 | void CUtlVector::ShiftElementsRight(int elem, int num) 274 | { 275 | int numToMove = m_Size - elem - num; 276 | if ((numToMove > 0) && (num > 0)) 277 | memmove(&Element(elem+num), &Element(elem), numToMove * sizeof(T)); 278 | } 279 | 280 | template< class T > 281 | void CUtlVector::ShiftElementsLeft(int elem, int num) 282 | { 283 | int numToMove = m_Size - elem - num; 284 | if ((numToMove > 0) && (num > 0)) 285 | { 286 | memmove(&Element(elem), &Element(elem+num), numToMove * sizeof(T)); 287 | 288 | #ifdef _DEBUG 289 | memset(&Element(m_Size-num), 0xDD, num * sizeof(T)); 290 | #endif 291 | } 292 | } 293 | 294 | //----------------------------------------------------------------------------- 295 | // Adds an element, uses default constructor 296 | //----------------------------------------------------------------------------- 297 | 298 | template< class T > 299 | inline int CUtlVector::AddToHead() 300 | { 301 | return InsertBefore(0); 302 | } 303 | 304 | template< class T > 305 | inline int CUtlVector::AddToTail() 306 | { 307 | return InsertBefore(m_Size); 308 | } 309 | 310 | template< class T > 311 | inline int CUtlVector::InsertAfter(int elem) 312 | { 313 | return InsertBefore(elem + 1); 314 | } 315 | 316 | template< class T > 317 | int CUtlVector::InsertBefore(int elem) 318 | { 319 | GrowVector(); 320 | ShiftElementsRight(elem); 321 | Construct(&Element(elem)); 322 | return elem; 323 | } 324 | 325 | //----------------------------------------------------------------------------- 326 | // Adds an element, uses copy constructor 327 | //----------------------------------------------------------------------------- 328 | 329 | template< class T > 330 | inline int CUtlVector::AddToHead(T const& src) 331 | { 332 | return InsertBefore(0, src); 333 | } 334 | 335 | template< class T > 336 | inline int CUtlVector::AddToTail(T const& src) 337 | { 338 | return InsertBefore(m_Size, src); 339 | } 340 | 341 | template< class T > 342 | inline int CUtlVector::InsertAfter(int elem, T const& src) 343 | { 344 | return InsertBefore(elem + 1, src); 345 | } 346 | 347 | template< class T > 348 | int CUtlVector::InsertBefore(int elem, T const& src) 349 | { 350 | GrowVector(); 351 | ShiftElementsRight(elem); 352 | CopyConstruct(&Element(elem), src); 353 | return elem; 354 | } 355 | 356 | 357 | //----------------------------------------------------------------------------- 358 | // Adds multiple elements, uses default constructor 359 | //----------------------------------------------------------------------------- 360 | 361 | template< class T > 362 | inline int CUtlVector::AddMultipleToHead(int num) 363 | { 364 | return InsertMultipleBefore(0, num); 365 | } 366 | 367 | template< class T > 368 | inline int CUtlVector::AddMultipleToTail(int num, const T *pToCopy) 369 | { 370 | return InsertMultipleBefore(m_Size, num, pToCopy); 371 | } 372 | 373 | template< class T > 374 | int CUtlVector::InsertMultipleAfter(int elem, int num) 375 | { 376 | return InsertMultipleBefore(elem + 1, num); 377 | } 378 | 379 | 380 | template< class T > 381 | void CUtlVector::SetCount(int count) 382 | { 383 | RemoveAll(); 384 | AddMultipleToTail(count); 385 | } 386 | 387 | template< class T > 388 | inline void CUtlVector::SetSize(int size) 389 | { 390 | SetCount(size); 391 | } 392 | 393 | template< class T > 394 | void CUtlVector::CopyArray(T const *pArray, int size) 395 | { 396 | SetSize(size); 397 | for(int i=0; i < size; i++) 398 | (*this)[i] = pArray[i]; 399 | } 400 | 401 | template< class T > 402 | int CUtlVector::AddVectorToTail(CUtlVector const &src) 403 | { 404 | int base = Count(); 405 | 406 | // Make space. 407 | AddMultipleToTail(src.Count()); 408 | 409 | // Copy the elements. 410 | for (int i=0; i < src.Count(); i++) 411 | (*this)[base + i] = src[i]; 412 | 413 | return base; 414 | } 415 | 416 | template< class T > 417 | inline int CUtlVector::InsertMultipleBefore(int elem, int num, const T *pToInsert) 418 | { 419 | if(num == 0) 420 | return elem; 421 | 422 | GrowVector(num); 423 | ShiftElementsRight(elem, num); 424 | 425 | // Invoke default constructors 426 | for (int i = 0; i < num; ++i) 427 | Construct(&Element(elem+i)); 428 | 429 | // Copy stuff in? 430 | if (pToInsert) 431 | { 432 | for (int i=0; i < num; i++) 433 | { 434 | Element(elem+i) = pToInsert[i]; 435 | } 436 | } 437 | 438 | return elem; 439 | } 440 | 441 | //----------------------------------------------------------------------------- 442 | // Finds an element (element needs operator== defined) 443 | //----------------------------------------------------------------------------- 444 | template< class T > 445 | int CUtlVector::Find(T const& src) const 446 | { 447 | for (int i = 0; i < Count(); ++i) 448 | { 449 | if (Element(i) == src) 450 | return i; 451 | } 452 | return -1; 453 | } 454 | 455 | template< class T > 456 | bool CUtlVector::HasElement(T const& src) 457 | { 458 | return (Find(src) >= 0); 459 | } 460 | 461 | //----------------------------------------------------------------------------- 462 | // Element removal 463 | //----------------------------------------------------------------------------- 464 | 465 | template< class T > 466 | void CUtlVector::FastRemove(int elem) 467 | { 468 | Destruct(&Element(elem)); 469 | if (m_Size > 0) 470 | { 471 | Q_memcpy(&Element(elem), &Element(m_Size-1), sizeof(T)); 472 | --m_Size; 473 | } 474 | } 475 | 476 | template< class T > 477 | void CUtlVector::Remove(int elem) 478 | { 479 | Destruct(&Element(elem)); 480 | ShiftElementsLeft(elem); 481 | --m_Size; 482 | } 483 | 484 | template< class T > 485 | void CUtlVector::FindAndRemove(T const& src) 486 | { 487 | int elem = Find(src); 488 | if (elem != -1) 489 | { 490 | Remove(elem); 491 | } 492 | } 493 | 494 | template< class T > 495 | void CUtlVector::RemoveMultiple(int elem, int num) 496 | { 497 | for (int i = elem + num; --i >= elem;) 498 | Destruct(&Element(i)); 499 | 500 | ShiftElementsLeft(elem, num); 501 | m_Size -= num; 502 | } 503 | 504 | template< class T > 505 | void CUtlVector::RemoveAll() 506 | { 507 | for (int i = m_Size; --i >= 0;) 508 | Destruct(&Element(i)); 509 | 510 | m_Size = 0; 511 | } 512 | 513 | //----------------------------------------------------------------------------- 514 | // Memory deallocation 515 | //----------------------------------------------------------------------------- 516 | 517 | template< class T > 518 | void CUtlVector::Purge() 519 | { 520 | RemoveAll(); 521 | m_Memory.Purge(); 522 | ResetDbgInfo(); 523 | } 524 | 525 | template 526 | inline void CUtlVector::PurgeAndDeleteElements() 527 | { 528 | for (int i = 0; i < m_Size; i++) 529 | delete Element(i); 530 | 531 | Purge(); 532 | } 533 | 534 | template< class T > 535 | void CUtlVector::SetGrowSize(int size) 536 | { 537 | m_Memory.SetGrowSize(size); 538 | } 539 | 540 | #endif 541 | -------------------------------------------------------------------------------- /SDK/cssdk/vector.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_VECTOR_H 2 | #define INCLUDE_VECTOR_H 3 | 4 | #include 5 | 6 | // 2DVector - used for many pathfinding and many other 7 | // operations that are treated as planar rather than 3d. 8 | class Vector2D { 9 | public: 10 | inline Vector2D() : x(), y() {} 11 | inline Vector2D(float X, float Y) : x(X), y(Y) {} 12 | inline Vector2D(const Vector2D &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; } 13 | inline Vector2D operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); } 14 | inline Vector2D operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); } 15 | inline Vector2D operator*(float fl) const { return Vector2D(x * fl, y * fl); } 16 | inline Vector2D operator/(float fl) const { return Vector2D(x / fl, y / fl); } 17 | inline Vector2D operator/=(float fl) const { return Vector2D(x / fl, y / fl); } 18 | 19 | inline float Length() const { return sqrt(x * x + y * y); } 20 | inline float LengthSquared() const { return (x * x + y * y); } 21 | 22 | operator float*() { return &x; } 23 | operator const float*() const { return &x; } 24 | 25 | inline Vector2D Normalize() const 26 | { 27 | float flLen = Length(); 28 | if (flLen == 0) 29 | return Vector2D(0, 0); 30 | 31 | flLen = 1 / flLen; 32 | return Vector2D(x * flLen, y * flLen); 33 | } 34 | 35 | inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); } 36 | inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); } 37 | inline float NormalizeInPlace() 38 | { 39 | float flLen = Length(); 40 | if (flLen == 0) 41 | { 42 | x = 1; y = 0; 43 | } 44 | else 45 | { 46 | flLen = 1 / flLen; 47 | x *= flLen; y *= flLen; 48 | } 49 | 50 | return flLen; 51 | } 52 | inline bool IsZero(float tolerance = 0.01f) const 53 | { 54 | return (x > -tolerance && x < tolerance && 55 | y > -tolerance && y < tolerance); 56 | } 57 | 58 | // Members 59 | vec_t x, y; 60 | }; 61 | 62 | inline float DotProduct(const Vector2D &a, const Vector2D &b) { return (a.x * b.x + a.y * b.y); } 63 | inline Vector2D operator*(float fl, const Vector2D &v) { return v * fl; } 64 | 65 | // 3D Vector 66 | // same data-layout as engine's vec3_t, which is a vec_t[3] 67 | class Vector { 68 | public: 69 | // Construction/destruction 70 | inline Vector() : x(), y(), z() {} 71 | inline Vector(float X, float Y, float Z) : x(X), y(Y), z(Z) {} 72 | inline Vector(const Vector &v) { *(int*)&x = *(int*)&v.x; *(int*)&y = *(int*)&v.y; *(int*)&z = *(int*)&v.z; } 73 | inline Vector(const float rgfl[3]) { *(int*)&x = *(int*)&rgfl[0]; *(int*)&y = *(int*)&rgfl[1]; *(int*)&z = *(int*)&rgfl[2]; } 74 | 75 | // Operators 76 | inline Vector operator-() const { return Vector(-x, -y, -z); } 77 | inline int operator==(const Vector &v) const { return x == v.x && y == v.y && z == v.z; } 78 | inline int operator!=(const Vector &v) const { return !(*this == v); } 79 | inline Vector operator+(const Vector &v) const { return Vector(x + v.x, y + v.y, z + v.z); } 80 | inline Vector operator-(const Vector &v) const { return Vector(x - v.x, y - v.y, z - v.z); } 81 | inline Vector operator*(float fl) const { return Vector(x * fl, y * fl, z * fl); } 82 | inline Vector operator/(float fl) const { return Vector(x / fl, y / fl, z / fl); } 83 | inline Vector operator/=(float fl) const{ return Vector(x / fl, y / fl, z / fl); } 84 | 85 | // Methods 86 | inline void CopyToArray(float *rgfl) const { *(int*)&rgfl[0] = *(int*)&x; *(int*)&rgfl[1] = *(int*)&y; *(int*)&rgfl[2] = *(int*)&z; } 87 | inline float Length() const { return sqrt(x * x + y * y + z * z); } 88 | inline float LengthSquared() const { return (x * x + y * y + z * z); } 89 | 90 | operator float*() { return &x; } // Vectors will now automatically convert to float * when needed 91 | operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed 92 | 93 | inline Vector Normalize() 94 | { 95 | float flLen = Length(); 96 | 97 | if (flLen == 0) 98 | return Vector(0, 0, 1); 99 | 100 | flLen = 1 / flLen; 101 | return Vector(x * flLen, y * flLen, z * flLen); 102 | } 103 | inline Vector2D Make2D() const 104 | { 105 | Vector2D Vec2; 106 | *(int*)&Vec2.x = *(int*)&x; 107 | *(int*)&Vec2.y = *(int*)&y; 108 | return Vec2; 109 | } 110 | 111 | inline float Length2D() const { return sqrt(x * x + y * y); } 112 | 113 | inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); } 114 | inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); } 115 | 116 | inline float NormalizeInPlace() 117 | { 118 | float flLen = Length(); 119 | if (flLen == 0) 120 | { 121 | x = 0; y = 0; z = 1; 122 | } 123 | else 124 | { 125 | flLen = 1 / flLen; 126 | x *= flLen; y *= flLen; z *= flLen; 127 | } 128 | 129 | return flLen; 130 | } 131 | inline bool IsZero(float tolerance = 0.01f) const 132 | { 133 | return (x > -tolerance && x < tolerance && 134 | y > -tolerance && y < tolerance && 135 | z > -tolerance && z < tolerance); 136 | } 137 | 138 | // Members 139 | vec_t x, y, z; 140 | }; 141 | 142 | inline Vector operator*(float fl, const Vector &v) { return v * fl; } 143 | inline float DotProduct(const Vector &a, const Vector &b) { return (a.x * b.x + a.y * b.y + a.z * b.z); } 144 | inline float DotProduct2D(const Vector &a, const Vector &b) { return (a.x * b.x + a.y * b.y); } 145 | inline Vector CrossProduct(const Vector &a, const Vector &b) { return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } 146 | 147 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/weapondata.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_WEAPONDATA_H 2 | #define INCLUDE_WEAPONDATA_H 3 | 4 | typedef struct weapon_data_s 5 | { 6 | int m_iId; 7 | int m_iClip; 8 | 9 | float m_flNextPrimaryAttack; 10 | float m_flNextSecondaryAttack; 11 | float m_flTimeWeaponIdle; 12 | 13 | int m_fInReload; 14 | int m_fInSpecialReload; 15 | float m_flNextReload; 16 | float m_flPumpTime; 17 | float m_fReloadTime; 18 | 19 | float m_fAimedDamage; 20 | float m_fNextAimBonus; 21 | int m_fInZoom; 22 | int m_iWeaponState; 23 | 24 | int iuser1; 25 | int iuser2; 26 | int iuser3; 27 | int iuser4; 28 | float fuser1; 29 | float fuser2; 30 | float fuser3; 31 | float fuser4; 32 | } weapon_data_t; 33 | 34 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/weapons.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_WEAPONS_H 2 | #define INCLUDE_WEAPONS_H 3 | 4 | class CBasePlayer; 5 | 6 | #define MAX_WEAPONS 32 7 | #define MAX_NORMAL_BATTERY 100.0f 8 | #define DISTANCE_RELOAD_SOUND 512.0f 9 | 10 | #define ITEM_FLAG_SELECTONEMPTY 1 11 | #define ITEM_FLAG_NOAUTORELOAD 2 12 | #define ITEM_FLAG_NOAUTOSWITCHEMPTY 4 13 | #define ITEM_FLAG_LIMITINWORLD 8 14 | #define ITEM_FLAG_EXHAUSTIBLE 16 // A player can totally exhaust their ammo supply and lose this weapon 15 | 16 | #define WEAPON_IS_ONTARGET 0x40 17 | 18 | // the maximum amount of ammo each weapon's clip can hold 19 | #define WEAPON_NOCLIP -1 20 | 21 | #define LOUD_GUN_VOLUME 1000 22 | #define NORMAL_GUN_VOLUME 600 23 | #define QUIET_GUN_VOLUME 200 24 | 25 | #define BRIGHT_GUN_FLASH 512 26 | #define NORMAL_GUN_FLASH 256 27 | #define DIM_GUN_FLASH 128 28 | 29 | #define BIG_EXPLOSION_VOLUME 2048 30 | #define NORMAL_EXPLOSION_VOLUME 1024 31 | #define SMALL_EXPLOSION_VOLUME 512 32 | 33 | #define WEAPON_ACTIVITY_VOLUME 64 34 | 35 | // spawn flags 36 | #define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges 37 | 38 | // for usermsg BombDrop 39 | #define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect 40 | #define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar. 41 | 42 | // custom enum 43 | enum ArmorType 44 | { 45 | ARMOR_NONE, // no armor 46 | ARMOR_KEVLAR, // body vest only 47 | ARMOR_VESTHELM, // vest and helmet 48 | }; 49 | 50 | enum ArmouryItemPack 51 | { 52 | ARMOURY_MP5NAVY, 53 | ARMOURY_TMP, 54 | ARMOURY_P90, 55 | ARMOURY_MAC10, 56 | ARMOURY_AK47, 57 | ARMOURY_SG552, 58 | ARMOURY_M4A1, 59 | ARMOURY_AUG, 60 | ARMOURY_SCOUT, 61 | ARMOURY_G3SG1, 62 | ARMOURY_AWP, 63 | ARMOURY_M3, 64 | ARMOURY_XM1014, 65 | ARMOURY_M249, 66 | ARMOURY_FLASHBANG, 67 | ARMOURY_HEGRENADE, 68 | ARMOURY_KEVLAR, 69 | ARMOURY_ASSAULT, 70 | ARMOURY_SMOKEGRENADE, 71 | ARMOURY_GLOCK18, 72 | ARMOURY_USP, 73 | ARMOURY_ELITE, 74 | ARMOURY_FIVESEVEN, 75 | ARMOURY_P228, 76 | ARMOURY_DEAGLE, 77 | ARMOURY_FAMAS, 78 | ARMOURY_SG550, 79 | ARMOURY_GALIL, 80 | ARMOURY_UMP45, 81 | ARMOURY_SHIELD 82 | }; 83 | 84 | struct ItemInfo 85 | { 86 | int iSlot; 87 | int iPosition; 88 | const char *pszAmmo1; 89 | int iMaxAmmo1; 90 | const char *pszAmmo2; 91 | int iMaxAmmo2; 92 | const char *pszName; 93 | int iMaxClip; 94 | int iId; 95 | int iFlags; 96 | int iWeight; 97 | }; 98 | 99 | struct AmmoInfo 100 | { 101 | const char *pszName; 102 | int iId; 103 | }; 104 | 105 | struct MULTIDAMAGE 106 | { 107 | CBaseEntity *pEntity; 108 | float amount; 109 | int type; 110 | }; 111 | 112 | class CArmoury; 113 | class CGrenade; 114 | class CBasePlayerItem; 115 | class CBasePlayerWeapon; 116 | class CBasePlayerAmmo; 117 | class CWeaponBox; 118 | 119 | class CUSP; 120 | class CMP5N; 121 | class CSG552; 122 | class CAK47; 123 | class CAUG; 124 | class CAWP; 125 | class CC4; 126 | class CDEAGLE; 127 | class CFlashbang; 128 | class CG3SG1; 129 | class CGLOCK18; 130 | class CHEGrenade; 131 | class CKnife; 132 | class CM249; 133 | class CM3; 134 | class CM4A1; 135 | class CMAC10; 136 | class CP228; 137 | class CP90; 138 | class CSCOUT; 139 | class CSmokeGrenade; 140 | class CTMP; 141 | class CXM1014; 142 | class CELITE; 143 | class CFiveSeven; 144 | class CUMP45; 145 | class CSG550; 146 | class CGalil; 147 | class CFamas; 148 | 149 | #endif -------------------------------------------------------------------------------- /SDK/cssdk/weapontype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_WEAPONTYPE_H 2 | #define INCLUDE_WEAPONTYPE_H 3 | 4 | enum WeaponIdType 5 | { 6 | WEAPON_NONE, 7 | WEAPON_P228, 8 | WEAPON_GLOCK, 9 | WEAPON_SCOUT, 10 | WEAPON_HEGRENADE, 11 | WEAPON_XM1014, 12 | WEAPON_C4, 13 | WEAPON_MAC10, 14 | WEAPON_AUG, 15 | WEAPON_SMOKEGRENADE, 16 | WEAPON_ELITE, 17 | WEAPON_FIVESEVEN, 18 | WEAPON_UMP45, 19 | WEAPON_SG550, 20 | WEAPON_GALIL, 21 | WEAPON_FAMAS, 22 | WEAPON_USP, 23 | WEAPON_GLOCK18, 24 | WEAPON_AWP, 25 | WEAPON_MP5N, 26 | WEAPON_MP5NAVY = 19, 27 | WEAPON_M249, 28 | WEAPON_M3, 29 | WEAPON_M4A1, 30 | WEAPON_TMP, 31 | WEAPON_G3SG1, 32 | WEAPON_FLASHBANG, 33 | WEAPON_DEAGLE, 34 | WEAPON_SG552, 35 | WEAPON_AK47, 36 | WEAPON_KNIFE, 37 | WEAPON_P90, 38 | WEAPON_SHIELDGUN = 99 39 | }; 40 | 41 | enum AutoBuyClassType 42 | { 43 | AUTOBUYCLASS_NONE = 0, 44 | AUTOBUYCLASS_PRIMARY = (1 << 0), 45 | AUTOBUYCLASS_SECONDARY = (1 << 1), 46 | AUTOBUYCLASS_AMMO = (1 << 2), 47 | AUTOBUYCLASS_ARMOR = (1 << 3), 48 | AUTOBUYCLASS_DEFUSER = (1 << 4), 49 | AUTOBUYCLASS_PISTOL = (1 << 5), 50 | AUTOBUYCLASS_SMG = (1 << 6), 51 | AUTOBUYCLASS_RIFLE = (1 << 7), 52 | AUTOBUYCLASS_SNIPERRIFLE = (1 << 8), 53 | AUTOBUYCLASS_SHOTGUN = (1 << 9), 54 | AUTOBUYCLASS_MACHINEGUN = (1 << 10), 55 | AUTOBUYCLASS_GRENADE = (1 << 11), 56 | AUTOBUYCLASS_NIGHTVISION = (1 << 12), 57 | AUTOBUYCLASS_SHIELD = (1 << 13), 58 | }; 59 | 60 | enum AmmoCostType 61 | { 62 | AMMO_338MAG_PRICE = 125, 63 | AMMO_357SIG_PRICE = 50, 64 | AMMO_45ACP_PRICE = 25, 65 | AMMO_50AE_PRICE = 40, 66 | AMMO_556MM_PRICE = 60, 67 | AMMO_57MM_PRICE = 50, 68 | AMMO_762MM_PRICE = 80, 69 | AMMO_9MM_PRICE = 20, 70 | AMMO_BUCKSHOT_PRICE = 65, 71 | }; 72 | 73 | enum WeaponCostType 74 | { 75 | AK47_PRICE = 2500, 76 | AWP_PRICE = 4750, 77 | DEAGLE_PRICE = 650, 78 | G3SG1_PRICE = 5000, 79 | SG550_PRICE = 4200, 80 | GLOCK18_PRICE = 400, 81 | M249_PRICE = 5750, 82 | M3_PRICE = 1700, 83 | M4A1_PRICE = 3100, 84 | AUG_PRICE = 3500, 85 | MP5NAVY_PRICE = 1500, 86 | P228_PRICE = 600, 87 | P90_PRICE = 2350, 88 | UMP45_PRICE = 1700, 89 | MAC10_PRICE = 1400, 90 | SCOUT_PRICE = 2750, 91 | SG552_PRICE = 3500, 92 | TMP_PRICE = 1250, 93 | USP_PRICE = 500, 94 | ELITE_PRICE = 800, 95 | FIVESEVEN_PRICE = 750, 96 | XM1014_PRICE = 3000, 97 | GALIL_PRICE = 2000, 98 | FAMAS_PRICE = 2250, 99 | SHIELDGUN_PRICE = 2200, 100 | }; 101 | 102 | enum WeaponState 103 | { 104 | WPNSTATE_USP_SILENCED = (1 << 0), 105 | WPNSTATE_GLOCK18_BURST_MODE = (1 << 1), 106 | WPNSTATE_M4A1_SILENCED = (1 << 2), 107 | WPNSTATE_ELITE_LEFT = (1 << 3), 108 | WPNSTATE_FAMAS_BURST_MODE = (1 << 4), 109 | WPNSTATE_SHIELD_DRAWN = (1 << 5), 110 | }; 111 | 112 | // custom enum 113 | // the default amount of ammo that comes with each gun when it spawns 114 | enum ClipGiveDefault 115 | { 116 | P228_DEFAULT_GIVE = 13, 117 | GLOCK18_DEFAULT_GIVE = 20, 118 | SCOUT_DEFAULT_GIVE = 10, 119 | HEGRENADE_DEFAULT_GIVE = 1, 120 | XM1014_DEFAULT_GIVE = 7, 121 | C4_DEFAULT_GIVE = 1, 122 | MAC10_DEFAULT_GIVE = 30, 123 | AUG_DEFAULT_GIVE = 30, 124 | SMOKEGRENADE_DEFAULT_GIVE = 1, 125 | ELITE_DEFAULT_GIVE = 30, 126 | FIVESEVEN_DEFAULT_GIVE = 20, 127 | UMP45_DEFAULT_GIVE = 25, 128 | SG550_DEFAULT_GIVE = 30, 129 | GALIL_DEFAULT_GIVE = 35, 130 | FAMAS_DEFAULT_GIVE = 25, 131 | USP_DEFAULT_GIVE = 12, 132 | AWP_DEFAULT_GIVE = 10, 133 | MP5NAVY_DEFAULT_GIVE = 30, 134 | M249_DEFAULT_GIVE = 100, 135 | M3_DEFAULT_GIVE = 8, 136 | M4A1_DEFAULT_GIVE = 30, 137 | TMP_DEFAULT_GIVE = 30, 138 | G3SG1_DEFAULT_GIVE = 20, 139 | FLASHBANG_DEFAULT_GIVE = 1, 140 | DEAGLE_DEFAULT_GIVE = 7, 141 | SG552_DEFAULT_GIVE = 30, 142 | AK47_DEFAULT_GIVE = 30, 143 | /*KNIFE_DEFAULT_GIVE = 1,*/ 144 | P90_DEFAULT_GIVE = 50, 145 | }; 146 | 147 | enum ClipSizeType 148 | { 149 | P228_MAX_CLIP = 13, 150 | GLOCK18_MAX_CLIP = 20, 151 | SCOUT_MAX_CLIP = 10, 152 | XM1014_MAX_CLIP = 7, 153 | MAC10_MAX_CLIP = 30, 154 | AUG_MAX_CLIP = 30, 155 | ELITE_MAX_CLIP = 30, 156 | FIVESEVEN_MAX_CLIP = 20, 157 | UMP45_MAX_CLIP = 25, 158 | SG550_MAX_CLIP = 30, 159 | GALIL_MAX_CLIP = 35, 160 | FAMAS_MAX_CLIP = 25, 161 | USP_MAX_CLIP = 12, 162 | AWP_MAX_CLIP = 10, 163 | MP5N_MAX_CLIP = 30, 164 | M249_MAX_CLIP = 100, 165 | M3_MAX_CLIP = 8, 166 | M4A1_MAX_CLIP = 30, 167 | TMP_MAX_CLIP = 30, 168 | G3SG1_MAX_CLIP = 20, 169 | DEAGLE_MAX_CLIP = 7, 170 | SG552_MAX_CLIP = 30, 171 | AK47_MAX_CLIP = 30, 172 | P90_MAX_CLIP = 50, 173 | }; 174 | 175 | enum WeightWeapon 176 | { 177 | P228_WEIGHT = 5, 178 | GLOCK18_WEIGHT = 5, 179 | SCOUT_WEIGHT = 30, 180 | HEGRENADE_WEIGHT = 2, 181 | XM1014_WEIGHT = 20, 182 | C4_WEIGHT = 3, 183 | MAC10_WEIGHT = 25, 184 | AUG_WEIGHT = 25, 185 | SMOKEGRENADE_WEIGHT = 1, 186 | ELITE_WEIGHT = 5, 187 | FIVESEVEN_WEIGHT = 5, 188 | UMP45_WEIGHT = 25, 189 | SG550_WEIGHT = 20, 190 | GALIL_WEIGHT = 25, 191 | FAMAS_WEIGHT = 75, 192 | USP_WEIGHT = 5, 193 | AWP_WEIGHT = 30, 194 | MP5NAVY_WEIGHT = 25, 195 | M249_WEIGHT = 25, 196 | M3_WEIGHT = 20, 197 | M4A1_WEIGHT = 25, 198 | TMP_WEIGHT = 25, 199 | G3SG1_WEIGHT = 20, 200 | FLASHBANG_WEIGHT = 1, 201 | DEAGLE_WEIGHT = 7, 202 | SG552_WEIGHT = 25, 203 | AK47_WEIGHT = 25, 204 | P90_WEIGHT = 26, 205 | KNIFE_WEIGHT = 0, 206 | }; 207 | 208 | enum MaxAmmoType 209 | { 210 | MAX_AMMO_BUCKSHOT = 32, 211 | MAX_AMMO_9MM = 120, 212 | MAX_AMMO_556NATO = 90, 213 | MAX_AMMO_556NATOBOX = 200, 214 | MAX_AMMO_762NATO = 90, 215 | MAX_AMMO_45ACP = 100, 216 | MAX_AMMO_50AE = 35, 217 | MAX_AMMO_338MAGNUM = 30, 218 | MAX_AMMO_57MM = 100, 219 | MAX_AMMO_357SIG = 52, 220 | 221 | // custom 222 | MAX_AMMO_SMOKEGRENADE = 1, 223 | MAX_AMMO_HEGRENADE = 1, 224 | MAX_AMMO_FLASHBANG = 2, 225 | }; 226 | 227 | enum AmmoType 228 | { 229 | AMMO_NONE, 230 | AMMO_338MAGNUM, 231 | AMMO_762NATO, 232 | AMMO_556NATOBOX, 233 | AMMO_556NATO, 234 | AMMO_BUCKSHOT, 235 | AMMO_45ACP, 236 | AMMO_57MM, 237 | AMMO_50AE, 238 | AMMO_357SIG, 239 | AMMO_9MM, 240 | AMMO_FLASHBANG, 241 | AMMO_HEGRENADE, 242 | AMMO_SMOKEGRENADE, 243 | AMMO_C4, 244 | 245 | AMMO_MAX_TYPES, 246 | }; 247 | 248 | enum WeaponClassType 249 | { 250 | WEAPONCLASS_NONE, 251 | WEAPONCLASS_KNIFE, 252 | WEAPONCLASS_PISTOL, 253 | WEAPONCLASS_GRENADE, 254 | WEAPONCLASS_SUBMACHINEGUN, 255 | WEAPONCLASS_SHOTGUN, 256 | WEAPONCLASS_MACHINEGUN, 257 | WEAPONCLASS_RIFLE, 258 | WEAPONCLASS_SNIPERRIFLE, 259 | WEAPONCLASS_MAX, 260 | }; 261 | 262 | enum AmmoBuyAmount 263 | { 264 | AMMO_338MAG_BUY = 10, 265 | AMMO_357SIG_BUY = 13, 266 | AMMO_45ACP_BUY = 12, 267 | AMMO_50AE_BUY = 7, 268 | AMMO_556NATO_BUY = 30, 269 | AMMO_556NATOBOX_BUY = 30, 270 | AMMO_57MM_BUY = 50, 271 | AMMO_762NATO_BUY = 30, 272 | AMMO_9MM_BUY = 30, 273 | AMMO_BUCKSHOT_BUY = 8, 274 | }; 275 | 276 | enum ItemCostType 277 | { 278 | ASSAULTSUIT_PRICE = 1000, 279 | FLASHBANG_PRICE = 200, 280 | HEGRENADE_PRICE = 300, 281 | SMOKEGRENADE_PRICE = 300, 282 | KEVLAR_PRICE = 650, 283 | HELMET_PRICE = 350, 284 | NVG_PRICE = 1250, 285 | DEFUSEKIT_PRICE = 200, 286 | }; 287 | 288 | enum shieldgun_e 289 | { 290 | SHIELDGUN_IDLE, 291 | SHIELDGUN_SHOOT1, 292 | SHIELDGUN_SHOOT2, 293 | SHIELDGUN_SHOOT_EMPTY, 294 | SHIELDGUN_RELOAD, 295 | SHIELDGUN_DRAW, 296 | SHIELDGUN_DRAWN_IDLE, 297 | SHIELDGUN_UP, 298 | SHIELDGUN_DOWN, 299 | }; 300 | 301 | // custom 302 | enum shieldgren_e 303 | { 304 | SHIELDREN_IDLE = 4, 305 | SHIELDREN_UP, 306 | SHIELDREN_DOWN 307 | }; 308 | 309 | enum InventorySlotType 310 | { 311 | NONE_SLOT, 312 | PRIMARY_WEAPON_SLOT, 313 | PISTOL_SLOT, 314 | KNIFE_SLOT, 315 | GRENADE_SLOT, 316 | C4_SLOT, 317 | }; 318 | 319 | enum Bullet 320 | { 321 | BULLET_NONE, 322 | BULLET_PLAYER_9MM, 323 | BULLET_PLAYER_MP5, 324 | BULLET_PLAYER_357, 325 | BULLET_PLAYER_BUCKSHOT, 326 | BULLET_PLAYER_CROWBAR, 327 | BULLET_MONSTER_9MM, 328 | BULLET_MONSTER_MP5, 329 | BULLET_MONSTER_12MM, 330 | BULLET_PLAYER_45ACP, 331 | BULLET_PLAYER_338MAG, 332 | BULLET_PLAYER_762MM, 333 | BULLET_PLAYER_556MM, 334 | BULLET_PLAYER_50AE, 335 | BULLET_PLAYER_57MM, 336 | BULLET_PLAYER_357SIG, 337 | }; 338 | 339 | struct WeaponStruct 340 | { 341 | int m_type; 342 | int m_price; 343 | int m_side; 344 | int m_slot; 345 | int m_ammoPrice; 346 | }; 347 | 348 | struct AutoBuyInfoStruct 349 | { 350 | AutoBuyClassType m_class; 351 | char *m_command; 352 | char *m_classname; 353 | }; 354 | 355 | struct WeaponAliasInfo 356 | { 357 | char *alias; 358 | WeaponIdType id; 359 | }; 360 | 361 | struct WeaponBuyAliasInfo 362 | { 363 | char *alias; 364 | WeaponIdType id; 365 | char *failName; 366 | }; 367 | 368 | struct WeaponClassAliasInfo 369 | { 370 | char *alias; 371 | WeaponClassType id; 372 | }; 373 | 374 | struct WeaponInfoStruct 375 | { 376 | int id; 377 | int cost; 378 | int clipCost; 379 | int buyClipSize; 380 | int gunClipSize; 381 | int maxRounds; 382 | int ammoType; 383 | char *entityName; 384 | const char *ammoName; 385 | }; 386 | 387 | struct WeaponSlotInfo 388 | { 389 | WeaponIdType id; 390 | InventorySlotType slot; 391 | const char *weaponName; 392 | }; 393 | 394 | #endif -------------------------------------------------------------------------------- /SDK/metamod/dllapi.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_DLLAPI_H 2 | #define INCLUDE_DLLAPI_H 3 | 4 | typedef int (*GETENTITYAPI_FN) (DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); 5 | typedef int (*GETENTITYAPI2_FN) (DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); 6 | typedef int (*GETNEWDLLFUNCTIONS_FN) (NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); 7 | 8 | typedef void (*FN_GAMEINIT) ( void ); 9 | typedef int (*FN_DISPATCHSPAWN) ( edict_t *pent ); 10 | typedef void (*FN_DISPATCHTHINK) ( edict_t *pent ); 11 | typedef void (*FN_DISPATCHUSE) ( edict_t *pentUsed, edict_t *pentOther ); 12 | typedef void (*FN_DISPATCHTOUCH) ( edict_t *pentTouched, edict_t *pentOther ); 13 | typedef void (*FN_DISPATCHBLOCKED) ( edict_t *pentBlocked, edict_t *pentOther ); 14 | typedef void (*FN_DISPATCHKEYVALUE) ( edict_t *pentKeyvalue, KeyValueData *pkvd ); 15 | typedef void (*FN_DISPATCHSAVE) ( edict_t *pent, SAVERESTOREDATA *pSaveData ); 16 | typedef int (*FN_DISPATCHRESTORE) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); 17 | typedef void (*FN_DISPATCHOBJECTCOLLISIONBOX) ( edict_t *pent ); 18 | typedef void (*FN_SAVEWRITEFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); 19 | typedef void (*FN_SAVEREADFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); 20 | typedef void (*FN_SAVEGLOBALSTATE) ( SAVERESTOREDATA *pSaveData ); 21 | typedef void (*FN_RESTOREGLOBALSTATE) ( SAVERESTOREDATA *pSaveData ); 22 | typedef void (*FN_RESETGLOBALSTATE) ( void ); 23 | 24 | typedef qboolean (*FN_CLIENTCONNECT) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]); 25 | typedef void (*FN_CLIENTDISCONNECT) ( edict_t *pEntity ); 26 | typedef void (*FN_CLIENTKILL) ( edict_t *pEntity ); 27 | typedef void (*FN_CLIENTPUTINSERVER) ( edict_t *pEntity ); 28 | typedef void (*FN_CLIENTCOMMAND) ( edict_t *pEntity ); 29 | typedef void (*FN_CLIENTUSERINFOCHANGED) ( edict_t *pEntity, char *infobuffer ); 30 | typedef void (*FN_SERVERACTIVATE) ( edict_t *pEdictList, int edictCount, int clientMax ); 31 | typedef void (*FN_SERVERDEACTIVATE) ( void ); 32 | typedef void (*FN_PLAYERPRETHINK) ( edict_t *pEntity ); 33 | typedef void (*FN_PLAYERPOSTTHINK) ( edict_t *pEntity ); 34 | typedef void (*FN_STARTFRAME) ( void ); 35 | typedef void (*FN_PARMSNEWLEVEL) ( void ); 36 | typedef void (*FN_PARMSCHANGELEVEL) ( void ); 37 | typedef const char *(*FN_GETGAMEDESCRIPTION) ( void ); 38 | typedef void (*FN_PLAYERCUSTOMIZATION) ( edict_t *pEntity, customization_t *pCust ); 39 | typedef void (*FN_SPECTATORCONNECT) ( edict_t *pEntity ); 40 | typedef void (*FN_SPECTATORDISCONNECT) ( edict_t *pEntity ); 41 | typedef void (*FN_SPECTATORTHINK) ( edict_t *pEntity ); 42 | typedef void (*FN_SYS_ERROR) ( const char *error_string ); 43 | 44 | typedef void (*FN_PM_MOVE) ( struct playermove_s *ppmove, int server ); 45 | typedef void (*FN_PM_INIT) ( struct playermove_s *ppmove ); 46 | typedef char (*FN_PM_FINDTEXTURETYPE) ( char *name ); 47 | 48 | typedef void (*FN_SETUPVISIBILITY) ( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ); 49 | typedef void (*FN_UPDATECLIENTDATA) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); 50 | typedef int (*FN_ADDTOFULLPACK) ( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); 51 | typedef void (*FN_CREATEBASELINE) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); 52 | typedef void (*FN_REGISTERENCODERS) ( void ); 53 | typedef int (*FN_GETWEAPONDATA) ( struct edict_s *player, struct weapon_data_s *info ); 54 | typedef void (*FN_CMDSTART) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ); 55 | typedef void (*FN_CMDEND) ( const edict_t *player ); 56 | typedef int (*FN_CONNECTIONLESSPACKET) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); 57 | typedef int (*FN_GETHULLBOUNDS) ( int hullnumber, float *mins, float *maxs ); 58 | typedef void (*FN_CREATEINSTANCEDBASELINES) ( void ); 59 | typedef int (*FN_INCONSISTENTFILE) ( const edict_t *player, const char *filename, char *disconnect_message ); 60 | typedef int (*FN_ALLOWLAGCOMPENSATION) ( void ); 61 | 62 | typedef void (*FN_ONFREEENTPRIVATEDATA) (edict_t *pEnt); 63 | typedef void (*FN_GAMESHUTDOWN) (void); 64 | typedef int (*FN_SHOULDCOLLIDE) (edict_t *pentTouched, edict_t *pentOther); 65 | // Added 2005/08/11 (no SDK update): 66 | typedef void (*FN_CVARVALUE)(const edict_t *pEnt, const char *value); 67 | // Added 2005/11/21 (no SDK update): 68 | typedef void (*FN_CVARVALUE2)(const edict_t *pEnt, int requestID, const char *cvarName, const char *value); 69 | 70 | #endif -------------------------------------------------------------------------------- /SDK/metamod/engineapi.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ENGINEAIP_H 2 | #define INCLUDE_ENGINEAIP_H 3 | 4 | typedef int (*GET_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion); 5 | typedef int (*FN_PRECACHEMODEL) (char* s); 6 | typedef int (*FN_PRECACHESOUND) (char* s); 7 | typedef void (*FN_SETMODEL) (edict_t *e, const char *m); 8 | typedef int (*FN_MODELINDEX) (const char *m); 9 | typedef int (*FN_MODELFRAMES) (int modelIndex); 10 | typedef void (*FN_SETSIZE) (edict_t *e, const float *rgflMin, const float *rgflMax); 11 | typedef void (*FN_CHANGELEVEL) (char *s1, char *s2); 12 | typedef void (*FN_GETSPAWNPARMS) (edict_t *ent); 13 | typedef void (*FN_SAVESPAWNPARMS) (edict_t *ent); 14 | typedef float (*FN_VECTOYAW) (const float *rgflVector); 15 | typedef void (*FN_VECTOANGLES) (const float *rgflVectorIn, float *rgflVectorOut); 16 | typedef void (*FN_MOVETOORIGIN) (edict_t *ent, const float *pflGoal, float dist, int iMoveType); 17 | typedef void (*FN_CHANGEYAW) (edict_t *ent); 18 | typedef void (*FN_CHANGEPITCH) (edict_t *ent); 19 | typedef edict_t * (*FN_FINDENTITYBYSTRING) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); 20 | typedef int (*FN_GETENTITYILLUM) (edict_t *pEnt); 21 | typedef edict_t * (*FN_FINDENTITYINSPHERE) (edict_t *pEdictStartSearchAfter, const float *org, float rad); 22 | typedef edict_t * (*FN_FINDCLIENTINPVS) (edict_t *pEdict); 23 | typedef edict_t * (*FN_ENTITIESINPVS) (edict_t *pplayer); 24 | typedef void (*FN_MAKEVECTORS) (const float *rgflVector); 25 | typedef void (*FN_ANGLEVECTORS) (const float *rgflVector, float *forward, float *right, float *up); 26 | typedef edict_t * (*FN_CREATEENTITY) (void); 27 | typedef void (*FN_REMOVEENTITY) (edict_t *e); 28 | typedef edict_t * (*FN_CREATENAMEDENTITY) (int className); 29 | typedef void (*FN_MAKESTATIC) (edict_t *ent); 30 | typedef int (*FN_ENTISONFLOOR) (edict_t *e); 31 | typedef int (*FN_DROPTOFLOOR) (edict_t *e); 32 | typedef int (*FN_WALKMOVE) (edict_t *ent, float yaw, float dist, int iMode); 33 | typedef void (*FN_SETORIGIN) (edict_t *e, const float *rgflOrigin); 34 | typedef void (*FN_EMITSOUND) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); 35 | typedef void (*FN_EMITAMBIENTSOUND) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); 36 | typedef void (*FN_TRACELINE) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); 37 | typedef void (*FN_TRACETOSS) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr); 38 | typedef int (*FN_TRACEMONSTERHULL) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); 39 | typedef void (*FN_TRACEHULL) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); 40 | typedef void (*FN_TRACEMODEL) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); 41 | typedef const char * (*FN_TRACETEXTURE) (edict_t *pTextureEntity, const float *v1, const float *v2 ); 42 | typedef void (*FN_TRACESPHERE) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); 43 | typedef void (*FN_GETAIMVECTOR) (edict_t *ent, float speed, float *rgflReturn); 44 | typedef void (*FN_SERVERCOMMAND) (char *str); 45 | typedef void (*FN_SERVEREXECUTE) (void); 46 | typedef void (*FN_CLIENTCOMMAND_ENG) (edict_t *pEdict, char *szFmt, ...); 47 | typedef void (*FN_PARTICLEEFFECT) (const float *org, const float *dir, float color, float count); 48 | typedef void (*FN_LIGHTSTYLE) (int style, char *val); 49 | typedef int (*FN_DECALINDEX) (const char *name); 50 | typedef int (*FN_POINTCONTENTS) (const float *rgflVector); 51 | typedef void (*FN_MESSAGEBEGIN) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); 52 | typedef void (*FN_MESSAGEEND) (void); 53 | typedef void (*FN_WRITEBYTE) (int iValue); 54 | typedef void (*FN_WRITECHAR) (int iValue); 55 | typedef void (*FN_WRITESHORT) (int iValue); 56 | typedef void (*FN_WRITELONG) (int iValue); 57 | typedef void (*FN_WRITEANGLE) (float flValue); 58 | typedef void (*FN_WRITECOORD) (float flValue); 59 | typedef void (*FN_WRITESTRING) (const char *sz); 60 | typedef void (*FN_WRITEENTITY) (int iValue); 61 | typedef void (*FN_CVARREGISTER) (cvar_t *pCvar); 62 | typedef float (*FN_CVARGETFLOAT) (const char *szVarName); 63 | typedef const char * (*FN_CVARGETSTRING) (const char *szVarName); 64 | typedef void (*FN_CVARSETFLOAT) (const char *szVarName, float flValue); 65 | typedef void (*FN_CVARSETSTRING) (const char *szVarName, const char *szValue); 66 | typedef void (*FN_ALERTMESSAGE) (ALERT_TYPE atype, char *szFmt, ...); 67 | typedef void (*FN_ENGINEFPRINTF) (void *pfile, char *szFmt, ...); 68 | typedef void * (*FN_PVALLOCENTPRIVATEDATA) (edict_t *pEdict, int32 cb); 69 | typedef void * (*FN_PVENTPRIVATEDATA) (edict_t *pEdict); 70 | typedef void (*FN_FREEENTPRIVATEDATA) (edict_t *pEdict); 71 | typedef const char * (*FN_SZFROMINDEX) (int iString); 72 | typedef int (*FN_ALLOCSTRING) (const char *szValue); 73 | typedef struct entvars_s * (*FN_GETVARSOFENT) (edict_t *pEdict); 74 | typedef edict_t * (*FN_PENTITYOFENTOFFSET) (int iEntOffset); 75 | typedef int (*FN_ENTOFFSETOFPENTITY) (const edict_t *pEdict); 76 | typedef int (*FN_INDEXOFEDICT) (const edict_t *pEdict); 77 | typedef edict_t * (*FN_PENTITYOFENTINDEX) (int iEntIndex); 78 | typedef edict_t * (*FN_FINDENTITYBYVARS) (struct entvars_s *pvars); 79 | typedef void * (*FN_GETMODELPTR) (edict_t *pEdict); 80 | typedef int (*FN_REGUSERMSG) (const char *pszName, int iSize); 81 | typedef void (*FN_ANIMATIONAUTOMOVE) (const edict_t *pEdict, float flTime); 82 | typedef void (*FN_GETBONEPOSITION) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); 83 | typedef uint32 (*FN_FUNCTIONFROMNAME) ( const char *pName ); 84 | typedef const char * (*FN_NAMEFORFUNCTION) ( uint32 function ); 85 | typedef void (*FN_CLIENTPRINTF) ( edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg ); 86 | typedef void (*FN_SERVERPRINT) ( const char *szMsg ); 87 | typedef const char * (*FN_CMD_ARGS) ( void ); 88 | typedef const char * (*FN_CMD_ARGV) ( int argc ); 89 | typedef int (*FN_CMD_ARGC) ( void ); 90 | typedef void (*FN_GETATTACHMENT) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); 91 | typedef void (*FN_CRC32_INIT) (CRC32_t *pulCRC); 92 | typedef void (*FN_CRC32_PROCESSBUFFER) (CRC32_t *pulCRC, void *p, int len); 93 | typedef void (*FN_CRC32_PROCESSBYTE) (CRC32_t *pulCRC, unsigned char ch); 94 | typedef CRC32_t (*FN_CRC32_FINAL) (CRC32_t pulCRC); 95 | #ifdef HLSDK_3_2_OLD_EIFACE 96 | typedef long (*FN_RANDOMLONG) (long lLow, long lHigh); 97 | #else 98 | typedef int32 (*FN_RANDOMLONG) (int32 lLow, int32 lHigh); 99 | #endif 100 | typedef float (*FN_RANDOMFLOAT) (float flLow, float flHigh); 101 | typedef void (*FN_SETVIEW) (const edict_t *pClient, const edict_t *pViewent ); 102 | typedef float (*FN_TIME) ( void ); 103 | typedef void (*FN_CROSSHAIRANGLE) (const edict_t *pClient, float pitch, float yaw); 104 | typedef byte * (*FN_LOADFILEFORME) (char *filename, int *pLength); 105 | typedef void (*FN_FREEFILE) (void *buffer); 106 | typedef void (*FN_ENDSECTION) (const char *pszSectionName); 107 | typedef int (*FN_COMPAREFILETIME) (char *filename1, char *filename2, int *iCompare); 108 | typedef void (*FN_GETGAMEDIR) (char *szGetGameDir); 109 | typedef void (*FN_CVAR_REGISTERVARIABLE) (cvar_t *variable); 110 | typedef void (*FN_FADECLIENTVOLUME) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); 111 | typedef void (*FN_SETCLIENTMAXSPEED) (const edict_t *pEdict, float fNewMaxspeed); 112 | typedef edict_t * (*FN_CREATEFAKECLIENT) (const char *netname); 113 | typedef void (*FN_RUNPLAYERMOVE) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); 114 | typedef int (*FN_NUMBEROFENTITIES) (void); 115 | typedef char * (*FN_GETINFOKEYBUFFER) (edict_t *e); 116 | typedef char * (*FN_INFOKEYVALUE) (char *infobuffer, char *key); 117 | typedef void (*FN_SETKEYVALUE) (char *infobuffer, char *key, char *value); 118 | typedef void (*FN_SETCLIENTKEYVALUE) (int clientIndex, char *infobuffer, char *key, char *value); 119 | typedef int (*FN_ISMAPVALID) (char *filename); 120 | typedef void (*FN_STATICDECAL) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); 121 | typedef int (*FN_PRECACHEGENERIC) (char *s); 122 | typedef int (*FN_GETPLAYERUSERID) (edict_t *e ); 123 | typedef void (*FN_BUILDSOUNDMSG) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); 124 | typedef int (*FN_ISDEDICATEDSERVER) (void); 125 | typedef cvar_t * (*FN_CVARGETPOINTER) (const char *szVarName); 126 | typedef unsigned int (*FN_GETPLAYERWONID) (edict_t *e); 127 | typedef void (*FN_INFO_REMOVEKEY) ( char *s, const char *key ); 128 | typedef const char * (*FN_GETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key ); 129 | typedef void (*FN_SETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key, const char *value ); 130 | typedef const char * (*FN_GETPHYSICSINFOSTRING) ( const edict_t *pClient ); 131 | typedef unsigned short (*FN_PRECACHEEVENT) ( int type, const char *psz ); 132 | typedef void (*FN_PLAYBACKEVENT) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); 133 | typedef unsigned char * (*FN_SETFATPVS) ( float *org ); 134 | typedef unsigned char * (*FN_SETFATPAS) ( float *org ); 135 | typedef int (*FN_CHECKVISIBILITY) ( const edict_t *entity, unsigned char *pset ); 136 | typedef void (*FN_DELTASETFIELD) ( struct delta_s *pFields, const char *fieldname ); 137 | typedef void (*FN_DELTAUNSETFIELD) ( struct delta_s *pFields, const char *fieldname ); 138 | typedef void (*FN_DELTAADDENCODER) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); 139 | typedef int (*FN_GETCURRENTPLAYER) ( void ); 140 | typedef int (*FN_CANSKIPPLAYER) ( const edict_t *player ); 141 | typedef int (*FN_DELTAFINDFIELD) ( struct delta_s *pFields, const char *fieldname ); 142 | typedef void (*FN_DELTASETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber ); 143 | typedef void (*FN_DELTAUNSETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber ); 144 | typedef void (*FN_SETGROUPMASK) ( int mask, int op ); 145 | typedef int (*FN_CREATEINSTANCEDBASELINE) ( int classname, struct entity_state_s *baseline ); 146 | typedef void (*FN_CVAR_DIRECTSET) ( struct cvar_s *var, char *value ); 147 | typedef void (*FN_FORCEUNMODIFIED) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); 148 | typedef void (*FN_GETPLAYERSTATS) ( const edict_t *pClient, int *ping, int *packet_loss ); 149 | typedef void (*FN_ADDSERVERCOMMAND) ( char *cmd_name, void (*function) (void) ); 150 | // Added in SDK 2.2: 151 | typedef qboolean (*FN_VOICE_GETCLIENTLISTENING) (int iReceiver, int iSender); 152 | typedef qboolean (*FN_VOICE_SETCLIENTLISTENING) (int iReceiver, int iSender, qboolean bListen); 153 | // Added for HL 1109 (no SDK update): 154 | typedef const char * (*FN_GETPLAYERAUTHID) (edict_t *e); 155 | // Added 2003/11/10 (no SDK update): 156 | typedef sequenceEntry_s * (*FN_SEQUENCEGET) (const char* fileName, const char* entryName); 157 | typedef sentenceEntry_s * (*FN_SEQUENCEPICKSENTENCE) (const char* groupName, int pickMethod, int *picked); 158 | typedef int (*FN_GETFILESIZE) (char *filename); 159 | typedef unsigned int (*FN_GETAPPROXWAVEPLAYLEN) (const char *filepath); 160 | typedef int (*FN_ISCAREERMATCH) (void); 161 | typedef int (*FN_GETLOCALIZEDSTRINGLENGTH) (const char *label); 162 | typedef void (*FN_REGISTERTUTORMESSAGESHOWN) (int mid); 163 | typedef int (*FN_GETTIMESTUTORMESSAGESHOWN) (int mid); 164 | typedef void (*FN_PROCESSTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength); 165 | typedef void (*FN_CONSTRUCTTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength); 166 | typedef void (*FN_RESETTUTORMESSAGEDECAYDATA) (void); 167 | // Added 2005/08/11 (no SDK update): 168 | typedef void (*FN_QUERYCLIENTCVARVALUE) ( const edict_t *player, const char *cvarName ); 169 | // Added 2005/11/21 (no SDK update): 170 | typedef void (*FN_QUERYCLIENTCVARVALUE2) ( const edict_t *player, const char *cvarName, int requestID ); 171 | // Added 2009/06/17 (no SDK update): 172 | typedef void (*FN_ENGCHECKPARM) ( const char *pchCmdLineToken, char **pchNextVal ); 173 | 174 | #endif -------------------------------------------------------------------------------- /SDK/metamod/gamedllfuncs.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_GAMEDLLFUNCS_H 2 | #define INCLUDE_GAMEDLLFUNCS_H 3 | 4 | typedef struct 5 | { 6 | DLL_FUNCTIONS *dllapi_table; 7 | NEW_DLL_FUNCTIONS *newapi_table; 8 | } gamedll_funcs_t; 9 | 10 | #endif -------------------------------------------------------------------------------- /SDK/metamod/ginfo.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_GINFO_H 2 | #define INCLUDE_GINFO_H 3 | 4 | typedef enum 5 | { 6 | GINFO_NAME = 0, 7 | GINFO_DESC, 8 | GINFO_GAMEDIR, 9 | GINFO_DLL_FULLPATH, 10 | GINFO_DLL_FILENAME, 11 | GINFO_REALDLL_FULLPATH, 12 | } ginfo_t; 13 | 14 | #endif -------------------------------------------------------------------------------- /SDK/metamod/metadllfuncs.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_METADLLFUNCS_H 2 | #define INCLUDE_METADLLFUNCS_H 3 | 4 | #define MDLL_FUNC META_GAMEDLLFUNCS->dllapi_table 5 | 6 | #define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit 7 | #define MDLL_Spawn MDLL_FUNC->pfnSpawn 8 | #define MDLL_Think MDLL_FUNC->pfnThink 9 | #define MDLL_Use MDLL_FUNC->pfnUse 10 | #define MDLL_Touch MDLL_FUNC->pfnTouch 11 | #define MDLL_Blocked MDLL_FUNC->pfnBlocked 12 | #define MDLL_KeyValue MDLL_FUNC->pfnKeyValue 13 | #define MDLL_Save MDLL_FUNC->pfnSave 14 | #define MDLL_Restore MDLL_FUNC->pfnRestore 15 | #define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox 16 | #define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields 17 | #define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields 18 | #define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState 19 | #define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState 20 | #define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState 21 | #define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect 22 | #define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect 23 | #define MDLL_ClientKill MDLL_FUNC->pfnClientKill 24 | #define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer 25 | #define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand 26 | #define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged 27 | #define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate 28 | #define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate 29 | #define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink 30 | #define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink 31 | #define MDLL_StartFrame MDLL_FUNC->pfnStartFrame 32 | #define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel 33 | #define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel 34 | #define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription 35 | #define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization 36 | #define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect 37 | #define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect 38 | #define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink 39 | #define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error 40 | #define MDLL_PM_Move MDLL_FUNC->pfnPM_Move 41 | #define MDLL_PM_Init MDLL_FUNC->pfnPM_Init 42 | #define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType 43 | #define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility 44 | #define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData 45 | #define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack 46 | #define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline 47 | #define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders 48 | #define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData 49 | #define MDLL_CmdStart MDLL_FUNC->pfnCmdStart 50 | #define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd 51 | #define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket 52 | #define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds 53 | #define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines 54 | #define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile 55 | #define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation 56 | 57 | // NEW API functions: 58 | #define MNEW_FUNC gpGamedllFuncs->newapi_table 59 | 60 | #define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData 61 | #define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown 62 | #define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide 63 | #define MNEW_CvarValue MNEW_FUNC->pfnCvarValue 64 | 65 | #endif -------------------------------------------------------------------------------- /SDK/metamod/metafunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_METAFUNCTIONS_H 2 | #define INCLUDE_METAFUNCTIONS_H 3 | 4 | typedef struct 5 | { 6 | GETENTITYAPI_FN pfnGetEntityAPI; 7 | GETENTITYAPI_FN pfnGetEntityAPI_Post; 8 | GETENTITYAPI2_FN pfnGetEntityAPI2; 9 | GETENTITYAPI2_FN pfnGetEntityAPI2_Post; 10 | GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions; 11 | GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions_Post; 12 | GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions; 13 | GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions_Post; 14 | } META_FUNCTIONS; 15 | 16 | #endif -------------------------------------------------------------------------------- /SDK/metamod/metaglobals.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_METAGLOBALS_H 2 | #define INCLUDE_METAGLOBALS_H 3 | 4 | typedef struct meta_globals_s 5 | { 6 | META_RES mres; // writable; plugin's return flag 7 | META_RES prev_mres; // readable; return flag of the previous plugin called 8 | META_RES status; // readable; "highest" return flag so far 9 | void *orig_ret; // readable; return value from "real" function 10 | void *override_ret; // readable; return value from overriding/superceding plugin 11 | } meta_globals_t; 12 | 13 | #endif -------------------------------------------------------------------------------- /SDK/metamod/metamod.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_METAMOD_H 2 | #define INCLUDE_METAMOD_H 3 | 4 | #define META_INTERFACE_VERSION "5:13" 5 | 6 | #define META_GLOBALS gpMetaGlobals 7 | #define META_GAMEDLLFUNCS gpGamedllFuncs 8 | #define META_UTILFUNCS gpMetaUtilFuncs 9 | #define PLINFO PLUGIN_INFO 10 | #define PLID &PLUGIN_INFO 11 | 12 | #include "metares.h" 13 | #include "plinfo.h" 14 | #include "metaglobals.h" 15 | #include "gamedllfuncs.h" 16 | #include "dllapi.h" 17 | #include "engineapi.h" 18 | #include "metafunctions.h" 19 | #include "ginfo.h" 20 | #include "mutil.h" 21 | #include "metadllfuncs.h" 22 | 23 | extern plugin_info_t PLINFO; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /SDK/metamod/metares.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_METARES_H 2 | #define INCLUDE_METARES_H 3 | 4 | #define SET_META_RESULT(result) META_GLOBALS->mres=result 5 | #define RETURN_META(result) { META_GLOBALS->mres=result; return; } 6 | #define RETURN_META_VALUE(result, value) { META_GLOBALS->mres=result; return(value); } 7 | #define META_RESULT_STATUS META_GLOBALS->status 8 | #define META_RESULT_PREVIOUS META_GLOBALS->prev_mres 9 | #define META_RESULT_ORIG_RET(type) *(type *)META_GLOBALS->orig_ret 10 | #define META_RESULT_OVERRIDE_RET(type) *(type *)META_GLOBALS->override_ret 11 | 12 | typedef enum 13 | { 14 | MRES_UNSET = 0, 15 | MRES_IGNORED, // plugin didn't take any action 16 | MRES_HANDLED, // plugin did something, but real function should still be called 17 | MRES_OVERRIDE, // call real function, but use my return value 18 | MRES_SUPERCEDE, // skip real function; use my return value 19 | } META_RES; 20 | 21 | #endif -------------------------------------------------------------------------------- /SDK/metamod/mutil.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_MUTIL_H 2 | #define INCLUDE_MUTIL_H 3 | 4 | #define MAX_LOGMSG_LEN 1024 5 | 6 | // Meta Utility Function table type. 7 | typedef struct meta_util_funcs_s { 8 | void (*pfnLogConsole) (plid_t plid, const char *fmt, ...); 9 | void (*pfnLogMessage) (plid_t plid, const char *fmt, ...); 10 | void (*pfnLogError) (plid_t plid, const char *fmt, ...); 11 | void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...); 12 | void (*pfnCenterSay) (plid_t plid, const char *fmt, ...); 13 | void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, 14 | const char *fmt, ...); 15 | void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, 16 | const char *fmt, va_list ap); 17 | qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, 18 | entvars_t *pev); 19 | int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size); 20 | const char *(*pfnGetUserMsgName) (plid_t plid, int msgid, int *size); 21 | const char *(*pfnGetPluginPath) (plid_t plid); 22 | const char *(*pfnGetGameInfo) (plid_t plid, ginfo_t tag); 23 | 24 | int (*pfnLoadPlugin)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); 25 | int (*pfnUnloadPlugin)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 26 | int (*pfnUnloadPluginByHandle)(plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 27 | 28 | const char *(*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *player); 29 | 30 | int (*pfnMakeRequestID) (plid_t plid); 31 | 32 | void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); 33 | } mutil_funcs_t; 34 | 35 | // Convenience macros for MetaUtil functions 36 | #define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole) 37 | #define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage) 38 | #define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError) 39 | #define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper) 40 | #define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay) 41 | #define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms) 42 | #define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs) 43 | #define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity) 44 | #define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID) 45 | #define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName) 46 | #define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath) 47 | #define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo) 48 | #define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin) 49 | #define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin) 50 | #define UNLOAD_PLUGIN_BY_HANDLE (*gpMetaUtilFuncs->pfnUnloadPluginByHandle) 51 | #define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar) 52 | #define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestID) 53 | #define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables) 54 | 55 | #endif -------------------------------------------------------------------------------- /SDK/metamod/plinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_PLINFO_H 2 | #define INCLUDE_PLINFO_H 3 | 4 | // Flags for plugin to indicate when it can be be loaded/unloaded. 5 | // NOTE: order is crucial, as greater/less comparisons are made. 6 | typedef enum 7 | { 8 | PT_NEVER = 0, 9 | PT_STARTUP, // should only be loaded/unloaded at initial hlds execution 10 | PT_CHANGELEVEL, // can be loaded/unloaded between maps 11 | PT_ANYTIME, // can be loaded/unloaded at any time 12 | PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map 13 | } PLUG_LOADTIME; 14 | 15 | // Flags to indicate why the plugin is being unloaded. 16 | typedef enum { 17 | PNL_NULL = 0, 18 | PNL_INI_DELETED, // was deleted from plugins.ini 19 | PNL_FILE_NEWER, // file on disk is newer than last load 20 | PNL_COMMAND, // requested by server/console command 21 | PNL_CMD_FORCED, // forced by server/console command 22 | PNL_DELAYED, // delayed from previous request; can't tell origin 23 | //only used for 'real_reason' on MPlugin::unload() 24 | PNL_PLUGIN, // requested by plugin function call 25 | PNL_PLG_FORCED, // forced by plugin function call 26 | //only used internally for 'meta reload' 27 | PNL_RELOAD, // forced unload by reload() 28 | } PL_UNLOAD_REASON; 29 | 30 | // Information plugin provides about itself. 31 | typedef struct { 32 | char *ifvers; // meta_interface version 33 | char *name; // full name of plugin 34 | char *version; // version 35 | char *date; // date 36 | char *author; // author name/email 37 | char *url; // URL 38 | char *logtag; // log message prefix (unused right now) 39 | PLUG_LOADTIME loadable; // when loadable 40 | PLUG_LOADTIME unloadable; // when unloadable 41 | } plugin_info_t; 42 | 43 | typedef plugin_info_t* plid_t; 44 | 45 | #endif 46 | --------------------------------------------------------------------------------