Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

cg_public.h (6167B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 //
     23 
     24 
     25 #define	CMD_BACKUP			64	
     26 #define	CMD_MASK			(CMD_BACKUP - 1)
     27 // allow a lot of command backups for very fast systems
     28 // multiple commands may be combined into a single packet, so this
     29 // needs to be larger than PACKET_BACKUP
     30 
     31 
     32 #define	MAX_ENTITIES_IN_SNAPSHOT	256
     33 
     34 // snapshots are a view of the server at a given time
     35 
     36 // Snapshots are generated at regular time intervals by the server,
     37 // but they may not be sent if a client's rate level is exceeded, or
     38 // they may be dropped by the network.
     39 typedef struct {
     40 	int				snapFlags;			// SNAPFLAG_RATE_DELAYED, etc
     41 	int				ping;
     42 
     43 	int				serverTime;		// server time the message is valid for (in msec)
     44 
     45 	byte			areamask[MAX_MAP_AREA_BYTES];		// portalarea visibility bits
     46 
     47 	playerState_t	ps;						// complete information about the current player at this time
     48 
     49 	int				numEntities;			// all of the entities that need to be presented
     50 	entityState_t	entities[MAX_ENTITIES_IN_SNAPSHOT];	// at the time of this snapshot
     51 
     52 	int				numServerCommands;		// text based server commands to execute when this
     53 	int				serverCommandSequence;	// snapshot becomes current
     54 } snapshot_t;
     55 
     56 enum {
     57   CGAME_EVENT_NONE,
     58   CGAME_EVENT_TEAMMENU,
     59   CGAME_EVENT_SCOREBOARD,
     60   CGAME_EVENT_EDITHUD
     61 };
     62 
     63 
     64 /*
     65 ==================================================================
     66 
     67 functions imported from the main executable
     68 
     69 ==================================================================
     70 */
     71 
     72 #define	CGAME_IMPORT_API_VERSION	4
     73 
     74 typedef enum {
     75 	CG_PRINT,
     76 	CG_ERROR,
     77 	CG_MILLISECONDS,
     78 	CG_CVAR_REGISTER,
     79 	CG_CVAR_UPDATE,
     80 	CG_CVAR_SET,
     81 	CG_CVAR_VARIABLESTRINGBUFFER,
     82 	CG_ARGC,
     83 	CG_ARGV,
     84 	CG_ARGS,
     85 	CG_FS_FOPENFILE,
     86 	CG_FS_READ,
     87 	CG_FS_WRITE,
     88 	CG_FS_FCLOSEFILE,
     89 	CG_SENDCONSOLECOMMAND,
     90 	CG_ADDCOMMAND,
     91 	CG_SENDCLIENTCOMMAND,
     92 	CG_UPDATESCREEN,
     93 	CG_CM_LOADMAP,
     94 	CG_CM_NUMINLINEMODELS,
     95 	CG_CM_INLINEMODEL,
     96 	CG_CM_LOADMODEL,
     97 	CG_CM_TEMPBOXMODEL,
     98 	CG_CM_POINTCONTENTS,
     99 	CG_CM_TRANSFORMEDPOINTCONTENTS,
    100 	CG_CM_BOXTRACE,
    101 	CG_CM_TRANSFORMEDBOXTRACE,
    102 	CG_CM_MARKFRAGMENTS,
    103 	CG_S_STARTSOUND,
    104 	CG_S_STARTLOCALSOUND,
    105 	CG_S_CLEARLOOPINGSOUNDS,
    106 	CG_S_ADDLOOPINGSOUND,
    107 	CG_S_UPDATEENTITYPOSITION,
    108 	CG_S_RESPATIALIZE,
    109 	CG_S_REGISTERSOUND,
    110 	CG_S_STARTBACKGROUNDTRACK,
    111 	CG_R_LOADWORLDMAP,
    112 	CG_R_REGISTERMODEL,
    113 	CG_R_REGISTERSKIN,
    114 	CG_R_REGISTERSHADER,
    115 	CG_R_CLEARSCENE,
    116 	CG_R_ADDREFENTITYTOSCENE,
    117 	CG_R_ADDPOLYTOSCENE,
    118 	CG_R_ADDLIGHTTOSCENE,
    119 	CG_R_RENDERSCENE,
    120 	CG_R_SETCOLOR,
    121 	CG_R_DRAWSTRETCHPIC,
    122 	CG_R_MODELBOUNDS,
    123 	CG_R_LERPTAG,
    124 	CG_GETGLCONFIG,
    125 	CG_GETGAMESTATE,
    126 	CG_GETCURRENTSNAPSHOTNUMBER,
    127 	CG_GETSNAPSHOT,
    128 	CG_GETSERVERCOMMAND,
    129 	CG_GETCURRENTCMDNUMBER,
    130 	CG_GETUSERCMD,
    131 	CG_SETUSERCMDVALUE,
    132 	CG_R_REGISTERSHADERNOMIP,
    133 	CG_MEMORY_REMAINING,
    134 	CG_R_REGISTERFONT,
    135 	CG_KEY_ISDOWN,
    136 	CG_KEY_GETCATCHER,
    137 	CG_KEY_SETCATCHER,
    138 	CG_KEY_GETKEY,
    139  	CG_PC_ADD_GLOBAL_DEFINE,
    140 	CG_PC_LOAD_SOURCE,
    141 	CG_PC_FREE_SOURCE,
    142 	CG_PC_READ_TOKEN,
    143 	CG_PC_SOURCE_FILE_AND_LINE,
    144 	CG_S_STOPBACKGROUNDTRACK,
    145 	CG_REAL_TIME,
    146 	CG_SNAPVECTOR,
    147 	CG_REMOVECOMMAND,
    148 	CG_R_LIGHTFORPOINT,
    149 	CG_CIN_PLAYCINEMATIC,
    150 	CG_CIN_STOPCINEMATIC,
    151 	CG_CIN_RUNCINEMATIC,
    152 	CG_CIN_DRAWCINEMATIC,
    153 	CG_CIN_SETEXTENTS,
    154 	CG_R_REMAP_SHADER,
    155 	CG_S_ADDREALLOOPINGSOUND,
    156 	CG_S_STOPLOOPINGSOUND,
    157 
    158 	CG_CM_TEMPCAPSULEMODEL,
    159 	CG_CM_CAPSULETRACE,
    160 	CG_CM_TRANSFORMEDCAPSULETRACE,
    161 	CG_R_ADDADDITIVELIGHTTOSCENE,
    162 	CG_GET_ENTITY_TOKEN,
    163 	CG_R_ADDPOLYSTOSCENE,
    164 	CG_R_INPVS,
    165 	// 1.32
    166 	CG_FS_SEEK,
    167 
    168 /*
    169 	CG_LOADCAMERA,
    170 	CG_STARTCAMERA,
    171 	CG_GETCAMERAINFO,
    172 */
    173 
    174 	CG_MEMSET = 100,
    175 	CG_MEMCPY,
    176 	CG_STRNCPY,
    177 	CG_SIN,
    178 	CG_COS,
    179 	CG_ATAN2,
    180 	CG_SQRT,
    181 	CG_FLOOR,
    182 	CG_CEIL,
    183 	CG_TESTPRINTINT,
    184 	CG_TESTPRINTFLOAT,
    185 	CG_ACOS
    186 } cgameImport_t;
    187 
    188 
    189 /*
    190 ==================================================================
    191 
    192 functions exported to the main executable
    193 
    194 ==================================================================
    195 */
    196 
    197 typedef enum {
    198 	CG_INIT,
    199 //	void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )
    200 	// called when the level loads or when the renderer is restarted
    201 	// all media should be registered at this time
    202 	// cgame will display loading status by calling SCR_Update, which
    203 	// will call CG_DrawInformation during the loading process
    204 	// reliableCommandSequence will be 0 on fresh loads, but higher for
    205 	// demos, tourney restarts, or vid_restarts
    206 
    207 	CG_SHUTDOWN,
    208 //	void (*CG_Shutdown)( void );
    209 	// oportunity to flush and close any open files
    210 
    211 	CG_CONSOLE_COMMAND,
    212 //	qboolean (*CG_ConsoleCommand)( void );
    213 	// a console command has been issued locally that is not recognized by the
    214 	// main game system.
    215 	// use Cmd_Argc() / Cmd_Argv() to read the command, return qfalse if the
    216 	// command is not known to the game
    217 
    218 	CG_DRAW_ACTIVE_FRAME,
    219 //	void (*CG_DrawActiveFrame)( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
    220 	// Generates and draws a game scene and status information at the given time.
    221 	// If demoPlayback is set, local movement prediction will not be enabled
    222 
    223 	CG_CROSSHAIR_PLAYER,
    224 //	int (*CG_CrosshairPlayer)( void );
    225 
    226 	CG_LAST_ATTACKER,
    227 //	int (*CG_LastAttacker)( void );
    228 
    229 	CG_KEY_EVENT, 
    230 //	void	(*CG_KeyEvent)( int key, qboolean down );
    231 
    232 	CG_MOUSE_EVENT,
    233 //	void	(*CG_MouseEvent)( int dx, int dy );
    234 	CG_EVENT_HANDLING
    235 //	void (*CG_EventHandling)(int type);
    236 } cgameExport_t;
    237 
    238 //----------------------------------------------