#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_t * | CG_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_t * | cgSendPS [MAX_GENTITIES] |
| void * | cg_g2JetpackInstance = NULL |
| int | cg_lastHyperSpaceEffectTime = 0 |
| vec3_t | cg_crosshairPos |
| vec3_t | cameraCurLoc |
|
|
Definition at line 5736 of file cg_players.c. Referenced by CG_SaberCompWork(). |
|
|
Definition at line 797 of file cg_players.c. Referenced by CG_LoadCISounds(). |
|
|
Definition at line 798 of file cg_players.c. Referenced by CG_LoadCISounds(). |
|
|
Definition at line 7970 of file cg_players.c. |
|
|
Definition at line 1988 of file cg_players.c. |
|
|
Definition at line 5987 of file cg_players.c. |
|
|
Definition at line 7880 of file cg_players.c. Referenced by CG_InitJetpackGhoul2(). |
|
|
Definition at line 5458 of file cg_players.c. |
|
|
Definition at line 5459 of file cg_players.c. |
|
|
Definition at line 5073 of file cg_players.c. Referenced by CG_PlayerShieldHit(). |
|
|
Definition at line 313 of file cg_players.c. Referenced by CG_ParseSurfsFile(). |
|
|
Definition at line 5074 of file cg_players.c. Referenced by CG_DrawPlayerShield(). |
|
|
Definition at line 7913 of file cg_players.c. Referenced by CG_Player(). |
|
|
Definition at line 4797 of file cg_players.c. |
|
|
Definition at line 7914 of file cg_players.c. Referenced by CG_Player(). |
|
|
Definition at line 5986 of file cg_players.c. Referenced by CG_AddSaberBlade(). |
|
|
Definition at line 4611 of file cg_players.c. |
|
|
Definition at line 7404 of file cg_players.c. |
|
|
Definition at line 6520 of file cg_players.c. Referenced by CG_Player(). |
|
|
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(). |
|
|
Definition at line 20 of file cg_players.c. Referenced by CG_G2Animated(), GM_StartGloat(), NPC_BSGM_Default(), NPC_GalakMech_Init(), and NPC_SetSurfaceOnOff(). |
|
|
Definition at line 7915 of file cg_players.c. Referenced by CG_Player(). |
|
||||||||||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
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 vec3_t org_, end, v,
05996 axis_[3] = {0,0,0, 0,0,0, 0,0,0}; // shut the compiler up
05997 trace_t trace;
05998 int i = 0;
05999 int trailDur;
06000 float saberLen;
06001 float diff;
06002 clientInfo_t *client;
06003 centity_t *saberEnt;
06004 saberTrail_t *saberTrail;
06005 mdxaBone_t boltMatrix;
06006 vec3_t futureAngles;
06007 effectTrailArgStruct_t fx;
06008 int scolor = 0;
06009 int useModelIndex = 0;
06010
06011 if (cent->currentState.eType == ET_NPC)
06012 {
06013 client = cent->npcClient;
06014 assert(client);
06015 }
06016 else
06017 {
06018 client = &cgs.clientinfo[cent->currentState.number];
06019 }
06020
06021 saberEnt = &cg_entities[cent->currentState.saberEntityNum];
06022 saberLen = client->saber[saberNum].blade[bladeNum].length;
06023
06024 if (saberLen <= 0 && !dontDraw)
06025 { //don't bother then.
06026 return;
06027 }
06028
06029 futureAngles[YAW] = angles[YAW];
06030 futureAngles[PITCH] = angles[PITCH];
06031 futureAngles[ROLL] = angles[ROLL];
06032
06033
06034 if ( fromSaber )
06035 {
06036 useModelIndex = 0;
06037 }
06038 else
06039 {
06040 useModelIndex = saberNum+1;
06041 }
06042 //Assume bladeNum is equal to the bolt index because bolts should be added in order of the blades.
06043 //if there is an effect on this blade, play it
06044 if ( !WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum )
06045 && client->saber[saberNum].bladeEffect )
06046 {
06047 trap_FX_PlayBoltedEffectID(client->saber[saberNum].bladeEffect, scent->lerpOrigin,
06048 scent->ghoul2, bladeNum, scent->currentState.number, useModelIndex, -1, qfalse);
06049 }
06050 else if ( WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum )
06051 && client->saber[saberNum].bladeEffect2 )
06052 {
06053 trap_FX_PlayBoltedEffectID(client->saber[saberNum].bladeEffect2, scent->lerpOrigin,
06054 scent->ghoul2, bladeNum, scent->currentState.number, useModelIndex, -1, qfalse);
06055 }
06056 //get the boltMatrix
06057 trap_G2API_GetBoltMatrix(scent->ghoul2, useModelIndex, bladeNum, &boltMatrix, futureAngles, origin, cg.time, cgs.gameModels, scent->modelScale);
06058
06059 // work the matrix axis stuff into the original axis and origins used.
06060 BG_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, org_);
06061 BG_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_Y, axis_[0]);
06062
06063 if (!fromSaber && saberEnt && !cent->currentState.saberInFlight)
06064 {
06065 VectorCopy(org_, saberEnt->currentState.pos.trBase);
06066
06067 VectorCopy(axis_[0], saberEnt->currentState.apos.trBase);
06068 }
06069
06070 VectorMA( org_, saberLen, axis_[0], end );
06071
06072 VectorAdd( end, axis_[0], end );
06073
06074 if (cent->currentState.eType == ET_NPC)
06075 {
06076 scolor = client->saber[saberNum].blade[bladeNum].color;
06077 }
06078 else
06079 {
06080 if (saberNum == 0)
06081 {
06082 scolor = client->icolor1;
06083 }
06084 else
06085 {
06086 scolor = client->icolor2;
06087 }
06088 }
06089
06090 if (cgs.gametype >= GT_TEAM &&
06091 cgs.gametype != GT_SIEGE &&
06092 !cgs.jediVmerc &&
06093 cent->currentState.eType != ET_NPC)
06094 {
06095 if (client->team == TEAM_RED)
06096 {
06097 scolor = SABER_RED;
06098 }
06099 else if (client->team == TEAM_BLUE)
06100 {
06101 scolor = SABER_BLUE;
06102 }
06103 }
06104
06105 if (!cg_saberContact.integer)
06106 { //if we don't have saber contact enabled, just add the blade and don't care what it's touching
06107 goto CheckTrail;
06108 }
06109
06110 if (!dontDraw)
06111 {
06112 if (cg_saberModelTraceEffect.integer)
06113 {
06114 CG_G2SaberEffects(org_, end, cent);
06115 }
06116 else if (cg_saberClientVisualCompensation.integer)
06117 {
06118 CG_Trace( &trace, org_, NULL, NULL, end, ENTITYNUM_NONE, MASK_SOLID );
06119
06120 if (trace.fraction != 1)
06121 { //nudge the endpos a very small amount from the beginning to the end, so the comp trace hits at the end.
06122 //I'm only bothering with this because I want to do a backwards trace too in the comp trace, so if the
06123 //blade is sticking through a player or something the standard trace doesn't it, it will make sparks
06124 //on each side.
06125 vec3_t seDif;
06126
06127 VectorSubtract(trace.endpos, org_, seDif);
06128 VectorNormalize(seDif);
06129 trace.endpos[0] += seDif[0]*0.1f;
06130 trace.endpos[1] += seDif[1]*0.1f;
06131 trace.endpos[2] += seDif[2]*0.1f;
06132 }
06133
06134 if (client->saber[saberNum].blade[bladeNum].storageTime < cg.time)
06135 { //debounce it in case our framerate is absurdly high. Using storageTime since it's not used for anything else in the client.
06136 CG_SaberCompWork(org_, trace.endpos, cent, saberNum, bladeNum);
06137
06138 client->saber[saberNum].blade[bladeNum].storageTime = cg.time + 5;
06139 }
06140 }
06141
06142 for ( i = 0; i < 1; i++ )//was 2 because it would go through architecture and leave saber trails on either side of the brush - but still looks bad if we hit a corner, blade is still 8 longer than hit
06143 {
06144 if ( i )
06145 {//tracing from end to base
06146 CG_Trace( &trace, end, NULL, NULL, org_, ENTITYNUM_NONE, MASK_SOLID );
06147 }
06148 else
06149 {//tracing from base to end
06150 CG_Trace( &trace, org_, NULL, NULL, end, ENTITYNUM_NONE, MASK_SOLID );
06151 }
06152
06153 if ( trace.fraction < 1.0f )
06154 {
06155 vec3_t trDir;
06156 VectorCopy(trace.plane.normal, trDir);
06157 if (!trDir[0] && !trDir[1] && !trDir[2])
06158 {
06159 trDir[1] = 1;
06160 }
06161
06162 if ( (client->saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) )
06163 {//don't actually draw the marks/impact effects
06164 }
06165 else
06166 {
06167 if (!(trace.surfaceFlags & SURF_NOIMPACT) ) // never spark on sky
06168 {
06169 trap_FX_PlayEffectID( cgs.effects.mSparks, trace.endpos, trDir, -1, -1 );
06170 }
06171 }
06172
06173 //Stop saber? (it wouldn't look right if it was stuck through a thin wall and unable to hurt players on the other side)
06174 VectorSubtract(org_, trace.endpos, v);
06175 saberLen = VectorLength(v);
06176
06177 VectorCopy(trace.endpos, end);
06178
06179 if ( (client->saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) )
06180 {//don't actually draw the marks
06181 }
06182 else
06183 {//draw marks if we hit a wall
06184 // All I need is a bool to mark whether I have a previous point to work with.
06185 //....come up with something better..
06186 if ( client->saber[saberNum].blade[bladeNum].trail.haveOldPos[i] )
06187 {
06188 if ( trace.entityNum == ENTITYNUM_WORLD || cg_entities[trace.entityNum].currentState.eType == ET_TERRAIN || (cg_entities[trace.entityNum].currentState.eFlags & EF_PERMANENT) )
06189 {//only put marks on architecture
06190 // Let's do some cool burn/glowing mark bits!!!
06191 CG_CreateSaberMarks( client->saber[saberNum].blade[bladeNum].trail.oldPos[i], trace.endpos, trace.plane.normal );
06192
06193 //make a sound
06194 if ( cg.time - client->saber[saberNum].blade[bladeNum].hitWallDebounceTime >= 100 )
06195 {//ugh, need to have a real sound debouncer... or do this game-side
06196 client->saber[saberNum].blade[bladeNum].hitWallDebounceTime = cg.time;
06197 trap_S_StartSound ( trace.endpos, -1, CHAN_WEAPON, trap_S_RegisterSound( va("sound/weapons/saber/saberhitwall%i", Q_irand(1, 3)) ) );
06198 }
06199 }
06200 }
06201 else
06202 {
06203 // if we impact next frame, we'll mark a slash mark
06204 client->saber[saberNum].blade[bladeNum].trail.haveOldPos[i] = qtrue;
06205 // CG_ImpactMark( cgs.media.rivetMarkShader, client->saber[saberNum].blade[bladeNum].trail.oldPos[i], client->saber[saberNum].blade[bladeNum].trail.oldNormal[i],
06206 // 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, qfalse, 1.1f, qfalse );
06207 }
06208 }
06209
06210 // stash point so we can connect-the-dots later
06211 VectorCopy( trace.endpos, client->saber[saberNum].blade[bladeNum].trail.oldPos[i] );
06212 VectorCopy( trace.plane.normal, client->saber[saberNum].blade[bladeNum].trail.oldNormal[i] );
06213 }
06214 else
06215 {
06216 if ( client->saber[saberNum].blade[bladeNum].trail.haveOldPos[i] )
06217 {
06218 // Hmmm, no impact this frame, but we have an old point
06219 // Let's put the mark there, we should use an endcap mark to close the line, but we
06220 // can probably just get away with a round mark
06221 // CG_ImpactMark( cgs.media.rivetMarkShader, client->saber[saberNum].blade[bladeNum].trail.oldPos[i], client->saber[saberNum].blade[bladeNum].trail.oldNormal[i],
06222 // 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, qfalse, 1.1f, qfalse );
06223 }
06224
06225 // we aren't impacting, so turn off our mark tracking mechanism
06226 client->saber[saberNum].blade[bladeNum].trail.haveOldPos[i] = qfalse;
06227 }
06228 }
06229 }
06230 CheckTrail:
06231
06232 if (!cg_saberTrail.integer)
06233 { //don't do the trail in this case
06234 goto JustDoIt;
06235 }
06236
06237 if ( (!WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) && client->saber[saberNum].trailStyle > 1 )
06238 || ( WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) && client->saber[saberNum].trailStyle2 > 1 ) )
06239 {//don't actually draw the trail at all
06240 goto JustDoIt;
06241 }
06242
06243 //FIXME: if trailStyle is 1, use the motion blur instead
06244
06245 saberTrail = &client->saber[saberNum].blade[bladeNum].trail;
06246 saberTrail->duration = saberMoveData[cent->currentState.saberMove].trailLength;
06247
06248 trailDur = (saberTrail->duration/5.0f);
06249 if (!trailDur)
06250 { //hmm.. ok, default
06251 if ( BG_SuperBreakWinAnim(cent->currentState.torsoAnim) )
06252 {
06253 trailDur = 150;
06254 }
06255 else
06256 {
06257 trailDur = SABER_TRAIL_TIME;
06258 }
06259 }
06260
06261 // if we happen to be timescaled or running in a high framerate situation, we don't want to flood
06262 // the system with very small trail slices...but perhaps doing it by distance would yield better results?
06263 if ( cg.time > saberTrail->lastTime + 2 || cg_saberTrail.integer == 2 ) // 2ms
06264 {
06265 if (!dontDraw)
06266 {
06267 if ( (BG_SuperBreakWinAnim(cent->currentState.torsoAnim) || saberMoveData[cent->currentState.saberMove].trailLength > 0 || ((cent->currentState.powerups & (1 << PW_SPEED) && cg_speedTrail.integer)) || (cent->currentState.saberInFlight && saberNum == 0)) && cg.time < saberTrail->lastTime + 2000 ) // if we have a stale segment, don't draw until we have a fresh one
06268 {
06269 #if 0
06270 if (cg_saberTrail.integer == 2 && cg_shadows.integer != 2 && cgs.glconfig.stencilBits >= 4)
06271 {
06272 polyVert_t verts[4];
06273
06274 VectorCopy( org_, verts[0].xyz );
06275 VectorMA( end, 3.0f, axis_[0], verts[1].xyz );
06276 VectorCopy( saberTrail->tip, verts[2].xyz );
06277 VectorCopy( saberTrail->base, verts[3].xyz );
06278
06279 //tc doesn't even matter since we're just gonna stencil an outline, but whatever.
06280 verts[0].st[0] = 0;
06281 verts[0].st[1] = 0;
06282 verts[0].modulate[0] = 255;
06283 verts[0].modulate[1] = 255;
06284 verts[0].modulate[2] = 255;
06285 verts[0].modulate[3] = 255;
06286
06287 verts[1].st[0] = 0;
06288 verts[1].st[1] = 1;
06289 verts[1].modulate[0] = 255;
06290 verts[1].modulate[1] = 255;
06291 verts[1].modulate[2] = 255;
06292 verts[1].modulate[3] = 255;
06293
06294 verts[2].st[0] = 1;
06295 verts[2].st[1] = 1;
06296 verts[2].modulate[0] = 255;
06297 verts[2].modulate[1] = 255;
06298 verts[2].modulate[2] = 255;
06299 verts[2].modulate[3] = 255;
06300
06301 verts[3].st[0] = 1;
06302 verts[3].st[1] = 0;
06303 verts[3].modulate[0] = 255;
06304 verts[3].modulate[1] = 255;
06305 verts[3].modulate[2] = 255;
06306 verts[3].modulate[3] = 255;
06307
06308 //don't capture postrender objects (now we'll postrender the saber so it doesn't get in the capture)
06309 trap_R_SetRefractProp(1.0f, 0.0f, qtrue, qtrue);
06310
06311 //shader 2 is always the crazy refractive shader.
06312 trap_R_AddPolyToScene( 2, 4, verts );
06313 }
06314 else
06315 #endif
06316 {
06317 vec3_t rgb1={255.0f,255.0f,255.0f};
06318
06319 switch( scolor )
06320 {
06321 case SABER_RED:
06322 VectorSet( rgb1, 255.0f, 0.0f, 0.0f );
06323 break;
06324 case SABER_ORANGE:
06325 VectorSet( rgb1, 255.0f, 64.0f, 0.0f );
06326 break;
06327 case SABER_YELLOW:
06328 VectorSet( rgb1, 255.0f, 255.0f, 0.0f );
06329 break;
06330 case SABER_GREEN:
06331 VectorSet( rgb1, 0.0f, 255.0f, 0.0f );
06332 break;
06333 case SABER_BLUE:
06334 VectorSet( rgb1, 0.0f, 64.0f, 255.0f );
06335 break;
06336 case SABER_PURPLE:
06337 VectorSet( rgb1, 220.0f, 0.0f, 255.0f );
06338 break;
06339 default:
06340 VectorSet( rgb1, 0.0f, 64.0f, 255.0f );
06341 break;
06342 }
06343
06344 //Here we will use the happy process of filling a struct in with arguments and passing it to a trap function
06345 //so that we can take the struct and fill in an actual CTrail type using the data within it once we get it
06346 //into the effects area
06347
06348 // Go from new muzzle to new end...then to old end...back down to old muzzle...finally
06349 // connect back to the new muzzle...this is our trail quad
06350 VectorCopy( org_, fx.mVerts[0].origin );
06351 VectorMA( end, 3.0f, axis_[0], fx.mVerts[1].origin );
06352
06353 VectorCopy( saberTrail->tip, fx.mVerts[2].origin );
06354 VectorCopy( saberTrail->base, fx.mVerts[3].origin );
06355
06356 diff = cg.time - saberTrail->lastTime;
06357
06358 // I'm not sure that clipping this is really the best idea
06359 //This prevents the trail from showing at all in low framerate situations.
06360 //if ( diff <= SABER_TRAIL_TIME * 2 )
06361 if ( diff <= 10000 )
06362 { //don't draw it if the last time is way out of date
06363 float oldAlpha = 1.0f - ( diff / trailDur );
06364
06365 if (cg_saberTrail.integer == 2 && cg_shadows.integer != 2 && cgs.glconfig.stencilBits >= 4)
06366 {//does other stuff below
06367 }
06368 else
06369 {
06370 if ( (!WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) && client->saber[saberNum].trailStyle == 1 )
06371 || ( WP_SaberBladeUseSecondBladeStyle( &client->saber[saberNum], bladeNum ) && client->saber[saberNum].trailStyle2 == 1 ) )
06372 {//motion trail
06373 fx.mShader = cgs.media.swordTrailShader;
06374 VectorSet( rgb1, 32.0f, 32.0f, 32.0f ); // make the sith sword trail pretty faint
06375 trailDur *= 2.0f; // stay around twice as long?
06376 }
06377 else
06378 {
06379 fx.mShader = cgs.media.saberBlurShader;
06380 }
06381 fx.mKillTime = trailDur;
06382 fx.mSetFlags = FX_USE_ALPHA;
06383 }
06384
06385 // New muzzle
06386 VectorCopy( rgb1, fx.mVerts[0].rgb );
06387 fx.mVerts[0].alpha = 255.0f;
06388
06389 fx.mVerts[0].ST[0] = 0.0f;
06390 fx.mVerts[0].ST[1] = 1.0f;
06391 fx.mVerts[0].destST[0] = 1.0f;
06392 fx.mVerts[0].destST[1] = 1.0f;
06393
06394 // new tip
06395 VectorCopy( rgb1, fx.mVerts[1].rgb );
06396 fx.mVerts[1].alpha = 255.0f;
06397
06398 fx.mVerts[1].ST[0] = 0.0f;
06399 fx.mVerts[1].ST[1] = 0.0f;
06400 fx.mVerts[1].destST[0] = 1.0f;
06401 fx.mVerts[1].destST[1] = 0.0f;
06402
06403 // old tip
06404 VectorCopy( rgb1, fx.mVerts[2].rgb );
06405 fx.mVerts[2].alpha = 255.0f;
06406
06407 fx.mVerts[2].ST[0] = 1.0f - oldAlpha; // NOTE: this just happens to contain the value I want
06408 fx.mVerts[2].ST[1] = 0.0f;
06409 fx.mVerts[2].destST[0] = 1.0f + fx.mVerts[2].ST[0];
06410 fx.mVerts[2].destST[1] = 0.0f;
06411
06412 // old muzzle
06413 VectorCopy( rgb1, fx.mVerts[3].rgb );
06414 fx.mVerts[3].alpha = 255.0f;
06415
06416 fx.mVerts[3].ST[0] = 1.0f - oldAlpha; // NOTE: this just happens to contain the value I want
06417 fx.mVerts[3].ST[1] = 1.0f;
06418 fx.mVerts[3].destST[0] = 1.0f + fx.mVerts[2].ST[0];
06419 fx.mVerts[3].destST[1] = 1.0f;
06420
06421 if (cg_saberTrail.integer == 2 && cg_shadows.integer != 2 && cgs.glconfig.stencilBits >= 4)
06422 {
06423 trap_R_SetRefractProp(1.0f, 0.0f, qtrue, qtrue); //don't need to do this every frame.. but..
06424
06425 if (BG_SaberInAttack(cent->currentState.saberMove)
06426 ||BG_SuperBreakWinAnim(cent->currentState.torsoAnim))
06427 { //in attack, strong trail
06428 fx.mKillTime = 300;
06429 }
06430 else
06431 { //faded trail
06432 fx.mKillTime = 40;
06433 }
06434 fx.mShader = 2; //2 is always refractive shader
06435 fx.mSetFlags = FX_USE_ALPHA;
06436 }
06437 /*
06438 else
06439 {
06440 fx.mShader = cgs.media.saberBlurShader;
06441 fx.mKillTime = trailDur;
06442 fx.mSetFlags = FX_USE_ALPHA;
06443 }
06444 */
06445
06446 trap_FX_AddPrimitive(&fx);
06447 }
06448 }
06449 }
06450 }
06451
06452 // we must always do this, even if we aren't active..otherwise we won't know where to pick up from
06453 VectorCopy( org_, saberTrail->base );
06454 VectorMA( end, 3.0f, axis_[0], saberTrail->tip );
06455 saberTrail->lastTime = cg.time;
06456 }
06457
06458 JustDoIt:
06459
06460 if (dontDraw)
06461 {
06462 return;
06463 }
06464
06465 if ( (client->saber[saberNum].saberFlags2&SFL2_NO_BLADE) )
06466 {//don't actually draw the blade at all
06467 if ( client->saber[saberNum].numBlades < 3
06468 && !(client->saber[saberNum].saberFlags2&SFL2_NO_DLIGHT) )
06469 {//hmm, but still add the dlight
06470 CG_DoSaberLight( &client->saber[saberNum] );
06471 }
06472 return;
06473 }
06474 // Pass in the renderfx flags attached to the saber weapon model...this is done so that saber glows
06475 // will get rendered properly in a mirror...not sure if this is necessary??
06476 //CG_DoSaber( org_, axis_[0], saberLen, client->saber[saberNum].blade[bladeNum].lengthMax, client->saber[saberNum].blade[bladeNum].radius,
06477 // scolor, renderfx, (qboolean)(saberNum==0&&bladeNum==0) );
06478 CG_DoSaber( org_, axis_[0], saberLen, client->saber[saberNum].blade[bladeNum].lengthMax, client->saber[saberNum].blade[bladeNum].radius,
06479 scolor, renderfx, (qboolean)(client->saber[saberNum].numBlades < 3 && !(client->saber[saberNum].saberFlags2&SFL2_NO_DLIGHT)) );
06480 }
|
|
|
Definition at line 68 of file cg_marks.c. References cg_activeMarkPolys, CG_FreeMarkPoly(), cg_freeMarkPolys, markPoly_t, memset(), markPoly_s::nextMark, markPoly_s::prevMark, and markPoly_s::time. Referenced by CG_CreateSaberMarks(), and CG_ImpactMark().
00068 {
00069 markPoly_t *le;
00070 int time;
00071
00072 if ( !cg_freeMarkPolys ) {
00073 // no free entities, so free the one at the end of the chain
00074 // remove the oldest active entity
00075 time = cg_activeMarkPolys.prevMark->time;
00076 while (cg_activeMarkPolys.prevMark && time == cg_activeMarkPolys.prevMark->time) {
00077 CG_FreeMarkPoly( cg_activeMarkPolys.prevMark );
00078 }
00079 }
00080
00081 le = cg_freeMarkPolys;
00082 cg_freeMarkPolys = cg_freeMarkPolys->nextMark;
00083
00084 memset( le, 0, sizeof( *le ) );
00085
00086 // link into the active list
00087 le->nextMark = cg_activeMarkPolys.nextMark;
00088 le->prevMark = &cg_activeMarkPolys;
00089 cg_activeMarkPolys.nextMark->prevMark = le;
00090 cg_activeMarkPolys.nextMark = le;
00091 return le;
00092 }
|
|
|
Definition at line 6876 of file cg_players.c. References BG_GetVehicleModelName(), BG_GetVehicleSkinName(), BG_ParseAnimationEvtFile(), BG_ParseAnimationFile(), bgNumAnimEvents, MAX_QPATH, NULL, Q_strrchr(), qfalse, strcpy(), trap_G2API_CleanGhoul2Models(), trap_G2API_GetGLAName(), trap_G2API_InitGhoul2Model(), trap_R_RegisterSkin(), and va().
06877 {
06878 void *g2 = NULL;
06879 char *slash;
06880 char useModel[MAX_QPATH];
06881 char useSkin[MAX_QPATH];
06882 int animIndex;
06883
06884 strcpy(useModel, modelName);
06885 strcpy(useSkin, modelName);
06886
06887 if (modelName[0] == '$')
06888 { //it's a vehicle name actually, let's precache the whole vehicle
06889 BG_GetVehicleModelName(useModel);
06890 BG_GetVehicleSkinName(useSkin);
06891 if ( useSkin[0] )
06892 { //use a custom skin
06893 trap_R_RegisterSkin(va("models/players/%s/model_%s.skin", useModel, useSkin));
06894 }
06895 else
06896 {
06897 trap_R_RegisterSkin(va("models/players/%s/model_default.skin", useModel));
06898 }
06899 strcpy(useModel, va("models/players/%s/model.glm", useModel));
06900 }
06901
06902 trap_G2API_InitGhoul2Model(&g2, useModel, 0, 0, 0, 0, 0);
06903
06904 if (g2)
06905 {
06906 char GLAName[MAX_QPATH];
06907 char originalModelName[MAX_QPATH];
06908
06909 animIndex = -1;
06910
06911 GLAName[0] = 0;
06912 trap_G2API_GetGLAName(g2, 0, GLAName);
06913
06914 strcpy(originalModelName, useModel);
06915
06916 slash = Q_strrchr( GLAName, '/' );
06917 if ( slash )
06918 {
06919 strcpy(slash, "/animation.cfg");
06920
06921 animIndex = BG_ParseAnimationFile(GLAName, NULL, qfalse);
06922 }
06923
06924 if (animIndex != -1)
06925 {
06926 slash = Q_strrchr( originalModelName, '/' );
06927 if ( slash )
06928 {
06929 slash++;
06930 *slash = 0;
06931 }
06932
06933 BG_ParseAnimationEvtFile(originalModelName, animIndex, bgNumAnimEvents);
06934 }
06935
06936 //Now free the temp instance
06937 trap_G2API_CleanGhoul2Models(&g2);
06938 }
06939 }
|
|
||||||||||||
|
Definition at line 8326 of file cg_players.c. References vehicleInfo_t::cameraAlpha, cameraCurLoc, vehicleInfo_t::cameraOverride, vehicleInfo_t::cameraRange, centity_t, cg, cg_crosshairPos, CG_G2Trace(), cg_thirdPersonAlpha, playerState_s::clientNum, entityState_s::clientNum, CONTENTS_BODY, centity_s::currentState, trace_t::entityNum, ENTITYNUM_NONE, cg_t::frametime, playerState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, cg_t::predictedPlayerState, refEntity_t::renderfx, cg_t::renderingThirdPerson, RF_FORCE_ENT_ALPHA, refEntity_t::shaderRGBA, vmCvar_t::value, vec3_origin, vec3_t, VectorMA, VectorNormalize(), and VectorSubtract. Referenced by CG_Player().
08327 {
08328 float alpha = 1.0f;
08329 int setFlags = 0;
08330
08331 if ( cent->m_pVehicle )
08332 {//a vehicle
08333 if ( cg.predictedPlayerState.m_iVehicleNum != cent->currentState.clientNum//not mine
08334 && cent->m_pVehicle->m_pVehicleInfo
08335 && cent->m_pVehicle->m_pVehicleInfo->cameraOverride
08336 && cent->m_pVehicle->m_pVehicleInfo->cameraAlpha )//it has alpha
08337 {//make sure it's not using any alpha
08338 legs->renderfx |= RF_FORCE_ENT_ALPHA;
08339 legs->shaderRGBA[3] = 255;
08340 return;
08341 }
08342 }
08343
08344 if ( !cg.renderingThirdPerson )
08345 {
08346 return;
08347 }
08348
08349 if ( cg.predictedPlayerState.m_iVehicleNum )
08350 {//in a vehicle
08351 if ( cg.predictedPlayerState.m_iVehicleNum == cent->currentState.clientNum )
08352 {//this is my vehicle
08353 if ( cent->m_pVehicle
08354 && cent->m_pVehicle->m_pVehicleInfo
08355 && cent->m_pVehicle->m_pVehicleInfo->cameraOverride
08356 && cent->m_pVehicle->m_pVehicleInfo->cameraAlpha )
08357 {//vehicle has auto third-person alpha on
08358 trace_t trace;
08359 vec3_t dir2Crosshair, end;
08360 VectorSubtract( cg_crosshairPos, cameraCurLoc, dir2Crosshair );
08361 VectorNormalize( dir2Crosshair );
08362 VectorMA( cameraCurLoc, cent->m_pVehicle->m_pVehicleInfo->cameraRange*2.0f, dir2Crosshair, end );
08363 CG_G2Trace( &trace, cameraCurLoc, vec3_origin, vec3_origin, end, ENTITYNUM_NONE, CONTENTS_BODY );
08364 if ( trace.entityNum == cent->currentState.clientNum
08365 || trace.entityNum == cg.predictedPlayerState.clientNum)
08366 {//hit me or the vehicle I'm in
08367 cg_vehThirdPersonAlpha -= 0.1f*cg.frametime/50.0f;
08368 if ( cg_vehThirdPersonAlpha < cent->m_pVehicle->m_pVehicleInfo->cameraAlpha )
08369 {
08370 cg_vehThirdPersonAlpha = cent->m_pVehicle->m_pVehicleInfo->cameraAlpha;
08371 }
08372 }
08373 else
08374 {
08375 cg_vehThirdPersonAlpha += 0.1f*cg.frametime/50.0f;
08376 if ( cg_vehThirdPersonAlpha > 1.0f )
08377 {
08378 cg_vehThirdPersonAlpha = 1.0f;
08379 }
08380 }
08381 alpha = cg_vehThirdPersonAlpha;
08382 }
08383 else
08384 {//use the cvar
08385 //reset this
08386 cg_vehThirdPersonAlpha = 1.0f;
08387 //use the cvar
08388 alpha = cg_thirdPersonAlpha.value;
08389 }
08390 }
08391 }
08392 else if ( cg.predictedPlayerState.clientNum == cent->currentState.clientNum )
08393 {//it's me
08394 //reset this
08395 cg_vehThirdPersonAlpha = 1.0f;
08396 //use the cvar
08397 setFlags = RF_FORCE_ENT_ALPHA;
08398 alpha = cg_thirdPersonAlpha.value;
08399 }
08400
08401 if ( alpha < 1.0f )
08402 {
08403 legs->renderfx |= setFlags;
08404 legs->shaderRGBA[3] = (unsigned char)(alpha * 255.0f);
08405 }
08406 }
|
|
|
Definition at line 7904 of file cg_players.c. References cg_g2JetpackInstance, NULL, and trap_G2API_CleanGhoul2Models(). Referenced by CG_DestroyAllGhoul2().
07905 {
07906 if (cg_g2JetpackInstance)
07907 {
07908 trap_G2API_CleanGhoul2Models(&cg_g2JetpackInstance);
07909 cg_g2JetpackInstance = NULL;
07910 }
07911 }
|
|
|
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 }
|
|
||||||||||||||||
|
Definition at line 5462 of file cg_players.c. References addpolyArgStruct_s::accel, addpolyArgStruct_t, addpolyArgStruct_s::alpha1, addpolyArgStruct_s::alpha2, markPoly_s::alphaFade, addpolyArgStruct_s::alphaParm, addpolyArgStruct_s::bounce, cg, cg_addMarks, CG_AllocMark(), cg_saberDynamicMarks, cg_saberDynamicMarkTime, cgs, markPoly_s::color, DotProduct, addpolyArgStruct_s::ev, addpolyArgStruct_s::flags, vmCvar_t::integer, addpolyArgStruct_s::killTime, markPoly_t, markPoly_s::markShader, MAX_MARK_FRAGMENTS, MAX_MARK_POINTS, MAX_VERTS_ON_POLY, cgs_t::media, memcpy(), memset(), addpolyArgStruct_s::motionDelay, cgMedia_t::mSaberDamageGlow, poly_s::numVerts, addpolyArgStruct_s::numVerts, addpolyArgStruct_s::p, markPoly_s::poly, qfalse, qtrue, random, addpolyArgStruct_s::rgb1, addpolyArgStruct_s::rgb2, addpolyArgStruct_s::rgbParm, cgMedia_t::rivetMarkShader, addpolyArgStruct_s::shader, cg_t::time, markPoly_s::time, trap_CM_MarkFragments(), trap_FX_AddPoly(), vec3_origin, vec3_t, VectorAdd, VectorCopy, VectorNormalize(), VectorScale, VectorSet, VectorSubtract, addpolyArgStruct_s::vel, and markPoly_s::verts. Referenced by CG_AddSaberBlade().
05463 {
05464 // byte colors[4];
05465 int i, j;
05466 int numFragments;
05467 vec3_t axis[3], originalPoints[4], mid;
05468 vec3_t markPoints[MAX_MARK_POINTS], projection;
05469 polyVert_t *v, verts[MAX_VERTS_ON_POLY];
05470 markPoly_t *mark;
05471 markFragment_t markFragments[MAX_MARK_FRAGMENTS], *mf;
05472
05473 float radius = 0.65f;
05474
05475 if ( !cg_addMarks.integer )
05476 {
05477 return;
05478 }
05479
05480 VectorSubtract( end, start, axis[1] );
05481 VectorNormalize( axis[1] );
05482
05483 // create the texture axis
05484 VectorCopy( normal, axis[0] );
05485 CrossProduct( axis[1], axis[0], axis[2] );
05486
05487 // create the full polygon that we'll project
05488 for ( i = 0 ; i < 3 ; i++ )
05489 { // stretch a bit more in the direction that we are traveling in... debateable as to whether this makes things better or worse
05490 originalPoints[0][i] = start[i] - radius * axis[1][i] - radius * axis[2][i];
05491 originalPoints[1][i] = end[i] + radius * axis[1][i] - radius * axis[2][i];
05492 originalPoints[2][i] = end[i] + radius * axis[1][i] + radius * axis[2][i];
05493 originalPoints[3][i] = start[i] - radius * axis[1][i] + radius * axis[2][i];
05494 }
05495
05496 VectorScale( normal, -1, projection );
05497
05498 // get the fragments
05499 numFragments = trap_CM_MarkFragments( 4, (const float (*)[3])originalPoints,
05500 projection, MAX_MARK_POINTS, markPoints[0], MAX_MARK_FRAGMENTS, markFragments );
05501
05502 for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ )
05503 {
05504 // we have an upper limit on the complexity of polygons that we store persistantly
05505 if ( mf->numPoints > MAX_VERTS_ON_POLY )
05506 {
05507 mf->numPoints = MAX_VERTS_ON_POLY;
05508 }
05509
05510 for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ )
05511 {
05512 vec3_t delta;
05513
05514 // Set up our texture coords, this may need some work
05515 VectorCopy( markPoints[mf->firstPoint + j], v->xyz );
05516 VectorAdd( end, start, mid );
05517 VectorScale( mid, 0.5f, mid );
05518 VectorSubtract( v->xyz, mid, delta );
05519
05520 v->st[0] = 0.5 + DotProduct( delta, axis[1] ) * (0.05f + random() * 0.03f);
05521 v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * (0.15f + random() * 0.05f);
05522 }
05523
05524 if (cg_saberDynamicMarks.integer)
05525 {
05526 int i = 0;
05527 int i_2 = 0;
05528 addpolyArgStruct_t apArgs;
05529 vec3_t x;
05530
05531 memset (&apArgs, 0, sizeof(apArgs));
05532
05533 while (i < 4)
05534 {
05535 while (i_2 < 3)
05536 {
05537 apArgs.p[i][i_2] = verts[i].xyz[i_2];
05538
05539 i_2++;
05540 }
05541
05542 i_2 = 0;
05543 i++;
05544 }
05545
05546 i = 0;
05547 i_2 = 0;
05548
05549 while (i < 4)
05550 {
05551 while (i_2 < 2)
05552 {
05553 apArgs.ev[i][i_2] = verts[i].st[i_2];
05554
05555 i_2++;
05556 }
05557
05558 i_2 = 0;
05559 i++;
05560 }
05561
05562 //When using addpoly, having a situation like this tends to cause bad results.
05563 //(I assume it doesn't like trying to draw a polygon over two planes and extends
05564 //the vertex out to some odd value)
05565 VectorSubtract(apArgs.p[0], apArgs.p[3], x);
05566 if (VectorLength(x) > 3.0f)
05567 {
05568 return;
05569 }
05570
05571 apArgs.numVerts = mf->numPoints;
05572 VectorCopy(vec3_origin, apArgs.vel);
05573 VectorCopy(vec3_origin, apArgs.accel);
05574
05575 apArgs.alpha1 = 1.0f;
05576 apArgs.alpha2 = 0.0f;
05577 apArgs.alphaParm = 255.0f;
05578
05579 VectorSet(apArgs.rgb1, 0.0f, 0.0f, 0.0f);
05580 VectorSet(apArgs.rgb2, 0.0f, 0.0f, 0.0f);
05581
05582 apArgs.rgbParm = 0.0f;
05583
05584 apArgs.bounce = 0;
05585 apArgs.motionDelay = 0;
05586 apArgs.killTime = cg_saberDynamicMarkTime.integer;
05587 apArgs.shader = cgs.media.rivetMarkShader;
05588 apArgs.flags = 0x08000000|0x00000004;
05589
05590 trap_FX_AddPoly(&apArgs);
05591
05592 apArgs.shader = cgs.media.mSaberDamageGlow;
05593 apArgs.rgb1[0] = 215 + random() * 40.0f;
05594 apArgs.rgb1[1] = 96 + random() * 32.0f;
05595 apArgs.rgb1[2] = apArgs.alphaParm = random()*15.0f;
05596
05597 apArgs.rgb1[0] /= 255;
05598 apArgs.rgb1[1] /= 255;
05599 apArgs.rgb1[2] /= 255;
05600 VectorCopy(apArgs.rgb1, apArgs.rgb2);
05601
05602 apArgs.killTime = 100;
05603
05604 trap_FX_AddPoly(&apArgs);
05605 }
05606 else
05607 {
05608 // save it persistantly, do burn first
05609 mark = CG_AllocMark();
05610 mark->time = cg.time;
05611 mark->alphaFade = qtrue;
05612 mark->markShader = cgs.media.rivetMarkShader;
05613 mark->poly.numVerts = mf->numPoints;
05614 mark->color[0] = mark->color[1] = mark->color[2] = mark->color[3] = 255;
05615 memcpy( mark->verts, verts, mf->numPoints * sizeof( verts[0] ) );
05616
05617 // And now do a glow pass
05618 // by moving the start time back, we can hack it to fade out way before the burn does
05619 mark = CG_AllocMark();
05620 mark->time = cg.time - 8500;
05621 mark->alphaFade = qfalse;
05622 mark->markShader = cgs.media.mSaberDamageGlow;
05623 mark->poly.numVerts = mf->numPoints;
05624 mark->color[0] = 215 + random() * 40.0f;
05625 mark->color[1] = 96 + random() * 32.0f;
05626 mark->color[2] = mark->color[3] = random()*15.0f;
05627 memcpy( mark->verts, verts, mf->numPoints * sizeof( verts[0] ) );
05628 }
05629 }
05630 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 5320 of file cg_players.c. References refEntity_t::axis, cgMedia_t::blueSaberCoreShader, cgMedia_t::blueSaberGlowShader, cg_saberTrail, cg_shadows, cgs, crandom, refEntity_t::customShader, cgs_t::glconfig, cgMedia_t::greenSaberCoreShader, cgMedia_t::greenSaberGlowShader, vmCvar_t::integer, cgs_t::media, memset(), refEntity_t::oldorigin, cgMedia_t::orangeSaberCoreShader, cgMedia_t::orangeSaberGlowShader, refEntity_t::origin, cgMedia_t::purpleSaberCoreShader, cgMedia_t::purpleSaberGlowShader, qhandle_t, refEntity_t::radius, random, cgMedia_t::redSaberCoreShader, cgMedia_t::redSaberGlowShader, refEntity_t::renderfx, refEntity_t::reType, RF_FORCEPOST, RT_LINE, RT_SABER_GLOW, SABER_BLUE, saber_colors_t, SABER_GREEN, SABER_ORANGE, SABER_PURPLE, SABER_RED, SABER_YELLOW, refEntity_t::saberLength, refEntity_t::shaderRGBA, refEntity_t::shaderTexCoord, glconfig_t::stencilBits, trap_R_AddLightToScene(), trap_R_AddRefEntityToScene(), vec3_t, VectorCopy, VectorMA, cgMedia_t::yellowSaberCoreShader, and cgMedia_t::yellowSaberGlowShader. Referenced by CG_AddSaberBlade().
05321 {
05322 vec3_t mid;
05323 qhandle_t blade = 0, glow = 0;
05324 refEntity_t saber;
05325 float radiusmult;
05326 float radiusRange;
05327 float radiusStart;
05328
05329 if ( length < 0.5f )
05330 {
05331 // if the thing is so short, just forget even adding me.
05332 return;
05333 }
05334
05335 // Find the midpoint of the saber for lighting purposes
05336 VectorMA( origin, length * 0.5f, dir, mid );
05337
05338 switch( color )
05339 {
05340 case SABER_RED:
05341 glow = cgs.media.redSaberGlowShader;
05342 blade = cgs.media.redSaberCoreShader;
05343 break;
05344 case SABER_ORANGE:
05345 glow = cgs.media.orangeSaberGlowShader;
05346 blade = cgs.media.orangeSaberCoreShader;
05347 break;
05348 case SABER_YELLOW:
05349 glow = cgs.media.yellowSaberGlowShader;
05350 blade = cgs.media.yellowSaberCoreShader;
05351 break;
05352 case SABER_GREEN:
05353 glow = cgs.media.greenSaberGlowShader;
05354 blade = cgs.media.greenSaberCoreShader;
05355 break;
05356 case SABER_BLUE:
05357 glow = cgs.media.blueSaberGlowShader;
05358 blade = cgs.media.blueSaberCoreShader;
05359 break;
05360 case SABER_PURPLE:
05361 glow = cgs.media.purpleSaberGlowShader;
05362 blade = cgs.media.purpleSaberCoreShader;
05363 break;
05364 default:
05365 glow = cgs.media.blueSaberGlowShader;
05366 blade = cgs.media.blueSaberCoreShader;
05367 break;
05368 }
05369
05370 if (doLight)
05371 { // always add a light because sabers cast a nice glow before they slice you in half!! or something...
05372 vec3_t rgb={1,1,1};
05373 CG_RGBForSaberColor( color, rgb );
05374 trap_R_AddLightToScene( mid, (length*1.4f) + (random()*3.0f), rgb[0], rgb[1], rgb[2] );
05375 }
05376
05377 memset( &saber, 0, sizeof( refEntity_t ));
05378
05379 // Saber glow is it's own ref type because it uses a ton of sprites, otherwise it would eat up too many
05380 // refEnts to do each glow blob individually
05381 saber.saberLength = length;
05382
05383 // Jeff, I did this because I foolishly wished to have a bright halo as the saber is unleashed.
05384 // It's not quite what I'd hoped tho. If you have any ideas, go for it! --Pat
05385 if (length < lengthMax)
05386 {
05387 radiusmult = 1.0 + (2.0 / length); // Note this creates a curve, and length cannot be < 0.5.
05388 }
05389 else
05390 {
05391 radiusmult = 1.0;
05392 }
05393
05394 if (cg_saberTrail.integer == 2 && cg_shadows.integer != 2 && cgs.glconfig.stencilBits >= 4)
05395 { //draw the blade as a post-render so it doesn't get in the cap...
05396 rfx |= RF_FORCEPOST;
05397 }
05398
05399 radiusRange = radius * 0.075f;
05400 radiusStart = radius-radiusRange;
05401
05402 saber.radius = (radiusStart + crandom() * radiusRange)*radiusmult;
05403 //saber.radius = (2.8f + crandom() * 0.2f)*radiusmult;
05404
05405 VectorCopy( origin, saber.origin );
05406 VectorCopy( dir, saber.axis[0] );
05407 saber.reType = RT_SABER_GLOW;
05408 saber.customShader = glow;
05409 saber.shaderRGBA[0] = saber.shaderRGBA[1] = saber.shaderRGBA[2] = saber.shaderRGBA[3] = 0xff;
05410 saber.renderfx = rfx;
05411
05412 trap_R_AddRefEntityToScene( &saber );
05413
05414 // Do the hot core
05415 VectorMA( origin, length, dir, saber.origin );
05416 VectorMA( origin, -1, dir, saber.oldorigin );
05417
05418
05419 // CG_TestLine(saber.origin, saber.oldorigin, 50, 0x000000ff, 3);
05420 saber.customShader = blade;
05421 saber.reType = RT_LINE;
05422 radiusStart = radius/3.0f;
05423 saber.radius = (radiusStart + crandom() * radiusRange)*radiusmult;
05424 // saber.radius = (1.0 + crandom() * 0.2f)*radiusmult;
05425
05426 saber.shaderTexCoord[0] = saber.shaderTexCoord[1] = 1.0f;
05427 saber.shaderRGBA[0] = saber.shaderRGBA[1] = saber.shaderRGBA[2] = saber.shaderRGBA[3] = 0xff;
05428
05429 trap_R_AddRefEntityToScene( &saber );
05430 }
|
|
||||||||||||
|
Definition at line 5107 of file cg_players.c. References AnglesToAxis(), refEntity_t::axis, centity_t, cg, cgs, centity_s::currentState, refEntity_t::customShader, centity_s::damageAngles, centity_s::damageTime, EF_DEAD, entityState_s::eFlags, cgMedia_t::halfShieldModel, cgMedia_t::halfShieldShader, refEntity_t::hModel, cgs_t::media, memset(), MIN_SHIELD_TIME, refEntity_t::origin, random, refEntity_t::shaderRGBA, cg_t::time, trap_R_AddRefEntityToScene(), vec3_t, VectorCopy, and VectorScale. Referenced by CG_PlayerHitFX().
05108 {
05109 refEntity_t ent;
05110 int alpha;
05111 float scale;
05112
05113 // Don't draw the shield when the player is dead.
05114 if (cent->currentState.eFlags & EF_DEAD)
05115 {
05116 return;
05117 }
05118
05119 memset( &ent, 0, sizeof( ent ) );
05120
05121 VectorCopy( origin, ent.origin );
05122 ent.origin[2] += 10.0;
05123 AnglesToAxis( cent->damageAngles, ent.axis );
05124
05125 alpha = 255.0 * ((cent->damageTime - cg.time) / MIN_SHIELD_TIME) + random()*16;
05126 if (alpha>255)
05127 alpha=255;
05128
05129 // Make it bigger, but tighter if more solid
05130 scale = 1.4 - ((float)alpha*(0.4/255.0)); // Range from 1.0 to 1.4
05131 VectorScale( ent.axis[0], scale, ent.axis[0] );
05132 VectorScale( ent.axis[1], scale, ent.axis[1] );
05133 VectorScale( ent.axis[2], scale, ent.axis[2] );
05134
05135 ent.hModel = cgs.media.halfShieldModel;
05136 ent.customShader = cgs.media.halfShieldShader;
05137 ent.shaderRGBA[0] = alpha;
05138 ent.shaderRGBA[1] = alpha;
05139 ent.shaderRGBA[2] = alpha;
05140 ent.shaderRGBA[3] = 255;
05141 trap_R_AddRefEntityToScene( &ent );
05142 }
|
|
||||||||||||||||||||
|
Definition at line 6522 of file cg_players.c. References AnglesToAxis(), refEntity_t::axis, centity_t, cg, cg_renderToTextureFX, cgs, playerState_s::clientNum, centity_s::currentState, refEntity_t::customShader, EF_DEAD, entityState_s::eFlags, cgMedia_t::endarkenmentShader, cgMedia_t::enlightenmentShader, cgMedia_t::halfShieldModel, refEntity_t::hModel, vmCvar_t::integer, cgMedia_t::invulnerabilityShader, cgs_t::media, memset(), refEntity_t::nonNormalizedAxes, entityState_s::number, refEntity_t::origin, PITCH, cg_t::predictedPlayerState, qtrue, refEntity_t::radius, cg_t::refdef, refEntity_t::renderfx, cg_t::renderingThirdPerson, RF_DISTORTION, RF_FORCE_ENT_ALPHA, ROLL, refEntity_t::shaderRGBA, trap_R_AddRefEntityToScene(), trap_R_RegisterShader(), vec3_t, vectoangles(), VectorCopy, VectorMA, VectorNormalize(), VectorScale, VectorSubtract, refdef_t::vieworg, and cgMedia_t::ysalimariShader. Referenced by CG_Player().
06523 {
06524 refEntity_t ent;
06525 vec3_t ang;
06526 float vLen;
06527 vec3_t viewDir;
06528
06529 // Don't draw the shield when the player is dead.
06530 if (cent->currentState.eFlags & EF_DEAD)
06531 {
06532 return;
06533 }
06534
06535 memset( &ent, 0, sizeof( ent ) );
06536
06537 VectorCopy( origin, ent.origin );
06538 ent.origin[2] += 9.0;
06539
06540 VectorSubtract(ent.origin, cg.refdef.vieworg, ent.axis[0]);
06541 vLen = VectorLength(ent.axis[0]);
06542 if (vLen <= 0.1f)
06543 { // Entity is right on vieworg. quit.
06544 return;
06545 }
06546
06547 VectorCopy(ent.axis[0], viewDir);
06548 VectorInverse(viewDir);
06549 VectorNormalize(viewDir);
06550
06551 vectoangles(ent.axis[0], ang);
06552 ang[ROLL] += 180.0f;
06553 ang[PITCH] += 180.0f;
06554 AnglesToAxis(ang, ent.axis);
06555
06556 VectorScale(ent.axis[0], scale, ent.axis[0]);
06557 VectorScale(ent.axis[1], scale, ent.axis[1]);
06558 VectorScale(ent.axis[2], scale, ent.axis[2]);
06559
06560 ent.nonNormalizedAxes = qtrue;
06561
06562 ent.hModel = cgs.media.halfShieldModel;
06563 ent.customShader = shader;
06564
06565 trap_R_AddRefEntityToScene( &ent );
06566
06567 if (!cg.renderingThirdPerson && cent->currentState.number == cg.predictedPlayerState.clientNum)
06568 { //don't do the rest then
06569 return;
06570 }
06571 if (!cg_renderToTextureFX.integer)
06572 {
06573 return;
06574 }
06575
06576 ang[PITCH] -= 180.0f;
06577 AnglesToAxis(ang, ent.axis);
06578
06579 VectorScale(ent.axis[0], scale*0.5f, ent.axis[0]);
06580 VectorScale(ent.axis[1], scale*0.5f, ent.axis[1]);
06581 VectorScale(ent.axis[2], scale*0.5f, ent.axis[2]);
06582
06583 ent.renderfx = (RF_DISTORTION|RF_FORCE_ENT_ALPHA);
06584 if (shader == cgs.media.invulnerabilityShader)
06585 { //ok, ok, this is a little hacky. sorry!
06586 ent.shaderRGBA[0] = 0;
06587 ent.shaderRGBA[1] = 255;
06588 ent.shaderRGBA[2] = 0;
06589 ent.shaderRGBA[3] = 100;
06590 }
06591 else if (shader == cgs.media.ysalimariShader)
06592 {
06593 ent.shaderRGBA[0] = 255;
06594 ent.shaderRGBA[1] = 255;
06595 ent.shaderRGBA[2] = 0;
06596 ent.shaderRGBA[3] = 100;
06597 }
06598 else if (shader == cgs.media.endarkenmentShader)
06599 {
06600 ent.shaderRGBA[0] = 100;
06601 ent.shaderRGBA[1] = 0;
06602 ent.shaderRGBA[2] = 0;
06603 ent.shaderRGBA[3] = 20;
06604 }
06605 else if (shader == cgs.media.enlightenmentShader)
06606 {
06607 ent.shaderRGBA[0] = 255;
06608 ent.shaderRGBA[1] = 255;
06609 ent.shaderRGBA[2] = 255;
06610 ent.shaderRGBA[3] = 20;
06611 }
06612 else
06613 { //ysal red/blue, boon
06614 ent.shaderRGBA[0] = 255.0f;
06615 ent.shaderRGBA[1] = 255.0f;
06616 ent.shaderRGBA[2] = 255.0f;
06617 ent.shaderRGBA[3] = 20;
06618 }
06619
06620 ent.radius = 256;
06621
06622 VectorMA(ent.origin, 40.0f, viewDir, ent.origin);
06623
06624 ent.customShader = trap_R_RegisterShader("effects/refract_2");
06625 trap_R_AddRefEntityToScene( &ent );
06626 }
|
|
|
Definition at line 7454 of file cg_players.c. References BG_NUM_TOGGLEABLE_SURFACES, bgToggleableSurfaceDebris, bgToggleableSurfaces, centity_t, CG_G2AnimEntModelLoad(), CG_Player(), CG_RagDoll(), CG_ReattachLimb(), cgs, centity_s::currentState, EF_DEAD, EF_RAG, cgs_t::effects, entityState_s::eFlags, centity_s::ghoul2, centity_s::lerpAngles, centity_s::localAnimIndex, cgEffects_t::mShipDestDestroyed, centity_s::npcLocalSurfOff, centity_s::npcLocalSurfOn, qtrue, centity_s::smoothYaw, entityState_s::surfacesOff, entityState_s::surfacesOn, centity_s::torsoBolt, trap_G2API_SetSurfaceOnOff(), TURN_OFF, TURN_ON, vec3_t, VectorClear, and YAW.
07455 {
07456 #ifdef SMOOTH_G2ANIM_LERPANGLES
07457 float angSmoothFactor = 0.7f;
07458 #endif
07459
07460
07461 if (!cent->ghoul2)
07462 { //Initialize this g2 anim ent, then return (will start rendering next frame)
07463 CG_G2AnimEntModelLoad(cent);
07464 cent->npcLocalSurfOff = 0;
07465 cent->npcLocalSurfOn = 0;
07466 return;
07467 }
07468
07469 if (cent->npcLocalSurfOff != cent->currentState.surfacesOff ||
07470 cent->npcLocalSurfOn != cent->currentState.surfacesOn)
07471 { //looks like it's time for an update.
07472 int i = 0;
07473
07474 while (i < BG_NUM_TOGGLEABLE_SURFACES && bgToggleableSurfaces[i])
07475 {
07476 if (!(cent->npcLocalSurfOff & (1 << i)) &&
07477 (cent->currentState.surfacesOff & (1 << i)))
07478 { //it wasn't off before but it's off now, so reflect this change in the g2 instance.
07479 if (bgToggleableSurfaceDebris[i] > 0)
07480 { //make some local debris of this thing?
07481 //FIXME: throw off the proper model effect, too
07482 CG_CreateSurfaceDebris(cent, i, cgs.effects.mShipDestDestroyed, qtrue);
07483 }
07484
07485 trap_G2API_SetSurfaceOnOff(cent->ghoul2, bgToggleableSurfaces[i], TURN_OFF);
07486 }
07487
07488 if (!(cent->npcLocalSurfOn & (1 << i)) &&
07489 (cent->currentState.surfacesOn & (1 << i)))
07490 { //same as above, but on instead of off.
07491 trap_G2API_SetSurfaceOnOff(cent->ghoul2, bgToggleableSurfaces[i], TURN_ON);
07492 }
07493
07494 i++;
07495 }
07496
07497 cent->npcLocalSurfOff = cent->currentState.surfacesOff;
07498 cent->npcLocalSurfOn = cent->currentState.surfacesOn;
07499 }
07500
07501
07502 /*
07503 if (cent->currentState.weapon &&
07504 !trap_G2API_HasGhoul2ModelOnIndex(&(cent->ghoul2), 1) &&
07505 !(cent->currentState.eFlags & EF_DEAD))
07506 { //if the server says we have a weapon and we haven't copied one onto ourselves yet, then do so.
07507 trap_G2API_CopySpecificGhoul2Model(g2WeaponInstances[cent->currentState.weapon], 0, cent->ghoul2, 1);
07508
07509 if (cent->currentState.weapon == WP_SABER)
07510 {
07511 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, trap_S_RegisterSound( "sound/weapons/saber/saberon.wav" ));
07512 }
07513 }
07514 */
07515
07516 if (cent->torsoBolt && !(cent->currentState.eFlags & EF_DEAD))
07517 { //he's alive and has a limb missing still, reattach it and reset the weapon
07518 CG_ReattachLimb(cent);
07519 }
07520
07521 if (((cent->currentState.eFlags & EF_DEAD) || (cent->currentState.eFlags & EF_RAG)) && !cent->localAnimIndex)
07522 {
07523 vec3_t forcedAngles;
07524
07525 VectorClear(forcedAngles);
07526 forcedAngles[YAW] = cent->lerpAngles[YAW];
07527
07528 CG_RagDoll(cent, forcedAngles);
07529 }
07530
07531 #ifdef SMOOTH_G2ANIM_LERPANGLES
07532 if ((cent->lerpAngles[YAW] > 0 && cent->smoothYaw < 0) ||
07533 (cent->lerpAngles[YAW] < 0 && cent->smoothYaw > 0))
07534 { //keep it from snapping around on the threshold
07535 cent->smoothYaw = -cent->smoothYaw;
07536 }
07537 cent->lerpAngles[YAW] = cent->smoothYaw+(cent->lerpAngles[YAW]-cent->smoothYaw)*angSmoothFactor;
07538 cent->smoothYaw = cent->lerpAngles[YAW];
07539 #endif
07540
07541 //now just render as a player
07542 CG_Player(cent);
07543
07544 /*
07545 if ( cg_showVehBounds.integer )
07546 {//show vehicle bboxes
07547 if ( cent->currentState.clientNum >= MAX_CLIENTS
07548 && cent->currentState.NPC_class == CLASS_VEHICLE
07549 && cent->m_pVehicle
07550 && cent->m_pVehicle->m_pVehicleInfo
07551 && cent->currentState.clientNum != cg.predictedVehicleState.clientNum )
07552 {//not the predicted vehicle
07553 vec3_t NPCDEBUG_RED = {1.0, 0.0, 0.0};
07554 vec3_t absmin, absmax;
07555 vec3_t bmins, bmaxs;
07556 float *old = cent->m_pVehicle->m_vOrientation;
07557 cent->m_pVehicle->m_vOrientation = ¢->lerpAngles[0];
07558
07559 BG_VehicleAdjustBBoxForOrientation( cent->m_pVehicle, cent->lerpOrigin, bmins, bmaxs,
07560 cent->currentState.number, MASK_PLAYERSOLID, NULL );
07561 cent->m_pVehicle->m_vOrientation = old;
07562
07563 VectorAdd( cent->lerpOrigin, bmins, absmin );
07564 VectorAdd( cent->lerpOrigin, bmaxs, absmax );
07565 CG_Cube( absmin, absmax, NPCDEBUG_RED, 0.25 );
07566 }
07567 }
07568 */
07569 }
|
|
|
Definition at line 6998 of file cg_players.c. References BG_GetVehicleModelName(), BG_ParseAnimationEvtFile(), BG_ParseAnimationFile(), BG_VehicleGetIndex(), bgEntity_t, bgNumAnimEvents, centity_t, CG_ConfigString(), CG_HandleAppendedSkin(), CG_HandleNPCSounds(), cgs, cgSendPS, CLASS_VEHICLE, Com_sprintf(), CS_MODELS, centity_s::currentState, centity_s::eventAnimIndex, G_CreateAnimalNPC(), G_CreateFighterNPC(), G_CreateSpeederNPC(), G_CreateWalkerNPC(), g_vehicleInfo, centity_s::ghoul2, clientInfo_t::ghoul2Weapons, turretStats_t::gunnerViewTag, centity_s::localAnimIndex, Vehicle_s::m_iDroidUnitTag, Vehicle_s::m_iExhaustTag, Vehicle_s::m_iGunnerViewTag, Vehicle_s::m_iMuzzleTag, Vehicle_s::m_pParentEntity, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vOrientation, MAX_QPATH, MAX_SABERS, MAX_VEHICLE_EXHAUSTS, MAX_VEHICLE_MUZZLES, MAX_VEHICLE_TURRETS, cgs_t::media, saberInfo_t::model, entityState_s::modelindex, cgMedia_t::noAmmoSound, centity_s::noFace, centity_s::noLumbar, entityState_s::NPC_class, centity_s::npcClient, entityState_s::npcSaber1, entityState_s::npcSaber2, NULL, entityState_s::number, Q_strrchr(), qfalse, qtrue, clientInfo_t::saber, vehicleInfo_t::skin, strcpy(), strstr(), trap_G2API_AddBolt(), trap_G2API_CleanGhoul2Models(), trap_G2API_GetGLAName(), trap_G2API_InitGhoul2Model(), trap_G2API_SetSkin(), trap_R_RegisterSkin(), trap_S_RegisterSound(), trap_S_ShutUp(), vehicleInfo_t::turret, vehicleInfo_t::type, va(), VH_ANIMAL, VH_FIGHTER, VH_SPEEDER, VH_WALKER, and WP_SetSaber(). Referenced by CG_G2Animated().
06999 {
07000 const char *cModelName = CG_ConfigString( CS_MODELS+cent->currentState.modelindex );
07001
07002 if (!cent->npcClient)
07003 { //have not init'd client yet
07004 return;
07005 }
07006
07007 if (cModelName && cModelName[0])
07008 {
07009 char modelName[MAX_QPATH];
07010 int skinID;
07011 char *slash;
07012
07013 strcpy(modelName, cModelName);
07014
07015 if (cent->currentState.NPC_class == CLASS_VEHICLE && modelName[0] == '$')
07016 { //vehicles pass their veh names over as model names, then we get the model name from the veh type
07017 //create a vehicle object clientside for this type
07018 char *vehType = &modelName[1];
07019 int iVehIndex = BG_VehicleGetIndex( vehType );
07020
07021 switch( g_vehicleInfo[iVehIndex].type )
07022 {
07023 case VH_ANIMAL:
07024 // Create the animal (making sure all it's data is initialized).
07025 G_CreateAnimalNPC( ¢->m_pVehicle, vehType );
07026 break;
07027 case VH_SPEEDER:
07028 // Create the speeder (making sure all it's data is initialized).
07029 G_CreateSpeederNPC( ¢->m_pVehicle, vehType );
07030 break;
07031 case VH_FIGHTER:
07032 // Create the fighter (making sure all it's data is initialized).
07033 G_CreateFighterNPC( ¢->m_pVehicle, vehType );
07034 break;
07035 case VH_WALKER:
07036 // Create the walker (making sure all it's data is initialized).
07037 G_CreateWalkerNPC( ¢->m_pVehicle, vehType );
07038 break;
07039
07040 default:
07041 assert(!"vehicle with an unknown type - couldn't create vehicle_t");
07042 break;
07043 }
07044
07045 //set up my happy prediction hack
07046 cent->m_pVehicle->m_vOrientation = &cgSendPS[cent->currentState.number]->vehOrientation[0];
07047
07048 cent->m_pVehicle->m_pParentEntity = (bgEntity_t *)cent;
07049
07050 //attach the handles for fx cgame-side
07051 CG_RegisterVehicleAssets(cent->m_pVehicle);
07052
07053 BG_GetVehicleModelName(modelName);
07054 if (cent->m_pVehicle->m_pVehicleInfo->skin &&
07055 cent->m_pVehicle->m_pVehicleInfo->skin[0])
07056 { //use a custom skin
07057 skinID = trap_R_RegisterSkin(va("models/players/%s/model_%s.skin", modelName, cent->m_pVehicle->m_pVehicleInfo->skin));
07058 }
07059 else
07060 {
07061 skinID = trap_R_RegisterSkin(va("models/players/%s/model_default.skin", modelName));
07062 }
07063 strcpy(modelName, va("models/players/%s/model.glm", modelName));
07064
07065 //this sound is *only* used for vehicles now
07066 cgs.media.noAmmoSound = trap_S_RegisterSound( "sound/weapons/noammo.wav" );
07067 }
07068 else
07069 {
07070 skinID = CG_HandleAppendedSkin(modelName); //get the skin if there is one.
07071 }
07072
07073 if (cent->ghoul2)
07074 { //clean it first!
07075 trap_G2API_CleanGhoul2Models(¢->ghoul2);
07076 }
07077
07078 trap_G2API_InitGhoul2Model(¢->ghoul2, modelName, 0, skinID, 0, 0, 0);
07079
07080 if (cent->ghoul2)
07081 {
07082 char GLAName[MAX_QPATH];
07083 char originalModelName[MAX_QPATH];
07084 char *saber;
07085 int j = 0;
07086
07087 if (cent->currentState.NPC_class == CLASS_VEHICLE &&
07088 cent->m_pVehicle)
07089 { //do special vehicle stuff
07090 char strTemp[128];
07091 int i;
07092
07093 // Setup the default first bolt
07094 i = trap_G2API_AddBolt( cent->ghoul2, 0, "model_root" );
07095
07096 // Setup the droid unit.
07097 cent->m_pVehicle->m_iDroidUnitTag = trap_G2API_AddBolt( cent->ghoul2, 0, "*droidunit" );
07098
07099 // Setup the Exhausts.
07100 for ( i = 0; i < MAX_VEHICLE_EXHAUSTS; i++ )
07101 {
07102 Com_sprintf( strTemp, 128, "*exhaust%i", i + 1 );
07103 cent->m_pVehicle->m_iExhaustTag[i] = trap_G2API_AddBolt( cent->ghoul2, 0, strTemp );
07104 }
07105
07106 // Setup the Muzzles.
07107 for ( i = 0; i < MAX_VEHICLE_MUZZLES; i++ )
07108 {
07109 Com_sprintf( strTemp, 128, "*muzzle%i", i + 1 );
07110 cent->m_pVehicle->m_iMuzzleTag[i] = trap_G2API_AddBolt( cent->ghoul2, 0, strTemp );
07111 if ( cent->m_pVehicle->m_iMuzzleTag[i] == -1 )
07112 {//ergh, try *flash?
07113 Com_sprintf( strTemp, 128, "*flash%i", i + 1 );
07114 cent->m_pVehicle->m_iMuzzleTag[i] = trap_G2API_AddBolt( cent->ghoul2, 0, strTemp );
07115 }
07116 }
07117
07118 // Setup the Turrets.
07119 for ( i = 0; i < MAX_VEHICLE_TURRETS; i++ )
07120 {
07121 if ( cent->m_pVehicle->m_pVehicleInfo->turret[i].gunnerViewTag )
07122 {
07123 cent->m_pVehicle->m_iGunnerViewTag[i] = trap_G2API_AddBolt( cent->ghoul2, 0, cent->m_pVehicle->m_pVehicleInfo->turret[i].gunnerViewTag );
07124 }
07125 else
07126 {
07127 cent->m_pVehicle->m_iGunnerViewTag[i] = -1;
07128 }
07129 }
07130 }
07131
07132 if (cent->currentState.npcSaber1)
07133 {
07134 saber = (char *)CG_ConfigString(CS_MODELS+cent->currentState.npcSaber1);
07135 assert(!saber || !saber[0] || saber[0] == '@');
07136 //valid saber names should always start with '@' for NPCs
07137
07138 if (saber && saber[0])
07139 {
07140 saber++; //skip over the @
07141 WP_SetSaber(cent->currentState.number, cent->npcClient->saber, 0, saber);
07142 }
07143 }
07144 if (cent->currentState.npcSaber2)
07145 {
07146 saber = (char *)CG_ConfigString(CS_MODELS+cent->currentState.npcSaber2);
07147 assert(!saber || !saber[0] || saber[0] == '@');
07148 //valid saber names should always start with '@' for NPCs
07149
07150 if (saber && saber[0])
07151 {
07152 saber++; //skip over the @
07153 WP_SetSaber(cent->currentState.number, cent->npcClient->saber, 1, saber);
07154 }
07155 }
07156
07157 // If this is a not vehicle, give it saber stuff...
07158 if ( cent->currentState.NPC_class != CLASS_VEHICLE )
07159 {
07160 while (j < MAX_SABERS)
07161 {
07162 if (cent->npcClient->saber[j].model[0])
07163 {
07164 if (cent->npcClient->ghoul2Weapons[j])
07165 { //free the old instance(s)
07166 trap_G2API_CleanGhoul2Models(¢->npcClient->ghoul2Weapons[j]);
07167 cent->npcClient->ghoul2Weapons[j] = 0;
07168 }
07169
07170 CG_InitG2SaberData(j, cent->npcClient);
07171 }
07172 j++;
07173 }
07174 }
07175
07176 trap_G2API_SetSkin(cent->ghoul2, 0, skinID, skinID);
07177
07178 cent->localAnimIndex = -1;
07179
07180 GLAName[0] = 0;
07181 trap_G2API_GetGLAName(cent->ghoul2, 0, GLAName);
07182
07183 strcpy(originalModelName, modelName);
07184
07185 if (GLAName[0] &&
07186 !strstr(GLAName, "players/_humanoid/") /*&&
07187 !strstr(GLAName, "players/rockettrooper/")*/)
07188 { //it doesn't use humanoid anims.
07189 slash = Q_strrchr( GLAName, '/' );
07190 if ( slash )
07191 {
07192 strcpy(slash, "/animation.cfg");
07193
07194 cent->localAnimIndex = BG_ParseAnimationFile(GLAName, NULL, qfalse);
07195 }
07196 }
07197 else
07198 { //humanoid index.
07199 trap_G2API_AddBolt(cent->ghoul2, 0, "*r_hand");
07200 trap_G2API_AddBolt(cent->ghoul2, 0, "*l_hand");
07201
07202 //rhand must always be first bolt. lhand always second. Whichever you want the
07203 //jetpack bolted to must always be third.
07204 trap_G2API_AddBolt(cent->ghoul2, 0, "*chestg");
07205
07206 //claw bolts
07207 trap_G2API_AddBolt(cent->ghoul2, 0, "*r_hand_cap_r_arm");
07208 trap_G2API_AddBolt(cent->ghoul2, 0, "*l_hand_cap_l_arm");
07209
07210 if (strstr(GLAName, "players/rockettrooper/"))
07211 {
07212 cent->localAnimIndex = 1;
07213 }
07214 else
07215 {
07216 cent->localAnimIndex = 0;
07217 }
07218
07219 if (trap_G2API_AddBolt(cent->ghoul2, 0, "*head_top") == -1)
07220 {
07221 trap_G2API_AddBolt(cent->ghoul2, 0, "ceyebrow");
07222 }
07223 trap_G2API_AddBolt(cent->ghoul2, 0, "Motion");
07224 }
07225
07226 // If this is a not vehicle...
07227 if ( cent->currentState.NPC_class != CLASS_VEHICLE )
07228 {
07229 if (trap_G2API_AddBolt(cent->ghoul2, 0, "lower_lumbar") == -1)
07230 { //check now to see if we have this bone for setting anims and such
07231 cent->noLumbar = qtrue;
07232 }
07233
07234 if (trap_G2API_AddBolt(cent->ghoul2, 0, "face") == -1)
07235 { //check now to see if we have this bone for setting anims and such
07236 cent->noFace = qtrue;
07237 }
07238 }
07239 else
07240 {
07241 cent->noLumbar = qtrue;
07242 cent->noFace = qtrue;
07243 }
07244
07245 if (cent->localAnimIndex != -1)
07246 {
07247 slash = Q_strrchr( originalModelName, '/' );
07248 if ( slash )
07249 {
07250 slash++;
07251 *slash = 0;
07252 }
07253
07254 cent->eventAnimIndex = BG_ParseAnimationEvtFile(originalModelName, cent->localAnimIndex, bgNumAnimEvents);
07255 }
07256 }
07257 }
07258
07259 trap_S_ShutUp(qtrue);
07260 CG_HandleNPCSounds(cent); //handle sound loading here as well.
07261 trap_S_ShutUp(qfalse);
07262 }
|
|
||||||||||||
|
Definition at line 770 of file cg_players.c. References BG_ParseAnimationEvtFile(), bgNumAnimEvents, MAX_QPATH, Q_strrchr(), and trap_G2API_GetGLAName(). Referenced by CG_LoadClientInfo(), CG_NewClientInfo(), CG_Player(), and CG_ResetPlayerEntity().
00771 {
00772 int evtIndex = -1;
00773 char GLAName[MAX_QPATH];
00774 char *slash;
00775
00776 if (animIndex == -1)
00777 {
00778 assert(!"shouldn't happen, bad animIndex");
00779 return -1;
00780 }
00781
00782 GLAName[0] = 0;
00783 trap_G2API_GetGLAName(g2, 0, GLAName);
00784
00785 slash = Q_strrchr( GLAName, '/' );
00786 if ( slash )
00787 {
00788 slash++;
00789 *slash = 0;
00790
00791 evtIndex = BG_ParseAnimationEvtFile(GLAName, animIndex, bgNumAnimEvents);
00792 }
00793
00794 return evtIndex;
00795 }
|
|
|
Definition at line 4059 of file cg_players.c. References centity_t, cg, cgs, cgs_t::clientinfo, centity_s::currentState, EF_DEAD, entityState_s::eFlags, FACE_ALERT, FACE_DEAD, FACE_FROWN, FACE_TALK1, clientInfo_t::facial_aux, clientInfo_t::facial_blink, clientInfo_t::facial_frown, flrand(), centity_s::localAnimIndex, MAX_CLIENTS, centity_s::noFace, centity_s::npcClient, NULL, entityState_s::number, qboolean, qfalse, qtrue, cg_t::time, and trap_S_GetVoiceVolume(). Referenced by CG_Player().
04060 {
04061 clientInfo_t *ci = NULL;
04062 int anim = -1;
04063 int voiceVolume = 0;
04064
04065 if(cent->localAnimIndex > 1)
04066 { //only do this for humanoids
04067 return qfalse;
04068 }
04069
04070 if (cent->noFace)
04071 { // i don't have a face
04072 return qfalse;
04073 }
04074
04075 if (cent->currentState.number < MAX_CLIENTS)
04076 {
04077 ci = &cgs.clientinfo[cent->currentState.number];
04078 }
04079 else
04080 {
04081 ci = cent->npcClient;
04082 }
04083
04084 if (!ci)
04085 {
04086 return qfalse;
04087 }
04088
04089 if ( cent->currentState.eFlags & EF_DEAD )
04090 {//Dead people close their eyes and don't make faces!
04091 anim = FACE_DEAD;
04092 ci->facial_blink = -1;
04093 }
04094 else
04095 {
04096 if (!ci->facial_blink)
04097 { // set the timers
04098 ci->facial_blink = cg.time + flrand(4000.0, 8000.0);
04099 ci->facial_frown = cg.time + flrand(6000.0, 10000.0);
04100 ci->facial_aux = cg.time + flrand(6000.0, 10000.0);
04101 }
04102
04103 //are we blinking?
04104 if (ci->facial_blink < 0)
04105 { // yes, check if we are we done blinking ?
04106 if (-(ci->facial_blink) < cg.time)
04107 { // yes, so reset blink timer
04108 ci->facial_blink = cg.time + flrand(4000.0, 8000.0);
04109 CG_G2SetHeadBlink( cent, qfalse ); //stop the blink
04110 }
04111 }
04112 else // no we aren't blinking
04113 {
04114 if (ci->facial_blink < cg.time)// but should we start ?
04115 {
04116 CG_G2SetHeadBlink( cent, qtrue );
04117 if (ci->facial_blink == 1)
04118 {//requested to stay shut by SET_FACEEYESCLOSED
04119 ci->facial_blink = -(cg.time + 99999999.0f);// set blink timer
04120 }
04121 else
04122 {
04123 ci->facial_blink = -(cg.time + 300.0f);// set blink timer
04124 }
04125 }
04126 }
04127
04128 voiceVolume = trap_S_GetVoiceVolume(cent->currentState.number);
04129
04130 if (voiceVolume > 0) // if we aren't talking, then it will be 0, -1 for talking but paused
04131 {
04132 anim = FACE_TALK1 + voiceVolume -1;
04133 }
04134 else if (voiceVolume == 0) //don't do aux if in a slient part of speech
04135 {//not talking
04136 if (ci->facial_aux < 0) // are we auxing ?
04137 { //yes
04138 if (-(ci->facial_aux) < cg.time)// are we done auxing ?
04139 { // yes, reset aux timer
04140 ci->facial_aux = cg.time + flrand(7000.0, 10000.0);
04141 }
04142 else
04143 { // not yet, so choose aux
04144 anim = FACE_ALERT;
04145 }
04146 }
04147 else // no we aren't auxing
04148 { // but should we start ?
04149 if (ci->facial_aux < cg.time)
04150 {//yes
04151 anim = FACE_ALERT;
04152 // set aux timer
04153 ci->facial_aux = -(cg.time + 2000.0);
04154 }
04155 }
04156
04157 if (anim != -1) //we we are auxing, see if we should override with a frown
04158 {
04159 if (ci->facial_frown < 0)// are we frowning ?
04160 { // yes,
04161 if (-(ci->facial_frown) < cg.time)//are we done frowning ?
04162 { // yes, reset frown timer
04163 ci->facial_frown = cg.time + flrand(7000.0, 10000.0);
04164 }
04165 else
04166 { // not yet, so choose frown
04167 anim = FACE_FROWN;
04168 }
04169 }
04170 else// no we aren't frowning
04171 { // but should we start ?
04172 if (ci->facial_frown < cg.time)
04173 {
04174 anim = FACE_FROWN;
04175 // set frown timer
04176 ci->facial_frown = -(cg.time + 2000.0);
04177 }
04178 }
04179 }
04180
04181 }//talking
04182 }//dead
04183 if (anim != -1)
04184 {
04185 CG_G2SetHeadAnim( cent, anim );
04186 return qtrue;
04187 }
04188 return qfalse;
04189 }
|
|
||||||||||||||||
|
Definition at line 5691 of file cg_players.c. References centity_t, CG_G2TraceCollide(), CG_Trace(), cgs, CHAN_AUTO, centity_s::currentState, cgs_t::effects, trace_t::endpos, trace_t::entityNum, ENTITYNUM_NONE, MASK_PLAYERSOLID, MAX_CLIENTS, cgEffects_t::mSaberBloodSparks, cplane_s::normal, NULL, entityState_s::number, trace_t::plane, Q_irand(), qboolean, qfalse, qtrue, trap_FX_PlayEffectID(), trap_S_RegisterSound(), trap_S_StartSound(), va(), vec3_t, and VectorCopy. Referenced by CG_AddSaberBlade().
05692 {
05693 trace_t trace;
05694 vec3_t startTr;
05695 vec3_t endTr;
05696 qboolean backWards = qfalse;
05697 qboolean doneWithTraces = qfalse;
05698
05699 while (!doneWithTraces)
05700 {
05701 if (!backWards)
05702 {
05703 VectorCopy(start, startTr);
05704 VectorCopy(end, endTr);
05705 }
05706 else
05707 {
05708 VectorCopy(end, startTr);
05709 VectorCopy(start, endTr);
05710 }
05711
05712 CG_Trace( &trace, startTr, NULL, NULL, endTr, owner->currentState.number, MASK_PLAYERSOLID );
05713
05714 if (trace.entityNum < MAX_CLIENTS)
05715 { //hit a client..
05716 CG_G2TraceCollide(&trace, NULL, NULL, startTr, endTr);
05717
05718 if (trace.entityNum != ENTITYNUM_NONE)
05719 { //it succeeded with the ghoul2 trace
05720 trap_FX_PlayEffectID( cgs.effects.mSaberBloodSparks, trace.endpos, trace.plane.normal, -1, -1 );
05721 trap_S_StartSound(trace.endpos, trace.entityNum, CHAN_AUTO, trap_S_RegisterSound(va("sound/weapons/saber/saberhit%i.wav", Q_irand(1, 3))));
05722 }
05723 }
05724
05725 if (!backWards)
05726 {
05727 backWards = qtrue;
05728 }
05729 else
05730 {
05731 doneWithTraces = qtrue;
05732 }
05733 }
05734 }
|
|
|
Definition at line 3914 of file cg_players.c. References BONE_ANGLES_POSTMULT, entityState_s::boneAngles1, entityState_s::boneAngles2, entityState_s::boneAngles3, entityState_s::boneAngles4, entityState_s::boneIndex1, entityState_s::boneIndex2, entityState_s::boneIndex3, entityState_s::boneIndex4, entityState_s::boneOrient, centity_t, cg, CG_ConfigString(), cgs, CS_G2BONES, centity_s::currentState, cgs_t::gameModels, centity_s::ghoul2, cg_t::time, trap_G2API_SetBoneAngles(), vec3_t, and VectorCopy.
03915 {
03916 int i = 0;
03917 int bone = cent->currentState.boneIndex1;
03918 int flags, up, right, forward;
03919 vec3_t boneAngles;
03920
03921 VectorCopy(cent->currentState.boneAngles1, boneAngles);
03922
03923 while (i < 4)
03924 { //cycle through the 4 bone index values on the entstate
03925 if (bone)
03926 { //if it's non-0 then it could have something in it.
03927 const char *boneName = CG_ConfigString(CS_G2BONES+bone);
03928
03929 if (boneName && boneName[0])
03930 { //got the bone, now set the angles from the corresponding entitystate boneangles value.
03931 flags = BONE_ANGLES_POSTMULT;
03932
03933 //get the orientation out of our bit field
03934 forward = (cent->currentState.boneOrient)&7; //3 bits from bit 0
03935 right = (cent->currentState.boneOrient>>3)&7; //3 bits from bit 3
03936 up = (cent->currentState.boneOrient>>6)&7; //3 bits from bit 6
03937
03938 trap_G2API_SetBoneAngles(cent->ghoul2, 0, boneName, boneAngles, flags, up, right, forward, cgs.gameModels, 100, cg.time);
03939 }
03940 }
03941
03942 switch (i)
03943 {
03944 case 0:
03945 bone = cent->currentState.boneIndex2;
03946 VectorCopy(cent->currentState.boneAngles2, boneAngles);
03947 break;
03948 case 1:
03949 bone = cent->currentState.boneIndex3;
03950 VectorCopy(cent->currentState.boneAngles3, boneAngles);
03951 break;
03952 case 2:
03953 bone = cent->currentState.boneIndex4;
03954 VectorCopy(cent->currentState.boneAngles4, boneAngles);
03955 break;
03956 default:
03957 break;
03958 }
03959
03960 i++;
03961 }
03962 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 3365 of file cg_players.c. References memset(), qhandle_t, qtrue, trap_G2API_SetBoneAngles(), and vec3_t. Referenced by CG_RagDoll().
03368 { //we want to hold off on setting the bone angles until the end of the frame, because every time we set
03369 //them the entire skeleton has to be reconstructed.
03370 #if 0
03371 //This function should ONLY be called from CG_Player() or a function that is called only within CG_Player().
03372 //At the end of the frame we will check to use this information to call SetBoneAngles
03373 memset(&cgBoneAnglePostSet, 0, sizeof(cgBoneAnglePostSet));
03374 cgBoneAnglePostSet.ghoul2 = ghoul2;
03375 cgBoneAnglePostSet.modelIndex = modelIndex;
03376 cgBoneAnglePostSet.boneName = (char *)boneName;
03377
03378 cgBoneAnglePostSet.angles[0] = angles[0];
03379 cgBoneAnglePostSet.angles[1] = angles[1];
03380 cgBoneAnglePostSet.angles[2] = angles[2];
03381
03382 cgBoneAnglePostSet.flags = flags;
03383 cgBoneAnglePostSet.up = up;
03384 cgBoneAnglePostSet.right = right;
03385 cgBoneAnglePostSet.forward = forward;
03386 cgBoneAnglePostSet.modelList = modelList;
03387 cgBoneAnglePostSet.blendTime = blendTime;
03388 cgBoneAnglePostSet.currentTime = currentTime;
03389
03390 cgBoneAnglePostSet.refreshSet = qtrue;
03391 #endif
03392 //We don't want to go with the delayed approach, we want out bolt points and everything to be updated in realtime.
03393 //We'll just take the reconstructs and live with them.
03394 trap_G2API_SetBoneAngles(ghoul2, modelIndex, boneName, angles, flags, up, right, forward, modelList,
03395 blendTime, currentTime);
03396 }
|
|
|
Definition at line 749 of file cg_players.c. References BG_ParseAnimationFile(), MAX_QPATH, NULL, Q_strrchr(), qfalse, strcpy(), and trap_G2API_GetGLAName(). Referenced by CG_LoadClientInfo(), CG_NewClientInfo(), CG_Player(), and CG_ResetPlayerEntity().
00750 {
00751 int animIndex = -1;
00752 char GLAName[MAX_QPATH];
00753 char *slash;
00754
00755 GLAName[0] = 0;
00756 trap_G2API_GetGLAName(g2, 0, GLAName);
00757
00758 slash = Q_strrchr( GLAName, '/' );
00759 if ( slash )
00760 {
00761 strcpy(slash, "/animation.cfg");
00762
00763 animIndex = BG_ParseAnimationFile(GLAName, NULL, qfalse);
00764 }
00765
00766 return animIndex;
00767 }
|
|
||||||||||||||||||||||||
|
Definition at line 5632 of file cg_players.c. References trace_t::allsolid, centity_t, cg, cg_entities, cg_g2TraceLod, cg_optvehtrace, CLASS_VEHICLE, centity_s::currentState, trace_t::endpos, trace_t::entityNum, ENTITYNUM_NONE, ET_NPC, entityState_s::eType, trace_t::fraction, G2Trace_t, centity_s::ghoul2, vmCvar_t::integer, centity_s::lerpAngles, centity_s::lerpOrigin, centity_s::m_pVehicle, MAX_G2_COLLISIONS, memset(), CollisionRecord_t::mEntityNum, centity_s::modelScale, cplane_s::normal, entityState_s::NPC_class, entityState_s::number, PITCH, trace_t::plane, qboolean, qfalse, qtrue, ROLL, trace_t::startsolid, cg_t::time, trap_G2API_CollisionDetect(), trap_G2API_CollisionDetectCache(), vec3_t, VectorCopy, and YAW. Referenced by CG_G2SaberEffects(), and CG_SaberCompWork().
05633 {
05634 G2Trace_t G2Trace;
05635 centity_t *g2Hit;
05636 vec3_t angles;
05637 int tN = 0;
05638 float fRadius = 0.0f;
05639
05640 if (mins && maxs &&
05641 (mins[0] || maxs[0]))
05642 {
05643 fRadius=(maxs[0]-mins[0])/2.0f;
05644 }
05645
05646 memset (&G2Trace, 0, sizeof(G2Trace));
05647
05648 while (tN < MAX_G2_COLLISIONS)
05649 {
05650 G2Trace[tN].mEntityNum = -1;
05651 tN++;
05652 }
05653 g2Hit = &cg_entities[tr->entityNum];
05654
05655 if (g2Hit && g2Hit->ghoul2)
05656 {
05657 angles[ROLL] = angles[PITCH] = 0;
05658 angles[YAW] = g2Hit->lerpAngles[YAW];
05659
05660 if (cg_optvehtrace.integer &&
05661 g2Hit->currentState.eType == ET_NPC &&
05662 g2Hit->currentState.NPC_class == CLASS_VEHICLE &&
05663 g2Hit->m_pVehicle)
05664 {
05665 trap_G2API_CollisionDetectCache ( G2Trace, g2Hit->ghoul2, angles, g2Hit->lerpOrigin, cg.time, g2Hit->currentState.number, lastValidStart, lastValidEnd, g2Hit->modelScale, 0, cg_g2TraceLod.integer, fRadius );
05666 }
05667 else
05668 {
05669 trap_G2API_CollisionDetect ( G2Trace, g2Hit->ghoul2, angles, g2Hit->lerpOrigin, cg.time, g2Hit->currentState.number, lastValidStart, lastValidEnd, g2Hit->modelScale, 0, cg_g2TraceLod.integer, fRadius );
05670 }
05671
05672 if (G2Trace[0].mEntityNum != g2Hit->currentState.number)
05673 {
05674 tr->fraction = 1.0f;
05675 tr->entityNum = ENTITYNUM_NONE;
05676 tr->startsolid = 0;
05677 tr->allsolid = 0;
05678 return qfalse;
05679 }
05680 else
05681 { //Yay!
05682 VectorCopy(G2Trace[0].mCollisionPosition, tr->endpos);
05683 VectorCopy(G2Trace[0].mCollisionNormal, tr->plane.normal);
05684 return qtrue;
05685 }
05686 }
05687
05688 return qfalse;
05689 }
|
|
||||||||||||||||||||
|
Definition at line 5437 of file cg_players.c. References orientation_t::axis, refEntity_t::axis, refEntity_t::backlerp, refEntity_t::frame, refEntity_t::hModel, MatrixMultiply(), refEntity_t::oldframe, orientation_t::origin, refEntity_t::origin, trap_R_LerpTag(), vec3_t, VectorCopy, and VectorMA.
05438 {
05439 orientation_t orientation;
05440 int i = 0;
05441
05442 // Get the requested tag
05443 trap_R_LerpTag( &orientation, model->hModel, model->oldframe, model->frame,
05444 1.0f - model->backlerp, tag );
05445
05446 VectorCopy( model->origin, pos );
05447 for ( i = 0 ; i < 3 ; i++ )
05448 {
05449 VectorMA( pos, orientation.origin[i], model->axis[i], pos );
05450 }
05451
05452 if ( axis )
05453 {
05454 MatrixMultiply( orientation.axis, model->axis, axis );
05455 }
05456 }
|
|
|
Definition at line 6817 of file cg_players.c. References MAX_QPATH, Q_strrchr(), qhandle_t, strchr(), strcpy(), trap_R_RegisterSkin(), and va(). Referenced by CG_G2AnimEntModelLoad().
06818 {
06819 char skinName[MAX_QPATH];
06820 char *p;
06821 qhandle_t skinID = 0;
06822 int i = 0;
06823
06824 //see if it has a skin name
06825 p = Q_strrchr(modelName, '*');
06826
06827 if (p)
06828 { //found a *, we should have a model name before it and a skin name after it.
06829 *p = 0; //terminate the modelName string at this point, then go ahead and parse to the next 0 for the skin.
06830 p++;
06831
06832 while (p && *p)
06833 {
06834 skinName[i] = *p;
06835 i++;
06836 p++;
06837 }
06838 skinName[i] = 0;
06839
06840 if (skinName[0])
06841 { //got it, register the skin under the model path.
06842 char baseFolder[MAX_QPATH];
06843
06844 strcpy(baseFolder, modelName);
06845 p = Q_strrchr(baseFolder, '/'); //go back to the first /, should be the path point
06846
06847 if (p)
06848 { //got it.. terminate at the slash and register.
06849 char *useSkinName;
06850
06851 *p = 0;
06852
06853 if (strchr(skinName, '|'))
06854 {//three part skin
06855 useSkinName = va("%s/|%s", baseFolder, skinName);
06856 }
06857 else
06858 {
06859 useSkinName = va("%s/model_%s.skin", baseFolder, skinName);
06860 }
06861
06862 skinID = trap_R_RegisterSkin(useSkinName);
06863 }
06864 }
06865 }
06866
06867 return skinID;
06868 }
|
|
|
Definition at line 484 of file cg_servercmds.c. Referenced by CG_G2AnimEntModelLoad().
00485 {
00486 if (!cent->npcClient)
00487 {
00488 return;
00489 }
00490
00491 //standard
00492 if (cent->currentState.csSounds_Std)
00493 {
00494 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Std );
00495
00496 if (s && s[0])
00497 {
00498 char sEnd[MAX_QPATH];
00499 int i = 2;
00500 int j = 0;
00501
00502 //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00503 //it is an NPC custom sound dir.
00504 while (s[i])
00505 {
00506 sEnd[j] = s[i];
00507 j++;
00508 i++;
00509 }
00510 sEnd[j] = 0;
00511
00512 CG_RegisterCustomSounds(cent->npcClient, 1, sEnd);
00513 }
00514 }
00515 else
00516 {
00517 memset(¢->npcClient->sounds, 0, sizeof(cent->npcClient->sounds));
00518 }
00519
00520 //combat
00521 if (cent->currentState.csSounds_Combat)
00522 {
00523 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Combat );
00524
00525 if (s && s[0])
00526 {
00527 char sEnd[MAX_QPATH];
00528 int i = 2;
00529 int j = 0;
00530
00531 //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00532 //it is an NPC custom sound dir.
00533 while (s[i])
00534 {
00535 sEnd[j] = s[i];
00536 j++;
00537 i++;
00538 }
00539 sEnd[j] = 0;
00540
00541 CG_RegisterCustomSounds(cent->npcClient, 2, sEnd);
00542 }
00543 }
00544 else
00545 {
00546 memset(¢->npcClient->combatSounds, 0, sizeof(cent->npcClient->combatSounds));
00547 }
00548
00549 //extra
00550 if (cent->currentState.csSounds_Extra)
00551 {
00552 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Extra );
00553
00554 if (s && s[0])
00555 {
00556 char sEnd[MAX_QPATH];
00557 int i = 2;
00558 int j = 0;
00559
00560 //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00561 //it is an NPC custom sound dir.
00562 while (s[i])
00563 {
00564 sEnd[j] = s[i];
00565 j++;
00566 i++;
00567 }
00568 sEnd[j] = 0;
00569
00570 CG_RegisterCustomSounds(cent->npcClient, 3, sEnd);
00571 }
00572 }
00573 else
00574 {
00575 memset(¢->npcClient->extraSounds, 0, sizeof(cent->npcClient->extraSounds));
00576 }
00577
00578 //jedi
00579 if (cent->currentState.csSounds_Jedi)
00580 {
00581 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Jedi );
00582
00583 if (s && s[0])
00584 {
00585 char sEnd[MAX_QPATH];
00586 int i = 2;
00587 int j = 0;
00588
00589 //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00590 //it is an NPC custom sound dir.
00591 while (s[i])
00592 {
00593 sEnd[j] = s[i];
00594 j++;
00595 i++;
00596 }
00597 sEnd[j] = 0;
00598
00599 CG_RegisterCustomSounds(cent->npcClient, 4, sEnd);
00600 }
00601 }
00602 else
00603 {
00604 memset(¢->npcClient->jediSounds, 0, sizeof(cent->npcClient->jediSounds));
00605 }
00606 }
|
|
|
Definition at line 5594 of file cg_draw.c. References centity_t, cg, cg_entities, playerState_s::m_iVehicleNum, centity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, vehicleInfo_t::type, and VH_FIGHTER. Referenced by CG_EntityEvent(), and CG_Player().
05595 {
05596 if ( cg.predictedPlayerState.m_iVehicleNum )
05597 {//I'm in a vehicle
05598 centity_t *vehCent = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
05599 if ( vehCent
05600 && vehCent->m_pVehicle
05601 && vehCent->m_pVehicle->m_pVehicleInfo
05602 && vehCent->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER )
05603 {//I'm in a fighter
05604 return qtrue;
05605 }
05606 }
05607 return qfalse;
05608 }
|
|
|
Definition at line 7882 of file cg_players.c. References cg_g2JetpackInstance, JETPACK_MODEL, trap_G2API_AddBolt(), trap_G2API_InitGhoul2Model(), and trap_G2API_SetBoltInfo(). Referenced by CG_Init().
07883 {
07884 if (cg_g2JetpackInstance)
07885 {
07886 assert(!"Tried to init jetpack inst, already init'd");
07887 return;
07888 }
07889
07890 trap_G2API_InitGhoul2Model(&cg_g2JetpackInstance, JETPACK_MODEL, 0, 0, 0, 0, 0);
07891
07892 assert(cg_g2JetpackInstance);
07893
07894 //Indicate which bolt on the player we will be attached to
07895 //In this case bolt 0 is rhand, 1 is lhand, and 2 is the bolt
07896 //for the jetpack (*chestg)
07897 trap_G2API_SetBoltInfo(cg_g2JetpackInstance, 0, 2);
07898
07899 //Add the bolts jet effects will be played from
07900 trap_G2API_AddBolt(cg_g2JetpackInstance, 0, "torso_ljet");
07901 trap_G2API_AddBolt(cg_g2JetpackInstance, 0, "torso_rjet");
07902 }
|
|
|
Definition at line 2721 of file cg_players.c. References lerpFrame_t::animationTime, BOTH_GETUP_BROLL_B, BOTH_GETUP_BROLL_F, BOTH_GETUP_BROLL_L, BOTH_GETUP_BROLL_R, BOTH_GETUP_FROLL_B, BOTH_GETUP_FROLL_F, BOTH_GETUP_FROLL_L, BOTH_GETUP_FROLL_R, BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, centity_t, cg, centity_s::currentState, playerEntity_t::legs, entityState_s::legsAnim, centity_s::pe, qboolean, qfalse, qtrue, and cg_t::time.
02722 {
02723 switch ( (cent->currentState.legsAnim) )
02724 {
02725 case BOTH_GETUP_BROLL_B:
02726 case BOTH_GETUP_BROLL_F:
02727 case BOTH_GETUP_BROLL_L:
02728 case BOTH_GETUP_BROLL_R:
02729 case BOTH_GETUP_FROLL_B:
02730 case BOTH_GETUP_FROLL_F:
02731 case BOTH_GETUP_FROLL_L:
02732 case BOTH_GETUP_FROLL_R:
02733 case BOTH_ROLL_F:
02734 case BOTH_ROLL_B:
02735 case BOTH_ROLL_R:
02736 case BOTH_ROLL_L:
02737 if ( cent->pe.legs.animationTime > cg.time )
02738 {
02739 return qtrue;
02740 }
02741 break;
02742 }
02743 return qfalse;
02744 }
|
|
|
Definition at line 2746 of file cg_players.c. References BOTH_ROLL_B, BOTH_ROLL_F, BOTH_ROLL_L, BOTH_ROLL_R, centity_t, centity_s::currentState, entityState_s::legsAnim, qboolean, qfalse, and qtrue.
02747 {
02748 switch ( (cent->currentState.legsAnim) )
02749 {
02750 case BOTH_ROLL_F:
02751 case BOTH_ROLL_B:
02752 case BOTH_ROLL_R:
02753 case BOTH_ROLL_L:
02754 return qtrue;
02755 }
02756 return qfalse;
02757 }
|
|
||||||||||||||||||||||||
|
Definition at line 6482 of file cg_players.c. References cg_entities, client, and FP_SEE. Referenced by CG_AddPlayerWeapon(), CG_AddRefEntityWithPowerups(), and CG_Player().
06483 {
06484 int checkIn;
06485 int sub = 0;
06486
06487 if (cg_entities[client].currentState.forcePowersActive & (1 << FP_SEE))
06488 {
06489 return 0;
06490 }
06491
06492 if (client > 47)
06493 {
06494 checkIn = trickIndex4;
06495 sub = 48;
06496 }
06497 else if (client > 31)
06498 {
06499 checkIn = trickIndex3;
06500 sub = 32;
06501 }
06502 else if (client > 15)
06503 {
06504 checkIn = trickIndex2;
06505 sub = 16;
06506 }
06507 else
06508 {
06509 checkIn = trickIndex1;
06510 }
06511
06512 if (checkIn & (1 << (client-sub)))
06513 {
06514 return 1;
06515 }
06516
06517 return 0;
06518 }
|
|
||||||||||||||||
|
Definition at line 5167 of file cg_players.c. References DotProduct, polyVert_t::modulate, qtrue, trap_R_LightForPoint(), and vec3_t.
05168 {
05169 int i, j;
05170 float incoming;
05171 vec3_t ambientLight;
05172 vec3_t lightDir;
05173 vec3_t directedLight;
05174
05175 trap_R_LightForPoint( verts[0].xyz, ambientLight, directedLight, lightDir );
05176
05177 for (i = 0; i < numVerts; i++) {
05178 incoming = DotProduct (normal, lightDir);
05179 if ( incoming <= 0 ) {
05180 verts[i].modulate[0] = ambientLight[0];
05181 verts[i].modulate[1] = ambientLight[1];
05182 verts[i].modulate[2] = ambientLight[2];
05183 verts[i].modulate[3] = 255;
05184 continue;
05185 }
05186 j = ( ambientLight[0] + incoming * directedLight[0] );
05187 if ( j > 255 ) {
05188 j = 255;
05189 }
05190 verts[i].modulate[0] = j;
05191
05192 j = ( ambientLight[1] + incoming * directedLight[1] );
05193 if ( j > 255 ) {
05194 j = 255;
05195 }
05196 verts[i].modulate[1] = j;
05197
05198 j = ( ambientLight[2] + incoming * directedLight[2] );
05199 if ( j > 255 ) {
05200 j = 255;
05201 }
05202 verts[i].modulate[2] = j;
05203
05204 verts[i].modulate[3] = 255;
05205 }
05206 return qtrue;
05207 }
|
|
||||||||||||
|
Definition at line 799 of file cg_players.c. References bg_customSiegeSoundNames, cg_buildScript, cg_customDuelSoundNames, cg_customSoundNames, cgs, Com_sprintf(), COM_StripExtension(), DEFAULT_FEMALE_SOUNDPATH, DEFAULT_MALE_SOUNDPATH, clientInfo_t::duelSounds, fileHandle_t, FS_READ, cgs_t::gametype, clientInfo_t::gender, GENDER_FEMALE, GENDER_MALE, GT_DUEL, GT_POWERDUEL, GT_TEAM, vmCvar_t::integer, MAX_CUSTOM_DUEL_SOUNDS, MAX_CUSTOM_SIEGE_SOUNDS, MAX_CUSTOM_SOUNDS, MAX_QPATH, clientInfo_t::modelName, Q_stricmp(), qboolean, qfalse, qtrue, clientInfo_t::siegeSounds, clientInfo_t::skinName, clientInfo_t::sounds, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_S_RegisterSound(), trap_S_ShutUp(), and va(). Referenced by CG_LoadClientInfo(), and CG_PrecachePlayersForSiegeTeam().
00800 {
00801 fileHandle_t f;
00802 qboolean isFemale = qfalse;
00803 int i = 0;
00804 int fLen = 0;
00805 const char *dir;
00806 char soundpath[MAX_QPATH];
00807 char soundName[1024];
00808 const char *s;
00809
00810 dir = ci->modelName;
00811
00812 if ( !ci->skinName || !Q_stricmp( "default", ci->skinName ) )
00813 {//try default sounds.cfg first
00814 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds.cfg", dir), &f, FS_READ);
00815 if ( !f )
00816 {//no? Look for _default sounds.cfg
00817 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds_default.cfg", dir), &f, FS_READ);
00818 }
00819 }
00820 else
00821 {//use the .skin associated with this skin
00822 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds_%s.cfg", dir, ci->skinName), &f, FS_READ);
00823 if ( !f )
00824 {//fall back to default sounds
00825 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds.cfg", dir), &f, FS_READ);
00826 }
00827 }
00828
00829 soundpath[0] = 0;
00830
00831 if (f)
00832 {
00833 trap_FS_Read(soundpath, fLen, f);
00834 soundpath[fLen] = 0;
00835
00836 i = fLen;
00837
00838 while (i >= 0 && soundpath[i] != '\n')
00839 {
00840 if (soundpath[i] == 'f')
00841 {
00842 isFemale = qtrue;
00843 soundpath[i] = 0;
00844 }
00845
00846 i--;
00847 }
00848
00849 i = 0;
00850
00851 while (soundpath[i] && soundpath[i] != '\r' && soundpath[i] != '\n')
00852 {
00853 i++;
00854 }
00855 soundpath[i] = 0;
00856
00857 trap_FS_FCloseFile(f);
00858 }
00859
00860 if (isFemale)
00861 {
00862 ci->gender = GENDER_FEMALE;
00863 }
00864 else
00865 {
00866 ci->gender = GENDER_MALE;
00867 }
00868
00869 trap_S_ShutUp(qtrue);
00870
00871 for ( i = 0 ; i < MAX_CUSTOM_SOUNDS ; i++ )
00872 {
00873 s = cg_customSoundNames[i];
00874 if ( !s ) {
00875 break;
00876 }
00877
00878 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00879 COM_StripExtension(soundName, soundName);
00880 //strip the extension because we might want .mp3's
00881
00882 ci->sounds[i] = 0;
00883 // if the model didn't load use the sounds of the default model
00884 if (soundpath[0])
00885 {
00886 ci->sounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", soundpath, soundName) );
00887 }
00888 else
00889 {
00890 if (modelloaded)
00891 {
00892 ci->sounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00893 }
00894 }
00895
00896 if (!ci->sounds[i])
00897 { //failed the load, try one out of the generic path
00898 if (isFemale)
00899 {
00900 ci->sounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00901 }
00902 else
00903 {
00904 ci->sounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00905 }
00906 }
00907 }
00908
00909 if (cgs.gametype >= GT_TEAM || cg_buildScript.integer)
00910 { //load the siege sounds then
00911 for ( i = 0 ; i < MAX_CUSTOM_SIEGE_SOUNDS; i++ )
00912 {
00913 s = bg_customSiegeSoundNames[i];
00914 if ( !s )
00915 {
00916 break;
00917 }
00918
00919 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00920 COM_StripExtension(soundName, soundName);
00921 //strip the extension because we might want .mp3's
00922
00923 ci->siegeSounds[i] = 0;
00924 // if the model didn't load use the sounds of the default model
00925 if (soundpath[0])
00926 {
00927 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", soundpath, soundName) );
00928 }
00929 else
00930 {
00931 if (modelloaded)
00932 {
00933 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00934 }
00935 }
00936
00937 if (!ci->siegeSounds[i])
00938 { //failed the load, try one out of the generic path
00939 if (isFemale)
00940 {
00941 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00942 }
00943 else
00944 {
00945 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00946 }
00947 }
00948 }
00949 }
00950
00951 if (cgs.gametype == GT_DUEL
00952 ||cgs.gametype == GT_POWERDUEL
00953 || cg_buildScript.integer)
00954 { //load the Duel sounds then
00955 for ( i = 0 ; i < MAX_CUSTOM_DUEL_SOUNDS; i++ )
00956 {
00957 s = cg_customDuelSoundNames[i];
00958 if ( !s )
00959 {
00960 break;
00961 }
00962
00963 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00964 COM_StripExtension(soundName, soundName);
00965 //strip the extension because we might want .mp3's
00966
00967 ci->duelSounds[i] = 0;
00968 // if the model didn't load use the sounds of the default model
00969 if (soundpath[0])
00970 {
00971 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", soundpath, soundName) );
00972 }
00973 else
00974 {
00975 if (modelloaded)
00976 {
00977 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00978 }
00979 }
00980
00981 if (!ci->duelSounds[i])
00982 { //failed the load, try one out of the generic path
00983 if (isFemale)
00984 {
00985 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00986 }
00987 else
00988 {
00989 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00990 }
00991 }
00992 }
00993 }
00994
00995 trap_S_ShutUp(qfalse);
00996 }
|
|
|
Definition at line 1006 of file cg_players.c. References cg_entities, CG_Error(), CG_G2EvIndexForModel(), CG_G2SkelForModel(), CG_LoadCISounds(), CG_ResetPlayerEntity(), cgs, cgs_t::clientinfo, entityState_s::clientNum, centity_s::currentState, DEFAULT_BLUETEAM_NAME, DEFAULT_MODEL, DEFAULT_REDTEAM_NAME, clientInfo_t::deferred, ET_PLAYER, entityState_s::eType, centity_s::eventAnimIndex, cgs_t::gametype, centity_s::ghoul2, clientInfo_t::ghoul2Model, GT_SIEGE, GT_TEAM, centity_s::localAnimIndex, MAX_CLIENTS, MAX_GENTITIES, MAX_QPATH, clientInfo_t::modelName, clientInfo_t::newAnims, centity_s::noFace, Q_strncpyz(), qboolean, qfalse, qtrue, clientInfo_t::siegeIndex, clientInfo_t::skinName, strcat(), clientInfo_t::team, TEAM_BLUE, TEAM_SPECTATOR, clientInfo_t::torsoModel, trap_G2_HaveWeGhoul2Models(), trap_G2API_AddBolt(), trap_G2API_AttachInstanceToEntNum(), trap_G2API_CleanGhoul2Models(), trap_G2API_ClearAttachedInstance(), trap_G2API_DuplicateGhoul2Instance(), and trap_R_LerpTag(). Referenced by CG_ActualLoadDeferredPlayers(), and CG_NewClientInfo().
01006 {
01007 qboolean modelloaded;
01008 int clientNum;
01009 int i;
01010 char teamname[MAX_QPATH];
01011
01012 clientNum = ci - cgs.clientinfo;
01013
01014 if (clientNum < 0 || clientNum >= MAX_CLIENTS)
01015 {
01016 clientNum = -1;
01017 }
01018
01019 ci->deferred = qfalse;
01020
01021 /*
01022 if (ci->team == TEAM_SPECTATOR)
01023 {
01024 // reset any existing players and bodies, because they might be in bad
01025 // frames for this new model
01026 clientNum = ci - cgs.clientinfo;
01027 for ( i = 0 ; i < MAX_GENTITIES ; i++ ) {
01028 if ( cg_entities[i].currentState.clientNum == clientNum
01029 && cg_entities[i].currentState.eType == ET_PLAYER ) {
01030 CG_ResetPlayerEntity( &cg_entities[i] );
01031 }
01032 }
01033
01034 if (ci->ghoul2Model && trap_G2_HaveWeGhoul2Models(ci->ghoul2Model))
01035 {
01036 trap_G2API_CleanGhoul2Models(&ci->ghoul2Model);
01037 }
01038
01039 return;
01040 }
01041 */
01042
01043 teamname[0] = 0;
01044 if( cgs.gametype >= GT_TEAM) {
01045 if( ci->team == TEAM_BLUE ) {
01046 Q_strncpyz(teamname, DEFAULT_BLUETEAM_NAME/*cg_blueTeamName.string*/, sizeof(teamname) );
01047 } else {
01048 Q_strncpyz(teamname, DEFAULT_REDTEAM_NAME/*cg_redTeamName.string*/, sizeof(teamname) );
01049 }
01050 }
01051 if( teamname[0] ) {
01052 strcat( teamname, "/" );
01053 }
01054 modelloaded = qtrue;
01055 if (cgs.gametype == GT_SIEGE &&
01056 (ci->team == TEAM_SPECTATOR || ci->siegeIndex == -1))
01057 { //yeah.. kind of a hack I guess. Don't care until they are actually ingame with a valid class.
01058 if ( !CG_RegisterClientModelname( ci, DEFAULT_MODEL, "default", teamname, -1 ) )
01059 {
01060 CG_Error( "DEFAULT_MODEL (%s) failed to register", DEFAULT_MODEL );
01061 }
01062 }
01063 else
01064 {
01065 if ( !CG_RegisterClientModelname( ci, ci->modelName, ci->skinName, teamname, clientNum ) ) {
01066 //CG_Error( "CG_RegisterClientModelname( %s, %s, %s, %s %s ) failed", ci->modelName, ci->skinName, ci->headModelName, ci->headSkinName, teamname );
01067 //rww - DO NOT error out here! Someone could just type in a nonsense model name and crash everyone's client.
01068 //Give it a chance to load default model for this client instead.
01069
01070 // fall back to default team name
01071 if( cgs.gametype >= GT_TEAM) {
01072 // keep skin name
01073 if( ci->team == TEAM_BLUE ) {
01074 Q_strncpyz(teamname, DEFAULT_BLUETEAM_NAME, sizeof(teamname) );
01075 } else {
01076 Q_strncpyz(teamname, DEFAULT_REDTEAM_NAME, sizeof(teamname) );
01077 }
01078 if ( !CG_RegisterClientModelname( ci, DEFAULT_MODEL, ci->skinName, teamname, -1 ) ) {
01079 CG_Error( "DEFAULT_MODEL / skin (%s/%s) failed to register", DEFAULT_MODEL, ci->skinName );
01080 }
01081 } else {
01082 if ( !CG_RegisterClientModelname( ci, DEFAULT_MODEL, "default", teamname, -1 ) ) {
01083 CG_Error( "DEFAULT_MODEL (%s) failed to register", DEFAULT_MODEL );
01084 }
01085 }
01086 modelloaded = qfalse;
01087 }
01088 }
01089
01090 if (clientNum != -1)
01091 {
01092 trap_G2API_ClearAttachedInstance(clientNum);
01093 }
01094
01095 if (clientNum != -1 && ci->ghoul2Model && trap_G2_HaveWeGhoul2Models(ci->ghoul2Model))
01096 {
01097 if (cg_entities[clientNum].ghoul2 && trap_G2_HaveWeGhoul2Models(cg_entities[clientNum].ghoul2))
01098 {
01099 trap_G2API_CleanGhoul2Models(&cg_entities[clientNum].ghoul2);
01100 }
01101 trap_G2API_DuplicateGhoul2Instance(ci->ghoul2Model, &cg_entities[clientNum].ghoul2);
01102
01103 //Attach the instance to this entity num so we can make use of client-server
01104 //shared operations if possible.
01105 trap_G2API_AttachInstanceToEntNum(cg_entities[clientNum].ghoul2, clientNum, qfalse);
01106
01107
01108 if (trap_G2API_AddBolt(cg_entities[clientNum].ghoul2, 0, "face") == -1)
01109 { //check now to see if we have this bone for setting anims and such
01110 cg_entities[clientNum].noFace = qtrue;
01111 }
01112
01113 cg_entities[clientNum].localAnimIndex = CG_G2SkelForModel(cg_entities[clientNum].ghoul2);
01114 cg_entities[clientNum].eventAnimIndex = CG_G2EvIndexForModel(cg_entities[clientNum].ghoul2, cg_entities[clientNum].localAnimIndex);
01115 }
01116
01117 ci->newAnims = qfalse;
01118 if ( ci->torsoModel ) {
01119 orientation_t tag;
01120 // if the torso model has the "tag_flag"
01121 if ( trap_R_LerpTag( &tag, ci->torsoModel, 0, 0, 1, "tag_flag" ) ) {
01122 ci->newAnims = qtrue;
01123 }
01124 }
01125
01126 // sounds
01127 if (cgs.gametype == GT_SIEGE &&
01128 (ci->team == TEAM_SPECTATOR || ci->siegeIndex == -1))
01129 { //don't need to load sounds
01130 }
01131 else
01132 {
01133 CG_LoadCISounds(ci, modelloaded);
01134 }
01135
01136 ci->deferred = qfalse;
01137
01138 // reset any existing players and bodies, because they might be in bad
01139 // frames for this new model
01140 clientNum = ci - cgs.clientinfo;
01141 for ( i = 0 ; i < MAX_GENTITIES ; i++ ) {
01142 if ( cg_entities[i].currentState.clientNum == clientNum
01143 && cg_entities[i].currentState.eType == ET_PLAYER ) {
01144 CG_ResetPlayerEntity( &cg_entities[i] );
01145 }
01146 }
01147 }
|
|
|
Definition at line 1976 of file cg_players.c. References cgQueueLoad, and qtrue. Referenced by CG_DrawOldScoreboard().
01976 {
01977 cgQueueLoad = qtrue;
01978 }
|
|
||||||||||||
|
Definition at line 1503 of file cg_players.c. References animation_t, atoi(), BG_SI_SetDesiredLength(), BG_SiegeFindClassByName(), BG_SiegeFindClassIndexByName(), BG_ValidateSkinForTeam(), bgHumanoidAnimations, saberInfo_t::blade, BONE_ANIM_OVERRIDE_FREEZE, BONE_ANIM_OVERRIDE_LOOP, clientInfo_t::botSkill, centity_t, cg, cg_buildScript, CG_ConfigString(), CG_CopyG2WeaponInstance(), cg_deferPlayers, cg_entities, cg_forceModel, CG_G2EvIndexForModel(), CG_G2SkelForModel(), CG_G2WeaponInstance(), CG_LoadClientInfo(), cgs, cgs_t::clientinfo, playerState_s::clientNum, cg_t::clientNum, clientInfo_t::color1, clientInfo_t::color2, clientInfo_t::colorOverride, CS_PLAYERS, centity_s::currentState, clientInfo_t::duelTeam, centity_s::eventAnimIndex, animation_s::firstFrame, siegeClass_t::forcedModel, siegeClass_t::forcedSaber2Color, siegeClass_t::forcedSaberColor, siegeClass_t::forcedSkin, clientInfo_t::forcePowers, lerpFrame_t::frame, animation_s::frameLerp, cgs_t::gametype, centity_s::ghoul2, clientInfo_t::ghoul2Model, centity_s::ghoul2weapon, clientInfo_t::ghoul2Weapons, GT_SIEGE, GT_TEAM, clientInfo_t::handicap, siegeClass_t::hasForcedSaber2Color, siegeClass_t::hasForcedSaberColor, clientInfo_t::icolor1, clientInfo_t::icolor2, Info_ValueForKey(), clientInfo_t::infoValid, vmCvar_t::integer, cgs_t::jediVmerc, playerEntity_t::legs, entityState_s::legsAnim, bladeInfo_t::length, bladeInfo_t::lengthMax, cg_t::loading, centity_s::localAnimIndex, animation_s::loopFrames, clientInfo_t::losses, MAX_CLIENTS, MAX_QPATH, MAX_SABERS, memcpy(), memset(), saberInfo_t::model, clientInfo_t::modelName, clientInfo_t::name, centity_s::noFace, NULL, entityState_s::number, saberInfo_t::numBlades, animation_s::numFrames, centity_s::pe, cg_t::predictedPlayerState, snapshot_t::ps, Q_stricmp(), Q_strncpyz(), qboolean, qfalse, qtrue, clientInfo_t::saber, clientInfo_t::saber2Name, entityState_s::saberHolstered, clientInfo_t::saberName, clientInfo_t::siegeDesiredTeam, clientInfo_t::siegeIndex, clientInfo_t::skinName, cg_t::snap, strchr(), clientInfo_t::team, clientInfo_t::teamLeader, clientInfo_t::teamTask, cg_t::time, playerEntity_t::torso, entityState_s::torsoAnim, trap_Cvar_Set(), trap_Cvar_VariableStringBuffer(), trap_G2_HaveWeGhoul2Models(), trap_G2API_AddBolt(), trap_G2API_AttachInstanceToEntNum(), trap_G2API_CleanGhoul2Models(), trap_G2API_ClearAttachedInstance(), trap_G2API_DuplicateGhoul2Instance(), trap_G2API_SetBoneAnim(), entityState_s::weapon, centity_s::weapon, clientInfo_t::wins, WP_SABER, and WP_SetSaber().
01503 {
01504 clientInfo_t *ci;
01505 clientInfo_t newInfo;
01506 const char *configstring;
01507 const char *v;
01508 char *slash;
01509 void *oldGhoul2;
01510 void *oldG2Weapons[MAX_SABERS];
01511 int i = 0;
01512 int k = 0;
01513 qboolean saberUpdate[MAX_SABERS];
01514
01515 ci = &cgs.clientinfo[clientNum];
01516
01517 oldGhoul2 = ci->ghoul2Model;
01518
01519 while (k < MAX_SABERS)
01520 {
01521 oldG2Weapons[k] = ci->ghoul2Weapons[k];
01522 k++;
01523 }
01524
01525 configstring = CG_ConfigString( clientNum + CS_PLAYERS );
01526 if ( !configstring[0] ) {
01527 if (ci->ghoul2Model && trap_G2_HaveWeGhoul2Models(ci->ghoul2Model))
01528 { //clean this stuff up first
01529 trap_G2API_CleanGhoul2Models(&ci->ghoul2Model);
01530 }
01531 k = 0;
01532 while (k < MAX_SABERS)
01533 {
01534 if (ci->ghoul2Weapons[k] && trap_G2_HaveWeGhoul2Models(ci->ghoul2Weapons[k]))
01535 {
01536 trap_G2API_CleanGhoul2Models(&ci->ghoul2Weapons[k]);
01537 }
01538 k++;
01539 }
01540
01541 memset( ci, 0, sizeof( *ci ) );
01542 return; // player just left
01543 }
01544
01545 // build into a temp buffer so the defer checks can use
01546 // the old value
01547 memset( &newInfo, 0, sizeof( newInfo ) );
01548
01549 // isolate the player's name
01550 v = Info_ValueForKey(configstring, "n");
01551 Q_strncpyz( newInfo.name, v, sizeof( newInfo.name ) );
01552
01553 // colors
01554 v = Info_ValueForKey( configstring, "c1" );
01555 CG_ColorFromString( v, newInfo.color1 );
01556
01557 newInfo.icolor1 = atoi(v);
01558
01559 v = Info_ValueForKey( configstring, "c2" );
01560 CG_ColorFromString( v, newInfo.color2 );
01561
01562 newInfo.icolor2 = atoi(v);
01563
01564 // bot skill
01565 v = Info_ValueForKey( configstring, "skill" );
01566 newInfo.botSkill = atoi( v );
01567
01568 // handicap
01569 v = Info_ValueForKey( configstring, "hc" );
01570 newInfo.handicap = atoi( v );
01571
01572 // wins
01573 v = Info_ValueForKey( configstring, "w" );
01574 newInfo.wins = atoi( v );
01575
01576 // losses
01577 v = Info_ValueForKey( configstring, "l" );
01578 newInfo.losses = atoi( v );
01579
01580 // team
01581 v = Info_ValueForKey( configstring, "t" );
01582 newInfo.team = atoi( v );
01583
01584 //copy team info out to menu
01585 if ( clientNum == cg.clientNum) //this is me
01586 {
01587 trap_Cvar_Set("ui_team", v);
01588 }
01589
01590 // team task
01591 v = Info_ValueForKey( configstring, "tt" );
01592 newInfo.teamTask = atoi(v);
01593
01594 // team leader
01595 v = Info_ValueForKey( configstring, "tl" );
01596 newInfo.teamLeader = atoi(v);
01597
01598 // v = Info_ValueForKey( configstring, "g_redteam" );
01599 // Q_strncpyz(newInfo.redTeam, v, MAX_TEAMNAME);
01600
01601 // v = Info_ValueForKey( configstring, "g_blueteam" );
01602 // Q_strncpyz(newInfo.blueTeam, v, MAX_TEAMNAME);
01603
01604 // model
01605 v = Info_ValueForKey( configstring, "model" );
01606 if ( cg_forceModel.integer ) {
01607 // forcemodel makes everyone use a single model
01608 // to prevent load hitches
01609 char modelStr[MAX_QPATH];
01610 char *skin;
01611
01612 trap_Cvar_VariableStringBuffer( "model", modelStr, sizeof( modelStr ) );
01613 if ( ( skin = strchr( modelStr, '/' ) ) == NULL) {
01614 skin = "default";
01615 } else {
01616 *skin++ = 0;
01617 }
01618 Q_strncpyz( newInfo.skinName, skin, sizeof( newInfo.skinName ) );
01619 Q_strncpyz( newInfo.modelName, modelStr, sizeof( newInfo.modelName ) );
01620
01621 if ( cgs.gametype >= GT_TEAM ) {
01622 // keep skin name
01623 slash = strchr( v, '/' );
01624 if ( slash ) {
01625 Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
01626 }
01627 }
01628 } else {
01629 Q_strncpyz( newInfo.modelName, v, sizeof( newInfo.modelName ) );
01630
01631 slash = strchr( newInfo.modelName, '/' );
01632 if ( !slash ) {
01633 // modelName didn not include a skin name
01634 Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
01635 } else {
01636 Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
01637 // truncate modelName
01638 *slash = 0;
01639 }
01640 }
01641
01642 if (cgs.gametype == GT_SIEGE)
01643 { //entries only sent in siege mode
01644 //siege desired team
01645 v = Info_ValueForKey( configstring, "sdt" );
01646 if (v && v[0])
01647 {
01648 newInfo.siegeDesiredTeam = atoi(v);
01649 }
01650 else
01651 {
01652 newInfo.siegeDesiredTeam = 0;
01653 }
01654
01655 |