121class EventArgDef :
public Class
127 qboolean minRangeDefault[3];
129 qboolean maxRangeDefault[3];
140 void Setup(
const char *eventName,
const char *argName,
const char *argType,
const char *argRange);
141 void PrintArgument(FILE *event_file = NULL);
142 void PrintRange(FILE *event_file = NULL);
144 const char *getName(
void);
145 qboolean isOptional(
void);
147 float GetMinRange(
int index)
150 return minRange[index];
155 qboolean GetMinRangeDefault(
int index)
158 return minRangeDefault[index];
163 float GetMaxRange(
int index)
166 return maxRange[index];
171 qboolean GetMaxRangeDefault(
int index)
174 return maxRangeDefault[index];
245class Event :
public Class
249 short unsigned int eventnum;
250 short unsigned int dataSize;
251 short unsigned int maxDataSize;
263 CLASS_PROTOTYPE(Event);
273 static void LoadEvents(
void);
277 static int NumEventCommands();
279 static void ListCommands(
const char *mask = NULL);
280 static void ListDocumentation(
const char *mask, qboolean print_to_file = qfalse);
281 static void PendingEvents(
const char *mask = NULL);
283 static int GetEvent(
str name, uchar type = EV_NORMAL);
284 static int GetEventWithFlags(
str name,
int flags, uchar type = EV_NORMAL);
286 static command_t *GetEventInfo(
int eventnum);
287 static int GetEventFlags(
int eventnum);
288 static const char *GetEventName(
int index);
290 static int compareEvents(
const void *arg1,
const void *arg2);
293 virtual void ErrorInternal(
Listener *l,
str text)
const;
295 static bool Exists(
const char *command);
296 static unsigned int FindEventNum(
const char *s);
297 static unsigned int FindNormalEventNum(const_str s);
298 static unsigned int FindNormalEventNum(
str s);
299 static unsigned int FindReturnEventNum(const_str s);
300 static unsigned int FindReturnEventNum(
str s);
301 static unsigned int FindSetterEventNum(const_str s);
302 static unsigned int FindSetterEventNum(
str s);
303 static unsigned int FindGetterEventNum(const_str s);
304 static unsigned int FindGetterEventNum(
str s);
306 bool operator==(Event ev) {
return eventnum == ev.eventnum; }
308 bool operator!=(Event ev) {
return eventnum != ev.eventnum; }
311 void *
operator new(
size_t size);
312 void operator delete(
void *ptr);
316 Event(
const Event& ev);
317 Event(
const Event& ev,
int numArgs);
320 Event(
int index,
int numArgs);
321 Event(
const char *command);
322 Event(
const char *command,
int numArgs);
329 const char *argument_names,
330 const char *documentation,
331 byte type = EV_NORMAL
334 Event& operator=(
const Event& ev);
335 Event& operator=(Event&& ev);
339#if defined(ARCHIVE_SUPPORTED)
340 void Archive(
Archiver& arc)
override;
344 eventInfo_t *getInfo();
349 const char *getName()
const;
352 void AddEntity(
Entity *ent);
353 void AddFloat(
float number);
354 void AddInteger(
int number);
355 void AddListener(
Listener *listener);
357 void AddConstString(const_str
string);
358 void AddString(
str string);
359 void AddToken(
str token);
360 void AddTokens(
int argc,
const char **argv);
362 void AddVector(
const Vector& vector);
367 void CheckPos(
int pos)
const;
369 bool GetBoolean(
int pos)
const;
371 const_str GetConstString(
int pos)
const;
373 Entity *GetEntity(
int pos)
const;
375 float GetFloat(
int pos)
const;
376 int GetInteger(
int pos)
const;
377 Listener *GetListener(
int pos)
const;
379 class PathNode *GetPathNode(
int pos)
const;
381#ifdef WITH_SCRIPT_ENGINE
385 str GetString(
int pos)
const;
386 str GetToken(
int pos)
const;
389 Vector GetVector(
int pos)
const;
391 class Waypoint *GetWaypoint(
int pos)
const;
393 qboolean IsEntityAt(
int pos)
const;
394 qboolean IsListenerAt(
int pos)
const;
395 qboolean IsNilAt(
int pos)
const;
396 qboolean IsNumericAt(
int pos)
const;
397#ifdef WITH_SCRIPT_ENGINE
398 qboolean IsSimpleEntityAt(
int pos)
const;
400 qboolean IsStringAt(
int pos)
const;
401 qboolean IsVectorAt(
int pos)
const;
403 qboolean IsFromScript(
void)
const;
449class Listener :
public Class
452#ifdef WITH_SCRIPT_ENGINE
456 ScriptVariableList *vars;
459 static bool EventSystemStarted;
460 static bool ProcessingEvents;
463#ifdef WITH_SCRIPT_ENGINE
473 CLASS_PROTOTYPE(Listener);
475#ifdef WITH_SCRIPT_ENGINE
479 virtual void StoppedNotify(
void);
480 virtual void StartedWaitFor(
void);
481 virtual void StoppedWaitFor(const_str name,
bool bDeleting);
484 virtual Listener *GetScriptOwner(
void);
485 virtual void SetScriptOwner(Listener *newOwner);
490 void Archive(
Archiver& arc)
override;
492 void CancelEventsOfType(
Event *ev);
493 void CancelEventsOfType(
Event& ev);
494 void CancelFlaggedEvents(
int flags);
495 void CancelPendingEvents(
void);
497 qboolean EventPending(
Event& ev);
499 void PostEvent(
Event *ev,
float delay,
int flags = 0);
500 void PostEvent(
const Event& ev,
float delay,
int flags = 0);
502 qboolean PostponeAllEvents(
float time);
503 qboolean PostponeEvent(
Event& ev,
float time);
505 bool ProcessEvent(
const Event& ev);
506 bool ProcessEvent(
Event *ev);
507 bool ProcessEvent(
Event& ev);
512 qboolean ProcessPendingEvents(
void);
514 bool ProcessScriptEvent(
Event& ev);
515 bool ProcessScriptEvent(
Event *ev);
517#ifdef WITH_SCRIPT_ENGINE
519 void CreateVars(
void);
520 void ClearVars(
void);
521 ScriptVariableList *Vars(
void);
523 bool BroadcastEvent(
Event& event, ConList *listeners);
524 bool BroadcastEvent(
str name,
Event& event);
525 bool BroadcastEvent(const_str name,
Event& event);
526 void CancelWaiting(
str name);
527 void CancelWaiting(const_str name);
528 void CancelWaitingAll(
void);
529 void CancelWaitingSources(const_str name, ConList& listeners, ConList& stoppedListeners);
531 void ExecuteThread(
str scriptName,
str label,
Event *params = NULL);
532 void ExecuteThread(
str scriptName,
str label,
Event& params);
534 void EndOn(
str name, Listener *listener);
535 void EndOn(const_str name, Listener *listener);
536 void Notify(
const char *name);
537 void Register(
str name, Listener *listener);
538 void Register(const_str name, Listener *listener);
539 void RegisterSource(const_str name, Listener *listener);
540 void RegisterTarget(const_str name, Listener *listener);
541 void Unregister(
str name);
542 void Unregister(const_str name);
543 void Unregister(
str name, Listener *listener);
544 void Unregister(const_str name, Listener *listener);
545 void UnregisterAll(
void);
546 bool UnregisterSource(const_str name, Listener *listener);
547 bool UnregisterTarget(const_str name, Listener *listener);
548 void UnregisterTargets(
549 const_str name, ConList& listeners, ConList& stoppedListeners,
Container<const_str>& stoppedNames
551 void AbortRegistration(const_str name, Listener *l);
553 int RegisterSize(const_str name)
const;
554 int RegisterSize(
str name)
const;
555 int WaitingSize(const_str name)
const;
556 int WaitingSize(
str name)
const;
558 bool WaitTillDisabled(
str s);
559 bool WaitTillDisabled(const_str s);
562 int GetFlags(
Event *event)
const;
563 qboolean ValidEvent(
str name)
const;
568 void CommandDelay(
Event *ev);
569 void Remove(
Event *ev);
570 void ScriptRemove(
Event *ev);
571 void EventInheritsFrom(
Event *ev);
572 void EventIsInheritedBy(
Event *ev);
573 void GetClassname(
Event *ev);
575#ifdef WITH_SCRIPT_ENGINE
576 void CancelFor(
Event *ev);
577 void CreateReturnThread(
Event *ev);
578 void CreateThread(
Event *ev);
579 void ExecuteReturnScript(
Event *ev);
580 void ExecuteScript(
Event *ev);
581 void EventDelayThrow(
Event *ev);
582 void EventEndOn(
Event *ev);
583 void EventGetOwner(
Event *ev);
584 void EventNotify(
Event *ev);
585 void EventThrow(
Event *ev);
586 void EventUnregister(
Event *ev);
587 void WaitCreateReturnThread(
Event *ev);
588 void WaitCreateThread(
Event *ev);
589 void WaitExecuteReturnScript(
Event *ev);
590 void WaitExecuteScript(
Event *ev);
591 void WaitTill(
Event *ev);
592 void WaitTillTimeout(
Event *ev);
593 void WaitTillAny(
Event *ev);
594 void WaitTillAnyTimeout(
Event *ev);