Annotation of quake1/client.h, revision 1.1.1.1

1.1       root        1: // client.h
                      2: 
                      3: typedef struct
                      4: {
                      5:        vec3_t  viewangles;
                      6: 
                      7: // intended velocities
                      8:        float   forwardmove;
                      9:        float   sidemove;
                     10:        float   upmove;
                     11: } usercmd_t;
                     12: 
                     13: typedef struct
                     14: {
                     15:        int             length;
                     16:        char    map[MAX_STYLESTRING];
                     17: } lightstyle_t;
                     18: 
                     19: typedef struct
                     20: {
                     21:        char    name[MAX_SCOREBOARDNAME];
                     22:        float   entertime;
                     23:        int             frags;
                     24:        int             colors;                 // two 4 bit fields
                     25:        byte    translations[VID_GRADES*256];
                     26: } scoreboard_t;
                     27: 
                     28: typedef struct
                     29: {
                     30:        int             destcolor[3];
                     31:        int             percent;                // 0-256
                     32: } cshift_t;
                     33: 
                     34: #define        CSHIFT_CONTENTS 0
                     35: #define        CSHIFT_DAMAGE   1
                     36: #define        CSHIFT_BONUS    2
                     37: #define        CSHIFT_POWERUP  3
                     38: #define        NUM_CSHIFTS             4
                     39: 
                     40: #define        NAME_LENGTH     64
                     41: 
                     42: 
                     43: //
                     44: // client_state_t should hold all pieces of the client state
                     45: //
                     46: 
                     47: #define        SIGNONS         4                       // signon messages to receive before connected
                     48: 
                     49: #define        MAX_DLIGHTS             32
                     50: typedef struct
                     51: {
                     52:        vec3_t  origin;
                     53:        float   radius;
                     54:        float   die;                            // stop lighting after this time
                     55:        float   decay;                          // drop this each second
                     56:        float   minlight;                       // don't add when contributing less
                     57: } dlight_t;
                     58: 
                     59: 
                     60: #define        MAX_BEAMS       8
                     61: typedef struct
                     62: {
                     63:        int             entity;
                     64:        struct model_s  *model;
                     65:        float   endtime;
                     66:        vec3_t  start, end;
                     67: } beam_t;
                     68: 
                     69: #define        MAX_EFRAGS              512
                     70: 
                     71: #define        MAX_MAPSTRING   2048
                     72: #define        MAX_DEMOS               8
                     73: #define        MAX_DEMONAME    16
                     74: 
                     75: typedef enum {
                     76: ca_dedicated,          // a dedicated server with no ability to start a client
                     77: ca_disconnected,       // full screen console with no connection
                     78: ca_connected           // valid netcon, talking to a server
                     79: } cactive_t;
                     80: 
                     81: //
                     82: // the client_static_t structure is persistant through an arbitrary number
                     83: // of server connections
                     84: //
                     85: typedef struct
                     86: {
                     87:        cactive_t       state;
                     88: 
                     89: // personalization data sent to server 
                     90:        char            mapstring[MAX_QPATH];
                     91:        char            spawnparms[MAX_MAPSTRING];      // to restart a level
                     92: 
                     93: // demo loop control
                     94:        int                     demonum;                // -1 = don't play demos
                     95:        char            demos[MAX_DEMOS][MAX_DEMONAME];         // when not playing
                     96: 
                     97: // demo recording info must be here, because record is started before
                     98: // entering a map (and clearing client_state_t)
                     99:        qboolean        demorecording;
                    100:        qboolean        demoplayback;
                    101:        qboolean        timedemo;
                    102:        int                     forcetrack;                     // -1 = use normal cd track
                    103:        FILE            *demofile;
                    104:        int                     td_lastframe;           // to meter out one message a frame
                    105:        int                     td_startframe;          // host_framecount at start
                    106:        float           td_starttime;           // realtime at second frame of timedemo
                    107: 
                    108: 
                    109: // connection information
                    110:        int                     signon;                 // 0 to SIGNONS
                    111:        struct qsocket_s        *netcon;
                    112:        sizebuf_t       message;                // writing buffer to send to server
                    113:        
                    114: } client_static_t;
                    115: 
                    116: extern client_static_t cls;
                    117: 
                    118: //
                    119: // the client_state_t structure is wiped completely at every
                    120: // server signon
                    121: //
                    122: typedef struct
                    123: {
                    124:        int                     movemessages;   // since connecting to this server
                    125:                                                                // throw out the first couple, so the player
                    126:                                                                // doesn't accidentally do something the 
                    127:                                                                // first frame
                    128:        usercmd_t       cmd;                    // last command sent to the server
                    129: 
                    130: // information for local display
                    131:        int                     stats[MAX_CL_STATS];    // health, etc
                    132:        int                     items;                  // inventory bit flags
                    133:        float   item_gettime[32];       // cl.time of aquiring item, for blinking
                    134:        float           faceanimtime;   // use anim frame if cl.time < this
                    135: 
                    136:        cshift_t        cshifts[NUM_CSHIFTS];   // color shifts for damage, powerups
                    137:        cshift_t        prev_cshifts[NUM_CSHIFTS];      // and content types
                    138: 
                    139: // the client maintains its own idea of view angles, which are
                    140: // sent to the server each frame.  The server sets punchangle when
                    141: // the view is temporarliy offset, and an angle reset commands at the start
                    142: // of each level and after teleporting.
                    143:        vec3_t          mviewangles[2]; // during demo playback viewangles is lerped
                    144:                                                                // between these
                    145:        vec3_t          viewangles;
                    146:        
                    147:        vec3_t          mvelocity[2];   // update by server, used for lean+bob
                    148:                                                                // (0 is newest)
                    149:        vec3_t          velocity;               // lerped between mvelocity[0] and [1]
                    150: 
                    151:        vec3_t          punchangle;             // temporary offset
                    152:        
                    153: // pitch drifting vars
                    154:        float           idealpitch;
                    155:        float           pitchvel;
                    156:        qboolean        nodrift;
                    157:        float           driftmove;
                    158:        double          laststop;
                    159: 
                    160:        float           viewheight;
                    161:        float           crouch;                 // local amount for smoothing stepups
                    162: 
                    163:        qboolean        paused;                 // send over by server
                    164:        qboolean        onground;
                    165:        qboolean        inwater;
                    166:        
                    167:        int                     intermission;   // don't change view angle, full screen, etc
                    168:        int                     completed_time; // latched at intermission start
                    169:        
                    170:        double          mtime[2];               // the timestamp of last two messages   
                    171:        double          time;                   // clients view of time, should be between
                    172:                                                                // servertime and oldservertime to generate
                    173:                                                                // a lerp point for other data
                    174:        double          oldtime;                // previous cl.time, time-oldtime is used
                    175:                                                                // to decay light values and smooth step ups
                    176:        
                    177: 
                    178:        float           last_received_message;  // (realtime) for net trouble icon
                    179: 
                    180: //
                    181: // information that is static for the entire time connected to a server
                    182: //
                    183:        struct model_s          *model_precache[MAX_MODELS];
                    184:        struct sfx_s            *sound_precache[MAX_SOUNDS];
                    185: 
                    186:        char            levelname[40];  // for display on solo scoreboard
                    187:        int                     viewentity;             // cl_entitites[cl.viewentity] = player
                    188:        int                     maxclients;
                    189:        int                     gametype;
                    190: 
                    191: // refresh related state
                    192:        struct model_s  *worldmodel;    // cl_entitites[0].model
                    193:        struct efrag_s  *free_efrags;
                    194:        int                     num_entities;   // held in cl_entities array
                    195:        int                     num_statics;    // held in cl_staticentities array
                    196:        entity_t        viewent;                        // the gun model
                    197: 
                    198:        int                     cdtrack, looptrack;     // cd audio
                    199: 
                    200: // frag scoreboard
                    201:        scoreboard_t    *scores;                // [cl.maxclients]
                    202: } client_state_t;
                    203: 
                    204: 
                    205: //
                    206: // cvars
                    207: //
                    208: extern cvar_t  cl_name;
                    209: extern cvar_t  cl_color;
                    210: 
                    211: extern cvar_t  cl_upspeed;
                    212: extern cvar_t  cl_forwardspeed;
                    213: extern cvar_t  cl_backspeed;
                    214: extern cvar_t  cl_sidespeed;
                    215: 
                    216: extern cvar_t  cl_movespeedkey;
                    217: 
                    218: extern cvar_t  cl_yawspeed;
                    219: extern cvar_t  cl_pitchspeed;
                    220: 
                    221: extern cvar_t  cl_anglespeedkey;
                    222: 
                    223: extern cvar_t  cl_autofire;
                    224: 
                    225: extern cvar_t  cl_shownet;
                    226: extern cvar_t  cl_nolerp;
                    227: 
                    228: extern cvar_t  cl_pitchdriftspeed;
                    229: extern cvar_t  lookspring;
                    230: extern cvar_t  lookstrafe;
                    231: extern cvar_t  sensitivity;
                    232: 
                    233: extern cvar_t  m_pitch;
                    234: extern cvar_t  m_yaw;
                    235: extern cvar_t  m_forward;
                    236: extern cvar_t  m_side;
                    237: 
                    238: 
                    239: #define        MAX_TEMP_ENTITIES       64                      // lightning bolts, etc
                    240: #define        MAX_STATIC_ENTITIES     128                     // torches, etc
                    241: 
                    242: extern client_state_t  cl;
                    243: 
                    244: // FIXME, allocate dynamically
                    245: extern efrag_t                 cl_efrags[MAX_EFRAGS];
                    246: extern entity_t                cl_entities[MAX_EDICTS];
                    247: extern entity_t                cl_static_entities[MAX_STATIC_ENTITIES];
                    248: extern lightstyle_t    cl_lightstyle[MAX_LIGHTSTYLES];
                    249: extern dlight_t                cl_dlights[MAX_DLIGHTS];
                    250: extern entity_t                cl_temp_entities[MAX_TEMP_ENTITIES];
                    251: extern beam_t                  cl_beams[MAX_BEAMS];
                    252: 
                    253: //=============================================================================
                    254: 
                    255: //
                    256: // cl_main
                    257: //
                    258: dlight_t *CL_AllocDlight (void);
                    259: void   CL_DecayLights (void);
                    260: 
                    261: void CL_Init (void);
                    262: 
                    263: void CL_EstablishConnection (char *host);
                    264: void CL_Signon1 (void);
                    265: void CL_Signon2 (void);
                    266: void CL_Signon3 (void);
                    267: void CL_Signon4 (void);
                    268: 
                    269: void CL_Disconnect (void);
                    270: void CL_Disconnect_f (void);
                    271: void CL_NextDemo (void);
                    272: 
                    273: #define                        MAX_VISEDICTS   256
                    274: extern int                             cl_numvisedicts;
                    275: extern entity_t                *cl_visedicts[MAX_VISEDICTS];
                    276: 
                    277: //
                    278: // cl_input
                    279: //
                    280: typedef struct
                    281: {
                    282:        int             down[2];                // key nums holding it down
                    283:        int             state;                  // low bit is down state
                    284: } kbutton_t;
                    285: 
                    286: extern kbutton_t       in_mlook, in_klook;
                    287: extern         kbutton_t       in_strafe;
                    288: extern         kbutton_t       in_speed;
                    289: 
                    290: void CL_InitInput (void);
                    291: void CL_SendCmd (void);
                    292: void CL_SendMove (usercmd_t *cmd);
                    293: 
                    294: void CL_ParseTEnt (void);
                    295: void CL_UpdateTEnts (void);
                    296: 
                    297: void CL_ClearState (void);
                    298: 
                    299: 
                    300: int  CL_ReadFromServer (void);
                    301: void CL_WriteToServer (usercmd_t *cmd);
                    302: void CL_BaseMove (usercmd_t *cmd);
                    303: 
                    304: 
                    305: float CL_KeyState (kbutton_t *key);
                    306: char *Key_KeynumToString (int keynum);
                    307: 
                    308: //
                    309: // cl_demo.c
                    310: //
                    311: void CL_StopPlayback (void);
                    312: int CL_GetMessage (void);
                    313: 
                    314: void CL_Stop_f (void);
                    315: void CL_Record_f (void);
                    316: void CL_PlayDemo_f (void);
                    317: void CL_TimeDemo_f (void);
                    318: 
                    319: //
                    320: // cl_parse.c
                    321: //
                    322: void CL_ParseServerMessage (void);
                    323: void CL_NewTranslation (int slot);
                    324: 
                    325: //
                    326: // view
                    327: //
                    328: void V_StartPitchDrift (void);
                    329: void V_StopPitchDrift (void);
                    330: 
                    331: void V_RenderView (void);
                    332: void V_UpdatePalette (void);
                    333: void V_Register (void);
                    334: void V_ParseDamage (void);
                    335: void V_SetContentsColor (int contents);
                    336: 
                    337: 
                    338: //
                    339: // cl_tent
                    340: //
                    341: void CL_InitTEnts (void);
                    342: void CL_SignonReply (void);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.