DI-Guy SDK Documentation  13.2
diguyCharacter.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2016 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyCharacter
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyCharacter_H
15 #define __diguyCharacter_H
16 
17 #ifdef SWIG
18 %module diguyCharacter
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 #include <declspec_diguy.h>
25 #include <diguy_constants.h>
26 #include <diguy_typedefs.h>
27 #include <diguy_vector_classes.h>
30 #include <diguyCharacterTypeMap.h>
31 #include <diguyMotionDirection.h>
32 #include <diguyMotionPosture.h>
33 #include <diguyMotionVariant.h>
34 
35 class bdiScenarioCharacter;
36 class diguyAgentParams;
38 class diguyCharacter;
42 class diguyCharacterPath;
47 class diguyCrowd;
48 class diguyGraphicsLink;
51 class diguyImpact;
53 class diguyPathShape;
54 class diguyScenario;
55 class diguySoundInstance;
56 class diguyVariable;
58 class diguyView;
59 class diguyViewLabel;
60 class diguyWaypoint;
61 
63 
65 
66 class DtEntityStateRepository;
67 
68 #endif
69 
70 
83 class BDI_DECLSPEC_diguy diguyCharacter
84 {
85 
86 public:
87 
88 /*****************************************************************************/
98  /*l
99  *b Description:
100  **
101  ** Returns the name of the object. This pointer will never be NULL.
102  */
103  const char* get_name();
104 
105  /*l
106  *b Description:
107  **
108  ** This function sets the name of this object.
109  **
110  *b Returns:
111  **
112  ** 0 on success, -1 on failure
113  */
114  int set_name(const char* name);
115 
116  /*l
117  *b Description:
118  **
119  ** Returns the type name of the object, should be 'character'. This pointer will never be
120  ** NULL.
121  */
122  const char* get_type_name();
123 
124  /*l
125  *b Description:
126  **
127  ** All characters are assigned a unique identifier, or uid. This
128  ** function returns this character's uid.
129  **
130  ** *Note*: unique identifiers will change between DI-Guy runs!
131  **
132  */
133  long get_uid();
134 
135  /*l
136  *b Description:
137  **
138  ** Returns the index of the object. This index may change if
139  ** characters are created or destroyed, so it should not be considered
140  ** a unique identifier for the character. See get_uid().
141  */
142  int get_index();
143 
144  /*l
145  *b Description:
146  **
147  ** This function updates the character. The character's position and
148  ** pose will be set to be what it will be (or was) at the specified t.
149  **
150  ** If the scenario has control of t (return value of
151  ** get_t_controlled_by_scenario_t() is 0), then this function's
152  ** effects will be overridden the next time diguyScenario::update() is
153  ** called with a new t.
154  **
155  ** Note: diguyScenario::update() must be called as or more frequently
156  ** than diguyCharacter::update() for proper DI-Guy operation.
157  ** diguyCharacter::update() is intended for load management use, where
158  ** the user intends to update far away or out-of-frustum characters
159  ** less frequently than the overall scenario. This is done in con-
160  ** junction with set_t_controlled_by_scenario_t(0) for the character.
161  ** diguyCharacter::update() is not intended as a replacement for
162  ** diguyScenario::update().
163  **
164  *b Returns:
165  **
166  ** 0 on success, -1 on failure
167  **
168  *b Arguments:
169  **
170  *a t - new time for the character
171  *a full_update - set to 1 to cause full update of character
172  */
173  int update(float t, int full_update = 1);
174 
175  /*l
176  *b Description:
177  **
178  ** This function sets the current type of this character.
179  **
180  *b Arguments:
181  **
182  *a type - name of the new desired type
183  **
184  *b See Also:
185  **
186  ** get_character_type_string()
187  */
188  void set_character_type(const char* type);
189 
190  /*l
191  *b Description:
192  **
193  ** Returns the type of the character (never NULL).
194  **
195  ** Character types specify the types of motions the character will be
196  ** able to perform. Some characters can move like soldiers, others
197  ** can move like civilians, still others can move like specific
198  ** animals.
199  **
200  ** The character type is explicitly specified in the call to
201  ** diguyScenario::create_character().
202  **
203  ** Examples of character types are:
204  *>
205  *- - soldier
206  *- - male_pedestrian
207  *- - horse
208  *- - prop
209  *<
210  */
211  const char* get_character_type_string();
212 
213  /*l
214  *b Description:
215  **
216  ** Returns the class of the character (never NULL).
217  **
218  ** Character classes are a higher level description than character
219  ** types, and allow for more generalized logic. For example, instead
220  ** of having something happen when one of a large set of specific
221  ** character types enters a region, something can happen when any
222  ** human enters the region.
223  **
224  ** Character classes are not specified directly, but are instead
225  ** derived from the character type. (In DI-Guy, all soldiers are
226  ** humans, for example.)
227  **
228  ** Examples of character classes are:
229  *>
230  *- - human
231  *- - vehicle
232  *- - object
233  *- - animal
234  *<
235  */
236  const char* get_character_class();
237 
239  diguyCharacterClass get_character_class_type();
240 
241  /*l
242  *b Description:
243  **
244  ** Returns the scenario that this character is a part of.
245  */
246  diguyScenario* get_scenario();
247 
248  /*l
249  *b Description:
250  **
251  ** This is the top-level on/off switch for the character. A character
252  ** that is not enabled has very little processing overhead: it is
253  ** neither updated during an update() call, nor is it drawn during a
254  ** draw() call. A disabled character will remain disabled until
255  ** set_enabled(1) is called on it; nothing else implicitly re-enables
256  ** the character.
257  **
258  ** There are several other diguyCharacter functions that have somewhat
259  ** similar effects that may be more appropriate at times:
260  **
261  *- - set_current_tin() and set_current_tout(): These functions
262  *- show and animate the character starting at time tin ("T In"),
263  *- and ending at time tout ("T Out")
264  *- - set_invisible_flag(): This function disables drawing of
265  *- the character, but the character still updates and changes
266  *- position.
267  **
268  ** Refer to the documentation of these functions for more information.
269  **
270  *b Returns:
271  **
272  ** always return 0
273  */
274  int set_enabled(int enabled);
275 
276  /*l
277  *b Description:
278  **
279  ** Returns whether the character is enabled, as set by the
280  ** set_enabled() call. New characters are enabled by default.
281  **
282  *b Returns:
283  **
284  ** 1 if the character is enabled, 0 if not
285  */
286  int get_enabled();
287 
288  /*l
289  *b Description:
290  **
291  ** Sets whether this character is drawn automatically by the scenario.
292  **
293  ** Note depending on the rendering environment if this flag is set to 0,
294  ** it is up to the user to call the character draw_pass1() and draw_pass2()
295  ** calls at the appropriate time.
296  **
297  *b Arguments:
298  **
299  *a flag - pass 1 for character drawing to automatically be
300  *a handled by scenario (this is the default);
301  *a 0 for it not to be
302  **
303  *b Returns:
304  **
305  ** 0 on success, -1 on failure
306  */
307  int set_drawn_by_scenario_flag(int flag);
308 
309  /*l
310  *b Description:
311  **
312  ** Returns whether character drawing is done automatically by the
313  ** scenario.
314  **
315  *b Returns:
316  **
317  ** 1 if character drawing is done by the scenario;
318  ** 0 if not
319  **
320  *b See Also:
321  **
322  ** set_drawn_by_scenario_flag()
323  */
324  int get_drawn_by_scenario_flag();
325 
326  /*l
327  *b Description:
328  **
329  ** This function makes the character invisible; i.e., draw() calls
330  ** for the character will have no effect. Note that the character
331  ** will still update its position and pose during update() calls. To
332  ** more thoroughly disable a character, consider the functions
333  ** set_enabled() and set_current_tout().
334  **
335  *b Arguments:
336  **
337  *a invisible_flag - pass 1 to make character invisible, 0 to
338  *a make it visible
339  **
340  *b Available as Decision Bead/Event
341  */
342  void set_invisible_flag(int invisible_flag);
343 
345  int get_invisible_flag();
346 
347  /*l
348  *b Description:
349  **
350  ** Returns whether the character is active. A character is
351  ** active if:
352  **
353  *- - it is enabled as per the set_enabled() call
354  *- - it is within its tin/tout interval as set by the
355  *- set_current_tin() and set_current_tout() calls
356  *- - it is not "network paused" (get_is_network_paused()
357  *- returns 0)
358  **
359  *b Returns:
360  **
361  ** 1 if the character is active, 0 if not
362  **
363  *b Available as Decision Bead
364  */
365  int get_is_active();
366 
367  /*l
368  *b Description:
369  **
370  ** Returns whether the character will be drawn during scenario and
371  ** character draw() calls. A character will be drawn if:
372  **
373  *- - it is enabled as per the set_enabled() call
374  *- - it is within its tin/tout interval as set by the
375  *- set_current_tin() and set_current_tout() calls
376  *- - its invisible flag is 0, as set by the
377  *- set_invisible_flag() call
378  **
379  ** There is no corresponding set_is_drawn() function; use
380  ** set_invisible_flag() to explicitly make a character not be drawn.
381  **
382  *b Returns:
383  **
384  ** 1 if the character will be drawn, 0 if not
385  */
386  int get_is_drawn();
387 
391  int get_was_drawn_last_frame();
392 
394  int set_was_drawn_last_frame(int drawn);
395 
397  int get_is_culled();
398 
404  int set_is_culled(int culled);
405 
406  /*l
407  *b Returns:
408  **
409  ** 1 if the character is temporary (created by diguyScenario::create_temporary_character()
410  ** call; 0 if not
411  */
412  int get_is_temporary();
413 
414  /*l
415  *b Description:
416  **
417  ** This function returns 1 if the character has been recycled from the
418  ** character recycle bin, 0 if not.
419  **
420  ** See diguyScenario::send_character_to_recycle_bin()
421  ** and diguyScenario::retrieve_character_from_recycle_bin().
422  */
423  int get_is_recycled();
424 
425  /*l
426  *b Description:
427  **
428  ** This function sets how the character's t (time) is controlled. If
429  ** 1, the character's t will be set by the scenario on each call to
430  ** diguyScenario::update(). If 0, the character should be updated by
431  ** calls to update().
432  **
433  *b Arguments:
434  **
435  *a t_controlled_by_scenario_t - 1 for controlled by scenario, 0 for
436  *a manual update
437  **
438  *b Returns:
439  **
440  ** 0 on success, -1 on failure
441  */
442  int set_t_controlled_by_scenario_t(int t_controlled_by_scenario_t);
443 
444  /*l
445  *b Returns:
446  **
447  ** whether character's t is controlled by the scenario;
448  ** see set_t_controlled_by_scenario_t()
449  */
450  int get_t_controlled_by_scenario_t();
451 
452  /*l
453  *b Description:
454  **
455  ** This function sets the initial tin ("T In") time of the character.
456  ** See set_current_tin() for a discussion of how tin and tout times
457  ** affect the character.
458  **
459  ** When the scenario is reset or loaded from a .dss file, the current
460  ** tin value will be set to this initial tin value.
461  **
462  ** Note that if the scenario is running (diguyScenario::get_t() returns > 0),
463  ** tin can be set only if override_time_warning is set.
464  **
465  ** Note that both tin and tout times are scenario-relative times, not
466  ** character-relative.
467  **
468  ** This call makes an implicit call to set_current_tin() with the
469  ** same value.
470  **
471  *b Arguments:
472  **
473  *a tin - new value of initial tin in seconds
474  *a override_time_warning - if set, initial_tin can be set at any time
475  **
476  *b Returns:
477  **
478  ** 0 on success, -1 on failure
479  */
480  int set_initial_tin(float tin, int override_time_warning = 0);
481 
482  /*l
483  *b Description:
484  **
485  ** This function sets the initial tout ("T Out") time of the
486  ** character. See set_current_tin() for a discussion of how tin and
487  ** tout times affect the character.
488  **
489  ** When the scenario is reset or loaded from a .dss file, the current
490  ** tout value will be set to this initial tout value.
491  **
492  ** Note that this function cannot be called once the scenario has
493  ** begun running (diguyScenario::get_t() returns > 0).
494  **
495  ** Note that both tin and tout times are scenario-relative times, not
496  ** character-relative.
497  **
498  ** This call makes an implicit call to set_current_tout() with the
499  ** same value.
500  **
501  *b Arguments:
502  **
503  *a tout - new value of initial tout in seconds
504  **
505  *b Returns:
506  **
507  ** 0 on success, -1 on failure
508  */
509  int set_initial_tout(float tout);
510 
511  /*l
512  *b Description:
513  **
514  ** This function sets the current tin ("T In") time of the character.
515  ** The character will not be visible nor will it start moving or
516  ** animating until the scenario reaches this time.
517  **
518  ** There are two ways the tin and tout times of the character can be
519  ** used:
520  **
521  ** The first is to set them to their desired values when the scenario
522  ** begins. If, for example, it is known that this character should
523  ** only be visible and active from 60 seconds to 80 seconds, the tin
524  ** and tout times can be set to 60 and 80, respectively. The
525  ** scenario will then spend very little time for character updates
526  ** and draws outside of these limits.
527  **
528  ** The second is to use them to quickly "trigger" a character to
529  ** become visible and start moving. This is done by setting the
530  ** initial values of tin and tout to very high values, and then
531  ** changing them to lower values when the character should become
532  ** active. Consider the following example: This character is
533  ** waiting just inside a doorway, and should emerge when another
534  ** character comes close. If the tin time of the character is very
535  ** high, very little time will be taken for this character's updates
536  ** and draws. When the other character does come close, this
537  ** character's tin time can be set to "now" (the scenario's current
538  ** t, as returned by diguyScenario::get_t()). This character will
539  ** then become visible and start moving out of the doorway.
540  **
541  ** The default current tin time is the current time of the scenario
542  ** when the character is created.
543  **
544  ** Note that both tin and tout times are scenario-relative times, not
545  ** character-relative.
546  **
547  *b Arguments:
548  **
549  *a tin - new value of current tin in seconds
550  **
551  *b Returns:
552  **
553  ** 0 on success, -1 on failure
554  */
555  int set_current_tin(float tin);
556 
557  /*l
558  *b Description:
559  **
560  ** Same as set_current_tin(), but time is set to current scenario time.
561  **
562  *b Returns:
563  **
564  ** 0 on success, -1 on failure
565  **
566  *b Available as Decision Bead/Event
567  */
568  int set_current_tin_to_now();
569 
570  /*l
571  *b Description:
572  **
573  ** This function returns the current tin time of the character. See
574  ** set_current_tin().
575  **
576  *b Returns:
577  **
578  ** Current tin time in seconds.
579  */
580  float get_current_tin();
581 
582  /*l
583  *b Description:
584  **
585  ** This function sets the current tout ("T Out") time of the
586  ** character. If tout is enabled the character will become invisible
587  ** and will stop moving and animating when the scenario reaches this
588  ** time.
589  **
590  ** Note that both tin and tout times are scenario-relative times, not
591  ** character-relative.
592  **
593  ** Default tout time is 60000 seconds.
594  **
595  *b Arguments:
596  **
597  *a tout - new value of current tout in seconds
598  *a disable_character_at_tout - this argument is present to keep
599  *a the function prototype will remain
600  *a backward compatible; it has no effect
601  */
602  int set_current_tout(float tout,
603  int disable_character_at_tout = 0);
604 
605  /*l
606  *b Description:
607  **
608  ** Same as set_current_tout(), but time is set to current scenario
609  ** time.
610  **
611  *b Returns:
612  **
613  ** 0 on success, -1 on failure
614  **
615  *b Available as Decision Bead
616  */
617  int set_current_tout_to_now();
618 
619  /*l
620  *b Description:
621  **
622  ** This function returns the current tout ("T Out") time of the
623  ** character in seconds. See set_current_tout().
624  */
625  float get_current_tout();
626 
627  /*l
628  *b Description:
629  **
630  ** This function sets what will happen when the character reaches its
631  ** tout time. If set to 0, the character will ignore the tout time
632  ** and continue indefinitely.
633  */
634  void set_tout_enabled(int tout_enabled);
635 
636  /*l
637  *b Description:
638  **
639  ** This function returns the whether tout is enabled.
640  **
641  ** See set_tout_enabled().
642  **
643  *b Returns:
644  **
645  ** 1 if tout enabled, 0 if not
646  */
647  int get_tout_enabled();
648 
649  /*l
650  *b Description:
651  **
652  ** When the motion data of a character is interpolated a quick
653  ** interpolation method can be used which may yield incorrect results,
654  ** or an expensive interpolation method can be used which will yield
655  ** correct results at the expense of time. The threshold at which
656  ** the interpolation method changes is specified by this function.
657  **
658  *b Arguments:
659  **
660  *a threshold - float between 0 (careful never) and 1 (careful always);
661  ** default is 0.7
662  **
663  ** DI-Guy compares the careful interpolation threshold to the cosine
664  ** of an angle. Both the threshold and the cosine are dimensionless
665  ** and thus have no units.
666  **
667  *b Returns:
668  **
669  ** 0 on success, -1 on failure
670  */
671  int set_careful_interpolation_threshold(float threshold);
672 
673  /*l
674  *b Returns:
675  **
676  ** most recent setting of the careful interpolation threshold;
677  ** see set_careful_interpolation_threshold()
678  */
679  float get_careful_interpolation_threshold();
680 
681  /*l
682  *b Description:
683  **
684  ** Sets whether the motion data of the character is interpolated.
685  ** Interpolation is disabled by default for better performance. For
686  ** applications achieving high frame rates, smoother motion may be
687  ** achieved by turning interpolation on.
688  **
689  *b Arguments:
690  **
691  *a flag - 0 by default
692  **
693  *b Returns:
694  **
695  ** 0 on success, -1 on failure
696  */
697  int set_motion_interpolation_flag(int flag);
698 
699  /*l
700  *b Returns:
701  **
702  ** most recent setting of the motion interpolation flag; see
703  ** set_motion_interpolation_flag()
704  */
705  int get_motion_interpolation_flag();
706 
707  /*l
708  *b Description:
709  **
710  ** Sets the scale of the character on each of the three major axes.
711  **
712  *b Arguments:
713  **
714  *a scale_x, scale_y, scale_z - the factor by which to scale along
715  *a the given axis
716  **
717  *b Returns:
718  **
719  ** 0 on success, -1 on failure
720  */
721  int set_scale(float scale_x, float scale_y, float scale_z);
722 
723  /*l
724  *b Description:
725  **
726  ** Returns the scale of the character.
727  **
728  *b Arguments:
729  **
730  *a sx, sy, sz - scale of the character along each axis
731  **
732  ** Pass NULL for any values that are not needed.
733  **
734  *b Returns:
735  **
736  ** 0 on success, -1 on failure
737  */
738  int get_scale(float* scale_x, float* scale_y, float* scale_z);
739 
740  /*l
741  *b Description:
742  **
743  ** Sets the parent of this character to be the passed character.
744  ** This means that the coordinate system of this character will be
745  ** local to the parent character rather than the world coordinate
746  ** system.
747  **
748  *b Arguments:
749  **
750  *a parent_name - character to which this character should
751  *a be attached; pass NULL to have no parent
752  *a and be attached to the world
753  *a parent_link_name - name of the link or connection point to which this character's
754  *a position link should attach; pass "" to attach
755  *a to the parent's position link
756  **
757  *b Returns:
758  **
759  ** 0 on success, -1 on failure
760  **
761  *b Available as Decision Bead/Event
762  */
763  int set_parent(const char* parent_name, const char* parent_link_name = "");
764 
765  /*l
766  *b Description:
767  **
768  ** Gets the parent of this character.
769  **
770  *b Returns:
771  **
772  ** pointer to type diguyCharacter; NULL if no parent
773  **
774  *b Available as Decision Bead/Event
775  */
776  diguyCharacter* get_parent();
777 
778  /*l
779  *b Description:
780  **
781  ** Gets the link name that the character is parented to, if any.
782  **
783  *b Returns:
784  **
785  ** name of link, NULL if no parent
786  */
787  const char* get_parent_link_name();
788 
789  /*l
790  *b Description:
791  **
792  ** Detaches a character from its parent and reattaches it to the
793  ** world. This is equivalent to diguyCharacter::set_parent(NULL).
794  **
795  *b Returns:
796  **
797  ** 0 on success, -1 on failure
798  **
799  *b Available as Decision Bead/Event
800  */
801  int unset_parent();
802 
803  /*l
804  *b Description:
805  **
806  ** Gets the number of children the character has.
807  */
808  int get_num_children();
809 
810  /*l
811  *b Description:
812  **
813  ** This function returns a pointer to the nth child of the character.
814  **
815  *b Returns:
816  **
817  ** pointer of type diguyCharacter; NULL if no
818  ** child at the specified index
819  **
820  *b Arguments:
821  **
822  *a index - index of the child; indices start at 0
823  */
824  diguyCharacter* get_child_at_index(int index);
825 
826  /*l
827  *b Description:
828  **
829  ** Gets if a character is a static object, by default any blitzed .
830  ** in props are.
831  **
832  *b Returns:
833  **
834  ** 1 if true, 0 if false
835  */
836  int get_is_scene_object();
837 
838  /*l
839  *b Description:
840  **
841  ** Sets if a character is a static object. By default any blitzed
842  ** in props are.
843  **
844  *b Arguments:
845  **
846  *a is_scene_object - pass 1 to make the object a scene object,
847  *a 0 to not
848  **
849  *b Returns:
850  **
851  ** 0 on success, -1 on failure
852  */
853  int set_is_scene_object(int is_scene_object);
854 
855  /*l
856  *b Description:
857  **
858  ** Gets the bounding radius currently used for this character
859  ** for purposes of culling it from the draw operation.
860  **
861  *b Returns:
862  **
863  ** The current draw-culling bounding radius for the character, in
864  ** meters.
865  */
866  float get_bounding_radius();
867 
868  /*l
869  *b Description:
870  **
871  ** Gets the default draw-culling bounding radius for this
872  ** character, as specified in its actor cfg file. See
873  ** actor_vehicle.cfg for an example.
874  **
875  *b Returns:
876  **
877  ** The default draw-culling bounding radius for the character.
878  */
879  float get_default_bounding_radius();
880 
881  /*l
882  *b Description:
883  **
884  ** Sets the current draw-culling bounding radius to be used for
885  ** this character.
886  */
887  void set_bounding_radius(float f);
888 
889  /*l
890  *b Description:
891  **
892  ** This function returns the number of seconds before the blend
893  ** into the next motion begins. If the character is already
894  ** in a blend between motions the function returns 0.
895  **
896  ** Note that this function is of limited practical use; in most
897  ** cases get_time_to_reach_desired_action() returns
898  ** information that is more useful.
899  **
900  *b Returns:
901  **
902  ** time to next blend, in seconds
903  **
904  *b Mode Restrictions:
905  **
906  *- - This function can only be called in free action mode.
907  */
908  float get_time_to_transition();
909 
910  /*l
911  *b Returns:
912  **
913  ** the action mode of the character
914  */
915  diguyCharacterMode get_action_mode();
916 
917  /*l
918  *b Returns:
919  **
920  ** the position mode of the character
921  */
922  diguyCharacterMode get_position_mode();
923 
924  /*l
925  *b Description:
926  **
927  ** This function speeds up or slows down the character. Setting
928  ** this value greater than 1 will cause character actions to
929  ** be played back at a slower pace, setting to less that 1 will
930  ** cause character actions to be played at a faster pace.
931  **
932  ** This will override other factors that may scale the time
933  ** scale factor of a character. (For example, smaller scale
934  ** characters will generally move faster.)
935  **
936  ** Call unset_t_scale_factor() to allow other factors such
937  ** as scale or desired speed to determine the time scale factor.
938  **
939  *b Mode Restrictions:
940  **
941  *- - This function can only be called in free action mode.
942  **
943  *b Arguments:
944  **
945  *a t_scale_factor - time scale factor
946  **
947  *b Returns:
948  **
949  ** 0 on success, -1 on failure
950  */
951  int set_t_scale_factor(float t_scale_factor);
952 
953  /*l
954  *b Description:
955  **
956  ** This function removes the manual setting of the time
957  ** scale factor as set by set_t_scale_factor().
958  **
959  *b Mode Restrictions:
960  **
961  *- - This function can only be called in free action mode.
962  **
963  *b Returns:
964  **
965  ** 0 on success, -1 on failure
966  */
967  int unset_t_scale_factor();
968 
969  /*l
970  *b Description:
971  **
972  ** This function determines whether this character is within the
973  ** specified distance of another.
974  **
975  *b Arguments:
976  **
977  *a character - character to be checked
978  *a distance - distance to character in meters
979  **
980  *b Returns:
981  **
982  ** 1 if within distance; 0 if not
983  */
984  int is_within_distance_n_of_character(const char* character_name,
985  float distance);
986 
987  /*l
988  *b Description:
989  **
990  ** This function determines whether this character is within the
991  ** specified distance of any members of the specified group.
992  **
993  *b Arguments:
994  **
995  *a group_name - name of group to be checked
996  *a distance - distance in meters
997  **
998  *b Returns:
999  **
1000  ** 1 if member of group is within distance; 0 if not
1001  */
1002  int is_within_distance_n_of_member_of_group(const char* group_name,
1003  float distance);
1004 
1005  /*l
1006  *b Description:
1007  **
1008  ** This function determines whether a character is a member of
1009  ** a particular group.
1010  **
1011  ** Also see diguyCharacterGroup::is_member().
1012  **
1013  *b Arguments:
1014  **
1015  *a group_name - name of group to be checked
1016  **
1017  *b Returns:
1018  **
1019  ** 1 if character is in group, 0 if not
1020  */
1021  int is_group_member(const char* group_name);
1022 
1023  /*l
1024  *b Description:
1025  **
1026  ** This function returns the number of groups that a character is a
1027  ** member of.
1028  **
1029  ** Also see diguyCharacterGroup::is_member().
1030  */
1031  int get_num_group_memberships();
1032 
1033  /*l
1034  *b Description:
1035  **
1036  ** This function returns a pointer to the nth group that this
1037  ** character is a member of.
1038  **
1039  ** Also see diguyCharacterGroup::is_member().
1040  **
1041  *b Returns:
1042  **
1043  ** pointer of type diguyCharacterGroup; NULL if no
1044  ** group at the specified index
1045  **
1046  *b Arguments:
1047  **
1048  *a index - index of the group; indices start at 0
1049  */
1050  diguyCharacterGroup* get_group_membership_at_index(int index);
1051 
1052  /*l
1053  *b Description:
1054  **
1055  ** This function will check all characters in the scenario and return
1056  ** the nearest character that is both alive and enabled. An optional
1057  ** argument specifies whether to skip characters that are invisible
1058  ** to the caller because a scene object is in the way. Checking
1059  ** visibility is only an option if an octtree is generated from scene
1060  ** objects. Typically only DI-Guy Scenario does this.
1061  **
1062  *b Arguments:
1063  **
1064  *a check_visibility - whether to check that characters are
1065  *a visible to calling character; pass 1
1066  *a to check, 0 to not check
1067  *a xy_distance - whether to include the z component
1068  *a in distance calculations; pass 1 to
1069  *a check only XY distance, 0 to check
1070  *a XYZ distance
1071  **
1072  *b Returns:
1073  **
1074  ** pointer of type diguyCharacter; may be NULL
1075  */
1076  diguyCharacter* get_nearest_active_character(int check_visibility,
1077  int xy_distance = 0,
1078  float max_distance_to_check = 100000);
1079 
1080  /*l
1081  *b Description:
1082  **
1083  ** This function will check all characters in a group and return the
1084  ** nearest character that is both alive and enabled. An optional
1085  ** argument specifies whether to skip characters that are invisible
1086  ** to the caller because a scene object is in the way. Checking
1087  ** visibility is only an option if an octtree is generated from scene
1088  ** objects. Typically only DI-Guy Scenario does this.
1089  **
1090  *b Arguments:
1091  **
1092  *a group_name - name of group to check
1093  *a check_visibility - whether to check that characters are
1094  *a visible to calling character; pass 1
1095  *a to check, 0 to not check
1096  *a xy_distance - whether to include the z component
1097  *a in distance calculations; pass 1 to
1098  *a check only XY distance, 0 to check
1099  *a XYZ distance
1100  **
1101  *b Returns:
1102  **
1103  ** pointer of type diguyCharacter; may be NULL
1104  */
1105  diguyCharacter* get_nearest_active_character_in_group(const char* group_name,
1106  int check_visibility = 1,
1107  int xy_distance = 0,
1108  float max_distance_to_check = 100000);
1109 
1110  /*l
1111  *b Description:
1112  **
1113  ** This function will check all characters in the scenario and return
1114  ** a random character within max_distance that is both alive and
1115  ** enabled. An optional argument specifies whether to skip characters
1116  ** that are invisible to the caller because a scene object is in the
1117  ** way. Checking visibility is only an option if an octtree is
1118  ** generated from scene objects. Typically only DI-Guy Scenario does
1119  ** this.
1120  **
1121  *b Arguments:
1122  **
1123  *a check_visibility - whether to check that characters are
1124  *a visible to calling character; pass 1
1125  *a to check, 0 to not check
1126  *a max_distance - how far away the search cut off should be pass
1127  *a in -1.0f to use all characters
1128  *a xy_distance - whether to include the z component
1129  *a in distance calculations; pass 1 to
1130  *a check only XY distance, 0 to check
1131  *a XYZ distance
1132  **
1133  *b Returns:
1134  **
1135  ** pointer of type diguyCharacter; may be NULL
1136  */
1137  diguyCharacter* get_random_active_character(float max_distance = 10.0f,
1138  int check_visibility = 1,
1139  int xy_distance = 0);
1140 
1141  /*l
1142  *b Description:
1143  **
1144  ** This function will check all characters in a group and return a
1145  ** random character within max_distance that is both alive and
1146  ** enabled. An optional argument specifies whether to skip characters
1147  ** that are invisible to the caller because a scene object is in the
1148  ** way. Checking visibility is only an option if an octtree is
1149  ** generated from scene objects. Typically only DI-Guy Scenario does
1150  ** this.
1151  **
1152  *b Arguments:
1153  **
1154  *a group_name - name of group to check
1155  *a max_distance - how far away the search cut off should be, pass
1156  *a in -1.0f to use all characters
1157  *a check_visibility - whether to check that characters are
1158  *a visible to calling character; pass 1
1159  *a to check, 0 to not check
1160  *a xy_distance - whether to include the z component
1161  *a in distance calculations; pass 1 to
1162  *a check only XY distance, 0 to check
1163  *a XYZ distance
1164  **
1165  *b Returns:
1166  **
1167  ** pointer of type diguyCharacter; may be NULL
1168  */
1169  diguyCharacter* get_random_active_character_in_group(const char* group_name,
1170  float max_distance = 10,
1171  int check_visibility = 1,
1172  int xy_distance = 0);
1173 
1174  /*l
1175  *b Description:
1176  **
1177  ** This function returns the 3D distance from this character to the
1178  ** specified character, in meters. The distance is calculated from
1179  ** the characters' idealized positions.
1180  */
1181  float get_distance_to_character(diguyCharacter* character);
1182 
1183  /*l
1184  *b Description:
1185  **
1186  ** This function returns the 2D distance in X and Y coordinates only
1187  ** from this character to the specified character, in meters. The
1188  ** distance is calculated from the characters' idealized positions.
1189  */
1190  float get_distance_xy_to_character(diguyCharacter* character);
1191 
1192  /*l
1193  *b Description:
1194  **
1195  ** This function returns the 3D distance from this character to the
1196  ** specified impact, in meters. The distance is calculated from the
1197  ** characters' idealized positions.
1198  */
1199  float get_distance_to_impact(diguyImpact* impact);
1200 
1201  /*l
1202  *b Description:
1203  **
1204  ** Each character has a "random factor" between 0 and 1. This value
1205  ** is persistent with the character; i.e., the random factor will
1206  ** stay constant for the entire lifetime of the character.
1207  **
1208  ** This random factor can be used to add some variability between
1209  ** different characters.
1210  **
1211  ** Though each character has a random factor that has a very good
1212  ** chance of being different from all other characters' in the
1213  ** scenario, this is not guaranteed and so should not be used as a
1214  ** unique identifier.
1215  **
1216  ** An example of use: Instead of all characters beginning an action
1217  ** or behavior at the same time, have each one begin (random_factor *
1218  ** 2.0) seconds from the current time. This will result in more
1219  ** natural looking behavior as characters one by one begin the new
1220  ** behavior in the next two seconds, rather than all beginning at
1221  ** once.
1222  **
1223  *b Returns:
1224  **
1225  ** the character's random factor, a value between 0 and 1
1226  */
1227  float get_random_factor();
1228 
1229 
1230 /*****************************************************************************/
1235  /*l
1236  *b Description:
1237  **
1238  ** This function draws this character in immediate mode graphics
1239  ** environments (see below). This is the equivalent of calling
1240  ** draw_pass1() immediately followed by draw_pass2().
1241  **
1242  *b Returns:
1243  **
1244  ** 0 on success, -1 on failure
1245  **
1246  *i OpenGL Version:
1247  **
1248  ** This function immediately draws this character. Either this
1249  ** function or draw_pass1() and draw_pass2() should be called once per
1250  ** frame.
1251  */
1252  int draw();
1253 
1254  /*l
1255  *b Description:
1256  **
1257  ** This function, along with draw_pass2(), allows the drawing of
1258  ** opaque and transparent polygons to be separated. This function
1259  ** draws all opaque polygons of this character.
1260  **
1261  *b Returns:
1262  **
1263  ** 0 on success, -1 on failure
1264  **
1265  *i OpenGL Version:
1266  **
1267  ** This function immediately draws the opaque character parts. Either
1268  ** this function or draw() should be called once per frame.
1269  */
1270  int draw_pass1();
1271 
1272  /*l
1273  *b Description:
1274  **
1275  ** Same as draw_pass1(), but draws transparent character parts.
1276  */
1277  int draw_pass2();
1278 
1279 #ifdef CPLUSPLUS_ONLY
1280 
1281  /*l
1282  *b Returns:
1283  **
1284  ** A pointer to the character's graphics.
1285  **
1286  *i Vega Prime Version:
1287  **
1288  ** The return pointer may be cast to point to a vpDiguyCharacter,
1289  ** which is derived from vpObject.
1290  **
1291  *i OpenGL Version:
1292  **
1293  ** This function returns NULL.
1294  **
1295  *i DI-Guy Graphics API:
1296  **
1297  ** This function returns the pointer set from the most recent
1298  ** set_graphics_ptr() call.
1299  */
1300  void* get_graphics_ptr();
1301 
1302  /*l
1303  *b Description:
1304  **
1305  ** Sets a graphics environment-specific pointer to graphics data.
1306  ** The pointer can be retrieved using get_graphics_ptr().
1307  **
1308  *b Arguments:
1309  **
1310  *a graphics_ptr - pointer to graphics data
1311  **
1312  *b Returns:
1313  **
1314  ** 0 on success, -1 on failure
1315  **
1316  *i OpenGL Version:
1317  **
1318  *b This function should not be called for these environments.
1319  **
1320  *i DI-Guy Graphics API Version:
1321  **
1322  ** This function allows graphics environment-specific data to be
1323  ** stored for later retrieval by get_graphics_ptr(). DI-Guy does
1324  ** not directly use the pointer, beyond returning it using the
1325  ** get_graphics_ptr() function.
1326  */
1327  int set_graphics_ptr(void* graphics_ptr);
1328 
1329  /*l
1330  *b Description:
1331  **
1332  ** This function sets a generic node pointer that can later be
1333  ** retrieved by the get_graphics_api_node_ptr() call. The pointer is
1334  ** otherwise not used.
1335  **
1336  *i Callback Info:
1337  **
1338  ** This function can be safely be called in the
1339  ** CALLBACK_ID_SET_GRAPHICS_API_NODE_PTR callback.
1340  **
1341  *b Arguments:
1342  **
1343  *a node_ptr - generic void* pointer
1344  */
1345  void set_graphics_api_node_ptr(void* node_ptr);
1346 
1347  /*l
1348  *b Returns:
1349  **
1350  ** pointer set by most recent call to set_graphics_api_node_ptr
1351  */
1352  void* get_graphics_api_node_ptr();
1353 
1354  /*l
1355  *b Description:
1356  **
1357  ** This function stores a pointer to user data.
1358  **
1359  *b Arguments:
1360  **
1361  *a user_data - pointer for user's own use; DI-Guy will
1362  *a do nothing to the contents of this pointer
1363  *a beyond passing it back when requested
1364  *a by get_user_data()
1365  **
1366  *b Returns:
1367  **
1368  ** 0 on success, -1 on failure
1369  */
1370  int set_user_data(void* user_data);
1371 
1372  /*l
1373  *b Returns:
1374  **
1375  ** The user data pointer set by set_user_data()
1376  */
1377  void* get_user_data();
1378 
1379 #endif
1380 
1381 /*****************************************************************************/
1391  /*l
1392  *b Description:
1393  **
1394  ** This function sets the desired action of the character.
1395  **
1396  ** This function will put the character into free action mode. If
1397  ** the character was in path action mode, actions will no longer be
1398  ** set by action beads on the path.
1399  **
1400  ** If the character is in path position mode and 1 is passed for
1401  ** retain_path_shape, the character will stay in path position mode.
1402  ** If 0 is passed for retain_path_shape, the character will be put
1403  ** into free position mode.
1404  **
1405  ** If the character is in free position mode the retain_path_shape
1406  ** argument will have no effect.
1407  **
1408  ** If this call is interrupting a character in path action mode
1409  ** and path position mode, the character will not be able to resume
1410  ** the interrupted path unless retain_path_shape is set to 1.
1411  ** See resume_interrupted_path().
1412  **
1413  ** This function will have no effect on a dead character (see
1414  ** die_now() and get_dead()).
1415  **
1416  *b Mode Effects:
1417  **
1418  *- - This function will put the character into free action mode.
1419  *- - This function may change the position mode; see Description.
1420  **
1421  *b Arguments:
1422  **
1423  *a action_name - name of the desired action to be performed by
1424  *a the character
1425  *a speed - the speed at which the character should travel
1426  *a while performing the action; pass
1427  *a DIGUY_DEFAULT_FLOAT for the optimal speed to
1428  *a be used
1429  *a retain_path_shape - pass 1 to remain in path position mode; pass
1430  *a 0 to change to free position mode
1431  **
1432  *b Returns:
1433  **
1434  ** 0 on success, -1 on failure
1435  */
1436  int set_desired_action(const char* action_name,
1437  float speed = DIGUY_DEFAULT_FLOAT,
1438  int retain_path_shape = 0);
1439 
1444  const char* get_desired_action();
1445 
1447  int get_desired_action_index();
1448 
1450  const char* get_current_action();
1451 
1453  int get_current_action_index();
1454 
1456  diguyMotionDirection get_desired_action_direction();
1457 
1459  diguyMotionDirection get_current_action_direction();
1460 
1461  /*l
1462  *b Description:
1463  **
1464  ** This function returns the transition state of the action
1465  ** of a character. When commanding an action, DI-Guy may
1466  ** transition the character through one or more intermediate
1467  ** actions to reach the final action. For example, a character
1468  ** with the action "walk" that is commanded to "prone" would
1469  ** transition through the intermediate action "stand".
1470  **
1471  *b Returns:
1472  **
1473  ** 1 if the character is transitioning between actions
1474  ** 0 otherwise
1475  */
1476  int get_is_in_action_transition();
1477 
1478  /*l
1479  *b Description:
1480  **
1481  ** This function forces the current action of the character to be the
1482  ** action identified by action_name.
1483  **
1484  ** See set_desired_action() for a discussion of the effects on
1485  ** position mode.
1486  **
1487  ** This function will have no effect on a dead character (see
1488  ** die_now() and get_dead()).
1489  **
1490  ** By passing a value greater than 0 for t_offset_into_new_action,
1491  ** the character can be made to begin the action partway in. This is
1492  ** useful when forcing actions for a lot of characters at the same
1493  ** time; without the offset, the characters would move in lockstep.
1494  **
1495  ** The most recent forced action, the time at which it was forced,
1496  ** and any time offset can be queried using the functions
1497  ** get_most_recent_forced_action(),
1498  ** get_most_recent_forced_action_t(), and
1499  ** get_most_recent_forced_action_t_offset().
1500  **
1501  *b Mode Effects:
1502  **
1503  *- - This function will put the character into free action mode.
1504  *- - This function may change the position mode; see Description.
1505  **
1506  *b Arguments:
1507  **
1508  *a action_name - name of the action to be performed by
1509  *a the character
1510  *a speed - the speed at which the character should
1511  *a travel while performing the action; pass
1512  *a DIGUY_DEFAULT_FLOAT for the optimal speed
1513  *a to be used
1514  *a include_transition_arc - flag for whether the transition
1515  *a motion from the current action to
1516  *a the new action is included;
1517  *a pass 1 for best chance of good looking
1518  *a transition;
1519  *a pass 0 for fastest response
1520  *a max_rampdown_interval - max amount of time spent trying to
1521  *a smooth over any motion seams; set
1522  *a to 0.5 for a smooth transition, set
1523  *a to 0 for a potentially rough transition
1524  *a retain_path_shape - pass 1 to remain in path position mode;
1525  *a pass 0 to change to free position mode
1526  *a t_offset_into_new_action - how much to shift time forward into
1527  *a new action; must be >= 0; see comment
1528  *a above for more info
1529  **
1530  *b Returns:
1531  **
1532  ** 0 on success, -1 on failure
1533  */
1534  int force_action(const char* action_name,
1535  float speed = DIGUY_DEFAULT_FLOAT,
1536  int include_transition_arc = 1,
1537  float max_rampdown_interval = 0.5f,
1538  int retain_path_shape = 0,
1539  float t_offset_into_new_action = 0.0f);
1540 
1541  /*l
1542  *b Description:
1543  **
1544  ** This function is similar to force_action(), but allows the
1545  ** specification of how long the interruption should last.
1546  **
1547  ** This function will have no effect on a dead character (see
1548  ** die_now() and get_dead()).
1549  **
1550  *b Mode Restrictions:
1551  **
1552  *- - This function can only be called if the character is in
1553  *- path action mode *and* path position mode.
1554  **
1555  *b Mode Effects:
1556  **
1557  *- - This function will put the character into free action mode.
1558  *- - This function will not change the position mode.
1559  **
1560  *b Arguments:
1561  **
1562  *a duration - how long the action should be performed before
1563  *a an automatic resume_interrupted_path() call is
1564  *a made
1565  **
1566  *b Returns:
1567  **
1568  ** 0 on success, -1 on failure
1569  */
1570  int force_action_with_duration(const char* action_name,
1571  float duration,
1572  int include_transition_arc = 1,
1573  float max_rampdown_interval = 0.5f);
1574 
1575  /*l
1576  *b Description:
1577  **
1578  ** This function forces the current action of the character to be the
1579  ** action identified by action_name, to be executed along the path
1580  ** shape specified by path_shape_name.
1581  **
1582  ** This function will have no effect on a dead character (see
1583  ** die_now() and get_dead()).
1584  **
1585  *b Mode Effects:
1586  **
1587  *- - This function will put the character into free action mode.
1588  *- - This function will put the character into path position mode.
1589  **
1590  *b Arguments:
1591  **
1592  *a action_name - name of the action to be performed by
1593  *a the character
1594  *a path_shape_name - name of the path shape on which action
1595  *a should be performed
1596  *a waypoint_name - name of waypoint on path shape to begin at;
1597  *a default of NULL will start at first waypoint
1598  *a distance_into_path - distance into path shape to start at, if
1599  *a waypoint_name isn't specified
1600  **
1601  *b Returns:
1602  **
1603  ** 0 on success, -1 on failure
1604  */
1605  int force_action_and_path_shape(const char* action_name,
1606  const char* path_shape_name,
1607  const char* waypoint_name = NULL,
1608  float distance_into_path = 0.0f);
1609 
1610  /*l
1611  *b Description:
1612  **
1613  ** This function returns the most recently forced action as set by
1614  ** by force_action(), force_action_with_duration(), or
1615  ** force_action_and_path_shape().
1616  **
1617  *b Returns:
1618  **
1619  ** the name of the most recent forced action, or NULL if no action
1620  ** has been forced
1621  */
1622  const char* get_most_recent_forced_action();
1623 
1624  /*l
1625  *b Description:
1626  **
1627  ** This function returns the time at which the most recently forced
1628  ** action occurred.
1629  **
1630  *b Returns:
1631  **
1632  ** time at which force action occurred; -1.0 if no action has been
1633  ** forced
1634  */
1635  float get_most_recent_forced_action_t();
1636 
1637  /*l
1638  *b Description:
1639  **
1640  ** This function returns the action time offset of the most recently
1641  ** forced action. This is typically value of the
1642  ** t_offset_into_new_action argument of the force_action() call.
1643  **
1644  *b Returns:
1645  **
1646  ** time at which force action occurred; -1.0 if no action has been
1647  ** forced
1648  */
1649  float get_most_recent_forced_action_t_offset();
1650 
1651 
1652  /*l
1653  *b Description:
1654  **
1655  ** This function adds a "pending action" to the character. This is
1656  ** essentially a delayed set_desired_action() call. The desired
1657  ** action will be set at the passed scenario t, just as if
1658  ** set_desired_action() is called at that time.
1659  **
1660  ** *Note:* Any call to set_desired_action() or force_action(), or
1661  ** their related variants, will clear any pending actions.
1662  **
1663  *b Arguments:
1664  **
1665  *a action - name of pending desired action
1666  *a scenario_t - time at which to set desired action
1667  *a remove_existing_pending_actions - pass 1 to remove any previously
1668  *a added pending actions, 0 to leave them
1669  *a speed - as passed to set_desired_action()
1670  *a retain_path_shape - as passed to set_desired_action()
1671  **
1672  *b Returns:
1673  **
1674  ** 0 on success, -1 on failure
1675  */
1676  int add_pending_desired_action(const char* action,
1677  float scenario_t,
1678  int remove_existing_pending_actions = 0,
1679  float speed = DIGUY_DEFAULT_FLOAT,
1680  int retain_path_shape = 1);
1681 
1682  /*l
1683  *b Description:
1684  **
1685  ** Similar to add_pending_desired_action(), but will do a
1686  ** force_action() at the passed scenario_t instead of a
1687  ** set_desired_action().
1688  **
1689  ** *Note:* Any call to set_desired_action() or force_action(), or
1690  ** their related variants, will clear any pending actions.
1691  **
1692  *b Returns:
1693  **
1694  ** 0 on success, -1 on failure
1695  */
1696  int add_pending_force_action(const char* action,
1697  float scenario_t,
1698  int remove_existing_pending_actions = 0,
1699  float speed = DIGUY_DEFAULT_FLOAT,
1700  int include_transition_arc = 1,
1701  float max_rampdown_interval = 0.5f,
1702  int retain_path_shape = 1,
1703  float first_arc_time_shift = 0.0f);
1704 
1705  /*l
1706  *b Returns:
1707  **
1708  ** 1 if the passed action name is an action available to this
1709  ** character, 0 if not
1710  */
1711  int is_valid_action(const char* action);
1712 
1713  /*l
1714  *b Description:
1715  **
1716  ** This function sends this character a signal to die as soon as
1717  ** possible. The character will transition to a dead action.
1718  **
1719  ** The following side-effects will also happen:
1720  *>
1721  *- - all aiming is ended
1722  *- - all gazing is ended
1723  *- - all pointing is ended
1724  *- - head nodding and shaking are stopped
1725  *- - all gestures are aborted
1726  *- - all sounds originated by the character are stopped
1727  *- - Destroyed appearance might be switched to.
1728  *<
1729  ** Many function calls will have no effect on dead characters;
1730  ** see individual function descriptions for limitations.
1731  **
1732  ** Use the get_dead() call to retrieve the dead state of a
1733  ** character.
1734  **
1735  *b Mode Effects:
1736  **
1737  *- - This function will put the character into free action mode.
1738  *- - This function will not change the position mode.
1739  **
1740  *b Returns:
1741  **
1742  ** 0 on success, -1 on failure
1743  **
1744  *b Available as Decision Bead/Event
1745  */
1746  int die_now(const char* preferred_dead_action_name = "(default)");
1747 
1748  /*l
1749  *b Description:
1750  **
1751  ** This function revives a dead character. The limitations of dead
1752  ** characters will be lifted from the revived character; e.g., the
1753  ** character will be able to gaze, execute gestures, etc.
1754  **
1755  *b Returns:
1756  **
1757  ** 0 on success, -1 on failure
1758  **
1759  *b Available as Decision Bead/Event
1760  */
1761  int revive_now(const char* preferred_revive_action_name = "(default)");
1762 
1763  /*l
1764  *b Description:
1765  **
1766  ** This function returns whether or not the character is dead.
1767  ** Characters can be killed by die_now() function calls, as well as
1768  ** by being hit by weapon fire.
1769  **
1770  *b Returns:
1771  **
1772  ** 1 if character is dead (die_now() function has been called),
1773  ** 0 if not.
1774  */
1775  int get_dead();
1776 
1777  /*l
1778  *b Description:
1779  **
1780  ** Sets the speed the character should attempt to move, in meters per
1781  ** second.
1782  **
1783  ** This setting takes effect immediately. To set a desired action
1784  ** and a desired speed at the same time, use the speed argument of
1785  ** the set_desired_action() call.
1786  **
1787  ** This desired speed setting can be undone in a couple of ways:
1788  **
1789  *- 1. by calling set_speed() with an argument of
1790  *- DIGUY_DEFAULT_FLOAT, or
1791  *- 2. by calling set_desired_action(), or
1792  *- 3. by calling one of the force_action() functions
1793  **
1794  *b Arguments:
1795  **
1796  *a speed - desired speed in meters per second
1797  **
1798  *b Returns:
1799  **
1800  ** 0 on success, -1 on failure
1801  */
1802  int set_speed(float speed);
1803 
1804  /*l
1805  *b Returns:
1806  **
1807  ** the approximate speed at which the character is moving, in meters
1808  ** per second
1809  */
1810  float get_speed();
1811 
1812  /*l
1813  *b Returns:
1814  **
1815  ** The desired speed of the character, in meters per second. Calls to
1816  ** set_speed(), set_desired_action(), or force_action() assign
1817  ** the character a desired speed, to which it transitions over some
1818  ** amount of time. If the speed-setting was instantaneous, the current
1819  ** speed will be returned.
1820  */
1821  float get_desired_speed();
1822 
1823 /*****************************************************************************/
1840  /*l
1841  *b Description:
1842  **
1843  ** Sets a generic parameter that can be mapped to a blend tree driver.
1844  ** Useful for creating animations that can play back at different vertical angles.
1845  */
1846  int set_animation_target_el(float elevation, float ramp_time = .25f);
1847 
1849  float get_animation_target_el();
1850 
1851  /*l
1852  *b Description:
1853  **
1854  ** Sets a generic parameter that can be mapped to a blend tree driver.
1855  ** Useful for creating animations that can play back at different horizontal angles.
1856  */
1857  int set_animation_target_az(float azimuth, float ramp_time = .25f);
1858 
1860  float get_animation_target_az();
1861 
1862  /*l
1863  *b Description:
1864  **
1865  ** Sets a generic parameter in world space that can be mapped to a blend tree driver.
1866  ** The locomotion actions are driven by these values allowing one action to go
1867  ** many different direction.
1868  ** Internally this is mapped to local space.
1869  **
1870  ** In practical terms, this means that a character with the appropriate animation blend
1871  ** tree can be made to move at an arbitrary speed in an arbitrary direction, provided
1872  ** that the blend tree supports these motions. One example would be a soldier who can
1873  ** "strafe" from side to side while pointing his weapon in a certain direction. Another
1874  ** example would be a car that can travel forwards or backwards at a speed within a
1875  ** continuous range.
1876  **
1877  ** Users can see a demonstration of this feature in the character view by selecting an
1878  ** appropriate character type (e.g. vehicle_09), appearance (e.g. taxi_2013), and
1879  ** action ("movement"). The exercise blend tree widget will allow adjustments.
1880  **
1881  */
1882  void set_animation_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = .25f);
1883 
1885  void get_animation_velocity(float *vel_x, float *vel_y, float *vel_z);
1886 
1887  /*l
1888  *b Description:
1889  **
1890  ** Sets a generic parameter in local space that can be mapped to a blend tree driver.
1891  ** The locomotion actions are driven by these values allowing one action to go
1892  ** many different directions.
1893  **
1894  ** Similar to set_animation_velocity() in terms of overall practical details.
1895  ** Note that the local velocity setting will affect the character's world velocity.
1896  */
1897  void set_animation_local_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = .25f);
1898 
1900  void get_animation_local_velocity(float *vel_x, float *vel_y, float *vel_z);
1901 
1902  /*l
1903  *b Description:
1904  **
1905  ** Sets a generic parameter in that can be mapped to a blend tree driver.
1906  ** The locomotion actions are driven by these values allowing one action to turn
1907  */
1908  void set_animation_angular_velocity(float vel_rz, float ramp_time = .25f);
1909 
1911  float get_animation_angular_velocity();
1912 
1913 
1914 /*****************************************************************************/
1924  /*l
1925  *b Description:
1926  **
1927  ** Sets the position of the character relative to the origin of the
1928  ** DI-Guy global coordinate system.
1929  **
1930  ** The new settings will take effect immediately, possibly causing
1931  ** the character to "teleport" if the new values are significantly
1932  ** different than the old.
1933  **
1934  ** The DI-Guy global coordinate system is right-handed, with
1935  ** X forward, Z up, and Y to the left. Rotation directions follow
1936  ** standard right-handed coordinate system conventions:
1937  **
1938  *- - positive rotations about X cause a counter-clockwise roll
1939  *- - position rotations about Y cause a forward pitch
1940  *- - positive rotations about Z cause a yaw to the left
1941  **
1942  ** Note that if the character has an altitude function (see
1943  ** set_altitude_function()), the tz argument will effectively be
1944  ** ignored as the altitude function will override it.
1945  **
1946  ** If the magnitude of the numbers is large (say 32000 or higher),
1947  ** the function set_position_double() should be used instead.
1948  **
1949  *b Mode Effects:
1950  **
1951  *- - This function will put the character into free position mode.
1952  *- - This function will put the character into free action mode.
1953  **
1954  *b Arguments:
1955  **
1956  *a tx, ty, tz - position in meters from the origin
1957  **
1958  *b Returns:
1959  **
1960  ** 0 on success, -1 on failure
1961  */
1962  int set_position(float tx, float ty, float tz);
1963 
1964  /*l
1965  *b Description:
1966  **
1967  ** Similar to set_position(), but using double-precision rather than
1968  ** single-precision numbers. If the magnitude of the numbers is large
1969  ** (say 32000 or higher), this function should be used.
1970  **
1971  *b Mode Effects:
1972  **
1973  *- - This function will put the character into free position mode.
1974  *- - This function will put the character into free action mode.
1975  **
1976  *b Arguments:
1977  **
1978  *a tx, ty, tz - position in meters from the origin
1979  **
1980  *b Returns:
1981  **
1982  ** 0 on success, -1 on failure
1983  */
1984  int set_position_double(double tx, double ty, double tz);
1985 
1986  /*l
1987  *b Description:
1988  **
1989  ** Retrieves the position of the character in the DI-Guy
1990  ** global coordinate system.
1991  **
1992  ** See set_position() for a description of the coordinate system.
1993  **
1994  *b Arguments:
1995  **
1996  *a tx, ty, tz - position in meters from the origin
1997  **
1998  ** Pass NULL for any values that are not needed.
1999  **
2000  *b Returns:
2001  **
2002  ** 0 on success, -1 on failure
2003  */
2004  int get_position(float* tx, float* ty, float* tz);
2005 
2006  /*l
2007  *b Description:
2008  **
2009  ** Retrieves the position of the character in the DI-Guy
2010  ** global coordinate system.
2011  **
2012  ** See set_position() for a description of the coordinate system.
2013  **
2014  ** Unlike get_position(), this function returns higher-precision
2015  ** values for the position, which is important when the character is
2016  ** far from the coordinate system origin.
2017  **
2018  *b Arguments:
2019  **
2020  *a tx, ty, tz - position in meters from the origin
2021  **
2022  ** Pass NULL for any values that are not needed.
2023  **
2024  *b Returns:
2025  **
2026  ** 0 on success, -1 on failure
2027  */
2028  int get_position_double(double* tx, double* ty, double* tz);
2029 
2030  /*l
2031  *b Description:
2032  **
2033  ** Sets the position of the character relative to its parent or the
2034  ** origin of the DI-Guy global coordinate system if this
2035  ** character is not parented.
2036  **
2037  ** See set_position() for a description of the coordinate system.
2038  **
2039  ** The new settings will take effect immediately, possibly causing the
2040  ** character to "teleport" if the new values are significantly
2041  ** different than the old.
2042  **
2043  *b Mode Effects:
2044  **
2045  *- - This function will put the character into free position mode.
2046  *- - This function will put the character into free action mode.
2047  **
2048  *b Arguments:
2049  **
2050  *a tx, ty, tz - position in meters from the origin
2051  **
2052  *b Returns:
2053  **
2054  ** 0 on success, -1 on failure
2055  */
2056  int set_position_relative_to_parent(float tx, float ty, float tz);
2057 
2058  /*l
2059  *b Description:
2060  **
2061  ** Retrieves the position of the character relative to its parent, or
2062  ** relative to the origin of the DI-Guy global coordinate
2063  ** system if this character is not parented.
2064  **
2065  ** See set_position() for a description of the coordinate system.
2066  **
2067  *b Arguments:
2068  **
2069  *a tx, ty, tz - position in meters from the origin
2070  **
2071  ** Pass NULL for any values that are not needed.
2072  **
2073  *b Returns:
2074  **
2075  ** 0 on success, -1 on failure
2076  */
2077  int get_position_relative_to_parent(float* tx, float* ty, float* tz);
2078 
2079  /*l
2080  *b Description:
2081  **
2082  ** Similar to set_position_relative_to_parent(), but the position is
2083  ** either from the other character's overall position (if
2084  ** other_link_name is NULL), or the position of the other character's
2085  ** link (if other_link_name specifies a link on the other character).
2086  **
2087  ** The position that is set is relative to this character's parent.
2088  **
2089  *b Mode Effects:
2090  **
2091  *- - This function will put the character into free position mode.
2092  *- - This function will put the character into free action mode.
2093  **
2094  *b Arguments:
2095  **
2096  *a other_character_name - other character from which to read
2097  *a position
2098  *a other_link_name - optional link on other character; if
2099  *a NULL, other character's base position is
2100  *a used
2101  *a offset_x, offset_y, offset_z - offset to apply to position
2102  *a read from other character
2103  *a also_set_orientation - pass 1 to also set this character's
2104  *a orientation from the other character's
2105  *a orientation
2106  **
2107  *b Returns:
2108  **
2109  ** 0 on success, -1 on failure
2110  */
2111  int set_position_to_other_character_position(const char* other_character_name,
2112  const char* other_link_name = NULL,
2113  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2114  int also_set_orientation = 1);
2115 
2116  /*l
2117  *b Description:
2118  **
2119  ** Sets the desired position of the character. How the character
2120  ** moves toward the desired position is determined by its current
2121  ** guides; see add_guide() and create_guide().
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 tx, ty, tz - desired position in meters from the origin
2131  *a force_guide_unacquired - this optional argument will set any guides
2132  *a the character has to be unacquired
2133  *b Returns:
2134  **
2135  ** 0 on success, -1 on failure
2136  */
2137  int set_desired_position(float tx, float ty, float tz,
2138  int force_guide_unacquired = 0);
2139 
2140  int set_desired_position_double(double tx, double ty, double tz,
2141  int force_guide_unacquired = 0);
2142  /*l
2143  *b Description:
2144  **
2145  ** Like set_desired_position(), but uses the character's current
2146  ** position as the desired position.
2147  **
2148  *b Mode Effects:
2149  **
2150  *- - This function will put the character into free position mode.
2151  *- - This function will put the character into free action mode.
2152  **
2153  *b Arguments:
2154  **
2155  *a also_set_orientation - pass 1 to also set this character's
2156  *a orientation to its current orientation
2157  **
2158  *b Returns:
2159  **
2160  ** 0 on success, -1 on failure
2161  */
2162  int set_desired_position_to_current_position(int also_set_orientation = 1);
2163 
2164  /*l
2165  *b Description:
2166  **
2167  ** Like set_desired_position(), but sets the character's desired
2168  ** position to passed waypoint's position.
2169  **
2170  ** The passed waypoint can be one created by
2171  ** diguyScenario::create_waypoint, a waypoint from a character's
2172  ** diguyCharacterPath, or waypoint from a diguyPathShape.
2173  **
2174  *b Mode Effects:
2175  **
2176  *- - This function will put the character into free position mode.
2177  *- - This function will put the character into free action mode.
2178  **
2179  *b Arguments:
2180  **
2181  *a waypoint - pointer to diguyWaypoint object
2182  *a offset_x, offset_y, offset_z - offset to apply to waypoint
2183  *a position
2184  *a offset_in_world_coords - 1 if offset is to be in world
2185  *a coordinates, 0 if it is to be
2186  *a in waypoint-local coordinates
2187  **
2188  *b Returns:
2189  **
2190  ** 0 on success, -1 on failure
2191  */
2192  int set_desired_position_to_waypoint(diguyWaypoint* waypoint,
2193  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2194  int offset_in_world_coords = 0);
2195 
2196  /*l
2197  *b Description:
2198  **
2199  ** Like set_desired_position(), but finds the specified waypoint on
2200  ** the specified path and sets the character's desired position to the
2201  ** waypoint's position.
2202  **
2203  *b Mode Effects:
2204  **
2205  *- - This function will put the character into free position mode.
2206  *- - This function will put the character into free action mode.
2207  **
2208  *b Arguments:
2209  **
2210  *a path_name - name of path on which to find waypoint
2211  *a waypoint_name - name of waypoint
2212  **
2213  *b Returns:
2214  **
2215  ** 0 on success, -1 on failure
2216  */
2217  int set_desired_position_to_path_waypoint(const char* path_name,
2218  const char* waypoint_name);
2219 
2220  /*l
2221  *b Description:
2222  **
2223  ** Like set_desired_position(), but finds the specified waypoint on
2224  ** the specified path shape and sets the character's desired position
2225  ** to the waypoint's position.
2226  **
2227  *b Mode Effects:
2228  **
2229  *- - This function will put the character into free position mode.
2230  *- - This function will put the character into free action mode.
2231  **
2232  *b Arguments:
2233  **
2234  *a path_shape_name - name of path shape on which to find waypoint
2235  *a waypoint_name - name of waypoint
2236  **
2237  *b Returns:
2238  **
2239  ** 0 on success, -1 on failure
2240  */
2241  int set_desired_position_to_path_shape_waypoint(const char* path_shape_name,
2242  const char* waypoint_name);
2243 
2244  /*l
2245  *b Description:
2246  **
2247  ** Retrieves the desired position of the character.
2248  **
2249  *b Mode Restrictions:
2250  **
2251  *- - This function can only be called in free position mode.
2252  **
2253  *b Arguments:
2254  **
2255  *a tx, ty, tz - desired position in meters from the origin
2256  **
2257  ** Pass NULL for any values that are not needed.
2258  **
2259  *b Returns:
2260  **
2261  ** 0 on success, -1 on failure
2262  */
2263  int get_desired_position(float* tx, float* ty, float* tz);
2264  int get_desired_position_double(double* tx, double* ty, double* tz);
2265 
2266  /*l
2267  *b Description:
2268  **
2269  ** Retrieves the delta vector from current position to desired one.
2270  **
2271  *b Mode Restrictions:
2272  **
2273  *- - This function can only be called in free position mode.
2274  **
2275  *b Arguments:
2276  **
2277  *a tx, ty, tz - delta in meters
2278  **
2279  ** Pass NULL for any values that are not needed.
2280  **
2281  *b Returns:
2282  **
2283  ** 0 on success, -1 on failure
2284  */
2285  int get_delta_to_desired_position(float* tx, float* ty, float* tz);
2286 
2287  /*l
2288  *b Description:
2289  **
2290  ** Sets the initial position the character should move to on a call to
2291  ** diguyScenario::reset().
2292  **
2293  ** If the character has an initial path, that path, not this function
2294  ** call, will determine its initial position.
2295  **
2296  *b Arguments:
2297  **
2298  *a tx, ty, tz - initial position in meters from the origin
2299  **
2300  *b Returns:
2301  **
2302  ** 0 on success, -1 on failure
2303  */
2304  int set_initial_position(float tx, float ty, float tz);
2305 
2306  /*l
2307  *b Description:
2308  **
2309  ** Retrieves the initial position of the character.
2310  **
2311  ** If the character is in free position mode or has no initial path,
2312  ** this will be the position set by set_initial_position().
2313  **
2314  ** Otherwise this will be the position of the first waypoint of the
2315  ** initial path.
2316  **
2317  *b Arguments:
2318  **
2319  *a tx, ty, tz - initial position in meters from the origin
2320  **
2321  ** Pass NULL for any values that are not needed.
2322  **
2323  *b Returns:
2324  **
2325  ** 0 on success, -1 on failure
2326  */
2327  int get_initial_position(float* tx, float* ty, float* tz);
2328 
2329  /*l
2330  *b Description:
2331  **
2332  ** Sets the orientation of the character relative to the origin of the
2333  ** DI-Guy global coordinate system.
2334  **
2335  ** See set_position() for a description of the coordinate system.
2336  **
2337  ** The new settings will take effect immediately, possibly causing the
2338  ** character to "teleport" if the new values are significantly
2339  ** different than the old.
2340  **
2341  ** Note that if the character has an up vector type of 'z' or 'n' or even
2342  ** sometimes 'd' (as set by the set_up_vector_type() call) the rx and ry
2343  ** values will not have any effect. To be able to set rx and ry
2344  ** values, set the up vector type of the character to 'c', for "custom".
2345  **
2346  *b Mode Effects:
2347  **
2348  *- - This function will put the character into free position mode.
2349  *- - This function will put the character into free action mode.
2350  **
2351  *b Arguments:
2352  **
2353  *a rz, rx, ry - orientations in degrees
2354  **
2355  *b Returns:
2356  **
2357  ** 0 on success, -1 on failure
2358  */
2359  int set_orientation(float rz, float rx, float ry);
2360 
2361  /*l
2362  *b Description:
2363  **
2364  ** Retrieves the orientation of the character in the DI-Guy
2365  ** global coordinate system. See set_position() for a description of
2366  ** the coordinate system.
2367  **
2368  *i Note:
2369  **
2370  ** For vehicles, you may want to use the function
2371  ** get_vehicle_body_orientation(). See that function for more
2372  ** information.
2373  **
2374  *b Arguments:
2375  **
2376  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2377  *a positive X axis
2378  **
2379  ** Pass NULL for any values that are not needed.
2380  **
2381  *b Returns:
2382  **
2383  ** 0 on success, -1 on failure
2384  */
2385  int get_orientation(float* rz, float* rx, float* ry);
2386 
2387  /*l
2388  *b Description:
2389  **
2390  ** Sets the orientation of the character relative to its parent or the
2391  ** origin of the DI-Guy global coordinate system if this
2392  ** character is not parented.
2393  **
2394  ** See set_position() for a description of the coordinate system.
2395  **
2396  ** The new settings will take effect immediately, possibly causing the
2397  ** character to "teleport" if the new values are significantly
2398  ** different than the old.
2399  **
2400  *b Mode Effects:
2401  **
2402  *- - This function will put the character into free position mode.
2403  *- - This function will put the character into free action mode.
2404  **
2405  *b Arguments:
2406  **
2407  *a rz, rx, ry - orientations in degrees
2408  **
2409  *b Returns:
2410  **
2411  ** 0 on success, -1 on failure
2412  */
2413  int set_orientation_relative_to_parent(float rz, float rx, float ry);
2414 
2415  /*l
2416  *b Description:
2417  **
2418  ** Retrieves the orientation of the character relative to its parent,
2419  ** or the origin of the DI-Guy global coordinate system if
2420  ** this character does not have a parent.
2421  **
2422  ** See set_position() for a description of the coordinate system.
2423  **
2424  *b Arguments:
2425  **
2426  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2427  *a positive X axis
2428  **
2429  ** Pass NULL for any values that are not needed.
2430  **
2431  *b Returns:
2432  **
2433  ** 0 on success, -1 on failure
2434  */
2435  int get_orientation_relative_to_parent(float* rz, float* rx, float* ry);
2436 
2437  /*l
2438  *b Description:
2439  **
2440  ** This function sets how the character should be oriented relative
2441  ** to its surroundings.
2442  **
2443  ** This function changes the current up vector type, and the up vector type
2444  ** that will be set when the character is reset. To change only the
2445  ** current up vector type (a temporary change that goes away on reset),
2446  ** call set_up_vector_type()).
2447  **
2448  *b Arguments:
2449  **
2450  *a axis - the up vector type the character should use; legal
2451  *a values shown below:
2452  **
2453  *- - 'd' - use default settings; character will change
2454  *- up vector type depending on current action and
2455  *- path shape parameters
2456  *- - 'z' - Z axis is up; character will be oriented
2457  *- so that positive Z in character coordinates is
2458  *- always oriented along the positive world Z axis
2459  *- - 'n' - normal to path; character will be oriented
2460  *- so that positive Z in character coordinates is
2461  *- normal to the path shape the character is on
2462  *- - 'g' - ground-clamped; the vehicle will attempt to cling
2463  *- to the terrain, in an approximation of real rigid
2464  *- body physics
2465  *- - 'c' - custom; character's rx and ry orientation values
2466  *- will not be modified
2467  **
2468  ** Having an up vector type of 'z' effectively zeroes out the rx and ry
2469  ** values of the character's orientation.
2470  **
2471  ** Having an up vector type of 'n' may override rx and ry values of the
2472  ** character's orientation with values derived from the character's
2473  ** path shape.
2474  **
2475  ** Having an up vector type of 'c' allows the pitch and roll of the
2476  ** character to be changed without taking it off the path it in on by
2477  ** calling set_custom_orientation_rx_and_ry(). Calling
2478  ** set_orientation() has the side-effect of putting the character
2479  ** into free position mode, taking it off of any path it's on.
2480  **
2481  *b Returns:
2482  **
2483  ** 0 on success, -1 on failure
2484  */
2485  int set_initial_up_vector_type(char axis);
2486 
2487  /*l
2488  *b Description:
2489  **
2490  ** This function is being deprecated, but remains for backwards compatibility.
2491  ** It does the same thing as set_initial_up_vector_type()
2492  **
2493  */
2494  int set_initial_up_vector(char axis);
2495 
2496  /*l
2497  *b Returns:
2498  **
2499  ** current up vector type; see set_initial_up_vector_type()
2500  */
2501  char get_initial_up_vector_type();
2502 
2503  /*l
2504  *b Description:
2505  **
2506  ** This function is being deprecated, but remains for backwards compatibility.
2507  ** It does the same thing as get_initial_up_vector_type()
2508  **
2509  */
2510  char get_initial_up_vector();
2511 
2512  /*l
2513  *b Description:
2514  **
2515  ** This function sets how the character should be oriented relative
2516  ** to its surroundings.
2517  **
2518  ** This function changes only the current up vector type. To change the
2519  ** up vector type that will be used when the character is reset, call
2520  ** set_initial_up_vector_type().
2521  **
2522  *b Arguments:
2523  **
2524  *a axis - the up vector type the character should use; see
2525  *a set_initial_up_vector_type() for description
2526  **
2527  *b Returns:
2528  **
2529  ** 0 on success, -1 on failure
2530  **
2531  *b Available as Decision Bead/Event
2532  */
2533  int set_up_vector_type(char axis);
2534 
2535  /*l
2536  *b Description:
2537  **
2538  ** This function is being deprecated, but remains for backwards compatibility.
2539  ** It does the same thing as set_up_vector_type()
2540  **
2541  */
2542  int set_up_vector(char axis);
2543 
2544  /*l
2545  *b Returns:
2546  **
2547  ** current up vector type; see set_up_vector_type()
2548  */
2549  char get_up_vector_type();
2550 
2551  /*l
2552  *b Description:
2553  **
2554  ** This function is being deprecated, but remains for backwards compatibility.
2555  ** It does the same thing as get_up_vector_type()
2556  **
2557  */
2558  char get_up_vector();
2559 
2560  /*l
2561  *b Description:
2562  **
2563  ** This function sets the rx and ry components of the character's
2564  ** orientation. Unlike set_orientation(), this function does not
2565  ** put the character into free position mode if it is currently in
2566  ** path position mode.
2567  **
2568  ** Note that if the character has an up vector type of 'z' or 'n' or even
2569  ** sometimes 'd' (as set by the set_up_vector_type() call) this function
2570  ** will not have any effect. To be able to set rx and ry values,
2571  ** set the up vector type of the character to 'c', for "custom".
2572  **
2573  ** The passed rx and ry values are in character-local coordinates,
2574  ** not parent coordinates if the character has a parent.
2575  **
2576  *b Mode Effects:
2577  **
2578  *- - None.
2579  **
2580  *b Arguments:
2581  **
2582  *a rx, ry - orientations in degrees
2583  **
2584  *b Returns:
2585  **
2586  ** 0 on success, -1 on failure
2587  */
2588  int set_custom_orientation_rx_and_ry(float rx,
2589  float ry);
2590 
2591  /*l
2592  *b Description:
2593  **
2594  ** Sets the desired orientation of the character. See
2595  ** set_desired_position().
2596  **
2597  *b Mode Effects:
2598  **
2599  *- - This function will put the character into free position mode.
2600  *- - This function will put the character into free action mode.
2601  **
2602  *b Arguments:
2603  **
2604  *a rz, rx, ry - orientations in degrees counter-clockwise from
2605  *a the positive X axis
2606  **
2607  *b Returns:
2608  **
2609  ** 0 on success, -1 on failure
2610  */
2611  int set_desired_orientation(float rz, float rx, float ry,
2612  int force_guide_unacquired = 0);
2613 
2614  /*l
2615  *b Description:
2616  **
2617  ** Retrieves the desired orientation of the character.
2618  **
2619  *b Mode Restrictions:
2620  **
2621  *- - This function can only be called in free position mode.
2622  **
2623  *b Arguments:
2624  **
2625  *a rz, rx, ry - orientations in degrees counter-clockwise from
2626  *a the positive X axis
2627  **
2628  ** Pass NULL for any values that are not needed.
2629  **
2630  *b Returns:
2631  **
2632  ** 0 on success, -1 on failure
2633  */
2634  int get_desired_orientation(float* rz, float* rx, float* ry);
2635 
2636  /*l
2637  *b Description:
2638  **
2639  ** Retrieves the delta from current orientation of the character
2640  ** to the desired one.
2641  **
2642  *b Mode Restrictions:
2643  **
2644  *- - This function can only be called in free position mode.
2645  **
2646  *b Arguments:
2647  **
2648  *a rz, rx, ry - orientation deltas in degrees counter-clockwise from
2649  *a the positive X axis
2650  **
2651  ** Pass NULL for any values that are not needed.
2652  **
2653  *b Returns:
2654  **
2655  ** 0 on success, -1 on failure
2656  */
2657  int get_delta_to_desired_orientation(float* rz, float* rx, float* ry);
2658 
2659  /*l
2660  *b Description:
2661  **
2662  ** Like set_desired_orientation(), but uses the character's current
2663  ** orientation as the desired orientation.
2664  **
2665  *b Mode Effects:
2666  **
2667  *- - This function will put the character into free position mode.
2668  *- - This function will put the character into free action mode.
2669  **
2670  *b Returns:
2671  **
2672  ** 0 on success, -1 on failure
2673  */
2674  int set_desired_orientation_to_current_orientation();
2675 
2676  /*l
2677  *b Description:
2678  **
2679  ** Like set_desired_orientation(), but orients the character towards
2680  ** the position specified.
2681  **
2682  *b Mode Effects:
2683  **
2684  *- - This function will put the character into free position mode.
2685  *- - This function will put the character into free action mode.
2686  **
2687  *b Returns:
2688  **
2689  ** 0 on success, -1 on failure
2690  */
2691  int set_desired_orientation_towards_position(float x, float y, float z,
2692  int force_guide_unacquired = 0);
2693 
2694  /*l
2695  *b Description:
2696  **
2697  ** Sets the initial orientation the character should move
2698  ** to on a call to diguyScenario::reset().
2699  **
2700  ** If the character is on a path the path, not this function
2701  ** call, will determine its initial orientation.
2702  **
2703  *b Arguments:
2704  **
2705  *a rz, rx, ry - orientations in degrees counter-clockwise from
2706  *a the positive X axis
2707  **
2708  *b Returns:
2709  **
2710  ** 0 on success, -1 on failure
2711  */
2712  int set_initial_orientation(float rz, float rx, float ry);
2713 
2714  /*l
2715  *b Description:
2716  **
2717  ** Retrieves the initial orientation of the character.
2718  **
2719  ** If the character is in free position mode or has no
2720  ** initial path, this will be the orientation set by
2721  ** set_initial_orientation().
2722  **
2723  ** Otherwise this will be the orientation of the first
2724  ** waypoint of the initial path.
2725  **
2726  *b Arguments:
2727  **
2728  *a rz, rx, ry - orientations in degrees counter-clockwise from
2729  *a the positive X axis
2730  **
2731  ** Pass NULL for any values that are not needed.
2732  **
2733  *b Returns:
2734  **
2735  ** 0 on success, -1 on failure
2736  */
2737  int get_initial_orientation(float* rz, float* rx, float* ry);
2738 
2739  /*l
2740  *b Description:
2741  **
2742  ** Returns the location and orientation of a specific link of the
2743  ** character.
2744  **
2745  *b Arguments:
2746  **
2747  *a link_name - name of the link or connection point; links are named after their inbound
2748  *a joint name
2749  *a tx, ty, tz - position in meters from the origin of the world
2750  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2751  *a positive X axis
2752  **
2753  ** Pass NULL for any values that are not needed.
2754  **
2755  *b Returns:
2756  **
2757  ** 0 on success, -1 on failure
2758  */
2759  int get_link_position(const char* link_name,
2760  float* tx, float* ty, float* tz,
2761  float* rz, float* rx, float* ry);
2762 
2763  /*l
2764  *b Description:
2765  **
2766  ** Returns the location and orientation of a specific link
2767  ** of the character.
2768  **
2769  *b Arguments:
2770  **
2771  *a link_name - name of the link or connection point; links are named after their inbound
2772  *a joint name
2773  *a tx, ty, tz - position in meters from the origin of the world
2774  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2775  *a positive X axis
2776  **
2777  ** Pass NULL for any values that are not needed.
2778  **
2779  *b Returns:
2780  **
2781  ** 0 on success, -1 on failure
2782  */
2783  int get_link_position_double(const char* link_name,
2784  double* tx, double* ty, double* tz,
2785  double* rz, double* rx, double* ry);
2786 
2787  /*l
2788  *b Description:
2789  **
2790  ** Similar to get_link_position(), but allows specification
2791  ** of offset into ending link.
2792  **
2793  *b Arguments:
2794  **
2795  *a link_name - name of the link or connection point
2796  *a offset_tx, offset_ty, offset_tz - offset in link
2797  *a tx, ty, tz - position in meters from the origin
2798  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2799  *a positive X axis
2800  **
2801  ** Pass NULL for any values that are not needed.
2802  **
2803  *b Returns:
2804  **
2805  ** 0 on success, -1 on failure
2806  */
2807  int get_link_position_with_offset(const char* link_name,
2808  float offset_tx, float offset_ty, float offset_tz,
2809  float* tx, float* ty, float* tz,
2810  float* rz, float* rx, float* ry);
2811 
2812  /*l
2813  *b Description:
2814  **
2815  ** Similar to get_link_position(), but allows specification
2816  ** of offset into ending link.
2817  **
2818  *b Arguments:
2819  **
2820  *a link_name - name of the link or connection point
2821  *a offset_tx, offset_ty, offset_tz - offset in link
2822  *a tx, ty, tz - position in meters from the origin
2823  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2824  *a positive X axis
2825  **
2826  ** Pass NULL for any values that are not needed.
2827  **
2828  *b Returns:
2829  **
2830  ** 0 on success, -1 on failure
2831  */
2832  int get_link_position_with_offset_double(const char* link_name,
2833  double offset_tx, double offset_ty, double offset_tz,
2834  double* tx, double* ty, double* tz,
2835  double* rz, double* rx, double* ry);
2836 
2837  /*l
2838  *b Description:
2839  **
2840  ** Returns the location and orientation of a specific link
2841  ** of the character relative to the position of another link.
2842  **
2843  *b Arguments:
2844  **
2845  *a beginning_link_name - name of the first link; send NULL to
2846  *a to specify the position link
2847  *a ending_link_name - name of the last link; send NULL to
2848  *a to specify the position link
2849  *a tx, ty, tz - position in meters from the origin
2850  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2851  *a positive X axis
2852  **
2853  ** Pass NULL for any values that are not needed.
2854  **
2855  *b Returns:
2856  **
2857  ** 0 on success, -1 on failure
2858  */
2859  int get_link_relative_position(const char* beginning_link_name,
2860  const char* ending_link_name,
2861  float* tx, float* ty, float* tz,
2862  float* rz, float* rx, float* ry);
2863 
2864  /*l
2865  *b Description:
2866  **
2867  ** Similar to get_link_relative_position(), but allows specification
2868  ** of offset into ending link.
2869  **
2870  *b Arguments:
2871  **
2872  *a beginning_link_name - name of the first link; send NULL to
2873  *a to specify the position link
2874  *a ending_link_name - name of the last link; send NULL to
2875  *a to specify the position link
2876  *a offset_tx, offset_ty, offset_tz - offset in ending link
2877  *a tx, ty, tz - position in meters from the origin
2878  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2879  *a positive X axis
2880  **
2881  ** Pass NULL for any values that are not needed.
2882  **
2883  *b Returns:
2884  **
2885  ** 0 on success, -1 on failure
2886  */
2887  int get_link_relative_position_with_offset(const char* beginning_link_name,
2888  const char* ending_link_name,
2889  float offset_tx, float offset_ty, float offset_tz,
2890  float* tx, float* ty, float* tz,
2891  float* rz, float* rx, float* ry);
2892 
2893  /*l
2894  *b Description:
2895  **
2896  ** By default characters on a path will scale their movement speed
2897  ** and velocity based on the scale of the actor the character is
2898  ** based on. For example, if a tall character and short character
2899  ** are both playing the exact same walk motion, the tall character
2900  ** will move further per motion repetition than the short character.
2901  **
2902  ** Scaling the travel in this way leads to more realistic looking
2903  ** motion, but can cause different characters using the same actions
2904  ** and underlying motions to move at different speeds. At times it
2905  ** is convenient to not scale the travel.
2906  **
2907  ** If actor scaling is disabled, characters of different sizes will
2908  ** all move the same distance, and at the same speed, if they have
2909  ** the same path shapes and action beads. Note that in cases of
2910  ** extreme differences between the actor the motion is based on
2911  ** and the actor the character's current appearance is based on,
2912  ** the characters feet may slip on the ground more than normal.
2913  **
2914  *b Arguments:
2915  **
2916  *a apply_scale_flag - pass 1 to apply actor scale to travel;
2917  *a 0 to not
2918  */
2919  void set_apply_actor_scale_to_action_bead_travel(int apply_scale_flag);
2920 
2921  /*l
2922  *b Returns:
2923  **
2924  ** 1 if actor scale is being applied to travel, 0 if not
2925  */
2926  int get_apply_actor_scale_to_action_bead_travel();
2927 
2928  /*l
2929  *b Description:
2930  **
2931  ** This function transforms a point that is in the local space of the
2932  ** character into a location in the world. Useful for things like
2933  ** navigating AIs to a location near a prop. Or moving to a spot
2934  ** in front of someone else.
2935  **
2936  ** This code presumes up_axis is 'z' and that there is only rotation
2937  ** about that axis.
2938  */
2939  int local_to_global(float x, float y, float z,
2940  float* res_x, float* res_y, float* res_z);
2941 
2942  /*l
2943  *b Description:
2944  **
2945  ** This function transforms a point that is in world space into the
2946  ** local space of a character. Useful for figuring out if something
2947  ** was seen.
2948  **
2949  ** This code presumes up_axis is 'z' and that there is only rotation
2950  ** about that axis.
2951  **
2952  */
2953  int global_to_local(float x, float y, float z,
2954  float* res_x, float* res_y, float* res_z);
2955 
2956  /*l
2957  *b Description:
2958  **
2959  ** Retrieves the current estimated velocity of the character. Note
2960  ** this value may not be valid in environments where characters are
2961  ** transformed independent of DI-Guy function calls. Teleporting
2962  ** characters can also temporarily make this calculation incorrect.
2963  **
2964  *b Arguments:
2965  **
2966  *a vel_x, vel_y, vel_z - meters/sec
2967  **
2968  ** Pass NULL for any values that are not needed.
2969  **
2970  */
2971  void get_velocity(float* vel_x, float* vel_y, float* vel_z);
2972 
2975  void get_acceleration(float* accel_x, float* accel_y, float* accel_z);
2976 
2977  /*l
2978  *b Description:
2979  **
2980  ** Used by the Drift and Adaptive guide
2981  **
2982  *b Arguments:
2983  **
2984  *a vel_x, vel_y, vel_z - meters/sec
2985  */
2986  void set_desired_velocity(float vel_x, float vel_y, float vel_z, float ramp_time = 0.0);
2987  void get_desired_velocity(float *vel_x, float *vel_y, float *vel_z);
2988 
2989  /*l
2990  *b Description:
2991  **
2992  ** Retrieves the current estimated angular velocity of the character.
2993  ** As above, changes made to characters independent of DI-Guy
2994  ** function calls will temporarily make this value incorrect.
2995  **
2996  ** Currently only the angular velocity in yaw is measured.
2997  **
2998  *b Arguments:
2999  **
3000  *a vel_rz - degrees/sec
3001  **
3002  */
3003  void get_angular_velocity(float* vel_rz);
3004 
3005  /*l
3006  ** Used by the Drift and Adaptive guide -- see diguyCharacterGuide.
3007  **
3008  ** The guide attempts to rotate the character at the desired angular
3009  ** velocity.
3010  */
3011  void set_desired_angular_velocity(float vel_rz);
3012  void get_desired_angular_velocity(float* vel_rz);
3013 
3014 /*****************************************************************************/
3020  /*l
3021  *b Description:
3022  **
3023  ** Returns the base appearance of the character, as passed to
3024  ** the function diguyScenario::create_character(). This pointer will
3025  ** never be NULL.
3026  **
3027  ** Note that the current appearance (as returned by
3028  ** get_current_appearance()) may be different than the base
3029  ** appearance. This base appearance is the starting appearance
3030  ** of the character before any calls to set_current_appearance()
3031  ** have been made.
3032  **
3033  *b Returns:
3034  **
3035  ** name of base appearance of the character
3036  */
3037  const char* get_appearance();
3038 
3039  /*l
3040  *b Description:
3041  **
3042  ** This function sets the base appearance of the character.
3043  ** The base appearance is the appearance the character will take
3044  ** if the scenario is reset, undoing any appearance changes made
3045  ** by calls to set_current_appearance().
3046  **
3047  ** Calling this function also makes an implicit call to
3048  ** set_current_appearance().
3049  **
3050  *b Arguments:
3051  **
3052  *a appearance - name of new base appearance
3053  **
3054  *b Returns:
3055  **
3056  ** 0 on success, -1 on failure
3057  */
3058  int set_appearance(const char* appearance);
3059 
3060  /*l
3061  *b Description:
3062  **
3063  ** This function sets the current appearance of this character.
3064  **
3065  ** Note that different appearances may be based on different actors.
3066  ** Different actors represent people of different sizes, so
3067  ** changing to an appearance that has a different actor can
3068  ** cause a pronounced change in character size.
3069  **
3070  ** Also, changing actors can take some time, as more internal
3071  ** character state needs to be updated to support the new size
3072  ** of the character.
3073  **
3074  *b Arguments:
3075  **
3076  *a appearance - name of new desired appearance
3077  *a allow_actor_change - pass 1 to allow the appearance change
3078  *a even if the actor changes, 0 to not
3079  **
3080  *b See Also:
3081  **
3082  ** get_current_appearance(), set_current_head_appearance()
3083  **
3084  *b Returns:
3085  **
3086  ** 0 on success, -1 on failure
3087  **
3088  *b Available as Decision Bead/Event
3089  */
3090  int set_current_appearance(const char* appearance,
3091  int allow_actor_change = 1);
3092 
3094  const char* get_current_appearance();
3095 
3096  /*l
3097  *b Description:
3098  **
3099  ** This function can be used to see if the current appearance
3100  ** has the passed name. This is primarily useful for decisions
3101  ** and other limited logic applications.
3102  **
3103  *b Returns:
3104  **
3105  ** 1 if current appearance has passed name; 0 if not
3106  **
3107  *b Available as Decision Bead/Event
3108  */
3109  int get_current_appearance_is(const char* appearance);
3110 
3111  /*l
3112  *b Description:
3113  **
3114  ** This function sets the head appearance of this character.
3115  ** This will persist past reseting the scenario, see set_appearance()
3116  ** for conceptual similarities.
3117  **
3118  *b Arguments:
3119  **
3120  *a head_appearance - name of the new desired head appearance
3121  **
3122  *b Returns:
3123  **
3124  ** 0 on success, -1 on failure
3125  */
3126  int set_head_appearance(const char* head_appearance);
3127 
3128  /*l
3129  *b Description:
3130  **
3131  ** This function sets the current head appearance of this character.
3132  ** On failure head appearance will be set to "default". see set_head_appearance()
3133  ** for more details
3134  **
3135  *b Available as Decision Bead/Event
3136  */
3137  int set_current_head_appearance(const char* head_appearance);
3138 
3140  const char* get_current_head_appearance();
3141 
3142  /*l
3143  *b Description:
3144  **
3145  ** Similar to get_current_appearance_is(), but for head appearance.
3146  **
3147  *b Returns:
3148  **
3149  ** 1 if current head appearance has passed name; 0 if not
3150  **
3151  *b Available as Decision Bead/Event
3152  */
3153  int get_current_head_appearance_is(const char* head_appearance);
3154 
3155 
3156  /*b Description:
3157  **
3158  ** This function sets the both base and current hand item appearance
3159  ** of this character. The base hand item is the one it will have upon
3160  ** reset.
3161  **
3162  *b Arguments:
3163  **
3164  *a hand_item_appearance -- name of the desired hand item or "default"
3165  **
3166  *b Returns:
3167  **
3168  ** 0 on success, -1 on failure
3169  **
3170  *b Available as Decision Bead/Event
3171  */
3172  int set_hand_item(const char* hand_item_appearance);
3173 
3174  /*l
3175  *b Returns:
3176  **
3177  ** Hand item appearance; see set_hand_item()
3178  **
3179  ** Might return "default"
3180  */
3181  const char* get_hand_item();
3182 
3183  /*b Description:
3184  **
3185  ** This function sets the current hand item appearance of this character.
3186  ** The base hand item will remain unaffected.
3187  **
3188  *b Arguments:
3189  **
3190  *a hand_item_appearance -- name of the desired hand item or "default"
3191  **
3192  *b Returns:
3193  **
3194  ** 0 on success, -1 on failure
3195  **
3196  *b Available as Decision Bead/Event
3197  */
3198  int set_current_hand_item(const char* hand_item_appearance);
3199 
3200  /*l
3201  *b Returns:
3202  **
3203  ** Current hand item appearance. Will be the actual appearance
3204  ** displayed, not "default"
3205  */
3206  const char* get_current_hand_item();
3207 
3208 
3209  /*l
3210  *b Description:
3211  **
3212  ** Turns on texture modulation system that tries to make all characters look
3213  ** unique. Only supported by some appearances. See diguyGraphicsShape Texture Variation API
3214  ** for fine grained control of this feature
3215  */
3216  int set_use_texture_variations(int value);
3217 
3218  /*l
3219  *b Returns:
3220  ** If texture variations have been enabled for this character. Note: only some
3221  ** appearances support this feature
3222  */
3223  int get_use_texture_variations();
3224 
3226  int get_supports_texture_variations();
3227 
3230  int get_supports_weight_variations();
3231 
3235  void set_weight_scale(float weight);
3236 
3238  float get_weight_scale();
3239 
3240  /*l
3241  *b Arguments:
3242  **
3243  *a appearance_type - a value indicating the type of supplementary appearance of concern,
3244  ** ie DIGUY_APPEARANCE_BODY, DIGUY_APPEARANCE_HEAD, DIGUY_APPEARANCE_EXPRESSIVE_HEAD,
3245  ** DIGUY_APPEARANCE_HAND_ITEM
3246  *b Returns:
3247  **
3248  ** The number of available supplementary appearances of given type
3249  */
3250  int get_num_appearances_of_type(diguyCharacterAppearanceTypes appearance_type);
3251 
3252  /*l
3253  *b Returns:
3254  **
3255  ** The name of the supplementary appearance (body, head, expressive head, hand item) or NULL
3256  **
3257  *b Arguments:
3258  **
3259  *a appearance_type - a value indicating the type of appearance of concern
3260  *a index - a value indicating the type of supplementary appearance of concern
3261  **
3262  */
3263  const char* get_appearance_name_at_index(diguyCharacterAppearanceTypes appearance_type, int index);
3264 
3265  /*****************************************************************************/
3288  /*l
3289  *b Description:
3290  **
3291  ** Sets the graphics level of detail (LOD) ranges for this character.
3292  ** Compare with diguyScenario::set_default_lod_ranges(), which sets
3293  ** the LOD ranges for newly created characters of a particular type.
3294  ** In both cases, ranges must be a static array of 8 floats,
3295  ** each larger than the one before.
3296  **
3297  ** This function sets graphics LOD ranges only. Motion levels of
3298  ** detail can be set by calling set_motion_lod().
3299  **
3300  *b Arguments:
3301  **
3302  *a lod_ranges - new lod ranges for this character;
3303  **
3304  ** See diguyScenario::set_default_lod_ranges() for a description
3305  ** of what to pass in lod_ranges.
3306  **
3307  *b Returns:
3308  **
3309  ** 0 on success, -1 on failure
3310  **
3311  *b Callable From:
3312  **
3313  *- - C++
3314  */
3315  int set_lod_ranges(float* lod_ranges);
3316 
3317 #ifdef CPLUSPLUS_ONLY
3318  float* get_lod_ranges();
3320 
3321 #endif
3322 
3324  int get_num_lods();
3325 
3326  /*l
3327  *b Description:
3328  **
3329  ** Set the desired graphics level of detail (LOD) for this character.
3330  ** This may be overridden if this character uses automatic LOD
3331  ** switching. See diguyScenario::set_automatic_graphics_lod_switching().
3332  **
3333  ** DI-Guy graphics LODs are numbered 1 (most detail) through 7 (least detail).
3334  **
3335  *b Arguments:
3336  **
3337  *a lod - an integer between 1 and 7
3338  **
3339  *b Returns:
3340  **
3341  ** 0 on success, -1 on failure
3342  */
3343  int set_graphics_lod(int lod);
3344 
3346  int get_graphics_lod();
3347 
3348 
3351  int set_allow_instancing(int value);
3352 
3354  int get_allow_instancing() const;
3355 
3358  int get_is_instanced() const;
3359 
3361  int can_lod_be_instanced(int lod);
3362 
3363  /*l Documentation Pending
3364  *b Description:
3365  **
3366  ** For scene graph renderers it can be necessary to patch the texture buffer object after
3367  ** the scene graph finishes updating various post processes (ground clamping for instance),
3368  ** or modifying the TBO with a local space camera.
3369  **
3370  ** This function allows the end user to pre-multiply the matrix in the TBO for each shape
3371  ** the character has. It requires diguyScenario::set_use_user_position_matrices() is called
3372  ** so that DI-Guy knows to keep track of TBO shape index data.
3373  */
3374  int set_final_tbo_position_matrix(int include_local_to_global_transform,
3375  float a0, float a1, float a2, float a3,
3376  float b0, float b1, float b2, float b3,
3377  float c0, float c1, float c2, float c3);
3378 
3379  /*l
3380  *b Description:
3381  **
3382  ** Set the desired shader level of detail (LOD) for this character.
3383  ** By default this is -1 and the shader is automatically picked by distance.
3384  **
3385  ** DI-Guy shaders LODs are numbered 1 (most quality) through the number of shaders in the
3386  ** current technique.
3387  **
3388  *b Arguments:
3389  **
3390  *a lod - an integer between 1 and the number of shaders in the current technique
3391  **
3392  *b Returns:
3393  **
3394  ** 0 on success, -1 on failure
3395  */
3396  int set_shader_lod(int lod);
3397 
3399  int get_shader_lod();
3400 
3403  int get_has_bump_maps();
3404 
3405  /*l
3406  *b Description:
3407  **
3408  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3409  ** multi-threaded pipeline for increasing performance.
3410  **
3411  ** Sets the motion level of detail (LOD) for this character.
3412  ** LOD 1 animates all joints of a character. Higher LODs
3413  ** animate fewer joints.
3414  **
3415  ** For LOD 6, *nothing* in the pose is updated. The character's
3416  ** pose will remain whatever it was the last time pose data
3417  ** was changed.
3418  **
3419  *a LOD - Effect
3420  *a 1 - animate all joints
3421  *a 2 - stop animating wrists and ankles
3422  *a 3 - stop animating elbows and knees
3423  *a 4 - stop animating everything but pelvis and position
3424  *a 5 - stop animating everything but position
3425  *a 6 - stop animating everything but position
3426  **
3427  ** Note that characters that are load managed
3428  ** (get_is_load_managed() returns 1) have this parameter managed
3429  ** automatically. The corresponding function for load managed
3430  ** characters is diguyLoadManager::set_zone_motion_lod().
3431  **
3432  *b Arguments:
3433  **
3434  *a motion_lod - an integer between 1 and 6
3435  **
3436  *b Returns:
3437  **
3438  ** 0 on success, -1 on failure
3439  */
3440  int set_motion_lod(int motion_lod);
3441 
3443  int get_motion_lod();
3444 
3446  int get_current_motion_lod();
3447 
3448  /*l
3449  *b Description:
3450  **
3451  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3452  ** multi-threaded pipeline for increasing performance.
3453  **
3454  ** This function sets the minimum CPL (character performance
3455  ** level) of the character.
3456  **
3457  ** A higher CPL will limit the types of operations that the character
3458  ** can perform, but will allow for more optimized update() calls.
3459  **
3460  ** The following CPL limitations are cumulative:
3461  **
3462  *- - CPL 1: all character function calls are available
3463  *- - CPL 2: the character cannot save history
3464  *- - CPL 3: no advanced pose operations that alter the basic pose
3465  *- of the character, including:
3466  *>
3467  *- - gazing
3468  *- - pointing
3469  *- - aiming
3470  *- - gestures
3471  *- - head nodding and shaking
3472  *- - pose overrides
3473  *- - features relying on link matrices
3474  *- - wheel rolling and turning on vehicles
3475  **
3476  ** Since link matrices are not computed, the DI-Guy Graphics API
3477  ** function diguyGraphicsLink::get_transformation_matrix() will
3478  ** not return valid results.
3479  *<
3480  *- - CPL 4: no blends between motions
3481  *- - CPL 5: (not currently implemented)
3482  **
3483  ** Note that characters that are load managed (get_is_load_managed()
3484  ** returns 1) have this parameter managed automatically. The
3485  ** corresponding function for load managed characters is
3486  ** diguyLoadManager::set_zone_minimum_cpl().
3487  **
3488  ** The passed minimum_cpl may not be achievable if the character
3489  ** is already in the process of doing something not allowed by the
3490  ** new CPL. For example, if the character is already gazing, trying
3491  ** to set the minimum CPL to 3 will fail, as CPL 3 would disable
3492  ** gazing. In this case the minimum CPL will be set to the current
3493  ** highest possible CPL based on what the character is already doing.
3494  ** In this example the minimum CPL would be set to 2, as gazing is
3495  ** allowed at that CPL.
3496  **
3497  ** Conversely, if the minimum CPL has been successfully been set to
3498  ** 3 or higher, any gaze calls such as diguyCharacter::gaze_at_point()
3499  ** will fail.
3500  **
3501  *b Arguments:
3502  **
3503  *a cpl - minimum CPL allowed for this character
3504  **
3505  *b Returns:
3506  **
3507  ** 0 on success, -1 on failure
3508  */
3509  int set_minimum_cpl(int minimum_cpl);
3510 
3512  int get_minimum_cpl();
3513 
3514  /*l
3515  *b Description:
3516  **
3517  ** This function returns that maximum possible CPL the character
3518  ** can attain based on what it is currently doing. Advanced pose
3519  ** operations like gazing and pose overrides will limit the maximum
3520  ** CPL that can be achieved.
3521  **
3522  ** See diguyCharacter::set_minimum_cpl() for a description of
3523  ** what is possible under the different CPL levels.
3524  **
3525  *b Returns:
3526  **
3527  ** maximum possible current CPL
3528  */
3529  int get_maximum_possible_current_cpl();
3530 
3531  /*l
3532  *b Description:
3533  **
3534  ** This function puts the character into the maximum possible CPL
3535  ** that can be achieved based on what the character is currently
3536  ** doing.
3537  **
3538  ** This current CPL does not prevent the character from starting
3539  ** operations that will potentially lower the CPL. e.g., if the
3540  ** character starts gazing, the CPL will potentially go down.
3541  ** Use set_minimum_cpl() to prevent that character from starting
3542  ** such operations.
3543  **
3544  ** See diguyCharacter::set_minimum_cpl() for a description of
3545  ** what is possible under the different CPL levels.
3546  **
3547  *b Returns:
3548  **
3549  ** 0 on success, -1 on failure
3550  */
3551  int maximize_current_cpl();
3552 
3553  /*l
3554  *b Description:
3555  **
3556  ** This function sets a flag that determines whether the character
3557  ** should raise and lower its CPL automatically. If automatic
3558  ** CPL switching is enabled then any time a potential CPL-changing
3559  ** operation is performed, the character will check the maximum
3560  ** possible current CPL (as per a call to maximize_current_cpl())
3561  ** and set its current CPL to the maximum possible.
3562  **
3563  *b Arguments:
3564  **
3565  *a enabled - pass 1 to enable automatic CPL switching, 0 to
3566  *a disable it
3567  **
3568  *b Returns:
3569  **
3570  ** 0 on success, -1 on failure
3571  */
3572  int set_automatic_cpl_switching_enabled(int enabled);
3573 
3575  int get_automatic_cpl_switching_enabled();
3576 
3577  /*l
3578  *b Description:
3579  **
3580  ** This function sets the current CPL of the character. Trying
3581  ** to set the CPL lower than the minimum (as set by
3582  ** set_minimum_cpl()) of higher than the maximum (as returned by
3583  ** get_maximum_possible_current_cpl()) will fail.
3584  **
3585  ** Note that characters that have automatic CPL switching enabled
3586  ** (get_automatic_cpl_switching_enabled() returns 1) will override
3587  ** this value.
3588  **
3589  ** See diguyCharacter::set_minimum_cpl() for a description of
3590  ** what is possible under the different CPL levels.
3591  **
3592  *b Arguments:
3593  **
3594  *a cpl - new current CPL
3595  **
3596  *b Returns:
3597  **
3598  ** 0 on success, -1 on failure
3599  */
3600  int set_current_cpl(int current_cpl);
3601 
3603  int get_current_cpl();
3604 
3605  /*l
3606  *b Description:
3607  **
3608  ** This function sets the position update rate of the character. If
3609  ** the character's position is not updated on a particular update
3610  ** tick, its position will not change for that tick. This can
3611  ** result is a modest performance increase.
3612  **
3613  ** The default value for new characters is 100.
3614  **
3615  ** This value may be overridden by the minimum full update period, as
3616  ** set by set_minimum_full_update_period().
3617  **
3618  ** Note that if the character's pose is updated, (see
3619  ** diguyCharacter::set_pose_update_rate()) its position will be
3620  ** updated as well.
3621  **
3622  ** Note that characters that are load managed
3623  ** (get_is_load_managed() returns 1) have this parameter managed
3624  ** automatically. The corresponding function for load managed
3625  ** characters is diguyLoadManager::set_zone_position_update_rate().
3626  **
3627  *b Arguments:
3628  **
3629  *a update_rate - percentage of scenario ticks for which
3630  *a position should update; can be between
3631  *a 1 and 100
3632  **
3633  ** Passing 100 means position will update every tick.
3634  ** Passing 50 means position will update every other tick.
3635  **
3636  *b Returns:
3637  **
3638  ** 0 on success, -1 on failure
3639  */
3640  int set_position_update_rate(int update_rate);
3641 
3643  int get_position_update_rate();
3644 
3645  /*l
3646  *b Description:
3647  **
3648  ** This function is very similar to set_position_update_rate(), but
3649  ** sets the percentage of ticks for which the character's pose is
3650  ** updated.
3651  **
3652  ** The default value for new characters is 100.
3653  **
3654  ** This value may be overridden by the minimum full update period,
3655  ** as set by set_minimum_full_update_period().
3656  **
3657  ** Note that if the character's pose is updated, its position will
3658  ** be updated as well.
3659  **
3660  ** Note that characters that are load managed (get_is_load_managed()
3661  ** returns 1) have this parameter managed automatically. The
3662  ** corresponding function for load managed characters is
3663  ** diguyLoadManager::set_zone_pose_update_rate().
3664  **
3665  *b Arguments:
3666  **
3667  *a update_rate - percentage of scenario ticks for which
3668  *a pose should update; can be between
3669  *a 1 and 100
3670  **
3671  ** Passing 100 means pose will update every tick.
3672  ** Passing 50 means pose will update every other tick.
3673  **
3674  *b Returns:
3675  **
3676  ** 0 on success, -1 on failure
3677  */
3678  int set_pose_update_rate(int update_rate);
3679 
3681  int get_pose_update_rate();
3682 
3683  /*l
3684  *b Description:
3685  **
3686  ** This function sets the minimum period for position or pose
3687  ** updates. If the passed amount of time passes with no position or
3688  ** pose update (see set_position_update_rate() and
3689  ** set_pose_update_rate()), the character's position and potentially
3690  ** pose will be updated.
3691  **
3692  ** Note that characters that are load managed (get_is_load_managed()
3693  ** returns 1) have this parameter managed automatically. The
3694  ** corresponding function for load managed characters is
3695  ** diguyLoadManager::set_minimum_full_update_period().
3696  **
3697  ** The default for new characters is 1.0 seconds.
3698  **
3699  *b Arguments:
3700  **
3701  *a min_period - in seconds
3702  **
3703  *b Returns:
3704  **
3705  ** 0 on success, -1 on failure
3706  */
3707  int set_minimum_full_update_period(float min_period);
3708 
3710  float get_minimum_full_update_period();
3711 
3712  /*l
3713  *b Description:
3714  **
3715  ** This function disables position accumulation due to played
3716  ** actions. The character will stay in whatever position has most
3717  ** recently been set by set_position(), regardless of action.
3718  ** Because of this the character will, for example, walk in place.
3719  ** It is up to the user application to correctly set and update the
3720  ** character's position.
3721  **
3722  ** This function can be used when a host application provides
3723  ** absolute control over character positions.
3724  **
3725  ** Disabling position accumulation will result in a modest
3726  ** performance increase.
3727  **
3728  *b Arguments:
3729  **
3730  *a disabled_flag - pass 1 to disable position accumulation, 0
3731  *a to enable it
3732  **
3733  *b Returns:
3734  **
3735  ** 0 on success, -1 on failure
3736  */
3737  int set_position_accumulation_disabled(int disabled_flag);
3738 
3740  int get_position_accumulation_disabled();
3741 
3742  /*l
3743  *b Description:
3744  **
3745  ** This function disables all blends between motions of the
3746  ** character. This will speed up performance at the expense of
3747  ** visual quality of the motions. If the character is far from the
3748  ** current camera position, however, the lack of blends may be
3749  ** visually acceptable.
3750  **
3751  ** Note that characters that are load managed (get_is_load_managed()
3752  ** returns 1) have this parameter managed automatically.
3753  **
3754  *b Arguments:
3755  **
3756  *a disabled_flag - pass 1 to disable all blends, 0
3757  *a to enable them
3758  **
3759  *b Returns:
3760  **
3761  ** 0 on success, -1 on failure
3762  */
3763  int set_all_blends_disabled(int disabled_flag);
3764 
3766  int get_all_blends_disabled();
3767 
3768  /*l
3769  *b Description:
3770  **
3771  *b Note: This function is not recommended. There is minimal perf gain.
3772  ** This function disables all update calls for shape switches.
3773  **
3774  ** Switches currently control:
3775  **
3776  *- - muzzle flashes
3777  *- - hand switching for selected characters
3778  **
3779  ** For DI-Guy Graphics API users this means that most calls to
3780  ** diguyGraphicsShape::show() and diguyGraphicsShape::hide() will not
3781  ** be made.
3782  **
3783  ** Note that characters that are load managed (get_is_load_managed()
3784  ** returns 1) have this parameter managed automatically.
3785  **
3786  *b Arguments:
3787  **
3788  *a disabled_flag - pass 1 to disable shape switches, 0
3789  *a to enable them
3790  **
3791  *b Returns:
3792  **
3793  ** 0 on success, -1 on failure
3794  */
3795  int set_shape_switches_disabled(int disabled_flag);
3796 
3798  int get_shape_switches_disabled();
3799 
3800  /*l
3801  *b Description:
3802  **
3803  *b Note: This function is not recommended. There is minimal perf gain.
3804  ** This function disables all shape callbacks. Shape callbacks are
3805  ** used internally for updating some advanced visual effects.
3806  **
3807  ** Shape callbacks currently control:
3808  **
3809  *- - expressive faces
3810  *- - particle systems
3811  **
3812  ** Disabling shape callbacks will make these visual effects work
3813  ** incorrectly but will result in a performance increase for
3814  ** characters that do not use them.
3815  **
3816  ** Note that characters that are load managed (get_is_load_managed()
3817  ** returns 1) have this parameter managed automatically.
3818  **
3819  *b Arguments:
3820  **
3821  *a disabled_flag - pass 1 to disable shape callbacks, 0
3822  *a to enable them
3823  **
3824  *b Returns:
3825  **
3826  ** 0 on success, -1 on failure
3827  */
3828  int set_shape_callbacks_disabled(int disabled_flag);
3829 
3831  int get_shape_callbacks_disabled();
3832 
3833  /*l
3834  *b Description:
3835  **
3836  *b Note: This function is not recommend. There is minimal perf gain.
3837  ** This function disables all calls to the virtual diguyGraphicsShape::update()
3838  ** function.
3839  **
3840  ** Note that characters that are load managed (get_is_load_managed()
3841  ** returns 1) have this parameter managed automatically.
3842  **
3843  *b Arguments:
3844  **
3845  *a disabled_flag - pass 1 to disable update calls, 0
3846  *a to enable them
3847  **
3848  *b Returns:
3849  **
3850  ** 0 on success, -1 on failure
3851  */
3852  int set_graphics_api_shape_update_disabled(int disabled_flag);
3853 
3855  int get_graphics_api_shape_update_disabled();
3856 
3857  /*l
3858  *b Description:
3859  **
3860  ** This function is a stripped-down version of the normal update()
3861  ** function. This function is for high performance applications that
3862  ** are willing to sacrifice advanced character functionality in
3863  ** exchange for faster performance.
3864  **
3865  ** Characters using optimized_update() must not do any of the
3866  ** following:
3867  **
3868  *- - change character types (e.g., set_character_type())
3869  *- - play sounds (e.g., play_sound())
3870  *- - use history (e.g., set_history_type())
3871  *- - use paths (e.g., push_path())
3872  *- - weapon firing (e.g., fire_weapon())
3873  *- - advanced pose operations (as per CPL 3)
3874  *- - be a DI-Guy Network Module character
3875  *- - need to use character callbacks
3876  *- - use advanced visual effects, such as expressive faces and particle systems
3877  **
3878  ** Like update(), the scenario must not call the character's update()
3879  ** function (return value of get_t_controlled_by_scenario_t() is 0)
3880  ** for this function to work properly.
3881  **
3882  ** In some cases the regular update() call can be used for a time in
3883  ** place of optimized_update() if one of the above operations is
3884  ** desired.
3885  **
3886  *b Arguments:
3887  **
3888  *a t - new time for the character
3889  **
3890  *b Returns:
3891  **
3892  ** 0 on success, -1 on failure
3893  */
3894  int optimized_update(float t);
3895 
3896  /*l
3897  *b Description:
3898  **
3899  ** This function sets whether many of the performance tuning
3900  ** functions above are automatically managed by a diguyLoadManager
3901  ** object, which can be obtained by calling
3902  ** diguyApp::create_load_manager().
3903  **
3904  ** Note that this function will have no effect if a load manager has
3905  ** not been enabled.
3906  **
3907  ** The default for new characters is to be load managed if the load
3908  ** manager has been enabled.
3909  **
3910  *b Arguments:
3911  **
3912  *a is_load_managed - pass 1 to have character automatically
3913  *a load managed, 0 for manual management
3914  **
3915  *b Returns:
3916  **
3917  ** 0 on success, -1 on failure
3918  */
3919  int set_is_load_managed(int is_load_managed);
3920 
3922  int get_is_load_managed();
3923 
3924 
3925 /*****************************************************************************/
3931  /*l
3932  *b Description:
3933  **
3934  ** This is an enumeration of the different callbacks that can be
3935  ** registered with add_callback() and add_callback_script().
3936  **
3937  ** Callbacks return a value of type diguyCallbackReturn, which will
3938  ** be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the
3939  ** callback returns DIGUY_CALLBACK_STOP, in some cases the default
3940  ** handler of the function will not be called; the callback is
3941  ** asserting that it has done everything necessary for the function
3942  ** call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default
3943  ** handler for the function will be called after the callback.
3944  **
3945  *b Usable From:
3946  **
3947  *- - C++
3948  *- - Script
3949  **
3950  *************************************************************************
3951  *4 Callback Enums:
3952  **
3953  *i CALLBACK_ID_CREATE
3954  **
3955  ** This callback will be called when a new character is created,
3956  ** *after* the character is fully initialized.
3957  **
3958  ** Note that this callback can only be added by calling
3959  ** diguyScenario::add_default_character_callback(); adding it with
3960  ** diguyCharacter::add_callback() will have no effect, as by that
3961  ** time the character has already been created.
3962  **
3963  *i CALLBACK_ID_DESTROY
3964  **
3965  ** This callback will be called when a character is
3966  ** destroyed.
3967  **
3968  *i CALLBACK_ID_PRE_CREATE
3969  **
3970  ** Like CALLBACK_ID_CREATE, this callback will be called when a
3971  ** new character is created; however, it is called *before* the
3972  ** character is fully initialized.
3973  **
3974  *b NOTE: Care must be taken when using this callback!
3975  ** As mentioned above, the character is not fully initialized,
3976  ** meaning that most member functions of the diguyCharacter object
3977  ** should not be called. Those member functions that are safe
3978  ** to call will be mentioned in the documentation for the function;
3979  ** e.g., set_graphics_api_node_ptr().
3980  **
3981  ** Note that this callback can only be added by calling
3982  ** diguyScenario::add_default_character_callback(); adding it
3983  ** with diguyCharacter::add_callback() will have no effect, as
3984  ** by that time the character has already been created.
3985  **
3986  *i CALLBACK_ID_CURRENT_APPEARANCE_CHANGED
3987  **
3988  ** This callback will be called when a character's current
3989  ** appearance is changed.
3990  **
3991  *i CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED
3992  **
3993  ** This callback will be called when a character's current head
3994  ** appearance is changed.
3995  **
3996  *i CALLBACK_ID_PRE_UPDATE
3997  **
3998  ** This callback will be called before the character is updated as
3999  ** a result of the diguyScenario::update() function.
4000  **
4001  *i CALLBACK_ID_POST_UPDATE
4002  **
4003  ** This callback will be called after the character is updated as a
4004  ** result of the diguyScenario::update() function.
4005  **
4006  *i CALLBACK_ID_DONE_SPEAKING
4007  **
4008  ** This callback will be called when the character has finished
4009  ** speaking the contents of a speak() function call.
4010  **
4011  *i CALLBACK_ID_GAZE_STATUS
4012  **
4013  ** This callback will be called after the character's gaze has
4014  ** experienced a status change.
4015  **
4016  *i CALLBACK_ID_LPOINT_STATUS
4017  **
4018  ** This callback will be called after the character's lpoint (left
4019  ** arm pointing) has experienced a status change.
4020  **
4021  *i CALLBACK_ID_SHOW
4022  **
4023  ** This callback will be called when the character is being shown
4024  ** for any reason.
4025  **
4026  *i CALLBACK_ID_HIDE
4027  **
4028  ** This callback will be called when the character is being hidden
4029  ** for any reason.
4030  **
4031  *i CALLBACK_ID_PRE_DIE
4032  **
4033  ** This callback will be called when the character has been told to
4034  ** die, before a die action has been selected and initiated.
4035  **
4036  ** If the returned diguyCallbackReturn value is
4037  ** DIGUY_CALLBACK_STOP, the character will not die.
4038  **
4039  *i CALLBACK_ID_POST_DIE
4040  **
4041  ** This callback will be called when the character has been told to
4042  ** die, after a die action has been selected and initiated.
4043  **
4044  *i CALLBACK_ID_PRE_FIRE_WEAPON
4045  **
4046  ** This callback will be called when the character has been told to
4047  ** fire its weapon, before a final decision has been made to fire.
4048  **
4049  ** If the returned diguyCallbackReturn value is
4050  ** DIGUY_CALLBACK_STOP, the character will not fire.
4051  **
4052  *i CALLBACK_ID_IMPACT
4053  **
4054  ** This callback will be called when the character has been hit.
4055  ** diguyCharacter::get_last_impact_record() contains a pointer to
4056  ** the impact information. If a character has this callback the
4057  ** standard behavior (killing the character) is skipped and the
4058  ** system assumes the end user has handled the impact.
4059  **
4060  ** Similar behavior results if
4061  ** diguyCrowd::CALLBACK_ID_CROWD_MEMBER_IMPACT is registered.
4062  **
4063  *i CALLBACK_ID_POST_FIRE_WEAPON
4064  **
4065  ** This callback will be called when the character has been told to
4066  ** fire its weapon, after a final decision has been made to fire.
4067  **
4068  *i CALLBACK_ID_CURRENT_ACTION_CHANGED
4069  **
4070  ** This callback will be called whenever the character's current
4071  ** action changes, typically after a call to set_desired_action()
4072  ** or force_action().
4073  **
4074  *i CALLBACK_ID_DESIRED_ACTION_CHANGED
4075  **
4076  ** This callback will be called whenever the character's desired
4077  ** action changes, typically after a call to set_desired_action().
4078  **
4079  *i CALLBACK_ID_DESIRED_ACTION_REACHED
4080  **
4081  ** This callback will be called when the character reaches its
4082  ** desired action as set by a call to set_desired_action().
4083  **
4084  *i CALLBACK_ID_MANUALLY_INVOKED
4085  **
4086  ** This callback id will be supplied to event handlers invoked by a
4087  ** call to manually_invoke_event_handler().
4088  **
4089  *i CALLBACK_ID_USER_SELECTED
4090  **
4091  ** This callback will be called when the character is selected in DI-Guy Scenario.
4092  **
4093  *i CALLBACK_ID_USER_UNSELECTED
4094  **
4095  ** This callback will be called on a currently selected character when a different
4096  ** character is selected in DI-Guy Scenario.
4097  **
4098  *i CALLBACK_ID_IGUY_INTERACT
4099  **
4100  ** This callback will be called when the character has been clicked
4101  ** on while DI-Guy Scenario is in I-Guy Input Mode. Note that this
4102  ** is called on the character clicked, not the I-Guy character.
4103  **
4104  *i CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT
4105  **
4106  ** This callback will be called when the character, as the I-Guy
4107  ** character, has clicked another character in I-Guy Input Mode.
4108  ** Note that this is called for the I-Guy character, not the
4109  ** clicked character.
4110  **
4111  *i CALLBACK_ID_GUIDE_POSITION_ACQUIRED
4112  **
4113  ** This callback will be called when the character has reached its
4114  ** desired position as set by set_desired_position(). The
4115  ** diguyCharacterGuide is responsible for moving the character towards
4116  ** this position.
4117  **
4118  *i CALLBACK_ID_GUIDE_POSITION_UNACQUIRED
4119  **
4120  ** This callback will be called if the character moves too far away
4121  ** from its desired position after it has been previously reached.
4122  **
4123  *i CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED
4124  **
4125  ** This callback will be called when the character has reached its
4126  ** desired orientation as set by set_desired_orientation(). The
4127  ** diguyCharacterGuide is responsible for moving the character towards
4128  ** this orientation.
4129  **
4130  *i CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED
4131  **
4132  ** This callback will be called if the character turns too far away
4133  ** from its desired orientation after it has been previously
4134  ** reached.
4135  **
4136  *i CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED
4137  **
4138  ** This callback will be called when the character has reached its
4139  ** desired altitude as set by set_desired_orientation() or other functions.
4140  ** The callback is most meaningful for vehicles that need to achieve
4141  ** some sort "cruising altitude" while moving to a destination.
4142  **
4143  *i CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED
4144  **
4145  ** This callback will be called if the character turns too far away
4146  ** from its desired orientation after it has been previously
4147  ** reached.
4148  **
4149  *i CALLBACK_ID_GUIDE_TARGET_LOST
4150  **
4151  ** This callback will be called when the character guide has determined
4152  ** that the character can't reach its desired position/orientation. An
4153  ** example would be a missile that has flown past its target
4154  **
4155  *i CALLBACK_ID_CURRENT_TOUT_REACHED
4156  **
4157  ** This callback will be called when scenario time reaches this
4158  ** character's tout time as set by set_current_tout().
4159  **
4160  *i CALLBACK_ID_POST_CREATE_GEOMETRY
4161  **
4162  ** This callback will be called just after the character's geometry
4163  ** has been created.
4164  **
4165  *i CALLBACK_ID_PRE_DESTROY_GEOMETRY
4166  **
4167  ** This callback will be called just before the character's
4168  ** geometry is broken down and destroyed.
4169  **
4170  *i CALLBACK_ID_END_OF_PATH_REACHED
4171  **
4172  ** This callback will be called when a character reaches the end of
4173  ** their current path. Note the path must finish, forcing to other
4174  ** paths will not trigger this callback.
4175  **
4176  **
4177  *************************************************************************
4178  *4 DI-Guy Scenario UI Callback enums:
4179  **
4180  *i CALLBACK_ID_UI_PRE_TRANSLATION
4181  **
4182  ** This callback will be called when the user interface starts
4183  ** moving a character.
4184  **
4185  *i CALLBACK_ID_UI_POST_TRANSLATION
4186  **
4187  ** This callback will be called when the user interface finishes
4188  ** moving a character.
4189  **
4190  *i CALLBACK_ID_UI_MOUSE_DOWN
4191  **
4192  ** This callback will be called when the user interface gets a
4193  ** mouse click in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT input
4194  ** mode.
4195  **
4196  *i CALLBACK_ID_UI_MOUSE_UP
4197  **
4198  ** This callback will be called when the user interface gets a
4199  ** mouse release in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT
4200  ** input mode.
4201  **
4202  *************************************************************************
4203  *4 DI-Guy AI Agent Callback enums:
4204  **
4205  *i CALLBACK_ID_AGENT_NEW_BEHAVIOR
4206  **
4207  ** This callback will be called when an agent changes its current
4208  ** behavior.
4209  **
4210  *i CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER
4211  **
4212  ** This callback will be called when an agent changes its current
4213  ** focus character; this happens most frequently when it is focused
4214  ** on a group.
4215  **
4216  *i CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS
4217  **
4218  ** This callback will be called when an agent in attack behavior
4219  ** evaluates the group it's focused on and cannot find an
4220  ** appropriate target. This can happen if all group members are
4221  ** dead.
4222  **
4223  *i CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS
4224  **
4225  ** This callback will be called when an agent in attack behavior
4226  ** can't see any potential members of the group it's focused on.
4227  **
4228  *i CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED
4229  **
4230  ** This callback will be called when an agent in pursue behavior
4231  ** has come within the pursuit distance of its pursuit target.
4232  **
4233  *i CALLBACK_ID_AGENT_PURSUE_TARGET_LOST
4234  **
4235  ** This callback will be called when an agent in pursue behavior
4236  ** is no longer within the pursuit distance of its pursuit target.
4237  **
4238  *i CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED
4239  **
4240  ** This callback will be called when an agent in mingle behavior
4241  ** has reached its mingle target.
4242  **
4243  *i CALLBACK_ID_AGENT_MINGLE_TARGET_LOST
4244  **
4245  ** This callback will be called when an agent in mingle behavior
4246  ** is no longer is range of its mingle target.
4247  **
4248  *i CALLBACK_ID_AGENT_WANDER_TARGET_REACHED
4249  **
4250  ** This callback will be called when an agent in wander behavior
4251  ** has reached its wander target.
4252  **
4253  *i CALLBACK_ID_AGENT_WANDER_TARGET_LOST
4254  **
4255  ** This callback will be called when an agent in wander behavior
4256  ** is no longer is range of its wander target.
4257  **
4258  *i CALLBACK_ID_AGENT_FLEE_AREA_LEFT
4259  **
4260  ** This callback will be called when an agent in flee behavior has
4261  ** successfully moved out range of all fled characters or
4262  ** locations. This will only be called when the agent is
4263  ** transitioning from inside the flee area to outside of it.
4264  **
4265  *i CALLBACK_ID_AGENT_FLEE_AREA_ENTERED
4266  **
4267  ** This callback will be called when an agent in flee behavior has
4268  ** moved inside of the range of any fled characters or locations.
4269  ** This will only be called when the agent is transitioning from
4270  ** outside the flee area to inside of it.
4271  **
4272  *i CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED
4273  **
4274  ** This callback will be called when an agent in travel behavior
4275  ** has reached in intermediate waypoint and is about to move
4276  ** on to the next.
4277  **
4278  *i CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
4279  **
4280  ** This callback will be called when an agent in travel behavior
4281  ** has reached the end of its travel path when moving forward
4282  ** along the path.
4283  **
4284  *i CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED
4285  **
4286  ** This callback will be called when an agent in travel behavior
4287  ** has reached the beginning of its travel path when moving
4288  ** backward along the path.
4289  **
4290  *i CALLBACK_ID_AGENT_TRAVEL_NEAR_FORWARD_DEST
4291  **
4292  ** This callback will be called when an agent gets within a specified
4293  ** distance of the end of the travel path
4294  **
4295  *i CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED
4296  **
4297  ** This callback will be called when fellow member of the crowd is
4298  ** killed.
4299  **
4300  *- - This is the character version of
4301  *- diguyCrowd::CALLBACK_ID_CROWD_MEMBER_KILLED
4302  *- - The crowd's callback character is the crowd member that was
4303  *- killed.
4304  *- - The crowd's callback impact contains the impact information.
4305  **
4306  *i CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT
4307  **
4308  ** This callback will be called when a fellow member of the crowd
4309  ** is hit by a detonation. This callback does not replace
4310  ** diguyCharacter::CALLBACK_ID_IMPACT, which still needs to be
4311  ** handled to implement damage models.
4312  **
4313  *- - The crowd's callback character is the crowd member that was
4314  *- hit.
4315  *- - The crowd's callback impact contains the impact information.
4316  **
4317  *i CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT
4318  **
4319  ** This callback will be called when a detonation occurs within the
4320  ** awareness radius (as set by set_awareness_radius()) of the
4321  ** crowd's current bounds.
4322  **
4323  *- - This is the character version of
4324  *- diguyCrowd::CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT
4325  *- - The crowd's callback character is the character that caused
4326  *- the detonation.
4327  *- - The crowd's callback impact contains the impact information.
4328  **
4329  *i CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED
4330  **
4331  ** This callback will be called when a weapon is fired within the
4332  ** awareness radius (as set by set_awareness_radius()) of the
4333  ** crowd's current bounds.
4334  **
4335  *- - The crowd's callback character is the character that fired the
4336  *- weapon.
4337  **
4338  *i CALLBACK_ID_AGENT_VEHICLE_COLLISION
4339  **
4340  ** This callback will be called on a vehicle agent when it hits a
4341  ** member of a companion crowd.
4342  **
4343  *i CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION
4344  **
4345  ** This callback will be called on a vehicle agent when it
4346  ** approaches another vehicle.
4347  **
4348  *i CALLBACK_ID_AGENT_NON_ZERO_REPULSION
4349  **
4350  ** This callback will be called when an agent character's repulsion
4351  ** forces become non-zero.
4352  **
4353  *i CALLBACK_ID_AGENT_ZERO_REPULSION
4354  **
4355  ** This callback will be called when an agent character's repulsion
4356  ** forces become zero.
4357  **
4358  *i CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED
4359  **
4360  ** This callback will be called when a character who's requested a
4361  ** path plan via the background path planner
4362  ** (agent_move_to_point_bg) gets a path result. Call
4363  ** diguyCharacter::get_path_planning_result() to get the status of
4364  ** the result.
4365  **
4366  *i CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED
4367  **
4368  ** This callback will be called when the current state the agent's
4369  ** mind, if it has one, has changed. Call
4370  ** diguyCharacter::get_mind_current_state_name() to get the new
4371  ** state name.
4372  */
4373  enum {
4374  CALLBACK_ID_CREATE = 1,
4375  CALLBACK_ID_DESTROY,
4376  CALLBACK_ID_PRE_CREATE,
4377  CALLBACK_ID_CURRENT_APPEARANCE_CHANGED,
4378  CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED,
4379  CALLBACK_ID_CURRENT_HAND_ITEM_APPEARANCE_CHANGED,
4380  CALLBACK_ID_SHAPE_VISIBILITY_CHANGED,
4381  CALLBACK_ID_PRE_UPDATE,
4382  CALLBACK_ID_POST_UPDATE,
4383  CALLBACK_ID_DONE_SPEAKING,
4384  CALLBACK_ID_GAZE_STATUS,
4385  CALLBACK_ID_LPOINT_STATUS,
4386  CALLBACK_ID_SHOW,
4387  CALLBACK_ID_HIDE,
4388  CALLBACK_ID_PRE_DIE,
4389  CALLBACK_ID_POST_DIE,
4390  CALLBACK_ID_PRE_FIRE_WEAPON,
4391  CALLBACK_ID_POST_FIRE_WEAPON,
4392  CALLBACK_ID_IMPACT,
4393  CALLBACK_ID_FIRE_WEAPON_SUCCESS,
4394  CALLBACK_ID_CURRENT_ACTION_CHANGED,
4395  CALLBACK_ID_DESIRED_ACTION_CHANGED,
4396  CALLBACK_ID_DESIRED_ACTION_REACHED,
4397  CALLBACK_ID_MANUALLY_INVOKED,
4398  CALLBACK_ID_USER_SELECTED,
4399  CALLBACK_ID_USER_UNSELECTED,
4400  CALLBACK_ID_IGUY_INTERACT,
4401  CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT,
4402  CALLBACK_ID_GUIDE_POSITION_ACQUIRED,
4403  CALLBACK_ID_GUIDE_POSITION_UNACQUIRED,
4404  CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED,
4405  CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED,
4406  CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED,
4407  CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED,
4408  CALLBACK_ID_GUIDE_TARGET_LOST,
4409  CALLBACK_ID_CURRENT_TOUT_REACHED,
4410  CALLBACK_ID_POST_CREATE_GEOMETRY,
4411  CALLBACK_ID_PRE_DESTROY_GEOMETRY,
4412  CALLBACK_ID_END_OF_PATH_REACHED,
4413  CALLBACK_ID_CHARACTER_CLICKED,
4414 
4415  // DI-Guy Scenario UI callbacks:
4416  CALLBACK_ID_UI_PRE_TRANSLATION,
4417  CALLBACK_ID_UI_POST_TRANSLATION,
4418  CALLBACK_ID_UI_MOUSE_DOWN,
4419  CALLBACK_ID_UI_MOUSE_UP,
4420  CALLBACK_ID_UI_RIGHT_MOUSE_DOWN,
4421  CALLBACK_ID_UI_RIGHT_MOUSE_UP,
4422  CALLBACK_ID_UI_LEFT_CLICK,
4423  CALLBACK_ID_UI_RIGHT_CLICK,
4424  CALLBACK_ID_UI_DOUBLE_CLICK,
4425  CALLBACK_ID_UI_MIDDLE_CLICK,
4426  CALLBACK_ID_UI_SCROLL_UP,
4427  CALLBACK_ID_UI_SCROLL_DOWN,
4428  //CALLBACK_ID_UI_DRAG,
4429 
4430  // DI-Guy AI agent callbacks:
4431  CALLBACK_ID_AGENT_NEW_BEHAVIOR,
4432  CALLBACK_ID_AGENT_NEW_PATH_SHAPE,
4433  CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER,
4434  CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS,
4435  CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS,
4436  CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED,
4437  CALLBACK_ID_AGENT_PURSUE_TARGET_LOST,
4438  CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED,
4439  CALLBACK_ID_AGENT_MINGLE_TARGET_LOST,
4440  CALLBACK_ID_AGENT_WANDER_TARGET_REACHED,
4441  CALLBACK_ID_AGENT_WANDER_TARGET_LOST,
4442  CALLBACK_ID_AGENT_FLEE_AREA_LEFT,
4443  CALLBACK_ID_AGENT_FLEE_AREA_ENTERED,
4444  CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED,
4445  CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED,
4446  CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED,
4447  CALLBACK_ID_AGENT_TRAVEL_NEAR_FORWARD_DEST,
4448  CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED,
4449  CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT,
4450  CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT,
4451  CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED,
4452  CALLBACK_ID_AGENT_VEHICLE_COLLISION,
4453  CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION,
4454  CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED,
4455  CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED,
4456  CALLBACK_ID_AGENT_NON_ZERO_REPULSION,
4457  CALLBACK_ID_AGENT_ZERO_REPULSION
4458  };
4459 
4460 #ifdef CPLUSPLUS_ONLY
4461 /*****************************************************************************/
4467  /*l
4468  *b Description:
4469  **
4470  ** This function adds a user callback. Callbacks can be removed
4471  ** with remove_callback() or remove_callback_with_user_data().
4472  **
4473  *b Arguments:
4474  **
4475  *a callback - pointer to function with prototype
4476  *a diguyCharacterCallback (typedefed above)
4477  *a callback_id - integer id of when this callback is to be called
4478  *a callback_params - not currently used; pass NULL
4479  *a callback_user_data - pointer for user's own use; DI-Guy will
4480  *a do nothing to the contents of this pointer
4481  *a beyond passing it back when the callback is
4482  *a invoked
4483  **
4484  *b Returns:
4485  **
4486  ** 0 on success, -1 on failure
4487  */
4488  int add_callback(int callback_id,
4489  diguyCharacterCallback* callback,
4490  void* callback_params = 0,
4491  void* callback_user_data = 0);
4492 
4493  /*l
4494  *b Description:
4495  **
4496  ** This function removes a user callback. All callbacks matching
4497  ** the specified callback_id and callback function will be removed.
4498  **
4499  *b Arguments:
4500  **
4501  *a callback_id - integer id of when this callback is to be called
4502  *a callback - pointer to function with prototype
4503  *a diguyCharacterCallback (typedefed above)
4504  **
4505  *b Returns:
4506  **
4507  ** 0 on success, -1 on failure
4508  */
4509  int remove_callback(int callback_id,
4510  diguyCharacterCallback* callback);
4511 
4512  /*l
4513  *b Description:
4514  **
4515  ** This function removes a user callback. All callbacks matching
4516  ** the specified callback_id and callback_user_data pointer will
4517  ** be removed.
4518  **
4519  *b Arguments:
4520  **
4521  *a callback_id - integer id of when this callback is to be
4522  *a called
4523  *a callback_user_data - pointer for user's own use
4524  **
4525  *b Returns:
4526  **
4527  ** 0 on success, -1 on failure
4528  */
4529  int remove_callback_with_user_data(int callback_id,
4530  void* callback_user_data);
4531 
4532 #endif
4533 /*****************************************************************************/
4539  /*l
4540  *b Description:
4541  **
4542  ** This function adds a user callback script. Callback scripts can
4543  ** be removed with remove_callback_script().
4544  **
4545  *b Arguments:
4546  **
4547  *a callback_id - integer id of the callback
4548  *a callback_script - script text of callback to be added
4549  *a callback_script_type - the type of script contained in
4550  *a callback_script
4551  **
4552  ** If NULL is passed for callback_script_type, a default script type
4553  ** will be derived based on the default script interpreter of the
4554  ** scenario.
4555  **
4556  *i lua specific:
4557  **
4558  ** When the script is called, the object for which it is being called
4559  ** will be in the callback_object global.
4560  **
4561  ** To pass NULL when calling from a lua script, use nil.
4562  **
4563  *b Returns:
4564  **
4565  ** 0 on success, -1 on failure
4566  **
4567  *b Lua Example:
4568  **
4569  *e -------------------------------------------------------------------
4570  *e local pre_fire_weapon_callback = [[
4571  *e
4572  *e local ch_name = callback_object:get_name();
4573  *e bdi_log_print(BDI_LOG_WARN, "Calling pre_fire_weapon_callback for character ".. ch_name .. ".\n");
4574  *e
4575  *e ]]
4576  *e -------------------------------------------------------------------
4577  *e
4578  *e character:add_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4579  *e pre_fire_weapon_callback,
4580  *e "lua");
4581  */
4582  int add_callback_script(int callback_id,
4583  const char* callback_script,
4584  const char* callback_script_type = NULL);
4585 
4586  /*l
4587  *b Description:
4588  **
4589  ** This function removes a user callback script previously added with
4590  ** add_callback_script().
4591  **
4592  *b Arguments:
4593  **
4594  *a callback_id - integer id of the callback
4595  *a callback_script - script text of callback previously added
4596  *a callback_script_type - the type of script contained in
4597  *a callback_script
4598  **
4599  ** If NULL is passed for callback_script, all callback
4600  ** scripts whose ids match callback_id and whose types match
4601  ** callback_script_type will be removed.
4602  **
4603  ** If NULL is passed for callback_script_type, a default script type
4604  ** will be derived based on the default script interpreter of the
4605  ** scenario.
4606  **
4607  *i lua specific:
4608  **
4609  ** To pass NULL when calling from a lua script, use nil.
4610  **
4611  *b Returns:
4612  **
4613  ** 0 on success, -1 on failure
4614  **
4615  *b lua Example:
4616  **
4617  *e #
4618  *e # Remove all callback scripts with id
4619  *e # diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON
4620  *e #
4621  *e character:remove_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4622  *e nil,
4623  *e "lua");
4624  */
4625  int remove_callback_script(int callback_id,
4626  const char* callback_script,
4627  const char* callback_script_type = NULL);
4628 
4629 
4630 /*****************************************************************************/
4640  /*l
4641  *b Description:
4642  **
4643  ** This function maps the event handler with the given name
4644  ** to a callback id. This mapping will be saved in the .dss
4645  ** file and restored when the .dss file is loaded.
4646  **
4647  ** Mappings can also be made via the DI-Guy Scenario UI.
4648  **
4649  ** The event handler is one of the following:
4650  **
4651  *- - a character callback function registered by
4652  *- diguyScenario::register_character_event_handler() or
4653  *- diguyScenario::register_character_event_handler_from_library()
4654  *- - a script registered by
4655  *- diguyScenario::register_character_event_handler_script()
4656  *- - a Script, Decision, or Library Function in the scenario
4657  *- whose "Event Type" is "Character"
4658  **
4659  *b Arguments:
4660  **
4661  *a callback_id - integer id of callback
4662  *a handler_name - name of the event handler to map
4663  **
4664  *b Returns:
4665  **
4666  ** 0 on success, -1 on failure
4667  */
4668  int map_event_handler_to_callback_id(int callback_id,
4669  const char* handler_name);
4670 
4671  /*l
4672  *b Description:
4673  **
4674  ** This function unmaps the event handler with the given name
4675  ** from a callback id.
4676  **
4677  *b Arguments:
4678  **
4679  *a callback_id - integer id of callback
4680  *a handler_name - name of the event handler to unmap
4681  *a unmap_all_matches - pass 0 to unmap only the first match,
4682  *a pass 1 to unmap all matches
4683  **
4684  *b Returns:
4685  **
4686  ** 0 on success, -1 on failure
4687  */
4688  int unmap_event_handler_from_callback_id(int callback_id,
4689  const char* handler_name,
4690  int unmap_all_matches = 0);
4691 
4692  /*l
4693  *b Description:
4694  **
4695  ** This function manually invokes the named character event
4696  ** handler. The callback_id that will be passed to the event
4697  ** handler will be CALLBACK_ID_MANUALLY_INVOKED.
4698  **
4699  ** See diguyCharacter::map_event_handler_to_callback_id() for
4700  ** a description of what comprises a character event handler.
4701  **
4702  ** Note that care should be taken not to end up in an
4703  ** infinite loop of event calls. In general an event handler
4704  ** should not end up directly or indirectly invoking itself.
4705  **
4706  *b Arguments:
4707  **
4708  *a handler_name - name of the event handler to invoke
4709  **
4710  *b Returns:
4711  **
4712  ** DIGUY_CALLBACK_CONTINUE or DIGUY_CALLBACK_STOP
4713  **
4714  *b Available as Decision Bead/Event
4715  */
4716  diguyCallbackReturn manually_invoke_event_handler(const char* handler_name);
4717 
4718 
4719 /*****************************************************************************/
4725  /*l
4726  *b Description:
4727  **
4728  ** This function creates a new path. The created path has no
4729  ** waypoints and no actions. Waypoints can be added using
4730  ** diguyCharacterPath::create_waypoint() or
4731  ** diguyCharacterPath::add_waypoint(). Action beads should be added
4732  ** using diguyCharacterPath::create_action_bead().
4733  **
4734  ** To create a simple path that has a few waypoints and actions, use
4735  ** create_simple_path().
4736  **
4737  ** The waypoints for the path should be created using the function
4738  ** diguyScenario::create_waypoint(). They should be deleted using the
4739  ** function diguyScenario::destroy_waypoint(). Copies of the
4740  ** waypoints are made during the function call, so it is safe to
4741  ** destroy them immediately after this function call returns, or use
4742  ** the waypoints again for another path.
4743  **
4744  ** The returned diguyCharacterPath pointer should be destroyed using
4745  ** destroy_path().
4746  **
4747  *b Arguments:
4748  **
4749  ** The path makes internal copies of all arguments.
4750  **
4751  *a name - name of the new path
4752  **
4753  *b Returns:
4754  **
4755  ** pointer to type diguyCharacterPath
4756  **
4757  */
4758  diguyCharacterPath* create_path(const char* name);
4759 
4760  /*l
4761  *b Description:
4762  **
4763  ** This function creates a new simple path. The path is simple
4764  ** because it has only two waypoints and three specified actions.
4765  **
4766  ** The waypoints for the path should be created using the function
4767  ** diguyScenario::create_waypoint(). They should be deleted using the
4768  ** function diguyScenario::destroy_waypoint(). Copies of the
4769  ** waypoints are made during the function call, so it is safe to
4770  ** destroy them immediately after this function call returns, or use
4771  ** the waypoints again for another path.
4772  **
4773  ** The returned diguyCharacterPath pointer should be destroyed using
4774  ** destroy_path().
4775  **
4776  *b Arguments:
4777  **
4778  ** The path makes internal copies of all arguments.
4779  **
4780  *a name - name of the new path
4781  *a waypoint0 - beginning waypoint
4782  *a waypoint1 - ending waypoint
4783  *a transition_from_action_name - name of the action the character
4784  *a should be transitioning from at the
4785  *a beginning of the path; can be NULL
4786  *a fill_action_name - name of the action that should fill
4787  *a the majority of the path; can be
4788  *a NULL, but see below
4789  *a transition_to_action_name - name of the action the character
4790  *a should transition into at the end of
4791  *a the path
4792  **
4793  ** If transition_from_action_name is NULL, an initial action bead that
4794  ** transitions to the fill action will not be created.
4795  **
4796  ** If fill_action_name is NULL, no action beads will be created for
4797  ** the path, even if transition_from_action_name and/or
4798  ** transition_to_action_name are non-NULL.
4799  **
4800  ** If transition_to_action_name is NULL, a final action bead that
4801  ** transitions from the fill action will not be created.
4802  **
4803  *b Returns:
4804  **
4805  ** pointer to type diguyCharacterPath
4806  */
4807  diguyCharacterPath* create_simple_path(const char* name,
4808  diguyWaypoint* waypoint0,
4809  diguyWaypoint* waypoint1,
4810  const char* transition_from_action_name,
4811  const char* fill_action_name,
4812  const char* transition_to_action_name);
4813 
4814  /*l
4815  *b Description:
4816  **
4817  ** This function is similar to create_simple_path(), but creates its
4818  ** waypoints based on waypoints from the passed path shape.
4819  **
4820  *b Arguments:
4821  **
4822  ** The path makes internal copies of all arguments.
4823  **
4824  *a name - name of the new path
4825  *a source_path_shape - path shape whose waypoints are used
4826  *a to define shape of new path
4827  *a transition_from_action_name - same as for create_simple_path()
4828  *a fill_action_name - same as for create_simple_path()
4829  *a transition_to_action_name - same as for create_simple_path()
4830  **
4831  *b Returns:
4832  **
4833  ** pointer to type diguyCharacterPath
4834  */
4835  diguyCharacterPath* create_path_from_path_shape(const char* name,
4836  diguyPathShape* source_path_shape,
4837  const char* transition_from_action_name,
4838  const char* fill_action_name,
4839  const char* transition_to_action_name);
4840 
4841  /*l
4842  *b Description:
4843  **
4844  ** This function creates a temporary path and immediately forces it as
4845  ** the character's current path. Once it has been traversed it will
4846  ** be automatically deleted.
4847  **
4848  ** The beginning waypoint of this path is at the character's current
4849  ** position; the ending waypoint is at the specified action bead on
4850  ** the specified path (or the first action bead of the specified path
4851  ** if no action bead is specified). The character will use the
4852  ** specified action to move from the beginning waypoint to the ending
4853  ** waypoint.
4854  **
4855  ** This function is useful for getting a free position mode character
4856  ** back onto a path.
4857  **
4858  ** This function will have no effect on a dead character (see
4859  ** die_now() and get_dead()).
4860  **
4861  *b Mode Effects:
4862  **
4863  *- - This function will put the character into path position mode.
4864  *- - This function will put the character into path action mode.
4865  **
4866  *b Arguments:
4867  **
4868  *a destination_path_name - the path the character is trying to
4869  *a reach
4870  *a via_action_name - the action used over the majority of
4871  *a the bridge path
4872  *a destination_path_action_bead_name - the target action bead on the
4873  *a destination path; pass NULL
4874  *a to start at the beginning
4875  *a of the path
4876  **
4877  *b Returns:
4878  **
4879  ** 0 on success, -1 on failure
4880  */
4881  int create_and_force_bridge_path(const char* destination_path_name,
4882  const char* destination_path_action_bead_name,
4883  const char* via_action_name);
4884 
4885  /*l
4886  *b Description:
4887  **
4888  ** This function creates a temporary path and immediately forces it as
4889  ** the character's current path. Once the path has been traversed it
4890  ** will be automatically deleted. The character then begins the local
4891  ** path specified by path_to_push.
4892  **
4893  ** The beginning waypoint of this path is at the character's current
4894  ** position; the ending waypoint is at the specified x, y, z. A
4895  ** path_offset is available to shorten the distance to the end point
4896  ** along the vector to the destination. The character will use the
4897  ** specified action to move from the beginning waypoint to the ending
4898  ** waypoint.
4899  **
4900  ** An optional follow-on path can be specified that the character will
4901  ** move onto once the end position is reached. This must be the name
4902  ** of an existing path for the character. A local path copy of the
4903  ** specified path will be created, and will be pushed to occur after
4904  ** this bridge path completes.
4905  **
4906  ** This function is useful for branching from one location to another
4907  ** in the world.
4908  **
4909  ** This function will have no effect on a dead character (see
4910  ** die_now() and get_dead()).
4911  **
4912  *b Mode Effects:
4913  **
4914  *- - This function will put the character into path position mode.
4915  *- - This function will put the character into path action mode.
4916  **
4917  *b Arguments:
4918  **
4919  *a x, y, z - location in world space the bridge path
4920  *a should aim for
4921  *a path_offset - the amount to shorten the bridge path
4922  *a via_action_name - the action used over the majority of the
4923  *a bridge path
4924  *a next_local_path - local path to push when the character
4925  *a arrives at it's destination; pass NULL
4926  *a to not push a local path
4927  *a orientation - amount to rotate the local path
4928  **
4929  *b Returns:
4930  **
4931  ** 0 on success, -1 on failure
4932  */
4933  int create_and_force_bridge_path_to_point(float x, float y, float z,
4934  float path_offset,
4935  const char* via_action_name,
4936  const char* next_local_path = NULL,
4937  float orientation = 0.0f);
4938 
4939  /*l
4940  *b Description:
4941  **
4942  ** This function destroys a path created by create_path(),
4943  ** create_simple_path(), or a path from a loaded scenario.
4944  **
4945  ** The path the character is currently traveling, as returned by
4946  ** get_current_traveled_path(), cannot be destroyed. Attempting to
4947  ** destroy it will result in an error.
4948  **
4949  *b Arguments:
4950  **
4951  *a path - path to be destroyed
4952  **
4953  *b Returns:
4954  **
4955  ** 0 on success, -1 on failure
4956  */
4957  int destroy_path(diguyCharacterPath* path);
4958 
4959  /*l
4960  *b Returns:
4961  **
4962  ** the number of paths belonging to this character
4963  */
4964  int get_num_paths();
4965 
4966  /*l
4967  *b Returns:
4968  **
4969  ** pointer of type diguyCharacterPath; NULL if no
4970  ** path at the specified index
4971  **
4972  *b Arguments:
4973  **
4974  *a index - index of the path; indices start at 0
4975  */
4976  diguyCharacterPath* get_path_at_index(int index);
4977 
4978  /*l
4979  *b Returns:
4980  **
4981  ** the name of the path at the given index; NULL if no
4982  ** path at the specified index
4983  */
4984  const char* get_path_name_at_index(int index);
4985 
4986  /*l
4987  *b Description:
4988  **
4989  ** This function returns the index of the path the character
4990  ** is currently following. If the character is not following
4991  ** a path the returned index will be -1. (i.e., the character
4992  ** must be in path action mode *and* path position mode.)
4993  **
4994  *b Mode Restrictions:
4995  **
4996  *- - This function will only return a 0 or greater index if the
4997  ** character is in path action mode *and* path position mode.
4998  **
4999  *b Returns:
5000  **
5001  ** the index of the current path; -1 if not on a path
5002  */
5003  int get_current_path_index();
5004 
5005  /*l
5006  *b Description:
5007  **
5008  ** This function returns the path the character is currently
5009  ** traveling.
5010  **
5011  *b Mode Restrictions:
5012  **
5013  *- - This function can only be called in path position mode.
5014  **
5015  *b Returns:
5016  **
5017  ** pointer of type diguyCharacterPath; NULL if no path is currently
5018  ** being traveled
5019  */
5020  diguyCharacterPath* get_current_traveled_path();
5021 
5022  /*l
5023  *b Description:
5024  **
5025  ** This function can be used to see if the current traveled has the
5026  ** passed name. This is primarily useful for decisions and other
5027  ** limited logic applications.
5028  **
5029  *b Returns:
5030  **
5031  ** 1 if currently traveled path has the passed name; 0 if the name
5032  ** doesn't match, or no path is currently being traveled
5033  **
5034  *b Available as Decision Bead/Event
5035  */
5036  int get_current_traveled_path_is(const char* path_name);
5037 
5038  /*l
5039  *b Description:
5040  **
5041  ** This function pushes the path with the specified name
5042  ** onto the queue of paths this character will follow.
5043  **
5044  ** This function will have no effect on a dead character (see
5045  ** die_now() and get_dead()).
5046  **
5047  *b Arguments:
5048  **
5049  *a name - name of the path to be pushed
5050  **
5051  *b Returns:
5052  **
5053  ** 0 on success, -1 on failure
5054  **
5055  *b Available as Decision Bead/Event
5056  */
5057  int push_path(const char* path_name);
5058 
5059  /*l
5060  *b Description:
5061  **
5062  ** This function clears the queue of paths the character will follow
5063  ** and then pushes the path with the specified name.
5064  **
5065  ** This function will have no effect on a dead character (see
5066  ** die_now() and get_dead()).
5067  **
5068  *b Arguments:
5069  **
5070  *a name - name of the path to be pushed
5071  *a max_rampdown_interval - max amount of time spent trying to
5072  *a smooth over any motion seams; set
5073  *a to 0.5 for a smooth transition, set
5074  *a to 0 for a potentially rough transition
5075  **
5076  *b Returns:
5077  **
5078  ** 0 on success, -1 on failure
5079  **
5080  *b Available as Decision Bead/Event
5081  */
5082  int force_path(const char* path_name,
5083  float max_rampdown_interval = 0.5f);
5084 
5085  /*l
5086  *b Description:
5087  **
5088  ** Same as force_path(), but only motions at or after the specified
5089  ** action bead are added.
5090  **
5091  ** This function will have no effect on a dead character (see
5092  ** die_now() and get_dead()).
5093  **
5094  *b Available as Decision Bead/Event
5095  */
5096  int force_partial_path(const char* path_name,
5097  const char* beginning_action_bead_name,
5098  float max_rampdown_interval = 0.5f);
5099 
5100  /*l
5101  *b Description:
5102  **
5103  ** Resumes a path that was interrupted with a call such as
5104  ** set_desired_action() or force_action(). Note that the
5105  ** retain_path_shape argument to these functions must have been 1 for
5106  ** the path to be resumable.
5107  **
5108  ** This function will have no effect on a dead character (see
5109  ** die_now() and get_dead()).
5110  **
5111  *b Mode Restrictions:
5112  **
5113  *- - This function can only be called if the character is in
5114  *- free action mode *and* path position mode.
5115  **
5116  *b Mode Effects:
5117  **
5118  *- - This function will put the character into path position mode.
5119  *- - This function will put the character into path action mode.
5120  **
5121  *b Arguments:
5122  **
5123  *a max_rampdown_interval - max amount of time spent trying to
5124  *a smooth over any motion seams; set
5125  *a to 0.5 for a smooth transition, set
5126  *a to 0 for a potentially rough transition
5127  **
5128  *b Returns:
5129  **
5130  ** 0 on success, -1 on failure
5131  **
5132  *b Available as Decision Bead/Event
5133  */
5134  int resume_interrupted_path(float max_rampdown_interval = 0.5f);
5135 
5136  /*l
5137  *b Description:
5138  **
5139  ** This function creates a temporary path that is a copy of path_name
5140  ** but transformed so that the starting point is the same as where
5141  ** the character currently is. It then forces it as the character's
5142  ** current path.
5143  **
5144  *b Arguments:
5145  **
5146  *a path_name - path to copy
5147  *a use_character_orientation - whether the character's orientation be
5148  *a incorporated into the transform of the
5149  *a path
5150  *a rotation - additional amount to rotate the path,
5151  *a in degrees
5152  *a clamp_path - whether the path be ground clamped
5153  **
5154  *b Returns:
5155  **
5156  ** pointer to type diguyCharacterPath
5157  */
5158  diguyCharacterPath* force_local_path(const char* path_name,
5159  int use_character_orientation,
5160  float rotation = 0.0f,
5161  int clamp_path = 1);
5162 
5163  /*l
5164  *b Description:
5165  **
5166  ** This function sets which path the character will start on when the
5167  ** scenario is reset.
5168  **
5169  *b Arguments:
5170  **
5171  *a name - name of the path that will be the initial path
5172  **
5173  *b Returns:
5174  **
5175  ** 0 on success, -1 on failure
5176  */
5177  int set_initial_path(const char* name);
5178 
5179  /*l
5180  *b Description:
5181  **
5182  ** This function returns the name of the path the character will start
5183  ** on when the scenario is reset.
5184  **
5185  ** See set_initial_path().
5186  **
5187  *b Returns:
5188  **
5189  ** name of initial path; NULL if there is none
5190  */
5191  const char* get_initial_path();
5192 
5193  /*l
5194  *b Description:
5195  **
5196  ** This function translates all of the paths of this character.
5197  **
5198  *b Arguments:
5199  **
5200  *a tx, ty, tz - distance in meters to move all waypoints
5201  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5202  */
5203  void translate_all_paths(float tx, float ty, float tz,
5204  int reclamp_waypoints = 1);
5205 
5206  /*l
5207  *b Description:
5208  **
5209  ** This function rotates all of the paths of this character.
5210  ** The rotation will occur about the specified point.
5211  **
5212  ** *Note:* It is currently recommended that only rotations
5213  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5214  **
5215  *b Arguments:
5216  **
5217  *a rz, rx, ry - amount of rotation, in degrees
5218  *a rotation_pt_x, rotation_pt_y, rotation_pt_z - point around
5219  *a which rotation should occur
5220  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5221  */
5222  int rotate_all_paths_about_point(float rz, float rx, float ry,
5223  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z,
5224  int reclamp_waypoints = 1);
5225 
5226  /*l
5227  *b Description:
5228  **
5229  ** This function is similar to rotate_all_paths_about_point(),
5230  ** but rotates around the character's current waypoint instead
5231  ** of an explicitly specified point.
5232  **
5233  ** *Note:* It is currently recommended that only rotations
5234  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5235  **
5236  *b Arguments:
5237  **
5238  *a rz, rx, ry - amount of rotation, in degrees
5239  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5240  */
5241  int rotate_all_paths_about_current_waypoint(float rz, float rx, float ry,
5242  int reclamp_waypoints = 1);
5243 
5244  /*l
5245  *b Description:
5246  **
5247  ** This function causes the character to jump forward along
5248  ** its current path to the specified action bead. Motions
5249  ** and beads that would have otherwise been played or processed
5250  ** will be skipped.
5251  **
5252  *b Arguments:
5253  **
5254  *a bead_name - name of the bead to jump to
5255  *a max_rampdown_interval - max amount of time spent trying to
5256  *a smooth over any motion seams; set
5257  *a to 0.5 for a smooth transition, set
5258  *a to 0 for a potentially rough transition
5259  **
5260  *b Returns:
5261  **
5262  ** 0 on success, -1 on failure
5263  */
5264  int jump_to_action_bead(const char* bead_name,
5265  float max_rampdown_interval = 0.5f);
5266 
5267  /*l
5268  *b Description:
5269  **
5270  ** This function finds and returns a pointer to the specified path.
5271  **
5272  *b Arguments:
5273  **
5274  *a name - name of the path to be found
5275  **
5276  *b Returns:
5277  **
5278  ** Pointer to object of type diguyCharacterPath;
5279  ** NULL if path not found.
5280  */
5281  diguyCharacterPath* find_path(const char* path_name);
5282 
5283  /*l
5284  *b Description:
5285  **
5286  ** This function causes the effects of the given aim bead to be
5287  ** applied to this character, regardless of whether the
5288  ** bead belongs to the character or whether character is within
5289  ** the bead's time interval.
5290  **
5291  *b Arguments:
5292  **
5293  *a how_far - how far into the bead the call should be; should
5294  *a be between 0 (beginning of bead time interval) and
5295  *a 1 (end of bead time interval)
5296  **
5297  *b Returns:
5298  **
5299  ** 0 on success, -1 on failure
5300  */
5301  int apply_aim_bead(diguyCharacterPathAimBead* bead,
5302  float how_far = 0.0f);
5303 
5304  /*l
5305  *b Description:
5306  **
5307  ** This function causes the effects of the given decision bead to be
5308  ** applied to this character, regardless of whether the
5309  ** bead belongs to the character or whether character is within
5310  ** the bead's time interval.
5311  **
5312  *b Arguments:
5313  **
5314  *a how_far - how far into the bead the call should be; should
5315  *a be between 0 (beginning of bead time interval) and
5316  *a 1 (end of bead time interval)
5317  **
5318  *b Returns:
5319  **
5320  ** 0 on success, -1 on failure
5321  */
5322  int apply_decision_bead(diguyCharacterPathDecisionBead* bead,
5323  float how_far = 0.0f);
5324 
5325  /*l
5326  *b Description:
5327  **
5328  ** This function causes the effects of the given gaze bead to be
5329  ** applied to this character, regardless of whether the
5330  ** bead belongs to the character or whether character is within
5331  ** the bead's time interval.
5332  **
5333  *b Arguments:
5334  **
5335  *a how_far - how far into the bead the call should be; should
5336  *a be between 0 (beginning of bead time interval) and
5337  *a 1 (end of bead time interval)
5338  **
5339  *b Returns:
5340  **
5341  ** 0 on success, -1 on failure
5342  */
5343  int apply_gaze_bead(diguyCharacterPathGazeBead* bead,
5344  float how_far = 0.0f);
5345 
5346  /*l
5347  *b Description:
5348  **
5349  ** This function causes the effects of the given script bead to be
5350  ** applied to this character, regardless of whether the
5351  ** bead belongs to the character or whether character is within
5352  ** the bead's time interval.
5353  **
5354  *b Arguments:
5355  **
5356  *a how_far - how far into the bead the call should be; should
5357  *a be between 0 (beginning of bead time interval) and
5358  *a 1 (end of bead time interval)
5359  **
5360  *b Returns:
5361  **
5362  ** 0 on success, -1 on failure
5363  */
5364  int apply_script_bead(diguyCharacterPathScriptBead* bead,
5365  float how_far = 0.0f);
5366 
5367  /*l
5368  *b Description:
5369  **
5370  ** This function sets how far along the current path shape
5371  ** the character will be.
5372  **
5373  *b Mode Restrictions:
5374  **
5375  *- - This function can only be called if the character is in
5376  *- free action mode *and* path position mode. i.e., the
5377  *- character is following a path shape, and is not on a
5378  *- diguyCharacterPath.
5379  **
5380  *b Arguments:
5381  **
5382  *a distance - distance in meters; 0.0 is the beginning of the
5383  *a path shape
5384  **
5385  *b Returns:
5386  **
5387  ** 0 on success, -1 on failure
5388  */
5389  int set_distance_along_path(float distance);
5390 
5391  /*l
5392  *b Returns:
5393  **
5394  ** the distance in meters along the path shape; see
5395  ** set_distance_along_path()
5396  **
5397  *b Mode Restrictions:
5398  **
5399  *- - This function can only be called in path position mode.
5400  */
5401  float get_distance_along_path();
5402 
5403  /*l
5404  *b Description:
5405  **
5406  ** This function takes the character off of its current path
5407  ** or path shape.
5408  **
5409  *b Mode Restrictions:
5410  **
5411  *- - This function can only be called in path position mode.
5412  **
5413  *b Mode Effects:
5414  **
5415  *- - This function will put the character into free position mode.
5416  *- - This function will put the character into free action mode.
5417  **
5418  *b Returns:
5419  **
5420  ** 0 on success, -1 on failure
5421  */
5422  int leave_path();
5423 
5424  /*l
5425  *b Description:
5426  **
5427  ** This function returns the index of the nearest waypoint in a path,
5428  ** the path argument is looked up in both the character's path list
5429  ** and the scenario's paths.
5430  **
5431  *b Returns:
5432  **
5433  ** waypoint index
5434  */
5435  int get_nearest_waypoint_index_in_path(const char* path_name);
5436 
5437  /*l
5438  *b Returns:
5439  **
5440  ** Distance to action bead or first waypoint, 100000000.0 on failure
5441  */
5442  float get_distance_to_path(const char* path_name,
5443  const char* action_bead_name = NULL);
5444 
5445 
5446 /*****************************************************************************/
5454  /*l
5455  *b Description:
5456  **
5457  ** This function gets the position link of the character skeleton.
5458  ** The rest of the skeleton can then be traversed by recursively
5459  ** calling the diguyGraphicsLink::get_num_child_links() and
5460  ** diguyGraphicsLink::get_child_link_at_index() functions.
5461  **
5462  ** Alternatively, the links of the character can be traversed
5463  ** by calling the get_num_links() and get_link_at_index()
5464  ** functions below.
5465  **
5466  *b Returns:
5467  **
5468  ** pointer of type diguyGraphicsLink; NULL if there is no
5469  ** position link
5470  */
5471  diguyGraphicsLink* get_position_link();
5472 
5473  /*l
5474  *b Returns:
5475  **
5476  ** number of links on this character
5477  */
5478  int get_num_links();
5479 
5480  /*l
5481  *b Returns:
5482  **
5483  ** pointer of type diguyGraphicsLink; NULL if no
5484  ** link at the specified index
5485  **
5486  *b Arguments:
5487  **
5488  *a index - index of the link; indices start at 0
5489  */
5490  diguyGraphicsLink* get_link_at_index(int index);
5491 
5492  /*l
5493  *b Description:
5494  **
5495  ** This function returns a pointer to the specified link.
5496  **
5497  *b Arguments:
5498  **
5499  *a name - name of link to be found
5500  **
5501  *b Returns:
5502  **
5503  ** pointer of type diguyGraphicsLink; NULL if not found
5504  */
5505  diguyGraphicsLink* find_link(const char* name);
5506 
5507  /*l
5508  *b Returns:
5509  **
5510  ** the string identifying the link at the given index
5511  **
5512  *b Arguments:
5513  **
5514  *a link_index - index of the link; indices start at 0
5515  */
5516  const char* get_link_name_at_index(int link_index);
5517 
5518  /*l
5519  *b Returns:
5520  **
5521  ** the number of shapes on the specified link
5522  **
5523  *b Arguments:
5524  **
5525  *a link_name - name of the link
5526  */
5527  int get_num_link_shapes(const char* link_name);
5528 
5529  /*l
5530  *b Returns:
5531  **
5532  ** the name of the shape at the specified index on the link
5533  **
5534  *b Arguments:
5535  **
5536  *a link_name - name of the link
5537  *a shape_index - index of the shape on the link; indices start at 0
5538  */
5539  const char* get_link_shape_name_at_index(const char* link_name,
5540  int shape_index);
5541 
5543  int get_num_connection_points();
5544 
5547  const char * get_connection_point_name_at_index(int index);
5548 
5551  int get_num_connection_points_with_type(diguyConnectionPointType type);
5552 
5555  const char * get_connection_point_name_with_type(diguyConnectionPointType type, int index);
5556 
5558  void set_link_visibility(const char* link_or_connection_name, int visible, int shape_index = -1);
5559 
5560 /*****************************************************************************/
5569  diguyLinkController * get_link_controller(const char * link_name);
5572 
5575  int set_link_translation_override(const char * link_name, float x, float y, float z, float ramp_time = .25f);
5576 
5579  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);
5580 
5582  int end_link_translation_override(const char * link_name, float ramp_time = .25f);
5583 
5585  int set_link_rotation_override(const char * link_name, float rz, float rx, float ry, float ramp_time = .25f);
5586  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);
5587 
5589  int end_link_rotation_override(const char * link_name, float ramp_time = .25f);
5590 
5591 
5592 /*****************************************************************************/
5601  int get_num_articulated_parts();
5603 
5605  const char * get_articulated_part_link_name(int index);
5606 
5608  int get_articulated_part_id(int index);
5609 
5611  const char * map_articulated_part_id_to_link(int id);
5612 
5613 
5614 /*****************************************************************************/
5636 #ifdef CPLUSPLUS_ONLY
5637 
5638  /*l
5639  *b Description:
5640  **
5641  ** The following prototype should be used for the altitude
5642  ** function:
5643  **
5644  *e float altitude_func(diguyCharacter* character,
5645  *e float x,
5646  *e float y,
5647  *e float old_z);
5648  **
5649  ** When a character needs new altitude info, DI-Guy calls this
5650  ** function with a pointer to the diguyCharacter in question,
5651  ** the character's current (x, y) coordinates, and its previous
5652  ** altitude in old_z.
5653  **
5654  ** The altitude function should then compute and return the new
5655  ** altitude based on this information. This can be done in a
5656  ** number of ways; a typical approach is to do an intersection
5657  ** test with the visual scene. Some users might want to implement
5658  ** fairly complex behavior, such as attempting to make all four
5659  ** wheels of a vehicle touch the terrain, or causing a character
5660  ** to drift slowly towards the ground.
5661  **
5662  ** A default altitude function that should be set for all
5663  ** characters can be set by calling
5664  ** diguyScenario::set_default_character_altitude_function().
5665  **
5666  ** This function is normally called for all characters if the flags
5667  ** for enabling it in free movement or path-following mode are
5668  ** set (see below). Some character systems, such as certain kinds
5669  ** of vehicle control code, will also use the scenario altitude
5670  ** function.
5671  **
5672  *b Callable From:
5673  **
5674  *- - C++
5675  */
5676  int set_altitude_function(diguyAltitudeFunction* altitude_function);
5677 
5678  /*l
5679  *b Returns:
5680  **
5681  ** current altitude function; see set_altitude_function()
5682  **
5683  *b Callable From:
5684  **
5685  *- - C++
5686  */
5687  diguyAltitudeFunction* get_altitude_function();
5688 
5689 #endif
5690 
5691  /*l
5692  *b Description:
5693  **
5694  ** This function sets whether the character's altitude function is
5695  ** enabled in free position mode. Altitude functions are set by the
5696  ** functions set_altitude_function() or
5697  ** diguyScenario::set_default_character_altitude_function().
5698  **
5699  *b Arguments:
5700  **
5701  *a enabled - pass 1 to enable, 0 to disable
5702  **
5703  *b Mode Effects:
5704  **
5705  *- - This function will not change the position mode.
5706  **
5707  *b Mode Restrictions:
5708  **
5709  *- - This function will only affect characters in free position mode.
5710  **
5711  *b Returns:
5712  **
5713  ** 0 on success, -1 on failure
5714  */
5715  int set_altitude_function_enabled_in_free_position_mode(int enabled);
5716 
5717  /*l
5718  *b Returns:
5719  **
5720  ** whether the character's altitude function is enabled in free
5721  ** position mode; see
5722  ** set_altitude_function_enabled_in_free_position_mode()
5723  */
5724  int get_altitude_function_enabled_in_free_position_mode();
5725 
5726  /*l
5727  *b Description:
5728  **
5729  ** This function sets whether the character's altitude function is
5730  ** enabled in path position mode. Altitude functions are set by
5731  ** the functions set_altitude_function() or
5732  ** diguyScenario::set_default_character_altitude_function().
5733  **
5734  *b Arguments:
5735  **
5736  *a enabled - pass 1 to enable, 0 to disable
5737  **
5738  *b Mode Effects:
5739  **
5740  *- - This function will not change the position mode.
5741  **
5742  *b Mode Restrictions:
5743  **
5744  *- - This function will only affect characters in path position mode.
5745  **
5746  *b Returns:
5747  **
5748  ** 0 on success, -1 on failure
5749  */
5750  int set_altitude_function_enabled_in_path_position_mode(int value);
5751 
5752  /*l
5753  *b Returns:
5754  **
5755  ** whether the character's altitude function is enabled in path
5756  ** position mode;
5757  ** see set_altitude_function_enabled_in_path_position_mode()
5758  */
5759  int get_altitude_function_enabled_in_path_position_mode();
5760 
5761  /*l
5762  *b Description
5763  **
5764  ** This function sets the altitude update rate of the character.
5765  **
5766  ** The default value for new characters is 100.
5767  **
5768  ** Note that characters that are load managed (get_is_load_managed()
5769  ** returns 1) have this parameter managed automatically. The
5770  ** corresponding function for load managed characters is
5771  ** diguyLoadManager::set_zone_altitude_update_rate().
5772  **
5773  *b Arguments:
5774  **
5775  *a update_rate - percentage of scenario ticks for which altitude
5776  *a should update; can be between 1 and 100
5777  **
5778  ** Passing 100 means altitude will update every tick.
5779  ** Passing 50 means altitude will update every other tick.
5780  **
5781  *b Returns:
5782  **
5783  ** 0 on success, -1 on failure
5784  */
5785  int set_altitude_update_rate(int update_rate);
5786 
5788  int get_altitude_update_rate();
5789 
5790  /*l
5791  *b Description
5792  **
5793  ** This function sets the altitude interpolation rate of the
5794  ** character. This function only has an effect if the character's
5795  ** altitude function is enabled.
5796  **
5797  ** When the altitude function determines that the character's Z
5798  ** position should be updated to bring it closer to the ground, the
5799  ** altitude interpolation rate determines how quickly the Z height
5800  ** is adjusted.
5801  **
5802  ** The default value is 10.
5803  **
5804  *b Arguments:
5805  **
5806  *a interpolation_rate - how much of the error will be made up
5807  *a each second
5808  **
5809  ** An interpolation_rate of 100 means that all error will be made
5810  ** up each frame.
5811  */
5812  void set_altitude_interpolation_rate(float interpolation_rate);
5813 
5815  float get_altitude_interpolation_rate();
5816 
5817 /*****************************************************************************/
5929  /*l
5930  *b Description:
5931  **
5932  ** Returns the number of variables in this character's pose array.
5933  ** See get_pose_in_radians() for an example of use.
5934  **
5935  *b Returns:
5936  **
5937  ** size of this character's pose array
5938  */
5939  int get_pose_array_size();
5940 
5941 #ifdef CPLUSPLUS_ONLY
5942 
5943  /*l
5944  *b Description:
5945  **
5946  ** Fills an array of floats with the character's current joint angles.
5947  ** Angles are expressed in radians. The size of the float array must
5948  ** be at least as large as that returned by get_pose_array_size().
5949  **
5950  *b Arguments:
5951  **
5952  *a pose_array - an array of floats
5953  **
5954  *b Returns:
5955  **
5956  ** 0 on success, -1 on failure
5957  **
5958  *b Callable From:
5959  **
5960  *- - C++
5961  **
5962  *b C++ Example:
5963  **
5964  *e diguyCharacter* ch = scenario->get_character_at_index(0);
5965  *e float* pose_array;
5966  *e
5967  *e // allocate a float array of the proper size
5968  *e int n = ch->get_pose_array_size();
5969  *e pose_array = new float[n];
5970  *e
5971  *e // get the pose array
5972  *e ch->get_pose_in_radians(pose_array);
5973  */
5974  int get_pose_in_radians(float* pose_array);
5975 
5977  int get_pose_in_quaternions(float* pose_array);
5978 
5979 #endif
5980 
5981  /*l
5982  *b Description:
5983  **
5984  ** Creates and returns a pose override object. The newly created
5985  ** pose override object is added to the character's previously
5986  ** created override objects, if any.
5987  **
5988  ** How the pose override interacts with other effects that affect
5989  ** the pose of the character depends on the override stage. See
5990  ** the section "Pose Override Stages" for a discussion of pose
5991  ** override stages.
5992  **
5993  *b Arguments:
5994  **
5995  *a override_stage - the stage in the DI-Guy motion engine at
5996  *a which the override should be applied
5997  **
5998  *b Returns:
5999  **
6000  ** object of type diguyCharacterPoseOverride
6001  */
6002  diguyCharacterPoseOverride* create_pose_override(int override_stage = 3);
6003 
6004  /*l
6005  *b Description:
6006  **
6007  ** Destroys a pose override object, ending its influence on the
6008  ** character.
6009  **
6010  *b Arguments:
6011  **
6012  *a po - pose override object to be destroyed
6013  **
6014  *b Returns:
6015  **
6016  ** 0 on success, -1 on failure
6017  */
6018  int destroy_pose_override(diguyCharacterPoseOverride* po);
6019 
6020  /*l
6021  *b Returns:
6022  **
6023  ** the number of pose overrides belonging to this character
6024  */
6025  int get_num_pose_overrides();
6026 
6027  /*l
6028  *b Returns:
6029  **
6030  ** pointer of type diguyCharacterPoseOverride; NULL if no
6031  ** pose override at the specified index
6032  **
6033  *b Arguments:
6034  **
6035  *a index - index of the pose override; indices start at 0
6036  */
6037  diguyCharacterPoseOverride* get_pose_override_at_index(int index);
6038 
6039  /*l
6040  *b Description:
6041  **
6042  ** Creates and returns a pose override object that completely
6043  ** overrides all other character pose operations, including motions,
6044  ** aiming, gazing, gestures, other pose overrides, etc. The values
6045  ** set in the complete pose override object will be the values used
6046  ** to animate the character.
6047  **
6048  ** Having only one thing that affects a character's pose allows for
6049  ** much faster updating of the character.
6050  **
6051  ** There can only be one complete pose override object per character.
6052  **
6053  ** To remove the complete pose override, call
6054  ** destroy_complete_pose_override().
6055  **
6056  *b Returns:
6057  **
6058  ** object of type diguyCharacterPoseOverride
6059  */
6060  diguyCharacterPoseOverride* create_complete_pose_override();
6061 
6062  /*l
6063  *b Description:
6064  **
6065  ** Removes and destroys the complete pose override created by
6066  ** create_complete_pose_override().
6067  */
6068  void destroy_complete_pose_override();
6069 
6070 
6071 /*****************************************************************************/
6077  /*l
6078  *b Description:
6079  **
6080  ** This function sets the current azimuth, elevation, and
6081  ** distance of the character's gaze. A fixed point in 3D space
6082  ** is then found using the two angles and the given distance
6083  ** from the DI-Guy coordinate system origin. Angles are
6084  ** given with respect to the DI-Guy coordinate system.
6085  **
6086  ** See set_position() for a description of the coordinate
6087  ** system.
6088  **
6089  ** Gazing will continue until end_gaze() is called.
6090  **
6091  ** This function will have no effect on a dead character (see
6092  ** die_now() and get_dead()).
6093  **
6094  *b Arguments:
6095  **
6096  *a azimuth - rotation in degrees about up (vertical) axis;
6097  *a positive rotates to character's left
6098  *a elevation - rotation in degrees about forward (horizontal) axis;
6099  *a positive rotates down
6100  *a distance - deprecated as of 13.2
6101  *a is_new_gaze - set to 1 if this is a new gaze;
6102  *a set to 0 if this is continuing an already started
6103  *a gaze
6104  **
6105  *b Returns:
6106  **
6107  ** 0 on success, -1 on failure
6108  */
6109  int gaze_at_angle(float azimuth,
6110  float elevation,
6111  float distance,
6112  int is_new_gaze = 1);
6113 
6114  /*l
6115  *b Description:
6116  **
6117  ** This function is identical to gaze_at_angle() except that it uses
6118  ** body local coordinates for the character. The angles
6119  ** are given with respect to the idealized position of the
6120  ** character. Use get_position() to learn the idealized position.
6121  ** The distance is between the idealized position of the character
6122  ** and the fixation point.
6123  **
6124  ** This function will have no effect on a dead character (see
6125  ** die_now() and get_dead()).
6126  ** distance argument - deprecated as of 13.2
6127  */
6128  int gaze_at_angle_local(float azimuth,
6129  float elevation,
6130  float distance = 10000.0f,
6131  int is_new_gaze = 1);
6132 
6133  /*l
6134  *b Description:
6135  **
6136  ** This function sets the current fixation point of the character's
6137  ** gaze. Point coordinates are given in meters in the DI-Guy
6138  ** global coordinate system. The function uses default gaze behavior
6139  ** settings. Gazing will continue until end_gaze() is called.
6140  **
6141  ** This function will have no effect on a dead character (see
6142  ** die_now() and get_dead()).
6143  **
6144  *b Arguments:
6145  **
6146  *a tx, ty, tz - position in meters from the DI-Guy global
6147  *a origin
6148  *a is_new_gaze - set to 1 if this is a new gaze;
6149  *a set to 0 if this is continuing an already started
6150  *a gaze
6151  **
6152  *b Returns:
6153  **
6154  ** 0 on success, -1 on failure
6155  */
6156  int gaze_at_point(float tx,
6157  float ty,
6158  float tz,
6159  int is_new_gaze = 1);
6160 
6161  /*l
6162  *b Description:
6163  **
6164  ** This function is identical to gaze_at_point() except that it uses
6165  ** body local coordinates for the character. Use get_position()
6166  ** to learn the idealized position of the character if necessary.
6167  **
6168  ** This function will have no effect on a dead character (see
6169  ** die_now() and get_dead()).
6170  */
6171  int gaze_at_point_local(float tx,
6172  float ty,
6173  float tz,
6174  int is_new_gaze = 1);
6175 
6176  /*l
6177  *b Description:
6178  **
6179  ** This function effectively does a gaze_at_point() each tick.
6180  ** The point to be gazed at is updated each tick to be the position
6181  ** of the specified link on the specified character.
6182  **
6183  ** This function will have no effect on a dead character (see
6184  ** die_now() and get_dead()).
6185  **
6186  *b Arguments:
6187  **
6188  *a target_character_name - name of the character to be
6189  *a gazed at
6190  *a target_character_link_name - link on the character that should
6191  *a be gazed at; pass NULL to gaze at
6192  *a the position link of the character
6193  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
6194  **
6195  *b Returns:
6196  **
6197  ** 0 on success, -1 on failure
6198  **
6199  *b Available as Decision Bead/Event
6200  **
6201  *b C++ Example:
6202  **
6203  *e // gaze at the head of character "soldier-1".
6204  *e ch->gaze_at_character("soldier-1",
6205  *e "cervical",
6206  *e 0.0,
6207  *e 0.0,
6208  *e 0.0);
6209  */
6210  int gaze_at_character(const char* target_character_name,
6211  const char* target_character_link_name = NULL,
6212  float offset_tx = 0.0f,
6213  float offset_ty = 0.0f,
6214  float offset_tz = 0.0f);
6215 
6216  /*l
6217  *b Returns:
6218  **
6219  ** 1 if the character is actively gazing, 0 if not
6220  */
6221  int get_gaze_is_active();
6222 
6223  /*l
6224  *b Returns:
6225  **
6226  ** the current gaze point relative to the DI-Guy
6227  ** global coordinate system
6228  */
6229  int get_gaze_point(float* x, float* y, float* z);
6230 
6231  /*l
6232  *b Description:
6233  **
6234  ** A gaze is acquired if the final link in the gaze link chain
6235  ** has fully oriented toward the gaze target, even if other
6236  ** links in the gaze chain are still moving.
6237  **
6238  ** If the gaze is acquired, but any links in the gaze chain
6239  ** are still moving, the gaze is considered acquired but not
6240  ** steady (see get_gaze_is_steady().) If all links have reached
6241  ** a relatively steady state, the gaze is considered acquired
6242  ** and steady.
6243  **
6244  ** If either the acquired or steady status of a gaze has changed
6245  ** (e.g., was acquired but now is not, or was steady but now
6246  ** a link is moving), the diguyCharacter callback with callback_id
6247  ** CALLBACK_ID_GAZE_STATUS will be called.
6248  **
6249  *b Returns:
6250  **
6251  *- - 1 if the final link in the gaze can and has become oriented
6252  *- toward the gaze target
6253  *- - 0 if not
6254  *- - -1 on error
6255  */
6256  int get_gaze_is_acquired();
6257 
6258  /*l
6259  *b Description:
6260  **
6261  ** A gaze is steady if it is acquired, and if all links involved
6262  ** in the gaze have reached a steady state.
6263  **
6264  ** For example, since the eyes move faster than the neck, which
6265  ** moves faster than the back, it's possible for the gaze to
6266  ** be acquired (see get_gaze_is_acquired()) by the eyes as the
6267  ** neck and back are still moving. As the neck and back move into
6268  ** a more natural position, the eyes will not need to be turned
6269  ** as far to keep the gaze acquired.
6270  **
6271  ** If either the acquired or steady status of a gaze has changed
6272  ** (e.g., was acquired but now is not, or was steady but now
6273  ** a link is moving), the diguyCharacter callback with callback_id
6274  ** CALLBACK_ID_GAZE_STATUS will be called.
6275  **
6276  *b Returns:
6277  **
6278  *- - 1 if all links participating in the gaze have reached a
6279  *- relatively steady state
6280  *- - 0 if not
6281  *- - -1 on error
6282  */
6283  int get_gaze_is_steady();
6284 
6285  /*l
6286  *b Description:
6287  **
6288  ** This function removes the fixation target of an ongoing gaze,
6289  ** allowing the character to return to a non-gaze posture and
6290  ** behavior. This effectively frees the character's posture to
6291  ** other influences.
6292  */
6293  int end_gaze();
6294 
6295  /*l
6296  *b Description:
6297  **
6298  ** This function is similar to gaze_at_angle(), but sets the target
6299  ** of left pointing rather than gaze.
6300  **
6301  ** This function will have no effect on a dead character (see
6302  ** die_now() and get_dead()).
6303  **
6304  *b Arguments:
6305  **
6306  *a azimuth - rotation in degrees about up (vertical) axis;
6307  *a positive rotates to character's left
6308  *a elevation - rotation in degrees about forward (horizontal) axis;
6309  *a positive rotates down
6310  *a distance - distance in meters from the position of the character
6311  *a to the lpoint target; positive values only
6312  *a is_new_lpoint - set to 1 if this is a new lpoint;
6313  *a set to 0 if this is continuing an already started
6314  *a lpoint
6315  *a base_gesture_name - the underlying gesture that should be used for
6316  *a motion of the arm; this is a placeholder
6317  *a argument for future functionality and should
6318  *a be set to NULL
6319  */
6320  int lpoint_at_angle(float azimuth,
6321  float elevation,
6322  float distance,
6323  int is_new_lpoint = 1,
6324  const char* base_gesture_name = 0);
6325 
6326  /*l
6327  *b Description:
6328  **
6329  ** This function is identical to gaze_at_local() except that it uses
6330  ** body local coordinates for the character. Use get_position()
6331  ** to learn the idealized position of the character if necessary.
6332  **
6333  ** This function will have no effect on a dead character (see
6334  ** die_now() and get_dead()).
6335  */
6336  int lpoint_at_angle_local(float azimuth,
6337  float elevation,
6338  float distance = 10000.0f,
6339  int is_new_lpoint = 1,
6340  const char* base_gesture_name = 0);
6341 
6342  /*l
6343  *b Description:
6344  **
6345  ** This function sets the current fixation point for the character's
6346  ** left pointing. Point coordinates are given in meters in the
6347  ** DI-Guy global coordinate system.
6348  **
6349  ** See set_position() for a description of the coordinate
6350  ** system.
6351  **
6352  ** Pointing will continue until end_lpoint() is called.
6353  **
6354  ** This function will have no effect on a dead character (see
6355  ** die_now() and get_dead()).
6356  **
6357  *b Arguments:
6358  **
6359  *a tx, ty, tz - position in meters from the DI-Guy global
6360  *a origin of the lpoint target
6361  *a is_new_gaze - set to 1 if this is a new lpoint;
6362  *a set to 0 if this is continuing an already started
6363  *a lpoint
6364  *a base_gesture_name - the underlying gesture that should be used for
6365  *a motion of the arm; this is a placeholder
6366  *a argument for future functionality and should
6367  *a be set to NULL
6368  **
6369  *b Returns:
6370  **
6371  ** 0 on success, -1 on failure
6372  */
6373  int lpoint_at_point(float tx,
6374  float ty,
6375  float tz,
6376  int is_new_lpoint = 1,
6377  const char* base_gesture_name = 0);
6378 
6379  /*l
6380  *b Description:
6381  **
6382  ** This function is identical to lpoint_at_local() except that it uses
6383  ** body local coordinates for the character. Use get_position()
6384  ** to learn the idealized position of the character if necessary.
6385  **
6386  ** This function will have no effect on a dead character (see
6387  ** die_now() and get_dead()).
6388  */
6389  int lpoint_at_point_local(float tx,
6390  float ty,
6391  float tz,
6392  int is_new_lpoint = 1,
6393  const char* base_gesture_name = 0);
6394 
6395  /*l
6396  *b Description:
6397  **
6398  ** This function is identical to gaze_at_character(), but sets the
6399  ** target of left pointing rather than gaze.
6400  **
6401  ** This function will have no effect on a dead character (see
6402  ** die_now() and get_dead()).
6403  */
6404  int lpoint_at_character(const char* target_character_name,
6405  const char* target_character_link_name = NULL,
6406  float offset_tx = 0.0f,
6407  float offset_ty = 0.0f,
6408  float offset_tz = 0.0f);
6409 
6410  /*l
6411  *b Returns:
6412  **
6413  ** the current lpoint target point relative to the DI-Guy
6414  ** global coordinate system
6415  */
6416  int get_lpoint_point(float* x, float* y, float* z);
6417 
6418  /*l
6419  *b Returns:
6420  **
6421  ** the current base gesture of the lpoint
6422  */
6423  const char* get_lpoint_base_gesture_name();
6424 
6425  /*l
6426  *b Returns:
6427  **
6428  ** 1 if the character is actively lpointing, 0 if not
6429  */
6430  int get_lpoint_is_active();
6431 
6432  /*l
6433  *b Returns:
6434  **
6435  ** 1 if the final link in the lpoint can and has become oriented
6436  ** toward the lpoint target;
6437  ** 0 if not;
6438  ** -1 on error
6439  */
6440  int get_lpoint_is_acquired();
6441 
6442  /*l
6443  *b Returns:
6444  **
6445  ** 1 if all links participating in the lpoint have reached a
6446  ** relatively steady state;
6447  ** 0 if not;
6448  ** -1 on error
6449  */
6450  int get_lpoint_is_steady();
6451 
6452  /*l
6453  *b Description:
6454  **
6455  ** This function removes the fixation target of an ongoing lpoint,
6456  ** allowing the character to return to a non-point posture and
6457  ** behavior. This effectively frees the character's posture to
6458  ** other influences.
6459  */
6460  int end_lpoint();
6461 
6462  /*l
6463  *b Description:
6464  **
6465  ** This function sets all gaze control parameters back to their
6466  ** default settings. This undoes modifications to gaze control
6467  ** parameters made by the following calls:
6468  **
6469  *- - set_gaze_param_desired_locate_time()
6470  *- - set_gaze_link_uses_desired_locate_time()
6471  *- - set_gaze_link_azimuth_limits()
6472  *- - set_gaze_link_elevation_limits()
6473  *- - set_gaze_link_azimuth_tolerance()
6474  *- - set_gaze_link_elevation_tolerance()
6475  *- - set_gaze_link_max_angular_vel()
6476  *- - set_gaze_link_scale_factor()
6477  **
6478  *b Returns:
6479  **
6480  ** 0 on success, -1 on failure
6481  */
6482  int set_gaze_params_to_defaults();
6483 
6484  /*l
6485  *b Description:
6486  **
6487  ** This function sets the desired amount of time in seconds it
6488  ** will take for the gaze or point target to be acquired.
6489  **
6490  ** Having a desired locate time effectively limits how fast links
6491  ** in the gaze chain can turn; they will turn as fast as it
6492  ** takes for them to arrive at their proper values, or as fast
6493  ** as their maximum angular velocity, whichever is longer.
6494  **
6495  ** The use of desired locate time can be turned on and off on a
6496  ** link by link bases using the function
6497  ** set_gaze_link_uses_desired_locate_time().
6498  **
6499  ** This value is only a guideline and may be overridden on a link
6500  ** by link basis during the actual gaze, as links try not to
6501  ** exceed their maximum angular velocities.
6502  **
6503  ** The default locate time is 1.0 seconds.
6504  **
6505  *b Arguments:
6506  **
6507  *a t - lower value results in faster turning rate
6508  **
6509  *b Returns:
6510  **
6511  ** 0 on success, -1 on failure
6512  */
6513  int set_gaze_param_desired_locate_time(float t);
6514 
6515  /*l
6516  *b Returns:
6517  **
6518  ** the most recent setting of set_gaze_param_desired_locate_time()
6519  */
6520  float get_gaze_param_desired_locate_time();
6521 
6522  /*l
6523  *b Description:
6524  **
6525  ** This function sets whether the specified link will pay attention
6526  ** to the desired locate time (as set by
6527  ** set_gaze_param_desired_locate_time()), or whether the link turns
6528  ** as fast as its maximum angular velocity allows (as set by
6529  ** set_gaze_link_max_angular_vel()).
6530  **
6531  ** Note that if this value is set to 1, the link still pays attention
6532  ** to its maximum angular velocity as an upper limit on how fast
6533  ** it can turn.
6534  **
6535  ** Valid link names and defaults:
6536  **
6537  *a orientation - 1
6538  *a back - 1
6539  *a cervical - 1
6540  *a eye_l - 0
6541  *a shoulder_l - 1
6542  *a elbow_l - 1
6543  **
6544  *b Arguments:
6545  **
6546  *a link_name - name of the link
6547  *a uses_desired_locate_time - 1 to use desired locate time, 0
6548  *a to disregard
6549  **
6550  *b Returns:
6551  **
6552  ** 0 on success, -1 on failure
6553  */
6554  int set_gaze_link_uses_desired_locate_time(const char* link_name,
6555  int uses_desired_locate_time);
6556 
6557  /*l
6558  *b Returns:
6559  **
6560  ** the most recent setting of set_gaze_link_uses_desired_locate_time()
6561  */
6562  int get_gaze_link_uses_desired_locate_time(const char* link_name);
6563 
6564  /*l
6565  *b Description:
6566  **
6567  ** This function sets the maximum amount the character can turn
6568  ** the specified link horizontally in pursuit of a gaze or point
6569  ** target.
6570  **
6571  ** Valid link names and defaults:
6572  **
6573  *a back - -45 to 45
6574  *a cervical - -80 to 80
6575  *a eye_l - -50 to 50
6576  *a shoulder_l - -30 to 135
6577  *a elbow_l - -30 to 10
6578  **
6579  *b Arguments:
6580  **
6581  *a link_name - name of the link
6582  *a min - value <= 0; in degrees
6583  *a max - value >= 0; in degrees
6584  **
6585  *b Returns:
6586  **
6587  ** 0 on success, -1 on failure
6588  */
6589  int set_gaze_link_azimuth_limits(const char* link_name, float min, float max);
6590 
6591  /*l
6592  *b Returns:
6593  **
6594  ** the most recent setting of set_gaze_link_azimuth_max()
6595  */
6596  int get_gaze_link_azimuth_limits(const char* link_name,
6597  float* min,
6598  float* max);
6599 
6600  /*l
6601  *b Description:
6602  **
6603  ** This function sets the maximum amount the character can turn
6604  ** the specified link vertically in pursuit of a gaze or point
6605  ** target.
6606  **
6607  ** Valid link names and defaults:
6608  **
6609  *a back - -15 to 45
6610  *a cervical - -80 to 45
6611  *a eye_l - -40 to 40
6612  *a shoulder_l - -80 to 80
6613  *a elbow_l - -170 to 0
6614  **
6615  *b Arguments:
6616  **
6617  *a link_name - name of the link
6618  *a min - value <= 0; in degrees
6619  *a max - value >= 0; in degrees
6620  **
6621  *b Returns:
6622  **
6623  ** 0 on success, -1 on failure
6624  */
6625  int set_gaze_link_elevation_limits(const char* link_name,
6626  float min,
6627  float max);
6628 
6630  int get_gaze_link_elevation_limits(const char* link_name,
6631  float* min,
6632  float* max);
6633 
6634  /*l
6635  *b Description:
6636  **
6637  ** This function sets how much difference there can be between
6638  ** the link's current horizontal orientation and the gaze or point
6639  ** target before the link begins to turn to acquire the gaze or
6640  ** point target.
6641  **
6642  ** The combination of this function and
6643  ** set_gaze_link_scale_factor() determine how close the link will
6644  ** turn toward the gaze or point target.
6645  **
6646  ** With a looser (higher) tolerance the link will not turn as much
6647  ** toward the target. With a tighter (lower) tolerance the link
6648  ** will turn more toward the target.
6649  **
6650  ** Valid link names and defaults:
6651  **
6652  *a orientation - -30 to 30
6653  *a back - -45 to 45
6654  *a cervical - -5 to 5
6655  *a eye_l - -1 to 1
6656  *a shoulder_l - -5 to 5
6657  *a elbow_l - -5 to 5
6658  **
6659  *b Arguments:
6660  **
6661  *a link_name - name of the link
6662  *a min - value <= 0; in degrees
6663  *a max - value >= 0; in degrees
6664  **
6665  *b Returns:
6666  **
6667  ** 0 on success, -1 on failure
6668  */
6669  int set_gaze_link_azimuth_tolerance(const char* link_name,
6670  float min,
6671  float max);
6672 
6674  int get_gaze_link_azimuth_tolerance(const char* link_name,
6675  float* min,
6676  float* max);
6677 
6678  /*l
6679  *b Description:
6680  **
6681  ** The elevation equivalent of set_gaze_link_azimuth_tolerance(),
6682  **
6683  ** Valid link names and defaults:
6684  **
6685  *a orientation - -90 to 90
6686  *a back - -45 to 45
6687  *a cervical - -5 to 5
6688  *a eye_l - -1 to 1
6689  *a shoulder_l - -5 to 5
6690  *a elbow_l - -5 to 5
6691  **
6692  *b Arguments:
6693  **
6694  *a link_name - name of the link
6695  *a min - value <= 0; in degrees
6696  *a max - value >= 0; in degrees
6697  **
6698  *b Returns:
6699  **
6700  ** 0 on success, -1 on failure
6701  */
6702  int set_gaze_link_elevation_tolerance(const char* link_name,
6703  float min,
6704  float max);
6705 
6707  int get_gaze_link_elevation_tolerance(const char* link_name,
6708  float* min,
6709  float* max);
6710 
6711  /*l
6712  *b Description:
6713  **
6714  ** This function sets the maximum angular velocity that the
6715  ** back link angles may attain in pursuit of a gaze or point target.
6716  **
6717  ** Valid link names and defaults:
6718  **
6719  *a back - 30 deg/s
6720  *a cervical - 60 deg/s
6721  *a eye_l - 180 deg/s
6722  *a shoulder_l - 180 deg/s
6723  *a elbow_l - 180 deg/s
6724  **
6725  *b Arguments:
6726  **
6727  *a link_name - name of the link
6728  *a angular_vel - angular velocity in degrees per second
6729  **
6730  *b Returns:
6731  **
6732  ** 0 on success, -1 on failure
6733  */
6734  int set_gaze_link_max_angular_vel(const char* link_name, float angular_vel);
6735 
6737  int get_gaze_link_max_angular_vel(const char* link_name, float* angular_vel);
6738 
6739  /*l
6740  *b Description:
6741  **
6742  ** This function sets how much the link will make up the difference
6743  ** toward the gaze or point target.
6744  **
6745  ** The combination of this function and
6746  ** the tolerances determine how close the
6747  ** link will turn toward the gaze or point target.
6748  **
6749  ** With a smaller scale factor the link will not turn as much toward
6750  ** the target. With a higher scale factor the link will turn more
6751  ** toward the target.
6752  **
6753  ** For example, if the gaze or point target is at 60 degrees yaw in
6754  ** back coordinates and the scale factor is 0.5, the back will turn
6755  ** 30 degrees in pursuit of the target.
6756  **
6757  ** Valid link names and defaults:
6758  **
6759  *a back - 0.75
6760  *a cervical - 0.5
6761  *a eye_l - 1.0
6762  *a shoulder_l - 0.9
6763  *a elbow_l - 1.0
6764  **
6765  *b Arguments:
6766  **
6767  *a link_name - name of the link
6768  *a scale_factor - scale factor between 0 and 1
6769  **
6770  *b Returns:
6771  **
6772  ** 0 on success, -1 on failure
6773  */
6774  int set_gaze_link_scale_factor(const char* link_name, float scale_factor);
6775 
6777  int get_gaze_link_scale_factor(const char* link_name, float* scale_factor);
6778 
6779  /*l
6780  *b Description:
6781  **
6782  ** This function sets whether the character can turn the specified
6783  ** link in pursuit of the gaze target.
6784  **
6785  ** Valid link names and defaults:
6786  **
6787  *a orientation - 0
6788  *a back - 1
6789  *a cervical - 1
6790  *a eye_l - 1 if character has movable eyes, else 0
6791  *a shoulder_l - 0
6792  *a elbow_l - 0
6793  **
6794  *b Arguments:
6795  **
6796  *a link_name - name of the link
6797  *a enabled - 1 to enable, 0 to disable
6798  **
6799  *b Returns:
6800  **
6801  ** 0 on success, -1 on failure
6802  */
6803  int set_link_enabled_for_gaze(const char* link_name, int enabled);
6804 
6806  int get_link_enabled_for_gaze(const char* link_name);
6807 
6808  /*l
6809  *b Description:
6810  **
6811  ** This function sets whether the character can change its current
6812  ** posture in pursuit of the gaze target.
6813  **
6814  ** Gaze can change current posture by default.
6815  **
6816  *b Arguments:
6817  **
6818  *a enabled - 1 to enable, 0 to disable
6819  **
6820  *b Returns:
6821  **
6822  ** 0 on success, -1 on failure
6823  */
6824  int set_gaze_can_change_posture(int enabled);
6825 
6827  int get_gaze_can_change_posture();
6828 
6829  /*l
6830  *b Description:
6831  **
6832  ** This function sets whether the character can change its current
6833  ** variant in pursuit of the gaze target.
6834  **
6835  ** Gaze can change current variant by default.
6836  **
6837  *b Arguments:
6838  **
6839  *a enabled - 1 to enable, 0 to disable
6840  **
6841  *b Returns:
6842  **
6843  ** 0 on success, -1 on failure
6844  */
6845  int set_gaze_can_change_variant(int enabled);
6846 
6848  int get_gaze_can_change_variant();
6849 
6850  /*l
6851  *b Description:
6852  **
6853  ** This function sets whether the character can move the specified
6854  ** link in pursuit of the lpoint target.
6855  **
6856  ** Valid link names and defaults:
6857  **
6858  *a orientation - 0
6859  *a back - 1
6860  *a cervical - 0
6861  *a eye_l - 0
6862  *a shoulder_l - 1
6863  *a elbow_l - 1
6864  **
6865  *b Arguments:
6866  **
6867  *a link_name - name of the link
6868  *a enabled - 1 to enable, 0 to disable
6869  **
6870  *b Returns:
6871  **
6872  ** 0 on success, -1 on failure
6873  */
6874  int set_link_enabled_for_lpoint(const char* link_name, int enabled);
6875 
6877  int get_link_enabled_for_lpoint(const char* link_name);
6878 
6879  /*l
6880  *b Description:
6881  **
6882  ** This function adjusts the current azimuth and elevation offsets
6883  ** of the character's head. If a gaze is ongoing, then the nod will
6884  ** be supplemented to the gazing, and the character will attempt to
6885  ** maintain its gaze.
6886  **
6887  ** This function will have no effect on a dead character (see
6888  ** die_now() and get_dead()).
6889  **
6890  *b Arguments:
6891  **
6892  *a azimuth - rotation offset about z (vertical) axis, in degrees;
6893  *a positive rotates to character's left
6894  *a elevation - rotation offset about y (horizontal) axis, in degrees;
6895  *a positive rotates down
6896  *a duration - how long it should take to attain the new azimuth
6897  *a and elevation
6898  **
6899  *b Returns:
6900  **
6901  ** 0 on success, -1 on failure
6902  */
6903  int set_nod(float azimuth,
6904  float elevation,
6905  float duration = 0.5f);
6906 
6907  /*l
6908  *b Description:
6909  **
6910  ** This function causes the character to nod its head for the
6911  ** specified number of times over the specified duration.
6912  **
6913  ** If nod_count is 0.5, the elevation of the head will move from its
6914  ** current elevation straight to nod_elevation_out. The arguments
6915  ** nod_elevation0 and nod_elevation1 will be ignored.
6916  **
6917  ** If nod_count is 1.0, the elevation of the head will move from
6918  ** its current elevation to nod_elevation0, then to
6919  ** nod_elevation_out. The argument nod_elevation1 will be ignored.
6920  **
6921  ** If nod_count is 1.5 or greater, the nod elevation will begin at
6922  ** its current elevation, move to nod_elevation0, then alternate
6923  ** between nod_elevation0 and nod_elevation1, before finally ending
6924  ** at nod_elevation_out.
6925  **
6926  ** The head will maintain an elevation offset of nod_elevation_out
6927  ** until a new call to nod_head() or set_nod() is made.
6928  **
6929  ** This function overrides any nod settings made by the set_nod()
6930  ** function.
6931  **
6932  ** This function will have no effect on a dead character (see
6933  ** die_now() and get_dead()).
6934  **
6935  *b Arguments:
6936  **
6937  *a duration - for how long the nod should be executed
6938  *a nod_count - how many nods the character should perform;
6939  *a this will be rounded to the nearest multiple
6940  *a of 0.5
6941  *a nod_elevation0 - elevation of initial nod in degrees
6942  *a nod_elevation1 - elevation of return nod in degrees
6943  *a nod_elevation_out - ending elevation when nod is complete
6944  **
6945  *b Returns:
6946  **
6947  ** 0 on success, -1 on failure
6948  **
6949  *b Available as Decision Bead/Event
6950  */
6951  int nod_head(float duration,
6952  float nod_count,
6953  float nod_elevation0 = 15.0f,
6954  float nod_elevation1 = 0.0f,
6955  float nod_elevation_out = 0.0f);
6956 
6957  /*l
6958  *b Description:
6959  **
6960  ** This function is similar to nod_head(), except the direction
6961  ** of head movement is side to side rather than up and down.
6962  ** See the nod_head() function for a detailed description of usage.
6963  **
6964  ** This function will have no effect on a dead character (see
6965  ** die_now() and get_dead()).
6966  **
6967  *b Arguments:
6968  **
6969  *a duration - for how long the shake should be executed
6970  *a shake_count - how shakes the character should perform; this
6971  *a will be rounded to the nearest multiple of
6972  *a 0.5
6973  *a shake_azimuth0 - azimuth of initial shake in degrees
6974  *a shake_azimuth1 - azimuth of return shake in degrees
6975  *a shake_azimuth_out - ending azimuth when shake is complete
6976  **
6977  *b Returns:
6978  **
6979  ** 0 on success, -1 on failure
6980  **
6981  *b Available as Decision Bead/Event
6982  */
6983  int shake_head(float duration,
6984  float shake_count,
6985  float shake_azimuth0 = -20.0f,
6986  float shake_azimuth1 = 20.0f,
6987  float shake_azimuth_out = 0.0f);
6988 
6989  /*l
6990  *b Returns:
6991  **
6992  ** current nod azimuth setting; see set_nod(), nod_head(), and
6993  ** shake_head()
6994  */
6995  float get_nod_azimuth();
6996 
6997  /*l
6998  *b Returns:
6999  **
7000  ** current nod elevation setting; see set_nod(), nod_head(), and
7001  ** shake_head()
7002  */
7003  float get_nod_elevation();
7004 
7005 
7006 /*****************************************************************************/
7027  /*l
7028  *b Description:
7029  **
7030  ** This function sets the current desired azimuth and elevation of
7031  ** the character's aim. The angles are in character-local
7032  ** coordinates. Zero values mean straight ahead and level.
7033  ** Aiming will continue until end_aim() is called.
7034  **
7035  ** This function effectively calls aim_at_angle_local(), with a
7036  ** distance of 10000 meters, and is_new_aim set to 1.
7037  **
7038  ** This function will have no effect on a dead character (see
7039  ** die_now() and get_dead()).
7040  **
7041  *b Arguments:
7042  **
7043  *a azimuth - rotation about z (vertical) axis, in degrees;
7044  *a positive rotates to character's left
7045  *a elevation - rotation about y (horizontal) axis, in degrees;
7046  *a positive rotates down
7047  **
7048  *b Returns:
7049  **
7050  ** 0 on success, -1 on failure
7051  */
7052  int set_aim(float azimuth, float elevation);
7053 
7054  /*l
7055  *b Description:
7056  **
7057  ** This function sets the current azimuth, elevation, and
7058  ** distance of the character's aim. A fixed point in 3D space is
7059  ** then found using the two angles and the given distance from
7060  ** the character's idealized position. Angles are given with
7061  ** respect to the DI-Guy global coordinate system.
7062  **
7063  ** See set_position() for a description of the coordinate
7064  ** system.
7065  **
7066  ** Aiming will continue until end_aim() is called.
7067  **
7068  ** This function will have no effect on a dead character (see
7069  ** die_now() and get_dead()).
7070  **
7071  *b Arguments:
7072  **
7073  *a azimuth - rotation in degrees about up (vertical) axis;
7074  *a begins at 0 at the positive X axis of the DI-Guy
7075  *a coordinate system and proceeds counter-clockwise
7076  *a elevation - rotation in degrees about horizontal axis; positive
7077  *a value rotates down
7078  *a distance - distance in meters from the idealized position of the
7079  *a character to the aim target; positive values only,
7080  *a typically this is a large value (e.g. 10,000 meters)
7081  *a is_new_aim - set to 1 if this is a new aim, for jumping to a
7082  *a new target;
7083  *a set to 0 if this is continuing an already
7084  *a started aim, for tracking an existing target
7085  **
7086  *b Returns:
7087  **
7088  ** 0 on success, -1 on failure
7089  */
7090  int aim_at_angle(float azimuth,
7091  float elevation,
7092  float distance,
7093  int is_new_aim = 1);
7094 
7095  /*l
7096  *b Description:
7097  **
7098  ** This function is identical to aim_at_angle() except that the
7099  ** angles are relative to the character's frame of reference. These
7100  ** relative angles will be maintained even if the character rotates.
7101  **
7102  ** Use get_position() to learn the idealized position. The
7103  ** distance is between the idealized position of the character
7104  ** and the fixation point. Aiming will continue until end_aim()
7105  ** is called.
7106  **
7107  ** This function will have no effect on a dead character (see
7108  ** die_now() and get_dead()).
7109  */
7110  int aim_at_angle_local(float azimuth,
7111  float elevation,
7112  float distance,
7113  int is_new_aim = 1);
7114 
7115  /*l
7116  *b Description:
7117  **
7118  ** This function is identical to aim_at_angle() and aim_at_angle_local(),
7119  ** but includes velocity that will modify the angles every frame.
7120  ** This can be useful in networked simulations where targeting velocity is published.
7121  **
7122  ** This function will have no effect on a dead character (see
7123  ** die_now() and get_dead()).
7124  */
7125  int aim_at_angle_with_velocity(float azimuth, float elevation, float az_vel, float el_vel, int local, int is_new_aim = 1);
7126 
7127  /*l
7128  *b Description:
7129  **
7130  ** This function sets the current fixation point of the
7131  ** character's aim. Point coordinates are given in meters in the
7132  ** DI-Guy global coordinate system.
7133  **
7134  ** The function uses default aim behavior settings. Aiming will
7135  ** continue until end_aim() is called.
7136  **
7137  ** This function will have no effect on a dead character (see
7138  ** die_now() and get_dead()).
7139  **
7140  *b Arguments:
7141  **
7142  *a tx, ty, tz - position in meters from the DI-Guy global
7143  *a origin
7144  *a is_new_aim - set to 1 if this is a new aim;
7145  *a set to 0 if this is continuing an already started aim
7146  **
7147  *b Returns:
7148  **
7149  ** 0 on success, -1 on failure
7150  */
7151  int aim_at_point(float x, float y, float z, int is_new_aim = 1);
7152 
7153  /*l
7154  *b Description:
7155  **
7156  ** This function is identical to aim_at_point() except that the
7157  ** coordinates are relative to the character, in its own coordinate
7158  ** system. Use get_position() to learn the idealized position of the
7159  ** character if necessary.
7160  **
7161  ** This function will have no effect on a dead character (see
7162  ** die_now() and get_dead()).
7163  */
7164  int aim_at_point_local(float x, float y, float z, int is_new_aim = 1);
7165 
7166  /*l
7167  *b Description:
7168  **
7169  ** This function effectively does an aim_at_point() each tick.
7170  ** The point to be aimed at is updated each tick to be the position
7171  ** of the specified link on the specified character.
7172  **
7173  ** This function will have no effect on a dead character (see
7174  ** die_now() and get_dead()).
7175  **
7176  *b Arguments:
7177  **
7178  *a target_character_name - name of the character to be
7179  *a aimed at
7180  *a target_character_link_name - link on the character that should
7181  *a be aimed at; pass NULL or "" to
7182  *a aim at the position link of the
7183  *a character. If NULL is passed,
7184  *a function will make best effort to
7185  *a choose a character-appropriate link
7186  *a to target.
7187  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
7188  **
7189  *b Returns:
7190  **
7191  ** 0 on success, -1 on failure
7192  **
7193  *b Available as Decision Bead/Event
7194  **
7195  *b C++ Example:
7196  **
7197  *e // aim at the head of character "soldier-1".
7198  *e ch->aim_at_character("soldier-1",
7199  *e "cervical",
7200  *e 0.0,
7201  *e 0.0,
7202  *e 0.0);
7203  */
7204  int aim_at_character(const char* target_character_name,
7205  const char* target_character_link_name = NULL,
7206  float offset_tx = 0.0f,
7207  float offset_ty = 0.0f,
7208  float offset_tz = 0.0f);
7209 
7210  /*l
7211  *b Description:
7212  **
7213  ** This function terminates aiming started by the set_aim(),
7214  ** aim_at_point(), aim_at_point_local(), aim_at_angle(),
7215  ** aim_at_angle_local(), and aim_at_character() functions.
7216  */
7217  void end_aim();
7218 
7220  const char * get_aim_at_character();
7221 
7223  float get_aim_azimuth();
7224 
7226  float get_aim_elevation();
7227 
7228  /*l
7229  *b Description:
7230  **
7231  ** This function returns values that can be used to compute the
7232  ** character's weapon's trajectory, i.e. the mathematical ray that
7233  ** comes out of the end of the barrel.
7234  **
7235  *b Returns:
7236  **
7237  ** 1 if the character is aiming, 0 if not
7238  **
7239  *b Arguments:
7240  **
7241  *a muzzle_x, muzzle_y, muzzle_z - position of muzzle in meters from
7242  *a the origin
7243  *a far_x, far_y, far_z - position of end target in meters from the
7244  *a origin
7245  **
7246  ** Pass NULL for any values that are not needed.
7247  ** Note: values will be zero if the character isn't currently aiming
7248  */
7249  int get_aim_trajectory(float* muzzle_x, float* muzzle_y, float* muzzle_z,
7250  float* far_x, float* far_y, float* far_z);
7251 
7252  /*l
7253  *b Description:
7254  **
7255  ** Not all actions of a character will be affected by aim
7256  ** commands. This function returns 1 if this character
7257  ** is currently in an aim-able action.
7258  **
7259  *b Returns:
7260  **
7261  ** 1 if current action is aim-able; 0 if not
7262  */
7263  int get_aim_is_possible();
7264 
7265  /*l
7266  *b Returns:
7267  **
7268  ** 1 if the aim is acquired, 0 if not
7269  */
7270  int get_aim_is_acquired();
7271 
7272  /*l
7273  *b Returns:
7274  **
7275  ** 1 if all links participating in the aim have reached a
7276  ** relatively steady state, 0 if not, -1 on error
7277  */
7278  int get_aim_is_steady();
7279 
7280 
7281  /*l
7282  *b Returns:
7283  **
7284  ** 1 if character is currently aiming, 0 if not
7285  */
7286  int get_is_aiming();
7287 
7288 
7289  /******************************************************
7290  **
7291  *3 Aim Algorithm 8 Parameters
7292  **
7293  ** This aim algorithm works by adjusting the aiming character's pose
7294  ** such that the difference between the current aim angles and the
7295  ** desired aim angles is decreased each scenario tick.
7296  **
7297  ** How much of that difference that is made up each frame is
7298  ** determined by the factor parameters. The difference between the
7299  ** desired aim angles and the current aim angles, multiplied by a
7300  ** calculated factor, is added to the current aim angles each frame.
7301  ** This causes the aim to "home in" on the desired aim angles.
7302  **
7303  ** For example, if for each frame the calculated factor is 0.5, half
7304  ** of the difference between the desired and current aim angles is
7305  ** made up.
7306  **
7307  ** Unless otherwise specified, all functions callable from:
7308  **
7309  *- - C++
7310  *- - Script
7311  */
7312 
7313  /*l
7314  *b Description:
7315  **
7316  ** This function sets the steady-state factor that is used once
7317  ** an aim is no longer considered "new".
7318  **
7319  ** See the function set_aim_param_new_aim_duration() for information
7320  ** on when an aim is considered new, and how the effective acquire
7321  ** is calculated from this steady-state acquire factor and the
7322  ** new aim factor.
7323  **
7324  *b Arguments:
7325  **
7326  *a factor - unitless value between 0 and 1; default is 0.6
7327  */
7328  void set_aim_param_acquire_factor(float factor);
7329 
7330  /*l
7331  *b Returns:
7332  **
7333  ** the current aim acquire factor parameter
7334  */
7335  float get_aim_param_acquire_factor();
7336 
7337  /*l
7338  *b Description:
7339  **
7340  ** This function sets the factor that is used when an aim is
7341  ** considered new.
7342  **
7343  ** See the function set_aim_param_new_aim_duration() for information
7344  ** on when an aim is considered new, and how the effective acquire
7345  ** is calculated from this new aim factor and the steady-state acquire
7346  ** factor.
7347  **
7348  *b Arguments:
7349  **
7350  *a factor - unitless value between 0 and 1; default is 0.05
7351  */
7352  void set_aim_param_new_aim_factor(float factor);
7353 
7355  float get_aim_param_new_aim_factor();
7356 
7357  /*l
7358  *b Description:
7359  **
7360  ** This function sets how long an aim is considered "new".
7361  **
7362  ** When an aim is brand-new, the effective acquire factor is equal
7363  ** to the new aim factor as set by set_aim_param_new_aim_factor().
7364  ** When the new aim duration has expired, the effective acquire factor
7365  ** is equal to the steady-state acquire factor as set by
7366  ** set_aim_param_acquire_factor(). In between, the effective acquire
7367  ** factor moves smoothly between the two.
7368  **
7369  ** For example, say that the new aim factor is 0.1, the acquire factor
7370  ** is 0.5, and the new aim duration is 0.2 seconds.
7371  ** If a new aim is started, say by a call to aim_at_angle_local(),
7372  ** the effective acquire factor of the first frame will be 0.1. Over
7373  ** the next 0.2 seconds, the effective acquire factor will smoothly
7374  ** ramp up to 0.5, where it will stay until the aim is acquired.
7375  **
7376  *b Arguments:
7377  **
7378  *a duration - how long, in seconds, a new aim should be considered
7379  *a new; default is 1 second
7380  */
7381  void set_aim_param_new_aim_duration(float duration);
7382 
7384  float get_aim_param_new_aim_duration();
7385 
7386  /*l
7387  *b Description:
7388  **
7389  ** This function sets the maximum factor that can be used for any
7390  ** single frame for aim convergence attempts.
7391  **
7392  ** See set_aim_param_acquire_factor() for a discussion of why setting
7393  ** this too close to 1 is not recommended.
7394  **
7395  *b Arguments:
7396  **
7397  *a factor - unitless value between 0 and 1; default is 0.95
7398  */
7399  void set_aim_param_max_per_frame_adj_factor(float factor);
7400 
7402  float get_aim_param_max_per_frame_adj_factor();
7403 
7404  /*l
7405  *b Description:
7406  **
7407  ** This function sets how close the current aim azimuth must be to
7408  ** the desired aim azimuth in order for the aim to be considered
7409  ** acquired.
7410  **
7411  ** Note that the aim isn't fully acquired until both azimuth and
7412  ** elevation are acquired.
7413  **
7414  ** Setting this value too close to 0 will result in the aim never
7415  ** being acquired.
7416  **
7417  *b Arguments:
7418  **
7419  *a range - how close, in degrees, the azimuth must be for the
7420  *a aim to be acquired; default is 0.5 degrees
7421  */
7422  void set_aim_param_azimuth_acquired_range(float range);
7423 
7425  float get_aim_param_azimuth_acquired_range();
7426 
7427  /*l
7428  *b Description:
7429  **
7430  ** This function sets how close the current aim elevation must be to
7431  ** the desired aim elevation in order for the aim to be considered
7432  ** acquired.
7433  **
7434  ** Note that the aim isn't fully acquired until both azimuth and
7435  ** elevation are acquired.
7436  **
7437  ** Setting this value too close to 0 will result in the aim never
7438  ** being acquired.
7439  **
7440  *b Arguments:
7441  **
7442  *a range - how close, in degrees, the elevation must be for the
7443  *a aim to be acquired; default is 1.0 degrees
7444  */
7445  void set_aim_param_elevation_acquired_range(float range);
7446 
7448  float get_aim_param_elevation_acquired_range();
7449 
7450  /*l
7451  *b Description:
7452  **
7453  ** This function attempts to have the character reach its desired
7454  ** aim angles instantly, every frame.
7455  **
7456  ** Set enabled to 0 to disable instant aim convergence.
7457  **
7458  */
7459  void set_aim_converge_every_frame( int enabled );
7460 
7462  int get_aim_converge_every_frame();
7463 
7466  int set_aim_variable_interpolation_time(float time);
7467  float get_aim_variable_interpolation_time();
7468 
7469 /*****************************************************************************/
7473  const char* get_aim_at_link();
7475 
7477  int get_aim_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
7478 
7480  const char* get_gaze_at_link();
7481 
7483  int get_gaze_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
7484 
7485 /*****************************************************************************/
7495  /*l
7496  *b Description:
7497  **
7498  ** This function causes a character to fire his weapon.
7499  **
7500  ** Different weapons have different "munition types", which specify,
7501  ** among other things, the sound to be played, the network info to be
7502  ** sent, and muzzle flash effect. See
7503  ** get_weapon_muzzle_munition_type() for more information on munition
7504  ** types.
7505  **
7506  ** If the weapon fires live rounds (as set by
7507  ** set_weapon_fires_live_rounds()) this function also computes a
7508  ** bullet trajectory, perhaps hitting and killing another character.
7509  **
7510  ** This function will have no effect on a dead character (see
7511  ** die_now() and get_dead()).
7512  **
7513  *b Returns:
7514  **
7515  ** 0 on success, -1 on failure
7516  **
7517  *b Available as Decision Bead/Event
7518  */
7519  int fire_weapon(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7520 
7521  /*l
7522  *b Description:
7523  **
7524  ** This function causes a character to fire his weapon the
7525  ** specified number of times. This causes a muzzle flash and
7526  ** the weapon's sound (if any) to be played.
7527  **
7528  ** The sound played will be one of, in order:
7529  **
7530  *- - the passed override_sound_name, or
7531  *- - the sound set by set_weapon_sound_override(), or
7532  *- - the default weapon sound based on the character's appearance
7533  **
7534  ** If the weapon fires live rounds (as set by
7535  ** set_weapon_fires_live_rounds()), this function also computes a
7536  ** trajectory for each round, perhaps hitting and killing
7537  ** another character.
7538  **
7539  ** This function will have no effect on a dead character (see
7540  ** die_now() and get_dead()).
7541  **
7542  *b Arguments:
7543  **
7544  *a count - number of times weapon should be fired
7545  *a override_sound_name - override sound to be played
7546  *a dt - time between firings if count > 1
7547  *a muzzle - muzzle on which flash should appear
7548  **
7549  *b Returns:
7550  **
7551  ** 0 on success, -1 on failure
7552  **
7553  *b Available as Decision Bead/Event
7554  */
7555  int fire_weapon_n_times(int count,
7556  float dt = 0.2f,
7557  const char* override_sound_name = NULL,
7559 
7560  /*l
7561  *b Description:
7562  **
7563  ** Fires a bullet at point (x, y) from the camera, using this
7564  ** character as the attacker.
7565  **
7566  *i Currently OpenGL only.
7567  **
7568  ** This function will have no effect on a dead character (see
7569  ** die_now() and get_dead()).
7570  **
7571  *b Returns:
7572  **
7573  ** number of hits
7574  */
7575  int fire_screen_space_bullet(diguyView* view, float x, float y);
7576 
7577  /*l
7578  *b Returns:
7579  **
7580  ** number of times weapon has been fired from specified muzzle
7581  **
7582  *b Available as Decision Bead/Event
7583  */
7584  int get_weapon_fire_count(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7585 
7586  /*l
7587  *b Description:
7588  **
7589  ** This function sets the default muzzle that will flash when
7590  ** the character fires its weapon due to a call to fire_weapon()
7591  ** or fire_weapon_n_times().
7592  **
7593  ** The default value is DIGUY_MUZZLE_DEFAULT.
7594  **
7595  *b Arguments:
7596  **
7597  *a muzzle - the muzzle that will flash; muzzle 1 is common
7598  **
7599  *b Returns:
7600  **
7601  ** 0 on success, -1 on failure
7602  */
7603  int set_default_weapon_muzzle(diguyMuzzle muzzle);
7604 
7605  /*l
7606  *b Returns:
7607  **
7608  ** current default weapon muzzle that flashes when the character's
7609  ** weapon is fired; see set_default_weapon_muzzle()
7610  */
7611  diguyMuzzle get_default_weapon_muzzle();
7612 
7613  /*l
7614  *b Description:
7615  **
7616  ** When the character fires its weapon, the results depend on the
7617  ** munition type of the muzzle fired from. Munition types specify,
7618  ** among other things:
7619  **
7620  *- - sound played
7621  *- - muzzle flash effect
7622  *- - network data sent (DIS septet)
7623  *- - detonation effect
7624  *- - detonation radius
7625  *- - etc.
7626  **
7627  ** Default munition types for the each muzzle are set automatically
7628  ** when the character's appearance is set. The munition type of the
7629  ** weapon can be overridden by calling
7630  ** set_weapon_munition_type_override().
7631  **
7632  ** Current munition types include:
7633  **
7634  *- - m16
7635  *- - m4
7636  *- - m60
7637  *- - m240
7638  *- - m249
7639  *- - m9
7640  *- - hand_gun
7641  *- - 50cal
7642  *- - m256
7643  *- - ak47
7644  *- - pk74
7645  *- - dragunov
7646  *- - sa80
7647  *- - rpg
7648  *- - m203
7649  *- - 40mm_hedp
7650  *- - javelin
7651  *- - stinger
7652  *- - at4
7653  *- - sa7
7654  *- - molotov_cocktail
7655  *- - 60mm_mortar
7656  *- - 82mm_mortar
7657  *- - 155mm_artillery
7658  *- - IED_mortar
7659  *- - VBIED
7660  *- - m242
7661  *- - 120mm
7662  *- - 125mm
7663  *- - ced
7664  *- - pepper_spray
7665  **
7666  *b Returns:
7667  **
7668  ** munition type of specified muzzle
7669  */
7670  const char* get_weapon_muzzle_munition_type(diguyMuzzle muzzle);
7671 
7673  const char* get_default_muzzle_munition_type();
7674 
7675  /*l
7676  *b Description:
7677  **
7678  ** This function allows the default munition type to be overridden.
7679  ** The default value is NULL (don't override default munition type).
7680  **
7681  *b Arguments:
7682  **
7683  *a munition_type - name of a munition type
7684  **
7685  *b Returns:
7686  **
7687  ** 0 on success, -1 on failure
7688  */
7689  int set_weapon_munition_type_override(const char* munition_type);
7690 
7692  const char* get_weapon_munition_type_override();
7693 
7694  /*l
7695  *b Description:
7696  **
7697  ** This function sets whether the character's weapons fire live
7698  ** rounds. If so, when fire_weapon() and fire_weapon_n_times() are
7699  ** called the trajectory of the bullet will be calculated and checked
7700  ** against characters in the scenario.
7701  **
7702  ** The default value is 1.
7703  **
7704  *b Arguments:
7705  **
7706  *a weapon_fires_live_rounds - set to 1 for live rounds; set to 0
7707  *a for "blanks"
7708  **
7709  *b Returns:
7710  **
7711  ** 0 on success, -1 on failure
7712  **
7713  *b Available as Decision Bead/Event
7714  */
7715  int set_weapon_fires_live_rounds(int weapon_fires_live_rounds);
7716 
7717  /*l
7718  *b Returns:
7719  **
7720  ** current setting of whether weapon fires live rounds or blanks; see
7721  ** set_weapon_fires_live_rounds()
7722  **
7723  *b Available as Decision Bead/Event
7724  */
7725  int get_weapon_fires_live_rounds();
7726 
7727  /*l
7728  *b Description:
7729  **
7730  ** A weapon sound is played when the character fires its weapon
7731  ** due to a call to fire_weapon() or fire_weapon_n_times().
7732  ** The sound that is played is generally derived from the weapon's
7733  ** munition type, which can be different for each muzzle.
7734  **
7735  ** This function overrides the default sound that will be played.
7736  ** Note that this overrides the sound for all muzzles.
7737  **
7738  ** The default value is NULL (don't override default sound).
7739  **
7740  ** To *not* play a sound at all, set the weapon sound gain override
7741  ** to 0.
7742  **
7743  *b Arguments:
7744  **
7745  *a sound - name of a sound defined in the scenario;
7746  *a pass NULL to specify that default should be played
7747  **
7748  *b Returns:
7749  **
7750  ** 0 on success, -1 on failure
7751  */
7752  int set_weapon_sound_override(const char* sound_name);
7753 
7754  /*l
7755  *b Description:
7756  **
7757  ** The function returns the current weapon sound override, if one
7758  ** is set; see set_weapon_sound_override().
7759  **
7760  ** This function will not return NULL. The empty string ("") is
7761  ** returned if a weapon sound override is not set.
7762  **
7763  *b Returns:
7764  **
7765  ** name of weapon sound override
7766  */
7767  const char* get_weapon_sound_override();
7768 
7769  /*l
7770  *b Description:
7771  **
7772  ** This function overrides the default gain on the sound played
7773  ** due to a call to fire_weapon() or fire_weapon_n_times().
7774  **
7775  ** Pass 1.0 to use the sound's default amplitude. Lower numbers
7776  ** decrease volume, higher numbers increase volume.
7777  **
7778  ** Pass 0.0 to completely disable playing of weapon sound.
7779  **
7780  ** The default value is 3.0.
7781  **
7782  ** See set_weapon_sound_override().
7783  **
7784  *b Arguments:
7785  **
7786  *a sound_gain - amount by which to change sound volume
7787  **
7788  *b Returns:
7789  **
7790  ** 0 on success, -1 on failure
7791  */
7792  int set_weapon_sound_gain_override(float gain);
7793 
7795  float get_weapon_sound_gain_override();
7796 
7797  /*l
7798  *b Description:
7799  **
7800  ** This function provides aiming assistance by making it possible for
7801  ** roughly-aimed weapons to hit targets. When spread is nonzero,
7802  ** fire_weapon searches for a target within a conical space centered
7803  ** on the muzzle. Within this cone, the live character within weapon
7804  ** range, and with the smallest angular deviation from the weapon, is
7805  ** chosen, by default, as the target. Other function calls may alter
7806  ** this aiming behavior, making it aim only at enemy targets, for
7807  ** example, or making it prefer close targets to far ones.
7808  **
7809  *b Arguments:
7810  **
7811  *a spread - angular deviation from weapon muzzle within which a
7812  *a target will be found
7813  **
7814  ** Spread values above 145 are suicidal (character can shoot himself).
7815  ** 90 is the highest sensible value, which covers everything ahead
7816  ** of the weapon muzzle. A value of 0 is the default, meaning that
7817  ** only targets in line with the muzzle are hit.
7818  */
7819  void set_weapon_spread(float spread);
7820 
7821  /*l
7822  *b Description:
7823  **
7824  ** This function affects how targets are chosen when
7825  ** the character's weapon_spread is nonzero. Only
7826  ** characters more than near_range meters away from the muzzle
7827  ** will be fired upon. Characters which are closer than
7828  ** near_range meters will not be fired upon.
7829  **
7830  ** This value does not affect weapon behavior when weapon_spread
7831  ** is zero.
7832  **
7833  ** If this function is never called for a character, it is as if
7834  ** the function had been called with a value of zero.
7835  **
7836  *b Arguments:
7837  **
7838  *a near_range - distance closer than which no character will be
7839  *a targeted
7840  */
7841  void set_weapon_near_range(float near_range);
7842  float get_weapon_near_range();
7843 
7844  /*l
7845  *b Description:
7846  **
7847  ** This function sets the range of the character's
7848  ** weapon.
7849  **
7850  ** If this function is never called for a character, it is as if
7851  ** the function had been called with a value of 500.0.
7852  **
7853  *b Arguments:
7854  **
7855  *a far_range - range of the weapon in meters
7856  */
7857  void set_weapon_far_range(float far_range);
7858  float get_weapon_far_range();
7859 
7860  /*l
7861  *b Description:
7862  **
7863  ** This function sets a weapon's ratio of hits to fired rounds. A
7864  ** value of 1.0 (the default) means the weapon will hit everything it
7865  ** is aimed at. Values less than 1.0 cause the weapon to
7866  ** probabilistically miss targets, even when perfectly aimed at them.
7867  ** A value of zero means the weapon doesn't hit anything, even if it
7868  ** is perfectly aimed. A value of 0.5 will hit half of the time.
7869  */
7870  void set_weapon_hit_ratio(float hit_ratio);
7871 
7872  /*l
7873  *b Description:
7874  **
7875  ** This function sets the number of potential impacts a fired round
7876  ** can have. The default is 1. Specifying more than 1 means the
7877  ** round will completely go through objects, triggering a
7878  ** CALLBACK_ID_IMPACT callback each time, until the maximum number of
7879  ** impacts has been reached.
7880  */
7881  void set_weapon_max_impacts(int val);
7882 
7883  /*l
7884  *b Returns:
7885  **
7886  ** state of accessory1
7887  */
7888  int get_accessory1_state();
7889 
7890  /*l
7891  *b Returns:
7892  **
7893  ** state of the character's rifle
7894  */
7895  int get_rifle_state();
7896 
7897  /*l
7898  *b Description
7899  **
7900  ** This function sets whether the projectiles of certain appearances'
7901  ** weapons (such as rocket launchers and RPGs) are visible. Note that
7902  ** most weapons do not have visible projectiles and this function will
7903  ** therefore have no effect.
7904  **
7905  *b Arguments:
7906  **
7907  *a muzzle - which muzzle's projectile should be shown/hidden
7908  *a is_visible - pass 1 to show, pass 0 to hide
7909  **
7910  *b Returns:
7911  **
7912  ** 0 on success, -1 on failure
7913  */
7914  int set_weapon_projectile_is_visible(diguyMuzzle muzzle, int is_visible);
7915 
7916  /*l
7917  *b Description
7918  **
7919  ** This function returns the most recent setting of
7920  ** set_weapon_projectile_is_visible().
7921  **
7922  *b Arguments:
7923  **
7924  *a muzzle - which muzzle's projectile should be queried
7925  **
7926  *b Returns:
7927  **
7928  ** 1 if visible, 0 if not
7929  */
7930  int get_weapon_projectile_is_visible(diguyMuzzle muzzle);
7931 
7932  /*l
7933  *b Description:
7934  **
7935  ** Retrieves the position and direction of the character's weapon.
7936  **
7937  *b Arguments:
7938  **
7939  *a muzzle_tx, muzzle_ty, muzzle_tz - muzzle position, and beginning
7940  *a of aim vector
7941  *a end_pt_tx, end_pt_ty, end_pt_tz - end point of aim vector
7942  *a muzzle_rz, muzzle_rx, muzzle_ry - orientation of muzzle in degrees
7943  *a muzzle - the muzzle for which the aim vector is needed
7944  *a in_character_local_coordinates - pass 0 for values in world
7945  *a coordinates (the default), 1 for values in character-local
7946  *a coordinates
7947  **
7948  ** The muzzle position and end point are in meters from the origin
7949  ** (if using world coordinates) or in meters from the character's
7950  ** position (if using character-local coordinates).
7951  **
7952  ** The distance of the end point from the muzzle position should
7953  ** be the weapon's far range, set by set_weapon_far_range().
7954  **
7955  ** Pass NULL for any values that are not needed.
7956  **
7957  ** *Note:* The muzzle argument is currently not used, and is present
7958  ** for future implementation.
7959  **
7960  *b Returns:
7961  **
7962  ** 0 on success, -1 on failure
7963  */
7964  int get_weapon_aim_vector(float* muzzle_tx, float* muzzle_ty, float* muzzle_tz,
7965  float* end_pt_tx = NULL, float* end_pt_ty = NULL, float* end_pt_tz = NULL,
7966  float* muzzle_rz = NULL, float* muzzle_rx = NULL, float* muzzle_ry = NULL,
7967  int in_character_local_coordinates = 0,
7969 
7970  /*l
7971  *b Description
7972  **
7973  ** This function returns the link the passed muzzle is associated
7974  ** with. For example, soldier rifle muzzles are attached to the
7975  ** "rifle_joint" link.
7976  **
7977  ** Call get_muzzle_offset() to get the offset of the muzzle on this
7978  ** link.
7979  **
7980  *b Arguments:
7981  **
7982  *a muzzle - muzzle of interest
7983  **
7984  *b Returns:
7985  **
7986  ** name of link, or NULL if the character doesn't have the specified
7987  ** muzzle
7988  */
7989  const char* get_muzzle_link(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7990 
7991  /*l
7992  *b Description
7993  **
7994  ** This function returns the offset of the muzzle from the link it
7995  ** is attached to as returned by get_muzzle_link().
7996  **
7997  *b Arguments:
7998  **
7999  *a muzzle - muzzle of interest
8000  *a offset_x, offset_y, offset_z - variables in which to return results
8001  **
8002  *b Returns:
8003  **
8004  ** 0 on success, -1 on failure
8005  */
8006  int get_muzzle_offset(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT,
8007  float* offset_x = NULL,
8008  float* offset_y = NULL,
8009  float* offset_z = NULL);
8010 
8011  /*l
8012  *b Description
8013  **
8014  ** This function sets the highest horizontal error possible when the
8015  ** weapon is fired. If non-0, a random horizontal error angle will
8016  ** be computed and added to the weapon's horizontal aim angle.
8017  **
8018  *b Arguments:
8019  **
8020  *a h_error - highest possible horizontal error
8021  **
8022  *b Returns:
8023  **
8024  ** 0 on success, -1 on failure
8025  */
8026  int set_weapon_max_azimuth_error(float h_error);
8027 
8029  float get_weapon_max_azimuth_error();
8030 
8031  /*l
8032  *b Description:
8033  **
8034  ** Similar to set_weapon_max_azimuth_error(), but for vertical aim.
8035  */
8036  int set_weapon_max_elevation_error(float v_error);
8037 
8039  float get_weapon_max_elevation_error();
8040 
8041  /*l
8042  *b Description
8043  **
8044  ** This function sets whether tracer effects will be shown when
8045  ** the weapon is fired. Not all weapons will support this effect.
8046  **
8047  *b Arguments:
8048  **
8049  *a enabled - pass 1 to enable, 0 to disable
8050  **
8051  *b Returns:
8052  **
8053  ** 0 on success, -1 on failure
8054  */
8055  int set_weapon_tracers_enabled(int enabled);
8056 
8058  int get_weapon_tracers_enabled();
8059 
8060  /*l
8061  *b Returns:
8062  **
8063  ** number of rounds until next tracer
8064  */
8065  int get_weapon_rounds_until_tracer(diguyMuzzle muzzle);
8066 
8067 
8068  /*l
8069  *b Description:
8070  **
8071  ** Similar to diguyScenario::trigger_detonation(), but detonation
8072  ** occurs at character's position.
8073  **
8074  *b Arguments:
8075  **
8076  *a munition_name - name of the munition to detonate
8077  *a attacker_name - this MUST be specified if the detonation is being
8078  *a broadcast over the network
8079  *a radius_override - defaults to the data in the munition config file
8080  *a broadcast_on_network - pass 0 to not broadcast detonation on DIS
8081  *a network
8082  **
8083  ** Note: Overriding the detonation radius will NOT work on broadcast
8084  ** detonations since the override value is not transmitted.
8085  */
8086  int trigger_detonation_on_character(const char* munition_name,
8087  const char* attacker_name = NULL,
8088  float radius_override = -1.0f,
8089  int broadcast_on_network = 1);
8090 
8091 
8092 /*****************************************************************************/
8103  /*l
8104  *b Description:
8105  **
8106  ** This function changes the face of the character to reflect the
8107  ** specified user-defined named facial expression.
8108  **
8109  ** Currently affects only "facefx" appearances.
8110  **
8111  *b Arguments:
8112  **
8113  *a facex_name - name of face expression to be applied
8114  *a blend_duration - how long (in seconds) to take to change the face
8115  *a strength - a multiplier between 0 and 1 on the expression
8116  **
8117  ** Face expressions available by default in new scenarios are:
8118  **
8119  *- - Neutral
8120  *- - Smile_cl
8121  *- - Trust
8122  *- - Sad
8123  *- - Mad
8124  *- - Distrust
8125  *- - Conniving
8126  *- - Smile
8127  *- - BrowsDown
8128  *- - BrowsUp
8129  **
8130  ** New face expressions can be added using the
8131  ** diguyScenario::create_face_expression() function.
8132  **
8133  *b Returns:
8134  **
8135  ** 0 on success, -1 on failure
8136  **
8137  *b Available as Decision Bead/Event
8138  **
8139  *b C++ Example:
8140  **
8141  *e diguyCharacter* ch = scenario->get_character_at_index(0);
8142  *e
8143  *e // take one second to get mad
8144  *e ch->set_face_expression("Mad", 1.0);
8145  */
8146  int set_face_expression(const char* facex_name, float blend_duration, float strength = 1.0f);
8147 
8148  /*l
8149  *b Description:
8150  **
8151  ** This function sets the current azimuth and elevation of the
8152  ** character's eyes.
8153  **
8154  ** Currently affects only "facefx" appearances.
8155  **
8156  *b Arguments:
8157  **
8158  *a azimuth - rotation about up (vertical) axis, in degrees;
8159  *a positive rotates to character's left
8160  *a elevation - rotation about forward (horizontal) axis, in degrees;
8161  *a positive rotates down
8162  *a blend_time - how long to take to reach new orientation
8163  **
8164  *b Returns:
8165  **
8166  ** 0 on success, -1 on failure
8167  **
8168  */
8169  int set_orientation_eyes(float azimuth,
8170  float elevation,
8171  float blend_time = 0.0f);
8172 
8173  /*l
8174  *b Description:
8175  **
8176  ** This function gets the current azimuth and elevation of the
8177  ** character's eyes. It currently doesn't take blending into account.
8178  **
8179  ** Currently affects only "facefx" appearances.
8180  **/
8181  int get_orientation_eyes(float* azimuth, float* elevation);
8182 
8183  /*l
8184  *b Description:
8185  **
8186  ** Sets how open the eyes are. The eyes will stay at this level
8187  ** indefinitely. To get automatic blinking behavior, call blink().
8188  **
8189  *b Arguments:
8190  **
8191  *a droop_amount - 1 = eyes closed, 0 = eyes open, 0.5 = half open
8192  **
8193  *b Returns:
8194  **
8195  ** 0 on success, -1 on failure
8196  **
8197  *b Available as Decision Bead/Event
8198  */
8199  int set_eye_droop(float droop_amount, float blend_time = 0.0f);
8200 
8202  float get_eye_droop();
8203 
8204  /*l
8205  *b Description:
8206  **
8207  ** This function blinks the eyes. To have the eyes close to a
8208  ** specific amount and stay there, call set_eye_droop().
8209  **
8210  ** Only characters with expressive face appearances can blink.
8211  **
8212  *b Arguments:
8213  **
8214  *a duration_in - how long in seconds the first part of the blink
8215  *a (typically eyes closing) should take
8216  *a duration_out - how long in seconds the second part of the blink
8217  *a (typically eyes opening) should take
8218  *a target_in - how closed the eyes should be at duration_in
8219  *a target_out - how open the eyes should be at duration_out and
8220  *a thereafter
8221  *a tin - time at which blink should occur; default is now
8222  **
8223  *b Returns:
8224  **
8225  ** 0 on success, -1 on failure
8226  **
8227  *b Available as Decision Bead/Event
8228  */
8229  int blink(float duration_in = 0.1f,
8230  float duration_out = 0.2f,
8231  float target_in = 1.0f,
8232  float target_out = 0.0f,
8233  float tin = DIGUY_DEFAULT_FLOAT);
8234 
8235  /*l
8236  *b Description:
8237  **
8238  ** This function enables automatic eye blinking, so that blinks
8239  ** will happen without further function calls. The various
8240  ** controlling factors of blinks are set by the following functions:
8241  **
8242  *- - set_automatic_blink_duration_in()
8243  *- - set_automatic_blink_duration_out()
8244  *- - set_automatic_blink_target_in()
8245  *- - set_automatic_blink_target_out()
8246  **
8247  ** See blink() for information on what these factors mean.
8248  **
8249  ** Only characters with expressive face appearances can blink.
8250  **
8251  *b Arguments:
8252  **
8253  *a enabled - pass 1 to enable automatic blinks; 0 to disable
8254  *a period - how many seconds between each blink
8255  *a period_variation - variation on how many seconds between
8256  *a each blink
8257  **
8258  ** If blinks are enabled, the first blink will happen immediately.
8259  ** Successive blinks will happen between times (period -
8260  ** period_variation) and (period + period_variation) after the
8261  ** previous blink ends.
8262  **
8263  *b Returns:
8264  **
8265  ** 0 on success, -1 on failure
8266  **
8267  *b Available as Decision Bead/Event
8268  */
8269  int set_automatic_blinks_enabled(int enabled,
8270  float period = 6.0f,
8271  float period_variation = 3.0f);
8272 
8274  int get_automatic_blinks_enabled();
8275 
8276  /*l
8277  *b Description:
8278  **
8279  ** This function sets how long it will take the eye to close during
8280  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8281  ** blink().
8282  **
8283  *b Arguments:
8284  **
8285  *a duration_in - time in seconds for eye droop to go from droop
8286  *a target in to target out
8287  **
8288  *b Available as Decision Bead/Event
8289  */
8290  void set_automatic_blink_duration_in(float duration_in);
8291 
8293  float get_automatic_blink_duration_in();
8294 
8295  /*l
8296  *b Description:
8297  **
8298  ** This function sets how long it will take the eye to open during
8299  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8300  ** blink().
8301  **
8302  *b Arguments:
8303  **
8304  *a duration_out - time in seconds for eye droop to go from droop
8305  *a target out to target in
8306  **
8307  *b Available as Decision Bead/Event
8308  */
8309  void set_automatic_blink_duration_out(float duration_out);
8310 
8312  float get_automatic_blink_duration_out();
8313 
8314  /*l
8315  *b Description:
8316  **
8317  ** This function sets how much the eye will close during
8318  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8319  ** blink().
8320  **
8321  *b Arguments:
8322  **
8323  *a target_in - how far to close eye; 1.0 is all closed, 0.0 is
8324  *a all open
8325  **
8326  *b Available as Decision Bead/Event
8327  */
8328  void set_automatic_blink_target_in(float target_in);
8329 
8331  float get_automatic_blink_target_in();
8332 
8333  /*l
8334  *b Description:
8335  **
8336  ** This function sets how much the eye will open during
8337  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8338  ** blink().
8339  **
8340  *b Arguments:
8341  **
8342  *a target_out - how far to open eye; 1.0 is all closed, 0.0 is
8343  *a all open
8344  **
8345  *b Available as Decision Bead/Event
8346  */
8347  void set_automatic_blink_target_out(float target_out);
8348 
8350  float get_automatic_blink_target_out();
8351 
8352  /*l
8353  *b Returns:
8354  **
8355  ** 1 if the character is speaking, 0 if not. With a FaceFX character
8356  ** this is true if a character is actively playing a FaceFX animation
8357  */
8358  int is_speaking();
8359 
8360  /*l
8361  *b Description:
8362  **
8363  ** FaceFX animations are referred to as a group/animation name.
8364  ** This function allows you to set the current group once.
8365  ** See diguyScenario::facefx_mount_animset() for how to load a new
8366  ** animset on an actor.
8367  */
8368  int set_current_facefx_animation_group(const char* anim_group);
8369 
8370  /*l
8371  *b Returns:
8372  **
8373  ** the current FaceFX animation group set for this character
8374  */
8375  const char* get_current_facefx_animation_group();
8376 
8377  /*l
8378  *b Returns:
8379  **
8380  ** the name of the FaceFX actor that goes with the current head
8381  ** appearance; returns NULL if there's no FaceFX actor
8382  */
8383  const char* get_facefx_actor();
8384 
8385  /*l
8386  *b Description:
8387  **
8388  ** Mounts an animset on the current FaceFX actor. See also
8389  ** diguyScenario::facefx_mount_animset()
8390  */
8391  int facefx_mount_animset(const char* file_name);
8392 
8393  /*l
8394  *b Description:
8395  **
8396  ** Plays a FaceFX animation. This is the main way a facial animation
8397  ** sequence is triggered. The animation can be named
8398  ** "group_name/animation" or just "animation" if the proper group has
8399  ** been set with set_current_facefx_animation_group().
8400  */
8401  int play_facefx_animation(const char* animation,
8402  float magnitude_scale = 1.0f,
8403  float duration_scale = 1.0f,
8404  float blendin_time = 0.1f,
8405  float blendout_time = 0.1f,
8406  int loop = 0);
8407 
8408  /*l
8409  *b Description:
8410  **
8411  ** Stops all active FaceFX animations.
8412  */
8413  int stop_facefx_animations(float blend_time = 0.25f, int stop_sounds = 1);
8414 
8415  /*****************************************************************************/
8420  /*l
8421  *b Returns:
8422  **
8423  ** the number of nodes in the FaceFX actor's face graph
8424  */
8425  int get_num_facefx_nodes();
8426 
8427  /*l
8428  *b Returns:
8429  **
8430  ** the name of the node with index 'index' in the FaceFX actor's face
8431  ** graph
8432  */
8433  const char* get_facefx_node_name(int index);
8434 
8435  /*l
8436  *b Returns:
8437  **
8438  ** the index of the node with name 'node_name'
8439  */
8440  int find_facefx_node_index(const char* node_name);
8441 
8442  /*l
8443  *b Description:
8444  **
8445  ** Allows low level control of individual nodes of the characters face
8446  ** graph. End users can use this function to get finer grained
8447  ** control over eye direction and emotional state.
8448  */
8449  int set_facefx_node_value(int node_index,
8450  float value,
8451  float blend_time = 0.25f);
8452 
8453  /*l
8454  *b Description:
8455  **
8456  ** Retrieves the current final value of a node
8457  **/
8458  float get_facefx_node_value(int node_index);
8459 
8460 /*****************************************************************************/
8504  /*l
8505  *b Description:
8506  **
8507  ** This function creates (but does not begin) the specified gesture.
8508  ** Exact control over the gesture, such as number of repetitions,
8509  ** when the gesture should begin, when it should end, when it
8510  ** should reach specific points within the gestures, etc., is then
8511  ** possible by making calls through the returned
8512  ** diguyCharacterGesture object.
8513  **
8514  ** To begin execution of the gesture, call the begin_now() function
8515  ** of the diguyCharacterGesture object.
8516  **
8517  ** *Do not* call delete on the returned object. It should be
8518  ** destroyed either by calling destroy_gesture(), or by calling
8519  ** set_automatic_destroy_flag(1) on the diguyCharacterGesture
8520  ** object.
8521  **
8522  *b Arguments:
8523  **
8524  *a gesture_name - name of the gesture of create
8525  **
8526  *b Returns:
8527  **
8528  ** pointer to object of type diguyCharacterGesture
8529  */
8530  diguyCharacterGesture* create_gesture(const char* gesture_name);
8531 
8532  /*l
8533  *b Description:
8534  **
8535  ** This function destroys a gesture object created by
8536  ** create_gesture().
8537  **
8538  *b Arguments:
8539  **
8540  *a gesture - gesture to destroy
8541  **
8542  *b Returns:
8543  **
8544  ** 0 on success, -1 on failure
8545  */
8546  int destroy_gesture(diguyCharacterGesture* gesture);
8547 
8548  /*l
8549  *b Description:
8550  **
8551  ** This function executes the specified gesture or motion file on disk.
8552  **
8553  ** The gesture will automatically begin and end. The only control
8554  ** over the executed gesture is whether is should be ended or aborted
8555  ** early. See end_executing_gesture() and abort_executing_gesture().
8556  ** For full control of gesture attributes, use create_gesture()
8557  ** instead.
8558  **
8559  ** A gesture takes over control of a subset of a character's pose
8560  ** variables and can be overlaid on top of most base actions of the
8561  ** character.
8562  **
8563  ** Note that gestures should be preloaded at the beginning of a
8564  ** scenario to avoid a hitch in frame rate. See the function
8565  ** diguyScenario::preload_gesture().
8566  **
8567  ** This function will have no effect on a dead character (see
8568  ** die_now() and get_dead()).
8569  **
8570  *b Arguments:
8571  **
8572  *a gesture_name - name of the gesture to execute, as of diguy 13.2 this can be
8573  *a a bdm file, and a full body gesture will be created on the fly.
8574  *a reps - how many times the gesture should be
8575  *a repeated; default is 1 if no duration
8576  *a is specified, or best fit if there is
8577  *a a duration specified
8578  *a overall_duration - for how long the gesture should be executed;
8579  *a default is such that no time scaling occurs
8580  *a channel_A_weight - the weight given to channel A of the
8581  *a gesture; ignored if the gesture does not
8582  *a have multiple channels
8583  **
8584  ** If the gesture is a multi-stage gesture, the overall duration
8585  ** will be spread proportionately over each stage.
8586  **
8587  *b Returns:
8588  **
8589  ** 0 on success, -1 on failure
8590  **
8591  *b Available as Decision Bead/Event
8592  */
8593  int execute_gesture(const char* gesture_name,
8594  int reps = DIGUY_DEFAULT_INT,
8595  float overall_duration = DIGUY_DEFAULT_FLOAT,
8596  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8597 
8598  /*l
8599  *b Description:
8600  **
8601  ** The gesture will automatically begin and end. The only control
8602  ** over the executed gesture is whether is should be ended or aborted
8603  ** early. See end_executing_gesture() and abort_executing_gesture().
8604  ** For full control of gesture attributes, use create_gesture()
8605  ** instead.
8606  **
8607  ** If the specified gesture is not a 1 stage gesture, no gesture
8608  ** is executed and an error value is returned.
8609  **
8610  ** The specified gesture can be a one or two channel 1 stage gesture,
8611  ** in which case the specified channel weight will be used over the
8612  ** course of the entire gesture.
8613  **
8614  ** A 1 stage gesture is a comprised of a single motion that begins
8615  ** and ends the gesture.
8616  **
8617  ** n repetitions of a 1 stage gesture will repeat the stage 1
8618  ** motion n times.
8619  **
8620  ** This function will have no effect on a dead character (see
8621  ** die_now() and get_dead()).
8622  **
8623  *b Arguments:
8624  **
8625  *a gesture_name - name of the gesture of execute
8626  *a reps - how many times the gesture should be
8627  *a repeated; default is 1 if no duration
8628  *a is specified, or best fit if there is
8629  *a a duration specified
8630  *a stage1_duration - how long stage 1 of the gesture should take;
8631  *a default is such that no time scaling occurs
8632  *a channel_A_weight - the weight given to channel A of the
8633  *a gesture; ignored if the gesture does not
8634  *a have multiple channels
8635  **
8636  *b Returns:
8637  **
8638  ** 0 on success, -1 on failure
8639  */
8640  int execute_1stage_gesture(const char* gesture_name,
8641  int reps = DIGUY_DEFAULT_INT,
8642  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8643  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8644 
8645  /*l
8646  *b Description:
8647  **
8648  ** This function is similar to execute_1stage_gesture().
8649  **
8650  ** Stage 1 of a 2 stage gesture is a motion that begins the gesture
8651  ** and leads to the "peak" of the gesture.
8652  **
8653  ** Stage 2 of a 2 stage gesture is the motion that returns the
8654  ** gesture from the "peak" to the starting position.
8655  **
8656  ** n repetitions of a 2 stage gesture will repeat the stage 1 motion
8657  ** followed by the stage 2 motion n times.
8658  **
8659  ** This function will have no effect on a dead character (see
8660  ** die_now() and get_dead()).
8661  **
8662  *b Arguments:
8663  **
8664  *a gesture_name - name of the gesture of execute
8665  *a reps - how many times the gesture should be
8666  *a repeated; default is 1 if no duration
8667  *a is specified, or best fit if there is
8668  *a a duration specified
8669  *a stage1_duration - how long stage 1 of the gesture should take,
8670  *a i.e., how far into the gesture the "peak"
8671  *a will occur;
8672  *a default is such that no time scaling occurs
8673  *a stage2_duration - how long stage 2 of the gesture should take;
8674  *a default is such that no time scaling occurs
8675  *a channel_A_weight - the weight given to channel A of the
8676  *a gesture; ignored if the gesture does not
8677  *a have multiple channels
8678  **
8679  *b Returns:
8680  **
8681  ** 0 on success, -1 on failure
8682  */
8683  int execute_2stage_gesture(const char* gesture_name,
8684  int reps = DIGUY_DEFAULT_INT,
8685  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8686  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8687  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8688 
8689  /*l
8690  *b Description:
8691  **
8692  ** This function is similar to execute_1stage_gesture().
8693  **
8694  ** Stage 1 of a 3 stage gesture is a motion that begins the gesture
8695  ** and leads to stage 2; e.g., raising the right arm in preparation
8696  ** for waving.
8697  **
8698  ** Stage 2 of a 3 stage gesture is a motion that can loop
8699  ** indefinitely; e.g., waving the right arm back and forth.
8700  **
8701  ** Stage 3 of a 3 stage gesture is the motion that ends the gesture;
8702  ** e.g., returning the right arm to the side of the body to complete
8703  ** the wave.
8704  **
8705  ** n repetitions of a 3 stage gesture will play the stage 1 motion
8706  ** once, followed by n reps of the stage 2 motion, followed by 1
8707  ** stage 3 motion.
8708  **
8709  ** This function will have no effect on a dead character (see
8710  ** die_now() and get_dead()).
8711  **
8712  *b Arguments:
8713  **
8714  *a gesture_name - name of the gesture of execute
8715  *a reps - how many times the gesture should be
8716  *a repeated; default is 1 if no duration
8717  *a is specified, or best fit if there is
8718  *a a duration specified
8719  *a stage1_duration - how long stage 1 of the gesture should take;
8720  *a default is such that no time scaling occurs
8721  *a stage2_duration - how long each repetition of stage 2 of the
8722  *a gesture should take;
8723  *a default is such that no time scaling occurs
8724  *a stage3_duration - how long stage 3 of the gesture should take;
8725  *a default is such that no time scaling occurs
8726  *a channel_A_weight - the weight given to channel A of the
8727  *a gesture; ignored if the gesture does not
8728  *a have multiple channels
8729  **
8730  *b Returns:
8731  **
8732  ** 0 on success, -1 on failure
8733  */
8734  int execute_3stage_gesture(const char* gesture_name,
8735  int reps = DIGUY_DEFAULT_INT,
8736  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8737  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8738  float stage3_duration = DIGUY_DEFAULT_FLOAT,
8739  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8740 
8741  /*l
8742  *b Description:
8743  **
8744  ** The gesture will automatically begin and end. The only control
8745  ** over the executed gesture is whether is should be ended or aborted
8746  ** early. See end_executing_gesture() and abort_executing_gesture().
8747  ** For full control of gesture attributes, use create_gesture()
8748  ** instead.
8749  **
8750  ** This function serves as a quick way of executing a table gesture.
8751  ** There are many capabilities of table gestures that are accessible
8752  ** only through the full diguyCharacterGesture object.
8753  **
8754  ** If the specified gesture is not a table gesture, no gesture is
8755  ** executed and an error value is returned.
8756  **
8757  ** A table stage gesture is a comprised of a table of gesture actions
8758  ** that can be transitioned between without going through a neutral
8759  ** position.
8760  **
8761  ** n repetitions of a table gesture will repeat the loop action
8762  ** n times.
8763  **
8764  ** This function will have no effect on a dead character (see
8765  ** die_now() and get_dead()).
8766  **
8767  *b Arguments:
8768  **
8769  *a gesture_name - name of the gesture of execute
8770  *a reps - how many times the gesture should be repeated;
8771  *a default is 1
8772  *a loop_action - which action in the gesture should be looped;
8773  *a default is action at index 1 of table
8774  *a begin_action - which action the gesture should begin from;
8775  *a default is action at index 0
8776  *a end_action - which action the gesture should end at;
8777  *a default is action at index 0
8778  **
8779  *b Returns:
8780  **
8781  ** 0 on success, -1 on failure
8782  */
8783  int execute_table_gesture(const char* gesture_name,
8784  int reps = DIGUY_DEFAULT_INT,
8785  const char* loop_action = NULL,
8786  const char* begin_action = NULL,
8787  const char* end_action = NULL);
8788 
8789  /*l
8790  *b Description:
8791  **
8792  ** Documentation Pending
8793  **/
8794  int set_executing_table_gesture_desired_action(const char* gesture_name,
8795  const char* desired_action);
8796 
8797  /*l
8798  *b Description:
8799  **
8800  ** This function alerts the specified gesture that it should end.
8801  ** The gesture will stop repeating and play its "out" motions as
8802  ** soon as possible.
8803  **
8804  ** In order to immediately stop the gesture, use the
8805  ** abort_executing_gesture() function.
8806  **
8807  *b Arguments:
8808  **
8809  *a gesture_name - name of executing gesture to end
8810  **
8811  *b Returns:
8812  **
8813  ** 0 on success, -1 on failure
8814  **
8815  *b See Also:
8816  **
8817  ** abort_executing_gesture()
8818  */
8819  int end_executing_gesture(const char* gesture_name);
8820 
8821  /*l
8822  *b Description:
8823  **
8824  ** This function aborts a gesture previously executed by one of
8825  ** the execute_*_gesture() calls, if it is currently executing.
8826  ** If a gesture with the given name is not executing, this function
8827  ** will have no effect.
8828  **
8829  ** This call won't cause the gesture to switch to its "out" motion;
8830  ** it is a straight-forward blend out of whatever the gesture is
8831  ** currently doing. Use the end_executing_gesture() call to make
8832  ** the gesture play its "out" motion as soon as possible,
8833  ** therefore ending the gesture in a smoother way.
8834  **
8835  *b Arguments:
8836  **
8837  *a gesture_name - name of executing gesture to abort
8838  *a max_rampdown_interval - max amount of time spent trying to
8839  *a smooth over any motion seams; set
8840  *a to 0.5 for a smooth transition, set
8841  *a to 0 for an immediate abort
8842  **
8843  *b Returns:
8844  **
8845  ** 0 on success, -1 on failure
8846  **
8847  *b See Also:
8848  **
8849  ** end_executing_gesture(), abort_all_gestures()
8850  */
8851  int abort_executing_gesture(const char* gesture_name,
8852  float max_rampdown_interval = .5f);
8853 
8854  /*l
8855  *b Description:
8856  **
8857  ** This function alerts all active gestures that they should end.
8858  ** The gestures will stop repeating and play their "out" motions as
8859  ** soon as possible.
8860  **
8861  ** In order to immediately stop all gestures, use the
8862  ** abort_all_gestures() function.
8863  **
8864  *b Returns:
8865  **
8866  ** 0 on success, -1 on failure
8867  **
8868  *b See Also:
8869  **
8870  ** abort_all_gestures(), diguyCharacterGesture::end_gesture()
8871  */
8872  int end_all_gestures();
8873 
8874  /*l
8875  *b Description:
8876  **
8877  ** This function aborts all active gestures. All gestures will
8878  ** immediately begin to lose their effect on the
8879  ** character's pose.
8880  **
8881  ** This won't cause the gestures to switch to their "out" motions;
8882  ** it is a straight-forward blend out of whatever the gesture is
8883  ** currently doing. Use the end_all_gestures() call to make all
8884  ** active gestures play their "out" motions as soon as possible,
8885  ** therefore ending the gestures in a smoother way.
8886  **
8887  *b Arguments:
8888  **
8889  *a max_rampdown_interval - max amount of time spent trying to
8890  *a smooth over any motion seams; set
8891  *a to 0.5 for a smooth transition, set
8892  *a to 0 for an immediate abort
8893  **
8894  *b Returns:
8895  **
8896  ** 0 on success, -1 on failure
8897  **
8898  *b See Also:
8899  **
8900  ** end_all_gestures(), diguyCharacterGesture::abort_now()
8901  */
8902  int abort_all_gestures(float max_rampdown_interval);
8903 
8904 
8905 /*****************************************************************************/
8937  /*l
8938  *b Description:
8939  **
8940  ** This function will play the specified sound. The sound will be
8941  ** "ambient"; i.e., it will be equally audible from everywhere within
8942  ** the world. Use the function play_3d_sound() to play a sound that
8943  ** moves with the character.
8944  **
8945  ** This function will have no effect on a dead character (see
8946  ** die_now() and get_dead()).
8947  **
8948  ** Unless the sound loops, the sound will play to completion and then
8949  ** stop. To stop the sound early or stop a looping sound call
8950  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
8951  **
8952  *b Arguments
8953  **
8954  *a sound_name - name of sound to play
8955  *a sound_gain - by how much sound's amplitude should be multiplied
8956  *a sound_loop - indicates that sound should loop indefinitely
8957  **
8958  ** There must be a diguySound in the scenario with the passed
8959  ** sound_name. See diguyScenario::create_sound().
8960  **
8961  ** See set_current_voice_actor() for information on how a voice actor
8962  ** can change which sound in the scenario is selected.
8963  **
8964  *b Returns:
8965  **
8966  ** 0 on success, -1 on failure
8967  **
8968  *b Available as Decision Bead/Event
8969  */
8970  int play_sound(const char* sound_name,
8971  float sound_gain = 1.0f,
8972  int sound_loops = 0);
8973 
8974  /*l
8975  *b Description:
8976  **
8977  ** This function will play the specified sound at the character's
8978  ** location. As the character moves, the sound will move with it.
8979  ** Use the function play_sound() to play a sound that is ambient and
8980  ** does not move with the character.
8981  **
8982  ** Note that not all sound modules support 3D sounds.
8983  **
8984  ** This function will have no effect on a dead character (see
8985  ** die_now() and get_dead()).
8986  **
8987  ** Unless the sound loops, the sound will play to completion and then
8988  ** stop. To stop the sound early or stop a looping sound call
8989  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
8990  **
8991  *b Arguments
8992  **
8993  *a sound_name - the name of the sound to play
8994  *a sound_gain - by how much the sound's amplitude
8995  *a should be multiplied
8996  *a sound_loop - indicates that the sound should loop
8997  *a indefinitely
8998  **
8999  ** There must be a diguySound in the scenario with the passed
9000  ** sound_name. See diguyScenario::create_sound().
9001  **
9002  ** See set_current_voice_actor() for information on how a voice actor
9003  ** can change which sound in the scenario is selected.
9004  **
9005  *b Returns:
9006  **
9007  ** 0 on success, -1 on failure
9008  **
9009  *b Available as Decision Bead/Event
9010  */
9011  int play_3d_sound(const char* sound_name,
9012  float sound_gain = 1.0f,
9013  int sound_loops = 0);
9014 
9015  /*l
9016  *b Description:
9017  **
9018  ** This function creates (but does not start playing) an instance of
9019  ** the specified sound.
9020  **
9021  ** Exact control over the sound instance is possible by making calls
9022  ** through the returned diguySoundInstance object.
9023  **
9024  ** To begin playing the sound, call diguySoundInstance::begin_now().
9025  **
9026  ** *Do not* call delete on the returned object. It should be
9027  ** destroyed either by calling diguyCharacter::destroy_sound_instance()
9028  ** or by calling diguySoundInstance::set_automatic_destroy_flag(1) on
9029  ** the returned object.
9030  **
9031  *b Arguments:
9032  **
9033  *a sound_name - name of the sound for which to create an instance
9034  **
9035  ** There must be a diguySound in the scenario with the passed
9036  ** sound_name. See diguyScenario::create_sound().
9037  **
9038  *b Returns:
9039  **
9040  ** pointer to object of type diguySoundInstance
9041  */
9042  diguySoundInstance* create_sound_instance(const char* sound_name);
9043 
9044  /*l
9045  *b Description:
9046  **
9047  ** This function destroys a sound instance object created by
9048  ** create_sound_instance().
9049  **
9050  ** Do not destroy a sound for which the
9051  ** diguySoundInstance::set_automatic_destroy_flag(1) has been called.
9052  **
9053  *b Arguments:
9054  **
9055  *a sound_instance - sound instance to destroy
9056  **
9057  *b Returns:
9058  **
9059  ** 0 on success, -1 on failure
9060  */
9061  int destroy_sound_instance(diguySoundInstance* sound_instance);
9062 
9063  /*l
9064  *b Description:
9065  **
9066  ** This function stops all active sound instances from this character.
9067  ** All sounds being played by this character will fade out and stop
9068  ** after rampdown_time, by default fade out is instant.
9069  **
9070  ** Sound instances that are automatically managed will be destroyed.
9071  ** This includes sound started by a call to
9072  ** diguyCharacter::play_sound() or a sound instance whose
9073  ** set_automatic_destroy_flag() function has been called.
9074  **
9075  ** diguySoundInstance pointers returned by a call to
9076  ** diguyCharacter::create_sound_instance(), which have not been set to
9077  ** be automatically destroyed, will still be valid.
9078  **
9079  *b Arguments:
9080  **
9081  *a rampdown_time - how long to fade out the sound
9082  **
9083  *b Returns:
9084  **
9085  ** 0 on success, -1 on failure
9086  **
9087  *b Available as Decision Bead/Event
9088  */
9089  int stop_all_sounds(float rampdown_time = 0.0f);
9090 
9091  /*l
9092  *b Description:
9093  **
9094  ** This function stops a named sound instance from this character.
9095  **
9096  ** Sound instances that are automatically managed will be destroyed.
9097  ** This includes sound started by a call to
9098  ** diguyCharacter::play_sound() or a sound instance whose
9099  ** set_automatic_destroy_flag() function has been called.
9100  **
9101  ** diguySoundInstance pointers returned by a call to
9102  ** diguyCharacter::create_sound_instance(), which have not been set to
9103  ** be automatically destroyed, will still be valid.
9104  **
9105  *b Arguments:
9106  **
9107  *a sound_name - the name of the sound to stop
9108  *a rampdown_time - how long to fade out the sound
9109  **
9110  *b Returns:
9111  **
9112  ** 0 on success, -1 on failure
9113  **
9114  *b Available as Decision Bead/Event
9115  */
9116  int stop_sound(const char* sound_name, float rampdown_time = 0.0f);
9117 
9118  /*l
9119  *b Returns:
9120  **
9121  ** 1 if the character is playing a the sound specified, 0 if not
9122  */
9123  int is_playing_sound(const char* sound_name);
9124 
9125  /*l
9126  *b Description:
9127  **
9128  ** Sets the "voice actor" for the character.
9129  **
9130  ** Having a voice actor can change which sounds from the scenario a
9131  ** character selects when the diguyCharacter::play_sound() or
9132  ** diguyCharacter::play_3d_sound().
9133  **
9134  ** When play_sound() is called the character asks the scenario for
9135  ** the sound with the specified name. If a voice actor has been set
9136  ** the character will first ask the scenario for the sound name
9137  ** prepended with the voice actor and a slash ("/"). If there isn't
9138  ** a sound with that modified name, it will ask the scenario for a
9139  ** sound with the exact specified name.
9140  **
9141  ** For example, if the character has the voice actor "carl" and is
9142  ** told to play the sound "run_away", the character will first look
9143  ** for a sound named "carl/run_away". If that isn't found, it will
9144  ** look for a sound named "run_away". (If that isn't found no sound
9145  ** is played.)
9146  **
9147  *b Lua Example:
9148  **
9149  ** A more specific example: say that various characters in the
9150  ** scenario need to say "hello". Some of the characters are male,
9151  ** some are female. There are two ways this can be set up.
9152  **
9153  ** The first way, not using a voice actor, is to have two sounds
9154  ** specified in the scenario: "male_hello" and "female_hello". These
9155  ** sounds specify the sound files "male_hello.wav" and
9156  ** "female_hello.wav", respectively. A male character would then do
9157  ** the following to say hello:
9158  **
9159  *e male_character:play_sound("male_hello")
9160  **
9161  ** A female character would do:
9162  **
9163  *e female_character:play_sound("female_hello")
9164  **
9165  ** This is fine, except when one script or character mind needs to be
9166  ** shared by a range of characters, some male and some female.
9167  **
9168  ** In this case it's better to use a voice actor. Say that the sounds
9169  ** specified above have the names "male/hello" and "female/hello";
9170  ** they still have the separate sound files specified. If the
9171  ** character has its voice actor specified as "male" and is told to
9172  ** play the sound "hello", it will select the sound "male/hello" as
9173  ** the sound to play. If its voice actor is "female" and is told to
9174  ** play the sound "hello", it will select the sound "female/hello".
9175  **
9176  *e -- called earlier: character:set_voice_actor("male")
9177  *e character:play_sound("hello") -- plays sound "male/hello"
9178  **
9179  *e -- called earlier: character:set_voice_actor("female")
9180  *e character:play_sound("hello") -- plays sound "female/hello"
9181  **
9182  *b Arguments:
9183  **
9184  *a voice_actor - name of voice actor
9185  **
9186  ** voice_actor can be an arbitrary string. It doesn't need to match
9187  ** any character name, but should have matching sounds specified in
9188  ** the scenario.
9189  **
9190  *b Returns:
9191  **
9192  ** 0 on success, -1 on failure
9193  */
9194  int set_current_voice_actor(const char* voice_actor);
9195 
9197  const char* get_current_voice_actor();
9198 
9199 
9200 /*****************************************************************************/
9236  /*l
9237  *b Description:
9238  **
9239  ** This function returns the state of the character in the form
9240  ** required by DIS.
9241  **
9242  ** Note that there is no corresponding set_DIS_lifeform_state()
9243  ** function. The lifeform state is derived from the character's
9244  ** action, posture, and variant information.
9245  **
9246  *b Returns:
9247  **
9248  ** one of the following values defined in diguy_dis_constants.h:
9249  **
9250  *- DIGUY_DIS_LIFEFORM_UNUSED (0)
9251  *- DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9252  *- DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9253  *- DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9254  *- DIGUY_DIS_LIFEFORM_KNEELING (4)
9255  *- DIGUY_DIS_LIFEFORM_PRONE (5)
9256  *- DIGUY_DIS_LIFEFORM_CRAWLING (6)
9257  *- DIGUY_DIS_LIFEFORM_SWIMMING (7)
9258  *- DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9259  *- DIGUY_DIS_LIFEFORM_JUMPING (9)
9260  *- DIGUY_DIS_LIFEFORM_SITTING (10)
9261  *- DIGUY_DIS_LIFEFORM_SQUATTING (11)
9262  *- DIGUY_DIS_LIFEFORM_CROUCHING (12)
9263  *- DIGUY_DIS_LIFEFORM_WADING (13)
9264  **
9265  *b Callable For Networked Entities That Are:
9266  **
9267  *- - DIS published and reflected
9268  */
9269  int get_DIS_lifeform_state();
9270 
9271  /*l
9272  *b Description:
9273  **
9274  ** This function returns the position of the character's
9275  ** primary weapon, in the form required by DIS.
9276  **
9277  *b Returns:
9278  **
9279  ** one of the following values defined in diguy_dis_constants.h:
9280  **
9281  *- DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9282  *- DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9283  *- DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9284  *- DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9285  **
9286  *b Callable For Networked Entities That Are:
9287  **
9288  *- - DIS published
9289  */
9290  int get_DIS_primary_weapon_position();
9291 
9292  /*l
9293  *b Description:
9294  **
9295  ** This function returns the position of the character's
9296  ** secondary weapon, in the form required by DIS.
9297  **
9298  *b Returns:
9299  **
9300  ** one of the following values defined in diguy_dis_constants.h:
9301  **
9302  *- DIGUY_DIS_SECONDARY_WEAPON_NOT_PRESENT (0)
9303  *- DIGUY_DIS_SECONDARY_WEAPON_STOWED (1)
9304  *- DIGUY_DIS_SECONDARY_WEAPON_DEPLOYED (2)
9305  *- DIGUY_DIS_SECONDARY_WEAPON_IN_FIRING_POSITION (3)
9306  **
9307  *b Callable For Networked Entities That Are:
9308  **
9309  *- - DIS published
9310  */
9311  int get_DIS_secondary_weapon_position();
9312 
9313  /*l
9314  *b Description:
9315  **
9316  ** This function sets the Marking Text for characters that are
9317  ** published to the network by DI-Guy Networking. The default
9318  ** network marking is the empty string "".
9319  **
9320  ** This function should only be called for published characters.
9321  ** The Marking Text is set internally for reflected characters.
9322  **
9323  *b Returns:
9324  **
9325  ** 0 on success, -1 on failure
9326  **
9327  *b Callable For Networked Entities That Are:
9328  **
9329  *- - DIS published
9330  *- - HLA published
9331  */
9332  int set_network_marking(const char* network_marking);
9333 
9334  /*l
9335  *b Description:
9336  **
9337  ** This function gets the Marking Text for characters.
9338  **
9339  ** For published characters this value will be what was most
9340  ** recently set by set_network_marking().
9341  **
9342  ** For reflected characters this value will be read from the
9343  ** reflected characters' entity state information.
9344  **
9345  *b Returns:
9346  **
9347  ** character's Marking Text; will never be NULL
9348  **
9349  *b Callable For Networked Entities That Are:
9350  **
9351  *- - DIS published and reflected
9352  *- - HLA published and reflected
9353  */
9354  const char* get_network_marking();
9355 
9356  /*l
9357  *b Description:
9358  **
9359  ** This function sets whether this character will be published
9360  ** by DI-Guy Networking. This value is persistent, and does
9361  ** not depend on whether there actually *is* currently a
9362  ** network connection.
9363  **
9364  ** The default is 1, the character is published.
9365  **
9366  ** This function should *not* be called for reflected characters.
9367  ** It affects to both DIS and HLA networking.
9368  **
9369  *b Returns:
9370  **
9371  ** 0 on success, -1 on failure
9372  **
9373  *b Callable For Networked Entities That Are:
9374  **
9375  *- - DIS published
9376  *- - HLA published
9377  */
9378  int set_is_network_published(int is_network_published);
9379 
9380  /*l
9381  *b Description:
9382  **
9383  ** This function returns whether the character is published
9384  ** by DI-Guy Networking. It will always return 0 for reflected
9385  ** characters.
9386  **
9387  ** This function can be called for any character.
9388  **
9389  *b Returns:
9390  **
9391  ** 1 if published, 0 if not
9392  **
9393  *b Available as Decision Bead/Event
9394  **
9395  *b Callable For Networked Entities That Are:
9396  **
9397  *- - DIS published and reflected
9398  *- - HLA published and reflected
9399  */
9400  int get_is_network_published();
9401 
9402  /*l
9403  *b Description:
9404  **
9405  ** Experimental function that returns a vrlink entity state repository,
9406  ** useful for adding additional information to a diguy that we don't usually
9407  ** model.
9408  */
9409  DtEntityStateRepository * get_vrlink_entity_state_repository();
9410 
9411  /*l
9412  *b Description:
9413  **
9414  ** This function returns whether the character is a
9415  ** reflected character created by DI-Guy Networking.
9416  **
9417  ** This function can be called for any character.
9418  **
9419  *b Returns:
9420  **
9421  ** 1 if reflected, 0 if not
9422  **
9423  *b Available as Decision Bead/Event
9424  **
9425  *b Callable For Networked Entities That Are:
9426  **
9427  *- - DIS published and reflected
9428  *- - HLA published and reflected
9429  */
9430  int get_is_network_reflected();
9431 
9432  /*l
9433  *b Description:
9434  **
9435  ** This function returns whether this character is in a
9436  ** "paused" state. This will only be true for reflected
9437  ** characters.
9438  **
9439  ** A reflected character will be paused if the network
9440  ** entity it is representing is paused; i.e., its personal
9441  ** timeline is not advancing. The most common case of this
9442  ** is when this character is reflecting a published character
9443  ** of a DI-Guy Scenario application that is in a paused or
9444  ** stopped state.
9445  **
9446  ** If DI-Guy Scenario, paused characters will remain frozen
9447  ** in their current postures.
9448  **
9449  *b Returns:
9450  **
9451  ** 1 if paused, 0 if not
9452  **
9453  *b Available as Decision Bead/Event
9454  */
9455  int get_is_network_paused();
9456 
9457  /*l
9458  *b Description:
9459  **
9460  ** Overrides built-in logic for network pausing, becomes end user's responsibility
9461  ** to manage
9462  */
9463  int set_is_network_paused(int paused);
9464 
9465  /*l
9466  *b Description:
9467  **
9468  ** This function returns the character's "network entity number".
9469  ** This number is valid and persistent regardless of whether the
9470  ** character is currently published.
9471  **
9472  ** This number is primarily used internally by DI-Guy Networking
9473  ** for creating entity IDs.
9474  **
9475  *b Returns:
9476  **
9477  ** character's network entity number
9478  **
9479  *b Callable For Networked Entities That Are:
9480  **
9481  *- - DIS published and reflected
9482  *- - HLA published and reflected
9483  */
9484  int get_network_entity_number();
9485 
9486  /*l
9487  *b Description:
9488  **
9489  ** This function returns the name of an action for a character,
9490  ** given the DIS damage state, lifeform state, primary weapon
9491  ** state, speed of the character, and direction of travel.
9492  ** Constants are all defined in diguy_dis_constants.h:
9493  **
9494  *b Arguments:
9495  **
9496  *a damage_state - one of the values listed below
9497  *a life_form_state - one of the values listed below
9498  *a primary_weapon_state - one of the values listed below
9499  *a speed - in meters/second
9500  *a forward - whether the action should move
9501  *a forward (pass 1), or backward (pass 0)
9502  **
9503  ** Valid values for damage_state:
9504  **
9505  *- - DIGUY_DIS_DAMAGE_NONE (0)
9506  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9507  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9508  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9509  **
9510  ** Valid values for life_form_state:
9511  **
9512  *- - DIGUY_DIS_LIFEFORM_UNUSED (0)
9513  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9514  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9515  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9516  *- - DIGUY_DIS_LIFEFORM_KNEELING (4)
9517  *- - DIGUY_DIS_LIFEFORM_PRONE (5)
9518  *- - DIGUY_DIS_LIFEFORM_CRAWLING (6)
9519  *- - DIGUY_DIS_LIFEFORM_SWIMMING (7)
9520  *- - DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9521  *- - DIGUY_DIS_LIFEFORM_JUMPING (9)
9522  *- - DIGUY_DIS_LIFEFORM_SITTING (10)
9523  *- - DIGUY_DIS_LIFEFORM_SQUATTING (11)
9524  *- - DIGUY_DIS_LIFEFORM_CROUCHING (12)
9525  *- - DIGUY_DIS_LIFEFORM_WADING (13)
9526  **
9527  ** Valid values for primary_weapon_state:
9528  **
9529  *- - DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9530  *- - DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9531  *- - DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9532  *- - DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9533  **
9534  ** Note that a backward motion can be requested in a couple of
9535  ** ways: either by passing a negative speed, or by passing
9536  ** 0 for the forward argument, or both.
9537  **
9538  *b Returns:
9539  **
9540  ** name of an action if a match is found, NULL if not
9541  **
9542  *b Callable For Networked Entities That Are:
9543  **
9544  *- - DIS published
9545  */
9546  const char* get_action_from_entity_state(int damage_state,
9547  int life_form_state,
9548  int primary_weapon_state,
9549  float speed,
9550  int forward);
9551 
9552  /*l
9553  *b Description:
9554  **
9555  ** Sets the damage state for the network published character.
9556  ** Depending on the appearance configuration info the character may automatically switch to a new appearance.
9557  **
9558  *b Arguments:
9559  **
9560  *a state - one of the values listed below
9561  **
9562  ** Valid values for state (defined in diguy_dis_constants.h):
9563  **
9564  *- - DIGUY_DIS_DAMAGE_NONE (0)
9565  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9566  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9567  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9568  **
9569  *b Callable For Networked Entities That Are:
9570  **
9571  *- - DIS published
9572  */
9573  void set_DIS_damage_state(int state);
9574 
9577  int get_DIS_damage_state();
9578 
9579  /*l
9580  *b Description:
9581  **
9582  ** Returns the name of damage state appearances based on the base appearance of the character.
9583  ** NULL if there is no appearance specified.
9584  */
9585  const char * get_damage_state_appearance_name(int state);
9586 
9587  /*l
9588  *b Description:
9589  **
9590  ** Sets the smoke state for a network published character.
9591  ** Starts or stops the "smoke" and "engine_smoke" appearance
9592  ** effects as appropriate.
9593  **
9594  *b Arguments:
9595  **
9596  *a state - one of the values listed below
9597  **
9598  ** Valid values for state (defined in diguy_dis_constants.h):
9599  **
9600  *- - DIGUY_DIS_SMOKE_NOT_SMOKING (0)
9601  *- - DIGUY_DIS_SMOKE_SMOKE_PLUME (1)
9602  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE (2)
9603  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE_AND_SMOKE_PLUME (3)
9604  **
9605  *b Callable For Networked Entities That Are:
9606  **
9607  *- - DIS published
9608  */
9609  void set_DIS_smoke_state(int state);
9610 
9613  int get_DIS_smoke_state();
9614 
9615  /*l
9616  *b Description:
9617  **
9618  ** Sets the flames state for a network published character.
9619  ** Starts or stops the "flames" appearance effect as appropriate.
9620  **
9621  *b Arguments:
9622  **
9623  ** state - one of the values listed below
9624  **
9625  ** Valid values for state (defined in diguy_dis_constants.h):
9626  **
9627  *- - DIGUY_DIS_FLAMES_NONE (0)
9628  *- - DIGUY_DIS_FLAMES_PRESENT (1)
9629  **
9630  *b Callable For Networked Entities That Are:
9631  **
9632  *- - DIS published
9633  */
9634  void set_DIS_flames_state(int state);
9635 
9638  int get_DIS_flames_state();
9639 
9640  /*l
9641  *b Description:
9642  **
9643  ** Sets the power plant state for a network published character.
9644  ** Vehicle power plants default to being on.
9645  **
9646  *b Arguments:
9647  **
9648  ** state - one of the values listed below
9649  **
9650  ** Valid values for state (defined in diguy_dis_constants.h):
9651  **
9652  *- - DIGUY_DIS_POWER_PLANT_OFF (0)
9653  *- - DIGUY_DIS_POWER_PLANT_ON (1)
9654  **
9655  *b Callable For Networked Entities That Are:
9656  **
9657  *- - DIS published
9658  */
9659  void set_DIS_power_plant_state(int state);
9660 
9663  int get_DIS_power_plant_state();
9664 
9667  void set_emissivity(float r, float g, float b, float lerp_time = .25);
9668 
9671  void get_emissivity(float *r, float *g, float *b);
9672 
9673  /*l
9674  *b Description:
9675  **
9676  ** Sets the trailing effect state for a network published character.
9677  **
9678  *b Arguments:
9679  **
9680  ** state - one of the values listed below
9681  **
9682  ** Valid values for state (defined in diguy_dis_constants.h):
9683  **
9684  *- - DIGUY_DIS_TRAILING_EFFECT_NONE (0)
9685  *- - DIGUY_DIS_TRAILING_EFFECT_SMALL (1)
9686  *- - DIGUY_DIS_TRAILING_EFFECT_MEDIUM (2)
9687  *- - DIGUY_DIS_TRAILING_EFFECT_LARGE (3)
9688  **
9689  *b Callable For Networked Entities That Are:
9690  **
9691  *- - DIS published
9692  */
9693  void set_DIS_trailing_effect_state(int state);
9694 
9697  int get_DIS_trailing_effect_state();
9698 
9701  void set_head_lights_state(int state);
9702 
9704  int get_head_lights_state() const;
9705 
9707  void set_tail_lights_state(int state);
9708 
9710  int get_tail_lights_state() const;
9711 
9712 /*****************************************************************************/
9722  /*l
9723  *b Description:
9724  **
9725  ** This function will create a new active formation with this
9726  ** character as its leader. The formation followers will fall
9727  ** into the formation given by the formation name.
9728  **
9729  ** The formation is broken up, or disbanded, by calling
9730  ** break_formation().
9731  **
9732  *b Arguments:
9733  **
9734  *a formation_name - the name of the formation
9735  *a snap_to_position_flag - if 1, following characters will
9736  *a immediately snap to their assigned
9737  *a positions; otherwise following characters
9738  *a will move toward their assigned
9739  *a positions from their current positions
9740  *a break_existing_formations_flag - if 1, any formations this
9741  *a character is leading with be broken
9742  *a as if the break_formation() call were
9743  *a made
9744  **
9745  *b Returns:
9746  **
9747  ** 0 on success, -1 on failure
9748  **
9749  *b Available as Decision Bead/Event
9750  */
9751  int call_formation(const char* formation_name,
9752  int snap_to_position_flag = 0,
9753  int break_existing_formations_flag = 1);
9754 
9755  /*l
9756  *b Description:
9757  **
9758  ** This function breaks up a formation initiated by call_formation().
9759  **
9760  *b Arguments:
9761  **
9762  *a formation_name - the name of the formation to break;
9763  *a passing NULL or "(all)" will break all formations
9764  *a this character is leading
9765  **
9766  *b Returns:
9767  **
9768  ** 0 on success, -1 on failure
9769  **
9770  *b Available as Decision Bead/Event
9771  */
9772  int break_formation(const char* formation_name = NULL);
9773 
9774 
9775 /*****************************************************************************/
9783  /*l
9784  *b Description:
9785  **
9786  ** This function adds a copy of the specified scenario guide
9787  ** to the character. Any changes that are subsequently made
9788  ** to the added guide -- for example by a call to
9789  ** diguyCharacterGuide::set_algorithm_float_parameter() -- are
9790  ** private to this copy of the guide and will not affect others.
9791  **
9792  ** The guide will be enabled by default. Guides can be disabled
9793  ** by calling diguyCharacterGuide::set_guide_enabled(0), or by
9794  ** passing 1 for the argument automatically_disable_when_acquired.
9795  **
9796  ** Note that disabling a guide is not the same as removing it.
9797  ** Disabled guides are still a part of the character and can
9798  ** later be re-enabled by calling diguyCharacterGuide::set_enabled().
9799  **
9800  *b Arguments:
9801  **
9802  *a guide_name - name of guide to find and copy
9803  *a automatically_disable_when_acquired - set to 1 to have the guide
9804  *a be automatically disabled when it has acquired
9805  *a its target
9806  **
9807  *b Returns:
9808  **
9809  ** object of type diguyCharacterGuide; if a guide with guide_name
9810  ** is not found, returns NULL
9811  */
9812  diguyCharacterGuide* add_guide(const char* guide_name,
9813  int automatically_disable_when_acquired = 0);
9814 
9815  /*l
9816  *b Description:
9817  **
9818  ** This function creates a new guide and adds it to the character.
9819  **
9820  ** The guide will be enabled by default. Guides can be disabled
9821  ** by calling diguyCharacterGuide::set_guide_enabled(), or by
9822  ** passing 1 for the argument automatically_disable_when_acquired.
9823  **
9824  ** Important note: a new guide will always be created, even if one with
9825  ** the same name already exists
9826  **
9827  *b Arguments:
9828  **
9829  *a guide_name - name of guide to find and copy
9830  *a guide_algorithm - name of guide algorithm to be used
9831  *a automatically_disable_when_acquired - set to 1 to have the guide
9832  *a be automatically disabled when it has
9833  *a acquired its target
9834  **
9835  *b Returns:
9836  **
9837  ** object of type diguyCharacterGuide; if a guide with guide_name
9838  ** is not found, returns NULL
9839  */
9840  diguyCharacterGuide* create_guide(const char* guide_name,
9841  const char* guide_algorithm,
9842  int automatically_disable_when_acquired = 0);
9843 
9844  /*l
9845  *b Description:
9846  **
9847  ** Like create_guide(), but returns guide if it already exists
9848  **
9849  *b Arguments:
9850  **
9851  *a guide_name - name of guide to find and copy
9852  *a guide_algorithm - name of guide algorithm to be used
9853  *a automatically_disable_when_acquired - set to 1 to have the guide
9854  *a be automatically disabled when it has
9855  *a acquired its target
9856  **
9857  *b Returns:
9858  **
9859  ** object of type diguyCharacterGuide; if a guide with guide_name
9860  ** is not found, returns NULL
9861  */
9862  diguyCharacterGuide* find_or_create_guide(const char* guide_name,
9863  const char* guide_algorithm,
9864  int automatically_disable_when_acquired = 0);
9865 
9866  /*l
9867  *b Description:
9868  **
9869  ** This function returns a pointer to the specified guide
9870  ** of the character, if is exists.
9871  **
9872  *b Arguments:
9873  **
9874  *a guide_name - name of guide to find
9875  **
9876  *b Returns:
9877  **
9878  ** object of type diguyCharacterGuide; if a guide with guide_name
9879  ** is not found, returns NULL
9880  */
9881  diguyCharacterGuide* find_guide(const char* guide_name);
9882 
9883  /*l
9884  *b Description:
9885  **
9886  ** This function removes the specified guide from the
9887  ** character.
9888  **
9889  *b Arguments:
9890  **
9891  *a guide_name - name of the guide to remove; must match name
9892  *a used by add_guide() or create_guide() call
9893  **
9894  *b Returns:
9895  **
9896  ** 0 on success, -1 on failure
9897  */
9898  int remove_guide_with_name(const char* guide_name);
9899 
9900  /*l
9901  *b Description:
9902  **
9903  ** This function removes the specified guide from the
9904  ** character.
9905  **
9906  *b Arguments:
9907  **
9908  *a guide - object returned by add_guide() call
9909  **
9910  *b Returns:
9911  **
9912  ** 0 on success, -1 on failure
9913  */
9914  int remove_guide(diguyCharacterGuide* guide);
9915 
9916  /*l
9917  *b Description:
9918  **
9919  ** This function removes all guides from the character.
9920  **
9921  *b Returns:
9922  **
9923  ** 0 on success, -1 on failure
9924  */
9925  int remove_all_guides();
9926 
9927  /*l
9928  *b Description:
9929  **
9930  ** This function removes all guides that are disabled.
9931  **
9932  *b Returns:
9933  **
9934  ** 0 on success, -1 on failure
9935  */
9936  int remove_all_disabled_guides();
9937 
9938 
9939 /*****************************************************************************/
9949  /*l
9950  *b Description:
9951  **
9952  ** This function adds a "motion texture" to the character. A
9953  ** motion texture is a relatively long (usually 10 seconds or
9954  ** more) loop that will add natural-looking, low amplitude
9955  ** joint angle adjustments.
9956  **
9957  ** This function will have no effect on a dead character (see
9958  ** die_now() and get_dead()).
9959  **
9960  *b Arguments:
9961  **
9962  *a motex_name - name of the motion texture to add; see below
9963  *a texture_gain - the relative amplitude of the motion texture;
9964  *a higher numbers result in more pronounced
9965  *a movements
9966  *a end_previous_motex - flag denoting whether this motion texture
9967  *a replaces all previously added motion
9968  *a textures; pass 1 to end existing textures
9969  *a rampup_interval - how long, in seconds, to take ramping up
9970  *a into the motion texture
9971  **
9972  ** List of currently available motion textures:
9973  **
9974  *- - "default"
9975  *- - "motex_stand_casual"
9976  **
9977  ** If 1 is passed for the argument end_previous_motex, the
9978  ** rampup_interval argument will be used as the interval for
9979  ** ending existing motion textures.
9980  **
9981  *b Returns:
9982  **
9983  ** 0 on success, -1 on failure
9984  **
9985  */
9986  int add_motion_texture(const char* motex_name = "default",
9987  float texture_gain = 1.0f,
9988  int end_previous_motex = 1,
9989  float rampup_interval = 0.2f);
9990 
9991  /*l
9992  *b Description:
9993  **
9994  ** This function gradually ends any active motion textures added by
9995  ** add_motion_texture().
9996  **
9997  *b Arguments:
9998  **
9999  *a rampdown_interval - how long, in seconds, to take ending the
10000  *a motion texture
10001  **
10002  *b Returns:
10003  **
10004  ** 0 on success, -1 on failure
10005  */
10006  int end_motion_texture(float rampdown_interval = 0.2f);
10007 
10008  /*l
10009  *b Description:
10010  **
10011  ** This function sets an initial motion texture that should be
10012  ** used by the character whenever the character is loaded from
10013  ** a scenario or the character's scenario is reset.
10014  **
10015  ** The gain of the motion texture can be set by calling
10016  ** set_initial_motion_texture_gain(). The initial motion
10017  ** texture gain is 1.0 by default.
10018  **
10019  *b See Also:
10020  **
10021  ** add_motion_texture(), set_initial_motion_texture_gain()
10022  **
10023  *b Arguments:
10024  **
10025  *a motex_name - name of the motion texture
10026  **
10027  *b Returns:
10028  **
10029  ** 0 on success, -1 on failure
10030  */
10031  int set_initial_motion_texture(const char* motex_name);
10032 
10033  /*l
10034  *b Description:
10035  **
10036  ** This function returns the initial motion texture as set
10037  ** by a call to set_initial_motion_texture().
10038  **
10039  *b Returns:
10040  **
10041  ** name of initial motion texture
10042  */
10043  const char* get_initial_motion_texture();
10044 
10045  /*l
10046  *b Description:
10047  **
10048  ** This function sets the gain of the initial motion texture
10049  ** of the character. The initial motion texture can be set
10050  ** by calling set_initial_motion_texture().
10051  **
10052  *b Arguments:
10053  **
10054  *a motex_gain - gain of the motion texture; higher gains
10055  *a result in more pronounced motion
10056  **
10057  *b Returns:
10058  **
10059  ** 0 on success, -1 on failure
10060  */
10061  int set_initial_motion_texture_gain(float motex_gain);
10062 
10063  /*l
10064  *b Description:
10065  **
10066  ** This function returns the initial motion texture gain as set
10067  ** by a call to set_initial_motion_texture_gain().
10068  **
10069  *b Returns:
10070  **
10071  ** gain of initial motion texture
10072  */
10073  float get_initial_motion_texture_gain();
10074 
10075 
10076 /*****************************************************************************/
10086  /*l
10087  *b Description:
10088  **
10089  ** This function sets what type of "history" will be kept for the
10090  ** character.
10091  **
10092  ** If time is run backwards in a scenario, characters
10093  ** with history will replay the motions they performed at that
10094  ** time. Characters without history will stay frozen in place
10095  ** until time advances past the point from which it was run
10096  ** backwards.
10097  **
10098  ** The default is DIGUY_HISTORY_TYPE_NONE for characters created
10099  ** using the diguyScenario::create_character() function.
10100  ** Characters loaded from a .dss file will retain their history
10101  ** settings from the DI-Guy Scenario editing session.
10102  **
10103  *b Arguments:
10104  **
10105  *a history_type - history type to be used for the character
10106  **
10107  ** history_type should be one of the following values:
10108  **
10109  *i DIGUY_HISTORY_TYPE_NONE
10110  **
10111  ** This history type saves no history.
10112  **
10113  *i DIGUY_HISTORY_TYPE_COMPLETE
10114  **
10115  ** This history type saves all of a character's history.
10116  **
10117  ** The initial amount of history to be saved, before memory buffers
10118  ** need to be resized, can be set by the function
10119  ** set_history_size_t(). The size by which memory buffers grow each
10120  ** time they do need to get resized by be set by
10121  ** set_history_size_increment_t().
10122  **
10123  *i DIGUY_HISTORY_TYPE_FIRST
10124  **
10125  ** This history type is no longer supported. Characters from
10126  ** a .dss that have this history type will have their history
10127  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10128  **
10129  *i DIGUY_HISTORY_TYPE_LAST
10130  **
10131  ** This history type is no longer supported. Characters from
10132  ** a .dss that have this history type will have their history
10133  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10134  **
10135  *b Returns:
10136  **
10137  ** 0 on success, -1 on failure
10138  */
10139  int set_history_type(diguyHistoryType history_type);
10140 
10141  /*l
10142  *b Returns:
10143  **
10144  ** the current history type of the character; see
10145  ** set_history_type()
10146  */
10147  diguyHistoryType get_history_type();
10148 
10149  /*l
10150  *b Description:
10151  **
10152  ** This function sets the size of the character's history
10153  ** buffer, in seconds.
10154  **
10155  *b Arguments:
10156  **
10157  *a t - length of history buffer, in seconds
10158  **
10159  *b Returns:
10160  **
10161  ** 0 on success, -1 on failure
10162  */
10163  int set_history_size_t(float t);
10164 
10165  /*l
10166  *b Description:
10167  **
10168  ** This function returns the current history buffer size.
10169  ** See set_history_size_t().
10170  **
10171  *b Returns:
10172  **
10173  ** current history size
10174  */
10175  float get_history_size_t();
10176 
10177  /*l
10178  *b Description:
10179  **
10180  ** This function sets the size of the character's history
10181  ** buffer increment, in seconds.
10182  **
10183  *b Arguments:
10184  **
10185  *a t - length of history buffer increment, in seconds
10186  **
10187  *b Returns:
10188  **
10189  ** 0 on success, -1 on failure
10190  */
10191  int set_history_size_increment_t(float t);
10192 
10193  /*l
10194  *b Description:
10195  **
10196  ** This function returns the current history buffer size increment.
10197  ** See set_history_size_increment_t().
10198  **
10199  *b Returns:
10200  **
10201  ** current history size increment
10202  */
10203  float get_history_size_increment_t();
10204 
10205 
10206 /*****************************************************************************/
10216  /*l
10217  *b Description:
10218  **
10219  ** This function sets the desired posture of the character. This,
10220  ** along with the desired variant, is used primarily by some guides.
10221  ** Specifically, to help choose which actions are used to reach the
10222  ** desired position and orientation of the character.
10223  **
10224  ** Pass DIGUY_MOTION_POSTURE_ANY for there to be no desired posture.
10225  **
10226  *b Arguments:
10227  **
10228  *a posture - new desired posture
10229  */
10230  void set_desired_posture(diguyMotionPosture desired_posture);
10231 
10232  /*l
10233  *b Returns:
10234  **
10235  ** current desired posture of the character
10236  */
10237  diguyMotionPosture get_desired_posture();
10238 
10239  /*l
10240  *b Description:
10241  **
10242  ** This function sets the desired variant of the character. This,
10243  ** along with the desired posture, is used primarily by some guides.
10244  ** Specifically, to help choose which actions are used to reach the
10245  ** desired position and orientation of the character.
10246  **
10247  ** Pass DIGUY_MOTION_VARIANT_ANY for there to be no desired variant.
10248  **
10249  *b Arguments:
10250  **
10251  *a variant - new desired variant
10252  */
10253  void set_desired_variant(diguyMotionVariant desired_variant);
10254 
10256  diguyMotionVariant get_desired_variant();
10257 
10258  /*l
10259  *b Description:
10260  **
10261  ** This function looks up the character action that most closely
10262  ** matches the given criteria.
10263  **
10264  *b Arguments:
10265  **
10266  *a direction - the direction of travel relative to
10267  *a the character's facing direction
10268  *a posture - overall desired posture; pass
10269  *a DIGUY_MOTION_POSTURE_ANY
10270  *a to specify that any posture will do
10271  *a variant - overall desired variant; pass
10272  *a DIGUY_MOTION_VARIANT_ANY
10273  *a to specify that any variant will do
10274  *a speed - speed in meters per second
10275  *a comparison - how the passed speed should compare
10276  *a to the action's speed
10277  *a comparison_tolerance - tolerance of comparison
10278  *a match_posture_before_variant - pass 1 if posture should be matched
10279  *a before variant if an exact match is
10280  *a not found; pass 0 if variant should
10281  *a be matched before posture
10282  *a posture_alternate1 - if an exact match is not found, use this
10283  *a as the first alternate posture; pass
10284  *a DIGUY_MOTION_POSTURE_UNKNOWN
10285  *a to specify that no alternate should be used
10286  *a posture_alternate2 - if an exact match is not found, use this
10287  *a as the second alternate posture; pass
10288  *a DIGUY_MOTION_POSTURE_UNKNOWN
10289  *a to specify that no alternate should be used
10290  *a variant_alternate1 - if an exact match is not found, use this
10291  *a as the first alternate variant; pass
10292  *a DIGUY_MOTION_VARIANT_UNKNOWN
10293  *a to specify that no alternate should be used
10294  *a variant_alternate2 - if an exact match is not found, use this
10295  *a as the second alternate variant; pass
10296  *a DIGUY_MOTION_VARIANT_UNKNOWN
10297  *a to specify that no alternate should be used
10298  *a return_random_match - (Experimental) if multiple actions match the
10299  *a specified criteria randomly return one of
10300  *a them. Typically only used for still motions
10301  *a and restricted to EQUAL and NEAREST
10302  *a comparisons
10303  **
10304  ** The direction argument should be one of the following:
10305  **
10306  *- - DIGUY_MOTION_DIRECTION_NONE - does not move character
10307  *- - DIGUY_MOTION_DIRECTION_FORWARD - moves character forward
10308  *- - DIGUY_MOTION_DIRECTION_BACKWARD - moves character backward
10309  *- - DIGUY_MOTION_DIRECTION_LEFT - moves character left
10310  *- - DIGUY_MOTION_DIRECTION_RIGHT - moves character right
10311  *- - DIGUY_MOTION_DIRECTION_UP - moves character up
10312  *- - DIGUY_MOTION_DIRECTION_DOWN - moves character down
10313  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10314  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10315  *- - DIGUY_MOTION_DIRECTION_NONLINEAR - moves character in
10316  *- multiple directions
10317  *- - DIGUY_MOTION_DIRECTION_LINEAR_OFFAXIS - moves character in a
10318  *- line, but not on any
10319  *- of the principle axes
10320  **
10321  ** Not every direction is supported by every character. If the
10322  ** character does not have any actions that move in the specified
10323  ** direction, the returned action will be NULL.
10324  **
10325  ** Use the calls diguyScenario::get_character_type_num_directions()
10326  ** and diguyScenario::get_character_type_direction_at_index() to
10327  ** enumerate which directions a character can travel.
10328  **
10329  ** The posture arguments should be one of the following:
10330  **
10331  *- - DIGUY_MOTION_POSTURE_UNKNOWN - unknown posture
10332  *- - DIGUY_MOTION_POSTURE_ANY - any posture; a wildcard
10333  *- - DIGUY_MOTION_POSTURE_UPRIGHT - upright posture; e.g., standing
10334  *- or walking
10335  *- - DIGUY_MOTION_POSTURE_CROUCHED - crouched posture; e.g., kneeling
10336  *- or walking low
10337  *- - DIGUY_MOTION_POSTURE_PRONE - prone posture; e.g., lying prone
10338  *- or crawling
10339  *- - DIGUY_MOTION_POSTURE_SITTING - sitting posture
10340  **
10341  ** The posture arguments specify the overall posture the action
10342  ** should have. Most characters have an upright posture.
10343  ** The other postures a character has is dependent on character type.
10344  ** Passing DIGUY_MOTION_POSTURE_ANY for the arguments posture,
10345  ** posture_alternate1, or posture_alternate2 means that the posture of
10346  ** the action should not be used to determine a match.
10347  **
10348  ** Use the calls diguyScenario::get_character_type_num_postures()
10349  ** and diguyScenario::get_character_type_posture_at_index() to
10350  ** enumerate which postures a specific character type has.
10351  **
10352  ** The variant arguments specify the overall mood the action should
10353  ** convey. Most characters have a "normal" variant. The other
10354  ** variants a character has is dependent on character type. Passing
10355  ** DIGUY_MOTION_VARIANT_ANY for the arguments variant,
10356  ** variant_alternate1, or variant_alternate2 means that the variant of
10357  ** the action should not be used to determine a match.
10358  **
10359  ** Use the calls diguyScenario::get_character_type_num_variants()
10360  ** and diguyScenario::get_character_type_variant_at_index() to
10361  ** enumerate which variants a specific character type has.
10362  **
10363  ** The comparison argument should be one of the following:
10364  **
10365  *- - DIGUY_PARAMETER_COMPARISON_EQUAL - matched action's speed
10366  *- must be within
10367  *- comparison_tolerance of
10368  *- passed speed
10369  *- - DIGUY_PARAMETER_COMPARISON_NEAREST - matched action's speed
10370  *- is closer than any other
10371  *- potential match's, but
10372  *- still within
10373  *- comparison_tolerance
10374  *- - DIGUY_PARAMETER_COMPARISON_GREATER - matched action's speed
10375  *- faster than passed speed,
10376  *- but still within
10377  *- comparison_tolerance
10378  *- - DIGUY_PARAMETER_COMPARISON_LESS - matched action's speed
10379  *- slower than passed speed,
10380  *- but still within
10381  *- comparison_tolerance
10382  *-
10383  ** The difference between DIGUY_PARAMETER_COMPARISON_EQUAL and
10384  ** DIGUY_PARAMETER_COMPARISON_NEAREST is largely in the
10385  ** value used for comparison_tolerance if DIGUY_DEFAULT_FLOAT is
10386  ** passed; the comparison_tolerance argument defaults to 0.001 for
10387  ** DIGUY_PARAMETER_COMPARISON_EQUAL, and 16384.0 for all
10388  ** other comparison types. Otherwise these two comparison types
10389  ** operate the same.
10390  **
10391  *b Returns:
10392  **
10393  ** name of an action if a match is found, NULL if not
10394  **
10395  *b C++ Example:
10396  **
10397  *e diguyCharacter* ch = scenario->get_character_at_index(0);
10398  *e const char* new_action;
10399  *e
10400  *e //
10401  *e // Get an action that moves forward in an upright posture,
10402  *e // whose speed move at least 2.0 meters per second:
10403  *e //
10404  *e new_action = ch->get_action_from_description(
10405  *e DIGUY_MOTION_DIRECTION_FORWARD,
10406  *e DIGUY_MOTION_POSTURE_UPRIGHT,
10407  *e DIGUY_MOTION_VARIANT_ANY,
10408  *e 2.0,
10409  *e DIGUY_PARAMETER_COMPARISON_GREATER, DIGUY_DEFAULT_FLOAT);
10410  *e
10411  *e //
10412  *e // Get an action that is standing still, with the variant
10413  *e // DIGUY_MOTION_VARIANT_READY. If no action has that variant,
10414  *e // try DIGUY_MOTION_VARIANT_AIM as variant_alternate1,
10415  *e // and DIGUY_MOTION_VARIANT_ANY as variant_alternate2:
10416  *e //
10417  *e new_action = ch->get_action_from_description(
10418  *e DIGUY_MOTION_DIRECTION_NONE,
10419  *e DIGUY_MOTION_POSTURE_ANY,
10420  *e DIGUY_MOTION_VARIANT_READY,
10421  *e 0.0,
10422  *e DIGUY_PARAMETER_COMPARISON_NEAREST, DIGUY_DEFAULT_FLOAT,
10423  *e 0,
10424  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10425  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10426  *e DIGUY_MOTION_VARIANT_AIM,
10427  *e DIGUY_MOTION_VARIANT_ANY);
10428  **
10429  */
10430  const char* get_action_from_description(diguyMotionDirection direction,
10431  diguyMotionPosture posture,
10432  diguyMotionVariant variant,
10433  float speed,
10435  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10436  int match_posture_before_variant = 1,
10437  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10438  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10439  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10440  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN,
10441  int return_random_match = 0);
10442 
10443  /*l
10444  *b Description:
10445  **
10446  ** This function is very similar to get_action_from_description(),
10447  ** but substitutes turn amount per action iteration for speed.
10448  **
10449  *b Arguments:
10450  **
10451  *a direction - the direction of travel relative to
10452  *a the character's facing direction
10453  *a posture - overall desired posture; pass
10454  *a DIGUY_MOTION_POSTURE_ANY
10455  *a to specify that any posture will do
10456  *a variant - overall desired variant; pass
10457  *a DIGUY_MOTION_VARIANT_ANY
10458  *a to specify that any variant will do
10459  *a turn_amount - how many degrees each iteration of the
10460  *a action should turn the character
10461  *a comparison - how the passed turn amount should compare
10462  *a to the action's turn amount
10463  *a comparison_tolerance - tolerance of comparison
10464  *a match_posture_before_variant - pass 1 if posture should be matched
10465  *a before variant if an exact match is
10466  *a not found; pass 0 if variant should
10467  *a be matched before posture
10468  *a posture_alternate1 - if an exact match is not found, use this
10469  *a as the first alternate posture; pass
10470  *a DIGUY_MOTION_POSTURE_UNKNOWN
10471  *a to specify that no alternate should be used
10472  *a posture_alternate2 - if an exact match is not found, use this
10473  *a as the second alternate posture; pass
10474  *a DIGUY_MOTION_POSTURE_UNKNOWN
10475  *a to specify that no alternate should be used
10476  *a variant_alternate1 - if an exact match is not found, use this
10477  *a as the first alternate variant; pass
10478  *a DIGUY_MOTION_VARIANT_UNKNOWN
10479  *a to specify that no alternate should be used
10480  *a variant_alternate2 - if an exact match is not found, use this
10481  *a as the second alternate variant; pass
10482  *a DIGUY_MOTION_VARIANT_UNKNOWN
10483  *a to specify that no alternate should be used
10484  **
10485  ** The direction argument should be one of the following:
10486  **
10487  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10488  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10489  **
10490  ** Not every direction is supported by every character. If the
10491  ** character does not have any actions that move in the specified
10492  ** direction, the returned action will be NULL.
10493  **
10494  ** The turn amount argument should be a positive number.
10495  **
10496  ** Refer to get_action_from_description() for more information on
10497  ** other arguments.
10498  **
10499  *b Returns:
10500  **
10501  ** name of an action if a match is found, NULL if not
10502  **
10503  */
10504  const char* get_turning_action_from_description(diguyMotionDirection direction,
10505  diguyMotionPosture posture,
10506  diguyMotionVariant variant,
10507  float turn_amount,
10509  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10510  int match_posture_before_variant = 1,
10511  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10512  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10513  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10514  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN);
10515 
10516 
10517 /*****************************************************************************/
10527  /*l
10528  *b Returns:
10529  **
10530  ** number of variables the character has
10531  */
10532  int get_num_variables();
10533 
10534  /*l
10535  *b Returns:
10536  **
10537  ** pointer of type diguyVariable; NULL if no
10538  ** variable at the specified index
10539  **
10540  *b Arguments:
10541  **
10542  *a index - index of the variable; indices start at 0
10543  */
10544  diguyVariable* get_variable_at_index(int index);
10545 
10546  /*l
10547  *b Description:
10548  **
10549  ** This function returns a pointer to the specified variable.
10550  **
10551  *b Arguments:
10552  **
10553  *a name - name of variable to be found
10554  **
10555  *b Returns:
10556  **
10557  ** pointer of type diguyVariable; NULL if not found
10558  */
10559  diguyVariable* find_variable(const char* name);
10560 
10561  /*l
10562  *b Description:
10563  **
10564  ** This function finds the variable with the given name or
10565  ** creates it if it doesn't exist.
10566  **
10567  *b Arguments:
10568  **
10569  *a name - name of the variable to find or create
10570  **
10571  *b Returns:
10572  **
10573  ** pointer of type diguyVariable; should never be NULL
10574  */
10575  diguyVariable* find_or_create_variable(const char* name);
10576 
10577  /*l
10578  *b Description:
10579  **
10580  ** This function destroys the passed variable.
10581  **
10582  *b Arguments:
10583  **
10584  *a variable - pointer to a diguyVariable
10585  **
10586  *b Returns:
10587  **
10588  ** 0 on success, -1 on failure
10589  */
10590  int destroy_variable(diguyVariable* variable);
10591 
10592  /*l
10593  *b Returns:
10594  **
10595  ** 1 if variable is equal to passed value,
10596  ** 0 if not
10597  **
10598  *b Arguments:
10599  **
10600  *a varname - name of variable to compare
10601  *a value - value to compare against
10602  **
10603  *b Available as Decision Bead/Event
10604  */
10605  int variable_equal_to_int(const char* varname, int value);
10606 
10607  /*l
10608  *b Returns:
10609  **
10610  ** 1 if variable is greater than passed value,
10611  ** 0 if not
10612  **
10613  *b Arguments:
10614  **
10615  *a varname - name of variable to compare
10616  *a value - value to compare against
10617  **
10618  *b Available as Decision Bead/Event
10619  */
10620  int variable_greater_than_int(const char* varname, int value);
10621 
10622  /*l
10623  *b Returns:
10624  **
10625  ** 1 if variable is less than passed value,
10626  ** 0 if not
10627  **
10628  *b Arguments:
10629  **
10630  *a varname - name of variable to compare
10631  *a value - value to compare against
10632  **
10633  *b Available as Decision Bead/Event
10634  */
10635  int variable_less_than_int(const char* varname, int value);
10636 
10637  /*l
10638  *b Returns:
10639  **
10640  ** 1 if variable is equal to passed value,
10641  ** 0 if not
10642  **
10643  *b Arguments:
10644  **
10645  *a varname - name of variable to compare
10646  *a value - value to compare against
10647  **
10648  *b Available as Decision Bead/Event
10649  */
10650  int variable_equal_to_float(const char* varname, float value);
10651 
10652  /*l
10653  *b Returns:
10654  **
10655  ** 1 if variable is greater than passed value,
10656  ** 0 if not
10657  **
10658  *b Arguments:
10659  **
10660  *a varname - name of variable to compare
10661  *a value - value to compare against
10662  **
10663  *b Available as Decision Bead/Event
10664  */
10665  int variable_greater_than_float(const char* varname, float value);
10666 
10667  /*l
10668  *b Returns:
10669  **
10670  ** 1 if variable is less than passed value,
10671  ** 0 if not
10672  **
10673  *b Arguments:
10674  **
10675  *a varname - name of variable to compare
10676  *a value - value to compare against
10677  **
10678  *b Available as Decision Bead/Event
10679  */
10680  int variable_less_than_float(const char* varname, float value);
10681 
10682  /*l
10683  *b Returns:
10684  **
10685  ** 1 if variable is equal than passed value,
10686  ** 0 if not
10687  **
10688  *b Arguments:
10689  **
10690  *a varname - name of variable to compare
10691  *a value - value to compare against
10692  **
10693  *b Available as Decision Bead/Event
10694  */
10695  int variable_equal_to_string(const char* varname, const char* value);
10696 
10697  /*l
10698  *b Returns:
10699  **
10700  ** 1 if variable is greater than passed value (comes
10701  ** later alphabetically), 0 if not
10702  **
10703  *b Arguments:
10704  **
10705  *a varname - name of variable to compare
10706  *a value - value to compare against
10707  **
10708  *b Available as Decision Bead/Event
10709  */
10710  int variable_greater_than_string(const char* varname, const char* value);
10711 
10712  /*l
10713  *b Returns:
10714  **
10715  ** 1 if variable is less than passed value (comes
10716  ** sooner alphabetically), 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_less_than_string(const char* varname, const char* value);
10726 
10727  /*l
10728  *b Description:
10729  **
10730  ** This function decrements the variable by the passed amount.
10731  **
10732  *b Arguments:
10733  **
10734  *a varname - name of variable to modify
10735  *a value - amount to decrement
10736  **
10737  *b Returns:
10738  **
10739  ** 0 on success, -1 on failure
10740  **
10741  *b Available as Decision Bead/Event
10742  */
10743  int variable_decrement_value_as_int(const char* varname, int value = 1);
10744 
10745  /*l
10746  *b Description:
10747  **
10748  ** This function increments the variable by the passed amount.
10749  **
10750  *b Arguments:
10751  **
10752  *a varname - name of variable to modify
10753  *a value - amount to increment
10754  **
10755  *b Returns:
10756  **
10757  ** 0 on success, -1 on failure
10758  **
10759  *b Available as Decision Bead/Event
10760  */
10761  int variable_increment_value_as_int(const char* varname, int value = 1);
10762 
10763  /*l
10764  *b Description:
10765  **
10766  ** This function is a convenience function for setting the variable
10767  ** to a new integer value without retrieving the diguyVariable
10768  ** object.
10769  **
10770  *b Arguments:
10771  **
10772  *a varname - name of variable to modify
10773  *a value - new value
10774  *a create_if_doesnt_exist - pass 1 to create the variable if it
10775  *a doesn't exist
10776  **
10777  *b Returns:
10778  **
10779  ** 0 on success, -1 on failure
10780  **
10781  *b Available as Decision Bead/Event
10782  */
10783  int variable_set_value_as_int(const char* varname,
10784  int value,
10785  int create_if_doesnt_exist = 1);
10786 
10787  /*l
10788  *b Description:
10789  **
10790  ** Short form of variable_set_value_as_int().
10791  */
10792  int set_ivar(const char* varname,
10793  int value,
10794  int create_if_doesnt_exist = 1);
10795 
10796  /*l
10797  *b Description:
10798  **
10799  ** This function is a convenience function for retrieving the
10800  ** value of a variable without retrieving the diguyVariable
10801  ** object.
10802  **
10803  ** If the variable doesn't exist and create_if_doesnt_exist is
10804  ** 0, the returned value will be 0.
10805  **
10806  *b Arguments:
10807  **
10808  *a varname - name of variable to query
10809  *a create_if_doesnt_exist - pass 1 to create the variable if it
10810  *a doesn't exist
10811  **
10812  *b Returns:
10813  **
10814  ** value of variable as int
10815  */
10816  int get_ivar(const char* varname,
10817  int create_if_doesnt_exist = 1);
10818 
10819  /*l
10820  *b Description:
10821  **
10822  ** Similar to variable_set_value_as_int(), for sets a
10823  ** floating point value instead.
10824  */
10825  int variable_set_value_as_float(const char* varname,
10826  float value,
10827  int create_if_doesnt_exist = 1);
10828 
10829  /*l
10830  *b Description:
10831  **
10832  ** Short form of variable_set_value_as_float().
10833  */
10834  int set_fvar(const char* varname,
10835  float value,
10836  int create_if_doesnt_exist = 1);
10837 
10838  /*l
10839  *b Description:
10840  **
10841  ** Similar to variable_get_value_as_int(), for returns a
10842  ** floating point value instead.
10843  **
10844  ** If the variable doesn't exist and create_if_doesnt_exist is
10845  ** 0, the returned value will be 0.0.
10846  */
10847  float get_fvar(const char* varname,
10848  int create_if_doesnt_exist = 1);
10849 
10850  /*l
10851  *b Description:
10852  **
10853  ** Similar to variable_set_value_as_int(), for sets a
10854  ** string value instead.
10855  */
10856  int variable_set_value_as_string(const char* varname,
10857  const char* value,
10858  int create_if_doesnt_exist = 1);
10859 
10860  /*l
10861  *b Description:
10862  **
10863  ** Short form of variable_set_value_as_string().
10864  */
10865  int set_svar(const char* varname,
10866  const char* value,
10867  int create_if_doesnt_exist = 1);
10868 
10869  /*l
10870  *b Description:
10871  **
10872  ** Similar to variable_get_value_as_int(), for returns a
10873  ** string value instead.
10874  **
10875  ** If the variable doesn't exist and create_if_doesnt_exist is
10876  ** 0, the returned value will be "".
10877  */
10878  const char* get_svar(const char* varname,
10879  int create_if_doesnt_exist = 1);
10880 
10881 
10882 /*****************************************************************************/
10897  /*l
10898  *b Description:
10899  **
10900  ** This function returns a pointer to the label object of
10901  ** the character.
10902  **
10903  ** Currently character labels are only enabled in DI-Guy Scenario.
10904  **
10905  *b Returns:
10906  **
10907  ** pointer to the character's label
10908  */
10909  diguyViewLabel* get_name_label();
10910 
10911  /*l
10912  *b Description:
10913  **
10914  ** This function sets the text of the character's label.
10915  ** By default the label text matches the character's name.
10916  **
10917  ** Currently character labels are only enabled in DI-Guy Scenario.
10918  **
10919  *b Arguments:
10920  **
10921  *a label_text - new text for the label
10922  **
10923  *b Returns:
10924  **
10925  ** 0 on success, -1 on failure
10926  */
10927  int set_label_text(const char* label_text);
10928 
10929  /*l
10930  *b Description:
10931  **
10932  ** This function returns the character's label text.
10933  ** See set_label_text().
10934  **
10935  *b Returns:
10936  **
10937  ** current label text; the returned pointer will never be NULL
10938  */
10939  const char* get_label_text();
10940 
10941  /*l
10942  *b Description:
10943  **
10944  ** This function sets whether the label of this character
10945  ** is visible. This setting will only be taken into account
10946  ** if the visibility flag for Character Labels is set to
10947  ** "Per Object".
10948  **
10949  ** Currently character labels are only enabled in DI-Guy Scenario.
10950  **
10951  *b Arguments:
10952  **
10953  *a is_visible - pass 1 to show, pass 0 to hide
10954  **
10955  *b Returns:
10956  **
10957  ** 0 on success, -1 on failure
10958  */
10959  int set_label_is_visible(int is_visible);
10960 
10961  /*l
10962  *b Description:
10963  **
10964  ** This function returns the most recent setting of
10965  ** set_label_is_visible().
10966  **
10967  *b Returns:
10968  **
10969  ** 1 if visible, 0 if not
10970  */
10971  int get_label_is_visible();
10972 
10973  /*l
10974  *b Description:
10975  **
10976  ** This function sets the text color of the character's label. By
10977  ** default the label text color is opaque white.
10978  **
10979  ** Currently character labels are only enabled in DI-Guy Scenario.
10980  **
10981  *b Arguments:
10982  **
10983  *a r, g, b, a - the red, green, blue, and alpha
10984  *a components of the text color
10985  **
10986  ** An alpha component of 0 makes the text completely transparent.
10987  ** An alpha component of 1 makes the text completely opaque.
10988  ** Values in between result in varying levels of transparency.
10989  **
10990  *b Returns:
10991  **
10992  ** 0 on success, -1 on failure
10993  */
10994  int set_label_text_color(float r, float g, float b, float a);
10995 
10996  /*l
10997  *b Description:
10998  **
10999  ** Alternate version of set_label_text_color().
11000  */
11001  int set_label_text_color_vec4(const diguyVec4f & color);
11002 
11003  /*l
11004  *b Description:
11005  **
11006  ** This function returns, in the passed variable pointers, the
11007  ** most recent setting of set_label_text_color().
11008  **
11009  *b Returns:
11010  **
11011  ** 0 on success, -1 on failure
11012  */
11013  int get_label_text_color(float* r, float* g, float* b, float* a);
11014 
11015  /*l
11016  *b Description:
11017  **
11018  ** Alternate version of get_label_text_color().
11019  */
11020  diguyVec4f get_label_text_color_vec4();
11021 
11022  /*l
11023  *b Description:
11024  **
11025  ** This function sets the text shadow color of the character's label.
11026  ** By default the label text shadow color is gray.
11027  **
11028  ** Currently character labels are only enabled in DI-Guy Scenario.
11029  **
11030  *b Arguments:
11031  **
11032  *a r, g, b, a - the red, green, blue, and alpha
11033  *a components of the text shadow color
11034  **
11035  ** An alpha component of 0 makes the text completely transparent.
11036  ** An alpha component of 1 makes the text completely opaque.
11037  ** Values in between result in varying levels of transparency.
11038  **
11039  *b Returns:
11040  **
11041  ** 0 on success, -1 on failure
11042  */
11043  int set_label_text_shadow_color(float r, float g, float b, float a);
11044 
11045  /*l
11046  *b Description:
11047  **
11048  ** Alternate version of set_label_text_shadow_color().
11049  */
11050  int set_label_text_shadow_color_vec4(const diguyVec4f & color);
11051 
11052  /*l
11053  *b Description:
11054  **
11055  ** This function returns, in the passed variable pointers, the
11056  ** most recent setting of set_label_text_shadow_color().
11057  **
11058  *b Returns:
11059  **
11060  ** 0 on success, -1 on failure
11061  */
11062  int get_label_text_shadow_color(float* r, float* g, float* b, float* a);
11063 
11064  /*l
11065  *b Description:
11066  **
11067  ** Alternate version of get_label_text_shadow_color().
11068  */
11069  diguyVec4f get_label_text_shadow_color_vec4();
11070 
11071  /*l
11072  *b Description:
11073  **
11074  ** This function sets the whether the text shadow is visible.
11075  **
11076  *b Arguments:
11077  **
11078  *a visible - pass 1 to make shadow visible, 0 to make it invisible
11079  **
11080  *b Returns:
11081  **
11082  ** 0 on success, -1 on failure
11083  */
11084  int set_label_text_shadow_is_visible(int is_visible);
11085 
11086  /*l
11087  *b Returns:
11088  **
11089  ** 1 if text shadow is visible, 0 if not
11090  */
11091  int get_label_text_shadow_is_visible();
11092 
11093  /*l
11094  *b Description:
11095  **
11096  ** This function sets the background color of the character's
11097  ** label. By default the label background color is transparent
11098  ** blue.
11099  **
11100  ** Currently character labels are only enabled in DI-Guy Scenario.
11101  **
11102  *b Arguments:
11103  **
11104  *a r, g, b, a - the red, green, blue, and alpha
11105  *a components of the text color
11106  **
11107  ** An alpha component of 0 makes the text completely transparent.
11108  ** An alpha component of 1 makes the text completely opaque.
11109  ** Values in between result in varying levels of transparency.
11110  **
11111  *b Returns:
11112  **
11113  ** 0 on success, -1 on failure
11114  */
11115  int set_label_background_color(float r, float g, float b, float a);
11116 
11117  /*l
11118  *b Description:
11119  **
11120  ** Alternate version of set_label_background_color().
11121  */
11122  int set_label_background_color_vec4(const diguyVec4f & color);
11123 
11124  /*l
11125  *b Description:
11126  **
11127  ** This function returns, in the passed variable pointers, the
11128  ** most recent setting of set_label_background_color().
11129  **
11130  *b Returns:
11131  **
11132  ** 0 on success, -1 on failure
11133  */
11134  int get_label_background_color(float* r, float* g, float* b, float* a);
11135 
11136  /*l
11137  *b Description:
11138  **
11139  ** Alternate version of get_label_background_color().
11140  */
11141  diguyVec4f get_label_background_color_vec4();
11142 
11143  /*l
11144  *b Description:
11145  **
11146  ** This function sets how high the label of the character will float
11147  ** above the character.
11148  **
11149  *b Arguments:
11150  **
11151  *a offset - offset, in meters, of label above character
11152  */
11153  void set_label_link_offset_override(float offset);
11154 
11155  /*l
11156  *b Returns:
11157  **
11158  ** how high the label of the character will float above the character
11159  */
11160  float get_label_link_offset_override();
11161 
11162  /*l
11163  *b Description:
11164  **
11165  ** This function sets whether the label text should show some basic
11166  ** state information about the character instead of its name or
11167  ** the text set by set_label_text().
11168  **
11169  ** The state shown is: Character name, current path, current action.
11170  ** The current path and current action will change as the character
11171  ** moves through paths and actions.
11172  **
11173  *b Arguments:
11174  **
11175  *a show_state - pass 1 to show state, 0 to show original text
11176  */
11177  int set_label_shows_character_state(int show_state);
11178 
11179  /*l
11180  *b Returns:
11181  **
11182  ** whether character state information is shown instead of the
11183  ** character's name or other label text
11184  */
11185  int get_label_shows_character_state();
11186 
11187 
11188 /*****************************************************************************/
11201  /*l
11202  *b Returns:
11203  **
11204  ** pointer of type diguyImpact; NULL if there has been no recent
11205  ** impact recorded; useful for finding out who or what was hit
11206  */
11207  diguyImpact* get_last_impact_record();
11208 
11209  /*l
11210  *b Returns:
11211  **
11212  ** the last impact number
11213  */
11214  int get_last_impact_number();
11215 
11216  /*l
11217  *b Returns:
11218  **
11219  ** the processed flag on the diguyImpact class
11220  */
11221  int get_last_impact_been_processed();
11222 
11223  /*l
11224  *b Description:
11225  **
11226  ** Sets the processed flag on the diguyImpact object.
11227  */
11228  void set_last_impact_been_processed();
11229 
11230  /*l
11231  *b Description:
11232  **
11233  ** Sets the maximum number of unprocessed impacts there can be.
11234  **
11235  ** The unprocessed impact array is a first-in-first-out queue. If an
11236  ** impact occurs that pushes the number of unprocessed impacts past
11237  ** this maximum number, earlier impacts will be dropped from the
11238  ** array.
11239  **
11240  ** The initial value is 10.
11241  */
11242  void set_max_unprocessed_impacts(int max_unprocessed_impacts);
11243 
11244  /*l
11245  *b Returns:
11246  **
11247  ** maximum number of unprocessed impacts
11248  */
11249  int get_max_unprocessed_impacts();
11250 
11251  /*l
11252  *b Returns:
11253  **
11254  ** the last impact link
11255  */
11256  const char* get_last_impact_link();
11257 
11258  /*l
11259  *b Returns:
11260  **
11261  ** 1 if the last impact link is the link named
11262  */
11263  int get_last_impact_link_is(const char* link_name);
11264 
11265  /*l
11266  *b Returns:
11267  **
11268  ** 1 if the last impact resulted from an impact with a vehicle,
11269  ** 0 if not
11270  */
11271  int get_last_impact_is_from_vehicle();
11272 
11273  /*l
11274  *b Returns:
11275  **
11276  ** 1 if the last impact speed is greater than the passed speed,
11277  ** 0 if not
11278  */
11279  int get_last_impact_speed_is_greater_than(float impact_speed);
11280 
11281  /*l
11282  *b Description:
11283  **
11284  ** Sets if impacts are ever processed on this character.
11285  ** Useful for temporary effects and the like.
11286  */
11287  void set_is_immune_to_impacts(int immune);
11288 
11289  /*l
11290  *b Returns:
11291  **
11292  ** 1 if the character is immune to impacts
11293  ** 0 if not
11294  */
11295  int get_is_immune_to_impacts();
11296 
11297 
11298 /*****************************************************************************/
11320  /*l
11321  *b Description:
11322  **
11323  ** This function starts the specified appearance effect on
11324  ** the character.
11325  **
11326  ** The following appearance effects are available:
11327  **
11328  *- - "brake_lights"
11329  *- - "debris"
11330  *- - "debris_dark"
11331  *- - "dust"
11332  *- - "engine_smoke"
11333  *- - "explosion"
11334  *- - "explosion_dark"
11335  *- - "flames"
11336  *- - "flashing_lights"
11337  *- - "ground_dust_burst"
11338  *- - "headlights"
11339  *- - "rotor_wash"
11340  *- - "smoke"
11341  *- - "smoke_dark"
11342  *- - "smoke_trail"
11343  **
11344  *b Arguments:
11345  **
11346  *a effect - name of appearance effect to be started
11347  *a override_link - link to attach to; overrides default
11348  *a override_scale - scale to use for effect; overrides default
11349  *a override_offset_x - x offset to use for effect; overrides default
11350  *a override_offset_y - y offset to use for effect; overrides default
11351  *a override_offset_z - z offset to use for effect; overrides default
11352  *a override_duration - overrides how long the effect should show
11353  *a before automatically ending
11354  **
11355  *b Returns:
11356  **
11357  ** 0 on success, -1 on failure
11358  **
11359  *b Available as Decision Bead/Event
11360  */
11361  int begin_appearance_effect(const char* effect,
11362  const char* override_link = NULL,
11363  float override_scale = DIGUY_DEFAULT_FLOAT,
11364  float override_offset_x = DIGUY_DEFAULT_FLOAT,
11365  float override_offset_y = DIGUY_DEFAULT_FLOAT,
11366  float override_offset_z = DIGUY_DEFAULT_FLOAT,
11367  float override_duration = DIGUY_DEFAULT_FLOAT);
11368 
11369  /*l
11370  *b Description:
11371  **
11372  ** This function ends the specified appearance effect on the
11373  ** character.
11374  **
11375  ** The active particles of the effect will go to completion. Use
11376  ** stop_all_appearance_effects() to immediately stop effects,
11377  ** including their active particles.
11378  **
11379  ** If the effect hasn't been started, nothing happens.
11380  **
11381  *b Arguments:
11382  **
11383  *a effect - name of appearance effect to be ended
11384  *a override_link - optional override link effect is attached to
11385  **
11386  ** Pass "all" for the effect argument to end all of this character's
11387  ** appearance effects.
11388  **
11389  *b Returns:
11390  **
11391  ** 0 on success, -1 on failure
11392  **
11393  *b Available as Decision Bead/Event
11394  */
11395  int end_appearance_effect(const char* effect,
11396  const char* override_link = NULL);
11397 
11398  /*l
11399  *b Description:
11400  **
11401  ** This function stops the specified appearance effect on the
11402  ** character.
11403  **
11404  ** The active particle systems of the effect will immediately be
11405  ** removed. Use end_appearance_effect() to gradually stop effects;
11406  ** that function lets active particles move to completion.
11407  **
11408  ** If the effect hasn't been started, nothing happens.
11409  **
11410  *b Arguments:
11411  **
11412  *a effect - name of appearance effect to be ended
11413  *a override_link - optional override link effect is attached to
11414  **
11415  ** Pass "all" for the effect argument to stop all of this character's
11416  ** appearance effects.
11417  **
11418  *b Returns:
11419  **
11420  ** 0 on success, -1 on failure
11421  **
11422  *b Available as Decision Bead/Event
11423  */
11424  int stop_appearance_effect(const char* effect,
11425  const char* override_link = NULL);
11426 
11427  /*l
11428  *b Description:
11429  **
11430  ** Equivalent to stop_appearance_effect("all");
11431  */
11432  int stop_all_appearance_effects();
11433 
11434  /*l
11435  *b Description:
11436  **
11437  ** This function checks to see if the specified appearance effect
11438  ** has been started with begin_appearance_effect().
11439  **
11440  *b Arguments:
11441  **
11442  *a effect - name of appearance effect to check
11443  *a override_link - optional override link effect is attached to
11444  **
11445  *b Returns:
11446  **
11447  ** 1 if appearance is active, 0 if not
11448  */
11449  int appearance_effect_is_active(const char* effect,
11450  const char* override_link = NULL);
11451 
11452 
11453 /*****************************************************************************/
11466  /*l
11467  *b Description:
11468  **
11469  ** This function returns a pointer to a diguyChainSimulation if the
11470  ** character is a chain_simulation type of character.
11471  **
11472  *b Returns:
11473  **
11474  ** pointer to a diguyChainSimulation
11475  */
11476  diguyChainSimulation* get_chain_simulation();
11477 
11478 
11479 /*****************************************************************************/
11492  /*l
11493  *b Description:
11494  **
11495  ** This function returns a pointer to a diguyVehicleController if the
11496  ** character has one.
11497  **
11498  *b Returns:
11499  **
11500  ** pointer to a diguyVehicleController; may return NULL if character
11501  ** does not have a vehicle controller object
11502  */
11503  diguyVehicleController* get_vehicle_controller();
11504 
11505  /*l
11506  *b Description:
11507  **
11508  ** For most characters playing a travel forward action, the
11509  ** character's facing direction matches the direction of travel. For
11510  ** example, when humans walk forward their pelvis is generally
11511  ** aligned in the direction of travel.
11512  **
11513  ** Some vehicle characters behave differently. For vehicles whose
11514  ** front wheels steer, when turning the vehicle body will pivot around
11515  ** the rear axle. Only gradually will the rear of the vehicle swing
11516  ** in behind the direction of travel. Think of a car making a very
11517  ** sharp turn, and how the rear of the car swings in behind the front
11518  ** as the turn is completed.
11519  **
11520  ** This function will return the orientation of the body of the
11521  ** vehicle; i.e., the orientation of the forward vector along the
11522  ** vehicle's long axis. As mentioned above this may be different
11523  ** than the orientation of the direction of travel.
11524  **
11525  ** This function will return valid results for all characters, though
11526  ** the returned values from this function and that of
11527  ** get_orientation() will be the same for non-vehicle characters.
11528  **
11529  *b Returns:
11530  **
11531  ** 0 on success, -1 on failure
11532  */
11533  int get_vehicle_body_orientation(float* rz, float* rx, float* ry);
11534 
11535 
11536 /*****************************************************************************/
11553  /*l
11554  *b Description:
11555  **
11556  ** This function sets the name of the shader technique that will be
11557  ** used by the character when the scenario is using the specified
11558  ** render mode. See diguyScenario::set_current_render_mode().
11559  **
11560  ** Note that care should be taken when changing the shader of
11561  ** characters with skinned appearances. A shader capable of properly
11562  ** transforming vertices must be used for such characters.
11563  **
11564  ** The shader with the given name should be loaded first. If the
11565  ** shader technique is not one of DI-Guy's stock shaders, a custom
11566  ** shader technique can be loaded explicitly by calling
11567  ** the diguyApp::load_shader_program() function.
11568  **
11569  *b NOTE:
11570  **
11571  ** The specified shader technique may not take effect immediately,
11572  ** if the scenario's current render mode is different than the
11573  ** passed render mode. See
11574  ** diguyScenario::set_current_render_mode().
11575  **
11576  *b Arguments:
11577  **
11578  *a shader_name - shader technique name; can be NULL
11579  *a render_mode - render mode to modify; passing NULL will
11580  *a modify shader "normal" render mode
11581  **
11582  *b Returns:
11583  **
11584  ** 0 on success, -1 on failure
11585  */
11586  int set_render_mode_shader(const char* shader_name,
11587  const char* render_mode = NULL);
11588 
11589  /*l
11590  *b Description:
11591  **
11592  ** This function resets the shader technique for the specified render
11593  ** mode to its default. This will be the shader technique name
11594  ** returned by
11595  ** diguyScenario::get_default_character_shader_program_name().
11596  **
11597  ** If the specified render mode is the current scenario render mode,
11598  ** the current shader will change immediately. If not, the change
11599  ** will not take effect until the specified render mode becomes the
11600  ** current scenario render mode. See
11601  ** diguyScenario::set_current_render_mode().
11602  **
11603  *b Arguments:
11604  **
11605  *a render_mode - render mode to modify; passing NULL will
11606  *a modify shader of "normal" render mode
11607  */
11608  void reset_render_mode_shader_to_default(const char* render_mode = NULL);
11609 
11610  /*l
11611  *b Description:
11612  **
11613  ** This function returns the name of the shader technique that will be used by
11614  ** the character when the scenario is using the specified render
11615  ** mode.
11616  **
11617  *b Arguments:
11618  **
11619  *a render_mode - render mode for which to get technique name;
11620  *a pass NULL for "normal" render mode
11621  **
11622  *b Returns:
11623  **
11624  ** name of shader technique; NULL if none or error
11625  */
11626  const char* get_render_mode_shader(const char* render_mode = NULL);
11627 
11628  /*l
11629  *b Description:
11630  **
11631  ** This function returns the shader program that is in use by the
11632  ** character. Shader programs are shared objects that can be used
11633  ** by multiple characters. This is here for backwards compatibility,
11634  ** and just returns the highest quality shader technique shader.
11635  **
11636  *b Returns:
11637  **
11638  ** object of type diguyGraphicsShaderProgram; NULL if none
11639  */
11640  diguyGraphicsShaderProgram* get_shader_program();
11641 
11642  /*l
11643  *b Description:
11644  **
11645  ** This function returns the shader technique that is in use by the
11646  ** character. Shader techniques own a number of shader objects.
11647  **
11648  *b Returns:
11649  **
11650  ** object of type diguyGraphicsShaderTechnique; NULL if none
11651  */
11652  diguyGraphicsShaderTechnique* get_shader_technique();
11653 
11654  /*l
11655  *b Description:
11656  **
11657  ** This function overrides the current shader with the specified
11658  ** temporary shader. This temporary shader will remain in effect
11659  ** until:
11660  **
11661  *- - the scenario is reset
11662  *- - reset_current_shader_to_default() is called
11663  *- - set_temporary_current_shader() is called with NULL
11664  **
11665  *b Arguments:
11666  **
11667  *a shader_name - shader name; can be NULL
11668  **
11669  ** Passing NULL for the shader name will un-set the temporary shader,
11670  ** resetting the render mode shader to its default.
11671  **
11672  *b Returns:
11673  **
11674  ** 0 on success, -1 on failure
11675  */
11676  int set_temporary_current_shader(const char* shader_name);
11677 
11678  /*l
11679  *b Description:
11680  **
11681  ** This is a convenience function for resetting the current render
11682  ** mode shader to its default.
11683  **
11684  ** It is equivalent to retrieving the current render mode using
11685  ** diguyScenario::get_current_render_mode(), and calling
11686  ** reset_render_mode_shader_to_default() with that render mode.
11687  */
11688  void reset_current_shader_to_default();
11689 
11690  /*l
11691  *b Description:
11692  **
11693  ** This is a convenience function for refreshing the shader
11694  ** of a character. Usually used in conjunction with logic
11695  ** provided by the user with the graphics API.
11696  */
11697  void trigger_shader_refresh();
11698 
11699  /*l
11700  *b Description:
11701  **
11702  ** This function returns the shader instance that is in use by the
11703  ** character. Each character has its own shader instance.
11704  **
11705  ** Note that the shader instance of a character can change over the
11706  ** lifetime of the character. For example, it will change if the
11707  ** appearance of the character changes. Therefore the returned
11708  ** pointer should not be stored, but should be re-read each time
11709  ** it is needed.
11710  **
11711  *b Returns:
11712  **
11713  ** object of type diguyGraphicsShaderInstance; NULL if none
11714  */
11715  diguyGraphicsShaderInstance* get_shader_instance();
11716 
11717  /*l
11718  *b Description:
11719  **
11720  ** This function resets current values of the variables of the shader
11721  ** back to their initial reset values.
11722  */
11723  void reset_shader_instance_variables_to_initial_values();
11724 
11725  /*l
11726  *b Description:
11727  **
11728  ** This function resets the current and initial values of variables
11729  ** of the shader to the built-in DI-Guy configuration defaults.
11730  */
11731  void reset_shader_instance_variables_to_program_defaults();
11732 
11733 
11734 /*****************************************************************************/
11758  /*l
11759  *b Description:
11760  **
11761  ** This function sets the named character as the attack
11762  ** target of this agent. This agent will pursue the
11763  ** target until it is within range, and then will fire its
11764  ** weapon in an attempt to kill the target.
11765  **
11766  ** This function will implicitly put this agent into the
11767  ** attack behavior.
11768  **
11769  ** The current focus character will be set the specified character.
11770  ** Pass NULL or the empty string ("") to not change the focus
11771  ** character, but still change to the pursue behavior.
11772  **
11773  ** The current focus group will be un-set.
11774  **
11775  *b Arguments:
11776  **
11777  *a character_name - character to attack
11778  **
11779  *b Returns:
11780  **
11781  ** 0 on success, -1 on failure
11782  **
11783  *b Available as Decision Bead/Event
11784  */
11785  int agent_attack_character(const char* character_name);
11786 
11787  /*l
11788  *b Description:
11789  **
11790  ** This function is similar to agent_attack_character(), but instead
11791  ** will choose attack targets from the characters in the specified
11792  ** group.
11793  **
11794  ** This function will implicitly put this agent into the attack
11795  ** behavior.
11796  **
11797  ** The current focus group will be set to the specified group. Pass
11798  ** NULL or the empty string ("") to not change the focus group, but
11799  ** still change to the attack behavior.
11800  **
11801  ** The current focus character will be un-set.
11802  **
11803  *b Arguments:
11804  **
11805  *a group_name - name of group from which attack targets should
11806  *a be chosen
11807  **
11808  *b Returns:
11809  **
11810  ** 0 on success, -1 on failure
11811  **
11812  *b Available as Decision Bead/Event
11813  */
11814  int agent_attack_group(const char* group_name);
11815 
11816  /*l
11817  *b Description:
11818  **
11819  ** See diguyAgentParams::set_attack_zone_enabled().
11820  */
11821  int agent_set_attack_zone_enabled(int use_attack_zone);
11822 
11823  /*l
11824  *b Description:
11825  **
11826  ** See diguyAgentParams::get_attack_zone_enabled().
11827  */
11828  int agent_get_attack_zone_enabled();
11829 
11830  /*l
11831  *b Description:
11832  **
11833  ** See diguyAgentParams::set_attack_zone().
11834  */
11835  int agent_set_attack_zone(float x, float y, float z, float radius);
11836 
11837  /*l
11838  *b Description:
11839  **
11840  ** See diguyAgentParams::get_attack_zone().
11841  */
11842  int agent_get_attack_zone(float* x, float* y, float* z, float* radius);
11843 
11850  /*l
11851  *b Description:
11852  **
11853  ** This function adds a flee object to this agent.
11854  ** This agent will attempt to move away from the specified
11855  ** character until it is beyond the specified flee distance.
11856  **
11857  ** Note: Currently there can only be one flee object. This
11858  ** restriction will be lifted in a future version.
11859  **
11860  ** This function will implicitly put this agent into the
11861  ** flee behavior.
11862  **
11863  ** Neither the current focus character nor group will be
11864  ** changed by this function.
11865  **
11866  *b Arguments:
11867  **
11868  *a character_name - character from which to flee
11869  *a distance - minimum distance to move away from character
11870  *a danger_level - how "strong" the flee should be; set from
11871  *a 0 to 100
11872  **
11873  ** The danger_level argument is not currently used, but will be in
11874  ** a future version.
11875  **
11876  *b Returns:
11877  **
11878  ** 0 on success, -1 on failure
11879  **
11880  *b Available as Decision Bead/Event
11881  */
11882  int agent_flee_character(const char* character_name,
11883  float distance,
11884  int danger_level = 50);
11885 
11886  /*l
11887  *b Description:
11888  **
11889  ** This function adds a flee object to this agent. This agent
11890  ** will attempt to move away from the specified group until it is
11891  ** beyond the specified flee distance.
11892  **
11893  ** This function will implicitly put this agent into the flee
11894  ** behavior.
11895  **
11896  ** Neither the current focus character nor group will be changed
11897  ** by this function.
11898  **
11899  *b Arguments:
11900  **
11901  *a group_name - group from which to flee
11902  *a distance - minimum distance to move away from character
11903  *a danger_level - how "strong" the flee should be; set from
11904  *a 0 to 100
11905  **
11906  ** The danger_level argument is not currently used, but will be in
11907  ** a future version.
11908  **
11909  *b Returns:
11910  **
11911  ** 0 on success, -1 on failure
11912  **
11913  *b Available as Decision Bead/Event
11914  */
11915  int agent_flee_group(const char* group_name,
11916  float distance,
11917  int danger_level = 50);
11918 
11919  /*l
11920  *b Description:
11921  **
11922  ** This function is similar to agent_flee_group(), but the
11923  ** agent will instead flee the members of the specified
11924  ** crowd.
11925  */
11926  int agent_flee_crowd(const char* crowd_name,
11927  float distance,
11928  int danger_level = 50);
11929 
11930  /*l
11931  *b Description:
11932  **
11933  ** This function adds a flee object to this agent.
11934  ** This agent will attempt to move away from the specified
11935  ** location until it is beyond the specified flee distance.
11936  **
11937  ** Note: Currently there can only be one flee object. This
11938  ** restriction will be lifted in a future version.
11939  **
11940  ** This function will implicitly put this agent into the
11941  ** flee behavior.
11942  **
11943  ** Neither the current focus character nor group will be
11944  ** changed by this function.
11945  **
11946  *b Arguments:
11947  **
11948  *a x, y, z - location from which to flee
11949  *a distance - minimum distance to move away from character
11950  *a danger_level - how "strong" the flee should be; set from
11951  *a 0 to 100
11952  **
11953  ** The danger_level argument is not currently used, but will be in
11954  ** a future version.
11955  **
11956  *b Returns:
11957  **
11958  ** 0 on success, -1 on failure
11959  */
11960  int agent_flee_location(float x, float y, float z,
11961  float distance,
11962  int danger_level = 50);
11963 
11964  /*l
11965  *b Description:
11966  **
11967  ** This function removes all flee objects.
11968  **
11969  ** This function has no effect on current behavior.
11970  **
11971  *b Returns:
11972  **
11973  ** 0 on success, -1 on failure
11974  **
11975  *b Available as Decision Bead/Event
11976  */
11977  void agent_remove_all_flee_objects();
11978 
11989  /*l
11990  *b Description:
11991  **
11992  ** This function puts this agent into the mingle behavior, in which
11993  ** it will choose semi-random points in the specified region and
11994  ** subregion to move to. The agent will remain at the selected
11995  ** points for some amount of time, and the select a new point.
11996  **
11997  ** If all members of a crowd have this behavior they will tend to get
11998  ** together in small groups.
11999  **
12000  ** Use diguyAgentParams::set_move_on_t_min() and
12001  ** diguyAgentParams::set_move_on_t_max() for setting how long the
12002  ** agent will remain at the selected mingle points.
12003  **
12004  *b Arguments:
12005  **
12006  *a region_name - region in which to mingle
12007  *a subregion_name - subregion in which to mingle
12008  **
12009  ** The behavior region will be set the specified region. Pass NULL
12010  ** or "(current)" to not change the current behavior region.
12011  **
12012  *b Returns:
12013  **
12014  ** 0 on success, -1 on failure
12015  **
12016  *b Available as Decision Bead/Event
12017  */
12018  int agent_mingle_in_region(const char* region_name = "(current)",
12019  const char* subregion_name = "base");
12020 
12031  /*l
12032  *b Description:
12033  **
12034  ** This function is similar to agent_mingle_in_region(), but agents
12035  ** will pick completely random points and not try to clump together
12036  ** in small groups.
12037  **
12038  *b Returns:
12039  **
12040  ** 0 on success, -1 on failure
12041  **
12042  *b Available as Decision Bead/Event
12043  */
12044  int agent_wander_region(const char* region_name = "(current)",
12045  const char* subregion_name = "base");
12046 
12057  /*l
12058  *b Description:
12059  **
12060  ** This function will cause this agent to pursue the specified
12061  ** character. This agent will attempt to move toward the specified
12062  ** character until it is within its still distance as specified in
12063  ** its agent params.
12064  **
12065  ** This function will implicitly put this agent into the pursue
12066  ** behavior.
12067  **
12068  ** The current focus group will be set to the specified group. Pass
12069  ** NULL or the empty string ("") to not change the focus group, but
12070  ** still change to the attack behavior.
12071  **
12072  ** The current focus character will be un-set.
12073  **
12074  *b Arguments:
12075  **
12076  *a character_name - character to pursue
12077  **
12078  *b Returns:
12079  **
12080  ** 0 on success, -1 on failure
12081  **
12082  *b Available as Decision Bead/Event
12083  */
12084  int agent_pursue_character(const char* character_name);
12085 
12086  /*l
12087  *b Description:
12088  **
12089  ** This function is similar to agent_pursue_character(), but the
12090  ** point toward the agent will move will be offset from the pursued
12091  ** character by the passed offset.
12092  */
12093  int agent_pursue_character_with_offset(const char* character_name,
12094  float offset_x,
12095  float offset_y);
12096 
12097  /*l
12098  *b Description:
12099  **
12100  ** This function is similar to agent_pursue_character(), but instead
12101  ** will choose pursue characters from the characters in the specified
12102  ** group.
12103  **
12104  ** This function will implicitly put this agent into the pursue
12105  ** behavior.
12106  **
12107  ** The current focus group will be set to the specified group. Pass
12108  ** NULL or the empty string ("") to not change the focus group, but
12109  ** still change to the pursue behavior.
12110  **
12111  ** The current focus character will be un-set.
12112  **
12113  *b Arguments:
12114  **
12115  *a group_name - name of group from which pursue characters should
12116  *a be chosen
12117  **
12118  *b Returns:
12119  **
12120  ** 0 on success, -1 on failure
12121  **
12122  *b Available as Decision Bead/Event
12123  */
12124  int agent_pursue_group(const char* group_name);
12125 
12126  /*l
12127  *b Description:
12128  **
12129  ** Calls a formation with this character as a leader, oriented towards
12130  ** (target_x, target_y).
12131  **
12132  *b Returns:
12133  **
12134  ** 0 on success, -1 on failure
12135  */
12136  int agent_call_formation(const char* formation_name,
12137  float target_x,
12138  float target_y);
12139 
12150  /*l
12151  *b Description:
12152  **
12153  ** This function has the character travel along its behavior path
12154  ** shape, typically to the end and then back to the beginning. It
12155  ** will put the agent into the travel behavior.
12156  **
12157  *b Arguments:
12158  **
12159  *a direction - should be either "forward" or "backward"; pass NULL
12160  *a for default forward
12161  *a at_end - what to do when end of path reached
12162  *a waypoint_index - index of waypoint to start at; -1 for nearest,
12163  *a -2 for random
12164  *a offset_y - sideways offset from behavior path
12165  **
12166  ** Valid values for at_end are:
12167  **
12168  *- - "reverse"
12169  *- - "loop"
12170  *- - "stop"
12171  *- - "teleport"
12172  **
12173  ** See the documentation for diguyNavPathAtEnd for information on
12174  ** what each value means.
12175  */
12176  int agent_travel_behavior_path(const char* direction = NULL,
12177  const char* at_end = NULL,
12178  int waypoint_index = -1,
12179  float offset_y = 0.5f);
12180 
12181  /*l
12182  *b Description:
12183  **
12184  ** Similar to agent_travel_behavior_path(), but specific path can be
12185  ** set rather than using behavior path.
12186  */
12187  int agent_travel_path_shape(const char* path_shape_name,
12188  const char* direction = NULL,
12189  const char* at_end = NULL,
12190  int waypoint_index = -1,
12191  float offset_y = 0.5f);
12192 
12193  /*l
12194  *b Description:
12195  **
12196  ** The agent will create a travel path around the border of the
12197  ** region specified. A CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
12198  ** callback will be triggered every time a character completes a loop
12199  ** around the border.
12200  **
12201  *b Arguments:
12202  **
12203  *a region_name - the name of the region to patrol; leaving blank or
12204  *a passing NULL will use the agent's current region
12205  *a subregion - name of the subregion to use; defaults to the base
12206  *a subregion
12207  **
12208  *b Returns:
12209  **
12210  ** 0 on success, -1 on failure
12211  */
12212  int agent_travel_region_border(const char* region_name = NULL,
12213  const char* subregion_name = "base");
12214 
12215  /*l
12216  *b Description:
12217  **
12218  ** Agent will attempt to create a navigation path on the via_region
12219  ** and then travel it. An A* path planning algorithm is used to find
12220  ** the path, cost preferences from the character's current
12221  ** diguyAgentParams are used in the search.
12222  **
12223  *b Note: as of DI-Guy 12 there is a version of this function
12224  ** agent_move_to_point_bg() that uses a multi-threaded infrastructure.
12225  ** We strongly recommend using it for future developments.
12226  **
12227  *b Arguments:
12228  **
12229  *a x, y, z - the target location
12230  *a via_region - the name of the region to run A* on (pass in "*"
12231  *a to have the code attempt to find the nearest
12232  *a region automatically.)
12233  *a subregion_name - the name of the subregion to restrict search to
12234  **
12235  *b Returns:
12236  **
12237  ** 0 on success, -1 on failure
12238  */
12239  int agent_move_to_point(float x, float y, float z,
12240  const char* via_region = NULL,
12241  const char* subregion_name = "base");
12242 
12243  /*l
12244  *b Description:
12245  **
12246  ** A multi-threaded version of agent_move_to_point(). See that
12247  ** function for more information.
12248  **
12249  ** We recommend switching to using this over the single threaded
12250  ** version. When the path result has been computed a callback with id
12251  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12252  ** stored in get_path_planning_result(). You can also poll for
12253  ** completion via get_is_path_planning().
12254  **
12255  *b Returns:
12256  **
12257  ** diguyNavPathSearchResults enum value
12258  **
12259  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12260  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12261  ** for multi-threading, or a negative value on failure.
12262  */
12263  int agent_move_to_point_bg(float x, float y, float z,
12264  const char* via_region = NULL,
12265  const char* subregion_name = "base");
12266 
12267  /*l
12268  *b Description:
12269  **
12270  ** Agent will attempt to create a navigation path on the region
12271  ** via_region and then travel it. An A* path planning algorithm is
12272  ** used to find the path.
12273  **
12274  ** The subregion masks are used to specify which subregions to use or
12275  ** avoid. Cost bias values can be used to make tweak how strong the
12276  ** repulsion values are.
12277  **
12278  *b Note:
12279  **
12280  ** As of DI-Guy 12 there is a version of this function
12281  ** agent_move_to_point_via_subregions_bg that uses a multi-threaded
12282  ** infrastructure. We strongly recommend using it for future
12283  ** developments.
12284  **
12285  ** This function will fail and return -1 if a path cannot be found.
12286  **
12287  *b Arguments:
12288  **
12289  *a x, y, z - the target location
12290  *a via_region - the name of the region to run A* on (pass in "*"
12291  *a to have the code attempt to find the nearest
12292  *a region automatically)
12293  *a preferred_subregions_mask - diguySubregionMask value of regions
12294  *a preferred for travel
12295  *a cost_bias_for_preferred_regions - how much cheaper it will be
12296  *a to cross spaces that are part of desired subregion;
12297  *a should be < 1.0
12298  *a cost_bias_for_neutral_regions - how much more expensive it will be
12299  *a to cross spaces that are not part of desired subregion; see
12300  *a below for more information
12301  *a repulsed_regions_mask - diguySubregionMask value of regions *not*
12302  *a preferred for travel
12303  *a cost_bias_for_repulsed_regions - how much more expensive it will be
12304  *a to cross regions that are marked as repulsive; pass
12305  *a DIGUY_DEFAULT_FLOAT to avoid completely
12306  **
12307  ** Pass DIGUY_DEFAULT_FLOAT for cost_bias_for_neutral_regions and
12308  ** cost_bias_for_repulsed_regions to specify that they should be
12309  ** avoided completely.
12310  **
12311  ** The preferred_subregions_mask and repulsed_regions_mask use
12312  ** DI-Guy subregion mask values combined together. For example,
12313  ** DIGUY_SUBREGION_MASK_SIDEWALK | DIGUY_SUBREGION_MASK_CROSSWALK.
12314  **
12315  ** For cost_bias_for_neutral_regions, specifying a non-zero value for
12316  ** this lowers the likelihood that searches fail on disjointed
12317  ** subregions. A value < 1 will cause the planner to run faster but
12318  ** explore fewer points, possibly missing preferred regions. Values
12319  ** greater then 1 will explore more points but will be slower.
12320  **
12321  *b NOTE:
12322  **
12323  *b THIS API has changed for DI-GUY 11.
12324  **
12325  ** cost_bias_for_preferred_regions has been added and the neutral and
12326  ** repulsed default values have changed.
12327  **
12328  *b Returns:
12329  **
12330  ** 0 on success, -1 on failure
12331  */
12332  int agent_move_to_point_via_subregions(float x, float y, float z,
12333  const char* via_region = NULL,
12334  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12335  float cost_bias_for_preferred_regions = 0.25f,
12336  float cost_bias_for_neutral_regions = 1.1f,
12337  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12338  float cost_bias_for_repulsed_regions = 10.0f,
12339  int cost_rule = 0);
12340 
12341  /*l
12342  *b Description:
12343  **
12344  ** A multi-threaded version of agent_move_to_point_via_subregions().
12345  ** We recommend switching to using this over the single threaded
12346  ** version. When the result is found a
12347  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12348  ** stored in get_path_planning_result(), you can also poll for
12349  ** completion via get_is_path_planning().
12350  **
12351  *b Returns:
12352  **
12353  ** diguyNavPathSearchResults enum value
12354  **
12355  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12356  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12357  ** for multi-threading, or a negative value on failure.
12358  */
12359  int agent_move_to_point_via_subregions_bg(float x, float y, float z,
12360  const char* via_region = NULL,
12361  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12362  float cost_bias_for_preferred_regions = 0.25f,
12363  float cost_bias_for_neutral_regions = 1.1f,
12364  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12365  float cost_bias_for_repulsed_regions = 10.0f,
12366  int cost_rule = 0);
12367 
12368  /*l
12369  *b Returns:
12370  **
12371  ** diguyNavPathSearchResults value after agent_move_to_point_bg()
12372  ** or agent_move_to_point_via_subregions_bg() has been called when
12373  ** the multi-threaded path planner has completed.
12374  */
12375  int get_path_planning_result();
12376 
12377  /*l
12378  *b Returns:
12379  **
12380  ** 1 if character is currently waiting for a result from the
12381  ** multi-threaded path planner, else 0
12382  */
12383  int get_is_path_planning();
12384 
12385  /*l
12386  *b Description:
12387  **
12388  ** Agent will attempt to create a navigation path on the via_region
12389  ** to a point in the target region, and then travel it. An A* path
12390  ** planning algorithm is used to find the path. Cost preferences from
12391  ** the character's current diguyAgentParams are used in the search.
12392  **
12393  *b Arguments:
12394  **
12395  *a region - target region
12396  *a subregion_name - target subregion
12397  *a via_region - name of the region travel in
12398  **
12399  *b Returns:
12400  **
12401  ** 0 on success, -1 on failure
12402  **
12403  *b Available as Decision Bead/Event
12404  */
12405  int agent_move_to_region(const char* region,
12406  const char* subregion_name = "base",
12407  const char* via_region = NULL);
12408 
12409  /*l
12410  *b Description:
12411  **
12412  ** Similar to agent_move_to_point_via_subregions(), but for moving to
12413  ** another region.
12414  **
12415  *b NOTE:
12416  **
12417  *b THIS API has changed for DI-GUY 11.
12418  **
12419  ** cost_bias_for_preferred_regions has been added and the neutral and
12420  ** repulsed default values have changed.
12421  **
12422  *b See Also:
12423  **
12424  ** diguyScenario::set_max_distance_planning_multiplier();
12425  ** diguyScenario::get_time_spent_path_planning_this_frame();
12426  **
12427  *b Returns:
12428  **
12429  ** 0 on success, -1 on failure
12430  */
12431  int agent_move_to_region_via_subregions(const char* region_name,
12432  const char* subregion_name = "base",
12433  const char* via_region = NULL,
12434  float cost_bias_for_preferred_regions = 0.25f,
12435  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12436  float cost_bias_for_neutral_regions = 1.1f,
12437  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12438  float cost_bias_for_repulsed_regions = 10.0f);
12439 
12450  /*l
12451  *b Description:
12452  **
12453  ** The agent will begin following the specified path, using the path
12454  ** follow behavior (DIGUY_AGENT_BEHAVIOR_PATH_FOLLOW).
12455  **
12456  ** The path follow behavior allows an agent to approximately follow a
12457  ** diguyCharacterPath without being in path position mode. The agent
12458  ** can respond to external stimuli (e.g., run away from gunfire), and
12459  ** later return to and resume the path.
12460  **
12461  ** Currently the path must be a path previously defined for the
12462  ** character, through either DI-Guy Scenario or via path API calls.
12463  **
12464  *b Arguments:
12465  **
12466  *a path_name - name of a path of this character
12467  **
12468  *b Returns:
12469  **
12470  ** 0 on success, -1 on failure
12471  **
12472  *b Available as Decision Bead/Event
12473  */
12474  int agent_path_follow(const char* path_name);
12475 
12476  /*l
12477  *b Description:
12478  **
12479  ** The agent will resume following the path specified by a previous
12480  ** call to agent_path_follow(). This will put the agent back into
12481  ** the path follow behavior.
12482  **
12483  *b Returns:
12484  **
12485  ** 0 on success, -1 on failure
12486  **
12487  *b Available as Decision Bead/Event
12488  */
12489  int agent_resume_path_follow();
12490 
12491  /*l
12492  *b Returns:
12493  **
12494  ** the path being followed in path behavior mode
12495  */
12496  diguyCharacterPath* agent_get_path_follow_path();
12497 
12498  /*l
12499  *b Description:
12500  **
12501  ** In path follow behavior the agent moves along the path specified
12502  ** in agent_path_follow(). How far along the agent is on the path is
12503  ** specified in seconds. This function returns that time.
12504  **
12505  ** Note that advancing along the path may be paused for some reason,
12506  ** typically because the agent is resuming path follow behavior
12507  ** after being in a different behavior, or the agent is too far away
12508  ** from the current desired position on the path. In this case the
12509  ** returned time may not advance for awhile until the agent is close
12510  ** enough to the path to resume advancing along it.
12511  **
12512  ** Call diguyAgentParams::set_path_follow_pause_t_when_off_path()
12513  ** to set whether time will be paused when off of the path.
12514  **
12515  ** Call diguyAgentParams::set_path_follow_unpause_t_at_radius() to
12516  ** set how close the agent must be to the last point on the path
12517  ** before time will resume.
12518  **
12519  *b Returns:
12520  **
12521  ** how far, in seconds, the agent is along its path follow path
12522  */
12523  float agent_get_path_follow_path_t();
12524 
12525  /*l
12526  *b Returns:
12527  **
12528  ** 1 if time along the path is not advancing, else 0
12529  */
12530  int agent_get_path_follow_path_t_paused();
12531 
12542  /*l
12543  *b Returns:
12544  **
12545  ** the crowd this agent is a part of, if any; returns NULL if not in
12546  ** a crowd
12547  */
12548  diguyCrowd* agent_get_crowd();
12549 
12550  /*l
12551  *b Description:
12552  **
12553  ** This function allows the end user to directly change an agent's
12554  ** current behavior. This function currently the only way to start
12555  ** an agent "idling".
12556  */
12557  int agent_begin_behavior(const char* behavior_name);
12558 
12559  /*l
12560  *b Description:
12561  **
12562  ** This function sets the behavior of the agent to "none".
12563  */
12564  int agent_stop_behavior();
12565 
12566  /*l
12567  *b Description:
12568  **
12569  ** This function is a convenience function that changes the focus
12570  ** character of this agent's current crowd params.
12571  **
12572  ** This can also be done by getting the character's current params
12573  ** using get_agent_current_params(), and then calling
12574  ** set_focus_character() on that object. This function
12575  ** call, however, is available in decisions.
12576  **
12577  ** The agent currently need not be part of a crowd for this function
12578  ** to work.
12579  **
12580  *b Arguments:
12581  **
12582  *a character_name - name of character to become new focus
12583  *a character; pass NULL or "" to un-set
12584  *a the focus character
12585  **
12586  *b Returns:
12587  **
12588  ** 0 on success, -1 on failure
12589  **
12590  *b Available as Decision Bead/Event
12591  */
12592  int agent_set_current_focus_character(const char* character_name);
12593 
12594  /*l
12595  *b Description:
12596  **
12597  ** This function returns the current character this agent
12598  ** is focused on. This will either be the character named
12599  ** by the focus character, or the character chosen from the
12600  ** focus group to be the current focus character.
12601  **
12602  ** The agent currently need not be part of a crowd for this function
12603  ** to work.
12604  **
12605  *b Returns:
12606  **
12607  *a pointer to type diguyCharacter
12608  */
12609  diguyCharacter* agent_get_current_focus_character();
12610 
12611  /*l
12612  *b Description:
12613  **
12614  ** Similar to set_current_focus_character(), but sets
12615  ** the current focus group instead of character.
12616  **
12617  ** The agent currently need not be part of a crowd for this function
12618  ** to work.
12619  **
12620  *b Arguments:
12621  **
12622  *a group_name - name of group to become new focus
12623  *a group; pass NULL or "" to un-set
12624  *a the focus group
12625  **
12626  *b Returns:
12627  **
12628  ** 0 on success, -1 on failure
12629  **
12630  *b Available as Decision Bead/Event
12631  */
12632  int agent_set_current_focus_group(const char* group_name);
12633 
12634  /*l
12635  *b Description:
12636  **
12637  ** This function returns the initial agent parameters of
12638  ** this agent. The initial parameters of this agent
12639  ** can then be edited through this object.
12640  **
12641  ** Changes to the initial parameters will have no effect until
12642  ** the scenario is reset.
12643  **
12644  ** The current agent parameters will be set to these
12645  ** initial parameters whenever the scenario is reset.
12646  **
12647  ** The agent currently need not be part of a crowd for this function
12648  ** to work.
12649  **
12650  *b Returns:
12651  **
12652  *a pointer to type diguyAgentParams
12653  */
12654  diguyAgentParams* agent_get_initial_params();
12655 
12656  /*l
12657  *b Description:
12658  **
12659  ** This function returns the current agent parameters of
12660  ** this agent. The current parameters of this agent
12661  ** can then be edited through this object.
12662  **
12663  ** Changes to the current parameters should take effect immediately.
12664  **
12665  ** The current agent parameters will be reset to the
12666  ** initial parameters whenever the scenario is reset.
12667  **
12668  ** The agent currently need not be part of a crowd for this function
12669  ** to work.
12670  **
12671  *b Returns:
12672  **
12673  *a pointer to type diguyAgentParams
12674  */
12675  diguyAgentParams* agent_get_current_params();
12676 
12677  /*l
12678  *b Description:
12679  **
12680  ** This function gets the name of the agent's current profile.
12681  **
12682  *b Returns:
12683  **
12684  ** the name of the agent's current profile
12685  */
12686  const char* agent_get_current_params_profile_name();
12687 
12688  /*l
12689  *b Description:
12690  **
12691  ** This function sets this agent's current agent parameters from the
12692  ** specified crowd profile.
12693  **
12694  ** The agent currently need not be part of a crowd for this function
12695  ** to work.
12696  **
12697  *b Arguments:
12698  **
12699  *a profile_name - name of existing crowd profile
12700  *a retain_focus_objects - pass 1 to not change focus object from
12701  *a current focus
12702  *a retain_navigation_values - pass 1 to not change current navigation
12703  *a parameters
12704  *a retain_behavior - pass 1 to not change current behavior
12705  **
12706  ** Navigation values are things like:
12707  **
12708  *- - behavior path
12709  *- - behavior region and subregion
12710  *- - region masks
12711  *- - cost biases
12712  *- - path planner settings
12713  **
12714  *b Returns:
12715  **
12716  ** 0 on success, -1 on failure
12717  **
12718  *b Available as Decision Bead/Event
12719  */
12720  int agent_set_current_params_from_profile(const char* profile_name,
12721  int retain_focus_objects = 1,
12722  int retain_navigation_values = 1,
12723  int retain_behavior = 0);
12724 
12725  /*l
12726  *b Description:
12727  **
12728  ** Similar to agent_set_current_params_from_profile(), but initial
12729  ** parameters are changed.
12730  */
12731  int agent_set_initial_params_from_profile(const char* profile_name);
12732 
12733  /*l
12734  *b Description:
12735  **
12736  ** This function sets the current parameters from the agent's
12737  ** initial parameters.
12738  */
12739  void agent_set_current_params_from_initial_params();
12740 
12741  /*l
12742  *b Description:
12743  **
12744  ** This function sets whether the borders of the current behavior
12745  ** region of the agent is solid.
12746  **
12747  ** If they are, the agent will treat the walls as if they are
12748  ** solid walls in the environment. If not, the agent is free to
12749  ** walk through them.
12750  **
12751  ** The agent currently need not be part of a crowd for this function
12752  ** to work.
12753  **
12754  *b Arguments:
12755  **
12756  *a is_solid - 1 if region border should be solid, 0 if not
12757  **
12758  *b Available as Decision Bead/Event
12759  */
12760  void agent_set_current_behavior_region_border_is_solid(int is_solid);
12761 
12762  /*l
12763  *b Description:
12764  **
12765  ** If the agent is in a behavior that stays in one place before moving
12766  ** to another, such as wander or mingle, this function will request
12767  ** that the agent move on to the next location.
12768  **
12769  *b Available as Decision Bead/Event
12770  */
12771  void agent_move_on();
12772 
12773 
12774  /*l
12775  *b Description:
12776  **
12777  ** This function controls if the AI will attempt to automatically change variants
12778  ** depending on the behavior. This should only change how still motions are performed
12779  ** when the default variant is Normal. Characters in wander and idle will automatically
12780  ** shift to ambient still motions, mingle will alternate between socialize and ambient
12781  ** motions. Attack should automatically switch from aiming to ambient.
12782  ** defaults to being on.
12783  */
12784  int agent_set_auto_variant_selection(int selection_enabled);
12785 
12786  /*l
12787  *b Description:
12788  **
12789  ** Returns if automatic variant selection is enabled, defaults to being on.
12790  */
12791  int agent_get_auto_variant_selection();
12792 
12793  /*l
12794  *b Description:
12795  **
12796  ** Returns current travel path or nav path.
12797  */
12798  diguyPathShape * agent_get_current_traveled_path();
12799 
12800  /*l
12801  *b Description:
12802  **
12803  ** Allows agent to determine speed zone based on distance to endpoint of current
12804  ** path. With this off, speed zones are determined by "desired position", which
12805  ** when following a path is not the endpoint, but a point on the path a short
12806  ** distance ahead of the current position.
12807  **
12808  ** The default value is false.
12809  **
12810  ** Enable this if you want the character to automatically run when following a
12811  ** long path.
12812  */
12813  void agent_set_use_speed_zones_on_paths(int enabled);
12814 
12815  /*l
12816  *b Description:
12817  **
12818  ** Returns the current value set by agent_set_use_speed_zones_on_paths().
12819  */
12820  int agent_get_use_speed_zones_on_paths();
12821 
12822 #ifdef CPLUSPLUS_ONLY
12823 
12879  /*l
12880  *b Description:
12881  **
12882  ** This function sets a feeler function that will be used by this
12883  ** character for environment collision detection. The feeler will
12884  ** replace any existing feeler function (including the default
12885  ** function used in DI-Guy Scenario).
12886  **
12887  ** See the "User-Defined Feelers" information for more information.
12888  **
12889  *b Arguments:
12890  **
12891  *a feeler_function - pointer to user-defined feeler function
12892  **
12893  *b Returns:
12894  **
12895  ** 0 on success, -1 on failure
12896  **
12897  *b Callable From:
12898  **
12899  *- - C++
12900  */
12901  int agent_set_feeler_function(diguyFeelerFunction* feeler_function);
12902 
12903  /*l
12904  *b Returns:
12905  **
12906  ** current feeler function; see set_feeler_function()
12907  **
12908  *b Callable From:
12909  **
12910  *- - C++
12911  */
12912  diguyFeelerFunction* agent_get_feeler_function();
12913 
12914 #endif
12915 
12916 
12917 /*****************************************************************************/
12923  /*l
12924  *b Description:
12925  **
12926  ** Creates a Lua mind object based off of the contents of base_class.
12927  **
12928  *b Arguments:
12929  **
12930  *a base_class - the class to use as the basis for the character's
12931  *a mind
12932  *a init_arg1-2 - experimental optional arguments passed to the init
12933  *a function; your lua init function will need to take
12934  *a arguments
12935  **
12936  */
12937  int create_lua_mind(const char* base_class, const char* init_arg1 = NULL,
12938  const char* init_arg2 = NULL);
12939 
12940  /*l
12941  *b Description:
12942  **
12943  ** Returns the name of the mind, e.g. "luaPedestrian". This is, in other
12944  ** words, the mind's base class
12945  */
12946  const char *get_mind_name();
12947 
12948  /*l
12949  *b Description:
12950  **
12951  ** Agent characters with minds will typically have the mind be in
12952  ** some state, such as "patrolling", "fleeing", "mobbing", etc. This
12953  ** function returns the name of that state.
12954  **
12955  ** Currently this is only applicable to characters with Lua minds.
12956  **
12957  *b Returns:
12958  **
12959  ** the name of the agent's current mind state
12960  */
12961  const char* get_mind_current_state_name();
12962 
12963  /*l
12964  *b Description:
12965  **
12966  ** This function causes callback functions with the callback id
12967  ** CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED to be called.
12968  ** It's intended use is for mind implementations that need to
12969  ** signal that the mind's current state has changed.
12970  **
12971  ** Currently this is only applicable to characters with Lua minds.
12972  */
12973  void do_mind_current_state_changed_callback();
12974 
12975  /*l
12976  *b Description:
12977  **
12978  ** How long until the character's main coroutine thread should be
12979  ** resumed. This function is typically used by various luaCharacter
12980  ** sleep functions.
12981  **
12982  *b Arguments:
12983  **
12984  *a sleep_length - how long relative to the current time the character
12985  *a should sleep
12986  */
12987  int set_sleep_timer(float sleep_length);
12988 
12989  /*l
12990  *b Returns:
12991  **
12992  ** How long until the character's main coroutine thread resumes,
12993  ** relative to the current time.
12994  */
12995  float get_sleep_timer();
12996 
12997  /*l
12998  *b Description:
12999  **
13000  ** The frequency at which the luaCharacter's heartbeat function
13001  ** should run. This defaults to once per second. The character
13002  ** must have a Lua function named heartbeat.
13003  **
13004  *b Arguments:
13005  **
13006  *a heartbeat_dt - frequency of heartbeat
13007  */
13008  int set_heartbeat_dt(float heartbeat_dt);
13009 
13010  /*l
13011  *b Description:
13012  **
13013  ** This function allows the addition of additional heartbeat
13014  ** functions.
13015  **
13016  *b Arguments:
13017  **
13018  *a function_name - the name of the Lua function to treat as a
13019  *a heartbeat; the function_name should not include
13020  *a the name of the character object
13021  *a heartbeat_dt - frequency of heartbeat
13022  **
13023  *b Returns:
13024  **
13025  ** 0 on success, -1 on failure
13026  */
13027  int add_secondary_heartbeat(const char* function_name,
13028  float heartbeat_dt);
13029 
13030  /*l
13031  *b Description:
13032  **
13033  ** This function removes an added heartbeat function.
13034  **
13035  *b Arguments:
13036  **
13037  *a function_name - the name of the Lua function to treat as a
13038  *a heartbeat; the function_name should not include
13039  *a the name of the character object
13040  **
13041  *b Returns:
13042  **
13043  ** 0 on success, -1 on failure
13044  */
13045  int remove_secondary_heartbeat(const char* function_name);
13046 
13047  /*l
13048  *b Description:
13049  **
13050  ** The frequency at which a luaCharacter's secondary heartbeat
13051  ** function should run. The character must have a Lua function named
13052  ** function_name.
13053  **
13054  *b Arguments:
13055  **
13056  *a function_name - heartbeat function to adjust
13057  *a heartbeat_dt - frequency of heartbeat
13058  **
13059  *b Returns:
13060  **
13061  ** 0 on success, -1 on failure
13062  */
13063  int set_secondary_heartbeat_dt(const char* function_name, float heartbeat_dt);
13064 
13065  /*l
13066  *b Description:
13067  **
13068  ** This function creates a request that whenever the specified
13069  ** callback is triggered, the character is woken up with a message.
13070  ** The message will be of the form:
13071  *>
13072  *- - message_type = "callback"
13073  *- - message = the string representation of the callback
13074  *<
13075  ** A good example of the use for this is a flexible "move to"
13076  ** command:
13077  **
13078  *b Lua Example:
13079  **
13080  *e self.character:add_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13081  *e -- begin to move to a location
13082  *e self.character:agent_move_to_region_via_subregions("navmesh", "green", "navmesh",
13083  *e DIGUY_SUBREGION_MASK_BASE, 12);
13084  *e -- sleep till arrived
13085  *e self:sleep(100);
13086  *e self.character:remove_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13087  **
13088  ** Effectively the character will wake up either after 100 seconds or
13089  ** when they arrive at their desired destination.
13090  **
13091  *b Arguments:
13092  **
13093  *a callback - the callback id that should wake up the character
13094  **
13095  *b Returns:
13096  **
13097  ** 0 on success, -1 on failure
13098  */
13099  int add_wakeup_callback(int callback);
13100 
13101  /*l
13102  *b Description:
13103  **
13104  ** This function removes a request to trigger a message when a
13105  ** callback is triggered.
13106  **
13107  *b Arguments:
13108  **
13109  *a callback - callback id that should no longer wake up the
13110  *a character
13111  **
13112  *b Returns:
13113  **
13114  ** 0 on success, -1 on failure
13115  */
13116  int remove_wakeup_callback(int callback);
13117 
13118  /*l
13119  *b Description:
13120  **
13121  ** This function removes all requests to trigger a message when
13122  ** callbacks are triggered.
13123  **
13124  *b Returns:
13125  **
13126  ** 0 on success, -1 on failure
13127  */
13128  int remove_all_wakeup_callbacks();
13129 
13130  /*l
13131  *b Description:
13132  **
13133  ** This function check for a requests to trigger a message when
13134  ** a given callback is triggered.
13135  **
13136  *b Returns:
13137  **
13138  ** 0 on false, 1 on true
13139  */
13140  int has_wakeup_callback(int callback);
13141 
13142  /*l
13143  *b Description:
13144  **
13145  ** This function wakes up a character and sends them a message.
13146  ** Currently this is only applicable to characters with Lua minds.
13147  **
13148  *b Arguments:
13149  **
13150  *a sender - who is sending the message
13151  *a message_type - what type of message is being sent
13152  *a message - the message string
13153  *a message_params - optional parameter string
13154  **
13155  *b Returns:
13156  **
13157  ** number of times message was successfully parsed
13158  */
13159  int agent_accept_message(const char* sender,
13160  const char* message_type,
13161  const char* message,
13162  const char* message_params = NULL);
13163 
13164  /*l
13165  **
13166  *b Description:
13167  **
13168  ** This function wakes up nearby characters and sends them a message.
13169  ** The sender of the message is implicitly set to the individual
13170  ** calling the broadcast function
13171  **
13172  ** Currently this is only applicable to characters with Lua minds.
13173  **
13174  *b Arguments:
13175  **
13176  *a radius - how far to broadcast the message
13177  *a message_type - what type of message is being sent
13178  *a message - the message string
13179  *a message_params - optional parameter string
13180  **
13181  *b Returns:
13182  **
13183  ** number of times message was successfully parsed
13184  */
13185  int agent_broadcast_message(float radius,
13186  const char* message_type,
13187  const char* message,
13188  const char* message_params = NULL);
13189 
13190  /*l
13191  *b Description:
13192  **
13193  ** This function wakes up nearby characters in the group specified
13194  ** and sends them a message. The sender of the message is implicitly
13195  ** set to the individual calling the broadcast function.
13196  **
13197  ** Currently this is only applicable to characters with Lua minds.
13198  **
13199  *b Arguments:
13200  **
13201  *a group_name - group to broadcast message to
13202  *a radius - how far to broadcast the message
13203  *a message_type - what type of message is being sent
13204  *a message - the message string
13205  *a message_params - optional parameter string
13206  **
13207  **
13208  *b Returns:
13209  **
13210  ** number of times message was successfully parsed,
13211  ** -1 on failure
13212  */
13213  int agent_broadcast_message_to_group(const char* group_name,
13214  float radius,
13215  const char* message_type,
13216  const char* message,
13217  const char* message_params = NULL);
13218 
13219  /*l
13220  **
13221  *b Returns:
13222  **
13223  ** name of character's lua mind object; typically this is the
13224  ** character's name with '-' replaced by '_'
13225  */
13226  const char* get_lua_object_name();
13227 
13228  /*l
13229  *b Description:
13230  **
13231  ** Sets the specified field of the mind to the string field_value.
13232  */
13233  void set_mind_field_as_string(const char* field_name,
13234  const char* field_value);
13235 
13236  /*l
13237  *b Description:
13238  **
13239  ** Queries the luaCharacter object for a specific field, and attempts
13240  ** to convert it into a string. This works for strings and
13241  ** numbers.
13242  **
13243  ** This returned pointer will stay valid until the next time this
13244  ** function is called, so if the results need to be saved they must
13245  ** be copied.
13246  **
13247  *b Returns:
13248  **
13249  ** field_name as string
13250  */
13251  const char* get_mind_field_as_string(const char* field_name,
13252  int warn_if_no_field = 1);
13253 
13254  /*l
13255  *b Description:
13256  **
13257  ** Sets the specified field of the mind to the floating point
13258  ** number field_value.
13259  */
13260  void set_mind_field_as_float(const char* field_name, float field_value);
13261 
13262  /*l
13263  *b Description:
13264  **
13265  ** Similar to get_mind_field_as_string(), but returns field as
13266  ** a float.
13267  **
13268  *b Returns:
13269  **
13270  ** field_name as double
13271  */
13272  float get_mind_field_as_float(const char* field_name,
13273  int warn_if_no_field = 1,
13274  int* found_field = NULL);
13275 
13276  /*l
13277  *b Description:
13278  **
13279  ** Sets the specified field of the mind to the integer number
13280  ** field_value.
13281  */
13282  void set_mind_field_as_int(const char* field_name, int field_value);
13283 
13284  /*l
13285  *b Description:
13286  **
13287  ** Similar to get_mind_field_as_int(), but returns field as
13288  ** an integer.
13289  **
13290  *b Returns:
13291  **
13292  ** field_name as int
13293  */
13294  int get_mind_field_as_int(const char* field_name,
13295  int warn_if_no_field = 1,
13296  int* found_field = NULL);
13297 
13298  /*l
13299  *b Description:
13300  **
13301  ** Attempts to run a luaCharacter member function, and can optionally
13302  ** return the function's result. Lua return values can be converted
13303  ** to strings and numbers -- other data types will cause an error.
13304  **
13305  ** This returned pointer will stay valid until the next time this
13306  ** function is called, so if the results need to be saved they must
13307  ** be copied.
13308  **
13309  *b *Note:* This function should be considered experimental, as the
13310  *b API may change.
13311  **
13312  *b Arguments:
13313  **
13314  *a function_name - luaCharacter function field to invoke
13315  *a argument - optional string argument to the function
13316  *a has_return_string - 0 or 1; determines if lua interface should
13317  *a attempt to retrieve a string value
13318  **
13319  *b Returns:
13320  **
13321  ** Lua function return value
13322  */
13323  const char* evaluate_mind_function(const char* function_name,
13324  const char* argument = NULL,
13325  int has_return_string = 0);
13326 
13327  /*l
13328  *b Description:
13329  **
13330  ** This function produces a string with a long list of character
13331  ** information, including: current path, crowd, behavior, lua state,
13332  ** lua call stack, wakeup callbacks and lua object fields. It is
13333  ** meant to help with debugging agents.
13334  **
13335  ** This returned pointer will stay valid until the next time this
13336  ** function is called, so if the results need to be saved they must
13337  ** be copied.
13338  **
13339  *b Arguments:
13340  **
13341  *a include_stack - pass 1 to include callstack info, 0 to not
13342  *a include_locals - pass 1 to include local variable info, 0 to not
13343  **
13344  *b Returns:
13345  **
13346  ** string containing character information
13347  */
13348  const char* get_ai_state_string(int include_stack = 1, int include_locals = 1);
13349 
13350 
13351 /*****************************************************************************/
13361 /*
13362  *3 Visibility Tests
13363  */
13364 
13365  /*l
13366  *b Description:
13367  **
13368  ** This function tests whether this character can see the passed
13369  ** character. Currently this tests if the cervical link of this
13370  ** character has a clear line of sight to either the cervical or the
13371  ** position links of the target. Currently the orientation of this
13372  ** character isn't factored in.
13373  **
13374  ** This function does not fail if other characters are between the
13375  ** two characters in question.
13376  **
13377  ** Checking visibility is only an option if an octtree is generated
13378  ** from scene objects; typically only DI-Guy Scenario does this.
13379  ** Outside of DI-Guy Scenario set_character_los_function() should be
13380  ** used if no octtree is present.
13381  **
13382  *b Arguments:
13383  **
13384  *a character - character to check
13385  *a los_check_type - currently unused but passed to callback function
13386  *a if end users wish to pass an additional parameter
13387  **
13388  *b Returns:
13389  **
13390  ** 1 if character is visible, 0 if not
13391  */
13392  int check_character_visibility(diguyCharacter* character,
13393  int los_check_type = 0);
13394 
13395  /*l
13396  *b Description:
13397  **
13398  ** This function tests whether this character can see the x, y, z
13399  ** location specified. Currently this tests if the cervical link of
13400  ** this character has a clear line of sight to the x, y, z location.
13401  ** Currently the orientation of this character isn't factored in.
13402  **
13403  ** This function does not fail if other characters are between the
13404  ** character and the location in question.
13405  **
13406  ** Checking visibility is only an option if an octtree is generated
13407  ** from scene objects; typically only DI-Guy Scenario does this.
13408  **
13409  *b Arguments:
13410  **
13411  *a x, y, z - location to check
13412  **
13413  *b Returns:
13414  **
13415  ** 1 if location is visible, 0 if not
13416  */
13417  int check_point_visibility(float x, float y, float z);
13418 
13419 
13420 
13421 /*****************************************************************************/
13438 #ifdef CPLUSPLUS_ONLY
13439 
13440  /*l
13441  *b Description:
13442  **
13443  ** When a character needs to check if it can see a location, DI-Guy
13444  ** calls this function with a pointer to the diguyCharacter in
13445  ** question, and the coordinates of the point that is being looked
13446  ** at. This currently happens when an agent is told to move to a new
13447  ** region.
13448  **
13449  ** The following prototype should be used for the point line-of-sight
13450  ** function:
13451  **
13452  *e int diguyPointLOSFunction(diguyCharacter* character,
13453  *e float x,
13454  *e float y,
13455  *e float z);
13456  **
13457  ** The function should then check if the desired location is visible.
13458  ** This can be done in a number of ways; a typical approach is to do
13459  ** an intersection test with the static scene.
13460  **
13461  ** The function should return 1 if the path to the target is clear, 0
13462  ** if there is an obstruction.
13463  **
13464  ** A default point line-of-sight function can be set for all
13465  ** subsequently created characters by calling
13466  ** diguyScenario::set_default_point_los_function().
13467  **
13468  *b Callable From:
13469  **
13470  *- - C++
13471  */
13472  int set_point_los_function(diguyPointLOSFunction* point_los_function);
13473 
13474  /*l
13475  *b Returns:
13476  **
13477  ** current point line-of-sight function; see set_point_los_function()
13478  **
13479  *b Callable From:
13480  **
13481  *- - C++
13482  */
13483  diguyPointLOSFunction* get_point_los_function();
13484 
13485  /*l
13486  *b Description:
13487  **
13488  ** When a character needs to check if it can see another character,
13489  ** DI-Guy calls this function with a pointer to the diguyCharacter in
13490  ** question. This can happen when check_character_visibility() is
13491  ** invoked or when AI attack code assesses if it should take a shot.
13492  **
13493  ** The following prototype should be used for the character
13494  ** line-of-sight function:
13495  **
13496  *e int diguyCharacterLOSFunction(diguyCharacter* character,
13497  *e diguyCharacter* target_character,
13498  *e int los_test_type) // (currently unused)
13499  **
13500  ** Currently the los_test_type argument defaults to 0 and is not used
13501  ** internally. It is, however, available in
13502  ** check_character_visibility() and will be passed to the callback.
13503  ** This can be useful if the end user wants to write scripting code
13504  ** that has alternative Line of Sight tests depending on agent
13505  ** conditions. (e.g. a test that factors in the character's field of
13506  ** view.)
13507  **
13508  ** The function then checks if the target character is visible. This
13509  ** can be done in a number of ways; a typical approach is to do an
13510  ** intersection test with the static scene. The default
13511  ** implementation tests the path from the characters head to the
13512  ** target's head and then to the target's feet.
13513  **
13514  ** The function should return 1 if the path to the target is clear,
13515  ** and 0 if there is an obstruction.
13516  **
13517  ** A default character line-of-sight function can be set for all
13518  ** subsequently created characters by calling
13519  ** diguyScenario::set_default_character_los_function().
13520  **
13521  *b Callable From:
13522  **
13523  *- - C++
13524  */
13525  int set_character_los_function(diguyCharacterLOSFunction* character_los_function);
13526 
13527  /*l
13528  *b Returns:
13529  **
13530  ** current character line-of-sight function; see
13531  ** set_character_los_function()
13532  **
13533  *b Callable From:
13534  **
13535  *- - C++
13536  */
13537  diguyCharacterLOSFunction* get_character_los_function();
13538 
13539 #endif
13540 
13541 
13542 /*****************************************************************************/
13559  int get_num_ik_chains();
13561 
13563  const char * get_ik_chain_name_at_index(int index);
13564 
13565  /*b Description:
13566  ** Moves the end effector for the specified ik chain to a location in the world.
13567  **
13568  *b Arguments:
13569  *a ik_chain_target - index of ik chain
13570  *a x,y,z - world location of where to move the IK end effector to.
13571  *a ramp_time - how long to take blending in solution
13572  **
13573  *b Returns:
13574  ** -1 on failure, 0 on success
13575  */
13576  int set_ik_target_world(int ik_chain_target, float x, float y, float z, float ramp_time = .25f);
13577 
13578  /*b Description:
13579  ** Moves the end effector for the specified ik chain to a location relative to the character.
13580  **
13581  *b Arguments:
13582  *a ik_chain_target - index of ik chain
13583  *a x,y,z - local location of where to move the IK end effector to.
13584  *a ramp_time - how long to take blending in solution
13585  **
13586  *b Returns:
13587  ** -1 on failure, 0 on success
13588  */
13589  int set_ik_target_local(int ik_chain_target, float x, float y, float z, float ramp_time = .25f);
13590 
13591  /*b Description:
13592  ** Resets the end effector to be solely driven by the animation system */
13593  int disable_ik_target(int ik_chain_target, float ramp_time = .25f);
13594 
13595  /*b Description:
13596  ** Sets the distance to the primary camera, this should be automatically set in OpenGL
13597  ** or if you set the camera position, in retained mode renderers you will need to set this
13598  ** manually. Currently only used by IK system for performance culling.
13599  */
13600  void set_distance_to_primary_camera(float camera_dist);
13601 
13603  float get_distance_to_primary_camera();
13604 
13605 /*****************************************************************************/
13621  /*l
13622  *b Description:
13623  **
13624  ** This function sets the initial character simulator this character
13625  ** will use. The current simulator will be set to this value on
13626  ** scenario reset.
13627  **
13628  ** The current simulator can be set by calling
13629  ** set_current_character_simulator().
13630  **
13631  ** The default simulator is
13632  ** DIGUY_CHARACTER_SIMULATOR_DIGUY_MOTION_ENGINE.
13633  **
13634  ** Requires active physics module if character simulator is set to
13635  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13636  **
13637  *b Arguments:
13638  **
13639  *a character_simulator - which simulator to use at reset
13640  **
13641  *b Returns:
13642  **
13643  ** 0 on success, -1 on failure
13644  */
13645  int set_initial_character_simulator(diguyCharacterSimulator character_simulator);
13646 
13647  /*l
13648  *b Returns:
13649  **
13650  ** initial character simulator
13651  */
13652  diguyCharacterSimulator get_initial_character_simulator();
13653 
13654  /*l
13655  *b Description:
13656  **
13657  ** This function sets the current character simulator this character
13658  ** will use. The current simulator will be reset to the initial
13659  ** character simulator on scenario reset.
13660  **
13661  ** The initial simulator can be set by calling
13662  ** set_initial_character_simulator().
13663  **
13664  *b Arguments:
13665  **
13666  *a character_simulator - new current character simulator
13667  **
13668  *b Returns:
13669  **
13670  ** 0 on success, -1 on failure
13671  */
13672  int set_current_character_simulator(diguyCharacterSimulator character_simulator);
13673 
13674  /*l
13675  *b Returns:
13676  **
13677  ** current character simulator
13678  */
13679  diguyCharacterSimulator get_current_character_simulator();
13680 
13681  /*l
13682  *b Description:
13683  **
13684  ** This function sets the initial physics simulation mode this
13685  ** character will use. The current simulation mode will be set to
13686  ** this value on scenario reset.
13687  **
13688  ** The current simulation mode can be set by calling
13689  ** set_current_physics_simulation_mode().
13690  **
13691  ** The default simulation mode is
13692  ** DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER.
13693  **
13694  ** The physics simulation mode will have no effect unless the current
13695  ** character simulator is
13696  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13697  **
13698  *b Arguments:
13699  **
13700  *a physics_simulation_mode - which simulation mode to use at reset
13701  **
13702  *b Returns:
13703  **
13704  ** 0 on success, -1 on failure
13705  */
13706  int set_initial_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
13707 
13708  /*l
13709  *b Returns:
13710  **
13711  ** initial physics simulation mode
13712  */
13713  diguyPhysicsSimulationMode get_initial_physics_simulation_mode();
13714 
13715  /*l
13716  *b Description:
13717  **
13718  ** This function sets the current physics simulation mode this
13719  ** character will use. The current simulation mode will be reset to
13720  ** the initial physics simulator mode on scenario reset.
13721  **
13722  ** The initial simulation mode can be set by calling
13723  ** set_initial_physics_simulation_mode().
13724  **
13725  ** The physics simulation mode will have no effect unless the current
13726  ** character simulator is
13727  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13728  **
13729  *b Arguments:
13730  **
13731  *a physics_simulation_mode - new current physics simulation mode
13732  **
13733  *b Returns:
13734  **
13735  ** 0 on success, -1 on failure
13736  */
13737  int set_current_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
13738 
13739  /*l
13740  *b Returns:
13741  **
13742  ** initial physics simulation mode
13743  */
13744  diguyPhysicsSimulationMode get_current_physics_simulation_mode();
13745 
13746  /*l
13747  *b Description:
13748  **
13749  ** This function sets the physics collision group this character will
13750  ** be in when being simulated. For improved performance, collision
13751  ** detection between various characters and scene objects will not
13752  ** be performed, based on which collision groups the objects are in.
13753  **
13754  ** By default:
13755  **
13756  *- - characters in character group n collide against props in prop
13757  *- group n and scene objects in scene object group n
13758  *- in group n
13759  *- - characters in group ghost don't collide against any other
13760  *- characters, but do against scene objects and props
13761  *- - characters in group everything collide against all characters,
13762  *- props, and scene objects
13763  *- - all props collide against all other props and scene objects
13764  **
13765  ** Collision group relationships can be modified using
13766  ** diguyApp::set_collision_group_detection_flag().
13767  **
13768  *b Arguments:
13769  **
13770  *a physics_simulation_mode - new current physics simulation mode
13771  **
13772  *b Returns:
13773  **
13774  ** 0 on success, -1 on failure
13775  */
13776  int set_physics_collision_group(diguyPhysicsCollisionGroup collision_group);
13777 
13778  /*l
13779  *b Returns:
13780  **
13781  ** physics collision group
13782  */
13783  diguyPhysicsCollisionGroup get_physics_collision_group();
13784 
13785  /*l
13786  *b Description:
13787  **
13788  ** This function sets a time at which active simulation of a physics
13789  ** controlled character will stop. This is useful for:
13790  **
13791  *- - reducing simulation processing overhead
13792  *- - freezing a simulation that is mostly in steady state, but some
13793  *- small part remains oscillating
13794  **
13795  ** The physics controlled character will remain frozen in the last
13796  ** computed simulated pose.
13797  **
13798  *b Arguments:
13799  **
13800  *a t - scenario t at which simulation will freeze
13801  **
13802  ** t should be large enough for the simulation to reach a reasonably
13803  ** steady state, such as a human lying on the ground. A value that
13804  ** is usually reasonable is around 5 seconds.
13805  */
13806  void set_stop_physics_sim_at_t(float t);
13807 
13808  /*l
13809  *b Description:
13810  **
13811  ** Similar to set_stop_physics_sim_at_t(), but the passed time will
13812  ** be relative to the current simulation time as returned by
13813  ** diguyScenario::get_t().
13814  */
13815  void set_stop_physics_sim_in_t_seconds(float relative_t);
13816 
13817  /*l
13818  *b Returns:
13819  **
13820  ** time at which physics simulation will freeze
13821  */
13822  float get_stop_physics_sim_at_t();
13823 
13824  /*l
13825  *b Description:
13826  **
13827  ** This function applied an impulse force to the character. An
13828  ** impulse is a force that is applied all at one time, such as an
13829  ** explosion shock wave.
13830  **
13831  *b Arguments:
13832  **
13833  *a link - link to which impulse should be applied
13834  *a impulse_magnitude_[xyz] - magnitude of impulse in x direction
13835  *a link_offset_[xyz] - offset on link at which to apply impulse
13836  *a set_simulation_drives_character - pass 1 to automatically change
13837  *a the character's current simulation mode
13838  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
13839  */
13840  void apply_impulse_to_physics_sim(const char* link,
13841  float impulse_magnitude_x,
13842  float impulse_magnitude_y,
13843  float impulse_magnitude_z,
13844  float link_offset_x = 0.0f,
13845  float link_offset_y = 0.0f,
13846  float link_offset_z = 0.0f,
13847  int set_simulation_drives_character = 1);
13848 
13849  /*l
13850  *b Description:
13851  **
13852  ** Similar to apply_impulse_to_physics_sim(), but impulse can be
13853  ** calculated relative to a world position. This is useful if, for
13854  ** example, a character should react to a nearby explosion.
13855  **
13856  *b Arguments:
13857  **
13858  *a link - link to which impulse should be applied
13859  *a impulse_magnitude_[xyz] - magnitude of impulse
13860  *a impulse_generator_position_[xyz] - world coordinates of impulse
13861  *a generating object
13862  *a max_distance - maximum distance from above position at
13863  *a which the impulse can affect this
13864  *a character
13865  *a impulse_rolloff - how much the impulse magnitude should
13866  *a decrease as distance from impulse source
13867  *a increases
13868  *a link_offset_[xyz] - offset on link at which to apply impulse
13869  *a set_simulation_drives_character - pass 1 to automatically change
13870  *a the character's current simulation mode
13871  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
13872  */
13873  void apply_impulse_to_physics_sim_from_world_position(const char* link,
13874  float impulse_magnitude_x,
13875  float impulse_magnitude_y,
13876  float impulse_magnitude_z,
13877  float impulse_generator_position_x,
13878  float impulse_generator_position_y,
13879  float impulse_generator_position_z,
13880  float max_distance = 20.0f,
13881  float impulse_rolloff = 0.0f,
13882  float link_offset_x = 0.0f,
13883  float link_offset_y = 0.0f,
13884  float link_offset_z = 0.0f,
13885  int set_simulation_drives_character = 1);
13886 
13887 /*****************************************************************************/
13891  /*l
13892  *b Description:
13893  **
13894  ** Sets texture load behavior to DIGUY_LOAD_INSTANTLY, DIGUY_LOAD_PRIORITY_ASYNC, or
13895  ** DIGUY_LOAD_ASYNC
13896  */
13897  static int set_texture_load_behavior(diguyGraphicsTextureLoadingBehavior mode);
13898 
13899  /*l
13900  *b Returns current behavior, as set in set_texture_load_behavior()
13901  */
13902  static diguyGraphicsTextureLoadingBehavior get_texture_load_behavior();
13903 
13904  /*l
13905  *b Description:
13906  **
13907  ** Sets maximum quality of shader to use (actual quality varies
13908  ** by distance from camera). See diguyGraphicsShaderQualityLevel for
13909  ** possible values.
13910  **
13911  *b Arguments:
13912  **
13913  *a quality_level - a value between DIGUY_GRAPHICS_SHADER_QUALITY_UNLIT
13914  *- and DIGUY_GRAPHICS_SHADER_QUALITY_MAX
13915  */
13916  static int set_max_shader_quality_level(int quality_level);
13917 
13919  static int get_max_shader_quality_level();
13920 
13921 
13922 /****************************************************************************/
13929 /****************************************************************************/
13930  /*l Documentation Pending
13931  ** Sets if this character will play back animation events that have been
13932  ** added to motion inits in the action table.
13933  */
13934  int set_animation_events_enabled(int enable);
13935  int get_animation_events_enabled();
13936 
13937 
13938  /*l
13939  *b Description:
13940  **
13941  ** This function returns how many channels the specified action has.
13942  ** If an action has more than one channel, the relative weights of
13943  ** its channels can be set using the set_action_channel_weight()
13944  ** function.
13945  **
13946  *b Arguments:
13947  **
13948  *a action_name - name of action to be queried
13949  **
13950  *b Returns:
13951  **
13952  ** number of channels in specified action
13953  */
13954  int get_action_num_channels(const char* action_name);
13955 
13956  /*l
13957  *b Description:
13958  **
13959  ** This function sets the weight one channel of a multi-channel
13960  ** action.
13961  **
13962  ** The passed weight should be between 0 and 1. The weights of
13963  ** the other channels in the action will be adjusted so that the
13964  ** total weight of all channels is 1.
13965  **
13966  *b Arguments:
13967  **
13968  *a action_name - name of action to be affected
13969  *a channel - which channel's weight to set
13970  *a weight - weight of the channel, between 0 and 1
13971  **
13972  *b Returns:
13973  **
13974  ** 0 on success, -1 on failure
13975  */
13976  int set_action_channel_weight(const char* action_name,
13977  char channel,
13978  float weight);
13979 
13980  /*l
13981  *b Description:
13982  **
13983  ** This function returns the weight of one channel of a multi-channel
13984  ** action.
13985  **
13986  *b Arguments:
13987  **
13988  *a action_name - name of action to be queried
13989  *a channel - which channel's weight to return
13990  **
13991  *b Returns:
13992  **
13993  ** weight of a channel
13994  */
13995  float get_action_channel_weight(const char* action_name,
13996  char channel);
13997 
13998  /*l
13999  *b Description:
14000  **
14001  ** This function returns the number of seconds before the transition
14002  ** to the desired action begins. If the character is already
14003  ** performing the desired action the function returns 0.
14004  **
14005  *b THIS FUNCTION DOES NOT YET RETURN VALID RESULTS.
14006  **
14007  *b Returns:
14008  **
14009  ** time to reach desired action, in seconds
14010  */
14011  float get_time_to_reach_desired_action();
14012 
14013  /*l
14014  *b Description:
14015  **
14016  ** Maps a character type map field to its value. See diguyCharacterTypeMap.
14017  **
14018  ** Returns:
14019  **
14020  ** The value, as a string.
14021  */
14022  const char* get_type_map_field(diguyCharacterTypeMapField field);
14023 
14024  /*l
14025  *b Description:
14026  **
14027  ** Maps a character type map field to its value, using a string version (e.g.
14028  ** "age") of the field name. See diguyCharacterTypeMap.
14029  **
14030  ** Returns:
14031  **
14032  ** The value, as a string.
14033  */
14034  const char* get_type_map_field_using_string(const char* field);
14035 
14038  float get_normalized_age() const;
14039 
14040  /*l
14041  *b Description:
14042  **
14043  ** This function performs a "micro merge", allowing a diguyCharacter
14044  ** to have objects added to it by parsing a .dss file fragment in the
14045  ** form of a string.
14046  **
14047  ** This function can be used, for example, to add paths to
14048  ** dynamically created agents. A Lua Package can contain a number of
14049  ** text strings representing local paths for agents. On character
14050  ** creation these strings can be merged in and turned into
14051  ** per-character objects.
14052  **
14053  ** The DI-Guy Scenario path page has a "Display Asset" button for
14054  ** generating merge_object() compatible strings.
14055  **
14056  ** There is also a diguyScenario::merge_object() function that allows
14057  ** the merging of text blocks that represent sounds and particle
14058  ** systems.
14059  **
14060  ** Note: the parser is very sensitive to tabs and formatting!
14061  */
14062  int merge_object(const char* object);
14063 
14064  /*l
14065  *b Description:
14066  **
14067  ** Returns 1 if any active character in the named group is visible,
14068  ** otherwise 0.
14069  **
14070  *b Arguments:
14071  **
14072  *a group_name
14073  *a max_distance_to_check
14074  */
14075  int is_active_character_in_group_visible(const char* group_name,
14076  float max_distance_to_check = 100000.0f);
14077 
14078  /*l
14079  *b Description:
14080  **
14081  ** Gets local space bounding box, this function is currently expensive
14082  ** and should be used with care.
14083  **
14084  *b Arguments:
14085  **
14086  *a x1,y1,z1,x2,y2,z2 - output parameters
14087  **
14088  *b Returns:
14089  **
14090  ** 0 on success, -1 on failure
14091  ** (float * arguments converted to return values in Lua)
14092  */
14093  int get_local_space_bounding_box(float* x1, float* y1, float* z1,
14094  float* x2, float* y2, float* z2);
14095 
14096  /*l
14097  *b Description:
14098  **
14099  ** This causes a character's mind to get an update call even if time
14100  ** isn't passing in the scenario. This is occasionally useful for
14101  ** characters that are managing the UI.
14102  **
14103  ** Note that there is now a luaUIStateMachine that might be a better
14104  ** solution.
14105  */
14106  void set_mind_always_updates(int force_update);
14107 
14109  int get_mind_always_updates();
14110 
14111  /*l
14112  ** Returns angle in degrees from character's "forward facing" vector
14113  ** to the specified action bead, on the specified path
14114  */
14115  float get_angle_to_path(const char* path_name,
14116  const char* action_bead_name = NULL);
14117 
14118 
14121  void set_scene_graph_mask(unsigned int mask);
14122 
14124  unsigned int get_scene_graph_mask();
14125 
14126 
14131  diguyMotionEngineSnapshot get_motion_engine_snapshot();
14132 
14134  int apply_motion_engine_snapshot(const diguyMotionEngineSnapshot & action_info);
14135 
14136 
14141  int set_local_to_world_orientation_matrix( float rz, float rx, float ry);
14143  int set_local_to_world_orientation_matrix(
14144  float a0, float a1, float a2,
14145  float b0, float b1, float b2,
14146  float c0, float c1, float c2, int transpose = 0);
14147 
14148 
14151  int set_always_update_regardless_of_dt(int val);
14153  int get_always_update_regardless_of_dt();
14154 
14155 
14156 /****************************************************************************/
14157 /****************************************************************************/
14168 /****************************************************************************/
14169 /****************************************************************************/
14170 /****************************************************************************/
14171 
14172  // Deprecated as of 13.0;
14174  int aim_converge(int max_iterations = 30);
14175 
14177  void set_aim_algorithm(int aim_algorithm);
14178 
14180  int get_aim_algorithm();
14181 
14182  // Deprecated as of 9.1.3; use diguyCharacter::get_position_link() instead.
14183  // diguyGraphicsLink* get_base_link();
14184 
14185  // Deprecated as of 9.0.1; use set_apply_actor_scale_to_action_bead_travel() instead.
14186  // void set_apply_actor_scale_to_action_bead_xy_travel(int apply_scale_flag);
14187 
14188  // Deprecated as of 9.0.1; use get_apply_actor_scale_to_action_bead_travel() instead.
14189  // int get_apply_actor_scale_to_action_bead_xy_travel();
14190 
14191  /*l
14192  ** Deprecated as of 9.1.4. In general setting the weapon sound
14193  ** should no longer be necessary, as weapon sounds are now specified
14194  ** by the weapon's munition type. If this function is called, it
14195  ** will have the same effect as calling
14196  ** diguyCharacter::set_weapon_sound_override().
14197  */
14198  // int set_default_weapon_sound(const char* sound_name);
14199 
14200  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14201  //const char* get_default_weapon_sound();
14202 
14203  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14204  // int set_default_weapon_sound_gain(float gain);
14205 
14206  // Deprecated as of 9.1.4. See comments for set_default_weapon_sound().
14207  // float get_default_weapon_sound_gain();
14208 
14209  // Deprecated as of 9.1.4. Call set_weapon_munition_type_override() instead.
14210  // int set_weapon_munition_type(const char* munition_type);
14211 
14212  // Deprecated as of 9.1.4. Call get_weapon_munition_type_override() instead.
14213  // const char* get_weapon_munition_type();
14214 
14215  // Deprecated as of 10.5.2. Call set_weapon_max_azimuth_error() instead.
14216  // int set_weapon_horizontal_error(float h_error);
14217 
14218  // Deprecated as of 10.5.2. Call get_weapon_max_azimuth_error() instead.
14219  // float get_weapon_horizontal_error();
14220 
14221  // Deprecated as of 10.5.2. Call set_weapon_max_elevation_error() instead.
14222  // int set_weapon_vertical_error(float v_error);
14223 
14224  // Deprecated as of 10.5.2. Call get_weapon_max_elevation_error() instead.
14225  // float get_weapon_vertical_error();
14226 
14227  // Added as of 10.1.6. Invokes the old implementation of
14228  // begin_appearance_effect().
14229  //int begin_legacy_appearance_effect(const char* effect,
14230  // const char* override_link = "",
14231  // float override_scale = DIGUY_DEFAULT_FLOAT,
14232  // float override_offset_x = DIGUY_DEFAULT_FLOAT,
14233  // float override_offset_y = DIGUY_DEFAULT_FLOAT,
14234  // float override_offset_z = DIGUY_DEFAULT_FLOAT);
14235 
14236 
14237  // Added as of 10.1.6. Invokes the old implementation of
14238  // end_appearance_effect().
14239  //
14240  //int end_legacy_appearance_effect(const char* effect);
14241 
14242  // Added as of 10.1.6. Invokes the old implementation of
14243  // appearance_effect_is_active().
14244  //int legacy_appearance_effect_is_active(const char* effect);
14245 
14246  // Deprecated as of 10.1.8. Use set_render_mode_shader() instead.
14247  //int set_shader_program(const char* shader_name);
14248 
14249  // Deprecated as of 10.5.2. Use get_render_mode_shader() instead.
14250  //const char* get_recommended_appearance_shader_program_name();
14251 
14252  // Deprecated as of 10.5.1. Use merge_object() instead.
14253  //int merge_asset(const char* asset);
14254 
14255  // Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state() instead.
14256  // void set_DIS_smoke_trail_state(int state);
14257 
14258  // Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state() instead.
14259  // int get_DIS_smoke_trail_state();
14260 
14261  // Deprecated as of 12.0.0. Not supported in FaceFX.
14262  //int speak(const char* string);
14263 
14264 
14265  // Deprecated as of 12.0.0. Not supported in FaceFX.
14266  //int set_viseme(const char* viseme_name, float weight);
14267 
14268  // Deprecated as of 12.0.0. Not supported in FaceFX.
14269  //float get_viseme(const char* viseme_name);
14270 
14271 
14272  // Deprecated as of 12.0.0. Not supported in FaceFX.
14273  //int set_orientation_eye_left(float azimuth, float elevation);
14274 
14275  // Deprecated as of 12.0.0. Not supported in FaceFX.
14276  //int set_orientation_eye_right(float azimuth, float elevation);
14277 
14278  // Deprecated as of 12.0.0. Not supported in FaceFX.
14279  //float get_azimuth_eye_left();
14280 
14281  // Deprecated as of 12.0.0. Not supported in FaceFX.
14282  //float get_elevation_eye_left();
14283 
14284  // Deprecated as of 12.0.0. Not supported in FaceFX.
14285  //float get_azimuth_eye_right();
14286 
14287  // Deprecated as of 12.0.0. Not supported in FaceFX.
14288  //float get_elevation_eye_right();
14289 
14290  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14291  //int set_weapon_shell_eject_enabled(int enabled);
14292 
14293  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14294  //int get_weapon_shell_eject_enabled();
14295 
14296  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14297  //int set_weapon_smoke_enabled(int enabled);
14298 
14299  // Deprecated as of 13.2 keys off of scenario weapons fire effects now
14300  //int get_weapon_smoke_enabled();
14301 /****************************************************************************/
14302 /****************************************************************************/
14303 
14308 #ifdef CPLUSPLUS_ONLY
14309 
14310  bdiScenarioCharacter* get_scripted_object();
14311 private:
14312 
14313  /*l
14314  ** A private constructor.
14315  */
14316  diguyCharacter(bdiScenarioCharacter* character);
14317 
14318  /*l
14319  ** A private destructor.
14320  */
14321  ~diguyCharacter();
14322 
14323  /*l
14324  ** A pointer to internal data.
14325  */
14326  bdiScenarioCharacter* m_scripted_object;
14327 
14328  friend class bdiPublishedCharacter;
14329  friend class bdiScenarioCharacter;
14330  friend class diguySensorRegion;
14331  friend class diguyScenario;
14332 
14333 #endif
14334 
14335 };
14336 
14337 
14338 #endif /* __diguyCharacter_H */
14339 
Definition: diguyViewLabel.h:44
A class that represents the unique per-character shader object.
Definition: diguyGraphicsShaderInstance.h:55
diguyGraphicsTextureLoadingBehavior
Definition: diguy_constants.h:370
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:48
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:152
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:1674
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:54
int diguyCharacterLOSFunction(diguyCharacter *character, diguyCharacter *target_character, int visibility_type)
Definition: diguy_typedefs.h:103
Represents the scenario currently being portrayed.
Definition: diguyScenario.h:92
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:81
Definition: diguyWaypoint.h:29
Definition: diguySensorRegion.h:38
int diguyPointLOSFunction(diguyCharacter *character, float x, float y, float z)
Definition: diguy_typedefs.h:108
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:61
static double t
4 Header files and forward declarations
Definition: simple_playback_ogl.cpp:55
Definition: diguy_constants.h:1507
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 representing a overlaid performance on a character's base animation.
Definition: diguyCharacterGesture.h:45
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:1691
diguyPhysicsCollisionGroup
This enumeration lists the collision groups that a DI-Guy physics sim object can be in...
Definition: diguy_constants.h:1707
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