void CEntHost::CreateHands( int index, int parent ) { Assert( IsPlayer() ); Assert( index >= 1 && index < MAX_VIEWMODELS ); if ( !IsPlayer() ) return; if ( !GetPlayer()->GetViewModel( parent ) ) return; if ( !GetHandsModel( index ) ) return; CBaseViewModel *hands = GetPlayer()->GetViewModel( index ); CBaseViewModel *vm = GetPlayer()->GetViewModel( parent ); // Ya existe, actualizamos el modelo if ( hands ) { hands->SetModel( GetHandsModel( index ) ); return; } hands = (CBaseViewModel *)CreateEntityByName( "predicted_viewmodel" ); if ( hands ) { hands->SetAbsOrigin( GetAbsOrigin() ); hands->SetOwner( GetPlayer() ); hands->SetIndex( index ); DispatchSpawn( hands ); hands->SetModel( GetHandsModel( index ) ); hands->SetOwnerViewModel( vm ); hands->SetOwnerEntity( GetPlayer() ); hands->AddEffects( EF_NODRAW ); GetPlayer()->m_hViewModel.Set( index, hands ); } }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CWeaponBrickbat::DrawAmmo( void ) { CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); // ------------------------------------------- // Make sure I have ammo of the current type // ------------------------------------------- int counter = 0; while (m_nAmmoCount[m_iCurrentAmmoType] <=0) { m_iCurrentAmmoType = ((++m_iCurrentAmmoType)%NUM_BRICKBAT_AMMO_TYPES); counter++; // ---------------------------------------------------- // No ammo of any types so drop the weapon and destroy // ---------------------------------------------------- if (counter >= NUM_BRICKBAT_AMMO_TYPES) { pOwner->Weapon_Drop( this, NULL, NULL ); UTIL_Remove(this); return; } } SetModel( BrickBatAmmoArray[m_iCurrentAmmoType].m_sViewModel); CBaseViewModel *vm = pOwner->GetViewModel(); if ( vm ) { vm->SetModel( BrickBatAmmoArray[m_iCurrentAmmoType].m_sViewModel ); } //Msg("Drawing %s...\n",BrickBatAmmoArray[m_iCurrentAmmoType].m_sClassName); m_bNeedDraw = false; SendWeaponAnim(ACT_VM_DRAW); // Don't fire again until fire animation has completed float flSequenceEndTime = gpGlobals->curtime + SequenceDuration(); pOwner->m_flNextAttack = m_flNextPrimaryAttack = m_flNextSecondaryAttack = flSequenceEndTime; }