codemp/cgame/cg_local.h File Reference

#include "../game/q_shared.h"
#include "tr_types.h"
#include "../game/bg_public.h"
#include "cg_public.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Data Structures

struct  centity_s
struct  cg_t
struct  cgEffects_t
struct  cgLoopSound_s
struct  cgMedia_t
struct  cgs_t
struct  cgscreffects_s
struct  chatBoxItem_s
struct  clientInfo_t
struct  forceTicPos_s
struct  itemInfo_t
struct  lerpFrame_t
struct  localEntity_s
struct  markPoly_s
struct  playerEntity_t
struct  powerupInfo_t
struct  score_t
struct  siegeExtended_s
struct  skulltrail_t
struct  weaponInfo_s

Defines

#define CGAME_INLINE   ID_INLINE
#define NULL_HANDLE   ((qhandle_t) 0)
#define NULL_SOUND   ((sfxHandle_t) 0)
#define NULL_FX   ((fxHandle_t) 0)
#define POWERUP_BLINKS   5
#define POWERUP_BLINK_TIME   1000
#define FADE_TIME   200
#define PULSE_TIME   200
#define DAMAGE_DEFLECT_TIME   100
#define DAMAGE_RETURN_TIME   400
#define DAMAGE_TIME   500
#define LAND_DEFLECT_TIME   150
#define LAND_RETURN_TIME   300
#define STEP_TIME   200
#define DUCK_TIME   100
#define PAIN_TWITCH_TIME   200
#define WEAPON_SELECT_TIME   1400
#define ITEM_SCALEUP_TIME   1000
#define ZOOM_TIME   150
#define MAX_ZOOM_FOV   3.0f
#define ZOOM_IN_TIME   1500.0f
#define ZOOM_OUT_TIME   100.0f
#define ZOOM_START_PERCENT   0.3f
#define ITEM_BLOB_TIME   200
#define MUZZLE_FLASH_TIME   20
#define SINK_TIME   1000
#define ATTACKER_HEAD_TIME   10000
#define REWARD_TIME   3000
#define PULSE_SCALE   1.5
#define MAX_STEP_CHANGE   32
#define MAX_VERTS_ON_POLY   10
#define MAX_MARK_POLYS   256
#define STAT_MINUS   10
#define ICON_SIZE   48
#define CHAR_WIDTH   32
#define CHAR_HEIGHT   48
#define TEXT_ICON_SPACE   4
#define GIANT_WIDTH   32
#define GIANT_HEIGHT   48
#define NUM_FONT_BIG   1
#define NUM_FONT_SMALL   2
#define NUM_FONT_CHUNKY   3
#define NUM_CROSSHAIRS   9
#define TEAM_OVERLAY_MAXNAME_WIDTH   32
#define TEAM_OVERLAY_MAXLOCATION_WIDTH   64
#define WAVE_AMPLITUDE   1
#define WAVE_FREQUENCY   0.4
#define DEFAULT_MODEL   "kyle"
#define DEFAULT_FORCEPOWERS   "5-1-000000000000000000"
#define DEFAULT_REDTEAM_NAME   "Empire"
#define DEFAULT_BLUETEAM_NAME   "Rebellion"
#define MAX_CUSTOM_COMBAT_SOUNDS   40
#define MAX_CUSTOM_EXTRA_SOUNDS   40
#define MAX_CUSTOM_JEDI_SOUNDS   40
#define MAX_CUSTOM_DUEL_SOUNDS   40
#define MAX_CUSTOM_SOUNDS   40
#define MAX_CG_LOOPSOUNDS   8
#define MAX_SKULLTRAIL   10
#define MAX_REWARDSTACK   10
#define MAX_SOUNDBUFFER   20
#define MAX_PREDICTED_EVENTS   16
#define MAX_CHATBOX_ITEMS   5
#define MAX_TICS   14
#define NUM_CHUNK_MODELS   4

Typedefs

typedef cgLoopSound_s cgLoopSound_t
typedef centity_s centity_t
typedef markPoly_s markPoly_t
typedef localEntity_s localEntity_t
typedef weaponInfo_s weaponInfo_t
typedef chatBoxItem_s chatBoxItem_t
typedef forceTicPos_s forceTicPos_t
typedef cgscreffects_s cgscreffects_t
typedef siegeExtended_s siegeExtended_t

Enumerations

enum  footstep_t {
  FOOTSTEP_STONEWALK, FOOTSTEP_STONERUN, FOOTSTEP_METALWALK, FOOTSTEP_METALRUN,
  FOOTSTEP_PIPEWALK, FOOTSTEP_PIPERUN, FOOTSTEP_SPLASH, FOOTSTEP_WADE,
  FOOTSTEP_SWIM, FOOTSTEP_SNOWWALK, FOOTSTEP_SNOWRUN, FOOTSTEP_SANDWALK,
  FOOTSTEP_SANDRUN, FOOTSTEP_GRASSWALK, FOOTSTEP_GRASSRUN, FOOTSTEP_DIRTWALK,
  FOOTSTEP_DIRTRUN, FOOTSTEP_MUDWALK, FOOTSTEP_MUDRUN, FOOTSTEP_GRAVELWALK,
  FOOTSTEP_GRAVELRUN, FOOTSTEP_RUGWALK, FOOTSTEP_RUGRUN, FOOTSTEP_WOODWALK,
  FOOTSTEP_WOODRUN, FOOTSTEP_TOTAL
}
enum  impactSound_t { IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, IMPACTSOUND_FLESH }
enum  leType_t {
  LE_MARK, LE_EXPLOSION, LE_SPRITE_EXPLOSION, LE_FADE_SCALE_MODEL,
  LE_FRAGMENT, LE_PUFF, LE_MOVE_SCALE_FADE, LE_FALL_SCALE_FADE,
  LE_FADE_RGB, LE_SCALE_FADE, LE_SCOREPLUM, LE_OLINE,
  LE_SHOWREFENTITY, LE_LINE
}
enum  leFlag_t { LEF_PUFF_DONT_SCALE = 0x0001, LEF_TUMBLE = 0x0002, LEF_FADE_RGB = 0x0004, LEF_NO_RANDOM_ROTATE = 0x0008 }
enum  leMarkType_t { LEMT_NONE, LEMT_BURN, LEMT_BLOOD }
enum  leBounceSoundType_t {
  LEBS_NONE, LEBS_BLOOD, LEBS_BRASS, LEBS_METAL,
  LEBS_ROCK
}
enum  {
  CHUNK_METAL1 = 0, CHUNK_METAL2, CHUNK_ROCK1, CHUNK_ROCK2,
  CHUNK_ROCK3, CHUNK_CRATE1, CHUNK_CRATE2, CHUNK_WHITE_METAL,
  NUM_CHUNK_TYPES
}
enum  q3print_t { SYSTEM_PRINT, CHAT_PRINT, TEAMCHAT_PRINT }

Functions

void CGCam_Shake (float intensity, int duration)
void CGCam_SetMusicMult (float multiplier, int duration)
void CG_DrawMiscEnts (void)
const char * CG_ConfigString (int index)
const char * CG_Argv (int arg)
void QDECL CG_Printf (const char *msg,...)
void QDECL CG_Error (const char *msg,...)
void CG_StartMusic (qboolean bForceStart)
void CG_UpdateCvars (void)
int CG_CrosshairPlayer (void)
int CG_LastAttacker (void)
void CG_LoadMenus (const char *menuFile)
void CG_KeyEvent (int key, qboolean down)
void CG_MouseEvent (int x, int y)
void CG_EventHandling (int type)
void CG_RankRunFrame (void)
void CG_SetScoreSelection (void *menu)
void CG_BuildSpectatorString (void)
void CG_NextInventory_f (void)
void CG_PrevInventory_f (void)
void CG_NextForcePower_f (void)
void CG_PrevForcePower_f (void)
void CG_TestModel_f (void)
void CG_TestGun_f (void)
void CG_TestModelNextFrame_f (void)
void CG_TestModelPrevFrame_f (void)
void CG_TestModelNextSkin_f (void)
void CG_TestModelPrevSkin_f (void)
void CG_ZoomDown_f (void)
void CG_ZoomUp_f (void)
void CG_AddBufferedSound (sfxHandle_t sfx)
void CG_DrawActiveFrame (int serverTime, stereoFrame_t stereoView, qboolean demoPlayback)
void CG_TestG2Model_f (void)
void CG_TestModelSurfaceOnOff_f (void)
void CG_ListModelSurfaces_f (void)
void CG_ListModelBones_f (void)
void CG_TestModelSetAnglespre_f (void)
void CG_TestModelSetAnglespost_f (void)
void CG_TestModelAnimate_f (void)
void CG_FillRect (float x, float y, float width, float height, const float *color)
void CG_DrawPic (float x, float y, float width, float height, qhandle_t hShader)
void CG_DrawRotatePic (float x, float y, float width, float height, float angle, qhandle_t hShader)
void CG_DrawRotatePic2 (float x, float y, float width, float height, float angle, qhandle_t hShader)
void CG_DrawString (float x, float y, const char *string, float charWidth, float charHeight, const float *modulate)
void CG_DrawNumField (int x, int y, int width, int value, int charWidth, int charHeight, int style, qboolean zeroFill)
void CG_DrawStringExt (int x, int y, const char *string, const float *setColor, qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars)
void CG_DrawBigString (int x, int y, const char *s, float alpha)
void CG_DrawBigStringColor (int x, int y, const char *s, vec4_t color)
void CG_DrawSmallString (int x, int y, const char *s, float alpha)
void CG_DrawSmallStringColor (int x, int y, const char *s, vec4_t color)
int CG_DrawStrlen (const char *str)
float * CG_FadeColor (int startMsec, int totalMsec)
float * CG_TeamColor (int team)
void CG_TileClear (void)
void CG_ColorForHealth (vec4_t hcolor)
void CG_GetColorForHealth (int health, int armor, vec4_t hcolor)
void UI_DrawProportionalString (int x, int y, const char *str, int style, vec4_t color)
void UI_DrawScaledProportionalString (int x, int y, const char *str, int style, vec4_t color, float scale)
void CG_DrawRect (float x, float y, float width, float height, float size, const float *color)
void CG_DrawSides (float x, float y, float w, float h, float size)
void CG_DrawTopBottom (float x, float y, float w, float h, float size)
void CG_AddLagometerFrameInfo (void)
void CG_AddLagometerSnapshotInfo (snapshot_t *snap)
void CG_CenterPrint (const char *str, int y, int charWidth)
void CG_DrawHead (float x, float y, float w, float h, int clientNum, vec3_t headAngles)
void CG_DrawActive (stereoFrame_t stereoView)
void CG_DrawFlagModel (float x, float y, float w, float h, int team, qboolean force2D)
void CG_DrawTeamBackground (int x, int y, int w, int h, float alpha, int team)
void CG_OwnerDraw (float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle, int font)
void CG_Text_Paint (float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont)
int CG_Text_Width (const char *text, float scale, int iMenuFont)
int CG_Text_Height (const char *text, float scale, int iMenuFont)
float CG_GetValue (int ownerDraw)
qboolean CG_OwnerDrawVisible (int flags)
void CG_RunMenuScript (char **args)
qboolean CG_DeferMenuScript (char **args)
void CG_ShowResponseHead (void)
void CG_GetTeamColor (vec4_t *color)
const char * CG_GetGameStatusText (void)
const char * CG_GetKillerText (void)
void CG_Draw3DModel (float x, float y, float w, float h, qhandle_t model, void *ghoul2, int g2radius, qhandle_t skin, vec3_t origin, vec3_t angles)
void CG_Text_PaintChar (float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader)
const char * CG_GameTypeString (void)
qboolean CG_YourTeamHasFlag (void)
qboolean CG_OtherTeamHasFlag (void)
qhandle_t CG_StatusHandle (int task)
qboolean CG_RagDoll (centity_t *cent, vec3_t forcedAngles)
qboolean CG_G2TraceCollide (trace_t *tr, const vec3_t mins, const vec3_t maxs, const vec3_t lastValidStart, const vec3_t lastValidEnd)
void CG_AddGhoul2Mark (int shader, float size, vec3_t start, vec3_t end, int entnum, vec3_t entposition, float entangle, void *ghoul2, vec3_t scale, int lifeTime)
void CG_CreateNPCClient (clientInfo_t **ci)
void CG_DestroyNPCClient (clientInfo_t **ci)
void CG_Player (centity_t *cent)
void CG_ResetPlayerEntity (centity_t *cent)
void CG_AddRefEntityWithPowerups (refEntity_t *ent, entityState_t *state, int team)
void CG_NewClientInfo (int clientNum, qboolean entitiesInitialized)
sfxHandle_t CG_CustomSound (int clientNum, const char *soundName)
void CG_PlayerShieldHit (int entitynum, vec3_t angles, int amount)
void CG_BuildSolidList (void)
int CG_PointContents (const vec3_t point, int passEntityNum)
void CG_Trace (trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int skipNumber, int mask)
void CG_G2Trace (trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int skipNumber, int mask)
void CG_PredictPlayerState (void)
void CG_LoadDeferredPlayers (void)
void CG_CheckEvents (centity_t *cent)
const char * CG_PlaceString (int rank)
void CG_EntityEvent (centity_t *cent, vec3_t position)
void CG_PainEvent (centity_t *cent, int health)
void CG_ReattachLimb (centity_t *source)
void CG_S_AddLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void CG_S_AddRealLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void CG_S_StopLoopingSound (int entityNum, sfxHandle_t sfx)
void CG_S_UpdateLoopingSounds (int entityNum)
void CG_SetEntitySoundPosition (centity_t *cent)
void CG_AddPacketEntities (qboolean isPortal)
void CG_ManualEntityRender (centity_t *cent)
void CG_Beam (centity_t *cent)
void CG_AdjustPositionForMover (const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out)
void CG_PositionEntityOnTag (refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName)
void CG_PositionRotatedEntityOnTag (refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName)
void ScaleModelAxis (refEntity_t *ent)
void TurretClientRun (centity_t *ent)
void CG_GetClientWeaponMuzzleBoltPoint (int clIndex, vec3_t to)
void CG_NextWeapon_f (void)
void CG_PrevWeapon_f (void)
void CG_Weapon_f (void)
void CG_WeaponClean_f (void)
void CG_RegisterWeapon (int weaponNum)
void CG_RegisterItemVisuals (int itemNum)
void CG_FireWeapon (centity_t *cent, qboolean alt_fire)
void CG_MissileHitWall (int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, qboolean alt_fire, int charge)
void CG_MissileHitPlayer (int weapon, vec3_t origin, vec3_t dir, int entityNum, qboolean alt_fire)
void CG_AddViewWeapon (playerState_t *ps)
void CG_AddPlayerWeapon (refEntity_t *parent, playerState_t *ps, centity_t *cent, int team, vec3_t newAngles, qboolean thirdPerson)
void CG_DrawWeaponSelect (void)
void CG_DrawIconBackground (void)
void CG_OutOfAmmoChange (int oldWeapon)
void CG_InitMarkPolys (void)
void CG_AddMarks (void)
void CG_ImpactMark (qhandle_t markShader, const vec3_t origin, const vec3_t dir, float orientation, float r, float g, float b, float a, qboolean alphaFade, float radius, qboolean temporary)
void CG_InitLocalEntities (void)
localEntity_tCG_AllocLocalEntity (void)
void CG_AddLocalEntities (void)
localEntity_tCG_SmokePuff (const vec3_t p, const vec3_t vel, float radius, float r, float g, float b, float a, float duration, int startTime, int fadeInTime, int leFlags, qhandle_t hShader)
void CG_BubbleTrail (vec3_t start, vec3_t end, float spacing)
void CG_GlassShatter (int entnum, vec3_t dmgPt, vec3_t dmgDir, float dmgRadius, int maxShards)
void CG_ScorePlum (int client, vec3_t org, int score)
void CG_Chunks (int owner, vec3_t origin, const vec3_t normal, const vec3_t mins, const vec3_t maxs, float speed, int numChunks, material_t chunkType, int customChunk, float baseScale)
void CG_MiscModelExplosion (vec3_t mins, vec3_t maxs, int size, material_t chunkType)
void CG_Bleed (vec3_t origin, int entityNum)
localEntity_tCG_MakeExplosion (vec3_t origin, vec3_t dir, qhandle_t hModel, int numframes, qhandle_t shader, int msec, qboolean isSprite, float scale, int flags)
void CG_SurfaceExplosion (vec3_t origin, vec3_t normal, float radius, float shake_speed, qboolean smoke)
void CG_TestLine (vec3_t start, vec3_t end, int time, unsigned int color, int radius)
void CG_InitGlass (void)
void CG_ProcessSnapshots (void)
void CG_LoadingString (const char *s)
void CG_LoadingItem (int itemNum)
void CG_LoadingClient (int clientNum)
void CG_DrawInformation (void)
qboolean CG_DrawOldScoreboard (void)
void CG_DrawOldTourneyScoreboard (void)
qboolean CG_ConsoleCommand (void)
void CG_InitConsoleCommands (void)
void CG_ExecuteNewServerCommands (int latestSequence)
void CG_ParseServerinfo (void)
void CG_SetConfigValues (void)
void CG_ShaderStateChanged (void)
int CG_IsMindTricked (int trickIndex1, int trickIndex2, int trickIndex3, int trickIndex4, int client)
void CG_Respawn (void)
void CG_TransitionPlayerState (playerState_t *ps, playerState_t *ops)
void CG_CheckChangedPredictableEvents (playerState_t *ps)
void CG_InitSiegeMode (void)
void CG_SiegeRoundOver (centity_t *ent, int won)
void CG_SiegeObjectiveCompleted (centity_t *ent, int won, int objectivenum)
void trap_Print (const char *fmt)
void trap_Error (const char *fmt)
int trap_Milliseconds (void)
void trap_PrecisionTimer_Start (void **theNewTimer)
int trap_PrecisionTimer_End (void *theTimer)
void trap_Cvar_Register (vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags)
void trap_Cvar_Update (vmCvar_t *vmCvar)
void trap_Cvar_Set (const char *var_name, const char *value)
void trap_Cvar_VariableStringBuffer (const char *var_name, char *buffer, int bufsize)
int trap_Cvar_GetHiddenVarValue (const char *name)
int trap_Argc (void)
void trap_Argv (int n, char *buffer, int bufferLength)
void trap_Args (char *buffer, int bufferLength)
int trap_FS_FOpenFile (const char *qpath, fileHandle_t *f, fsMode_t mode)
void trap_FS_Read (void *buffer, int len, fileHandle_t f)
void trap_FS_Write (const void *buffer, int len, fileHandle_t f)
void trap_FS_FCloseFile (fileHandle_t f)
int trap_FS_GetFileList (const char *path, const char *extension, char *listbuf, int bufsize)
void trap_SendConsoleCommand (const char *text)
void trap_AddCommand (const char *cmdName)
void trap_SendClientCommand (const char *s)
void trap_UpdateScreen (void)
void trap_CM_LoadMap (const char *mapname, qboolean SubBSP)
int trap_CM_NumInlineModels (void)
clipHandle_t trap_CM_InlineModel (int index)
clipHandle_t trap_CM_TempBoxModel (const vec3_t mins, const vec3_t maxs)
int trap_CM_PointContents (const vec3_t p, clipHandle_t model)
int trap_CM_TransformedPointContents (const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles)
void trap_CM_BoxTrace (trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask)
void trap_CM_TransformedBoxTrace (trace_t *results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, clipHandle_t model, int brushmask, const vec3_t origin, const vec3_t angles)
int trap_CM_MarkFragments (int numPoints, const vec3_t *points, const vec3_t projection, int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer)
int trap_S_GetVoiceVolume (int entityNum)
void trap_S_MuteSound (int entityNum, int entchannel)
void trap_S_StartSound (vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx)
void trap_S_StopLoopingSound (int entnum)
void trap_S_StartLocalSound (sfxHandle_t sfx, int channelNum)
void trap_S_ClearLoopingSounds (void)
void trap_S_AddLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void trap_S_AddRealLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void trap_S_UpdateEntityPosition (int entityNum, const vec3_t origin)
void trap_S_Respatialize (int entityNum, const vec3_t origin, vec3_t axis[3], int inwater)
void trap_S_ShutUp (qboolean shutUpFactor)
sfxHandle_t trap_S_RegisterSound (const char *sample)
void trap_S_StartBackgroundTrack (const char *intro, const char *loop, qboolean bReturnWithoutStarting)
void trap_S_StopBackgroundTrack (void)
void trap_S_UpdateAmbientSet (const char *name, vec3_t origin)
void trap_AS_ParseSets (void)
void trap_AS_AddPrecacheEntry (const char *name)
int trap_S_AddLocalSet (const char *name, vec3_t listener_origin, vec3_t origin, int entID, int time)
sfxHandle_t trap_AS_GetBModelSound (const char *name, int stage)
void trap_R_LoadWorldMap (const char *mapname)
qhandle_t trap_R_RegisterModel (const char *name)
qhandle_t trap_R_RegisterSkin (const char *name)
qhandle_t trap_R_RegisterShader (const char *name)
qhandle_t trap_R_RegisterShaderNoMip (const char *name)
qhandle_t trap_R_RegisterFont (const char *name)
int trap_R_Font_StrLenPixels (const char *text, const int iFontIndex, const float scale)
int trap_R_Font_StrLenChars (const char *text)
int trap_R_Font_HeightPixels (const int iFontIndex, const float scale)
void trap_R_Font_DrawString (int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale)
qboolean trap_Language_IsAsian (void)
qboolean trap_Language_UsesSpaces (void)
unsigned trap_AnyLanguage_ReadCharFromString (const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation)
void trap_R_ClearScene (void)
void trap_R_ClearDecals (void)
void trap_R_AddRefEntityToScene (const refEntity_t *re)
void trap_R_AddPolyToScene (qhandle_t hShader, int numVerts, const polyVert_t *verts)
void trap_R_AddPolysToScene (qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys)
void trap_R_AddDecalToScene (qhandle_t shader, const vec3_t origin, const vec3_t dir, float orientation, float r, float g, float b, float a, qboolean alphaFade, float radius, qboolean temporary)
void trap_R_AddLightToScene (const vec3_t org, float intensity, float r, float g, float b)
int trap_R_LightForPoint (vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir)
void trap_R_RenderScene (const refdef_t *fd)
void trap_R_SetColor (const float *rgba)
void trap_R_DrawStretchPic (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader)
void trap_R_ModelBounds (clipHandle_t model, vec3_t mins, vec3_t maxs)
int trap_R_LerpTag (orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName)
void trap_R_DrawRotatePic (float x, float y, float w, float h, float s1, float t1, float s2, float t2, float a, qhandle_t hShader)
void trap_R_DrawRotatePic2 (float x, float y, float w, float h, float s1, float t1, float s2, float t2, float a, qhandle_t hShader)
void trap_R_SetRangeFog (float range)
void trap_R_SetRefractProp (float alpha, float stretch, qboolean prepost, qboolean negate)
void trap_R_RemapShader (const char *oldShader, const char *newShader, const char *timeOffset)
void trap_R_GetLightStyle (int style, color4ub_t color)
void trap_R_SetLightStyle (int style, int color)
void trap_R_GetBModelVerts (int bmodelIndex, vec3_t *verts, vec3_t normal)
void trap_R_GetDistanceCull (float *f)
void trap_R_GetRealRes (int *w, int *h)
void trap_R_AutomapElevAdj (float newHeight)
qboolean trap_R_InitWireframeAutomap (void)
void trap_FX_AddLine (const vec3_t start, const vec3_t end, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, const vec3_t sRGB, const vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int flags)
void trap_GetGlconfig (glconfig_t *glconfig)
void trap_GetGameState (gameState_t *gamestate)
void trap_GetCurrentSnapshotNumber (int *snapshotNumber, int *serverTime)
qboolean trap_GetSnapshot (int snapshotNumber, snapshot_t *snapshot)
qboolean trap_GetDefaultState (int entityIndex, entityState_t *state)
qboolean trap_GetServerCommand (int serverCommandNumber)
int trap_GetCurrentCmdNumber (void)
qboolean trap_GetUserCmd (int cmdNumber, usercmd_t *ucmd)
void trap_SetUserCmdValue (int stateValue, float sensitivityScale, float mPitchOverride, float mYawOverride, float mSensitivityOverride, int fpSel, int invenSel, qboolean fighterControls)
void trap_SetClientForceAngle (int time, vec3_t angle)
void trap_SetClientTurnExtent (float turnAdd, float turnSub, int turnTime)
void trap_OpenUIMenu (int menuID)
void testPrintInt (char *string, int i)
void testPrintFloat (char *string, float f)
int trap_MemoryRemaining (void)
qboolean trap_Key_IsDown (int keynum)
int trap_Key_GetCatcher (void)
void trap_Key_SetCatcher (int catcher)
int trap_Key_GetKey (const char *binding)
void BG_CycleInven (playerState_t *ps, int direction)
int BG_ProperForceIndex (int power)
void BG_CycleForce (playerState_t *ps, int direction)
int trap_CIN_PlayCinematic (const char *arg0, int xpos, int ypos, int width, int height, int bits)
e_status trap_CIN_StopCinematic (int handle)
e_status trap_CIN_RunCinematic (int handle)
void trap_CIN_DrawCinematic (int handle)
void trap_CIN_SetExtents (int handle, int x, int y, int w, int h)
void trap_SnapVector (float *v)
qboolean trap_loadCamera (const char *name)
void trap_startCamera (int time)
qboolean trap_getCameraInfo (int time, vec3_t *origin, vec3_t *angles)
qboolean trap_GetEntityToken (char *buffer, int bufferSize)
qboolean trap_R_inPVS (const vec3_t p1, const vec3_t p2, byte *mask)
int trap_FX_InitSystem (refdef_t *)
void trap_FX_SetRefDef (refdef_t *refdef)
int trap_FX_RegisterEffect (const char *file)
void trap_FX_PlayEffect (const char *file, vec3_t org, vec3_t fwd, int vol, int rad)
void trap_FX_PlayEntityEffect (const char *file, vec3_t org, vec3_t axis[3], const int boltInfo, const int entNum, int vol, int rad)
void trap_FX_PlayEffectID (int id, vec3_t org, vec3_t fwd, int vol, int rad)
void trap_FX_PlayPortalEffectID (int id, vec3_t org, vec3_t fwd, int vol, int rad)
void trap_FX_PlayEntityEffectID (int id, vec3_t org, vec3_t axis[3], const int boltInfo, const int pGhoul2, int vol, int rad)
void trap_FX_PlayBoltedEffectID (int id, vec3_t org, void *pGhoul2, const int boltNum, const int entNum, const int modelNum, int iLooptime, qboolean isRelative)
void trap_FX_AddScheduledEffects (qboolean skyPortal)
void trap_FX_Draw2DEffects (float screenXScale, float screenYScale)
qboolean trap_FX_FreeSystem (void)
void trap_FX_AdjustTime (int time)
void trap_FX_Reset (void)
void trap_FX_AddPoly (addpolyArgStruct_t *p)
void trap_FX_AddBezier (addbezierArgStruct_t *p)
void trap_FX_AddPrimitive (effectTrailArgStruct_t *p)
void trap_FX_AddSprite (addspriteArgStruct_t *p)
void trap_FX_AddElectricity (addElectricityArgStruct_t *p)
int trap_SP_GetStringTextString (const char *text, char *buffer, int bufferLength)
void trap_CG_RegisterSharedMemory (char *memory)
int trap_CM_RegisterTerrain (const char *config)
void trap_RMG_Init (int terrainID, const char *terrainInfo)
void trap_RE_InitRendererTerrain (const char *info)
void trap_R_WeatherContentsOverride (int contents)
void trap_R_WorldEffectCommand (const char *cmd)
void trap_WE_AddWeatherZone (const vec3_t mins, const vec3_t maxs)
qboolean trap_ROFF_Clean (void)
void trap_ROFF_UpdateEntities (void)
int trap_ROFF_Cache (char *file)
qboolean trap_ROFF_Play (int entID, int roffID, qboolean doTranslation)
qboolean trap_ROFF_Purge_Ent (int entID)
void trap_TrueMalloc (void **ptr, int size)
void trap_TrueFree (void **ptr)
void CG_ClearParticles (void)
void CG_AddParticles (void)
void CG_ParticleSnow (qhandle_t pshader, vec3_t origin, vec3_t origin2, int turb, float range, int snum)
void CG_ParticleSmoke (qhandle_t pshader, centity_t *cent)
void CG_AddParticleShrapnel (localEntity_t *le)
void CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent)
void CG_ParticleBulletDebris (vec3_t org, vec3_t vel, int duration)
void CG_ParticleSparks (vec3_t org, vec3_t vel, int duration, float x, float y, float speed)
void CG_ParticleDust (centity_t *cent, vec3_t origin, vec3_t dir)
void CG_ParticleMisc (qhandle_t pshader, vec3_t origin, int size, int duration, float alpha)
void CG_ParticleExplosion (char *animStr, vec3_t origin, vec3_t vel, int duration, int sizeStart, int sizeEnd)
const char * CG_GetStringEdString (char *refSection, char *refName)
int CG_NewParticleArea (int num)
void FX_TurretProjectileThink (centity_t *cent, const struct weaponInfo_s *weapon)
void FX_TurretHitWall (vec3_t origin, vec3_t normal)
void FX_TurretHitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_ConcussionHitWall (vec3_t origin, vec3_t normal)
void FX_ConcussionHitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_ConcussionProjectileThink (centity_t *cent, const struct weaponInfo_s *weapon)
void FX_ConcAltShot (vec3_t start, vec3_t end)
void CG_Spark (vec3_t origin, vec3_t dir)
void FX_BryarHitWall (vec3_t origin, vec3_t normal)
void FX_BryarAltHitWall (vec3_t origin, vec3_t normal, int power)
void FX_BryarHitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_BryarAltHitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_BlasterProjectileThink (centity_t *cent, const struct weaponInfo_s *weapon)
void FX_BlasterAltFireThink (centity_t *cent, const struct weaponInfo_s *weapon)
void FX_BlasterWeaponHitWall (vec3_t origin, vec3_t normal)
void FX_BlasterWeaponHitPlayer (vec3_t origin, vec3_t normal, qboolean humanoid)
void FX_ForceDrained (vec3_t origin, vec3_t dir)
void trap_G2API_CollisionDetect (CollisionRecord_t *collRecMap, void *ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius)
void trap_G2API_CollisionDetectCache (CollisionRecord_t *collRecMap, void *ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius)
void trap_G2_ListModelSurfaces (void *ghlInfo)
void trap_G2_ListModelBones (void *ghlInfo, int frame)
void trap_G2_SetGhoul2ModelIndexes (void *ghoul2, qhandle_t *modelList, qhandle_t *skinList)
qboolean trap_G2_HaveWeGhoul2Models (void *ghoul2)
qboolean trap_G2API_GetBoltMatrix (void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
qboolean trap_G2API_GetBoltMatrix_NoReconstruct (void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
qboolean trap_G2API_GetBoltMatrix_NoRecNoRot (void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
int trap_G2API_InitGhoul2Model (void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin, qhandle_t customShader, int modelFlags, int lodBias)
qboolean trap_G2API_SetSkin (void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin)
int trap_G2API_CopyGhoul2Instance (void *g2From, void *g2To, int modelIndex)
void trap_G2API_CopySpecificGhoul2Model (void *g2From, int modelFrom, void *g2To, int modelTo)
void trap_G2API_DuplicateGhoul2Instance (void *g2From, void **g2To)
qboolean trap_G2API_HasGhoul2ModelOnIndex (void *ghlInfo, int modelIndex)
qboolean trap_G2API_RemoveGhoul2Model (void *ghlInfo, int modelIndex)
qboolean trap_G2API_SkinlessModel (void *ghlInfo, int modelIndex)
int trap_G2API_GetNumGoreMarks (void *ghlInfo, int modelIndex)
void trap_G2API_AddSkinGore (void *ghlInfo, SSkinGoreData *gore)
void trap_G2API_ClearSkinGore (void *ghlInfo)
int trap_G2API_Ghoul2Size (void *ghlInfo)
int trap_G2API_AddBolt (void *ghoul2, int modelIndex, const char *boneName)
void trap_G2API_SetBoltInfo (void *ghoul2, int modelIndex, int boltInfo)
qboolean trap_G2API_AttachEnt (int *boltInfo, void *ghlInfoTo, int toBoltIndex, int entNum, int toModelNum)
void trap_G2API_CleanGhoul2Models (void **ghoul2Ptr)
qboolean trap_G2API_SetBoneAngles (void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags, const int up, const int right, const int forward, qhandle_t *modelList, int blendTime, int currentTime)
void trap_G2API_GetGLAName (void *ghoul2, int modelIndex, char *fillBuf)
qboolean trap_G2API_SetBoneAnim (void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime)
qboolean trap_G2API_GetBoneAnim (void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex)
qboolean trap_G2API_GetBoneFrame (void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex)
qboolean trap_G2API_SetRootSurface (void *ghoul2, const int modelIndex, const char *surfaceName)
qboolean trap_G2API_SetSurfaceOnOff (void *ghoul2, const char *surfaceName, const int flags)
qboolean trap_G2API_SetNewOrigin (void *ghoul2, const int boltIndex)
qboolean trap_G2API_DoesBoneExist (void *ghoul2, int modelIndex, const char *boneName)
int trap_G2API_GetSurfaceRenderStatus (void *ghoul2, const int modelIndex, const char *surfaceName)
int trap_G2API_GetTime (void)
void trap_G2API_SetTime (int time, int clock)
void trap_G2API_AbsurdSmoothing (void *ghoul2, qboolean status)
void trap_G2API_SetRagDoll (void *ghoul2, sharedRagDollParams_t *params)
void trap_G2API_AnimateG2Models (void *ghoul2, int time, sharedRagDollUpdateParams_t *params)
qboolean trap_G2API_RagPCJConstraint (void *ghoul2, const char *boneName, vec3_t min, vec3_t max)
qboolean trap_G2API_RagPCJGradientSpeed (void *ghoul2, const char *boneName, const float speed)
qboolean trap_G2API_RagEffectorGoal (void *ghoul2, const char *boneName, vec3_t pos)
qboolean trap_G2API_GetRagBonePos (void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale)
qboolean trap_G2API_RagEffectorKick (void *ghoul2, const char *boneName, vec3_t velocity)
qboolean trap_G2API_RagForceSolve (void *ghoul2, qboolean force)
qboolean trap_G2API_SetBoneIKState (void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params)
qboolean trap_G2API_IKMove (void *ghoul2, int time, sharedIKMoveParams_t *params)
qboolean trap_G2API_RemoveBone (void *ghoul2, const char *boneName, int modelIndex)
void trap_G2API_AttachInstanceToEntNum (void *ghoul2, int entityNum, qboolean server)
void trap_G2API_ClearAttachedInstance (int entityNum)
void trap_G2API_CleanEntAttachments (void)
qboolean trap_G2API_OverrideServer (void *serverInstance)
void trap_G2API_GetSurfaceName (void *ghoul2, int surfNumber, int modelIndex, char *fillBuf)
void CG_Init_CG (void)
void CG_Init_CGents (void)
void CG_SetGhoul2Info (refEntity_t *ent, centity_t *cent)
void CG_CreateBBRefEnts (entityState_t *s1, vec3_t origin)
void CG_InitG2Weapons (void)
void CG_ShutDownG2Weapons (void)
void CG_CopyG2WeaponInstance (centity_t *cent, int weaponNum, void *toGhoul2)
void * CG_G2WeaponInstance (centity_t *cent, int weapon)
void CG_CheckPlayerG2Weapons (playerState_t *ps, centity_t *cent)
void CG_SetSiegeTimerCvar (int msec)

Variables

forceTicPos_t forceTicPos []
forceTicPos_t ammoTicPos []
cgscreffects_t cgScreenEffects
siegeExtended_t cg_siegeExtendedData [MAX_CLIENTS]
cgs_t cgs
cg_t cg
centity_t cg_entities [MAX_GENTITIES]
centity_tcg_permanents [MAX_GENTITIES]
int cg_numpermanents
weaponInfo_t cg_weapons [MAX_WEAPONS]
itemInfo_t cg_items [MAX_ITEMS]
markPoly_t cg_markPolys [MAX_MARK_POLYS]
vmCvar_t cg_centertime
vmCvar_t cg_runpitch
vmCvar_t cg_runroll
vmCvar_t cg_bobup
vmCvar_t cg_bobpitch
vmCvar_t cg_bobroll
vmCvar_t cg_shadows
vmCvar_t cg_renderToTextureFX
vmCvar_t cg_drawTimer
vmCvar_t cg_drawFPS
vmCvar_t cg_drawSnapshot
vmCvar_t cg_draw3dIcons
vmCvar_t cg_drawIcons
vmCvar_t cg_drawAmmoWarning
vmCvar_t cg_drawCrosshair
vmCvar_t cg_drawCrosshairNames
vmCvar_t cg_drawRadar
vmCvar_t cg_drawVehLeadIndicator
vmCvar_t cg_drawAutomap
vmCvar_t cg_drawScores
vmCvar_t cg_dynamicCrosshair
vmCvar_t cg_dynamicCrosshairPrecision
vmCvar_t cg_drawRewards
vmCvar_t cg_drawTeamOverlay
vmCvar_t cg_teamOverlayUserinfo
vmCvar_t cg_crosshairX
vmCvar_t cg_crosshairY
vmCvar_t cg_crosshairSize
vmCvar_t cg_crosshairHealth
vmCvar_t cg_drawStatus
vmCvar_t cg_draw2D
vmCvar_t cg_animSpeed
vmCvar_t cg_debugAnim
vmCvar_t cg_debugPosition
vmCvar_t cg_debugEvents
vmCvar_t cg_errorDecay
vmCvar_t cg_nopredict
vmCvar_t cg_noPlayerAnims
vmCvar_t cg_showmiss
vmCvar_t cg_showVehMiss
vmCvar_t cg_footsteps
vmCvar_t cg_addMarks
vmCvar_t cg_gun_frame
vmCvar_t cg_gun_x
vmCvar_t cg_gun_y
vmCvar_t cg_gun_z
vmCvar_t cg_drawGun
vmCvar_t cg_viewsize
vmCvar_t cg_autoswitch
vmCvar_t cg_ignore
vmCvar_t cg_simpleItems
vmCvar_t cg_fov
vmCvar_t cg_zoomFov
vmCvar_t cg_swingAngles
vmCvar_t cg_oldPainSounds
vmCvar_t cg_ragDoll
vmCvar_t cg_jumpSounds
vmCvar_t cg_autoMap
vmCvar_t cg_autoMapX
vmCvar_t cg_autoMapY
vmCvar_t cg_autoMapW
vmCvar_t cg_autoMapH
vmCvar_t bg_fighterAltControl
vmCvar_t cg_chatBox
vmCvar_t cg_chatBoxHeight
vmCvar_t cg_saberModelTraceEffect
vmCvar_t cg_saberClientVisualCompensation
vmCvar_t cg_g2TraceLod
vmCvar_t cg_fpls
vmCvar_t cg_ghoul2Marks
vmCvar_t cg_optvehtrace
vmCvar_t cg_saberDynamicMarks
vmCvar_t cg_saberDynamicMarkTime
vmCvar_t cg_saberContact
vmCvar_t cg_saberTrail
vmCvar_t cg_duelHeadAngles
vmCvar_t cg_speedTrail
vmCvar_t cg_auraShell
vmCvar_t cg_repeaterOrb
vmCvar_t cg_animBlend
vmCvar_t cg_dismember
vmCvar_t cg_thirdPersonSpecialCam
vmCvar_t cg_thirdPerson
vmCvar_t cg_thirdPersonRange
vmCvar_t cg_thirdPersonAngle
vmCvar_t cg_thirdPersonPitchOffset
vmCvar_t cg_thirdPersonVertOffset
vmCvar_t cg_thirdPersonCameraDamp
vmCvar_t cg_thirdPersonTargetDamp
vmCvar_t cg_thirdPersonAlpha
vmCvar_t cg_thirdPersonHorzOffset
vmCvar_t cg_stereoSeparation
vmCvar_t cg_lagometer
vmCvar_t cg_drawEnemyInfo
vmCvar_t cg_synchronousClients
vmCvar_t cg_stats
vmCvar_t cg_forceModel
vmCvar_t cg_buildScript
vmCvar_t cg_paused
vmCvar_t cg_blood
vmCvar_t cg_predictItems
vmCvar_t cg_deferPlayers
vmCvar_t cg_drawFriend
vmCvar_t cg_teamChatsOnly
vmCvar_t cg_noVoiceChats
vmCvar_t cg_noVoiceText
vmCvar_t cg_scorePlum
vmCvar_t cg_hudFiles
vmCvar_t cg_smoothClients
vmCvar_t pmove_fixed
vmCvar_t pmove_msec
vmCvar_t cg_cameraOrbit
vmCvar_t cg_cameraOrbitDelay
vmCvar_t cg_timescaleFadeEnd
vmCvar_t cg_timescaleFadeSpeed
vmCvar_t cg_timescale
vmCvar_t cg_cameraMode
vmCvar_t cg_smallFont
vmCvar_t cg_bigFont
vmCvar_t cg_noTaunt
vmCvar_t cg_noProjectileTrail
vmCvar_t cg_currentSelectedPlayer
vmCvar_t cg_currentSelectedPlayerName
vmCvar_t cg_recordSPDemo
vmCvar_t cg_recordSPDemoName
vmCvar_t ui_myteam
vmCvar_t cg_snapshotTimeout
vmCvar_t cg_debugBB
int sortedTeamPlayers [TEAM_MAXOVERLAY]
int numSortedTeamPlayers
char systemChat [256]
qboolean initparticles


Define Documentation

#define ATTACKER_HEAD_TIME   10000
 

Definition at line 49 of file cg_local.h.

#define CGAME_INLINE   ID_INLINE
 

Definition at line 14 of file cg_local.h.

#define CHAR_HEIGHT   48
 

Definition at line 63 of file cg_local.h.

#define CHAR_WIDTH   32
 

Definition at line 62 of file cg_local.h.

#define DAMAGE_DEFLECT_TIME   100
 

Definition at line 28 of file cg_local.h.

#define DAMAGE_RETURN_TIME   400
 

Definition at line 29 of file cg_local.h.

#define DAMAGE_TIME   500
 

Definition at line 30 of file cg_local.h.

Referenced by CG_DamageFeedback().

#define DEFAULT_BLUETEAM_NAME   "Rebellion"
 

Definition at line 88 of file cg_local.h.

Referenced by CG_LoadClientInfo().

#define DEFAULT_FORCEPOWERS   "5-1-000000000000000000"
 

Definition at line 84 of file cg_local.h.

Referenced by BotUtilizePersonality(), and CG_RegisterCvars().

#define DEFAULT_MODEL   "kyle"
 

Definition at line 82 of file cg_local.h.

Referenced by CG_LoadClientInfo(), and CG_RegisterCvars().

#define DEFAULT_REDTEAM_NAME   "Empire"
 

Definition at line 87 of file cg_local.h.

Referenced by CG_LoadClientInfo().

#define DUCK_TIME   100
 

Definition at line 34 of file cg_local.h.

#define FADE_TIME   200
 

Definition at line 26 of file cg_local.h.

Referenced by CG_DrawOldScoreboard(), and CG_FadeColor().

#define GIANT_HEIGHT   48
 

Definition at line 68 of file cg_local.h.

#define GIANT_WIDTH   32
 

Definition at line 67 of file cg_local.h.

#define ICON_SIZE   48
 

Definition at line 61 of file cg_local.h.

#define ITEM_BLOB_TIME   200
 

Definition at line 46 of file cg_local.h.

#define ITEM_SCALEUP_TIME   1000
 

Definition at line 37 of file cg_local.h.

#define LAND_DEFLECT_TIME   150
 

Definition at line 31 of file cg_local.h.

#define LAND_RETURN_TIME   300
 

Definition at line 32 of file cg_local.h.

#define MAX_CG_LOOPSOUNDS   8
 

Definition at line 321 of file cg_local.h.

Referenced by CG_S_AddLoopingSound().

#define MAX_CHATBOX_ITEMS   5
 

Definition at line 747 of file cg_local.h.

Referenced by CG_ChatBox_AddString().

#define MAX_CUSTOM_COMBAT_SOUNDS   40
 

Definition at line 187 of file cg_local.h.

#define MAX_CUSTOM_DUEL_SOUNDS   40
 

Definition at line 191 of file cg_local.h.

Referenced by CG_LoadCISounds().

#define MAX_CUSTOM_EXTRA_SOUNDS   40
 

Definition at line 188 of file cg_local.h.

#define MAX_CUSTOM_JEDI_SOUNDS   40
 

Definition at line 189 of file cg_local.h.

#define MAX_CUSTOM_SOUNDS   40
 

Definition at line 193 of file cg_local.h.

Referenced by CG_CustomSound(), and CG_LoadCISounds().

#define MAX_MARK_POLYS   256
 

Definition at line 57 of file cg_local.h.

Referenced by CG_InitMarkPolys().

#define MAX_PREDICTED_EVENTS   16
 

Definition at line 744 of file cg_local.h.

Referenced by CG_CheckChangedPredictableEvents(), and CG_CheckPlayerstateEvents().

#define MAX_REWARDSTACK   10
 

Definition at line 736 of file cg_local.h.

#define MAX_SKULLTRAIL   10
 

Definition at line 728 of file cg_local.h.

#define MAX_SOUNDBUFFER   20
 

Definition at line 737 of file cg_local.h.

Referenced by CG_AddBufferedSound().

#define MAX_STEP_CHANGE   32
 

Definition at line 54 of file cg_local.h.

Referenced by CG_EntityEvent().

#define MAX_TICS   14
 

Definition at line 1016 of file cg_local.h.

#define MAX_VERTS_ON_POLY   10
 

Definition at line 56 of file cg_local.h.

Referenced by CG_CreateSaberMarks(), and CG_ImpactMark().

#define MAX_ZOOM_FOV   3.0f
 

Definition at line 41 of file cg_local.h.

#define MUZZLE_FLASH_TIME   20
 

Definition at line 47 of file cg_local.h.

Referenced by CG_AddPlayerWeapon().

#define NULL_FX   ((fxHandle_t) 0)
 

Definition at line 21 of file cg_local.h.

Referenced by CG_RegisterWeapon().

#define NULL_HANDLE   ((qhandle_t) 0)
 

Definition at line 19 of file cg_local.h.

Referenced by CG_RegisterWeapon().

#define NULL_SOUND   ((sfxHandle_t) 0)
 

Definition at line 20 of file cg_local.h.

Referenced by CG_RegisterWeapon().

#define NUM_CHUNK_MODELS   4
 

Definition at line 1061 of file cg_local.h.

#define NUM_CROSSHAIRS   9
 

Definition at line 74 of file cg_local.h.

Referenced by AssetCache().

#define NUM_FONT_BIG   1
 

Definition at line 70 of file cg_local.h.

Referenced by CG_DrawNumField().

#define NUM_FONT_CHUNKY   3
 

Definition at line 72 of file cg_local.h.

Referenced by CG_DrawNumField().

#define NUM_FONT_SMALL   2
 

Definition at line 71 of file cg_local.h.

Referenced by CG_DrawArmor(), CG_DrawForcePower(), CG_DrawHealth(), and CG_DrawNumField().

#define PAIN_TWITCH_TIME   200
 

Definition at line 35 of file cg_local.h.

#define POWERUP_BLINK_TIME   1000
 

Definition at line 25 of file cg_local.h.

#define POWERUP_BLINKS   5
 

Definition at line 23 of file cg_local.h.

#define PULSE_SCALE   1.5
 

Definition at line 52 of file cg_local.h.

#define PULSE_TIME   200
 

Definition at line 27 of file cg_local.h.

#define REWARD_TIME   3000
 

Definition at line 50 of file cg_local.h.

#define SINK_TIME   1000
 

Definition at line 48 of file cg_local.h.

Referenced by CG_AddFragment().

#define STAT_MINUS   10
 

Definition at line 59 of file cg_local.h.

Referenced by CG_DrawNumField().

#define STEP_TIME   200
 

Definition at line 33 of file cg_local.h.

Referenced by CG_EntityEvent().

#define TEAM_OVERLAY_MAXLOCATION_WIDTH   64
 

Definition at line 77 of file cg_local.h.

#define TEAM_OVERLAY_MAXNAME_WIDTH   32
 

Definition at line 76 of file cg_local.h.

#define TEXT_ICON_SPACE   4
 

Definition at line 64 of file cg_local.h.

#define WAVE_AMPLITUDE   1
 

Definition at line 79 of file cg_local.h.

#define WAVE_FREQUENCY   0.4
 

Definition at line 80 of file cg_local.h.

#define WEAPON_SELECT_TIME   1400
 

Definition at line 36 of file cg_local.h.

Referenced by CG_DrawForceSelect(), CG_DrawIconBackground(), CG_DrawInvenSelect(), and CG_DrawWeaponSelect().

#define ZOOM_IN_TIME   1500.0f
 

Definition at line 42 of file cg_local.h.

#define ZOOM_OUT_TIME   100.0f
 

Definition at line 43 of file cg_local.h.

Referenced by CG_DrawSkyBoxPortal().

#define ZOOM_START_PERCENT   0.3f
 

Definition at line 44 of file cg_local.h.

#define ZOOM_TIME   150
 

Definition at line 40 of file cg_local.h.


Typedef Documentation

typedef struct centity_s centity_t
 

Referenced by BG_MySaber(), CG_AddBracketedEnt(), CG_AddPacketEntities(), CG_AddPlayerWeapon(), CG_AddRadarEnt(), CG_AddSaberBlade(), CG_AddViewWeapon(), CG_AdjustPositionForMover(), CG_Beam(), CG_BracketEntity(), CG_BuildSolidList(), CG_CalcEntityLerpPositions(), CG_CalcEWebMuzzlePoint(), CG_CalcMuzzlePoint(), CG_CalcVehicleMuzzlePoint(), CG_CalcVehMuzzle(), CG_CheckChangedPredictableEvents(), CG_CheckEvents(), CG_CheckPassengerTurretView(), CG_CheckPlayerG2Weapons(), CG_CheckPlayerstateEvents(), CG_CheckTargetVehicle(), CG_CheckThirdPersonAlpha(), CG_CopyG2WeaponInstance(), CG_CreateDistortionTrailPart(), CG_Disintegration(), CG_DrawActiveFrame(), CG_DrawBracketedEntities(), CG_DrawEWebHealth(), CG_DrawHealthBar(), CG_DrawHUD(), CG_DrawPlayerShield(), CG_DrawPlayerSphere(), CG_DrawRadar(), CG_DrawSiegeInfo(), CG_DrawVehicleAmmo(), CG_DrawVehicleAmmoLower(), CG_DrawVehicleAmmoUpper(), CG_DrawVehicleArmor(), CG_DrawVehicleDamage(), CG_DrawVehicleDamageHUD(), CG_DrawVehicleHud(), CG_DrawVehicleShields(), CG_DrawVehicleSpeed(), CG_DrawVehicleTurboRecharge(), CG_DrawVehicleWeaponsLinked(), CG_EntityEvent(), CG_FireWeapon(), CG_G2Animated(), CG_G2AnimEntModelLoad(), CG_G2MarkEvent(), CG_G2PlayerHeadAnims(), CG_G2SaberEffects(), CG_G2ServerBoneAngles(), CG_G2TraceCollide(), CG_G2WeaponInstance(), CG_GetClientWeaponMuzzleBoltPoint(), CG_GetValue(), CG_InATST(), CG_InFighter(), CG_InRoll(), CG_InRollAnim(), CG_ManualEntityRender(), CG_NewClientInfo(), CG_OilSlickRemove(), CG_PainEvent(), CG_ParseSiegeExtendedDataEntry(), CG_Particle_OilParticle(), CG_Particle_OilSlick(), CG_ParticleBloodCloud(), CG_ParticleDust(), CG_ParticleSmoke(), CG_ParticleSnowFlurry(), CG_PlayDoorLoopSound(), CG_PlayDoorSound(), CG_Player(), CG_PlayerAnimEventDo(), CG_PlayerHitFX(), CG_PlayerShieldHit(), CG_PmoveClientPointerUpdate(), CG_PointContents(), CG_PredictPlayerState(), CG_RadiusForCent(), CG_RagDoll(), CG_ReattachLimb(), CG_ResetPlayerEntity(), CG_ROFF_NotetrackCallback(), CG_S_AddLoopingSound(), CG_S_StopLoopingSound(), CG_S_UpdateLoopingSounds(), CG_SaberCompWork(), CG_SetEntitySoundPosition(), CG_SetGhoul2Info(), CG_SetInitialSnapshot(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), CG_SnowLink(), CG_Special(), CG_ThereIsAMaster(), CG_ToggleBinoculars(), CG_TransitionPermanent(), CG_TriggerAnimSounds(), CG_UpdateSoundTrackers(), CG_VehicleAttachDroidUnit(), CG_VehicleShouldDrawShields(), CG_VehicleWeaponImpact(), CG_VehMuzzleFireFX(), DoFall(), FX_BlasterAltFireThink(), FX_BlasterProjectileThink(), FX_BowcasterAltProjectileThink(), FX_BowcasterProjectileThink(), FX_BryarAltProjectileThink(), FX_BryarProjectileThink(), FX_ConcussionProjectileThink(), FX_DEMP2_ProjectileThink(), FX_DrawPortableShield(), FX_FlechetteAltProjectileThink(), FX_FlechetteProjectileThink(), FX_RepeaterAltProjectileThink(), FX_RepeaterProjectileThink(), FX_RocketAltProjectileThink(), FX_RocketProjectileThink(), FX_TurretProjectileThink(), G2_BoltToGhoul2Model(), and TurretClientRun().

typedef struct cgLoopSound_s cgLoopSound_t
 

Referenced by CG_S_AddLoopingSound(), CG_S_StopLoopingSound(), and CG_S_UpdateLoopingSounds().

typedef struct cgscreffects_s cgscreffects_t
 

typedef struct chatBoxItem_s chatBoxItem_t
 

Referenced by CG_ChatBox_AddString(), and CG_ChatBox_ArrayInsert().

typedef struct forceTicPos_s forceTicPos_t
 

typedef struct localEntity_s localEntity_t
 

Referenced by CG_AddFadeRGB(), CG_AddFragment(), CG_AddLine(), CG_AddLocalEntities(), CG_AddOLine(), CG_AddParticleShrapnel(), CG_AddRefEntity(), CG_AddScorePlum(), CG_AllocLocalEntity(), CG_Bleed(), CG_BloodPool(), CG_BloodTrail(), CG_BubbleTrail(), CG_Chunks(), CG_FragmentBounceMark(), CG_FragmentBounceSound(), CG_FreeLocalEntity(), CG_LaunchGib(), CG_MakeExplosion(), CG_ReflectVelocity(), CG_ScorePlum(), CG_SmokePuff(), CG_SurfaceExplosion(), CG_TestLine(), CG_ThrowChunk(), FX_AddOrientedLine(), FX_DEMP2_AltDetonate(), and FX_DrawPortableShield().

typedef struct markPoly_s markPoly_t
 

Referenced by CG_AddMarks(), CG_AllocMark(), CG_CreateSaberMarks(), CG_FreeMarkPoly(), and CG_ImpactMark().

typedef struct siegeExtended_s siegeExtended_t
 

Referenced by CG_DrawSiegeInfo().

typedef struct weaponInfo_s weaponInfo_t
 

Referenced by CG_AddPlayerWeapon(), CG_AddViewWeapon(), CG_DrawWeaponSelect(), CG_EntityEvent(), CG_FireWeapon(), CG_RegisterWeapon(), and TurretClientRun().


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
CHUNK_METAL1 
CHUNK_METAL2 
CHUNK_ROCK1 
CHUNK_ROCK2 
CHUNK_ROCK3 
CHUNK_CRATE1 
CHUNK_CRATE2 
CHUNK_WHITE_METAL 
NUM_CHUNK_TYPES 

Definition at line 1049 of file cg_local.h.

01050 {
01051         CHUNK_METAL1 = 0,
01052         CHUNK_METAL2,
01053         CHUNK_ROCK1,
01054         CHUNK_ROCK2,
01055         CHUNK_ROCK3,
01056         CHUNK_CRATE1,
01057         CHUNK_CRATE2,
01058         CHUNK_WHITE_METAL,
01059         NUM_CHUNK_TYPES
01060 };

enum footstep_t
 

Enumeration values:
FOOTSTEP_STONEWALK 
FOOTSTEP_STONERUN 
FOOTSTEP_METALWALK 
FOOTSTEP_METALRUN 
FOOTSTEP_PIPEWALK 
FOOTSTEP_PIPERUN 
FOOTSTEP_SPLASH 
FOOTSTEP_WADE 
FOOTSTEP_SWIM 
FOOTSTEP_SNOWWALK 
FOOTSTEP_SNOWRUN 
FOOTSTEP_SANDWALK 
FOOTSTEP_SANDRUN 
FOOTSTEP_GRASSWALK 
FOOTSTEP_GRASSRUN 
FOOTSTEP_DIRTWALK 
FOOTSTEP_DIRTRUN 
FOOTSTEP_MUDWALK 
FOOTSTEP_MUDRUN 
FOOTSTEP_GRAVELWALK 
FOOTSTEP_GRAVELRUN 
FOOTSTEP_RUGWALK 
FOOTSTEP_RUGRUN 
FOOTSTEP_WOODWALK 
FOOTSTEP_WOODRUN 
FOOTSTEP_TOTAL 

Definition at line 90 of file cg_local.h.

Referenced by CG_EntityEvent().

enum impactSound_t
 

Enumeration values:
IMPACTSOUND_DEFAULT 
IMPACTSOUND_METAL 
IMPACTSOUND_FLESH 

Definition at line 120 of file cg_local.h.

enum leBounceSoundType_t
 

Enumeration values:
LEBS_NONE 
LEBS_BLOOD 
LEBS_BRASS 
LEBS_METAL 
LEBS_ROCK 

Definition at line 511 of file cg_local.h.

Referenced by CG_Chunks().

00511              {
00512         LEBS_NONE,
00513         LEBS_BLOOD,
00514         LEBS_BRASS,
00515         LEBS_METAL,
00516         LEBS_ROCK
00517 } leBounceSoundType_t;  // fragment local entities can make sounds on impacts

enum leFlag_t
 

Enumeration values:
LEF_PUFF_DONT_SCALE 
LEF_TUMBLE 
LEF_FADE_RGB 
LEF_NO_RANDOM_ROTATE 

Definition at line 498 of file cg_local.h.

00498              {
00499         LEF_PUFF_DONT_SCALE = 0x0001,                   // do not scale size over time
00500         LEF_TUMBLE                      = 0x0002,                       // tumble over time, used for ejecting shells
00501         LEF_FADE_RGB            = 0x0004,                       // explicitly fade
00502         LEF_NO_RANDOM_ROTATE= 0x0008                    // MakeExplosion adds random rotate which could be bad in some cases
00503 } leFlag_t;

enum leMarkType_t
 

Enumeration values:
LEMT_NONE 
LEMT_BURN 
LEMT_BLOOD 

Definition at line 505 of file cg_local.h.

00505              {
00506         LEMT_NONE,
00507         LEMT_BURN,
00508         LEMT_BLOOD
00509 } leMarkType_t;                 // fragment local entities can leave marks on walls

enum leType_t
 

Enumeration values:
LE_MARK 
LE_EXPLOSION 
LE_SPRITE_EXPLOSION 
LE_FADE_SCALE_MODEL 
LE_FRAGMENT 
LE_PUFF 
LE_MOVE_SCALE_FADE 
LE_FALL_SCALE_FADE 
LE_FADE_RGB 
LE_SCALE_FADE 
LE_SCOREPLUM 
LE_OLINE 
LE_SHOWREFENTITY 
LE_LINE 

Definition at line 481 of file cg_local.h.

00481              {
00482         LE_MARK,
00483         LE_EXPLOSION,
00484         LE_SPRITE_EXPLOSION,
00485         LE_FADE_SCALE_MODEL, // currently only for Demp2 shock sphere
00486         LE_FRAGMENT,
00487         LE_PUFF,
00488         LE_MOVE_SCALE_FADE,
00489         LE_FALL_SCALE_FADE,
00490         LE_FADE_RGB,
00491         LE_SCALE_FADE,
00492         LE_SCOREPLUM,
00493         LE_OLINE,
00494         LE_SHOWREFENTITY,
00495         LE_LINE
00496 } leType_t;

enum q3print_t
 

Enumeration values:
SYSTEM_PRINT 
CHAT_PRINT 
TEAMCHAT_PRINT 

Definition at line 2373 of file cg_local.h.

02373              {
02374   SYSTEM_PRINT,
02375   CHAT_PRINT,
02376   TEAMCHAT_PRINT
02377 } q3print_t; // bk001201 - warning: useless keyword or type name in empty declaration


Function Documentation

void BG_CycleForce playerState_t ps,
int  direction
 

Definition at line 2014 of file bg_misc.c.

References BG_ProperForceIndex(), playerState_s::fd, forcedata_s::forcePowerSelected, forcedata_s::forcePowersKnown, forcePowerSorted, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, NUM_FORCE_POWERS, and playerState_t.

Referenced by CG_NextForcePower_f(), and CG_PrevForcePower_f().

02015 {
02016         int i = ps->fd.forcePowerSelected;
02017         int x = i;
02018         int presel = i;
02019         int foundnext = -1;
02020 
02021         if (!ps->fd.forcePowersKnown & (1 << x) ||
02022                 x >= NUM_FORCE_POWERS ||
02023                 x == -1)
02024         { //apparently we have no valid force powers
02025                 return;
02026         }
02027 
02028         x = BG_ProperForceIndex(x);
02029         presel = x;
02030 
02031         if (direction == 1)
02032         { //get the next power
02033                 x++;
02034         }
02035         else
02036         { //get the previous power
02037                 x--;
02038         }
02039 
02040         if (x >= NUM_FORCE_POWERS)
02041         { //cycled off the end.. cycle around to the first
02042                 x = 0;
02043         }
02044         if (x < 0)
02045         { //cycled off the beginning.. cycle around to the last
02046                 x = NUM_FORCE_POWERS-1;
02047         }
02048 
02049         i = forcePowerSorted[x]; //the "sorted" value of this power
02050 
02051         while (x != presel)
02052         { //loop around to the current force power
02053                 if (ps->fd.forcePowersKnown & (1 << i) && i != ps->fd.forcePowerSelected)
02054                 { //we have the force power
02055                         if (i != FP_LEVITATION &&
02056                                 i != FP_SABER_OFFENSE &&
02057                                 i != FP_SABER_DEFENSE &&
02058                                 i != FP_SABERTHROW)
02059                         { //it's selectable
02060                                 foundnext = i;
02061                                 break;
02062                         }
02063                 }
02064 
02065                 if (direction == 1)
02066                 { //next
02067                         x++;
02068                 }
02069                 else
02070                 { //previous
02071                         x--;
02072                 }
02073         
02074                 if (x >= NUM_FORCE_POWERS)
02075                 { //loop around
02076                         x = 0;
02077                 }
02078                 if (x < 0)
02079                 { //loop around
02080                         x = NUM_FORCE_POWERS-1;
02081                 }
02082 
02083                 i = forcePowerSorted[x]; //set to the sorted value again
02084         }
02085 
02086         if (foundnext != -1)
02087         { //found one, select it
02088                 ps->fd.forcePowerSelected = foundnext;
02089         }
02090 }

void BG_CycleInven playerState_t ps,
int  direction
 

Definition at line 2121 of file bg_misc.c.

02122 {
02123         int i;
02124         int dontFreeze = 0;
02125         int original;
02126 
02127         i = bg_itemlist[ps->stats[STAT_HOLDABLE_ITEM]].giTag;
02128         original = i;
02129 
02130         if (direction == 1)
02131         { //next
02132                 i++;
02133                 if (i == HI_NUM_HOLDABLE)
02134                 {
02135                         i = 1;
02136                 }
02137         }
02138         else
02139         { //previous
02140                 i--;
02141                 if (i == 0)
02142                 {
02143                         i = HI_NUM_HOLDABLE-1;
02144                 }
02145         }
02146 
02147         while (i != original)
02148         { //go in a full loop until hitting something, if hit nothing then select nothing
02149                 if (ps->stats[STAT_HOLDABLE_ITEMS] & (1 << i))
02150                 { //we have it, select it.
02151                         if (BG_IsItemSelectable(ps, i))
02152                         {
02153                                 ps->stats[STAT_HOLDABLE_ITEM] = BG_GetItemIndexByTag(i, IT_HOLDABLE);
02154                                 break;
02155                         }
02156                 }
02157 
02158                 if (direction == 1)
02159                 { //next
02160                         i++;
02161                 }
02162                 else
02163                 { //previous
02164                         i--;
02165                 }
02166 
02167                 if (i <= 0)
02168                 { //wrap around to the last
02169                         i = HI_NUM_HOLDABLE-1;
02170                 }
02171                 else if (i >= HI_NUM_HOLDABLE)
02172                 { //wrap around to the first
02173                         i = 1;
02174                 }
02175 
02176                 dontFreeze++;
02177                 if (dontFreeze >= 32)
02178                 { //yeah, sure, whatever (it's 2 am and I'm paranoid and can't frickin think)
02179                         break;
02180                 }
02181         }
02182 }

int BG_ProperForceIndex int  power  ) 
 

Definition at line 1997 of file bg_misc.c.

References forcePowerSorted, and NUM_FORCE_POWERS.

Referenced by BG_CycleForce(), and CG_DrawForceSelect().

01998 {
01999         int i = 0;
02000 
02001         while (i < NUM_FORCE_POWERS)
02002         {
02003                 if (forcePowerSorted[i] == power)
02004                 {
02005                         return i;
02006                 }
02007 
02008                 i++;
02009         }
02010 
02011         return -1;
02012 }

void CG_AddBufferedSound sfxHandle_t  sfx  ) 
 

Definition at line 1934 of file cg_view.c.

References cg, MAX_SOUNDBUFFER, sfxHandle_t, cg_t::soundBuffer, cg_t::soundBufferIn, and cg_t::soundBufferOut.

Referenced by CG_CheckLocalSounds(), and CG_EntityEvent().

01934                                             {
01935         if ( !sfx )
01936                 return;
01937         cg.soundBuffer[cg.soundBufferIn] = sfx;
01938         cg.soundBufferIn = (cg.soundBufferIn + 1) % MAX_SOUNDBUFFER;
01939         if (cg.soundBufferIn == cg.soundBufferOut) {
01940                 cg.soundBufferOut++;
01941         }
01942 }

void CG_AddGhoul2Mark int  shader,
float  size,
vec3_t  start,
vec3_t  end,
int  entnum,
vec3_t  entposition,
float  entangle,
void *  ghoul2,
vec3_t  scale,
int  lifeTime
 

Definition at line 5738 of file cg_players.c.

References SSkinGoreData_s::angles, SSkinGoreData_s::backFaces, SSkinGoreData_s::baseModelOnly, cg, cg_ghoul2Marks, SSkinGoreData_s::currentTime, SSkinGoreData_s::entNum, flrand(), SSkinGoreData_s::frontFaces, SSkinGoreData_s::goreScaleStartFraction, SSkinGoreData_s::growDuration, SSkinGoreData_s::hitLocation, vmCvar_t::integer, SSkinGoreData_s::lifeTime, memset(), SSkinGoreData_s::position, qfalse, qtrue, SSkinGoreData_s::rayDirection, SSkinGoreData_s::scale, SSkinGoreData_s::shader, SSkinGoreData_s::SSize, SSkinGoreData, SSkinGoreData_s::theta, cg_t::time, trap_G2API_AddSkinGore(), trap_G2API_GetNumGoreMarks(), SSkinGoreData_s::TSize, vec3_t, VectorCopy, VectorNormalize(), VectorSet, VectorSubtract, and YAW.

Referenced by CG_G2MarkEvent(), and CG_SaberCompWork().

05740 {
05741         SSkinGoreData goreSkin;
05742 
05743         assert(ghoul2);
05744 
05745         memset ( &goreSkin, 0, sizeof(goreSkin) );
05746 
05747         if (trap_G2API_GetNumGoreMarks(ghoul2, 0) >= cg_ghoul2Marks.integer)
05748         { //you've got too many marks already
05749                 return;
05750         }
05751 
05752         goreSkin.growDuration = -1; // default expandy time
05753         goreSkin.goreScaleStartFraction = 1.0; // default start scale
05754         goreSkin.frontFaces = qtrue;
05755         goreSkin.backFaces = qtrue;
05756         goreSkin.lifeTime = lifeTime; //last randomly 10-20 seconds
05757         /*
05758         if (lifeTime)
05759         {
05760                 goreSkin.fadeOutTime = lifeTime*0.1; //default fade duration is relative to lifetime.
05761         }
05762         goreSkin.fadeRGB = qtrue; //fade on RGB instead of alpha (this depends on the shader really, modify if needed)
05763         */
05764         //rwwFIXMEFIXME: fade has sorting issues with other non-fading decals, disabled until fixed
05765 
05766         goreSkin.baseModelOnly = qfalse;
05767         
05768         goreSkin.currentTime = cg.time;
05769         goreSkin.entNum      = entnum;
05770         goreSkin.SSize           = size;
05771         goreSkin.TSize           = size;
05772         goreSkin.theta           = flrand(0.0f,6.28f);
05773         goreSkin.shader          = shader;
05774 
05775         if (!scale[0] && !scale[1] && !scale[2])
05776         {
05777                 VectorSet(goreSkin.scale, 1.0f, 1.0f, 1.0f);
05778         }
05779         else
05780         {
05781                 VectorCopy(goreSkin.scale, scale);
05782         }
05783 
05784         VectorCopy (start, goreSkin.hitLocation);
05785 
05786         VectorSubtract(end, start, goreSkin.rayDirection);
05787         if (VectorNormalize(goreSkin.rayDirection)<.1f)
05788         {
05789                 return;
05790         }
05791 
05792         VectorCopy ( entposition, goreSkin.position );
05793         goreSkin.angles[YAW] = entangle;
05794 
05795         trap_G2API_AddSkinGore(ghoul2, &goreSkin);
05796 }

void CG_AddLagometerFrameInfo void   ) 
 

Definition at line 4161 of file cg_draw.c.

References cg, lagometer_t::frameCount, lagometer_t::frameSamples, LAG_SAMPLES, lagometer, cg_t::latestSnapshotTime, and cg_t::time.

Referenced by CG_DrawActiveFrame().

04161                                       {
04162         int                     offset;
04163 
04164         offset = cg.time - cg.latestSnapshotTime;
04165         lagometer.frameSamples[ lagometer.frameCount & ( LAG_SAMPLES - 1) ] = offset;
04166         lagometer.frameCount++;
04167 }

void CG_AddLagometerSnapshotInfo snapshot_t snap  ) 
 

Definition at line 4179 of file cg_draw.c.

References LAG_SAMPLES, lagometer, snapshot_t::ping, snapshot_t::snapFlags, lagometer_t::snapshotCount, lagometer_t::snapshotFlags, and lagometer_t::snapshotSamples.

04179                                                      {
04180         // dropped packet
04181         if ( !snap ) {
04182                 lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = -1;
04183                 lagometer.snapshotCount++;
04184                 return;
04185         }
04186 
04187         // add this snapshot's info
04188         lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->ping;
04189         lagometer.snapshotFlags[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->snapFlags;
04190         lagometer.snapshotCount++;
04191 }

void CG_AddLocalEntities void   ) 
 

Definition at line 789 of file cg_localents.c.

References cg, cg_activeLocalEntities, CG_AddFadeRGB(), CG_AddFragment(), CG_AddLine(), CG_AddOLine(), CG_AddRefEntity(), CG_AddScorePlum(), CG_Error(), CG_FreeLocalEntity(), localEntity_s::endTime, LE_EXPLOSION, LE_FADE_RGB, LE_FADE_SCALE_MODEL, LE_FALL_SCALE_FADE, LE_FRAGMENT, LE_LINE, LE_MARK, LE_MOVE_SCALE_FADE, LE_OLINE, LE_PUFF, LE_SCALE_FADE, LE_SCOREPLUM, LE_SHOWREFENTITY, LE_SPRITE_EXPLOSION, localEntity_s::leType, localEntity_t, localEntity_s::prev, and cg_t::time.

Referenced by CG_DrawActiveFrame().

00789                                  {
00790         localEntity_t   *le, *next;
00791 
00792         // walk the list backwards, so any new local entities generated
00793         // (trails, marks, etc) will be present this frame
00794         le = cg_activeLocalEntities.prev;
00795         for ( ; le != &cg_activeLocalEntities ; le = next ) {
00796                 // grab next now, so if the local entity is freed we
00797                 // still have it
00798                 next = le->prev;
00799 
00800                 if ( cg.time >= le->endTime ) {
00801                         CG_FreeLocalEntity( le );
00802                         continue;
00803                 }
00804                 switch ( le->leType ) {
00805                 default:
00806                         CG_Error( "Bad leType: %i", le->leType );
00807                         break;
00808 
00809                 case LE_MARK:
00810                         break;
00811 
00812                 case LE_SPRITE_EXPLOSION:
00813                         CG_AddSpriteExplosion( le );
00814                         break;
00815 
00816                 case LE_EXPLOSION:
00817                         CG_AddExplosion( le );
00818                         break;
00819 
00820                 case LE_FADE_SCALE_MODEL:
00821                         CG_AddFadeScaleModel( le );
00822                         break;
00823 
00824                 case LE_FRAGMENT:                       // gibs and brass
00825                         CG_AddFragment( le );
00826                         break;
00827 
00828                 case LE_PUFF:
00829                         CG_AddPuff( le );
00830                         break;
00831 
00832                 case LE_MOVE_SCALE_FADE:                // water bubbles
00833                         CG_AddMoveScaleFade( le );
00834                         break;
00835 
00836                 case LE_FADE_RGB:                               // teleporters, railtrails
00837                         CG_AddFadeRGB( le );
00838                         break;
00839 
00840                 case LE_FALL_SCALE_FADE: // gib blood trails
00841                         CG_AddFallScaleFade( le );
00842                         break;
00843 
00844                 case LE_SCALE_FADE:             // rocket trails
00845                         CG_AddScaleFade( le );
00846                         break;
00847 
00848                 case LE_SCOREPLUM:
00849                         CG_AddScorePlum( le );
00850                         break;
00851 
00852                 case LE_OLINE:
00853                         CG_AddOLine( le );
00854                         break;
00855 
00856                 case LE_SHOWREFENTITY:
00857                         CG_AddRefEntity( le );
00858                         break;
00859 
00860                 case LE_LINE:                                   // oriented lines for FX
00861                         CG_AddLine( le );
00862                         break;
00863                 }
00864         }
00865 }

void CG_AddMarks void   ) 
 

Definition at line 221 of file cg_marks.c.

References markPoly_s::alphaFade, cg, cg_activeMarkPolys, cg_addMarks, CG_FreeMarkPoly(), markPoly_s::color, vmCvar_t::integer, MARK_FADE_TIME, MARK_TOTAL_TIME, markPoly_t, markPoly_s::markShader, polyVert_t::modulate, markPoly_s::nextMark, poly_s::numVerts, markPoly_s::poly, cg_t::time, markPoly_s::time, trap_R_AddPolyToScene(), and markPoly_s::verts.

Referenced by CG_DrawActiveFrame().

00221                          {
00222         int                     j;
00223         markPoly_t      *mp, *next;
00224         int                     t;
00225         int                     fade;
00226 
00227         if ( !cg_addMarks.integer ) {
00228                 return;
00229         }
00230 
00231         mp = cg_activeMarkPolys.nextMark;
00232         for ( ; mp != &cg_activeMarkPolys ; mp = next ) {
00233                 // grab next now, so if the local entity is freed we
00234                 // still have it
00235                 next = mp->nextMark;
00236 
00237                 // see if it is time to completely remove it
00238                 if ( cg.time > mp->time + MARK_TOTAL_TIME ) {
00239                         CG_FreeMarkPoly( mp );
00240                         continue;
00241                 }
00242 
00243                 // fade out the energy bursts
00244                 //if ( mp->markShader == cgs.media.energyMarkShader ) {
00245                 if (0) {
00246 
00247                         fade = 450 - 450 * ( (cg.time - mp->time ) / 3000.0 );
00248                         if ( fade < 255 ) {
00249                                 if ( fade < 0 ) {
00250                                         fade = 0;
00251                                 }
00252                                 if ( mp->verts[0].modulate[0] != 0 ) {
00253                                         for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00254                                                 mp->verts[j].modulate[0] = mp->color[0] * fade;
00255                                                 mp->verts[j].modulate[1] = mp->color[1] * fade;
00256                                                 mp->verts[j].modulate[2] = mp->color[2] * fade;
00257                                         }
00258                                 }
00259                         }
00260                 }
00261 
00262                 // fade all marks out with time
00263                 t = mp->time + MARK_TOTAL_TIME - cg.time;
00264                 if ( t < MARK_FADE_TIME ) {
00265                         fade = 255 * t / MARK_FADE_TIME;
00266                         if ( mp->alphaFade ) {
00267                                 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00268                                         mp->verts[j].modulate[3] = fade;
00269                                 }
00270                         }
00271                         else 
00272                         {
00273                                 float f = (float)t / MARK_FADE_TIME;
00274                                 for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00275                                         mp->verts[j].modulate[0] = mp->color[0] * f;
00276                                         mp->verts[j].modulate[1] = mp->color[1] * f;
00277                                         mp->verts[j].modulate[2] = mp->color[2] * f;
00278                                 }
00279                         }
00280                 }
00281                 else
00282                 {
00283                         for ( j = 0 ; j < mp->poly.numVerts ; j++ ) {
00284                                 mp->verts[j].modulate[0] = mp->color[0];
00285                                 mp->verts[j].modulate[1] = mp->color[1];
00286                                 mp->verts[j].modulate[2] = mp->color[2];
00287                         }
00288                 }
00289 
00290                 trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );
00291         }
00292 }

void CG_AddPacketEntities qboolean  isPortal  ) 
 

Definition at line 3412 of file cg_ents.c.

References AnglesToAxis(), cg_t::autoAngles, cg_t::autoAnglesFast, cg_t::autoAxis, cg_t::autoAxisFast, BG_PlayerStateToEntityState(), centity_s::bodyHeight, cg_t::bracketedEntityCount, centity_t, cg, CG_CheckPlayerG2Weapons(), cg_entities, cg_numpermanents, cg_permanents, playerState_s::clientNum, centity_s::currentState, centity_s::currentValid, snapshot_t::entities, ET_NPC, ET_PLAYER, entityState_s::eType, cg_t::frameInterpolation, entityState_s::isPortalEnt, entityState_s::m_iVehicleNum, playerState_s::m_iVehicleNum, cg_t::nextSnap, entityState_s::number, snapshot_t::numEntities, entityState_s::owner, playerState_t, entityState_s::pos, cg_t::predictedPlayerState, cg_t::predictedVehicleState, snapshot_t::ps, qfalse, cg_t::radarEntityCount, snapshot_t::serverTime, cg_t::snap, cg_t::time, TR_INTERPOLATE, and trajectory_t::trType.

Referenced by CG_DrawActiveFrame(), and CG_DrawSkyBoxPortal().

03412                                                {
03413         int                                     num;
03414         centity_t                       *cent;
03415         playerState_t           *ps;
03416 
03417         if (isPortal)
03418         {
03419                 for ( num = 0 ; num < cg.snap->numEntities ; num++ )
03420                 {
03421                         cent = &cg_entities[ cg.snap->entities[ num ].number ];
03422 
03423                         if (cent->currentState.isPortalEnt)
03424                         {
03425                                 CG_AddCEntity( cent );
03426                         }
03427                 }
03428                 return;
03429         }
03430 
03431         // set cg.frameInterpolation
03432         if ( cg.nextSnap ) {
03433                 int             delta;
03434 
03435                 delta = (cg.nextSnap->serverTime - cg.snap->serverTime);
03436                 if ( delta == 0 ) {
03437                         cg.frameInterpolation = 0;
03438                 } else {
03439                         cg.frameInterpolation = (float)( cg.time - cg.snap->serverTime ) / delta;
03440                 }
03441         } else {
03442                 cg.frameInterpolation = 0;      // actually, it should never be used, because 
03443                                                                         // no entities should be marked as interpolating
03444         }
03445 
03446         // the auto-rotating items will all have the same axis
03447         cg.autoAngles[0] = 0;
03448         cg.autoAngles[1] = ( cg.time & 2047 ) * 360 / 2048.0;
03449         cg.autoAngles[2] = 0;
03450 
03451         cg.autoAnglesFast[0] = 0;
03452         cg.autoAnglesFast[1] = ( cg.time & 1023 ) * 360 / 1024.0f;
03453         cg.autoAnglesFast[2] = 0;
03454 
03455         AnglesToAxis( cg.autoAngles, cg.autoAxis );
03456         AnglesToAxis( cg.autoAnglesFast, cg.autoAxisFast );
03457 
03458         // Reset radar entities
03459         cg.radarEntityCount = 0;
03460         cg.bracketedEntityCount = 0;
03461 
03462         // generate and add the entity from the playerstate
03463         ps = &cg.predictedPlayerState;
03464 
03465         CG_CheckPlayerG2Weapons(ps, &cg_entities[cg.predictedPlayerState.clientNum]);
03466         BG_PlayerStateToEntityState( ps, &cg_entities[cg.predictedPlayerState.clientNum].currentState, qfalse );
03467         
03468         if (cg.predictedPlayerState.m_iVehicleNum)
03469         { //add the vehicle I'm riding first
03470                 //BG_PlayerStateToEntityState( &cg.predictedVehicleState, &cg_entities[cg.predictedPlayerState.m_iVehicleNum].currentState, qfalse );
03471                 //cg_entities[cg.predictedPlayerState.m_iVehicleNum].currentState.eType = ET_NPC;
03472                 centity_t *veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
03473 
03474                 if (veh->currentState.owner == cg.predictedPlayerState.clientNum)
03475                 {
03476                         BG_PlayerStateToEntityState( &cg.predictedVehicleState, &veh->currentState, qfalse );
03477                         veh->currentState.eType = ET_NPC;
03478 
03479                         veh->currentState.pos.trType = TR_INTERPOLATE;
03480                 }
03481         CG_AddCEntity(veh);
03482                 veh->bodyHeight = cg.time; //indicate we have already been added
03483         }
03484 
03485         CG_AddCEntity( &cg_entities[cg.predictedPlayerState.clientNum] );
03486 
03487         /*
03488         // lerp the non-predicted value for lightning gun origins
03489         CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] );
03490         */
03491         //No longer have to do this.
03492 
03493         // add each entity sent over by the server
03494         for ( num = 0 ; num < cg.snap->numEntities ; num++ ) {
03495                 // Don't re-add ents that have been predicted.
03496                 if (cg.snap->entities[ num ].number != cg.snap->ps.clientNum)
03497                 {
03498                         cent = &cg_entities[ cg.snap->entities[ num ].number ];
03499                         if (cent->currentState.eType == ET_PLAYER &&
03500                                 cent->currentState.m_iVehicleNum)
03501                         { //add his veh first
03502                                 int j = 0;
03503 
03504                                 while (j < cg.snap->numEntities)
03505                                 {
03506                                         if (cg.snap->entities[j].number == cent->currentState.m_iVehicleNum)
03507                                         {
03508                                                 centity_t *veh = &cg_entities[cg.snap->entities[j].number];
03509 
03510                                                 CG_AddCEntity(veh);
03511                                                 veh->bodyHeight = cg.time; //indicate we have already been added
03512                                                 break;
03513                                         }
03514 
03515                                         j++;
03516                                 }
03517                         }
03518                         else if (cent->currentState.eType == ET_NPC &&
03519                                 cent->currentState.m_iVehicleNum &&
03520                                 cent->bodyHeight == cg.time)
03521                         { //never add a vehicle with a pilot, his pilot entity will get him added first.
03522                                 //if we were to add the vehicle after the pilot, the pilot's bolt would lag a frame behind.
03523                                 continue;
03524                         }
03525                         CG_AddCEntity( cent );
03526                 }
03527         }
03528 
03529         for(num=0;num<cg_numpermanents;num++)
03530         {
03531                 cent = cg_permanents[num];
03532                 if (cent->currentValid)
03533                 {
03534                         CG_AddCEntity( cent );
03535                 }
03536         }
03537 }

void CG_AddParticles void   ) 
 

Definition at line 1081 of file cg_marks.c.

References active_particles, particle_s::alpha, particle_s::alphavel, AngleVectors(), cg, CG_AddParticleToScene(), CG_ClearParticles(), cparticle_t, particle_s::endtime, free_particles, initparticles, particle_s::next, NULL, oldtime, particle_s::org, P_ANIM, P_BAT, P_BLEED, P_FLAT_SCALEUP_FADE, P_SMOKE, P_SMOKE_IMPACT, P_SPRITE, P_WEATHER_FLURRY, pvforward, pvright, pvup, cg_t::refdef, rforward, ROLL, rright, rup, cg_t::time, particle_s::time, particle_s::type, vec3_t, vectoangles(), VectorCopy, and refdef_t::viewaxis.

Referenced by CG_DrawActiveFrame().

01082 {
01083         cparticle_t             *p, *next;
01084         float                   alpha;
01085         float                   time, time2;
01086         vec3_t                  org;
01087         int                             color;
01088         cparticle_t             *active, *tail;
01089         int                             type;
01090         vec3_t                  rotate_ang;
01091 
01092         if (!initparticles)
01093                 CG_ClearParticles ();
01094 
01095         VectorCopy( cg.refdef.viewaxis[0], pvforward );
01096         VectorCopy( cg.refdef.viewaxis[1], pvright );
01097         VectorCopy( cg.refdef.viewaxis[2], pvup );
01098 
01099         vectoangles( cg.refdef.viewaxis[0], rotate_ang );
01100         roll += ((cg.time - oldtime) * 0.1) ;
01101         rotate_ang[ROLL] += (roll*0.9);
01102         AngleVectors ( rotate_ang, rforward, rright, rup);
01103         
01104         oldtime = cg.time;
01105 
01106         active = NULL;
01107         tail = NULL;
01108 
01109         for (p=active_particles ; p ; p=next)
01110         {
01111 
01112                 next = p->next;
01113 
01114                 time = (cg.time - p->time)*0.001;
01115 
01116                 alpha = p->alpha + time*p->alphavel;
01117                 if (alpha <= 0)
01118                 {       // faded out
01119                         p->next = free_particles;
01120                         free_particles = p;
01121                         p->type = 0;
01122                         p->color = 0;
01123                         p->alpha = 0;
01124                         continue;
01125                 }
01126 
01127                 if (p->type == P_SMOKE || p->type == P_ANIM || p->type == P_BLEED || p->type == P_SMOKE_IMPACT)
01128                 {
01129                         if (cg.time > p->endtime)
01130                         {
01131                                 p->next = free_particles;
01132                                 free_particles = p;
01133                                 p->type = 0;
01134                                 p->color = 0;
01135                                 p->alpha = 0;
01136                         
01137                                 continue;
01138                         }
01139 
01140                 }
01141 
01142                 if (p->type == P_WEATHER_FLURRY)
01143                 {
01144                         if (cg.time > p->endtime)
01145                         {
01146                                 p->next = free_particles;
01147                                 free_particles = p;
01148                                 p->type = 0;
01149                                 p->color = 0;
01150                                 p->alpha = 0;
01151                         
01152                                 continue;
01153                         }
01154                 }
01155 
01156 
01157                 if (p->type == P_FLAT_SCALEUP_FADE)
01158                 {
01159                         if (cg.time > p->endtime)
01160                         {
01161                                 p->next = free_particles;
01162                                 free_particles = p;
01163                                 p->type = 0;
01164                                 p->color = 0;
01165                                 p->alpha = 0;
01166                                 continue;
01167                         }
01168 
01169                 }
01170 
01171                 if ((p->type == P_BAT || p->type == P_SPRITE) && p->endtime < 0) {
01172                         // temporary sprite
01173                         CG_AddParticleToScene (p, p->org, alpha);
01174                         p->next = free_particles;
01175                         free_particles = p;
01176                         p->type = 0;
01177                         p->color = 0;
01178                         p->alpha = 0;
01179                         continue;
01180                 }
01181 
01182                 p->next = NULL;
01183                 if (!tail)
01184                         active = tail = p;
01185                 else
01186                 {
01187                         tail->next = p;
01188                         tail = p;
01189                 }
01190 
01191                 if (alpha > 1.0)
01192                         alpha = 1;
01193 
01194                 color = p->color;
01195 
01196                 time2 = time*time;
01197 
01198                 org[0] = p->org[0] + p->vel[0]*time + p->accel[0]*time2;
01199                 org[1] = p->org[1] + p->vel[1]*time + p->accel[1]*time2;
01200                 org[2] = p->org[2] + p->vel[2]*time + p->accel[2]*time2;
01201 
01202                 type = p->type;
01203 
01204                 CG_AddParticleToScene (p, org, alpha);
01205         }
01206 
01207         active_particles = active;
01208 }

void CG_AddParticleShrapnel localEntity_t le  ) 
 

Definition at line 1550 of file cg_marks.c.

References localEntity_t.

01551 {
01552         return;
01553 }

void CG_AddPlayerWeapon refEntity_t parent,
playerState_t ps,
centity_t cent,
int  team,
vec3_t  newAngles,
qboolean  thirdPerson
 

Definition at line 404 of file cg_weapons.c.

References addspriteArgStruct_s::accel, addspriteArgStruct_t, weaponInfo_s::altMuzzleEffect, AnglesToAxis(), refEntity_t::axis, weaponInfo_s::barrelModel, addspriteArgStruct_s::bounce, cgMedia_t::bryarFrontFlash, centity_t, cg, cg_entities, CG_IsMindTricked(), CG_PositionEntityOnTag(), CG_PositionRotatedEntityOnTag(), CG_RegisterWeapon(), cg_weapons, CGCam_Shake(), cgs, playerState_s::clientNum, entityState_s::clientNum, entityState_s::constantLight, centity_s::currentState, addspriteArgStruct_s::dscale, addspriteArgStruct_s::eAlpha, EF_ALT_FIRING, EF_FIRING, entityState_s::eFlags, weaponInfo_s::firingSound, addspriteArgStruct_s::flags, weaponInfo_s::flashDlightColor, cgs_t::gameModels, centity_s::ghoul2, cgMedia_t::greenFrontFlash, weaponInfo_s::handsModel, refEntity_t::hModel, cg_t::lastFPFlashPoint, centity_s::lerpOrigin, addspriteArgStruct_s::life, refEntity_t::lightingOrigin, playerEntity_t::lightningFiring, cgMedia_t::lightningFlash, cgs_t::media, memset(), entityState_s::modelindex2, centity_s::modelScale, MUZZLE_FLASH_TIME, weaponInfo_s::muzzleEffect, centity_s::muzzleFlashTime, entityState_s::number, refEntity_t::origin, ORIGIN, addspriteArgStruct_s::origin, centity_s::pe, PITCH, playerState_t, PM_SPECTATOR, playerState_s::pm_type, POSITIVE_X, entityState_s::powerups, cg_t::predictedPlayerState, snapshot_t::ps, qfalse, qtrue, rand(), random, weaponInfo_s::readySound, refEntity_t::renderfx, cg_t::renderingThirdPerson, ROLL, addspriteArgStruct_s::rotation, addspriteArgStruct_s::sAlpha, addspriteArgStruct_s::scale, addspriteArgStruct_s::shader, refEntity_t::shadowPlane, cg_t::snap, cg_t::time, trap_FX_AddSprite(), trap_FX_PlayEffectID(), trap_FX_PlayEntityEffectID(), trap_G2API_GetBoltMatrix(), trap_G2API_HasGhoul2ModelOnIndex(), trap_R_AddLightToScene(), trap_R_RegisterModel(), trap_S_AddLoopingSound(), entityState_s::trickedentindex, entityState_s::trickedentindex2, entityState_s::trickedentindex3, entityState_s::trickedentindex4, vec3_origin, vec3_t, VectorClear, VectorCopy, addspriteArgStruct_s::vel, weaponInfo_s::viewModel, entityState_s::weapon, WEAPON_CHARGING, WEAPON_CHARGING_ALT, weapon_t, weaponInfo_t, weaponInfo_s::weaponModel, WP_BOWCASTER, WP_BRYAR_OLD, WP_BRYAR_PISTOL, WP_DEMP2, WP_EMPLACED_GUN, WP_STUN_BATON, and YAW.

Referenced by CG_AddViewWeapon(), and CG_Player().

00404                                                                                                                                      {
00405         refEntity_t     gun;
00406         refEntity_t     barrel;
00407         vec3_t          angles;
00408         weapon_t        weaponNum;
00409         weaponInfo_t    *weapon;
00410         centity_t       *nonPredictedCent;
00411         refEntity_t     flash;
00412 
00413         weaponNum = cent->currentState.weapon;
00414 
00415         if (cent->currentState.weapon == WP_EMPLACED_GUN)
00416         {
00417                 return;
00418         }
00419 
00420         if (cg.predictedPlayerState.pm_type == PM_SPECTATOR &&
00421                 cent->currentState.number == cg.predictedPlayerState.clientNum)
00422         { //spectator mode, don't draw it...
00423                 return;
00424         }
00425 
00426         CG_RegisterWeapon( weaponNum );
00427         weapon = &cg_weapons[weaponNum];
00428 /*
00429 Ghoul2 Insert Start
00430 */
00431 
00432         memset( &gun, 0, sizeof( gun ) );
00433 
00434         // only do this if we are in first person, since world weapons are now handled on the server by Ghoul2
00435         if (!thirdPerson)
00436         {
00437 
00438                 // add the weapon
00439                 VectorCopy( parent->lightingOrigin, gun.lightingOrigin );
00440                 gun.shadowPlane = parent->shadowPlane;
00441                 gun.renderfx = parent->renderfx;
00442 
00443                 if (ps)
00444                 {       // this player, in first person view
00445                         gun.hModel = weapon->viewModel;
00446                 }
00447                 else
00448                 {
00449                         gun.hModel = weapon->weaponModel;
00450                 }
00451                 if (!gun.hModel) {
00452                         return;
00453                 }
00454 
00455                 if ( !ps ) {
00456                         // add weapon ready sound
00457                         cent->pe.lightningFiring = qfalse;
00458                         if ( ( cent->currentState.eFlags & EF_FIRING ) && weapon->firingSound ) {
00459                                 // lightning gun and guantlet make a different sound when fire is held down
00460                                 trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->firingSound );
00461                                 cent->pe.lightningFiring = qtrue;
00462                         } else if ( weapon->readySound ) {
00463                                 trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->readySound );
00464                         }
00465                 }
00466         
00467                 CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon");
00468 
00469                 if (!CG_IsMindTricked(cent->currentState.trickedentindex,
00470                         cent->currentState.trickedentindex2,
00471                         cent->currentState.trickedentindex3,
00472                         cent->currentState.trickedentindex4,
00473                         cg.snap->ps.clientNum))
00474                 {
00475                         CG_AddWeaponWithPowerups( &gun, cent->currentState.powerups ); //don't draw the weapon if the player is invisible
00476                         /*
00477                         if ( weaponNum == WP_STUN_BATON )
00478                         {
00479                                 gun.shaderRGBA[0] = gun.shaderRGBA[1] = gun.shaderRGBA[2] = 25;
00480         
00481                                 gun.customShader = trap_R_RegisterShader( "gfx/effects/stunPass" );
00482                                 gun.renderfx = RF_RGB_TINT | RF_FIRST_PERSON | RF_DEPTHHACK;
00483                                 trap_R_AddRefEntityToScene( &gun );
00484                         }
00485                         */
00486                 }
00487 
00488                 if (weaponNum == WP_STUN_BATON)
00489                 {
00490                         int i = 0;
00491 
00492                         while (i < 3)
00493                         {
00494                                 memset( &barrel, 0, sizeof( barrel ) );
00495                                 VectorCopy( parent->lightingOrigin, barrel.lightingOrigin );
00496                                 barrel.shadowPlane = parent->shadowPlane;
00497                                 barrel.renderfx = parent->renderfx;
00498 
00499                                 if (i == 0)
00500                                 {
00501                                         barrel.hModel = trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel.md3");
00502                                 }
00503                                 else if (i == 1)
00504                                 {
00505                                         barrel.hModel = trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel2.md3");
00506                                 }
00507                                 else
00508                                 {
00509                                         barrel.hModel = trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel3.md3");
00510                                 }
00511                                 angles[YAW] = 0;
00512                                 angles[PITCH] = 0;
00513                                 angles[ROLL] = 0;
00514 
00515                                 AnglesToAxis( angles, barrel.axis );
00516 
00517                                 if (i == 0)
00518                                 {
00519                                         CG_PositionRotatedEntityOnTag( &barrel, parent/*&gun*/, /*weapon->weaponModel*/weapon->handsModel, "tag_barrel" );
00520                                 }
00521                                 else if (i == 1)
00522                                 {
00523                                         CG_PositionRotatedEntityOnTag( &barrel, parent/*&gun*/, /*weapon->weaponModel*/weapon->handsModel, "tag_barrel2" );
00524                                 }
00525                                 else
00526                                 {
00527                                         CG_PositionRotatedEntityOnTag( &barrel, parent/*&gun*/, /*weapon->weaponModel*/weapon->handsModel, "tag_barrel3" );
00528                                 }
00529                                 CG_AddWeaponWithPowerups( &barrel, cent->currentState.powerups );
00530 
00531                                 i++;
00532                         }
00533                 }
00534                 else
00535                 {
00536                         // add the spinning barrel
00537                         if ( weapon->barrelModel ) {
00538                                 memset( &barrel, 0, sizeof( barrel ) );
00539                                 VectorCopy( parent->lightingOrigin, barrel.lightingOrigin );
00540                                 barrel.shadowPlane = parent->shadowPlane;
00541                                 barrel.renderfx = parent->renderfx;
00542 
00543                                 barrel.hModel = weapon->barrelModel;
00544                                 angles[YAW] = 0;
00545                                 angles[PITCH] = 0;
00546                                 angles[ROLL] = 0;
00547 
00548                                 AnglesToAxis( angles, barrel.axis );
00549 
00550                                 CG_PositionRotatedEntityOnTag( &barrel, parent/*&gun*/, /*weapon->weaponModel*/weapon->handsModel, "tag_barrel" );
00551 
00552                                 CG_AddWeaponWithPowerups( &barrel, cent->currentState.powerups );
00553                         }
00554                 }
00555         }
00556 /*
00557 Ghoul2 Insert End
00558 */
00559 
00560         memset (&flash, 0, sizeof(flash));
00561         CG_PositionEntityOnTag( &flash, &gun, gun.hModel, "tag_flash");
00562 
00563         VectorCopy(flash.origin, cg.lastFPFlashPoint);
00564 
00565         // Do special charge bits
00566         //-----------------------
00567         if ( (ps || cg.renderingThirdPerson || cg.predictedPlayerState.clientNum != cent->currentState.number) &&
00568                 ( ( cent->currentState.modelindex2 == WEAPON_CHARGING_ALT && cent->currentState.weapon == WP_BRYAR_PISTOL ) ||
00569                   ( cent->currentState.modelindex2 == WEAPON_CHARGING_ALT && cent->currentState.weapon == WP_BRYAR_OLD ) ||
00570                   ( cent->currentState.weapon == WP_BOWCASTER && cent->currentState.modelindex2 == WEAPON_CHARGING ) ||
00571                   ( cent->currentState.weapon == WP_DEMP2 && cent->currentState.modelindex2 == WEAPON_CHARGING_ALT) ) )
00572         {
00573                 int             shader = 0;
00574                 float   val = 0.0f;
00575                 float   scale = 1.0f;
00576                 addspriteArgStruct_t fxSArgs;
00577                 vec3_t flashorigin, flashdir;
00578 
00579                 if (!thirdPerson)
00580                 {
00581                         VectorCopy(flash.origin, flashorigin);
00582                         VectorCopy(flash.axis[0], flashdir);
00583                 }
00584                 else
00585                 {
00586                         mdxaBone_t              boltMatrix;
00587 
00588                         if (!trap_G2API_HasGhoul2ModelOnIndex(&(cent->ghoul2), 1))
00589                         { //it's quite possible that we may have have no weapon model and be in a valid state, so return here if this is the case
00590                                 return;
00591                         }
00592 
00593                         // go away and get me the bolt position for this frame please
00594                         if (!(trap_G2API_GetBoltMatrix(cent->ghoul2, 1, 0, &boltMatrix, newAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale)))
00595                         {       // Couldn't find bolt point.
00596                                 return;
00597                         }
00598                         
00599                         BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, flashorigin);
00600                         BG_GiveMeVectorFromMatrix(&boltMatrix, POSITIVE_X, flashdir);
00601                 }
00602 
00603                 if ( cent->currentState.weapon == WP_BRYAR_PISTOL ||
00604                         cent->currentState.weapon == WP_BRYAR_OLD)
00605                 {
00606                         // Hardcoded max charge time of 1 second
00607                         val = ( cg.time - cent->currentState.constantLight ) * 0.001f;
00608                         shader = cgs.media.bryarFrontFlash;
00609                 }
00610                 else if ( cent->currentState.weapon == WP_BOWCASTER )
00611                 {
00612                         // Hardcoded max charge time of 1 second
00613                         val = ( cg.time - cent->currentState.constantLight ) * 0.001f;
00614                         shader = cgs.media.greenFrontFlash;
00615                 }
00616                 else if ( cent->currentState.weapon == WP_DEMP2 )
00617                 {
00618                         val = ( cg.time - cent->currentState.constantLight ) * 0.001f;
00619                         shader = cgs.media.lightningFlash;
00620                         scale = 1.75f;
00621                 }
00622 
00623                 if ( val < 0.0f )
00624                 {
00625                         val = 0.0f;
00626                 }
00627                 else if ( val > 1.0f )
00628                 {
00629                         val = 1.0f;
00630                         if (ps && cent->currentState.number == ps->clientNum)
00631                         {
00632                                 CGCam_Shake( /*0.1f*/0.2f, 100 );
00633                         }
00634                 }
00635                 else
00636                 {
00637                         if (ps && cent->currentState.number == ps->clientNum)
00638                         {
00639                                 CGCam_Shake( val * val * /*0.3f*/0.6f, 100 );
00640                         }
00641                 }
00642 
00643                 val += random() * 0.5f;
00644 
00645                 VectorCopy(flashorigin, fxSArgs.origin);
00646                 VectorClear(fxSArgs.vel);
00647                 VectorClear(fxSArgs.accel);
00648                 fxSArgs.scale = 3.0f*val*scale;
00649                 fxSArgs.dscale = 0.0f;
00650                 fxSArgs.sAlpha = 0.7f;
00651                 fxSArgs.eAlpha = 0.7f;
00652                 fxSArgs.rotation = random()*360;
00653                 fxSArgs.bounce = 0.0f;
00654                 fxSArgs.life = 1.0f;
00655                 fxSArgs.shader = shader;
00656                 fxSArgs.flags = 0x08000000;
00657 
00658                 //FX_AddSprite( flash.origin, NULL, NULL, 3.0f * val, 0.0f, 0.7f, 0.7f, WHITE, WHITE, random() * 360, 0.0f, 1.0f, shader, FX_USE_ALPHA );
00659                 trap_FX_AddSprite(&fxSArgs);
00660         }
00661 
00662         // make sure we aren't looking at cg.predictedPlayerEntity for LG
00663         nonPredictedCent = &cg_entities[cent->currentState.clientNum];
00664 
00665         // if the index of the nonPredictedCent is not the same as the clientNum
00666         // then this is a fake player (like on teh single player podiums), so
00667         // go ahead and use the cent
00668         if( ( nonPredictedCent - cg_entities ) != cent->currentState.clientNum ) {
00669                 nonPredictedCent = cent;
00670         }
00671 
00672         // add the flash
00673         if ( ( weaponNum == WP_DEMP2)
00674                 && ( nonPredictedCent->currentState.eFlags & EF_FIRING ) ) 
00675         {
00676                 // continuous flash
00677         } else {
00678                 // impulse flash
00679                 if ( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME) {
00680                         return;
00681                 }
00682         }
00683 
00684         if ( ps || cg.renderingThirdPerson ||
00685                         cent->currentState.number != cg.predictedPlayerState.clientNum ) 
00686         {       // Make sure we don't do the thirdperson model effects for the local player if we're in first person
00687                 vec3_t flashorigin, flashdir;
00688                 refEntity_t     flash;
00689 
00690                 memset (&flash, 0, sizeof(flash));
00691 
00692                 if (!thirdPerson)
00693                 {
00694                         CG_PositionEntityOnTag( &flash, &gun, gun.hModel, "tag_flash");
00695                         VectorCopy(flash.origin, flashorigin);
00696                         VectorCopy(flash.axis[0], flashdir);
00697                 }
00698                 else
00699                 {
00700                         mdxaBone_t              boltMatrix;
00701 
00702                         if (!trap_G2API_HasGhoul2ModelOnIndex(&(cent->ghoul2), 1))
00703                         { //it's quite possible that we may have have no weapon model and be in a valid state, so return here if this is the case
00704                                 return;
00705                         }
00706 
00707                         // go away and get me the bolt position for this frame please
00708                         if (!(trap_G2API_GetBoltMatrix(cent->ghoul2, 1, 0, &boltMatrix, newAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale)))
00709                         {       // Couldn't find bolt point.
00710                                 return;
00711                         }
00712                         
00713                         BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, flashorigin);
00714                         BG_GiveMeVectorFromMatrix(&boltMatrix, POSITIVE_X, flashdir);
00715                 }
00716 
00717                 if ( cg.time - cent->muzzleFlashTime <= MUZZLE_FLASH_TIME + 10 )
00718                 {       // Handle muzzle flashes
00719                         if ( cent->currentState.eFlags & EF_ALT_FIRING )
00720                         {       // Check the alt firing first.
00721                                 if (weapon->altMuzzleEffect)
00722                                 {
00723                                         if (!thirdPerson)
00724                                         {
00725                                                 trap_FX_PlayEntityEffectID(weapon->altMuzzleEffect, flashorigin, flash.axis, -1, -1, -1, -1  );
00726                                         }
00727                                         else
00728                                         {
00729                                                 trap_FX_PlayEffectID(weapon->altMuzzleEffect, flashorigin, flashdir, -1, -1);
00730                                         }
00731                                 }
00732                         }
00733                         else
00734                         {       // Regular firing
00735                                 if (weapon->muzzleEffect)
00736                                 {
00737                                         if (!thirdPerson)
00738                                         {
00739                                                 trap_FX_PlayEntityEffectID(weapon->muzzleEffect, flashorigin, flash.axis, -1, -1, -1, -1  );
00740                                         }
00741                                         else
00742                                         {
00743                                                 trap_FX_PlayEffectID(weapon->muzzleEffect, flashorigin, flashdir, -1, -1);
00744                                         }
00745                                 }
00746                         }
00747                 }
00748 
00749                 // add lightning bolt
00750                 CG_LightningBolt( nonPredictedCent, flashorigin );
00751 
00752                 if ( weapon->flashDlightColor[0] || weapon->flashDlightColor[1] || weapon->flashDlightColor[2] ) {
00753                         trap_R_AddLightToScene( flashorigin, 300 + (rand()&31), weapon->flashDlightColor[0],
00754                                 weapon->flashDlightColor[1], weapon->flashDlightColor[2] );
00755                 }
00756         }
00757 }

void CG_AddRefEntityWithPowerups refEntity_t ent,
entityState_t state,
int  team
 

Definition at line 5059 of file cg_players.c.

References cg, CG_IsMindTricked(), playerState_s::clientNum, entityState_t, snapshot_t::ps, cg_t::snap, trap_R_AddRefEntityToScene(), entityState_s::trickedentindex, entityState_s::trickedentindex2, entityState_s::trickedentindex3, and entityState_s::trickedentindex4.

05059                                                                                      {
05060 
05061         if (CG_IsMindTricked(state->trickedentindex,
05062                 state->trickedentindex2,
05063                 state->trickedentindex3,
05064                 state->trickedentindex4,
05065                 cg.snap->ps.clientNum))
05066         {
05067                 return; //this entity is mind-tricking the current client, so don't render it
05068         }
05069 
05070         trap_R_AddRefEntityToScene( ent );
05071 }

void CG_AddViewWeapon playerState_t ps  ) 
 

Definition at line 766 of file cg_weapons.c.

References AnglesToAxis(), refEntity_t::axis, refEntity_t::backlerp, lerpFrame_t::backlerp, centity_t, cg, CG_AddPlayerWeapon(), cg_drawGun, cg_entities, cg_fov, cg_gun_frame, cg_gun_x, cg_gun_y, cg_gun_z, CG_RegisterWeapon(), cg_weapons, cgs, cgs_t::clientinfo, playerState_s::clientNum, entityState_s::clientNum, centity_s::currentState, EF_FIRING, playerState_s::eFlags, ET_NPC, entityState_s::eType, refEntity_t::frame, lerpFrame_t::frame, weaponInfo_s::handsModel, refEntity_t::hModel, vmCvar_t::integer, memset(), centity_s::npcClient, refEntity_t::oldframe, lerpFrame_t::oldFrame, refEntity_t::origin, centity_s::pe, PERS_TEAM, playerState_s::persistant, playerState_t, PM_INTERMISSION, playerState_s::pm_type, cg_t::predictedPlayerState, qfalse, cg_t::refdef, refEntity_t::renderfx, cg_t::renderingThirdPerson, RF_DEPTHHACK, RF_FIRST_PERSON, TEAM_SPECTATOR, cg_t::testGun, playerEntity_t::torso, entityState_s::torsoAnim, vmCvar_t::value, vec3_t, VectorCopy, VectorMA, refdef_t::viewaxis, refdef_t::vieworg, playerState_s::weapon, weaponInfo_t, and playerState_s::zoomMode.

Referenced by CG_DrawActiveFrame().

00766                                            {
00767         refEntity_t     hand;
00768         centity_t       *cent;
00769         clientInfo_t    *ci;
00770         float           fovOffset;
00771         vec3_t          angles;
00772         weaponInfo_t    *weapon;
00773         float   cgFov = cg_fov.value;
00774 
00775         if (cgFov < 1)
00776         {
00777                 cgFov = 1;
00778         }
00779         if (cgFov > 97)
00780         {
00781                 cgFov = 97;
00782         }
00783 
00784         if ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
00785                 return;
00786         }
00787 
00788         if ( ps->pm_type == PM_INTERMISSION ) {
00789                 return;
00790         }
00791 
00792         // no gun if in third person view or a camera is active
00793         //if ( cg.renderingThirdPerson || cg.cameraMode) {
00794         if ( cg.renderingThirdPerson ) {
00795                 return;
00796         }
00797 
00798         // allow the gun to be completely removed
00799         if ( !cg_drawGun.integer || cg.predictedPlayerState.zoomMode) {
00800                 vec3_t          origin;
00801 
00802                 if ( cg.predictedPlayerState.eFlags & EF_FIRING ) {
00803                         // special hack for lightning gun...
00804                         VectorCopy( cg.refdef.vieworg, origin );
00805                         VectorMA( origin, -8, cg.refdef.viewaxis[2], origin );
00806                         CG_LightningBolt( &cg_entities[ps->clientNum], origin );
00807                 }
00808                 return;
00809         }
00810 
00811         // don't draw if testing a gun model
00812         if ( cg.testGun ) {
00813                 return;
00814         }
00815 
00816         // drop gun lower at higher fov
00817         if ( cgFov > 90 ) {
00818                 fovOffset = -0.2 * ( cgFov - 90 );
00819         } else {
00820                 fovOffset = 0;
00821         }
00822 
00823         cent = &cg_entities[cg.predictedPlayerState.clientNum];
00824         CG_RegisterWeapon( ps->weapon );
00825         weapon = &cg_weapons[ ps->weapon ];
00826 
00827         memset (&hand, 0, sizeof(hand));
00828 
00829         // set up gun position
00830         CG_CalculateWeaponPosition( hand.origin, angles );
00831 
00832         VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[0], hand.origin );
00833         VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[1], hand.origin );
00834         VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );
00835 
00836         AnglesToAxis( angles, hand.axis );
00837 
00838         // map torso animations to weapon animations
00839         if ( cg_gun_frame.integer ) {
00840                 // development tool
00841                 hand.frame = hand.oldframe = cg_gun_frame.integer;
00842                 hand.backlerp = 0;
00843         } else {
00844                 // get clientinfo for animation map
00845                 if (cent->currentState.eType == ET_NPC)
00846                 {
00847                         if (!cent->npcClient)
00848                         {
00849                                 return;
00850                         }
00851 
00852                         ci = cent->npcClient;
00853                 }
00854                 else
00855                 {
00856                         ci = &cgs.clientinfo[ cent->currentState.clientNum ];
00857                 }
00858                 hand.frame = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.frame, cent->currentState.torsoAnim );
00859                 hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame, cent->currentState.torsoAnim );
00860                 hand.backlerp = cent->pe.torso.backlerp;
00861 
00862                 // Handle the fringe situation where oldframe is invalid
00863                 if ( hand.frame == -1 )
00864                 {
00865                         hand.frame = 0;
00866                         hand.oldframe = 0;
00867                         hand.backlerp = 0;
00868                 }
00869                 else if ( hand.oldframe == -1 )
00870                 {
00871                         hand.oldframe = hand.frame;
00872                         hand.backlerp = 0;
00873                 }
00874         }
00875 
00876         hand.hModel = weapon->handsModel;
00877         hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON;// | RF_MINLIGHT;
00878 
00879         // add everything onto the hand
00880         CG_AddPlayerWeapon( &hand, ps, &cg_entities[cg.predictedPlayerState.clientNum], ps->persistant[PERS_TEAM], angles, qfalse );
00881 }

void CG_AdjustPositionForMover const vec3_t  in,
int  moverNum,
int  fromTime,
int  toTime,
vec3_t  out
 

Definition at line 2994 of file cg_ents.c.

References entityState_s::apos, BG_EvaluateTrajectory(), centity_t, cg_entities, centity_s::currentState, ENTITYNUM_MAX_NORMAL, ET_MOVER, entityState_s::eType, entityState_s::pos, vec3_t, VectorAdd, VectorCopy, and VectorSubtract.

Referenced by CG_CalcEntityLerpPositions(), and CG_PredictPlayerState().

02994                                                                                                       {
02995         centity_t       *cent;
02996         vec3_t  oldOrigin, origin, deltaOrigin;
02997         vec3_t  oldAngles, angles, deltaAngles;
02998 
02999         if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) {
03000                 VectorCopy( in, out );
03001                 return;
03002         }
03003 
03004         cent = &cg_entities[ moverNum ];
03005         if ( cent->currentState.eType != ET_MOVER ) {
03006                 VectorCopy( in, out );
03007                 return;
03008         }
03009 
03010         BG_EvaluateTrajectory( &cent->currentState.pos, fromTime, oldOrigin );
03011         BG_EvaluateTrajectory( &cent->currentState.apos, fromTime, oldAngles );
03012 
03013         BG_EvaluateTrajectory( &cent->currentState.pos, toTime, origin );
03014         BG_EvaluateTrajectory( &cent->currentState.apos, toTime, angles );
03015 
03016         VectorSubtract( origin, oldOrigin, deltaOrigin );
03017         VectorSubtract( angles, oldAngles, deltaAngles );
03018 
03019         VectorAdd( in, deltaOrigin, out );
03020 
03021         // FIXME: origin change when on a rotating object
03022 }

localEntity_t* CG_AllocLocalEntity void   ) 
 

Definition at line 60 of file cg_localents.c.

References cg_activeLocalEntities, cg_freeLocalEntities, CG_FreeLocalEntity(), localEntity_t, memset(), localEntity_s::next, and localEntity_s::prev.

Referenced by CG_Bleed(), CG_BubbleTrail(), CG_Chunks(), CG_LaunchGib(), CG_MakeExplosion(), CG_ScorePlum(), CG_SmokePuff(), CG_TestLine(), CG_ThrowChunk(), FX_AddOrientedLine(), and FX_DEMP2_AltDetonate().

00060                                              {
00061         localEntity_t   *le;
00062 
00063         if ( !cg_freeLocalEntities ) {
00064                 // no free entities, so free the one at the end of the chain
00065                 // remove the oldest active entity
00066                 CG_FreeLocalEntity( cg_activeLocalEntities.prev );
00067         }
00068 
00069         le = cg_freeLocalEntities;
00070         cg_freeLocalEntities = cg_freeLocalEntities->next;
00071 
00072         memset( le, 0, sizeof( *le ) );
00073 
00074         // link into the active list
00075         le->next = cg_activeLocalEntities.next;
00076         le->prev = &cg_activeLocalEntities;
00077         cg_activeLocalEntities.next->prev = le;
00078         cg_activeLocalEntities.next = le;
00079         return le;
00080 }

const char* CG_Argv int  arg  ) 
 

Definition at line 1263 of file cg_main.c.

References MAX_STRING_CHARS, and trap_Argv().

Referenced by CG_ConsoleCommand(), CG_ParseSiegeExtendedData(), CG_TestModel_f(), CG_Weapon_f(), and CG_WeaponClean_f().

01263                                {
01264         static char     buffer[MAX_STRING_CHARS];
01265 
01266         trap_Argv( arg, buffer, sizeof( buffer ) );
01267 
01268         return buffer;
01269 }

void CG_Beam centity_t cent  ) 
 

Definition at line 2921 of file cg_ents.c.

References refEntity_t::axis, AxisClear(), centity_t, CG_SetGhoul2Info(), centity_s::currentState, entityState_t, memset(), refEntity_t::oldorigin, refEntity_t::origin, entityState_s::origin2, entityState_s::pos, refEntity_t::renderfx, refEntity_t::reType, RF_NOSHADOW, RT_BEAM, trap_R_AddRefEntityToScene(), trajectory_t::trBase, and VectorCopy.

Referenced by CG_EntityEvent().

02921                                 {
02922         refEntity_t                     ent;
02923         entityState_t           *s1;
02924 
02925         s1 = &cent->currentState;
02926 
02927         // create the render entity
02928         memset (&ent, 0, sizeof(ent));
02929         VectorCopy( s1->pos.trBase, ent.origin );
02930         VectorCopy( s1->origin2, ent.oldorigin );
02931         AxisClear( ent.axis );
02932         ent.reType = RT_BEAM;
02933 
02934         ent.renderfx = RF_NOSHADOW;
02935 /*
02936 Ghoul2 Insert Start
02937 */
02938         CG_SetGhoul2Info(&ent, cent);  
02939 
02940 /*
02941 Ghoul2 Insert End
02942 */
02943         // add to refresh list
02944         trap_R_AddRefEntityToScene(&ent);
02945 }

void CG_Bleed vec3_t  origin,
int  entityNum
 

Definition at line 1489 of file cg_effects.c.

References cg, CG_AllocLocalEntity(), cg_blood, playerState_s::clientNum, refEntity_t::customShader, localEntity_s::endTime, vmCvar_t::integer, LE_EXPLOSION, localEntity_s::leType, localEntity_t, refEntity_t::origin, snapshot_t::ps, refEntity_t::radius, rand(), localEntity_s::refEntity, refEntity_t::renderfx, refEntity_t::reType, RF_THIRD_PERSON, refEntity_t::rotation, RT_SPRITE, cg_t::snap, localEntity_s::startTime, cg_t::time, vec3_t, and VectorCopy.

01489                                               {
01490         localEntity_t   *ex;
01491 
01492         if ( !cg_blood.integer ) {
01493                 return;
01494         }
01495 
01496         ex = CG_AllocLocalEntity();
01497         ex->leType = LE_EXPLOSION;
01498 
01499         ex->startTime = cg.time;
01500         ex->endTime = ex->startTime + 500;
01501         
01502         VectorCopy ( origin, ex->refEntity.origin);
01503         ex->refEntity.reType = RT_SPRITE;
01504         ex->refEntity.rotation = rand() % 360;
01505         ex->refEntity.radius = 24;
01506 
01507         ex->refEntity.customShader = 0;//cgs.media.bloodExplosionShader;
01508 
01509         // don't show player's own blood in view
01510         if ( entityNum == cg.snap->ps.clientNum ) {
01511                 ex->refEntity.renderfx |= RF_THIRD_PERSON;
01512         }
01513 }

void CG_BubbleTrail vec3_t  start,
vec3_t  end,
float  spacing
 

Definition at line 15 of file cg_effects.c.

References cg, CG_AllocLocalEntity(), cg_noProjectileTrail, localEntity_s::color, crandom, refEntity_t::customShader, localEntity_s::endTime, vmCvar_t::integer, LE_MOVE_SCALE_FADE, LEF_PUFF_DONT_SCALE, localEntity_s::leFlags, localEntity_s::leType, localEntity_s::lifeRate, localEntity_t, localEntity_s::pos, refEntity_t::radius, rand(), random, localEntity_s::refEntity, refEntity_t::reType, refEntity_t::rotation, RT_SPRITE, refEntity_t::shaderRGBA, refEntity_t::shaderTime, localEntity_s::startTime, cg_t::time, TR_LINEAR, trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trTime, trajectory_t::trType, vec3_t, VectorAdd, VectorCopy, VectorMA, VectorNormalize(), VectorScale, and VectorSubtract.

00015                                                                {
00016         vec3_t          move;
00017         vec3_t          vec;
00018         float           len;
00019         int                     i;
00020 
00021         if ( cg_noProjectileTrail.integer ) {
00022                 return;
00023         }
00024 
00025         VectorCopy (start, move);
00026         VectorSubtract (end, start, vec);
00027         len = VectorNormalize (vec);
00028 
00029         // advance a random amount first
00030         i = rand() % (int)spacing;
00031         VectorMA( move, i, vec, move );
00032 
00033         VectorScale (vec, spacing, vec);
00034 
00035         for ( ; i < len; i += spacing ) {
00036                 localEntity_t   *le;
00037                 refEntity_t             *re;
00038 
00039                 le = CG_AllocLocalEntity();
00040                 le->leFlags = LEF_PUFF_DONT_SCALE;
00041                 le->leType = LE_MOVE_SCALE_FADE;
00042                 le->startTime = cg.time;
00043                 le->endTime = cg.time + 1000 + random() * 250;
00044                 le->lifeRate = 1.0 / ( le->endTime - le->startTime );
00045 
00046                 re = &le->refEntity;
00047                 re->shaderTime = cg.time / 1000.0f;
00048 
00049                 re->reType = RT_SPRITE;
00050                 re->rotation = 0;
00051                 re->radius = 3;
00052                 re->customShader = 0;//cgs.media.waterBubbleShader;
00053                 re->shaderRGBA[0] = 0xff;
00054                 re->shaderRGBA[1] = 0xff;
00055                 re->shaderRGBA[2] = 0xff;
00056                 re->shaderRGBA[3] = 0xff;
00057 
00058                 le->color[3] = 1.0;
00059 
00060                 le->pos.trType = TR_LINEAR;
00061                 le->pos.trTime = cg.time;
00062                 VectorCopy( move, le->pos.trBase );
00063                 le->pos.trDelta[0] = crandom()*5;
00064                 le->pos.trDelta[1] = crandom()*5;
00065                 le->pos.trDelta[2] = crandom()*5 + 6;
00066 
00067                 VectorAdd (move, vec, move);
00068         }
00069 }

void CG_BuildSolidList void   ) 
 

Definition at line 46 of file cg_predict.c.

References centity_t, cg, cg_entities, cg_numpermanents, cg_permanents, playerState_s::clientNum, centity_s::currentState, centity_s::currentValid, DEFAULT_MAXS_2, DEFAULT_MINS_2, snapshot_t::entities, entityState_t, ET_ITEM, ET_PUSH_TRIGGER, ET_TELEPORT_TRIGGER, ET_TERRAIN, entityState_s::eType, centity_s::lerpOrigin, MAX_ENTITIES_IN_SNAPSHOT, cg_t::nextFrameTeleport, cg_t::nextSnap, centity_s::nextState, entityState_s::number, snapshot_t::numEntities, playerState_s::origin, playerMaxs, playerMins, cg_t::predictedPlayerState, snapshot_t::ps, qfalse, qtrue, cg_t::snap, entityState_s::solid, cg_t::thisFrameTeleport, vec3_t, and VectorSubtract.

Referenced by CG_SetInitialSnapshot().

00046                                {
00047         int                             i;
00048         centity_t               *cent;
00049         snapshot_t              *snap;
00050         entityState_t   *ent;
00051         vec3_t                  difference;
00052         float                   dsquared;
00053 
00054         cg_numSolidEntities = 0;
00055         cg_numTriggerEntities = 0;
00056 
00057         if ( cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport ) {
00058                 snap = cg.nextSnap;
00059         } else {
00060                 snap = cg.snap;
00061         }
00062 
00063         for ( i = 0 ; i < snap->numEntities ; i++ ) {
00064                 cent = &cg_entities[ snap->entities[ i ].number ];
00065                 ent = &cent->currentState;
00066 
00067                 if ( ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER || ent->eType == ET_TELEPORT_TRIGGER ) {
00068                         cg_triggerEntities[cg_numTriggerEntities] = cent;
00069                         cg_numTriggerEntities++;
00070                         continue;
00071                 }
00072 
00073                 if ( cent->nextState.solid ) {
00074                         cg_solidEntities[cg_numSolidEntities] = cent;
00075                         cg_numSolidEntities++;
00076                         continue;
00077                 }
00078         }
00079 
00080         //rww - Horrible, terrible, awful hack.
00081         //We don't send your client entity from the server,
00082         //so it isn't added into the solid list from the snapshot,
00083         //and in addition, it has no solid data. So we will force
00084         //adding it in based on a hardcoded player bbox size.
00085         //This will cause issues if the player box size is ever
00086         //changed..
00087         if (cg_numSolidEntities < MAX_ENTITIES_IN_SNAPSHOT)
00088         {
00089                 vec3_t  playerMins = {-15, -15, DEFAULT_MINS_2};
00090                 vec3_t  playerMaxs = {15, 15, DEFAULT_MAXS_2};
00091                 int i, j, k;
00092 
00093                 i = playerMaxs[0];
00094                 if (i<1)
00095                         i = 1;
00096                 if (i>255)
00097                         i = 255;
00098 
00099                 // z is not symetric
00100                 j = (-playerMins[2]);
00101                 if (j<1)
00102                         j = 1;
00103                 if (j>255)
00104                         j = 255;
00105 
00106                 // and z playerMaxs can be negative...
00107                 k = (playerMaxs[2]+32);
00108                 if (k<1)
00109                         k = 1;
00110                 if (k>255)
00111                         k = 255;
00112 
00113                 cg_solidEntities[cg_numSolidEntities] = &cg_entities[cg.predictedPlayerState.clientNum];
00114                 cg_solidEntities[cg_numSolidEntities]->currentState.solid = (k<<16) | (j<<8) | i;
00115 
00116                 cg_numSolidEntities++;
00117         }
00118 
00119         dsquared = /*RMG_distancecull.value*/5000+500;
00120         dsquared *= dsquared;
00121 
00122         for(i=0;i<cg_numpermanents;i++)
00123         {
00124                 cent = cg_permanents[i];
00125                 VectorSubtract(cent->lerpOrigin, snap->ps.origin, difference);
00126                 if (cent->currentState.eType == ET_TERRAIN ||
00127                         ((difference[0]*difference[0]) + (difference[1]*difference[1]) + (difference[2]*difference[2])) <= dsquared)
00128                 {
00129                         cent->currentValid = qtrue;
00130                         if ( cent->nextState.solid ) 
00131                         {
00132                                 cg_solidEntities[cg_numSolidEntities] = cent;
00133                                 cg_numSolidEntities++;
00134                         }
00135                 }
00136                 else
00137                 {
00138                         cent->currentValid = qfalse;
00139                 }
00140         }
00141 }

void CG_BuildSpectatorString void   ) 
 

Definition at line 2480 of file cg_main.c.

References cg, CG_SiegeCountCvars(), cgs, cgs_t::clientinfo, clientInfo_t::infoValid, MAX_CLIENTS, clientInfo_t::name, Q_strcat(), cg_t::spectatorLen, cg_t::spectatorList, cg_t::spectatorWidth, strlen(), clientInfo_t::team, TEAM_SPECTATOR, and va().

02480                                    {
02481         int i;
02482         cg.spectatorList[0] = 0;
02483 
02484         // Count up the number of players per team and per class
02485         CG_SiegeCountCvars();
02486 
02487         for (i = 0; i < MAX_CLIENTS; i++) {
02488                 if (cgs.clientinfo[i].infoValid && cgs.clientinfo[i].team == TEAM_SPECTATOR ) {
02489                         Q_strcat(cg.spectatorList, sizeof(cg.spectatorList), va("%s     ", cgs.clientinfo[i].name));
02490                 }
02491         }
02492         i = strlen(cg.spectatorList);
02493         if (i != cg.spectatorLen) {
02494                 cg.spectatorLen = i;
02495                 cg.spectatorWidth = -1;
02496         }
02497 }

void CG_CenterPrint const char *  str,
int  y,
int  charWidth
 

Definition at line 4398 of file cg_draw.c.

References cg_t::centerPrint, cg_t::centerPrintCharWidth, cg_t::centerPrintLines, cg_t::centerPrintTime, cg_t::centerPrintY, cg, Q_strncpyz(), and cg_t::time.

Referenced by Board(), CG_DrawSiegeMessageNonMenu(), and CG_EntityEvent().

04398                                                              {
04399         char    *s;
04400 
04401         Q_strncpyz( cg.centerPrint, str, sizeof(cg.centerPrint) );
04402 
04403         cg.centerPrintTime = cg.time;
04404         cg.centerPrintY = y;
04405         cg.centerPrintCharWidth = charWidth;
04406 
04407         // count the number of lines for centering
04408         cg.centerPrintLines = 1;
04409         s = cg.centerPrint;
04410         while( *s ) {
04411                 if (*s == '\n')
04412                         cg.centerPrintLines++;
04413                 s++;
04414         }
04415 }

void CG_CheckChangedPredictableEvents playerState_t ps  ) 
 

Definition at line 257 of file cg_playerstate.c.

References centity_t, cg, cg_entities, CG_EntityEvent(), CG_Printf(), cg_showmiss, playerState_s::clientNum, centity_s::currentState, entityState_s::event, entityState_s::eventParm, playerState_s::eventParms, playerState_s::events, playerState_s::eventSequence, cg_t::eventSequence, vmCvar_t::integer, centity_s::lerpOrigin, MAX_PREDICTED_EVENTS, MAX_PS_EVENTS, playerState_t, and cg_t::predictableEvents.

00257                                                            {
00258         int i;
00259         int event;
00260         centity_t       *cent;
00261 
00262         cent = &cg_entities[ps->clientNum];
00263         for ( i = ps->eventSequence - MAX_PS_EVENTS ; i < ps->eventSequence ; i++ ) {
00264                 //
00265                 if (i >= cg.eventSequence) {
00266                         continue;
00267                 }
00268                 // if this event is not further back in than the maximum predictable events we remember
00269                 if (i > cg.eventSequence - MAX_PREDICTED_EVENTS) {
00270                         // if the new playerstate event is different from a previously predicted one
00271                         if ( ps->events[i & (MAX_PS_EVENTS-1)] != cg.predictableEvents[i & (MAX_PREDICTED_EVENTS-1) ] ) {
00272 
00273                                 event = ps->events[ i & (MAX_PS_EVENTS-1) ];
00274                                 cent->currentState.event = event;
00275                                 cent->currentState.eventParm = ps->eventParms[ i & (MAX_PS_EVENTS-1) ];
00276                                 CG_EntityEvent( cent, cent->lerpOrigin );
00277 
00278                                 cg.predictableEvents[ i & (MAX_PREDICTED_EVENTS-1) ] = event;
00279 
00280                                 if ( cg_showmiss.integer ) {
00281                                         CG_Printf("WARNING: changed predicted event\n");
00282                                 }
00283                         }
00284                 }
00285         }
00286 }

void CG_CheckEvents centity_t cent  ) 
 

Definition at line 3526 of file cg_event.c.

References BG_EvaluateTrajectory(), centity_t, cg, CG_EntityEvent(), CG_SetEntitySoundPosition(), centity_s::currentState, EF_PLAYER_EVENT, entityState_s::eFlags, ET_EVENTS, entityState_s::eType, EV_EVENT_BITS, entityState_s::event, centity_s::lerpOrigin, entityState_s::number, entityState_s::otherEntityNum, entityState_s::pos, centity_s::previousEvent, snapshot_t::serverTime, and cg_t::snap.

Referenced by CG_SetInitialSnapshot().

03526                                        {
03527         // check for event-only entities
03528         if ( cent->currentState.eType > ET_EVENTS ) {
03529                 if ( cent->previousEvent ) {
03530                         return; // already fired
03531                 }
03532                 // if this is a player event set the entity number of the client entity number
03533                 if ( cent->currentState.eFlags & EF_PLAYER_EVENT ) {
03534                         cent->currentState.number = cent->currentState.otherEntityNum;
03535                 }
03536 
03537                 cent->previousEvent = 1;
03538 
03539                 cent->currentState.event = cent->currentState.eType - ET_EVENTS;
03540         } else {
03541                 // check for events riding with another entity
03542                 if ( cent->currentState.event == cent->previousEvent ) {
03543                         return;
03544                 }
03545                 cent->previousEvent = cent->currentState.event;
03546                 if ( ( cent->currentState.event & ~EV_EVENT_BITS ) == 0 ) {
03547                         return;
03548                 }
03549         }
03550 
03551         // calculate the position at exactly the frame time
03552         BG_EvaluateTrajectory( &cent->currentState.pos, cg.snap->serverTime, cent->lerpOrigin );
03553         CG_SetEntitySoundPosition( cent );
03554 
03555         CG_EntityEvent( cent, cent->lerpOrigin );
03556 }

void CG_CheckPlayerG2Weapons playerState_t ps,
centity_t cent
 

Definition at line 2494 of file cg_weapons.c.

References BG_SI_SetDesiredLength(), centity_t, CG_CopyG2WeaponInstance(), cg_entities, CG_G2WeaponInstance(), cgs, CHAN_AUTO, cgs_t::clientinfo, playerState_s::clientNum, centity_s::currentState, EF_DEAD, entityState_s::eFlags, ET_NPC, entityState_s::eType, centity_s::ghoul2, centity_s::ghoul2weapon, centity_s::lerpOrigin, NULL, entityState_s::number, PERS_TEAM, playerState_s::persistant, playerState_t, playerState_s::pm_flags, PMF_FOLLOW, playerState_s::saberHolstered, entityState_s::saberInFlight, centity_s::saberWasInFlight, TEAM_SPECTATOR, centity_s::torsoBolt, trap_S_StartSound(), centity_s::weapon, playerState_s::weapon, and WP_SABER.

Referenced by CG_AddPacketEntities().

02495 {
02496         if (!ps)
02497         {
02498                 assert(0);
02499                 return;
02500         }
02501 
02502         if (ps->pm_flags & PMF_FOLLOW)
02503         {
02504                 return;
02505         }
02506 
02507         if (cent->currentState.eType == ET_NPC)
02508         {
02509                 assert(0);
02510                 return;
02511         }
02512 
02513         // should we change the gun model on this player?
02514         if (cent->currentState.saberInFlight)
02515         {
02516                 cent->ghoul2weapon = CG_G2WeaponInstance(cent, WP_SABER);
02517         }
02518 
02519         if (cent->currentState.eFlags & EF_DEAD)
02520         { //no updating weapons when dead
02521                 cent->ghoul2weapon = NULL;
02522                 return;
02523         }
02524 
02525         if (cent->torsoBolt)
02526         { //got our limb cut off, no updating weapons until it's restored
02527                 cent->ghoul2weapon = NULL;
02528                 return;
02529         }
02530 
02531         if (cgs.clientinfo[ps->clientNum].team == TEAM_SPECTATOR ||
02532                 ps->persistant[PERS_TEAM] == TEAM_SPECTATOR)
02533         {
02534                 cent->ghoul2weapon = cg_entities[ps->clientNum].ghoul2weapon = NULL;
02535                 cent->weapon = cg_entities[ps->clientNum].weapon = 0;
02536                 return;
02537         }
02538 
02539         if (cent->ghoul2 && cent->ghoul2weapon != CG_G2WeaponInstance(cent, ps->weapon) &&
02540                 ps->clientNum == cent->currentState.number) //don't want spectator mode forcing one client's weapon instance over another's
02541         {
02542                 CG_CopyG2WeaponInstance(cent, ps->weapon, cent->ghoul2);
02543                 cent->ghoul2weapon = CG_G2WeaponInstance(cent, ps->weapon);
02544                 if (cent->weapon == WP_SABER && cent->weapon != ps->weapon && !ps->saberHolstered)
02545                 { //switching away from the saber
02546                         //trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, trap_S_RegisterSound( "sound/weapons/saber/saberoffquick.wav" ));
02547                         if (cgs.clientinfo[ps->clientNum].saber[0].soundOff && !ps->saberHolstered)
02548                         {
02549                                 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[0].soundOff);
02550                         }
02551 
02552                         if (cgs.clientinfo[ps->clientNum].saber[1].soundOff &&
02553                                 cgs.clientinfo[ps->clientNum].saber[1].model[0] &&
02554                                 !ps->saberHolstered)
02555                         {
02556                                 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[1].soundOff);
02557                         }
02558                 }
02559                 else if (ps->weapon == WP_SABER && cent->weapon != ps->weapon && !cent->saberWasInFlight)
02560                 { //switching to the saber
02561                         //trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, trap_S_RegisterSound( "sound/weapons/saber/saberon.wav" ));
02562                         if (cgs.clientinfo[ps->clientNum].saber[0].soundOn)
02563                         {
02564                                 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[0].soundOn);
02565                         }
02566 
02567                         if (cgs.clientinfo[ps->clientNum].saber[1].soundOn)
02568                         {
02569                                 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[1].soundOn);
02570                         }
02571 
02572                         BG_SI_SetDesiredLength(&cgs.clientinfo[ps->clientNum].saber[0], 0, -1);
02573                         BG_SI_SetDesiredLength(&cgs.clientinfo[ps->clientNum].saber[1], 0, -1);
02574                 }
02575                 cent->weapon = ps->weapon;
02576         }
02577 }

void CG_Chunks int  owner,
vec3_t  origin,
const vec3_t  normal,
const vec3_t  mins,
const vec3_t  maxs,
float  speed,
int  numChunks,
material_t  chunkType,
int  customChunk,
float  baseScale
 

Definition at line 1061 of file cg_effects.c.

References localEntity_s::angles, refEntity_t::axis, AxisCopy(), axisDefault, localEntity_s::bounceFactor, cg, CG_AllocLocalEntity(), cgs, CHAN_BODY, CHUNK_CRATE1, CHUNK_CRATE2, CHUNK_METAL1, CHUNK_METAL2, CHUNK_ROCK1, CHUNK_ROCK2, CHUNK_ROCK3, CHUNK_WHITE_METAL, cgMedia_t::chunkModels, cgMedia_t::chunkSound, crandom, cgMedia_t::crateBreakSound, localEntity_s::endTime, flrand(), cgs_t::gameModels, cgMedia_t::glassChunkSound, cgMedia_t::grateSound, refEntity_t::hModel, LE_FRAGMENT, localEntity_s::leBounceSoundType, leBounceSoundType_t, LEBS_METAL, LEBS_NONE, LEBS_ROCK, LEF_TUMBLE, localEntity_s::leFlags, localEntity_s::leType, localEntity_t, MAT_CRATE1, MAT_CRATE2, MAT_DRK_STONE, MAT_ELEC_METAL, MAT_ELECTRICAL, MAT_GLASS, MAT_GLASS_METAL, MAT_GRATE1, MAT_GREY_STONE, MAT_LT_STONE, MAT_METAL, MAT_METAL2, MAT_METAL3, MAT_NONE, MAT_ROPE, MAT_SNOWY_ROCK, MAT_WHITE_METAL, material_t, cgs_t::media, refEntity_t::modelScale, refEntity_t::nonNormalizedAxes, NULL, refEntity_t::origin, localEntity_s::pos, Q_irand(), qboolean, qfalse, qtrue, localEntity_s::radius, rand(), random, localEntity_s::refEntity, cgMedia_t::rockBreakSound, ScaleModelAxis(), cg_t::time, TR_GRAVITY, TR_LINEAR, trap_S_RegisterSound(), trap_S_StartSound(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trTime, trajectory_t::trType, va(), vec3_t, VectorCopy, VectorNormalize(), VectorScale, VectorSet, and VectorSubtract.

Referenced by CG_EntityEvent().

01063 {
01064         localEntity_t   *le;
01065         refEntity_t             *re;
01066         vec3_t                  dir;
01067         int                             i, j, k;
01068         int                             chunkModel = 0;
01069         leBounceSoundType_t     bounce = LEBS_NONE;
01070         float                   r, speedMod = 1.0f;
01071         qboolean                chunk = qfalse;
01072 
01073         if ( chunkType == MAT_NONE )
01074         {
01075                 // Well, we should do nothing
01076                 return;
01077         }
01078 
01079         // Set up our chunk sound info...breaking sounds are done here so they are done once on breaking..some return instantly because the chunks are done with effects instead of models
01080         switch( chunkType )
01081         {
01082         case MAT_GLASS:
01083                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.glassChunkSound );
01084                 return;
01085                 break;
01086         case MAT_GRATE1:
01087                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.grateSound );
01088                 return;
01089                 break;
01090         case MAT_ELECTRICAL:// (sparks)
01091                 trap_S_StartSound( NULL, owner, CHAN_BODY, trap_S_RegisterSound (va("sound/ambience/spark%d.wav", Q_irand(1, 6))) );
01092                 return;
01093                 break;
01094         case MAT_DRK_STONE:
01095         case MAT_LT_STONE:
01096         case MAT_GREY_STONE:
01097         case MAT_WHITE_METAL:  // not quite sure what this stuff is supposed to be...it's for Stu
01098         case MAT_SNOWY_ROCK:
01099                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.rockBreakSound );
01100                 bounce = LEBS_ROCK;
01101                 speedMod = 0.5f; // rock blows up less
01102                 break;
01103         case MAT_GLASS_METAL:
01104                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.glassChunkSound ); // FIXME: should probably have a custom sound
01105                 bounce = LEBS_METAL;
01106                 break;
01107         case MAT_CRATE1:
01108         case MAT_CRATE2:
01109                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.crateBreakSound[Q_irand(0,1)] );
01110                 break;
01111         case MAT_METAL:
01112         case MAT_METAL2:
01113         case MAT_METAL3:
01114         case MAT_ELEC_METAL:// FIXME: maybe have its own sound?
01115                 trap_S_StartSound( NULL, owner, CHAN_BODY, cgs.media.chunkSound );
01116                 bounce = LEBS_METAL;
01117                 speedMod = 0.8f; // metal blows up a bit more
01118                 break;
01119         case MAT_ROPE:
01120 //              trap_S_StartSound( NULL, owner, CHAN_BODY, cgi_S_RegisterSound( "" ));  FIXME:  needs a sound
01121                 return;
01122                 break;
01123         }
01124 
01125         if ( baseScale <= 0.0f )
01126         {
01127                 baseScale = 1.0f;
01128         }
01129 
01130         // Chunks
01131         for( i = 0; i < numChunks; i++ )
01132         {
01133                 if ( customChunk > 0 )
01134                 {
01135                         // Try to use a custom chunk.
01136                         if ( cgs.gameModels[customChunk] )
01137                         {
01138                                 chunk = qtrue;
01139                                 chunkModel = cgs.gameModels[customChunk];
01140                         }
01141                 }
01142 
01143                 if ( !chunk )
01144                 {
01145                         // No custom chunk.  Pick a random chunk type at run-time so we don't get the same chunks
01146                         switch( chunkType )
01147                         {
01148                         case MAT_METAL2: //bluegrey
01149                                 chunkModel = cgs.media.chunkModels[CHUNK_METAL2][Q_irand(0, 3)];
01150                                 break;
01151                         case MAT_GREY_STONE://gray
01152                                 chunkModel = cgs.media.chunkModels[CHUNK_ROCK1][Q_irand(0, 3)];
01153                                 break;
01154                         case MAT_LT_STONE: //tan
01155                                 chunkModel = cgs.media.chunkModels[CHUNK_ROCK2][Q_irand(0, 3)];
01156                                 break;
01157                         case MAT_DRK_STONE://brown
01158                                 chunkModel = cgs.media.chunkModels[CHUNK_ROCK3][Q_irand(0, 3)];
01159                                 break;
01160                         case MAT_SNOWY_ROCK://gray & brown
01161                                 if ( Q_irand( 0, 1 ) )
01162                                 {
01163                                         chunkModel = cgs.media.chunkModels[CHUNK_ROCK1][Q_irand(0, 3)];
01164                                 }
01165                                 else
01166                                 {
01167                                         chunkModel = cgs.media.chunkModels[CHUNK_ROCK3][Q_irand(0, 3)];
01168                                 }
01169                                 break;
01170                         case MAT_WHITE_METAL:
01171                                 chunkModel = cgs.media.chunkModels[CHUNK_WHITE_METAL][Q_irand(0, 3)];
01172                                 break;
01173                         case MAT_CRATE1://yellow multi-colored crate chunks
01174                                 chunkModel = cgs.media.chunkModels[CHUNK_CRATE1][Q_irand(0, 3)];
01175                                 break;
01176                         case MAT_CRATE2://red multi-colored crate chunks
01177                                 chunkModel = cgs.media.chunkModels[CHUNK_CRATE2][Q_irand(0, 3)];
01178                                 break;
01179                         case MAT_ELEC_METAL:
01180                         case MAT_GLASS_METAL:
01181                         case MAT_METAL://grey
01182                                 chunkModel = cgs.media.chunkModels[CHUNK_METAL1][Q_irand(0, 3)];
01183                                 break;
01184                         case MAT_METAL3:
01185                                 if ( rand() & 1 )
01186                                 {
01187                                         chunkModel = cgs.media.chunkModels[CHUNK_METAL1][Q_irand(0, 3)];
01188                                 }
01189                                 else
01190                                 {
01191                                         chunkModel = cgs.media.chunkModels[CHUNK_METAL2][Q_irand(0, 3)];
01192                                 }
01193                                 break;
01194                         }
01195                 }
01196 
01197                 // It wouldn't look good to throw a bunch of RGB axis models...so make sure we have something to work with.
01198                 if ( chunkModel )
01199                 {
01200                         le = CG_AllocLocalEntity();
01201                         re = &le->refEntity;
01202 
01203                         re->hModel = chunkModel;
01204                         le->leType = LE_FRAGMENT;
01205                         le->endTime = cg.time + 1300 + random() * 900;
01206 
01207                         // spawn chunk roughly in the bbox of the thing...bias towards center in case thing blowing up doesn't complete fill its bbox.
01208                         for( j = 0; j < 3; j++ )
01209                         {
01210                                 r = random() * 0.8f + 0.1f;
01211                                 re->origin[j] = ( r * mins[j] + ( 1 - r ) * maxs[j] );
01212                         }
01213                         VectorCopy( re->origin, le->pos.trBase );
01214 
01215                         // Move out from center of thing, otherwise you can end up things moving across the brush in an undesirable direction.  Visually looks wrong
01216                         VectorSubtract( re->origin, origin, dir );
01217                         VectorNormalize( dir );
01218                         VectorScale( dir, flrand( speed * 0.5f, speed * 1.25f ) * speedMod, le->pos.trDelta );
01219 
01220                         // Angular Velocity
01221                         VectorSet( le->angles.trBase, random() * 360, random() * 360, random() * 360 );
01222 
01223                         le->angles.trDelta[0] = crandom();
01224                         le->angles.trDelta[1] = crandom();
01225                         le->angles.trDelta[2] = 0; // don't do roll
01226 
01227                         VectorScale( le->angles.trDelta, random() * 600.0f + 200.0f, le->angles.trDelta );
01228 
01229                         le->pos.trType = TR_GRAVITY;
01230                         le->angles.trType = TR_LINEAR;
01231                         le->pos.trTime = le->angles.trTime = cg.time;
01232                         le->bounceFactor = 0.2f + random() * 0.2f;
01233                         le->leFlags |= LEF_TUMBLE;
01234                         //le->ownerGentNum = owner;
01235                         le->leBounceSoundType = bounce; 
01236 
01237                         // Make sure that we have the desired start size set
01238                         le->radius = flrand( baseScale * 0.75f, baseScale * 1.25f );
01239                         re->nonNormalizedAxes = qtrue;
01240                         AxisCopy( axisDefault, re->axis ); // could do an angles to axis, but this is cheaper and works ok
01241                         for( k = 0; k < 3; k++ )
01242                         {
01243                                 re->modelScale[k] = le->radius;
01244                         }
01245                         ScaleModelAxis(re);
01246                         /*
01247                         for( k = 0; k < 3; k++ )
01248                         {
01249                                 VectorScale( re->axis[k], le->radius, re->axis[k] );
01250                         }
01251                         */
01252                 }
01253         }
01254 }

void CG_ClearParticles void   ) 
 

Definition at line 395 of file cg_marks.c.

References active_particles, cg, cl_numparticles, free_particles, initparticles, memset(), particle_s::next, NULL, oldtime, particles, qtrue, cg_t::time, and particle_s::type.

Referenced by CG_AddParticles().

00396 {
00397         int             i;
00398 
00399         memset( particles, 0, sizeof(particles) );
00400 
00401         free_particles = &particles[0];
00402         active_particles = NULL;
00403 
00404         for (i=0 ;i<cl_numparticles ; i++)
00405         {
00406                 particles[i].next = &particles[i+1];
00407                 particles[i].type = 0;
00408         }
00409         particles[cl_numparticles-1].next = NULL;
00410 
00411         oldtime = cg.time;
00412 
00413         /*
00414         // Ridah, init the shaderAnims
00415         for (i=0; shaderAnimNames[i]; i++) {
00416                 int j;
00417 
00418                 for (j=0; j<shaderAnimCounts[i]; j++) {
00419                         shaderAnims[i][j] = trap_R_RegisterShader( va("%s%i", shaderAnimNames[i], j+1) );
00420                 }
00421         }
00422         numShaderAnims = i;
00423         */
00424         numShaderAnims = 0;
00425         // done.
00426 
00427         initparticles = qtrue;
00428 }

void CG_ColorForHealth vec4_t  hcolor  ) 
 

Definition at line 454 of file cg_drawtools.c.

References ARMOR_PROTECTION, cg, CG_ColorForGivenHealth(), snapshot_t::ps, cg_t::snap, STAT_ARMOR, STAT_HEALTH, playerState_s::stats, vec4_t, and VectorClear.

00455 {
00456         int             health;
00457         int             count;
00458         int             max;
00459 
00460         // calculate the total points of damage that can
00461         // be sustained at the current health / armor level
00462         health = cg.snap->ps.stats[STAT_HEALTH];
00463 
00464         if ( health <= 0 ) 
00465         {
00466                 VectorClear( hcolor );  // black
00467                 hcolor[3] = 1;
00468                 return;
00469         }
00470 
00471         count = cg.snap->ps.stats[STAT_ARMOR];
00472         max = health * ARMOR_PROTECTION / ( 1.0 - ARMOR_PROTECTION );
00473         if ( max < count ) 
00474         {
00475                 count = max;
00476         }
00477         health += count;
00478 
00479         hcolor[3] = 1.0;
00480         CG_ColorForGivenHealth( hcolor, health );
00481 }

const char* CG_ConfigString int  index  ) 
 

Definition at line 2535 of file cg_main.c.

References CG_Error(), cgs, cgs_t::gameState, MAX_CONFIGSTRINGS, gameState_t::stringData, and gameState_t::stringOffsets.

Referenced by CG_DrawActiveFrame(), CG_DrawInformation(), CG_DrawNewTeamInfo(), CG_DrawSiegeInfo(), CG_EntityEvent(), CG_G2AnimEntModelLoad(), CG_G2ServerBoneAngles(), CG_Init(), CG_LoadingClient(), CG_NewClientInfo(), CG_NewParticleArea(), CG_ParseServerinfo(), CG_PlayDoorLoopSound(), CG_PlayDoorSound(), CG_Player(), CG_SetConfigValues(), CG_SetLightstyle(), CG_ShaderStateChanged(), CG_StartMusic(), and TurretClientRun().

02535                                          {
02536         if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
02537                 CG_Error( "CG_ConfigString: bad index: %i", index );
02538         }
02539         return cgs.gameState.stringData + cgs.gameState.stringOffsets[ index ];
02540 }

qboolean CG_ConsoleCommand void   ) 
 

Definition at line 309 of file cg_consolecmds.c.

References CG_Argv(), consoleCommand_t::function, Q_stricmp(), qboolean, qfalse, and qtrue.

Referenced by vmMain().

00309                                    {
00310         const char      *cmd;
00311         int             i;
00312 
00313         cmd = CG_Argv(0);
00314 
00315         for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
00316                 if ( !Q_stricmp( cmd, commands[i].cmd ) ) {
00317                         commands[i].function();
00318                         return qtrue;
00319                 }
00320         }
00321 
00322         return qfalse;
00323 }

void CG_CopyG2WeaponInstance centity_t cent,
int  weaponNum,
void *  toGhoul2
 

Definition at line 2414 of file cg_weapons.c.

References centity_t, CG_G2WeaponInstance(), cgs, cgs_t::clientinfo, centity_s::currentState, ET_NPC, entityState_s::eType, clientInfo_t::ghoul2Weapons, MAX_SABERS, MAX_WEAPONS, saberInfo_t::model, centity_s::npcClient, NULL, entityState_s::number, qboolean, clientInfo_t::saber, trap_G2API_CleanGhoul2Models(), trap_G2API_CopySpecificGhoul2Model(), trap_G2API_HasGhoul2ModelOnIndex(), trap_G2API_RemoveGhoul2Model(), WP_EMPLACED_GUN, WP_MELEE, and WP_SABER.

Referenced by CG_CheckPlayerG2Weapons(), CG_NewClientInfo(), CG_Player(), CG_ResetPlayerEntity(), and CG_SetInitialSnapshot().

02415 {
02416         //rww - the -1 is because there is no "weapon" for WP_NONE
02417         assert(weaponNum < MAX_WEAPONS);
02418         if (CG_G2WeaponInstance(cent, weaponNum/*-1*/))
02419         {
02420                 if (weaponNum == WP_SABER)
02421                 {
02422                         clientInfo_t *ci = NULL;
02423 
02424                         if (cent->currentState.eType == ET_NPC)
02425                         {
02426                                 ci = cent->npcClient;
02427                         }
02428                         else
02429                         {
02430                                 ci = &cgs.clientinfo[cent->currentState.number];
02431                         }
02432 
02433                         if (!ci)
02434                         {
02435                                 trap_G2API_CopySpecificGhoul2Model(CG_G2WeaponInstance(cent, weaponNum/*-1*/), 0, toGhoul2, 1); 
02436                         }
02437                         else
02438                         { //Try both the left hand saber and the right hand saber
02439                                 int i = 0;
02440 
02441                                 while (i < MAX_SABERS)
02442                                 {
02443                                         if (ci->saber[i].model[0] &&
02444                                                 ci->ghoul2Weapons[i])
02445                                         {
02446                                                 trap_G2API_CopySpecificGhoul2Model(ci->ghoul2Weapons[i], 0, toGhoul2, i+1); 
02447                                         }
02448                                         else if (ci->ghoul2Weapons[i])
02449                                         { //if the second saber has been removed, then be sure to remove it and free the instance.
02450                                                 qboolean g2HasSecondSaber = trap_G2API_HasGhoul2ModelOnIndex(&(toGhoul2), 2);
02451 
02452                                                 if (g2HasSecondSaber)
02453                                                 { //remove it now since we're switching away from sabers
02454                                                         trap_G2API_RemoveGhoul2Model(&(toGhoul2), 2);
02455                                                 }
02456                                                 trap_G2API_CleanGhoul2Models(&ci->ghoul2Weapons[i]);
02457                                         }
02458 
02459                                         i++;
02460                                 }
02461                         }
02462                 }
02463                 else
02464                 {
02465                         qboolean g2HasSecondSaber = trap_G2API_HasGhoul2ModelOnIndex(&(toGhoul2), 2);
02466 
02467                         if (g2HasSecondSaber)
02468                         { //remove it now since we're switching away from sabers
02469                                 trap_G2API_RemoveGhoul2Model(&(toGhoul2), 2);
02470                         }
02471 
02472                         if (weaponNum == WP_EMPLACED_GUN)
02473                         { //a bit of a hack to remove gun model when using an emplaced weap
02474                                 if (trap_G2API_HasGhoul2ModelOnIndex(&(toGhoul2), 1))
02475                                 {
02476                                         trap_G2API_RemoveGhoul2Model(&(toGhoul2), 1);
02477                                 }
02478                         }
02479                         else if (weaponNum == WP_MELEE)
02480                         { //don't want a weapon on the model for this one
02481                                 if (trap_G2API_HasGhoul2ModelOnIndex(&(toGhoul2), 1))
02482                                 {
02483                                         trap_G2API_RemoveGhoul2Model(&(toGhoul2), 1);
02484                                 }
02485                         }
02486                         else
02487                         {
02488                                 trap_G2API_CopySpecificGhoul2Model(CG_G2WeaponInstance(cent, weaponNum/*-1*/), 0, toGhoul2, 1); 
02489                         }
02490                 }
02491         }
02492 }

void CG_CreateBBRefEnts entityState_t s1,
vec3_t  origin
 

Definition at line 502 of file cg_ents.c.

References entityState_t, and vec3_t.

00503 {
00504 /* 
00505 //g2r
00506 #if _DEBUG
00507         refEntity_t             point[8];
00508         int                             i;
00509         vec3_t                  angles = {0,0,0};
00510 
00511         for (i=0; i<8; i++)
00512         {
00513                 memset (&point[i], 0, sizeof(refEntity_t));
00514                 point[i].reType = RT_SPRITE;
00515                 point[i].radius = 1;
00516                 point[i].customShader = trap_R_RegisterShader("textures/tests/circle");
00517                 point[i].shaderRGBA[0] = 255;
00518                 point[i].shaderRGBA[1] = 255;
00519                 point[i].shaderRGBA[2] = 255;
00520                 point[i].shaderRGBA[3] = 255;
00521 
00522                 AnglesToAxis( angles, point[i].axis );
00523 
00524                 // now, we need to put the correct origins into each origin from the mins and max's
00525                 switch(i)
00526                 {
00527                 case 0:
00528                         VectorCopy(s1->mins, point[i].origin);
00529                         break;
00530                 case 1:
00531                         VectorCopy(s1->mins, point[i].origin);
00532                         point[i].origin[0] = s1->maxs[0];
00533                         break;
00534                 case 2:
00535                         VectorCopy(s1->mins, point[i].origin);
00536                         point[i].origin[1] = s1->maxs[1];
00537                         break;
00538                 case 3:
00539                         VectorCopy(s1->mins, point[i].origin);
00540                         point[i].origin[0] = s1->maxs[0];
00541                         point[i].origin[1] = s1->maxs[1];
00542                         break;
00543                 case 4:
00544                         VectorCopy(s1->maxs, point[i].origin);
00545                         break;
00546                 case 5:
00547                         VectorCopy(s1->maxs, point[i].origin);
00548                         point[i].origin[0] = s1->mins[0];
00549                         break;
00550                 case 6:
00551                         VectorCopy(s1->maxs, point[i].origin);
00552                         point[i].origin[1] = s1->mins[1];
00553                         break;
00554                 case 7:
00555                         VectorCopy(s1->maxs, point[i].origin);
00556                         point[i].origin[0] = s1->mins[0];
00557                         point[i].origin[1] = s1->mins[1];
00558                         break;
00559                 }
00560 
00561                 // add the original origin to each point and then stuff them out there
00562                 VectorAdd(point[i].origin, origin, point[i].origin);
00563 
00564                 trap_R_AddRefEntityToScene (&point[i]);
00565         }
00566 #endif
00567         */
00568 }

void CG_CreateNPCClient clientInfo_t **  ci  ) 
 

Definition at line 7686 of file cg_players.c.

References BG_Alloc().

Referenced by CG_EntityEvent(), CG_Player(), and CG_ResetPlayerEntity().

07687 {
07688         //trap_TrueMalloc((void **)ci, sizeof(clientInfo_t));
07689         *ci = (clientInfo_t *) BG_Alloc(sizeof(clientInfo_t));
07690 }

int CG_CrosshairPlayer void   ) 
 

Definition at line 1189 of file cg_main.c.

References cg, cg_t::crosshairClientNum, cg_t::crosshairClientTime, MAX_CLIENTS, and cg_t::time.

Referenced by CG_TargetCommand_f(), and vmMain().

01189                                {
01190         if ( cg.time > ( cg.crosshairClientTime + 1000 ) ) {
01191                 return -1;
01192         }
01193 
01194         if (cg.crosshairClientNum >= MAX_CLIENTS)
01195         {
01196                 return -1;
01197         }
01198 
01199         return cg.crosshairClientNum;
01200 }

sfxHandle_t CG_CustomSound int  clientNum,
const char *  soundName
 

Definition at line 170 of file cg_players.c.

References bg_customSiegeSoundNames, cg_buildScript, cg_customCombatSoundNames, cg_customDuelSoundNames, cg_customExtraSoundNames, cg_customJediSoundNames, cg_customSoundNames, cg_entities, cgs, cgs_t::clientinfo, Com_Printf(), COM_StripExtension(), clientInfo_t::combatSounds, clientInfo_t::duelSounds, clientInfo_t::extraSounds, cgs_t::gametype, GT_DUEL, GT_POWERDUEL, GT_TEAM, vmCvar_t::integer, clientInfo_t::jediSounds, MAX_CLIENTS, MAX_CUSTOM_SOUNDS, MAX_QPATH, centity_s::npcClient, sfxHandle_t, clientInfo_t::siegeSounds, clientInfo_t::sounds, strcmp(), and trap_S_RegisterSound().

Referenced by CG_EntityEvent(), CG_PainEvent(), CG_TryPlayCustomSound(), and DoFall().

00170                                                                        {
00171         clientInfo_t *ci;
00172         int                     i;
00173         int                     numCSounds = 0;
00174         int                     numCComSounds = 0;
00175         int                     numCExSounds = 0;
00176         int                     numCJediSounds = 0;
00177         int                     numCSiegeSounds = 0;
00178         int                     numCDuelSounds = 0;
00179         char            lSoundName[MAX_QPATH];
00180 
00181         if ( soundName[0] != '*' ) {
00182                 return trap_S_RegisterSound( soundName );
00183         }
00184 
00185         COM_StripExtension(soundName, lSoundName);
00186 
00187         if ( clientNum < 0 )
00188         {
00189                 clientNum = 0;
00190         }
00191 
00192         if (clientNum >= MAX_CLIENTS)
00193         {
00194                 ci = cg_entities[clientNum].npcClient;
00195         }
00196         else
00197         {
00198                 ci = &cgs.clientinfo[ clientNum ];
00199         }
00200 
00201         if (!ci)
00202         {
00203                 return 0;
00204         }
00205 
00206         for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00207         {
00208                 if (!cg_customSoundNames[i])
00209                 {
00210                         numCSounds = i;
00211                         break;
00212                 }
00213         }
00214 
00215         if (clientNum >= MAX_CLIENTS)
00216         { //these are only for npc's
00217                 for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00218                 {
00219                         if (!cg_customCombatSoundNames[i])
00220                         {
00221                                 numCComSounds = i;
00222                                 break;
00223                         }
00224                 }
00225 
00226                 for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00227                 {
00228                         if (!cg_customExtraSoundNames[i])
00229                         {
00230                                 numCExSounds = i;
00231                                 break;
00232                         }
00233                 }
00234 
00235                 for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00236                 {
00237                         if (!cg_customJediSoundNames[i])
00238                         {
00239                                 numCJediSounds = i;
00240                                 break;
00241                         }
00242                 }
00243         }
00244 
00245     if (cgs.gametype >= GT_TEAM || cg_buildScript.integer)
00246         { //siege only
00247                 for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00248                 {
00249                         if (!bg_customSiegeSoundNames[i])
00250                         {
00251                                 numCSiegeSounds = i;
00252                                 break;
00253                         }
00254                 }
00255         }
00256 
00257     if (cgs.gametype == GT_DUEL
00258                 || cgs.gametype == GT_POWERDUEL
00259                 || cg_buildScript.integer)
00260         { //Duel only
00261                 for (i = 0; i < MAX_CUSTOM_SOUNDS; i++)
00262                 {
00263                         if (!cg_customDuelSoundNames[i])
00264                         {
00265                                 numCDuelSounds = i;
00266                                 break;
00267                         }
00268                 }
00269         }
00270 
00271         for ( i = 0 ; i < MAX_CUSTOM_SOUNDS ; i++ )
00272         {
00273                 if ( i < numCSounds && !strcmp( lSoundName, cg_customSoundNames[i] ) )
00274                 {
00275                         return ci->sounds[i];
00276                 }
00277                 else if ( (cgs.gametype >= GT_TEAM || cg_buildScript.integer) && i < numCSiegeSounds && !strcmp( lSoundName, bg_customSiegeSoundNames[i] ) )
00278                 { //siege only
00279                         return ci->siegeSounds[i];
00280                 }
00281                 else if ( (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL || cg_buildScript.integer) && i < numCDuelSounds && !strcmp( lSoundName, cg_customDuelSoundNames[i] ) )
00282                 { //siege only
00283                         return ci->duelSounds[i];
00284                 }
00285                 else if ( clientNum >= MAX_CLIENTS && i < numCComSounds && !strcmp( lSoundName, cg_customCombatSoundNames[i] ) )
00286                 { //npc only
00287                         return ci->combatSounds[i];
00288                 }
00289                 else if ( clientNum >= MAX_CLIENTS && i < numCExSounds && !strcmp( lSoundName, cg_customExtraSoundNames[i] ) )
00290                 { //npc only
00291                         return ci->extraSounds[i];
00292                 }
00293                 else if ( clientNum >= MAX_CLIENTS && i < numCJediSounds && !strcmp( lSoundName, cg_customJediSoundNames[i] ) )
00294                 { //npc only
00295                         return ci->jediSounds[i];
00296                 }
00297         }
00298 
00299         //CG_Error( "Unknown custom sound: %s", lSoundName );
00300 #ifndef FINAL_BUILD
00301         Com_Printf( "Unknown custom sound: %s", lSoundName );
00302 #endif
00303         return 0;
00304 }

qboolean CG_DeferMenuScript char **  args  ) 
 

Definition at line 879 of file cg_newDraw.c.

References qboolean, and qfalse.

Referenced by CG_LoadHudMenu().

00880 {
00881         return qfalse;
00882 }

void CG_DestroyNPCClient clientInfo_t **  ci  ) 
 

Definition at line 7692 of file cg_players.c.

References memset().

07693 {
07694         memset(*ci, 0, sizeof(clientInfo_t));
07695         //trap_TrueFree((void **)ci);
07696 }

void CG_Draw3DModel float  x,
float  y,
float  w,
float  h,
qhandle_t  model,
void *  ghoul2,
int  g2radius,
qhandle_t  skin,
vec3_t  origin,
vec3_t  angles
 

Definition at line 467 of file cg_draw.c.

References AnglesToAxis(), refEntity_t::axis, AxisClear(), cg, cg_draw3dIcons, cg_drawIcons, refEntity_t::customSkin, refdef_t::fov_x, refdef_t::fov_y, refEntity_t::ghoul2, refdef_t::height, refEntity_t::hModel, vmCvar_t::integer, memset(), refEntity_t::origin, qhandle_t, refEntity_t::radius, RDF_NOWORLDMODEL, refdef_t::rdflags, refEntity_t::renderfx, RF_NOSHADOW, cg_t::time, refdef_t::time, trap_R_AddRefEntityToScene(), trap_R_ClearScene(), trap_R_RenderScene(), vec3_t, VectorCopy, refdef_t::viewaxis, refdef_t::width, refdef_t::x, and refdef_t::y.

Referenced by CG_DrawFlagModel().

00467                                                                                                                                                      {
00468         refdef_t                refdef;
00469         refEntity_t             ent;
00470 
00471         if ( !cg_draw3dIcons.integer || !cg_drawIcons.integer ) {
00472                 return;
00473         }
00474 
00475         memset( &refdef, 0, sizeof( refdef ) );
00476 
00477         memset( &ent, 0, sizeof( ent ) );
00478         AnglesToAxis( angles, ent.axis );
00479         VectorCopy( origin, ent.origin );
00480         ent.hModel = model;
00481         ent.ghoul2 = ghoul2;
00482         ent.radius = g2radius;
00483         ent.customSkin = skin;
00484         ent.renderfx = RF_NOSHADOW;             // no stencil shadows
00485 
00486         refdef.rdflags = RDF_NOWORLDMODEL;
00487 
00488         AxisClear( refdef.viewaxis );
00489 
00490         refdef.fov_x = 30;
00491         refdef.fov_y = 30;
00492 
00493         refdef.x = x;
00494         refdef.y = y;
00495         refdef.width = w;
00496         refdef.height = h;
00497 
00498         refdef.time = cg.time;
00499 
00500         trap_R_ClearScene();
00501         trap_R_AddRefEntityToScene( &ent );
00502         trap_R_RenderScene( &refdef );
00503 }

void CG_DrawActive stereoFrame_t  stereoView  ) 
 

Definition at line 8511 of file cg_draw.c.

References cg, CG_DrawInformation(), CG_Error(), cg_stereoSeparation, CG_TileClear(), PERS_TEAM, playerState_s::persistant, playerState_s::pm_flags, PMF_SCOREBOARD, snapshot_t::ps, RDF_DRAWSKYBOX, refdef_t::rdflags, cg_t::refdef, cg_t::snap, STEREO_CENTER, STEREO_LEFT, STEREO_RIGHT, stereoFrame_t, TEAM_SPECTATOR, trap_R_RenderScene(), vmCvar_t::value, vec3_t, VectorCopy, VectorMA, refdef_t::viewaxis, and refdef_t::vieworg.

Referenced by CG_DrawActiveFrame().

08511                                                {
08512         float           separation;
08513         vec3_t          baseOrg;
08514 
08515         // optionally draw the info screen instead
08516         if ( !cg.snap ) {
08517                 CG_DrawInformation();
08518                 return;
08519         }
08520 
08521         // optionally draw the tournement scoreboard instead
08522         if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR &&
08523                 ( cg.snap->ps.pm_flags & PMF_SCOREBOARD ) ) {
08524                 CG_DrawTourneyScoreboard();
08525                 return;
08526         }
08527 
08528         switch ( stereoView ) {
08529         case STEREO_CENTER:
08530                 separation = 0;
08531                 break;
08532         case STEREO_LEFT:
08533                 separation = -cg_stereoSeparation.value / 2;
08534                 break;
08535         case STEREO_RIGHT:
08536                 separation = cg_stereoSeparation.value / 2;
08537                 break;
08538         default:
08539                 separation = 0;
08540                 CG_Error( "CG_DrawActive: Undefined stereoView" );
08541         }
08542 
08543 
08544         // clear around the rendered view if sized down
08545         CG_TileClear();
08546 
08547         // offset vieworg appropriately if we're doing stereo separation
08548         VectorCopy( cg.refdef.vieworg, baseOrg );
08549         if ( separation != 0 ) {
08550                 VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
08551         }
08552 
08553         cg.refdef.rdflags |= RDF_DRAWSKYBOX;
08554 
08555         // draw 3D view
08556         trap_R_RenderScene( &cg.refdef );
08557 
08558         // restore original viewpoint if running stereo
08559         if ( separation != 0 ) {
08560                 VectorCopy( baseOrg, cg.refdef.vieworg );
08561         }
08562 
08563         // draw status bar and other floating elements
08564         CG_Draw2D();
08565 }

void CG_DrawActiveFrame int  serverTime,
stereoFrame_t  stereoView,
qboolean  demoPlayback
 

Definition at line 2439 of file cg_view.c.

References AnglesToAxis(), refdef_t::areamask, snapshot_t::areamask, bg_fighterAltControl, BG_InGrappleMove(), BG_VehicleTurnRateForSpeed(), bgSiegeClasses, centity_t, cg, CG_ActualLoadDeferredPlayers(), CG_AddLagometerFrameInfo(), CG_AddLocalEntities(), CG_AddMarks(), CG_AddPacketEntities(), CG_AddParticles(), CG_AddViewWeapon(), CG_CalcScreenEffects(), CG_ConfigString(), CG_DrawActive(), CG_DrawAutoMap(), CG_DrawInformation(), CG_DrawMiscEnts(), CG_DrawSkyBoxPortal(), cg_entities, cg_fpls, CG_GetStringEdString(), cg_linearFogOverride, CG_PredictPlayerState(), CG_Printf(), CG_ProcessSnapshots(), CG_RunLightStyles(), cg_snapshotTimeout, cg_stats, cg_thirdPerson, cg_timescale, cg_timescaleFadeEnd, cg_timescaleFadeSpeed, CG_UpdateCvars(), CG_UpdateSoundTrackers(), cgQueueLoad, cgs, CLASS_VEHICLE, cg_t::clientFrame, cgs_t::clientinfo, playerState_s::clientNum, Com_Error(), CS_GLOBAL_AMBIENT_SET, CS_SKYBOXORG, centity_s::currentState, cg_t::demoPlayback, playerState_s::emplacedIndex, ERR_DROP, ET_NPC, entityState_s::eType, playerState_s::fallingToDeath, playerState_s::forceHandExtend, cg_t::forceSelect, refdef_t::fov_x, cg_t::frametime, cgs_t::gametype, gCGFallVector, gCGHasFallVector, playerState_s::generic1, GT_SIEGE, HANDEXTEND_KNOCKDOWN, refEntity_t::hModel, cg_t::hyperspace, cg_t::infoScreenText, vmCvar_t::integer, cg_t::itemSelect, playerState_s::legsAnim, playerState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, memcpy(), name, entityState_s::NPC_class, NULL, cg_t::oldTime, playerState_s::origin, PERS_TEAM, playerState_s::persistant, PM_InKnockDown(), PM_SPECTATOR, playerState_s::pm_type, cg_t::predictedPlayerState, snapshot_t::ps, qboolean, qfalse, qtrue, cg_t::refdef, cg_t::renderingThirdPerson, playerState_s::saberLockTime, cg_t::snap, SNAPFLAG_NOT_ACTIVE, snapshot_t::snapFlags, entityState_s::speed, STAT_HEALTH, playerState_s::stats, STEREO_RIGHT, stereoFrame_t, TEAM_SPECTATOR, cg_t::testModelEntity, cg_t::time, refdef_t::time, playerState_s::torsoAnim, trap_Cvar_Set(), trap_FX_AddScheduledEffects(), trap_FX_AdjustTime(), trap_Milliseconds(), trap_R_ClearScene(), trap_R_SetRangeFog(), trap_ROFF_UpdateEntities(), trap_S_ClearLoopingSounds(), trap_S_Respatialize(), trap_S_UpdateAmbientSet(), trap_SetUserCmdValue(), vehicleInfo_t::type, ui_myteam, va(), vmCvar_t::value, vec3_t, vectoangles(), VectorCopy, VectorNormalize(), VectorSubtract, VH_FIGHTER, refdef_t::viewaxis, refdef_t::vieworg, playerState_s::weapon, cg_t::weaponSelect, WP_EMPLACED_GUN, WP_MELEE, WP_SABER, playerState_s::zoomMode, and cg_t::zoomSensitivity.

Referenced by vmMain().

02439                                                                                            {
02440         int             inwater;
02441         const char *cstr;
02442         float mSensitivity = cg.zoomSensitivity;
02443         float mPitchOverride = 0.0f;
02444         float mYawOverride = 0.0f;
02445         static centity_t *veh = NULL;
02446 #ifdef VEH_CONTROL_SCHEME_4
02447         float mSensitivityOverride = 0.0f;
02448         qboolean bUseFighterPitch = qfalse;
02449         qboolean        isFighter = qfalse;
02450 #endif
02451 
02452         if (cgQueueLoad)
02453         { //do this before you start messing around with adding ghoul2 refents and crap
02454                 CG_ActualLoadDeferredPlayers();
02455                 cgQueueLoad = qfalse;
02456         }
02457 
02458         cg.time = serverTime;
02459         cg.demoPlayback = demoPlayback;
02460 
02461         if (cg.snap && ui_myteam.integer != cg.snap->ps.persistant[PERS_TEAM])
02462         {
02463                 trap_Cvar_Set ( "ui_myteam", va("%i", cg.snap->ps.persistant[PERS_TEAM]) );
02464         }
02465         if (cgs.gametype == GT_SIEGE &&
02466                 cg.snap &&
02467                 cg_siegeClassIndex != cgs.clientinfo[cg.snap->ps.clientNum].siegeIndex)
02468         {
02469                 cg_siegeClassIndex = cgs.clientinfo[cg.snap->ps.clientNum].siegeIndex;
02470                 if (cg_siegeClassIndex == -1)
02471                 {
02472                         trap_Cvar_Set("ui_mySiegeClass", "<none>");
02473                 }
02474                 else
02475                 {
02476                         trap_Cvar_Set("ui_mySiegeClass", bgSiegeClasses[cg_siegeClassIndex].name);
02477                 }
02478         }
02479 
02480         // update cvars
02481         CG_UpdateCvars();
02482 
02483         // if we are only updating the screen as a loading
02484         // pacifier, don't even try to read snapshots
02485         if ( cg.infoScreenText[0] != 0 ) {
02486                 CG_DrawInformation();
02487                 return;
02488         }
02489 
02490         trap_FX_AdjustTime( cg.time );
02491 
02492         CG_RunLightStyles();
02493 
02494         // any looped sounds will be respecified as entities
02495         // are added to the render list
02496         trap_S_ClearLoopingSounds();
02497 
02498         // clear all the render lists
02499         trap_R_ClearScene();
02500 
02501         // set up cg.snap and possibly cg.nextSnap
02502         CG_ProcessSnapshots();
02503 
02504         trap_ROFF_UpdateEntities();
02505 
02506         // if we haven't received any snapshots yet, all
02507         // we can draw is the information screen
02508         if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) )
02509         {
02510 #if 0   
02511                 // Transition from zero to negative one on the snapshot timeout.
02512                 // The reason we do this is because the first client frame is responsible for
02513                 // some farily slow processing (such as weather) and we dont want to include
02514                 // that processing time into our calculations
02515                 if ( !cg.snapshotTimeoutTime )
02516                 {
02517                         cg.snapshotTimeoutTime = -1;
02518                 }
02519                 // Transition the snapshot timeout time from -1 to the current time in 
02520                 // milliseconds which will start the timeout.
02521                 else if ( cg.snapshotTimeoutTime == -1 )
02522                 {               
02523                         cg.snapshotTimeoutTime = trap_Milliseconds ( );
02524                 }
02525 
02526                 // If we have been waiting too long then just error out
02527                 if ( cg.snapshotTimeoutTime > 0 && (trap_Milliseconds ( ) - cg.snapshotTimeoutTime > cg_snapshotTimeout.integer * 1000) )
02528                 {
02529                         Com_Error ( ERR_DROP, CG_GetStringEdString("MP_SVGAME", "SNAPSHOT_TIMEOUT"));
02530                         return;
02531                 }
02532 #endif  
02533                 CG_DrawInformation();
02534                 return;
02535         }
02536 
02537         // let the client system know what our weapon and zoom settings are
02538         if (cg.snap && cg.snap->ps.saberLockTime > cg.time)
02539         {
02540                 mSensitivity = 0.01f;
02541         }
02542         else if (cg.predictedPlayerState.weapon == WP_EMPLACED_GUN)
02543         { //lower sens for emplaced guns and vehicles
02544                 mSensitivity = 0.2f;
02545         }
02546 #ifdef VEH_CONTROL_SCHEME_4
02547         else if (cg.predictedPlayerState.m_iVehicleNum//in a vehicle
02548                 && !cg.predictedPlayerState.generic1 )//not as a passenger
02549         {
02550                 centity_t *cent = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
02551                 if ( cent->m_pVehicle
02552                         && cent->m_pVehicle->m_pVehicleInfo
02553                         && cent->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
02554                 {
02555                         BG_VehicleTurnRateForSpeed( cent->m_pVehicle, cent->currentState.speed, &mPitchOverride, &mYawOverride );
02556                         //mSensitivityOverride = 5.0f;//old default value
02557                         mSensitivityOverride = 0.0f;
02558                         bUseFighterPitch = qtrue;
02559                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, mSensitivityOverride, cg.forceSelect, cg.itemSelect, bUseFighterPitch );
02560                         isFighter = qtrue;
02561                 }
02562         } 
02563 
02564         if ( !isFighter )
02565 #endif //VEH_CONTROL_SCHEME_4
02566         {
02567                 if (cg.predictedPlayerState.m_iVehicleNum)
02568                 {
02569                         veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
02570                 }
02571                 if (veh &&
02572                         veh->currentState.eType == ET_NPC &&
02573                         veh->currentState.NPC_class == CLASS_VEHICLE &&
02574                         veh->m_pVehicle &&
02575                         veh->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER &&
02576                         bg_fighterAltControl.integer)
02577                 {
02578                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, 0.0f, cg.forceSelect, cg.itemSelect, qtrue );
02579                         veh = NULL; //this is done because I don't want an extra assign each frame because I am so perfect and super efficient.
02580                 }
02581                 else
02582                 {
02583                         trap_SetUserCmdValue( cg.weaponSelect, mSensitivity, mPitchOverride, mYawOverride, 0.0f, cg.forceSelect, cg.itemSelect, qfalse );
02584                 }
02585         }
02586 
02587         // this counter will be bumped for every valid scene we generate
02588         cg.clientFrame++;
02589 
02590         // update cg.predictedPlayerState
02591         CG_PredictPlayerState();
02592 
02593         // decide on third person view
02594         cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0);
02595 
02596         if (cg.snap->ps.stats[STAT_HEALTH] > 0)
02597         {
02598                 if (cg.predictedPlayerState.weapon == WP_EMPLACED_GUN && cg.predictedPlayerState.emplacedIndex /*&&
02599                         cg_entities[cg.predictedPlayerState.emplacedIndex].currentState.weapon == WP_NONE*/)
02600                 { //force third person for e-web and emplaced use
02601                         cg.renderingThirdPerson = 1;
02602                 }
02603                 else if (cg.predictedPlayerState.weapon == WP_SABER || cg.predictedPlayerState.weapon == WP_MELEE ||
02604                         BG_InGrappleMove(cg.predictedPlayerState.torsoAnim) || BG_InGrappleMove(cg.predictedPlayerState.legsAnim) ||
02605                         cg.predictedPlayerState.forceHandExtend == HANDEXTEND_KNOCKDOWN || cg.predictedPlayerState.fallingToDeath ||
02606                         cg.predictedPlayerState.m_iVehicleNum || PM_InKnockDown(&cg.predictedPlayerState))
02607                 {
02608                         if (cg_fpls.integer && cg.predictedPlayerState.weapon == WP_SABER)
02609                         { //force to first person for fpls
02610                                 cg.renderingThirdPerson = 0;
02611                         }
02612                         else
02613                         {
02614                                 cg.renderingThirdPerson = 1;
02615                         }
02616                 }
02617                 else if (cg.snap->ps.zoomMode)
02618                 { //always force first person when zoomed
02619                         cg.renderingThirdPerson = 0;
02620                 }
02621         }
02622         
02623         if (cg.predictedPlayerState.pm_type == PM_SPECTATOR)
02624         { //always first person for spec
02625                 cg.renderingThirdPerson = 0;
02626         }
02627 
02628 
02629         if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR)
02630         {
02631                 cg.renderingThirdPerson = 0;
02632         }
02633 
02634         // build cg.refdef
02635         inwater = CG_CalcViewValues();
02636 
02637         if (cg_linearFogOverride)
02638         {
02639                 trap_R_SetRangeFog(-cg_linearFogOverride);
02640         }
02641         else if (cg.predictedPlayerState.zoomMode)
02642         { //zooming with binoculars or sniper, set the fog range based on the zoom level -rww
02643                 cg_rangedFogging = qtrue;
02644                 //smaller the fov the less fog we have between the view and cull dist
02645                 trap_R_SetRangeFog(cg.refdef.fov_x*64.0f);
02646         }
02647         else if (cg_rangedFogging)
02648         { //disable it
02649                 cg_rangedFogging = qfalse;
02650                 trap_R_SetRangeFog(0.0f);
02651         }
02652 
02653         cstr = CG_ConfigString(CS_SKYBOXORG);
02654 
02655         if (cstr && cstr[0])
02656         { //we have a skyportal
02657                 CG_DrawSkyBoxPortal(cstr);
02658         }
02659 
02660         CG_CalcScreenEffects();
02661 
02662         // first person blend blobs, done after AnglesToAxis
02663         if ( !cg.renderingThirdPerson && cg.predictedPlayerState.pm_type != PM_SPECTATOR ) {
02664                 CG_DamageBlendBlob();
02665         }
02666 
02667         // build the render lists
02668         if ( !cg.hyperspace ) {
02669                 CG_AddPacketEntities(qfalse);                   // adter calcViewValues, so predicted player state is correct
02670                 CG_AddMarks();
02671                 CG_AddParticles ();
02672                 CG_AddLocalEntities();
02673                 CG_DrawMiscEnts();
02674         }
02675         CG_AddViewWeapon( &cg.predictedPlayerState );
02676 
02677         if ( !cg.hyperspace) 
02678         {
02679                 trap_FX_AddScheduledEffects(qfalse);
02680         }
02681 
02682         // add buffered sounds
02683         CG_PlayBufferedSounds();
02684 
02685         // finish up the rest of the refdef
02686         if ( cg.testModelEntity.hModel ) {
02687                 CG_AddTestModel();
02688         }
02689         cg.refdef.time = cg.time;
02690         memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) );
02691 
02692         // warning sounds when powerup is wearing off
02693         CG_PowerupTimerSounds();
02694 
02695         // if there are any entities flagged as sound trackers and attached to other entities, update their sound pos
02696         CG_UpdateSoundTrackers();
02697 
02698         if (gCGHasFallVector)
02699         {
02700                 vec3_t lookAng;
02701 
02702                 VectorSubtract(cg.snap->ps.origin, cg.refdef.vieworg, lookAng);
02703                 VectorNormalize(lookAng);
02704                 vectoangles(lookAng, lookAng);
02705 
02706                 VectorCopy(gCGFallVector, cg.refdef.vieworg);
02707                 AnglesToAxis(lookAng, cg.refdef.viewaxis);
02708         }
02709 
02710         //This is done from the vieworg to get origin for non-attenuated sounds
02711         cstr = CG_ConfigString( CS_GLOBAL_AMBIENT_SET );
02712 
02713         if (cstr && cstr[0])
02714         {
02715                 trap_S_UpdateAmbientSet( cstr, cg.refdef.vieworg );
02716         }
02717 
02718         // update audio positions
02719         trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater );
02720 
02721         // make sure the lagometerSample and frame timing isn't done twice when in stereo
02722         if ( stereoView != STEREO_RIGHT ) {
02723                 cg.frametime = cg.time - cg.oldTime;
02724                 if ( cg.frametime < 0 ) {
02725                         cg.frametime = 0;
02726                 }
02727                 cg.oldTime = cg.time;
02728                 CG_AddLagometerFrameInfo();
02729         }
02730         if (cg_timescale.value != cg_timescaleFadeEnd.value) {
02731                 if (cg_timescale.value < cg_timescaleFadeEnd.value) {
02732                         cg_timescale.value += cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000;
02733                         if (cg_timescale.value > cg_timescaleFadeEnd.value)
02734                                 cg_timescale.value = cg_timescaleFadeEnd.value;
02735                 }
02736                 else {
02737                         cg_timescale.value -= cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000;
02738                         if (cg_timescale.value < cg_timescaleFadeEnd.value)
02739                                 cg_timescale.value = cg_timescaleFadeEnd.value;
02740                 }
02741                 if (cg_timescaleFadeSpeed.value) {
02742                         trap_Cvar_Set("timescale", va("%f", cg_timescale.value));
02743                 }
02744         }
02745 
02746         // actually issue the rendering calls
02747         CG_DrawActive( stereoView );
02748 
02749         CG_DrawAutoMap();
02750 
02751         if ( cg_stats.integer ) {
02752                 CG_Printf( "cg.clientFrame:%i\n", cg.clientFrame );
02753         }
02754 }

void CG_DrawBigString int  x,
int  y,
const char *  s,
float  alpha
 

Definition at line 276 of file cg_drawtools.c.

References BIGCHAR_HEIGHT, BIGCHAR_WIDTH, CG_DrawStringExt(), qfalse, and qtrue.

00276                                                                   {
00277         float   color[4];
00278 
00279         color[0] = color[1] = color[2] = 1.0;
00280         color[3] = alpha;
00281         CG_DrawStringExt( x, y, s, color, qfalse, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 );
00282 }

void CG_DrawBigStringColor int  x,
int  y,
const char *  s,
vec4_t  color
 

Definition at line 284 of file cg_drawtools.c.

References BIGCHAR_HEIGHT, BIGCHAR_WIDTH, CG_DrawStringExt(), qtrue, and vec4_t.

00284                                                                         {
00285         CG_DrawStringExt( x, y, s, color, qtrue, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 );
00286 }

void CG_DrawFlagModel float  x,
float  y,
float  w,
float  h,
int  team,
qboolean  force2D
 

Definition at line 539 of file cg_draw.c.

References BG_FindItemForPowerup(), cgMedia_t::blueFlagModel, cg, cg_draw3dIcons, CG_Draw3DModel(), cg_drawIcons, CG_DrawPic(), cg_items, cgs, gitem_t, vmCvar_t::integer, ITEM_INDEX, cgs_t::media, NULL, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, qhandle_t, cgMedia_t::redFlagModel, sin(), TEAM_BLUE, TEAM_FREE, TEAM_RED, cg_t::time, trap_R_ModelBounds(), vec3_t, VectorClear, and YAW.

00539                                                                                         {
00540         qhandle_t               cm;
00541         float                   len;
00542         vec3_t                  origin, angles;
00543         vec3_t                  mins, maxs;
00544         qhandle_t               handle;
00545 
00546         if ( !force2D && cg_draw3dIcons.integer ) {
00547 
00548                 VectorClear( angles );
00549 
00550                 cm = cgs.media.redFlagModel;
00551 
00552                 // offset the origin y and z to center the flag
00553                 trap_R_ModelBounds( cm, mins, maxs );
00554 
00555                 origin[2] = -0.5 * ( mins[2] + maxs[2] );
00556                 origin[1] = 0.5 * ( mins[1] + maxs[1] );
00557 
00558                 // calculate distance so the flag nearly fills the box
00559                 // assume heads are taller than wide
00560                 len = 0.5 * ( maxs[2] - mins[2] );              
00561                 origin[0] = len / 0.268;        // len / tan( fov/2 )
00562 
00563                 angles[YAW] = 60 * sin( cg.time / 2000.0 );;
00564 
00565                 if( team == TEAM_RED ) {
00566                         handle = cgs.media.redFlagModel;
00567                 } else if( team == TEAM_BLUE ) {
00568                         handle = cgs.media.blueFlagModel;
00569                 } else if( team == TEAM_FREE ) {
00570                         handle = 0;//cgs.media.neutralFlagModel;
00571                 } else {
00572                         return;
00573                 }
00574                 CG_Draw3DModel( x, y, w, h, handle, NULL, 0, 0, origin, angles );
00575         } else if ( cg_drawIcons.integer ) {
00576                 gitem_t *item;
00577 
00578                 if( team == TEAM_RED ) {
00579                         item = BG_FindItemForPowerup( PW_REDFLAG );
00580                 } else if( team == TEAM_BLUE ) {
00581                         item = BG_FindItemForPowerup( PW_BLUEFLAG );
00582                 } else if( team == TEAM_FREE ) {
00583                         item = BG_FindItemForPowerup( PW_NEUTRALFLAG );
00584                 } else {
00585                         return;
00586                 }
00587                 if (item) {
00588                   CG_DrawPic( x, y, w, h, cg_items[ ITEM_INDEX(item) ].icon );
00589                 }
00590         }
00591 }

void CG_DrawHead float  x,
float  y,
float  w,
float  h,
int  clientNum,
vec3_t  headAngles
 

Definition at line 512 of file cg_draw.c.

References CG_DrawPic(), cgs, cgs_t::clientinfo, clientInfo_t::deferred, cgMedia_t::deferShader, MAX_CLIENTS, cgs_t::media, clientInfo_t::modelIcon, and vec3_t.

00513 {
00514         clientInfo_t    *ci;
00515 
00516         if (clientNum >= MAX_CLIENTS)
00517         { //npc?
00518                 return;
00519         }
00520 
00521         ci = &cgs.clientinfo[ clientNum ];
00522 
00523         CG_DrawPic( x, y, w, h, ci->modelIcon );
00524 
00525         // if they are deferred, draw a cross out
00526         if ( ci->deferred ) 
00527         {
00528                 CG_DrawPic( x, y, w, h, cgs.media.deferShader );
00529         }
00530 }

void CG_DrawIconBackground void   ) 
 

Definition at line 895 of file cg_weapons.c.

References cg, cg_hudFiles, cg_t::forceSelectTime, cg_t::iconHUDActive, cg_t::iconHUDPercent, cg_t::iconSelectTime, vmCvar_t::integer, cg_t::invenSelectTime, snapshot_t::ps, qfalse, qtrue, SCREEN_HEIGHT, cg_t::snap, STAT_HEALTH, playerState_s::stats, cg_t::time, WEAPON_SELECT_TIME, and cg_t::weaponSelectTime.

00896 {
00897         int                             height,xAdd,x2,y2,t;
00898 //      int                             prongLeftX,prongRightX;
00899         float                   inTime = cg.invenSelectTime+WEAPON_SELECT_TIME;
00900         float                   wpTime = cg.weaponSelectTime+WEAPON_SELECT_TIME;
00901         float                   fpTime = cg.forceSelectTime+WEAPON_SELECT_TIME;
00902 //      int                             drawType = cgs.media.weaponIconBackground;
00903 //      int                             yOffset = 0;
00904 
00905 #ifdef _XBOX
00906         //yOffset = -50;
00907 #endif
00908 
00909         // don't display if dead
00910         if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) 
00911         {
00912                 return;
00913         }
00914 
00915         if (cg_hudFiles.integer)
00916         { //simple hud
00917                 return;
00918         }
00919 
00920         x2 = 30;
00921         y2 = SCREEN_HEIGHT-70;
00922 
00923         //prongLeftX =x2+37; 
00924         //prongRightX =x2+544; 
00925 
00926         if (inTime > wpTime)
00927         {
00928 //              drawType = cgs.media.inventoryIconBackground;
00929                 cg.iconSelectTime = cg.invenSelectTime;
00930         }
00931         else
00932         {
00933 //              drawType = cgs.media.weaponIconBackground;
00934                 cg.iconSelectTime = cg.weaponSelectTime;
00935         }
00936 
00937         if (fpTime > inTime && fpTime > wpTime)
00938         {
00939 //              drawType = cgs.media.forceIconBackground;
00940                 cg.iconSelectTime = cg.forceSelectTime;
00941         }
00942 
00943         if ((cg.iconSelectTime+WEAPON_SELECT_TIME)<cg.time)     // Time is up for the HUD to display
00944         {
00945                 if (cg.iconHUDActive)           // The time is up, but we still need to move the prongs back to their original position
00946                 {
00947                         t =  cg.time - (cg.iconSelectTime+WEAPON_SELECT_TIME);
00948                         cg.iconHUDPercent = t/ 130.0f;
00949                         cg.iconHUDPercent = 1 - cg.iconHUDPercent;
00950 
00951                         if (cg.iconHUDPercent<0)
00952                         {
00953                                 cg.iconHUDActive = qfalse;
00954                                 cg.iconHUDPercent=0;
00955                         }
00956 
00957                         xAdd = (int) 8*cg.iconHUDPercent;
00958 
00959                         height = (int) (60.0f*cg.iconHUDPercent);
00960                         //CG_DrawPic( x2+60, y2+30+yOffset, 460, -height, drawType);    // Top half
00961                         //CG_DrawPic( x2+60, y2+30-2+yOffset, 460, height, drawType);   // Bottom half
00962 
00963                 }
00964                 else
00965                 {
00966                         xAdd = 0;
00967                 }
00968 
00969                 return;
00970         }
00971         //prongLeftX =x2+37; 
00972         //prongRightX =x2+544; 
00973 
00974         if (!cg.iconHUDActive)
00975         {
00976                 t = cg.time - cg.iconSelectTime;
00977                 cg.iconHUDPercent = t/ 130.0f;
00978 
00979                 // Calc how far into opening sequence we are
00980                 if (cg.iconHUDPercent>1)
00981                 {
00982                         cg.iconHUDActive = qtrue;
00983                         cg.iconHUDPercent=1;
00984                 }
00985                 else if (cg.iconHUDPercent<0)
00986                 {
00987                         cg.iconHUDPercent=0;
00988                 }
00989         }
00990         else
00991         {
00992                 cg.iconHUDPercent=1;
00993         }
00994 
00995         //trap_R_SetColor( colorTable[CT_WHITE] );                                      
00996         //height = (int) (60.0f*cg.iconHUDPercent);
00997         //CG_DrawPic( x2+60, y2+30+yOffset, 460, -height, drawType);    // Top half
00998         //CG_DrawPic( x2+60, y2+30-2+yOffset, 460, height, drawType);   // Bottom half
00999 
01000         // And now for the prongs
01001 /*      if ((cg.inventorySelectTime+WEAPON_SELECT_TIME)>cg.time)        
01002         {
01003                 cgs.media.currentBackground = ICON_INVENTORY;
01004                 background = &cgs.media.inventoryProngsOn;
01005         }
01006         else if ((cg.weaponSelectTime+WEAPON_SELECT_TIME)>cg.time)      
01007         {
01008                 cgs.media.currentBackground = ICON_WEAPONS;
01009         }
01010         else 
01011         {
01012                 cgs.media.currentBackground = ICON_FORCE;
01013                 background = &cgs.media.forceProngsOn;
01014         }
01015 */
01016         // Side Prongs
01017 //      trap_R_SetColor( colorTable[CT_WHITE]);                                 
01018 //      xAdd = (int) 8*cg.iconHUDPercent;
01019 //      CG_DrawPic( prongLeftX+xAdd, y2-10, 40, 80, background);
01020 //      CG_DrawPic( prongRightX-xAdd, y2-10, -40, 80, background);
01021 
01022 }

void CG_DrawInformation void   ) 
 

Definition at line 110 of file cg_info.c.

References atoi(), cg, CG_ConfigString(), CG_DrawPic(), CG_GetStringEdString(), CG_LoadBar(), cgs, colorWhite, CS_MESSAGE, CS_MOTD, CS_SERVERINFO, CS_SYSTEMINFO, forceMasteryLevels, cgs_t::gametype, GT_CTF, GT_CTY, GT_DUEL, GT_FFA, GT_HOLOCRON, GT_JEDIMASTER, GT_POWERDUEL, GT_SIEGE, GT_SINGLE_PLAYER, GT_TEAM, Info_ValueForKey(), cg_t::infoScreenText, NULL, NUM_FORCE_MASTERY_LEVELS, Q_CleanStr(), Q_strncpyz(), qhandle_t, SCREEN_HEIGHT, SCREEN_WIDTH, trap_Cvar_VariableStringBuffer(), trap_R_RegisterShaderNoMip(), trap_R_SetColor(), trap_SP_GetStringTextString(), UI_CENTER, UI_DrawProportionalString(), UI_DROPSHADOW, UI_INFOFONT, and va().

Referenced by CG_DrawActive(), and CG_DrawActiveFrame().

00110                                 {
00111         const char      *s;
00112         const char      *info;
00113         const char      *sysInfo;
00114         int                     y;
00115         int                     value, valueNOFP;
00116         qhandle_t       levelshot;
00117         char            buf[1024];
00118         int                     iPropHeight = 18;       // I know, this is total crap, but as a post release asian-hack....  -Ste
00119         
00120         info = CG_ConfigString( CS_SERVERINFO );
00121         sysInfo = CG_ConfigString( CS_SYSTEMINFO );
00122 
00123         s = Info_ValueForKey( info, "mapname" );
00124         levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );
00125         if ( !levelshot ) {
00126                 levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap_mp" );
00127         }
00128         trap_R_SetColor( NULL );
00129         CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
00130 
00131         CG_LoadBar();
00132 
00133         // draw the icons of things as they are loaded
00134 //      CG_DrawLoadingIcons();
00135 
00136         // the first 150 rows are reserved for the client connection
00137         // screen to write into
00138         if ( cg.infoScreenText[0] ) {
00139                 const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME");
00140                 UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg.infoScreenText),
00141                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );              
00142         } else {
00143                 const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT");
00144                 UI_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot,
00145                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );                      
00146         }
00147 
00148         // draw info string information
00149 
00150         y = 180-32;
00151 
00152         // don't print server lines if playing a local game
00153         trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) );
00154         if ( !atoi( buf ) ) {
00155                 // server hostname
00156                 Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024);
00157                 Q_CleanStr(buf);
00158                 UI_DrawProportionalString( 320, y, buf,
00159                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00160                 y += iPropHeight;
00161 
00162                 // pure server
00163                 s = Info_ValueForKey( sysInfo, "sv_pure" );
00164                 if ( s[0] == '1' ) {
00165                         const char *psPure = CG_GetStringEdString("MP_INGAME", "PURE_SERVER");
00166                         UI_DrawProportionalString( 320, y, psPure,
00167                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00168                         y += iPropHeight;
00169                 }
00170 
00171                 // server-specific message of the day
00172                 s = CG_ConfigString( CS_MOTD );
00173                 if ( s[0] ) {
00174                         UI_DrawProportionalString( 320, y, s,
00175                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00176                         y += iPropHeight;
00177                 }
00178 
00179                 {       // display global MOTD at bottom (mirrors ui_main UI_DrawConnectScreen
00180                         char motdString[1024];
00181                         trap_Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) );
00182 
00183                         if (motdString[0])
00184                         {
00185                                 UI_DrawProportionalString( 320, 425, motdString,
00186                                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00187                         }
00188                 }
00189 
00190                 // some extra space after hostname and motd
00191                 y += 10;
00192         }
00193 
00194         // map-specific message (long map name)
00195         s = CG_ConfigString( CS_MESSAGE );
00196         if ( s[0] ) {
00197                 UI_DrawProportionalString( 320, y, s,
00198                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00199                 y += iPropHeight;
00200         }
00201 
00202         // cheats warning
00203         s = Info_ValueForKey( sysInfo, "sv_cheats" );
00204         if ( s[0] == '1' ) {
00205                 UI_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "CHEATSAREENABLED"),
00206                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00207                 y += iPropHeight;
00208         }
00209 
00210         // game type
00211         switch ( cgs.gametype ) {
00212         case GT_FFA:
00213                         s = CG_GetStringEdString("MENUS", "FREE_FOR_ALL");//"Free For All";
00214 //              s = "Free For All";
00215                 break;
00216         case GT_HOLOCRON:
00217                         s = CG_GetStringEdString("MENUS", "HOLOCRON_FFA");//"Holocron FFA";
00218 //              s = "Holocron FFA";
00219                 break;
00220         case GT_JEDIMASTER:
00221                         s = CG_GetStringEdString("MENUS", "SAGA");//"Jedi Master";??
00222 
00223 //              s = "Jedi Master";
00224                 break;
00225         case GT_SINGLE_PLAYER:
00226                         s = CG_GetStringEdString("MENUS", "SAGA");//"Team FFA";
00227 
00228                 //s = "Single Player";
00229                 break;
00230         case GT_DUEL:
00231                         s = CG_GetStringEdString("MENUS", "DUEL");//"Team FFA";
00232                 //s = "Duel";
00233                 break;
00234         case GT_POWERDUEL:
00235                         s = CG_GetStringEdString("MENUS", "POWERDUEL");//"Team FFA";
00236                 //s = "Power Duel";
00237                 break;
00238         case GT_TEAM:
00239                         s = CG_GetStringEdString("MENUS", "TEAM_FFA");//"Team FFA";
00240 
00241                 //s = "Team FFA";
00242                 break;
00243         case GT_SIEGE:
00244                         s = CG_GetStringEdString("MENUS", "SIEGE");//"Siege";
00245 
00246                 //s = "Siege";
00247                 break;
00248         case GT_CTF:
00249                         s = CG_GetStringEdString("MENUS", "CAPTURE_THE_FLAG");//"Capture the Flag";
00250 
00251                 //s = "Capture The Flag";
00252                 break;
00253         case GT_CTY:
00254                         s = CG_GetStringEdString("MENUS", "CAPTURE_THE_YSALIMARI");//"Capture the Ysalamiri";
00255 
00256                 //s = "Capture The Ysalamiri";
00257                 break;
00258         default:
00259                         s = CG_GetStringEdString("MENUS", "SAGA");//"Team FFA";
00260 
00261                 //s = "Unknown Gametype";
00262                 break;
00263         }
00264         UI_DrawProportionalString( 320, y, s,
00265                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00266         y += iPropHeight;
00267                 
00268         if (cgs.gametype != GT_SIEGE)
00269         {
00270                 value = atoi( Info_ValueForKey( info, "timelimit" ) );
00271                 if ( value ) {
00272                         UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "TIMELIMIT"), value ),
00273                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00274                         y += iPropHeight;
00275                 }
00276 
00277                 if (cgs.gametype < GT_CTF ) {
00278                         value = atoi( Info_ValueForKey( info, "fraglimit" ) );
00279                         if ( value ) {
00280                                 UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "FRAGLIMIT"), value ),
00281                                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00282                                 y += iPropHeight;
00283                         }
00284 
00285                         if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL)
00286                         {
00287                                 value = atoi( Info_ValueForKey( info, "duel_fraglimit" ) );
00288                                 if ( value ) {
00289                                         UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "WINLIMIT"), value ),
00290                                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00291                                         y += iPropHeight;
00292                                 }
00293                         }
00294                 }
00295         }
00296 
00297         if (cgs.gametype >= GT_CTF) {
00298                 value = atoi( Info_ValueForKey( info, "capturelimit" ) );
00299                 if ( value ) {
00300                         UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "CAPTURELIMIT"), value ),
00301                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00302                         y += iPropHeight;
00303                 }
00304         }
00305 
00306         if (cgs.gametype >= GT_TEAM)
00307         {
00308                 value = atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) );
00309                 if ( value ) {
00310                         UI_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "FORCEBASEDTEAMS"),
00311                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00312                         y += iPropHeight;
00313                 }
00314         }
00315 
00316     if (cgs.gametype != GT_SIEGE)
00317         {
00318                 valueNOFP = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) );
00319 
00320                 value = atoi( Info_ValueForKey( info, "g_maxForceRank" ) );
00321                 if ( value && !valueNOFP && (value < NUM_FORCE_MASTERY_LEVELS) ) {
00322                         char fmStr[1024]; 
00323 
00324                         trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr));
00325 
00326                         UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, CG_GetStringEdString("MP_INGAME", forceMasteryLevels[value]) ),
00327                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00328                         y += iPropHeight;
00329                 }
00330                 else if (!valueNOFP)
00331                 {
00332                         char fmStr[1024];
00333                         trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr));
00334 
00335                         UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, (char *)CG_GetStringEdString("MP_INGAME", forceMasteryLevels[7]) ),
00336                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00337                         y += iPropHeight;
00338                 }
00339 
00340                 if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL)
00341                 {
00342                         value = atoi( Info_ValueForKey( info, "g_duelWeaponDisable" ) );
00343                 }
00344                 else
00345                 {
00346                         value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) );
00347                 }
00348                 if ( cgs.gametype != GT_JEDIMASTER && value ) {
00349                         UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "SABERONLYSET") ),
00350                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00351                         y += iPropHeight;
00352                 }
00353 
00354                 if ( valueNOFP ) {
00355                         UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "NOFPSET") ),
00356                                 UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00357                         y += iPropHeight;
00358                 }
00359         }
00360 
00361         // Display the rules based on type
00362                 y += iPropHeight;
00363         switch ( cgs.gametype ) {
00364         case GT_FFA:                                    
00365                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_FFA_1")),
00366                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00367                 y += iPropHeight;
00368                 break;
00369         case GT_HOLOCRON:
00370                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_1")),
00371                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00372                 y += iPropHeight;
00373                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_2")),
00374                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00375                 y += iPropHeight;
00376                 break;
00377         case GT_JEDIMASTER:
00378                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_1")),
00379                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00380                 y += iPropHeight;
00381                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_2")),
00382                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00383                 y += iPropHeight;
00384                 break;
00385         case GT_SINGLE_PLAYER:
00386                 break;
00387         case GT_DUEL:
00388                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_1")),
00389                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00390                 y += iPropHeight;
00391                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_2")),
00392                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00393                 y += iPropHeight;
00394                 break;
00395         case GT_POWERDUEL:
00396                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_1")),
00397                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00398                 y += iPropHeight;
00399                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_2")),
00400                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00401                 y += iPropHeight;
00402                 break;
00403         case GT_TEAM:
00404                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_1")),
00405                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00406                 y += iPropHeight;
00407                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_2")),
00408                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00409                 y += iPropHeight;
00410                 break;
00411         case GT_SIEGE:
00412                 break;
00413         case GT_CTF:
00414                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_1")),
00415                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00416                 y += iPropHeight;
00417                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_2")),
00418                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00419                 y += iPropHeight;
00420                 break;
00421         case GT_CTY:
00422                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_1")),
00423                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00424                 y += iPropHeight;
00425                 UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_2")),
00426                         UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite );
00427                 y += iPropHeight;
00428                 break;
00429         default:
00430                 break;
00431         }
00432 }

void CG_DrawMiscEnts void   ) 
 

Definition at line 624 of file cg_main.c.

References snapshot_t::areamask, cg, cg_t::distanceCull, refEntity_t::origin, cg_t::refdef, cg_t::snap, trap_R_AddRefEntityToScene(), trap_R_inPVS(), vec3_t, VectorCopy, VectorSubtract, and refdef_t::vieworg.

Referenced by CG_DrawActiveFrame().

00625 {
00626         int                     i;
00627         refEntity_t     *RefEnt;
00628         float           *radius, *zOff;
00629         vec3_t          difference;
00630         vec3_t          cullOrigin;
00631 
00632         RefEnt = MiscEnts;
00633         radius = Radius;
00634         zOff = zOffset;
00635         for(i=0;i<NumMiscEnts;i++)
00636         {
00637                 VectorCopy(RefEnt->origin, cullOrigin);
00638                 cullOrigin[2] += 1.0f;
00639 
00640                 if (*zOff)
00641                 {
00642                         cullOrigin[2] += *zOff;
00643                 }
00644 
00645                 if (cg.snap && trap_R_inPVS(cg.refdef.vieworg, cullOrigin, cg.snap->areamask))
00646                 {
00647                         VectorSubtract(RefEnt->origin, cg.refdef.vieworg, difference);
00648                         if (VectorLength(difference)-(*radius) <= cg.distanceCull)
00649                         {
00650                                 trap_R_AddRefEntityToScene(RefEnt);
00651                         }
00652                 }
00653                 RefEnt++;
00654                 radius++;
00655                 zOff++;
00656         }
00657 }

void CG_DrawNumField int  x,
int  y,
int  width,
int  value,
int  charWidth,
int  charHeight,
int  style,
qboolean  zeroFill
 

Definition at line 491 of file cg_drawtools.c.

References CG_DrawPic(), cgs, cgMedia_t::chunkyNumberShaders, Com_sprintf(), cgs_t::media, NUM_FONT_BIG, NUM_FONT_CHUNKY, NUM_FONT_SMALL, cgMedia_t::numberShaders, cgMedia_t::smallnumberShaders, STAT_MINUS, and strlen().

Referenced by CG_DrawArmor(), CG_DrawForcePower(), and CG_DrawHealth().

00492 {
00493         char    num[16], *ptr;
00494         int             l;
00495         int             frame;
00496         int             xWidth;
00497         int             i = 0;
00498 
00499         if (width < 1) {
00500                 return;
00501         }
00502 
00503         // draw number string
00504         if (width > 5) {
00505                 width = 5;
00506         }
00507 
00508         switch ( width ) {
00509         case 1:
00510                 value = value > 9 ? 9 : value;
00511                 value = value < 0 ? 0 : value;
00512                 break;
00513         case 2:
00514                 value = value > 99 ? 99 : value;
00515                 value = value < -9 ? -9 : value;
00516                 break;
00517         case 3:
00518                 value = value > 999 ? 999 : value;
00519                 value = value < -99 ? -99 : value;
00520                 break;
00521         case 4:
00522                 value = value > 9999 ? 9999 : value;
00523                 value = value < -999 ? -999 : value;
00524                 break;
00525         }
00526 
00527         Com_sprintf (num, sizeof(num), "%i", value);
00528         l = strlen(num);
00529         if (l > width)
00530                 l = width;
00531 
00532         // FIXME: Might need to do something different for the chunky font??
00533         switch(style)
00534         {
00535         case NUM_FONT_SMALL:
00536                 xWidth = charWidth;
00537                 break;
00538         case NUM_FONT_CHUNKY:
00539                 xWidth = (charWidth/1.2f) + 2;
00540                 break;
00541         default:
00542         case NUM_FONT_BIG:
00543                 xWidth = (charWidth/2) + 7;//(charWidth/6);
00544                 break;
00545         }
00546 
00547         if ( zeroFill )
00548         {
00549                 for (i = 0; i < (width - l); i++ )
00550                 {
00551                         switch(style)
00552                         {
00553                         case NUM_FONT_SMALL:
00554                                 CG_DrawPic( x,y, charWidth, charHeight, cgs.media.smallnumberShaders[0] );
00555                                 break;
00556                         case NUM_FONT_CHUNKY:
00557                                 CG_DrawPic( x,y, charWidth, charHeight, cgs.media.chunkyNumberShaders[0] );
00558                                 break;
00559                         default:
00560                         case NUM_FONT_BIG:
00561                                 CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[0] );
00562                                 break;
00563                         }
00564                         x += 2 + (xWidth);
00565                 }
00566         }
00567         else
00568         {
00569                 x += 2 + (xWidth)*(width - l);
00570         }
00571 
00572         ptr = num;
00573         while (*ptr && l)
00574         {
00575                 if (*ptr == '-')
00576                         frame = STAT_MINUS;
00577                 else
00578                         frame = *ptr -'0';
00579 
00580                 switch(style)
00581                 {
00582                 case NUM_FONT_SMALL:
00583                         CG_DrawPic( x,y, charWidth, charHeight, cgs.media.smallnumberShaders[frame] );
00584                         x++;    // For a one line gap
00585                         break;
00586                 case NUM_FONT_CHUNKY:
00587                         CG_DrawPic( x,y, charWidth, charHeight, cgs.media.chunkyNumberShaders[frame] );
00588                         break;
00589                 default:
00590                 case NUM_FONT_BIG:
00591                         CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[frame] );
00592                         break;
00593                 }
00594 
00595                 x += (xWidth);
00596                 ptr++;
00597                 l--;
00598         }
00599 
00600 }

qboolean CG_DrawOldScoreboard void   ) 
 

Definition at line 345 of file cg_scoreboard.c.

References BIGCHAR_HEIGHT, BIGCHAR_WIDTH, cg, CG_DrawPic(), CG_DrawStrlen(), CG_DrawTeamBackground(), CG_FadeColor(), CG_GetStringEdString(), CG_GetTeamCount(), CG_LoadDeferredPlayers(), cg_paused, CG_PlaceString(), cg_siegeWinTeam, CG_Text_Paint(), CG_Text_Width(), cgs, score_t::client, cgs_t::clientinfo, playerState_s::clientNum, colorTable, colorWhite, CT_WHITE, cg_t::deferredPlayerLoading, cgs_t::duelist1, cgs_t::duelist2, cgs_t::duelist3, cgs_t::duelWinner, FADE_TIME, FONT_MEDIUM, cgs_t::gametype, GT_DUEL, GT_POWERDUEL, GT_SIEGE, GT_TEAM, vmCvar_t::integer, ITEM_TEXTSTYLE_OUTLINED, cg_t::killerName, cg_t::numScores, PERS_RANK, PERS_SCORE, PERS_TEAM, playerState_s::persistant, PM_DEAD, PM_INTERMISSION, playerState_s::pm_type, cg_t::predictedPlayerState, snapshot_t::ps, qboolean, qfalse, qtrue, SB_HEADER, SB_INTER_HEIGHT, SB_MAXCLIENTS_INTER, SB_MAXCLIENTS_NORMAL, SB_NAME_X, SB_NORMAL_HEIGHT, SB_PING_X, SB_SCORE_X, SB_SCORELINE_WIDTH, SB_SCORELINE_X, SB_TIME_X, SB_TOP, cg_t::scoreFadeTime, cg_t::scores, SCREEN_WIDTH, cg_t::showScores, cg_t::snap, TEAM_BLUE, TEAM_FREE, TEAM_RED, TEAM_SPECTATOR, cg_t::teamScores, trap_R_RegisterShaderNoMip(), trap_SP_GetStringTextString(), UI_CENTER, UI_DrawProportionalString(), UI_DROPSHADOW, va(), and cg_t::warmup.

00345                                       {
00346         int             x, y, w, i, n1, n2;
00347         float   fade;
00348         float   *fadeColor;
00349         char    *s;
00350         int maxClients;
00351         int lineHeight;
00352         int topBorderSize, bottomBorderSize;
00353 
00354         // don't draw amuthing if the menu or console is up
00355         if ( cg_paused.integer ) {
00356                 cg.deferredPlayerLoading = 0;
00357                 return qfalse;
00358         }
00359 
00360         // don't draw scoreboard during death while warmup up
00361         if ( cg.warmup && !cg.showScores ) {
00362                 return qfalse;
00363         }
00364 
00365         if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD ||
00366                  cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
00367                 fade = 1.0;
00368                 fadeColor = colorWhite;
00369         } else {
00370                 fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME );
00371                 
00372                 if ( !fadeColor ) {
00373                         // next time scoreboard comes up, don't print killer
00374                         cg.deferredPlayerLoading = 0;
00375                         cg.killerName[0] = 0;
00376                         return qfalse;
00377                 }
00378                 fade = *fadeColor;
00379         }
00380 
00381         // fragged by ... line
00382         // or if in intermission and duel, prints the winner of the duel round
00383         if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelWinner != -1 &&
00384                 cg.predictedPlayerState.pm_type == PM_INTERMISSION)
00385         {
00386                 s = va("%s^7 %s", cgs.clientinfo[cgs.duelWinner].name, CG_GetStringEdString("MP_INGAME", "DUEL_WINS") );
00387                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00388                 x = ( SCREEN_WIDTH - w ) / 2;
00389                 y = 40;
00390                 CG_DrawBigString( x, y, s, fade );
00391                 */
00392                 x = ( SCREEN_WIDTH ) / 2;
00393                 y = 40;
00394                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00395         }
00396         else if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelist1 != -1 && cgs.duelist2 != -1 &&
00397                 cg.predictedPlayerState.pm_type == PM_INTERMISSION)
00398         {
00399                 if (cgs.gametype == GT_POWERDUEL && cgs.duelist3 != -1)
00400                 {
00401                         s = va("%s^7 %s %s^7 %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString("MP_INGAME", "SPECHUD_VERSUS"), cgs.clientinfo[cgs.duelist2].name, CG_GetStringEdString("MP_INGAME", "AND"), cgs.clientinfo[cgs.duelist3].name );
00402                 }
00403                 else
00404                 {
00405                         s = va("%s^7 %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString("MP_INGAME", "SPECHUD_VERSUS"), cgs.clientinfo[cgs.duelist2].name );
00406                 }
00407                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00408                 x = ( SCREEN_WIDTH - w ) / 2;
00409                 y = 40;
00410                 CG_DrawBigString( x, y, s, fade );
00411                 */
00412                 x = ( SCREEN_WIDTH ) / 2;
00413                 y = 40;
00414                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00415         }
00416         else if ( cg.killerName[0] ) {
00417                 s = va("%s %s", CG_GetStringEdString("MP_INGAME", "KILLEDBY"), cg.killerName );
00418                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00419                 x = ( SCREEN_WIDTH - w ) / 2;
00420                 y = 40;
00421                 CG_DrawBigString( x, y, s, fade );
00422                 */
00423                 x = ( SCREEN_WIDTH ) / 2;
00424                 y = 40;
00425                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00426         }
00427 
00428         // current rank
00429         if (cgs.gametype == GT_POWERDUEL)
00430         { //do nothing?
00431         }
00432         else if ( cgs.gametype < GT_TEAM) {
00433                 if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) 
00434                 {
00435                         char sPlace[256];
00436                         char sOf[256];
00437                         char sWith[256];
00438 
00439                         trap_SP_GetStringTextString("MP_INGAME_PLACE",  sPlace, sizeof(sPlace));
00440                         trap_SP_GetStringTextString("MP_INGAME_OF",             sOf,    sizeof(sOf));
00441                         trap_SP_GetStringTextString("MP_INGAME_WITH",   sWith,  sizeof(sWith));
00442 
00443                         s = va("%s %s (%s %i) %s %i",
00444                                 CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ),
00445                                 sPlace,
00446                                 sOf,
00447                                 cg.numScores,
00448                                 sWith,
00449                                 cg.snap->ps.persistant[PERS_SCORE] );
00450                         w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00451                         x = ( SCREEN_WIDTH ) / 2;
00452                         y = 60;
00453                         //CG_DrawBigString( x, y, s, fade );
00454                         UI_DrawProportionalString(x, y, s, UI_CENTER|UI_DROPSHADOW, colorTable[CT_WHITE]);
00455                 }
00456         }
00457         else if (cgs.gametype != GT_SIEGE)
00458         {
00459                 if ( cg.teamScores[0] == cg.teamScores[1] ) {
00460                         s = va("%s %i", CG_GetStringEdString("MP_INGAME", "TIEDAT"), cg.teamScores[0] );
00461                 } else if ( cg.teamScores[0] >= cg.teamScores[1] ) {
00462                         s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "RED_LEADS"), cg.teamScores[0], cg.teamScores[1] );
00463                 } else {
00464                         s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "BLUE_LEADS"), cg.teamScores[1], cg.teamScores[0] );
00465                 }
00466 
00467                 x = ( SCREEN_WIDTH ) / 2;
00468                 y = 60;
00469                 
00470                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00471         }
00472         else if (cgs.gametype == GT_SIEGE && (cg_siegeWinTeam == 1 || cg_siegeWinTeam == 2))
00473         {
00474                 if (cg_siegeWinTeam == 1)
00475                 {
00476                         s = va("%s", CG_GetStringEdString("MP_INGAME", "SIEGETEAM1WIN") );
00477                 }
00478                 else
00479                 {
00480                         s = va("%s", CG_GetStringEdString("MP_INGAME", "SIEGETEAM2WIN") );
00481                 }
00482 
00483                 x = ( SCREEN_WIDTH ) / 2;
00484                 y = 60;
00485                 
00486                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00487         }
00488 
00489         // scoreboard
00490         y = SB_HEADER;
00491 
00492         CG_DrawPic ( SB_SCORELINE_X - 40, y - 5, SB_SCORELINE_WIDTH + 80, 40, trap_R_RegisterShaderNoMip ( "gfx/menus/menu_buttonback.tga" ) );
00493 
00494         CG_Text_Paint ( SB_NAME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "NAME"),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00495         if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL)
00496         {
00497                 char sWL[100];
00498                 trap_SP_GetStringTextString("MP_INGAME_W_L", sWL,       sizeof(sWL));
00499 
00500                 CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, sWL, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00501         }
00502         else
00503         {
00504                 CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "SCORE"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00505         }
00506         CG_Text_Paint ( SB_PING_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "PING"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00507         CG_Text_Paint ( SB_TIME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "TIME"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00508 
00509         y = SB_TOP;
00510 
00511         // If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores
00512         if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) {
00513                 maxClients = SB_MAXCLIENTS_INTER;
00514                 lineHeight = SB_INTER_HEIGHT;
00515                 topBorderSize = 8;
00516                 bottomBorderSize = 16;
00517         } else {
00518                 maxClients = SB_MAXCLIENTS_NORMAL;
00519                 lineHeight = SB_NORMAL_HEIGHT;
00520                 topBorderSize = 8;
00521                 bottomBorderSize = 8;
00522         }
00523 
00524         localClient = qfalse;
00525 
00526 
00527         //I guess this should end up being able to display 19 clients at once.
00528         //In a team game, if there are 9 or more clients on the team not in the lead,
00529         //we only want to show 10 of the clients on the team in the lead, so that we
00530         //have room to display the clients in the lead on the losing team.
00531 
00532         //I guess this can be accomplished simply by printing the first teams score with a maxClients
00533         //value passed in related to how many players are on both teams.
00534         if ( cgs.gametype >= GT_TEAM ) {
00535                 //
00536                 // teamplay scoreboard
00537                 //
00538                 y += lineHeight/2;
00539 
00540                 if ( cg.teamScores[0] >= cg.teamScores[1] ) {
00541                         int team1MaxCl = CG_GetTeamCount(TEAM_RED, maxClients);
00542                         int team2MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients);
00543 
00544                         if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients)
00545                         {
00546                                 team1MaxCl -= team2MaxCl;
00547                                 //subtract as many as you have to down to 10, once we get there
00548                                 //we just set it to 10
00549 
00550                                 if (team1MaxCl < 10)
00551                                 {
00552                                         team1MaxCl = 10;
00553                                 }
00554                         }
00555 
00556                         team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display
00557 
00558                         n1 = CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qtrue );
00559                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED );
00560                         CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qfalse );
00561                         y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00562 
00563                         //maxClients -= n1;
00564 
00565                         n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qtrue );
00566                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE );
00567                         CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qfalse );
00568                         y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00569 
00570                         //maxClients -= n2;
00571 
00572                         maxClients -= (team1MaxCl+team2MaxCl);
00573                 } else {
00574                         int team1MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients);
00575                         int team2MaxCl = CG_GetTeamCount(TEAM_RED, maxClients);
00576 
00577                         if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients)
00578                         {
00579                                 team1MaxCl -= team2MaxCl;
00580                                 //subtract as many as you have to down to 10, once we get there
00581                                 //we just set it to 10
00582 
00583                                 if (team1MaxCl < 10)
00584                                 {
00585                                         team1MaxCl = 10;
00586                                 }
00587                         }
00588 
00589                         team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display
00590 
00591                         n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qtrue );
00592                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE );
00593                         CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qfalse );
00594                         y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00595 
00596                         //maxClients -= n1;
00597 
00598                         n2 = CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qtrue );
00599                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED );
00600                         CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qfalse );
00601                         y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00602 
00603                         //maxClients -= n2;
00604 
00605                         maxClients -= (team1MaxCl+team2MaxCl);
00606                 }
00607                 n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight, qfalse );
00608                 y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00609 
00610         } else {
00611                 //
00612                 // free for all scoreboard
00613                 //
00614                 n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight, qfalse );
00615                 y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00616                 n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight, qfalse );
00617                 y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00618         }
00619 
00620         if (!localClient) {
00621                 // draw local client at the bottom
00622                 for ( i = 0 ; i < cg.numScores ; i++ ) {
00623                         if ( cg.scores[i].client == cg.snap->ps.clientNum ) {
00624                                 CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT );
00625                                 break;
00626                         }
00627                 }
00628         }
00629 
00630         // load any models that have been deferred
00631         if ( ++cg.deferredPlayerLoading > 10 ) {
00632                 CG_LoadDeferredPlayers();
00633         }
00634 
00635         return qtrue;
00636 }

void CG_DrawOldTourneyScoreboard void   ) 
 

void CG_DrawPic float  x,
float  y,
float  width,
float  height,
qhandle_t  hShader
 

Definition at line 133 of file cg_drawtools.c.

References qhandle_t, and trap_R_DrawStretchPic().

Referenced by CG_BracketEntity(), CG_DottedLine(), CG_DrawArmor(), CG_DrawAutoMap(), CG_DrawFlagModel(), CG_DrawFlagStatus(), CG_DrawForcePower(), CG_DrawForceSelect(), CG_DrawHaqrBar(), CG_DrawHead(), CG_DrawHealth(), CG_DrawHUD(), CG_DrawInformation(), CG_DrawInvenSelect(), CG_DrawMedal(), CG_DrawNewTeamInfo(), CG_DrawNumField(), CG_DrawOldScoreboard(), CG_DrawRadar(), CG_DrawVehicleAmmo(), CG_DrawVehicleAmmoLower(), CG_DrawVehicleAmmoUpper(), CG_DrawVehicleArmor(), CG_DrawVehicleDamage(), CG_DrawVehicleDamageHUD(), CG_DrawVehicleHud(), CG_DrawVehicleShields(), CG_DrawVehicleSpeed(), CG_DrawVehicleTurboRecharge(), CG_DrawVehicleWeaponsLinked(), CG_DrawWeaponSelect(), CG_LoadBar(), CG_LoadHudMenu(), and CG_SaberClashFlare().

00133                                                                                   {
00134         trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
00135 }

void CG_DrawRect float  x,
float  y,
float  width,
float  height,
float  size,
const float *  color
 

Definition at line 24 of file cg_drawtools.c.

References CG_DrawSides(), CG_DrawTopBottom(), NULL, and trap_R_SetColor().

Referenced by CG_DrawCloakFuel(), CG_DrawEWebHealth(), CG_DrawGenericTimerBar(), CG_DrawHaqrBar(), CG_DrawHealthBar(), CG_DrawHealthBarRough(), CG_DrawJetpackFuel(), CG_DrawSiegeInfo(), and CG_LoadHudMenu().

00024                                                                                                 {
00025         trap_R_SetColor( color );
00026         
00027         CG_DrawTopBottom(x, y, width, height, size);
00028         CG_DrawSides(x, y, width, height, size);
00029         
00030         trap_R_SetColor( NULL );
00031 }

void CG_DrawRotatePic float  x,
float  y,
float  width,
float  height,
float  angle,
qhandle_t  hShader
 

Definition at line 146 of file cg_drawtools.c.

References qhandle_t, and trap_R_DrawRotatePic().

00146                                                                                                     {
00147         trap_R_DrawRotatePic( x, y, width, height, 0, 0, 1, 1, angle, hShader );
00148 }

void CG_DrawRotatePic2 float  x,
float  y,
float  width,
float  height,
float  angle,
qhandle_t  hShader
 

Definition at line 159 of file cg_drawtools.c.

References qhandle_t, and trap_R_DrawRotatePic2().

Referenced by CG_DrawRadar().

00159                                                                                                      {
00160         trap_R_DrawRotatePic2( x, y, width, height, 0, 0, 1, 1, angle, hShader );
00161 }

void CG_DrawSides float  x,
float  y,
float  w,
float  h,
float  size
 

Definition at line 85 of file cg_drawtools.c.

References cgs, cgs_t::media, cgs_t::screenXScale, trap_R_DrawStretchPic(), and cgMedia_t::whiteShader.

Referenced by CG_DrawRect(), and CG_LoadHudMenu().

00085                                                                   {
00086         size *= cgs.screenXScale;
00087         trap_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
00088         trap_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
00089 }

void CG_DrawSmallString int  x,
int  y,
const char *  s,
float  alpha
 

Definition at line 288 of file cg_drawtools.c.

References CG_DrawStringExt(), qfalse, SMALLCHAR_HEIGHT, and SMALLCHAR_WIDTH.

00288                                                                     {
00289         float   color[4];
00290 
00291         color[0] = color[1] = color[2] = 1.0;
00292         color[3] = alpha;
00293         CG_DrawStringExt( x, y, s, color, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 );
00294 }

void CG_DrawSmallStringColor int  x,
int  y,
const char *  s,
vec4_t  color
 

Definition at line 296 of file cg_drawtools.c.

References CG_DrawStringExt(), qfalse, qtrue, SMALLCHAR_HEIGHT, SMALLCHAR_WIDTH, and vec4_t.

00296                                                                           {
00297         CG_DrawStringExt( x, y, s, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 );
00298 }

void CG_DrawString float  x,
float  y,
const char *  string,
float  charWidth,
float  charHeight,
const float *  modulate
 

void CG_DrawStringExt int  x,
int  y,
const char *  string,
const float *  setColor,
qboolean  forceColor,
qboolean  shadow,
int  charWidth,
int  charHeight,
int  maxChars
 

Definition at line 212 of file cg_drawtools.c.

References CG_DrawChar(), CG_Text_Paint(), ColorIndex, FONT_MEDIUM, g_color_table, ITEM_TEXTSTYLE_SHADOWED, memcpy(), NULL, Q_IsColorString, trap_Language_IsAsian(), trap_R_SetColor(), and vec4_t.

Referenced by CG_DrawBigString(), CG_DrawBigStringColor(), CG_DrawSmallString(), and CG_DrawSmallStringColor().

00214 {
00215         if (trap_Language_IsAsian())
00216         {
00217                 // hack-a-doodle-do (post-release quick fix code)...
00218                 //
00219                 vec4_t color;
00220                 memcpy(color,setColor, sizeof(color));  // de-const it
00221                 CG_Text_Paint(x, y, 1.0f,       // float scale, 
00222                                                 color,          // vec4_t color, 
00223                                                 string,         // const char *text, 
00224                                                 0.0f,           // float adjust, 
00225                                                 0,                      // int limit, 
00226                                                 shadow ? ITEM_TEXTSTYLE_SHADOWED : 0,   // int style, 
00227                                                 FONT_MEDIUM             // iMenuFont
00228                                                 ) ;
00229         }
00230         else
00231         {
00232                 vec4_t          color;
00233                 const char      *s;
00234                 int                     xx;
00235 
00236                 // draw the drop shadow
00237                 if (shadow) {
00238                         color[0] = color[1] = color[2] = 0;
00239                         color[3] = setColor[3];
00240                         trap_R_SetColor( color );
00241                         s = string;
00242                         xx = x;
00243                         while ( *s ) {
00244                                 if ( Q_IsColorString( s ) ) {
00245                                         s += 2;
00246                                         continue;
00247                                 }
00248                                 CG_DrawChar( xx + 2, y + 2, charWidth, charHeight, *s );
00249                                 xx += charWidth;
00250                                 s++;
00251                         }
00252                 }
00253 
00254                 // draw the colored text
00255                 s = string;
00256                 xx = x;
00257                 trap_R_SetColor( setColor );
00258                 while ( *s ) {
00259                         if ( Q_IsColorString( s ) ) {
00260                                 if ( !forceColor ) {
00261                                         memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
00262                                         color[3] = setColor[3];
00263                                         trap_R_SetColor( color );
00264                                 }
00265                                 s += 2;
00266                                 continue;
00267                         }
00268                         CG_DrawChar( xx, y, charWidth, charHeight, *s );
00269                         xx += charWidth;
00270                         s++;
00271                 }
00272                 trap_R_SetColor( NULL );
00273         }
00274 }

int CG_DrawStrlen const char *  str  ) 
 

Definition at line 307 of file cg_drawtools.c.

References Q_IsColorString.

Referenced by CG_DrawOldScoreboard().

00307                                      {
00308         const char *s = str;
00309         int count = 0;
00310 
00311         while ( *s ) {
00312                 if ( Q_IsColorString( s ) ) {
00313                         s += 2;
00314                 } else {
00315                         count++;
00316                         s++;
00317                 }
00318         }
00319 
00320         return count;
00321 }

void CG_DrawTeamBackground int  x,
int  y,
int  w,
int  h,
float  alpha,
int  team
 

Definition at line 2776 of file cg_draw.c.

References CG_FillRect(), NULL, TEAM_BLUE, TEAM_RED, trap_R_SetColor(), and vec4_t.

Referenced by CG_DrawOldScoreboard().

02777 {
02778         vec4_t          hcolor;
02779 
02780         hcolor[3] = alpha;
02781         if ( team == TEAM_RED ) {
02782                 hcolor[0] = 1;
02783                 hcolor[1] = .2f;
02784                 hcolor[2] = .2f;
02785         } else if ( team == TEAM_BLUE ) {
02786                 hcolor[0] = .2f;
02787                 hcolor[1] = .2f;
02788                 hcolor[2] = 1;
02789         } else {
02790                 return;
02791         }
02792 //      trap_R_SetColor( hcolor );
02793 
02794         CG_FillRect ( x, y, w, h, hcolor );
02795 //      CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
02796         trap_R_SetColor( NULL );
02797 }

void CG_DrawTopBottom float  x,
float  y,
float  w,
float  h,
float  size
 

Definition at line 91 of file cg_drawtools.c.

References cgs, cgs_t::media, cgs_t::screenYScale, trap_R_DrawStretchPic(), and cgMedia_t::whiteShader.

Referenced by CG_DrawRect(), and CG_LoadHudMenu().

00091                                                                       {
00092         size *= cgs.screenYScale;
00093         trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
00094         trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
00095 }

void CG_DrawWeaponSelect void   ) 
 

Definition at line 1076 of file cg_weapons.c.

References cg, CG_DrawPic(), CG_RegisterWeapon(), CG_WeaponCheck(), cg_weapons, cgs, colorTable, CT_WHITE, playerState_s::emplacedIndex, cg_t::iconHUDPercent, cg_t::itemPickupTime, LAST_USEABLE_WEAPON, cgs_t::media, NULL, cg_t::predictedPlayerState, Q_strupr(), qboolean, qfalse, qtrue, STAT_HEALTH, STAT_WEAPONS, playerState_s::stats, strcpy(), cg_t::time, trap_R_SetColor(), trap_SP_GetStringTextString(), UI_CENTER, UI_DrawProportionalString(), UI_SMALLFONT, va(), vec4_t, WEAPON_SELECT_TIME, cgMedia_t::weaponIcons, cgMedia_t::weaponIcons_NA, weaponInfo_t, cg_t::weaponSelect, cg_t::weaponSelectTime, WP_CONCUSSION, WP_FLECHETTE, WP_NUM_WEAPONS, WP_ROCKET_LAUNCHER, WP_THERMAL, and WP_TRIP_MINE.

01076                                  {
01077         int                             i;
01078         int                             bits;
01079         int                             count;
01080         int                             smallIconSize,bigIconSize;
01081         int                             holdX,x,y,pad;
01082         int                             sideLeftIconCnt,sideRightIconCnt;
01083         int                             sideMax,holdCount,iconCnt;
01084         int                             height;
01085         int             yOffset = 0;
01086         qboolean drewConc = qfalse;
01087 
01088         if (cg.predictedPlayerState.emplacedIndex)
01089         { //can't cycle when on a weapon
01090                 cg.weaponSelectTime = 0;
01091         }
01092 
01093         if ((cg.weaponSelectTime+WEAPON_SELECT_TIME)<cg.time)   // Time is up for the HUD to display
01094         {
01095                 return;
01096         }
01097 
01098         // don't display if dead
01099         if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) 
01100         {
01101                 return;
01102         }
01103 
01104 #ifdef _XBOX
01105         if(CL_ExtendSelectTime()) {
01106                 cg.weaponSelectTime = cg.time;
01107         }
01108 
01109         yOffset = -50;
01110 #endif
01111 
01112         // showing weapon select clears pickup item display, but not the blend blob
01113         cg.itemPickupTime = 0;
01114 
01115         bits = cg.predictedPlayerState.stats[ STAT_WEAPONS ];
01116 
01117         // count the number of weapons owned
01118         count = 0;
01119 
01120         if ( !CG_WeaponSelectable(cg.weaponSelect) &&
01121                 (cg.weaponSelect == WP_THERMAL || cg.weaponSelect == WP_TRIP_MINE) )
01122         { //display this weapon that we don't actually "have" as unhighlighted until it's deselected
01123           //since it's selected we must increase the count to display the proper number of valid selectable weapons
01124                 count++;
01125         }
01126 
01127         for ( i = 1 ; i < WP_NUM_WEAPONS ; i++ ) 
01128         {
01129                 if ( bits & ( 1 << i ) ) 
01130                 {
01131                         if ( CG_WeaponSelectable(i) ||
01132                                 (i != WP_THERMAL && i != WP_TRIP_MINE) )
01133                         {
01134                                 count++;
01135                         }
01136                 }
01137         }
01138 
01139         if (count == 0) // If no weapons, don't display
01140         {
01141                 return;
01142         }
01143 
01144         sideMax = 3;    // Max number of icons on the side
01145 
01146         // Calculate how many icons will appear to either side of the center one
01147         holdCount = count - 1;  // -1 for the center icon
01148         if (holdCount == 0)                     // No icons to either side
01149         {
01150                 sideLeftIconCnt = 0;
01151                 sideRightIconCnt = 0;
01152         }
01153         else if (count > (2*sideMax))   // Go to the max on each side
01154         {
01155                 sideLeftIconCnt = sideMax;
01156                 sideRightIconCnt = sideMax;
01157         }
01158         else                                                    // Less than max, so do the calc
01159         {
01160                 sideLeftIconCnt = holdCount/2;
01161                 sideRightIconCnt = holdCount - sideLeftIconCnt;
01162         }
01163 
01164         if ( cg.weaponSelect == WP_CONCUSSION )
01165         {
01166                 i = WP_FLECHETTE;
01167         }
01168         else
01169         {
01170                 i = cg.weaponSelect - 1;
01171         }
01172         if (i<1)
01173         {
01174                 i = LAST_USEABLE_WEAPON;
01175         }
01176 
01177         smallIconSize = 40;
01178         bigIconSize = 80;
01179         pad = 12;
01180 
01181         x = 320;
01182         y = 410;
01183 
01184         // Background
01185 //      memcpy(calcColor, colorTable[CT_WHITE], sizeof(vec4_t));
01186 //      calcColor[3] = .35f;
01187 //      trap_R_SetColor( calcColor);                                    
01188 
01189         // Left side ICONS
01190         trap_R_SetColor(colorTable[CT_WHITE]);
01191         // Work backwards from current icon
01192         holdX = x - ((bigIconSize/2) + pad + smallIconSize);
01193         height = smallIconSize * 1;//cg.iconHUDPercent;
01194         drewConc = qfalse;
01195 
01196         for (iconCnt=1;iconCnt<(sideLeftIconCnt+1);i--)
01197         {
01198                 if ( i == WP_CONCUSSION )
01199                 {
01200                         i--;
01201                 }
01202                 else if ( i == WP_FLECHETTE && !drewConc && cg.weaponSelect != WP_CONCUSSION )
01203                 {
01204                         i = WP_CONCUSSION;
01205                 }
01206                 if (i<1)
01207                 {
01208                         //i = 13;
01209                         //...don't ever do this.
01210                         i = LAST_USEABLE_WEAPON;
01211                 }
01212 
01213                 if ( !(bits & ( 1 << i )))      // Does he have this weapon?
01214                 {
01215                         if ( i == WP_CONCUSSION )
01216                         {
01217                                 drewConc = qtrue;
01218                                 i = WP_ROCKET_LAUNCHER;
01219                         }
01220                         continue;
01221                 }
01222 
01223                 if ( !CG_WeaponSelectable(i) &&
01224                         (i == WP_THERMAL || i == WP_TRIP_MINE) )
01225                 { //Don't show thermal and tripmine when out of them
01226                         continue;
01227                 }
01228 
01229                 ++iconCnt;                                      // Good icon
01230 
01231                 if (cgs.media.weaponIcons[i])
01232                 {
01233                         weaponInfo_t    *weaponInfo;
01234                         CG_RegisterWeapon( i ); 
01235                         weaponInfo = &cg_weapons[i];
01236 
01237                         trap_R_SetColor(colorTable[CT_WHITE]);
01238                         if (!CG_WeaponCheck(i))
01239                         {
01240                                 CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, /*weaponInfo->weaponIconNoAmmo*/cgs.media.weaponIcons_NA[i] );
01241                         }
01242                         else
01243                         {
01244                                 CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, /*weaponInfo->weaponIcon*/cgs.media.weaponIcons[i] );
01245                         }
01246 
01247                         holdX -= (smallIconSize+pad);
01248                 }
01249                 if ( i == WP_CONCUSSION )
01250                 {
01251                         drewConc = qtrue;
01252                         i = WP_ROCKET_LAUNCHER;
01253                 }
01254         }
01255 
01256         // Current Center Icon
01257         height = bigIconSize * cg.iconHUDPercent;
01258         if (cgs.media.weaponIcons[cg.weaponSelect])
01259         {
01260                 weaponInfo_t    *weaponInfo;
01261                 CG_RegisterWeapon( cg.weaponSelect );   
01262                 weaponInfo = &cg_weapons[cg.weaponSelect];
01263 
01264                 trap_R_SetColor( colorTable[CT_WHITE]);
01265                 if (!CG_WeaponCheck(cg.weaponSelect))
01266                 {
01267                         CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10+yOffset, bigIconSize, bigIconSize, cgs.media.weaponIcons_NA[cg.weaponSelect] );
01268                 }
01269                 else
01270                 {
01271                         CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10+yOffset, bigIconSize, bigIconSize, cgs.media.weaponIcons[cg.weaponSelect] );
01272                 }
01273         }
01274 
01275         if ( cg.weaponSelect == WP_CONCUSSION )
01276         {
01277                 i = WP_ROCKET_LAUNCHER;
01278         }
01279         else
01280         {
01281                 i = cg.weaponSelect + 1;
01282         }
01283         if (i> LAST_USEABLE_WEAPON)
01284         {
01285                 i = 1;
01286         }
01287 
01288         // Right side ICONS
01289         // Work forwards from current icon
01290         holdX = x + (bigIconSize/2) + pad;
01291         height = smallIconSize * cg.iconHUDPercent;
01292         for (iconCnt=1;iconCnt<(sideRightIconCnt+1);i++)
01293         {
01294                 if ( i == WP_CONCUSSION )
01295                 {
01296                         i++;
01297                 }
01298                 else if ( i == WP_ROCKET_LAUNCHER && !drewConc && cg.weaponSelect != WP_CONCUSSION )
01299                 {
01300                         i = WP_CONCUSSION;
01301                 }
01302                 if (i>LAST_USEABLE_WEAPON)
01303                 {
01304                         i = 1;
01305                 }
01306 
01307                 if ( !(bits & ( 1 << i )))      // Does he have this weapon?
01308                 {
01309                         if ( i == WP_CONCUSSION )
01310                         {
01311                                 drewConc = qtrue;
01312                                 i = WP_FLECHETTE;
01313                         }
01314                         continue;
01315                 }
01316 
01317                 if ( !CG_WeaponSelectable(i) &&
01318                         (i == WP_THERMAL || i == WP_TRIP_MINE) )
01319                 { //Don't show thermal and tripmine when out of them
01320                         continue;
01321                 }
01322 
01323                 ++iconCnt;                                      // Good icon
01324 
01325                 if (/*weaponData[i].weaponIcon[0]*/cgs.media.weaponIcons[i])
01326                 {
01327                         weaponInfo_t    *weaponInfo;
01328                         CG_RegisterWeapon( i ); 
01329                         weaponInfo = &cg_weapons[i];
01330                         // No ammo for this weapon?
01331                         trap_R_SetColor( colorTable[CT_WHITE]);
01332                         if (!CG_WeaponCheck(i))
01333                         {
01334                                 CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, cgs.media.weaponIcons_NA[i] );
01335                         }
01336                         else
01337                         {
01338                                 CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, cgs.media.weaponIcons[i] );
01339                         }
01340 
01341 
01342                         holdX += (smallIconSize+pad);
01343                 }
01344                 if ( i == WP_CONCUSSION )
01345                 {
01346                         drewConc = qtrue;
01347                         i = WP_FLECHETTE;
01348                 }
01349         }
01350 
01351         // draw the selected name
01352         if ( cg_weapons[ cg.weaponSelect ].item ) 
01353         {
01354                 vec4_t                  textColor = { .875f, .718f, .121f, 1.0f };
01355                 char    text[1024];
01356                 char    upperKey[1024];
01357 
01358                 strcpy(upperKey, cg_weapons[ cg.weaponSelect ].item->classname);
01359 
01360                 if ( trap_SP_GetStringTextString( va("SP_INGAME_%s",Q_strupr(upperKey)), text, sizeof( text )))
01361                 {
01362                         UI_DrawProportionalString(320, y+45+yOffset, text, UI_CENTER|UI_SMALLFONT, textColor);
01363                 }
01364                 else
01365                 {
01366                         UI_DrawProportionalString(320, y+45+yOffset, cg_weapons[ cg.weaponSelect ].item->classname, UI_CENTER|UI_SMALLFONT, textColor);
01367                 }
01368         }
01369 
01370         trap_R_SetColor( NULL );
01371 }

void CG_EntityEvent centity_t cent,
vec3_t  position
 

Definition at line 1317 of file cg_event.c.

References cgEffects_t::acidSplash, playerState_s::ammo, entityState_s::angles, entityState_s::angles2, AngleVectors(), entityState_s::apos, bg_itemlist, bg_numItems, BIGCHAR_WIDTH, saberInfo_t::block2Sound, saberInfo_t::blockEffect, saberInfo_t::blockEffect2, saberInfo_t::blockSound, cgMedia_t::blueFlagReturnedSound, cgMedia_t::blueLeadsSound, cgMedia_t::blueScoredSound, cgMedia_t::blueTookFlagSound, cgMedia_t::blueTookYsalSound, cgMedia_t::blueYsalReturnedSound, centity_s::bodyFadeTime, centity_s::bodyHeight, entityState_s::bolt1, centity_s::bolt1, entityState_s::bolt2, centity_s::bolt2, centity_s::bolt3, centity_s::bolt4, centity_s::boltInfo, BONE_ANIM_BLEND, BONE_ANIM_OVERRIDE_FREEZE, ByteToDir(), centity_t, cg, CG_AddBufferedSound(), CG_Beam(), CG_CenterPrint(), CG_ChatBox_AddString(), CG_Chunks(), CG_ConfigString(), CG_CreateNPCClient(), CG_CustomSound(), cg_debugEvents, cg_entities, CG_Error(), CG_FireWeapon(), cg_footsteps, CG_G2MarkEvent(), CG_GetClientWeaponMuzzleBoltPoint(), CG_GetCTFMessageEvent(), CG_GetStringEdString(), CG_GetStringForVoiceSound(), cg_ghoul2Marks, CG_GlassShatter(), CG_InATST(), CG_InClientBitflags(), CG_InFighter(), cg_jumpSounds, CG_LocalTimingBar(), CG_MiscModelExplosion(), CG_MissileHitPlayer(), CG_MissileHitWall(), cg_nopredict, cg_oldPainSounds, CG_OutOfAmmoChange(), CG_PainEvent(), CG_PlayDoorLoopSound(), CG_PlayDoorSound(), CG_PlayerShieldHit(), CG_Printf(), CG_RegisterWeapon(), CG_S_AddRealLoopingSound(), CG_S_StopLoopingSound(), cg_saberFlashPos, cg_saberFlashTime, CG_ScorePlum(), cg_siegeDeathTime, CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), CG_StartMusic(), cg_synchronousClients, CG_TestLine(), CG_Trace(), CG_TryPlayCustomSound(), cg_vehicleAmmoWarning, cg_vehicleAmmoWarningTime, CG_VehicleWeaponImpact(), CG_VehMuzzleFireFX(), cg_weapons, CGCam_SetMusicMult(), CGCam_Shake(), cgs, CHAN_ANNOUNCER, CHAN_AUTO, CHAN_BODY, CHAN_LOCAL, CHAN_MENU1, CHAN_VOICE, CHAN_WEAPON, CLASS_VEHICLE, client, cgs_t::clientinfo, playerState_s::clientNum, entityState_s::clientNum, Com_Printf(), CONTENTS_SOLID, CONTENTS_TERRAIN, cgMedia_t::countFightSound, CS_AMBIENT_SET, CS_EFFECTS, CS_SOUNDS, centity_s::currentState, DEBUGNAME, DEFAULT_MAXS_2, DEFAULT_MINS_2, cg_t::demoPlayback, cgMedia_t::disruptorZoomLoop, DoFall(), cgMedia_t::drainSound, cgMedia_t::dramaticFailure, EF_ALT_FIRING, EF_SOUNDTRACKER, EFFECT_ACID_SPLASH, EFFECT_EXPLOSION, EFFECT_EXPLOSION_DEMP2ALT, EFFECT_EXPLOSION_DETPACK, EFFECT_EXPLOSION_FLECHETTE, EFFECT_EXPLOSION_PAS, EFFECT_EXPLOSION_TRIPMINE, EFFECT_EXPLOSION_TURRET, EFFECT_LANDING_DIRT, EFFECT_LANDING_GRAVEL, EFFECT_LANDING_MUD, EFFECT_LANDING_SAND, EFFECT_LANDING_SNOW, EFFECT_LAVA_SPLASH, EFFECT_SMOKE, EFFECT_SPARK_EXPLOSION, EFFECT_SPARKS, EFFECT_STUNHIT, EFFECT_WATER_SPLASH, cgs_t::effects, entityState_s::eFlags, entityState_s::emplacedOwner, trace_t::endpos, trace_t::entityNum, ENTITYNUM_NONE, entityState_t, ET_BODY, ET_NPC, entityState_s::eType, EV_ALT_FIRE, EV_ANGER1, EV_ANGER2, EV_ANGER3, EV_BECOME_JEDIMASTER, EV_BMODEL_SOUND, EV_BODYFADE, EV_CHANGE_WEAPON, EV_CHASE1, EV_CHASE2, EV_CHASE3, EV_CHOKE1, EV_CHOKE2, EV_CHOKE3, EV_CLIENTJOIN, EV_COMBAT1, EV_COMBAT2, EV_COMBAT3, EV_CONC_ALT_IMPACT, EV_CONFUSE1, EV_CONFUSE2, EV_CONFUSE3, EV_COVER1, EV_COVER2, EV_COVER3, EV_COVER4, EV_COVER5, EV_CTFMESSAGE, EV_DEATH1, EV_DEATH2, EV_DEATH3, EV_DEBRIS, EV_DEBUG_LINE, EV_DEFLECT1, EV_DEFLECT2, EV_DEFLECT3, EV_DESTROY_GHOUL2_INSTANCE, EV_DESTROY_WEAPON_MODEL, EV_DETECTED1, EV_DETECTED2, EV_DETECTED3, EV_DETECTED4, EV_DETECTED5, EV_DISRUPTOR_HIT, EV_DISRUPTOR_MAIN_SHOT, EV_DISRUPTOR_SNIPER_MISS, EV_DISRUPTOR_SNIPER_SHOT, EV_DISRUPTOR_ZOOMSOUND, EV_ENTITY_SOUND, EV_ESCAPING1, EV_ESCAPING2, EV_ESCAPING3, EV_EVENT_BITS, EV_FALL, EV_FFTURN, EV_FFWARN, EV_FIRE_WEAPON, EV_FOOTSPLASH, EV_FOOTSTEP, EV_FOOTSTEP_METAL, EV_FOOTWADE, EV_FORCE_DRAINED, EV_GENERAL_SOUND, EV_GHOUL2_MARK, EV_GIB_PLAYER, EV_GIVE_NEW_RANK, EV_GIVEUP1, EV_GIVEUP2, EV_GIVEUP3, EV_GIVEUP4, EV_GLASS_SHATTER, EV_GLOAT1, EV_GLOAT2, EV_GLOAT3, EV_GLOBAL_DUEL, EV_GLOBAL_ITEM_PICKUP, EV_GLOBAL_SOUND, EV_GLOBAL_TEAM_SOUND, EV_GRENADE_BOUNCE, EV_ITEM_PICKUP, EV_ITEM_POP, EV_ITEM_RESPAWN, EV_ITEMUSEFAIL, EV_JCHASE1, EV_JCHASE2, EV_JCHASE3, EV_JDETECTED1, EV_JDETECTED2, EV_JDETECTED3, EV_JLOST1, EV_JLOST2, EV_JLOST3, EV_JUMP, EV_JUMP_PAD, EV_LOCALTIMER, EV_LOOK1, EV_LOOK2, EV_LOST1, EV_MISC_MODEL_EXP, EV_MISSILE_HIT, EV_MISSILE_MISS, EV_MISSILE_MISS_METAL, EV_MISSILE_STICK, EV_MUTE_SOUND, EV_NOAMMO, EV_OBITUARY, EV_OUTFLANK1, EV_OUTFLANK2, EV_PAIN, EV_PLAY_EFFECT, EV_PLAY_EFFECT_ID, EV_PLAY_PORTAL_EFFECT_ID, EV_PLAY_ROFF, EV_PLAYDOORLOOPSOUND, EV_PLAYDOORSOUND, EV_PLAYER_TELEPORT_IN, EV_PLAYER_TELEPORT_OUT, EV_POWERUP_BATTLESUIT, EV_POWERUP_QUAD, EV_PREDEFSOUND, EV_PRIVATE_DUEL, EV_PUSHED1, EV_PUSHED2, EV_PUSHED3, EV_PUSHFAIL, EV_ROLL, EV_SABER_ATTACK, EV_SABER_BLOCK, EV_SABER_CLASHFLARE, EV_SABER_HIT, EV_SABER_UNHOLSTER, EV_SCOREPLUM, EV_SCREENSHAKE, EV_SET_FORCE_DISABLE, EV_SET_FREE_SABER, EV_SHIELD_HIT, EV_SIEGE_OBJECTIVECOMPLETE, EV_SIEGE_ROUNDOVER, EV_SIEGESPEC, EV_SIGHT1, EV_SIGHT2, EV_SIGHT3, EV_SOUND1, EV_SOUND2, EV_SOUND3, EV_STARTLOOPINGSOUND, EV_STEP_12, EV_STEP_16, EV_STEP_4, EV_STEP_8, EV_STOPLOOPINGSOUND, EV_SUSPICIOUS1, EV_SUSPICIOUS2, EV_SUSPICIOUS3, EV_SUSPICIOUS4, EV_SUSPICIOUS5, EV_SWIM, EV_TAUNT, EV_TAUNT1, EV_TAUNT2, EV_TAUNT3, EV_TEAM_POWER, EV_TESTLINE, EV_USE_ITEM0, EV_USE_ITEM1, EV_USE_ITEM10, EV_USE_ITEM11, EV_USE_ITEM12, EV_USE_ITEM13, EV_USE_ITEM14, EV_USE_ITEM2, EV_USE_ITEM3, EV_USE_ITEM4, EV_USE_ITEM5, EV_USE_ITEM6, EV_USE_ITEM7, EV_USE_ITEM8, EV_USE_ITEM9, EV_VEH_FIRE, EV_VICTORY1, EV_VICTORY2, EV_VICTORY3, EV_VOICECMD_SOUND, EV_WATER_CLEAR, EV_WATER_LEAVE, EV_WATER_TOUCH, EV_WATER_UNDER, EV_WEAPON_CHARGE, EV_WEAPON_CHARGE_ALT, entityState_s::event, entityState_s::eventParm, playerState_s::fallingToDeath, playerState_s::fd, FOOTSTEP_DIRTWALK, FOOTSTEP_GRASSWALK, FOOTSTEP_GRAVELWALK, FOOTSTEP_METALWALK, FOOTSTEP_MUDWALK, FOOTSTEP_PIPEWALK, FOOTSTEP_RUGWALK, FOOTSTEP_SANDWALK, FOOTSTEP_SNOWWALK, FOOTSTEP_SPLASH, FOOTSTEP_STONEWALK, footstep_t, FOOTSTEP_WOODWALK, cgMedia_t::footsteps, cg_t::forceHUDTotalFlashTime, forcedata_s::forcePowersActive, forcedata_s::forcePowerSelected, cg_t::forceSelect, cg_t::forceSelectTime, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, trace_t::fraction, centity_s::frame_hold_refreshed, centity_s::frame_hold_time, centity_s::frame_minus1_refreshed, centity_s::frame_minus2_refreshed, FX_ConcAltShot(), FX_DEMP2_AltDetonate(), FX_DisruptorAltMiss(), FX_DisruptorAltShot(), FX_DisruptorHitPlayer(), FX_DisruptorHitWall(), FX_DisruptorMainShot(), cgs_t::gameEffects, cgs_t::gameModels, cgs_t::gameSounds, cgs_t::gametype, entityState_s::generic1, entityState_s::genericenemyindex, centity_s::ghoul2, clientInfo_t::ghoul2Model, centity_s::ghoul2weapon, GIANTCHAR_WIDTH, gitem_t, gitem_s::giType, entityState_s::groundEntityNum, GT_CTY, GT_DUEL, GT_POWERDUEL, GTS_BLUE_CAPTURE, GTS_BLUE_RETURN, GTS_BLUE_TAKEN, GTS_BLUETEAM_SCORED, GTS_BLUETEAM_TOOK_LEAD, GTS_RED_CAPTURE, GTS_RED_RETURN, GTS_RED_TAKEN, GTS_REDTEAM_SCORED, GTS_REDTEAM_TOOK_LEAD, GTS_TEAMS_ARE_TIED, cgMedia_t::happyMusic, saberInfo_t::hit2Sound, saberInfo_t::hitOtherEffect, saberInfo_t::hitOtherEffect2, saberInfo_t::hitPersonEffect, saberInfo_t::hitPersonEffect2, saberInfo_t::hitSound, cgMedia_t::holocronPickup, IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, vmCvar_t::integer, IT_TEAM, KEYCATCH_UI, cgEffects_t::landingDirt, cgEffects_t::landingGravel, cgEffects_t::landingMud, cgEffects_t::landingSand, cgEffects_t::landingSnow, cg_t::lastFPFlashPoint, cgEffects_t::lavaSplash, entityState_s::legsAnim, centity_s::lerpOrigin, entityState_s::loopSound, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, cgEffects_t::mAltDetonate, MASK_SOLID, MATERIAL_CANVAS, MATERIAL_CARPET, MATERIAL_DIRT, MATERIAL_FABRIC, MATERIAL_GRAVEL, MATERIAL_HOLLOWMETAL, MATERIAL_HOLLOWWOOD, MATERIAL_LONGGRASS, MATERIAL_MUD, MATERIAL_PLASTIC, MATERIAL_RUBBER, MATERIAL_SAND, MATERIAL_SHORTGRASS, MATERIAL_SNOW, MATERIAL_SOLIDMETAL, MATERIAL_SOLIDWOOD, mdxaBone_t::matrix, MAX_CLIENTS, MAX_STEP_CHANGE, MAX_WEAPONS, cgEffects_t::mBlasterDeflect, cgEffects_t::mConcussionAltRing, cgEffects_t::mDetpackExplosion, cgs_t::media, cgEffects_t::mEmplacedDeadSmoke, cgEffects_t::mEmplacedExplode, cgEffects_t::mEmplacedMuzzleFlash, memset(), cgEffects_t::mFlechetteAltBlow, cg_t::mInRMG, centity_s::miscTime, cgEffects_t::mJediSpawn, entityState_s::modelindex, centity_s::modelScale, cgEffects_t::mSaberBlock, cgEffects_t::mSaberBloodSparks, cgEffects_t::mSaberBloodSparksMid, cgEffects_t::mSaberBloodSparksSmall, cgEffects_t::mSaberCut, cgEffects_t::mSparkExplosion, cgEffects_t::mSparksExplodeNoSound, cgEffects_t::mSpawn, cgEffects_t::mStunBatonFleshImpact, cgEffects_t::mTripmineExplosion, cgEffects_t::mTurretExplode, clientInfo_t::name, cgMedia_t::noAmmoSound, entityState_s::NPC_class, centity_s::npcClient, NULL, entityState_s::number, centity_s::numLoopingSounds, entityState_s::origin, entityState_s::origin2, entityState_s::otherEntityNum, entityState_s::otherEntityNum2, entityState_s::owner, PDSOUND_ABSORB, PDSOUND_ABSORBHIT, PDSOUND_FORCEGRIP, PDSOUND_FORCEJUMP, PDSOUND_PROTECT, PDSOUND_PROTECTHIT, PERS_TEAM, playerState_s::persistant, gitem_s::pickup_sound, playerMaxs, playerMins, playerState_s::pm_flags, PMF_FOLLOW, entityState_s::pos, cg_t::powerupActive, cg_t::powerupTime, cg_t::predictedPlayerState, snapshot_t::ps, PW_BATTLESUIT, PW_QUAD, Q_irand(), qboolean, qfalse, qhandle_t, qtrue, rand(), cgMedia_t::redFlagReturnedSound, cgMedia_t::redLeadsSound, cgMedia_t::redScoredSound, cgMedia_t::redTookFlagSound, cgMedia_t::redTookYsalSound, cgMedia_t::redYsalReturnedSound, cg_t::refdef, weaponInfo_s::registered, cg_t::renderingThirdPerson, cgMedia_t::respawnSound, ROLL, cgMedia_t::rollSound, clientInfo_t::saber, gclient_s::saber, entityState_s::saberEntityNum, saberInfo_t::saberFlags2, SCREEN_HEIGHT, SEEKER_ALREADYDEPLOYED, cgMedia_t::selectSound, weaponInfo_s::selectSound, SENTRY_ALREADYPLACED, SENTRY_NOROOM, centity_s::serverSaberFleshImpact, centity_s::serverSaberHitIndex, centity_s::serverSaberHitTime, SFL2_NO_CLASH_FLARE, sfxHandle_t, SHIELD_NOROOM, entityState_s::shouldtarget, showPowersName, cg_t::snap, saberInfo_t::soundOn, entityState_s::soundSetIndex, entityState_s::speed, STAT_WEAPONS, playerState_s::stats, STEP_TIME, cg_t::stepChange, cg_t::stepTime, strcpy(), saberInfo_t::swingSound, TAUNT_BOW, TAUNT_FLOURISH, TAUNT_GLOAT, TAUNT_MEDITATE, TAUNT_TAUNT, clientInfo_t::team, cgMedia_t::teamHealSound, centity_s::teamPowerEffectTime, centity_s::teamPowerType, cgMedia_t::teamRegenSound, cgMedia_t::teamsTiedSound, cgMedia_t::teleInSound, cgMedia_t::teleOutSound, entityState_s::time, cg_t::time, entityState_s::time2, TRACK_CHANNEL_2, TRACK_CHANNEL_3, TRACK_CHANNEL_5, trap_AS_GetBModelSound(), trap_Cvar_Set(), trap_FX_PlayEffectID(), trap_FX_PlayPortalEffectID(), trap_FX_RegisterEffect(), trap_G2_HaveWeGhoul2Models(), trap_G2API_AddBolt(), trap_G2API_CleanGhoul2Models(), trap_G2API_GetBoltMatrix(), trap_G2API_HasGhoul2ModelOnIndex(), trap_G2API_RemoveGhoul2Model(), trap_G2API_SetBoneAnim(), trap_G2API_SetSurfaceOnOff(), trap_Key_GetCatcher(), trap_OpenUIMenu(), trap_ROFF_Play(), trap_S_MuteSound(), trap_S_RegisterSound(), trap_S_StartBackgroundTrack(), trap_S_StartLocalSound(), trap_S_StartSound(), trajectory_t::trBase, centity_s::trickAlpha, centity_s::trickAlphaTime, entityState_s::trickedentindex, entityState_s::trickedentindex2, trajectory_t::trTime, UIMENU_PLAYERCONFIG, va(), centity_s::vChatTime, vec3_origin, vec3_t, VectorClear, VectorCopy, VectorMA, VectorNormalize(), VectorSubtract, refdef_t::vieworg, cgEffects_t::waterSplash, cgMedia_t::watrInSound, cgMedia_t::watrOutSound, cgMedia_t::watrUnSound, entityState_s::weapon, vehicleInfo_t::weapon, playerState_s::weapon, centity_s::weapon, weaponData, weaponInfo_t, WP_CONCUSSION, WP_DET_PACK, WP_DISRUPTOR, WP_EMPLACED_GUN, WP_NONE, WP_NUM_WEAPONS, WP_SABER, WP_SaberBladeUseSecondBladeStyle(), WP_TURRET, and playerState_s::zoomMode.

Referenced by CG_CheckChangedPredictableEvents(), CG_CheckEvents(), and CG_CheckPlayerstateEvents().

01317                                                         {
01318         entityState_t   *es;
01319         int                             event;
01320         vec3_t                  dir;
01321         const char              *s;
01322         int                             clientNum;
01323         clientInfo_t    *ci;
01324         int                             eID = 0;
01325         int                             isnd = 0;
01326         centity_t               *cl_ent;
01327 
01328         es = &cent->currentState;
01329         event = es->event & ~EV_EVENT_BITS;
01330 
01331         if ( cg_debugEvents.integer ) {
01332                 CG_Printf( "ent:%3i  event:%3i ", es->number, event );
01333         }
01334 
01335         if ( !event ) {
01336                 DEBUGNAME("ZEROEVENT");
01337                 return;
01338         }
01339 
01340         clientNum = es->clientNum;
01341         if ( clientNum < 0 || clientNum >= MAX_CLIENTS ) {
01342                 clientNum = 0;
01343         }
01344 
01345         if (es->eType == ET_NPC)
01346         {
01347                 clientNum = es->number;
01348 
01349                 if (!cent->npcClient)
01350                 {
01351                         CG_CreateNPCClient(&cent->npcClient); //allocate memory for it
01352 
01353                         if (!cent->npcClient)
01354                         {
01355                                 assert(0);
01356                                 return;
01357                         }
01358 
01359                         memset(cent->npcClient, 0, sizeof(clientInfo_t));
01360                         cent->npcClient->ghoul2Model = NULL;
01361                 }
01362 
01363                 ci = cent->npcClient;
01364 
01365                 assert(ci);
01366         }
01367         else
01368         {
01369                 ci = &cgs.clientinfo[ clientNum ];
01370         }
01371 
01372         switch ( event ) {
01373         //
01374         // movement generated events
01375         //
01376         case EV_CLIENTJOIN:
01377                 DEBUGNAME("EV_CLIENTJOIN");
01378 
01379                 //Slight hack to force a local reinit of client entity on join.
01380                 cl_ent = &cg_entities[es->eventParm];
01381 
01382                 if (cl_ent)
01383                 {
01384                         //cl_ent->torsoBolt = 0;
01385                         cl_ent->bolt1 = 0;
01386                         cl_ent->bolt2 = 0;
01387                         cl_ent->bolt3 = 0;
01388                         cl_ent->bolt4 = 0;
01389                         cl_ent->bodyHeight = 0;//SABER_LENGTH_MAX;
01390                         //cl_ent->saberExtendTime = 0;
01391                         cl_ent->boltInfo = 0;
01392                         cl_ent->frame_minus1_refreshed = 0;
01393                         cl_ent->frame_minus2_refreshed = 0;
01394                         cl_ent->frame_hold_time = 0;
01395                         cl_ent->frame_hold_refreshed = 0;
01396                         cl_ent->trickAlpha = 0;
01397                         cl_ent->trickAlphaTime = 0;
01398                         cl_ent->ghoul2weapon = NULL;
01399                         cl_ent->weapon = WP_NONE;
01400                         cl_ent->teamPowerEffectTime = 0;
01401                         cl_ent->teamPowerType = 0;
01402                         cl_ent->numLoopingSounds = 0;
01403                         //cl_ent->localAnimIndex = 0;
01404                 }
01405                 break;
01406 
01407         case EV_FOOTSTEP:
01408                 DEBUGNAME("EV_FOOTSTEP");
01409                 if (cg_footsteps.integer) {
01410                         footstep_t      soundType;
01411                         switch( es->eventParm )
01412                         {
01413                         case MATERIAL_MUD:
01414                                 soundType = FOOTSTEP_MUDWALK;
01415                                 break;
01416                         case MATERIAL_DIRT:                     
01417                                 soundType = FOOTSTEP_DIRTWALK;
01418                                 break;
01419                         case MATERIAL_SAND:                     
01420                                 soundType = FOOTSTEP_SANDWALK;
01421                                 break;
01422                         case MATERIAL_SNOW:                     
01423                                 soundType = FOOTSTEP_SNOWWALK;
01424                                 break;
01425                         case MATERIAL_SHORTGRASS:               
01426                         case MATERIAL_LONGGRASS:                
01427                                 soundType = FOOTSTEP_GRASSWALK;
01428                                 break;
01429                         case MATERIAL_SOLIDMETAL:               
01430                                 soundType = FOOTSTEP_METALWALK;
01431                                 break;
01432                         case MATERIAL_HOLLOWMETAL:      
01433                                 soundType = FOOTSTEP_PIPEWALK;
01434                                 break;
01435                         case MATERIAL_GRAVEL:
01436                                 soundType = FOOTSTEP_GRAVELWALK;
01437                                 break;
01438                         case MATERIAL_CARPET:
01439                         case MATERIAL_FABRIC:
01440                         case MATERIAL_CANVAS:
01441                         case MATERIAL_RUBBER:
01442                         case MATERIAL_PLASTIC:
01443                                 soundType = FOOTSTEP_RUGWALK;
01444                                 break;
01445                         case MATERIAL_SOLIDWOOD:
01446                         case MATERIAL_HOLLOWWOOD:
01447                                 soundType = FOOTSTEP_WOODWALK;
01448                                 break;
01449 
01450                         default:
01451                                 soundType = FOOTSTEP_STONEWALK;
01452                                 break;
01453                         }
01454 
01455                         trap_S_StartSound (NULL, es->number, CHAN_BODY, cgs.media.footsteps[ soundType ][rand()&3] );
01456                 }
01457                 break;
01458         case EV_FOOTSTEP_METAL:
01459                 DEBUGNAME("EV_FOOTSTEP_METAL");
01460                 if (cg_footsteps.integer) {
01461                         trap_S_StartSound (NULL, es->number, CHAN_BODY, 
01462                                 cgs.media.footsteps[ FOOTSTEP_METALWALK ][rand()&3] );
01463                 }
01464                 break;
01465         case EV_FOOTSPLASH:
01466                 DEBUGNAME("EV_FOOTSPLASH");
01467                 if (cg_footsteps.integer) {
01468                         trap_S_StartSound (NULL, es->number, CHAN_BODY, 
01469                                 cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] );
01470                 }
01471                 break;
01472         case EV_FOOTWADE:
01473                 DEBUGNAME("EV_FOOTWADE");
01474                 if (cg_footsteps.integer) {
01475                         trap_S_StartSound (NULL, es->number, CHAN_BODY, 
01476                                 cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] );
01477                 }
01478                 break;
01479         case EV_SWIM:
01480                 DEBUGNAME("EV_SWIM");
01481                 if (cg_footsteps.integer) {
01482                         trap_S_StartSound (NULL, es->number, CHAN_BODY, 
01483                                 cgs.media.footsteps[ FOOTSTEP_SPLASH ][rand()&3] );
01484                 }
01485                 break;
01486 
01487 
01488         case EV_FALL:
01489                 DEBUGNAME("EV_FALL");
01490                 if (es->number == cg.snap->ps.clientNum && cg.snap->ps.fallingToDeath)
01491                 {
01492                         break;
01493                 }
01494                 DoFall(cent, es, clientNum);
01495                 break;
01496         case EV_STEP_4:
01497         case EV_STEP_8:
01498         case EV_STEP_12:
01499         case EV_STEP_16:                // smooth out step up transitions
01500                 DEBUGNAME("EV_STEP");
01501         {
01502                 float   oldStep;
01503                 int             delta;
01504                 int             step;
01505 
01506                 if ( clientNum != cg.predictedPlayerState.clientNum ) {
01507                         break;
01508                 }
01509                 // if we are interpolating, we don't need to smooth steps
01510                 if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) ||
01511                         cg_nopredict.integer || cg_synchronousClients.integer ) {
01512                         break;
01513                 }
01514                 // check for stepping up before a previous step is completed
01515                 delta = cg.time - cg.stepTime;
01516                 if (delta < STEP_TIME) {
01517                         oldStep = cg.stepChange * (STEP_TIME - delta) / STEP_TIME;
01518                 } else {
01519                         oldStep = 0;
01520                 }
01521 
01522                 // add this amount
01523                 step = 4 * (event - EV_STEP_4 + 1 );
01524                 cg.stepChange = oldStep + step;
01525                 if ( cg.stepChange > MAX_STEP_CHANGE ) {
01526                         cg.stepChange = MAX_STEP_CHANGE;
01527                 }
01528                 cg.stepTime = cg.time;
01529                 break;
01530         }
01531 
01532         case EV_JUMP_PAD:
01533                 DEBUGNAME("EV_JUMP_PAD");
01534                 break;
01535 
01536         case EV_GHOUL2_MARK:
01537                 DEBUGNAME("EV_GHOUL2_MARK");
01538 
01539                 if (cg_ghoul2Marks.integer)
01540                 { //Can we put a burn mark on him?
01541                         CG_G2MarkEvent(es);
01542                 }
01543                 break;
01544 
01545         case EV_GLOBAL_DUEL:
01546                 DEBUGNAME("EV_GLOBAL_DUEL");
01547                 //used for beginning of power duels
01548                 //if (cg.predictedPlayerState.persistant[PERS_TEAM] != TEAM_SPECTATOR)
01549                 if (es->otherEntityNum == cg.predictedPlayerState.clientNum ||
01550                         es->otherEntityNum2 == cg.predictedPlayerState.clientNum ||
01551                         es->groundEntityNum == cg.predictedPlayerState.clientNum)
01552                 {
01553                         CG_CenterPrint( CG_GetStringEdString("MP_SVGAME", "BEGIN_DUEL"), 120, GIANTCHAR_WIDTH*2 );                              
01554                         trap_S_StartLocalSound( cgs.media.countFightSound, CHAN_ANNOUNCER );
01555                 }
01556                 break;
01557 
01558         case EV_PRIVATE_DUEL:
01559                 DEBUGNAME("EV_PRIVATE_DUEL");
01560 
01561                 if (cg.snap->ps.clientNum != es->number)
01562                 {
01563                         break;
01564                 }
01565 
01566                 if (es->eventParm)
01567                 { //starting the duel
01568                         if (es->eventParm == 2)
01569                         {
01570                                 CG_CenterPrint( CG_GetStringEdString("MP_SVGAME", "BEGIN_DUEL"), 120, GIANTCHAR_WIDTH*2 );                              
01571                                 trap_S_StartLocalSound( cgs.media.countFightSound, CHAN_ANNOUNCER );
01572                         }
01573                         else
01574                         {
01575                                 trap_S_StartBackgroundTrack( "music/mp/duel.mp3", "music/mp/duel.mp3", qfalse );
01576                         }
01577                 }
01578                 else
01579                 { //ending the duel
01580                         CG_StartMusic(qtrue);
01581                 }
01582                 break;
01583 
01584         case EV_JUMP:
01585                 DEBUGNAME("EV_JUMP");
01586                 if (cg_jumpSounds.integer)
01587                 {
01588                         trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) );
01589                 }
01590                 break;
01591         case EV_ROLL:
01592                 DEBUGNAME("EV_ROLL");
01593                 if (es->number == cg.snap->ps.clientNum && cg.snap->ps.fallingToDeath)
01594                 {
01595                         break;
01596                 }
01597                 if (es->eventParm)
01598                 { //fall-roll-in-one event
01599                         DoFall(cent, es, clientNum);
01600                 }
01601 
01602                 trap_S_StartSound (NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) );
01603                 trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.rollSound  );
01604 
01605                 //FIXME: need some sort of body impact on ground sound and maybe kick up some dust?
01606                 break;
01607 
01608         case EV_TAUNT:
01609                 DEBUGNAME("EV_TAUNT");
01610                 {
01611                         int soundIndex = 0;
01612                         if ( cgs.gametype != GT_DUEL
01613                                 && cgs.gametype != GT_POWERDUEL
01614                                 && es->eventParm == TAUNT_TAUNT )
01615                         {//normal taunt
01616                                 soundIndex = CG_CustomSound( es->number, "*taunt.wav" );
01617                         }
01618                         else
01619                         {
01620                                 switch ( es->eventParm )
01621                                 {
01622                                 case TAUNT_TAUNT:
01623                                 default:
01624                                         if ( Q_irand( 0, 1 ) )
01625                                         {
01626                                                 soundIndex = CG_CustomSound( es->number, va("*anger%d.wav", Q_irand(1,3)) );
01627                                         }
01628                                         else
01629                                         {
01630                                                 soundIndex = CG_CustomSound( es->number, va("*taunt%d.wav", Q_irand(1,3)) );
01631                                                 if ( !soundIndex )
01632                                                 {
01633                                                         soundIndex = CG_CustomSound( es->number, va("*anger%d.wav", Q_irand(1,3)) );
01634                                                 }
01635                                         }
01636                                         break;
01637                                 case TAUNT_BOW:
01638                                         //soundIndex = CG_CustomSound( es->number, va("*respect%d.wav", Q_irand(1,3)) );
01639                                         break;
01640                                 case TAUNT_MEDITATE:
01641                                         //soundIndex = CG_CustomSound( es->number, va("*meditate%d.wav", Q_irand(1,3)) );
01642                                         break;
01643                                 case TAUNT_FLOURISH:
01644                                         if ( Q_irand( 0, 1 ) )
01645                                         {
01646                                                 soundIndex = CG_CustomSound( es->number, va("*deflect%d.wav", Q_irand(1,3)) );
01647                                                 if ( !soundIndex )
01648                                                 {
01649                                                         soundIndex = CG_CustomSound( es->number, va("*gloat%d.wav", Q_irand(1,3)) );
01650                                                         if ( !soundIndex )
01651                                                         {
01652                                                                 soundIndex = CG_CustomSound( es->number, va("*anger%d.wav", Q_irand(1,3)) );
01653                                                         }
01654                                                 }
01655                                         }
01656                                         else
01657                                         {
01658                                                 soundIndex = CG_CustomSound( es->number, va("*gloat%d.wav", Q_irand(1,3)) );
01659                                                 if ( !soundIndex )
01660                                                 {
01661                                                         soundIndex = CG_CustomSound( es->number, va("*deflect%d.wav", Q_irand(1,3)) );
01662                                                         if ( !soundIndex )
01663                                                         {
01664                                                                 soundIndex = CG_CustomSound( es->number, va("*anger%d.wav", Q_irand(1,3)) );
01665                                                         }
01666                                                 }
01667                                         }
01668                                         break;
01669                                 case TAUNT_GLOAT:
01670                                         soundIndex = CG_CustomSound( es->number, va("*victory%d.wav", Q_irand(1,3)) );
01671                                         break;
01672                                 }
01673                         }
01674                         if ( !soundIndex )
01675                         {
01676                                 soundIndex = CG_CustomSound( es->number, "*taunt.wav" );
01677                         }
01678                         if ( soundIndex )
01679                         {
01680                                 trap_S_StartSound (NULL, es->number, CHAN_VOICE, soundIndex );
01681                         }
01682                 }
01683                 break;
01684 
01685                 //Begin NPC sounds
01686         case EV_ANGER1: //Say when acquire an enemy when didn't have one before
01687         case EV_ANGER2:
01688         case EV_ANGER3:
01689                 DEBUGNAME("EV_ANGERx");
01690                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*anger%i.wav", event - EV_ANGER1 + 1) );
01691                 break;
01692 
01693         case EV_VICTORY1:       //Say when killed an enemy
01694         case EV_VICTORY2:
01695         case EV_VICTORY3:
01696                 DEBUGNAME("EV_VICTORYx");
01697                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*victory%i.wav", event - EV_VICTORY1 + 1) );
01698                 break;
01699 
01700         case EV_CONFUSE1:       //Say when confused
01701         case EV_CONFUSE2:
01702         case EV_CONFUSE3:
01703                 DEBUGNAME("EV_CONFUSEDx");
01704                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*confuse%i.wav", event - EV_CONFUSE1 + 1) );
01705                 break;
01706 
01707         case EV_PUSHED1:        //Say when pushed
01708         case EV_PUSHED2:
01709         case EV_PUSHED3:
01710                 DEBUGNAME("EV_PUSHEDx");
01711                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*pushed%i.wav", event - EV_PUSHED1 + 1) );
01712                 break;
01713 
01714         case EV_CHOKE1: //Say when choking
01715         case EV_CHOKE2:
01716         case EV_CHOKE3:
01717                 DEBUGNAME("EV_CHOKEx");
01718                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*choke%i.wav", event - EV_CHOKE1 + 1) );
01719                 break;
01720 
01721         case EV_FFWARN: //Warn ally to stop shooting you
01722                 DEBUGNAME("EV_FFWARN");
01723                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, "*ffwarn.wav" );
01724                 break;
01725 
01726         case EV_FFTURN: //Turn on ally after being shot by them
01727                 DEBUGNAME("EV_FFTURN");
01728                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, "*ffturn.wav" );
01729                 break;
01730 
01731         //extra sounds for ST
01732         case EV_CHASE1:
01733         case EV_CHASE2:
01734         case EV_CHASE3:
01735                 DEBUGNAME("EV_CHASEx");
01736                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*chase%i.wav", event - EV_CHASE1 + 1) );
01737                 break;
01738         case EV_COVER1:
01739         case EV_COVER2:
01740         case EV_COVER3:
01741         case EV_COVER4:
01742         case EV_COVER5:
01743                 DEBUGNAME("EV_COVERx");
01744                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*cover%i.wav", event - EV_COVER1 + 1) );
01745                 break;
01746         case EV_DETECTED1:
01747         case EV_DETECTED2:
01748         case EV_DETECTED3:
01749         case EV_DETECTED4:
01750         case EV_DETECTED5:
01751                 DEBUGNAME("EV_DETECTEDx");
01752                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*detected%i.wav", event - EV_DETECTED1 + 1) );
01753                 break;
01754         case EV_GIVEUP1:
01755         case EV_GIVEUP2:
01756         case EV_GIVEUP3:
01757         case EV_GIVEUP4:
01758                 DEBUGNAME("EV_GIVEUPx");
01759                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*giveup%i.wav", event - EV_GIVEUP1 + 1) );
01760                 break;
01761         case EV_LOOK1:
01762         case EV_LOOK2:
01763                 DEBUGNAME("EV_LOOKx");
01764                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*look%i.wav", event - EV_LOOK1 + 1) );
01765                 break;
01766         case EV_LOST1:
01767                 DEBUGNAME("EV_LOST1");
01768                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, "*lost1.wav" );
01769                 break;
01770         case EV_OUTFLANK1:
01771         case EV_OUTFLANK2:
01772                 DEBUGNAME("EV_OUTFLANKx");
01773                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*outflank%i.wav", event - EV_OUTFLANK1 + 1) );
01774                 break;
01775         case EV_ESCAPING1:
01776         case EV_ESCAPING2:
01777         case EV_ESCAPING3:
01778                 DEBUGNAME("EV_ESCAPINGx");
01779                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*escaping%i.wav", event - EV_ESCAPING1 + 1) );
01780                 break;
01781         case EV_SIGHT1:
01782         case EV_SIGHT2:
01783         case EV_SIGHT3:
01784                 DEBUGNAME("EV_SIGHTx");
01785                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*sight%i.wav", event - EV_SIGHT1 + 1) );
01786                 break;
01787         case EV_SOUND1:
01788         case EV_SOUND2:
01789         case EV_SOUND3:
01790                 DEBUGNAME("EV_SOUNDx");
01791                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*sound%i.wav", event - EV_SOUND1 + 1) );
01792                 break;
01793         case EV_SUSPICIOUS1:
01794         case EV_SUSPICIOUS2:
01795         case EV_SUSPICIOUS3:
01796         case EV_SUSPICIOUS4:
01797         case EV_SUSPICIOUS5:
01798                 DEBUGNAME("EV_SUSPICIOUSx");
01799                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*suspicious%i.wav", event - EV_SUSPICIOUS1 + 1) );
01800                 break;
01801         //extra sounds for Jedi
01802         case EV_COMBAT1:
01803         case EV_COMBAT2:
01804         case EV_COMBAT3:
01805                 DEBUGNAME("EV_COMBATx");
01806                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*combat%i.wav", event - EV_COMBAT1 + 1) );
01807                 break;
01808         case EV_JDETECTED1:
01809         case EV_JDETECTED2:
01810         case EV_JDETECTED3:
01811                 DEBUGNAME("EV_JDETECTEDx");
01812                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*jdetected%i.wav", event - EV_JDETECTED1 + 1) );
01813                 break;
01814         case EV_TAUNT1:
01815         case EV_TAUNT2:
01816         case EV_TAUNT3:
01817                 DEBUGNAME("EV_TAUNTx");
01818                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*taunt%i.wav", event - EV_TAUNT1 + 1) );
01819                 break;
01820         case EV_JCHASE1:
01821         case EV_JCHASE2:
01822         case EV_JCHASE3:
01823                 DEBUGNAME("EV_JCHASEx");
01824                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*jchase%i.wav", event - EV_JCHASE1 + 1) );
01825                 break;
01826         case EV_JLOST1:
01827         case EV_JLOST2:
01828         case EV_JLOST3:
01829                 DEBUGNAME("EV_JLOSTx");
01830                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*jlost%i.wav", event - EV_JLOST1 + 1) );
01831                 break;
01832         case EV_DEFLECT1:
01833         case EV_DEFLECT2:
01834         case EV_DEFLECT3:
01835                 DEBUGNAME("EV_DEFLECTx");
01836                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*deflect%i.wav", event - EV_DEFLECT1 + 1) );
01837                 break;
01838         case EV_GLOAT1:
01839         case EV_GLOAT2:
01840         case EV_GLOAT3:
01841                 DEBUGNAME("EV_GLOATx");
01842                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, va("*gloat%i.wav", event - EV_GLOAT1 + 1) );
01843                 break;
01844         case EV_PUSHFAIL:
01845                 DEBUGNAME("EV_PUSHFAIL");
01846                 CG_TryPlayCustomSound( NULL, es->number, CHAN_VOICE, "*pushfail.wav" );
01847                 break;
01848                 //End NPC sounds
01849 
01850         case EV_SIEGESPEC:
01851                 DEBUGNAME("EV_SIEGESPEC");
01852                 if ( es->owner == cg.predictedPlayerState.clientNum )
01853                 {
01854                         cg_siegeDeathTime = es->time;
01855                 }
01856 
01857                 break;
01858                 
01859         case EV_WATER_TOUCH:
01860                 DEBUGNAME("EV_WATER_TOUCH");
01861                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrInSound );
01862                 break;
01863         case EV_WATER_LEAVE:
01864                 DEBUGNAME("EV_WATER_LEAVE");
01865                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrOutSound );
01866                 break;
01867         case EV_WATER_UNDER:
01868                 DEBUGNAME("EV_WATER_UNDER");
01869                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.watrUnSound );
01870                 break;
01871         case EV_WATER_CLEAR:
01872                 DEBUGNAME("EV_WATER_CLEAR");
01873                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*gasp.wav" ) );
01874                 break;
01875 
01876         case EV_ITEM_PICKUP:
01877                 DEBUGNAME("EV_ITEM_PICKUP");
01878                 {
01879                         gitem_t *item;
01880                         int             index;
01881                         qboolean        newindex = qfalse;
01882 
01883                         index = cg_entities[es->eventParm].currentState.modelindex;             // player predicted
01884 
01885                         if (index < 1 && cg_entities[es->eventParm].currentState.isJediMaster)
01886                         { //a holocron most likely
01887                                 index = cg_entities[es->eventParm].currentState.trickedentindex4;
01888                                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.holocronPickup );
01889                                                                 
01890                                 if (es->number == cg.snap->ps.clientNum && showPowersName[index])
01891                                 {
01892                                         const char *strText = CG_GetStringEdString("MP_INGAME", "PICKUPLINE");
01893 
01894                                         //Com_Printf("%s %s\n", strText, showPowersName[index]);
01895                                         CG_CenterPrint( va("%s %s\n", strText, CG_GetStringEdString("SP_INGAME",showPowersName[index])), SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
01896                                 }
01897 
01898                                 //Show the player their force selection bar in case picking the holocron up changed the current selection
01899                                 if (index != FP_SABER_OFFENSE && index != FP_SABER_DEFENSE && index != FP_SABERTHROW &&
01900                                         index != FP_LEVITATION &&
01901                                         es->number == cg.snap->ps.clientNum &&
01902                                         (index == cg.snap->ps.fd.forcePowerSelected || !(cg.snap->ps.fd.forcePowersActive & (1 << cg.snap->ps.fd.forcePowerSelected))))
01903                                 {
01904                                         if (cg.forceSelect != index)
01905                                         {
01906                                                 cg.forceSelect = index;
01907                                                 newindex = qtrue;
01908                                         }
01909                                 }
01910 
01911                                 if (es->number == cg.snap->ps.clientNum && newindex)
01912                                 {
01913                                         if (cg.forceSelectTime < cg.time)
01914                                         {
01915                                                 cg.forceSelectTime = cg.time;
01916                                         }
01917                                 }
01918 
01919                                 break;
01920                         }
01921 
01922                         if (cg_entities[es->eventParm].weapon >= cg.time)
01923                         { //rww - an unfortunately necessary hack to prevent double item pickups
01924                                 break;
01925                         }
01926 
01927                         //Hopefully even if this entity is somehow removed and replaced with, say, another
01928                         //item, this time will have expired by the time that item needs to be picked up.
01929                         //Of course, it's quite possible this will fail miserably, so if you've got a better
01930                         //solution then please do use it.
01931                         cg_entities[es->eventParm].weapon = cg.time+500;
01932 
01933                         if ( index < 1 || index >= bg_numItems ) {
01934                                 break;
01935                         }
01936                         item = &bg_itemlist[ index ];
01937 
01938                         if ( /*item->giType != IT_POWERUP && */item->giType != IT_TEAM) {
01939                                 if (item->pickup_sound && item->pickup_sound[0])
01940                                 {
01941                                         trap_S_StartSound (NULL, es->number, CHAN_AUTO, trap_S_RegisterSound( item->pickup_sound ) );
01942                                 }
01943                         }
01944 
01945                         // show icon and name on status bar
01946                         if ( es->number == cg.snap->ps.clientNum ) {
01947                                 CG_ItemPickup( index );
01948                         }
01949                 }
01950                 break;
01951 
01952         case EV_GLOBAL_ITEM_PICKUP:
01953                 DEBUGNAME("EV_GLOBAL_ITEM_PICKUP");
01954                 {
01955                         gitem_t *item;
01956                         int             index;
01957 
01958                         index = es->eventParm;          // player predicted
01959 
01960                         if ( index < 1 || index >= bg_numItems ) {
01961                                 break;
01962                         }
01963                         item = &bg_itemlist[ index ];
01964                         // powerup pickups are global
01965                         if( item->pickup_sound && item->pickup_sound[0] ) {
01966                                 trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, trap_S_RegisterSound( item->pickup_sound) );
01967                         }
01968 
01969                         // show icon and name on status bar
01970                         if ( es->number == cg.snap->ps.clientNum ) {
01971                                 CG_ItemPickup( index );
01972                         }
01973                 }
01974                 break;
01975 
01976         case EV_VEH_FIRE:
01977                 DEBUGNAME("EV_VEH_FIRE");
01978                 {
01979                         centity_t *veh = &cg_entities[es->owner];
01980                         CG_VehMuzzleFireFX(veh, es);
01981                 }
01982                 break;
01983 
01984         //
01985         // weapon events
01986         //
01987         case EV_NOAMMO:
01988                 DEBUGNAME("EV_NOAMMO");
01989 //              trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.noAmmoSound );
01990                 if ( es->number == cg.snap->ps.clientNum )
01991                 {
01992                         if ( CG_InFighter() || CG_InATST() || cg.snap->ps.weapon == WP_NONE )
01993                         {//just letting us know our vehicle is out of ammo
01994                                 //FIXME: flash something on HUD or give some message so we know we have no ammo
01995                                 centity_t *localCent = &cg_entities[cg.snap->ps.clientNum];
01996                                 if ( localCent->m_pVehicle 
01997                                         && localCent->m_pVehicle->m_pVehicleInfo
01998                                         && localCent->m_pVehicle->m_pVehicleInfo->weapon[es->eventParm].soundNoAmmo )
01999                                 {//play the "no Ammo" sound for this weapon
02000                                         trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, localCent->m_pVehicle->m_pVehicleInfo->weapon[es->eventParm].soundNoAmmo );
02001                                 }
02002                                 else
02003                                 {//play the default "no ammo" sound
02004                                         trap_S_StartSound (NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.noAmmoSound );
02005                                 }
02006                                 //flash the HUD so they associate the sound with the visual indicator that they don't have enough ammo
02007                                 if ( cg_vehicleAmmoWarningTime < cg.time
02008                                         || cg_vehicleAmmoWarning != es->eventParm )
02009                                 {//if there's already one going, don't interrupt it (unless they tried to fire another weapon that's out of ammo)
02010                                         cg_vehicleAmmoWarning = es->eventParm;
02011                                         cg_vehicleAmmoWarningTime = cg.time+500;
02012                                 }
02013                         }
02014                         else if ( cg.snap->ps.weapon == WP_SABER )
02015                         {
02016                                 cg.forceHUDTotalFlashTime = cg.time + 1000;
02017                         }
02018                         else
02019                         {
02020                                 int weap = 0;
02021 
02022                                 if (es->eventParm && es->eventParm < WP_NUM_WEAPONS)
02023                                 {
02024                                         cg.snap->ps.stats[STAT_WEAPONS] &= ~(1 << es->eventParm);
02025                                         weap = cg.snap->ps.weapon;
02026                                 }
02027                                 else if (es->eventParm)
02028                                 {
02029                                         weap = (es->eventParm-WP_NUM_WEAPONS);
02030                                 }
02031                                 CG_OutOfAmmoChange(weap);
02032                         }
02033                 }
02034                 break;
02035         case EV_CHANGE_WEAPON:
02036                 DEBUGNAME("EV_CHANGE_WEAPON");
02037                 {
02038                         int weapon = es->eventParm;
02039                         weaponInfo_t *weaponInfo;
02040                         
02041                         assert(weapon >= 0 && weapon < MAX_WEAPONS);
02042 
02043                         weaponInfo = &cg_weapons[weapon];
02044 
02045                         assert(weaponInfo);
02046 
02047                         if (weaponInfo->selectSound)
02048                         {
02049                                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, weaponInfo->selectSound );
02050                         }
02051                         else if (weapon != WP_SABER)
02052                         { //not sure what SP is doing for this but I don't want a select sound for saber (it has the saber-turn-on)
02053                                 trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.selectSound );
02054                         }
02055                 }
02056                 break;
02057         case EV_FIRE_WEAPON:
02058                 DEBUGNAME("EV_FIRE_WEAPON");
02059                 if (cent->currentState.number >= MAX_CLIENTS && cent->currentState.eType != ET_NPC)
02060                 { //special case for turret firing
02061                         vec3_t gunpoint, gunangle;
02062                         mdxaBone_t matrix;
02063 
02064                         weaponInfo_t *weaponInfo = &cg_weapons[WP_TURRET];
02065 
02066                         if ( !weaponInfo->registered )
02067                         {
02068                                 CG_RegisterWeapon(WP_TURRET);
02069                         }
02070 
02071                         if (cent->ghoul2)
02072                         {
02073                                 if (!cent->bolt1)
02074                                 {
02075                                         cent->bolt1 = trap_G2API_AddBolt(cent->ghoul2, 0, "*flash01");
02076                                 }
02077                                 if (!cent->bolt2)
02078                                 {
02079                                         cent->bolt2 = trap_G2API_AddBolt(cent->ghoul2, 0, "*flash02");
02080                                 }
02081                                 trap_G2API_SetBoneAnim(cent->ghoul2, 0, "Bone02", 1, 4, BONE_ANIM_OVERRIDE_FREEZE|BONE_ANIM_BLEND,
02082                                         1.0f, cg.time, -1, 300);
02083                         }
02084                         else
02085                         {
02086                                 break;
02087                         }
02088 
02089                         if (cent->currentState.eventParm)
02090                         {
02091                                 trap_G2API_GetBoltMatrix(cent->ghoul2, 0, cent->bolt2, &matrix, cent->currentState.angles, cent->currentState.origin, cg.time, cgs.gameModels, cent->modelScale);
02092                         }
02093                         else
02094                         {
02095                                 trap_G2API_GetBoltMatrix(cent->ghoul2, 0, cent->bolt1, &matrix, cent->currentState.angles, cent->currentState.origin, cg.time, cgs.gameModels, cent->modelScale);
02096                         }
02097 
02098                         gunpoint[0] = matrix.matrix[0][3];
02099                         gunpoint[1] = matrix.matrix[1][3];
02100                         gunpoint[2] = matrix.matrix[2][3];
02101 
02102                         gunangle[0] = -matrix.matrix[0][0];
02103                         gunangle[1] = -matrix.matrix[1][0];
02104                         gunangle[2] = -matrix.matrix[2][0];
02105 
02106                         trap_FX_PlayEffectID(cgs.effects.mEmplacedMuzzleFlash, gunpoint, gunangle, -1, -1);
02107                 }
02108                 else if (cent->currentState.weapon != WP_EMPLACED_GUN || cent->currentState.eType == ET_NPC)
02109                 {
02110                         if (cent->currentState.eType == ET_NPC &&
02111                                 cent->currentState.NPC_class == CLASS_VEHICLE &&
02112                                 cent->m_pVehicle)
02113                         { //vehicles do nothing for clientside weapon fire events.. at least for now.
02114                                 break;
02115                         }
02116                         CG_FireWeapon( cent, qfalse );
02117                 }
02118                 break;
02119 
02120         case EV_ALT_FIRE:
02121                 DEBUGNAME("EV_ALT_FIRE");
02122 
02123                 if (cent->currentState.weapon == WP_EMPLACED_GUN)
02124                 { //don't do anything for emplaced stuff
02125                         break;
02126                 }
02127 
02128                 if (cent->currentState.eType == ET_NPC &&
02129                         cent->currentState.NPC_class == CLASS_VEHICLE &&
02130                         cent->m_pVehicle)
02131                 { //vehicles do nothing for clientside weapon fire events.. at least for now.
02132                         break;
02133                 }
02134 
02135                 CG_FireWeapon( cent, qtrue );
02136 
02137                 //if you just exploded your detpacks and you have no ammo left for them, autoswitch
02138                 if ( cg.snap->ps.clientNum == cent->currentState.number &&
02139                         cg.snap->ps.weapon == WP_DET_PACK )
02140                 {
02141                         if (cg.snap->ps.ammo[weaponData[WP_DET_PACK].ammoIndex] == 0) 
02142                         {
02143                                 CG_OutOfAmmoChange(WP_DET_PACK);
02144                         }
02145                 }
02146 
02147                 break;
02148 
02149         case EV_SABER_ATTACK:
02150                 DEBUGNAME("EV_SABER_ATTACK");
02151                 {
02152                         qhandle_t swingSound = trap_S_RegisterSound(va("sound/weapons/saber/saberhup%i.wav", Q_irand(1, 8)));
02153                         clientInfo_t *client = NULL;
02154                         if ( cg_entities[es->number].currentState.eType == ET_NPC )
02155                         {
02156                                 client = cg_entities[es->number].npcClient;
02157                         }
02158                         else if ( es->number < MAX_CLIENTS )
02159                         {
02160                                 client = &cgs.clientinfo[es->number];
02161                         }
02162                         if ( client && client->infoValid && client->saber[0].swingSound[0] )
02163                         {//custom swing sound
02164                                 swingSound = client->saber[0].swingSound[Q_irand(0,2)];
02165                         }
02166             trap_S_StartSound(es->pos.trBase, es->number, CHAN_WEAPON, swingSound );
02167                 }
02168                 break;
02169 
02170         case EV_SABER_HIT:
02171                 DEBUGNAME("EV_SABER_HIT");
02172                 {
02173                         int hitPersonFxID = cgs.effects.mSaberBloodSparks;
02174                         int hitPersonSmallFxID = cgs.effects.mSaberBloodSparksSmall;
02175                         int hitPersonMidFxID = cgs.effects.mSaberBloodSparksMid;
02176                         int hitOtherFxID = cgs.effects.mSaberCut;
02177                         int hitSound = trap_S_RegisterSound(va("sound/weapons/saber/saberhit%i.wav", Q_irand(1, 3)));
02178                         
02179                         if ( es->otherEntityNum2 >= 0
02180                                 && es->otherEntityNum2 < ENTITYNUM_NONE )
02181                         {//we have a specific person who is causing this effect, see if we should override it with any custom saber effects/sounds
02182                                 clientInfo_t *client = NULL;
02183                                 if ( cg_entities[es->otherEntityNum2].currentState.eType == ET_NPC )
02184                                 {
02185                                         client = cg_entities[es->otherEntityNum2].npcClient;
02186                                 }
02187                                 else if ( es->otherEntityNum2 < MAX_CLIENTS )
02188                                 {
02189                                         client = &cgs.clientinfo[es->otherEntityNum2];
02190                                 }
02191                                 if ( client && client->infoValid )
02192                                 {
02193                                         int saberNum = es->weapon;
02194                                         int bladeNum = es->legsAnim;
02195                                         if ( WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) )
02196                                         {//use second blade style values
02197                                                 if ( client->saber[saberNum].hitPersonEffect2 )
02198                                                 {//custom hit person effect
02199                                                         hitPersonFxID = hitPersonSmallFxID = hitPersonMidFxID = client->saber[saberNum].hitPersonEffect2;
02200                                                 }
02201                                                 if ( client->saber[saberNum].hitOtherEffect2 )
02202                                                 {//custom hit other effect
02203                                                         hitOtherFxID = client->saber[saberNum].hitOtherEffect2;
02204                                                 }
02205                                                 if ( client->saber[saberNum].hit2Sound[0] )
02206                                                 {//custom hit sound
02207                                                         hitSound = client->saber[saberNum].hit2Sound[Q_irand(0,2)];
02208                                                 }
02209                                         }
02210                                         else
02211                                         {//use first blade style values
02212                                                 if ( client->saber[saberNum].hitPersonEffect )
02213                                                 {//custom hit person effect
02214                                                         hitPersonFxID = hitPersonSmallFxID = hitPersonMidFxID = client->saber[saberNum].hitPersonEffect;
02215                                                 }
02216                                                 if ( client->saber[saberNum].hitOtherEffect )
02217                                                 {//custom hit other effect
02218                                                         hitOtherFxID = client->saber[0].hitOtherEffect;
02219                                                 }
02220                                                 if ( client->saber[saberNum].hitSound[0] )
02221                                                 {//custom hit sound
02222                                                         hitSound = client->saber[saberNum].hitSound[Q_irand(0,2)];
02223                                                 }
02224                                         }
02225                                 }
02226                         }
02227 
02228                         if (es->eventParm == 16)
02229                         { //Make lots of sparks, something special happened
02230                                 vec3_t fxDir;
02231                                 VectorCopy(es->angles, fxDir);
02232                                 if (!fxDir[0] && !fxDir[1] && !fxDir[2])
02233                                 {
02234                                         fxDir[1] = 1;
02235                                 }
02236                                 trap_S_StartSound(es->origin, es->number, CHAN_AUTO, hitSound );
02237                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02238                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02239                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02240                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02241                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02242                                 trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02243                         }
02244                         else if (es->eventParm)
02245                         { //hit a person
02246                                 vec3_t fxDir;
02247                                 VectorCopy(es->angles, fxDir);
02248                                 if (!fxDir[0] && !fxDir[1] && !fxDir[2])
02249                                 {
02250                                         fxDir[1] = 1;
02251                                 }
02252                                 trap_S_StartSound(es->origin, es->number, CHAN_AUTO, hitSound );
02253                                 if ( es->eventParm == 3 )
02254                                 {       // moderate or big hits.
02255                                         trap_FX_PlayEffectID( hitPersonSmallFxID, es->origin, fxDir, -1, -1 );
02256                                 }
02257                                 else if ( es->eventParm == 2 )
02258                                 {       // this is for really big hits.
02259                                         trap_FX_PlayEffectID( hitPersonMidFxID, es->origin, fxDir, -1, -1 );
02260                                 }
02261                                 else
02262                                 {       // this should really just be done in the effect itself, no?
02263                                         trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02264                                         trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02265                                         trap_FX_PlayEffectID( hitPersonFxID, es->origin, fxDir, -1, -1 );
02266                                 }
02267                         }
02268                         else
02269                         { //hit something else
02270                                 vec3_t fxDir;
02271                                 VectorCopy(es->angles, fxDir);
02272                                 if (!fxDir[0] && !fxDir[1] && !fxDir[2])
02273                                 {
02274                                         fxDir[1] = 1;
02275                                 }
02276                                 //old jk2mp method
02277                                 /*
02278                                 trap_S_StartSound(es->origin, es->number, CHAN_AUTO, trap_S_RegisterSound("sound/weapons/saber/saberhit.wav"));
02279                                 trap_FX_PlayEffectID( trap_FX_RegisterEffect("saber/spark.efx"), es->origin, fxDir, -1, -1 );
02280                                 */
02281 
02282                                 trap_FX_PlayEffectID( hitOtherFxID, es->origin, fxDir, -1, -1 );
02283                         }
02284 
02285                         //rww - this means we have the number of the ent being hit and the ent that owns the saber doing
02286                         //the hit. This being the case, we can store these indecies and the current time in order to do
02287                         //some visual tricks on the client between frames to make it look like we're actually continuing
02288                         //to hit between server frames.
02289                         if (es->otherEntityNum != ENTITYNUM_NONE && es->otherEntityNum2 != ENTITYNUM_NONE)
02290                         {
02291                                 centity_t *saberOwner;
02292 
02293                                 saberOwner = &cg_entities[es->otherEntityNum2];
02294 
02295                                 saberOwner->serverSaberHitIndex = es->otherEntityNum;
02296                                 saberOwner->serverSaberHitTime = cg.time;
02297 
02298                                 if (es->eventParm)
02299                                 {
02300                                         saberOwner->serverSaberFleshImpact = qtrue;
02301                                 }
02302                                 else
02303                                 {
02304                                         saberOwner->serverSaberFleshImpact = qfalse;
02305                                 }
02306                         }
02307                 }
02308                 break;
02309 
02310         case EV_SABER_BLOCK:
02311                 DEBUGNAME("EV_SABER_BLOCK");
02312                 {
02313                         if (es->eventParm)
02314                         { //saber block
02315                                 qboolean cullPass = qfalse;
02316                                 int                     blockFXID = cgs.effects.mSaberBlock;
02317                                 qhandle_t       blockSound = trap_S_RegisterSound(va( "sound/weapons/saber/saberblock%d.wav", Q_irand(1, 9) ));
02318                                 qboolean        noFlare = qfalse;
02319 
02320                                 if ( es->otherEntityNum2 >= 0
02321                                         && es->otherEntityNum2 < ENTITYNUM_NONE )
02322                                 {//we have a specific person who is causing this effect, see if we should override it with any custom saber effects/sounds
02323                                         clientInfo_t *client = NULL;
02324                                         if ( cg_entities[es->otherEntityNum2].currentState.eType == ET_NPC )
02325                                         {
02326                                                 client = cg_entities[es->otherEntityNum2].npcClient;
02327                                         }
02328                                         else if ( es->otherEntityNum2 < MAX_CLIENTS )
02329                                         {
02330                                                 client = &cgs.clientinfo[es->otherEntityNum2];
02331                                         }
02332                                         if ( client && client->infoValid )
02333                                         {
02334                                                 int saberNum = es->weapon;
02335                                                 int bladeNum = es->legsAnim;
02336                                                 if ( WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) )
02337                                                 {//use second blade style values
02338                                                         if ( client->saber[saberNum].blockEffect2 )
02339                                                         {//custom saber block effect
02340                                                                 blockFXID = client->saber[saberNum].blockEffect2;
02341                                                         }
02342                                                         if ( client->saber[saberNum].block2Sound[0] )
02343                                                         {//custom hit sound
02344                                                                 blockSound = client->saber[saberNum].block2Sound[Q_irand(0,2)];
02345                                                         }
02346                                                 }
02347                                                 else
02348                                                 {
02349                                                         if ( client->saber[saberNum].blockEffe