home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / game / Game.h < prev    next >
C/C++ Source or Header  |  2005-11-14  |  27KB  |  609 lines

  1.  
  2. #ifndef __GAME_H__
  3. #define __GAME_H__
  4.  
  5. /*
  6. ===============================================================================
  7.  
  8.     Public game interface with methods to run the game.
  9.  
  10. ===============================================================================
  11. */
  12.  
  13. // RAVEN BEGIN
  14. // bgeisler: moved into scripts directory
  15. // default scripts
  16. #define SCRIPT_DEFAULTDEFS            "scripts/defs.script"
  17. #define SCRIPT_DEFAULT                "scripts/main.script"
  18. // RAVEN END
  19. #define SCRIPT_DEFAULTFUNC            "doom_main"
  20.  
  21. struct gameReturn_t {
  22.     char        sessionCommand[MAX_STRING_CHARS];    // "map", "disconnect", "victory", etc
  23.     int            consistencyHash;                    // used to check for network game divergence
  24.     int            health;
  25.     int            heartRate;
  26.     int            stamina;
  27.     int            combat;
  28.     bool        syncNextGameFrame;                    // used when cinematics are skipped to prevent session from simulating several game frames to
  29.                                                     // keep the game time in sync with real time
  30. };
  31.  
  32. enum allowReply_t {
  33.     ALLOW_YES = 0,
  34.     ALLOW_BADPASS,    // core will prompt for password and connect again
  35.     ALLOW_NOTYET,    // core will wait with transmitted message
  36.     ALLOW_NO        // core will abort with transmitted message
  37. };
  38.  
  39. enum escReply_t {
  40.     ESC_IGNORE = 0,    // do nothing
  41.     ESC_MAIN,        // start main menu GUI
  42.     ESC_GUI            // set an explicit GUI
  43. };
  44.  
  45. enum demoState_t {
  46.     DEMO_NONE,
  47.     DEMO_RECORDING,
  48.     DEMO_PLAYING
  49. };
  50.  
  51. // RAVEN BEGIN
  52. // bdube: forward reference
  53. class rvClientEffect;
  54. // RAVEN END
  55.  
  56. struct ClientStats_t {
  57.     bool    isLastPredictFrame;
  58.     bool    isLagged;
  59.     bool    isNewFrame;
  60. };
  61.  
  62. class idGame {
  63. public:
  64.     virtual                        ~idGame() {}
  65.  
  66.     // Initialize the game for the first time.
  67. // RAVEN BEGIN
  68. // jsinger: attempt to eliminate cross-DLL allocation issues
  69. #ifdef RV_UNIFIED_ALLOCATOR
  70.     virtual void                Init( void *(*allocator)( size_t size ), void (*deallocator)( void *ptr ), size_t (*msize)( void *ptr ) ) = 0;
  71. #else
  72.     virtual void                Init( void ) = 0;
  73. #endif
  74.  
  75.     // Shut down the entire game.
  76.     virtual void                Shutdown( void ) = 0;
  77.  
  78.     // Set the local client number. Distinguishes listen ( == 0 ) / dedicated ( == -1 )
  79.     virtual void                SetLocalClient( int clientNum ) = 0;
  80.  
  81.     // Sets the user info for a client.
  82.     // The game can modify the user info in the returned dictionary pointer, server will forward back.
  83.     virtual const idDict *        SetUserInfo( int clientNum, const idDict &userInfo, bool isClient ) = 0;
  84.  
  85.     // Retrieve the game's userInfo dict for a client.
  86.     virtual const idDict *        GetUserInfo( int clientNum ) = 0;
  87.  
  88.     // The game gets a chance to alter userinfo before they are emitted to server.
  89.     virtual void                ThrottleUserInfo( void ) = 0;
  90.  
  91.     // Sets the serverinfo at map loads and when it changes.
  92.     virtual void                SetServerInfo( const idDict &serverInfo ) = 0;
  93.  
  94.     // The session calls this before moving the single player game to a new level.
  95.     virtual const idDict &        GetPersistentPlayerInfo( int clientNum ) = 0;
  96.  
  97.     // The session calls this right before a new level is loaded.
  98.     virtual void                SetPersistentPlayerInfo( int clientNum, const idDict &playerInfo ) = 0;
  99.  
  100.     // Loads a map and spawns all the entities.
  101.     virtual void                InitFromNewMap( const char *mapName, idRenderWorld *renderWorld, bool isServer, bool isClient, int randseed ) = 0;
  102.  
  103.     // Loads a map from a savegame file.
  104.     virtual bool                InitFromSaveGame( const char *mapName, idRenderWorld *renderWorld, idFile *saveGameFile ) = 0;
  105.  
  106.     // Saves the current game state, the session may have written some data to the file already.
  107. // RAVEN BEGIN
  108. // mekberg: added saveTypes
  109.     virtual void                SaveGame( idFile *saveGameFile, saveType_t saveType = ST_REGULAR ) = 0;
  110. // RAVEN END
  111.  
  112.     // Shut down the current map.
  113.     virtual void                MapShutdown( void ) = 0;
  114.  
  115.     // Caches media referenced from in key/value pairs in the given dictionary.
  116.     virtual void                CacheDictionaryMedia( const idDict *dict ) = 0;
  117.  
  118.     // Spawns the player entity to be used by the client.
  119.     virtual void                SpawnPlayer( int clientNum ) = 0;
  120.  
  121. // RAVEN BEGIN
  122.     // Runs a game frame, may return a session command for level changing, etc
  123.     // lastCatchupFrame is always true except if we are running several game frames in a row and this one is not the last one
  124.     // subsystems which can tolerate skipping frames will not run during those catchup frames
  125.     // several game frames in a row happen when game + renderer time goes above the tick time ( 16ms )
  126.     virtual gameReturn_t        RunFrame( const usercmd_t *clientCmds, int activeEditors, bool lastCatchupFrame ) = 0;
  127.  
  128.     virtual void                MenuFrame( void ) = 0;
  129. // RAVEN END
  130.  
  131.     // Makes rendering and sound system calls to display for a given clientNum.
  132.     virtual bool                Draw( int clientNum ) = 0;
  133.  
  134.     // Let the game do it's own UI when ESCAPE is used
  135.     virtual escReply_t            HandleESC( idUserInterface **gui ) = 0;
  136.  
  137.     // get the games menu if appropriate ( multiplayer )
  138.     virtual idUserInterface *    StartMenu() = 0;
  139.  
  140.     // When the game is running it's own UI fullscreen, GUI commands are passed through here
  141.     // return NULL once the fullscreen UI mode should stop, or "main" to go to main menu
  142.     virtual const char *        HandleGuiCommands( const char *menuCommand ) = 0;
  143.  
  144.     // main menu commands not caught in the engine are passed here
  145.     virtual void                HandleMainMenuCommands( const char *menuCommand, idUserInterface *gui ) = 0;
  146.  
  147.     // Early check to deny connect.
  148.     virtual allowReply_t        ServerAllowClient( int numClients, const char *IP, const char *guid, const char *password, char reason[MAX_STRING_CHARS] ) = 0;
  149.  
  150.     // Connects a client.
  151.     virtual void                ServerClientConnect( int clientNum ) = 0;
  152.  
  153.     // Spawns the player entity to be used by the client.
  154.     virtual void                ServerClientBegin( int clientNum ) = 0;
  155.  
  156.     // Disconnects a client and removes the player entity from the game.
  157.     virtual void                ServerClientDisconnect( int clientNum ) = 0;
  158.  
  159.     // Writes initial reliable messages a client needs to recieve when first joining the game.
  160.     virtual void                ServerWriteInitialReliableMessages( int clientNum ) = 0;
  161.  
  162.     // Writes a snapshot of the server game state for the given client.
  163. // RAVEN BEGIN
  164. // jnewquist: Use dword array to match pvs array so we don't have endianness problems.
  165.     virtual void                ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &msg, dword *clientInPVS, int numPVSClients ) = 0;
  166. // RAVEN END
  167.  
  168.     // Patches the network entity states at the server with a snapshot for the given client.
  169.     virtual bool                ServerApplySnapshot( int clientNum, int sequence ) = 0;
  170.  
  171.     // Processes a reliable message from a client.
  172.     virtual void                ServerProcessReliableMessage( int clientNum, const idBitMsg &msg ) = 0;
  173.  
  174.     // Reads a snapshot and updates the client game state.
  175.     virtual void                ClientReadSnapshot( int clientNum, int sequence, const int gameFrame, const int gameTime, const int dupeUsercmds, const int aheadOfServer, const idBitMsg &msg ) = 0;
  176.  
  177.     // Patches the network entity states at the client with a snapshot.
  178.     virtual bool                ClientApplySnapshot( int clientNum, int sequence ) = 0;
  179.  
  180.     // Processes a reliable message from the server.
  181.     virtual void                ClientProcessReliableMessage( int clientNum, const idBitMsg &msg ) = 0;
  182.  
  183.     // Runs prediction on entities at the client.
  184.     virtual gameReturn_t        ClientPrediction( int clientNum, const usercmd_t *clientCmds, bool lastPredictFrame = true, ClientStats_t *cs = NULL ) = 0;
  185.  
  186. // RAVEN BEGIN
  187. // ddynerman: client game frame
  188.     virtual void                ClientRun( void ) = 0;
  189.  
  190. // jshepard: rcon password check
  191.     virtual void                ProcessRconReturn( bool success ) = 0;
  192.  
  193. // RAVEN END
  194.  
  195.     virtual idStr                GetBestGameType( const char* map, const char* gametype ) = 0;
  196.  
  197.     // Returns a summary of stats for a given client
  198.     virtual void                GetClientStats( int clientNum, char *data, const int len ) = 0;
  199.  
  200.     // Switch a player to a particular team
  201.     virtual void                SwitchTeam( int clientNum, int team ) = 0;
  202.  
  203.     virtual bool                DownloadRequest( const char *IP, const char *guid, const char *paks, char urls[ MAX_STRING_CHARS ] ) = 0;
  204.  
  205. // RAVEN BEGIN
  206. // jscott: for the effects system
  207.     virtual void                StartViewEffect( int type, float time, float scale ) = 0;
  208.     virtual rvClientEffect*        PlayEffect ( const idDecl *effect, const idVec3& origin, const idMat3& axis, bool loop = false, const idVec3& endOrigin = vec3_origin, bool broadcast = false, effectCategory_t category = EC_IGNORE, const idVec4& effectTint = vec4_one ) = 0;
  209.     virtual void                GetPlayerView( idVec3 &origin, idMat3 &axis ) = 0;
  210.     virtual const idVec3        GetCurrentGravity( const idVec3& origin, const idMat3& axis ) const = 0;
  211.     virtual void                Translation( trace_t &trace, idVec3 &source, idVec3 &dest, idTraceModel *trm, int clipMask ) = 0;
  212.     virtual void                SpawnClientMoveable ( const char* name, int lifetime, const idVec3& origin, const idMat3& axis, const idVec3& velocity, const idVec3& angular_velocity ) = 0;
  213. // bdube: debugging stuff    
  214.     virtual void                DebugSetString ( const char* name, const char* value ) = 0;
  215.     virtual void                DebugSetFloat ( const char* name, float value ) = 0;
  216.     virtual void                DebugSetInt ( const char* name, int value ) = 0;
  217.     virtual const char*            DebugGetStatString ( const char* name ) = 0;
  218.     virtual int                    DebugGetStatInt ( const char* name ) = 0;
  219.     virtual float                DebugGetStatFloat ( const char* name ) = 0;
  220.     virtual bool                IsDebugHudActive ( void ) const = 0;
  221. // rjohnson: for new note taking mechanism
  222.     virtual bool                GetPlayerInfo( idVec3 &origin, idMat3 &axis, int PlayerNum = -1, idAngles *deltaViewAngles = NULL, int reqClientNum = -1 ) = 0;
  223.     virtual void                SetPlayerInfo( idVec3 &origin, idMat3 &axis, int PlayerNum = -1 ) = 0;
  224.     virtual    bool                PlayerChatDisabled( int clientNum ) = 0;
  225.     virtual void                SetViewComments( const char *text = 0 ) = 0;
  226. // ddynerman: utility functions
  227.     virtual void                GetPlayerName( int clientNum, char* name ) = 0;
  228.     virtual void                GetPlayerClan( int clientNum, char* clan ) = 0;
  229.     virtual void                SetFriend( int clientNum, bool isFriend ) = 0;
  230.     virtual const char*            GetLongGametypeName( const char* gametype ) = 0;
  231.     virtual void                ReceiveRemoteConsoleOutput( const char* output ) = 0;
  232. // rjohnson: entity usage stats
  233.     virtual void                ListEntityStats( const idCmdArgs &args ) = 0;
  234. // shouchard:  for ban lists
  235.     virtual void                RegisterClientGuid( int clientNum, const char *guid ) = 0;
  236.     virtual bool                IsMultiplayer( void ) = 0;
  237. // mekberg: added
  238.     virtual bool                InCinematic( void ) = 0;
  239. // mekberg: so banlist can be populated outside of multiplayer game
  240.     virtual void                PopulateBanList( idUserInterface* hud ) = 0;
  241.     virtual void                RemoveGuidFromBanList( const char *guid ) = 0;
  242. // mekberg: interface
  243.     virtual void                AddGuidToBanList( const char *guid ) = 0;
  244.     virtual const char*            GetGuidByClientNum( int clientNum ) = 0;
  245. // jshepard: updating player post-menu
  246.     virtual void                UpdatePlayerPostMainMenu( void ) = 0;
  247.     virtual void                ResetRconGuiStatus( void ) = 0;
  248. // RAVEN END
  249.  
  250. // RAVEN BEGIN
  251. // mwhitlock: Dynamic memory consolidation
  252. #if defined(_RV_MEM_SYS_SUPPORT)
  253.     virtual void                FlushBeforelevelLoad( void ) = 0;
  254. #endif
  255. // RAVEN END
  256.  
  257.     // Set the demo state.
  258.     virtual void                SetDemoState( demoState_t state ) = 0;
  259.  
  260.     // Writes current network info to a file (used as initial state for demo recording).
  261.     virtual void                WriteClientNetworkInfo( idFile* file, int clientNum ) = 0;
  262.  
  263.     // Reads current network info from a file (used as initial state for demo playback).
  264.     virtual void                ReadClientNetworkInfo( int gameTime, idFile* file, int clientNum ) = 0;
  265.  
  266.     // Let gamecode decide if it wants to accept demos from older releases of the engine.
  267.     virtual bool                ValidateDemoProtocol( int minor_ref, int minor ) = 0;
  268. };
  269.  
  270. extern idGame *                    game;
  271.  
  272.  
  273. /*
  274. ===============================================================================
  275.  
  276.     Public game interface with methods for in-game editing.
  277.  
  278. ===============================================================================
  279. */
  280.  
  281. struct refSound_t {
  282. // RAVEN BEGIN
  283.     int                            referenceSoundHandle;    // this is the interface to the sound system, created
  284.                                                         // with idSoundWorld::AllocSoundEmitter() when needed
  285. // RAVEN END
  286.     idVec3                        origin;
  287. // RAVEN BEGIN
  288. // jscott: for Miles doppler
  289.     idVec3                        velocity;
  290. // RAVEN END
  291.     int                            listenerId;        // SSF_PRIVATE_SOUND only plays if == listenerId from PlaceListener
  292.                                                 // no spatialization will be performed if == listenerID
  293.     const idSoundShader *        shader;            // this really shouldn't be here, it is a holdover from single channel behavior
  294.     float                        diversity;        // 0.0 to 1.0 value used to select which
  295.                                                 // samples in a multi-sample list from the shader are used
  296.     bool                        waitfortrigger;    // don't start it at spawn time
  297.     soundShaderParms_t            parms;            // override volume, flags, etc
  298. };
  299.  
  300. enum {
  301.     TEST_PARTICLE_MODEL = 0,
  302.     TEST_PARTICLE_IMPACT,
  303.     TEST_PARTICLE_MUZZLE,
  304.     TEST_PARTICLE_FLIGHT,
  305.     TEST_PARTICLE_SELECTED
  306. };
  307.  
  308. class idEntity;
  309. class idMD5Anim;
  310. // RAVEN BEGIN
  311. // bdube: more forward declarations
  312. class idProgram;
  313. class idInterpreter;
  314. class idThread;
  315.  
  316. typedef void (*debugInfoProc_t) ( const char* classname, const char* name, const char* value, void *userdata );
  317. // RAVEN END
  318.  
  319. // FIXME: this interface needs to be reworked but it properly separates code for the time being
  320. class idGameEdit {
  321. public:
  322.     virtual                        ~idGameEdit( void ) {}
  323.  
  324.     // These are the canonical idDict to parameter parsing routines used by both the game and tools.
  325.     virtual bool                ParseSpawnArgsToRenderLight( const idDict *args, renderLight_t *renderLight );
  326.     virtual void                ParseSpawnArgsToRenderEntity( const idDict *args, renderEntity_t *renderEntity );
  327.     virtual void                ParseSpawnArgsToRefSound( const idDict *args, refSound_t *refSound );
  328.  
  329.     // Animation system calls for non-game based skeletal rendering.
  330.     virtual idRenderModel *        ANIM_GetModelFromEntityDef( const char *classname );
  331.     virtual const idVec3         &ANIM_GetModelOffsetFromEntityDef( const char *classname );
  332.     virtual idRenderModel *        ANIM_GetModelFromEntityDef( const idDict *args );
  333.     virtual idRenderModel *        ANIM_GetModelFromName( const char *modelName );
  334.     virtual const idMD5Anim *    ANIM_GetAnimFromEntityDef( const char *classname, const char *animname );
  335. // RAVEN BEGIN
  336. // bdube: added
  337. // scork: added 'const' qualifiers so other stuff would compile
  338.     virtual const idMD5Anim *    ANIM_GetAnimFromEntity( const idEntity* ent, int animNum );
  339.     virtual float                ANIM_GetAnimPlaybackRateFromEntity ( idEntity* ent, int animNum );
  340.     virtual const char*            ANIM_GetAnimNameFromEntity ( const idEntity* ent, int animNum );
  341. // RAVEN END
  342.     virtual int                    ANIM_GetNumAnimsFromEntityDef( const idDict *args );
  343.     virtual const char *        ANIM_GetAnimNameFromEntityDef( const idDict *args, int animNum );
  344.     virtual const idMD5Anim *    ANIM_GetAnim( const char *fileName );
  345.     virtual int                    ANIM_GetLength( const idMD5Anim *anim );
  346.     virtual int                    ANIM_GetNumFrames( const idMD5Anim *anim );
  347. // RAVEN BEGIN
  348. // bdube: added
  349.     virtual const char *        ANIM_GetFilename( const idMD5Anim* anim );
  350.     virtual int                    ANIM_ConvertFrameToTime ( const idMD5Anim* anim, int frame );
  351.     virtual int                    ANIM_ConvertTimeToFrame ( const idMD5Anim* anim, int time );
  352. // RAVEN END
  353.     virtual void                ANIM_CreateAnimFrame( const idRenderModel *model, const idMD5Anim *anim, int numJoints, idJointMat *frame, int time, const idVec3 &offset, bool remove_origin_offset );
  354.     virtual idRenderModel *        ANIM_CreateMeshForAnim( idRenderModel *model, const char *classname, const char *animname, int frame, bool remove_origin_offset );
  355.  
  356. // RAVEN BEGIN
  357. // mekberg: access to animationlib functions for radiant
  358.     virtual void                FlushUnusedAnims( void );
  359. // RAVEN END
  360.  
  361.     // Articulated Figure calls for AF editor and Radiant.
  362.     virtual bool                AF_SpawnEntity( const char *fileName );
  363.     virtual void                AF_UpdateEntities( const char *fileName );
  364.     virtual void                AF_UndoChanges( void );
  365.     virtual idRenderModel *        AF_CreateMesh( const idDict &args, idVec3 &meshOrigin, idMat3 &meshAxis, bool &poseIsSet );
  366.  
  367.  
  368.     // Entity selection.
  369.     virtual void                ClearEntitySelection( void );
  370.     virtual int                    GetSelectedEntities( idEntity *list[], int max );
  371.     virtual void                AddSelectedEntity( idEntity *ent );
  372.  
  373.     // Selection methods
  374.     virtual void                TriggerSelected();
  375.  
  376.     // Entity defs and spawning.
  377.     virtual const idDict *        FindEntityDefDict( const char *name, bool makeDefault = true ) const;
  378.     virtual void                SpawnEntityDef( const idDict &args, idEntity **ent );
  379.     virtual idEntity *            FindEntity( const char *name ) const;
  380.     virtual const char *        GetUniqueEntityName( const char *classname ) const;
  381.  
  382.     // Entity methods.
  383.     virtual void                EntityGetOrigin( idEntity *ent, idVec3 &org ) const;
  384.     virtual void                EntityGetAxis( idEntity *ent, idMat3 &axis ) const;
  385.     virtual void                EntitySetOrigin( idEntity *ent, const idVec3 &org );
  386.     virtual void                EntitySetAxis( idEntity *ent, const idMat3 &axis );
  387.     virtual void                EntityTranslate( idEntity *ent, const idVec3 &org );
  388. // RAVEN BEGIN
  389. // scork: const-qualified 'ent' so other things would compile
  390.     virtual const idDict *        EntityGetSpawnArgs( const idEntity *ent ) const;
  391. // RAVEN END
  392.     virtual void                EntityUpdateChangeableSpawnArgs( idEntity *ent, const idDict *dict );
  393.     virtual void                EntityChangeSpawnArgs( idEntity *ent, const idDict *newArgs );
  394.     virtual void                EntityUpdateVisuals( idEntity *ent );
  395.     virtual void                EntitySetModel( idEntity *ent, const char *val );
  396.     virtual void                EntityStopSound( idEntity *ent );
  397.     virtual void                EntityDelete( idEntity *ent );
  398.     virtual void                EntitySetColor( idEntity *ent, const idVec3 color );
  399. // RAVEN BEGIN
  400. // bdube: added
  401.     virtual const char*            EntityGetName ( idEntity* ent ) const;
  402.     virtual int                    EntityToSafeId( idEntity* ent ) const;
  403.     virtual idEntity *            EntityFromSafeId( int safeID) const;
  404.     virtual void                EntitySetSkin ( idEntity *ent, const char* temp ) const;
  405.     virtual void                EntityClearSkin ( idEntity *ent ) const;
  406.     virtual void                EntityShow ( idEntity* ent ) const;
  407.     virtual void                EntityHide ( idEntity* ent ) const;
  408.     virtual void                EntityGetBounds ( idEntity* ent, idBounds &bounds ) const;
  409.     virtual int                    EntityPlayAnim ( idEntity* ent, int animNum, int time, int blendtime );
  410.     virtual void                EntitySetFrame ( idEntity* ent, int animNum, int frame, int time, int blendtime );
  411.     virtual void                EntityStopAllEffects ( idEntity* ent );
  412.     virtual void                EntityGetDelta ( idEntity* ent, int fromTime, int toTime, idVec3& delta ); 
  413.     virtual void                EntityRemoveOriginOffset ( idEntity* ent, bool remove );
  414.     virtual const char*            EntityGetClassname ( idEntity* ent ) const;
  415.     virtual bool                EntityIsDerivedFrom ( idEntity* ent, const char* classname ) const;
  416.     virtual renderEntity_t*        EntityGetRenderEntity ( idEntity* ent );
  417. // scork: accessor functions for various utils
  418.     virtual    idEntity *            EntityGetNextTeamEntity( idEntity *pEnt ) const;
  419.     virtual void                GetPlayerInfo( idVec3 &v3Origin, idMat3 &mat3Axis, int PlayerNum = -1, idAngles *deltaViewAngles = NULL ) const;
  420.     virtual void                SetPlayerInfo( idVec3 &v3Origin, idMat3 &mat3Axis, int PlayerNum = -1 ) const;
  421.     virtual void                EntitySetName( idEntity* pEnt, const char *psName );
  422. // RAVEN END
  423.  
  424.     // Player methods.
  425.     virtual bool                PlayerIsValid() const;
  426.     virtual void                PlayerGetOrigin( idVec3 &org ) const;
  427.     virtual void                PlayerGetAxis( idMat3 &axis ) const;
  428.     virtual void                PlayerGetViewAngles( idAngles &angles ) const;
  429.     virtual void                PlayerGetEyePosition( idVec3 &org ) const;
  430. // RAVEN BEGIN
  431. // bdube: new game edit stuff
  432.     virtual bool                PlayerTraceFromEye ( trace_t &results, float length, int contentMask );
  433.  
  434.     // Effect methods
  435.     virtual void                EffectRefreshTemplate ( const idDecl *effect ) const;
  436.  
  437.     // Light entity methods
  438.     virtual void                LightSetParms ( idEntity* ent, int maxLevel, int currentLevel, float radius );
  439.  
  440.     // Common editing functions
  441.     virtual int                    GetGameTime ( int *previous = NULL ) const;
  442.     virtual void                SetGameTime    ( int time ) const;
  443.     virtual bool                TracePoint ( trace_t &results, const idVec3 &start, const idVec3 &end, int contentMask ) const;
  444.     virtual void                CacheDictionaryMedia ( const idDict* dict ) const;
  445.     virtual void                SetCamera ( idEntity* camera ) const;
  446. // RAVEN BEGIN
  447. // bdube: added
  448.     virtual int                    GetGameEntityRegisterTime ( void ) const;
  449.     virtual idEntity*            GetFirstSpawnedEntity ( void ) const;
  450.     virtual idEntity*            GetNextSpawnedEntity ( idEntity* from ) const; 
  451. // jscott: added
  452.     virtual    void                DrawPlaybackDebugInfo( void );
  453.     virtual    void                RecordPlayback( const usercmd_t &cmd, idEntity *source );
  454.     virtual    bool                PlayPlayback( void );
  455.     virtual    void                ShutdownPlaybacks( void );
  456. // RAVEN END    
  457.     
  458.     // Script methods
  459.     virtual int                    ScriptGetStatementLineNumber ( idProgram* program, int instructionPointer ) const;
  460.     virtual const char*            ScriptGetStatementFileName ( idProgram* program, int instructionPointer ) const;
  461.     virtual int                    ScriptGetStatementOperator ( idProgram* program, int instructionPointer ) const;
  462.     virtual void*                ScriptGetCurrentFunction ( idInterpreter* interpreter ) const;
  463.     virtual const char*            ScriptGetCurrentFunctionName ( idInterpreter* interpreter ) const;
  464.     virtual int                    ScriptGetCallstackDepth ( idInterpreter* interpreter ) const;
  465.     virtual void*                ScriptGetCallstackFunction ( idInterpreter* interpreter, int depth ) const;
  466.     virtual const char*            ScriptGetCallstackFunctionName ( idInterpreter* interpreter, int depth ) const;
  467.     virtual int                    ScriptGetCallstackStatement ( idInterpreter* interpreter, int depth ) const;
  468.     virtual bool                ScriptIsReturnOperator ( int op ) const;
  469.     virtual const char*            ScriptGetRegisterValue ( idInterpreter* interpreter, const char* varname, int callstackDepth ) const;
  470.     virtual idThread*            ScriptGetThread ( idInterpreter* interpreter ) const;
  471.     
  472.     // Thread methods
  473.     virtual int                    ThreadGetCount ( void );
  474.     virtual idThread*            ThreadGetThread ( int index );
  475.     virtual const char*            ThreadGetName ( idThread* thread );
  476.     virtual int                    ThreadGetNumber ( idThread* thread );
  477.     virtual const char*            ThreadGetState ( idThread* thread );
  478.     
  479.     // Class externals for entity viewer
  480.     virtual void                GetClassDebugInfo ( const idEntity* entity, debugInfoProc_t proc, void* userdata );
  481.  
  482.     // In game map editing support.
  483.     virtual const idDict *        MapGetEntityDict( const char *name ) const;
  484.     virtual void                MapSave( const char *path = NULL ) const;
  485. // RAVEN BEGIN
  486. // rjohnson: added entity export
  487.     virtual bool                MapHasExportEntities( void ) const;
  488. // scork: simple func for the sound editor
  489.     virtual const char*            MapLoaded( void ) const;
  490. // cdr: AASTactical
  491.     virtual idAASFile*            GetAASFile( int i );
  492. // jscott: added entries for memory tracking
  493.     virtual void                PrintMemInfo( MemInfo *mi );
  494.     virtual size_t                ScriptSummary( const idCmdArgs &args ) const;
  495.     virtual size_t                ClassSummary( const idCmdArgs &args ) const;
  496.     virtual size_t                EntitySummary( const idCmdArgs &args ) const;
  497. // RAVEN END
  498.     virtual void                MapSetEntityKeyVal( const char *name, const char *key, const char *val ) const ;
  499.     virtual void                MapCopyDictToEntity( const char *name, const idDict *dict ) const;
  500.     virtual int                    MapGetUniqueMatchingKeyVals( const char *key, const char *list[], const int max ) const;
  501.     virtual void                MapAddEntity( const idDict *dict ) const;
  502.     virtual int                    MapGetEntitiesMatchingClassWithString( const char *classname, const char *match, const char *list[], const int max ) const;
  503.     virtual void                MapRemoveEntity( const char *name ) const;
  504.     virtual void                MapEntityTranslate( const char *name, const idVec3 &v ) const;
  505. };
  506.  
  507. extern idGameEdit *                gameEdit;
  508.  
  509. // RAVEN BEGIN
  510. // bdube: game logging
  511. /*
  512. ===============================================================================
  513.  
  514.     Game Log.
  515.  
  516. ===============================================================================
  517. */
  518. class rvGameLog {
  519. public:
  520.     virtual                ~rvGameLog( void ) {}
  521.  
  522.     virtual void        Init        ( void ) = 0;
  523.     virtual void        Shutdown    ( void ) = 0;
  524.  
  525.     virtual void        BeginFrame    ( int time ) = 0;
  526.     virtual void        EndFrame    ( void ) = 0;
  527.  
  528.     virtual    void        Set            ( const char* keyword, int value ) = 0;
  529.     virtual void        Set            ( const char* keyword, float value ) = 0;
  530.     virtual void        Set            ( const char* keyword, const char* value ) = 0;
  531.     virtual void        Set            ( const char* keyword, bool value ) = 0;
  532.     
  533.     virtual void        Add            ( const char* keyword, int value ) = 0;
  534.     virtual void        Add            ( const char* keyword, float value ) = 0;
  535. };
  536.  
  537. extern rvGameLog *                gameLog;
  538.  
  539. #define GAMELOG_SET(x,y)        {if(g_gamelog.GetBool())gameLog->Set ( x, y );}
  540. #define GAMELOG_ADD(x,y)        {if(g_gamelog.GetBool())gameLog->Add ( x, y );}
  541.  
  542. #define GAMELOG_SET_IF(x,y,z)    {if(g_gamelog.GetBool()&&(z))gameLog->Set ( x, y );}
  543. #define GAMELOG_ADD_IF(x,y,z)    {if(g_gamelog.GetBool()&&(z))gameLog->Add ( x, y );}
  544.  
  545. // RAVEN END
  546.  
  547. /*
  548. ===============================================================================
  549.  
  550.     Game API.
  551.  
  552. ===============================================================================
  553. */
  554.  
  555. // 4: network demos
  556. // 5: fix idNetworkSystem ( memory / DLL boundary related )
  557. // 6: more network demo APIs
  558. // 7: cleanups
  559. // 8: added some demo functions to the FS class
  560. const int GAME_API_VERSION        = 8;
  561.  
  562. struct gameImport_t {
  563.  
  564.     int                            version;                // API version
  565.     idSys *                        sys;                    // non-portable system services
  566.     idCommon *                    common;                    // common
  567.     idCmdSystem *                cmdSystem;                // console command system
  568.     idCVarSystem *                cvarSystem;                // console variable system
  569.     idFileSystem *                fileSystem;                // file system
  570.     idNetworkSystem *            networkSystem;            // network system
  571.     idRenderSystem *            renderSystem;            // render system
  572.     idSoundSystem *                soundSystem;            // sound system
  573.     idRenderModelManager *        renderModelManager;        // render model manager
  574.     idUserInterfaceManager *    uiManager;                // user interface manager
  575.     idDeclManager *                declManager;            // declaration manager
  576.     idAASFileManager *            AASFileManager;            // AAS file manager
  577.     idCollisionModelManager *    collisionModelManager;    // collision model manager
  578.  
  579. // RAVEN BEGIN
  580. // jscott:
  581.     rvBSEManager *                bse;                    // Raven effects system
  582. // RAVEN END
  583.  
  584. // RAVEN BEGIN
  585. // dluetscher: added the following members to exchange memory system data
  586. #ifdef _RV_MEM_SYS_SUPPORT
  587.     rvHeapArena *                heapArena;                                // main heap arena that all other heaps use
  588.     rvHeap *                    systemHeapArray[MAX_SYSTEM_HEAPS];        // array of pointers to rvHeaps that are common to idLib, Game, and executable 
  589. #endif
  590. // RAVEN END
  591. };
  592.  
  593. struct gameExport_t {
  594.  
  595.     int                            version;                // API version
  596.     idGame *                    game;                    // interface to run the game
  597.     idGameEdit *                gameEdit;                // interface for in-game editing
  598. // RAVEN BEGIN
  599. // bdube: added
  600.     rvGameLog *                    gameLog;                // interface for game logging
  601. // RAVEN END    
  602. };
  603.  
  604. extern "C" {
  605. typedef gameExport_t * (*GetGameAPI_t)( gameImport_t *import );
  606. }
  607.  
  608. #endif /* !__GAME_H__ */
  609.