コード例 #1
0
void
dmz::EntityPluginFreeFly::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _hilHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _move.moveSpeed = config_to_float64 ("movement.speed", local, _move.moveSpeed);
   _move.turnRate = config_to_float64 ("movement.turn-rate", local, _move.turnRate);

   init_input_channels (
      local,
      InputEventButtonMask | InputEventAxisMask | InputEventChannelStateMask,
      &_log);

   _isectParameters.set_test_result_type (IsectClosestPoint);
   _isectParameters.set_calculate_normal (False);
   _isectParameters.set_calculate_object_handle (False);
   _isectParameters.set_calculate_distance (True);
   _isectParameters.set_calculate_cull_mode (False);
}
コード例 #2
0
void
dmz::EntityPluginPortalFollow3D::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _hilAttrHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   Boolean foundOffset (False);

   Config cameraParams;

   if (local.lookup_config ("offset", cameraParams)) {

      foundOffset = True;

      _offset = config_to_vector (cameraParams, _offset);
   }

   init_input_channels (local, InputEventChannelStateMask, &_log);

   _log.info << "Using " << (foundOffset ? "" : "default ") << "camera offset: "
      << _offset << endl;
}
コード例 #3
0
ファイル: dmzExPluginInput.cpp プロジェクト: Andais/dmz
void
dmz::ExPluginInput::_init (Config &local) {

   init_input_channels (
      local,
      InputEventAxisMask |
      InputEventButtonMask |
      InputEventKeyMask |
      InputEventChannelStateMask,
      &_log);
}
コード例 #4
0
ファイル: dmzInputPluginExit.cpp プロジェクト: Andais/dmz
void
dmz::InputPluginExit::_init (Config &local) {

   Config keys;

   if (local.lookup_all_config ("key", keys)) {

      ConfigIterator it;
      Config cd;

      Boolean found (keys.get_first_config (it, cd));

      while (found)  {

         const UInt32 Key (config_to_key_value ("value", cd, 0, &_log));

         if (Key) {

            UInt32 *keyPtr (new UInt32 (Key));

            if (keyPtr) {

               if (_keyTable.store (*keyPtr, keyPtr)) {

                  _log.info << "Setting exit key: "
                  << config_to_string ("value", cd) << endl;
               }
               else { delete keyPtr; keyPtr = 0; }
             }
          }

         found = keys.get_next_config (it, cd);
      }
   }
   else {

      UInt32 *keyPtr (new UInt32 (dmz::KeyEsc));

      if (keyPtr) {

         if (_keyTable.store (*keyPtr, keyPtr)) {

            _log.info << "Setting 'Esc' as default exit key" << endl;
         }
         else { delete keyPtr; keyPtr = 0; }
      }
   }

   init_input_channels (local, InputEventKeyMask, &_log);
}
コード例 #5
0
// ObjectPluginSelect Interface
void
dmz::ObjectPluginSelect::_init (Config &local) {

   _selectMsg = config_create_message (
      "select-message.name",
      local,
      "Object_Select_Message",
      get_plugin_runtime_context ());

   subscribe_to_message (_selectMsg);

   _convert.set_handle (
      config_to_string ("data-convert-handle.name", local, "handle"),
      get_plugin_runtime_context ());

   _key = config_to_key_value ("add-to-selection-key.name", local, KeyShift, &_log);

   init_input_channels (local, InputEventKeyMask, &_log);
}
コード例 #6
0
void
dmz::EntityPluginGroundSimple::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   defs.lookup_state (DefaultStateNameDead, _deadState);
   defs.lookup_state (DefaultStateNameAirBorn, _airBornState);

   _defaultHandle = activate_default_object_attribute (ObjectStateMask);

   _hilHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _throttleHandle = activate_object_attribute (
      ObjectAttributeScalarThrottleName,
      ObjectScalarMask);

   _move.maxSpeed = config_to_float64 ("movement.speed", local, _move.maxSpeed);
   _move.maxAccel = config_to_float64 ("movement.acceleration", local, _move.maxAccel);
   _move.maxDecel = config_to_float64 ("movement.deceleration", local, _move.maxDecel);
   _move.turnRate = config_to_float64 ("movement.turn", local, _move.turnRate);
   _move.brakeRate = config_to_float64 ("movement.brake", local, _move.brakeRate);
   _move.whiskerLength = config_to_float64 ("whisker.length", local, _move.whiskerLength);
   _move.whiskerHeight = config_to_float64 ("whisker.height", local, _move.whiskerHeight);

   init_input_channels (
      local,
      InputEventButtonMask | InputEventAxisMask | InputEventChannelStateMask,
      &_log);

   _isectParameters.set_test_result_type (IsectAllPoints);
   _isectParameters.set_calculate_normal (True);
   _isectParameters.set_calculate_object_handle (True);
   _isectParameters.set_calculate_distance (False);
   _isectParameters.set_calculate_cull_mode (True);
}
コード例 #7
0
void
dmz::WeaponPluginFixedLauncher::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   Definitions defs (context, &_log);

   _defaultHandle = activate_default_object_attribute (
      ObjectStateMask);

   _hilAttrHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _deadState = config_to_state (
      "state.dead.value",
      local,
      DefaultStateNameDead,
      context);

   _delay = config_to_float64 ("delay.value", local, _delay);
   _launcherOffset = config_to_vector ("offset", local);
   const Vector HPR = config_to_vector ("rotation", local);

   _launcherRotation.roll_in_place (HPR.get_z ());
   _launcherRotation.pitch_in_place (HPR.get_x ());
   _launcherRotation.yaw_in_place (HPR.get_y ());

   _launchButton = config_to_uint32 ("button.value", local, _launchButton);

   init_input_channels (
      local,
      InputEventButtonMask | InputEventChannelStateMask,
      &_log);

}