Exemplo n.º 1
0
void
dmz::RenderPluginEventOSG::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   _defaultHandle = _defs.create_named_handle (EventAttributeDefaultName);

   EventTypeSet set = config_to_event_type_set ("event-list", local, context);

   if (set.get_count () == 0) {

      EventType root = _defs.get_root_event_type ();
      activate_event_callback (root, EventCloseMask);
   }
   else {

      RuntimeIterator it;
      EventType type;

      while (set.get_next (it, type)) {

         activate_event_callback (type, EventCloseMask);
      }
   }
}
Exemplo n.º 2
0
void
dmz::EntityPluginDamage::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _targetHandle = defs.create_named_handle (EventAttributeTargetName);

   const String StateNames = config_to_string ("state.name", local, DefaultStateNameDead);

   defs.lookup_state (StateNames, _deadState);

   _defaultObjectHandle = activate_default_object_attribute (ObjectDestroyMask);

   _hilHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _detonationType = activate_event_callback (EventDetonationName, EventCloseMask);
}
Exemplo n.º 3
0
void
dmz::AudioPluginEventSimple::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultEventHandle = defs.create_named_handle (EventAttributeDefaultName);

   Config eventList;

   if (local.lookup_all_config ("event-type", eventList)) {

      ConfigIterator it;
      Config event;

      while (eventList.get_next_config (it, event)) {

         const String EventTypeName = config_to_string ("name", event);
         const String FileName = _rc.find_file (config_to_string ("resource", event));

         if (FileName && EventTypeName) {

            EventStruct *es = new EventStruct (FileName);

            if (es) {

               es->event = activate_event_callback (EventTypeName, EventCloseMask);

               if (es->event) {

                  const Handle EventHandle (es->event.get_handle ());

                  if (!_eventTable.store (EventHandle, es)) {

                     delete es; es = 0;
                     es = _eventTable.lookup (EventHandle);

                     _log.error << "Unable to bind sound: " << FileName << " to event: "
                        << EventTypeName << " because file: "
                        << (es ? es->File : "<Unknown File>")
                        << " has already been bound to the event type" << endl;
                  }
               }
               else {

                  delete es; es = 0;

                  _log.error << "Unknown event type: " << EventTypeName << endl;
               }
            }
         }

         if (!FileName) {

            _log.error << "No audio file specified for event type: "
               << (EventTypeName ? EventTypeName : "<Unknown Type>") << endl;
         }

         if (!EventTypeName) {

            _log.error << "No event type specified for audio file: "
               << (FileName ? FileName : "<Unknown File>") << endl;
         }
      }
   }
}