//========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ // //=============================================================================// #ifndef CONST_H #define CONST_H #ifdef _WIN32 #pragma once #endif // the command line param that tells the engine to use steam #define STEAM_PARM "-steam" // the command line param to tell dedicated server to restart // if they are out of date #define AUTO_RESTART "-autoupdate" // the message a server sends when a clients steam login is expired #define INVALID_STEAM_TICKET "Invalid STEAM UserID Ticket\n" #define INVALID_STEAM_LOGON "No Steam logon\n" #define INVALID_STEAM_VACBANSTATE "VAC banned from secure server\n" #define INVALID_STEAM_LOGGED_IN_ELSEWHERE "This Steam account is being used in another location\n" #define DEFAULT_TICK_INTERVAL_X360 (1.0 / 29.970030) // This matches x360 refresh, but is not critical #define DEFAULT_TICK_INTERVAL_PS3 (1.0 / 30.0) #define DEFAULT_TICK_INTERVAL_PC (1.0 / 64.0) // This is the default, see shareddefs.h for mod-specific value, which can override this #if defined( _X360 ) #define DEFAULT_TICK_INTERVAL DEFAULT_TICK_INTERVAL_X360 #elif defined( _PS3 ) #define DEFAULT_TICK_INTERVAL DEFAULT_TICK_INTERVAL_PS3 #else #define DEFAULT_TICK_INTERVAL DEFAULT_TICK_INTERVAL_PC #endif #define MINIMUM_TICK_INTERVAL (4.0f / 512.0f) // 128 fps #define MAXIMUM_TICK_INTERVAL (25.0f / 512.0f) // 20.48 fps // This is the max # of players the engine can handle // Note, must be power of 2 #define ABSOLUTE_PLAYER_LIMIT 255 #define ABSOLUTE_PLAYER_LIMIT_DW ( (ABSOLUTE_PLAYER_LIMIT/32) + 1 ) #if ABSOLUTE_PLAYER_LIMIT > 32 #define CPlayerBitVec CBitVec #else #define CPlayerBitVec CDWordBitVec #endif // a player name may have 31 chars + 0 on the PC. // the 360 only allows 15 char + 0, but stick with the larger PC size for cross-platform communication #define MAX_PLAYER_NAME_LENGTH 128 #ifdef _X360 #define MAX_PLAYERS_PER_CLIENT XUSER_MAX_COUNT // Xbox 360 supports 4 players per console #else #define MAX_PLAYERS_PER_CLIENT 1 // One player per PC #endif #define MAX_MAP_NAME 64 #define MAX_NETWORKID_LENGTH 64 // num chars for a network (i.e steam) ID // BUGBUG: Reconcile with or derive this from the engine's internal definition! // FIXME: Somebody added an extra bit because they needed to make it signed, not sure why? // Anyways must have this value in sync(+1) with qlimits.h and effect_dispatch_data.cpp #define SP_MODEL_INDEX_BITS 13 // How many bits to use to encode an edict. #define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts // Max # of edicts in a level #define MAX_EDICTS (1<movetype values enum MoveType_t { MOVETYPE_NONE = 0, // never moves MOVETYPE_ISOMETRIC, // For players -- in TF2 commander view, etc. MOVETYPE_WALK, // Player only - moving on the ground MOVETYPE_STEP, // gravity, special edge handling -- monsters use this MOVETYPE_FLY, // No gravity, but still collides with stuff MOVETYPE_FLYGRAVITY, // flies through the air + is affected by gravity MOVETYPE_VPHYSICS, // uses VPHYSICS for simulation MOVETYPE_PUSH, // no clip to world, push and crush MOVETYPE_NOCLIP, // No gravity, no collisions, still do velocity/avelocity MOVETYPE_LADDER, // Used by players only when going onto a ladder MOVETYPE_OBSERVER, // Observer movement, depends on player's observer mode MOVETYPE_CUSTOM, // Allows the entity to describe its own physics // should always be defined as the last item in the list MOVETYPE_LAST = MOVETYPE_CUSTOM, MOVETYPE_MAX_BITS = 4 }; // edict->movecollide values enum MoveCollide_t { MOVECOLLIDE_DEFAULT = 0, // These ones only work for MOVETYPE_FLY + MOVETYPE_FLYGRAVITY MOVECOLLIDE_FLY_BOUNCE, // bounces, reflects, based on elasticity of surface and object - applies friction (adjust velocity) MOVECOLLIDE_FLY_CUSTOM, // Touch() will modify the velocity however it likes MOVECOLLIDE_FLY_SLIDE, // slides along surfaces (no bounce) - applies friciton (adjusts velocity) MOVECOLLIDE_COUNT, // Number of different movecollides // When adding new movecollide types, make sure this is correct MOVECOLLIDE_MAX_BITS = 3 }; // edict->solid values // NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves // SOLID only effects OTHER entities colliding with this one when they move - UGH! // Solid type basically describes how the bounding volume of the object is represented // NOTE: SOLID_BBOX MUST BE 2, and SOLID_VPHYSICS MUST BE 6 // NOTE: These numerical values are used in the FGD by the prop code (see prop_dynamic) enum SolidType_t { SOLID_NONE = 0, // no solid model SOLID_BSP = 1, // a BSP tree SOLID_BBOX = 2, // an AABB SOLID_OBB = 3, // an OBB (not implemented yet) SOLID_OBB_YAW = 4, // an OBB, constrained so that it can only yaw SOLID_CUSTOM = 5, // Always call into the entity for tests SOLID_VPHYSICS = 6, // solid vphysics object, get vcollide from the model and collide with that SOLID_LAST, }; enum SolidFlags_t { FSOLID_CUSTOMRAYTEST = 0x0001, // Ignore solid type + always call into the entity for ray tests FSOLID_CUSTOMBOXTEST = 0x0002, // Ignore solid type + always call into the entity for swept box tests FSOLID_NOT_SOLID = 0x0004, // Are we currently not solid? FSOLID_TRIGGER = 0x0008, // This is something may be collideable but fires touch functions // even when it's not collideable (when the FSOLID_NOT_SOLID flag is set) FSOLID_NOT_STANDABLE = 0x0010, // You can't stand on this FSOLID_VOLUME_CONTENTS = 0x0020, // Contains volumetric contents (like water) FSOLID_FORCE_WORLD_ALIGNED = 0x0040, // Forces the collision rep to be world-aligned even if it's SOLID_BSP or SOLID_VPHYSICS FSOLID_USE_TRIGGER_BOUNDS = 0x0080, // Uses a special trigger bounds separate from the normal OBB FSOLID_ROOT_PARENT_ALIGNED = 0x0100, // Collisions are defined in root parent's local coordinate space FSOLID_TRIGGER_TOUCH_DEBRIS = 0x0200, // This trigger will touch debris objects FSOLID_TRIGGER_TOUCH_PLAYER = 0x0400, // This trigger will touch only players FSOLID_NOT_MOVEABLE = 0x0800, // Assume this object will not move FSOLID_MAX_BITS = 12 }; //----------------------------------------------------------------------------- // A couple of inline helper methods //----------------------------------------------------------------------------- inline bool IsSolid( SolidType_t solidType, int nSolidFlags ) { return (solidType != SOLID_NONE) && ((nSolidFlags & FSOLID_NOT_SOLID) == 0); } // m_lifeState values #define LIFE_ALIVE 0 // alive #define LIFE_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground #define LIFE_DEAD 2 // dead. lying still. #define LIFE_RESPAWNABLE 3 #define LIFE_DISCARDBODY 4 // entity effects enum { EF_BONEMERGE = 0x001, // Performs bone merge on client side EF_BRIGHTLIGHT = 0x002, // DLIGHT centered at entity origin EF_DIMLIGHT = 0x004, // player flashlight EF_NOINTERP = 0x008, // don't interpolate the next frame EF_NOSHADOW = 0x010, // Don't cast no shadow EF_NODRAW = 0x020, // don't draw entity EF_NORECEIVESHADOW = 0x040, // Don't receive no shadow EF_BONEMERGE_FASTCULL = 0x080, // For use with EF_BONEMERGE. If this is set, then it places this ent's origin at its // parent and uses the parent's bbox + the max extents of the aiment. // Otherwise, it sets up the parent's bones every frame to figure out where to place // the aiment, which is inefficient because it'll setup the parent's bones even if // the parent is not in the PVS. EF_ITEM_BLINK = 0x100, // blink an item so that the user notices it. EF_PARENT_ANIMATES = 0x200, // always assume that the parent entity is animating EF_MARKED_FOR_FAST_REFLECTION = 0x400, // marks an entity for reflection rendering when using $reflectonlymarkedentities material variable EF_NOSHADOWDEPTH = 0x800, // Indicates this entity does not render into any shadow depthmap EF_SHADOWDEPTH_NOCACHE = 0x1000, // Indicates this entity cannot be cached in shadow depthmap and should render every frame EF_NOFLASHLIGHT = 0x2000, EF_NOCSM = 0x4000, // Indicates this entity does not render into the cascade shadow depthmap EF_MAX_BITS = 15 }; #define EF_PARITY_BITS 3 #define EF_PARITY_MASK ((1<