codemp/cgame/cg_players.c File Reference

#include "cg_local.h"
#include "..\ghoul2\g2.h"
#include "bg_saga.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define TURN_ON   0x00000000
#define TURN_OFF   0x00000100
#define MAX_SURF_LIST_SIZE   1024
#define DEFAULT_FEMALE_SOUNDPATH   "chars/mp_generic_female/misc"
#define DEFAULT_MALE_SOUNDPATH   "chars/mp_generic_male/misc"
#define FOOTSTEP_DISTANCE   32
#define SHADOW_DISTANCE   128
#define REFRACT_EFFECT_DURATION   500
#define MAX_SHIELD_TIME   2000.0
#define MIN_SHIELD_TIME   2000.0
#define MAX_MARK_FRAGMENTS   128
#define MAX_MARK_POINTS   384
#define CG_MAX_SABER_COMP_TIME   400
#define SABER_TRAIL_TIME   40.0f
#define FX_USE_ALPHA   0x08000000
#define SPEED_TRAIL_DISTANCE   6
#define SMOOTH_G2ANIM_LERPANGLES
#define JETPACK_MODEL   "models/weapons2/jetpack/model.glm"
#define RARMBIT   (1 << (G2_MODELPART_RARM-10))
#define RHANDBIT   (1 << (G2_MODELPART_RHAND-10))
#define WAISTBIT   (1 << (G2_MODELPART_WAIST-10))
#define FLYBYSOUNDTIME   2000

Functions

void CG_AddRadarEnt (centity_t *cent)
void CG_AddBracketedEnt (centity_t *cent)
qboolean CG_InFighter (void)
qboolean WP_SaberBladeUseSecondBladeStyle (saberInfo_t *saber, int bladeNum)
void CG_Disintegration (centity_t *cent, refEntity_t *ent)
sfxHandle_t CG_CustomSound (int clientNum, const char *soundName)
qboolean CG_ParseSurfsFile (const char *modelName, const char *skinName, char *surfOff, char *surfOn)
qboolean BG_IsValidCharacterModel (const char *modelName, const char *skinName)
qboolean BG_ValidateSkinForTeam (const char *modelName, char *skinName, int team, float *colors)
int CG_G2SkelForModel (void *g2)
int CG_G2EvIndexForModel (void *g2, int animIndex)
void CG_LoadCISounds (clientInfo_t *ci, qboolean modelloaded)
void CG_LoadClientInfo (clientInfo_t *ci)
void WP_SetSaber (int entNum, saberInfo_t *sabers, int saberNum, const char *saberName)
void CG_NewClientInfo (int clientNum, qboolean entitiesInitialized)
void CG_ActualLoadDeferredPlayers (void)
void CG_LoadDeferredPlayers (void)
void CG_PlayerAnimEventDo (centity_t *cent, animevent_t *animEvent)
void CG_PlayerAnimEvents (int animFileIndex, int eventFileIndex, qboolean torso, int oldFrame, int frame, int entNum)
void CG_TriggerAnimSounds (centity_t *cent)
qboolean CG_InRoll (centity_t *cent)
qboolean CG_InRollAnim (centity_t *cent)
qboolean BG_SaberStanceAnim (int anim)
qboolean PM_RunningAnim (int anim)
qboolean PM_WalkingAnim (int anim)
void CG_G2SetBoneAngles (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 CG_Rag_Trace (trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int skipNumber, int mask)
qboolean CG_RagDoll (centity_t *cent, vec3_t forcedAngles)
void CG_G2ServerBoneAngles (centity_t *cent)
qboolean CG_G2PlayerHeadAnims (centity_t *cent)
void CG_AddRefEntityWithPowerups (refEntity_t *ent, entityState_t *state, int team)
void CG_PlayerShieldHit (int entitynum, vec3_t dir, int amount)
void CG_DrawPlayerShield (centity_t *cent, vec3_t origin)
void CG_PlayerHitFX (centity_t *cent)
int CG_LightVerts (vec3_t normal, int numVerts, polyVert_t *verts)
void CG_DoSaber (vec3_t origin, vec3_t dir, float length, float lengthMax, float radius, saber_colors_t color, int rfx, qboolean doLight)
void CG_GetTagWorldPosition (refEntity_t *model, char *tag, vec3_t pos, vec3_t axis[3])
markPoly_tCG_AllocMark ()
void CG_CreateSaberMarks (vec3_t start, vec3_t end, vec3_t normal)
qboolean CG_G2TraceCollide (trace_t *tr, vec3_t const mins, vec3_t const maxs, const vec3_t lastValidStart, const vec3_t lastValidEnd)
void CG_G2SaberEffects (vec3_t start, vec3_t end, centity_t *owner)
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_SaberCompWork (vec3_t start, vec3_t end, centity_t *owner, int saberNum, int bladeNum)
qboolean BG_SuperBreakWinAnim (int anim)
void CG_AddSaberBlade (centity_t *cent, centity_t *scent, refEntity_t *saber, int renderfx, int modelIndex, int saberNum, int bladeNum, vec3_t origin, vec3_t angles, qboolean fromSaber, qboolean dontDraw)
int CG_IsMindTricked (int trickIndex1, int trickIndex2, int trickIndex3, int trickIndex4, int client)
void CG_DrawPlayerSphere (centity_t *cent, vec3_t origin, float scale, int shader)
void CG_AddLightningBeam (vec3_t start, vec3_t end)
void CG_AddRandomLightning (vec3_t start, vec3_t end)
qboolean CG_ThereIsAMaster (void)
int CG_HandleAppendedSkin (char *modelName)
void BG_GetVehicleModelName (char *modelname)
void BG_GetVehicleSkinName (char *skinname)
void CG_CacheG2AnimInfo (char *modelName)
void CG_HandleNPCSounds (centity_t *cent)
void G_CreateAnimalNPC (Vehicle_t **pVeh, const char *strAnimalType)
void G_CreateSpeederNPC (Vehicle_t **pVeh, const char *strType)
void G_CreateWalkerNPC (Vehicle_t **pVeh, const char *strAnimalType)
void G_CreateFighterNPC (Vehicle_t **pVeh, const char *strType)
void CG_G2AnimEntModelLoad (centity_t *cent)
qboolean CG_VehicleShouldDrawShields (centity_t *vehCent)
qboolean CG_VehicleAttachDroidUnit (centity_t *droidCent, refEntity_t *legs)
void CG_G2Animated (centity_t *cent)
void CG_CreateNPCClient (clientInfo_t **ci)
void CG_DestroyNPCClient (clientInfo_t **ci)
void CG_InitJetpackGhoul2 (void)
void CG_CleanJetpackGhoul2 (void)
int BG_EmplacedView (vec3_t baseAngles, vec3_t angles, float *newYaw, float constraint)
float CG_RadiusForCent (centity_t *cent)
void CG_CheckThirdPersonAlpha (centity_t *cent, refEntity_t *legs)
void CG_Player (centity_t *cent)
void CG_ResetPlayerEntity (centity_t *cent)

Variables

vmCvar_t cg_thirdPersonAlpha
int cgSiegeTeam1PlShader
int cgSiegeTeam2PlShader
stringID_table_t animTable [MAX_ANIMATIONS+1]
char * cg_customSoundNames [MAX_CUSTOM_SOUNDS]
const char * cg_customCombatSoundNames [MAX_CUSTOM_COMBAT_SOUNDS]
const char * cg_customExtraSoundNames [MAX_CUSTOM_EXTRA_SOUNDS]
const char * cg_customJediSoundNames [MAX_CUSTOM_JEDI_SOUNDS]
const char * cg_customDuelSoundNames [MAX_CUSTOM_DUEL_SOUNDS]
qboolean cgQueueLoad = qfalse
char * forceHolocronModels []
playerState_tcgSendPS [MAX_GENTITIES]
void * cg_g2JetpackInstance = NULL
int cg_lastHyperSpaceEffectTime = 0
vec3_t cg_crosshairPos
vec3_t cameraCurLoc


Define Documentation

#define CG_MAX_SABER_COMP_TIME   400
 

Definition at line 5736 of file cg_players.c.

Referenced by CG_SaberCompWork().

#define DEFAULT_FEMALE_SOUNDPATH   "chars/mp_generic_female/misc"
 

Definition at line 797 of file cg_players.c.

Referenced by CG_LoadCISounds().

#define DEFAULT_MALE_SOUNDPATH   "chars/mp_generic_male/misc"
 

Definition at line 798 of file cg_players.c.

Referenced by CG_LoadCISounds().

#define FLYBYSOUNDTIME   2000
 

Definition at line 7970 of file cg_players.c.

#define FOOTSTEP_DISTANCE   32
 

Definition at line 1988 of file cg_players.c.

#define FX_USE_ALPHA   0x08000000
 

Definition at line 5987 of file cg_players.c.

#define JETPACK_MODEL   "models/weapons2/jetpack/model.glm"
 

Definition at line 7880 of file cg_players.c.

Referenced by CG_InitJetpackGhoul2().

#define MAX_MARK_FRAGMENTS   128
 

Definition at line 5458 of file cg_players.c.

#define MAX_MARK_POINTS   384
 

Definition at line 5459 of file cg_players.c.

#define MAX_SHIELD_TIME   2000.0
 

Definition at line 5073 of file cg_players.c.

Referenced by CG_PlayerShieldHit().

#define MAX_SURF_LIST_SIZE   1024
 

Definition at line 313 of file cg_players.c.

Referenced by CG_ParseSurfsFile().

#define MIN_SHIELD_TIME   2000.0
 

Definition at line 5074 of file cg_players.c.

Referenced by CG_DrawPlayerShield().

#define RARMBIT   (1 << (G2_MODELPART_RARM-10))
 

Definition at line 7913 of file cg_players.c.

Referenced by CG_Player().

#define REFRACT_EFFECT_DURATION   500
 

Definition at line 4797 of file cg_players.c.

#define RHANDBIT   (1 << (G2_MODELPART_RHAND-10))
 

Definition at line 7914 of file cg_players.c.

Referenced by CG_Player().

#define SABER_TRAIL_TIME   40.0f
 

Definition at line 5986 of file cg_players.c.

Referenced by CG_AddSaberBlade().

#define SHADOW_DISTANCE   128
 

Definition at line 4611 of file cg_players.c.

#define SMOOTH_G2ANIM_LERPANGLES
 

Definition at line 7404 of file cg_players.c.

#define SPEED_TRAIL_DISTANCE   6
 

Definition at line 6520 of file cg_players.c.

Referenced by CG_Player().

#define TURN_OFF   0x00000100
 

Definition at line 21 of file cg_players.c.

Referenced by ATST_Attack(), CG_G2Animated(), GM_Dying(), Mark1_dying(), NPC_BSGM_Default(), NPC_Droid_Pain(), NPC_GalakMech_Init(), NPC_Mark1_Pain(), and NPC_Mark2_Pain().

#define TURN_ON   0x00000000
 

Definition at line 20 of file cg_players.c.

Referenced by CG_G2Animated(), GM_StartGloat(), NPC_BSGM_Default(), NPC_GalakMech_Init(), and NPC_SetSurfaceOnOff().

#define WAISTBIT   (1 << (G2_MODELPART_WAIST-10))
 

Definition at line 7915 of file cg_players.c.

Referenced by CG_Player().


Function Documentation

int BG_EmplacedView vec3_t  baseAngles,
vec3_t  angles,
float *  newYaw,
float  constraint
 

Definition at line 2703 of file bg_misc.c.

02704 {
02705         float dif = AngleSubtract(baseAngles[YAW], angles[YAW]);
02706 
02707         if (dif > constraint ||
02708                 dif < -constraint)
02709         {
02710                 float amt;
02711 
02712                 if (dif > constraint)
02713                 {
02714                         amt = (dif-constraint);
02715                         dif = constraint;
02716                 }
02717                 else if (dif < -constraint)
02718                 {
02719                         amt = (dif+constraint);
02720                         dif = -constraint;
02721                 }
02722                 else
02723                 {
02724                         amt = 0.0f;
02725                 }
02726 
02727                 *newYaw = AngleSubtract(angles[YAW], -dif);
02728 
02729                 if (amt > 1.0f || amt < -1.0f)
02730                 { //significant, force the view
02731                         return 2;
02732                 }
02733                 else
02734                 { //just a little out of range
02735                         return 1;
02736                 }
02737         }
02738 
02739         return 0;
02740 }

void BG_GetVehicleModelName char *  modelname  ) 
 

Definition at line 1599 of file bg_vehicleLoad.c.

01600 {
01601         char *vehName = &modelname[1];
01602         int vIndex = BG_VehicleGetIndex(vehName);
01603         assert(modelname[0] == '$');
01604         
01605         if (vIndex == VEHICLE_NONE)
01606         {
01607                 Com_Error(ERR_DROP, "BG_GetVehicleModelName:  couldn't find vehicle %s", vehName);
01608         }
01609 
01610     strcpy(modelname, g_vehicleInfo[vIndex].model);     
01611 }

void BG_GetVehicleSkinName char *  skinname  ) 
 

Definition at line 1613 of file bg_vehicleLoad.c.

References BG_VehicleGetIndex(), Com_Error(), ERR_DROP, g_vehicleInfo, vehicleInfo_t::skin, strcpy(), and VEHICLE_NONE.

Referenced by CG_CacheG2AnimInfo().

01614 {
01615         char *vehName = &skinname[1];
01616         int vIndex = BG_VehicleGetIndex(vehName);
01617         assert(skinname[0] == '$');
01618         
01619         if (vIndex == VEHICLE_NONE)
01620         {
01621                 Com_Error(ERR_DROP, "BG_GetVehicleSkinName:  couldn't find vehicle %s", vehName);
01622         }
01623 
01624     if ( !g_vehicleInfo[vIndex].skin 
01625                 || !g_vehicleInfo[vIndex].skin[0] )
01626         {
01627                 skinname[0] = 0;
01628         }
01629         else
01630         {
01631                 strcpy(skinname, g_vehicleInfo[vIndex].skin);   
01632         }
01633 }

qboolean BG_IsValidCharacterModel const char *  modelName,
const char *  skinName
 

Definition at line 2744 of file bg_misc.c.

02745 {
02746         if (!Q_stricmp(skinName, "menu"))
02747         {
02748                 return qfalse;
02749         }
02750         else if (!Q_stricmp(modelName, "kyle"))
02751         {
02752                 if (!Q_stricmp(skinName, "fpls"))
02753                 {
02754                         return qfalse;
02755                 }
02756                 else if (!Q_stricmp(skinName, "fpls2"))
02757                 {
02758                         return qfalse;
02759                 }
02760                 else if (!Q_stricmp(skinName, "fpls3"))
02761                 {
02762                         return qfalse;
02763                 }
02764         }
02765         return qtrue;
02766 }

qboolean BG_SaberStanceAnim int  anim  ) 
 

Definition at line 33 of file bg_panimate.c.

00034 {
00035         switch ( anim )
00036         {
00037         case BOTH_STAND1://not really a saberstance anim, actually... "saber off" stance
00038         case BOTH_STAND2://single-saber, medium style
00039         case BOTH_SABERFAST_STANCE://single-saber, fast style
00040         case BOTH_SABERSLOW_STANCE://single-saber, strong style
00041         case BOTH_SABERSTAFF_STANCE://saber staff style
00042         case BOTH_SABERDUAL_STANCE://dual saber style
00043                 return qtrue;
00044                 break;
00045         }
00046         return qfalse;
00047 }

qboolean BG_SuperBreakWinAnim int  anim  ) 
 

Definition at line 1458 of file bg_panimate.c.

01459 {
01460         switch ( anim )
01461         {
01462         case BOTH_LK_S_DL_S_SB_1_W:     //super break I won
01463         case BOTH_LK_S_DL_T_SB_1_W:     //super break I won
01464         case BOTH_LK_S_ST_S_SB_1_W:     //super break I won
01465         case BOTH_LK_S_ST_T_SB_1_W:     //super break I won
01466         case BOTH_LK_S_S_S_SB_1_W:      //super break I won
01467         case BOTH_LK_S_S_T_SB_1_W:      //super break I won
01468         case BOTH_LK_DL_DL_S_SB_1_W:    //super break I won
01469         case BOTH_LK_DL_DL_T_SB_1_W:    //super break I won
01470         case BOTH_LK_DL_ST_S_SB_1_W:    //super break I won
01471         case BOTH_LK_DL_ST_T_SB_1_W:    //super break I won
01472         case BOTH_LK_DL_S_S_SB_1_W:     //super break I won
01473         case BOTH_LK_DL_S_T_SB_1_W:     //super break I won
01474         case BOTH_LK_ST_DL_S_SB_1_W:    //super break I won
01475         case BOTH_LK_ST_DL_T_SB_1_W:    //super break I won
01476         case BOTH_LK_ST_ST_S_SB_1_W:    //super break I won
01477         case BOTH_LK_ST_ST_T_SB_1_W:    //super break I won
01478         case BOTH_LK_ST_S_S_SB_1_W:     //super break I won
01479         case BOTH_LK_ST_S_T_SB_1_W:     //super break I won
01480                 return qtrue;
01481                 break;
01482         }
01483         return qfalse;
01484 }

qboolean BG_ValidateSkinForTeam const char *  modelName,
char *  skinName,
int  team,
float *  colors
 

Definition at line 2768 of file bg_misc.c.

02769 {
02770         if (!Q_stricmpn(modelName, "jedi_",5))
02771         { //argh, it's a custom player skin!
02772                 if (team == TEAM_RED && colors)
02773                 {
02774                         colors[0] = 1.0f;
02775                         colors[1] = 0.0f;
02776                         colors[2] = 0.0f;
02777                 }
02778                 else if (team == TEAM_BLUE && colors)
02779                 {
02780                         colors[0] = 0.0f;
02781                         colors[1] = 0.0f;
02782                         colors[2] = 1.0f;
02783                 }
02784                 return qtrue;
02785         }
02786 
02787         if (team == TEAM_RED)
02788         {
02789                 if ( Q_stricmp( "red", skinName ) != 0 )
02790                 {//not "red"
02791                         if ( Q_stricmp( "blue", skinName ) == 0
02792                                 || Q_stricmp( "default", skinName ) == 0
02793                                 || strchr(skinName, '|')//a multi-skin playerModel
02794                                 || !BG_IsValidCharacterModel(modelName, skinName) )
02795                         {
02796                                 Q_strncpyz(skinName, "red", MAX_QPATH);
02797                                 return qfalse;
02798                         }
02799                         else
02800                         {//need to set it to red
02801                                 int len = strlen( skinName );
02802                                 if ( len < 3 )
02803                                 {//too short to be "red"
02804                                         Q_strcat(skinName, MAX_QPATH, "_red");
02805                                 }
02806                                 else
02807                                 {
02808                                         char    *start = &skinName[len-3];
02809                                         if ( Q_strncmp( "red", start, 3 ) != 0 )
02810                                         {//doesn't already end in "red"
02811                                                 if ( len+4 >= MAX_QPATH )
02812                                                 {//too big to append "_red"
02813                                                         Q_strncpyz(skinName, "red", MAX_QPATH);
02814                                                         return qfalse;
02815                                                 }
02816                                                 else
02817                                                 {
02818                                                         Q_strcat(skinName, MAX_QPATH, "_red");
02819                                                 }
02820                                         }
02821                                 }
02822                                 //if file does not exist, set to "red"
02823                                 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02824                                 {
02825                                         Q_strncpyz(skinName, "red", MAX_QPATH);
02826                                 }
02827                                 return qfalse;
02828                         }
02829                 }
02830 
02831         }
02832         else if (team == TEAM_BLUE)
02833         {
02834                 if ( Q_stricmp( "blue", skinName ) != 0 )
02835                 {
02836                         if ( Q_stricmp( "red", skinName ) == 0
02837                                 || Q_stricmp( "default", skinName ) == 0
02838                                 || strchr(skinName, '|')//a multi-skin playerModel
02839                                 || !BG_IsValidCharacterModel(modelName, skinName) )
02840                         {
02841                                 Q_strncpyz(skinName, "blue", MAX_QPATH);
02842                                 return qfalse;
02843                         }
02844                         else
02845                         {//need to set it to blue
02846                                 int len = strlen( skinName );
02847                                 if ( len < 4 )
02848                                 {//too short to be "blue"
02849                                         Q_strcat(skinName, MAX_QPATH, "_blue");
02850                                 }
02851                                 else 
02852                                 {
02853                                         char    *start = &skinName[len-4];
02854                                         if ( Q_strncmp( "blue", start, 4 ) != 0 )
02855                                         {//doesn't already end in "blue"
02856                                                 if ( len+5 >= MAX_QPATH )
02857                                                 {//too big to append "_blue"
02858                                                         Q_strncpyz(skinName, "blue", MAX_QPATH);
02859                                                         return qfalse;
02860                                                 }
02861                                                 else
02862                                                 {
02863                                                         Q_strcat(skinName, MAX_QPATH, "_blue");
02864                                                 }
02865                                         }
02866                                 }
02867                                 //if file does not exist, set to "blue"
02868                                 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02869                                 {
02870                                         Q_strncpyz(skinName, "blue", MAX_QPATH);
02871                                 }
02872                                 return qfalse;
02873                         }
02874                 }
02875         }
02876         return qtrue;
02877 }

void CG_ActualLoadDeferredPlayers void   ) 
 

Definition at line 1953 of file cg_players.c.

References CG_LoadClientInfo(), cgs, cgs_t::clientinfo, and cgs_t::maxclients.

Referenced by CG_DrawActiveFrame().

01954 {
01955         int             i;
01956         clientInfo_t    *ci;
01957 
01958         // scan for a deferred player to load
01959         for ( i = 0, ci = cgs.clientinfo ; i < cgs.maxclients ; i++, ci++ ) {
01960                 if ( ci->infoValid && ci->deferred ) {
01961                         CG_LoadClientInfo( ci );
01962 //                      break;
01963                 }
01964         }
01965 }

void CG_AddBracketedEnt centity_t cent  ) 
 

Definition at line 811 of file cg_ents.c.

References cg_t::bracketedEntities, cg_t::bracketedEntityCount, centity_t, cg, Com_Printf(), centity_s::currentState, entityState_s::number, and cg_t::radarEntities.

Referenced by CG_Player().

00812 {
00813         if (cg.bracketedEntityCount == sizeof(cg.bracketedEntities)/sizeof(cg.bracketedEntities[0]))
00814         {       
00815 #ifdef _DEBUG
00816                 Com_Printf("^3Warning: CG_AddBracketedEnt full. (%d max)\n", sizeof(cg.radarEntities)/sizeof(cg.bracketedEntities[0]));
00817 #endif
00818                 return;
00819         }
00820         cg.bracketedEntities[cg.bracketedEntityCount++] = cent->currentState.number;
00821 }

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_AddLightningBeam vec3_t  start,
vec3_t  end
 

Definition at line 6628 of file cg_players.c.

References addbezierArgStruct_t, addbezierArgStruct_s::alpha1, addbezierArgStruct_s::alpha2, addbezierArgStruct_s::alphaParm, cg, addbezierArgStruct_s::control1, addbezierArgStruct_s::control1Vel, addbezierArgStruct_s::control2, addbezierArgStruct_s::control2Vel, crandom, addbezierArgStruct_s::end, addbezierArgStruct_s::eRGB, addbezierArgStruct_s::flags, addbezierArgStruct_s::killTime, addbezierArgStruct_s::rgbParm, addbezierArgStruct_s::shader, sin(), addbezierArgStruct_s::size1, addbezierArgStruct_s::size2, addbezierArgStruct_s::sizeParm, addbezierArgStruct_s::sRGB, addbezierArgStruct_s::start, cg_t::time, trap_FX_AddBezier(), trap_R_RegisterShader(), vec3_origin, vec3_t, VectorAdd, VectorCopy, VectorMA, VectorNormalize(), VectorScale, VectorSet, and VectorSubtract.

Referenced by CG_AddRandomLightning().

06629 {
06630         vec3_t  dir, chaos,
06631                         c1, c2,
06632                         v1, v2;
06633         float   len,
06634                         s1, s2, s3;
06635 
06636         addbezierArgStruct_t b;
06637 
06638         VectorCopy(start, b.start);
06639         VectorCopy(end, b.end);
06640 
06641         VectorSubtract( b.end, b.start, dir );
06642         len = VectorNormalize( dir );
06643 
06644         // Get the base control points, we'll work from there
06645         VectorMA( b.start, 0.3333f * len, dir, c1 );
06646         VectorMA( b.start, 0.6666f * len, dir, c2 );
06647 
06648         // get some chaos values that really aren't very chaotic :)
06649         s1 = sin( cg.time * 0.005f ) * 2 + crandom() * 0.2f;
06650         s2 = sin( cg.time * 0.001f );
06651         s3 = sin( cg.time * 0.011f );
06652 
06653         VectorSet( chaos, len * 0.01f * s1,
06654                                                 len * 0.02f * s2,
06655                                                 len * 0.04f * (s1 + s2 + s3));
06656 
06657         VectorAdd( c1, chaos, c1 );
06658         VectorScale( chaos, 4.0f, v1 );
06659 
06660         VectorSet( chaos, -len * 0.02f * s3,
06661                                                 len * 0.01f * (s1 * s2),
06662                                                 -len * 0.02f * (s1 + s2 * s3));
06663 
06664         VectorAdd( c2, chaos, c2 );
06665         VectorScale( chaos, 2.0f, v2 );
06666 
06667         VectorSet( chaos, 1.0f, 1.0f, 1.0f );
06668 
06669         VectorCopy(c1, b.control1);
06670         VectorCopy(vec3_origin, b.control1Vel);
06671         VectorCopy(c2, b.control2);
06672         VectorCopy(vec3_origin, b.control2Vel);
06673 
06674         b.size1 = 6.0f;
06675         b.size2 = 6.0f;
06676         b.sizeParm = 0.0f;
06677         b.alpha1 = 0.0f;
06678         b.alpha2 = 0.2f;
06679         b.alphaParm = 0.5f;
06680         
06681         /*
06682         VectorCopy(WHITE, b.sRGB);
06683         VectorCopy(WHITE, b.eRGB);
06684         */
06685 
06686         b.sRGB[0] = 255;
06687         b.sRGB[1] = 255;
06688         b.sRGB[2] = 255;
06689         VectorCopy(b.sRGB, b.eRGB);
06690 
06691         b.rgbParm = 0.0f;
06692         b.killTime = 50;
06693         b.shader = trap_R_RegisterShader( "gfx/misc/electric2" );
06694         b.flags = 0x00000001; //FX_ALPHA_LINEAR
06695 
06696         trap_FX_AddBezier(&b);
06697 }

void CG_AddRadarEnt centity_t cent  ) 
 

Definition at line 799 of file cg_ents.c.

References centity_t, cg, Com_Printf(), centity_s::currentState, entityState_s::number, cg_t::radarEntities, and cg_t::radarEntityCount.

Referenced by CG_Player().

00800 {
00801         if (cg.radarEntityCount == sizeof(cg.radarEntities)/sizeof(cg.radarEntities[0]))
00802         {       
00803 #ifdef _DEBUG
00804                 Com_Printf("^3Warning: CG_AddRadarEnt full. (%d max)\n", sizeof(cg.radarEntities)/sizeof(cg.radarEntities[0]));
00805 #endif
00806                 return;
00807         }
00808         cg.radarEntities[cg.radarEntityCount++] = cent->currentState.number;
00809 }

void CG_AddRandomLightning vec3_t  start,
vec3_t  end
 

Definition at line 6699 of file cg_players.c.

References CG_AddLightningBeam(), Q_irand(), rand(), vec3_t, and VectorCopy.

06700 {
06701         vec3_t inOrg, outOrg;
06702 
06703         VectorCopy(start, inOrg);
06704         VectorCopy(end, outOrg);
06705 
06706         if ( rand() & 1 )
06707         {
06708                 outOrg[0] += Q_irand(0, 24);
06709                 inOrg[0] += Q_irand(0, 8);
06710         }
06711         else
06712         {
06713                 outOrg[0] -= Q_irand(0, 24);
06714                 inOrg[0] -= Q_irand(0, 8);
06715         }
06716 
06717         if ( rand() & 1 )
06718         {
06719                 outOrg[1] += Q_irand(0, 24);
06720                 inOrg[1] += Q_irand(0, 8);
06721         }
06722         else
06723         {
06724                 outOrg[1] -= Q_irand(0, 24);
06725                 inOrg[1] -= Q_irand(0, 8);
06726         }
06727 
06728         if ( rand() & 1 )
06729         {
06730                 outOrg[2] += Q_irand(0, 50);
06731                 inOrg[2] += Q_irand(0, 40);
06732         }
06733         else
06734         {
06735                 outOrg[2] -= Q_irand(0, 64);
06736                 inOrg[2] -= Q_irand(0, 40);
06737         }
06738 
06739         CG_AddLightningBeam(inOrg, outOrg);
06740 }

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_AddSaberBlade centity_t cent,
centity_t scent,
refEntity_t saber,
int  renderfx,
int  modelIndex,
int  saberNum,
int  bladeNum,
vec3_t  origin,
vec3_t  angles,
qboolean  fromSaber,
qboolean  dontDraw
 

Definition at line 5993 of file cg_players.c.

References effectTrailVertStruct_t::alpha, entityState_s::apos, saberTrail_t::base, BG_SaberInAttack(), BG_SuperBreakWinAnim(), saberInfo_t::blade, saberInfo_t::bladeEffect, saberInfo_t::bladeEffect2, centity_t, cg, CG_CreateSaberMarks(), CG_DoSaber(), cg_entities, CG_G2SaberEffects(), cg_saberClientVisualCompensation, CG_SaberCompWork(), cg_saberContact, cg_saberModelTraceEffect, cg_saberTrail, cg_shadows, cg_speedTrail, CG_Trace(), cgs, CHAN_WEAPON, client, cgs_t::clientinfo, bladeInfo_t::color, centity_s::currentState, effectTrailVertStruct_t::destST, saberTrail_t::duration, EF_PERMANENT, cgs_t::effects, effectTrailArgStruct_t, trace_t::endpos, trace_t::entityNum, ENTITYNUM_NONE, ENTITYNUM_WORLD, ET_NPC, ET_TERRAIN, entityState_s::eType, trace_t::fraction, FX_USE_ALPHA, cgs_t::gameModels, cgs_t::gametype, centity_s::ghoul2, cgs_t::glconfig, GT_SIEGE, GT_TEAM, saberTrail_t::haveOldPos, bladeInfo_t::hitWallDebounceTime, vmCvar_t::integer, cgs_t::jediVmerc, saberTrail_t::lastTime, bladeInfo_t::length, bladeInfo_t::lengthMax, centity_s::lerpOrigin, MASK_SOLID, cgs_t::media, effectTrailArgStruct_s::mKillTime, centity_s::modelScale, polyVert_t::modulate, effectTrailArgStruct_s::mSetFlags, effectTrailArgStruct_s::mShader, cgEffects_t::mSparks, effectTrailArgStruct_s::mVerts, NEGATIVE_Y, cplane_s::normal, centity_s::npcClient, NULL, entityState_s::number, saberInfo_t::numBlades, saberTrail_t::oldNormal, saberTrail_t::oldPos, effectTrailVertStruct_t::origin, ORIGIN, PITCH, trace_t::plane, entityState_s::pos, entityState_s::powerups, PW_SPEED, Q_irand(), qboolean, qfalse, qtrue, bladeInfo_t::radius, effectTrailVertStruct_t::rgb, ROLL, gclient_s::saber, SABER_BLUE, SABER_GREEN, SABER_ORANGE, SABER_PURPLE, SABER_RED, SABER_TRAIL_TIME, SABER_YELLOW, cgMedia_t::saberBlurShader, entityState_s::saberEntityNum, saberInfo_t::saberFlags2, entityState_s::saberInFlight, entityState_s::saberMove, saberMoveData, SFL2_NO_BLADE, SFL2_NO_DLIGHT, SFL2_NO_WALL_MARKS, effectTrailVertStruct_t::ST, polyVert_t::st, glconfig_t::stencilBits, bladeInfo_t::storageTime, SURF_NOIMPACT, trace_t::surfaceFlags, cgMedia_t::swordTrailShader, TEAM_BLUE, TEAM_RED, cg_t::time, saberTrail_t::tip, entityState_s::torsoAnim, bladeInfo_t::trail, saberInfo_t::trailStyle, saberInfo_t::trailStyle2, trap_FX_AddPrimitive(), trap_FX_PlayBoltedEffectID(), trap_FX_PlayEffectID(), trap_G2API_GetBoltMatrix(), trap_R_AddPolyToScene(), trap_R_SetRefractProp(), trap_S_RegisterSound(), trap_S_StartSound(), trajectory_t::trBase, va(), vec3_t, VectorAdd, VectorCopy, VectorMA, VectorNormalize(), VectorSet, VectorSubtract, WP_SaberBladeUseSecondBladeStyle(), polyVert_t::xyz, and YAW.

Referenced by CG_Player().

05994 {
05995