MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CG_AddViewWeapon

Function CG_AddViewWeapon

code/cgame/cg_weapons.cpp:971–1368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

969extern float CG_ForceSpeedFOV( void );
970
971void CG_AddViewWeapon( playerState_t *ps )
972{
973 refEntity_t hand;
974 refEntity_t flash;
975 vec3_t angles;
976 const weaponInfo_t *weapon;
977 weaponData_t *wData;
978 centity_t *cent;
979 float fovOffset, leanOffset;
980
981 // no gun if in third person view
982 if ( cg.renderingThirdPerson )
983 return;
984
985 if ( ps->pm_type == PM_INTERMISSION )
986 return;
987
988 cent = &cg_entities[ps->clientNum];
989
990 if ( ps->eFlags & EF_LOCKED_TO_WEAPON )
991 {
992 return;
993 }
994
995 if ( cent->gent && cent->gent->client && cent->gent->client->ps.forcePowersActive&(1<<FP_LIGHTNING) )
996 {//doing the electrocuting
997 vec3_t temp;//tAng, fxDir,
998 //VectorSet( tAng, cent->pe.torso.pitchAngle, cent->pe.torso.yawAngle, 0 );
999
1000 VectorCopy( cent->gent->client->renderInfo.handLPoint, temp );
1001 VectorMA( temp, -5, cg.refdef.viewaxis[0], temp );
1002 if ( cent->gent->client->ps.forcePowerLevel[FP_LIGHTNING] > FORCE_LEVEL_2 )
1003 {//arc
1004 //vec3_t fxAxis[3];
1005 //AnglesToAxis( tAng, fxAxis );
1006 theFxScheduler.PlayEffect( cgs.effects.forceLightningWide, temp, cg.refdef.viewaxis );
1007 }
1008 else
1009 {//line
1010 //AngleVectors( tAng, fxDir, NULL, NULL );
1011 theFxScheduler.PlayEffect( cgs.effects.forceLightning, temp, cg.refdef.viewaxis[0] );
1012 }
1013 }
1014
1015 if ( cent->gent && cent->gent->client && cent->gent->client->ps.forcePowersActive&(1<<FP_DRAIN) )
1016 {//doing the draining
1017 vec3_t temp;//tAng, fxDir,
1018 //VectorSet( tAng, cent->pe.torso.pitchAngle, cent->pe.torso.yawAngle, 0 );
1019
1020 VectorCopy( cent->gent->client->renderInfo.handLPoint, temp );
1021 VectorMA( temp, -5, cg.refdef.viewaxis[0], temp );
1022 if ( cent->gent->client->ps.forcePowerLevel[FP_DRAIN] > FORCE_LEVEL_2 )
1023 {//arc
1024 //vec3_t fxAxis[3];
1025 //AnglesToAxis( tAng, fxAxis );
1026 theFxScheduler.PlayEffect( cgs.effects.forceDrainWide, temp, cg.refdef.viewaxis );
1027 }
1028 else

Callers 1

CG_DrawActiveFrameFunction · 0.70

Calls 15

VectorCopyFunction · 0.85
AnglesToAxisFunction · 0.85
VectorScaleFunction · 0.85
Q_flrandFunction · 0.85
CG_RegisterWeaponFunction · 0.70
CG_DoMuzzleFlashFunction · 0.70
CG_ForceSpeedFOVFunction · 0.70
cgi_S_AddLoopingSoundFunction · 0.70
CG_MapTorsoToWeaponFrameFunction · 0.70
CG_PositionEntityOnTagFunction · 0.70
CG_GetTagWorldPositionFunction · 0.70

Tested by

no test coverage detected