示例#1
0
bool WaitLongOperation::operator()(RLMachine& machine) {
  bool done = ctrl_pressed_ || machine.system().fastForward();

  if (!done && wait_until_target_time_) {
    done = machine.system().event().getTicks() > target_time_;
  }

  if (!done && break_on_event_) {
    done = event_function_();
  }

  GraphicsSystem& graphics = machine.system().graphics();
  if (mouse_moved_) {
    graphics.markScreenAsDirty(GUT_MOUSE_MOTION);
    mouse_moved_ = false;
  } else if (graphics.objectStateDirty()) {
    graphics.markScreenAsDirty(GUT_DISPLAY_OBJ);
  }

  if (break_on_clicks_) {
    if (button_pressed_) {
      done = true;
      machine.setStoreRegister(button_pressed_);
    } else if (done) {
      // TODO(erg): this is fishy. shouldn't we record when clicked?
      if (save_click_location_)
        recordMouseCursorPosition();
      machine.setStoreRegister(0);
    }
  }

  return done;
}
示例#2
0
bool SelectLongOperation::operator()(RLMachine& machine) {
  if (return_value_ != -1) {
    machine.setStoreRegister(return_value_);
    return true;
  } else {
    return false;
  }
}