bool SpeedDialThumbnail::StartDragging(INT32 x, INT32 y) { if (m_drag_object != NULL) return true; OpAutoPtr<DesktopDragObject> drag_object(GetContent()->GetButton()->GetDragObject(DRAG_TYPE_SPEEDDIAL, x, y)); if (drag_object.get() != NULL && GetContent()->HandleDragStart(*drag_object)) { m_drag_object = drag_object.release(); return true; } return false; }
void CStateManagerBloodsucker::execute () { u32 state_id = u32(-1); const CEntityAlive* enemy = object->EnemyMan.get_enemy(); if ( !object->is_drag_anim_jump() && !object->is_animated() ) { if ( enemy ) { if ( check_state(eStateCustom_Vampire) ) { state_id = eStateCustom_Vampire; } else { switch ( object->EnemyMan.get_danger_type() ) { case eStrong: state_id = eStatePanic; break; case eWeak: state_id = eStateAttack; break; } } } else if ( object->HitMemory.is_hit() ) { state_id = eStateHitted; } else if ( object->hear_interesting_sound ) { state_id = eStateHearInterestingSound; } else { if ( can_eat() ) state_id = eStateEat; else state_id = eStateRest; } /////////////////////////////////////////////////////////////////////////////// // Additional /////////////////////////////////////////////////////////////////////////////// // check if start interesting sound state // if ( (prev_substate != eStateHearInterestingSound) && (state_id == eStateHearInterestingSound) ) // { // object->start_invisible_predator(); // } // else // // check if stop interesting sound state // if ( (prev_substate == eStateHearInterestingSound) && (state_id != eStateHearInterestingSound) ) // { // object->stop_invisible_predator(); // } select_state(state_id); // выполнить текущее состояние get_state_current()->execute(); prev_substate = current_substate; } else { state_id = eStateCustom; if ( object->is_drag_anim_jump() ) { select_state(state_id); // выполнить текущее состояние get_state_current()->execute(); prev_substate = current_substate; drag_object(); } } }