DI-Guy SDK Documentation  13.5
diguyCharacter.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2020 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 /*********************************************************************
7  **
8  *t diguyCharacter
9  **
10  *b Link against: libdiguy
11  */
12 
13 #ifndef __diguyCharacter_H
14 #define __diguyCharacter_H
15 
16 #ifdef SWIG
17 %module diguyCharacter
18 #else
19 #define CPLUSPLUS_ONLY
20 #endif
21 
22 #ifdef CPLUSPLUS_ONLY
23 #include <declspec_diguy.h>
24 #include <diguy_constants.h>
25 #include <diguy_typedefs.h>
26 #include <diguy_vector_classes.h>
29 #include <diguyCharacterTypeMap.h>
30 #include <diguyMotionDirection.h>
31 #include <diguyMotionPosture.h>
32 #include <diguyMotionVariant.h>
33 
34 class bdiScenarioCharacter;
35 class diguyAgentParams;
37 class diguyCharacter;
41 class diguyCharacterPath;
46 class diguyCrowd;
47 class diguyGraphicsLink;
50 class diguyImpact;
52 class diguyPathShape;
53 class diguyScenario;
54 class diguySoundInstance;
55 class diguyVariable;
57 class diguyView;
58 class diguyViewLabel;
59 class diguyWaypoint;
60 
62 
64 
65 class DtEntityStateRepository;
66 
67 #endif
68 
69 
82 class BDI_DECLSPEC_diguy diguyCharacter
83 {
84 
85 public:
86 
87 /*****************************************************************************/
97  /*l
98  *b Description:
99  **
100  ** Returns the name of the object. This pointer will never be NULL.
101  */
102  const char* get_name();
103 
104  /*l
105  *b Description:
106  **
107  ** This function sets the name of this object.
108  **
109  *b Returns:
110  **
111  ** 0 on success, -1 on failure
112  */
113  int set_name(const char* name);
114 
115  /*l
116  *b Description:
117  **
118  ** Returns the type name of the object, should be 'character'. This pointer will never be
119  ** NULL.
120  */
121  const char* get_type_name();
122 
123  /*l
124  *b Description:
125  **
126  ** All characters are assigned a unique identifier, or uid. This
127  ** function returns this character's uid.
128  **
129  ** *Note*: unique identifiers will change between DI-Guy runs!
130  **
131  */
132  long get_uid();
133 
134  /*l
135  *b Description:
136  **
137  ** Returns the index of the object. This index may change if
138  ** characters are created or destroyed, so it should not be considered
139  ** a unique identifier for the character. See get_uid().
140  */
141  int get_index();
142 
143  /*l
144  *b Description:
145  **
146  ** This function updates the character. The character's position and
147  ** pose will be set to be what it will be (or was) at the specified t.
148  **
149  ** If the scenario has control of t (return value of
150  ** get_t_controlled_by_scenario_t() is 0), then this function's
151  ** effects will be overridden the next time diguyScenario::update() is
152  ** called with a new t.
153  **
154  ** Note: diguyScenario::update() must be called as or more frequently
155  ** than diguyCharacter::update() for proper DI-Guy operation.
156  ** diguyCharacter::update() is intended for load management use, where
157  ** the user intends to update far away or out-of-frustum characters
158  ** less frequently than the overall scenario. This is done in con-
159  ** junction with set_t_controlled_by_scenario_t(0) for the character.
160  ** diguyCharacter::update() is not intended as a replacement for
161  ** diguyScenario::update().
162  **
163  *b Returns:
164  **
165  ** 0 on success, -1 on failure
166  **
167  *b Arguments:
168  **
169  *a t - new time for the character
170  *a full_update - set to 1 to cause full update of character
171  */
172  int update(float t, int full_update = 1);
173 
174  /*l
175  *b Description:
176  **
177  ** This function sets the current type of this character.
178  **
179  *b Arguments:
180  **
181  *a type - name of the new desired type
182  **
183  *b See Also:
184  **
185  ** get_character_type_string()
186  */
187  void set_character_type(const char* type);
188 
189  /*l
190  *b Description:
191  **
192  ** Returns the type of the character (never NULL).
193  **
194  ** Character types specify the types of motions the character will be
195  ** able to perform. Some characters can move like soldiers, others
196  ** can move like civilians, still others can move like specific
197  ** animals.
198  **
199  ** The character type is explicitly specified in the call to
200  ** diguyScenario::create_character().
201  **
202  ** Examples of character types are:
203  *>
204  *- - soldier
205  *- - male_pedestrian
206  *- - horse
207  *- - prop
208  *<
209  */
210  const char* get_character_type_string();
211 
212  /*l
213  *b Description:
214  **
215  ** Returns the class of the character (never NULL).
216  **
217  ** Character classes are a higher level description than character
218  ** types, and allow for more generalized logic. For example, instead
219  ** of having something happen when one of a large set of specific
220  ** character types enters a region, something can happen when any
221  ** human enters the region.
222  **
223  ** Character classes are not specified directly, but are instead
224  ** derived from the character type. (In DI-Guy, all soldiers are
225  ** humans, for example.)
226  **
227  ** Examples of character classes are:
228  *>
229  *- - human
230  *- - vehicle
231  *- - object
232  *- - animal
233  *<
234  */
235  const char* get_character_class();
236 
238  diguyCharacterClass get_character_class_type();
239 
240  /*l
241  *b Description:
242  **
243  ** Returns the scenario that this character is a part of.
244  */
245  diguyScenario* get_scenario();
246 
247  /*l
248  *b Description:
249  **
250  ** This is the top-level on/off switch for the character. A character
251  ** that is not enabled has very little processing overhead: it is
252  ** neither updated during an update() call, nor is it drawn during a
253  ** draw() call. A disabled character will remain disabled until
254  ** set_enabled(1) is called on it; nothing else implicitly re-enables
255  ** the character.
256  **
257  ** There are several other diguyCharacter functions that have somewhat
258  ** similar effects that may be more appropriate at times:
259  **
260  *- - set_current_tin() and set_current_tout(): These functions
261  *- show and animate the character starting at time tin ("T In"),
262  *- and ending at time tout ("T Out")
263  *- - set_invisible_flag(): This function disables drawing of
264  *- the character, but the character still updates and changes
265  *- position.
266  **
267  ** Refer to the documentation of these functions for more information.
268  **
269  *b Returns:
270  **
271  ** always return 0
272  */
273  int set_enabled(int enabled);
274 
275  /*l
276  *b Description:
277  **
278  ** Returns whether the character is enabled, as set by the
279  ** set_enabled() call. New characters are enabled by default.
280  **
281  *b Returns:
282  **
283  ** 1 if the character is enabled, 0 if not
284  */
285  int get_enabled();
286 
287  /*l
288  *b Description:
289  **
290  ** Sets whether this character is drawn automatically by the scenario.
291  **
292  ** Note depending on the rendering environment if this flag is set to 0,
293  ** it is up to the user to call the character draw_pass1() and draw_pass2()
294  ** calls at the appropriate time.
295  **
296  *b Arguments:
297  **
298  *a flag - pass 1 for character drawing to automatically be
299  *a handled by scenario (this is the default);
300  *a 0 for it not to be
301  **
302  *b Returns:
303  **
304  ** 0 on success, -1 on failure
305  */
306  int set_drawn_by_scenario_flag(int flag);
307 
308  /*l
309  *b Description:
310  **
311  ** Returns whether character drawing is done automatically by the
312  ** scenario.
313  **
314  *b Returns:
315  **
316  ** 1 if character drawing is done by the scenario;
317  ** 0 if not
318  **
319  *b See Also:
320  **
321  ** set_drawn_by_scenario_flag()
322  */
323  int get_drawn_by_scenario_flag();
324 
325  /*l
326  *b Description:
327  **
328  ** This function makes the character invisible; i.e., draw() calls
329  ** for the character will have no effect. Note that the character
330  ** will still update its position and pose during update() calls. To
331  ** more thoroughly disable a character, consider the functions
332  ** set_enabled() and set_current_tout().
333  **
334  *b Arguments:
335  **
336  *a invisible_flag - pass 1 to make character invisible, 0 to
337  *a make it visible
338  **
339  *b Available as Decision Bead/Event
340  */
341  void set_invisible_flag(int invisible_flag);
342 
344  int get_invisible_flag();
345 
346  /*l
347  *b Description:
348  **
349  ** Returns whether the character is active. A character is
350  ** active if:
351  **
352  *- - it is enabled as per the set_enabled() call
353  *- - it is within its tin/tout interval as set by the
354  *- set_current_tin() and set_current_tout() calls
355  *- - it is not "network paused" (get_is_network_paused()
356  *- returns 0)
357  **
358  *b Returns:
359  **
360  ** 1 if the character is active, 0 if not
361  **
362  *b Available as Decision Bead
363  */
364  int get_is_active();
365 
366  /*l
367  *b Description:
368  **
369  ** Returns whether the character will be drawn during scenario and
370  ** character draw() calls. A character will be drawn if:
371  **
372  *- - it is enabled as per the set_enabled() call
373  *- - it is within its tin/tout interval as set by the
374  *- set_current_tin() and set_current_tout() calls
375  *- - its invisible flag is 0, as set by the
376  *- set_invisible_flag() call
377  **
378  ** There is no corresponding set_is_drawn() function; use
379  ** set_invisible_flag() to explicitly make a character not be drawn.
380  **
381  *b Returns:
382  **
383  ** 1 if the character will be drawn, 0 if not
384  */
385  int get_is_drawn();
386 
390  int get_was_drawn_last_frame();
391 
393  int set_was_drawn_last_frame(int drawn);
394 
396  int get_is_culled();
397 
403  int set_is_culled(int culled);
404 
405  /*l
406  *b Returns:
407  **
408  ** 1 if the character is temporary (created by diguyScenario::create_temporary_character()
409  ** call; 0 if not
410  */
411  int get_is_temporary();
412 
413  /*l
414  *b Description:
415  **
416  ** This function returns 1 if the character has been recycled from the
417  ** character recycle bin, 0 if not.
418  **
419  ** See diguyScenario::send_character_to_recycle_bin()
420  ** and diguyScenario::retrieve_character_from_recycle_bin().
421  */
422  int get_is_recycled();
423 
424  /*l
425  *b Description:
426  **
427  ** This function sets how the character's t (time) is controlled. If
428  ** 1, the character's t will be set by the scenario on each call to
429  ** diguyScenario::update(). If 0, the character should be updated by
430  ** calls to update().
431  **
432  *b Arguments:
433  **
434  *a t_controlled_by_scenario_t - 1 for controlled by scenario, 0 for
435  *a manual update
436  **
437  *b Returns:
438  **
439  ** 0 on success, -1 on failure
440  */
441  int set_t_controlled_by_scenario_t(int t_controlled_by_scenario_t);
442 
443  /*l
444  *b Returns:
445  **
446  ** whether character's t is controlled by the scenario;
447  ** see set_t_controlled_by_scenario_t()
448  */
449  int get_t_controlled_by_scenario_t();
450 
451  /*l
452  *b Description:
453  **
454  ** This function sets the initial tin ("T In") time of the character.
455  ** See set_current_tin() for a discussion of how tin and tout times
456  ** affect the character.
457  **
458  ** When the scenario is reset or loaded from a .dss file, the current
459  ** tin value will be set to this initial tin value.
460  **
461  ** Note that if the scenario is running (diguyScenario::get_t() returns > 0),
462  ** tin can be set only if override_time_warning is set.
463  **
464  ** Note that both tin and tout times are scenario-relative times, not
465  ** character-relative.
466  **
467  ** This call makes an implicit call to set_current_tin() with the
468  ** same value.
469  **
470  *b Arguments:
471  **
472  *a tin - new value of initial tin in seconds
473  *a override_time_warning - if set, initial_tin can be set at any time
474  **
475  *b Returns:
476  **
477  ** 0 on success, -1 on failure
478  */
479  int set_initial_tin(float tin, int override_time_warning = 0);
480 
481  /*l
482  *b Description:
483  **
484  ** This function sets the initial tout ("T Out") time of the
485  ** character. See set_current_tin() for a discussion of how tin and
486  ** tout times affect the character.
487  **
488  ** When the scenario is reset or loaded from a .dss file, the current
489  ** tout value will be set to this initial tout value.
490  **
491  ** Note that this function cannot be called once the scenario has
492  ** begun running (diguyScenario::get_t() returns > 0).
493  **
494  ** Note that both tin and tout times are scenario-relative times, not
495  ** character-relative.
496  **
497  ** This call makes an implicit call to set_current_tout() with the
498  ** same value.
499  **
500  *b Arguments:
501  **
502  *a tout - new value of initial tout in seconds
503  **
504  *b Returns:
505  **
506  ** 0 on success, -1 on failure
507  */
508  int set_initial_tout(float tout);
509 
510  /*l
511  *b Description:
512  **
513  ** This function sets the current tin ("T In") time of the character.
514  ** The character will not be visible nor will it start moving or
515  ** animating until the scenario reaches this time.
516  **
517  ** There are two ways the tin and tout times of the character can be
518  ** used:
519  **
520  ** The first is to set them to their desired values when the scenario
521  ** begins. If, for example, it is known that this character should
522  ** only be visible and active from 60 seconds to 80 seconds, the tin
523  ** and tout times can be set to 60 and 80, respectively. The
524  ** scenario will then spend very little time for character updates
525  ** and draws outside of these limits.
526  **
527  ** The second is to use them to quickly "trigger" a character to
528  ** become visible and start moving. This is done by setting the
529  ** initial values of tin and tout to very high values, and then
530  ** changing them to lower values when the character should become
531  ** active. Consider the following example: This character is
532  ** waiting just inside a doorway, and should emerge when another
533  ** character comes close. If the tin time of the character is very
534  ** high, very little time will be taken for this character's updates
535  ** and draws. When the other character does come close, this
536  ** character's tin time can be set to "now" (the scenario's current
537  ** t, as returned by diguyScenario::get_t()). This character will
538  ** then become visible and start moving out of the doorway.
539  **
540  ** The default current tin time is the current time of the scenario
541  ** when the character is created.
542  **
543  ** Note that both tin and tout times are scenario-relative times, not
544  ** character-relative.
545  **
546  *b Arguments:
547  **
548  *a tin - new value of current tin in seconds
549  **
550  *b Returns:
551  **
552  ** 0 on success, -1 on failure
553  */
554  int set_current_tin(float tin);
555 
556  /*l
557  *b Description:
558  **
559  ** Same as set_current_tin(), but time is set to current scenario time.
560  **
561  *b Returns:
562  **
563  ** 0 on success, -1 on failure
564  **
565  *b Available as Decision Bead/Event
566  */
567  int set_current_tin_to_now();
568 
569  /*l
570  *b Description:
571  **
572  ** This function returns the current tin time of the character. See
573  ** set_current_tin().
574  **
575  *b Returns:
576  **
577  ** Current tin time in seconds.
578  */
579  float get_current_tin();
580 
581  /*l
582  *b Description:
583  **
584  ** This function sets the current tout ("T Out") time of the
585  ** character. If tout is enabled the character will become invisible
586  ** and will stop moving and animating when the scenario reaches this
587  ** time.
588  **
589  ** Note that both tin and tout times are scenario-relative times, not
590  ** character-relative.
591  **
592  ** Default tout time is 60000 seconds.
593  **
594  *b Arguments:
595  **
596  *a tout - new value of current tout in seconds
597  *a disable_character_at_tout - this argument is present to keep
598  *a the function prototype will remain
599  *a backward compatible; it has no effect
600  */
601  int set_current_tout(float tout,
602  int disable_character_at_tout = 0);
603 
604  /*l
605  *b Description:
606  **
607  ** Same as set_current_tout(), but time is set to current scenario
608  ** time.
609  **
610  *b Returns:
611  **
612  ** 0 on success, -1 on failure
613  **
614  *b Available as Decision Bead
615  */
616  int set_current_tout_to_now();
617 
618  /*l
619  *b Description:
620  **
621  ** This function returns the current tout ("T Out") time of the
622  ** character in seconds. See set_current_tout().
623  */
624  float get_current_tout();
625 
626  /*l
627  *b Description:
628  **
629  ** This function sets what will happen when the character reaches its
630  ** tout time. If set to 0, the character will ignore the tout time
631  ** and continue indefinitely.
632  */
633  void set_tout_enabled(int tout_enabled);
634 
635  /*l
636  *b Description:
637  **
638  ** This function returns the whether tout is enabled.
639  **
640  ** See set_tout_enabled().
641  **
642  *b Returns:
643  **
644  ** 1 if tout enabled, 0 if not
645  */
646  int get_tout_enabled();
647 
649  float get_char_time();
650 
651  /*l
652  *b Description:
653  **
654  ** When the motion data of a character is interpolated a quick
655  ** interpolation method can be used which may yield incorrect results,
656  ** or an expensive interpolation method can be used which will yield
657  ** correct results at the expense of time. The threshold at which
658  ** the interpolation method changes is specified by this function.
659  **
660  *b Arguments:
661  **
662  *a threshold - float between 0 (careful never) and 1 (careful always);
663  ** default is 0.7
664  **
665  ** DI-Guy compares the careful interpolation threshold to the cosine
666  ** of an angle. Both the threshold and the cosine are dimensionless
667  ** and thus have no units.
668  **
669  *b Returns:
670  **
671  ** 0 on success, -1 on failure
672  */
673  int set_careful_interpolation_threshold(float threshold);
674 
675  /*l
676  *b Returns:
677  **
678  ** most recent setting of the careful interpolation threshold;
679  ** see set_careful_interpolation_threshold()
680  */
681  float get_careful_interpolation_threshold();
682 
683  /*l
684  *b Description:
685  **
686  ** Sets whether the motion data of the character is interpolated.
687  ** Interpolation is disabled by default for better performance. For
688  ** applications achieving high frame rates, smoother motion may be
689  ** achieved by turning interpolation on.
690  **
691  *b Arguments:
692  **
693  *a flag - 0 by default
694  **
695  *b Returns:
696  **
697  ** 0 on success, -1 on failure
698  */
699  int set_motion_interpolation_flag(int flag);
700 
701  /*l
702  *b Returns:
703  **
704  ** most recent setting of the motion interpolation flag; see
705  ** set_motion_interpolation_flag()
706  */
707  int get_motion_interpolation_flag();
708 
709  /*l
710  *b Description:
711  **
712  ** Sets the scale of the character on each of the three major axes.
713  **
714  *b Arguments:
715  **
716  *a scale_x, scale_y, scale_z - the factor by which to scale along
717  *a the given axis
718  **
719  *b Returns:
720  **
721  ** 0 on success, -1 on failure
722  */
723  int set_scale(float scale_x, float scale_y, float scale_z);
724 
725  /*l
726  *b Description:
727  **
728  ** Returns the scale of the character.
729  **
730  *b Arguments:
731  **
732  *a sx, sy, sz - scale of the character along each axis
733  **
734  ** Pass NULL for any values that are not needed.
735  **
736  *b Returns:
737  **
738  ** 0 on success, -1 on failure
739  */
740  int get_scale(float* scale_x, float* scale_y, float* scale_z);
741 
742  /*l
743  *b Description:
744  **
745  ** Sets the parent of this character to be the passed character.
746  ** This means that the coordinate system of this character will be
747  ** local to the parent character rather than the world coordinate
748  ** system.
749  **
750  *b Arguments:
751  **
752  *a parent_name - character to which this character should
753  *a be attached; pass NULL to have no parent
754  *a and be attached to the world
755  *a parent_link_name - name of the link or connection point to which this character's
756  *a position link should attach; pass "" to attach
757  *a to the parent's position link
758  **
759  *b Returns:
760  **
761  ** 0 on success, -1 on failure
762  **
763  *b Available as Decision Bead/Event
764  */
765  int set_parent(const char* parent_name, const char* parent_link_name = "");
766 
767  /*l
768  *b Description:
769  **
770  ** Gets the parent of this character.
771  **
772  *b Returns:
773  **
774  ** pointer to type diguyCharacter; NULL if no parent
775  **
776  *b Available as Decision Bead/Event
777  */
778  diguyCharacter* get_parent();
779 
780  /*l
781  *b Description:
782  **
783  ** Gets the link name that the character is parented to, if any.
784  **
785  *b Returns:
786  **
787  ** name of link, NULL if no parent
788  */
789  const char* get_parent_link_name();
790 
791  /*l
792  *b Description:
793  **
794  ** Detaches a character from its parent and reattaches it to the
795  ** world. This is equivalent to diguyCharacter::set_parent(NULL).
796  **
797  *b Returns:
798  **
799  ** 0 on success, -1 on failure
800  **
801  *b Available as Decision Bead/Event
802  */
803  int unset_parent();
804 
805  /*l
806  *b Description:
807  **
808  ** Gets the number of children the character has.
809  */
810  int get_num_children();
811 
812  /*l
813  *b Description:
814  **
815  ** This function returns a pointer to the nth child of the character.
816  **
817  *b Returns:
818  **
819  ** pointer of type diguyCharacter; NULL if no
820  ** child at the specified index
821  **
822  *b Arguments:
823  **
824  *a index - index of the child; indices start at 0
825  */
826  diguyCharacter* get_child_at_index(int index);
827 
828  /*l
829  *b Description:
830  **
831  ** Gets if a character is a static object, by default any blitzed .
832  ** in props are.
833  **
834  *b Returns:
835  **
836  ** 1 if true, 0 if false
837  */
838  int get_is_scene_object();
839 
840  /*l
841  *b Description:
842  **
843  ** Sets if a character is a static object. By default any blitzed
844  ** in props are.
845  **
846  *b Arguments:
847  **
848  *a is_scene_object - pass 1 to make the object a scene object,
849  *a 0 to not
850  **
851  *b Returns:
852  **
853  ** 0 on success, -1 on failure
854  */
855  int set_is_scene_object(int is_scene_object);
856 
857  /*l
858  *b Description:
859  **
860  ** Gets the bounding radius currently used for this character
861  ** for purposes of culling it from the draw operation.
862  **
863  *b Returns:
864  **
865  ** The current draw-culling bounding radius for the character, in
866  ** meters.
867  */
868  float get_bounding_radius();
869 
870  /*l
871  *b Description:
872  **
873  ** Gets the default draw-culling bounding radius for this
874  ** character, as specified in its actor cfg file. See
875  ** actor_vehicle.cfg for an example.
876  **
877  *b Returns:
878  **
879  ** The default draw-culling bounding radius for the character.
880  */
881  float get_default_bounding_radius();
882 
883  /*l
884  *b Description:
885  **
886  ** Sets the current draw-culling bounding radius to be used for
887  ** this character.
888  */
889  void set_bounding_radius(float f);
890 
891  /*l
892  *b Description:
893  **
894  ** This function returns the number of seconds before the blend
895  ** into the next motion begins. If the character is already
896  ** in a blend between motions the function returns 0.
897  **
898  ** Note that this function is of limited practical use; in most
899  ** cases get_time_to_reach_desired_action() returns
900  ** information that is more useful.
901  **
902  *b Returns:
903  **
904  ** time to next blend, in seconds
905  **
906  *b Mode Restrictions:
907  **
908  *- - This function can only be called in free action mode.
909  */
910  float get_time_to_transition();
911 
913  float get_character_local_time();
914 
915  /*l
916  *b Returns:
917  **
918  ** the action mode of the character
919  */
920  diguyCharacterMode get_action_mode();
921 
922  /*l
923  *b Returns:
924  **
925  ** the position mode of the character
926  */
927  diguyCharacterMode get_position_mode();
928 
929  /*l
930  *b Description:
931  **
932  ** This function speeds up or slows down the character. Setting
933  ** this value greater than 1 will cause character actions to
934  ** be played back at a slower pace, setting to less that 1 will
935  ** cause character actions to be played at a faster pace.
936  **
937  ** This will override other factors that may scale the time
938  ** scale factor of a character. (For example, smaller scale
939  ** characters will generally move faster.)
940  **
941  ** Call unset_t_scale_factor() to allow other factors such
942  ** as scale or desired speed to determine the time scale factor.
943  **
944  *b Mode Restrictions:
945  **
946  *- - This function can only be called in free action mode.
947  **
948  *b Arguments:
949  **
950  *a t_scale_factor - time scale factor
951  **
952  *b Returns:
953  **
954  ** 0 on success, -1 on failure
955  */
956  int set_t_scale_factor(float t_scale_factor);
957 
958  /*l
959  *b Description:
960  **
961  ** This function removes the manual setting of the time
962  ** scale factor as set by set_t_scale_factor().
963  **
964  *b Mode Restrictions:
965  **
966  *- - This function can only be called in free action mode.
967  **
968  *b Returns:
969  **
970  ** 0 on success, -1 on failure
971  */
972  int unset_t_scale_factor();
973 
974  /*l
975  *b Description:
976  **
977  ** This function determines whether this character is within the
978  ** specified distance of another.
979  **
980  *b Arguments:
981  **
982  *a character - character to be checked
983  *a distance - distance to character in meters
984  **
985  *b Returns:
986  **
987  ** 1 if within distance; 0 if not
988  */
989  int is_within_distance_n_of_character(const char* character_name,
990  float distance);
991 
992  /*l
993  *b Description:
994  **
995  ** This function determines whether this character is within the
996  ** specified distance of any members of the specified group.
997  **
998  *b Arguments:
999  **
1000  *a group_name - name of group to be checked
1001  *a distance - distance in meters
1002  **
1003  *b Returns:
1004  **
1005  ** 1 if member of group is within distance; 0 if not
1006  */
1007  int is_within_distance_n_of_member_of_group(const char* group_name,
1008  float distance);
1009 
1010  /*l
1011  *b Description:
1012  **
1013  ** This function determines whether a character is a member of
1014  ** a particular group.
1015  **
1016  ** Also see diguyCharacterGroup::is_member().
1017  **
1018  *b Arguments:
1019  **
1020  *a group_name - name of group to be checked
1021  **
1022  *b Returns:
1023  **
1024  ** 1 if character is in group, 0 if not
1025  */
1026  int is_group_member(const char* group_name);
1027 
1028  /*l
1029  *b Description:
1030  **
1031  ** This function returns the number of groups that a character is a
1032  ** member of.
1033  **
1034  ** Also see diguyCharacterGroup::is_member().
1035  */
1036  int get_num_group_memberships();
1037 
1038  /*l
1039  *b Description:
1040  **
1041  ** This function returns a pointer to the nth group that this
1042  ** character is a member of.
1043  **
1044  ** Also see diguyCharacterGroup::is_member().
1045  **
1046  *b Returns:
1047  **
1048  ** pointer of type diguyCharacterGroup; NULL if no
1049  ** group at the specified index
1050  **
1051  *b Arguments:
1052  **
1053  *a index - index of the group; indices start at 0
1054  */
1055  diguyCharacterGroup* get_group_membership_at_index(int index);
1056 
1057  /*l
1058  *b Description:
1059  **
1060  ** This function will check all characters in the scenario and return
1061  ** the nearest character that is both alive and enabled. An optional
1062  ** argument specifies whether to skip characters that are invisible
1063  ** to the caller because a scene object is in the way. Checking
1064  ** visibility is only an option if an octtree is generated from scene
1065  ** objects. Typically only DI-Guy Scenario does this.
1066  **
1067  *b Arguments:
1068  **
1069  *a check_visibility - whether to check that characters are
1070  *a visible to calling character; pass 1
1071  *a to check, 0 to not check
1072  *a xy_distance - whether to include the z component
1073  *a in distance calculations; pass 1 to
1074  *a check only XY distance, 0 to check
1075  *a XYZ distance
1076  **
1077  *b Returns:
1078  **
1079  ** pointer of type diguyCharacter; may be NULL
1080  */
1081  diguyCharacter* get_nearest_active_character(int check_visibility,
1082  int xy_distance = 0,
1083  float max_distance_to_check = 100000);
1084 
1085  /*l
1086  *b Description:
1087  **
1088  ** This function will check all characters in a group and return the
1089  ** nearest character that is both alive and enabled. An optional
1090  ** argument specifies whether to skip characters that are invisible
1091  ** to the caller because a scene object is in the way. Checking
1092  ** visibility is only an option if an octtree is generated from scene
1093  ** objects. Typically only DI-Guy Scenario does this.
1094  **
1095  *b Arguments:
1096  **
1097  *a group_name - name of group to check
1098  *a check_visibility - whether to check that characters are
1099  *a visible to calling character; pass 1
1100  *a to check, 0 to not check
1101  *a xy_distance - whether to include the z component
1102  *a in distance calculations; pass 1 to
1103  *a check only XY distance, 0 to check
1104  *a XYZ distance
1105  **
1106  *b Returns:
1107  **
1108  ** pointer of type diguyCharacter; may be NULL
1109  */
1110  diguyCharacter* get_nearest_active_character_in_group(const char* group_name,
1111  int check_visibility = 1,
1112  int xy_distance = 0,
1113  float max_distance_to_check = 100000);
1114 
1115  /*l
1116  *b Description:
1117  **
1118  ** This function will check all characters in the scenario and return
1119  ** a random character within max_distance that is both alive and
1120  ** enabled. An optional argument specifies whether to skip characters
1121  ** that are invisible to the caller because a scene object is in the
1122  ** way. Checking visibility is only an option if an octtree is
1123  ** generated from scene objects. Typically only DI-Guy Scenario does
1124  ** this.
1125  **
1126  *b Arguments:
1127  **
1128  *a check_visibility - whether to check that characters are
1129  *a visible to calling character; pass 1
1130  *a to check, 0 to not check
1131  *a max_distance - how far away the search cut off should be pass
1132  *a in -1.0f to use all characters
1133  *a xy_distance - whether to include the z component
1134  *a in distance calculations; pass 1 to
1135  *a check only XY distance, 0 to check
1136  *a XYZ distance
1137  **
1138  *b Returns:
1139  **
1140  ** pointer of type diguyCharacter; may be NULL
1141  */
1142  diguyCharacter* get_random_active_character(float max_distance = 10.0f,
1143  int check_visibility = 1,
1144  int xy_distance = 0);
1145 
1146  /*l
1147  *b Description:
1148  **
1149  ** This function will check all characters in a group and return a
1150  ** random character within max_distance that is both alive and
1151  ** enabled. An optional argument specifies whether to skip characters
1152  ** that are invisible to the caller because a scene object is in the
1153  ** way. Checking visibility is only an option if an octtree is
1154  ** generated from scene objects. Typically only DI-Guy Scenario does
1155  ** this.
1156  **
1157  *b Arguments:
1158  **
1159  *a group_name - name of group to check
1160  *a max_distance - how far away the search cut off should be, pass
1161  *a in -1.0f to use all characters
1162  *a check_visibility - whether to check that characters are
1163  *a visible to calling character; pass 1
1164  *a to check, 0 to not check
1165  *a xy_distance - whether to include the z component
1166  *a in distance calculations; pass 1 to
1167  *a check only XY distance, 0 to check
1168  *a XYZ distance
1169  **
1170  *b Returns:
1171  **
1172  ** pointer of type diguyCharacter; may be NULL
1173  */
1174  diguyCharacter* get_random_active_character_in_group(const char* group_name,
1175  float max_distance = 10,
1176  int check_visibility = 1,
1177  int xy_distance = 0);
1178 
1179  /*l
1180  *b Description:
1181  **
1182  ** This function returns the 3D distance from this character to the
1183  ** specified character, in meters. The distance is calculated from
1184  ** the characters' idealized positions.
1185  */
1186  float get_distance_to_character(diguyCharacter* character);
1187 
1188  /*l
1189  *b Description:
1190  **
1191  ** This function returns the 2D distance in X and Y coordinates only
1192  ** from this character to the specified character, in meters. The
1193  ** distance is calculated from the characters' idealized positions.
1194  */
1195  float get_distance_xy_to_character(diguyCharacter* character);
1196 
1197  /*l
1198  *b Description:
1199  **
1200  ** This function returns the 3D distance from this character to the
1201  ** specified impact, in meters. The distance is calculated from the
1202  ** characters' idealized positions.
1203  */
1204  float get_distance_to_impact(diguyImpact* impact);
1205 
1206  /*l
1207  *b Description:
1208  **
1209  ** Each character has a "random factor" between 0 and 1. This value
1210  ** is persistent with the character; i.e., the random factor will
1211  ** stay constant for the entire lifetime of the character.
1212  **
1213  ** This random factor can be used to add some variability between
1214  ** different characters.
1215  **
1216  ** Though each character has a random factor that has a very good
1217  ** chance of being different from all other characters' in the
1218  ** scenario, this is not guaranteed and so should not be used as a
1219  ** unique identifier.
1220  **
1221  ** An example of use: Instead of all characters beginning an action
1222  ** or behavior at the same time, have each one begin (random_factor *
1223  ** 2.0) seconds from the current time. This will result in more
1224  ** natural looking behavior as characters one by one begin the new
1225  ** behavior in the next two seconds, rather than all beginning at
1226  ** once.
1227  **
1228  *b Returns:
1229  **
1230  ** the character's random factor, a value between 0 and 1
1231  */
1232  float get_random_factor();
1233 
1234 
1235 /*****************************************************************************/
1240  /*l
1241  *b Description:
1242  **
1243  ** This function draws this character in immediate mode graphics
1244  ** environments (see below). This is the equivalent of calling
1245  ** draw_pass1() immediately followed by draw_pass2().
1246  **
1247  *b Returns:
1248  **
1249  ** 0 on success, -1 on failure
1250  **
1251  *i OpenGL Version:
1252  **
1253  ** This function immediately draws this character. Either this
1254  ** function or draw_pass1() and draw_pass2() should be called once per
1255  ** frame.
1256  */
1257  int draw();
1258 
1259  /*l
1260  *b Description:
1261  **
1262  ** This function, along with draw_pass2(), allows the drawing of
1263  ** opaque and transparent polygons to be separated. This function
1264  ** draws all opaque polygons of this character.
1265  **
1266  *b Returns:
1267  **
1268  ** 0 on success, -1 on failure
1269  **
1270  *i OpenGL Version:
1271  **
1272  ** This function immediately draws the opaque character parts. Either
1273  ** this function or draw() should be called once per frame.
1274  */
1275  int draw_pass1();
1276 
1277  /*l
1278  *b Description:
1279  **
1280  ** Same as draw_pass1(), but draws transparent character parts.
1281  */
1282  int draw_pass2();
1283 
1284 #ifdef CPLUSPLUS_ONLY
1285 
1286  /*l
1287  *b Returns:
1288  **
1289  ** A pointer to the character's graphics.
1290  **
1291  *i Vega Prime Version:
1292  **
1293  ** The return pointer may be cast to point to a vpDiguyCharacter,
1294  ** which is derived from vpObject.
1295  **
1296  *i OpenGL Version:
1297  **
1298  ** This function returns NULL.
1299  **
1300  *i DI-Guy Graphics API:
1301  **
1302  ** This function returns the pointer set from the most recent
1303  ** set_graphics_ptr() call.
1304  */
1305  void* get_graphics_ptr();
1306 
1307  /*l
1308  *b Description:
1309  **
1310  ** Sets a graphics environment-specific pointer to graphics data.
1311  ** The pointer can be retrieved using get_graphics_ptr().
1312  **
1313  *b Arguments:
1314  **
1315  *a graphics_ptr - pointer to graphics data
1316  **
1317  *b Returns:
1318  **
1319  ** 0 on success, -1 on failure
1320  **
1321  *i OpenGL Version:
1322  **
1323  *b This function should not be called for these environments.
1324  **
1325  *i DI-Guy Graphics API Version:
1326  **
1327  ** This function allows graphics environment-specific data to be
1328  ** stored for later retrieval by get_graphics_ptr(). DI-Guy does
1329  ** not directly use the pointer, beyond returning it using the
1330  ** get_graphics_ptr() function.
1331  */
1332  int set_graphics_ptr(void* graphics_ptr);
1333 
1334  /*l
1335  *b Description:
1336  **
1337  ** This function sets a generic node pointer that can later be
1338  ** retrieved by the get_graphics_api_node_ptr() call. The pointer is
1339  ** otherwise not used.
1340  **
1341  *i Callback Info:
1342  **
1343  ** This function can be safely be called in the
1344  ** CALLBACK_ID_SET_GRAPHICS_API_NODE_PTR callback.
1345  **
1346  *b Arguments:
1347  **
1348  *a node_ptr - generic void* pointer
1349  */
1350  void set_graphics_api_node_ptr(void* node_ptr);
1351 
1352  /*l
1353  *b Returns:
1354  **
1355  ** pointer set by most recent call to set_graphics_api_node_ptr
1356  */
1357  void* get_graphics_api_node_ptr();
1358 
1359  /*l
1360  *b Description:
1361  **
1362  ** This function stores a pointer to user data.
1363  **
1364  *b Arguments:
1365  **
1366  *a user_data - pointer for user's own use; DI-Guy will
1367  *a do nothing to the contents of this pointer
1368  *a beyond passing it back when requested
1369  *a by get_user_data()
1370  **
1371  *b Returns:
1372  **
1373  ** 0 on success, -1 on failure
1374  */
1375  int set_user_data(void* user_data);
1376 
1377  /*l
1378  *b Returns:
1379  **
1380  ** The user data pointer set by set_user_data()
1381  */
1382  void* get_user_data();
1383 
1384 #endif
1385 
1386 /*****************************************************************************/
1396  /*l
1397  *b Description:
1398  **
1399  ** This function sets the desired action of the character.
1400  **
1401  ** This function will put the character into free action mode. If
1402  ** the character was in path action mode, actions will no longer be
1403  ** set by action beads on the path.
1404  **
1405  ** If the character is in path position mode and 1 is passed for
1406  ** retain_path_shape, the character will stay in path position mode.
1407  ** If 0 is passed for retain_path_shape, the character will be put
1408  ** into free position mode.
1409  **
1410  ** If the character is in free position mode the retain_path_shape
1411  ** argument will have no effect.
1412  **
1413  ** If this call is interrupting a character in path action mode
1414  ** and path position mode, the character will not be able to resume
1415  ** the interrupted path unless retain_path_shape is set to 1.
1416  ** See resume_interrupted_path().
1417  **
1418  ** This function will have no effect on a dead character (see
1419  ** die_now() and get_dead()).
1420  **
1421  *b Mode Effects:
1422  **
1423  *- - This function will put the character into free action mode.
1424  *- - This function may change the position mode; see Description.
1425  **
1426  *b Arguments:
1427  **
1428  *a action_name - name of the desired action to be performed by
1429  *a the character
1430  *a speed - the speed at which the character should travel
1431  *a while performing the action; pass
1432  *a DIGUY_DEFAULT_FLOAT for the optimal speed to
1433  *a be used
1434  *a retain_path_shape - pass 1 to remain in path position mode; pass
1435  *a 0 to change to free position mode
1436  **
1437  *b Returns:
1438  **
1439  ** 0 on success, -1 on failure
1440  */
1441  int set_desired_action(const char* action_name,
1442  float speed = DIGUY_DEFAULT_FLOAT,
1443  int retain_path_shape = 0);
1444 
1449  const char* get_desired_action();
1450 
1452  int get_desired_action_index();
1453 
1455  const char* get_current_action();
1456 
1458  int get_current_action_index();
1459 
1461  diguyMotionDirection get_desired_action_direction();
1462 
1464  diguyMotionDirection get_current_action_direction();
1465 
1466  /*l
1467  *b Description:
1468  **
1469  ** This function returns the transition state of the action
1470  ** of a character. When commanding an action, DI-Guy may
1471  ** transition the character through one or more intermediate
1472  ** actions to reach the final action. For example, a character
1473  ** with the action "walk" that is commanded to "prone" would
1474  ** transition through the intermediate action "stand".
1475  **
1476  *b Returns:
1477  **
1478  ** 1 if the character is transitioning between actions
1479  ** 0 otherwise
1480  */
1481  int get_is_in_action_transition();
1482 
1483  /*l
1484  *b Description:
1485  **
1486  ** This function forces the current action of the character to be the
1487  ** action identified by action_name.
1488  **
1489  ** See set_desired_action() for a discussion of the effects on
1490  ** position mode.
1491  **
1492  ** This function will have no effect on a dead character (see
1493  ** die_now() and get_dead()).
1494  **
1495  ** By passing a value greater than 0 for t_offset_into_new_action,
1496  ** the character can be made to begin the action partway in. This is
1497  ** useful when forcing actions for a lot of characters at the same
1498  ** time; without the offset, the characters would move in lockstep.
1499  **
1500  ** The most recent forced action, the time at which it was forced,
1501  ** and any time offset can be queried using the functions
1502  ** get_most_recent_forced_action(),
1503  ** get_most_recent_forced_action_t(), and
1504  ** get_most_recent_forced_action_t_offset().
1505  **
1506  *b Mode Effects:
1507  **
1508  *- - This function will put the character into free action mode.
1509  *- - This function may change the position mode; see Description.
1510  **
1511  *b Arguments:
1512  **
1513  *a action_name - name of the action to be performed by
1514  *a the character
1515  *a speed - the speed at which the character should
1516  *a travel while performing the action; pass
1517  *a DIGUY_DEFAULT_FLOAT for the optimal speed
1518  *a to be used
1519  *a include_transition_arc - flag for whether the transition
1520  *a motion from the current action to
1521  *a the new action is included;
1522  *a pass 1 for best chance of good looking
1523  *a transition;
1524  *a pass 0 for fastest response
1525  *a max_rampdown_interval - max amount of time spent trying to
1526  *a smooth over any motion seams; set
1527  *a to 0.5 for a smooth transition, set
1528  *a to 0 for a potentially rough transition
1529  *a retain_path_shape - pass 1 to remain in path position mode;
1530  *a pass 0 to change to free position mode
1531  *a t_offset_into_new_action - how much to shift time forward into
1532  *a new action; must be >= 0; see comment
1533  *a above for more info
1534  **
1535  *b Returns:
1536  **
1537  ** 0 on success, -1 on failure
1538  */
1539  int force_action(const char* action_name,
1540  float speed = DIGUY_DEFAULT_FLOAT,
1541  int include_transition_arc = 1,
1542  float max_rampdown_interval = 0.5f,
1543  int retain_path_shape = 0,
1544  float t_offset_into_new_action = 0.0f);
1545 
1546  /*l
1547  *b Description:
1548  **
1549  ** This function is similar to force_action(), but allows the
1550  ** specification of how long the interruption should last.
1551  **
1552  ** This function will have no effect on a dead character (see
1553  ** die_now() and get_dead()).
1554  **
1555  *b Mode Restrictions:
1556  **
1557  *- - This function can only be called if the character is in
1558  *- path action mode *and* path position mode.
1559  **
1560  *b Mode Effects:
1561  **
1562  *- - This function will put the character into free action mode.
1563  *- - This function will not change the position mode.
1564  **
1565  *b Arguments:
1566  **
1567  *a duration - how long the action should be performed before
1568  *a an automatic resume_interrupted_path() call is
1569  *a made
1570  **
1571  *b Returns:
1572  **
1573  ** 0 on success, -1 on failure
1574  */
1575  int force_action_with_duration(const char* action_name,
1576  float duration,
1577  int include_transition_arc = 1,
1578  float max_rampdown_interval = 0.5f);
1579 
1580  /*l
1581  *b Description:
1582  **
1583  ** This function is similar to force_action(), but allows the
1584  ** specification of an offset to apply to the character's position.
1585  **
1586  *b Mode Effects:
1587  **
1588  *- - This function will put the character into free action mode.
1589  *- - This function may change the position mode; see Description.
1590  **
1591  *b Arguments:
1592  **
1593  *a x, y, z - Offset to apply to character's position when transitioning
1594  *a to given action.
1595  **
1596  *b Returns:
1597  **
1598  ** 0 on success, -1 on failure
1599  **
1600  */
1601  int force_action_with_offset( const char* action_name,
1602  float speed = DIGUY_DEFAULT_FLOAT,
1603  int include_transition_arc = 1,
1604  float max_rampdown_interval = 0.5f,
1605  int retain_path_shape = 0,
1606  float t_offset_into_new_action = 0.0f,
1607  float x = 0, float y = 0, float z = 0 );
1608 
1609  /*l
1610  *b Description:
1611  **
1612  ** This function forces the current action of the character to be the
1613  ** action identified by action_name, to be executed along the path
1614  ** shape specified by path_shape_name.
1615  **
1616  ** This function will have no effect on a dead character (see
1617  ** die_now() and get_dead()).
1618  **
1619  *b Mode Effects:
1620  **
1621  *- - This function will put the character into free action mode.
1622  *- - This function will put the character into path position mode.
1623  **
1624  *b Arguments:
1625  **
1626  *a action_name - name of the action to be performed by
1627  *a the character
1628  *a path_shape_name - name of the path shape on which action
1629  *a should be performed
1630  *a waypoint_name - name of waypoint on path shape to begin at;
1631  *a default of NULL will start at first waypoint
1632  *a distance_into_path - distance into path shape to start at, if
1633  *a waypoint_name isn't specified
1634  **
1635  *b Returns:
1636  **
1637  ** 0 on success, -1 on failure
1638  */
1639  int force_action_and_path_shape(const char* action_name,
1640  const char* path_shape_name,
1641  const char* waypoint_name = NULL,
1642  float distance_into_path = 0.0f);
1643 
1644  /*l
1645  *b Description:
1646  **
1647  ** This function returns the most recently forced action as set by
1648  ** by force_action(), force_action_with_duration(), or
1649  ** force_action_and_path_shape().
1650  **
1651  *b Returns:
1652  **
1653  ** the name of the most recent forced action, or NULL if no action
1654  ** has been forced
1655  */
1656  const char* get_most_recent_forced_action();
1657 
1658  /*l
1659  *b Description:
1660  **
1661  ** This function returns the time at which the most recently forced
1662  ** action occurred.
1663  **
1664  *b Returns:
1665  **
1666  ** time at which force action occurred; -1.0 if no action has been
1667  ** forced
1668  */
1669  float get_most_recent_forced_action_t();
1670 
1671  /*l
1672  *b Description:
1673  **
1674  ** This function returns the action time offset of the most recently
1675  ** forced action. This is typically value of the
1676  ** t_offset_into_new_action argument of the force_action() call.
1677  **
1678  *b Returns:
1679  **
1680  ** time at which force action occurred; -1.0 if no action has been
1681  ** forced
1682  */
1683  float get_most_recent_forced_action_t_offset();
1684 
1685 
1686  /*l
1687  *b Description:
1688  **
1689  ** This function adds a "pending action" to the character. This is
1690  ** essentially a delayed set_desired_action() call. The desired
1691  ** action will be set at the passed scenario t, just as if
1692  ** set_desired_action() is called at that time.
1693  **
1694  ** *Note:* Any call to set_desired_action() or force_action(), or
1695  ** their related variants, will clear any pending actions.
1696  **
1697  *b Arguments:
1698  **
1699  *a action - name of pending desired action
1700  *a scenario_t - time at which to set desired action
1701  *a remove_existing_pending_actions - pass 1 to remove any previously
1702  *a added pending actions, 0 to leave them
1703  *a speed - as passed to set_desired_action()
1704  *a retain_path_shape - as passed to set_desired_action()
1705  **
1706  *b Returns:
1707  **
1708  ** 0 on success, -1 on failure
1709  */
1710  int add_pending_desired_action(const char* action,
1711  float scenario_t,
1712  int remove_existing_pending_actions = 0,
1713  float speed = DIGUY_DEFAULT_FLOAT,
1714  int retain_path_shape = 1);
1715 
1716  /*l
1717  *b Description:
1718  **
1719  ** Similar to add_pending_desired_action(), but will do a
1720  ** force_action() at the passed scenario_t instead of a
1721  ** set_desired_action().
1722  **
1723  ** *Note:* Any call to set_desired_action() or force_action(), or
1724  ** their related variants, will clear any pending actions.
1725  **
1726  *b Returns:
1727  **
1728  ** 0 on success, -1 on failure
1729  */
1730  int add_pending_force_action(const char* action,
1731  float scenario_t,
1732  int remove_existing_pending_actions = 0,
1733  float speed = DIGUY_DEFAULT_FLOAT,
1734  int include_transition_arc = 1,
1735  float max_rampdown_interval = 0.5f,
1736  int retain_path_shape = 1,
1737  float first_arc_time_shift = 0.0f);
1738 
1739  /*l
1740  *b Returns:
1741  **
1742  ** 1 if the passed action name is an action available to this
1743  ** character, 0 if not
1744  */
1745  int is_valid_action(const char* action);
1746 
1747  /*l
1748  *b Description:
1749  **
1750  ** This function sends this character a signal to die as soon as
1751  ** possible. The character will transition to a dead action.
1752  **
1753  ** The following side-effects will also happen:
1754  *>
1755  *- - all aiming is ended
1756  *- - all gazing is ended
1757  *- - all pointing is ended
1758  *- - head nodding and shaking are stopped
1759  *- - all gestures are aborted
1760  *- - all sounds originated by the character are stopped
1761  *- - Destroyed appearance might be switched to.
1762  *<
1763  ** Many function calls will have no effect on dead characters;
1764  ** see individual function descriptions for limitations.
1765  **
1766  ** Use the get_dead() call to retrieve the dead state of a
1767  ** character.
1768  **
1769  *b Mode Effects:
1770  **
1771  *- - This function will put the character into free action mode.
1772  *- - This function will not change the position mode.
1773  **
1774  *b Returns:
1775  **
1776  ** 0 on success, -1 on failure
1777  **
1778  *b Available as Decision Bead/Event
1779  */
1780  int die_now(const char* preferred_dead_action_name = "(default)");
1781 
1782  /*l
1783  *b Description:
1784  **
1785  ** This function revives a dead character. The limitations of dead
1786  ** characters will be lifted from the revived character; e.g., the
1787  ** character will be able to gaze, execute gestures, etc.
1788  **
1789  *b Returns:
1790  **
1791  ** 0 on success, -1 on failure
1792  **
1793  *b Available as Decision Bead/Event
1794  */
1795  int revive_now(const char* preferred_revive_action_name = "(default)");
1796 
1797  /*l
1798  *b Description:
1799  **
1800  ** This function returns whether or not the character is dead.
1801  ** Characters can be killed by die_now() function calls, as well as
1802  ** by being hit by weapon fire.
1803  **
1804  *b Returns:
1805  **
1806  ** 1 if character is dead (die_now() function has been called),
1807  ** 0 if not.
1808  */
1809  int get_dead();
1810 
1811  /*l
1812  *b Description:
1813  **
1814  ** Sets the speed the character should attempt to move, in meters per
1815  ** second.
1816  **
1817  ** This setting takes effect immediately. To set a desired action
1818  ** and a desired speed at the same time, use the speed argument of
1819  ** the set_desired_action() call.
1820  **
1821  ** This desired speed setting can be undone in a couple of ways:
1822  **
1823  *- 1. by calling set_speed() with an argument of
1824  *- DIGUY_DEFAULT_FLOAT, or
1825  *- 2. by calling set_desired_action(), or
1826  *- 3. by calling one of the force_action() functions
1827  **
1828  *b Arguments:
1829  **
1830  *a speed - desired speed in meters per second
1831  **
1832  *b Returns:
1833  **
1834  ** 0 on success, -1 on failure
1835  */
1836  int set_speed(float speed);
1837 
1838  /*l
1839  *b Returns:
1840  **
1841  ** the approximate speed at which the character is moving, in meters
1842  ** per second
1843  */
1844  float get_speed();
1845 
1846  /*l
1847  *b Returns:
1848  **
1849  ** The desired speed of the character, in meters per second. Calls to
1850  ** set_speed(), set_desired_action(), or force_action() assign
1851  ** the character a desired speed, to which it transitions over some
1852  ** amount of time. If the speed-setting was instantaneous, the current
1853  ** speed will be returned.
1854  */
1855  float get_desired_speed();
1856 
1857 /*****************************************************************************/
1874  /*l
1875  *b Description:
1876  **
1877  ** Sets a generic parameter that can be mapped to a blend tree driver.
1878  ** Useful for creating animations that can play back at different vertical angles.
1879  */
1880  int set_animation_target_el(float elevation, float ramp_time = .25f);
1881 
1883  float get_animation_target_el();
1884 
1885  /*l
1886  *b Description:
1887  **
1888  ** Sets a generic parameter that can be mapped to a blend tree driver.
1889  ** Useful for creating animations that can play back at different horizontal angles.
1890  */
1891  int set_animation_target_az(float azimuth, float ramp_time = .25f);
1892 
1894  float get_animation_target_az();
1895 
1896  /*l
1897  *b Description:
1898  **
1899  ** Sets a generic parameter in world space that can be mapped to a blend tree driver.
1900  ** The locomotion actions are driven by these values allowing one action to go
1901  ** many different direction.
1902  ** Internally this is mapped to local space.
1903  **
1904  ** In practical terms, this means that a character with the appropriate animation blend
1905  ** tree can be made to move at an arbitrary speed in an arbitrary direction, provided
1906  ** that the blend tree supports these motions. One example would be a soldier who can
1907  ** "strafe" from side to side while pointing his weapon in a certain direction. Another
1908  ** example would be a car that can travel forwards or backwards at a speed within a
1909  ** continuous range.
1910  **
1911  ** Users can see a demonstration of this feature in the character view by selecting an
1912  ** appropriate character type (e.g. vehicle_09), appearance (e.g. taxi_2013), and
1913  ** action ("movement"). The exercise blend tree widget will allow adjustments.
1914  **
1915  */
1916  void set_animation_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = 0.10f);
1917 
1919  void get_animation_velocity(float *vel_x, float *vel_y, float *vel_z);
1920 
1921  /*l
1922  *b Description:
1923  **
1924  ** Sets a generic parameter in local space that can be mapped to a blend tree driver.
1925  ** The locomotion actions are driven by these values allowing one action to go
1926  ** many different directions.
1927  **
1928  ** Similar to set_animation_velocity() in terms of overall practical details.
1929  ** Note that the local velocity setting will affect the character's world velocity.
1930  */
1931  void set_animation_local_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = 0.10f);
1932 
1934  void get_animation_local_velocity(float *vel_x, float *vel_y, float *vel_z);
1935 
1936  /*l
1937  *b Description:
1938  **
1939  ** Sets a generic parameter in that can be mapped to a blend tree driver.
1940  ** The locomotion actions are driven by these values allowing one action to turn
1941  */
1942  void set_animation_angular_velocity(float vel_rz, float ramp_time = .25f);
1943 
1945  float get_animation_angular_velocity();
1946 
1947 
1948 /*****************************************************************************/
1958  /*l
1959  *b Description:
1960  **
1961  ** Sets the position of the character relative to the origin of the
1962  ** DI-Guy global coordinate system.
1963  **
1964  ** The new settings will take effect immediately, possibly causing
1965  ** the character to "teleport" if the new values are significantly
1966  ** different than the old.
1967  **
1968  ** The DI-Guy global coordinate system is right-handed, with
1969  ** X forward, Z up, and Y to the left. Rotation directions follow
1970  ** standard right-handed coordinate system conventions:
1971  **
1972  *- - positive rotations about X cause a counter-clockwise roll
1973  *- - position rotations about Y cause a forward pitch
1974  *- - positive rotations about Z cause a yaw to the left
1975  **
1976  ** Note that if the character has an altitude function (see
1977  ** set_altitude_function()), the tz argument will effectively be
1978  ** ignored as the altitude function will override it.
1979  **
1980  ** If the magnitude of the numbers is large (say 32000 or higher),
1981  ** the function set_position_double() should be used instead.
1982  **
1983  *b Mode Effects:
1984  **
1985  *- - This function will put the character into free position mode.
1986  *- - This function will put the character into free action mode.
1987  **
1988  *b Arguments:
1989  **
1990  *a tx, ty, tz - position in meters from the origin
1991  **
1992  *b Returns:
1993  **
1994  ** 0 on success, -1 on failure
1995  */
1996  int set_position(float tx, float ty, float tz);
1997 
1998  /*l
1999  *b Description:
2000  **
2001  ** Similar to set_position(), but using double-precision rather than
2002  ** single-precision numbers. If the magnitude of the numbers is large
2003  ** (say 32000 or higher), this function should be used.
2004  **
2005  *b Mode Effects:
2006  **
2007  *- - This function will put the character into free position mode.
2008  *- - This function will put the character into free action mode.
2009  **
2010  *b Arguments:
2011  **
2012  *a tx, ty, tz - position in meters from the origin
2013  **
2014  *b Returns:
2015  **
2016  ** 0 on success, -1 on failure
2017  */
2018  int set_position_double(double tx, double ty, double tz);
2019 
2020  /*l
2021  *b Description:
2022  **
2023  ** Retrieves the position of the character in the DI-Guy
2024  ** global coordinate system.
2025  **
2026  ** See set_position() for a description of the coordinate system.
2027  **
2028  *b Arguments:
2029  **
2030  *a tx, ty, tz - position in meters from the origin
2031  **
2032  ** Pass NULL for any values that are not needed.
2033  **
2034  *b Returns:
2035  **
2036  ** 0 on success, -1 on failure
2037  */
2038  int get_position(float* tx, float* ty, float* tz);
2039 
2040  /*l
2041  *b Description:
2042  **
2043  ** Retrieves the position of the character in the DI-Guy
2044  ** global coordinate system.
2045  **
2046  ** See set_position() for a description of the coordinate system.
2047  **
2048  ** Unlike get_position(), this function returns higher-precision
2049  ** values for the position, which is important when the character is
2050  ** far from the coordinate system origin.
2051  **
2052  *b Arguments:
2053  **
2054  *a tx, ty, tz - position in meters from the origin
2055  **
2056  ** Pass NULL for any values that are not needed.
2057  **
2058  *b Returns:
2059  **
2060  ** 0 on success, -1 on failure
2061  */
2062  int get_position_double(double* tx, double* ty, double* tz);
2063 
2064  /*l
2065  *b Description:
2066  **
2067  ** Sets the position of the character relative to its parent or the
2068  ** origin of the DI-Guy global coordinate system if this
2069  ** character is not parented.
2070  **
2071  ** See set_position() for a description of the coordinate system.
2072  **
2073  ** The new settings will take effect immediately, possibly causing the
2074  ** character to "teleport" if the new values are significantly
2075  ** different than the old.
2076  **
2077  *b Mode Effects:
2078  **
2079  *- - This function will put the character into free position mode.
2080  *- - This function will put the character into free action mode.
2081  **
2082  *b Arguments:
2083  **
2084  *a tx, ty, tz - position in meters from the origin
2085  **
2086  *b Returns:
2087  **
2088  ** 0 on success, -1 on failure
2089  */
2090  int set_position_relative_to_parent(float tx, float ty, float tz);
2091 
2092  /*l
2093  *b Description:
2094  **
2095  ** Retrieves the position of the character relative to its parent, or
2096  ** relative to the origin of the DI-Guy global coordinate
2097  ** system if this character is not parented.
2098  **
2099  ** See set_position() for a description of the coordinate system.
2100  **
2101  *b Arguments:
2102  **
2103  *a tx, ty, tz - position in meters from the origin
2104  **
2105  ** Pass NULL for any values that are not needed.
2106  **
2107  *b Returns:
2108  **
2109  ** 0 on success, -1 on failure
2110  */
2111  int get_position_relative_to_parent(float* tx, float* ty, float* tz);
2112 
2113  /*l
2114  *b Description:
2115  **
2116  ** Similar to set_position_relative_to_parent(), but the position is
2117  ** either from the other character's overall position (if
2118  ** other_link_name is NULL), or the position of the other character's
2119  ** link (if other_link_name specifies a link on the other character).
2120  **
2121  ** The position that is set is relative to this character's parent.
2122  **
2123  *b Mode Effects:
2124  **
2125  *- - This function will put the character into free position mode.
2126  *- - This function will put the character into free action mode.
2127  **
2128  *b Arguments:
2129  **
2130  *a other_character_name - other character from which to read
2131  *a position
2132  *a other_link_name - optional link on other character; if
2133  *a NULL, other character's base position is
2134  *a used
2135  *a offset_x, offset_y, offset_z - offset to apply to position
2136  *a read from other character
2137  *a also_set_orientation - pass 1 to also set this character's
2138  *a orientation from the other character's
2139  *a orientation
2140  **
2141  *b Returns:
2142  **
2143  ** 0 on success, -1 on failure
2144  */
2145  int set_position_to_other_character_position(const char* other_character_name,
2146  const char* other_link_name = NULL,
2147  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2148  int also_set_orientation = 1);
2149 
2150  /*l
2151  *b Description:
2152  **
2153  ** Sets the desired position of the character. How the character
2154  ** moves toward the desired position is determined by its current
2155  ** guides; see add_guide() and create_guide().
2156  **
2157  *b Mode Effects:
2158  **
2159  *- - This function will put the character into free position mode.
2160  *- - This function will put the character into free action mode.
2161  **
2162  *b Arguments:
2163  **
2164  *a tx, ty, tz - desired position in meters from the origin
2165  *a force_guide_unacquired - this optional argument will set any guides
2166  *a the character has to be unacquired
2167  *b Returns:
2168  **
2169  ** 0 on success, -1 on failure
2170  */
2171  int set_desired_position(float tx, float ty, float tz,
2172  int force_guide_unacquired = 0);
2173 
2174  int set_desired_position_double(double tx, double ty, double tz,
2175  int force_guide_unacquired = 0);
2176  /*l
2177  *b Description:
2178  **
2179  ** Like set_desired_position(), but uses the character's current
2180  ** position as the desired position.
2181  **
2182  *b Mode Effects:
2183  **
2184  *- - This function will put the character into free position mode.
2185  *- - This function will put the character into free action mode.
2186  **
2187  *b Arguments:
2188  **
2189  *a also_set_orientation - pass 1 to also set this character's
2190  *a orientation to its current orientation
2191  **
2192  *b Returns:
2193  **
2194  ** 0 on success, -1 on failure
2195  */
2196  int set_desired_position_to_current_position(int also_set_orientation = 1);
2197 
2198  /*l
2199  *b Description:
2200  **
2201  ** Like set_desired_position(), but sets the character's desired
2202  ** position to passed waypoint's position.
2203  **
2204  ** The passed waypoint can be one created by
2205  ** diguyScenario::create_waypoint, a waypoint from a character's
2206  ** diguyCharacterPath, or waypoint from a diguyPathShape.
2207  **
2208  *b Mode Effects:
2209  **
2210  *- - This function will put the character into free position mode.
2211  *- - This function will put the character into free action mode.
2212  **
2213  *b Arguments:
2214  **
2215  *a waypoint - pointer to diguyWaypoint object
2216  *a offset_x, offset_y, offset_z - offset to apply to waypoint
2217  *a position
2218  *a offset_in_world_coords - 1 if offset is to be in world
2219  *a coordinates, 0 if it is to be
2220  *a in waypoint-local coordinates
2221  **
2222  *b Returns:
2223  **
2224  ** 0 on success, -1 on failure
2225  */
2226  int set_desired_position_to_waypoint(diguyWaypoint* waypoint,
2227  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2228  int offset_in_world_coords = 0);
2229 
2230  /*l
2231  *b Description:
2232  **
2233  ** Like set_desired_position(), but finds the specified waypoint on
2234  ** the specified path and sets the character's desired position to the
2235  ** waypoint's position.
2236  **
2237  *b Mode Effects:
2238  **
2239  *- - This function will put the character into free position mode.
2240  *- - This function will put the character into free action mode.
2241  **
2242  *b Arguments:
2243  **
2244  *a path_name - name of path on which to find waypoint
2245  *a waypoint_name - name of waypoint
2246  **
2247  *b Returns:
2248  **
2249  ** 0 on success, -1 on failure
2250  */
2251  int set_desired_position_to_path_waypoint(const char* path_name,
2252  const char* waypoint_name);
2253 
2254  /*l
2255  *b Description:
2256  **
2257  ** Like set_desired_position(), but finds the specified waypoint on
2258  ** the specified path shape and sets the character's desired position
2259  ** to the waypoint's position.
2260  **
2261  *b Mode Effects:
2262  **
2263  *- - This function will put the character into free position mode.
2264  *- - This function will put the character into free action mode.
2265  **
2266  *b Arguments:
2267  **
2268  *a path_shape_name - name of path shape on which to find waypoint
2269  *a waypoint_name - name of waypoint
2270  **
2271  *b Returns:
2272  **
2273  ** 0 on success, -1 on failure
2274  */
2275  int set_desired_position_to_path_shape_waypoint(const char* path_shape_name,
2276  const char* waypoint_name);
2277 
2278  /*l
2279  *b Description:
2280  **
2281  ** Retrieves the desired position of the character.
2282  **
2283  *b Mode Restrictions:
2284  **
2285  *- - This function can only be called in free position mode.
2286  **
2287  *b Arguments:
2288  **
2289  *a tx, ty, tz - desired position in meters from the origin
2290  **
2291  ** Pass NULL for any values that are not needed.
2292  **
2293  *b Returns:
2294  **
2295  ** 0 on success, -1 on failure
2296  */
2297  int get_desired_position(float* tx, float* ty, float* tz);
2298  int get_desired_position_double(double* tx, double* ty, double* tz);
2299 
2300  /*l
2301  *b Description:
2302  **
2303  ** Retrieves the delta vector from current position to desired one.
2304  **
2305  *b Mode Restrictions:
2306  **
2307  *- - This function can only be called in free position mode.
2308  **
2309  *b Arguments:
2310  **
2311  *a tx, ty, tz - delta in meters
2312  **
2313  ** Pass NULL for any values that are not needed.
2314  **
2315  *b Returns:
2316  **
2317  ** 0 on success, -1 on failure
2318  */
2319  int get_delta_to_desired_position(float* tx, float* ty, float* tz);
2320 
2321  /*l
2322  *b Description:
2323  **
2324  ** Sets the initial position the character should move to on a call to
2325  ** diguyScenario::reset().
2326  **
2327  ** If the character has an initial path, that path, not this function
2328  ** call, will determine its initial position.
2329  **
2330  *b Arguments:
2331  **
2332  *a tx, ty, tz - initial position in meters from the origin
2333  **
2334  *b Returns:
2335  **
2336  ** 0 on success, -1 on failure
2337  */
2338  int set_initial_position(float tx, float ty, float tz);
2339 
2340  /*l
2341  *b Description:
2342  **
2343  ** Retrieves the initial position of the character.
2344  **
2345  ** If the character is in free position mode or has no initial path,
2346  ** this will be the position set by set_initial_position().
2347  **
2348  ** Otherwise this will be the position of the first waypoint of the
2349  ** initial path.
2350  **
2351  *b Arguments:
2352  **
2353  *a tx, ty, tz - initial position in meters from the origin
2354  **
2355  ** Pass NULL for any values that are not needed.
2356  **
2357  *b Returns:
2358  **
2359  ** 0 on success, -1 on failure
2360  */
2361  int get_initial_position(float* tx, float* ty, float* tz);
2362 
2363  /*l
2364  *b Description:
2365  **
2366  ** Sets the orientation of the character relative to the origin of the
2367  ** DI-Guy global coordinate system.
2368  **
2369  ** See set_position() for a description of the coordinate system.
2370  **
2371  ** The new settings will take effect immediately, possibly causing the
2372  ** character to "teleport" if the new values are significantly
2373  ** different than the old.
2374  **
2375  ** Note that if the character has an up vector type of 'z' or 'n' or even
2376  ** sometimes 'd' (as set by the set_up_vector_type() call) the rx and ry
2377  ** values will not have any effect. To be able to set rx and ry
2378  ** values, set the up vector type of the character to 'c', for "custom".
2379  **
2380  *b Mode Effects:
2381  **
2382  *- - This function will put the character into free position mode.
2383  *- - This function will put the character into free action mode.
2384  **
2385  *b Arguments:
2386  **
2387  *a rz, rx, ry - orientations in degrees
2388  **
2389  *b Returns:
2390  **
2391  ** 0 on success, -1 on failure
2392  */
2393  int set_orientation(float rz, float rx, float ry);
2394 
2395  /*l
2396  *b Description:
2397  **
2398  ** Retrieves the orientation of the character in the DI-Guy
2399  ** global coordinate system. See set_position() for a description of
2400  ** the coordinate system.
2401  **
2402  *i Note:
2403  **
2404  ** For vehicles, you may want to use the function
2405  ** get_vehicle_body_orientation(). See that function for more
2406  ** information.
2407  **
2408  *b Arguments:
2409  **
2410  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2411  *a positive X axis
2412  **
2413  ** Pass NULL for any values that are not needed.
2414  **
2415  *b Returns:
2416  **
2417  ** 0 on success, -1 on failure
2418  */
2419  int get_orientation(float* rz, float* rx, float* ry);
2420 
2421  /*l
2422  *b Description:
2423  **
2424  ** Sets the orientation of the character relative to its parent or the
2425  ** origin of the DI-Guy global coordinate system if this
2426  ** character is not parented.
2427  **
2428  ** See set_position() for a description of the coordinate system.
2429  **
2430  ** The new settings will take effect immediately, possibly causing the
2431  ** character to "teleport" if the new values are significantly
2432  ** different than the old.
2433  **
2434  *b Mode Effects:
2435  **
2436  *- - This function will put the character into free position mode.
2437  *- - This function will put the character into free action mode.
2438  **
2439  *b Arguments:
2440  **
2441  *a rz, rx, ry - orientations in degrees
2442  **
2443  *b Returns:
2444  **
2445  ** 0 on success, -1 on failure
2446  */
2447  int set_orientation_relative_to_parent(float rz, float rx, float ry);
2448 
2449  /*l
2450  *b Description:
2451  **
2452  ** Retrieves the orientation of the character relative to its parent,
2453  ** or the origin of the DI-Guy global coordinate system if
2454  ** this character does not have a parent.
2455  **
2456  ** See set_position() for a description of the coordinate system.
2457  **
2458  *b Arguments:
2459  **
2460  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2461  *a positive X axis
2462  **
2463  ** Pass NULL for any values that are not needed.
2464  **
2465  *b Returns:
2466  **
2467  ** 0 on success, -1 on failure
2468  */
2469  int get_orientation_relative_to_parent(float* rz, float* rx, float* ry);
2470 
2471  /*l
2472  *b Description:
2473  **
2474  ** This function sets how the character should be oriented relative
2475  ** to its surroundings.
2476  **
2477  ** This function changes the current up vector type, and the up vector type
2478  ** that will be set when the character is reset. To change only the
2479  ** current up vector type (a temporary change that goes away on reset),
2480  ** call set_up_vector_type()).
2481  **
2482  *b Arguments:
2483  **
2484  *a axis - the up vector type the character should use; legal
2485  *a values shown below:
2486  **
2487  *- - 'd' - use default settings; character will change
2488  *- up vector type depending on current action and
2489  *- path shape parameters
2490  *- - 'z' - Z axis is up; character will be oriented
2491  *- so that positive Z in character coordinates is
2492  *- always oriented along the positive world Z axis
2493  *- - 'n' - normal to path; character will be oriented
2494  *- so that positive Z in character coordinates is
2495  *- normal to the path shape the character is on
2496  *- - 'g' - ground-clamped; the vehicle will attempt to cling
2497  *- to the terrain, in an approximation of real rigid
2498  *- body physics
2499  *- - 'c' - custom; character's rx and ry orientation values
2500  *- will not be modified
2501  **
2502  ** Having an up vector type of 'z' effectively zeroes out the rx and ry
2503  ** values of the character's orientation.
2504  **
2505  ** Having an up vector type of 'n' may override rx and ry values of the
2506  ** character's orientation with values derived from the character's
2507  ** path shape.
2508  **
2509  ** Having an up vector type of 'c' allows the pitch and roll of the
2510  ** character to be changed without taking it off the path it in on by
2511  ** calling set_custom_orientation_rx_and_ry(). Calling
2512  ** set_orientation() has the side-effect of putting the character
2513  ** into free position mode, taking it off of any path it's on.
2514  **
2515  *b Returns:
2516  **
2517  ** 0 on success, -1 on failure
2518  */
2519  int set_initial_up_vector_type(char axis);
2520 
2521  /*l
2522  *b Description:
2523  **
2524  ** This function is being deprecated, but remains for backwards compatibility.
2525  ** It does the same thing as set_initial_up_vector_type()
2526  **
2527  */
2528  int set_initial_up_vector(char axis);
2529 
2530  /*l
2531  *b Returns:
2532  **
2533  ** current up vector type; see set_initial_up_vector_type()
2534  */
2535  char get_initial_up_vector_type();
2536 
2537  /*l
2538  *b Description:
2539  **
2540  ** This function is being deprecated, but remains for backwards compatibility.
2541  ** It does the same thing as get_initial_up_vector_type()
2542  **
2543  */
2544  char get_initial_up_vector();
2545 
2546  /*l
2547  *b Description:
2548  **
2549  ** This function sets how the character should be oriented relative
2550  ** to its surroundings.
2551  **
2552  ** This function changes only the current up vector type. To change the
2553  ** up vector type that will be used when the character is reset, call
2554  ** set_initial_up_vector_type().
2555  **
2556  *b Arguments:
2557  **
2558  *a axis - the up vector type the character should use; see
2559  *a set_initial_up_vector_type() for description
2560  **
2561  *b Returns:
2562  **
2563  ** 0 on success, -1 on failure
2564  **
2565  *b Available as Decision Bead/Event
2566  */
2567  int set_up_vector_type(char axis);
2568 
2569  /*l
2570  *b Description:
2571  **
2572  ** This function is being deprecated, but remains for backwards compatibility.
2573  ** It does the same thing as set_up_vector_type()
2574  **
2575  */
2576  int set_up_vector(char axis);
2577 
2578  /*l
2579  *b Returns:
2580  **
2581  ** current up vector type; see set_up_vector_type()
2582  */
2583  char get_up_vector_type();
2584 
2585  /*l
2586  *b Description:
2587  **
2588  ** This function is being deprecated, but remains for backwards compatibility.
2589  ** It does the same thing as get_up_vector_type()
2590  **
2591  */
2592  char get_up_vector();
2593 
2594  /*l
2595  *b Description:
2596  **
2597  ** This function sets the rx and ry components of the character's
2598  ** orientation. Unlike set_orientation(), this function does not
2599  ** put the character into free position mode if it is currently in
2600  ** path position mode.
2601  **
2602  ** Note that if the character has an up vector type of 'z' or 'n' or even
2603  ** sometimes 'd' (as set by the set_up_vector_type() call) this function
2604  ** will not have any effect. To be able to set rx and ry values,
2605  ** set the up vector type of the character to 'c', for "custom".
2606  **
2607  ** The passed rx and ry values are in character-local coordinates,
2608  ** not parent coordinates if the character has a parent.
2609  **
2610  *b Mode Effects:
2611  **
2612  *- - None.
2613  **
2614  *b Arguments:
2615  **
2616  *a rx, ry - orientations in degrees
2617  **
2618  *b Returns:
2619  **
2620  ** 0 on success, -1 on failure
2621  */
2622  int set_custom_orientation_rx_and_ry(float rx,
2623  float ry);
2624 
2625  /*l
2626  *b Description:
2627  **
2628  ** Sets the desired orientation of the character. See
2629  ** set_desired_position().
2630  **
2631  *b Mode Effects:
2632  **
2633  *- - This function will put the character into free position mode.
2634  *- - This function will put the character into free action mode.
2635  **
2636  *b Arguments:
2637  **
2638  *a rz, rx, ry - orientations in degrees counter-clockwise from
2639  *a the positive X axis
2640  **
2641  *b Returns:
2642  **
2643  ** 0 on success, -1 on failure
2644  */
2645  int set_desired_orientation(float rz, float rx, float ry,
2646  int force_guide_unacquired = 0);
2647 
2648  /*l
2649  *b Description:
2650  **
2651  ** Retrieves the desired orientation of the character.
2652  **
2653  *b Mode Restrictions:
2654  **
2655  *- - This function can only be called in free position mode.
2656  **
2657  *b Arguments:
2658  **
2659  *a rz, rx, ry - orientations in degrees counter-clockwise from
2660  *a the positive X axis
2661  **
2662  ** Pass NULL for any values that are not needed.
2663  **
2664  *b Returns:
2665  **
2666  ** 0 on success, -1 on failure
2667  */
2668  int get_desired_orientation(float* rz, float* rx, float* ry);
2669 
2670  /*l
2671  *b Description:
2672  **
2673  ** Retrieves the delta from current orientation of the character
2674  ** to the desired one.
2675  **
2676  *b Mode Restrictions:
2677  **
2678  *- - This function can only be called in free position mode.
2679  **
2680  *b Arguments:
2681  **
2682  *a rz, rx, ry - orientation deltas in degrees counter-clockwise from
2683  *a the positive X axis
2684  **
2685  ** Pass NULL for any values that are not needed.
2686  **
2687  *b Returns:
2688  **
2689  ** 0 on success, -1 on failure
2690  */
2691  int get_delta_to_desired_orientation(float* rz, float* rx, float* ry);
2692 
2693  /*l
2694  *b Description:
2695  **
2696  ** Like set_desired_orientation(), but uses the character's current
2697  ** orientation as the desired orientation.
2698  **
2699  *b Mode Effects:
2700  **
2701  *- - This function will put the character into free position mode.
2702  *- - This function will put the character into free action mode.
2703  **
2704  *b Returns:
2705  **
2706  ** 0 on success, -1 on failure
2707  */
2708  int set_desired_orientation_to_current_orientation();
2709 
2710  /*l
2711  *b Description:
2712  **
2713  ** Like set_desired_orientation(), but orients the character towards
2714  ** the position specified.
2715  **
2716  *b Mode Effects:
2717  **
2718  *- - This function will put the character into free position mode.
2719  *- - This function will put the character into free action mode.
2720  **
2721  *b Returns:
2722  **
2723  ** 0 on success, -1 on failure
2724  */
2725  int set_desired_orientation_towards_position(float x, float y, float z,
2726  int force_guide_unacquired = 0);
2727 
2728  /*l
2729  *b Description:
2730  **
2731  ** Sets the initial orientation the character should move
2732  ** to on a call to diguyScenario::reset().
2733  **
2734  ** If the character is on a path the path, not this function
2735  ** call, will determine its initial orientation.
2736  **
2737  *b Arguments:
2738  **
2739  *a rz, rx, ry - orientations in degrees counter-clockwise from
2740  *a the positive X axis
2741  **
2742  *b Returns:
2743  **
2744  ** 0 on success, -1 on failure
2745  */
2746  int set_initial_orientation(float rz, float rx, float ry);
2747 
2748  /*l
2749  *b Description:
2750  **
2751  ** Retrieves the initial orientation of the character.
2752  **
2753  ** If the character is in free position mode or has no
2754  ** initial path, this will be the orientation set by
2755  ** set_initial_orientation().
2756  **
2757  ** Otherwise this will be the orientation of the first
2758  ** waypoint of the initial path.
2759  **
2760  *b Arguments:
2761  **
2762  *a rz, rx, ry - orientations in degrees counter-clockwise from
2763  *a the positive X axis
2764  **
2765  ** Pass NULL for any values that are not needed.
2766  **
2767  *b Returns:
2768  **
2769  ** 0 on success, -1 on failure
2770  */
2771  int get_initial_orientation(float* rz, float* rx, float* ry);
2772 
2773  /*l
2774  *b Description:
2775  **
2776  ** Returns the location and orientation of a specific link of the
2777  ** character.
2778  **
2779  *b Arguments:
2780  **
2781  *a link_name - name of the link or connection point; links are named after their inbound
2782  *a joint name
2783  *a tx, ty, tz - position in meters from the origin of the world
2784  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2785  *a positive X axis
2786  **
2787  ** Pass NULL for any values that are not needed.
2788  **
2789  *b Returns:
2790  **
2791  ** 0 on success, -1 on failure
2792  */
2793  int get_link_position(const char* link_name,
2794  float* tx, float* ty, float* tz,
2795  float* rz, float* rx, float* ry);
2796 
2797  /*l
2798  *b Description:
2799  **
2800  ** Returns the location and orientation of a specific link
2801  ** of the character.
2802  **
2803  *b Arguments:
2804  **
2805  *a link_name - name of the link or connection point; links are named after their inbound
2806  *a joint name
2807  *a tx, ty, tz - position in meters from the origin of the world
2808  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2809  *a positive X axis
2810  **
2811  ** Pass NULL for any values that are not needed.
2812  **
2813  *b Returns:
2814  **
2815  ** 0 on success, -1 on failure
2816  */
2817  int get_link_position_double(const char* link_name,
2818  double* tx, double* ty, double* tz,
2819  double* rz, double* rx, double* ry);
2820 
2821  /*l
2822  *b Description:
2823  **
2824  ** Similar to get_link_position(), but allows specification
2825  ** of offset into ending link.
2826  **
2827  *b Arguments:
2828  **
2829  *a link_name - name of the link or connection point
2830  *a offset_tx, offset_ty, offset_tz - offset in link
2831  *a tx, ty, tz - position in meters from the origin
2832  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2833  *a positive X axis
2834  **
2835  ** Pass NULL for any values that are not needed.
2836  **
2837  *b Returns:
2838  **
2839  ** 0 on success, -1 on failure
2840  */
2841  int get_link_position_with_offset(const char* link_name,
2842  float offset_tx, float offset_ty, float offset_tz,
2843  float* tx, float* ty, float* tz,
2844  float* rz, float* rx, float* ry);
2845 
2846  /*l
2847  *b Description:
2848  **
2849  ** Similar to get_link_position(), but allows specification
2850  ** of offset into ending link.
2851  **
2852  *b Arguments:
2853  **
2854  *a link_name - name of the link or connection point
2855  *a offset_tx, offset_ty, offset_tz - offset in link
2856  *a tx, ty, tz - position in meters from the origin
2857  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2858  *a positive X axis
2859  **
2860  ** Pass NULL for any values that are not needed.
2861  **
2862  *b Returns:
2863  **
2864  ** 0 on success, -1 on failure
2865  */
2866  int get_link_position_with_offset_double(const char* link_name,
2867  double offset_tx, double offset_ty, double offset_tz,
2868  double* tx, double* ty, double* tz,
2869  double* rz, double* rx, double* ry);
2870 
2871  /*l
2872  *b Description:
2873  **
2874  ** Returns the location and orientation of a specific link
2875  ** of the character relative to the position of another link.
2876  **
2877  *b Arguments:
2878  **
2879  *a beginning_link_name - name of the first link; send NULL to
2880  *a to specify the position link
2881  *a ending_link_name - name of the last link; send NULL to
2882  *a to specify the position link
2883  *a tx, ty, tz - position in meters from the origin
2884  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2885  *a positive X axis
2886  **
2887  ** Pass NULL for any values that are not needed.
2888  **
2889  *b Returns:
2890  **
2891  ** 0 on success, -1 on failure
2892  */
2893  int get_link_relative_position(const char* beginning_link_name,
2894  const char* ending_link_name,
2895  float* tx, float* ty, float* tz,
2896  float* rz, float* rx, float* ry);
2897 
2898  /*l
2899  *b Description:
2900  **
2901  ** Similar to get_link_relative_position(), but allows specification
2902  ** of offset into ending link.
2903  **
2904  *b Arguments:
2905  **
2906  *a beginning_link_name - name of the first link; send NULL to
2907  *a to specify the position link
2908  *a ending_link_name - name of the last link; send NULL to
2909  *a to specify the position link
2910  *a offset_tx, offset_ty, offset_tz - offset in ending link
2911  *a tx, ty, tz - position in meters from the origin
2912  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2913  *a positive X axis
2914  **
2915  ** Pass NULL for any values that are not needed.
2916  **
2917  *b Returns:
2918  **
2919  ** 0 on success, -1 on failure
2920  */
2921  int get_link_relative_position_with_offset(const char* beginning_link_name,
2922  const char* ending_link_name,
2923  float offset_tx, float offset_ty, float offset_tz,
2924  float* tx, float* ty, float* tz,
2925  float* rz, float* rx, float* ry);
2926 
2927  /*l
2928  *b Description:
2929  **
2930  ** By default characters on a path will scale their movement speed
2931  ** and velocity based on the scale of the actor the character is
2932  ** based on. For example, if a tall character and short character
2933  ** are both playing the exact same walk motion, the tall character
2934  ** will move further per motion repetition than the short character.
2935  **
2936  ** Scaling the travel in this way leads to more realistic looking
2937  ** motion, but can cause different characters using the same actions
2938  ** and underlying motions to move at different speeds. At times it
2939  ** is convenient to not scale the travel.
2940  **
2941  ** If actor scaling is disabled, characters of different sizes will
2942  ** all move the same distance, and at the same speed, if they have
2943  ** the same path shapes and action beads. Note that in cases of
2944  ** extreme differences between the actor the motion is based on
2945  ** and the actor the character's current appearance is based on,
2946  ** the characters feet may slip on the ground more than normal.
2947  **
2948  *b Arguments:
2949  **
2950  *a apply_scale_flag - pass 1 to apply actor scale to travel;
2951  *a 0 to not
2952  */
2953  void set_apply_actor_scale_to_action_bead_travel(int apply_scale_flag);
2954 
2955  /*l
2956  *b Returns:
2957  **
2958  ** 1 if actor scale is being applied to travel, 0 if not
2959  */
2960  int get_apply_actor_scale_to_action_bead_travel();
2961 
2962  /*l
2963  *b Description:
2964  **
2965  ** This function transforms a point that is in the local space of the
2966  ** character into a location in the world. Useful for things like
2967  ** navigating AIs to a location near a prop. Or moving to a spot
2968  ** in front of someone else.
2969  **
2970  ** This code presumes up_axis is 'z' and that there is only rotation
2971  ** about that axis.
2972  */
2973  int local_to_global(float x, float y, float z,
2974  float* res_x, float* res_y, float* res_z);
2975 
2976  /*l
2977  *b Description:
2978  **
2979  ** This function transforms a point that is in world space into the
2980  ** local space of a character. Useful for figuring out if something
2981  ** was seen.
2982  **
2983  ** This code presumes up_axis is 'z' and that there is only rotation
2984  ** about that axis.
2985  **
2986  */
2987  int global_to_local(float x, float y, float z,
2988  float* res_x, float* res_y, float* res_z);
2989 
2990  /*l
2991  *b Description:
2992  **
2993  ** Retrieves the current estimated velocity of the character. Note
2994  ** this value may not be valid in environments where characters are
2995  ** transformed independent of DI-Guy function calls. Teleporting
2996  ** characters can also temporarily make this calculation incorrect.
2997  **
2998  *b Arguments:
2999  **
3000  *a vel_x, vel_y, vel_z - meters/sec
3001  **
3002  ** Pass NULL for any values that are not needed.
3003  **
3004  */
3005  void get_velocity(float* vel_x, float* vel_y, float* vel_z);
3006 
3009  void get_acceleration(float* accel_x, float* accel_y, float* accel_z);
3010 
3011  /*l
3012  *b Description:
3013  **
3014  ** Used by the Drift and Adaptive guide
3015  **
3016  *b Arguments:
3017  **
3018  *a vel_x, vel_y, vel_z - meters/sec
3019  */
3020  void set_desired_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = 0.0);
3021  void get_desired_velocity(float *vel_x, float *vel_y, float *vel_z);
3022 
3023  /*l
3024  *b Description:
3025  **
3026  ** Retrieves the current estimated angular velocity of the character.
3027  ** As above, changes made to characters independent of DI-Guy
3028  ** function calls will temporarily make this value incorrect.
3029  **
3030  ** Currently only the angular velocity in yaw is measured.
3031  **
3032  *b Arguments:
3033  **
3034  *a vel_rz - degrees/sec
3035  **
3036  */
3037  void get_angular_velocity(float* vel_rz);
3038 
3039  /*l
3040  ** Used by the Drift and Adaptive guide -- see diguyCharacterGuide.
3041  **
3042  ** The guide attempts to rotate the character at the desired angular
3043  ** velocity.
3044  */
3045  void set_desired_angular_velocity(float vel_rz);
3046  void get_desired_angular_velocity(float* vel_rz);
3047 
3048 /*****************************************************************************/
3054  /*l
3055  *b Description:
3056  **
3057  ** Returns the base appearance of the character, as passed to
3058  ** the function diguyScenario::create_character(). This pointer will
3059  ** never be NULL.
3060  **
3061  ** Note that the current appearance (as returned by
3062  ** get_current_appearance()) may be different than the base
3063  ** appearance. This base appearance is the starting appearance
3064  ** of the character before any calls to set_current_appearance()
3065  ** have been made.
3066  **
3067  *b Returns:
3068  **
3069  ** name of base appearance of the character
3070  */
3071  const char* get_appearance();
3072 
3073  /*l
3074  *b Description:
3075  **
3076  ** This function sets the base appearance of the character.
3077  ** The base appearance is the appearance the character will take
3078  ** if the scenario is reset, undoing any appearance changes made
3079  ** by calls to set_current_appearance().
3080  **
3081  ** Calling this function also makes an implicit call to
3082  ** set_current_appearance().
3083  **
3084  *b Arguments:
3085  **
3086  *a appearance - name of new base appearance
3087  **
3088  *b Returns:
3089  **
3090  ** 0 on success, -1 on failure
3091  */
3092  int set_appearance(const char* appearance);
3093 
3094  /*l
3095  *b Description:
3096  **
3097  ** This function sets the current appearance of this character.
3098  **
3099  ** Note that different appearances may be based on different actors.
3100  ** Different actors represent people of different sizes, so
3101  ** changing to an appearance that has a different actor can
3102  ** cause a pronounced change in character size.
3103  **
3104  ** Also, changing actors can take some time, as more internal
3105  ** character state needs to be updated to support the new size
3106  ** of the character.
3107  **
3108  *b Arguments:
3109  **
3110  *a appearance - name of new desired appearance
3111  *a allow_actor_change - pass 1 to allow the appearance change
3112  *a even if the actor changes, 0 to not
3113  **
3114  *b See Also:
3115  **
3116  ** get_current_appearance(), set_current_head_appearance()
3117  **
3118  *b Returns:
3119  **
3120  ** 0 on success, -1 on failure
3121  **
3122  *b Available as Decision Bead/Event
3123  */
3124  int set_current_appearance(const char* appearance,
3125  int allow_actor_change = 1);
3126 
3128  const char* get_current_appearance();
3129 
3130  /*l
3131  *b Description:
3132  **
3133  ** This function can be used to see if the current appearance
3134  ** has the passed name. This is primarily useful for decisions
3135  ** and other limited logic applications.
3136  **
3137  *b Returns:
3138  **
3139  ** 1 if current appearance has passed name; 0 if not
3140  **
3141  *b Available as Decision Bead/Event
3142  */
3143  int get_current_appearance_is(const char* appearance);
3144 
3145  /*l
3146  *b Description:
3147  **
3148  ** This function sets the head appearance of this character.
3149  ** This will persist past reseting the scenario, see set_appearance()
3150  ** for conceptual similarities.
3151  **
3152  *b Arguments:
3153  **
3154  *a head_appearance - name of the new desired head appearance
3155  **
3156  *b Returns:
3157  **
3158  ** 0 on success, -1 on failure
3159  */
3160  int set_head_appearance(const char* head_appearance);
3161 
3162  /*l
3163  *b Description:
3164  **
3165  ** This function sets the current head appearance of this character.
3166  ** On failure head appearance will be set to "default". see set_head_appearance()
3167  ** for more details
3168  **
3169  *b Available as Decision Bead/Event
3170  */
3171  int set_current_head_appearance(const char* head_appearance);
3172 
3174  const char* get_current_head_appearance();
3175 
3177  int get_num_compatible_head_appearances();
3179  const char* get_compatible_head_appearance_at_index(int index);
3180 
3182  int get_num_compatible_facefx_head_appearances();
3184  const char* get_compatible_facefx_head_appearance_at_index(int index);
3185 
3186 
3187  /*l
3188  *b Description:
3189  **
3190  ** Similar to get_current_appearance_is(), but for head appearance.
3191  **
3192  *b Returns:
3193  **
3194  ** 1 if current head appearance has passed name; 0 if not
3195  **
3196  *b Available as Decision Bead/Event
3197  */
3198  int get_current_head_appearance_is(const char* head_appearance);
3199 
3200 
3201  /*b Description:
3202  **
3203  ** This function sets the both base and current hand item appearance
3204  ** of this character. The base hand item is the one it will have upon
3205  ** reset.
3206  **
3207  *b Arguments:
3208  **
3209  *a hand_item_appearance -- name of the desired hand item or "default"
3210  **
3211  *b Returns:
3212  **
3213  ** 0 on success, -1 on failure
3214  **
3215  *b Available as Decision Bead/Event
3216  */
3217  int set_hand_item(const char* hand_item_appearance);
3218 
3219  /*l
3220  *b Returns:
3221  **
3222  ** Hand item appearance; see set_hand_item()
3223  **
3224  ** Might return "default"
3225  */
3226  const char* get_hand_item();
3227 
3228  /*b Description:
3229  **
3230  ** This function sets the current hand item appearance of this character.
3231  ** The base hand item will remain unaffected.
3232  **
3233  *b Arguments:
3234  **
3235  *a hand_item_appearance -- name of the desired hand item or "default"
3236  **
3237  *b Returns:
3238  **
3239  ** 0 on success, -1 on failure
3240  **
3241  *b Available as Decision Bead/Event
3242  */
3243  int set_current_hand_item(const char* hand_item_appearance);
3244 
3245  /*l
3246  *b Returns:
3247  **
3248  ** Current hand item appearance. Will be the actual appearance
3249  ** displayed, not "default"
3250  */
3251  const char* get_current_hand_item();
3252 
3253  /*l
3254  *b Returns:
3255  **
3256  ** generic catagory of the hand item appearance.
3257  */
3258  const char* get_current_hand_item_type();
3259 
3261  const char * get_actor();
3262 
3265  int add_equipment_appearance(const char* equipment_appearance);
3266 
3268  int reset_equipment_appearance(const char* class_type);
3269 
3271  int reset_equipment_appearance();
3272 
3274  int get_num_equipment();
3275 
3277  const char * get_equipment_name_at_index(int index);
3278 
3280  const char * get_equipment_type_at_index(int index);
3281 
3283  int get_equipment_index_at_index(int index);
3284 
3286  int add_equipment_by_index(int index);
3287 
3288  /*l
3289  *b Description:
3290  **
3291  ** Turns on texture modulation system that tries to make all characters look
3292  ** unique. Only supported by some appearances. See diguyGraphicsShape Texture Variation API
3293  ** for fine grained control of this feature
3294  */
3295  int set_use_texture_variations(int value);
3296 
3297  /*l
3298  *b Returns:
3299  ** If texture variations have been enabled for this character. Note: only some
3300  ** appearances support this feature
3301  */
3302  int get_use_texture_variations();
3303 
3305  int get_supports_texture_variations();
3306 
3309  int get_supports_weight_variations();
3310 
3314  void set_weight_scale( float weight );
3315 
3317  float get_weight_scale();
3318 
3322  int set_unit_name( const char* name, const char* personal_patch = NULL );
3323  const char* get_unit_name( int personal = 0 );
3325 
3329  int set_unit_index( int unit_index, int personal_index = -1 );
3330  int get_unit_index( int personal = 0 );
3332 
3336  int set_rank_name( const char* name );
3337  const char* get_rank_name();
3339 
3343  int set_rank_index( int index );
3344  int get_rank_index();
3346 
3349  int set_uniform_label_text( const char* name );
3350  const char* get_uniform_label_text();
3352 
3353  /*l
3354  *b Arguments:
3355  **
3356  *a appearance_type - a value indicating the type of supplementary appearance of concern,
3357  ** ie DIGUY_APPEARANCE_BODY, DIGUY_APPEARANCE_HEAD, DIGUY_APPEARANCE_EXPRESSIVE_HEAD,
3358  ** DIGUY_APPEARANCE_HAND_ITEM
3359  *b Returns:
3360  **
3361  ** The number of available supplementary appearances of given type
3362  */
3363  int get_num_appearances_of_type( diguyCharacterAppearanceTypes appearance_type );
3364 
3365  /*l
3366  *b Returns:
3367  **
3368  ** The name of the supplementary appearance (body, head, expressive head, hand item) or NULL
3369  **
3370  *b Arguments:
3371  **
3372  *a appearance_type - a value indicating the type of appearance of concern
3373  *a index - a value indicating the type of supplementary appearance of concern
3374  **
3375  */
3376  const char* get_appearance_name_at_index(diguyCharacterAppearanceTypes appearance_type, int index);
3377 
3378  /*****************************************************************************/
3401  /*l
3402  *b Description:
3403  **
3404  ** Sets the graphics level of detail (LOD) ranges for this character.
3405  ** Compare with diguyScenario::set_default_lod_ranges(), which sets
3406  ** the LOD ranges for newly created characters of a particular type.
3407  ** In both cases, ranges must be a static array of 8 floats,
3408  ** each larger than the one before.
3409  **
3410  ** This function sets graphics LOD ranges only. Motion levels of
3411  ** detail can be set by calling set_motion_lod().
3412  **
3413  *b Arguments:
3414  **
3415  *a lod_ranges - new lod ranges for this character;
3416  **
3417  ** See diguyScenario::set_default_lod_ranges() for a description
3418  ** of what to pass in lod_ranges.
3419  **
3420  *b Returns:
3421  **
3422  ** 0 on success, -1 on failure
3423  **
3424  *b Callable From:
3425  **
3426  *- - C++
3427  */
3428  int set_lod_ranges(float* lod_ranges);
3429 
3430 #ifdef CPLUSPLUS_ONLY
3431  float* get_lod_ranges();
3433 
3434 #endif
3435 
3437  int get_num_lods();
3438 
3439  /*l
3440  *b Description:
3441  **
3442  ** Set the desired graphics level of detail (LOD) for this character.
3443  ** This may be overridden if this character uses automatic LOD
3444  ** switching. See diguyScenario::set_automatic_graphics_lod_switching().
3445  **
3446  ** DI-Guy graphics LODs are numbered 1 (most detail) through 7 (least detail).
3447  **
3448  *b Arguments:
3449  **
3450  *a lod - an float between 1 and 7... fractional part represent percentage through the lod
3451  **
3452  *b Returns:
3453  **
3454  ** 0 on success, -1 on failure
3455  */
3456  int set_graphics_lod(float lod);
3457 
3459  int get_graphics_lod();
3460 
3462  float get_graphics_lod_fraction();
3463 
3466  int set_allow_instancing(int value);
3467 
3469  int get_allow_instancing() const;
3470 
3473  int get_is_instanced() const;
3474 
3475  // informs the internals that this character wasn't instanced, can cause an update if set_is_culled(0) is called
3476  void set_is_instanced(int val);
3477 
3479  int can_lod_be_instanced(int lod);
3480 
3481  /*l
3482  *b Description:
3483  **
3484  ** For scene graph renderers it can be necessary to patch the texture buffer object after
3485  ** the scene graph finishes updating various post processes (ground clamping for instance),
3486  ** or modifying the TBO with a local space camera.
3487  **
3488  ** This function allows the end user to pre-multiply the matrix in the TBO for each shape
3489  ** the character has. It requires diguyScenario::set_use_user_position_matrices() is called
3490  ** so that DI-Guy knows to keep track of TBO shape index data.
3491  */
3492  int set_final_tbo_position_matrix(int include_local_to_global_transform,
3493  float a0, float a1, float a2, float a3,
3494  float b0, float b1, float b2, float b3,
3495  float c0, float c1, float c2, float c3);
3496 
3497  /*l
3498  *b Description:
3499  **
3500  ** Set the desired shader level of detail (LOD) for this character.
3501  ** By default this is -1 and the shader is automatically picked by distance.
3502  **
3503  ** DI-Guy shaders LODs are numbered 1 (most quality) through the number of shaders in the
3504  ** current technique.
3505  **
3506  *b Arguments:
3507  **
3508  *a lod - an integer between 1 and the number of shaders in the current technique
3509  **
3510  *b Returns:
3511  **
3512  ** 0 on success, -1 on failure
3513  */
3514  int set_shader_lod(int lod);
3515 
3517  int get_shader_lod();
3518 
3521  int get_has_bump_maps();
3522 
3523  /*l
3524  *b Description:
3525  **
3526  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3527  ** multi-threaded pipeline for increasing performance.
3528  **
3529  ** Sets the motion level of detail (LOD) for this character.
3530  ** LOD 1 animates all joints of a character. Higher LODs
3531  ** animate fewer joints.
3532  **
3533  ** For LOD 6, *nothing* in the pose is updated. The character's
3534  ** pose will remain whatever it was the last time pose data
3535  ** was changed.
3536  **
3537  *a LOD - Effect
3538  *a 1 - animate all joints
3539  *a 2 - stop animating wrists and ankles
3540  *a 3 - stop animating elbows and knees
3541  *a 4 - stop animating everything but pelvis and position
3542  *a 5 - stop animating everything but position
3543  *a 6 - stop animating everything but position
3544  **
3545  ** Note that characters that are load managed
3546  ** (get_is_load_managed() returns 1) have this parameter managed
3547  ** automatically. The corresponding function for load managed
3548  ** characters is diguyLoadManager::set_zone_motion_lod().
3549  **
3550  *b Arguments:
3551  **
3552  *a motion_lod - an integer between 1 and 6
3553  **
3554  *b Returns:
3555  **
3556  ** 0 on success, -1 on failure
3557  */
3558  int set_motion_lod(int motion_lod);
3559 
3561  int get_motion_lod();
3562 
3564  int get_current_motion_lod();
3565 
3566  /*l
3567  *b Description:
3568  **
3569  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3570  ** multi-threaded pipeline for increasing performance.
3571  **
3572  ** This function sets the minimum CPL (character performance
3573  ** level) of the character.
3574  **
3575  ** A higher CPL will limit the types of operations that the character
3576  ** can perform, but will allow for more optimized update() calls.
3577  **
3578  ** The following CPL limitations are cumulative:
3579  **
3580  *- - CPL 1: all character function calls are available
3581  *- - CPL 2: the character cannot save history
3582  *- - CPL 3: no advanced pose operations that alter the basic pose
3583  *- of the character, including:
3584  *>
3585  *- - gazing
3586  *- - pointing
3587  *- - aiming
3588  *- - gestures
3589  *- - head nodding and shaking
3590  *- - pose overrides
3591  *- - features relying on link matrices
3592  *- - wheel rolling and turning on vehicles
3593  **
3594  ** Since link matrices are not computed, the DI-Guy Graphics API
3595  ** function diguyGraphicsLink::get_transformation_matrix() will
3596  ** not return valid results.
3597  *<
3598  *- - CPL 4: no blends between motions
3599  *- - CPL 5: (not currently implemented)
3600  **
3601  ** Note that characters that are load managed (get_is_load_managed()
3602  ** returns 1) have this parameter managed automatically. The
3603  ** corresponding function for load managed characters is
3604  ** diguyLoadManager::set_zone_minimum_cpl().
3605  **
3606  ** The passed minimum_cpl may not be achievable if the character
3607  ** is already in the process of doing something not allowed by the
3608  ** new CPL. For example, if the character is already gazing, trying
3609  ** to set the minimum CPL to 3 will fail, as CPL 3 would disable
3610  ** gazing. In this case the minimum CPL will be set to the current
3611  ** highest possible CPL based on what the character is already doing.
3612  ** In this example the minimum CPL would be set to 2, as gazing is
3613  ** allowed at that CPL.
3614  **
3615  ** Conversely, if the minimum CPL has been successfully been set to
3616  ** 3 or higher, any gaze calls such as diguyCharacter::gaze_at_point()
3617  ** will fail.
3618  **
3619  *b Arguments:
3620  **
3621  *a cpl - minimum CPL allowed for this character
3622  **
3623  *b Returns:
3624  **
3625  ** 0 on success, -1 on failure
3626  */
3627  int set_minimum_cpl(int minimum_cpl);
3628 
3630  int get_minimum_cpl();
3631 
3632  /*l
3633  *b Description:
3634  **
3635  ** This function returns that maximum possible CPL the character
3636  ** can attain based on what it is currently doing. Advanced pose
3637  ** operations like gazing and pose overrides will limit the maximum
3638  ** CPL that can be achieved.
3639  **
3640  ** See diguyCharacter::set_minimum_cpl() for a description of
3641  ** what is possible under the different CPL levels.
3642  **
3643  *b Returns:
3644  **
3645  ** maximum possible current CPL
3646  */
3647  int get_maximum_possible_current_cpl();
3648 
3649  /*l
3650  *b Description:
3651  **
3652  ** This function puts the character into the maximum possible CPL
3653  ** that can be achieved based on what the character is currently
3654  ** doing.
3655  **
3656  ** This current CPL does not prevent the character from starting
3657  ** operations that will potentially lower the CPL. e.g., if the
3658  ** character starts gazing, the CPL will potentially go down.
3659  ** Use set_minimum_cpl() to prevent that character from starting
3660  ** such operations.
3661  **
3662  ** See diguyCharacter::set_minimum_cpl() for a description of
3663  ** what is possible under the different CPL levels.
3664  **
3665  *b Returns:
3666  **
3667  ** 0 on success, -1 on failure
3668  */
3669  int maximize_current_cpl();
3670 
3671  /*l
3672  *b Description:
3673  **
3674  ** This function sets a flag that determines whether the character
3675  ** should raise and lower its CPL automatically. If automatic
3676  ** CPL switching is enabled then any time a potential CPL-changing
3677  ** operation is performed, the character will check the maximum
3678  ** possible current CPL (as per a call to maximize_current_cpl())
3679  ** and set its current CPL to the maximum possible.
3680  **
3681  *b Arguments:
3682  **
3683  *a enabled - pass 1 to enable automatic CPL switching, 0 to
3684  *a disable it
3685  **
3686  *b Returns:
3687  **
3688  ** 0 on success, -1 on failure
3689  */
3690  int set_automatic_cpl_switching_enabled(int enabled);
3691 
3693  int get_automatic_cpl_switching_enabled();
3694 
3695  /*l
3696  *b Description:
3697  **
3698  ** This function sets the current CPL of the character. Trying
3699  ** to set the CPL lower than the minimum (as set by
3700  ** set_minimum_cpl()) of higher than the maximum (as returned by
3701  ** get_maximum_possible_current_cpl()) will fail.
3702  **
3703  ** Note that characters that have automatic CPL switching enabled
3704  ** (get_automatic_cpl_switching_enabled() returns 1) will override
3705  ** this value.
3706  **
3707  ** See diguyCharacter::set_minimum_cpl() for a description of
3708  ** what is possible under the different CPL levels.
3709  **
3710  *b Arguments:
3711  **
3712  *a cpl - new current CPL
3713  **
3714  *b Returns:
3715  **
3716  ** 0 on success, -1 on failure
3717  */
3718  int set_current_cpl(int current_cpl);
3719 
3721  int get_current_cpl();
3722 
3723  /*l
3724  *b Description:
3725  **
3726  ** This function sets the position update rate of the character. If
3727  ** the character's position is not updated on a particular update
3728  ** tick, its position will not change for that tick. This can
3729  ** result is a modest performance increase.
3730  **
3731  ** The default value for new characters is 100.
3732  **
3733  ** This value may be overridden by the minimum full update period, as
3734  ** set by set_minimum_full_update_period().
3735  **
3736  ** Note that if the character's pose is updated, (see
3737  ** diguyCharacter::set_pose_update_rate()) its position will be
3738  ** updated as well.
3739  **
3740  ** Note that characters that are load managed
3741  ** (get_is_load_managed() returns 1) have this parameter managed
3742  ** automatically. The corresponding function for load managed
3743  ** characters is diguyLoadManager::set_zone_position_update_rate().
3744  **
3745  *b Arguments:
3746  **
3747  *a update_rate - percentage of scenario ticks for which
3748  *a position should update; can be between
3749  *a 1 and 100
3750  **
3751  ** Passing 100 means position will update every tick.
3752  ** Passing 50 means position will update every other tick.
3753  **
3754  *b Returns:
3755  **
3756  ** 0 on success, -1 on failure
3757  */
3758  int set_position_update_rate(int update_rate);
3759 
3761  int get_position_update_rate();
3762 
3763  /*l
3764  *b Description:
3765  **
3766  ** This function is very similar to set_position_update_rate(), but
3767  ** sets the percentage of ticks for which the character's pose is
3768  ** updated.
3769  **
3770  ** The default value for new characters is 100.
3771  **
3772  ** This value may be overridden by the minimum full update period,
3773  ** as set by set_minimum_full_update_period().
3774  **
3775  ** Note that if the character's pose is updated, its position will
3776  ** be updated as well.
3777  **
3778  ** Note that characters that are load managed (get_is_load_managed()
3779  ** returns 1) have this parameter managed automatically. The
3780  ** corresponding function for load managed characters is
3781  ** diguyLoadManager::set_zone_pose_update_rate().
3782  **
3783  *b Arguments:
3784  **
3785  *a update_rate - percentage of scenario ticks for which
3786  *a pose should update; can be between
3787  *a 1 and 100
3788  **
3789  ** Passing 100 means pose will update every tick.
3790  ** Passing 50 means pose will update every other tick.
3791  **
3792  *b Returns:
3793  **
3794  ** 0 on success, -1 on failure
3795  */
3796  int set_pose_update_rate(int update_rate);
3797 
3799  int get_pose_update_rate();
3800 
3801  /*l
3802  *b Description:
3803  **
3804  ** This function sets the minimum period for position or pose
3805  ** updates. If the passed amount of time passes with no position or
3806  ** pose update (see set_position_update_rate() and
3807  ** set_pose_update_rate()), the character's position and potentially
3808  ** pose will be updated.
3809  **
3810  ** Note that characters that are load managed (get_is_load_managed()
3811  ** returns 1) have this parameter managed automatically. The
3812  ** corresponding function for load managed characters is
3813  ** diguyLoadManager::set_minimum_full_update_period().
3814  **
3815  ** The default for new characters is 1.0 seconds.
3816  **
3817  *b Arguments:
3818  **
3819  *a min_period - in seconds
3820  **
3821  *b Returns:
3822  **
3823  ** 0 on success, -1 on failure
3824  */
3825  int set_minimum_full_update_period(float min_period);
3826 
3828  float get_minimum_full_update_period();
3829 
3830  /*l
3831  *b Description:
3832  **
3833  ** This function disables position accumulation due to played
3834  ** actions. The character will stay in whatever position has most
3835  ** recently been set by set_position(), regardless of action.
3836  ** Because of this the character will, for example, walk in place.
3837  ** It is up to the user application to correctly set and update the
3838  ** character's position.
3839  **
3840  ** This function can be used when a host application provides
3841  ** absolute control over character positions.
3842  **
3843  ** Disabling position accumulation will result in a modest
3844  ** performance increase.
3845  **
3846  *b Arguments:
3847  **
3848  *a disabled_flag - pass 1 to disable position accumulation, 0
3849  *a to enable it
3850  **
3851  *b Returns:
3852  **
3853  ** 0 on success, -1 on failure
3854  */
3855  int set_position_accumulation_disabled(int disabled_flag);
3856 
3858  int get_position_accumulation_disabled();
3859 
3860  /*l
3861  *b Description:
3862  **
3863  ** This function disables all blends between motions of the
3864  ** character. This will speed up performance at the expense of
3865  ** visual quality of the motions. If the character is far from the
3866  ** current camera position, however, the lack of blends may be
3867  ** visually acceptable.
3868  **
3869  ** Note that characters that are load managed (get_is_load_managed()
3870  ** returns 1) have this parameter managed automatically.
3871  **
3872  *b Arguments:
3873  **
3874  *a disabled_flag - pass 1 to disable all blends, 0
3875  *a to enable them
3876  **
3877  *b Returns:
3878  **
3879  ** 0 on success, -1 on failure
3880  */
3881  int set_all_blends_disabled(int disabled_flag);
3882 
3884  int get_all_blends_disabled();
3885 
3886 
3887  /*l
3888  *b Description:
3889  **
3890  *b Note: This function is not recommended. There is minimal perf gain.
3891  ** This function disables all shape callbacks. Shape callbacks are
3892  ** used internally for updating some advanced visual effects.
3893  **
3894  ** Shape callbacks currently control:
3895  **
3896  *- - expressive faces
3897  *- - particle systems
3898  **
3899  ** Disabling shape callbacks will make these visual effects work
3900  ** incorrectly but will result in a performance increase for
3901  ** characters that do not use them.
3902  **
3903  ** Note that characters that are load managed (get_is_load_managed()
3904  ** returns 1) have this parameter managed automatically.
3905  **
3906  *b Arguments:
3907  **
3908  *a disabled_flag - pass 1 to disable shape callbacks, 0
3909  *a to enable them
3910  **
3911  *b Returns:
3912  **
3913  ** 0 on success, -1 on failure
3914  */
3915  int set_shape_callbacks_disabled(int disabled_flag);
3916 
3918  int get_shape_callbacks_disabled();
3919 
3920  /*l
3921  *b Description:
3922  **
3923  *b Note: This function is not recommend. There is minimal perf gain.
3924  ** This function disables all calls to the virtual diguyGraphicsShape::update()
3925  ** function.
3926  **
3927  ** Note that characters that are load managed (get_is_load_managed()
3928  ** returns 1) have this parameter managed automatically.
3929  **
3930  *b Arguments:
3931  **
3932  *a disabled_flag - pass 1 to disable update calls, 0
3933  *a to enable them
3934  **
3935  *b Returns:
3936  **
3937  ** 0 on success, -1 on failure
3938  */
3939  int set_graphics_api_shape_update_disabled(int disabled_flag);
3940 
3942  int get_graphics_api_shape_update_disabled();
3943 
3944  /*l
3945  *b Description:
3946  **
3947  ** This function is a stripped-down version of the normal update()
3948  ** function. This function is for high performance applications that
3949  ** are willing to sacrifice advanced character functionality in
3950  ** exchange for faster performance.
3951  **
3952  ** Characters using optimized_update() must not do any of the
3953  ** following:
3954  **
3955  *- - change character types (e.g., set_character_type())
3956  *- - play sounds (e.g., play_sound())
3957  *- - use history (e.g., set_history_type())
3958  *- - use paths (e.g., push_path())
3959  *- - weapon firing (e.g., fire_weapon())
3960  *- - advanced pose operations (as per CPL 3)
3961  *- - be a DI-Guy Network Module character
3962  *- - need to use character callbacks
3963  *- - use advanced visual effects, such as expressive faces and particle systems
3964  **
3965  ** Like update(), the scenario must not call the character's update()
3966  ** function (return value of get_t_controlled_by_scenario_t() is 0)
3967  ** for this function to work properly.
3968  **
3969  ** In some cases the regular update() call can be used for a time in
3970  ** place of optimized_update() if one of the above operations is
3971  ** desired.
3972  **
3973  *b Arguments:
3974  **
3975  *a t - new time for the character
3976  **
3977  *b Returns:
3978  **
3979  ** 0 on success, -1 on failure
3980  */
3981  int optimized_update(float t);
3982 
3983  /*l
3984  *b Description:
3985  **
3986  ** This function sets whether many of the performance tuning
3987  ** functions above are automatically managed by a diguyLoadManager
3988  ** object, which can be obtained by calling
3989  ** diguyApp::create_load_manager().
3990  **
3991  ** Note that this function will have no effect if the load manager has
3992  ** not been enabled.
3993  **
3994  ** The default for new characters is to be load managed if the load
3995  ** manager has been enabled.
3996  **
3997  *b Arguments:
3998  **
3999  *a is_load_managed - pass 1 to have character automatically
4000  *a load managed, 0 for manual management
4001  **
4002  *b Returns:
4003  **
4004  ** 0 on success, -1 on failure
4005  */
4006  int set_is_load_managed(int is_load_managed);
4007 
4009  int get_is_load_managed();
4010 
4013  void get_load_manager_current_update_rates(float & zone, int & pose_update_rate,
4014  int & position_update_rate, int & alt_update_rate);
4015 
4016 /*****************************************************************************/
4022  /*l
4023  *b Description:
4024  **
4025  ** This is an enumeration of the different callbacks that can be
4026  ** registered with add_callback() and add_callback_script().
4027  **
4028  ** Callbacks return a value of type diguyCallbackReturn, which will
4029  ** be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the
4030  ** callback returns DIGUY_CALLBACK_STOP, in some cases the default
4031  ** handler of the function will not be called; the callback is
4032  ** asserting that it has done everything necessary for the function
4033  ** call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default
4034  ** handler for the function will be called after the callback.
4035  **
4036  *b Usable From:
4037  **
4038  *- - C++
4039  *- - Script
4040  **
4041  *************************************************************************
4042  *4 Callback Enums:
4043  **
4044  *i CALLBACK_ID_CREATE
4045  **
4046  ** This callback will be called when a new character is created,
4047  ** *after* the character is fully initialized.
4048  **
4049  ** Note that this callback can only be added by calling
4050  ** diguyScenario::add_default_character_callback(); adding it with
4051  ** diguyCharacter::add_callback() will have no effect, as by that
4052  ** time the character has already been created.
4053  **
4054  *i CALLBACK_ID_DESTROY
4055  **
4056  ** This callback will be called when a character is
4057  ** destroyed.
4058  **
4059  *i CALLBACK_ID_PRE_CREATE
4060  **
4061  ** Like CALLBACK_ID_CREATE, this callback will be called when a
4062  ** new character is created; however, it is called *before* the
4063  ** character is fully initialized.
4064  **
4065  *b NOTE: Care must be taken when using this callback!
4066  ** As mentioned above, the character is not fully initialized,
4067  ** meaning that most member functions of the diguyCharacter object
4068  ** should not be called. Those member functions that are safe
4069  ** to call will be mentioned in the documentation for the function;
4070  ** e.g., set_graphics_api_node_ptr().
4071  **
4072  ** Note that this callback can only be added by calling
4073  ** diguyScenario::add_default_character_callback(); adding it
4074  ** with diguyCharacter::add_callback() will have no effect, as
4075  ** by that time the character has already been created.
4076  **
4077  *i CALLBACK_ID_CURRENT_APPEARANCE_CHANGED
4078  **
4079  ** This callback will be called when a character's current
4080  ** appearance is changed.
4081  **
4082  *i CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED
4083  **
4084  ** This callback will be called when a character's current head
4085  ** appearance is changed.
4086  **
4087  *i CALLBACK_ID_PRE_UPDATE
4088  **
4089  ** This callback will be called before the character is updated as
4090  ** a result of the diguyScenario::update() function.
4091  **
4092  *i CALLBACK_ID_POST_UPDATE
4093  **
4094  ** This callback will be called after the character is updated as a
4095  ** result of the diguyScenario::update() function.
4096  **
4097  *i CALLBACK_ID_DONE_SPEAKING
4098  **
4099  ** This callback will be called when the character has finished
4100  ** speaking the contents of a speak() function call.
4101  **
4102  *i CALLBACK_ID_GAZE_STATUS
4103  **
4104  ** This callback will be called after the character's gaze has
4105  ** experienced a status change.
4106  **
4107  *i CALLBACK_ID_LPOINT_STATUS
4108  **
4109  ** This callback will be called after the character's lpoint (left
4110  ** arm pointing) has experienced a status change.
4111  **
4112  *i CALLBACK_ID_SHOW
4113  **
4114  ** This callback will be called when the character is being shown
4115  ** for any reason.
4116  **
4117  *i CALLBACK_ID_HIDE
4118  **
4119  ** This callback will be called when the character is being hidden
4120  ** for any reason.
4121  **
4122  *i CALLBACK_ID_PRE_DIE
4123  **
4124  ** This callback will be called when the character has been told to
4125  ** die, before a die action has been selected and initiated.
4126  **
4127  ** If the returned diguyCallbackReturn value is
4128  ** DIGUY_CALLBACK_STOP, the character will not die.
4129  **
4130  *i CALLBACK_ID_POST_DIE
4131  **
4132  ** This callback will be called when the character has been told to
4133  ** die, after a die action has been selected and initiated.
4134  **
4135  *i CALLBACK_ID_PRE_FIRE_WEAPON
4136  **
4137  ** This callback will be called when the character has been told to
4138  ** fire its weapon, before a final decision has been made to fire.
4139  **
4140  ** If the returned diguyCallbackReturn value is
4141  ** DIGUY_CALLBACK_STOP, the character will not fire.
4142  **
4143  *i CALLBACK_ID_IMPACT
4144  **
4145  ** This callback will be called when the character has been hit.
4146  ** diguyCharacter::get_last_impact_record() contains a pointer to
4147  ** the impact information. If a character has this callback the
4148  ** standard behavior (killing the character) is skipped and the
4149  ** system assumes the end user has handled the impact.
4150  **
4151  ** Similar behavior results if
4152  ** diguyCrowd::CALLBACK_ID_CROWD_MEMBER_IMPACT is registered.
4153  **
4154  *i CALLBACK_ID_POST_FIRE_WEAPON
4155  **
4156  ** This callback will be called when the character has been told to
4157  ** fire its weapon, after a final decision has been made to fire.
4158  **
4159  *i CALLBACK_ID_CURRENT_ARC_CHANGED
4160  **
4161  ** This callback will be called whenever the character's current
4162  ** motion arc changes, typically after a call to set_desired_action()
4163  ** or force_action(), or when transitioning to the next motion arc.
4164  **
4165  *i CALLBACK_ID_CURRENT_ACTION_CHANGED
4166  **
4167  ** This callback will be called whenever the character's current
4168  ** action changes, typically after a call to set_desired_action()
4169  ** or force_action().
4170  **
4171  *i CALLBACK_ID_DESIRED_ACTION_CHANGED
4172  **
4173  ** This callback will be called whenever the character's desired
4174  ** action changes, typically after a call to set_desired_action().
4175  **
4176  *i CALLBACK_ID_DESIRED_ACTION_REACHED
4177  **
4178  ** This callback will be called when the character reaches its
4179  ** desired action as set by a call to set_desired_action().
4180  **
4181  *i CALLBACK_ID_MANUALLY_INVOKED
4182  **
4183  ** This callback id will be supplied to event handlers invoked by a
4184  ** call to manually_invoke_event_handler().
4185  **
4186  *i CALLBACK_ID_USER_SELECTED
4187  **
4188  ** This callback will be called when the character is selected in DI-Guy Scenario.
4189  **
4190  *i CALLBACK_ID_USER_UNSELECTED
4191  **
4192  ** This callback will be called on a currently selected character when a different
4193  ** character is selected in DI-Guy Scenario.
4194  **
4195  *i CALLBACK_ID_IGUY_INTERACT
4196  **
4197  ** This callback will be called when the character has been clicked
4198  ** on while DI-Guy Scenario is in I-Guy Input Mode. Note that this
4199  ** is called on the character clicked, not the I-Guy character.
4200  **
4201  *i CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT
4202  **
4203  ** This callback will be called when the character, as the I-Guy
4204  ** character, has clicked another character in I-Guy Input Mode.
4205  ** Note that this is called for the I-Guy character, not the
4206  ** clicked character.
4207  **
4208  *i CALLBACK_ID_GUIDE_POSITION_ACQUIRED
4209  **
4210  ** This callback will be called when the character has reached its
4211  ** desired position as set by set_desired_position(). The
4212  ** diguyCharacterGuide is responsible for moving the character towards
4213  ** this position.
4214  **
4215  *i CALLBACK_ID_GUIDE_POSITION_UNACQUIRED
4216  **
4217  ** This callback will be called if the character moves too far away
4218  ** from its desired position after it has been previously reached.
4219  **
4220  *i CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED
4221  **
4222  ** This callback will be called when the character has reached its
4223  ** desired orientation as set by set_desired_orientation(). The
4224  ** diguyCharacterGuide is responsible for moving the character towards
4225  ** this orientation.
4226  **
4227  *i CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED
4228  **
4229  ** This callback will be called if the character turns too far away
4230  ** from its desired orientation after it has been previously
4231  ** reached.
4232  **
4233  *i CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED
4234  **
4235  ** This callback will be called when the character has reached its
4236  ** desired altitude as set by set_desired_orientation() or other functions.
4237  ** The callback is most meaningful for vehicles that need to achieve
4238  ** some sort "cruising altitude" while moving to a destination.
4239  **
4240  *i CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED
4241  **
4242  ** This callback will be called if the character turns too far away
4243  ** from its desired orientation after it has been previously
4244  ** reached.
4245  **
4246  *i CALLBACK_ID_GUIDE_TARGET_LOST
4247  **
4248  ** This callback will be called when the character guide has determined
4249  ** that the character can't reach its desired position/orientation. An
4250  ** example would be a missile that has flown past its target
4251  **
4252  *i CALLBACK_ID_CURRENT_TOUT_REACHED
4253  **
4254  ** This callback will be called when scenario time reaches this
4255  ** character's tout time as set by set_current_tout().
4256  **
4257  *i CALLBACK_ID_POST_CREATE_GEOMETRY
4258  **
4259  ** This callback will be called just after the character's geometry
4260  ** has been created.
4261  **
4262  *i CALLBACK_ID_PRE_DESTROY_GEOMETRY
4263  **
4264  ** This callback will be called just before the character's
4265  ** geometry is broken down and destroyed.
4266  **
4267  *i CALLBACK_ID_END_OF_PATH_REACHED
4268  **
4269  ** This callback will be called when a character reaches the end of
4270  ** their current path. Note the path must finish, forcing to other
4271  ** paths will not trigger this callback.
4272  **
4273  **
4274  *************************************************************************
4275  *4 DI-Guy Scenario UI Callback enums:
4276  **
4277  *i CALLBACK_ID_UI_PRE_TRANSLATION
4278  **
4279  ** This callback will be called when the user interface starts
4280  ** moving a character.
4281  **
4282  *i CALLBACK_ID_UI_POST_TRANSLATION
4283  **
4284  ** This callback will be called when the user interface finishes
4285  ** moving a character.
4286  **
4287  *i CALLBACK_ID_UI_MOUSE_DOWN
4288  **
4289  ** This callback will be called when the user interface gets a
4290  ** mouse click in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT input
4291  ** mode.
4292  **
4293  *i CALLBACK_ID_UI_MOUSE_UP
4294  **
4295  ** This callback will be called when the user interface gets a
4296  ** mouse release in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT
4297  ** input mode.
4298  **
4299  *************************************************************************
4300  *4 DI-Guy AI Agent Callback enums:
4301  **
4302  *i CALLBACK_ID_AGENT_NEW_BEHAVIOR
4303  **
4304  ** This callback will be called when an agent changes its current
4305  ** behavior.
4306  **
4307  *i CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER
4308  **
4309  ** This callback will be called when an agent changes its current
4310  ** focus character; this happens most frequently when it is focused
4311  ** on a group.
4312  **
4313  *i CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS
4314  **
4315  ** This callback will be called when an agent in attack behavior
4316  ** evaluates the group it's focused on and cannot find an
4317  ** appropriate target. This can happen if all group members are
4318  ** dead.
4319  **
4320  *i CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS
4321  **
4322  ** This callback will be called when an agent in attack behavior
4323  ** can't see any potential members of the group it's focused on.
4324  **
4325  *i CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED
4326  **
4327  ** This callback will be called when an agent in pursue behavior
4328  ** has come within the pursuit distance of its pursuit target.
4329  **
4330  *i CALLBACK_ID_AGENT_PURSUE_TARGET_LOST
4331  **
4332  ** This callback will be called when an agent in pursue behavior
4333  ** is no longer within the pursuit distance of its pursuit target.
4334  **
4335  *i CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED
4336  **
4337  ** This callback will be called when an agent in mingle behavior
4338  ** has reached its mingle target.
4339  **
4340  *i CALLBACK_ID_AGENT_MINGLE_TARGET_LOST
4341  **
4342  ** This callback will be called when an agent in mingle behavior
4343  ** is no longer is range of its mingle target.
4344  **
4345  *i CALLBACK_ID_AGENT_WANDER_TARGET_REACHED
4346  **
4347  ** This callback will be called when an agent in wander behavior
4348  ** has reached its wander target.
4349  **
4350  *i CALLBACK_ID_AGENT_WANDER_TARGET_LOST
4351  **
4352  ** This callback will be called when an agent in wander behavior
4353  ** is no longer is range of its wander target.
4354  **
4355  *i CALLBACK_ID_AGENT_FLEE_AREA_LEFT
4356  **
4357  ** This callback will be called when an agent in flee behavior has
4358  ** successfully moved out range of all fled characters or
4359  ** locations. This will only be called when the agent is
4360  ** transitioning from inside the flee area to outside of it.
4361  **
4362  *i CALLBACK_ID_AGENT_FLEE_AREA_ENTERED
4363  **
4364  ** This callback will be called when an agent in flee behavior has
4365  ** moved inside of the range of any fled characters or locations.
4366  ** This will only be called when the agent is transitioning from
4367  ** outside the flee area to inside of it.
4368  **
4369  *i CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED
4370  **
4371  ** This callback will be called when an agent in travel behavior
4372  ** has reached in intermediate waypoint and is about to move
4373  ** on to the next.
4374  **
4375  *i CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
4376  **
4377  ** This callback will be called when an agent in travel behavior
4378  ** has reached the end of its travel path when moving forward
4379  ** along the path.
4380  **
4381  *i CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED
4382  **
4383  ** This callback will be called when an agent in travel behavior
4384  ** has reached the beginning of its travel path when moving
4385  ** backward along the path.
4386  **
4387  *i CALLBACK_ID_AGENT_TRAVEL_NEAR_FORWARD_DEST
4388  **
4389  ** This callback will be called when an agent gets within a specified
4390  ** distance of the end of the travel path
4391  **
4392  *i CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED
4393  **
4394  ** This callback will be called when fellow member of the crowd is
4395  ** killed.
4396  **
4397  *- - This is the character version of
4398  *- diguyCrowd::CALLBACK_ID_CROWD_MEMBER_KILLED
4399  *- - The crowd's callback character is the crowd member that was
4400  *- killed.
4401  *- - The crowd's callback impact contains the impact information.
4402  **
4403  *i CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT
4404  **
4405  ** This callback will be called when a fellow member of the crowd
4406  ** is hit by a detonation. This callback does not replace
4407  ** diguyCharacter::CALLBACK_ID_IMPACT, which still needs to be
4408  ** handled to implement damage models.
4409  **
4410  *- - The crowd's callback character is the crowd member that was
4411  *- hit.
4412  *- - The crowd's callback impact contains the impact information.
4413  **
4414  *i CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT
4415  **
4416  ** This callback will be called when a detonation occurs within the
4417  ** awareness radius (as set by set_awareness_radius()) of the
4418  ** crowd's current bounds.
4419  **
4420  *- - This is the character version of
4421  *- diguyCrowd::CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT
4422  *- - The crowd's callback character is the character that caused
4423  *- the detonation.
4424  *- - The crowd's callback impact contains the impact information.
4425  **
4426  *i CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED
4427  **
4428  ** This callback will be called when a weapon is fired within the
4429  ** awareness radius (as set by set_awareness_radius()) of the
4430  ** crowd's current bounds.
4431  **
4432  *- - The crowd's callback character is the character that fired the
4433  *- weapon.
4434  **
4435  *i CALLBACK_ID_AGENT_VEHICLE_COLLISION
4436  **
4437  ** This callback will be called on a vehicle agent when it hits a
4438  ** member of a companion crowd.
4439  **
4440  *i CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION
4441  **
4442  ** This callback will be called on a vehicle agent when it
4443  ** approaches another vehicle.
4444  **
4445  *i CALLBACK_ID_AGENT_NON_ZERO_REPULSION
4446  **
4447  ** This callback will be called when an agent character's repulsion
4448  ** forces become non-zero.
4449  **
4450  *i CALLBACK_ID_AGENT_ZERO_REPULSION
4451  **
4452  ** This callback will be called when an agent character's repulsion
4453  ** forces become zero.
4454  **
4455  *i CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED
4456  **
4457  ** This callback will be called when a character who's requested a
4458  ** path plan via the background path planner
4459  ** (agent_move_to_point_bg) gets a path result. Call
4460  ** diguyCharacter::get_path_planning_result() to get the status of
4461  ** the result.
4462  **
4463  *i CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED
4464  **
4465  ** This callback will be called when the current state the agent's
4466  ** mind, if it has one, has changed. Call
4467  ** diguyCharacter::get_mind_current_state_name() to get the new
4468  ** state name.
4469  */
4470  enum {
4471  CALLBACK_ID_CREATE = 1,
4472  CALLBACK_ID_DESTROY,
4473  CALLBACK_ID_PRE_CREATE,
4474  CALLBACK_ID_CURRENT_APPEARANCE_CHANGED,
4475  CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED,
4476  CALLBACK_ID_CURRENT_HAND_ITEM_APPEARANCE_CHANGED,
4477  CALLBACK_ID_CURRENT_EQUIPMENT_APPEARANCE_CHANGED,
4478  CALLBACK_ID_SHAPE_VARIATIONS_CHANGED,
4479  CALLBACK_ID_SHAPE_VISIBILITY_CHANGED,
4480  CALLBACK_ID_PRE_UPDATE,
4481  CALLBACK_ID_POST_UPDATE,
4482  CALLBACK_ID_DONE_SPEAKING,
4483  CALLBACK_ID_GAZE_STATUS,
4484  CALLBACK_ID_LPOINT_STATUS,
4485  CALLBACK_ID_SHOW,
4486  CALLBACK_ID_HIDE,
4487  CALLBACK_ID_PRE_DIE,
4488  CALLBACK_ID_POST_DIE,
4489  CALLBACK_ID_PRE_FIRE_WEAPON,
4490  CALLBACK_ID_POST_FIRE_WEAPON,
4491  CALLBACK_ID_IMPACT,
4492  CALLBACK_ID_FIRE_WEAPON_SUCCESS,
4493  CALLBACK_ID_CURRENT_ARC_CHANGED,
4494  CALLBACK_ID_CURRENT_ACTION_CHANGED,
4495  CALLBACK_ID_DESIRED_ACTION_CHANGED,
4496  CALLBACK_ID_DESIRED_ACTION_REACHED,
4497  CALLBACK_ID_MANUALLY_INVOKED,
4498  CALLBACK_ID_USER_SELECTED,
4499  CALLBACK_ID_USER_UNSELECTED,
4500  CALLBACK_ID_IGUY_INTERACT,
4501  CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT,
4502  CALLBACK_ID_GUIDE_POSITION_ACQUIRED,
4503  CALLBACK_ID_GUIDE_POSITION_UNACQUIRED,
4504  CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED,
4505  CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED,
4506  CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED,
4507  CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED,
4508  CALLBACK_ID_GUIDE_TARGET_LOST,
4509  CALLBACK_ID_CURRENT_TOUT_REACHED,
4510  CALLBACK_ID_POST_CREATE_GEOMETRY,
4511  CALLBACK_ID_PRE_DESTROY_GEOMETRY,
4512  CALLBACK_ID_END_OF_PATH_REACHED,
4513  CALLBACK_ID_CHARACTER_CLICKED,
4514 
4515  // DI-Guy Scenario UI callbacks:
4516  CALLBACK_ID_UI_PRE_TRANSLATION,
4517  CALLBACK_ID_UI_POST_TRANSLATION,
4518  CALLBACK_ID_UI_MOUSE_DOWN,
4519  CALLBACK_ID_UI_MOUSE_UP,
4520  CALLBACK_ID_UI_RIGHT_MOUSE_DOWN,
4521  CALLBACK_ID_UI_RIGHT_MOUSE_UP,
4522  CALLBACK_ID_UI_LEFT_CLICK,
4523  CALLBACK_ID_UI_RIGHT_CLICK,
4524  CALLBACK_ID_UI_DOUBLE_CLICK,
4525  CALLBACK_ID_UI_MIDDLE_CLICK,
4526  CALLBACK_ID_UI_SCROLL_UP,
4527  CALLBACK_ID_UI_SCROLL_DOWN,
4528  //CALLBACK_ID_UI_DRAG,
4529 
4530  // DI-Guy AI agent callbacks:
4531  CALLBACK_ID_AGENT_NEW_BEHAVIOR,
4532  CALLBACK_ID_AGENT_NEW_PATH_SHAPE,
4533  CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER,
4534  CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS,
4535  CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS,
4536  CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED,
4537  CALLBACK_ID_AGENT_PURSUE_TARGET_LOST,
4538  CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED,
4539  CALLBACK_ID_AGENT_MINGLE_TARGET_LOST,
4540  CALLBACK_ID_AGENT_WANDER_TARGET_REACHED,
4541  CALLBACK_ID_AGENT_WANDER_TARGET_LOST,
4542  CALLBACK_ID_AGENT_FLEE_AREA_LEFT,
4543  CALLBACK_ID_AGENT_FLEE_AREA_ENTERED,
4544  CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED,
4545  CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED,
4546  CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED,
4547  CALLBACK_ID_AGENT_TRAVEL_NEAR_FORWARD_DEST,
4548  CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED,
4549  CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT,
4550  CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT,
4551  CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED,
4552  CALLBACK_ID_AGENT_VEHICLE_COLLISION,
4553  CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION,
4554  CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED,
4555  CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED,
4556  CALLBACK_ID_AGENT_NON_ZERO_REPULSION,
4557  CALLBACK_ID_AGENT_ZERO_REPULSION
4558  };
4559 
4560 #ifdef CPLUSPLUS_ONLY
4561 /*****************************************************************************/
4567  /*l
4568  *b Description:
4569  **
4570  ** This function adds a user callback. Callbacks can be removed
4571  ** with remove_callback() or remove_callback_with_user_data().
4572  **
4573  *b Arguments:
4574  **
4575  *a callback - pointer to function with prototype
4576  *a diguyCharacterCallback (typedefed above)
4577  *a callback_id - integer id of when this callback is to be called
4578  *a callback_params - not currently used; pass NULL
4579  *a callback_user_data - pointer for user's own use; DI-Guy will
4580  *a do nothing to the contents of this pointer
4581  *a beyond passing it back when the callback is
4582  *a invoked
4583  **
4584  *b Returns:
4585  **
4586  ** 0 on success, -1 on failure
4587  */
4588  int add_callback(int callback_id,
4589  diguyCharacterCallback* callback,
4590  void* callback_params = 0,
4591  void* callback_user_data = 0);
4592 
4593  /*l
4594  *b Description:
4595  **
4596  ** This function removes a user callback. All callbacks matching
4597  ** the specified callback_id and callback function will be removed.
4598  **
4599  *b Arguments:
4600  **
4601  *a callback_id - integer id of when this callback is to be called
4602  *a callback - pointer to function with prototype
4603  *a diguyCharacterCallback (typedefed above)
4604  **
4605  *b Returns:
4606  **
4607  ** 0 on success, -1 on failure
4608  */
4609  int remove_callback(int callback_id,
4610  diguyCharacterCallback* callback);
4611 
4612  /*l
4613  *b Description:
4614  **
4615  ** This function removes a user callback. All callbacks matching
4616  ** the specified callback_id and callback_user_data pointer will
4617  ** be removed.
4618  **
4619  *b Arguments:
4620  **
4621  *a callback_id - integer id of when this callback is to be
4622  *a called
4623  *a callback_user_data - pointer for user's own use
4624  **
4625  *b Returns:
4626  **
4627  ** 0 on success, -1 on failure
4628  */
4629  int remove_callback_with_user_data(int callback_id,
4630  void* callback_user_data);
4631 
4632 #endif
4633 /*****************************************************************************/
4639  /*l
4640  *b Description:
4641  **
4642  ** This function adds a user callback script. Callback scripts can
4643  ** be removed with remove_callback_script().
4644  **
4645  *b Arguments:
4646  **
4647  *a callback_id - integer id of the callback
4648  *a callback_script - script text of callback to be added
4649  *a callback_script_type - the type of script contained in
4650  *a callback_script
4651  **
4652  ** If NULL is passed for callback_script_type, a default script type
4653  ** will be derived based on the default script interpreter of the
4654  ** scenario.
4655  **
4656  *i lua specific:
4657  **
4658  ** When the script is called, the object for which it is being called
4659  ** will be in the callback_object global.
4660  **
4661  ** To pass NULL when calling from a lua script, use nil.
4662  **
4663  *b Returns:
4664  **
4665  ** 0 on success, -1 on failure
4666  **
4667  *b Lua Example:
4668  **
4669  *e -------------------------------------------------------------------
4670  *e local pre_fire_weapon_callback = [[
4671  *e
4672  *e local ch_name = callback_object:get_name();
4673  *e bdi_log_print(BDI_LOG_WARN, "Calling pre_fire_weapon_callback for character ".. ch_name .. ".\n");
4674  *e
4675  *e ]]
4676  *e -------------------------------------------------------------------
4677  *e
4678  *e character:add_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4679  *e pre_fire_weapon_callback,
4680  *e "lua");
4681  */
4682  int add_callback_script(int callback_id,
4683  const char* callback_script,
4684  const char* callback_script_type = NULL);
4685 
4686  /*l
4687  *b Description:
4688  **
4689  ** This function removes a user callback script previously added with
4690  ** add_callback_script().
4691  **
4692  *b Arguments:
4693  **
4694  *a callback_id - integer id of the callback
4695  *a callback_script - script text of callback previously added
4696  *a callback_script_type - the type of script contained in
4697  *a callback_script
4698  **
4699  ** If NULL is passed for callback_script, all callback
4700  ** scripts whose ids match callback_id and whose types match
4701  ** callback_script_type will be removed.
4702  **
4703  ** If NULL is passed for callback_script_type, a default script type
4704  ** will be derived based on the default script interpreter of the
4705  ** scenario.
4706  **
4707  *i lua specific:
4708  **
4709  ** To pass NULL when calling from a lua script, use nil.
4710  **
4711  *b Returns:
4712  **
4713  ** 0 on success, -1 on failure
4714  **
4715  *b lua Example:
4716  **
4717  *e #
4718  *e # Remove all callback scripts with id
4719  *e # diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON
4720  *e #
4721  *e character:remove_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4722  *e nil,
4723  *e "lua");
4724  */
4725  int remove_callback_script(int callback_id,
4726  const char* callback_script,
4727  const char* callback_script_type = NULL);
4728 
4729 
4730 /*****************************************************************************/
4740  /*l
4741  *b Description:
4742  **
4743  ** This function maps the event handler with the given name
4744  ** to a callback id. This mapping will be saved in the .dss
4745  ** file and restored when the .dss file is loaded.
4746  **
4747  ** Mappings can also be made via the DI-Guy Scenario UI.
4748  **
4749  ** The event handler is one of the following:
4750  **
4751  *- - a character callback function registered by
4752  *- diguyScenario::register_character_event_handler() or
4753  *- diguyScenario::register_character_event_handler_from_library()
4754  *- - a script registered by
4755  *- diguyScenario::register_character_event_handler_script()
4756  *- - a Script, Decision, or Library Function in the scenario
4757  *- whose "Event Type" is "Character"
4758  **
4759  *b Arguments:
4760  **
4761  *a callback_id - integer id of callback
4762  *a handler_name - name of the event handler to map
4763  **
4764  *b Returns:
4765  **
4766  ** 0 on success, -1 on failure
4767  */
4768  int map_event_handler_to_callback_id(int callback_id,
4769  const char* handler_name);
4770 
4771  /*l
4772  *b Description:
4773  **
4774  ** This function unmaps the event handler with the given name
4775  ** from a callback id.
4776  **
4777  *b Arguments:
4778  **
4779  *a callback_id - integer id of callback
4780  *a handler_name - name of the event handler to unmap
4781  *a unmap_all_matches - pass 0 to unmap only the first match,
4782  *a pass 1 to unmap all matches
4783  **
4784  *b Returns:
4785  **
4786  ** 0 on success, -1 on failure
4787  */
4788  int unmap_event_handler_from_callback_id(int callback_id,
4789  const char* handler_name,
4790  int unmap_all_matches = 0);
4791 
4792  /*l
4793  *b Description:
4794  **
4795  ** This function manually invokes the named character event
4796  ** handler. The callback_id that will be passed to the event
4797  ** handler will be CALLBACK_ID_MANUALLY_INVOKED.
4798  **
4799  ** See diguyCharacter::map_event_handler_to_callback_id() for
4800  ** a description of what comprises a character event handler.
4801  **
4802  ** Note that care should be taken not to end up in an
4803  ** infinite loop of event calls. In general an event handler
4804  ** should not end up directly or indirectly invoking itself.
4805  **
4806  *b Arguments:
4807  **
4808  *a handler_name - name of the event handler to invoke
4809  **
4810  *b Returns:
4811  **
4812  ** DIGUY_CALLBACK_CONTINUE or DIGUY_CALLBACK_STOP
4813  **
4814  *b Available as Decision Bead/Event
4815  */
4816  diguyCallbackReturn manually_invoke_event_handler(const char* handler_name);
4817 
4818 
4819 /*****************************************************************************/
4825  /*l
4826  *b Description:
4827  **
4828  ** This function creates a new path. The created path has no
4829  ** waypoints and no actions. Waypoints can be added using
4830  ** diguyCharacterPath::create_waypoint() or
4831  ** diguyCharacterPath::add_waypoint(). Action beads should be added
4832  ** using diguyCharacterPath::create_action_bead().
4833  **
4834  ** To create a simple path that has a few waypoints and actions, use
4835  ** create_simple_path().
4836  **
4837  ** The waypoints for the path should be created using the function
4838  ** diguyScenario::create_waypoint(). They should be deleted using the
4839  ** function diguyScenario::destroy_waypoint(). Copies of the
4840  ** waypoints are made during the function call, so it is safe to
4841  ** destroy them immediately after this function call returns, or use
4842  ** the waypoints again for another path.
4843  **
4844  ** The returned diguyCharacterPath pointer should be destroyed using
4845  ** destroy_path().
4846  **
4847  *b Arguments:
4848  **
4849  ** The path makes internal copies of all arguments.
4850  **
4851  *a name - name of the new path
4852  **
4853  *b Returns:
4854  **
4855  ** pointer to type diguyCharacterPath
4856  **
4857  */
4858  diguyCharacterPath* create_path(const char* name);
4859 
4860  /*l
4861  *b Description:
4862  **
4863  ** This function creates a new simple path. The path is simple
4864  ** because it has only two waypoints and three specified actions.
4865  **
4866  ** The waypoints for the path should be created using the function
4867  ** diguyScenario::create_waypoint(). They should be deleted using the
4868  ** function diguyScenario::destroy_waypoint(). Copies of the
4869  ** waypoints are made during the function call, so it is safe to
4870  ** destroy them immediately after this function call returns, or use
4871  ** the waypoints again for another path.
4872  **
4873  ** The returned diguyCharacterPath pointer should be destroyed using
4874  ** destroy_path().
4875  **
4876  *b Arguments:
4877  **
4878  ** The path makes internal copies of all arguments.
4879  **
4880  *a name - name of the new path
4881  *a waypoint0 - beginning waypoint
4882  *a waypoint1 - ending waypoint
4883  *a transition_from_action_name - name of the action the character
4884  *a should be transitioning from at the
4885  *a beginning of the path; can be NULL
4886  *a fill_action_name - name of the action that should fill
4887  *a the majority of the path; can be
4888  *a NULL, but see below
4889  *a transition_to_action_name - name of the action the character
4890  *a should transition into at the end of
4891  *a the path
4892  **
4893  ** If transition_from_action_name is NULL, an initial action bead that
4894  ** transitions to the fill action will not be created.
4895  **
4896  ** If fill_action_name is NULL, no action beads will be created for
4897  ** the path, even if transition_from_action_name and/or
4898  ** transition_to_action_name are non-NULL.
4899  **
4900  ** If transition_to_action_name is NULL, a final action bead that
4901  ** transitions from the fill action will not be created.
4902  **
4903  *b Returns:
4904  **
4905  ** pointer to type diguyCharacterPath
4906  */
4907  diguyCharacterPath* create_simple_path(const char* name,
4908  diguyWaypoint* waypoint0,
4909  diguyWaypoint* waypoint1,
4910  const char* transition_from_action_name,
4911  const char* fill_action_name,
4912  const char* transition_to_action_name);
4913 
4914  /*l
4915  *b Description:
4916  **
4917  ** This function is similar to create_simple_path(), but creates its
4918  ** waypoints based on waypoints from the passed path shape.
4919  **
4920  *b Arguments:
4921  **
4922  ** The path makes internal copies of all arguments.
4923  **
4924  *a name - name of the new path
4925  *a source_path_shape - path shape whose waypoints are used
4926  *a to define shape of new path
4927  *a transition_from_action_name - same as for create_simple_path()
4928  *a fill_action_name - same as for create_simple_path()
4929  *a transition_to_action_name - same as for create_simple_path()
4930  **
4931  *b Returns:
4932  **
4933  ** pointer to type diguyCharacterPath
4934  */
4935  diguyCharacterPath* create_path_from_path_shape(const char* name,
4936  diguyPathShape* source_path_shape,
4937  const char* transition_from_action_name,
4938  const char* fill_action_name,
4939  const char* transition_to_action_name);
4940 
4941  /*l
4942  *b Description:
4943  **
4944  ** This function creates a temporary path and immediately forces it as
4945  ** the character's current path. Once it has been traversed it will
4946  ** be automatically deleted.
4947  **
4948  ** The beginning waypoint of this path is at the character's current
4949  ** position; the ending waypoint is at the specified action bead on
4950  ** the specified path (or the first action bead of the specified path
4951  ** if no action bead is specified). The character will use the
4952  ** specified action to move from the beginning waypoint to the ending
4953  ** waypoint.
4954  **
4955  ** This function is useful for getting a free position mode character
4956  ** back onto a path.
4957  **
4958  ** This function will have no effect on a dead character (see
4959  ** die_now() and get_dead()).
4960  **
4961  *b Mode Effects:
4962  **
4963  *- - This function will put the character into path position mode.
4964  *- - This function will put the character into path action mode.
4965  **
4966  *b Arguments:
4967  **
4968  *a destination_path_name - the path the character is trying to
4969  *a reach
4970  *a via_action_name - the action used over the majority of
4971  *a the bridge path
4972  *a destination_path_action_bead_name - the target action bead on the
4973  *a destination path; pass NULL
4974  *a to start at the beginning
4975  *a of the path
4976  **
4977  *b Returns:
4978  **
4979  ** 0 on success, -1 on failure
4980  */
4981  int create_and_force_bridge_path(const char* destination_path_name,
4982  const char* destination_path_action_bead_name,
4983  const char* via_action_name);
4984 
4985  /*l
4986  *b Description:
4987  **
4988  ** This function creates a temporary path and immediately forces it as
4989  ** the character's current path. Once the path has been traversed it
4990  ** will be automatically deleted. The character then begins the local
4991  ** path specified by path_to_push.
4992  **
4993  ** The beginning waypoint of this path is at the character's current
4994  ** position; the ending waypoint is at the specified x, y, z. A
4995  ** path_offset is available to shorten the distance to the end point
4996  ** along the vector to the destination. The character will use the
4997  ** specified action to move from the beginning waypoint to the ending
4998  ** waypoint.
4999  **
5000  ** An optional follow-on path can be specified that the character will
5001  ** move onto once the end position is reached. This must be the name
5002  ** of an existing path for the character. A local path copy of the
5003  ** specified path will be created, and will be pushed to occur after
5004  ** this bridge path completes.
5005  **
5006  ** This function is useful for branching from one location to another
5007  ** in the world.
5008  **
5009  ** This function will have no effect on a dead character (see
5010  ** die_now() and get_dead()).
5011  **
5012  *b Mode Effects:
5013  **
5014  *- - This function will put the character into path position mode.
5015  *- - This function will put the character into path action mode.
5016  **
5017  *b Arguments:
5018  **
5019  *a x, y, z - location in world space the bridge path
5020  *a should aim for
5021  *a path_offset - the amount to shorten the bridge path
5022  *a via_action_name - the action used over the majority of the
5023  *a bridge path
5024  *a next_local_path - local path to push when the character
5025  *a arrives at it's destination; pass NULL
5026  *a to not push a local path
5027  *a orientation - amount to rotate the local path
5028  **
5029  *b Returns:
5030  **
5031  ** 0 on success, -1 on failure
5032  */
5033  int create_and_force_bridge_path_to_point(float x, float y, float z,
5034  float path_offset,
5035  const char* via_action_name,
5036  const char* next_local_path = NULL,
5037  float orientation = 0.0f);
5038 
5039  /*l
5040  *b Description:
5041  **
5042  ** This function destroys a path created by create_path(),
5043  ** create_simple_path(), or a path from a loaded scenario.
5044  **
5045  ** The path the character is currently traveling, as returned by
5046  ** get_current_traveled_path(), cannot be destroyed. Attempting to
5047  ** destroy it will result in an error.
5048  **
5049  *b Arguments:
5050  **
5051  *a path - path to be destroyed
5052  **
5053  *b Returns:
5054  **
5055  ** 0 on success, -1 on failure
5056  */
5057  int destroy_path(diguyCharacterPath* path);
5058 
5059  /*l
5060  *b Returns:
5061  **
5062  ** the number of paths belonging to this character
5063  */
5064  int get_num_paths();
5065 
5066  /*l
5067  *b Returns:
5068  **
5069  ** pointer of type diguyCharacterPath; NULL if no
5070  ** path at the specified index
5071  **
5072  *b Arguments:
5073  **
5074  *a index - index of the path; indices start at 0
5075  */
5076  diguyCharacterPath* get_path_at_index(int index);
5077 
5078  /*l
5079  *b Returns:
5080  **
5081  ** the name of the path at the given index; NULL if no
5082  ** path at the specified index
5083  */
5084  const char* get_path_name_at_index(int index);
5085 
5086  /*l
5087  *b Description:
5088  **
5089  ** This function returns the index of the path the character
5090  ** is currently following. If the character is not following
5091  ** a path the returned index will be -1. (i.e., the character
5092  ** must be in path action mode *and* path position mode.)
5093  **
5094  *b Mode Restrictions:
5095  **
5096  *- - This function will only return a 0 or greater index if the
5097  ** character is in path action mode *and* path position mode.
5098  **
5099  *b Returns:
5100  **
5101  ** the index of the current path; -1 if not on a path
5102  */
5103  int get_current_path_index();
5104 
5105  /*l
5106  *b Description:
5107  **
5108  ** This function returns the path the character is currently
5109  ** traveling.
5110  **
5111  *b Mode Restrictions:
5112  **
5113  *- - This function can only be called in path position mode.
5114  **
5115  *b Returns:
5116  **
5117  ** pointer of type diguyCharacterPath; NULL if no path is currently
5118  ** being traveled
5119  */
5120  diguyCharacterPath* get_current_traveled_path();
5121 
5122  /*l
5123  *b Description:
5124  **
5125  ** This function can be used to see if the current traveled has the
5126  ** passed name. This is primarily useful for decisions and other
5127  ** limited logic applications.
5128  **
5129  *b Returns:
5130  **
5131  ** 1 if currently traveled path has the passed name; 0 if the name
5132  ** doesn't match, or no path is currently being traveled
5133  **
5134  *b Available as Decision Bead/Event
5135  */
5136  int get_current_traveled_path_is(const char* path_name);
5137 
5138  /*l
5139  *b Description:
5140  **
5141  ** This function pushes the path with the specified name
5142  ** onto the queue of paths this character will follow.
5143  **
5144  ** This function will have no effect on a dead character (see
5145  ** die_now() and get_dead()).
5146  **
5147  *b Arguments:
5148  **
5149  *a name - name of the path to be pushed
5150  **
5151  *b Returns:
5152  **
5153  ** 0 on success, -1 on failure
5154  **
5155  *b Available as Decision Bead/Event
5156  */
5157  int push_path(const char* path_name);
5158 
5159  /*l
5160  *b Description:
5161  **
5162  ** This function clears the queue of paths the character will follow
5163  ** and then pushes the path with the specified name.
5164  **
5165  ** This function will have no effect on a dead character (see
5166  ** die_now() and get_dead()).
5167  **
5168  *b Arguments:
5169  **
5170  *a name - name of the path to be pushed
5171  *a max_rampdown_interval - max amount of time spent trying to
5172  *a smooth over any motion seams; set
5173  *a to 0.5 for a smooth transition, set
5174  *a to 0 for a potentially rough transition
5175  **
5176  *b Returns:
5177  **
5178  ** 0 on success, -1 on failure
5179  **
5180  *b Available as Decision Bead/Event
5181  */
5182  int force_path(const char* path_name,
5183  float max_rampdown_interval = 0.5f);
5184 
5185  /*l
5186  *b Description:
5187  **
5188  ** Same as force_path(), but only motions at or after the specified
5189  ** action bead are added.
5190  **
5191  ** This function will have no effect on a dead character (see
5192  ** die_now() and get_dead()).
5193  **
5194  *b Available as Decision Bead/Event
5195  */
5196  int force_partial_path(const char* path_name,
5197  const char* beginning_action_bead_name,
5198  float max_rampdown_interval = 0.5f);
5199 
5200  /*l
5201  *b Description:
5202  **
5203  ** Resumes a path that was interrupted with a call such as
5204  ** set_desired_action() or force_action(). Note that the
5205  ** retain_path_shape argument to these functions must have been 1 for
5206  ** the path to be resumable.
5207  **
5208  ** This function will have no effect on a dead character (see
5209  ** die_now() and get_dead()).
5210  **
5211  *b Mode Restrictions:
5212  **
5213  *- - This function can only be called if the character is in
5214  *- free action mode *and* path position mode.
5215  **
5216  *b Mode Effects:
5217  **
5218  *- - This function will put the character into path position mode.
5219  *- - This function will put the character into path action mode.
5220  **
5221  *b Arguments:
5222  **
5223  *a max_rampdown_interval - max amount of time spent trying to
5224  *a smooth over any motion seams; set
5225  *a to 0.5 for a smooth transition, set
5226  *a to 0 for a potentially rough transition
5227  **
5228  *b Returns:
5229  **
5230  ** 0 on success, -1 on failure
5231  **
5232  *b Available as Decision Bead/Event
5233  */
5234  int resume_interrupted_path(float max_rampdown_interval = 0.5f);
5235 
5236  /*l
5237  *b Description:
5238  **
5239  ** This function creates a temporary path that is a copy of path_name
5240  ** but transformed so that the starting point is the same as where
5241  ** the character currently is. It then forces it as the character's
5242  ** current path.
5243  **
5244  *b Arguments:
5245  **
5246  *a path_name - path to copy
5247  *a use_character_orientation - whether the character's orientation be
5248  *a incorporated into the transform of the
5249  *a path
5250  *a rotation - additional amount to rotate the path,
5251  *a in degrees
5252  *a clamp_path - whether the path be ground clamped
5253  **
5254  *b Returns:
5255  **
5256  ** pointer to type diguyCharacterPath
5257  */
5258  diguyCharacterPath* force_local_path(const char* path_name,
5259  int use_character_orientation,
5260  float rotation = 0.0f,
5261  int clamp_path = 1);
5262 
5263  /*l
5264  *b Description:
5265  **
5266  ** This function sets which path the character will start on when the
5267  ** scenario is reset.
5268  **
5269  *b Arguments:
5270  **
5271  *a name - name of the path that will be the initial path
5272  **
5273  *b Returns:
5274  **
5275  ** 0 on success, -1 on failure
5276  */
5277  int set_initial_path(const char* name);
5278 
5279  /*l
5280  *b Description:
5281  **
5282  ** This function returns the name of the path the character will start
5283  ** on when the scenario is reset.
5284  **
5285  ** See set_initial_path().
5286  **
5287  *b Returns:
5288  **
5289  ** name of initial path; NULL if there is none
5290  */
5291  const char* get_initial_path();
5292 
5293  /*l
5294  *b Description:
5295  **
5296  ** This function translates all of the paths of this character.
5297  **
5298  *b Arguments:
5299  **
5300  *a tx, ty, tz - distance in meters to move all waypoints
5301  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5302  */
5303  void translate_all_paths(float tx, float ty, float tz,
5304  int reclamp_waypoints = 1);
5305 
5306  /*l
5307  *b Description:
5308  **
5309  ** This function rotates all of the paths of this character.
5310  ** The rotation will occur about the specified point.
5311  **
5312  ** *Note:* It is currently recommended that only rotations
5313  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5314  **
5315  *b Arguments:
5316  **
5317  *a rz, rx, ry - amount of rotation, in degrees
5318  *a rotation_pt_x, rotation_pt_y, rotation_pt_z - point around
5319  *a which rotation should occur
5320  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5321  */
5322  int rotate_all_paths_about_point(float rz, float rx, float ry,
5323  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z,
5324  int reclamp_waypoints = 1);
5325 
5326  /*l
5327  *b Description:
5328  **
5329  ** This function is similar to rotate_all_paths_about_point(),
5330  ** but rotates around the character's current waypoint instead
5331  ** of an explicitly specified point.
5332  **
5333  ** *Note:* It is currently recommended that only rotations
5334  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5335  **
5336  *b Arguments:
5337  **
5338  *a rz, rx, ry - amount of rotation, in degrees
5339  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5340  */
5341  int rotate_all_paths_about_current_waypoint(float rz, float rx, float ry,
5342  int reclamp_waypoints = 1);
5343 
5344  /*l
5345  *b Description:
5346  **
5347  ** This function causes the character to jump forward along
5348  ** its current path to the specified action bead. Motions
5349  ** and beads that would have otherwise been played or processed
5350  ** will be skipped.
5351  **
5352  *b Arguments:
5353  **
5354  *a bead_name - name of the bead to jump to
5355  *a max_rampdown_interval - max amount of time spent trying to
5356  *a smooth over any motion seams; set
5357  *a to 0.5 for a smooth transition, set
5358  *a to 0 for a potentially rough transition
5359  **
5360  *b Returns:
5361  **
5362  ** 0 on success, -1 on failure
5363  */
5364  int jump_to_action_bead(const char* bead_name,
5365  float max_rampdown_interval = 0.5f);
5366 
5367  /*l
5368  *b Description:
5369  **
5370  ** This function finds and returns a pointer to the specified path.
5371  **
5372  *b Arguments:
5373  **
5374  *a name - name of the path to be found
5375  **
5376  *b Returns:
5377  **
5378  ** Pointer to object of type diguyCharacterPath;
5379  ** NULL if path not found.
5380  */
5381  diguyCharacterPath* find_path(const char* path_name);
5382 
5383  /*l
5384  *b Description:
5385  **
5386  ** This function causes the effects of the given aim bead to be
5387  ** applied to this character, regardless of whether the
5388  ** bead belongs to the character or whether character is within
5389  ** the bead's time interval.
5390  **
5391  *b Arguments:
5392  **
5393  *a how_far - how far into the bead the call should be; should
5394  *a be between 0 (beginning of bead time interval) and
5395  *a 1 (end of bead time interval)
5396  **
5397  *b Returns:
5398  **
5399  ** 0 on success, -1 on failure
5400  */
5401  int apply_aim_bead(diguyCharacterPathAimBead* bead,
5402  float how_far = 0.0f);
5403 
5404  /*l
5405  *b Description:
5406  **
5407  ** This function causes the effects of the given decision bead to be
5408  ** applied to this character, regardless of whether the
5409  ** bead belongs to the character or whether character is within
5410  ** the bead's time interval.
5411  **
5412  *b Arguments:
5413  **
5414  *a how_far - how far into the bead the call should be; should
5415  *a be between 0 (beginning of bead time interval) and
5416  *a 1 (end of bead time interval)
5417  **
5418  *b Returns:
5419  **
5420  ** 0 on success, -1 on failure
5421  */
5422  int apply_decision_bead(diguyCharacterPathDecisionBead* bead,
5423  float how_far = 0.0f);
5424 
5425  /*l
5426  *b Description:
5427  **
5428  ** This function causes the effects of the given gaze bead to be
5429  ** applied to this character, regardless of whether the
5430  ** bead belongs to the character or whether character is within
5431  ** the bead's time interval.
5432  **
5433  *b Arguments:
5434  **
5435  *a how_far - how far into the bead the call should be; should
5436  *a be between 0 (beginning of bead time interval) and
5437  *a 1 (end of bead time interval)
5438  **
5439  *b Returns:
5440  **
5441  ** 0 on success, -1 on failure
5442  */
5443  int apply_gaze_bead(diguyCharacterPathGazeBead* bead,
5444  float how_far = 0.0f);
5445 
5446  /*l
5447  *b Description:
5448  **
5449  ** This function causes the effects of the given script bead to be
5450  ** applied to this character, regardless of whether the
5451  ** bead belongs to the character or whether character is within
5452  ** the bead's time interval.
5453  **
5454  *b Arguments:
5455  **
5456  *a how_far - how far into the bead the call should be; should
5457  *a be between 0 (beginning of bead time interval) and
5458  *a 1 (end of bead time interval)
5459  **
5460  *b Returns:
5461  **
5462  ** 0 on success, -1 on failure
5463  */
5464  int apply_script_bead(diguyCharacterPathScriptBead* bead,
5465  float how_far = 0.0f);
5466 
5467  /*l
5468  *b Description:
5469  **
5470  ** This function sets how far along the current path shape
5471  ** the character will be.
5472  **
5473  *b Mode Restrictions:
5474  **
5475  *- - This function can only be called if the character is in
5476  *- free action mode *and* path position mode. i.e., the
5477  *- character is following a path shape, and is not on a
5478  *- diguyCharacterPath.
5479  **
5480  *b Arguments:
5481  **
5482  *a distance - distance in meters; 0.0 is the beginning of the
5483  *a path shape
5484  **
5485  *b Returns:
5486  **
5487  ** 0 on success, -1 on failure
5488  */
5489  int set_distance_along_path(float distance);
5490 
5491  /*l
5492  *b Returns:
5493  **
5494  ** the distance in meters along the path shape; see
5495  ** set_distance_along_path()
5496  **
5497  *b Mode Restrictions:
5498  **
5499  *- - This function can only be called in path position mode.
5500  */
5501  float get_distance_along_path();
5502 
5503  /*l
5504  *b Description:
5505  **
5506  ** This function takes the character off of its current path
5507  ** or path shape.
5508  **
5509  *b Mode Restrictions:
5510  **
5511  *- - This function can only be called in path position mode.
5512  **
5513  *b Mode Effects:
5514  **
5515  *- - This function will put the character into free position mode.
5516  *- - This function will put the character into free action mode.
5517  **
5518  *b Returns:
5519  **
5520  ** 0 on success, -1 on failure
5521  */
5522  int leave_path();
5523 
5524  /*l
5525  *b Description:
5526  **
5527  ** This function returns the index of the nearest waypoint in a path,
5528  ** the path argument is looked up in both the character's path list
5529  ** and the scenario's paths.
5530  **
5531  *b Returns:
5532  **
5533  ** waypoint index
5534  */
5535  int get_nearest_waypoint_index_in_path(const char* path_name);
5536 
5537  /*l
5538  *b Returns:
5539  **
5540  ** Distance to action bead or first waypoint, 100000000.0 on failure
5541  */
5542  float get_distance_to_path(const char* path_name,
5543  const char* action_bead_name = NULL);
5544 
5545 
5546 /*****************************************************************************/
5554  /*l
5555  *b Description:
5556  **
5557  ** This function gets the position link of the character skeleton.
5558  ** The rest of the skeleton can then be traversed by recursively
5559  ** calling the diguyGraphicsLink::get_num_child_links() and
5560  ** diguyGraphicsLink::get_child_link_at_index() functions.
5561  **
5562  ** Alternatively, the links of the character can be traversed
5563  ** by calling the get_num_links() and get_link_at_index()
5564  ** functions below.
5565  **
5566  *b Returns:
5567  **
5568  ** pointer of type diguyGraphicsLink; NULL if there is no
5569  ** position link
5570  */
5571  diguyGraphicsLink* get_position_link();
5572 
5573  /*l
5574  *b Returns:
5575  **
5576  ** number of links on this character
5577  */
5578  int get_num_links();
5579 
5580  /*l
5581  *b Returns:
5582  **
5583  ** pointer of type diguyGraphicsLink; NULL if no
5584  ** link at the specified index
5585  **
5586  *b Arguments:
5587  **
5588  *a index - index of the link; indices start at 0
5589  */
5590  diguyGraphicsLink* get_link_at_index(int index);
5591 
5592  /*l
5593  *b Description:
5594  **
5595  ** This function returns a pointer to the specified link.
5596  **
5597  *b Arguments:
5598  **
5599  *a name - name of link to be found
5600  **
5601  *b Returns:
5602  **
5603  ** pointer of type diguyGraphicsLink; NULL if not found
5604  */
5605  diguyGraphicsLink* find_link(const char* name);
5606 
5607  /*l
5608  *b Returns:
5609  **
5610  ** the string identifying the link at the given index
5611  **
5612  *b Arguments:
5613  **
5614  *a link_index - index of the link; indices start at 0
5615  */
5616  const char* get_link_name_at_index(int link_index);
5617 
5618  /*l
5619  *b Returns:
5620  **
5621  ** the number of shapes on the specified link
5622  **
5623  *b Arguments:
5624  **
5625  *a link_name - name of the link
5626  */
5627  int get_num_link_shapes(const char* link_name);
5628 
5629  /*l
5630  *b Returns:
5631  **
5632  ** the name of the shape at the specified index on the link
5633  **
5634  *b Arguments:
5635  **
5636  *a link_name - name of the link
5637  *a shape_index - index of the shape on the link; indices start at 0
5638  */
5639  const char* get_link_shape_name_at_index(const char* link_name,
5640  int shape_index);
5641 
5642 
5644  int get_num_connection_points();
5645 
5648  const char * get_connection_point_name_at_index(int index);
5649 
5652  int get_num_connection_points_with_type(diguyConnectionPointType type);
5653 
5656  const char * get_connection_point_name_with_type(diguyConnectionPointType type, int index);
5657 
5659  void set_link_visibility(const char* link_or_connection_name, int visible, int shape_index = -1);
5660 
5662  diguyGraphicsShape* find_shape(const char* shape_name);
5663 
5665  int remove_shape(const char* shape_name);
5666 
5667 /*****************************************************************************/
5676  diguyLinkController * get_link_controller(const char * link_name);
5679 
5682  int set_link_translation_override(const char * link_name, float x, float y, float z, float ramp_time = .25f);
5683 
5686  int set_link_translation_override(const char * link_name, float x, float y, float z, float vx, float vy, float vz, float ramp_time = .25f);
5687 
5689  int end_link_translation_override(const char * link_name, float ramp_time = .25f);
5690 
5692  int set_link_rotation_override(const char * link_name, float rz, float rx, float ry, float ramp_time = .25f);
5693  int set_link_rotation_override(const char * link_name, float rz, float rx, float ry, float vrx, float vry, float vrz, float ramp_time = .25f);
5694 
5696  int end_link_rotation_override(const char * link_name, float ramp_time = .25f);
5697 
5698 
5699 /*****************************************************************************/
5708  int get_num_articulated_parts();
5710 
5712  const char * get_articulated_part_link_name(int index);
5713 
5715  int get_articulated_part_id(int index);
5716 
5718  const char * map_articulated_part_id_to_link(int id);
5719 
5720 
5721 /*****************************************************************************/
5743 #ifdef CPLUSPLUS_ONLY
5744 
5745  /*l
5746  *b Description:
5747  **
5748  ** The following prototype should be used for the altitude
5749  ** function:
5750  **
5751  *e float altitude_func(diguyCharacter* character,
5752  *e float x,
5753  *e float y,
5754  *e float old_z);
5755  **
5756  ** When a character needs new altitude info, DI-Guy calls this
5757  ** function with a pointer to the diguyCharacter in question,
5758  ** the character's current (x, y) coordinates, and its previous
5759  ** altitude in old_z.
5760  **
5761  ** The altitude function should then compute and return the new
5762  ** altitude based on this information. This can be done in a
5763  ** number of ways; a typical approach is to do an intersection
5764  ** test with the visual scene. Some users might want to implement
5765  ** fairly complex behavior, such as attempting to make all four
5766  ** wheels of a vehicle touch the terrain, or causing a character
5767  ** to drift slowly towards the ground.
5768  **
5769  ** A default altitude function that should be set for all
5770  ** characters can be set by calling
5771  ** diguyScenario::set_default_character_altitude_function().
5772  **
5773  ** This function is normally called for all characters if the flags
5774  ** for enabling it in free movement or path-following mode are
5775  ** set (see below). Some character systems, such as certain kinds
5776  ** of vehicle control code, will also use the scenario altitude
5777  ** function.
5778  **
5779  *b Callable From:
5780  **
5781  *- - C++
5782  */
5783  int set_altitude_function(diguyAltitudeFunction* altitude_function);
5784 
5785  /*l
5786  *b Returns:
5787  **
5788  ** current altitude function; see set_altitude_function()
5789  **
5790  *b Callable From:
5791  **
5792  *- - C++
5793  */
5794  diguyAltitudeFunction* get_altitude_function();
5795 
5796 #endif
5797 
5798  /*l
5799  *b Description:
5800  **
5801  ** This function sets whether the character's altitude function is
5802  ** enabled in free position mode. Altitude functions are set by the
5803  ** functions set_altitude_function() or
5804  ** diguyScenario::set_default_character_altitude_function().
5805  **
5806  *b Arguments:
5807  **
5808  *a enabled - pass 1 to enable, 0 to disable
5809  **
5810  *b Mode Effects:
5811  **
5812  *- - This function will not change the position mode.
5813  **
5814  *b Mode Restrictions:
5815  **
5816  *- - This function will only affect characters in free position mode.
5817  **
5818  *b Returns:
5819  **
5820  ** 0 on success, -1 on failure
5821  */
5822  int set_altitude_function_enabled_in_free_position_mode(int enabled);
5823 
5824  /*l
5825  *b Returns:
5826  **
5827  ** whether the character's altitude function is enabled in free
5828  ** position mode; see
5829  ** set_altitude_function_enabled_in_free_position_mode()
5830  */
5831  int get_altitude_function_enabled_in_free_position_mode();
5832 
5833  /*l
5834  *b Description:
5835  **
5836  ** This function sets whether the character's altitude function is
5837  ** enabled in path position mode. Altitude functions are set by
5838  ** the functions set_altitude_function() or
5839  ** diguyScenario::set_default_character_altitude_function().
5840  **
5841  *b Arguments:
5842  **
5843  *a enabled - pass 1 to enable, 0 to disable
5844  **
5845  *b Mode Effects:
5846  **
5847  *- - This function will not change the position mode.
5848  **
5849  *b Mode Restrictions:
5850  **
5851  *- - This function will only affect characters in path position mode.
5852  **
5853  *b Returns:
5854  **
5855  ** 0 on success, -1 on failure
5856  */
5857  int set_altitude_function_enabled_in_path_position_mode(int value);
5858 
5859  /*l
5860  *b Returns:
5861  **
5862  ** whether the character's altitude function is enabled in path
5863  ** position mode;
5864  ** see set_altitude_function_enabled_in_path_position_mode()
5865  */
5866  int get_altitude_function_enabled_in_path_position_mode();
5867 
5868  /*l
5869  *b Description
5870  **
5871  ** This function sets the altitude update rate of the character.
5872  **
5873  ** The default value for new characters is 100.
5874  **
5875  ** Note that characters that are load managed (get_is_load_managed()
5876  ** returns 1) have this parameter managed automatically. The
5877  ** corresponding function for load managed characters is
5878  ** diguyLoadManager::set_zone_altitude_update_rate().
5879  **
5880  *b Arguments:
5881  **
5882  *a update_rate - percentage of scenario ticks for which altitude
5883  *a should update; can be between 1 and 100
5884  **
5885  ** Passing 100 means altitude will update every tick.
5886  ** Passing 50 means altitude will update every other tick.
5887  **
5888  *b Returns:
5889  **
5890  ** 0 on success, -1 on failure
5891  */
5892  int set_altitude_update_rate(int update_rate);
5893 
5895  int get_altitude_update_rate();
5896 
5897  /*l
5898  *b Description
5899  **
5900  ** This function sets the altitude interpolation rate of the
5901  ** character. This function only has an effect if the character's
5902  ** altitude function is enabled.
5903  **
5904  ** When the altitude function determines that the character's Z
5905  ** position should be updated to bring it closer to the ground, the
5906  ** altitude interpolation rate determines how quickly the Z height
5907  ** is adjusted.
5908  **
5909  ** The default value is 10.
5910  **
5911  *b Arguments:
5912  **
5913  *a interpolation_rate - how much of the error will be made up
5914  *a each second
5915  **
5916  ** An interpolation_rate of 100 means that all error will be made
5917  ** up each frame.
5918  */
5919  void set_altitude_interpolation_rate(float interpolation_rate);
5920 
5922  float get_altitude_interpolation_rate();
5923 
5924 /*****************************************************************************/
6036  /*l
6037  *b Description:
6038  **
6039  ** Returns the number of variables in this character's pose array.
6040  ** See get_pose_in_radians() for an example of use.
6041  **
6042  *b Returns:
6043  **
6044  ** size of this character's pose array
6045  */
6046  int get_pose_array_size();
6047 
6048 #ifdef CPLUSPLUS_ONLY
6049 
6050  /*l
6051  *b Description:
6052  **
6053  ** Fills an array of floats with the character's current joint angles.
6054  ** Angles are expressed in radians. The size of the float array must
6055  ** be at least as large as that returned by get_pose_array_size().
6056  **
6057  *b Arguments:
6058  **
6059  *a pose_array - an array of floats
6060  **
6061  *b Returns:
6062  **
6063  ** 0 on success, -1 on failure
6064  **
6065  *b Callable From:
6066  **
6067  *- - C++
6068  **
6069  *b C++ Example:
6070  **
6071  *e diguyCharacter* ch = scenario->get_character_at_index(0);
6072  *e float* pose_array;
6073  *e
6074  *e // allocate a float array of the proper size
6075  *e int n = ch->get_pose_array_size();
6076  *e pose_array = new float[n];
6077  *e
6078  *e // get the pose array
6079  *e ch->get_pose_in_radians(pose_array);
6080  */
6081  int get_pose_in_radians(float* pose_array);
6082 
6084  int get_pose_in_quaternions(float* pose_array);
6085 
6086 #endif
6087 
6088  /*l
6089  *b Description:
6090  **
6091  ** Creates and returns a pose override object. The newly created
6092  ** pose override object is added to the character's previously
6093  ** created override objects, if any.
6094  **
6095  ** How the pose override interacts with other effects that affect
6096  ** the pose of the character depends on the override stage. See
6097  ** the section "Pose Override Stages" for a discussion of pose
6098  ** override stages.
6099  **
6100  *b Arguments:
6101  **
6102  *a override_stage - the stage in the DI-Guy motion engine at
6103  *a which the override should be applied
6104  **
6105  *b Returns:
6106  **
6107  ** object of type diguyCharacterPoseOverride
6108  */
6109  diguyCharacterPoseOverride* create_pose_override(int override_stage = 3);
6110 
6111  /*l
6112  *b Description:
6113  **
6114  ** Destroys a pose override object, ending its influence on the
6115  ** character.
6116  **
6117  *b Arguments:
6118  **
6119  *a po - pose override object to be destroyed
6120  **
6121  *b Returns:
6122  **
6123  ** 0 on success, -1 on failure
6124  */
6125  int destroy_pose_override(diguyCharacterPoseOverride* po);
6126 
6127  /*l
6128  *b Returns:
6129  **
6130  ** the number of pose overrides belonging to this character
6131  */
6132  int get_num_pose_overrides();
6133 
6134  /*l
6135  *b Returns:
6136  **
6137  ** pointer of type diguyCharacterPoseOverride; NULL if no
6138  ** pose override at the specified index
6139  **
6140  *b Arguments:
6141  **
6142  *a index - index of the pose override; indices start at 0
6143  */
6144  diguyCharacterPoseOverride* get_pose_override_at_index(int index);
6145 
6146  /*l
6147  *b Description:
6148  **
6149  ** Creates and returns a pose override object that completely
6150  ** overrides all other character pose operations, including motions,
6151  ** aiming, gazing, gestures, other pose overrides, etc. The values
6152  ** set in the complete pose override object will be the values used
6153  ** to animate the character.
6154  **
6155  ** Having only one thing that affects a character's pose allows for
6156  ** much faster updating of the character.
6157  **
6158  ** There can only be one complete pose override object per character.
6159  **
6160  ** To remove the complete pose override, call
6161  ** destroy_complete_pose_override().
6162  **
6163  *b Returns:
6164  **
6165  ** object of type diguyCharacterPoseOverride
6166  */
6167  diguyCharacterPoseOverride* create_complete_pose_override();
6168 
6169  /*l
6170  *b Description:
6171  **
6172  ** Removes and destroys the complete pose override created by
6173  ** create_complete_pose_override().
6174  */
6175  void destroy_complete_pose_override();
6176 
6177 
6178 /*****************************************************************************/
6184  /*l
6185  *b Description:
6186  **
6187  ** This function sets the current azimuth, elevation, and
6188  ** distance of the character's gaze. A fixed point in 3D space
6189  ** is then found using the two angles and the given distance
6190  ** from the DI-Guy coordinate system origin. Angles are
6191  ** given with respect to the DI-Guy coordinate system.
6192  **
6193  ** See set_position() for a description of the coordinate
6194  ** system.
6195  **
6196  ** Gazing will continue until end_gaze() is called.
6197  **
6198  ** This function will have no effect on a dead character (see
6199  ** die_now() and get_dead()).
6200  **
6201  *b Arguments:
6202  **
6203  *a azimuth - rotation in degrees about up (vertical) axis;
6204  *a positive rotates to character's left
6205  *a elevation - rotation in degrees about forward (horizontal) axis;
6206  *a positive rotates down
6207  *a distance - deprecated as of 13.2
6208  *a is_new_gaze - set to 1 if this is a new gaze;
6209  *a set to 0 if this is continuing an already started
6210  *a gaze
6211  **
6212  *b Returns:
6213  **
6214  ** 0 on success, -1 on failure
6215  */
6216  int gaze_at_angle(float azimuth,
6217  float elevation,
6218  float distance,
6219  int is_new_gaze = 1);
6220 
6221  /*l
6222  *b Description:
6223  **
6224  ** This function is identical to gaze_at_angle() except that it uses
6225  ** body local coordinates for the character. The angles
6226  ** are given with respect to the idealized position of the
6227  ** character. Use get_position() to learn the idealized position.
6228  ** The distance is between the idealized position of the character
6229  ** and the fixation point.
6230  **
6231  ** This function will have no effect on a dead character (see
6232  ** die_now() and get_dead()).
6233  ** distance argument - deprecated as of 13.2
6234  */
6235  int gaze_at_angle_local(float azimuth,
6236  float elevation,
6237  float distance = 10000.0f,
6238  int is_new_gaze = 1);
6239 
6240  /*l
6241  *b Description:
6242  **
6243  ** This function sets the current fixation point of the character's
6244  ** gaze. Point coordinates are given in meters in the DI-Guy
6245  ** global coordinate system. The function uses default gaze behavior
6246  ** settings. Gazing will continue until end_gaze() is called.
6247  **
6248  ** This function will have no effect on a dead character (see
6249  ** die_now() and get_dead()).
6250  **
6251  *b Arguments:
6252  **
6253  *a tx, ty, tz - position in meters from the DI-Guy global
6254  *a origin
6255  *a is_new_gaze - set to 1 if this is a new gaze;
6256  *a set to 0 if this is continuing an already started
6257  *a gaze
6258  **
6259  *b Returns:
6260  **
6261  ** 0 on success, -1 on failure
6262  */
6263  int gaze_at_point(float tx,
6264  float ty,
6265  float tz,
6266  int is_new_gaze = 1);
6267 
6268  /*l
6269  *b Description:
6270  **
6271  ** This function is identical to gaze_at_point() except that it uses
6272  ** body local coordinates for the character. Use get_position()
6273  ** to learn the idealized position of the character if necessary.
6274  **
6275  ** This function will have no effect on a dead character (see
6276  ** die_now() and get_dead()).
6277  */
6278  int gaze_at_point_local(float tx,
6279  float ty,
6280  float tz,
6281  int is_new_gaze = 1);
6282 
6283  /*l
6284  *b Description:
6285  **
6286  ** This function effectively does a gaze_at_point() each tick.
6287  ** The point to be gazed at is updated each tick to be the position
6288  ** of the specified link on the specified character.
6289  **
6290  ** This function will have no effect on a dead character (see
6291  ** die_now() and get_dead()).
6292  **
6293  *b Arguments:
6294  **
6295  *a target_character_name - name of the character to be
6296  *a gazed at
6297  *a target_character_link_name - link on the character that should
6298  *a be gazed at; pass NULL to gaze at
6299  *a the position link of the character
6300  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
6301  **
6302  *b Returns:
6303  **
6304  ** 0 on success, -1 on failure
6305  **
6306  *b Available as Decision Bead/Event
6307  **
6308  *b C++ Example:
6309  **
6310  *e // gaze at the head of character "soldier-1".
6311  *e ch->gaze_at_character("soldier-1",
6312  *e "cervical",
6313  *e 0.0,
6314  *e 0.0,
6315  *e 0.0);
6316  */
6317  int gaze_at_character(const char* target_character_name,
6318  const char* target_character_link_name = NULL,
6319  float offset_tx = 0.0f,
6320  float offset_ty = 0.0f,
6321  float offset_tz = 0.0f);
6322 
6323  /*l
6324  *b Returns:
6325  **
6326  ** 1 if the character is actively gazing, 0 if not
6327  */
6328  int get_gaze_is_active();
6329 
6330  /*l
6331  *b Returns:
6332  **
6333  ** the current gaze point relative to the DI-Guy
6334  ** global coordinate system
6335  */
6336  int get_gaze_point(float* x, float* y, float* z);
6337 
6338  /*l
6339  *b Description:
6340  **
6341  ** A gaze is acquired if the final link in the gaze link chain
6342  ** has fully oriented toward the gaze target, even if other
6343  ** links in the gaze chain are still moving.
6344  **
6345  ** If the gaze is acquired, but any links in the gaze chain
6346  ** are still moving, the gaze is considered acquired but not
6347  ** steady (see get_gaze_is_steady().) If all links have reached
6348  ** a relatively steady state, the gaze is considered acquired
6349  ** and steady.
6350  **
6351  ** If either the acquired or steady status of a gaze has changed
6352  ** (e.g., was acquired but now is not, or was steady but now
6353  ** a link is moving), the diguyCharacter callback with callback_id
6354  ** CALLBACK_ID_GAZE_STATUS will be called.
6355  **
6356  *b Returns:
6357  **
6358  *- - 1 if the final link in the gaze can and has become oriented
6359  *- toward the gaze target
6360  *- - 0 if not
6361  *- - -1 on error
6362  */
6363  int get_gaze_is_acquired();
6364 
6365  /*l
6366  *b Description:
6367  **
6368  ** A gaze is steady if it is acquired, and if all links involved
6369  ** in the gaze have reached a steady state.
6370  **
6371  ** For example, since the eyes move faster than the neck, which
6372  ** moves faster than the back, it's possible for the gaze to
6373  ** be acquired (see get_gaze_is_acquired()) by the eyes as the
6374  ** neck and back are still moving. As the neck and back move into
6375  ** a more natural position, the eyes will not need to be turned
6376  ** as far to keep the gaze acquired.
6377  **
6378  ** If either the acquired or steady status of a gaze has changed
6379  ** (e.g., was acquired but now is not, or was steady but now
6380  ** a link is moving), the diguyCharacter callback with callback_id
6381  ** CALLBACK_ID_GAZE_STATUS will be called.
6382  **
6383  *b Returns:
6384  **
6385  *- - 1 if all links participating in the gaze have reached a
6386  *- relatively steady state
6387  *- - 0 if not
6388  *- - -1 on error
6389  */
6390  int get_gaze_is_steady();
6391 
6392  /*l
6393  *b Description:
6394  **
6395  ** This function removes the fixation target of an ongoing gaze,
6396  ** allowing the character to return to a non-gaze posture and
6397  ** behavior. This effectively frees the character's posture to
6398  ** other influences.
6399  */
6400  int end_gaze();
6401 
6402  /*l
6403  *b Description:
6404  **
6405  ** This function is similar to gaze_at_angle(), but sets the target
6406  ** of left pointing rather than gaze.
6407  **
6408  ** This function will have no effect on a dead character (see
6409  ** die_now() and get_dead()).
6410  **
6411  *b Arguments:
6412  **
6413  *a azimuth - rotation in degrees about up (vertical) axis;
6414  *a positive rotates to character's left
6415  *a elevation - rotation in degrees about forward (horizontal) axis;
6416  *a positive rotates down
6417  *a distance - distance in meters from the position of the character
6418  *a to the lpoint target; positive values only
6419  *a is_new_lpoint - set to 1 if this is a new lpoint;
6420  *a set to 0 if this is continuing an already started
6421  *a lpoint
6422  *a base_gesture_name - the underlying gesture that should be used for
6423  *a motion of the arm; this is a placeholder
6424  *a argument for future functionality and should
6425  *a be set to NULL
6426  */
6427  int lpoint_at_angle(float azimuth,
6428  float elevation,
6429  float distance,
6430  int is_new_lpoint = 1,
6431  const char* base_gesture_name = 0);
6432 
6433  /*l
6434  *b Description:
6435  **
6436  ** This function is identical to gaze_at_local() except that it uses
6437  ** body local coordinates for the character. Use get_position()
6438  ** to learn the idealized position of the character if necessary.
6439  **
6440  ** This function will have no effect on a dead character (see
6441  ** die_now() and get_dead()).
6442  */
6443  int lpoint_at_angle_local(float azimuth,
6444  float elevation,
6445  float distance = 10000.0f,
6446  int is_new_lpoint = 1,
6447  const char* base_gesture_name = 0);
6448 
6449  /*l
6450  *b Description:
6451  **
6452  ** This function sets the current fixation point for the character's
6453  ** left pointing. Point coordinates are given in meters in the
6454  ** DI-Guy global coordinate system.
6455  **
6456  ** See set_position() for a description of the coordinate
6457  ** system.
6458  **
6459  ** Pointing will continue until end_lpoint() is called.
6460  **
6461  ** This function will have no effect on a dead character (see
6462  ** die_now() and get_dead()).
6463  **
6464  *b Arguments:
6465  **
6466  *a tx, ty, tz - position in meters from the DI-Guy global
6467  *a origin of the lpoint target
6468  *a is_new_gaze - set to 1 if this is a new lpoint;
6469  *a set to 0 if this is continuing an already started
6470  *a lpoint
6471  *a base_gesture_name - the underlying gesture that should be used for
6472  *a motion of the arm; this is a placeholder
6473  *a argument for future functionality and should
6474  *a be set to NULL
6475  **
6476  *b Returns:
6477  **
6478  ** 0 on success, -1 on failure
6479  */
6480  int lpoint_at_point(float tx,
6481  float ty,
6482  float tz,
6483  int is_new_lpoint = 1,
6484  const char* base_gesture_name = 0);
6485 
6486  /*l
6487  *b Description:
6488  **
6489  ** This function is identical to lpoint_at_local() except that it uses
6490  ** body local coordinates for the character. Use get_position()
6491  ** to learn the idealized position of the character if necessary.
6492  **
6493  ** This function will have no effect on a dead character (see
6494  ** die_now() and get_dead()).
6495  */
6496  int lpoint_at_point_local(float tx,
6497  float ty,
6498  float tz,
6499  int is_new_lpoint = 1,
6500  const char* base_gesture_name = 0);
6501 
6502  /*l
6503  *b Description:
6504  **
6505  ** This function is identical to gaze_at_character(), but sets the
6506  ** target of left pointing rather than gaze.
6507  **
6508  ** This function will have no effect on a dead character (see
6509  ** die_now() and get_dead()).
6510  */
6511  int lpoint_at_character(const char* target_character_name,
6512  const char* target_character_link_name = NULL,
6513  float offset_tx = 0.0f,
6514  float offset_ty = 0.0f,
6515  float offset_tz = 0.0f);
6516 
6517  /*l
6518  *b Returns:
6519  **
6520  ** the current lpoint target point relative to the DI-Guy
6521  ** global coordinate system
6522  */
6523  int get_lpoint_point(float* x, float* y, float* z);
6524 
6525  /*l
6526  *b Returns:
6527  **
6528  ** the current base gesture of the lpoint
6529  */
6530  const char* get_lpoint_base_gesture_name();
6531 
6532  /*l
6533  *b Returns:
6534  **
6535  ** 1 if the character is actively lpointing, 0 if not
6536  */
6537  int get_lpoint_is_active();
6538 
6539  /*l
6540  *b Returns:
6541  **
6542  ** 1 if the final link in the lpoint can and has become oriented
6543  ** toward the lpoint target;
6544  ** 0 if not;
6545  ** -1 on error
6546  */
6547  int get_lpoint_is_acquired();
6548 
6549  /*l
6550  *b Returns:
6551  **
6552  ** 1 if all links participating in the lpoint have reached a
6553  ** relatively steady state;
6554  ** 0 if not;
6555  ** -1 on error
6556  */
6557  int get_lpoint_is_steady();
6558 
6559  /*l
6560  *b Description:
6561  **
6562  ** This function removes the fixation target of an ongoing lpoint,
6563  ** allowing the character to return to a non-point posture and
6564  ** behavior. This effectively frees the character's posture to
6565  ** other influences.
6566  */
6567  int end_lpoint();
6568 
6569  /*l
6570  *b Description:
6571  **
6572  ** This function sets all gaze control parameters back to their
6573  ** default settings. This undoes modifications to gaze control
6574  ** parameters made by the following calls:
6575  **
6576  *- - set_gaze_param_desired_locate_time()
6577  *- - set_gaze_link_uses_desired_locate_time()
6578  *- - set_gaze_link_azimuth_limits()
6579  *- - set_gaze_link_elevation_limits()
6580  *- - set_gaze_link_azimuth_tolerance()
6581  *- - set_gaze_link_elevation_tolerance()
6582  *- - set_gaze_link_max_angular_vel()
6583  *- - set_gaze_link_scale_factor()
6584  **
6585  *b Returns:
6586  **
6587  ** 0 on success, -1 on failure
6588  */
6589  int set_gaze_params_to_defaults();
6590 
6591  /*l
6592  *b Description:
6593  **
6594  ** This function sets the desired amount of time in seconds it
6595  ** will take for the gaze or point target to be acquired.
6596  **
6597  ** Having a desired locate time effectively limits how fast links
6598  ** in the gaze chain can turn; they will turn as fast as it
6599  ** takes for them to arrive at their proper values, or as fast
6600  ** as their maximum angular velocity, whichever is longer.
6601  **
6602  ** The use of desired locate time can be turned on and off on a
6603  ** link by link bases using the function
6604  ** set_gaze_link_uses_desired_locate_time().
6605  **
6606  ** This value is only a guideline and may be overridden on a link
6607  ** by link basis during the actual gaze, as links try not to
6608  ** exceed their maximum angular velocities.
6609  **
6610  ** The default locate time is 1.0 seconds.
6611  **
6612  *b Arguments:
6613  **
6614  *a t - lower value results in faster turning rate
6615  **
6616  *b Returns:
6617  **
6618  ** 0 on success, -1 on failure
6619  */
6620  int set_gaze_param_desired_locate_time(float t);
6621 
6622  /*l
6623  *b Returns:
6624  **
6625  ** the most recent setting of set_gaze_param_desired_locate_time()
6626  */
6627  float get_gaze_param_desired_locate_time();
6628 
6629  /*l
6630  *b Description:
6631  **
6632  ** This function sets whether the specified link will pay attention
6633  ** to the desired locate time (as set by
6634  ** set_gaze_param_desired_locate_time()), or whether the link turns
6635  ** as fast as its maximum angular velocity allows (as set by
6636  ** set_gaze_link_max_angular_vel()).
6637  **
6638  ** Note that if this value is set to 1, the link still pays attention
6639  ** to its maximum angular velocity as an upper limit on how fast
6640  ** it can turn.
6641  **
6642  ** Valid link names and defaults:
6643  **
6644  *a orientation - 1
6645  *a back - 1
6646  *a cervical - 1
6647  *a eye_l - 0
6648  *a shoulder_l - 1
6649  *a elbow_l - 1
6650  **
6651  *b Arguments:
6652  **
6653  *a link_name - name of the link
6654  *a uses_desired_locate_time - 1 to use desired locate time, 0
6655  *a to disregard
6656  **
6657  *b Returns:
6658  **
6659  ** 0 on success, -1 on failure
6660  */
6661  int set_gaze_link_uses_desired_locate_time(const char* link_name,
6662  int uses_desired_locate_time);
6663 
6664  /*l
6665  *b Returns:
6666  **
6667  ** the most recent setting of set_gaze_link_uses_desired_locate_time()
6668  */
6669  int get_gaze_link_uses_desired_locate_time(const char* link_name);
6670 
6671  /*l
6672  *b Description:
6673  **
6674  ** This function sets the maximum amount the character can turn
6675  ** the specified link horizontally in pursuit of a gaze or point
6676  ** target.
6677  **
6678  ** Valid link names and defaults:
6679  **
6680  *a back - -45 to 45
6681  *a cervical - -80 to 80
6682  *a eye_l - -50 to 50
6683  *a shoulder_l - -30 to 135
6684  *a elbow_l - -30 to 10
6685  **
6686  *b Arguments:
6687  **
6688  *a link_name - name of the link
6689  *a min - value <= 0; in degrees
6690  *a max - value >= 0; in degrees
6691  **
6692  *b Returns:
6693  **
6694  ** 0 on success, -1 on failure
6695  */
6696  int set_gaze_link_azimuth_limits(const char* link_name, float min, float max);
6697 
6698  /*l
6699  *b Returns:
6700  **
6701  ** the most recent setting of set_gaze_link_azimuth_max()
6702  */
6703  int get_gaze_link_azimuth_limits(const char* link_name,
6704  float* min,
6705  float* max);
6706 
6707  /*l
6708  *b Description:
6709  **
6710  ** This function sets the maximum amount the character can turn
6711  ** the specified link vertically in pursuit of a gaze or point
6712  ** target.
6713  **
6714  ** Valid link names and defaults:
6715  **
6716  *a back - -15 to 45
6717  *a cervical - -80 to 45
6718  *a eye_l - -40 to 40
6719  *a shoulder_l - -80 to 80
6720  *a elbow_l - -170 to 0
6721  **
6722  *b Arguments:
6723  **
6724  *a link_name - name of the link
6725  *a min - value <= 0; in degrees
6726  *a max - value >= 0; in degrees
6727  **
6728  *b Returns:
6729  **
6730  ** 0 on success, -1 on failure
6731  */
6732  int set_gaze_link_elevation_limits(const char* link_name,
6733  float min,
6734  float max);
6735 
6737  int get_gaze_link_elevation_limits(const char* link_name,
6738  float* min,
6739  float* max);
6740 
6741  /*l
6742  *b Description:
6743  **
6744  ** This function sets how much difference there can be between
6745  ** the link's current horizontal orientation and the gaze or point
6746  ** target before the link begins to turn to acquire the gaze or
6747  ** point target.
6748  **
6749  ** The combination of this function and
6750  ** set_gaze_link_scale_factor() determine how close the link will
6751  ** turn toward the gaze or point target.
6752  **
6753  ** With a looser (higher) tolerance the link will not turn as much
6754  ** toward the target. With a tighter (lower) tolerance the link
6755  ** will turn more toward the target.
6756  **
6757  ** Valid link names and defaults:
6758  **
6759  *a orientation - -30 to 30
6760  *a back - -45 to 45
6761  *a cervical - -5 to 5
6762  *a eye_l - -1 to 1
6763  *a shoulder_l - -5 to 5
6764  *a elbow_l - -5 to 5
6765  **
6766  *b Arguments:
6767  **
6768  *a link_name - name of the link
6769  *a min - value <= 0; in degrees
6770  *a max - value >= 0; in degrees
6771  **
6772  *b Returns:
6773  **
6774  ** 0 on success, -1 on failure
6775  */
6776  int set_gaze_link_azimuth_tolerance(const char* link_name,
6777  float min,
6778  float max);
6779 
6781  int get_gaze_link_azimuth_tolerance(const char* link_name,
6782  float* min,
6783  float* max);
6784 
6785  /*l
6786  *b Description:
6787  **
6788  ** The elevation equivalent of set_gaze_link_azimuth_tolerance(),
6789  **
6790  ** Valid link names and defaults:
6791  **
6792  *a orientation - -90 to 90
6793  *a back - -45 to 45
6794  *a cervical - -5 to 5
6795  *a eye_l - -1 to 1
6796  *a shoulder_l - -5 to 5
6797  *a elbow_l - -5 to 5
6798  **
6799  *b Arguments:
6800  **
6801  *a link_name - name of the link
6802  *a min - value <= 0; in degrees
6803  *a max - value >= 0; in degrees
6804  **
6805  *b Returns:
6806  **
6807  ** 0 on success, -1 on failure
6808  */
6809  int set_gaze_link_elevation_tolerance(const char* link_name,
6810  float min,
6811  float max);
6812 
6814  int get_gaze_link_elevation_tolerance(const char* link_name,
6815  float* min,
6816  float* max);
6817 
6818  /*l
6819  *b Description:
6820  **
6821  ** This function sets the maximum angular velocity that the
6822  ** back link angles may attain in pursuit of a gaze or point target.
6823  **
6824  ** Valid link names and defaults:
6825  **
6826  *a back - 30 deg/s
6827  *a cervical - 60 deg/s
6828  *a eye_l - 180 deg/s
6829  *a shoulder_l - 180 deg/s
6830  *a elbow_l - 180 deg/s
6831  **
6832  *b Arguments:
6833  **
6834  *a link_name - name of the link
6835  *a angular_vel - angular velocity in degrees per second
6836  **
6837  *b Returns:
6838  **
6839  ** 0 on success, -1 on failure
6840  */
6841  int set_gaze_link_max_angular_vel(const char* link_name, float angular_vel);
6842 
6844  int get_gaze_link_max_angular_vel(const char* link_name, float* angular_vel);
6845 
6846  /*l
6847  *b Description:
6848  **
6849  ** This function sets how much the link will make up the difference
6850  ** toward the gaze or point target.
6851  **
6852  ** The combination of this function and
6853  ** the tolerances determine how close the
6854  ** link will turn toward the gaze or point target.
6855  **
6856  ** With a smaller scale factor the link will not turn as much toward
6857  ** the target. With a higher scale factor the link will turn more
6858  ** toward the target.
6859  **
6860  ** For example, if the gaze or point target is at 60 degrees yaw in
6861  ** back coordinates and the scale factor is 0.5, the back will turn
6862  ** 30 degrees in pursuit of the target.
6863  **
6864  ** Valid link names and defaults:
6865  **
6866  *a back - 0.75
6867  *a cervical - 0.5
6868  *a eye_l - 1.0
6869  *a shoulder_l - 0.9
6870  *a elbow_l - 1.0
6871  **
6872  *b Arguments:
6873  **
6874  *a link_name - name of the link
6875  *a scale_factor - scale factor between 0 and 1
6876  **
6877  *b Returns:
6878  **
6879  ** 0 on success, -1 on failure
6880  */
6881  int set_gaze_link_scale_factor(const char* link_name, float scale_factor);
6882 
6884  int get_gaze_link_scale_factor(const char* link_name, float* scale_factor);
6885 
6886  /*l
6887  *b Description:
6888  **
6889  ** This function sets whether the character can turn the specified
6890  ** link in pursuit of the gaze target.
6891  **
6892  ** Valid link names and defaults:
6893  **
6894  *a orientation - 0
6895  *a back - 1
6896  *a cervical - 1
6897  *a eye_l - 1 if character has movable eyes, else 0
6898  *a shoulder_l - 0
6899  *a elbow_l - 0
6900  **
6901  *b Arguments:
6902  **
6903  *a link_name - name of the link
6904  *a enabled - 1 to enable, 0 to disable
6905  **
6906  *b Returns:
6907  **
6908  ** 0 on success, -1 on failure
6909  */
6910  int set_link_enabled_for_gaze(const char* link_name, int enabled);
6911 
6913  int get_link_enabled_for_gaze(const char* link_name);
6914 
6915  /*l
6916  *b Description:
6917  **
6918  ** This function sets whether the character can change its current
6919  ** posture in pursuit of the gaze target.
6920  **
6921  ** Gaze can change current posture by default.
6922  **
6923  *b Arguments:
6924  **
6925  *a enabled - 1 to enable, 0 to disable
6926  **
6927  *b Returns:
6928  **
6929  ** 0 on success, -1 on failure
6930  */
6931  int set_gaze_can_change_posture(int enabled);
6932 
6934  int get_gaze_can_change_posture();
6935 
6936  /*l
6937  *b Description:
6938  **
6939  ** This function sets whether the character can change its current
6940  ** variant in pursuit of the gaze target.
6941  **
6942  ** Gaze can change current variant by default.
6943  **
6944  *b Arguments:
6945  **
6946  *a enabled - 1 to enable, 0 to disable
6947  **
6948  *b Returns:
6949  **
6950  ** 0 on success, -1 on failure
6951  */
6952  int set_gaze_can_change_variant(int enabled);
6953 
6955  int get_gaze_can_change_variant();
6956 
6957  /*l
6958  *b Description:
6959  **
6960  ** This function sets whether the character can move the specified
6961  ** link in pursuit of the lpoint target.
6962  **
6963  ** Valid link names and defaults:
6964  **
6965  *a orientation - 0
6966  *a back - 1
6967  *a cervical - 0
6968  *a eye_l - 0
6969  *a shoulder_l - 1
6970  *a elbow_l - 1
6971  **
6972  *b Arguments:
6973  **
6974  *a link_name - name of the link
6975  *a enabled - 1 to enable, 0 to disable
6976  **
6977  *b Returns:
6978  **
6979  ** 0 on success, -1 on failure
6980  */
6981  int set_link_enabled_for_lpoint(const char* link_name, int enabled);
6982 
6984  int get_link_enabled_for_lpoint(const char* link_name);
6985 
6986  /*l
6987  *b Description:
6988  **
6989  ** This function adjusts the current azimuth and elevation offsets
6990  ** of the character's head. If a gaze is ongoing, then the nod will
6991  ** be supplemented to the gazing, and the character will attempt to
6992  ** maintain its gaze.
6993  **
6994  ** This function will have no effect on a dead character (see
6995  ** die_now() and get_dead()).
6996  **
6997  *b Arguments:
6998  **
6999  *a azimuth - rotation offset about z (vertical) axis, in degrees;
7000  *a positive rotates to character's left
7001  *a elevation - rotation offset about y (horizontal) axis, in degrees;
7002  *a positive rotates down
7003  *a duration - how long it should take to attain the new azimuth
7004  *a and elevation
7005  **
7006  *b Returns:
7007  **
7008  ** 0 on success, -1 on failure
7009  */
7010  int set_nod(float azimuth,
7011  float elevation,
7012  float duration = 0.5f);
7013 
7014  /*l
7015  *b Description:
7016  **
7017  ** This function causes the character to nod its head for the
7018  ** specified number of times over the specified duration.
7019  **
7020  ** If nod_count is 0.5, the elevation of the head will move from its
7021  ** current elevation straight to nod_elevation_out. The arguments
7022  ** nod_elevation0 and nod_elevation1 will be ignored.
7023  **
7024  ** If nod_count is 1.0, the elevation of the head will move from
7025  ** its current elevation to nod_elevation0, then to
7026  ** nod_elevation_out. The argument nod_elevation1 will be ignored.
7027  **
7028  ** If nod_count is 1.5 or greater, the nod elevation will begin at
7029  ** its current elevation, move to nod_elevation0, then alternate
7030  ** between nod_elevation0 and nod_elevation1, before finally ending
7031  ** at nod_elevation_out.
7032  **
7033  ** The head will maintain an elevation offset of nod_elevation_out
7034  ** until a new call to nod_head() or set_nod() is made.
7035  **
7036  ** This function overrides any nod settings made by the set_nod()
7037  ** function.
7038  **
7039  ** This function will have no effect on a dead character (see
7040  ** die_now() and get_dead()).
7041  **
7042  *b Arguments:
7043  **
7044  *a duration - for how long the nod should be executed
7045  *a nod_count - how many nods the character should perform;
7046  *a this will be rounded to the nearest multiple
7047  *a of 0.5
7048  *a nod_elevation0 - elevation of initial nod in degrees
7049  *a nod_elevation1 - elevation of return nod in degrees
7050  *a nod_elevation_out - ending elevation when nod is complete
7051  **
7052  *b Returns:
7053  **
7054  ** 0 on success, -1 on failure
7055  **
7056  *b Available as Decision Bead/Event
7057  */
7058  int nod_head(float duration,
7059  float nod_count,
7060  float nod_elevation0 = 15.0f,
7061  float nod_elevation1 = 0.0f,
7062  float nod_elevation_out = 0.0f);
7063 
7064  /*l
7065  *b Description:
7066  **
7067  ** This function is similar to nod_head(), except the direction
7068  ** of head movement is side to side rather than up and down.
7069  ** See the nod_head() function for a detailed description of usage.
7070  **
7071  ** This function will have no effect on a dead character (see
7072  ** die_now() and get_dead()).
7073  **
7074  *b Arguments:
7075  **
7076  *a duration - for how long the shake should be executed
7077  *a shake_count - how shakes the character should perform; this
7078  *a will be rounded to the nearest multiple of
7079  *a 0.5
7080  *a shake_azimuth0 - azimuth of initial shake in degrees
7081  *a shake_azimuth1 - azimuth of return shake in degrees
7082  *a shake_azimuth_out - ending azimuth when shake is complete
7083  **
7084  *b Returns:
7085  **
7086  ** 0 on success, -1 on failure
7087  **
7088  *b Available as Decision Bead/Event
7089  */
7090  int shake_head(float duration,
7091  float shake_count,
7092  float shake_azimuth0 = -20.0f,
7093  float shake_azimuth1 = 20.0f,
7094  float shake_azimuth_out = 0.0f);
7095 
7096  /*l
7097  *b Returns:
7098  **
7099  ** current nod azimuth setting; see set_nod(), nod_head(), and
7100  ** shake_head()
7101  */
7102  float get_nod_azimuth();
7103 
7104  /*l
7105  *b Returns:
7106  **
7107  ** current nod elevation setting; see set_nod(), nod_head(), and
7108  ** shake_head()
7109  */
7110  float get_nod_elevation();
7111 
7112 
7113 /*****************************************************************************/
7134  /*l
7135  *b Description:
7136  **
7137  ** This function sets the current desired azimuth and elevation of
7138  ** the character's aim. The angles are in character-local
7139  ** coordinates. Zero values mean straight ahead and level.
7140  ** Aiming will continue until end_aim() is called.
7141  **
7142  ** This function effectively calls aim_at_angle_local(), with a
7143  ** distance of 10000 meters, and is_new_aim set to 1.
7144  **
7145  ** This function will have no effect on a dead character (see
7146  ** die_now() and get_dead()).
7147  **
7148  *b Arguments:
7149  **
7150  *a azimuth - rotation about z (vertical) axis, in degrees;
7151  *a positive rotates to character's left
7152  *a elevation - rotation about y (horizontal) axis, in degrees;
7153  *a positive rotates down
7154  **
7155  *b Returns:
7156  **
7157  ** 0 on success, -1 on failure
7158  */
7159  int set_aim(float azimuth, float elevation);
7160 
7161  /*l
7162  *b Description:
7163  **
7164  ** This function sets the current azimuth, elevation, and
7165  ** distance of the character's aim. A fixed point in 3D space is
7166  ** then found using the two angles and the given distance from
7167  ** the character's idealized position. Angles are given with
7168  ** respect to the DI-Guy global coordinate system.
7169  **
7170  ** See set_position() for a description of the coordinate
7171  ** system.
7172  **
7173  ** Aiming will continue until end_aim() is called.
7174  **
7175  ** This function will have no effect on a dead character (see
7176  ** die_now() and get_dead()).
7177  **
7178  *b Arguments:
7179  **
7180  *a azimuth - rotation in degrees about up (vertical) axis;
7181  *a begins at 0 at the positive X axis of the DI-Guy
7182  *a coordinate system and proceeds counter-clockwise
7183  *a elevation - rotation in degrees about horizontal axis; positive
7184  *a value rotates down
7185  *a distance - distance in meters from the idealized position of the
7186  *a character to the aim target; positive values only,
7187  *a typically this is a large value (e.g. 10,000 meters)
7188  *a is_new_aim - set to 1 if this is a new aim, for jumping to a
7189  *a new target;
7190  *a set to 0 if this is continuing an already
7191  *a started aim, for tracking an existing target
7192  **
7193  *b Returns:
7194  **
7195  ** 0 on success, -1 on failure
7196  */
7197  int aim_at_angle(float azimuth,
7198  float elevation,
7199  float distance,
7200  int is_new_aim = 1);
7201 
7202  /*l
7203  *b Description:
7204  **
7205  ** This function is identical to aim_at_angle() except that the
7206  ** angles are relative to the character's frame of reference. These
7207  ** relative angles will be maintained even if the character rotates.
7208  **
7209  ** Use get_position() to learn the idealized position. The
7210  ** distance is between the idealized position of the character
7211  ** and the fixation point. Aiming will continue until end_aim()
7212  ** is called.
7213  **
7214  ** This function will have no effect on a dead character (see
7215  ** die_now() and get_dead()).
7216  */
7217  int aim_at_angle_local(float azimuth,
7218  float elevation,
7219  float distance,
7220  int is_new_aim = 1);
7221 
7222  /*l
7223  *b Description:
7224  **
7225  ** This function is identical to aim_at_angle() and aim_at_angle_local(),
7226  ** but includes velocity that will modify the angles every frame.
7227  ** This can be useful in networked simulations where targeting velocity is published.
7228  **
7229  ** This function will have no effect on a dead character (see
7230  ** die_now() and get_dead()).
7231  */
7232  int aim_at_angle_with_velocity(float azimuth, float elevation, float az_vel, float el_vel, int local, int is_new_aim = 1);
7233 
7234  /*l
7235  *b Description:
7236  **
7237  ** This function sets the current fixation point of the
7238  ** character's aim. Point coordinates are given in meters in the
7239  ** DI-Guy global coordinate system.
7240  **
7241  ** The function uses default aim behavior settings. Aiming will
7242  ** continue until end_aim() is called.
7243  **
7244  ** This function will have no effect on a dead character (see
7245  ** die_now() and get_dead()).
7246  **
7247  *b Arguments:
7248  **
7249  *a tx, ty, tz - position in meters from the DI-Guy global
7250  *a origin
7251  *a is_new_aim - set to 1 if this is a new aim;
7252  *a set to 0 if this is continuing an already started aim
7253  **
7254  *b Returns:
7255  **
7256  ** 0 on success, -1 on failure
7257  */
7258  int aim_at_point(float x, float y, float z, int is_new_aim = 1);
7259 
7260  /*l
7261  *b Description:
7262  **
7263  ** This function is identical to aim_at_point() except that the
7264  ** coordinates are relative to the character, in its own coordinate
7265  ** system. Use get_position() to learn the idealized position of the
7266  ** character if necessary.
7267  **
7268  ** This function will have no effect on a dead character (see
7269  ** die_now() and get_dead()).
7270  */
7271  int aim_at_point_local(float x, float y, float z, int is_new_aim = 1);
7272 
7273  /*l
7274  *b Description:
7275  **
7276  ** This function effectively does an aim_at_point() each tick.
7277  ** The point to be aimed at is updated each tick to be the position
7278  ** of the specified link on the specified character.
7279  **
7280  ** This function will have no effect on a dead character (see
7281  ** die_now() and get_dead()).
7282  **
7283  *b Arguments:
7284  **
7285  *a target_character_name - name of the character to be
7286  *a aimed at
7287  *a target_character_link_name - link on the character that should
7288  *a be aimed at; pass NULL or "" to
7289  *a aim at the position link of the
7290  *a character. If NULL is passed,
7291  *a function will make best effort to
7292  *a choose a character-appropriate link
7293  *a to target.
7294  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
7295  **
7296  *b Returns:
7297  **
7298  ** 0 on success, -1 on failure
7299  **
7300  *b Available as Decision Bead/Event
7301  **
7302  *b C++ Example:
7303  **
7304  *e // aim at the head of character "soldier-1".
7305  *e ch->aim_at_character("soldier-1",
7306  *e "cervical",
7307  *e 0.0,
7308  *e 0.0,
7309  *e 0.0);
7310  */
7311  int aim_at_character(const char* target_character_name,
7312  const char* target_character_link_name = NULL,
7313  float offset_tx = 0.0f,
7314  float offset_ty = 0.0f,
7315  float offset_tz = 0.0f);
7316 
7317  /*l
7318  *b Description:
7319  **
7320  ** This function terminates aiming started by the set_aim(),
7321  ** aim_at_point(), aim_at_point_local(), aim_at_angle(),
7322  ** aim_at_angle_local(), and aim_at_character() functions.
7323  */
7324  void end_aim();
7325 
7327  const char * get_aim_at_character();
7328 
7330  float get_aim_azimuth();
7331 
7333  float get_aim_elevation();
7334 
7335  /*l
7336  *b Description:
7337  **
7338  ** This function returns values that can be used to compute the
7339  ** character's weapon's trajectory, i.e. the mathematical ray that
7340  ** comes out of the end of the barrel.
7341  **
7342  *b Returns:
7343  **
7344  ** 1 if the character is aiming, 0 if not
7345  **
7346  *b Arguments:
7347  **
7348  *a muzzle_x, muzzle_y, muzzle_z - position of muzzle in meters from
7349  *a the origin
7350  *a far_x, far_y, far_z - position of end target in meters from the
7351  *a origin
7352  **
7353  ** Pass NULL for any values that are not needed.
7354  ** Note: values will be zero if the character isn't currently aiming
7355  */
7356  int get_aim_trajectory(float* muzzle_x, float* muzzle_y, float* muzzle_z,
7357  float* far_x, float* far_y, float* far_z);
7358 
7359  /*l
7360  *b Description:
7361  **
7362  ** Not all actions of a character will be affected by aim
7363  ** commands. This function returns 1 if this character
7364  ** is currently in an aim-able action.
7365  **
7366  *b Returns:
7367  **
7368  ** 1 if current action is aim-able; 0 if not
7369  */
7370  int get_aim_is_possible();
7371 
7372  /*l
7373  *b Returns:
7374  **
7375  ** 1 if the aim is acquired, 0 if not
7376  */
7377  int get_aim_is_acquired();
7378 
7379  /*l
7380  *b Returns:
7381  **
7382  ** 1 if all links participating in the aim have reached a
7383  ** relatively steady state, 0 if not, -1 on error
7384  */
7385  int get_aim_is_steady();
7386 
7387 
7388  /*l
7389  *b Returns:
7390  **
7391  ** 1 if character is currently aiming, 0 if not
7392  */
7393  int get_is_aiming();
7394 
7395 
7396  /******************************************************
7397  **
7398  *3 Aim Algorithm 8 Parameters
7399  **
7400  ** This aim algorithm works by adjusting the aiming character's pose
7401  ** such that the difference between the current aim angles and the
7402  ** desired aim angles is decreased each scenario tick.
7403  **
7404  ** How much of that difference that is made up each frame is
7405  ** determined by the factor parameters. The difference between the
7406  ** desired aim angles and the current aim angles, multiplied by a
7407  ** calculated factor, is added to the current aim angles each frame.
7408  ** This causes the aim to "home in" on the desired aim angles.
7409  **
7410  ** For example, if for each frame the calculated factor is 0.5, half
7411  ** of the difference between the desired and current aim angles is
7412  ** made up.
7413  **
7414  ** Unless otherwise specified, all functions callable from:
7415  **
7416  *- - C++
7417  *- - Script
7418  */
7419 
7420  /*l
7421  *b Description:
7422  **
7423  ** This function sets the steady-state factor that is used once
7424  ** an aim is no longer considered "new".
7425  **
7426  ** See the function set_aim_param_new_aim_duration() for information
7427  ** on when an aim is considered new, and how the effective acquire
7428  ** is calculated from this steady-state acquire factor and the
7429  ** new aim factor.
7430  **
7431  *b Arguments:
7432  **
7433  *a factor - unitless value between 0 and 1; default is 0.6
7434  */
7435  void set_aim_param_acquire_factor(float factor);
7436 
7437  /*l
7438  *b Returns:
7439  **
7440  ** the current aim acquire factor parameter
7441  */
7442  float get_aim_param_acquire_factor();
7443 
7444  /*l
7445  *b Description:
7446  **
7447  ** This function sets the factor that is used when an aim is
7448  ** considered new.
7449  **
7450  ** See the function set_aim_param_new_aim_duration() for information
7451  ** on when an aim is considered new, and how the effective acquire
7452  ** is calculated from this new aim factor and the steady-state acquire
7453  ** factor.
7454  **
7455  *b Arguments:
7456  **
7457  *a factor - unitless value between 0 and 1; default is 0.05
7458  */
7459  void set_aim_param_new_aim_factor(float factor);
7460 
7462  float get_aim_param_new_aim_factor();
7463 
7464  /*l
7465  *b Description:
7466  **
7467  ** This function sets how long an aim is considered "new".
7468  **
7469  ** When an aim is brand-new, the effective acquire factor is equal
7470  ** to the new aim factor as set by set_aim_param_new_aim_factor().
7471  ** When the new aim duration has expired, the effective acquire factor
7472  ** is equal to the steady-state acquire factor as set by
7473  ** set_aim_param_acquire_factor(). In between, the effective acquire
7474  ** factor moves smoothly between the two.
7475  **
7476  ** For example, say that the new aim factor is 0.1, the acquire factor
7477  ** is 0.5, and the new aim duration is 0.2 seconds.
7478  ** If a new aim is started, say by a call to aim_at_angle_local(),
7479  ** the effective acquire factor of the first frame will be 0.1. Over
7480  ** the next 0.2 seconds, the effective acquire factor will smoothly
7481  ** ramp up to 0.5, where it will stay until the aim is acquired.
7482  **
7483  *b Arguments:
7484  **
7485  *a duration - how long, in seconds, a new aim should be considered
7486  *a new; default is 1 second
7487  */
7488  void set_aim_param_new_aim_duration(float duration);
7489 
7491  float get_aim_param_new_aim_duration();
7492 
7493  /*l
7494  *b Description:
7495  **
7496  ** This function sets the maximum factor that can be used for any
7497  ** single frame for aim convergence attempts.
7498  **
7499  ** See set_aim_param_acquire_factor() for a discussion of why setting
7500  ** this too close to 1 is not recommended.
7501  **
7502  *b Arguments:
7503  **
7504  *a factor - unitless value between 0 and 1; default is 0.95
7505  */
7506  void set_aim_param_max_per_frame_adj_factor(float factor);
7507 
7509  float get_aim_param_max_per_frame_adj_factor();
7510 
7511  /*l
7512  *b Description:
7513  **
7514  ** This function sets how close the current aim azimuth must be to
7515  ** the desired aim azimuth in order for the aim to be considered
7516  ** acquired.
7517  **
7518  ** Note that the aim isn't fully acquired until both azimuth and
7519  ** elevation are acquired.
7520  **
7521  ** Setting this value too close to 0 will result in the aim never
7522  ** being acquired.
7523  **
7524  *b Arguments:
7525  **
7526  *a range - how close, in degrees, the azimuth must be for the
7527  *a aim to be acquired; default is 0.5 degrees
7528  */
7529  void set_aim_param_azimuth_acquired_range(float range);
7530 
7532  float get_aim_param_azimuth_acquired_range();
7533 
7534  /*l
7535  *b Description:
7536  **
7537  ** This function sets how close the current aim elevation must be to
7538  ** the desired aim elevation in order for the aim to be considered
7539  ** acquired.
7540  **
7541  ** Note that the aim isn't fully acquired until both azimuth and
7542  ** elevation are acquired.
7543  **
7544  ** Setting this value too close to 0 will result in the aim never
7545  ** being acquired.
7546  **
7547  *b Arguments:
7548  **
7549  *a range - how close, in degrees, the elevation must be for the
7550  *a aim to be acquired; default is 1.0 degrees
7551  */
7552  void set_aim_param_elevation_acquired_range(float range);
7553 
7555  float get_aim_param_elevation_acquired_range();
7556 
7557  /*l
7558  *b Description:
7559  **
7560  ** This function attempts to have the character reach its desired
7561  ** aim angles instantly, every frame.
7562  **
7563  ** Set enabled to 0 to disable instant aim convergence.
7564  **
7565  */
7566  void set_aim_converge_every_frame( int enabled );
7567 
7569  int get_aim_converge_every_frame();
7570 
7573  int set_aim_variable_interpolation_time(float time);
7574  float get_aim_variable_interpolation_time();
7575 
7576 /*****************************************************************************/
7580  const char* get_aim_at_link();
7582 
7584  int get_aim_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
7585 
7587  const char* get_gaze_at_link();
7588 
7590  int get_gaze_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
7591 
7592 /*****************************************************************************/
7602  /*l
7603  *b Description:
7604  **
7605  ** This function causes a character to fire his weapon.
7606  **
7607  ** Different weapons have different "munition types", which specify,
7608  ** among other things, the sound to be played, the network info to be
7609  ** sent, and muzzle flash effect. See
7610  ** get_weapon_muzzle_munition_type() for more information on munition
7611  ** types.
7612  **
7613  ** If the weapon fires live rounds (as set by
7614  ** set_weapon_fires_live_rounds()) this function also computes a
7615  ** bullet trajectory, perhaps hitting and killing another character.
7616  **
7617  ** This function will have no effect on a dead character (see
7618  ** die_now() and get_dead()).
7619  **
7620  *b Returns:
7621  **
7622  ** 0 on success, -1 on failure
7623  **
7624  *b Available as Decision Bead/Event
7625  */
7626  int fire_weapon(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7627 
7628  /*l
7629  *b Description:
7630  **
7631  ** This function causes a character to fire his weapon the
7632  ** specified number of times. This causes a muzzle flash and
7633  ** the weapon's sound (if any) to be played.
7634  **
7635  ** The sound played will be one of, in order:
7636  **
7637  *- - the passed override_sound_name, or
7638  *- - the sound set by set_weapon_sound_override(), or
7639  *- - the default weapon sound based on the character's appearance
7640  **
7641  ** If the weapon fires live rounds (as set by
7642  ** set_weapon_fires_live_rounds()), this function also computes a
7643  ** trajectory for each round, perhaps hitting and killing
7644  ** another character.
7645  **
7646  ** This function will have no effect on a dead character (see
7647  ** die_now() and get_dead()).
7648  **
7649  *b Arguments:
7650  **
7651  *a count - number of times weapon should be fired
7652  *a override_sound_name - override sound to be played
7653  *a dt - time between firings if count > 1
7654  *a muzzle - muzzle on which flash should appear
7655  **
7656  *b Returns:
7657  **
7658  ** 0 on success, -1 on failure
7659  **
7660  *b Available as Decision Bead/Event
7661  */
7662  int fire_weapon_n_times(int count,
7663  float dt = 0.2f,
7664  const char* override_sound_name = NULL,
7666 
7667  /*l
7668  *b Description:
7669  **
7670  ** Fires a bullet at point (x, y) from the camera, using this
7671  ** character as the attacker.
7672  **
7673  *i Currently OpenGL only.
7674  **
7675  ** This function will have no effect on a dead character (see
7676  ** die_now() and get_dead()).
7677  **
7678  *b Returns:
7679  **
7680  ** number of hits
7681  */
7682  int fire_screen_space_bullet(diguyView* view, float x, float y);
7683 
7684  /*l
7685  *b Returns:
7686  **
7687  ** number of times weapon has been fired from specified muzzle
7688  **
7689  *b Available as Decision Bead/Event
7690  */
7691  int get_weapon_fire_count(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7692 
7693  /*l
7694  *b Description:
7695  **
7696  ** This function sets the default muzzle that will flash when
7697  ** the character fires its weapon due to a call to fire_weapon()
7698  ** or fire_weapon_n_times().
7699  **
7700  ** The default value is DIGUY_MUZZLE_DEFAULT.
7701  **
7702  *b Arguments:
7703  **
7704  *a muzzle - the muzzle that will flash; muzzle 1 is common
7705  **
7706  *b Returns:
7707  **
7708  ** 0 on success, -1 on failure
7709  */
7710  int set_default_weapon_muzzle(diguyMuzzle muzzle);
7711 
7712  /*l
7713  *b Returns:
7714  **
7715  ** current default weapon muzzle that flashes when the character's
7716  ** weapon is fired; see set_default_weapon_muzzle()
7717  */
7718  diguyMuzzle get_default_weapon_muzzle();
7719 
7720  /*l
7721  *b Description:
7722  **
7723  ** When the character fires its weapon, the results depend on the
7724  ** munition type of the muzzle fired from. Munition types specify,
7725  ** among other things:
7726  **
7727  *- - sound played
7728  *- - muzzle flash effect
7729  *- - network data sent (DIS septet)
7730  *- - detonation effect
7731  *- - detonation radius
7732  *- - etc.
7733  **
7734  ** Default munition types for the each muzzle are set automatically
7735  ** when the character's appearance is set. The munition type of the
7736  ** weapon can be overridden by calling
7737  ** set_weapon_munition_type_override().
7738  **
7739  ** Current munition types include:
7740  **
7741  *- - m16
7742  *- - m4
7743  *- - m60
7744  *- - m240
7745  *- - m249
7746  *- - m9
7747  *- - hand_gun
7748  *- - 50cal
7749  *- - m256
7750  *- - ak47
7751  *- - pk74
7752  *- - dragunov
7753  *- - sa80
7754  *- - rpg
7755  *- - m203
7756  *- - 40mm_hedp
7757  *- - javelin
7758  *- - stinger
7759  *- - at4
7760  *- - sa7
7761  *- - molotov_cocktail
7762  *- - 60mm_mortar
7763  *- - 82mm_mortar
7764  *- - 155mm_artillery
7765  *- - IED_mortar
7766  *- - VBIED
7767  *- - m242
7768  *- - 120mm
7769  *- - 125mm
7770  *- - ced
7771  *- - pepper_spray
7772  **
7773  *b Returns:
7774  **
7775  ** munition type of specified muzzle
7776  */
7777  const char* get_weapon_muzzle_munition_type(diguyMuzzle muzzle);
7778 
7780  const char* get_weapon_supplemental_data_name();
7781 
7783  const char* get_default_muzzle_munition_type();
7784 
7785  /*l
7786  *b Description:
7787  **
7788  ** This function allows the default munition type to be overridden.
7789  ** The default value is NULL (don't override default munition type).
7790  **
7791  *b Arguments:
7792  **
7793  *a munition_type - name of a munition type
7794  **
7795  *b Returns:
7796  **
7797  ** 0 on success, -1 on failure
7798  */
7799  int set_weapon_munition_type_override(const char* munition_type);
7800 
7802  const char* get_weapon_munition_type_override();
7803 
7804  /*l
7805  *b Description:
7806  **
7807  ** This function sets whether the character's weapons fire live
7808  ** rounds. If so, when fire_weapon() and fire_weapon_n_times() are
7809  ** called the trajectory of the bullet will be calculated and checked
7810  ** against characters in the scenario.
7811  **
7812  ** The default value is 1.
7813  **
7814  *b Arguments:
7815  **
7816  *a weapon_fires_live_rounds - set to 1 for live rounds; set to 0
7817  *a for "blanks"
7818  **
7819  *b Returns:
7820  **
7821  ** 0 on success, -1 on failure
7822  **
7823  *b Available as Decision Bead/Event
7824  */
7825  int set_weapon_fires_live_rounds(int weapon_fires_live_rounds);
7826 
7827  /*l
7828  *b Returns:
7829  **
7830  ** current setting of whether weapon fires live rounds or blanks; see
7831  ** set_weapon_fires_live_rounds()
7832  **
7833  *b Available as Decision Bead/Event
7834  */
7835  int get_weapon_fires_live_rounds();
7836 
7837  /*l
7838  *b Description:
7839  **
7840  ** A weapon sound is played when the character fires its weapon
7841  ** due to a call to fire_weapon() or fire_weapon_n_times().
7842  ** The sound that is played is generally derived from the weapon's
7843  ** munition type, which can be different for each muzzle.
7844  **
7845  ** This function overrides the default sound that will be played.
7846  ** Note that this overrides the sound for all muzzles.
7847  **
7848  ** The default value is NULL (don't override default sound).
7849  **
7850  ** To *not* play a sound at all, set the weapon sound gain override
7851  ** to 0.
7852  **
7853  *b Arguments:
7854  **
7855  *a sound - name of a sound defined in the scenario;
7856  *a pass NULL to specify that default should be played
7857  **
7858  *b Returns:
7859  **
7860  ** 0 on success, -1 on failure
7861  */
7862  int set_weapon_sound_override(const char* sound_name);
7863 
7864  /*l
7865  *b Description:
7866  **
7867  ** The function returns the current weapon sound override, if one
7868  ** is set; see set_weapon_sound_override().
7869  **
7870  ** This function will not return NULL. The empty string ("") is
7871  ** returned if a weapon sound override is not set.
7872  **
7873  *b Returns:
7874  **
7875  ** name of weapon sound override
7876  */
7877  const char* get_weapon_sound_override();
7878 
7879  /*l
7880  *b Description:
7881  **
7882  ** This function overrides the default gain on the sound played
7883  ** due to a call to fire_weapon() or fire_weapon_n_times().
7884  **
7885  ** Pass 1.0 to use the sound's default amplitude. Lower numbers
7886  ** decrease volume, higher numbers increase volume.
7887  **
7888  ** Pass 0.0 to completely disable playing of weapon sound.
7889  **
7890  ** The default value is 3.0.
7891  **
7892  ** See set_weapon_sound_override().
7893  **
7894  *b Arguments:
7895  **
7896  *a sound_gain - amount by which to change sound volume
7897  **
7898  *b Returns:
7899  **
7900  ** 0 on success, -1 on failure
7901  */
7902  int set_weapon_sound_gain_override(float gain);
7903 
7905  float get_weapon_sound_gain_override();
7906 
7907  /*l
7908  *b Description:
7909  **
7910  ** This function provides aiming assistance by making it possible for
7911  ** roughly-aimed weapons to hit targets. When spread is nonzero,
7912  ** fire_weapon searches for a target within a conical space centered
7913  ** on the muzzle. Within this cone, the live character within weapon
7914  ** range, and with the smallest angular deviation from the weapon, is
7915  ** chosen, by default, as the target. Other function calls may alter
7916  ** this aiming behavior, making it aim only at enemy targets, for
7917  ** example, or making it prefer close targets to far ones.
7918  **
7919  *b Arguments:
7920  **
7921  *a spread - angular deviation from weapon muzzle within which a
7922  *a target will be found
7923  **
7924  ** Spread values above 145 are suicidal (character can shoot himself).
7925  ** 90 is the highest sensible value, which covers everything ahead
7926  ** of the weapon muzzle. A value of 0 is the default, meaning that
7927  ** only targets in line with the muzzle are hit.
7928  */
7929  void set_weapon_spread(float spread);
7930 
7931  /*l
7932  *b Description:
7933  **
7934  ** This function affects how targets are chosen when
7935  ** the character's weapon_spread is nonzero. Only
7936  ** characters more than near_range meters away from the muzzle
7937  ** will be fired upon. Characters which are closer than
7938  ** near_range meters will not be fired upon.
7939  **
7940  ** This value does not affect weapon behavior when weapon_spread
7941  ** is zero.
7942  **
7943  ** If this function is never called for a character, it is as if
7944  ** the function had been called with a value of zero.
7945  **
7946  *b Arguments:
7947  **
7948  *a near_range - distance closer than which no character will be
7949  *a targeted
7950  */
7951  void set_weapon_near_range(float near_range);
7952  float get_weapon_near_range();
7953 
7954  /*l
7955  *b Description:
7956  **
7957  ** This function sets the range of the character's
7958  ** weapon.
7959  **
7960  ** If this function is never called for a character, it is as if
7961  ** the function had been called with a value of 500.0.
7962  **
7963  *b Arguments:
7964  **
7965  *a far_range - range of the weapon in meters
7966  */
7967  void set_weapon_far_range(float far_range);
7968  float get_weapon_far_range();
7969 
7970  /*l
7971  *b Description:
7972  **
7973  ** This function sets a weapon's ratio of hits to fired rounds. A
7974  ** value of 1.0 (the default) means the weapon will hit everything it
7975  ** is aimed at. Values less than 1.0 cause the weapon to
7976  ** probabilistically miss targets, even when perfectly aimed at them.
7977  ** A value of zero means the weapon doesn't hit anything, even if it
7978  ** is perfectly aimed. A value of 0.5 will hit half of the time.
7979  */
7980  void set_weapon_hit_ratio(float hit_ratio);
7981 
7982  /*l
7983  *b Description:
7984  **
7985  ** This function sets the number of potential impacts a fired round
7986  ** can have. The default is 1. Specifying more than 1 means the
7987  ** round will completely go through objects, triggering a
7988  ** CALLBACK_ID_IMPACT callback each time, until the maximum number of
7989  ** impacts has been reached.
7990  */
7991  void set_weapon_max_impacts(int val);
7992 
7993  /*l
7994  *b Returns:
7995  **
7996  ** state of accessory1
7997  */
7998  int get_accessory1_state();
7999 
8000  /*l
8001  *b Returns:
8002  **
8003  ** state of the character's rifle
8004  */
8005  int get_rifle_state();
8006 
8007  /*l
8008  *b Description
8009  **
8010  ** This function sets whether the projectiles of certain appearances'
8011  ** weapons (such as rocket launchers and RPGs) are visible. Note that
8012  ** most weapons do not have visible projectiles and this function will
8013  ** therefore have no effect.
8014  **
8015  *b Arguments:
8016  **
8017  *a muzzle - which muzzle's projectile should be shown/hidden
8018  *a is_visible - pass 1 to show, pass 0 to hide
8019  **
8020  *b Returns:
8021  **
8022  ** 0 on success, -1 on failure
8023  */
8024  int set_weapon_projectile_is_visible(diguyMuzzle muzzle, int is_visible);
8025 
8026  /*l
8027  *b Description
8028  **
8029  ** This function returns the most recent setting of
8030  ** set_weapon_projectile_is_visible().
8031  **
8032  *b Arguments:
8033  **
8034  *a muzzle - which muzzle's projectile should be queried
8035  **
8036  *b Returns:
8037  **
8038  ** 1 if visible, 0 if not
8039  */
8040  int get_weapon_projectile_is_visible(diguyMuzzle muzzle);
8041 
8042  /*l
8043  *b Description:
8044  **
8045  ** Retrieves the position and direction of the character's weapon.
8046  **
8047  *b Arguments:
8048  **
8049  *a muzzle_tx, muzzle_ty, muzzle_tz - muzzle position, and beginning
8050  *a of aim vector
8051  *a end_pt_tx, end_pt_ty, end_pt_tz - end point of aim vector
8052  *a muzzle_rz, muzzle_rx, muzzle_ry - orientation of muzzle in degrees
8053  *a muzzle - the muzzle for which the aim vector is needed
8054  *a in_character_local_coordinates - pass 0 for values in world
8055  *a coordinates (the default), 1 for values in character-local
8056  *a coordinates
8057  **
8058  ** The muzzle position and end point are in meters from the origin
8059  ** (if using world coordinates) or in meters from the character's
8060  ** position (if using character-local coordinates).
8061  **
8062  ** The distance of the end point from the muzzle position should
8063  ** be the weapon's far range, set by set_weapon_far_range().
8064  **
8065  ** Pass NULL for any values that are not needed.
8066  **
8067  ** *Note:* The muzzle argument is currently not used, and is present
8068  ** for future implementation.
8069  **
8070  *b Returns:
8071  **
8072  ** 0 on success, -1 on failure
8073  */
8074  int get_weapon_aim_vector(float* muzzle_tx, float* muzzle_ty, float* muzzle_tz,
8075  float* end_pt_tx = NULL, float* end_pt_ty = NULL, float* end_pt_tz = NULL,
8076  float* muzzle_rz = NULL, float* muzzle_rx = NULL, float* muzzle_ry = NULL,
8077  int in_character_local_coordinates = 0,
8079 
8080  /*l
8081  *b Description
8082  **
8083  ** This function returns the link the passed muzzle is associated
8084  ** with. For example, soldier rifle muzzles are attached to the
8085  ** "rifle_joint" link.
8086  **
8087  ** Call get_muzzle_offset() to get the offset of the muzzle on this
8088  ** link.
8089  **
8090  *b Arguments:
8091  **
8092  *a muzzle - muzzle of interest
8093  **
8094  *b Returns:
8095  **
8096  ** name of link, or NULL if the character doesn't have the specified
8097  ** muzzle
8098  */
8099  const char* get_muzzle_link(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
8100 
8101  /*l
8102  *b Description
8103  **
8104  ** This function returns the offset of the muzzle from the link it
8105  ** is attached to as returned by get_muzzle_link().
8106  **
8107  *b Arguments:
8108  **
8109  *a muzzle - muzzle of interest
8110  *a offset_x, offset_y, offset_z - variables in which to return results
8111  **
8112  *b Returns:
8113  **
8114  ** 0 on success, -1 on failure
8115  */
8116  int get_muzzle_offset(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT,
8117  float* offset_x = NULL,
8118  float* offset_y = NULL,
8119  float* offset_z = NULL);
8120 
8121  /*l
8122  *b Description
8123  **
8124  ** This function sets the highest horizontal error possible when the
8125  ** weapon is fired. If non-0, a random horizontal error angle will
8126  ** be computed and added to the weapon's horizontal aim angle.
8127  **
8128  *b Arguments:
8129  **
8130  *a h_error - highest possible horizontal error
8131  **
8132  *b Returns:
8133  **
8134  ** 0 on success, -1 on failure
8135  */
8136  int set_weapon_max_azimuth_error(float h_error);
8137 
8139  float get_weapon_max_azimuth_error();
8140 
8141  /*l
8142  *b Description:
8143  **
8144  ** Similar to set_weapon_max_azimuth_error(), but for vertical aim.
8145  */
8146  int set_weapon_max_elevation_error(float v_error);
8147 
8149  float get_weapon_max_elevation_error();
8150 
8151  /*l
8152  *b Description
8153  **
8154  ** This function sets whether tracer effects will be shown when
8155  ** the weapon is fired. Not all weapons will support this effect.
8156  **
8157  *b Arguments:
8158  **
8159  *a enabled - pass 1 to enable, 0 to disable
8160  **
8161  *b Returns:
8162  **
8163  ** 0 on success, -1 on failure
8164  */
8165  int set_weapon_tracers_enabled(int enabled);
8166 
8168  int get_weapon_tracers_enabled();
8169 
8170  /*l
8171  *b Returns:
8172  **
8173  ** number of rounds until next tracer
8174  */
8175  int get_weapon_rounds_until_tracer(diguyMuzzle muzzle);
8176 
8177 
8178  /*l
8179  *b Description:
8180  **
8181  ** Similar to diguyScenario::trigger_detonation(), but detonation
8182  ** occurs at character's position.
8183  **
8184  *b Arguments:
8185  **
8186  *a munition_name - name of the munition to detonate
8187  *a attacker_name - this MUST be specified if the detonation is being
8188  *a broadcast over the network
8189  *a radius_override - defaults to the data in the munition config file
8190  *a broadcast_on_network - pass 0 to not broadcast detonation on DIS
8191  *a network
8192  **
8193  ** Note: Overriding the detonation radius will NOT work on broadcast
8194  ** detonations since the override value is not transmitted.
8195  */
8196  int trigger_detonation_on_character(const char* munition_name,
8197  const char* attacker_name = NULL,
8198  float radius_override = -1.0f,
8199  int broadcast_on_network = 1);
8200 
8201 
8202 /*****************************************************************************/
8213  /*l
8214  *b Description:
8215  **
8216  ** This function changes the face of the character to reflect the
8217  ** specified user-defined named facial expression.
8218  **
8219  ** Currently affects only "facefx" appearances.
8220  **
8221  *b Arguments:
8222  **
8223  *a facex_name - name of face expression to be applied
8224  *a blend_duration - how long (in seconds) to take to change the face
8225  *a strength - a multiplier between 0 and 1 on the expression
8226  **
8227  ** Face expressions available by default in new scenarios are:
8228  **
8229  *- - Neutral
8230  *- - Smile_cl
8231  *- - Trust
8232  *- - Sad
8233  *- - Mad
8234  *- - Distrust
8235  *- - Conniving
8236  *- - Smile
8237  *- - BrowsDown
8238  *- - BrowsUp
8239  **
8240  ** New face expressions can be added using the
8241  ** diguyScenario::create_face_expression() function.
8242  **
8243  *b Returns:
8244  **
8245  ** 0 on success, -1 on failure
8246  **
8247  *b Available as Decision Bead/Event
8248  **
8249  *b C++ Example:
8250  **
8251  *e diguyCharacter* ch = scenario->get_character_at_index(0);
8252  *e
8253  *e // take one second to get mad
8254  *e ch->set_face_expression("Mad", 1.0);
8255  */
8256  int set_face_expression(const char* facex_name, float blend_duration, float strength = 1.0f);
8257 
8258  /*l
8259  *b Description:
8260  **
8261  ** This function sets the current azimuth and elevation of the
8262  ** character's eyes.
8263  **
8264  ** Currently affects only "facefx" appearances.
8265  **
8266  *b Arguments:
8267  **
8268  *a azimuth - rotation about up (vertical) axis, in degrees;
8269  *a positive rotates to character's left
8270  *a elevation - rotation about forward (horizontal) axis, in degrees;
8271  *a positive rotates down
8272  *a blend_time - how long to take to reach new orientation
8273  **
8274  *b Returns:
8275  **
8276  ** 0 on success, -1 on failure
8277  **
8278  */
8279  int set_orientation_eyes(float azimuth,
8280  float elevation,
8281  float blend_time = 0.0f);
8282 
8283  /*l
8284  *b Description:
8285  **
8286  ** This function gets the current azimuth and elevation of the
8287  ** character's eyes. It currently doesn't take blending into account.
8288  **
8289  ** Currently affects only "facefx" appearances.
8290  **/
8291  int get_orientation_eyes(float* azimuth, float* elevation);
8292 
8293  /*l
8294  *b Description:
8295  **
8296  ** Sets how open the eyes are. The eyes will stay at this level
8297  ** indefinitely. To get automatic blinking behavior, call blink().
8298  **
8299  *b Arguments:
8300  **
8301  *a droop_amount - 1 = eyes closed, 0 = eyes open, 0.5 = half open
8302  **
8303  *b Returns:
8304  **
8305  ** 0 on success, -1 on failure
8306  **
8307  *b Available as Decision Bead/Event
8308  */
8309  int set_eye_droop(float droop_amount, float blend_time = 0.0f);
8310 
8312  float get_eye_droop();
8313 
8314  /*l
8315  *b Description:
8316  **
8317  ** This function blinks the eyes. To have the eyes close to a
8318  ** specific amount and stay there, call set_eye_droop().
8319  **
8320  ** Only characters with expressive face appearances can blink.
8321  **
8322  *b Arguments:
8323  **
8324  *a duration_in - how long in seconds the first part of the blink
8325  *a (typically eyes closing) should take
8326  *a duration_out - how long in seconds the second part of the blink
8327  *a (typically eyes opening) should take
8328  *a target_in - how closed the eyes should be at duration_in
8329  *a target_out - how open the eyes should be at duration_out and
8330  *a thereafter
8331  *a tin - time at which blink should occur; default is now
8332  **
8333  *b Returns:
8334  **
8335  ** 0 on success, -1 on failure
8336  **
8337  *b Available as Decision Bead/Event
8338  */
8339  int blink(float duration_in = 0.1f,
8340  float duration_out = 0.2f,
8341  float target_in = 1.0f,
8342  float target_out = 0.0f,
8343  float tin = DIGUY_DEFAULT_FLOAT);
8344 
8345  /*l
8346  *b Description:
8347  **
8348  ** This function enables automatic eye blinking, so that blinks
8349  ** will happen without further function calls. The various
8350  ** controlling factors of blinks are set by the following functions:
8351  **
8352  *- - set_automatic_blink_duration_in()
8353  *- - set_automatic_blink_duration_out()
8354  *- - set_automatic_blink_target_in()
8355  *- - set_automatic_blink_target_out()
8356  **
8357  ** See blink() for information on what these factors mean.
8358  **
8359  ** Only characters with expressive face appearances can blink.
8360  **
8361  *b Arguments:
8362  **
8363  *a enabled - pass 1 to enable automatic blinks; 0 to disable
8364  *a period - how many seconds between each blink
8365  *a period_variation - variation on how many seconds between
8366  *a each blink
8367  **
8368  ** If blinks are enabled, the first blink will happen immediately.
8369  ** Successive blinks will happen between times (period -
8370  ** period_variation) and (period + period_variation) after the
8371  ** previous blink ends.
8372  **
8373  *b Returns:
8374  **
8375  ** 0 on success, -1 on failure
8376  **
8377  *b Available as Decision Bead/Event
8378  */
8379  int set_automatic_blinks_enabled(int enabled,
8380  float period = 6.0f,
8381  float period_variation = 3.0f);
8382 
8384  int get_automatic_blinks_enabled();
8385 
8386  /*l
8387  *b Description:
8388  **
8389  ** This function sets how long it will take the eye to close during
8390  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8391  ** blink().
8392  **
8393  *b Arguments:
8394  **
8395  *a duration_in - time in seconds for eye droop to go from droop
8396  *a target in to target out
8397  **
8398  *b Available as Decision Bead/Event
8399  */
8400  void set_automatic_blink_duration_in(float duration_in);
8401 
8403  float get_automatic_blink_duration_in();
8404 
8405  /*l
8406  *b Description:
8407  **
8408  ** This function sets how long it will take the eye to open during
8409  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8410  ** blink().
8411  **
8412  *b Arguments:
8413  **
8414  *a duration_out - time in seconds for eye droop to go from droop
8415  *a target out to target in
8416  **
8417  *b Available as Decision Bead/Event
8418  */
8419  void set_automatic_blink_duration_out(float duration_out);
8420 
8422  float get_automatic_blink_duration_out();
8423 
8424  /*l
8425  *b Description:
8426  **
8427  ** This function sets how much the eye will close during
8428  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8429  ** blink().
8430  **
8431  *b Arguments:
8432  **
8433  *a target_in - how far to close eye; 1.0 is all closed, 0.0 is
8434  *a all open
8435  **
8436  *b Available as Decision Bead/Event
8437  */
8438  void set_automatic_blink_target_in(float target_in);
8439 
8441  float get_automatic_blink_target_in();
8442 
8443  /*l
8444  *b Description:
8445  **
8446  ** This function sets how much the eye will open during
8447  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8448  ** blink().
8449  **
8450  *b Arguments:
8451  **
8452  *a target_out - how far to open eye; 1.0 is all closed, 0.0 is
8453  *a all open
8454  **
8455  *b Available as Decision Bead/Event
8456  */
8457  void set_automatic_blink_target_out(float target_out);
8458 
8460  float get_automatic_blink_target_out();
8461 
8462  /*l
8463  *b Returns:
8464  **
8465  ** 1 if the character is speaking, 0 if not. With a FaceFX character
8466  ** this is true if a character is actively playing a FaceFX animation
8467  */
8468  int is_speaking();
8469 
8470  /*l
8471  *b Description:
8472  **
8473  ** FaceFX animations are referred to as a group/animation name.
8474  ** This function allows you to set the current group once.
8475  ** See diguyScenario::facefx_mount_animset() for how to load a new
8476  ** animset on an actor.
8477  */
8478  int set_current_facefx_animation_group(const char* anim_group);
8479 
8480  /*l
8481  *b Returns:
8482  **
8483  ** the current FaceFX animation group set for this character
8484  */
8485  const char* get_current_facefx_animation_group();
8486 
8487  /*l
8488  *b Returns:
8489  **
8490  ** the name of the FaceFX actor that goes with the current head
8491  ** appearance; returns NULL if there's no FaceFX actor
8492  */
8493  const char* get_facefx_actor();
8494 
8495  /*l
8496  *b Description:
8497  **
8498  ** Mounts an animset on the current FaceFX actor. See also
8499  ** diguyScenario::facefx_mount_animset()
8500  */
8501  int facefx_mount_animset(const char* file_name);
8502 
8503  /*l
8504  *b Description:
8505  **
8506  ** Plays a FaceFX animation. This is the main way a facial animation
8507  ** sequence is triggered. The animation can be named
8508  ** "group_name/animation" or just "animation" if the proper group has
8509  ** been set with set_current_facefx_animation_group().
8510  */
8511  int play_facefx_animation(const char* animation,
8512  float magnitude_scale = 1.0f,
8513  float duration_scale = 1.0f,
8514  float blendin_time = 0.1f,
8515  float blendout_time = 0.1f,
8516  int loop = 0);
8517 
8518  /*l
8519  *b Description:
8520  **
8521  ** Stops all active FaceFX animations.
8522  */
8523  int stop_facefx_animations(float blend_time = 0.25f, int stop_sounds = 1);
8524 
8525  /*****************************************************************************/
8530  /*l
8531  *b Returns:
8532  **
8533  ** the number of nodes in the FaceFX actor's face graph
8534  */
8535  int get_num_facefx_nodes();
8536 
8537  /*l
8538  *b Returns:
8539  **
8540  ** the name of the node with index 'index' in the FaceFX actor's face
8541  ** graph
8542  */
8543  const char* get_facefx_node_name(int index);
8544 
8545  /*l
8546  *b Returns:
8547  **
8548  ** the index of the node with name 'node_name'
8549  */
8550  int find_facefx_node_index(const char* node_name);
8551 
8552  /*l
8553  *b Description:
8554  **
8555  ** Allows low level control of individual nodes of the characters face
8556  ** graph. End users can use this function to get finer grained
8557  ** control over eye direction and emotional state.
8558  */
8559  int set_facefx_node_value(int node_index,
8560  float value,
8561  float blend_time = 0.25f);
8562 
8563  /*l
8564  *b Description:
8565  **
8566  ** Retrieves the current final value of a node
8567  **/
8568  float get_facefx_node_value(int node_index);
8569 
8570 /*****************************************************************************/
8614  /*l
8615  *b Description:
8616  **
8617  ** This function creates (but does not begin) the specified gesture.
8618  ** Exact control over the gesture, such as number of repetitions,
8619  ** when the gesture should begin, when it should end, when it
8620  ** should reach specific points within the gestures, etc., is then
8621  ** possible by making calls through the returned
8622  ** diguyCharacterGesture object.
8623  **
8624  ** To begin execution of the gesture, call the begin_now() function
8625  ** of the diguyCharacterGesture object.
8626  **
8627  ** *Do not* call delete on the returned object. It should be
8628  ** destroyed either by calling destroy_gesture(), or by calling
8629  ** set_automatic_destroy_flag(1) on the diguyCharacterGesture
8630  ** object.
8631  **
8632  *b Arguments:
8633  **
8634  *a gesture_name - name of the gesture of create
8635  **
8636  *b Returns:
8637  **
8638  ** pointer to object of type diguyCharacterGesture
8639  */
8640  diguyCharacterGesture* create_gesture(const char* gesture_name);
8641 
8642  /*l
8643  *b Description:
8644  **
8645  ** This function destroys a gesture object created by
8646  ** create_gesture().
8647  **
8648  *b Arguments:
8649  **
8650  *a gesture - gesture to destroy
8651  **
8652  *b Returns:
8653  **
8654  ** 0 on success, -1 on failure
8655  */
8656  int destroy_gesture(diguyCharacterGesture* gesture);
8657 
8658  /*l
8659  *b Description:
8660  **
8661  ** This function executes the specified gesture or motion file on disk.
8662  **
8663  ** The gesture will automatically begin and end. The only control
8664  ** over the executed gesture is whether is should be ended or aborted
8665  ** early. See end_executing_gesture() and abort_executing_gesture().
8666  ** For full control of gesture attributes, use create_gesture()
8667  ** instead.
8668  **
8669  ** A gesture takes over control of a subset of a character's pose
8670  ** variables and can be overlaid on top of most base actions of the
8671  ** character.
8672  **
8673  ** Note that gestures should be preloaded at the beginning of a
8674  ** scenario to avoid a hitch in frame rate. See the function
8675  ** diguyScenario::preload_gesture().
8676  **
8677  ** This function will have no effect on a dead character (see
8678  ** die_now() and get_dead()).
8679  **
8680  *b Arguments:
8681  **
8682  *a gesture_name - name of the gesture to execute, as of diguy 13.2 this can be
8683  *a a bdm file, and a full body gesture will be created on the fly.
8684  *a reps - how many times the gesture should be
8685  *a repeated; default is 1 if no duration
8686  *a is specified, or best fit if there is
8687  *a a duration specified
8688  *a overall_duration - for how long the gesture should be executed;
8689  *a default is such that no time scaling occurs
8690  *a channel_A_weight - the weight given to channel A of the
8691  *a gesture; ignored if the gesture does not
8692  *a have multiple channels
8693  **
8694  ** If the gesture is a multi-stage gesture, the overall duration
8695  ** will be spread proportionately over each stage.
8696  **
8697  *b Returns:
8698  **
8699  ** 0 on success, -1 on failure
8700  **
8701  *b Available as Decision Bead/Event
8702  */
8703  int execute_gesture(const char* gesture_name,
8704  int reps = DIGUY_DEFAULT_INT,
8705  float overall_duration = DIGUY_DEFAULT_FLOAT,
8706  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8707 
8708  /*l
8709  *b Description:
8710  **
8711  ** The gesture will automatically begin and end. The only control
8712  ** over the executed gesture is whether is should be ended or aborted
8713  ** early. See end_executing_gesture() and abort_executing_gesture().
8714  ** For full control of gesture attributes, use create_gesture()
8715  ** instead.
8716  **
8717  ** If the specified gesture is not a 1 stage gesture, no gesture
8718  ** is executed and an error value is returned.
8719  **
8720  ** The specified gesture can be a one or two channel 1 stage gesture,
8721  ** in which case the specified channel weight will be used over the
8722  ** course of the entire gesture.
8723  **
8724  ** A 1 stage gesture is a comprised of a single motion that begins
8725  ** and ends the gesture.
8726  **
8727  ** n repetitions of a 1 stage gesture will repeat the stage 1
8728  ** motion n times.
8729  **
8730  ** This function will have no effect on a dead character (see
8731  ** die_now() and get_dead()).
8732  **
8733  *b Arguments:
8734  **
8735  *a gesture_name - name of the gesture of execute
8736  *a reps - how many times the gesture should be
8737  *a repeated; default is 1 if no duration
8738  *a is specified, or best fit if there is
8739  *a a duration specified
8740  *a stage1_duration - how long stage 1 of the gesture should take;
8741  *a default is such that no time scaling occurs
8742  *a channel_A_weight - the weight given to channel A of the
8743  *a gesture; ignored if the gesture does not
8744  *a have multiple channels
8745  **
8746  *b Returns:
8747  **
8748  ** 0 on success, -1 on failure
8749  */
8750  int execute_1stage_gesture(const char* gesture_name,
8751  int reps = DIGUY_DEFAULT_INT,
8752  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8753  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8754 
8755  /*l
8756  *b Description:
8757  **
8758  ** This function is similar to execute_1stage_gesture().
8759  **
8760  ** Stage 1 of a 2 stage gesture is a motion that begins the gesture
8761  ** and leads to the "peak" of the gesture.
8762  **
8763  ** Stage 2 of a 2 stage gesture is the motion that returns the
8764  ** gesture from the "peak" to the starting position.
8765  **
8766  ** n repetitions of a 2 stage gesture will repeat the stage 1 motion
8767  ** followed by the stage 2 motion n times.
8768  **
8769  ** This function will have no effect on a dead character (see
8770  ** die_now() and get_dead()).
8771  **
8772  *b Arguments:
8773  **
8774  *a gesture_name - name of the gesture of execute
8775  *a reps - how many times the gesture should be
8776  *a repeated; default is 1 if no duration
8777  *a is specified, or best fit if there is
8778  *a a duration specified
8779  *a stage1_duration - how long stage 1 of the gesture should take,
8780  *a i.e., how far into the gesture the "peak"
8781  *a will occur;
8782  *a default is such that no time scaling occurs
8783  *a stage2_duration - how long stage 2 of the gesture should take;
8784  *a default is such that no time scaling occurs
8785  *a channel_A_weight - the weight given to channel A of the
8786  *a gesture; ignored if the gesture does not
8787  *a have multiple channels
8788  **
8789  *b Returns:
8790  **
8791  ** 0 on success, -1 on failure
8792  */
8793  int execute_2stage_gesture(const char* gesture_name,
8794  int reps = DIGUY_DEFAULT_INT,
8795  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8796  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8797  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8798 
8799  /*l
8800  *b Description:
8801  **
8802  ** This function is similar to execute_1stage_gesture().
8803  **
8804  ** Stage 1 of a 3 stage gesture is a motion that begins the gesture
8805  ** and leads to stage 2; e.g., raising the right arm in preparation
8806  ** for waving.
8807  **
8808  ** Stage 2 of a 3 stage gesture is a motion that can loop
8809  ** indefinitely; e.g., waving the right arm back and forth.
8810  **
8811  ** Stage 3 of a 3 stage gesture is the motion that ends the gesture;
8812  ** e.g., returning the right arm to the side of the body to complete
8813  ** the wave.
8814  **
8815  ** n repetitions of a 3 stage gesture will play the stage 1 motion
8816  ** once, followed by n reps of the stage 2 motion, followed by 1
8817  ** stage 3 motion.
8818  **
8819  ** This function will have no effect on a dead character (see
8820  ** die_now() and get_dead()).
8821  **
8822  *b Arguments:
8823  **
8824  *a gesture_name - name of the gesture of execute
8825  *a reps - how many times the gesture should be
8826  *a repeated; default is 1 if no duration
8827  *a is specified, or best fit if there is
8828  *a a duration specified
8829  *a stage1_duration - how long stage 1 of the gesture should take;
8830  *a default is such that no time scaling occurs
8831  *a stage2_duration - how long each repetition of stage 2 of the
8832  *a gesture should take;
8833  *a default is such that no time scaling occurs
8834  *a stage3_duration - how long stage 3 of the gesture should take;
8835  *a default is such that no time scaling occurs
8836  *a channel_A_weight - the weight given to channel A of the
8837  *a gesture; ignored if the gesture does not
8838  *a have multiple channels
8839  **
8840  *b Returns:
8841  **
8842  ** 0 on success, -1 on failure
8843  */
8844  int execute_3stage_gesture(const char* gesture_name,
8845  int reps = DIGUY_DEFAULT_INT,
8846  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8847  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8848  float stage3_duration = DIGUY_DEFAULT_FLOAT,
8849  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8850 
8851  /*l
8852  *b Description:
8853  **
8854  ** The gesture will automatically begin and end. The only control
8855  ** over the executed gesture is whether is should be ended or aborted
8856  ** early. See end_executing_gesture() and abort_executing_gesture().
8857  ** For full control of gesture attributes, use create_gesture()
8858  ** instead.
8859  **
8860  ** This function serves as a quick way of executing a table gesture.
8861  ** There are many capabilities of table gestures that are accessible
8862  ** only through the full diguyCharacterGesture object.
8863  **
8864  ** If the specified gesture is not a table gesture, no gesture is
8865  ** executed and an error value is returned.
8866  **
8867  ** A table stage gesture is a comprised of a table of gesture actions
8868  ** that can be transitioned between without going through a neutral
8869  ** position.
8870  **
8871  ** n repetitions of a table gesture will repeat the loop action
8872  ** n times.
8873  **
8874  ** This function will have no effect on a dead character (see
8875  ** die_now() and get_dead()).
8876  **
8877  *b Arguments:
8878  **
8879  *a gesture_name - name of the gesture of execute
8880  *a reps - how many times the gesture should be repeated;
8881  *a default is 1
8882  *a loop_action - which action in the gesture should be looped;
8883  *a default is action at index 1 of table
8884  *a begin_action - which action the gesture should begin from;
8885  *a default is action at index 0
8886  *a end_action - which action the gesture should end at;
8887  *a default is action at index 0
8888  **
8889  *b Returns:
8890  **
8891  ** 0 on success, -1 on failure
8892  */
8893  int execute_table_gesture(const char* gesture_name,
8894  int reps = DIGUY_DEFAULT_INT,
8895  const char* loop_action = NULL,
8896  const char* begin_action = NULL,
8897  const char* end_action = NULL);
8898 
8899  /*l
8900  *b Description:
8901  **
8902  ** Executes the given gesture and performs the given action as a table action.
8903  **
8904  *b Arguments:
8905  **
8906  *a gesture_name - name of the gesture to execute
8907  *a desired_action - name of table action to perform
8908  **
8909  *b Returns:
8910  **
8911  ** 0 on success, -1 on failure
8912  **
8913  **/
8914  int set_executing_table_gesture_desired_action(const char* gesture_name,
8915  const char* desired_action);
8916 
8917  /*l
8918  *b Description:
8919  **
8920  ** This function alerts the specified gesture that it should end.
8921  ** The gesture will stop repeating and play its "out" motions as
8922  ** soon as possible.
8923  **
8924  ** In order to immediately stop the gesture, use the
8925  ** abort_executing_gesture() function.
8926  **
8927  *b Arguments:
8928  **
8929  *a gesture_name - name of executing gesture to end
8930  **
8931  *b Returns:
8932  **
8933  ** 0 on success, -1 on failure
8934  **
8935  *b See Also:
8936  **
8937  ** abort_executing_gesture()
8938  */
8939  int end_executing_gesture(const char* gesture_name);
8940 
8941  /*l
8942  *b Description:
8943  **
8944  ** This function aborts a gesture previously executed by one of
8945  ** the execute_*_gesture() calls, if it is currently executing.
8946  ** If a gesture with the given name is not executing, this function
8947  ** will have no effect.
8948  **
8949  ** This call won't cause the gesture to switch to its "out" motion;
8950  ** it is a straight-forward blend out of whatever the gesture is
8951  ** currently doing. Use the end_executing_gesture() call to make
8952  ** the gesture play its "out" motion as soon as possible,
8953  ** therefore ending the gesture in a smoother way.
8954  **
8955  *b Arguments:
8956  **
8957  *a gesture_name - name of executing gesture to abort
8958  *a max_rampdown_interval - max amount of time spent trying to
8959  *a smooth over any motion seams; set
8960  *a to 0.5 for a smooth transition, set
8961  *a to 0 for an immediate abort
8962  **
8963  *b Returns:
8964  **
8965  ** 0 on success, -1 on failure
8966  **
8967  *b See Also:
8968  **
8969  ** end_executing_gesture(), abort_all_gestures()
8970  */
8971  int abort_executing_gesture(const char* gesture_name,
8972  float max_rampdown_interval = .5f);
8973 
8974  /*l
8975  *b Description:
8976  **
8977  ** This function alerts all active gestures that they should end.
8978  ** The gestures will stop repeating and play their "out" motions as
8979  ** soon as possible.
8980  **
8981  ** In order to immediately stop all gestures, use the
8982  ** abort_all_gestures() function.
8983  **
8984  *b Returns:
8985  **
8986  ** 0 on success, -1 on failure
8987  **
8988  *b See Also:
8989  **
8990  ** abort_all_gestures(), diguyCharacterGesture::end_gesture()
8991  */
8992  int end_all_gestures();
8993 
8994  /*l
8995  *b Description:
8996  **
8997  ** This function aborts all active gestures. All gestures will
8998  ** immediately begin to lose their effect on the
8999  ** character's pose.
9000  **
9001  ** This won't cause the gestures to switch to their "out" motions;
9002  ** it is a straight-forward blend out of whatever the gesture is
9003  ** currently doing. Use the end_all_gestures() call to make all
9004  ** active gestures play their "out" motions as soon as possible,
9005  ** therefore ending the gestures in a smoother way.
9006  **
9007  *b Arguments:
9008  **
9009  *a max_rampdown_interval - max amount of time spent trying to
9010  *a smooth over any motion seams; set
9011  *a to 0.5 for a smooth transition, set
9012  *a to 0 for an immediate abort
9013  **
9014  *b Returns:
9015  **
9016  ** 0 on success, -1 on failure
9017  **
9018  *b See Also:
9019  **
9020  ** end_all_gestures(), diguyCharacterGesture::abort_now()
9021  */
9022  int abort_all_gestures(float max_rampdown_interval);
9023 
9024 
9025 /*****************************************************************************/
9057  /*l
9058  *b Description:
9059  **
9060  ** This function will play the specified sound. The sound will be
9061  ** "ambient"; i.e., it will be equally audible from everywhere within
9062  ** the world. Use the function play_3d_sound() to play a sound that
9063  ** moves with the character.
9064  **
9065  ** This function will have no effect on a dead character (see
9066  ** die_now() and get_dead()).
9067  **
9068  ** Unless the sound loops, the sound will play to completion and then
9069  ** stop. To stop the sound early or stop a looping sound call
9070  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
9071  **
9072  *b Arguments
9073  **
9074  *a sound_name - name of sound to play
9075  *a sound_gain - by how much sound's amplitude should be multiplied
9076  *a sound_loop - indicates that sound should loop indefinitely
9077  **
9078  ** There must be a diguySound in the scenario with the passed
9079  ** sound_name. See diguyScenario::create_sound().
9080  **
9081  ** See set_current_voice_actor() for information on how a voice actor
9082  ** can change which sound in the scenario is selected.
9083  **
9084  *b Returns:
9085  **
9086  ** 0 on success, -1 on failure
9087  **
9088  *b Available as Decision Bead/Event
9089  */
9090  int play_sound(const char* sound_name,
9091  float sound_gain = 1.0f,
9092  int sound_loops = 0);
9093 
9094  /*l
9095  *b Description:
9096  **
9097  ** This function will play the specified sound at the character's
9098  ** location. As the character moves, the sound will move with it.
9099  ** Use the function play_sound() to play a sound that is ambient and
9100  ** does not move with the character.
9101  **
9102  ** Note that not all sound modules support 3D sounds.
9103  **
9104  ** This function will have no effect on a dead character (see
9105  ** die_now() and get_dead()).
9106  **
9107  ** Unless the sound loops, the sound will play to completion and then
9108  ** stop. To stop the sound early or stop a looping sound call
9109  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
9110  **
9111  *b Arguments
9112  **
9113  *a sound_name - the name of the sound to play
9114  *a sound_gain - by how much the sound's amplitude
9115  *a should be multiplied
9116  *a sound_loop - indicates that the sound should loop
9117  *a indefinitely
9118  **
9119  ** There must be a diguySound in the scenario with the passed
9120  ** sound_name. See diguyScenario::create_sound().
9121  **
9122  ** See set_current_voice_actor() for information on how a voice actor
9123  ** can change which sound in the scenario is selected.
9124  **
9125  *b Returns:
9126  **
9127  ** 0 on success, -1 on failure
9128  **
9129  *b Available as Decision Bead/Event
9130  */
9131  int play_3d_sound(const char* sound_name,
9132  float sound_gain = 1.0f,
9133  int sound_loops = 0);
9134 
9135  /*l
9136  *b Description:
9137  **
9138  ** This function creates (but does not start playing) an instance of
9139  ** the specified sound.
9140  **
9141  ** Exact control over the sound instance is possible by making calls
9142  ** through the returned diguySoundInstance object.
9143  **
9144  ** To begin playing the sound, call diguySoundInstance::begin_now().
9145  **
9146  ** *Do not* call delete on the returned object. It should be
9147  ** destroyed either by calling diguyCharacter::destroy_sound_instance()
9148  ** or by calling diguySoundInstance::set_automatic_destroy_flag(1) on
9149  ** the returned object.
9150  **
9151  *b Arguments:
9152  **
9153  *a sound_name - name of the sound for which to create an instance
9154  **
9155  ** There must be a diguySound in the scenario with the passed
9156  ** sound_name. See diguyScenario::create_sound().
9157  **
9158  *b Returns:
9159  **
9160  ** pointer to object of type diguySoundInstance
9161  */
9162  diguySoundInstance* create_sound_instance(const char* sound_name);
9163 
9164  /*l
9165  *b Description:
9166  **
9167  ** This function destroys a sound instance object created by
9168  ** create_sound_instance().
9169  **
9170  ** Do not destroy a sound for which the
9171  ** diguySoundInstance::set_automatic_destroy_flag(1) has been called.
9172  **
9173  *b Arguments:
9174  **
9175  *a sound_instance - sound instance to destroy
9176  **
9177  *b Returns:
9178  **
9179  ** 0 on success, -1 on failure
9180  */
9181  int destroy_sound_instance(diguySoundInstance* sound_instance);
9182 
9183  /*l
9184  *b Description:
9185  **
9186  ** This function stops all active sound instances from this character.
9187  ** All sounds being played by this character will fade out and stop
9188  ** after rampdown_time, by default fade out is instant.
9189  **
9190  ** Sound instances that are automatically managed will be destroyed.
9191  ** This includes sound started by a call to
9192  ** diguyCharacter::play_sound() or a sound instance whose
9193  ** set_automatic_destroy_flag() function has been called.
9194  **
9195  ** diguySoundInstance pointers returned by a call to
9196  ** diguyCharacter::create_sound_instance(), which have not been set to
9197  ** be automatically destroyed, will still be valid.
9198  **
9199  *b Arguments:
9200  **
9201  *a rampdown_time - how long to fade out the sound
9202  **
9203  *b Returns:
9204  **
9205  ** 0 on success, -1 on failure
9206  **
9207  *b Available as Decision Bead/Event
9208  */
9209  int stop_all_sounds(float rampdown_time = 0.0f);
9210 
9211  /*l
9212  *b Description:
9213  **
9214  ** This function stops a named sound instance from this character.
9215  **
9216  ** Sound instances that are automatically managed will be destroyed.
9217  ** This includes sound started by a call to
9218  ** diguyCharacter::play_sound() or a sound instance whose
9219  ** set_automatic_destroy_flag() function has been called.
9220  **
9221  ** diguySoundInstance pointers returned by a call to
9222  ** diguyCharacter::create_sound_instance(), which have not been set to
9223  ** be automatically destroyed, will still be valid.
9224  **
9225  *b Arguments:
9226  **
9227  *a sound_name - the name of the sound to stop
9228  *a rampdown_time - how long to fade out the sound
9229  **
9230  *b Returns:
9231  **
9232  ** 0 on success, -1 on failure
9233  **
9234  *b Available as Decision Bead/Event
9235  */
9236  int stop_sound(const char* sound_name, float rampdown_time = 0.0f);
9237 
9238  /*l
9239  *b Returns:
9240  **
9241  ** 1 if the character is playing a the sound specified, 0 if not
9242  */
9243  int is_playing_sound(const char* sound_name);
9244 
9245  /*l
9246  *b Description:
9247  **
9248  ** Sets the "voice actor" for the character.
9249  **
9250  ** Having a voice actor can change which sounds from the scenario a
9251  ** character selects when the diguyCharacter::play_sound() or
9252  ** diguyCharacter::play_3d_sound().
9253  **
9254  ** When play_sound() is called the character asks the scenario for
9255  ** the sound with the specified name. If a voice actor has been set
9256  ** the character will first ask the scenario for the sound name
9257  ** prepended with the voice actor and a slash ("/"). If there isn't
9258  ** a sound with that modified name, it will ask the scenario for a
9259  ** sound with the exact specified name.
9260  **
9261  ** For example, if the character has the voice actor "carl" and is
9262  ** told to play the sound "run_away", the character will first look
9263  ** for a sound named "carl/run_away". If that isn't found, it will
9264  ** look for a sound named "run_away". (If that isn't found no sound
9265  ** is played.)
9266  **
9267  *b Lua Example:
9268  **
9269  ** A more specific example: say that various characters in the
9270  ** scenario need to say "hello". Some of the characters are male,
9271  ** some are female. There are two ways this can be set up.
9272  **
9273  ** The first way, not using a voice actor, is to have two sounds
9274  ** specified in the scenario: "male_hello" and "female_hello". These
9275  ** sounds specify the sound files "male_hello.wav" and
9276  ** "female_hello.wav", respectively. A male character would then do
9277  ** the following to say hello:
9278  **
9279  *e male_character:play_sound("male_hello")
9280  **
9281  ** A female character would do:
9282  **
9283  *e female_character:play_sound("female_hello")
9284  **
9285  ** This is fine, except when one script or character mind needs to be
9286  ** shared by a range of characters, some male and some female.
9287  **
9288  ** In this case it's better to use a voice actor. Say that the sounds
9289  ** specified above have the names "male/hello" and "female/hello";
9290  ** they still have the separate sound files specified. If the
9291  ** character has its voice actor specified as "male" and is told to
9292  ** play the sound "hello", it will select the sound "male/hello" as
9293  ** the sound to play. If its voice actor is "female" and is told to
9294  ** play the sound "hello", it will select the sound "female/hello".
9295  **
9296  *e -- called earlier: character:set_voice_actor("male")
9297  *e character:play_sound("hello") -- plays sound "male/hello"
9298  **
9299  *e -- called earlier: character:set_voice_actor("female")
9300  *e character:play_sound("hello") -- plays sound "female/hello"
9301  **
9302  *b Arguments:
9303  **
9304  *a voice_actor - name of voice actor
9305  **
9306  ** voice_actor can be an arbitrary string. It doesn't need to match
9307  ** any character name, but should have matching sounds specified in
9308  ** the scenario.
9309  **
9310  *b Returns:
9311  **
9312  ** 0 on success, -1 on failure
9313  */
9314  int set_current_voice_actor(const char* voice_actor);
9315 
9317  const char* get_current_voice_actor();
9318 
9319 
9320 /*****************************************************************************/
9356  /*l
9357  *b Description:
9358  **
9359  ** This function returns the state of the character in the form
9360  ** required by DIS.
9361  **
9362  ** Note that there is no corresponding set_DIS_lifeform_state()
9363  ** function. The lifeform state is derived from the character's
9364  ** action, posture, and variant information.
9365  **
9366  *b Returns:
9367  **
9368  ** one of the following values defined in diguy_dis_constants.h:
9369  **
9370  *- DIGUY_DIS_LIFEFORM_UNUSED (0)
9371  *- DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9372  *- DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9373  *- DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9374  *- DIGUY_DIS_LIFEFORM_KNEELING (4)
9375  *- DIGUY_DIS_LIFEFORM_PRONE (5)
9376  *- DIGUY_DIS_LIFEFORM_CRAWLING (6)
9377  *- DIGUY_DIS_LIFEFORM_SWIMMING (7)
9378  *- DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9379  *- DIGUY_DIS_LIFEFORM_JUMPING (9)
9380  *- DIGUY_DIS_LIFEFORM_SITTING (10)
9381  *- DIGUY_DIS_LIFEFORM_SQUATTING (11)
9382  *- DIGUY_DIS_LIFEFORM_CROUCHING (12)
9383  *- DIGUY_DIS_LIFEFORM_WADING (13)
9384  **
9385  *b Callable For Networked Entities That Are:
9386  **
9387  *- - DIS published and reflected
9388  */
9389  int get_DIS_lifeform_state();
9390 
9391  /*l
9392  *b Description:
9393  **
9394  ** This function returns the position of the character's
9395  ** primary weapon, in the form required by DIS.
9396  **
9397  *b Returns:
9398  **
9399  ** one of the following values defined in diguy_dis_constants.h:
9400  **
9401  *- DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9402  *- DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9403  *- DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9404  *- DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9405  **
9406  *b Callable For Networked Entities That Are:
9407  **
9408  *- - DIS published
9409  */
9410  int get_DIS_primary_weapon_position();
9411 
9412  /*l
9413  *b Description:
9414  **
9415  ** This function returns the position of the character's
9416  ** secondary weapon, in the form required by DIS.
9417  **
9418  *b Returns:
9419  **
9420  ** one of the following values defined in diguy_dis_constants.h:
9421  **
9422  *- DIGUY_DIS_SECONDARY_WEAPON_NOT_PRESENT (0)
9423  *- DIGUY_DIS_SECONDARY_WEAPON_STOWED (1)
9424  *- DIGUY_DIS_SECONDARY_WEAPON_DEPLOYED (2)
9425  *- DIGUY_DIS_SECONDARY_WEAPON_IN_FIRING_POSITION (3)
9426  **
9427  *b Callable For Networked Entities That Are:
9428  **
9429  *- - DIS published
9430  */
9431  int get_DIS_secondary_weapon_position();
9432 
9433  /*l
9434  *b Description:
9435  **
9436  ** This function sets the Marking Text for characters that are
9437  ** published to the network by DI-Guy Networking. The default
9438  ** network marking is the empty string "".
9439  **
9440  ** This function should only be called for published characters.
9441  ** The Marking Text is set internally for reflected characters.
9442  **
9443  *b Returns:
9444  **
9445  ** 0 on success, -1 on failure
9446  **
9447  *b Callable For Networked Entities That Are:
9448  **
9449  *- - DIS published
9450  *- - HLA published
9451  */
9452  int set_network_marking(const char* network_marking);
9453 
9454  /*l
9455  *b Description:
9456  **
9457  ** This function gets the Marking Text for characters.
9458  **
9459  ** For published characters this value will be what was most
9460  ** recently set by set_network_marking().
9461  **
9462  ** For reflected characters this value will be read from the
9463  ** reflected characters' entity state information.
9464  **
9465  *b Returns:
9466  **
9467  ** character's Marking Text; will never be NULL
9468  **
9469  *b Callable For Networked Entities That Are:
9470  **
9471  *- - DIS published and reflected
9472  *- - HLA published and reflected
9473  */
9474  const char* get_network_marking();
9475 
9476  /*l
9477  *b Description:
9478  **
9479  ** This function sets whether this character will be published
9480  ** by DI-Guy Networking. This value is persistent, and does
9481  ** not depend on whether there actually *is* currently a
9482  ** network connection.
9483  **
9484  ** The default is 1, the character is published.
9485  **
9486  ** This function should *not* be called for reflected characters.
9487  ** It affects to both DIS and HLA networking.
9488  **
9489  *b Returns:
9490  **
9491  ** 0 on success, -1 on failure
9492  **
9493  *b Callable For Networked Entities That Are:
9494  **
9495  *- - DIS published
9496  *- - HLA published
9497  */
9498  int set_is_network_published(int is_network_published);
9499 
9500  /*l
9501  *b Description:
9502  **
9503  ** This function returns whether the character is published
9504  ** by DI-Guy Networking. It will always return 0 for reflected
9505  ** characters.
9506  **
9507  ** This function can be called for any character.
9508  **
9509  *b Returns:
9510  **
9511  ** 1 if published, 0 if not
9512  **
9513  *b Available as Decision Bead/Event
9514  **
9515  *b Callable For Networked Entities That Are:
9516  **
9517  *- - DIS published and reflected
9518  *- - HLA published and reflected
9519  */
9520  int get_is_network_published();
9521 
9522  /*l
9523  *b Description:
9524  **
9525  ** Experimental function that returns a vrlink entity state repository,
9526  ** useful for adding additional information to a diguy that we don't usually
9527  ** model.
9528  */
9529  DtEntityStateRepository * get_vrlink_entity_state_repository();
9530 
9531  /*l
9532  *b Description:
9533  **
9534  ** This function returns whether the character is a
9535  ** reflected character created by DI-Guy Networking.
9536  **
9537  ** This function can be called for any character.
9538  **
9539  *b Returns:
9540  **
9541  ** 1 if reflected, 0 if not
9542  **
9543  *b Available as Decision Bead/Event
9544  **
9545  *b Callable For Networked Entities That Are:
9546  **
9547  *- - DIS published and reflected
9548  *- - HLA published and reflected
9549  */
9550  int get_is_network_reflected();
9551 
9552  /*l
9553  *b Description:
9554  **
9555  ** This function returns whether this character is in a
9556  ** "paused" state. This will only be true for reflected
9557  ** characters.
9558  **
9559  ** A reflected character will be paused if the network
9560  ** entity it is representing is paused; i.e., its personal
9561  ** timeline is not advancing. The most common case of this
9562  ** is when this character is reflecting a published character
9563  ** of a DI-Guy Scenario application that is in a paused or
9564  ** stopped state.
9565  **
9566  ** If DI-Guy Scenario, paused characters will remain frozen
9567  ** in their current postures.
9568  **
9569  *b Returns:
9570  **
9571  ** 1 if paused, 0 if not
9572  **
9573  *b Available as Decision Bead/Event
9574  */
9575  int get_is_network_paused();
9576 
9577  /*l
9578  *b Description:
9579  **
9580  ** Overrides built-in logic for network pausing, becomes end user's responsibility
9581  ** to manage
9582  */
9583  int set_is_network_paused(int paused);
9584 
9585  /*l
9586  *b Description:
9587  **
9588  ** This function returns the character's "network entity number".
9589  ** This number is valid and persistent regardless of whether the
9590  ** character is currently published.
9591  **
9592  ** This number is primarily used internally by DI-Guy Networking
9593  ** for creating entity IDs.
9594  **
9595  *b Returns:
9596  **
9597  ** character's network entity number
9598  **
9599  *b Callable For Networked Entities That Are:
9600  **
9601  *- - DIS published and reflected
9602  *- - HLA published and reflected
9603  */
9604  int get_network_entity_number();
9605 
9606  /*l
9607  *b Description:
9608  **
9609  ** This function returns the name of an action for a character,
9610  ** given the DIS damage state, lifeform state, primary weapon
9611  ** state, speed of the character, and direction of travel.
9612  ** Constants are all defined in diguy_dis_constants.h:
9613  **
9614  *b Arguments:
9615  **
9616  *a damage_state - one of the values listed below
9617  *a life_form_state - one of the values listed below
9618  *a primary_weapon_state - one of the values listed below
9619  *a speed - in meters/second
9620  *a forward - whether the action should move
9621  *a forward (pass 1), or backward (pass 0)
9622  **
9623  ** Valid values for damage_state:
9624  **
9625  *- - DIGUY_DIS_DAMAGE_NONE (0)
9626  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9627  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9628  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9629  **
9630  ** Valid values for life_form_state:
9631  **
9632  *- - DIGUY_DIS_LIFEFORM_UNUSED (0)
9633  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9634  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9635  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9636  *- - DIGUY_DIS_LIFEFORM_KNEELING (4)
9637  *- - DIGUY_DIS_LIFEFORM_PRONE (5)
9638  *- - DIGUY_DIS_LIFEFORM_CRAWLING (6)
9639  *- - DIGUY_DIS_LIFEFORM_SWIMMING (7)
9640  *- - DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9641  *- - DIGUY_DIS_LIFEFORM_JUMPING (9)
9642  *- - DIGUY_DIS_LIFEFORM_SITTING (10)
9643  *- - DIGUY_DIS_LIFEFORM_SQUATTING (11)
9644  *- - DIGUY_DIS_LIFEFORM_CROUCHING (12)
9645  *- - DIGUY_DIS_LIFEFORM_WADING (13)
9646  **
9647  ** Valid values for primary_weapon_state:
9648  **
9649  *- - DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9650  *- - DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9651  *- - DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9652  *- - DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9653  **
9654  ** Note that a backward motion can be requested in a couple of
9655  ** ways: either by passing a negative speed, or by passing
9656  ** 0 for the forward argument, or both.
9657  **
9658  *b Returns:
9659  **
9660  ** name of an action if a match is found, NULL if not
9661  **
9662  *b Callable For Networked Entities That Are:
9663  **
9664  *- - DIS published
9665  */
9666  const char* get_action_from_entity_state(int damage_state,
9667  int life_form_state,
9668  int primary_weapon_state,
9669  float speed,
9670  int forward);
9671 
9672  /*l
9673  *b Description:
9674  **
9675  ** Sets the damage state for the network published character.
9676  ** Depending on the appearance configuration info the character may automatically switch to a new appearance.
9677  **
9678  *b Arguments:
9679  **
9680  *a state - one of the values listed below
9681  **
9682  ** Valid values for state (defined in diguy_dis_constants.h):
9683  **
9684  *- - DIGUY_DIS_DAMAGE_NONE (0)
9685  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9686  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9687  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9688  **
9689  *b Callable For Networked Entities That Are:
9690  **
9691  *- - DIS published
9692  */
9693  void set_DIS_damage_state(int state);
9694 
9697  int get_DIS_damage_state();
9698 
9699  /*l
9700  *b Description:
9701  **
9702  ** Returns the name of damage state appearances based on the base appearance of the character.
9703  ** NULL if there is no appearance specified.
9704  */
9705  const char * get_damage_state_appearance_name(int state);
9706 
9707  /*l
9708  *b Description:
9709  **
9710  ** Sets the smoke state for a network published character.
9711  ** Starts or stops the "smoke" and "engine_smoke" appearance
9712  ** effects as appropriate.
9713  **
9714  *b Arguments:
9715  **
9716  *a state - one of the values listed below
9717  **
9718  ** Valid values for state (defined in diguy_dis_constants.h):
9719  **
9720  *- - DIGUY_DIS_SMOKE_NOT_SMOKING (0)
9721  *- - DIGUY_DIS_SMOKE_SMOKE_PLUME (1)
9722  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE (2)
9723  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE_AND_SMOKE_PLUME (3)
9724  **
9725  *b Callable For Networked Entities That Are:
9726  **
9727  *- - DIS published
9728  */
9729  void set_DIS_smoke_state(int state);
9730 
9733  int get_DIS_smoke_state();
9734 
9735  /*l
9736  *b Description:
9737  **
9738  ** Sets the flames state for a network published character.
9739  ** Starts or stops the "flames" appearance effect as appropriate.
9740  **
9741  *b Arguments:
9742  **
9743  ** state - one of the values listed below
9744  **
9745  ** Valid values for state (defined in diguy_dis_constants.h):
9746  **
9747  *- - DIGUY_DIS_FLAMES_NONE (0)
9748  *- - DIGUY_DIS_FLAMES_PRESENT (1)
9749  **
9750  *b Callable For Networked Entities That Are:
9751  **
9752  *- - DIS published
9753  */
9754  void set_DIS_flames_state(int state);
9755 
9758  int get_DIS_flames_state();
9759 
9760  /*l
9761  *b Description:
9762  **
9763  ** Sets the power plant state for a network published character.
9764  ** Vehicle power plants default to being on.
9765  **
9766  *b Arguments:
9767  **
9768  ** state - one of the values listed below
9769  **
9770  ** Valid values for state (defined in diguy_dis_constants.h):
9771  **
9772  *- - DIGUY_DIS_POWER_PLANT_OFF (0)
9773  *- - DIGUY_DIS_POWER_PLANT_ON (1)
9774  **
9775  *b Callable For Networked Entities That Are:
9776  **
9777  *- - DIS published
9778  */
9779  void set_DIS_power_plant_state(int state);
9780 
9783  int get_DIS_power_plant_state();
9784 
9787  void set_emissivity(float r, float g, float b, float lerp_time = .25);
9788 
9791  void get_emissivity(float *r, float *g, float *b);
9792 
9793  /*l
9794  *b Description:
9795  **
9796  ** Sets the trailing effect state for a network published character.
9797  **
9798  *b Arguments:
9799  **
9800  ** state - one of the values listed below
9801  **
9802  ** Valid values for state (defined in diguy_dis_constants.h):
9803  **
9804  *- - DIGUY_DIS_TRAILING_EFFECT_NONE (0)
9805  *- - DIGUY_DIS_TRAILING_EFFECT_SMALL (1)
9806  *- - DIGUY_DIS_TRAILING_EFFECT_MEDIUM (2)
9807  *- - DIGUY_DIS_TRAILING_EFFECT_LARGE (3)
9808  **
9809  *b Callable For Networked Entities That Are:
9810  **
9811  *- - DIS published
9812  */
9813  void set_DIS_trailing_effect_state(int state);
9814 
9817  int get_DIS_trailing_effect_state();
9818 
9821  void set_head_lights_state(int state);
9822 
9824  int get_head_lights_state() const;
9825 
9827  void set_tail_lights_state(int state);
9828 
9830  int get_tail_lights_state() const;
9831 
9832 /*****************************************************************************/
9842  /*l
9843  *b Description:
9844  **
9845  ** This function will create a new active formation with this
9846  ** character as its leader. The formation followers will fall
9847  ** into the formation given by the formation name.
9848  **
9849  ** The formation is broken up, or disbanded, by calling
9850  ** break_formation().
9851  **
9852  *b Arguments:
9853  **
9854  *a formation_name - the name of the formation
9855  *a snap_to_position_flag - if 1, following characters will
9856  *a immediately snap to their assigned
9857  *a positions; otherwise following characters
9858  *a will move toward their assigned
9859  *a positions from their current positions
9860  *a break_existing_formations_flag - if 1, any formations this
9861  *a character is leading with be broken
9862  *a as if the break_formation() call were
9863  *a made
9864  **
9865  *b Returns:
9866  **
9867  ** 0 on success, -1 on failure
9868  **
9869  *b Available as Decision Bead/Event
9870  */
9871  int call_formation(const char* formation_name,
9872  int snap_to_position_flag = 0,
9873  int break_existing_formations_flag = 1);
9874 
9875  /*l
9876  *b Description:
9877  **
9878  ** This function breaks up a formation initiated by call_formation().
9879  **
9880  *b Arguments:
9881  **
9882  *a formation_name - the name of the formation to break;
9883  *a passing NULL or "(all)" will break all formations
9884  *a this character is leading
9885  **
9886  *b Returns:
9887  **
9888  ** 0 on success, -1 on failure
9889  **
9890  *b Available as Decision Bead/Event
9891  */
9892  int break_formation(const char* formation_name = NULL);
9893 
9894 
9895 /*****************************************************************************/
9903  /*l
9904  *b Description:
9905  **
9906  ** This function adds a copy of the specified scenario guide
9907  ** to the character. Any changes that are subsequently made
9908  ** to the added guide -- for example by a call to
9909  ** diguyCharacterGuide::set_algorithm_float_parameter() -- are
9910  ** private to this copy of the guide and will not affect others.
9911  **
9912  ** The guide will be enabled by default. Guides can be disabled
9913  ** by calling diguyCharacterGuide::set_guide_enabled(0), or by
9914  ** passing 1 for the argument automatically_disable_when_acquired.
9915  **
9916  ** Note that disabling a guide is not the same as removing it.
9917  ** Disabled guides are still a part of the character and can
9918  ** later be re-enabled by calling diguyCharacterGuide::set_enabled().
9919  **
9920  *b Arguments:
9921  **
9922  *a guide_name - name of guide to find and copy
9923  *a automatically_disable_when_acquired - set to 1 to have the guide
9924  *a be automatically disabled when it has acquired
9925  *a its target
9926  **
9927  *b Returns:
9928  **
9929  ** object of type diguyCharacterGuide; if a guide with guide_name
9930  ** is not found, returns NULL
9931  */
9932  diguyCharacterGuide* add_guide(const char* guide_name,
9933  int automatically_disable_when_acquired = 0);
9934 
9935  /*l
9936  *b Description:
9937  **
9938  ** This function creates a new guide and adds it to the character.
9939  **
9940  ** The guide will be enabled by default. Guides can be disabled
9941  ** by calling diguyCharacterGuide::set_guide_enabled(), or by
9942  ** passing 1 for the argument automatically_disable_when_acquired.
9943  **
9944  ** Important note: a new guide will always be created, even if one with
9945  ** the same name already exists
9946  **
9947  *b Arguments:
9948  **
9949  *a guide_name - name of guide to find and copy
9950  *a guide_algorithm - name of guide algorithm to be used
9951  *a automatically_disable_when_acquired - set to 1 to have the guide
9952  *a be automatically disabled when it has
9953  *a acquired its target
9954  **
9955  *b Returns:
9956  **
9957  ** object of type diguyCharacterGuide; if a guide with guide_name
9958  ** is not found, returns NULL
9959  */
9960  diguyCharacterGuide* create_guide(const char* guide_name,
9961  const char* guide_algorithm,
9962  int automatically_disable_when_acquired = 0);
9963 
9964  /*l
9965  *b Description:
9966  **
9967  ** Like create_guide(), but returns guide if it already exists
9968  **
9969  *b Arguments:
9970  **
9971  *a guide_name - name of guide to find and copy
9972  *a guide_algorithm - name of guide algorithm to be used
9973  *a automatically_disable_when_acquired - set to 1 to have the guide
9974  *a be automatically disabled when it has
9975  *a acquired its target
9976  **
9977  *b Returns:
9978  **
9979  ** object of type diguyCharacterGuide; if a guide with guide_name
9980  ** is not found, returns NULL
9981  */
9982  diguyCharacterGuide* find_or_create_guide(const char* guide_name,
9983  const char* guide_algorithm,
9984  int automatically_disable_when_acquired = 0);
9985 
9986  /*l
9987  *b Description:
9988  **
9989  ** This function returns a pointer to the specified guide
9990  ** of the character, if is exists.
9991  **
9992  *b Arguments:
9993  **
9994  *a guide_name - name of guide to find
9995  **
9996  *b Returns:
9997  **
9998  ** object of type diguyCharacterGuide; if a guide with guide_name
9999  ** is not found, returns NULL
10000  */
10001  diguyCharacterGuide* find_guide(const char* guide_name);
10002 
10003  /*l
10004  *b Description:
10005  **
10006  ** This function removes the specified guide from the
10007  ** character.
10008  **
10009  *b Arguments:
10010  **
10011  *a guide_name - name of the guide to remove; must match name
10012  *a used by add_guide() or create_guide() call
10013  **
10014  *b Returns:
10015  **
10016  ** 0 on success, -1 on failure
10017  */
10018  int remove_guide_with_name(const char* guide_name);
10019 
10020  /*l
10021  *b Description:
10022  **
10023  ** This function removes the specified guide from the
10024  ** character.
10025  **
10026  *b Arguments:
10027  **
10028  *a guide - object returned by add_guide() call
10029  **
10030  *b Returns:
10031  **
10032  ** 0 on success, -1 on failure
10033  */
10034  int remove_guide(diguyCharacterGuide* guide);
10035 
10036  /*l
10037  *b Description:
10038  **
10039  ** This function removes all guides from the character.
10040  **
10041  *b Returns:
10042  **
10043  ** 0 on success, -1 on failure
10044  */
10045  int remove_all_guides();
10046 
10047  /*l
10048  *b Description:
10049  **
10050  ** This function removes all guides that are disabled.
10051  **
10052  *b Returns:
10053  **
10054  ** 0 on success, -1 on failure
10055  */
10056  int remove_all_disabled_guides();
10057 
10058 
10059 /*****************************************************************************/
10069  /*l
10070  *b Description:
10071  **
10072  ** This function adds a "motion texture" to the character. A
10073  ** motion texture is a relatively long (usually 10 seconds or
10074  ** more) loop that will add natural-looking, low amplitude
10075  ** joint angle adjustments.
10076  **
10077  ** This function will have no effect on a dead character (see
10078  ** die_now() and get_dead()).
10079  **
10080  *b Arguments:
10081  **
10082  *a motex_name - name of the motion texture to add; see below
10083  *a texture_gain - the relative amplitude of the motion texture;
10084  *a higher numbers result in more pronounced
10085  *a movements
10086  *a end_previous_motex - flag denoting whether this motion texture
10087  *a replaces all previously added motion
10088  *a textures; pass 1 to end existing textures
10089  *a rampup_interval - how long, in seconds, to take ramping up
10090  *a into the motion texture
10091  **
10092  ** List of currently available motion textures:
10093  **
10094  *- - "default"
10095  *- - "motex_stand_casual"
10096  **
10097  ** If 1 is passed for the argument end_previous_motex, the
10098  ** rampup_interval argument will be used as the interval for
10099  ** ending existing motion textures.
10100  **
10101  *b Returns:
10102  **
10103  ** 0 on success, -1 on failure
10104  **
10105  */
10106  int add_motion_texture(const char* motex_name = "default",
10107  float texture_gain = 1.0f,
10108  int end_previous_motex = 1,
10109  float rampup_interval = 0.2f);
10110 
10111  /*l
10112  *b Description:
10113  **
10114  ** This function gradually ends any active motion textures added by
10115  ** add_motion_texture().
10116  **
10117  *b Arguments:
10118  **
10119  *a rampdown_interval - how long, in seconds, to take ending the
10120  *a motion texture
10121  **
10122  *b Returns:
10123  **
10124  ** 0 on success, -1 on failure
10125  */
10126  int end_motion_texture(float rampdown_interval = 0.2f);
10127 
10128  /*l
10129  *b Description:
10130  **
10131  ** This function sets an initial motion texture that should be
10132  ** used by the character whenever the character is loaded from
10133  ** a scenario or the character's scenario is reset.
10134  **
10135  ** The gain of the motion texture can be set by calling
10136  ** set_initial_motion_texture_gain(). The initial motion
10137  ** texture gain is 1.0 by default.
10138  **
10139  *b See Also:
10140  **
10141  ** add_motion_texture(), set_initial_motion_texture_gain()
10142  **
10143  *b Arguments:
10144  **
10145  *a motex_name - name of the motion texture
10146  **
10147  *b Returns:
10148  **
10149  ** 0 on success, -1 on failure
10150  */
10151  int set_initial_motion_texture(const char* motex_name);
10152 
10153  /*l
10154  *b Description:
10155  **
10156  ** This function returns the initial motion texture as set
10157  ** by a call to set_initial_motion_texture().
10158  **
10159  *b Returns:
10160  **
10161  ** name of initial motion texture
10162  */
10163  const char* get_initial_motion_texture();
10164 
10165  /*l
10166  *b Description:
10167  **
10168  ** This function sets the gain of the initial motion texture
10169  ** of the character. The initial motion texture can be set
10170  ** by calling set_initial_motion_texture().
10171  **
10172  *b Arguments:
10173  **
10174  *a motex_gain - gain of the motion texture; higher gains
10175  *a result in more pronounced motion
10176  **
10177  *b Returns:
10178  **
10179  ** 0 on success, -1 on failure
10180  */
10181  int set_initial_motion_texture_gain(float motex_gain);
10182 
10183  /*l
10184  *b Description:
10185  **
10186  ** This function returns the initial motion texture gain as set
10187  ** by a call to set_initial_motion_texture_gain().
10188  **
10189  *b Returns:
10190  **
10191  ** gain of initial motion texture
10192  */
10193  float get_initial_motion_texture_gain();
10194 
10195 
10196 /*****************************************************************************/
10206  /*l
10207  *b Description:
10208  **
10209  ** This function sets what type of "history" will be kept for the
10210  ** character.
10211  **
10212  ** If time is run backwards in a scenario, characters
10213  ** with history will replay the motions they performed at that
10214  ** time. Characters without history will stay frozen in place
10215  ** until time advances past the point from which it was run
10216  ** backwards.
10217  **
10218  ** The default is DIGUY_HISTORY_TYPE_NONE for characters created
10219  ** using the diguyScenario::create_character() function.
10220  ** Characters loaded from a .dss file will retain their history
10221  ** settings from the DI-Guy Scenario editing session.
10222  **
10223  *b Arguments:
10224  **
10225  *a history_type - history type to be used for the character
10226  **
10227  ** history_type should be one of the following values:
10228  **
10229  *i DIGUY_HISTORY_TYPE_NONE
10230  **
10231  ** This history type saves no history.
10232  **
10233  *i DIGUY_HISTORY_TYPE_COMPLETE
10234  **
10235  ** This history type saves all of a character's history.
10236  **
10237  ** The initial amount of history to be saved, before memory buffers
10238  ** need to be resized, can be set by the function
10239  ** set_history_size_t(). The size by which memory buffers grow each
10240  ** time they do need to get resized by be set by
10241  ** set_history_size_increment_t().
10242  **
10243  *i DIGUY_HISTORY_TYPE_FIRST
10244  **
10245  ** This history type is no longer supported. Characters from
10246  ** a .dss that have this history type will have their history
10247  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10248  **
10249  *i DIGUY_HISTORY_TYPE_LAST
10250  **
10251  ** This history type is no longer supported. Characters from
10252  ** a .dss that have this history type will have their history
10253  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10254  **
10255  *b Returns:
10256  **
10257  ** 0 on success, -1 on failure
10258  */
10259  int set_history_type(diguyHistoryType history_type);
10260 
10261  /*l
10262  *b Returns:
10263  **
10264  ** the current history type of the character; see
10265  ** set_history_type()
10266  */
10267  diguyHistoryType get_history_type();
10268 
10269  /*l
10270  *b Description:
10271  **
10272  ** This function sets the size of the character's history
10273  ** buffer, in seconds.
10274  **
10275  *b Arguments:
10276  **
10277  *a t - length of history buffer, in seconds
10278  **
10279  *b Returns:
10280  **
10281  ** 0 on success, -1 on failure
10282  */
10283  int set_history_size_t(float t);
10284 
10285  /*l
10286  *b Description:
10287  **
10288  ** This function returns the current history buffer size.
10289  ** See set_history_size_t().
10290  **
10291  *b Returns:
10292  **
10293  ** current history size
10294  */
10295  float get_history_size_t();
10296 
10297  /*l
10298  *b Description:
10299  **
10300  ** This function sets the size of the character's history
10301  ** buffer increment, in seconds.
10302  **
10303  *b Arguments:
10304  **
10305  *a t - length of history buffer increment, in seconds
10306  **
10307  *b Returns:
10308  **
10309  ** 0 on success, -1 on failure
10310  */
10311  int set_history_size_increment_t(float t);
10312 
10313  /*l
10314  *b Description:
10315  **
10316  ** This function returns the current history buffer size increment.
10317  ** See set_history_size_increment_t().
10318  **
10319  *b Returns:
10320  **
10321  ** current history size increment
10322  */
10323  float get_history_size_increment_t();
10324 
10325 
10326 /*****************************************************************************/
10336  /*l
10337  *b Description:
10338  **
10339  ** This function sets the desired posture of the character. This,
10340  ** along with the desired variant, is used primarily by some guides.
10341  ** Specifically, to help choose which actions are used to reach the
10342  ** desired position and orientation of the character.
10343  **
10344  ** Pass DIGUY_MOTION_POSTURE_ANY for there to be no desired posture.
10345  **
10346  *b Arguments:
10347  **
10348  *a posture - new desired posture
10349  */
10350  void set_desired_posture(diguyMotionPosture desired_posture);
10351 
10352  /*l
10353  *b Returns:
10354  **
10355  ** current desired posture of the character
10356  */
10357  diguyMotionPosture get_desired_posture();
10358 
10359  /*l
10360  *b Description:
10361  **
10362  ** This function sets the desired variant of the character. This,
10363  ** along with the desired posture, is used primarily by some guides.
10364  ** Specifically, to help choose which actions are used to reach the
10365  ** desired position and orientation of the character.
10366  **
10367  ** Pass DIGUY_MOTION_VARIANT_ANY for there to be no desired variant.
10368  **
10369  *b Arguments:
10370  **
10371  *a variant - new desired variant
10372  */
10373  void set_desired_variant(diguyMotionVariant desired_variant);
10374 
10376  diguyMotionVariant get_desired_variant();
10377 
10378  /*l
10379  *b Description:
10380  **
10381  ** This function looks up the character action that most closely
10382  ** matches the given criteria.
10383  **
10384  *b Arguments:
10385  **
10386  *a direction - the direction of travel relative to
10387  *a the character's facing direction
10388  *a posture - overall desired posture; pass
10389  *a DIGUY_MOTION_POSTURE_ANY
10390  *a to specify that any posture will do
10391  *a variant - overall desired variant; pass
10392  *a DIGUY_MOTION_VARIANT_ANY
10393  *a to specify that any variant will do
10394  *a speed - speed in meters per second
10395  *a comparison - how the passed speed should compare
10396  *a to the action's speed
10397  *a comparison_tolerance - tolerance of comparison
10398  *a match_posture_before_variant - pass 1 if posture should be matched
10399  *a before variant if an exact match is
10400  *a not found; pass 0 if variant should
10401  *a be matched before posture
10402  *a posture_alternate1 - if an exact match is not found, use this
10403  *a as the first alternate posture; pass
10404  *a DIGUY_MOTION_POSTURE_UNKNOWN
10405  *a to specify that no alternate should be used
10406  *a posture_alternate2 - if an exact match is not found, use this
10407  *a as the second alternate posture; pass
10408  *a DIGUY_MOTION_POSTURE_UNKNOWN
10409  *a to specify that no alternate should be used
10410  *a variant_alternate1 - if an exact match is not found, use this
10411  *a as the first alternate variant; pass
10412  *a DIGUY_MOTION_VARIANT_UNKNOWN
10413  *a to specify that no alternate should be used
10414  *a variant_alternate2 - if an exact match is not found, use this
10415  *a as the second alternate variant; pass
10416  *a DIGUY_MOTION_VARIANT_UNKNOWN
10417  *a to specify that no alternate should be used
10418  *a return_random_match - (Experimental) if multiple actions match the
10419  *a specified criteria randomly return one of
10420  *a them. Typically only used for still motions
10421  *a and restricted to EQUAL and NEAREST
10422  *a comparisons
10423  **
10424  ** The direction argument should be one of the following:
10425  **
10426  *- - DIGUY_MOTION_DIRECTION_NONE - does not move character
10427  *- - DIGUY_MOTION_DIRECTION_FORWARD - moves character forward
10428  *- - DIGUY_MOTION_DIRECTION_BACKWARD - moves character backward
10429  *- - DIGUY_MOTION_DIRECTION_LEFT - moves character left
10430  *- - DIGUY_MOTION_DIRECTION_RIGHT - moves character right
10431  *- - DIGUY_MOTION_DIRECTION_UP - moves character up
10432  *- - DIGUY_MOTION_DIRECTION_DOWN - moves character down
10433  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10434  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10435  *- - DIGUY_MOTION_DIRECTION_NONLINEAR - moves character in
10436  *- multiple directions
10437  *- - DIGUY_MOTION_DIRECTION_LINEAR_OFFAXIS - moves character in a
10438  *- line, but not on any
10439  *- of the principle axes
10440  **
10441  ** Not every direction is supported by every character. If the
10442  ** character does not have any actions that move in the specified
10443  ** direction, the returned action will be NULL.
10444  **
10445  ** Use the calls diguyScenario::get_character_type_num_directions()
10446  ** and diguyScenario::get_character_type_direction_at_index() to
10447  ** enumerate which directions a character can travel.
10448  **
10449  ** The posture arguments should be one of the following:
10450  **
10451  *- - DIGUY_MOTION_POSTURE_UNKNOWN - unknown posture
10452  *- - DIGUY_MOTION_POSTURE_ANY - any posture; a wildcard
10453  *- - DIGUY_MOTION_POSTURE_UPRIGHT - upright posture; e.g., standing
10454  *- or walking
10455  *- - DIGUY_MOTION_POSTURE_CROUCHED - crouched posture; e.g., kneeling
10456  *- or walking low
10457  *- - DIGUY_MOTION_POSTURE_PRONE - prone posture; e.g., lying prone
10458  *- or crawling
10459  *- - DIGUY_MOTION_POSTURE_SITTING - sitting posture
10460  **
10461  ** The posture arguments specify the overall posture the action
10462  ** should have. Most characters have an upright posture.
10463  ** The other postures a character has is dependent on character type.
10464  ** Passing DIGUY_MOTION_POSTURE_ANY for the arguments posture,
10465  ** posture_alternate1, or posture_alternate2 means that the posture of
10466  ** the action should not be used to determine a match.
10467  **
10468  ** Use the calls diguyScenario::get_character_type_num_postures()
10469  ** and diguyScenario::get_character_type_posture_at_index() to
10470  ** enumerate which postures a specific character type has.
10471  **
10472  ** The variant arguments specify the overall mood the action should
10473  ** convey. Most characters have a "normal" variant. The other
10474  ** variants a character has is dependent on character type. Passing
10475  ** DIGUY_MOTION_VARIANT_ANY for the arguments variant,
10476  ** variant_alternate1, or variant_alternate2 means that the variant of
10477  ** the action should not be used to determine a match.
10478  **
10479  ** Use the calls diguyScenario::get_character_type_num_variants()
10480  ** and diguyScenario::get_character_type_variant_at_index() to
10481  ** enumerate which variants a specific character type has.
10482  **
10483  ** The comparison argument should be one of the following:
10484  **
10485  *- - DIGUY_PARAMETER_COMPARISON_EQUAL - matched action's speed
10486  *- must be within
10487  *- comparison_tolerance of
10488  *- passed speed
10489  *- - DIGUY_PARAMETER_COMPARISON_NEAREST - matched action's speed
10490  *- is closer than any other
10491  *- potential match's, but
10492  *- still within
10493  *- comparison_tolerance
10494  *- - DIGUY_PARAMETER_COMPARISON_GREATER - matched action's speed
10495  *- faster than passed speed,
10496  *- but still within
10497  *- comparison_tolerance
10498  *- - DIGUY_PARAMETER_COMPARISON_LESS - matched action's speed
10499  *- slower than passed speed,
10500  *- but still within
10501  *- comparison_tolerance
10502  *-
10503  ** The difference between DIGUY_PARAMETER_COMPARISON_EQUAL and
10504  ** DIGUY_PARAMETER_COMPARISON_NEAREST is largely in the
10505  ** value used for comparison_tolerance if DIGUY_DEFAULT_FLOAT is
10506  ** passed; the comparison_tolerance argument defaults to 0.001 for
10507  ** DIGUY_PARAMETER_COMPARISON_EQUAL, and 16384.0 for all
10508  ** other comparison types. Otherwise these two comparison types
10509  ** operate the same.
10510  **
10511  *b Returns:
10512  **
10513  ** name of an action if a match is found, NULL if not
10514  **
10515  *b C++ Example:
10516  **
10517  *e diguyCharacter* ch = scenario->get_character_at_index(0);
10518  *e const char* new_action;
10519  *e
10520  *e //
10521  *e // Get an action that moves forward in an upright posture,
10522  *e // whose speed move at least 2.0 meters per second:
10523  *e //
10524  *e new_action = ch->get_action_from_description(
10525  *e DIGUY_MOTION_DIRECTION_FORWARD,
10526  *e DIGUY_MOTION_POSTURE_UPRIGHT,
10527  *e DIGUY_MOTION_VARIANT_ANY,
10528  *e 2.0,
10529  *e DIGUY_PARAMETER_COMPARISON_GREATER, DIGUY_DEFAULT_FLOAT);
10530  *e
10531  *e //
10532  *e // Get an action that is standing still, with the variant
10533  *e // DIGUY_MOTION_VARIANT_READY. If no action has that variant,
10534  *e // try DIGUY_MOTION_VARIANT_AIM as variant_alternate1,
10535  *e // and DIGUY_MOTION_VARIANT_ANY as variant_alternate2:
10536  *e //
10537  *e new_action = ch->get_action_from_description(
10538  *e DIGUY_MOTION_DIRECTION_NONE,
10539  *e DIGUY_MOTION_POSTURE_ANY,
10540  *e DIGUY_MOTION_VARIANT_READY,
10541  *e 0.0,
10542  *e DIGUY_PARAMETER_COMPARISON_NEAREST, DIGUY_DEFAULT_FLOAT,
10543  *e 0,
10544  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10545  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10546  *e DIGUY_MOTION_VARIANT_AIM,
10547  *e DIGUY_MOTION_VARIANT_ANY);
10548  **
10549  */
10550  const char* get_action_from_description(diguyMotionDirection direction,
10551  diguyMotionPosture posture,
10552  diguyMotionVariant variant,
10553  float speed,
10555  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10556  int match_posture_before_variant = 1,
10557  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10558  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10559  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10560  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN,
10561  int return_random_match = 0);
10562 
10563  /*l
10564  *b Description:
10565  **
10566  ** This function is very similar to get_action_from_description(),
10567  ** but substitutes turn amount per action iteration for speed.
10568  **
10569  *b Arguments:
10570  **
10571  *a direction - the direction of travel relative to
10572  *a the character's facing direction
10573  *a posture - overall desired posture; pass
10574  *a DIGUY_MOTION_POSTURE_ANY
10575  *a to specify that any posture will do
10576  *a variant - overall desired variant; pass
10577  *a DIGUY_MOTION_VARIANT_ANY
10578  *a to specify that any variant will do
10579  *a turn_amount - how many degrees each iteration of the
10580  *a action should turn the character
10581  *a comparison - how the passed turn amount should compare
10582  *a to the action's turn amount
10583  *a comparison_tolerance - tolerance of comparison
10584  *a match_posture_before_variant - pass 1 if posture should be matched
10585  *a before variant if an exact match is
10586  *a not found; pass 0 if variant should
10587  *a be matched before posture
10588  *a posture_alternate1 - if an exact match is not found, use this
10589  *a as the first alternate posture; pass
10590  *a DIGUY_MOTION_POSTURE_UNKNOWN
10591  *a to specify that no alternate should be used
10592  *a posture_alternate2 - if an exact match is not found, use this
10593  *a as the second alternate posture; pass
10594  *a DIGUY_MOTION_POSTURE_UNKNOWN
10595  *a to specify that no alternate should be used
10596  *a variant_alternate1 - if an exact match is not found, use this
10597  *a as the first alternate variant; pass
10598  *a DIGUY_MOTION_VARIANT_UNKNOWN
10599  *a to specify that no alternate should be used
10600  *a variant_alternate2 - if an exact match is not found, use this
10601  *a as the second alternate variant; pass
10602  *a DIGUY_MOTION_VARIANT_UNKNOWN
10603  *a to specify that no alternate should be used
10604  **
10605  ** The direction argument should be one of the following:
10606  **
10607  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10608  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10609  **
10610  ** Not every direction is supported by every character. If the
10611  ** character does not have any actions that move in the specified
10612  ** direction, the returned action will be NULL.
10613  **
10614  ** The turn amount argument should be a positive number.
10615  **
10616  ** Refer to get_action_from_description() for more information on
10617  ** other arguments.
10618  **
10619  *b Returns:
10620  **
10621  ** name of an action if a match is found, NULL if not
10622  **
10623  */
10624  const char* get_turning_action_from_description(diguyMotionDirection direction,
10625  diguyMotionPosture posture,
10626  diguyMotionVariant variant,
10627  float turn_amount,
10629  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10630  int match_posture_before_variant = 1,
10631  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10632  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10633  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10634  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN);
10635 
10636 
10637 /*****************************************************************************/
10647  /*l
10648  *b Returns:
10649  **
10650  ** number of variables the character has
10651  */
10652  int get_num_variables();
10653 
10654  /*l
10655  *b Returns:
10656  **
10657  ** pointer of type diguyVariable; NULL if no
10658  ** variable at the specified index
10659  **
10660  *b Arguments:
10661  **
10662  *a index - index of the variable; indices start at 0
10663  */
10664  diguyVariable* get_variable_at_index(int index);
10665 
10666  /*l
10667  *b Description:
10668  **
10669  ** This function returns a pointer to the specified variable.
10670  **
10671  *b Arguments:
10672  **
10673  *a name - name of variable to be found
10674  **
10675  *b Returns:
10676  **
10677  ** pointer of type diguyVariable; NULL if not found
10678  */
10679  diguyVariable* find_variable(const char* name);
10680 
10681  /*l
10682  *b Description:
10683  **
10684  ** This function finds the variable with the given name or
10685  ** creates it if it doesn't exist.
10686  **
10687  *b Arguments:
10688  **
10689  *a name - name of the variable to find or create
10690  **
10691  *b Returns:
10692  **
10693  ** pointer of type diguyVariable; should never be NULL
10694  */
10695  diguyVariable* find_or_create_variable(const char* name);
10696 
10697  /*l
10698  *b Description:
10699  **
10700  ** This function destroys the passed variable.
10701  **
10702  *b Arguments:
10703  **
10704  *a variable - pointer to a diguyVariable
10705  **
10706  *b Returns:
10707  **
10708  ** 0 on success, -1 on failure
10709  */
10710  int destroy_variable(diguyVariable* variable);
10711 
10712  /*l
10713  *b Returns:
10714  **
10715  ** 1 if variable is equal to passed value,
10716  ** 0 if not
10717  **
10718  *b Arguments:
10719  **
10720  *a varname - name of variable to compare
10721  *a value - value to compare against
10722  **
10723  *b Available as Decision Bead/Event
10724  */
10725  int variable_equal_to_int(const char* varname, int value);
10726 
10727  /*l
10728  *b Returns:
10729  **
10730  ** 1 if variable is greater than passed value,
10731  ** 0 if not
10732  **
10733  *b Arguments:
10734  **
10735  *a varname - name of variable to compare
10736  *a value - value to compare against
10737  **
10738  *b Available as Decision Bead/Event
10739  */
10740  int variable_greater_than_int(const char* varname, int value);
10741 
10742  /*l
10743  *b Returns:
10744  **
10745  ** 1 if variable is less than passed value,
10746  ** 0 if not
10747  **
10748  *b Arguments:
10749  **
10750  *a varname - name of variable to compare
10751  *a value - value to compare against
10752  **
10753  *b Available as Decision Bead/Event
10754  */
10755  int variable_less_than_int(const char* varname, int value);
10756 
10757  /*l
10758  *b Returns:
10759  **
10760  ** 1 if variable is equal to passed value,
10761  ** 0 if not
10762  **
10763  *b Arguments:
10764  **
10765  *a varname - name of variable to compare
10766  *a value - value to compare against
10767  **
10768  *b Available as Decision Bead/Event
10769  */
10770  int variable_equal_to_float(const char* varname, float value);
10771 
10772  /*l
10773  *b Returns:
10774  **
10775  ** 1 if variable is greater than passed value,
10776  ** 0 if not
10777  **
10778  *b Arguments:
10779  **
10780  *a varname - name of variable to compare
10781  *a value - value to compare against
10782  **
10783  *b Available as Decision Bead/Event
10784  */
10785  int variable_greater_than_float(const char* varname, float value);
10786 
10787  /*l
10788  *b Returns:
10789  **
10790  ** 1 if variable is less than passed value,
10791  ** 0 if not
10792  **
10793  *b Arguments:
10794  **
10795  *a varname - name of variable to compare
10796  *a value - value to compare against
10797  **
10798  *b Available as Decision Bead/Event
10799  */
10800  int variable_less_than_float(const char* varname, float value);
10801 
10802  /*l
10803  *b Returns:
10804  **
10805  ** 1 if variable is equal than passed value,
10806  ** 0 if not
10807  **
10808  *b Arguments:
10809  **
10810  *a varname - name of variable to compare
10811  *a value - value to compare against
10812  **
10813  *b Available as Decision Bead/Event
10814  */
10815  int variable_equal_to_string(const char* varname, const char* value);
10816 
10817  /*l
10818  *b Returns:
10819  **
10820  ** 1 if variable is greater than passed value (comes
10821  ** later alphabetically), 0 if not
10822  **
10823  *b Arguments:
10824  **
10825  *a varname - name of variable to compare
10826  *a value - value to compare against
10827  **
10828  *b Available as Decision Bead/Event
10829  */
10830  int variable_greater_than_string(const char* varname, const char* value);
10831 
10832  /*l
10833  *b Returns:
10834  **
10835  ** 1 if variable is less than passed value (comes
10836  ** sooner alphabetically), 0 if not
10837  **
10838  *b Arguments:
10839  **
10840  *a varname - name of variable to compare
10841  *a value - value to compare against
10842  **
10843  *b Available as Decision Bead/Event
10844  */
10845  int variable_less_than_string(const char* varname, const char* value);
10846 
10847  /*l
10848  *b Description:
10849  **
10850  ** This function decrements the variable by the passed amount.
10851  **
10852  *b Arguments:
10853  **
10854  *a varname - name of variable to modify
10855  *a value - amount to decrement
10856  **
10857  *b Returns:
10858  **
10859  ** 0 on success, -1 on failure
10860  **
10861  *b Available as Decision Bead/Event
10862  */
10863  int variable_decrement_value_as_int(const char* varname, int value = 1);
10864 
10865  /*l
10866  *b Description:
10867  **
10868  ** This function increments the variable by the passed amount.
10869  **
10870  *b Arguments:
10871  **
10872  *a varname - name of variable to modify
10873  *a value - amount to increment
10874  **
10875  *b Returns:
10876  **
10877  ** 0 on success, -1 on failure
10878  **
10879  *b Available as Decision Bead/Event
10880  */
10881  int variable_increment_value_as_int(const char* varname, int value = 1);
10882 
10883  /*l
10884  *b Description:
10885  **
10886  ** This function is a convenience function for setting the variable
10887  ** to a new integer value without retrieving the diguyVariable
10888  ** object.
10889  **
10890  *b Arguments:
10891  **
10892  *a varname - name of variable to modify
10893  *a value - new value
10894  *a create_if_doesnt_exist - pass 1 to create the variable if it
10895  *a doesn't exist
10896  **
10897  *b Returns:
10898  **
10899  ** 0 on success, -1 on failure
10900  **
10901  *b Available as Decision Bead/Event
10902  */
10903  int variable_set_value_as_int(const char* varname,
10904  int value,
10905  int create_if_doesnt_exist = 1);
10906 
10907  /*l
10908  *b Description:
10909  **
10910  ** Short form of variable_set_value_as_int().
10911  */
10912  int set_ivar(const char* varname,
10913  int value,
10914  int create_if_doesnt_exist = 1);
10915 
10916  /*l
10917  *b Description:
10918  **
10919  ** This function is a convenience function for retrieving the
10920  ** value of a variable without retrieving the diguyVariable
10921  ** object.
10922  **
10923  ** If the variable doesn't exist and create_if_doesnt_exist is
10924  ** 0, the returned value will be 0.
10925  **
10926  *b Arguments:
10927  **
10928  *a varname - name of variable to query
10929  *a create_if_doesnt_exist - pass 1 to create the variable if it
10930  *a doesn't exist
10931  **
10932  *b Returns:
10933  **
10934  ** value of variable as int
10935  */
10936  int get_ivar(const char* varname,
10937  int create_if_doesnt_exist = 1);
10938 
10939  /*l
10940  *b Description:
10941  **
10942  ** Similar to variable_set_value_as_int(), for sets a
10943  ** floating point value instead.
10944  */
10945  int variable_set_value_as_float(const char* varname,
10946  float value,
10947  int create_if_doesnt_exist = 1);
10948 
10949  /*l
10950  *b Description:
10951  **
10952  ** Short form of variable_set_value_as_float().
10953  */
10954  int set_fvar(const char* varname,
10955  float value,
10956  int create_if_doesnt_exist = 1);
10957 
10958  /*l
10959  *b Description:
10960  **
10961  ** Similar to variable_get_value_as_int(), for returns a
10962  ** floating point value instead.
10963  **
10964  ** If the variable doesn't exist and create_if_doesnt_exist is
10965  ** 0, the returned value will be 0.0.
10966  */
10967  float get_fvar(const char* varname,
10968  int create_if_doesnt_exist = 1);
10969 
10970  /*l
10971  *b Description:
10972  **
10973  ** Similar to variable_set_value_as_int(), for sets a
10974  ** string value instead.
10975  */
10976  int variable_set_value_as_string(const char* varname,
10977  const char* value,
10978  int create_if_doesnt_exist = 1);
10979 
10980  /*l
10981  *b Description:
10982  **
10983  ** Short form of variable_set_value_as_string().
10984  */
10985  int set_svar(const char* varname,
10986  const char* value,
10987  int create_if_doesnt_exist = 1);
10988 
10989  /*l
10990  *b Description:
10991  **
10992  ** Similar to variable_get_value_as_int(), for returns a
10993  ** string value instead.
10994  **
10995  ** If the variable doesn't exist and create_if_doesnt_exist is
10996  ** 0, the returned value will be "".
10997  */
10998  const char* get_svar(const char* varname,
10999  int create_if_doesnt_exist = 1);
11000 
11001 
11002 /*****************************************************************************/
11017  /*l
11018  *b Description:
11019  **
11020  ** This function returns a pointer to the label object of
11021  ** the character.
11022  **
11023  ** Currently character labels are only enabled in DI-Guy Scenario.
11024  **
11025  *b Returns:
11026  **
11027  ** pointer to the character's label
11028  */
11029  diguyViewLabel* get_name_label();
11030 
11031  /*l
11032  *b Description:
11033  **
11034  ** This function sets the text of the character's label.
11035  ** By default the label text matches the character's name.
11036  **
11037  ** Currently character labels are only enabled in DI-Guy Scenario.
11038  **
11039  *b Arguments:
11040  **
11041  *a label_text - new text for the label
11042  **
11043  *b Returns:
11044  **
11045  ** 0 on success, -1 on failure
11046  */
11047  int set_label_text(const char* label_text);
11048 
11049  /*l
11050  *b Description:
11051  **
11052  ** This function returns the character's label text.
11053  ** See set_label_text().
11054  **
11055  *b Returns:
11056  **
11057  ** current label text; the returned pointer will never be NULL
11058  */
11059  const char* get_label_text();
11060 
11061  /*l
11062  *b Description:
11063  **
11064  ** This function sets whether the label of this character
11065  ** is visible. This setting will only be taken into account
11066  ** if the visibility flag for Character Labels is set to
11067  ** "Per Object".
11068  **
11069  ** Currently character labels are only enabled in DI-Guy Scenario.
11070  **
11071  *b Arguments:
11072  **
11073  *a is_visible - pass 1 to show, pass 0 to hide
11074  **
11075  *b Returns:
11076  **
11077  ** 0 on success, -1 on failure
11078  */
11079  int set_label_is_visible(int is_visible);
11080 
11081  /*l
11082  *b Description:
11083  **
11084  ** This function returns the most recent setting of
11085  ** set_label_is_visible().
11086  **
11087  *b Returns:
11088  **
11089  ** 1 if visible, 0 if not
11090  */
11091  int get_label_is_visible();
11092 
11093  /*l
11094  *b Description:
11095  **
11096  ** This function sets the text color of the character's label. By
11097  ** default the label text color is opaque white.
11098  **
11099  ** Currently character labels are only enabled in DI-Guy Scenario.
11100  **
11101  *b Arguments:
11102  **
11103  *a r, g, b, a - the red, green, blue, and alpha
11104  *a components of the text color
11105  **
11106  ** An alpha component of 0 makes the text completely transparent.
11107  ** An alpha component of 1 makes the text completely opaque.
11108  ** Values in between result in varying levels of transparency.
11109  **
11110  *b Returns:
11111  **
11112  ** 0 on success, -1 on failure
11113  */
11114  int set_label_text_color(float r, float g, float b, float a);
11115 
11116  /*l
11117  *b Description:
11118  **
11119  ** Alternate version of set_label_text_color().
11120  */
11121  int set_label_text_color_vec4(const diguyVec4f & color);
11122 
11123  /*l
11124  *b Description:
11125  **
11126  ** This function returns, in the passed variable pointers, the
11127  ** most recent setting of set_label_text_color().
11128  **
11129  *b Returns:
11130  **
11131  ** 0 on success, -1 on failure
11132  */
11133  int get_label_text_color(float* r, float* g, float* b, float* a);
11134 
11135  /*l
11136  *b Description:
11137  **
11138  ** Alternate version of get_label_text_color().
11139  */
11140  diguyVec4f get_label_text_color_vec4();
11141 
11142  /*l
11143  *b Description:
11144  **
11145  ** This function sets the text shadow color of the character's label.
11146  ** By default the label text shadow color is gray.
11147  **
11148  ** Currently character labels are only enabled in DI-Guy Scenario.
11149  **
11150  *b Arguments:
11151  **
11152  *a r, g, b, a - the red, green, blue, and alpha
11153  *a components of the text shadow color
11154  **
11155  ** An alpha component of 0 makes the text completely transparent.
11156  ** An alpha component of 1 makes the text completely opaque.
11157  ** Values in between result in varying levels of transparency.
11158  **
11159  *b Returns:
11160  **
11161  ** 0 on success, -1 on failure
11162  */
11163  int set_label_text_shadow_color(float r, float g, float b, float a);
11164 
11165  /*l
11166  *b Description:
11167  **
11168  ** Alternate version of set_label_text_shadow_color().
11169  */
11170  int set_label_text_shadow_color_vec4(const diguyVec4f & color);
11171 
11172  /*l
11173  *b Description:
11174  **
11175  ** This function returns, in the passed variable pointers, the
11176  ** most recent setting of set_label_text_shadow_color().
11177  **
11178  *b Returns:
11179  **
11180  ** 0 on success, -1 on failure
11181  */
11182  int get_label_text_shadow_color(float* r, float* g, float* b, float* a);
11183 
11184  /*l
11185  *b Description:
11186  **
11187  ** Alternate version of get_label_text_shadow_color().
11188  */
11189  diguyVec4f get_label_text_shadow_color_vec4();
11190 
11191  /*l
11192  *b Description:
11193  **
11194  ** This function sets the whether the text shadow is visible.
11195  **
11196  *b Arguments:
11197  **
11198  *a visible - pass 1 to make shadow visible, 0 to make it invisible
11199  **
11200  *b Returns:
11201  **
11202  ** 0 on success, -1 on failure
11203  */
11204  int set_label_text_shadow_is_visible(int is_visible);
11205 
11206  /*l
11207  *b Returns:
11208  **
11209  ** 1 if text shadow is visible, 0 if not
11210  */
11211  int get_label_text_shadow_is_visible();
11212 
11213  /*l
11214  *b Description:
11215  **
11216  ** This function sets the background color of the character's
11217  ** label. By default the label background color is transparent
11218  ** blue.
11219  **
11220  ** Currently character labels are only enabled in DI-Guy Scenario.
11221  **
11222  *b Arguments:
11223  **
11224  *a r, g, b, a - the red, green, blue, and alpha
11225  *a components of the text color
11226  **
11227  ** An alpha component of 0 makes the text completely transparent.
11228  ** An alpha component of 1 makes the text completely opaque.
11229  ** Values in between result in varying levels of transparency.
11230  **
11231  *b Returns:
11232  **
11233  ** 0 on success, -1 on failure
11234  */
11235  int set_label_background_color(float r, float g, float b, float a);
11236 
11237  /*l
11238  *b Description:
11239  **
11240  ** Alternate version of set_label_background_color().
11241  */
11242  int set_label_background_color_vec4(const diguyVec4f & color);
11243 
11244  /*l
11245  *b Description:
11246  **
11247  ** This function returns, in the passed variable pointers, the
11248  ** most recent setting of set_label_background_color().
11249  **
11250  *b Returns:
11251  **
11252  ** 0 on success, -1 on failure
11253  */
11254  int get_label_background_color(float* r, float* g, float* b, float* a);
11255 
11256  /*l
11257  *b Description:
11258  **
11259  ** Alternate version of get_label_background_color().
11260  */
11261  diguyVec4f get_label_background_color_vec4();
11262 
11263  /*l
11264  *b Description:
11265  **
11266  ** This function sets how high the label of the character will float
11267  ** above the character.
11268  **
11269  *b Arguments:
11270  **
11271  *a offset - offset, in meters, of label above character
11272  */
11273  void set_label_link_offset_override(float offset);
11274 
11275  /*l
11276  *b Returns:
11277  **
11278  ** how high the label of the character will float above the character
11279  */
11280  float get_label_link_offset_override();
11281 
11282  /*l
11283  *b Description:
11284  **
11285  ** This function sets whether the label text should show some basic
11286  ** state information about the character instead of its name or
11287  ** the text set by set_label_text().
11288  **
11289  ** The state shown is: Character name, current path, current action.
11290  ** The current path and current action will change as the character
11291  ** moves through paths and actions.
11292  **
11293  *b Arguments:
11294  **
11295  *a show_state - pass 1 to show state, 0 to show original text
11296  */
11297  int set_label_shows_character_state(int show_state);
11298 
11299  /*l
11300  *b Returns:
11301  **
11302  ** whether character state information is shown instead of the
11303  ** character's name or other label text
11304  */
11305  int get_label_shows_character_state();
11306 
11307 
11308 /*****************************************************************************/
11321  /*l
11322  *b Returns:
11323  **
11324  ** pointer of type diguyImpact; NULL if there has been no recent
11325  ** impact recorded; useful for finding out who or what was hit
11326  */
11327  diguyImpact* get_last_impact_record();
11328 
11329  /*l
11330  *b Returns:
11331  **
11332  ** the last impact number
11333  */
11334  int get_last_impact_number();
11335 
11336  /*l
11337  *b Returns:
11338  **
11339  ** the processed flag on the diguyImpact class
11340  */
11341  int get_last_impact_been_processed();
11342 
11343  /*l
11344  *b Description:
11345  **
11346  ** Sets the processed flag on the diguyImpact object.
11347  */
11348  void set_last_impact_been_processed();
11349 
11350  /*l
11351  *b Description:
11352  **
11353  ** Sets the maximum number of unprocessed impacts there can be.
11354  **
11355  ** The unprocessed impact array is a first-in-first-out queue. If an
11356  ** impact occurs that pushes the number of unprocessed impacts past
11357  ** this maximum number, earlier impacts will be dropped from the
11358  ** array.
11359  **
11360  ** The initial value is 10.
11361  */
11362  void set_max_unprocessed_impacts(int max_unprocessed_impacts);
11363 
11364  /*l
11365  *b Returns:
11366  **
11367  ** maximum number of unprocessed impacts
11368  */
11369  int get_max_unprocessed_impacts();
11370 
11371  /*l
11372  *b Returns:
11373  **
11374  ** the last impact link
11375  */
11376  const char* get_last_impact_link();
11377 
11378  /*l
11379  *b Returns:
11380  **
11381  ** 1 if the last impact link is the link named
11382  */
11383  int get_last_impact_link_is(const char* link_name);
11384 
11385  /*l
11386  *b Returns:
11387  **
11388  ** 1 if the last impact resulted from an impact with a vehicle,
11389  ** 0 if not
11390  */
11391  int get_last_impact_is_from_vehicle();
11392 
11393  /*l
11394  *b Returns:
11395  **
11396  ** 1 if the last impact speed is greater than the passed speed,
11397  ** 0 if not
11398  */
11399  int get_last_impact_speed_is_greater_than(float impact_speed);
11400 
11401  /*l
11402  *b Description:
11403  **
11404  ** Sets if impacts are ever processed on this character.
11405  ** Useful for temporary effects and the like.
11406  */
11407  void set_is_immune_to_impacts(int immune);
11408 
11409  /*l
11410  *b Returns:
11411  **
11412  ** 1 if the character is immune to impacts
11413  ** 0 if not
11414  */
11415  int get_is_immune_to_impacts();
11416 
11417 
11418 /*****************************************************************************/
11440  /*l
11441  *b Description:
11442  **
11443  ** This function starts the specified appearance effect on
11444  ** the character.
11445  **
11446  ** The following appearance effects are available:
11447  **
11448  *- - "brake_lights"
11449  *- - "debris"
11450  *- - "debris_dark"
11451  *- - "dust"
11452  *- - "engine_smoke"
11453  *- - "explosion"
11454  *- - "explosion_dark"
11455  *- - "flames"
11456  *- - "flashing_lights"
11457  *- - "ground_dust_burst"
11458  *- - "headlights"
11459  *- - "rotor_wash"
11460  *- - "smoke"
11461  *- - "smoke_dark"
11462  *- - "smoke_trail"
11463  **
11464  *b Arguments:
11465  **
11466  *a effect - name of appearance effect to be started
11467  *a override_link - link to attach to; overrides default
11468  *a override_scale - scale to use for effect; overrides default
11469  *a override_offset_x - x offset to use for effect; overrides default
11470  *a override_offset_y - y offset to use for effect; overrides default
11471  *a override_offset_z - z offset to use for effect; overrides default
11472  *a override_duration - overrides how long the effect should show
11473  *a before automatically ending
11474  **
11475  *b Returns:
11476  **
11477  ** 0 on success, -1 on failure
11478  **
11479  *b Available as Decision Bead/Event
11480  */
11481  int begin_appearance_effect(const char* effect,
11482  const char* override_link = NULL,
11483  float override_scale = DIGUY_DEFAULT_FLOAT,
11484  float override_offset_x = DIGUY_DEFAULT_FLOAT,
11485  float override_offset_y = DIGUY_DEFAULT_FLOAT,
11486  float override_offset_z = DIGUY_DEFAULT_FLOAT,
11487  float override_duration = DIGUY_DEFAULT_FLOAT);
11488 
11489  /*l
11490  *b Description:
11491  **
11492  ** This function ends the specified appearance effect on the
11493  ** character.
11494  **
11495  ** The active particles of the effect will go to completion. Use
11496  ** stop_all_appearance_effects() to immediately stop effects,
11497  ** including their active particles.
11498  **
11499  ** If the effect hasn't been started, nothing happens.
11500  **
11501  *b Arguments:
11502  **
11503  *a effect - name of appearance effect to be ended
11504  *a override_link - optional override link effect is attached to
11505  **
11506  ** Pass "all" for the effect argument to end all of this character's
11507  ** appearance effects.
11508  **
11509  *b Returns:
11510  **
11511  ** 0 on success, -1 on failure
11512  **
11513  *b Available as Decision Bead/Event
11514  */
11515  int end_appearance_effect(const char* effect,
11516  const char* override_link = NULL);
11517 
11518  /*l
11519  *b Description:
11520  **
11521  ** This function stops the specified appearance effect on the
11522  ** character.
11523  **
11524  ** The active particle systems of the effect will immediately be
11525  ** removed. Use end_appearance_effect() to gradually stop effects;
11526  ** that function lets active particles move to completion.
11527  **
11528  ** If the effect hasn't been started, nothing happens.
11529  **
11530  *b Arguments:
11531  **
11532  *a effect - name of appearance effect to be ended
11533  *a override_link - optional override link effect is attached to
11534  **
11535  ** Pass "all" for the effect argument to stop all of this character's
11536  ** appearance effects.
11537  **
11538  *b Returns:
11539  **
11540  ** 0 on success, -1 on failure
11541  **
11542  *b Available as Decision Bead/Event
11543  */
11544  int stop_appearance_effect(const char* effect,
11545  const char* override_link = NULL);
11546 
11547  /*l
11548  *b Description:
11549  **
11550  ** Equivalent to stop_appearance_effect("all");
11551  */
11552  int stop_all_appearance_effects();
11553 
11554  /*l
11555  *b Description:
11556  **
11557  ** This function checks to see if the specified appearance effect
11558  ** has been started with begin_appearance_effect().
11559  **
11560  *b Arguments:
11561  **
11562  *a effect - name of appearance effect to check
11563  *a override_link - optional override link effect is attached to
11564  **
11565  *b Returns:
11566  **
11567  ** 1 if appearance is active, 0 if not
11568  */
11569  int appearance_effect_is_active(const char* effect,
11570  const char* override_link = NULL);
11571 
11572 
11573 /*****************************************************************************/
11586  /*l
11587  *b Description:
11588  **
11589  ** This function returns a pointer to a diguyChainSimulation if the
11590  ** character is a chain_simulation type of character.
11591  **
11592  *b Returns:
11593  **
11594  ** pointer to a diguyChainSimulation
11595  */
11596  diguyChainSimulation* get_chain_simulation();
11597 
11598 
11599 /*****************************************************************************/
11612  /*l
11613  *b Description:
11614  **
11615  ** This function returns a pointer to a diguyVehicleController if the
11616  ** character has one.
11617  **
11618  *b Returns:
11619  **
11620  ** pointer to a diguyVehicleController; may return NULL if character
11621  ** does not have a vehicle controller object
11622  */
11623  diguyVehicleController* get_vehicle_controller();
11624 
11625  /*l
11626  *b Description:
11627  **
11628  ** For most characters playing a travel forward action, the
11629  ** character's facing direction matches the direction of travel. For
11630  ** example, when humans walk forward their pelvis is generally
11631  ** aligned in the direction of travel.
11632  **
11633  ** Some vehicle characters behave differently. For vehicles whose
11634  ** front wheels steer, when turning the vehicle body will pivot around
11635  ** the rear axle. Only gradually will the rear of the vehicle swing
11636  ** in behind the direction of travel. Think of a car making a very
11637  ** sharp turn, and how the rear of the car swings in behind the front
11638  ** as the turn is completed.
11639  **
11640  ** This function will return the orientation of the body of the
11641  ** vehicle; i.e., the orientation of the forward vector along the
11642  ** vehicle's long axis. As mentioned above this may be different
11643  ** than the orientation of the direction of travel.
11644  **
11645  ** This function will return valid results for all characters, though
11646  ** the returned values from this function and that of
11647  ** get_orientation() will be the same for non-vehicle characters.
11648  **
11649  *b Returns:
11650  **
11651  ** 0 on success, -1 on failure
11652  */
11653  int get_vehicle_body_orientation(float* rz, float* rx, float* ry);
11654 
11655 
11656 /*****************************************************************************/
11673  /*l
11674  *b Description:
11675  **
11676  ** This function sets the name of the shader technique that will be
11677  ** used by the character when the scenario is using the specified
11678  ** render mode. See diguyScenario::set_current_render_mode().
11679  **
11680  ** Note that care should be taken when changing the shader of
11681  ** characters with skinned appearances. A shader capable of properly
11682  ** transforming vertices must be used for such characters.
11683  **
11684  ** The shader with the given name should be loaded first. If the
11685  ** shader technique is not one of DI-Guy's stock shaders, a custom
11686  ** shader technique can be loaded explicitly by calling
11687  ** the diguyApp::load_shader_program() function.
11688  **
11689  *b NOTE:
11690  **
11691  ** The specified shader technique may not take effect immediately,
11692  ** if the scenario's current render mode is different than the
11693  ** passed render mode. See
11694  ** diguyScenario::set_current_render_mode().
11695  **
11696  *b Arguments:
11697  **
11698  *a shader_name - shader technique name; can be NULL
11699  *a render_mode - render mode to modify; passing NULL will
11700  *a modify shader "normal" render mode
11701  **
11702  *b Returns:
11703  **
11704  ** 0 on success, -1 on failure
11705  */
11706  int set_render_mode_shader(const char* shader_name,
11707  const char* render_mode = NULL);
11708 
11709  /*l
11710  *b Description:
11711  **
11712  ** This function resets the shader technique for the specified render
11713  ** mode to its default. This will be the shader technique name
11714  ** returned by
11715  ** diguyScenario::get_default_character_shader_program_name().
11716  **
11717  ** If the specified render mode is the current scenario render mode,
11718  ** the current shader will change immediately. If not, the change
11719  ** will not take effect until the specified render mode becomes the
11720  ** current scenario render mode. See
11721  ** diguyScenario::set_current_render_mode().
11722  **
11723  *b Arguments:
11724  **
11725  *a render_mode - render mode to modify; passing NULL will
11726  *a modify shader of "normal" render mode
11727  */
11728  void reset_render_mode_shader_to_default(const char* render_mode = NULL);
11729 
11730  /*l
11731  *b Description:
11732  **
11733  ** This function returns the name of the shader technique that will be used by
11734  ** the character when the scenario is using the specified render
11735  ** mode.
11736  **
11737  *b Arguments:
11738  **
11739  *a render_mode - render mode for which to get technique name;
11740  *a pass NULL for "normal" render mode
11741  **
11742  *b Returns:
11743  **
11744  ** name of shader technique; NULL if none or error
11745  */
11746  const char* get_render_mode_shader(const char* render_mode = NULL);
11747 
11748  /*l
11749  *b Description:
11750  **
11751  ** This function returns the shader program that is in use by the
11752  ** character. Shader programs are shared objects that can be used
11753  ** by multiple characters. This is here for backwards compatibility,
11754  ** and just returns the highest quality shader technique shader.
11755  **
11756  *b Returns:
11757  **
11758  ** object of type diguyGraphicsShaderProgram; NULL if none
11759  */
11760  diguyGraphicsShaderProgram* get_shader_program();
11761 
11762  /*l
11763  *b Description:
11764  **
11765  ** This function returns the shader technique that is in use by the
11766  ** character. Shader techniques own a number of shader objects.
11767  **
11768  *b Returns:
11769  **
11770  ** object of type diguyGraphicsShaderTechnique; NULL if none
11771  */
11772  diguyGraphicsShaderTechnique* get_shader_technique();
11773 
11774  /*l
11775  *b Description:
11776  **
11777  ** This function overrides the current shader with the specified
11778  ** temporary shader. This temporary shader will remain in effect
11779  ** until:
11780  **
11781  *- - the scenario is reset
11782  *- - reset_current_shader_to_default() is called
11783  *- - set_temporary_current_shader() is called with NULL
11784  **
11785  *b Arguments:
11786  **
11787  *a shader_name - shader name; can be NULL
11788  **
11789  ** Passing NULL for the shader name will un-set the temporary shader,
11790  ** resetting the render mode shader to its default.
11791  **
11792  *b Returns:
11793  **
11794  ** 0 on success, -1 on failure
11795  */
11796  int set_temporary_current_shader(const char* shader_name);
11797 
11798  /*l
11799  *b Description:
11800  **
11801  ** This is a convenience function for resetting the current render
11802  ** mode shader to its default.
11803  **
11804  ** It is equivalent to retrieving the current render mode using
11805  ** diguyScenario::get_current_render_mode(), and calling
11806  ** reset_render_mode_shader_to_default() with that render mode.
11807  */
11808  void reset_current_shader_to_default();
11809 
11810  /*l
11811  *b Description:
11812  **
11813  ** This is a convenience function for refreshing the shader
11814  ** of a character. Usually used in conjunction with logic
11815  ** provided by the user with the graphics API.
11816  */
11817  void trigger_shader_refresh();
11818 
11819  /*l
11820  *b Description:
11821  **
11822  ** This function returns the shader instance that is in use by the
11823  ** character. Each character has its own shader instance.
11824  **
11825  ** Note that the shader instance of a character can change over the
11826  ** lifetime of the character. For example, it will change if the
11827  ** appearance of the character changes. Therefore the returned
11828  ** pointer should not be stored, but should be re-read each time
11829  ** it is needed.
11830  **
11831  *b Returns:
11832  **
11833  ** object of type diguyGraphicsShaderInstance; NULL if none
11834  */
11835  diguyGraphicsShaderInstance* get_shader_instance();
11836 
11837  /*l
11838  *b Description:
11839  **
11840  ** This function resets current values of the variables of the shader
11841  ** back to their initial reset values.
11842  */
11843  void reset_shader_instance_variables_to_initial_values();
11844 
11845  /*l
11846  *b Description:
11847  **
11848  ** This function resets the current and initial values of variables
11849  ** of the shader to the built-in DI-Guy configuration defaults.
11850  */
11851  void reset_shader_instance_variables_to_program_defaults();
11852 
11853 
11854 /*****************************************************************************/
11878  /*l
11879  *b Description:
11880  **
11881  ** This function sets the named character as the attack
11882  ** target of this agent. This agent will pursue the
11883  ** target until it is within range, and then will fire its
11884  ** weapon in an attempt to kill the target.
11885  **
11886  ** This function will implicitly put this agent into the
11887  ** attack behavior.
11888  **
11889  ** The current focus character will be set the specified character.
11890  ** Pass NULL or the empty string ("") to not change the focus
11891  ** character, but still change to the pursue behavior.
11892  **
11893  ** The current focus group will be un-set.
11894  **
11895  *b Arguments:
11896  **
11897  *a character_name - character to attack
11898  **
11899  *b Returns:
11900  **
11901  ** 0 on success, -1 on failure
11902  **
11903  *b Available as Decision Bead/Event
11904  */
11905  int agent_attack_character(const char* character_name);
11906 
11907  /*l
11908  *b Description:
11909  **
11910  ** This function is similar to agent_attack_character(), but instead
11911  ** will choose attack targets from the characters in the specified
11912  ** group.
11913  **
11914  ** This function will implicitly put this agent into the attack
11915  ** behavior.
11916  **
11917  ** The current focus group will be set to the specified group. Pass
11918  ** NULL or the empty string ("") to not change the focus group, but
11919  ** still change to the attack behavior.
11920  **
11921  ** The current focus character will be un-set.
11922  **
11923  *b Arguments:
11924  **
11925  *a group_name - name of group from which attack targets should
11926  *a be chosen
11927  **
11928  *b Returns:
11929  **
11930  ** 0 on success, -1 on failure
11931  **
11932  *b Available as Decision Bead/Event
11933  */
11934  int agent_attack_group(const char* group_name);
11935 
11936  /*l
11937  *b Description:
11938  **
11939  ** See diguyAgentParams::set_attack_zone_enabled().
11940  */
11941  int agent_set_attack_zone_enabled(int use_attack_zone);
11942 
11943  /*l
11944  *b Description:
11945  **
11946  ** See diguyAgentParams::get_attack_zone_enabled().
11947  */
11948  int agent_get_attack_zone_enabled();
11949 
11950  /*l
11951  *b Description:
11952  **
11953  ** See diguyAgentParams::set_attack_zone().
11954  */
11955  int agent_set_attack_zone(float x, float y, float z, float radius);
11956 
11957  /*l
11958  *b Description:
11959  **
11960  ** See diguyAgentParams::get_attack_zone().
11961  */
11962  int agent_get_attack_zone(float* x, float* y, float* z, float* radius);
11963 
11970  /*l
11971  *b Description:
11972  **
11973  ** This function adds a flee object to this agent.
11974  ** This agent will attempt to move away from the specified
11975  ** character until it is beyond the specified flee distance.
11976  **
11977  ** Note: Currently there can only be one flee object. This
11978  ** restriction will be lifted in a future version.
11979  **
11980  ** This function will implicitly put this agent into the
11981  ** flee behavior.
11982  **
11983  ** Neither the current focus character nor group will be
11984  ** changed by this function.
11985  **
11986  *b Arguments:
11987  **
11988  *a character_name - character from which to flee
11989  *a distance - minimum distance to move away from character
11990  *a danger_level - how "strong" the flee should be; set from
11991  *a 0 to 100
11992  **
11993  ** The danger_level argument is not currently used, but will be in
11994  ** a future version.
11995  **
11996  *b Returns:
11997  **
11998  ** 0 on success, -1 on failure
11999  **
12000  *b Available as Decision Bead/Event
12001  */
12002  int agent_flee_character(const char* character_name,
12003  float distance,
12004  int danger_level = 50);
12005 
12006  /*l
12007  *b Description:
12008  **
12009  ** This function adds a flee object to this agent. This agent
12010  ** will attempt to move away from the specified group until it is
12011  ** beyond the specified flee distance.
12012  **
12013  ** This function will implicitly put this agent into the flee
12014  ** behavior.
12015  **
12016  ** Neither the current focus character nor group will be changed
12017  ** by this function.
12018  **
12019  *b Arguments:
12020  **
12021  *a group_name - group from which to flee
12022  *a distance - minimum distance to move away from character
12023  *a danger_level - how "strong" the flee should be; set from
12024  *a 0 to 100
12025  **
12026  ** The danger_level argument is not currently used, but will be in
12027  ** a future version.
12028  **
12029  *b Returns:
12030  **
12031  ** 0 on success, -1 on failure
12032  **
12033  *b Available as Decision Bead/Event
12034  */
12035  int agent_flee_group(const char* group_name,
12036  float distance,
12037  int danger_level = 50);
12038 
12039  /*l
12040  *b Description:
12041  **
12042  ** This function is similar to agent_flee_group(), but the
12043  ** agent will instead flee the members of the specified
12044  ** crowd.
12045  */
12046  int agent_flee_crowd(const char* crowd_name,
12047  float distance,
12048  int danger_level = 50);
12049 
12050  /*l
12051  *b Description:
12052  **
12053  ** This function adds a flee object to this agent.
12054  ** This agent will attempt to move away from the specified
12055  ** location until it is beyond the specified flee distance.
12056  **
12057  ** Note: Currently there can only be one flee object. This
12058  ** restriction will be lifted in a future version.
12059  **
12060  ** This function will implicitly put this agent into the
12061  ** flee behavior.
12062  **
12063  ** Neither the current focus character nor group will be
12064  ** changed by this function.
12065  **
12066  *b Arguments:
12067  **
12068  *a x, y, z - location from which to flee
12069  *a distance - minimum distance to move away from character
12070  *a danger_level - how "strong" the flee should be; set from
12071  *a 0 to 100
12072  **
12073  ** The danger_level argument is not currently used, but will be in
12074  ** a future version.
12075  **
12076  *b Returns:
12077  **
12078  ** 0 on success, -1 on failure
12079  */
12080  int agent_flee_location(float x, float y, float z,
12081  float distance,
12082  int danger_level = 50);
12083 
12084  /*l
12085  *b Description:
12086  **
12087  ** This function removes all flee objects.
12088  **
12089  ** This function has no effect on current behavior.
12090  **
12091  *b Returns:
12092  **
12093  ** 0 on success, -1 on failure
12094  **
12095  *b Available as Decision Bead/Event
12096  */
12097  void agent_remove_all_flee_objects();
12098 
12109  /*l
12110  *b Description:
12111  **
12112  ** This function puts this agent into the mingle behavior, in which
12113  ** it will choose semi-random points in the specified region and
12114  ** subregion to move to. The agent will remain at the selected
12115  ** points for some amount of time, and the select a new point.
12116  **
12117  ** If all members of a crowd have this behavior they will tend to get
12118  ** together in small groups.
12119  **
12120  ** Use diguyAgentParams::set_move_on_t_min() and
12121  ** diguyAgentParams::set_move_on_t_max() for setting how long the
12122  ** agent will remain at the selected mingle points.
12123  **
12124  *b Arguments:
12125  **
12126  *a region_name - region in which to mingle
12127  *a subregion_name - subregion in which to mingle
12128  **
12129  ** The behavior region will be set the specified region. Pass NULL
12130  ** or "(current)" to not change the current behavior region.
12131  **
12132  *b Returns:
12133  **
12134  ** 0 on success, -1 on failure
12135  **
12136  *b Available as Decision Bead/Event
12137  */
12138  int agent_mingle_in_region(const char* region_name = "(current)",
12139  const char* subregion_name = "base");
12140 
12151  /*l
12152  *b Description:
12153  **
12154  ** This function is similar to agent_mingle_in_region(), but agents
12155  ** will pick completely random points and not try to clump together
12156  ** in small groups.
12157  **
12158  *b Returns:
12159  **
12160  ** 0 on success, -1 on failure
12161  **
12162  *b Available as Decision Bead/Event
12163  */
12164  int agent_wander_region(const char* region_name = "(current)",
12165  const char* subregion_name = "base");
12166 
12177  /*l
12178  *b Description:
12179  **
12180  ** This function will cause this agent to pursue the specified
12181  ** character. This agent will attempt to move toward the specified
12182  ** character until it is within its still distance as specified in
12183  ** its agent params.
12184  **
12185  ** This function will implicitly put this agent into the pursue
12186  ** behavior.
12187  **
12188  ** The current focus group will be set to the specified group. Pass
12189  ** NULL or the empty string ("") to not change the focus group, but
12190  ** still change to the attack behavior.
12191  **
12192  ** The current focus character will be un-set.
12193  **
12194  *b Arguments:
12195  **
12196  *a character_name - character to pursue
12197  **
12198  *b Returns:
12199  **
12200  ** 0 on success, -1 on failure
12201  **
12202  *b Available as Decision Bead/Event
12203  */
12204  int agent_pursue_character(const char* character_name);
12205 
12206  /*l
12207  *b Description:
12208  **
12209  ** This function is similar to agent_pursue_character(), but the
12210  ** point toward the agent will move will be offset from the pursued
12211  ** character by the passed offset.
12212  */
12213  int agent_pursue_character_with_offset(const char* character_name,
12214  float offset_x,
12215  float offset_y);
12216 
12217  /*l
12218  *b Description:
12219  **
12220  ** This function is similar to agent_pursue_character(), but instead
12221  ** will choose pursue characters from the characters in the specified
12222  ** group.
12223  **
12224  ** This function will implicitly put this agent into the pursue
12225  ** behavior.
12226  **
12227  ** The current focus group will be set to the specified group. Pass
12228  ** NULL or the empty string ("") to not change the focus group, but
12229  ** still change to the pursue behavior.
12230  **
12231  ** The current focus character will be un-set.
12232  **
12233  *b Arguments:
12234  **
12235  *a group_name - name of group from which pursue characters should
12236  *a be chosen
12237  **
12238  *b Returns:
12239  **
12240  ** 0 on success, -1 on failure
12241  **
12242  *b Available as Decision Bead/Event
12243  */
12244  int agent_pursue_group(const char* group_name);
12245 
12246  /*l
12247  *b Description:
12248  **
12249  ** Calls a formation with this character as a leader, oriented towards
12250  ** (target_x, target_y).
12251  **
12252  *b Returns:
12253  **
12254  ** 0 on success, -1 on failure
12255  */
12256  int agent_call_formation(const char* formation_name,
12257  float target_x,
12258  float target_y);
12259 
12270  /*l
12271  *b Description:
12272  **
12273  ** This function has the character travel along its behavior path
12274  ** shape, typically to the end and then back to the beginning. It
12275  ** will put the agent into the travel behavior.
12276  **
12277  *b Arguments:
12278  **
12279  *a direction - should be either "forward" or "backward"; pass NULL
12280  *a for default forward
12281  *a at_end - what to do when end of path reached
12282  *a waypoint_index - index of waypoint to start at; -1 for nearest,
12283  *a -2 for random
12284  *a offset_y - sideways offset from behavior path
12285  **
12286  ** Valid values for at_end are:
12287  **
12288  *- - "reverse"
12289  *- - "loop"
12290  *- - "stop"
12291  *- - "teleport"
12292  **
12293  ** See the documentation for diguyNavPathAtEnd for information on
12294  ** what each value means.
12295  */
12296  int agent_travel_behavior_path(const char* direction = NULL,
12297  const char* at_end = NULL,
12298  int waypoint_index = -1,
12299  float offset_y = 0.5f);
12300 
12301  /*l
12302  *b Description:
12303  **
12304  ** Similar to agent_travel_behavior_path(), but specific path can be
12305  ** set rather than using behavior path.
12306  */
12307  int agent_travel_path_shape(const char* path_shape_name,
12308  const char* direction = NULL,
12309  const char* at_end = NULL,
12310  int waypoint_index = -1,
12311  float offset_y = 0.5f);
12312 
12313  /*l
12314  *b Description:
12315  **
12316  ** The agent will create a travel path around the border of the
12317  ** region specified. A CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
12318  ** callback will be triggered every time a character completes a loop
12319  ** around the border.
12320  **
12321  *b Arguments:
12322  **
12323  *a region_name - the name of the region to patrol; leaving blank or
12324  *a passing NULL will use the agent's current region
12325  *a subregion - name of the subregion to use; defaults to the base
12326  *a subregion
12327  **
12328  *b Returns:
12329  **
12330  ** 0 on success, -1 on failure
12331  */
12332  int agent_travel_region_border(const char* region_name = NULL,
12333  const char* subregion_name = "base");
12334 
12335  /*l
12336  *b Description:
12337  **
12338  ** Agent will attempt to create a navigation path on the via_region
12339  ** and then travel it. An A* path planning algorithm is used to find
12340  ** the path, cost preferences from the character's current
12341  ** diguyAgentParams are used in the search.
12342  **
12343  *b Note: as of DI-Guy 12 there is a version of this function
12344  ** agent_move_to_point_bg() that uses a multi-threaded infrastructure.
12345  ** We strongly recommend using it for future developments.
12346  **
12347  *b Arguments:
12348  **
12349  *a x, y, z - the target location
12350  *a via_region - the name of the region to run A* on (pass in "*"
12351  *a to have the code attempt to find the nearest
12352  *a region automatically.)
12353  *a subregion_name - the name of the subregion to restrict search to
12354  **
12355  *b Returns:
12356  **
12357  ** 0 on success, -1 on failure
12358  */
12359  int agent_move_to_point(float x, float y, float z,
12360  const char* via_region = NULL,
12361  const char* subregion_name = "base");
12362 
12363  /*l
12364  *b Description:
12365  **
12366  ** A multi-threaded version of agent_move_to_point(). See that
12367  ** function for more information.
12368  **
12369  ** We recommend switching to using this over the single threaded
12370  ** version. When the path result has been computed a callback with id
12371  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12372  ** stored in get_path_planning_result(). You can also poll for
12373  ** completion via get_is_path_planning().
12374  **
12375  *b Returns:
12376  **
12377  ** diguyNavPathSearchResults enum value
12378  **
12379  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12380  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12381  ** for multi-threading, or a negative value on failure.
12382  */
12383  int agent_move_to_point_bg(float x, float y, float z,
12384  const char* via_region = NULL,
12385  const char* subregion_name = "base");
12386 
12387  /*l
12388  *b Description:
12389  **
12390  ** Agent will attempt to create a navigation path on the region
12391  ** via_region and then travel it. An A* path planning algorithm is
12392  ** used to find the path.
12393  **
12394  ** The subregion masks are used to specify which subregions to use or
12395  ** avoid. Cost bias values can be used to make tweak how strong the
12396  ** repulsion values are.
12397  **
12398  *b Note:
12399  **
12400  ** As of DI-Guy 12 there is a version of this function
12401  ** agent_move_to_point_via_subregions_bg that uses a multi-threaded
12402  ** infrastructure. We strongly recommend using it for future
12403  ** developments.
12404  **
12405  ** This function will fail and return -1 if a path cannot be found.
12406  **
12407  *b Arguments:
12408  **
12409  *a x, y, z - the target location
12410  *a via_region - the name of the region to run A* on (pass in "*"
12411  *a to have the code attempt to find the nearest
12412  *a region automatically)
12413  *a preferred_subregions_mask - diguySubregionMask value of regions
12414  *a preferred for travel
12415  *a cost_bias_for_preferred_regions - how much cheaper it will be
12416  *a to cross spaces that are part of desired subregion;
12417  *a should be < 1.0
12418  *a cost_bias_for_neutral_regions - how much more expensive it will be
12419  *a to cross spaces that are not part of desired subregion; see
12420  *a below for more information
12421  *a repulsed_regions_mask - diguySubregionMask value of regions *not*
12422  *a preferred for travel
12423  *a cost_bias_for_repulsed_regions - how much more expensive it will be
12424  *a to cross regions that are marked as repulsive; pass
12425  *a DIGUY_DEFAULT_FLOAT to avoid completely
12426  **
12427  ** Pass DIGUY_DEFAULT_FLOAT for cost_bias_for_neutral_regions and
12428  ** cost_bias_for_repulsed_regions to specify that they should be
12429  ** avoided completely.
12430  **
12431  ** The preferred_subregions_mask and repulsed_regions_mask use
12432  ** DI-Guy subregion mask values combined together. For example,
12433  ** DIGUY_SUBREGION_MASK_SIDEWALK | DIGUY_SUBREGION_MASK_CROSSWALK.
12434  **
12435  ** For cost_bias_for_neutral_regions, specifying a non-zero value for
12436  ** this lowers the likelihood that searches fail on disjointed
12437  ** subregions. A value < 1 will cause the planner to run faster but
12438  ** explore fewer points, possibly missing preferred regions. Values
12439  ** greater then 1 will explore more points but will be slower.
12440  **
12441  *b NOTE:
12442  **
12443  *b THIS API has changed for DI-GUY 11.
12444  **
12445  ** cost_bias_for_preferred_regions has been added and the neutral and
12446  ** repulsed default values have changed.
12447  **
12448  *b Returns:
12449  **
12450  ** 0 on success, -1 on failure
12451  */
12452  int agent_move_to_point_via_subregions(float x, float y, float z,
12453  const char* via_region = NULL,
12454  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12455  float cost_bias_for_preferred_regions = 0.25f,
12456  float cost_bias_for_neutral_regions = 1.1f,
12457  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12458  float cost_bias_for_repulsed_regions = 10.0f,
12459  int cost_rule = 0);
12460 
12461  /*l
12462  *b Description:
12463  **
12464  ** A multi-threaded version of agent_move_to_point_via_subregions().
12465  ** We recommend switching to using this over the single threaded
12466  ** version. When the result is found a
12467  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12468  ** stored in get_path_planning_result(), you can also poll for
12469  ** completion via get_is_path_planning().
12470  **
12471  *b Returns:
12472  **
12473  ** diguyNavPathSearchResults enum value
12474  **
12475  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12476  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12477  ** for multi-threading, or a negative value on failure.
12478  */
12479  int agent_move_to_point_via_subregions_bg(float x, float y, float z,
12480  const char* via_region = NULL,
12481  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12482  float cost_bias_for_preferred_regions = 0.25f,
12483  float cost_bias_for_neutral_regions = 1.1f,
12484  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12485  float cost_bias_for_repulsed_regions = 10.0f,
12486  int cost_rule = 0);
12487 
12488  /*l
12489  *b Returns:
12490  **
12491  ** diguyNavPathSearchResults value after agent_move_to_point_bg()
12492  ** or agent_move_to_point_via_subregions_bg() has been called when
12493  ** the multi-threaded path planner has completed.
12494  */
12495  int get_path_planning_result();
12496 
12497  /*l
12498  *b Returns:
12499  **
12500  ** 1 if character is currently waiting for a result from the
12501  ** multi-threaded path planner, else 0
12502  */
12503  int get_is_path_planning();
12504 
12505  /*l
12506  *b Description:
12507  **
12508  ** Agent will attempt to create a navigation path on the via_region
12509  ** to a point in the target region, and then travel it. An A* path
12510  ** planning algorithm is used to find the path. Cost preferences from
12511  ** the character's current diguyAgentParams are used in the search.
12512  **
12513  *b Arguments:
12514  **
12515  *a region - target region
12516  *a subregion_name - target subregion
12517  *a via_region - name of the region travel in
12518  **
12519  *b Returns:
12520  **
12521  ** 0 on success, -1 on failure
12522  **
12523  *b Available as Decision Bead/Event
12524  */
12525  int agent_move_to_region(const char* region,
12526  const char* subregion_name = "base",
12527  const char* via_region = NULL);
12528 
12529  /*l
12530  *b Description:
12531  **
12532  ** Similar to agent_move_to_point_via_subregions(), but for moving to
12533  ** another region.
12534  **
12535  *b NOTE:
12536  **
12537  *b THIS API has changed for DI-GUY 11.
12538  **
12539  ** cost_bias_for_preferred_regions has been added and the neutral and
12540  ** repulsed default values have changed.
12541  **
12542  *b See Also:
12543  **
12544  ** diguyScenario::set_max_distance_planning_multiplier();
12545  ** diguyScenario::get_time_spent_path_planning_this_frame();
12546  **
12547  *b Returns:
12548  **
12549  ** 0 on success, -1 on failure
12550  */
12551  int agent_move_to_region_via_subregions(const char* region_name,
12552  const char* subregion_name = "base",
12553  const char* via_region = NULL,
12554  float cost_bias_for_preferred_regions = 0.25f,
12555  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12556  float cost_bias_for_neutral_regions = 1.1f,
12557  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12558  float cost_bias_for_repulsed_regions = 10.0f);
12559 
12570  /*l
12571  *b Description:
12572  **
12573  ** The agent will begin following the specified path, using the path
12574  ** follow behavior (DIGUY_AGENT_BEHAVIOR_PATH_FOLLOW).
12575  **
12576  ** The path follow behavior allows an agent to approximately follow a
12577  ** diguyCharacterPath without being in path position mode. The agent
12578  ** can respond to external stimuli (e.g., run away from gunfire), and
12579  ** later return to and resume the path.
12580  **
12581  ** Currently the path must be a path previously defined for the
12582  ** character, through either DI-Guy Scenario or via path API calls.
12583  **
12584  *b Arguments:
12585  **
12586  *a path_name - name of a path of this character
12587  **
12588  *b Returns:
12589  **
12590  ** 0 on success, -1 on failure
12591  **
12592  *b Available as Decision Bead/Event
12593  */
12594  int agent_path_follow(const char* path_name);
12595 
12596  /*l
12597  *b Description:
12598  **
12599  ** The agent will resume following the path specified by a previous
12600  ** call to agent_path_follow(). This will put the agent back into
12601  ** the path follow behavior.
12602  **
12603  *b Returns:
12604  **
12605  ** 0 on success, -1 on failure
12606  **
12607  *b Available as Decision Bead/Event
12608  */
12609  int agent_resume_path_follow();
12610 
12611  /*l
12612  *b Returns:
12613  **
12614  ** the path being followed in path behavior mode
12615  */
12616  diguyCharacterPath* agent_get_path_follow_path();
12617 
12618  /*l
12619  *b Description:
12620  **
12621  ** In path follow behavior the agent moves along the path specified
12622  ** in agent_path_follow(). How far along the agent is on the path is
12623  ** specified in seconds. This function returns that time.
12624  **
12625  ** Note that advancing along the path may be paused for some reason,
12626  ** typically because the agent is resuming path follow behavior
12627  ** after being in a different behavior, or the agent is too far away
12628  ** from the current desired position on the path. In this case the
12629  ** returned time may not advance for awhile until the agent is close
12630  ** enough to the path to resume advancing along it.
12631  **
12632  ** Call diguyAgentParams::set_path_follow_pause_t_when_off_path()
12633  ** to set whether time will be paused when off of the path.
12634  **
12635  ** Call diguyAgentParams::set_path_follow_unpause_t_at_radius() to
12636  ** set how close the agent must be to the last point on the path
12637  ** before time will resume.
12638  **
12639  *b Returns:
12640  **
12641  ** how far, in seconds, the agent is along its path follow path
12642  */
12643  float agent_get_path_follow_path_t();
12644 
12645  /*l
12646  *b Returns:
12647  **
12648  ** 1 if time along the path is not advancing, else 0
12649  */
12650  int agent_get_path_follow_path_t_paused();
12651 
12662  /*l
12663  *b Returns:
12664  **
12665  ** the crowd this agent is a part of, if any; returns NULL if not in
12666  ** a crowd
12667  */
12668  diguyCrowd* agent_get_crowd();
12669 
12670  /*l
12671  *b Description:
12672  **
12673  ** This function allows the end user to directly change an agent's
12674  ** current behavior. This function currently the only way to start
12675  ** an agent "idling".
12676  */
12677  int agent_begin_behavior(const char* behavior_name);
12678 
12679  /*l
12680  *b Description:
12681  **
12682  ** This function sets the behavior of the agent to "none".
12683  */
12684  int agent_stop_behavior();
12685 
12686  /*l
12687  *b Description:
12688  **
12689  ** This function is a convenience function that changes the focus
12690  ** character of this agent's current crowd params.
12691  **
12692  ** This can also be done by getting the character's current params
12693  ** using get_agent_current_params(), and then calling
12694  ** set_focus_character() on that object. This function
12695  ** call, however, is available in decisions.
12696  **
12697  ** The agent currently need not be part of a crowd for this function
12698  ** to work.
12699  **
12700  *b Arguments:
12701  **
12702  *a character_name - name of character to become new focus
12703  *a character; pass NULL or "" to un-set
12704  *a the focus character
12705  **
12706  *b Returns:
12707  **
12708  ** 0 on success, -1 on failure
12709  **
12710  *b Available as Decision Bead/Event
12711  */
12712  int agent_set_current_focus_character(const char* character_name);
12713 
12714  /*l
12715  *b Description:
12716  **
12717  ** This function returns the current character this agent
12718  ** is focused on. This will either be the character named
12719  ** by the focus character, or the character chosen from the
12720  ** focus group to be the current focus character.
12721  **
12722  ** The agent currently need not be part of a crowd for this function
12723  ** to work.
12724  **
12725  *b Returns:
12726  **
12727  *a pointer to type diguyCharacter
12728  */
12729  diguyCharacter* agent_get_current_focus_character();
12730 
12731  /*l
12732  *b Description:
12733  **
12734  ** Similar to set_current_focus_character(), but sets
12735  ** the current focus group instead of character.
12736  **
12737  ** The agent currently need not be part of a crowd for this function
12738  ** to work.
12739  **
12740  *b Arguments:
12741  **
12742  *a group_name - name of group to become new focus
12743  *a group; pass NULL or "" to un-set
12744  *a the focus group
12745  **
12746  *b Returns:
12747  **
12748  ** 0 on success, -1 on failure
12749  **
12750  *b Available as Decision Bead/Event
12751  */
12752  int agent_set_current_focus_group(const char* group_name);
12753 
12754  /*l
12755  *b Description:
12756  **
12757  ** This function returns the initial agent parameters of
12758  ** this agent. The initial parameters of this agent
12759  ** can then be edited through this object.
12760  **
12761  ** Changes to the initial parameters will have no effect until
12762  ** the scenario is reset.
12763  **
12764  ** The current agent parameters will be set to these
12765  ** initial parameters whenever the scenario is reset.
12766  **
12767  ** The agent currently need not be part of a crowd for this function
12768  ** to work.
12769  **
12770  *b Returns:
12771  **
12772  *a pointer to type diguyAgentParams
12773  */
12774  diguyAgentParams* agent_get_initial_params();
12775 
12776  /*l
12777  *b Description:
12778  **
12779  ** This function returns the current agent parameters of
12780  ** this agent. The current parameters of this agent
12781  ** can then be edited through this object.
12782  **
12783  ** Changes to the current parameters should take effect immediately.
12784  **
12785  ** The current agent parameters will be reset to the
12786  ** initial parameters whenever the scenario is reset.
12787  **
12788  ** The agent currently need not be part of a crowd for this function
12789  ** to work.
12790  **
12791  *b Returns:
12792  **
12793  *a pointer to type diguyAgentParams
12794  */
12795  diguyAgentParams* agent_get_current_params();
12796 
12797  /*l
12798  *b Description:
12799  **
12800  ** This function gets the name of the agent's current profile.
12801  **
12802  *b Returns:
12803  **
12804  ** the name of the agent's current profile
12805  */
12806  const char* agent_get_current_params_profile_name();
12807 
12808  /*l
12809  *b Description:
12810  **
12811  ** This function sets this agent's current agent parameters from the
12812  ** specified crowd profile.
12813  **
12814  ** The agent currently need not be part of a crowd for this function
12815  ** to work.
12816  **
12817  *b Arguments:
12818  **
12819  *a profile_name - name of existing crowd profile
12820  *a retain_focus_objects - pass 1 to not change focus object from
12821  *a current focus
12822  *a retain_navigation_values - pass 1 to not change current navigation
12823  *a parameters
12824  *a retain_behavior - pass 1 to not change current behavior
12825  **
12826  ** Navigation values are things like:
12827  **
12828  *- - behavior path
12829  *- - behavior region and subregion
12830  *- - region masks
12831  *- - cost biases
12832  *- - path planner settings
12833  **
12834  *b Returns:
12835  **
12836  ** 0 on success, -1 on failure
12837  **
12838  *b Available as Decision Bead/Event
12839  */
12840  int agent_set_current_params_from_profile(const char* profile_name,
12841  int retain_focus_objects = 1,
12842  int retain_navigation_values = 1,
12843  int retain_behavior = 0);
12844 
12845  /*l
12846  *b Description:
12847  **
12848  ** Similar to agent_set_current_params_from_profile(), but initial
12849  ** parameters are changed.
12850  */
12851  int agent_set_initial_params_from_profile(const char* profile_name);
12852 
12853  /*l
12854  *b Description:
12855  **
12856  ** This function sets the current parameters from the agent's
12857  ** initial parameters.
12858  */
12859  void agent_set_current_params_from_initial_params();
12860 
12861  /*l
12862  *b Description:
12863  **
12864  ** This function sets whether the borders of the current behavior
12865  ** region of the agent is solid.
12866  **
12867  ** If they are, the agent will treat the walls as if they are
12868  ** solid walls in the environment. If not, the agent is free to
12869  ** walk through them.
12870  **
12871  ** The agent currently need not be part of a crowd for this function
12872  ** to work.
12873  **
12874  *b Arguments:
12875  **
12876  *a is_solid - 1 if region border should be solid, 0 if not
12877  **
12878  *b Available as Decision Bead/Event
12879  */
12880  void agent_set_current_behavior_region_border_is_solid(int is_solid);
12881 
12882  /*l
12883  *b Description:
12884  **
12885  ** If the agent is in a behavior that stays in one place before moving
12886  ** to another, such as wander or mingle, this function will request
12887  ** that the agent move on to the next location.
12888  **
12889  *b Available as Decision Bead/Event
12890  */
12891  void agent_move_on();
12892 
12893 
12894  /*l
12895  *b Description:
12896  **
12897  ** This function controls if the AI will attempt to automatically change variants
12898  ** depending on the behavior. This should only change how still motions are performed
12899  ** when the default variant is Normal. Characters in wander and idle will automatically
12900  ** shift to ambient still motions, mingle will alternate between socialize and ambient
12901  ** motions. Attack should automatically switch from aiming to ambient.
12902  ** defaults to being on.
12903  */
12904  int agent_set_auto_variant_selection(int selection_enabled);
12905 
12906  /*l
12907  *b Description:
12908  **
12909  ** Returns if automatic variant selection is enabled, defaults to being on.
12910  */
12911  int agent_get_auto_variant_selection();
12912 
12913  /*l
12914  *b Description:
12915  **
12916  ** Returns current travel path or nav path.
12917  */
12918  diguyPathShape * agent_get_current_traveled_path();
12919 
12920  /*l
12921  *b Description:
12922  **
12923  ** Allows agent to determine speed zone based on distance to endpoint of current
12924  ** path. With this off, speed zones are determined by "desired position", which
12925  ** when following a path is not the endpoint, but a point on the path a short
12926  ** distance ahead of the current position.
12927  **
12928  ** The default value is false.
12929  **
12930  ** Enable this if you want the character to automatically run when following a
12931  ** long path.
12932  */
12933  void agent_set_use_speed_zones_on_paths(int enabled);
12934 
12935  /*l
12936  *b Description:
12937  **
12938  ** Returns the current value set by agent_set_use_speed_zones_on_paths().
12939  */
12940  int agent_get_use_speed_zones_on_paths();
12941 
12942 #ifdef CPLUSPLUS_ONLY
12943 
12999  /*l
13000  *b Description:
13001  **
13002  ** This function sets a feeler function that will be used by this
13003  ** character for environment collision detection. The feeler will
13004  ** replace any existing feeler function (including the default
13005  ** function used in DI-Guy Scenario).
13006  **
13007  ** See the "User-Defined Feelers" information for more information.
13008  **
13009  *b Arguments:
13010  **
13011  *a feeler_function - pointer to user-defined feeler function
13012  **
13013  *b Returns:
13014  **
13015  ** 0 on success, -1 on failure
13016  **
13017  *b Callable From:
13018  **
13019  *- - C++
13020  */
13021  int agent_set_feeler_function(diguyFeelerFunction* feeler_function);
13022 
13023  /*l
13024  *b Returns:
13025  **
13026  ** current feeler function; see set_feeler_function()
13027  **
13028  *b Callable From:
13029  **
13030  *- - C++
13031  */
13032  diguyFeelerFunction* agent_get_feeler_function();
13033 
13034 #endif
13035 
13036 
13037 /*****************************************************************************/
13043  /*l
13044  *b Description:
13045  **
13046  ** Creates a Lua mind object based off of the contents of base_class.
13047  **
13048  *b Arguments:
13049  **
13050  *a base_class - the class to use as the basis for the character's
13051  *a mind
13052  *a init_arg1-2 - experimental optional arguments passed to the init
13053  *a function; your lua init function will need to take
13054  *a arguments
13055  **
13056  */
13057  int create_lua_mind(const char* base_class, const char* init_arg1 = NULL,
13058  const char* init_arg2 = NULL);
13059 
13060  /*l
13061  *b Description:
13062  **
13063  ** Returns the name of the mind, e.g. "luaPedestrian". This is, in other
13064  ** words, the mind's base class
13065  */
13066  const char *get_mind_name();
13067 
13068  /*l
13069  *b Description:
13070  **
13071  ** Agent characters with minds will typically have the mind be in
13072  ** some state, such as "patrolling", "fleeing", "mobbing", etc. This
13073  ** function returns the name of that state.
13074  **
13075  ** Currently this is only applicable to characters with Lua minds.
13076  **
13077  *b Returns:
13078  **
13079  ** the name of the agent's current mind state
13080  */
13081  const char* get_mind_current_state_name();
13082 
13083  /*l
13084  *b Description:
13085  **
13086  ** This function causes callback functions with the callback id
13087  ** CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED to be called.
13088  ** It's intended use is for mind implementations that need to
13089  ** signal that the mind's current state has changed.
13090  **
13091  ** Currently this is only applicable to characters with Lua minds.
13092  */
13093  void do_mind_current_state_changed_callback();
13094 
13095  /*l
13096  *b Description:
13097  **
13098  ** How long until the character's main coroutine thread should be
13099  ** resumed. This function is typically used by various luaCharacter
13100  ** sleep functions.
13101  **
13102  *b Arguments:
13103  **
13104  *a sleep_length - how long relative to the current time the character
13105  *a should sleep
13106  */
13107  int set_sleep_timer(float sleep_length);
13108 
13109  /*l
13110  *b Returns:
13111  **
13112  ** How long until the character's main coroutine thread resumes,
13113  ** relative to the current time.
13114  */
13115  float get_sleep_timer();
13116 
13117  /*l
13118  *b Description:
13119  **
13120  ** The frequency at which the luaCharacter's heartbeat function
13121  ** should run. This defaults to once per second. The character
13122  ** must have a Lua function named heartbeat.
13123  **
13124  *b Arguments:
13125  **
13126  *a heartbeat_dt - frequency of heartbeat
13127  */
13128  int set_heartbeat_dt(float heartbeat_dt);
13129 
13130  /*l
13131  *b Description:
13132  **
13133  ** This function allows the addition of additional heartbeat
13134  ** functions.
13135  **
13136  *b Arguments:
13137  **
13138  *a function_name - the name of the Lua function to treat as a
13139  *a heartbeat; the function_name should not include
13140  *a the name of the character object
13141  *a heartbeat_dt - frequency of heartbeat
13142  **
13143  *b Returns:
13144  **
13145  ** 0 on success, -1 on failure
13146  */
13147  int add_secondary_heartbeat(const char* function_name,
13148  float heartbeat_dt);
13149 
13150  /*l
13151  *b Description:
13152  **
13153  ** This function removes an added heartbeat function.
13154  **
13155  *b Arguments:
13156  **
13157  *a function_name - the name of the Lua function to treat as a
13158  *a heartbeat; the function_name should not include
13159  *a the name of the character object
13160  **
13161  *b Returns:
13162  **
13163  ** 0 on success, -1 on failure
13164  */
13165  int remove_secondary_heartbeat(const char* function_name);
13166 
13167  /*l
13168  *b Description:
13169  **
13170  ** The frequency at which a luaCharacter's secondary heartbeat
13171  ** function should run. The character must have a Lua function named
13172  ** function_name.
13173  **
13174  *b Arguments:
13175  **
13176  *a function_name - heartbeat function to adjust
13177  *a heartbeat_dt - frequency of heartbeat
13178  **
13179  *b Returns:
13180  **
13181  ** 0 on success, -1 on failure
13182  */
13183  int set_secondary_heartbeat_dt(const char* function_name, float heartbeat_dt);
13184 
13185  /*l
13186  *b Description:
13187  **
13188  ** This function creates a request that whenever the specified
13189  ** callback is triggered, the character is woken up with a message.
13190  ** The message will be of the form:
13191  *>
13192  *- - message_type = "callback"
13193  *- - message = the string representation of the callback
13194  *<
13195  ** A good example of the use for this is a flexible "move to"
13196  ** command:
13197  **
13198  *b Lua Example:
13199  **
13200  *e self.character:add_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13201  *e -- begin to move to a location
13202  *e self.character:agent_move_to_region_via_subregions("navmesh", "green", "navmesh",
13203  *e DIGUY_SUBREGION_MASK_BASE, 12);
13204  *e -- sleep till arrived
13205  *e self:sleep(100);
13206  *e self.character:remove_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13207  **
13208  ** Effectively the character will wake up either after 100 seconds or
13209  ** when they arrive at their desired destination.
13210  **
13211  *b Arguments:
13212  **
13213  *a callback - the callback id that should wake up the character
13214  **
13215  *b Returns:
13216  **
13217  ** 0 on success, -1 on failure
13218  */
13219  int add_wakeup_callback(int callback);
13220 
13221  /*l
13222  *b Description:
13223  **
13224  ** This function removes a request to trigger a message when a
13225  ** callback is triggered.
13226  **
13227  *b Arguments:
13228  **
13229  *a callback - callback id that should no longer wake up the
13230  *a character
13231  **
13232  *b Returns:
13233  **
13234  ** 0 on success, -1 on failure
13235  */
13236  int remove_wakeup_callback(int callback);
13237 
13238  /*l
13239  *b Description:
13240  **
13241  ** This function removes all requests to trigger a message when
13242  ** callbacks are triggered.
13243  **
13244  *b Returns:
13245  **
13246  ** 0 on success, -1 on failure
13247  */
13248  int remove_all_wakeup_callbacks();
13249 
13250  /*l
13251  *b Description:
13252  **
13253  ** This function check for a requests to trigger a message when
13254  ** a given callback is triggered.
13255  **
13256  *b Returns:
13257  **
13258  ** 0 on false, 1 on true
13259  */
13260  int has_wakeup_callback(int callback);
13261 
13262  /*l
13263  *b Description:
13264  **
13265  ** This function wakes up a character and sends them a message.
13266  ** Currently this is only applicable to characters with Lua minds.
13267  **
13268  *b Arguments:
13269  **
13270  *a sender - who is sending the message
13271  *a message_type - what type of message is being sent
13272  *a message - the message string
13273  *a message_params - optional parameter string
13274  **
13275  *b Returns:
13276  **
13277  ** number of times message was successfully parsed
13278  */
13279  int agent_accept_message(const char* sender,
13280  const char* message_type,
13281  const char* message,
13282  const char* message_params = NULL);
13283 
13284  /*l
13285  **
13286  *b Description:
13287  **
13288  ** This function wakes up nearby characters and sends them a message.
13289  ** The sender of the message is implicitly set to the individual
13290  ** calling the broadcast function
13291  **
13292  ** Currently this is only applicable to characters with Lua minds.
13293  **
13294  *b Arguments:
13295  **
13296  *a radius - how far to broadcast the message
13297  *a message_type - what type of message is being sent
13298  *a message - the message string
13299  *a message_params - optional parameter string
13300  **
13301  *b Returns:
13302  **
13303  ** number of times message was successfully parsed
13304  */
13305  int agent_broadcast_message(float radius,
13306  const char* message_type,
13307  const char* message,
13308  const char* message_params = NULL);
13309 
13310  /*l
13311  *b Description:
13312  **
13313  ** This function wakes up nearby characters in the group specified
13314  ** and sends them a message. The sender of the message is implicitly
13315  ** set to the individual calling the broadcast function.
13316  **
13317  ** Currently this is only applicable to characters with Lua minds.
13318  **
13319  *b Arguments:
13320  **
13321  *a group_name - group to broadcast message to
13322  *a radius - how far to broadcast the message
13323  *a message_type - what type of message is being sent
13324  *a message - the message string
13325  *a message_params - optional parameter string
13326  **
13327  **
13328  *b Returns:
13329  **
13330  ** number of times message was successfully parsed,
13331  ** -1 on failure
13332  */
13333  int agent_broadcast_message_to_group(const char* group_name,
13334  float radius,
13335  const char* message_type,
13336  const char* message,
13337  const char* message_params = NULL);
13338 
13339  /*l
13340  **
13341  *b Returns:
13342  **
13343  ** name of character's lua mind object; typically this is the
13344  ** character's name with '-' replaced by '_'
13345  */
13346  const char* get_lua_object_name();
13347 
13348  /*l
13349  *b Description:
13350  **
13351  ** Sets the specified field of the mind to the string field_value.
13352  */
13353  void set_mind_field_as_string(const char* field_name,
13354  const char* field_value);
13355 
13356  /*l
13357  *b Description:
13358  **
13359  ** Queries the luaCharacter object for a specific field, and attempts
13360  ** to convert it into a string. This works for strings and
13361  ** numbers.
13362  **
13363  ** This returned pointer will stay valid until the next time this
13364  ** function is called, so if the results need to be saved they must
13365  ** be copied.
13366  **
13367  *b Returns:
13368  **
13369  ** field_name as string
13370  */
13371  const char* get_mind_field_as_string(const char* field_name,
13372  int warn_if_no_field = 1);
13373 
13374  /*l
13375  *b Description:
13376  **
13377  ** Sets the specified field of the mind to the floating point
13378  ** number field_value.
13379  */
13380  void set_mind_field_as_float(const char* field_name, float field_value);
13381 
13382  /*l
13383  *b Description:
13384  **
13385  ** Similar to get_mind_field_as_string(), but returns field as
13386  ** a float.
13387  **
13388  *b Returns:
13389  **
13390  ** field_name as double
13391  */
13392  float get_mind_field_as_float(const char* field_name,
13393  int warn_if_no_field = 1,
13394  int* found_field = NULL);
13395 
13396  /*l
13397  *b Description:
13398  **
13399  ** Sets the specified field of the mind to the integer number
13400  ** field_value.
13401  */
13402  void set_mind_field_as_int(const char* field_name, int field_value);
13403 
13404  /*l
13405  *b Description:
13406  **
13407  ** Similar to get_mind_field_as_int(), but returns field as
13408  ** an integer.
13409  **
13410  *b Returns:
13411  **
13412  ** field_name as int
13413  */
13414  int get_mind_field_as_int(const char* field_name,
13415  int warn_if_no_field = 1,
13416  int* found_field = NULL);
13417 
13418  /*l
13419  *b Description:
13420  **
13421  ** Attempts to run a luaCharacter member function, and can optionally
13422  ** return the function's result. Lua return values can be converted
13423  ** to strings and numbers -- other data types will cause an error.
13424  **
13425  ** This returned pointer will stay valid until the next time this
13426  ** function is called, so if the results need to be saved they must
13427  ** be copied.
13428  **
13429  *b *Note:* This function should be considered experimental, as the
13430  *b API may change.
13431  **
13432  *b Arguments:
13433  **
13434  *a function_name - luaCharacter function field to invoke
13435  *a argument - optional string argument to the function
13436  *a has_return_string - 0 or 1; determines if lua interface should
13437  *a attempt to retrieve a string value
13438  **
13439  *b Returns:
13440  **
13441  ** Lua function return value
13442  */
13443  const char* evaluate_mind_function(const char* function_name,
13444  const char* argument = NULL,
13445  int has_return_string = 0);
13446 
13447  /*l
13448  *b Description:
13449  **
13450  ** This function produces a string with a long list of character
13451  ** information, including: current path, crowd, behavior, lua state,
13452  ** lua call stack, wakeup callbacks and lua object fields. It is
13453  ** meant to help with debugging agents.
13454  **
13455  ** This returned pointer will stay valid until the next time this
13456  ** function is called, so if the results need to be saved they must
13457  ** be copied.
13458  **
13459  *b Arguments:
13460  **
13461  *a include_stack - pass 1 to include callstack info, 0 to not
13462  *a include_locals - pass 1 to include local variable info, 0 to not
13463  **
13464  *b Returns:
13465  **
13466  ** string containing character information
13467  */
13468  const char* get_ai_state_string(int include_stack = 1, int include_locals = 1);
13469 
13470 
13471 /*****************************************************************************/
13481 /*
13482  *3 Visibility Tests
13483  */
13484 
13485  /*l
13486  *b Description:
13487  **
13488  ** This function tests whether this character can see the passed
13489  ** character. Currently this tests if the cervical link of this
13490  ** character has a clear line of sight to either the cervical or the
13491  ** position links of the target. Currently the orientation of this
13492  ** character isn't factored in.
13493  **
13494  ** This function does not fail if other characters are between the
13495  ** two characters in question.
13496  **
13497  ** Checking visibility is only an option if an octtree is generated
13498  ** from scene objects; typically only DI-Guy Scenario does this.
13499  ** Outside of DI-Guy Scenario set_character_los_function() should be
13500  ** used if no octtree is present.
13501  **
13502  *b Arguments:
13503  **
13504  *a character - character to check
13505  *a los_check_type - currently unused but passed to callback function
13506  *a if end users wish to pass an additional parameter
13507  **
13508  *b Returns:
13509  **
13510  ** 1 if character is visible, 0 if not
13511  */
13512  int check_character_visibility(diguyCharacter* character,
13513  int los_check_type = 0);
13514 
13515  /*l
13516  *b Description:
13517  **
13518  ** This function tests whether this character can see the x, y, z
13519  ** location specified. Currently this tests if the cervical link of
13520  ** this character has a clear line of sight to the x, y, z location.
13521  ** Currently the orientation of this character isn't factored in.
13522  **
13523  ** This function does not fail if other characters are between the
13524  ** character and the location in question.
13525  **
13526  ** Checking visibility is only an option if an octtree is generated
13527  ** from scene objects; typically only DI-Guy Scenario does this.
13528  **
13529  *b Arguments:
13530  **
13531  *a x, y, z - location to check
13532  **
13533  *b Returns:
13534  **
13535  ** 1 if location is visible, 0 if not
13536  */
13537  int check_point_visibility(float x, float y, float z);
13538 
13539 
13540 
13541 /*****************************************************************************/
13558 #ifdef CPLUSPLUS_ONLY
13559 
13560  /*l
13561  *b Description:
13562  **
13563  ** When a character needs to check if it can see a location, DI-Guy
13564  ** calls this function with a pointer to the diguyCharacter in
13565  ** question, and the coordinates of the point that is being looked
13566  ** at. This currently happens when an agent is told to move to a new
13567  ** region.
13568  **
13569  ** The following prototype should be used for the point line-of-sight
13570  ** function:
13571  **
13572  *e int diguyPointLOSFunction(diguyCharacter* character,
13573  *e float x,
13574  *e float y,
13575  *e float z);
13576  **
13577  ** The function should then check if the desired location is visible.
13578  ** This can be done in a number of ways; a typical approach is to do
13579  ** an intersection test with the static scene.
13580  **
13581  ** The function should return 1 if the path to the target is clear, 0
13582  ** if there is an obstruction.
13583  **
13584  ** A default point line-of-sight function can be set for all
13585  ** subsequently created characters by calling
13586  ** diguyScenario::set_default_point_los_function().
13587  **
13588  *b Callable From:
13589  **
13590  *- - C++
13591  */
13592  int set_point_los_function(diguyPointLOSFunction* point_los_function);
13593 
13594  /*l
13595  *b Returns:
13596  **
13597  ** current point line-of-sight function; see set_point_los_function()
13598  **
13599  *b Callable From:
13600  **
13601  *- - C++
13602  */
13603  diguyPointLOSFunction* get_point_los_function();
13604 
13605  /*l
13606  *b Description:
13607  **
13608  ** When a character needs to check if it can see another character,
13609  ** DI-Guy calls this function with a pointer to the diguyCharacter in
13610  ** question. This can happen when check_character_visibility() is
13611  ** invoked or when AI attack code assesses if it should take a shot.
13612  **
13613  ** The following prototype should be used for the character
13614  ** line-of-sight function:
13615  **
13616  *e int diguyCharacterLOSFunction(diguyCharacter* character,
13617  *e diguyCharacter* target_character,
13618  *e int los_test_type) // (currently unused)
13619  **
13620  ** Currently the los_test_type argument defaults to 0 and is not used
13621  ** internally. It is, however, available in
13622  ** check_character_visibility() and will be passed to the callback.
13623  ** This can be useful if the end user wants to write scripting code
13624  ** that has alternative Line of Sight tests depending on agent
13625  ** conditions. (e.g. a test that factors in the character's field of
13626  ** view.)
13627  **
13628  ** The function then checks if the target character is visible. This
13629  ** can be done in a number of ways; a typical approach is to do an
13630  ** intersection test with the static scene. The default
13631  ** implementation tests the path from the characters head to the
13632  ** target's head and then to the target's feet.
13633  **
13634  ** The function should return 1 if the path to the target is clear,
13635  ** and 0 if there is an obstruction.
13636  **
13637  ** A default character line-of-sight function can be set for all
13638  ** subsequently created characters by calling
13639  ** diguyScenario::set_default_character_los_function().
13640  **
13641  *b Callable From:
13642  **
13643  *- - C++
13644  */
13645  int set_character_los_function(diguyCharacterLOSFunction* character_los_function);
13646 
13647  /*l
13648  *b Returns:
13649  **
13650  ** current character line-of-sight function; see
13651  ** set_character_los_function()
13652  **
13653  *b Callable From:
13654  **
13655  *- - C++
13656  */
13657  diguyCharacterLOSFunction* get_character_los_function();
13658 
13659 #endif
13660 
13661 
13662 /*****************************************************************************/
13679  int get_num_ik_chains();
13681 
13683  const char * get_ik_chain_name_at_index(int index);
13684 
13685  /*b Description:
13686  ** Moves the end effector for the specified ik chain to a location in the world.
13687  **
13688  *b Arguments:
13689  *a ik_chain_target - index of ik chain
13690  *a x,y,z - world location of where to move the IK end effector to.
13691  *a ramp_time - how long to take blending in solution
13692  **
13693  *b Returns:
13694  ** -1 on failure, 0 on success
13695  */
13696  int set_ik_target_world(int ik_chain_target, float x, float y, float z, float ramp_time = .25f);
13697 
13698  /*b Description:
13699  ** Moves the end effector for the specified ik chain to a location relative to the character.
13700  **
13701  *b Arguments:
13702  *a ik_chain_target - index of ik chain
13703  *a x,y,z - local location of where to move the IK end effector to.
13704  *a ramp_time - how long to take blending in solution
13705  **
13706  *b Returns:
13707  ** -1 on failure, 0 on success
13708  */
13709  int set_ik_target_local(int ik_chain_target, float x, float y, float z, float ramp_time = .25f);
13710 
13711  /*b Description:
13712  ** Resets the end effector to be solely driven by the animation system */
13713  int disable_ik_target(int ik_chain_target, float ramp_time = .25f);
13714 
13715  /*b Description:
13716  ** Sets the distance to the primary camera, this should be automatically set in OpenGL
13717  ** or if you set the camera position, in retained mode renderers you will need to set this
13718  ** manually. Currently only used by IK system for performance culling.
13719  */
13720  void set_distance_to_primary_camera(float camera_dist);
13721 
13723  float get_distance_to_primary_camera();
13724 
13725 /*****************************************************************************/
13741  /*l
13742  *b Description:
13743  **
13744  ** This function sets the initial character simulator this character
13745  ** will use. The current simulator will be set to this value on
13746  ** scenario reset.
13747  **
13748  ** The current simulator can be set by calling
13749  ** set_current_character_simulator().
13750  **
13751  ** The default simulator is
13752  ** DIGUY_CHARACTER_SIMULATOR_DIGUY_MOTION_ENGINE.
13753  **
13754  ** Requires active physics module if character simulator is set to
13755  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13756  **
13757  *b Arguments:
13758  **
13759  *a character_simulator - which simulator to use at reset
13760  **
13761  *b Returns:
13762  **
13763  ** 0 on success, -1 on failure
13764  */
13765  int set_initial_character_simulator(diguyCharacterSimulator character_simulator);
13766 
13767  /*l
13768  *b Returns:
13769  **
13770  ** initial character simulator
13771  */
13772  diguyCharacterSimulator get_initial_character_simulator();
13773 
13774  /*l
13775  *b Description:
13776  **
13777  ** This function sets the current character simulator this character
13778  ** will use. The current simulator will be reset to the initial
13779  ** character simulator on scenario reset.
13780  **
13781  ** The initial simulator can be set by calling
13782  ** set_initial_character_simulator().
13783  **
13784  *b Arguments:
13785  **
13786  *a character_simulator - new current character simulator
13787  **
13788  *b Returns:
13789  **
13790  ** 0 on success, -1 on failure
13791  */
13792  int set_current_character_simulator(diguyCharacterSimulator character_simulator);
13793 
13794  /*l
13795  *b Returns:
13796  **
13797  ** current character simulator
13798  */
13799  diguyCharacterSimulator get_current_character_simulator();
13800 
13801  /*l
13802  *b Description:
13803  **
13804  ** This function sets the initial physics simulation mode this
13805  ** character will use. The current simulation mode will be set to
13806  ** this value on scenario reset.
13807  **
13808  ** The current simulation mode can be set by calling
13809  ** set_current_physics_simulation_mode().
13810  **
13811  ** The default simulation mode is
13812  ** DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER.
13813  **
13814  ** The physics simulation mode will have no effect unless the current
13815  ** character simulator is
13816  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13817  **
13818  *b Arguments:
13819  **
13820  *a physics_simulation_mode - which simulation mode to use at reset
13821  **
13822  *b Returns:
13823  **
13824  ** 0 on success, -1 on failure
13825  */
13826  int set_initial_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
13827 
13828  /*l
13829  *b Returns:
13830  **
13831  ** initial physics simulation mode
13832  */
13833  diguyPhysicsSimulationMode get_initial_physics_simulation_mode();
13834 
13835  /*l
13836  *b Description:
13837  **
13838  ** This function sets the current physics simulation mode this
13839  ** character will use. The current simulation mode will be reset to
13840  ** the initial physics simulator mode on scenario reset.
13841  **
13842  ** The initial simulation mode can be set by calling
13843  ** set_initial_physics_simulation_mode().
13844  **
13845  ** The physics simulation mode will have no effect unless the current
13846  ** character simulator is
13847  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13848  **
13849  *b Arguments:
13850  **
13851  *a physics_simulation_mode - new current physics simulation mode
13852  **
13853  *b Returns:
13854  **
13855  ** 0 on success, -1 on failure
13856  */
13857  int set_current_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
13858 
13859  /*l
13860  *b Returns:
13861  **
13862  ** initial physics simulation mode
13863  */
13864  diguyPhysicsSimulationMode get_current_physics_simulation_mode();
13865 
13866  /*l
13867  *b Description:
13868  **
13869  ** This function sets the physics collision group this character will
13870  ** be in when being simulated. For improved performance, collision
13871  ** detection between various characters and scene objects will not
13872  ** be performed, based on which collision groups the objects are in.
13873  **
13874  ** By default:
13875  **
13876  *- - characters in character group n collide against props in prop
13877  *- group n and scene objects in scene object group n
13878  *- in group n
13879  *- - characters in group ghost don't collide against any other
13880  *- characters, but do against scene objects and props
13881  *- - characters in group everything collide against all characters,
13882  *- props, and scene objects
13883  *- - all props collide against all other props and scene objects
13884  **
13885  ** Collision group relationships can be modified using
13886  ** diguyApp::set_collision_group_detection_flag().
13887  **
13888  *b Arguments:
13889  **
13890  *a physics_simulation_mode - new current physics simulation mode
13891  **
13892  *b Returns:
13893  **
13894  ** 0 on success, -1 on failure
13895  */
13896  int set_physics_collision_group(diguyPhysicsCollisionGroup collision_group);
13897 
13898  /*l
13899  *b Returns:
13900  **
13901  ** physics collision group
13902  */
13903  diguyPhysicsCollisionGroup get_physics_collision_group();
13904 
13905  /*l
13906  *b Description:
13907  **
13908  ** This function sets a time at which active simulation of a physics
13909  ** controlled character will stop. This is useful for:
13910  **
13911  *- - reducing simulation processing overhead
13912  *- - freezing a simulation that is mostly in steady state, but some
13913  *- small part remains oscillating
13914  **
13915  ** The physics controlled character will remain frozen in the last
13916  ** computed simulated pose.
13917  **
13918  *b Arguments:
13919  **
13920  *a t - scenario t at which simulation will freeze
13921  **
13922  ** t should be large enough for the simulation to reach a reasonably
13923  ** steady state, such as a human lying on the ground. A value that
13924  ** is usually reasonable is around 5 seconds.
13925  */
13926  void set_stop_physics_sim_at_t(float t);
13927 
13928  /*l
13929  *b Description:
13930  **
13931  ** Similar to set_stop_physics_sim_at_t(), but the passed time will
13932  ** be relative to the current simulation time as returned by
13933  ** diguyScenario::get_t().
13934  */
13935  void set_stop_physics_sim_in_t_seconds(float relative_t);
13936 
13937  /*l
13938  *b Returns:
13939  **
13940  ** time at which physics simulation will freeze
13941  */
13942  float get_stop_physics_sim_at_t();
13943 
13944  /*l
13945  *b Description:
13946  **
13947  ** This function applied an impulse force to the character. An
13948  ** impulse is a force that is applied all at one time, such as an
13949  ** explosion shock wave.
13950  **
13951  *b Arguments:
13952  **
13953  *a link - link to which impulse should be applied
13954  *a impulse_magnitude_[xyz] - magnitude of impulse in x direction
13955  *a link_offset_[xyz] - offset on link at which to apply impulse
13956  *a set_simulation_drives_character - pass 1 to automatically change
13957  *a the character's current simulation mode
13958  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
13959  */
13960  void apply_impulse_to_physics_sim(const char* link,
13961  float impulse_magnitude_x,
13962  float impulse_magnitude_y,
13963  float impulse_magnitude_z,
13964  float link_offset_x = 0.0f,
13965  float link_offset_y = 0.0f,
13966  float link_offset_z = 0.0f,
13967  int set_simulation_drives_character = 1);
13968 
13969  /*l
13970  *b Description:
13971  **
13972  ** Similar to apply_impulse_to_physics_sim(), but impulse can be
13973  ** calculated relative to a world position. This is useful if, for
13974  ** example, a character should react to a nearby explosion.
13975  **
13976  *b Arguments:
13977  **
13978  *a link - link to which impulse should be applied
13979  *a impulse_magnitude_[xyz] - magnitude of impulse
13980  *a impulse_generator_position_[xyz] - world coordinates of impulse
13981  *a generating object
13982  *a max_distance - maximum distance from above position at
13983  *a which the impulse can affect this
13984  *a character
13985  *a impulse_rolloff - how much the impulse magnitude should
13986  *a decrease as distance from impulse source
13987  *a increases
13988  *a link_offset_[xyz] - offset on link at which to apply impulse
13989  *a set_simulation_drives_character - pass 1 to automatically change
13990  *a the character's current simulation mode
13991  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
13992  */
13993  void apply_impulse_to_physics_sim_from_world_position(const char* link,
13994  float impulse_magnitude_x,
13995  float impulse_magnitude_y,
13996  float impulse_magnitude_z,
13997  float impulse_generator_position_x,
13998  float impulse_generator_position_y,
13999  float impulse_generator_position_z,
14000  float max_distance = 20.0f,
14001  float impulse_rolloff = 0.0f,
14002  float link_offset_x = 0.0f,
14003  float link_offset_y = 0.0f,
14004  float link_offset_z = 0.0f,
14005  int set_simulation_drives_character = 1);
14006 
14007 /*****************************************************************************/
14011  /*l
14012  *b Description:
14013  **
14014  ** Sets texture load behavior to DIGUY_LOAD_INSTANTLY, DIGUY_LOAD_PRIORITY_ASYNC, or
14015  ** DIGUY_LOAD_ASYNC
14016  */
14017  static int set_texture_load_behavior(diguyGraphicsTextureLoadingBehavior mode);
14018 
14019  /*l
14020  *b Returns current behavior, as set in set_texture_load_behavior()
14021  */
14022  static diguyGraphicsTextureLoadingBehavior get_texture_load_behavior();
14023 
14024  /*l
14025  *b Description:
14026  **
14027  ** Sets maximum quality of shader to use (actual quality varies
14028  ** by distance from camera). See diguyGraphicsShaderQualityLevel for
14029  ** possible values.
14030  **
14031  *b Arguments:
14032  **
14033  *a quality_level - a value between DIGUY_GRAPHICS_SHADER_QUALITY_UNLIT
14034  *- and DIGUY_GRAPHICS_SHADER_QUALITY_MAX
14035  */
14036  static int set_max_shader_quality_level(int quality_level);
14037 
14039  static int get_max_shader_quality_level();
14040 
14041 
14042 /****************************************************************************/
14049 /****************************************************************************/
14050 
14051  /*l
14052  ** Sets if this character will play back animation events that have been
14053  ** added to motion inits in the action table.
14054  */
14055  int set_animation_events_enabled(int enable);
14056  int get_animation_events_enabled();
14057 
14058 
14059  /*l
14060  *b Description:
14061  **
14062  ** This function returns how many channels the specified action has.
14063  ** If an action has more than one channel, the relative weights of
14064  ** its channels can be set using the set_action_channel_weight()
14065  ** function.
14066  **
14067  *b Arguments:
14068  **
14069  *a action_name - name of action to be queried
14070  **
14071  *b Returns:
14072  **
14073  ** number of channels in specified action
14074  */
14075  int get_action_num_channels(const char* action_name);
14076 
14077  /*l
14078  *b Description:
14079  **
14080  ** This function sets the weight one channel of a multi-channel
14081  ** action.
14082  **
14083  ** The passed weight should be between 0 and 1. The weights of
14084  ** the other channels in the action will be adjusted so that the
14085  ** total weight of all channels is 1.
14086  **
14087  *b Arguments:
14088  **
14089  *a action_name - name of action to be affected
14090  *a channel - which channel's weight to set
14091  *a weight - weight of the channel, between 0 and 1
14092  **
14093  *b Returns:
14094  **
14095  ** 0 on success, -1 on failure
14096  */
14097  int set_action_channel_weight(const char* action_name,
14098  char channel,
14099  float weight);
14100 
14101  /*l
14102  *b Description:
14103  **
14104  ** This function returns the weight of one channel of a multi-channel
14105  ** action.
14106  **
14107  *b Arguments:
14108  **
14109  *a action_name - name of action to be queried
14110  *a channel - which channel's weight to return
14111  **
14112  *b Returns:
14113  **
14114  ** weight of a channel
14115  */
14116  float get_action_channel_weight(const char* action_name,
14117  char channel);
14118 
14119  /*l
14120  *b Description:
14121  **
14122  ** This function returns the number of seconds before the transition
14123  ** to the desired action begins. If the character is already
14124  ** performing the desired action the function returns 0.
14125  **
14126  *b THIS FUNCTION DOES NOT YET RETURN VALID RESULTS.
14127  **
14128  *b Returns:
14129  **
14130  ** time to reach desired action, in seconds
14131  */
14132  float get_time_to_reach_desired_action();
14133 
14134  /*l
14135  *b Description:
14136  **
14137  ** Maps a character type map field to its value. See diguyCharacterTypeMap.
14138  **
14139  ** Returns:
14140  **
14141  ** The value, as a string.
14142  */
14143  const char* get_type_map_field(diguyCharacterTypeMapField field);
14144 
14145  /*l
14146  *b Description:
14147  **
14148  ** Maps a character type map field to its value, using a string version (e.g.
14149  ** "age") of the field name. See diguyCharacterTypeMap.
14150  **
14151  ** Returns:
14152  **
14153  ** The value, as a string.
14154  */
14155  const char* get_type_map_field_using_string(const char* field);
14156 
14159  float get_normalized_age() const;
14160 
14161  /*l
14162  *b Description:
14163  **
14164  ** This function performs a "micro merge", allowing a diguyCharacter
14165  ** to have objects added to it by parsing a .dss file fragment in the
14166  ** form of a string.
14167  **
14168  ** This function can be used, for example, to add paths to
14169  ** dynamically created agents. A Lua Package can contain a number of
14170  ** text strings representing local paths for agents. On character
14171  ** creation these strings can be merged in and turned into
14172  ** per-character objects.
14173  **
14174  ** The DI-Guy Scenario path page has a "Display Asset" button for
14175  ** generating merge_object() compatible strings.
14176  **
14177  ** There is also a diguyScenario::merge_object() function that allows
14178  ** the merging of text blocks that represent sounds and particle
14179  ** systems.
14180  **
14181  ** Note: the parser is very sensitive to tabs and formatting!
14182  */
14183  int merge_object(const char* object);
14184 
14185  /*l
14186  *b Description:
14187  **
14188  ** Returns 1 if any active character in the named group is visible,
14189  ** otherwise 0.
14190  **
14191  *b Arguments:
14192  **
14193  *a group_name
14194  *a max_distance_to_check
14195  */
14196  int is_active_character_in_group_visible(const char* group_name,
14197  float max_distance_to_check = 100000.0f);
14198 
14199  /*l
14200  *b Description:
14201  **
14202  ** Gets local space bounding box, this function is currently expensive
14203  ** and should be used with care.
14204  **
14205  *b Arguments:
14206  **
14207  *a x1,y1,z1,x2,y2,z2 - output parameters
14208  **
14209  *b Returns:
14210  **
14211  ** 0 on success, -1 on failure
14212  ** (float * arguments converted to return values in Lua)
14213  */
14214  int get_local_space_bounding_box(float* x1, float* y1, float* z1,
14215  float* x2, float* y2, float* z2);
14216 
14217  /*l
14218  *b Description:
14219  **
14220  ** This causes a character's mind to get an update call even if time
14221  ** isn't passing in the scenario. This is occasionally useful for
14222  ** characters that are managing the UI.
14223  **
14224  ** Note that there is now a luaUIStateMachine that might be a better
14225  ** solution.
14226  */
14227  void set_mind_always_updates(int force_update);
14228 
14230  int get_mind_always_updates();
14231 
14232  /*l
14233  ** Returns angle in degrees from character's "forward facing" vector
14234  ** to the specified action bead, on the specified path
14235  */
14236  float get_angle_to_path(const char* path_name,
14237  const char* action_bead_name = NULL);
14238 
14239 
14242  void set_scene_graph_mask(unsigned int mask);
14243 
14245  unsigned int get_scene_graph_mask();
14246 
14247 
14252  diguyMotionEngineSnapshot get_motion_engine_snapshot();
14253 
14255  int apply_motion_engine_snapshot(const diguyMotionEngineSnapshot & action_info);
14256 
14257 
14262  int set_local_to_world_orientation_matrix( float rz, float rx, float ry);
14264  int set_local_to_world_orientation_matrix(
14265  float a0, float a1, float a2,
14266  float b0, float b1, float b2,
14267  float c0, float c1, float c2, int transpose = 0);
14268 
14269 
14272  int set_always_update_regardless_of_dt(int val);
14274  int get_always_update_regardless_of_dt();
14275 
14276  void set_shader_matrixes_out_of_date();
14277 
14278 /****************************************************************************/
14279 /****************************************************************************/
14290 /****************************************************************************/
14291 /****************************************************************************/
14292 /****************************************************************************/
14293 
14294  // Deprecated as of 13.0;
14296  int aim_converge(int max_iterations = 30);
14297 
14299  void set_aim_algorithm(int aim_algorithm);
14300 
14302  int get_aim_algorithm();
14303 
14304 
14305  // Deprecated as of 9.1.3; use diguyCharacter::get_position_link() instead.
14306  // diguyGraphicsLink* get_base_link();
14307 
14308  // Deprecated as of 9.0.1; use set_apply_actor_scale_to_action_bead_travel() instead.
14309  // void set_apply_actor_scale_to_action_bead_xy_travel(int apply_scale_flag);
14310 
14311  // Deprecated as of 9.0.1; use get_apply_actor_scale_to_action_bead_travel() instead.
14312  // int get_apply_actor_scale_to_action_bead_xy_travel();
14313 
14314  /*l
14315  ** Deprecated as of 9.1.4. In general setting the weapon sound
14316  ** should no longer be necessary, as weapon sounds are now specified
14317  ** by the weapon's munition type. If this function is called, it
14318  ** will have the same effect as calling
14319  ** diguyCharacter::set_weapon_sound_override().
14320  */
14321  // int set_default_weapon_sound(const char* sound_name);
14322 
14323  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14324  //const char* get_default_weapon_sound();
14325 
14326  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14327  // int set_default_weapon_sound_gain(float gain);
14328 
14329  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14330  // float get_default_weapon_sound_gain();
14331 
14332  // Deprecated as of 9.1.4. Call set_weapon_munition_type_override() instead.
14333  // int set_weapon_munition_type(const char* munition_type);
14334 
14335  // Deprecated as of 9.1.4. Call get_weapon_munition_type_override() instead.
14336  // const char* get_weapon_munition_type();
14337 
14338  // Deprecated as of 10.5.2. Call set_weapon_max_azimuth_error() instead.
14339  // int set_weapon_horizontal_error(float h_error);
14340 
14341  // Deprecated as of 10.5.2. Call get_weapon_max_azimuth_error() instead.
14342  // float get_weapon_horizontal_error();
14343 
14344  // Deprecated as of 10.5.2. Call set_weapon_max_elevation_error() instead.
14345  // int set_weapon_vertical_error(float v_error);
14346 
14347  // Deprecated as of 10.5.2. Call get_weapon_max_elevation_error() instead.
14348  // float get_weapon_vertical_error();
14349 
14350  // Added as of 10.1.6. Invokes the old implementation of
14351  // begin_appearance_effect().
14352  //int begin_legacy_appearance_effect(const char* effect,
14353  // const char* override_link = "",
14354  // float override_scale = DIGUY_DEFAULT_FLOAT,
14355  // float override_offset_x = DIGUY_DEFAULT_FLOAT,
14356  // float override_offset_y = DIGUY_DEFAULT_FLOAT,
14357  // float override_offset_z = DIGUY_DEFAULT_FLOAT);
14358 
14359 
14360  // Added as of 10.1.6. Invokes the old implementation of
14361  // end_appearance_effect().
14362  //
14363  //int end_legacy_appearance_effect(const char* effect);
14364 
14365  // Added as of 10.1.6. Invokes the old implementation of
14366  // appearance_effect_is_active().
14367  //int legacy_appearance_effect_is_active(const char* effect);
14368 
14369  // Deprecated as of 10.1.8. Use set_render_mode_shader() instead.
14370  //int set_shader_program(const char* shader_name);
14371 
14372  // Deprecated as of 10.5.2. Use get_render_mode_shader() instead.
14373  //const char* get_recommended_appearance_shader_program_name();
14374 
14375  // Deprecated as of 10.5.1. Use merge_object() instead.
14376  //int merge_asset(const char* asset);
14377 
14378  // Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state() instead.
14379  // void set_DIS_smoke_trail_state(int state);
14380 
14381  // Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state() instead.
14382  // int get_DIS_smoke_trail_state();
14383 
14384  // Deprecated as of 12.0.0. Not supported in FaceFX.
14385  //int speak(const char* string);
14386 
14387 
14388  // Deprecated as of 12.0.0. Not supported in FaceFX.
14389  //int set_viseme(const char* viseme_name, float weight);
14390 
14391  // Deprecated as of 12.0.0. Not supported in FaceFX.
14392  //float get_viseme(const char* viseme_name);
14393 
14394 
14395  // Deprecated as of 12.0.0. Not supported in FaceFX.
14396  //int set_orientation_eye_left(float azimuth, float elevation);
14397 
14398  // Deprecated as of 12.0.0. Not supported in FaceFX.
14399  //int set_orientation_eye_right(float azimuth, float elevation);
14400 
14401  // Deprecated as of 12.0.0. Not supported in FaceFX.
14402  //float get_azimuth_eye_left();
14403 
14404  // Deprecated as of 12.0.0. Not supported in FaceFX.
14405  //float get_elevation_eye_left();
14406 
14407  // Deprecated as of 12.0.0. Not supported in FaceFX.
14408  //float get_azimuth_eye_right();
14409 
14410  // Deprecated as of 12.0.0. Not supported in FaceFX.
14411  //float get_elevation_eye_right();
14412 
14413  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14414  //int set_weapon_shell_eject_enabled(int enabled);
14415 
14416  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14417  //int get_weapon_shell_eject_enabled();
14418 
14419  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14420  //int set_weapon_smoke_enabled(int enabled);
14421 
14422  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14423  //int get_weapon_smoke_enabled();
14424 
14425  // Deprecated as of 13.5
14426  // int set_shape_switches_disabled(int disabled_flag);
14427  // int get_shape_switches_disabled();
14428 
14429 /****************************************************************************/
14430 /****************************************************************************/
14431 
14436 #ifdef CPLUSPLUS_ONLY
14437 
14438  bdiScenarioCharacter* get_scripted_object();
14439 private:
14440 
14441  /*l
14442  ** A private constructor.
14443  */
14444  diguyCharacter(bdiScenarioCharacter* character);
14445 
14446  /*l
14447  ** A private destructor.
14448  */
14449  ~diguyCharacter();
14450 
14451  /*l
14452  ** A pointer to internal data.
14453  */
14454  bdiScenarioCharacter* m_scripted_object;
14455 
14456  friend class bdiPublishedCharacter;
14457  friend class bdiScenarioCharacter;
14458  friend class diguySensorRegion;
14459  friend class diguyScenario;
14460 
14461 #endif
14462 
14463 };
14464 
14465 
14466 #endif /* __diguyCharacter_H */
14467 
Definition: diguyViewLabel.h:44
A class that represents the unique per-character shader object.
Definition: diguyGraphicsShaderInstance.h:55
diguyGraphicsTextureLoadingBehavior
Definition: diguy_constants.h:382
Experimental class for helping with multichannel synchronization.
Definition: diguyMotionEngineSnapshot.h:6
#define DIGUY_DEFAULT_FLOAT
This value is a magic number that, when passed to certain functions, means that the function should u...
Definition: diguy_constants.h:64
diguyCallbackReturn diguyCharacterCallback(diguyCharacter *character, int callback_id, void *callback_params, void *callback_user_data)
Definition: diguy_typedefs.h:51
diguyCharacterTypeMapField
This enumeration allows type map fields to be queried using a numerical value rather than a string na...
Definition: diguyCharacterTypeMap.h:33
The class that represents what parameters an agent is currently using to carry out their base behavio...
Definition: diguyAgentParams.h:39
wrapper around a chain simulation
Definition: diguyChainSimulation.h:35
diguyHistoryType
DI-Guy history types.
Definition: diguy_constants.h:280
Definition: diguyPathShape.h:30
diguyMotionDirection
Definition: diguyMotionDirection.h:26
Definition: diguy_vector_classes.h:154
A class that represents a bullet impact in the world, often used by AIs to make reaction decisions...
Definition: diguyImpact.h:41
A bead that sits on a character's spline path and triggers a new gaze.
Definition: diguyCharacterPathGazeBead.h:34
Definition: diguyMotionPosture.h:32
diguyConnectionPointType
Definition: diguyConnectionPointType.h:27
Definition: diguy_constants.h:165
#define DIGUY_DEFAULT_INT
This value is a magic number that, when passed to certain functions, means that the function should u...
Definition: diguy_constants.h:74
Definition: diguy_constants.h:183
A view is a graphics window wherein the scenario and its characters are animated. Note that views hav...
Definition: diguyView.h:48
diguyMuzzle
This is an enumeration of the different muzzles that can be specified to various DI-Guy function call...
Definition: diguy_constants.h:181
A bead that sits on a character's spline path and triggers a new decision.
Definition: diguyCharacterPathDecisionBead.h:34
An interface for manipulating a character's spline path. A path is typically authored in DI-Guy Scena...
Definition: diguyCharacterPath.h:47
diguyCharacterSimulator
This enumeration lists the ways that data can be generated for DI-Guy characters. ...
Definition: diguy_constants.h:1686
diguyCharacterClass
DI-Guy character classes.
Definition: diguy_constants.h:110
Attached to certain types of more complex vehicles, to manage their behavior.
Definition: diguyVehicleController.h:49
float diguyAltitudeFunction(diguyCharacter *character, float x, float y, float old_z, int *valid)
Definition: diguy_typedefs.h:57
int diguyCharacterLOSFunction(diguyCharacter *character, diguyCharacter *target_character, int visibility_type)
Definition: diguy_typedefs.h:106
Represents the scenario currently being portrayed.
Definition: diguyScenario.h:100
A group of DI-Guy characters, useful for organizing your scenarios.
Definition: diguyCharacterGroup.h:38
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:80
Definition: diguyWaypoint.h:29
Definition: diguySensorRegion.h:38
int diguyPointLOSFunction(diguyCharacter *character, float x, float y, float z)
Definition: diguy_typedefs.h:111
int diguyFeelerFunction(diguyCharacter *character, float origin_x, float origin_y, float origin_z, float dir_x, float dir_y, float dir_z, float max_distance_to_test, float *intersection_x, float *intersection_y, float *intersection_z, float *normal_x, float *normal_y, float *normal_z)
Definition: diguy_typedefs.h:64
static double t
4 Header files and forward declarations
Definition: simple_playback_ogl.cpp:55
Definition: diguy_constants.h:1519
Definition: diguyMotionVariant.h:54
diguyParameterComparison
This is an enumeration of the different parameter comparison options that can be specified to various...
Definition: diguy_constants.h:163
A class that allows end users to override a character's animation on a joint level.
Definition: diguyCharacterPoseOverride.h:37
diguyCallbackReturn
DI-Guy callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIG...
Definition: diguy_constants.h:96
diguyMotionVariant
Definition: diguyMotionVariant.h:26
diguyCharacterMode
This is an enumeration of the different modes a DI-Guy character can be in.
Definition: diguy_constants.h:148
A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its text...
Definition: diguyGraphicsShape.h:51
A class representing a overlaid performance on a character's base animation.
Definition: diguyCharacterGesture.h:43
A bead that sits on a character's spline path and triggers a new script evaluation.
Definition: diguyCharacterPathScriptBead.h:34
Definition: diguySoundInstance.h:29
Definition: diguyVariable.h:38
diguyCharacterAppearanceTypes
DI-Guy character appearance query API, this is for diguyCharacter::get_num_appearances_of_type() ...
Definition: diguy_constants.h:132
diguyPhysicsSimulationMode
This enumeration lists the modes that a DI-Guy character physics sim can be in, when the character si...
Definition: diguy_constants.h:1703
diguyPhysicsCollisionGroup
This enumeration lists the collision groups that a DI-Guy physics sim object can be in...
Definition: diguy_constants.h:1719
This class implements shader lod system for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderTechnique.h:152
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:96
The class that represents a DI-Guy Crowd, DI-Guy AI agents can be given orders at an individual level...
Definition: diguyCrowd.h:47
Represents algorithm for steering and maneuvering a character towards a goal point.
Definition: diguyCharacterGuide.h:561
diguyMotionPosture
Definition: diguyMotionPosture.h:26
A bead that sits on a character's spline path and triggers a new aim event.
Definition: diguyCharacterPathAimBead.h:34