void CWeaponTranquilizer::ToggleZoom( void ) { if ( m_bInZoom ) UnZoom(); else Zoom(); }
void UlzrakInterceptor::inflict_damage(SpaceObject* other) { STACKTRACE; if (this->damage_factor<0.0001) return; if (other->isShot() || other->isLine()) { return; } if (other->isPlanet()) { UnZoom(); } if (other->mass > 0.0001 && this->specialStopZoomOnCollision) { UnZoom(); } Ship::inflict_damage(other); if (other->isShip() || other->isAsteroid() || other->isPlanet()) this->damage_factor = 0.0; if (TRUE) { if (this->specialZeroBaseVelocityOnCollision) { this->normalVel = Vector2(0,0); } if (this->specialReverseZoomDirectionOnCollision) { zoomReversed = !zoomReversed; } if (this->specialReverseFacingOnCollision) { this->angle += PI; } this->translate(unit_vector(this->angle) * this->specialSkipForwardDistanceOnCollision); if (other->mass <= 0) return; if (other->isShip()) game->add(new FixedAnimation(this, other, data->spriteSpecialExplosion, 0, 10, 100, DEPTH_EXPLOSIONS) ); else game->add(new Animation(this, pos, data->spriteSpecialExplosion, 0, 10, 100, DEPTH_EXPLOSIONS) ); } }
bool CWeaponTranquilizer::Holster( CBaseCombatWeapon *pSwitchingTo) { UnZoom(); #ifndef CLIENT_DLL if ( m_hLaserDot != NULL ) { m_hLaserDot->TurnOff(); UTIL_Remove( m_hLaserDot ); m_hLaserDot = NULL; } #endif return BaseClass::Holster( pSwitchingTo ); }
bool CWeaponTranquilizer::Deploy( void ) { UnZoom(); // Petit bordel pour conserver le m_flNextPrimaryAttack // Cette connerie de Deploy le modifie... const float tmpNextattack = m_flNextPrimaryAttack; const bool reployRet = BaseClass::Deploy(); m_flNextPrimaryAttack = tmpNextattack; CreateLaserPointer(); // Ca semble pas marcher. On se fait pas chier on recalcule (hyper compliqué) m_flNextPrimaryAttack = gpGlobals->curtime + 0.15f; return reployRet; }
void UlzrakInterceptor::calculate() { STACKTRACE; double fracDone; if ((!zoomActive) && (!zoomSequenceInitiated)) spriteShift = 0; if (zoomActive) { mass = this->specialZoomMass; if (zoomReversed) this->zoomVel = (-1) * unit_vector(this->angle) * this->specialZoomSpeedAddition; else this->zoomVel = unit_vector(this->angle) * this->specialZoomSpeedAddition; if (this->specialZoomSpeedIsAdditive) set_vel ( this->normalVel + this->zoomVel ); else set_vel ( this->zoomVel ); this->damage_factor = this->specialCollisionDamage; this->zoomCounter += frame_time; this->DrawZoomLines(); spriteShift = 3; if (zoomCounter>=this->specialZoomTime) { UnZoom(); } } else if (zoomCounter >= this->specialActivationTime) { play_sound2((this->data->sampleSpecial[1])); this->zoomActive = true; this->zoomReversed = false; this->zoomSequenceInitiated = false; this->zoomCounter = 0; //storing away the normal Velocity this->normalVel = this->vel; this->zoomVel = unit_vector(this->angle) * this->specialZoomSpeedAddition; this->inflictDamageCounter = 0; } else if (zoomSequenceInitiated) { zoomCounter += frame_time; fracDone = (double)zoomCounter / (double)this->specialActivationTime; spriteShift = (int)((fracDone * 3.0) + 0.5); } sprite_index_override = get_index(this->angle) + 64 * spriteShift; sprite_index = sprite_index_override; Ship::calculate(); sprite_index = sprite_index_override; }