void VAutoDialog::OnNotifyTelescopeStop (wxCommandEvent& ev) { bool accidentalStop = false; wxLogDebug (wxT("VAutoDialog::OnNotifyTelescopeStop telescope notification arrived.")); TelescopeNotifier::TelescopeStopAction stopAction = (TelescopeNotifier::TelescopeStopAction) ev.GetInt (); switch (stopAction) { case TelescopeNotifier::STOP_NORMALLY: break; case TelescopeNotifier::STOP_DISCONNECT: accidentalStop = true; wxMessageBox (_("The telescope is disconnected. Check cables and power."), _("Moving telescope"), wxICON_EXCLAMATION | wxOK, this); break; case TelescopeNotifier::STOP_TIMEOUT: accidentalStop = true; wxMessageBox (_("The telescope is not stopped before timeout expired."), _("Moving telescope"), wxICON_EXCLAMATION | wxOK, this); break; case TelescopeNotifier::STOP_ABORT: accidentalStop = true; wxMessageBox (_("The telescope stopped by the user."), _("Moving telescope"), wxICON_EXCLAMATION | wxOK, this); break; case TelescopeNotifier::DISPLAY_COORD: SetStatusCoords (ev.GetString ()); break; } if (!m_Auto) { SetState (STATE_READY); DoDisableControls (false); m_ShootButton->SetFocus (); } // in auto mode, start to make exposition else { if (accidentalStop) { m_Auto = false; SetState (STATE_READY); DoDisableControls (false); m_ShootButton->SetFocus (); } else if (!DoShoot ()) { m_Auto = false; SetState (STATE_READY); DoDisableControls (false); m_ShootButton->SetFocus (); } } }
bool DoKeepDistanceAndShoot( Mob* mob, Player* player, uint32_t delta ) { DoLogicAngleAdd( mob, mob->angle_to_player ); float dist = mob->player_distance; cml::vector3f mob2player = mob->transform.position - player->transform.position; if( dist < 6 ) DoMove( mob, mob2player , -4 ); if( dist > 7 ) DoMove( mob, mob2player , 4 ); DoMove( mob, mob2player , 4 ); bool shoot = mob->player_distance < SHOOT_DISTANCE; return DoShoot( &(mob->wep), shoot, delta ); }
void VAutoDialog::OnShoot(wxCommandEvent& ev) { DoShoot (); }