bool AscentApMfd::ConsumeKeyBuffered (DWORD key) { switch (key) { case OAPI_KEY_L: return OnLaunch(); case OAPI_KEY_D: return OnDisengage(); case OAPI_KEY_E: return OnEngage(); case OAPI_KEY_COMMA: DecPage(); return true; case OAPI_KEY_PERIOD: IncPage(); return true; case OAPI_KEY_SEMICOLON: InitDecAzimuth(); return true; case OAPI_KEY_APOSTROPHE: InitIncAzimuth(); return true; case OAPI_KEY_MINUS: InitDecAltitude(); return true; case OAPI_KEY_EQUALS: InitIncAltitude(); return true; } return false; }
int AscentAPDlgTabControl::OnCommand (WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDC_LAUNCH: return OnLaunch(); } return TabPage::OnCommand (wParam, lParam); }
//-------------------------------------------- void CC4Projectile::Launch(const Vec3 &pos, const Vec3 &dir, const Vec3 &velocity, float speedScale) { CProjectile::Launch(pos, dir, velocity, speedScale); if(!gEnv->bMultiplayer) { //don't want the hud grenade indicator on c4 in multiplayer OnLaunch(); } if(m_pAmmoParams->armTime > 0.f) { GetEntity()->SetTimer(ePTIMER_ACTIVATION, (int)(m_pAmmoParams->armTime*1000.f)); Arm(false); } else { Arm(true); } //Set up armed/disarmed materials and set material based on initial armed state if(SC4ExplosiveParams* pExplosiveParams = m_pAmmoParams->pC4ExplosiveParams) { if(int count = GetEntity()->GetSlotCount()) { for(int i = 0; i < count; i++) { SEntitySlotInfo info; GetEntity()->GetSlotInfo(i, info); if(info.pStatObj) { IMaterial* pMaterial = info.pStatObj->GetMaterial(); if(pMaterial) { m_pStatObj = info.pStatObj; m_pStatObj->AddRef(); IMaterialManager* pMatManager = gEnv->p3DEngine->GetMaterialManager(); if( m_pArmedMaterial = pMatManager->LoadMaterial(pExplosiveParams->armedMaterial, false) ) { m_pArmedMaterial->AddRef(); } if( m_pDisarmedMaterial = pMatManager->LoadMaterial(pExplosiveParams->disarmedMaterial, false) ) { m_pDisarmedMaterial->AddRef(); } info.pStatObj->SetMaterial(m_armed ? m_pArmedMaterial : m_pDisarmedMaterial); break; } } } } } }
void PhysicsObject::Launch(int angleSuppression, int speedOverride) { m_airborne = true; // Call any overridden OnLaunch code OnLaunch(); // The spatial launch angle m_spatialKin.SetAngleBySuppression(angleSuppression); // The scalar launch speed int speed = (speedOverride >= 0)? speedOverride : ComputeSpeedForDistance(); // Derive the velocity from the speed and angle m_spatialKin.SetVelocityFromScalar(speed); // Compute the on-screen angle of travel m_screenKin.angle = ComputeScreenAngle(); /* This is hard to explain: Image this as the velocity of the object's shadow along the ground. The x and y values are the components of the spatial horizontal velocities. */ m_additiveScreenVelocity = XY ( m_spatialKin.velocity.x * cos(m_screenKin.angle), m_spatialKin.velocity.x * sin((m_pos.y > m_endPos.y) ? (m_screenKin.angle*-1) : m_screenKin.angle) ); // Determine the on-screen velocities // X is mapped directly as it is on screen m_screenKin.velocity.x = m_additiveScreenVelocity.x; /* * Y is what you'd expect: * The y component of the horiztonal spatial velocity, * plus a fraction of the spatial vertical velocity */ m_screenKin.velocity.y = m_additiveScreenVelocity.y + (m_spatialKin.velocity.y * -3/4); }