Annotation of quake1/client.h, revision 1.1.1.2

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