void W_FireSpikes( float ox ) { vec3_t dir, tmp; // gedict_t* old; makevectors( self->s.v.v_angle ); if ( self->s.v.ammo_nails >= 2 && self->s.v.weapon == IT_SUPER_NAILGUN ) { W_FireSuperSpikes(); return; } if ( self->s.v.ammo_nails < 1 ) { self->s.v.weapon = W_BestWeapon(); W_SetCurrentAmmo(); return; } sound( self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM ); self->attack_finished = g_globalvars.time + 0.2; if ( deathmatch != 4 ) self->s.v.currentammo = self->s.v.ammo_nails = self->s.v.ammo_nails - 1; aim( dir ); // dir = aim (self, 1000); VectorScale( g_globalvars.v_right, ox, tmp ); VectorAdd( tmp, self->s.v.origin, tmp ); tmp[2] += 16; launch_spike( tmp, dir ); g_globalvars.msg_entity = EDICT_TO_PROG( self ); trap_WriteByte( MSG_ONE, SVC_SMALLKICK ); }
// Nailgun void CBasePlayer::W_FireSpikes(int iQuadSound) { // If we're wielding the Super nailgun and we've got ammo for it, fire Super nails if(*m_pCurrentAmmo >= 2 && m_iQuakeWeapon == IT_SUPER_NAILGUN) { W_FireSuperSpikes(iQuadSound); return; } // Swap to next best weapon if this one just ran out if(*m_pCurrentAmmo < 1) { m_iQuakeWeapon = W_BestWeapon(); W_SetCurrentAmmo(); return; } PLAYBACK_EVENT_FULL(FEV_NOTHOST, edict(), m_usSpike, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, iQuadSound, 0, m_iNailOffset > 0.0 ? 1 : 0, 0); // Fire left then right if(m_iNailOffset == 2) m_iNailOffset = -2; else m_iNailOffset = 2; if(gpGlobals->deathmatch != 4) *m_pCurrentAmmo -= 1; m_flNextAttack = UTIL_WeaponTimeBase() + 0.1; // Fire the nail UTIL_MakeVectors(pev->v_angle); Vector vecDir = GetAutoaimVector(AUTOAIM_5DEGREES); CQuakeNail *pNail = CQuakeNail::CreateNail(pev->origin + Vector(0, 0, 10) + (gpGlobals->v_right * m_iNailOffset), vecDir, this); }