codemp/cgame/cg_ents.c File Reference

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

Go to the source code of this file.

Functions

qboolean CG_InFighter (void)
void CG_PositionEntityOnTag (refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName)
void CG_PositionRotatedEntityOnTag (refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName)
void CG_SetEntitySoundPosition (centity_t *cent)
void CG_S_AddLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void CG_S_AddRealLoopingSound (int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx)
void CG_S_StopLoopingSound (int entityNum, sfxHandle_t sfx)
void CG_S_UpdateLoopingSounds (int entityNum)
localEntity_tFX_AddOrientedLine (vec3_t start, vec3_t end, vec3_t normal, float stScale, float scale, float dscale, float startalpha, float endalpha, float killTime, qhandle_t shader)
void FX_DrawPortableShield (centity_t *cent)
void CG_Special (centity_t *cent)
void CG_SetGhoul2Info (refEntity_t *ent, centity_t *cent)
void CG_CreateBBRefEnts (entityState_t *s1, vec3_t origin)
void G2_BoltToGhoul2Model (centity_t *cent, refEntity_t *ent)
void ScaleModelAxis (refEntity_t *ent)
void CG_Disintegration (centity_t *cent, refEntity_t *ent)
void CG_AddRadarEnt (centity_t *cent)
void CG_AddBracketedEnt (centity_t *cent)
void CG_G2ServerBoneAngles (centity_t *cent)
qboolean BG_GetRootSurfNameWithVariant (void *ghoul2, const char *rootSurfName, char *returnSurfName, int returnSize)
qboolean CG_GreyItem (int type, int tag, int plSide)
void CG_CreateDistortionTrailPart (centity_t *cent, float scale, vec3_t pos)
void CG_PlayDoorLoopSound (centity_t *cent)
void CG_PlayDoorSound (centity_t *cent, int type)
void CG_Beam (centity_t *cent)
void CG_AdjustPositionForMover (const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out)
void CG_CalcEntityLerpPositions (centity_t *cent)
void CG_G2Animated (centity_t *cent)
void CG_ManualEntityRender (centity_t *cent)
void CG_AddPacketEntities (qboolean isPortal)
void CG_ROFF_NotetrackCallback (centity_t *cent, const char *notetrack)
void CG_Cube (vec3_t mins, vec3_t maxs, vec3_t color, float alpha)

Variables

char * forceHolocronModels []
int cgSiegeEntityRender
int CG_BMS_START = 0
int CG_BMS_MID = 1
int CG_BMS_END = 2


Function Documentation

qboolean BG_GetRootSurfNameWithVariant void *  ghoul2,
const char *  rootSurfName,
char *  returnSurfName,
int  returnSize
 

Definition at line 101 of file bg_g2_utils.c.

00102 {
00103         if ( !ghoul2 || !trap_G2API_GetSurfaceRenderStatus( ghoul2, 0, rootSurfName ) )
00104         {//see if the basic name without variants is on
00105                 Q_strncpyz( returnSurfName, rootSurfName, returnSize );
00106                 return qtrue;
00107         }
00108         else
00109         {//check variants
00110                 int i;
00111                 for ( i = 0; i < MAX_VARIANTS; i++ )
00112                 {
00113                         Com_sprintf( returnSurfName, returnSize, "%s%c", rootSurfName, 'a'+i );
00114                         if ( !trap_G2API_GetSurfaceRenderStatus( ghoul2, 0, returnSurfName ) )
00115                         {
00116                                 return qtrue;
00117                         }
00118                 }
00119         }
00120         Q_strncpyz( returnSurfName, rootSurfName, returnSize );
00121         return qfalse;
00122 }

void CG_AddBracketedEnt centity_t cent  ) 
 

Definition at line 811 of file cg_ents.c.

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

Referenced by CG_Player().

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

void CG_AddPacketEntities qboolean  isPortal  ) 
 

Definition at line 3412 of file cg_ents.c.

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

Referenced by CG_DrawActiveFrame(), and CG_DrawSkyBoxPortal().

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

void CG_AddRadarEnt centity_t cent  ) 
 

Definition at line 799 of file cg_ents.c.

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

Referenced by CG_Player().

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

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

Definition at line 2994 of file cg_ents.c.

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

Referenced by CG_CalcEntityLerpPositions(), and CG_PredictPlayerState().

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

void CG_Beam centity_t cent  ) 
 

Definition at line 2921 of file cg_ents.c.

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

Referenced by CG_EntityEvent().

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

void CG_CalcEntityLerpPositions centity_t cent  ) 
 

Definition at line 3064 of file cg_ents.c.

References trace_t::allsolid, entityState_s::apos, BG_EvaluateTrajectory(), centity_t, cg, CG_AdjustPositionForMover(), cg_entities, cg_smoothClients, CG_Trace(), CLASS_VEHICLE, playerState_s::clientNum, centity_s::currentState, DEFAULT_MAXS_2, DEFAULT_MINS_2, EF_DEAD, EF_RAG, entityState_s::eFlags, ET_NPC, entityState_s::eType, trace_t::fraction, entityState_s::groundEntityNum, vmCvar_t::integer, centity_s::interpolate, centity_s::isRagging, centity_s::lerpAngles, centity_s::lerpOrigin, playerState_s::m_iVehicleNum, MASK_PLAYERSOLID, MAX_CLIENTS, centity_s::nextState, entityState_s::NPC_class, entityState_s::number, entityState_s::owner, playerMaxs, playerMins, entityState_s::pos, cg_t::predictedPlayerState, qboolean, qfalse, qtrue, snapshot_t::serverTime, cg_t::snap, trace_t::startsolid, cg_t::time, TR_INTERPOLATE, TR_LINEAR_STOP, trajectory_t::trType, vec3_t, VectorAdd, VectorClear, VectorCopy, VectorMA, and VectorNormalize().

Referenced by vmMain().

03064                                                    {
03065         qboolean goAway = qfalse;
03066 
03067         // if this player does not want to see extrapolated players
03068         if ( !cg_smoothClients.integer ) {
03069                 // make sure the clients use TR_INTERPOLATE
03070                 if ( cent->currentState.number < MAX_CLIENTS ) {
03071                         cent->currentState.pos.trType = TR_INTERPOLATE;
03072                         cent->nextState.pos.trType = TR_INTERPOLATE;
03073                 }
03074         }
03075 
03076         if (cg.predictedPlayerState.m_iVehicleNum &&
03077                 cg.predictedPlayerState.m_iVehicleNum == cent->currentState.number &&
03078                 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03079         { //special case for vehicle we are riding
03080                 centity_t *veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
03081 
03082                 if (veh->currentState.owner == cg.predictedPlayerState.clientNum)
03083                 { //only do this if the vehicle is pilotted by this client and predicting properly
03084                         BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
03085                         BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
03086                         return;
03087                 }
03088         }
03089 
03090         if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
03091                 CG_InterpolateEntityPosition( cent );
03092                 return;
03093         }
03094 
03095         // first see if we can interpolate between two snaps for
03096         // linear extrapolated clients
03097         if ( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
03098                                                                                         cent->currentState.number < MAX_CLIENTS) {
03099                 CG_InterpolateEntityPosition( cent );
03100                 goAway = qtrue;
03101         }
03102         else if (cent->interpolate &&
03103                 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03104         {
03105                 CG_InterpolateEntityPosition( cent );
03106                 goAway = qtrue;
03107         }
03108         else
03109         {
03110                 // just use the current frame and evaluate as best we can
03111                 BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
03112                 BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
03113         }
03114 
03115 #if 0
03116         if (cent->hasRagOffset && cent->ragOffsetTime < cg.time)
03117         { //take all of the offsets from last frame and normalize the total direction and add it in
03118                 vec3_t slideDir;
03119                 vec3_t preOffset;
03120                 vec3_t addedOffset;
03121                 vec3_t  playerMins = {-15, -15, DEFAULT_MINS_2};
03122                 vec3_t  playerMaxs = {15, 15, DEFAULT_MAXS_2};
03123                 trace_t tr;
03124 
03125                 //VectorSubtract(cent->lerpOrigin, callData->bonePos, slideDir);
03126                 VectorCopy(cent->ragOffsets, slideDir);
03127                 VectorNormalize(slideDir);
03128 
03129                 //Store it in case we want to go back
03130                 VectorCopy(cent->lerpOriginOffset, preOffset);
03131 
03132                 //just add a little at a time
03133                 VectorMA(cent->lerpOriginOffset, 0.4f, slideDir, cent->lerpOriginOffset);
03134 
03135                 if (VectorLength(cent->lerpOriginOffset) > 10.0f)
03136                 { //don't go too far away
03137                         VectorCopy(preOffset, cent->lerpOriginOffset);
03138                 }
03139                 else
03140                 {
03141                         //Let's trace there to make sure we can make it
03142                         VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, addedOffset);
03143                         CG_Trace(&tr, cent->lerpOrigin, playerMins, playerMaxs, addedOffset, cent->currentState.number, MASK_PLAYERSOLID);
03144 
03145                         if (tr.startsolid || tr.allsolid || tr.fraction != 1.0f)
03146                         { //can't get there
03147                                 VectorCopy(preOffset, cent->lerpOriginOffset);
03148                         }
03149                         else
03150                         {
03151                                 /*
03152                                 if (cent->lerpOriginOffset[2] > 4.0f)
03153                                 { //don't go too far off the ground
03154                                         cent->lerpOriginOffset[2] = 4.0f;
03155                                 }
03156                                 */
03157                                 //I guess I just don't want this happening.
03158                                 cent->lerpOriginOffset[2] = 0.0f;
03159                         }
03160                 }
03161 
03162                 //done with this bit
03163                 cent->hasRagOffset = qfalse;
03164                 VectorClear(cent->ragOffsets);
03165                 cent->ragOffsetTime = cg.time + 50;
03166         }
03167 
03168         //See if we should add in the offset for ragdoll
03169         if (cent->isRagging && ((cent->currentState.eFlags & EF_DEAD) || (cent->currentState.eFlags & EF_RAG)))
03170         {
03171                 VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, cent->lerpOrigin);
03172         }
03173 #endif
03174 
03175         if (goAway)
03176         {
03177                 return;
03178         }
03179 
03180         // adjust for riding a mover if it wasn't rolled into the predicted
03181         // player state
03182         if ( cent->currentState.number != cg.predictedPlayerState.clientNum ) {
03183                 CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum, 
03184                 cg.snap->serverTime, cg.time, cent->lerpOrigin );
03185         }
03186 }

void CG_CreateBBRefEnts entityState_t s1,
vec3_t  origin
 

Definition at line 502 of file cg_ents.c.

References entityState_t, and vec3_t.

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

void CG_CreateDistortionTrailPart centity_t cent,
float  scale,
vec3_t  pos
 

Definition at line 2324 of file cg_ents.c.

References AnglesToAxis(), refEntity_t::axis, centity_t, cg, cg_renderToTextureFX, cgs, refEntity_t::customShader, refEntity_t::hModel, vmCvar_t::integer, cgMedia_t::itemRespawningRezOut, centity_s::lerpAngles, cgs_t::media, memset(), refEntity_t::modelScale, refEntity_t::origin, PITCH, refEntity_t::radius, cg_t::refdef, refEntity_t::renderfx, RF_DISTORTION, RF_FORCE_ENT_ALPHA, ScaleModelAxis(), refEntity_t::shaderRGBA, trap_R_AddRefEntityToScene(), trap_R_RegisterModel(), vec3_t, VectorCopy, VectorNormalize(), VectorSubtract, and refdef_t::vieworg.

02325 {
02326         refEntity_t ent;
02327         vec3_t ang;
02328         float vLen;
02329 
02330         if (!cg_renderToTextureFX.integer)
02331         {
02332                 return;
02333         }
02334         memset( &ent, 0, sizeof( ent ) );
02335 
02336         VectorCopy( pos, ent.origin );
02337 
02338         VectorSubtract(ent.origin, cg.refdef.vieworg, ent.axis[0]);
02339         vLen = VectorLength(ent.axis[0]);
02340         if (VectorNormalize(ent.axis[0]) <= 0.1f)
02341         {       // Entity is right on vieworg.  quit.
02342                 return;
02343         }
02344 
02345         VectorCopy(cent->lerpAngles, ang);
02346         ang[PITCH] += 90.0f;
02347         AnglesToAxis(ang, ent.axis);
02348 
02349         //radius must be a power of 2, and is the actual captured texture size
02350         if (vLen < 512)
02351         {
02352                 ent.radius = 256;
02353         }
02354         else if (vLen < 1024)
02355         {
02356                 ent.radius = 128;
02357         }
02358         else if (vLen < 2048)
02359         {
02360                 ent.radius = 64;
02361         }
02362         else
02363         {
02364                 ent.radius = 32;
02365         }
02366 
02367         ent.modelScale[0] = scale;
02368         ent.modelScale[1] = scale;
02369         ent.modelScale[2] = scale*16.0f;
02370         ScaleModelAxis(&ent);
02371 
02372         ent.hModel = trap_R_RegisterModel("models/weapons2/merr_sonn/trailmodel.md3");
02373         ent.customShader = cgs.media.itemRespawningRezOut;//cgs.media.cloakedShader;//cgs.media.halfShieldShader;       
02374 
02375 #if 1
02376         ent.renderfx = (RF_DISTORTION|RF_FORCE_ENT_ALPHA);
02377         ent.shaderRGBA[0] = 255.0f;
02378         ent.shaderRGBA[1] = 255.0f;
02379         ent.shaderRGBA[2] = 255.0f;
02380         ent.shaderRGBA[3] = 100.0f;
02381 #else //no alpha
02382         ent.renderfx = RF_DISTORTION;
02383 #endif
02384 
02385         trap_R_AddRefEntityToScene( &ent );
02386 }

void CG_Cube vec3_t  mins,
vec3_t  maxs,
vec3_t  color,
float  alpha
 

Definition at line 3744 of file cg_ents.c.

References addpolyArgStruct_t, addpolyArgStruct_s::alpha1, addpolyArgStruct_s::alpha2, cg, cgs, cg_t::frametime, addpolyArgStruct_s::killTime, cgs_t::media, memset(), addpolyArgStruct_s::numVerts, addpolyArgStruct_s::p, addpolyArgStruct_s::rgb1, addpolyArgStruct_s::rgb2, addpolyArgStruct_s::rotationDelta, addpolyArgStruct_s::shader, cgMedia_t::solidWhite, trap_FX_AddPoly(), vec3_t, and VectorCopy.

Referenced by CG_PredictPlayerState().

03745 {
03746         vec3_t  rot={0,0,0};
03747         int             vec[3];
03748         int             axis, i;
03749         addpolyArgStruct_t apArgs;
03750 
03751         memset (&apArgs, 0, sizeof(apArgs));
03752 
03753         for ( axis = 0, vec[0] = 0, vec[1] = 1, vec[2] = 2; axis < 3; axis++, vec[0]++, vec[1]++, vec[2]++ )
03754         {
03755                 for ( i = 0; i < 3; i++ )
03756                 {
03757                         if ( vec[i] > 2 )
03758                         {
03759                                 vec[i] = 0;
03760                         }
03761                 }
03762 
03763                 apArgs.p[0][vec[1]] = mins[vec[1]];
03764                 apArgs.p[0][vec[2]] = mins[vec[2]];
03765 
03766                 apArgs.p[1][vec[1]] = mins[vec[1]];
03767                 apArgs.p[1][vec[2]] = maxs[vec[2]];
03768 
03769                 apArgs.p[2][vec[1]] = maxs[vec[1]];
03770                 apArgs.p[2][vec[2]] = maxs[vec[2]];
03771                 
03772                 apArgs.p[3][vec[1]] = maxs[vec[1]];
03773                 apArgs.p[3][vec[2]] = mins[vec[2]];
03774 
03775                 //- face
03776                 apArgs.p[0][vec[0]] = apArgs.p[1][vec[0]] = apArgs.p[2][vec[0]] = apArgs.p[3][vec[0]] = mins[vec[0]];
03777 
03778                 apArgs.numVerts = 4;
03779                 apArgs.alpha1 = apArgs.alpha2 = alpha;
03780                 VectorCopy( color, apArgs.rgb1 );
03781                 VectorCopy( color, apArgs.rgb2 );
03782                 VectorCopy( rot, apArgs.rotationDelta );
03783                 apArgs.killTime = cg.frametime;
03784                 apArgs.shader = cgs.media.solidWhite;
03785 
03786                 trap_FX_AddPoly( &apArgs );
03787 
03788                 //+ face
03789                 apArgs.p[0][vec[0]] = apArgs.p[1][vec[0]] = apArgs.p[2][vec[0]] = apArgs.p[3][vec[0]] = maxs[vec[0]];
03790 
03791                 trap_FX_AddPoly( &apArgs );
03792         }
03793 }

void CG_Disintegration centity_t cent,
refEntity_t ent
 

Definition at line 653 of file cg_ents.c.

References AngleVectors(), centity_t, cg, cg_timescale, cgs, crandom, centity_s::currentState, refEntity_t::customShader, cgMedia_t::disruptorShader, centity_s::dustTrailTime, cgs_t::effects, refEntity_t::endTime, cgs_t::gameModels, centity_s::ghoul2, centity_s::lerpAngles, centity_s::lerpOrigin, cgEffects_t::mDisruptorDeathSmoke, cgs_t::media, centity_s::modelScale, NULL, refEntity_t::oldorigin, refEntity_t::origin, ORIGIN, entityState_s::origin2, random, cg_t::refdef, refEntity_t::renderfx, RF_DISINTEGRATE1, RF_DISINTEGRATE2, cg_t::time, trap_FX_PlayEffectID(), trap_G2API_AddBolt(), trap_G2API_GetBoltMatrix(), trap_R_AddRefEntityToScene(), vmCvar_t::value, vec3_t, vectoangles(), VectorCopy, VectorMA, VectorNormalize(), VectorScale, VectorSet, VectorSubtract, refdef_t::viewaxis, and YAW.

Referenced by CG_Player().

00654 {
00655         vec3_t tempAng, hitLoc;
00656         float tempLength;
00657 
00658         VectorCopy(cent->currentState.origin2, hitLoc);
00659 
00660         VectorSubtract( hitLoc, ent->origin, ent->oldorigin );
00661         
00662         tempLength = VectorNormalize( ent->oldorigin );
00663         vectoangles( ent->oldorigin, tempAng );
00664         tempAng[YAW] -= cent->lerpAngles[YAW];
00665         AngleVectors( tempAng, ent->oldorigin, NULL, NULL );
00666         VectorScale( ent->oldorigin, tempLength, ent->oldorigin );
00667 
00668         ent->endTime = cent->dustTrailTime;
00669 
00670         ent->renderfx |= RF_DISINTEGRATE2;
00671         ent->customShader = cgs.media.disruptorShader;
00672         trap_R_AddRefEntityToScene( ent );
00673 
00674         ent->renderfx &= ~(RF_DISINTEGRATE2);
00675         ent->renderfx |= (RF_DISINTEGRATE1);
00676         ent->customShader = 0;
00677         trap_R_AddRefEntityToScene( ent );
00678 
00679         if ( cg.time - ent->endTime < 1000 && (cg_timescale.value * cg_timescale.value * random()) > 0.05f )
00680         {
00681                 vec3_t fxOrg, fxDir;
00682                 mdxaBone_t      boltMatrix;
00683                 int torsoBolt = trap_G2API_AddBolt(cent->ghoul2, 0, "lower_lumbar");
00684 
00685                 VectorSet(fxDir, 0, 1, 0);
00686 
00687                 trap_G2API_GetBoltMatrix( cent->ghoul2, 0, torsoBolt, &boltMatrix, cent->lerpAngles, cent->lerpOrigin, cg.time, 
00688                                 cgs.gameModels, cent->modelScale);
00689                                 BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, fxOrg );
00690 
00691                 VectorMA( fxOrg, -18, cg.refdef.viewaxis[0], fxOrg );
00692                 fxOrg[2] += crandom() * 20;
00693                 trap_FX_PlayEffectID( cgs.effects.mDisruptorDeathSmoke, fxOrg, fxDir, -1, -1 );
00694 
00695                 if ( random() > 0.5f )
00696                 {
00697                         trap_FX_PlayEffectID( cgs.effects.mDisruptorDeathSmoke, fxOrg, fxDir, -1, -1 );
00698                 }
00699         }
00700 }

void CG_G2Animated centity_t cent  ) 
 

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 = &cent->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 }

void CG_G2ServerBoneAngles centity_t cent  ) 
 

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 }

qboolean CG_GreyItem int  type,
int  tag,
int  plSide
 

Definition at line 1849 of file cg_ents.c.

References FORCE_DARKSIDE, FORCE_LIGHTSIDE, IT_POWERUP, PW_FORCE_ENLIGHTENED_DARK, PW_FORCE_ENLIGHTENED_LIGHT, qboolean, qfalse, and qtrue.

01850 {
01851         if (type == IT_POWERUP &&
01852                 (tag == PW_FORCE_ENLIGHTENED_LIGHT || tag == PW_FORCE_ENLIGHTENED_DARK))
01853         {
01854                 if (plSide == FORCE_LIGHTSIDE)
01855                 {
01856                         if (tag == PW_FORCE_ENLIGHTENED_DARK)
01857                         {
01858                                 return qtrue;
01859                         }
01860                 }
01861                 else if (plSide == FORCE_DARKSIDE)
01862                 {
01863                         if (tag == PW_FORCE_ENLIGHTENED_LIGHT)
01864                         {
01865                                 return qtrue;
01866                         }
01867                 }
01868         }
01869 
01870         return qfalse;
01871 }

qboolean CG_InFighter void   ) 
 

Definition at line 5594 of file cg_draw.c.

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 }

void CG_ManualEntityRender centity_t cent  ) 
 

Definition at line 3401 of file cg_ents.c.

References centity_t.

Referenced by CG_Player().

03402 {
03403         CG_AddCEntity(cent);
03404 }

void CG_PlayDoorLoopSound centity_t cent  ) 
 

Definition at line 2739 of file cg_ents.c.

References centity_t, CG_BMS_MID, CG_ConfigString(), CG_S_AddRealLoopingSound(), cgs, CS_AMBIENT_SET, centity_s::currentState, ET_MOVER, entityState_s::eType, cgs_t::inlineModelMidpoints, centity_s::lerpOrigin, entityState_s::modelindex, entityState_s::number, sfxHandle_t, entityState_s::soundSetIndex, trap_AS_GetBModelSound(), vec3_origin, vec3_t, VectorAdd, and VectorCopy.

Referenced by CG_EntityEvent().

02740 {
02741         sfxHandle_t     sfx;
02742         const char *soundSet;
02743         vec3_t  origin;
02744         float   *v;
02745 
02746         if ( !cent->currentState.soundSetIndex )
02747         {
02748                 return;
02749         }
02750 
02751         soundSet = CG_ConfigString( CS_AMBIENT_SET + cent->currentState.soundSetIndex );
02752 
02753         if (!soundSet || !soundSet[0])
02754         {
02755                 return;
02756         }
02757 
02758         sfx = trap_AS_GetBModelSound( soundSet, CG_BMS_MID );
02759 
02760         if ( sfx == -1 )
02761         {
02762                 return;
02763         }
02764 
02765         if (cent->currentState.eType == ET_MOVER) //shouldn't be in here otherwise, but just in case.
02766         {
02767                 v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
02768                 VectorAdd( cent->lerpOrigin, v, origin );
02769         }
02770         else
02771         {
02772                 VectorCopy(cent->lerpOrigin, origin);
02773         }
02774 
02775         //ent->s.loopSound = sfx;
02776         CG_S_AddRealLoopingSound(cent->currentState.number, origin, vec3_origin, sfx);
02777 }

void CG_PlayDoorSound centity_t cent,
int  type
 

Definition at line 2785 of file cg_ents.c.

References centity_t, CG_ConfigString(), CHAN_AUTO, CS_AMBIENT_SET, centity_s::currentState, NULL, entityState_s::number, sfxHandle_t, entityState_s::soundSetIndex, trap_AS_GetBModelSound(), and trap_S_StartSound().

Referenced by CG_EntityEvent().

02786 {
02787         sfxHandle_t     sfx;
02788         const char *soundSet;
02789 
02790         if ( !cent->currentState.soundSetIndex )
02791         {
02792                 return;
02793         }
02794 
02795         soundSet = CG_ConfigString( CS_AMBIENT_SET + cent->currentState.soundSetIndex );
02796 
02797         if (!soundSet || !soundSet[0])
02798         {
02799                 return;
02800         }
02801 
02802         sfx = trap_AS_GetBModelSound( soundSet, type );
02803 
02804         if ( sfx == -1 )
02805         {
02806                 return;
02807         }
02808 
02809         trap_S_StartSound( NULL, cent->currentState.number, CHAN_AUTO, sfx );
02810 }

void CG_PositionEntityOnTag refEntity_t entity,
const refEntity_t parent,
qhandle_t  parentModel,
char *  tagName
 

Definition at line 26 of file cg_ents.c.

References refEntity_t::axis, orientation_t::axis, refEntity_t::backlerp, refEntity_t::frame, MatrixMultiply(), refEntity_t::oldframe, refEntity_t::origin, orientation_t::origin, qhandle_t, trap_R_LerpTag(), VectorCopy, and VectorMA.

Referenced by CG_AddPlayerWeapon().

00027                                                                                                {
00028         int                             i;
00029         orientation_t   lerped;
00030         
00031         // lerp the tag
00032         trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
00033                 1.0 - parent->backlerp, tagName );
00034 
00035         // FIXME: allow origin offsets along tag?
00036         VectorCopy( parent->origin, entity->origin );
00037         for ( i = 0 ; i < 3 ; i++ ) {
00038                 VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
00039         }
00040 
00041         // had to cast away the const to avoid compiler problems...
00042         MatrixMultiply( lerped.axis, ((refEntity_t *)parent)->axis, entity->axis );
00043         entity->backlerp = parent->backlerp;
00044 }

void CG_PositionRotatedEntityOnTag refEntity_t entity,
const refEntity_t parent,
qhandle_t  parentModel,
char *  tagName
 

Definition at line 55 of file cg_ents.c.

References refEntity_t::axis, orientation_t::axis, refEntity_t::backlerp, refEntity_t::frame, MatrixMultiply(), refEntity_t::oldframe, refEntity_t::origin, orientation_t::origin, qhandle_t, trap_R_LerpTag(), vec3_t, VectorCopy, and VectorMA.

Referenced by CG_AddPlayerWeapon().

00056                                                                                                {
00057         int                             i;
00058         orientation_t   lerped;
00059         vec3_t                  tempAxis[3];
00060 
00061 //AxisClear( entity->axis );
00062         // lerp the tag
00063         trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
00064                 1.0 - parent->backlerp, tagName );
00065 
00066         // FIXME: allow origin offsets along tag?
00067         VectorCopy( parent->origin, entity->origin );
00068         for ( i = 0 ; i < 3 ; i++ ) {
00069                 VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
00070         }
00071 
00072         // had to cast away the const to avoid compiler problems...
00073         MatrixMultiply( entity->axis, lerped.axis, tempAxis );
00074         MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
00075 }

void CG_ROFF_NotetrackCallback centity_t cent,
const char *  notetrack
 

Definition at line 3539 of file cg_ents.c.

References AngleVectors(), atof(), centity_t, CHAN_BODY, Com_Printf(), Com_sprintf(), centity_s::currentState, centity_s::lerpAngles, centity_s::lerpOrigin, entityState_s::number, strcmp(), trap_FX_PlayEffectID(), trap_FX_RegisterEffect(), trap_S_RegisterSound(), trap_S_StartSound(), vec3_t, VectorClear, and VectorCopy.

Referenced by vmMain().

03540 {
03541         int i = 0, r = 0, objectID = 0, anglesGathered = 0, posoffsetGathered = 0;
03542         char type[256];
03543         char argument[512];
03544         char addlArg[512];
03545         char errMsg[256];
03546         char t[64];
03547         int addlArgs = 0;
03548         vec3_t parsedAngles, parsedOffset, useAngles, useOrigin, forward, right, up;
03549 
03550         if (!cent || !notetrack)
03551         {
03552                 return;
03553         }
03554 
03555         //notetrack = "effect effects/explosion1.efx 0+0+64 0-0-1";
03556 
03557         while (notetrack[i] && notetrack[i] != ' ')
03558         {
03559                 type[i] = notetrack[i];
03560                 i++;
03561         }
03562 
03563         type[i] = '\0';
03564 
03565         if (notetrack[i] != ' ')
03566         { //didn't pass in a valid notetrack type, or forgot the argument for it
03567                 return;
03568         }
03569 
03570         i++;
03571 
03572         while (notetrack[i] && notetrack[i] != ' ')
03573         {
03574                 argument[r] = notetrack[i];
03575                 r++;
03576                 i++;
03577         }
03578         argument[r] = '\0';
03579 
03580         if (!r)
03581         {
03582                 return;
03583         }
03584 
03585         if (notetrack[i] == ' ')
03586         { //additional arguments...
03587                 addlArgs = 1;
03588 
03589                 i++;
03590                 r = 0;
03591                 while (notetrack[i])
03592                 {
03593                         addlArg[r] = notetrack[i];
03594                         r++;
03595                         i++;
03596                 }
03597                 addlArg[r] = '\0';
03598         }
03599 
03600         if (strcmp(type, "effect") == 0)
03601         {
03602                 if (!addlArgs)
03603                 {
03604                         //sprintf(errMsg, "Offset position argument for 'effect' type is invalid.");
03605                         //goto functionend;
03606                         VectorClear(parsedOffset);
03607                         goto defaultoffsetposition;
03608                 }
03609 
03610                 i = 0;
03611 
03612                 while (posoffsetGathered < 3)
03613                 {
03614                         r = 0;
03615                         while (addlArg[i] && addlArg[i] != '+' && addlArg[i] != ' ')
03616                         {
03617                                 t[r] = addlArg[i];
03618                                 r++;
03619                                 i++;
03620                         }
03621                         t[r] = '\0';
03622                         i++;
03623                         if (!r)
03624                         { //failure..
03625                                 //sprintf(errMsg, "Offset position argument for 'effect' type is invalid.");
03626                                 //goto functionend;
03627                                 VectorClear(parsedOffset);
03628                                 i = 0;
03629                                 goto defaultoffsetposition;
03630                         }
03631                         parsedOffset[posoffsetGathered] = atof(t);
03632                         posoffsetGathered++;
03633                 }
03634 
03635                 if (posoffsetGathered < 3)
03636                 {
03637                         Com_sprintf(errMsg, sizeof(errMsg), "Offset position argument for 'effect' type is invalid.");
03638                         goto functionend;
03639                 }
03640 
03641                 i--;
03642 
03643                 if (addlArg[i] != ' ')
03644                 {
03645                         addlArgs = 0;
03646                 }
03647 
03648 defaultoffsetposition:
03649 
03650                 objectID = trap_FX_RegisterEffect(argument);
03651 
03652                 if (objectID)
03653                 {
03654                         if (addlArgs)
03655                         { //if there is an additional argument for an effect it is expected to be XANGLE-YANGLE-ZANGLE
03656                                 i++;
03657                                 while (anglesGathered < 3)
03658                                 {
03659                                         r = 0;
03660                                         while (addlArg[i] && addlArg[i] != '-')
03661                                         {
03662                                                 t[r] = addlArg[i];
03663                                                 r++;
03664                                                 i++;
03665                                         }
03666                                         t[r] = '\0';
03667                                         i++;
03668 
03669                                         if (!r)
03670                                         { //failed to get a new part of the vector
03671                                                 anglesGathered = 0;
03672                                                 break;
03673                                         }
03674 
03675                                         parsedAngles[anglesGathered] = atof(t);
03676                                         anglesGathered++;
03677                                 }
03678 
03679                                 if (anglesGathered)
03680                                 {
03681                                         VectorCopy(parsedAngles, useAngles);
03682                                 }
03683                                 else
03684                                 { //failed to parse angles from the extra argument provided..
03685                                         VectorCopy(cent->lerpAngles, useAngles);
03686                                 }
03687                         }
03688                         else
03689                         { //if no constant angles, play in direction entity is facing
03690                                 VectorCopy(cent->lerpAngles, useAngles);
03691                         }
03692 
03693                         AngleVectors(useAngles, forward, right, up);
03694 
03695                         VectorCopy(cent->lerpOrigin, useOrigin);
03696 
03697                         //forward
03698                         useOrigin[0] += forward[0]*parsedOffset[0];
03699                         useOrigin[1] += forward[1]*parsedOffset[0];
03700                         useOrigin[2] += forward[2]*parsedOffset[0];
03701 
03702                         //right
03703                         useOrigin[0] += right[0]*parsedOffset[1];
03704                         useOrigin[1] += right[1]*parsedOffset[1];
03705                         useOrigin[2] += right[2]*parsedOffset[1];
03706 
03707                         //up
03708                         useOrigin[0] += up[0]*parsedOffset[2];
03709                         useOrigin[1] += up[1]*parsedOffset[2];
03710                         useOrigin[2] += up[2]*parsedOffset[2];
03711 
03712                         trap_FX_PlayEffectID(objectID, useOrigin, useAngles, -1, -1);
03713                 }
03714         }
03715         else if (strcmp(type, "sound") == 0)
03716         {
03717                 objectID = trap_S_RegisterSound(argument);
03718                 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_BODY, objectID);
03719         }
03720         else if (strcmp(type, "loop") == 0)
03721         { //handled server-side
03722                 return;
03723         }
03724         //else if ...
03725         else
03726         {
03727                 if (type[0])
03728                 {
03729                         Com_Printf("^3Warning: \"%s\" is an invalid ROFF notetrack function\n", type);
03730                 }
03731                 else
03732                 {
03733                         Com_Printf("^3Warning: Notetrack is missing function and/or arguments\n");
03734                 }
03735         }
03736 
03737         return;
03738 
03739 functionend:
03740         Com_Printf("^3Type-specific notetrack error: %s\n", errMsg);
03741         return;
03742 }

void CG_S_AddLoopingSound int  entityNum,
const vec3_t  origin,
const vec3_t  velocity,
sfxHandle_t  sfx
 

Definition at line 119 of file cg_ents.c.

References centity_t, cg_entities, cgLoopSound_t, Com_Printf(), cgLoopSound_s::entityNum, centity_s::loopingSound, MAX_CG_LOOPSOUNDS, NULL, centity_s::numLoopingSounds, cgLoopSound_s::origin, qboolean, qfalse, qtrue, S_COLOR_YELLOW, cgLoopSound_s::sfx, sfxHandle_t, vec3_t, VectorCopy, and cgLoopSound_s::velocity.

Referenced by CG_S_AddRealLoopingSound().

00120 {
00121         centity_t *cent = &cg_entities[entityNum];
00122         cgLoopSound_t *cSound = NULL;
00123         int i = 0;
00124         qboolean alreadyPlaying = qfalse;
00125 
00126         //first see if we're already looping this sound handle.
00127         while (i < cent->numLoopingSounds)
00128         {
00129                 cSound = &cent->loopingSound[i];
00130 
00131                 if (cSound->sfx == sfx)
00132                 {
00133                         alreadyPlaying = qtrue;
00134                         break;
00135                 }
00136         }
00137         
00138         if (alreadyPlaying && cSound)
00139         { //if this is the case, just update the properties of the looping sound and return.
00140                 VectorCopy(origin, cSound->origin);
00141                 VectorCopy(velocity, cSound->velocity);
00142         }
00143         else if (cent->numLoopingSounds >= MAX_CG_LOOPSOUNDS)
00144         { //Just don't add it then I suppose.
00145 #ifdef _XBOX    // We decreased this number, so I'd like to know if it gets overflowed
00146                 Com_Printf( S_COLOR_YELLOW "Warning: MAX_CG_LOOPSOUNDS exceeded!!\n" );
00147 #endif
00148                 return;
00149         }
00150 
00151         //Add a new looping sound.
00152         cSound = &cent->loopingSound[cent->numLoopingSounds];
00153 
00154         cSound->entityNum = entityNum;
00155         VectorCopy(origin, cSound->origin);
00156         VectorCopy(velocity, cSound->velocity);
00157         cSound->sfx = sfx;
00158 
00159         cent->numLoopingSounds++;
00160 }

void CG_S_AddRealLoopingSound int  entityNum,
const vec3_t  origin,
const vec3_t  velocity,
sfxHandle_t  sfx
 

Definition at line 169 of file cg_ents.c.

References CG_S_AddLoopingSound(), sfxHandle_t, and vec3_t.

Referenced by CG_EntityEvent(), and CG_PlayDoorLoopSound().

00170 {
00171         CG_S_AddLoopingSound(entityNum, origin, velocity, sfx);
00172 }

void CG_S_StopLoopingSound int  entityNum,
sfxHandle_t  sfx
 

Definition at line 181 of file cg_ents.c.

References centity_t, cg_entities, cgLoopSound_t, centity_s::loopingSound, memcpy(), centity_s::numLoopingSounds, cgLoopSound_s::sfx, and sfxHandle_t.

Referenced by CG_EntityEvent().

00182 {
00183         centity_t *cent = &cg_entities[entityNum];
00184         cgLoopSound_t *cSound;
00185 
00186         if (sfx == -1)
00187         { //clear all the looping sounds on the entity
00188                 cent->numLoopingSounds = 0;
00189         }
00190         else
00191         { //otherwise, clear only the specified looping sound
00192                 int i = 0;
00193 
00194                 while (i < cent->numLoopingSounds)
00195                 {
00196                         cSound = &cent->loopingSound[i];
00197 
00198                         if (cSound->sfx == sfx)
00199                         { //remove it then
00200                                 int x = i+1;
00201 
00202                                 while (x < cent->numLoopingSounds)
00203                                 {
00204                                         memcpy(&cent->loopingSound[x-1], &cent->loopingSound[x], sizeof(cent->loopingSound[x]));
00205                                         x++;
00206                                 }
00207                                 cent->numLoopingSounds--;
00208                         }
00209 
00210                         i++;
00211                 }
00212         }
00213         //trap_S_StopLoopingSound(entityNum);
00214 }

void CG_S_UpdateLoopingSounds int  entityNum  ) 
 

Definition at line 223 of file cg_ents.c.

References centity_t, cg_entities, cgLoopSound_t, cgs, centity_s::currentState, ET_MOVER, entityState_s::eType, cgs_t::inlineModelMidpoints, centity_s::lerpOrigin, centity_s::loopingSound, entityState_s::modelindex, centity_s::numLoopingSounds, cgLoopSound_s::sfx, trap_S_AddLoopingSound(), vec3_t, VectorAdd, VectorCopy, and cgLoopSound_s::velocity.

Referenced by CG_UpdateSoundTrackers().

00224 {
00225         centity_t *cent = &cg_entities[entityNum];
00226         cgLoopSound_t *cSound;
00227         vec3_t lerpOrg;
00228         float *v;
00229         int i = 0;
00230 
00231         if (!cent->numLoopingSounds)
00232         {
00233                 return;
00234         }
00235 
00236         if (cent->currentState.eType == ET_MOVER)
00237         {
00238                 v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
00239                 VectorAdd( cent->lerpOrigin, v, lerpOrg );
00240         }
00241         else
00242         {
00243                 VectorCopy(cent->lerpOrigin, lerpOrg);
00244         }
00245 
00246         while (i < cent->numLoopingSounds)
00247         {
00248                 cSound = &cent->loopingSound[i];
00249 
00250                 //trap_S_AddLoopingSound(entityNum, cSound->origin, cSound->velocity, cSound->sfx);
00251                 //I guess just keep using lerpOrigin for now,
00252                 trap_S_AddLoopingSound(entityNum, lerpOrg, cSound->velocity, cSound->sfx);
00253                 i++;
00254         }
00255 }

void CG_SetEntitySoundPosition centity_t cent  ) 
 

Definition at line 96 of file cg_ents.c.

References centity_t, cgs, centity_s::currentState, cgs_t::inlineModelMidpoints, centity_s::lerpOrigin, entityState_s::modelindex, entityState_s::number, entityState_s::solid, SOLID_BMODEL, trap_S_UpdateEntityPosition(), vec3_t, and VectorAdd.

Referenced by CG_CheckEvents().

00096                                                   {
00097         if ( cent->currentState.solid == SOLID_BMODEL )
00098         {
00099                 vec3_t  origin;
00100                 float   *v;
00101 
00102                 v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
00103                 VectorAdd( cent->lerpOrigin, v, origin );
00104                 trap_S_UpdateEntityPosition( cent->currentState.number, origin );
00105         }
00106         else
00107         {
00108                 trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin );
00109         }
00110 }

void CG_SetGhoul2Info refEntity_t ent,
centity_t cent
 

Definition at line 490 of file cg_ents.c.

References refEntity_t::angles, centity_t, refEntity_t::ghoul2, centity_s::ghoul2, centity_s::lerpAngles, centity_s::modelScale, refEntity_t::modelScale, refEntity_t::radius, centity_s::radius, and VectorCopy.

Referenced by CG_Beam(), and CG_Player().

00491 {
00492 
00493         ent->ghoul2 = cent->ghoul2;
00494         VectorCopy( cent->modelScale, ent->modelScale);
00495         ent->radius = cent->radius;
00496         VectorCopy (cent->lerpAngles, ent->angles);
00497 }

void CG_Special centity_t cent  ) 
 

Definition at line 463 of file cg_ents.c.

References centity_t, centity_s::currentState, entityState_t, FX_DrawPortableShield(), HI_SHIELD, and entityState_s::modelindex.

00463                                    {
00464         entityState_t           *s1;
00465 
00466         s1 = &cent->currentState;
00467 
00468         if (!s1)
00469         {
00470                 return;
00471         }
00472 
00473         // if set to invisible, skip
00474         if (!s1->modelindex) {
00475                 return;
00476         }
00477 
00478         if (s1->modelindex == HI_SHIELD) 
00479         {       // The portable shield should go through a different rendering function.
00480                 FX_DrawPortableShield(cent);
00481                 return;
00482         }
00483 }

localEntity_t* FX_AddOrientedLine vec3_t  start,
vec3_t  end,
vec3_t  normal,
float  stScale,
float  scale,
float  dscale,
float  startalpha,
float  endalpha,
float  killTime,
qhandle_t  shader
 

Definition at line 329 of file cg_ents.c.

References localEntity_s::alpha, refEntity_t::axis, AxisClear(), cg, CG_AllocLocalEntity(), localEntity_s::color, Com_Printf(), refEntity_t::customShader, localEntity_s::dalpha, refEntity_t::data, localEntity_s::data, localEntity_s::endTime, LE_OLINE, localEntity_s::leType, localEntity_s::lifeRate, localEntity_t, refEntity_t::oldorigin, refEntity_t::origin, qhandle_t, localEntity_s::refEntity, RotateAroundDirection(), refEntity_t::shaderRGBA, localEntity_s::startTime, cg_t::time, vec3_t, and VectorCopy.

Referenced by FX_DrawPortableShield().

00331 {
00332         localEntity_t   *le;
00333         
00334 #ifdef _DEBUG
00335         if (!shader)
00336         {
00337                 Com_Printf("FX_AddLine: NULL shader\n");
00338         }
00339 #endif
00340 
00341         le = CG_AllocLocalEntity();
00342         le->leType = LE_OLINE;
00343 
00344         le->startTime = cg.time;
00345         le->endTime = le->startTime + killTime;
00346         le->data.line.width = scale;
00347         le->data.line.dwidth = dscale;
00348 
00349         le->alpha = startalpha;
00350         le->dalpha = endalpha - startalpha;
00351 
00352         le->refEntity.data.line.stscale = stScale;
00353         le->refEntity.data.line.width = scale;
00354 
00355         le->refEntity.customShader = shader;
00356 
00357         // set origin
00358         VectorCopy ( start, le->refEntity.origin);
00359         VectorCopy ( end, le->refEntity.oldorigin );
00360 
00361         AxisClear(le->refEntity.axis);
00362         VectorCopy( normal, le->refEntity.axis[0] );
00363         RotateAroundDirection( le->refEntity.axis, 0); // le->refEntity.data.sprite.rotation ); This is roll in quad land
00364 
00365         le->refEntity.shaderRGBA[0] = 0xff;
00366         le->refEntity.shaderRGBA[1] = 0xff;
00367         le->refEntity.shaderRGBA[2] = 0xff;
00368         le->refEntity.shaderRGBA[3] = 0xff;
00369 
00370         le->color[0] = 1.0;
00371         le->color[1] = 1.0;
00372         le->color[2] = 1.0;
00373         le->color[3] = 1.0;
00374         le->lifeRate = 1.0 / ( le->endTime - le->startTime );
00375 
00376         return(le);
00377 }

void FX_DrawPortableShield centity_t cent  ) 
 

Definition at line 379 of file cg_ents.c.

References atoi(), centity_t, centity_s::currentState, EF_NODRAW, entityState_s::eFlags, FX_AddOrientedLine(), centity_s::lerpOrigin, localEntity_t, entityState_s::otherEntityNum2, qhandle_t, TEAM_RED, entityState_s::time2, trap_Cvar_VariableStringBuffer(), trap_R_RegisterShader(), entityState_s::trickedentindex, vec3_t, VectorClear, and VectorCopy.

Referenced by CG_Special().

00380 {
00381         //rww - this code differs a bit from the draw code in EF, I don't know why I had to do
00382         //it this way yet it worked in EF the other way.
00383 
00384         int                             xaxis, height, posWidth, negWidth, team;
00385         vec3_t                  start, end, normal;
00386         localEntity_t   *le;
00387         qhandle_t               shader;
00388         char                    buf[1024];
00389 
00390         trap_Cvar_VariableStringBuffer("cl_paused", buf, sizeof(buf));
00391 
00392         if (atoi(buf))
00393         { //rww - fix to keep from rendering repeatedly while HUD menu is up
00394                 return;
00395         }
00396 
00397         if (cent->currentState.eFlags & EF_NODRAW)
00398         {
00399                 return;
00400         }
00401 
00402         // decode the data stored in time2
00403         xaxis = ((cent->currentState.time2 >> 24) & 1);
00404         height = ((cent->currentState.time2 >> 16) & 255);
00405         posWidth = ((cent->currentState.time2 >> 8) & 255);
00406         negWidth = (cent->currentState.time2 & 255);
00407 
00408         team = (cent->currentState.otherEntityNum2);
00409 
00410         VectorClear(normal);
00411 
00412         VectorCopy(cent->lerpOrigin, start);
00413         VectorCopy(cent->lerpOrigin, end);
00414 
00415         if (xaxis) // drawing along x-axis
00416         {
00417                 start[0] -= negWidth;
00418                 end[0] += posWidth;
00419         }
00420         else
00421         {
00422                 start[1] -= negWidth;
00423                 end[1] += posWidth;
00424         }
00425 
00426         normal[0] = 1;
00427         normal[1] = 1;
00428 
00429         start[2] += height/2;
00430         end[2] += height/2;
00431 
00432         if (team == TEAM_RED)
00433         {
00434                 if (cent->currentState.trickedentindex)
00435                 {
00436                         shader = trap_R_RegisterShader( "gfx/misc/red_dmgshield" );
00437                 }
00438                 else
00439                 {
00440                         shader = trap_R_RegisterShader( "gfx/misc/red_portashield" );
00441                 }
00442         }
00443         else
00444         {
00445                 if (cent->currentState.trickedentindex)
00446                 {
00447                         shader = trap_R_RegisterShader( "gfx/misc/blue_dmgshield" );
00448                 }
00449                 else
00450                 {
00451                         shader = trap_R_RegisterShader( "gfx/misc/blue_portashield" );
00452                 }
00453         }
00454 
00455         le = FX_AddOrientedLine(start, end, normal, 1.0f, height, 0.0f, 1.0f, 1.0f, 50.0, shader);
00456 }

void G2_BoltToGhoul2Model centity_t cent,
refEntity_t ent
 

Definition at line 571 of file cg_ents.c.

References entityState_s::angles, refEntity_t::axis, BOLT_AND, BOLT_SHIFT, centity_s::boltInfo, centity_t, cg, cg_entities, cgs, centity_s::currentState, ENTITY_AND, ENTITY_SHIFT, cgs_t::gameModels, centity_s::ghoul2, mdxaBone_t::matrix, MODEL_AND, MODEL_SHIFT, centity_s::modelScale, refEntity_t::origin, entityState_s::origin, cg_t::time, and trap_G2API_GetBoltMatrix().

00572 {
00573                 // extract the wraith ID from the bolt info
00574         int modelNum = cent->boltInfo >> MODEL_SHIFT;
00575         int boltNum     = cent->boltInfo >> BOLT_SHIFT;
00576         int     entNum = cent->boltInfo >> ENTITY_SHIFT;
00577         mdxaBone_t              boltMatrix;
00578         
00579         modelNum &= MODEL_AND;
00580         boltNum &= BOLT_AND;
00581         entNum &= ENTITY_AND;
00582 
00583 
00584         //NOTENOTE I put this here because the cgs.gamemodels array no longer gets initialized.
00585         assert(0);              
00586 
00587 
00588         // go away and get me the bolt position for this frame please
00589         trap_G2API_GetBoltMatrix(cent->ghoul2, modelNum, boltNum, &boltMatrix, cg_entities[entNum].currentState.angles, cg_entities[entNum].currentState.origin, cg.time, cgs.gameModels, cent->modelScale);
00590 
00591         // set up the axis and origin we need for the actual effect spawning
00592         ent->origin[0] = boltMatrix.matrix[0][3];
00593         ent->origin[1] = boltMatrix.matrix[1][3];
00594         ent->origin[2] = boltMatrix.matrix[2][3];
00595 
00596         ent->axis[0][0] = boltMatrix.matrix[0][0];
00597         ent->axis[0][1] = boltMatrix.matrix[1][0];
00598         ent->axis[0][2] = boltMatrix.matrix[2][0];
00599 
00600         ent->axis[1][0] = boltMatrix.matrix[0][1];
00601         ent->axis[1][1] = boltMatrix.matrix[1][1];
00602         ent->axis[1][2] = boltMatrix.matrix[2][1];
00603 
00604         ent->axis[2][0] = boltMatrix.matrix[0][2];
00605         ent->axis[2][1] = boltMatrix.matrix[1][2];
00606         ent->axis[2][2] = boltMatrix.matrix[2][2];
00607 }

void ScaleModelAxis refEntity_t ent  ) 
 

Definition at line 609 of file cg_ents.c.

References refEntity_t::axis, refEntity_t::modelScale, refEntity_t::nonNormalizedAxes, qtrue, and VectorScale.

Referenced by CG_AddFragment(), CG_Chunks(), CG_CreateDistortionTrailPart(), CG_CreateModelFromSpawnEnt(), CG_MiscEnt(), and CG_Player().

00611 {               // scale the model should we need to
00612                 if (ent->modelScale[0] && ent->modelScale[0] != 1.0f)
00613                 {
00614                         VectorScale( ent->axis[0], ent->modelScale[0] , ent->axis[0] );
00615                         ent->nonNormalizedAxes = qtrue;
00616                 }
00617                 if (ent->modelScale[1] && ent->modelScale[1] != 1.0f)
00618                 {
00619                         VectorScale( ent->axis[1], ent->modelScale[1] , ent->axis[1] );
00620                         ent->nonNormalizedAxes = qtrue;
00621                 }
00622                 if (ent->modelScale[2] && ent->modelScale[2] != 1.0f)
00623                 {
00624                         VectorScale( ent->axis[2], ent->modelScale[2] , ent->axis[2] );
00625                         ent->nonNormalizedAxes = qtrue;
00626                 }
00627 }


Variable Documentation

int CG_BMS_END = 2
 

Definition at line 2731 of file cg_ents.c.

int CG_BMS_MID = 1
 

Definition at line 2730 of file cg_ents.c.

Referenced by CG_PlayDoorLoopSound().

int CG_BMS_START = 0
 

Definition at line 2729 of file cg_ents.c.

int cgSiegeEntityRender
 

Definition at line 702 of file cg_ents.c.

char* forceHolocronModels[]
 

Initial value:

 {
        "models/map_objects/mp/lt_heal.md3",            
        "models/map_objects/mp/force_jump.md3",         
        "models/map_objects/mp/force_speed.md3",        
        "models/map_objects/mp/force_push.md3",         
        "models/map_objects/mp/force_pull.md3",         
        "models/map_objects/mp/lt_telepathy.md3",       
        "models/map_objects/mp/dk_grip.md3",            
        "models/map_objects/mp/dk_lightning.md3",       
        "models/map_objects/mp/dk_rage.md3",            
        "models/map_objects/mp/lt_protect.md3",         
        "models/map_objects/mp/lt_absorb.md3",          
        "models/map_objects/mp/lt_healother.md3",       
        "models/map_objects/mp/dk_powerother.md3",      
        "models/map_objects/mp/dk_drain.md3",           
        "models/map_objects/mp/force_sight.md3",        
        "models/map_objects/mp/saber_attack.md3",       
        "models/map_objects/mp/saber_defend.md3",       
        "models/map_objects/mp/saber_throw.md3"         
}

Definition at line 632 of file cg_ents.c.

Referenced by CG_Player().