void Wolfcam_AddViewWeapon (void) { vec3_t origin; const centity_t *cent; const entityState_t *es; if (!wolfcam_following) { return; } cent = &cg_entities[wcg.clientNum]; es = ¢->currentState; if (es->eFlags & EF_FIRING && es->weapon == WP_LIGHTNING) { if (1) { //FIXME check for draw gun // special hack for lightning gun... VectorCopy( cg.refdef.vieworg, origin ); VectorMA( origin, -8, cg.refdef.viewaxis[2], origin ); CG_LightningBolt( &cg_entities[es->number], origin ); } //CG_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->firingSound ); CG_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cg_weapons[es->weapon].firingSound ); } }
void Wolfcam_AddViewWeapon (void) { vec3_t origin; centity_t *cent; const entityState_t *es; refEntity_t hand; const clientInfo_t *ci; float fovOffset; vec3_t angles; const weaponInfo_t *weapon; float gunX; int fov; if (!wolfcam_following) { return; } cent = &cg_entities[wcg.clientNum]; es = ¢->currentState; if (!cg_drawGun.integer) { if (es->eFlags & EF_FIRING && es->weapon == WP_LIGHTNING) { // special hack for lightning gun... VectorCopy( cg.refdef.vieworg, origin ); VectorMA( origin, -8, cg.refdef.viewaxis[2], origin ); CG_LightningBolt( &cg_entities[es->number], origin ); //FIXME is this adding the sound twice? CG_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cg_weapons[es->weapon].firingSound ); } return; } // don't draw if testing a gun model if (cg.testGun) { return; } gunX = cg_gun_x.value; if (es->weapon == WP_GRAPPLING_HOOK) { gunX += 8.9; } fov = cg_fov.integer; //FIXME option // drop gun lower at higher fov if (fov > 90) { fovOffset = -0.2 * (fov - 90); } else { fovOffset = 0; } CG_RegisterWeapon(es->weapon); weapon = &cg_weapons[es->weapon]; memset(&hand, 0, sizeof(hand)); // set up gun position Wolfcam_CalculateWeaponPosition(hand.origin, angles); VectorMA( hand.origin, gunX, cg.refdef.viewaxis[0], hand.origin ); VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[1], hand.origin ); VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin ); AnglesToAxis( angles, hand.axis ); // map torso animations to weapon animations //cg_gun_frame.integer = 1; if ( cg_gun_frame.integer ) { // development tool hand.frame = hand.oldframe = cg_gun_frame.integer; hand.backlerp = 0; } else { //if (0) { // these are just for calling CG_PlayerAnimation() int legsOld; int legs; float legsBackLerp; int torsoOld; int torso; float torsoBackLerp; // get clientinfo for animation map ci = &cgs.clientinfo[ cent->currentState.clientNum ]; // animations weren't run for /follow'ed player CG_PlayerAnimation(cent, &legsOld, &legs, &legsBackLerp, &torsoOld, &torso, &torsoBackLerp); hand.frame = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.frame ); hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame ); hand.backlerp = cent->pe.torso.backlerp; } hand.hModel = weapon->handsModel; hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT; // add everything onto the hand Wolfcam_AddPlayerWeapon(&hand, cent, cgs.clientinfo[cent->currentState.clientNum].team); }