Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Sep 6th, 2010 | Syntax: C | Size: 5.29 KB | Hits: 61 | Expires: Never
Copy text to clipboard
  1. cg_t cg; // cg has the members assigned to the type cg_t varable which is the structure below.
  2.  
  3.  
  4. typedef struct {
  5.         int                     clientFrame;            // incremented each frame
  6.  
  7.         int                     clientNum;
  8.        
  9.         qboolean        demoPlayback;
  10.         qboolean        levelShot;                      // taking a level menu screenshot
  11.         int                     deferredPlayerLoading;
  12.         qboolean        loading;                        // don't defer players at initial startup
  13.         qboolean        intermissionStarted;    // don't play voice rewards, because game will end shortly
  14.  
  15.         // there are only one or two snapshot_t that are relevent at a time
  16.         int                     latestSnapshotNum;      // the number of snapshots the client system has received
  17.         int                     latestSnapshotTime;     // the time from latestSnapshotNum, so we don't need to read the snapshot yet
  18.  
  19.         snapshot_t      *snap;                          // cg.snap->serverTime <= cg.time
  20.         snapshot_t      *nextSnap;                      // cg.nextSnap->serverTime > cg.time, or NULL
  21.         snapshot_t      activeSnapshots[2];
  22.  
  23.         float           frameInterpolation;     // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
  24.  
  25.         qboolean        thisFrameTeleport;
  26.         qboolean        nextFrameTeleport;
  27.  
  28.         int                     frametime;              // cg.time - cg.oldTime
  29.  
  30.         int                     time;                   // this is the time value that the client
  31.                                                                 // is rendering at.
  32.         int                     oldTime;                // time at last frame, used for missile trails and prediction checking
  33.  
  34.         int                     physicsTime;    // either cg.snap->time or cg.nextSnap->time
  35.  
  36.         int                     timelimitWarnings;      // 5 min, 1 min, overtime
  37.         int                     fraglimitWarnings;
  38.  
  39.         qboolean        mapRestart;                     // set on a map restart to set back the weapon
  40.  
  41.         qboolean        renderingThirdPerson;           // during deaths, chasecams, etc
  42.  
  43.         // prediction state
  44.         qboolean        hyperspace;                             // true if prediction has hit a trigger_teleport
  45.         playerState_t   predictedPlayerState;
  46.         centity_t               predictedPlayerEntity;
  47.         qboolean        validPPS;                               // clear until the first call to CG_PredictPlayerState
  48.         int                     predictedErrorTime;
  49.         vec3_t          predictedError;
  50.  
  51.         int                     eventSequence;
  52.         int                     predictableEvents[MAX_PREDICTED_EVENTS];
  53.  
  54.         float           stepChange;                             // for stair up smoothing
  55.         int                     stepTime;
  56.  
  57.         float           duckChange;                             // for duck viewheight smoothing
  58.         int                     duckTime;
  59.  
  60.         float           landChange;                             // for landing hard
  61.         int                     landTime;
  62.  
  63.         // input state sent to server
  64.         int                     weaponSelect;
  65.  
  66.         // auto rotating items
  67.         vec3_t          autoAngles;
  68.         vec3_t          autoAxis[3];
  69.         vec3_t          autoAnglesFast;
  70.         vec3_t          autoAxisFast[3];
  71.  
  72.         // view rendering
  73.         refdef_t        refdef;
  74.         vec3_t          refdefViewAngles;               // will be converted to refdef.viewaxis
  75.  
  76.         // zoom key
  77.         qboolean        zoomed;
  78.         int                     zoomTime;
  79.         float           zoomSensitivity;
  80.  
  81.         // information screen text during loading
  82.         char            infoScreenText[MAX_STRING_CHARS];
  83.  
  84.         // scoreboard
  85.         int                     scoresRequestTime;
  86.         int                     numScores;
  87.         int                     selectedScore;
  88.         int                     teamScores[2];
  89.         score_t         scores[MAX_CLIENTS];
  90.         qboolean        showScores;
  91.         qboolean        scoreBoardShowing;
  92.         int                     scoreFadeTime;
  93.         char            killerName[MAX_NAME_LENGTH];
  94.         char                    spectatorList[MAX_STRING_CHARS];                // list of names
  95.         int                             spectatorLen;                                                                                           // length of list
  96.         float                   spectatorWidth;                                                                                 // width in device units
  97.         int                             spectatorTime;                                                                                  // next time to offset
  98.         int                             spectatorPaintX;                                                                                // current paint x
  99.         int                             spectatorPaintX2;                                                                               // current paint x
  100.         int                             spectatorOffset;                                                                                // current offset from start
  101.         int                             spectatorPaintLen;                                                                      // current offset from start
  102.  
  103.         // skull trails
  104.         skulltrail_t    skulltrails[MAX_CLIENTS];
  105.  
  106.         // centerprinting
  107.         int                     centerPrintTime;
  108.         int                     centerPrintCharWidth;
  109.         int                     centerPrintY;
  110.         char            centerPrint[1024];
  111.         int                     centerPrintLines;
  112.  
  113.         // low ammo warning state
  114.         int                     lowAmmoWarning;         // 1 = low, 2 = empty
  115.  
  116.         // kill timers for carnage reward
  117.         int                     lastKillTime;
  118.  
  119.         // crosshair client ID
  120.         int                     crosshairClientNum;
  121.         int                     crosshairClientTime;
  122.  
  123.         // powerup active flashing
  124.         int                     powerupActive;
  125.         int                     powerupTime;
  126.  
  127.         // attacking player
  128.         int                     attackerTime;
  129.         int                     voiceTime;
  130.  
  131.         // reward medals
  132.         int                     rewardStack;
  133.         int                     rewardTime;
  134.         int                     rewardCount[MAX_REWARDSTACK];
  135.         qhandle_t       rewardShader[MAX_REWARDSTACK];
  136.         qhandle_t       rewardSound[MAX_REWARDSTACK];
  137.  
  138.         // sound buffer mainly for announcer sounds
  139.         int                     soundBufferIn;
  140.         int                     soundBufferOut;
  141.         int                     soundTime;
  142.         qhandle_t       soundBuffer[MAX_SOUNDBUFFER];
  143.  
  144.         // for voice chat buffer
  145.         int                     voiceChatTime;
  146.         int                     voiceChatBufferIn;
  147.         int                     voiceChatBufferOut;
  148.  
  149.         // warmup countdown
  150.         int                     warmup;
  151.         int                     warmupCount;
  152.  
  153.         //==========================
  154.  
  155.         int                     itemPickup;
  156.         int                     itemPickupTime;
  157.         int                     itemPickupBlendTime;    // the pulse around the crosshair is timed seperately
  158.  
  159.         int                     weaponSelectTime;
  160.         int                     weaponAnimation;
  161.         int                     weaponAnimationTime;
  162.  
  163.         // blend blobs
  164.         float           damageTime;
  165.         float           damageX, damageY, damageValue;
  166.  
  167.         // status bar head
  168.         float           headYaw;
  169.         float           headEndPitch;
  170.         float           headEndYaw;
  171.         int                     headEndTime;
  172.         float           headStartPitch;
  173.         float           headStartYaw;
  174.         int                     headStartTime;
  175.  
  176.         // view movement
  177.         float           v_dmg_time;
  178.         float           v_dmg_pitch;
  179.         float           v_dmg_roll;
  180.  
  181.         vec3_t          kick_angles;    // weapon kicks
  182.         vec3_t          kick_origin;
  183.  
  184.         // temp working variables for player view
  185.         float           bobfracsin;
  186.         int                     bobcycle;
  187.         float           xyspeed;
  188.         int     nextOrbitTime;
  189.  
  190.         //qboolean cameraMode;          // if rendering from a loaded camera
  191.  
  192.  
  193.         // development tool
  194.         refEntity_t             testModelEntity;
  195.         char                    testModelName[MAX_QPATH];
  196.         qboolean                testGun;
  197.  
  198. } cg_t;