//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: Definitions that are shared by the game DLL and the client DLL. // // $NoKeywords: $ //=============================================================================// #ifndef SHAREDDEFS_H #define SHAREDDEFS_H #ifdef _WIN32 #pragma once #endif #define TICK_INTERVAL (gpGlobals->interval_per_tick) #define TIME_TO_TICKS( dt ) ( (int)( 0.5f + (float)(dt) / TICK_INTERVAL ) ) #define TICKS_TO_TIME( t ) ( TICK_INTERVAL *( t ) ) #define ROUND_TO_TICKS( t ) ( TICK_INTERVAL * TIME_TO_TICKS( t ) ) #define TICK_NEVER_THINK (-1) #if defined( TF_DLL ) #define ANIMATION_CYCLE_BITS 10 #else #define ANIMATION_CYCLE_BITS 15 #endif #define ANIMATION_CYCLE_MINFRAC (1.0f / (1<GetViewVectors()->m_vView #define VEC_HULL_MIN g_pGameRules->GetViewVectors()->m_vHullMin #define VEC_HULL_MAX g_pGameRules->GetViewVectors()->m_vHullMax #define VEC_DUCK_HULL_MIN g_pGameRules->GetViewVectors()->m_vDuckHullMin #define VEC_DUCK_HULL_MAX g_pGameRules->GetViewVectors()->m_vDuckHullMax #define VEC_DUCK_VIEW g_pGameRules->GetViewVectors()->m_vDuckView #define VEC_OBS_HULL_MIN g_pGameRules->GetViewVectors()->m_vObsHullMin #define VEC_OBS_HULL_MAX g_pGameRules->GetViewVectors()->m_vObsHullMax #define VEC_DEAD_VIEWHEIGHT g_pGameRules->GetViewVectors()->m_vDeadViewHeight // If the player (enemy bots) are scaled, adjust the hull #define VEC_VIEW_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vView * player->GetModelScale() ) #define VEC_HULL_MIN_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vHullMin * player->GetModelScale() ) #define VEC_HULL_MAX_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vHullMax * player->GetModelScale() ) #define VEC_DUCK_HULL_MIN_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vDuckHullMin * player->GetModelScale() ) #define VEC_DUCK_HULL_MAX_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vDuckHullMax * player->GetModelScale() ) #define VEC_DUCK_VIEW_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vDuckView * player->GetModelScale() ) #define VEC_OBS_HULL_MIN_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vObsHullMin * player->GetModelScale() ) #define VEC_OBS_HULL_MAX_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vObsHullMax * player->GetModelScale() ) #define VEC_DEAD_VIEWHEIGHT_SCALED( player ) ( g_pGameRules->GetViewVectors()->m_vDeadViewHeight * player->GetModelScale() ) #define WATERJUMP_HEIGHT 8 #define MAX_CLIMB_SPEED 200 #if defined(TF_DLL) || defined(TF_CLIENT_DLL) #define TIME_TO_DUCK 0.2 #define TIME_TO_DUCK_MS 200.0f #else #define TIME_TO_DUCK 0.4 #define TIME_TO_DUCK_MS 400.0f #endif #define TIME_TO_UNDUCK 0.2 #define TIME_TO_UNDUCK_MS 200.0f #define MAX_WEAPON_SLOTS 6 // hud item selection slots #define MAX_WEAPON_POSITIONS 20 // max number of items within a slot #define MAX_ITEM_TYPES 6 // hud item selection slots #define MAX_WEAPONS 48 // Max number of weapons available #define MAX_ITEMS 5 // hard coded item types #define WEAPON_NOCLIP -1 // clip sizes set to this tell the weapon it doesn't use a clip #define MAX_AMMO_TYPES 32 // ??? #define MAX_AMMO_SLOTS 32 // not really slots #define HUD_PRINTNOTIFY 1 #define HUD_PRINTCONSOLE 2 #define HUD_PRINTTALK 3 #define HUD_PRINTCENTER 4 // Vote creation or processing failure codes typedef enum { VOTE_FAILED_GENERIC = 0, VOTE_FAILED_TRANSITIONING_PLAYERS, VOTE_FAILED_RATE_EXCEEDED, VOTE_FAILED_YES_MUST_EXCEED_NO, VOTE_FAILED_QUORUM_FAILURE, VOTE_FAILED_ISSUE_DISABLED, VOTE_FAILED_MAP_NOT_FOUND, VOTE_FAILED_MAP_NAME_REQUIRED, VOTE_FAILED_ON_COOLDOWN, VOTE_FAILED_TEAM_CANT_CALL, VOTE_FAILED_WAITINGFORPLAYERS, VOTE_FAILED_PLAYERNOTFOUND, VOTE_FAILED_CANNOT_KICK_ADMIN, VOTE_FAILED_SCRAMBLE_IN_PROGRESS, VOTE_FAILED_SPECTATOR, VOTE_FAILED_NEXTLEVEL_SET, VOTE_FAILED_MAP_NOT_VALID, VOTE_FAILED_CANNOT_KICK_FOR_TIME, VOTE_FAILED_CANNOT_KICK_DURING_ROUND, VOTE_FAILED_VOTE_IN_PROGRESS, VOTE_FAILED_KICK_LIMIT_REACHED, VOTE_FAILED_KICK_DENIED_BY_GC, // TF-specific? VOTE_FAILED_MODIFICATION_ALREADY_ACTIVE, } vote_create_failed_t; enum { #ifdef STAGING_ONLY SERVER_MODIFICATION_ITEM_DURATION_IN_MINUTES = 2 #else SERVER_MODIFICATION_ITEM_DURATION_IN_MINUTES = 120 #endif }; #define MAX_VOTE_DETAILS_LENGTH 64 #define INVALID_ISSUE -1 #define MAX_VOTE_OPTIONS 5 #define DEDICATED_SERVER 99 enum CastVote { VOTE_OPTION1, // Use this for Yes VOTE_OPTION2, // Use this for No VOTE_OPTION3, VOTE_OPTION4, VOTE_OPTION5, VOTE_UNCAST }; //=================================================================================================================== // Close caption flags #define CLOSE_CAPTION_WARNIFMISSING ( 1<<0 ) #define CLOSE_CAPTION_FROMPLAYER ( 1<<1 ) #define CLOSE_CAPTION_GENDER_MALE ( 1<<2 ) #define CLOSE_CAPTION_GENDER_FEMALE ( 1<<3 ) //=================================================================================================================== // Hud Element hiding flags #define HIDEHUD_WEAPONSELECTION ( 1<<0 ) // Hide ammo count & weapon selection #define HIDEHUD_FLASHLIGHT ( 1<<1 ) #define HIDEHUD_ALL ( 1<<2 ) #define HIDEHUD_HEALTH ( 1<<3 ) // Hide health & armor / suit battery #define HIDEHUD_PLAYERDEAD ( 1<<4 ) // Hide when local player's dead #define HIDEHUD_NEEDSUIT ( 1<<5 ) // Hide when the local player doesn't have the HEV suit #define HIDEHUD_MISCSTATUS ( 1<<6 ) // Hide miscellaneous status elements (trains, pickup history, death notices, etc) #define HIDEHUD_CHAT ( 1<<7 ) // Hide all communication elements (saytext, voice icon, etc) #define HIDEHUD_CROSSHAIR ( 1<<8 ) // Hide crosshairs #define HIDEHUD_VEHICLE_CROSSHAIR ( 1<<9 ) // Hide vehicle crosshair #define HIDEHUD_INVEHICLE ( 1<<10 ) #define HIDEHUD_BONUS_PROGRESS ( 1<<11 ) // Hide bonus progress display (for bonus map challenges) #define HIDEHUD_BITCOUNT 12 //=================================================================================================================== // suit usage bits #define bits_SUIT_DEVICE_SPRINT 0x00000001 #define bits_SUIT_DEVICE_FLASHLIGHT 0x00000002 #define bits_SUIT_DEVICE_BREATHER 0x00000004 #define MAX_SUIT_DEVICES 3 //=================================================================================================================== // Player Defines // Max number of players in a game ( see const.h for ABSOLUTE_PLAYER_LIMIT (256 ) ) // The Source engine is really designed for 32 or less players. If you raise this number above 32, you better know what you are doing // and have a good answer for a bunch of perf question related to player simulation, thinking logic, tracelines, networking overhead, etc. // But if you are brave or are doing something interesting, go for it... ywb 9/22/03 //You might be wondering why these aren't multiple of 2. Well the reason is that if servers decide to have HLTV or Replay enabled we need the extra slot. //This is ok since MAX_PLAYERS is used for code specific things like arrays and loops, but it doesn't really means that this is the max number of players allowed //Since this is decided by the gamerules (and it can be whatever number as long as its less than MAX_PLAYERS). #if defined( CSTRIKE_DLL ) #define MAX_PLAYERS 65 // Absolute max players supported #else #define MAX_PLAYERS 33 // Absolute max players supported #endif #define MAX_PLACE_NAME_LENGTH 18 #define MAX_FOV 90 //=================================================================================================================== // Team Defines #define TEAM_ANY -2 #define TEAM_INVALID -1 #define TEAM_UNASSIGNED 0 // not assigned to a team #define TEAM_SPECTATOR 1 // spectator team // Start your team numbers after this #define LAST_SHARED_TEAM TEAM_SPECTATOR // The first team that's game specific (i.e. not unassigned / spectator) #define FIRST_GAME_TEAM (LAST_SHARED_TEAM+1) #define MAX_TEAMS 32 // Max number of teams in a game #define MAX_TEAM_NAME_LENGTH 32 // Max length of a team's name // Weapon m_iState #define WEAPON_IS_ONTARGET 0x40 #define WEAPON_NOT_CARRIED 0 // Weapon is on the ground #define WEAPON_IS_CARRIED_BY_PLAYER 1 // This client is carrying this weapon. #define WEAPON_IS_ACTIVE 2 // This client is carrying this weapon and it's the currently held weapon // ----------------------------------------- // Skill Level // ----------------------------------------- #define SKILL_EASY 1 #define SKILL_MEDIUM 2 #define SKILL_HARD 3 // Weapon flags // ----------------------------------------- // Flags - NOTE: KEEP g_ItemFlags IN WEAPON_PARSE.CPP UPDATED WITH THESE // ----------------------------------------- #define ITEM_FLAG_SELECTONEMPTY (1<<0) #define ITEM_FLAG_NOAUTORELOAD (1<<1) #define ITEM_FLAG_NOAUTOSWITCHEMPTY (1<<2) #define ITEM_FLAG_LIMITINWORLD (1<<3) #define ITEM_FLAG_EXHAUSTIBLE (1<<4) // A player can totally exhaust their ammo supply and lose this weapon #define ITEM_FLAG_DOHITLOCATIONDMG (1<<5) // This weapon take hit location into account when applying damage #define ITEM_FLAG_NOAMMOPICKUPS (1<<6) // Don't draw ammo pickup sprites/sounds when ammo is received #define ITEM_FLAG_NOITEMPICKUP (1<<7) // Don't draw weapon pickup when this weapon is picked up by the player // NOTE: KEEP g_ItemFlags IN WEAPON_PARSE.CPP UPDATED WITH THESE // Humans only have left and right hands, though we might have aliens with more // than two, sigh #define MAX_VIEWMODELS 2 #define MAX_BEAM_ENTS 10 #define TRACER_TYPE_DEFAULT 0x00000001 #define TRACER_TYPE_GUNSHIP 0x00000002 #define TRACER_TYPE_STRIDER 0x00000004 // Here ya go, Jay! #define TRACER_TYPE_GAUSS 0x00000008 #define TRACER_TYPE_WATERBULLET 0x00000010 #define MUZZLEFLASH_TYPE_DEFAULT 0x00000001 #define MUZZLEFLASH_TYPE_GUNSHIP 0x00000002 #define MUZZLEFLASH_TYPE_STRIDER 0x00000004 // Muzzle flash definitions (for the flags field of the "MuzzleFlash" DispatchEffect) enum { MUZZLEFLASH_AR2 = 0, MUZZLEFLASH_SHOTGUN, MUZZLEFLASH_SMG1, MUZZLEFLASH_SMG2, MUZZLEFLASH_PISTOL, MUZZLEFLASH_COMBINE, MUZZLEFLASH_357, MUZZLEFLASH_RPG, MUZZLEFLASH_COMBINE_TURRET, MUZZLEFLASH_FIRSTPERSON = 0x100, }; // Tracer Flags #define TRACER_FLAG_WHIZ 0x0001 #define TRACER_FLAG_USEATTACHMENT 0x0002 #define TRACER_DONT_USE_ATTACHMENT -1 // Entity Dissolve types enum { ENTITY_DISSOLVE_NORMAL = 0, ENTITY_DISSOLVE_ELECTRICAL, ENTITY_DISSOLVE_ELECTRICAL_LIGHT, ENTITY_DISSOLVE_CORE, // NOTE: Be sure to up the bits if you make more dissolve types ENTITY_DISSOLVE_BITS = 3 }; // --------------------------- // Hit Group standards // --------------------------- #define HITGROUP_GENERIC 0 #define HITGROUP_HEAD 1 #define HITGROUP_CHEST 2 #define HITGROUP_STOMACH 3 #define HITGROUP_LEFTARM 4 #define HITGROUP_RIGHTARM 5 #define HITGROUP_LEFTLEG 6 #define HITGROUP_RIGHTLEG 7 #define HITGROUP_GEAR 10 // alerts NPC, but doesn't do damage or bleed (1/100th damage) // // Enumerations for setting player animation. // enum PLAYER_ANIM { PLAYER_IDLE, PLAYER_WALK, PLAYER_JUMP, PLAYER_SUPERJUMP, PLAYER_DIE, PLAYER_ATTACK1, PLAYER_IN_VEHICLE, // TF Player animations PLAYER_RELOAD, PLAYER_START_AIMING, PLAYER_LEAVE_AIMING, }; #ifdef HL2_DLL // HL2 has 600 gravity by default // NOTE: The discrete ticks can have quantization error, so these numbers are biased a little to // make the heights more exact #define PLAYER_FATAL_FALL_SPEED 922.5f // approx 60 feet sqrt( 2 * gravity * 60 * 12 ) #define PLAYER_MAX_SAFE_FALL_SPEED 526.5f // approx 20 feet sqrt( 2 * gravity * 20 * 12 ) #define PLAYER_LAND_ON_FLOATING_OBJECT 173 // Can fall another 173 in/sec without getting hurt #define PLAYER_MIN_BOUNCE_SPEED 173 #define PLAYER_FALL_PUNCH_THRESHOLD 303.0f // won't punch player's screen/make scrape noise unless player falling at least this fast - at least a 76" fall (sqrt( 2 * g * 76)) #else #define PLAYER_FATAL_FALL_SPEED 1024 // approx 60 feet #define PLAYER_MAX_SAFE_FALL_SPEED 580 // approx 20 feet #define PLAYER_LAND_ON_FLOATING_OBJECT 200 // Can go another 200 units without getting hurt #define PLAYER_MIN_BOUNCE_SPEED 200 #define PLAYER_FALL_PUNCH_THRESHOLD (float)350 // won't punch player's screen/make scrape noise unless player falling at least this fast. #endif #define DAMAGE_FOR_FALL_SPEED 100.0f / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED ) // damage per unit per second. #define AUTOAIM_2DEGREES 0.0348994967025 #define AUTOAIM_5DEGREES 0.08715574274766 #define AUTOAIM_8DEGREES 0.1391731009601 #define AUTOAIM_10DEGREES 0.1736481776669 #define AUTOAIM_20DEGREES 0.3490658503989 #define AUTOAIM_SCALE_DEFAULT 1.0f #define AUTOAIM_SCALE_DIRECT_ONLY 0.0f // instant damage // For a means of resolving these consts into debug string text, see function // CTakeDamageInfo::DebugGetDamageTypeString(unsigned int DamageType, char *outbuf, unsigned int outbuflength ) #define DMG_GENERIC 0 // generic damage -- do not use if you want players to flinch and bleed! #define DMG_CRUSH (1 << 0) // crushed by falling or moving object. // NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage. // DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead. #define DMG_BULLET (1 << 1) // shot #define DMG_SLASH (1 << 2) // cut, clawed, stabbed #define DMG_BURN (1 << 3) // heat burned #define DMG_VEHICLE (1 << 4) // hit by a vehicle #define DMG_FALL (1 << 5) // fell too far #define DMG_BLAST (1 << 6) // explosive blast damage #define DMG_CLUB (1 << 7) // crowbar, punch, headbutt #define DMG_SHOCK (1 << 8) // electric shock #define DMG_SONIC (1 << 9) // sound pulse shockwave #define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam #define DMG_PREVENT_PHYSICS_FORCE (1 << 11) // Prevent a physics force #define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death #define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death. #define DMG_DROWN (1 << 14) // Drowning #define DMG_PARALYZE (1 << 15) // slows affected creature down #define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad #define DMG_POISON (1 << 17) // blood poisoning - heals over time like drowning damage #define DMG_RADIATION (1 << 18) // radiation exposure #define DMG_DROWNRECOVER (1 << 19) // drowning recovery #define DMG_ACID (1 << 20) // toxic chemicals or acid burns #define DMG_SLOWBURN (1 << 21) // in an oven #define DMG_REMOVENORAGDOLL (1<<22) // with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed. // use this to kill an entity that you've already got a server-side ragdoll for #define DMG_PHYSGUN (1<<23) // Hit by manipulator. Usually doesn't do any damage. #define DMG_PLASMA (1<<24) // Shot by Cremator #define DMG_AIRBOAT (1<<25) // Hit by the airboat's gun #define DMG_DISSOLVE (1<<26) // Dissolving! #define DMG_BLAST_SURFACE (1<<27) // A blast on the surface of water that cannot harm things underwater #define DMG_DIRECT (1<<28) #define DMG_BUCKSHOT (1<<29) // not quite a bullet. Little, rounder, different. // NOTE: DO NOT ADD ANY MORE CUSTOM DMG_ TYPES. MODS USE THE DMG_LASTGENERICFLAG BELOW, AND // IF YOU ADD NEW DMG_ TYPES, THEIR TYPES WILL BE HOSED. WE NEED A BETTER SOLUTION. // TODO: keep this up to date so all the mod-specific flags don't overlap anything. #define DMG_LASTGENERICFLAG DMG_BUCKSHOT // settings for m_takedamage #define DAMAGE_NO 0 #define DAMAGE_EVENTS_ONLY 1 // Call damage functions, but don't modify health #define DAMAGE_YES 2 #define DAMAGE_AIM 3 // Spectator Movement modes enum { OBS_MODE_NONE = 0, // not in spectator mode OBS_MODE_DEATHCAM, // special mode for death cam animation OBS_MODE_FREEZECAM, // zooms to a target, and freeze-frames on them OBS_MODE_FIXED, // view from a fixed camera position OBS_MODE_IN_EYE, // follow a player in first person view OBS_MODE_CHASE, // follow a player in third person view OBS_MODE_POI, // PASSTIME point of interest - game objective, big fight, anything interesting; added in the middle of the enum due to tons of hard-coded " m_UtlVecSoundOrigin; ///< Actual sound origin(s) (can be multiple if sound routed through speaker entity(ies) ) mutable HSOUNDSCRIPTHANDLE m_hSoundScriptHandle; }; #define MAX_ACTORS_IN_SCENE 16 //----------------------------------------------------------------------------- // Multiplayer specific defines //----------------------------------------------------------------------------- #define MAX_CONTROL_POINTS 8 #define MAX_CONTROL_POINT_GROUPS 8 // Maximum number of points that a control point may need owned to be cappable #define MAX_PREVIOUS_POINTS 3 // The maximum number of teams the control point system knows how to deal with #define MAX_CONTROL_POINT_TEAMS 8 // Maximum length of the cap layout string #define MAX_CAPLAYOUT_LENGTH 32 // Maximum length of the current round printname #define MAX_ROUND_NAME 32 // Maximum length of the current round name #define MAX_ROUND_IMAGE_NAME 64 // Score added to the team score for a round win #define TEAMPLAY_ROUND_WIN_SCORE 1 enum { CP_WARN_NORMAL = 0, CP_WARN_FINALCAP, CP_WARN_NO_ANNOUNCEMENTS }; // YWB: 3/12/2007 // Changing the following #define for Prediction Error checking (See gamemovement.cpp for overview) will to 1 or 2 enables the system, 0 turns it off // Level 1 enables it, but doesn't force "full precision" networking, so you can still get lots of errors in position/velocity/etc. // Level 2 enables it but also forces origins/angles to be sent full precision, so other fields can be error / tolerance checked // NOTE: This stuff only works on a listen server since it punches a hole from the client .dll to server .dll!!! #define PREDICTION_ERROR_CHECK_LEVEL 0 //----------------------------------------------------------------------------- // Round timer states //----------------------------------------------------------------------------- enum { RT_STATE_SETUP, // Timer is in setup mode RT_STATE_NORMAL, // Timer is in normal mode }; enum { SIMULATION_TIME_WINDOW_BITS = 8, }; //----------------------------------------------------------------------------- // Commentary Mode //----------------------------------------------------------------------------- #if defined(TF_DLL) || defined(TF_CLIENT_DLL) #define GAME_HAS_NO_USE_KEY #if defined( SPROP_COORD ) #undef SPROP_COORD #endif #define SPROP_COORD SPROP_COORD_MP #endif // The player's method of starting / stopping commentary #ifdef GAME_HAS_NO_USE_KEY #define COMMENTARY_BUTTONS (IN_ATTACK | IN_ATTACK2 | IN_USE) #else #define COMMENTARY_BUTTONS (IN_USE) #endif #define TEAM_TRAIN_MAX_TEAMS 4 #define TEAM_TRAIN_MAX_HILLS 5 #define TEAM_TRAIN_FLOATS_PER_HILL 2 #define TEAM_TRAIN_HILLS_ARRAY_SIZE TEAM_TRAIN_MAX_TEAMS * TEAM_TRAIN_MAX_HILLS * TEAM_TRAIN_FLOATS_PER_HILL enum { HILL_TYPE_NONE = 0, HILL_TYPE_UPHILL, HILL_TYPE_DOWNHILL, }; #define NOINTERP_PARITY_MAX 4 #define NOINTERP_PARITY_MAX_BITS 2 //----------------------------------------------------------------------------- // Generic activity lookup support //----------------------------------------------------------------------------- enum { kActivityLookup_Unknown = -2, // hasn't been searched for kActivityLookup_Missing = -1, // has been searched for but wasn't found }; #if defined(TF_DLL) || defined(TF_CLIENT_DLL) //----------------------------------------------------------------------------- // Vision Filters. //----------------------------------------------------------------------------- // Also used in the item schema to define vision filter or vision mode opt in #define TF_VISION_FILTER_NONE 0 #define TF_VISION_FILTER_PYRO (1<<0) // 1 #define TF_VISION_FILTER_HALLOWEEN (1<<1) // 2 #define TF_VISION_FILTER_ROME (1<<2) // 4 // THIS ENUM SHOULD MATCH THE ORDER OF THE FLAGS ABOVE enum { VISION_MODE_NONE = 0, VISION_MODE_PYRO, VISION_MODE_HALLOWEEN, VISION_MODE_ROME, MAX_VISION_MODES }; #endif // TF_DLL || TF_CLIENT_DLL #endif // SHAREDDEFS_H