C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyCharacter.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyCharacter
30  **
31  *b Link against: libdiguy
32  */
33 
34 #ifndef __diguyCharacter_H
35 #define __diguyCharacter_H
36 
37 #ifdef SWIG
38 %module diguyCharacter
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #ifdef CPLUSPLUS_ONLY
44 #include <declspec_diguy.h>
45 #include <diguy_constants.h>
46 #include <diguy_typedefs.h>
47 #include <diguy_vector_classes.h>
49 #include <diguyCharacterTypeMap.h>
50 #include <diguyMotionDirection.h>
51 #include <diguyMotionPosture.h>
52 #include <diguyMotionVariant.h>
53 
54 class bdiScenarioCharacter;
55 class diguyAgentParams;
57 class diguyCharacter;
61 class diguyCharacterPath;
66 class diguyCrowd;
67 class diguyGraphicsLink;
70 class diguyViewLabel;
71 class diguyPathShape;
72 class diguyScenario;
73 class diguyWaypoint;
74 class diguySoundInstance;
75 class diguyImpact;
76 class diguyVariable;
78 class diguyView;
79 
80 #endif
81 
82 
83 
84 /****************************************************************************/
85 class BDI_DECLSPEC_diguy diguyCharacter
86 {
87 
88 public:
89 
90 /*****************************************************************************/
100  /*l
101  *b Description:
102  **
103  ** Returns the name of the object. This pointer will never be NULL.
104  */
105  const char* get_name();
106 
107  /*l
108  *b Description:
109  **
110  ** This function sets the name of this object.
111  **
112  *b Returns:
113  **
114  ** 0 on success, -1 on failure
115  */
116  int set_name(const char* name);
117 
118  /*l
119  *b Description:
120  **
121  ** Returns the type name of the object. This pointer will never be
122  ** NULL.
123  **
124  */
125  const char* get_type_name();
126 
127  /*l
128  *b Description:
129  **
130  ** All characters are assigned a unique identifier, or uid. This
131  ** function returns this character's uid.
132  **
133  ** *Note*: unique identifiers will change between DI-Guy runs!
134  **
135  */
136  long get_uid();
137 
138  /*l
139  *b Description:
140  **
141  ** Returns the index of the object. This index may change if
142  ** characters are created or destroyed, so it should not be considered
143  ** a unique identifier for the character. See get_uid().
144  */
145  int get_index();
146 
147  /*l
148  *b Description:
149  **
150  ** This function updates the character. The character's position and
151  ** pose will be set to be what it will be (or was) at the specified t.
152  **
153  ** If the scenario has control of t (return value of
154  ** get_t_controlled_by_scenario_t() is 0), then this function's
155  ** effects will be overridden the next time diguyScenario::update() is
156  ** called with a new t.
157  **
158  ** Note: diguyScenario::update() must be called as or more frequently
159  ** than diguyCharacter::update() for proper DI-Guy operation.
160  ** diguyCharacter::update() is intended for load management use, where
161  ** the user intends to update far away or out-of-frustum characters
162  ** less frequently than the overall scenario. This is done in con-
163  ** junction with set_t_controlled_by_scenario_t(0) for the character.
164  ** diguyCharacter::update() is not intended as a replacement for
165  ** diguyScenario::update().
166  **
167  *b Returns:
168  **
169  ** 0 on success, -1 on failure
170  **
171  *b Arguments:
172  **
173  *a t - new time for the character
174  *a full_update - set to 1 to cause full update of character
175  */
176  int update(float t, int full_update = 1);
177 
178  /*l
179  *b Description:
180  **
181  ** This function sets the current type of this character.
182  **
183  *b Arguments:
184  **
185  *a type - name of the new desired type
186  **
187  *b See Also:
188  **
189  ** get_character_type_string()
190  */
191  void set_character_type(const char* type);
192 
193  /*l
194  *b Description:
195  **
196  ** Returns the type of the character (never NULL).
197  **
198  ** Character types specify the types of motions the character will be
199  ** able to perform. Some characters can move like soldiers, others
200  ** can move like civilians, still others can move like specific
201  ** animals.
202  **
203  ** The character type is explicitly specified in the call to
204  ** diguyScenario::create_character().
205  **
206  ** Examples of character types are:
207  *>
208  *- - soldier
209  *- - male_pedestrian
210  *- - horse
211  *- - prop
212  *<
213  */
214  const char* get_character_type_string();
215 
216  /*l
217  *b Description:
218  **
219  ** Returns the class of the character (never NULL).
220  **
221  ** Character classes are a higher level description than character
222  ** types, and allow for more generalized logic. For example, instead
223  ** of having something happen when one of a large set of specific
224  ** character types enters a region, something can happen when any
225  ** human enters the region.
226  **
227  ** Character classes are not specified directly, but are instead
228  ** derived from the character type. (In DI-Guy, all soldiers are
229  ** humans, for example.)
230  **
231  ** Examples of character classes are:
232  *>
233  *- - human
234  *- - vehicle
235  *- - object
236  *- - animal
237  *<
238  */
239  const char* get_character_class();
240 
241  /*l
242  *b Description:
243  **
244  ** Returns the scenario that this character is a part of.
245  **
246  */
247  diguyScenario* get_scenario();
248 
249  /*l
250  *b Description:
251  **
252  ** This is the top-level on/off switch for the character. A character
253  ** that is not enabled has very little processing overhead: it is
254  ** neither updated during an update() call, nor is it drawn during a
255  ** draw() call. A disabled character will remain disabled until
256  ** set_enabled(1) is called on it; nothing else implicitly re-enables
257  ** the character.
258  **
259  ** There are several other diguyCharacter functions that have somewhat
260  ** similar effects that may be more appropriate at times:
261  **
262  *- - set_current_tin() and set_current_tout(): These functions
263  *- show and animate the character starting at time tin ("T In"),
264  *- and ending at time tout ("T Out")
265  *- - set_invisible_flag(): This function disables drawing of
266  *- the character, but the character still updates and changes
267  *- position.
268  **
269  ** Refer to the documentation of these functions for more information.
270  **
271  *b Returns:
272  **
273  ** always return 0
274  */
275  int set_enabled(int enabled);
276 
277  /*l
278  *b Description:
279  **
280  ** Returns whether the character is enabled, as set by the
281  ** set_enabled() call. New characters are enabled by default.
282  **
283  *b Returns:
284  **
285  ** 1 if the character is enabled, 0 if not
286  */
287  int get_enabled();
288 
289  /*l
290  *b Description:
291  **
292  ** Sets whether this character is drawn automatically by the scenario.
293  **
294  *i OpenGL Version:
295  *i Direct3D Version:
296  **
297  ** If this flag is set to 0, it is up to the user to call the
298  ** character draw_pass1() and draw_pass2() calls at the appropriate
299  ** time.
300  **
301  *b Arguments:
302  **
303  *a flag - pass 1 for character drawing to automatically be
304  *a handled by scenario (this is the default);
305  *a 0 for it not to be
306  **
307  *b Returns:
308  **
309  ** 0 on success, -1 on failure
310  */
311  int set_drawn_by_scenario_flag(int flag);
312 
313  /*l
314  *b Description:
315  **
316  ** Returns whether character drawing is done automatically by the
317  ** scenario.
318  **
319  *b Returns:
320  **
321  ** 1 if character drawing is done by the scenario;
322  ** 0 if not
323  **
324  *b See Also:
325  **
326  ** set_drawn_by_scenario_flag()
327  */
328  int get_drawn_by_scenario_flag();
329 
330  /*l
331  *b Description:
332  **
333  ** This function makes the character invisible; i.e., draw() calls
334  ** for the character will have no effect. Note that the character
335  ** will still update its position and pose during update() calls. To
336  ** more thoroughly disable a character, consider the functions
337  ** set_enabled() and set_current_tout().
338  **
339  *b Arguments:
340  **
341  *a invisible_flag - pass 1 to make character invisible, 0 to
342  *a make it visible
343  **
344  *b Callable from:
345  **
346  *- - C++
347  *- - Script
348  *- - Decision
349  */
350  void set_invisible_flag(int invisible_flag);
351 
352  /*l
353  *b Returns:
354  **
355  ** the character's invisible flag, as set by set_invisible_flag()
356  */
357  int get_invisible_flag();
358 
359  /*l
360  *b Description:
361  **
362  ** Returns whether the character is active. A character is
363  ** active if:
364  **
365  *- - it is enabled as per the set_enabled() call
366  *- - it is within its tin/tout interval as set by the
367  *- set_current_tin() and set_current_tout() calls
368  *- - it is not "network paused" (get_is_network_paused()
369  *- returns 0)
370  **
371  *b Returns:
372  **
373  ** 1 if the character is active, 0 if not
374  **
375  *b Callable from:
376  **
377  *- - C++
378  *- - Script
379  *- - Decision
380  */
381  int get_is_active();
382 
383  /*l
384  *b Description:
385  **
386  ** Returns whether the character will be drawn during scenario and
387  ** character draw() calls. A character will be drawn if:
388  **
389  *- - it is enabled as per the set_enabled() call
390  *- - it is within its tin/tout interval as set by the
391  *- set_current_tin() and set_current_tout() calls
392  *- - its invisible flag is 0, as set by the
393  *- set_invisible_flag() call
394  **
395  ** There is no corresponding set_is_drawn() function; use
396  ** set_invisible_flag() to explicitly make a character not be drawn.
397  **
398  *b Returns:
399  **
400  ** 1 if the character will be drawn, 0 if not
401  */
402  int get_is_drawn();
403 
404  /*l
405  *b Returns:
406  **
407  ** 1 if the character is temporary (created by
408  ** diguyScenario::create_temporary_character() call;
409  ** 0 if not
410  */
411  int get_is_temporary();
412 
413  /*l
414  *b Description:
415  **
416  ** This function returns 1 if the character has been recycled from the
417  ** character recycle bin, 0 if not.
418  **
419  ** See diguyScenario::send_character_to_recycle_bin()
420  ** and diguyScenario::retrieve_character_from_recycle_bin().
421  */
422  int get_is_recycled();
423 
424  /*l
425  *b Description:
426  **
427  ** This function sets how the character's t (time) is controlled. If
428  ** 1, the character's t will be set by the scenario on each call to
429  ** diguyScenario::update(). If 0, the character should be updated by
430  ** calls to update().
431  **
432  *b Arguments:
433  **
434  *a t_controlled_by_scenario_t - 1 for controlled by scenario, 0 for
435  *a manual update
436  **
437  *b Returns:
438  **
439  ** 0 on success, -1 on failure
440  */
441  int set_t_controlled_by_scenario_t(int t_controlled_by_scenario_t);
442 
443  /*l
444  *b Returns:
445  **
446  ** whether character's t is controlled by the scenario;
447  ** see set_t_controlled_by_scenario_t()
448  */
449  int get_t_controlled_by_scenario_t();
450 
451  /*l
452  *b Description:
453  **
454  ** This function sets the initial tin ("T In") time of the character.
455  ** See set_current_tin() for a discussion of how tin and tout times
456  ** affect the character.
457  **
458  ** When the scenario is reset or loaded from a .dss file, the current
459  ** tin value will be set to this initial tin value.
460  **
461  ** Note that this function cannot be called once the scenario has
462  ** begun running (diguyScenario::get_t() returns > 0).
463  **
464  ** Note that both tin and tout times are scenario-relative times, not
465  ** character-relative.
466  **
467  ** This call makes an implicit call to set_current_tin() with the
468  ** same value.
469  **
470  *b Arguments:
471  **
472  *a tin - new value of initial tin in seconds
473  **
474  *b Returns:
475  **
476  ** 0 on success, -1 on failure
477  */
478  int set_initial_tin(float tin, int override_time_warning = 0);
479 
480  /*l
481  *b Description:
482  **
483  ** This function sets the initial tout ("T Out") time of the
484  ** character. See set_current_tin() for a discussion of how tin and
485  ** tout times affect the character.
486  **
487  ** When the scenario is reset or loaded from a .dss file, the current
488  ** tout value will be set to this initial tout value.
489  **
490  ** Note that this function cannot be called once the scenario has
491  ** begun running (diguyScenario::get_t() returns > 0).
492  **
493  ** Note that both tin and tout times are scenario-relative times, not
494  ** character-relative.
495  **
496  ** This call makes an implicit call to set_current_tout() with the
497  ** same value.
498  **
499  *b Arguments:
500  **
501  *a tout - new value of initial tout in seconds
502  **
503  *b Returns:
504  **
505  ** 0 on success, -1 on failure
506  */
507  int set_initial_tout(float tout);
508 
509  /*l
510  *b Description:
511  **
512  ** This function sets the current tin ("T In") time of the character.
513  ** The character will not be visible nor will it start moving or
514  ** animating until the scenario reaches this time.
515  **
516  ** There are two ways the tin and tout times of the character can be
517  ** used:
518  **
519  ** The first is to set them to their desired values when the scenario
520  ** begins. If, for example, it is known that this character should
521  ** only be visible and active from 60 seconds to 80 seconds, the tin
522  ** and tout times can be set to 60 and 80, respectively. The
523  ** scenario will then spend very little time for character updates
524  ** and draws outside of these limits.
525  **
526  ** The second is to use them to quickly "trigger" a character to
527  ** become visible and start moving. This is done by setting the
528  ** initial values of tin and tout to very high values, and then
529  ** changing them to lower values when the character should become
530  ** active. Consider the following example: This character is
531  ** waiting just inside a doorway, and should emerge when another
532  ** character comes close. If the tin time of the character is very
533  ** high, very little time will be taken for this character's updates
534  ** and draws. When the other character does come close, this
535  ** character's tin time can be set to "now" (the scenario's current
536  ** t, as returned by diguyScenario::get_t()). This character will
537  ** then become visible and start moving out of the doorway.
538  **
539  ** The default current tin time is the current time of the scenario
540  ** when the character is created.
541  **
542  ** Note that both tin and tout times are scenario-relative times, not
543  ** character-relative.
544  **
545  *b Arguments:
546  **
547  *a tin - new value of current tin in seconds
548  **
549  *b Returns:
550  **
551  ** 0 on success, -1 on failure
552  */
553  int set_current_tin(float tin);
554 
555  /*l
556  *b Description:
557  **
558  ** Same as set_current_tin(), but time is set to current scenario
559  ** time.
560  **
561  *b Returns:
562  **
563  ** 0 on success, -1 on failure
564  **
565  *b Callable from:
566  **
567  *- - C++
568  *- - Script
569  *- - Decision
570  */
571  int set_current_tin_to_now();
572 
573  /*l
574  *b Description:
575  **
576  ** This function returns the current tin time of the character. See
577  ** set_current_tin().
578  **
579  *b Returns:
580  **
581  ** Current tin time in seconds.
582  */
583  float get_current_tin();
584 
585  /*l
586  *b Description:
587  **
588  ** This function sets the current tout ("T Out") time of the
589  ** character. If tout is enabled the character will become invisible
590  ** and will stop moving and animating when the scenario reaches this
591  ** time.
592  **
593  ** Note that both tin and tout times are scenario-relative times, not
594  ** character-relative.
595  **
596  ** Default tout time is 60000 seconds.
597  **
598  *b Arguments:
599  **
600  *a tout - new value of current tout in seconds
601  *a disable_character_at_tout - this argument is present to keep
602  *a the function prototype will remain
603  *a backward compatible; it has no effect
604  */
605  int set_current_tout(float tout,
606  int disable_character_at_tout = 0);
607 
608  /*l
609  *b Description:
610  **
611  ** Same as set_current_tout(), but time is set to current scenario
612  ** time.
613  **
614  *b Returns:
615  **
616  ** 0 on success, -1 on failure
617  **
618  *b Callable From:
619  **
620  *- - C++
621  *- - Script
622  *- - Decision
623  */
624  int set_current_tout_to_now();
625 
626  /*l
627  *b Description:
628  **
629  ** This function returns the current tout ("T Out") time of the
630  ** character in seconds. See set_current_tout().
631  */
632  float get_current_tout();
633 
634  /*l
635  *b Description:
636  **
637  ** This function sets what will happen when the character reaches its
638  ** tout time. If set to 0, the character will ignore the tout time
639  ** and continue indefinitely.
640  */
641  void set_tout_enabled(int tout_enabled);
642 
643  /*l
644  *b Description:
645  **
646  ** This function returns the whether tout is enabled.
647  **
648  ** See set_tout_enabled().
649  **
650  *b Returns:
651  **
652  ** 1 if tout enabled, 0 if not
653  */
654  int get_tout_enabled();
655 
656  /*l
657  *b Description:
658  **
659  ** When the motion data of a character is interpolated a quick
660  ** interpolation method can be used which may yield incorrect results,
661  ** or an expensive interpolation method can be used which will yield
662  ** correct results at the expense of time. The threshold at which
663  ** the interpolation method changes is specified by this function.
664  **
665  *b Arguments:
666  **
667  *a threshold - float between 0 (careful never) and 1 (careful always);
668  ** default is 0.7
669  **
670  ** DI-Guy compares the careful interpolation threshold to the cosine
671  ** of an angle. Both the threshold and the cosine are dimensionless
672  ** and thus have no units.
673  **
674  *b Returns:
675  **
676  ** 0 on success, -1 on failure
677  */
678  int set_careful_interpolation_threshold(float threshold);
679 
680  /*l
681  *b Returns:
682  **
683  ** most recent setting of the careful interpolation threshold;
684  ** see set_careful_interpolation_threshold()
685  */
686  float get_careful_interpolation_threshold();
687 
688  /*l
689  *b Description:
690  **
691  ** Sets whether the motion data of the character is interpolated.
692  ** Interpolation is disabled by default for better performance. For
693  ** applications achieving high frame rates, smoother motion may be
694  ** achieved by turning interpolation on.
695  **
696  *b Arguments:
697  **
698  *a flag - 0 by default
699  **
700  *b Returns:
701  **
702  ** 0 on success, -1 on failure
703  */
704  int set_motion_interpolation_flag(int flag);
705 
706  /*l
707  *b Returns:
708  **
709  ** most recent setting of the motion interpolation flag; see
710  ** set_motion_interpolation_flag()
711  */
712  int get_motion_interpolation_flag();
713 
714  /*l
715  *b Description:
716  **
717  ** Sets the scale of the character on each of the three major axes.
718  **
719  *b Arguments:
720  **
721  *a scale_x, scale_y, scale_z - the factor by which to scale along
722  *a the given axis
723  **
724  *b Returns:
725  **
726  ** 0 on success, -1 on failure
727  */
728  int set_scale(float scale_x,
729  float scale_y,
730  float scale_z);
731 
732  /*l
733  *b Description:
734  **
735  ** Returns the scale of the character.
736  **
737  *b Arguments:
738  **
739  *a sx, sy, sz - scale of the character along each axis
740  **
741  ** Pass NULL for any values that are not needed.
742  **
743  *b Returns:
744  **
745  ** 0 on success, -1 on failure
746  */
747  int get_scale(float* scale_x,
748  float* scale_y,
749  float* scale_z);
750 
751  /*l
752  *b Description:
753  **
754  ** Sets the parent of this character to be the passed character.
755  ** This means that the coordinate system of this character will be
756  ** local to the parent character rather than the world coordinate
757  ** system.
758  **
759  *b Arguments:
760  **
761  *a parent_name - character to which this character should
762  *a be attached; pass NULL to have no parent
763  *a and be attached to the world
764  *a parent_link_name - name of the link to which this character's
765  *a position link should attach; pass "" to attach
766  *a to the parent's position link
767  **
768  *b Returns:
769  **
770  ** 0 on success, -1 on failure
771  **
772  *b Callable From:
773  **
774  *- - C++
775  *- - Script
776  *- - Decision Bead
777  */
778  int set_parent(const char* parent_name,
779  const char* parent_link_name = "");
780 
781  /*l
782  *b Description:
783  **
784  ** Gets the parent of this character.
785  **
786  *b Returns:
787  **
788  ** pointer to type diguyCharacter; NULL if no parent
789  **
790  *b Callable From:
791  **
792  *- - C++
793  *- - Script
794  *- - Decision Bead
795  */
796  diguyCharacter* get_parent();
797 
798  /*l
799  *b Description:
800  **
801  ** Gets the link name that the character is parented to, if any.
802  **
803  *b Returns:
804  **
805  ** name of link, NULL if no parent
806  */
807  const char* get_parent_link_name();
808 
809  /*l
810  *b Description:
811  **
812  ** Detaches a character from its parent and reattaches it to the
813  ** world. This is equivalent to diguyCharacter::set_parent(NULL).
814  **
815  *b Returns:
816  **
817  ** 0 on success, -1 on failure
818  **
819  *b Callable From:
820  **
821  *- - C++
822  *- - Script
823  *- - Decision Bead
824  */
825  int unset_parent();
826 
827  /*l
828  *b Description:
829  **
830  ** Gets the number of children the character has.
831  */
832  int get_num_children();
833 
834  /*l
835  *b Description:
836  **
837  ** This function returns a pointer to the nth child of the character.
838  **
839  *b Returns:
840  **
841  ** pointer of type diguyCharacter; NULL if no
842  ** child at the specified index
843  **
844  *b Arguments:
845  **
846  *a index - index of the child; indices start at 0
847  */
848  diguyCharacter* get_child_at_index(int index);
849 
850  /*l
851  *b Description:
852  **
853  ** Gets if a character is a static object, by default any blitzed .
854  ** in props are.
855  **
856  *b Returns:
857  **
858  ** 1 if true, 0 if false
859  */
860  int get_is_scene_object();
861 
862  /*l
863  *b Description:
864  **
865  ** Sets if a character is a static object. By default any blitzed
866  ** in props are.
867  **
868  *b Arguments:
869  **
870  *a is_scene_object - pass 1 to make the object a scene object,
871  *a 0 to not
872  **
873  *b Returns:
874  **
875  ** 0 on success, -1 on failure
876  */
877  int set_is_scene_object(int is_scene_object);
878 
879  /*l
880  *b Description:
881  **
882  ** Gets the bounding radius currently used for this character
883  ** for purposes of culling it from the draw operation.
884  **
885  *b Returns:
886  **
887  ** The current draw-culling bounding radius for the character, in
888  ** meters.
889  */
890  float get_bounding_radius();
891 
892  /*l
893  *b Description:
894  **
895  ** Gets the default draw-culling bounding radius for this
896  ** character, as specified in its actor cfg file. See
897  ** actor_vehicle.cfg for an example.
898  **
899  *b Returns:
900  **
901  ** The default draw-culling bounding radius for the character.
902  */
903  float get_default_bounding_radius();
904 
905  /*l
906  *b Description:
907  **
908  ** Sets the current draw-culling bounding radius to be used for
909  ** this character.
910  */
911  void set_bounding_radius(float f);
912 
913  /*l
914  *b Description:
915  **
916  ** This function returns the number of seconds before the blend
917  ** into the next motion begins. If the character is already
918  ** in a blend between motions the function returns 0.
919  **
920  ** Note that this function is of limited practical use; in most
921  ** cases get_time_to_reach_desired_action() returns
922  ** information that is more useful.
923  **
924  *b Returns:
925  **
926  ** time to next blend, in seconds
927  **
928  *b Mode Restrictions:
929  **
930  *- - This function can only be called in free action mode.
931  */
932  float get_time_to_transition();
933 
934  /*l
935  *b Returns:
936  **
937  ** the action mode of the character
938  */
939  diguyCharacterMode get_action_mode();
940 
941  /*l
942  *b Returns:
943  **
944  ** the position mode of the character
945  */
946  diguyCharacterMode get_position_mode();
947 
948  /*l
949  *b Description:
950  **
951  ** This function speeds up or slows down the character. Setting
952  ** this value greater than 1 will cause character actions to
953  ** be played back at a slower pace, setting to less that 1 will
954  ** cause character actions to be played at a faster pace.
955  **
956  ** This will override other factors that may scale the time
957  ** scale factor of a character. (For example, smaller scale
958  ** characters will generally move faster.)
959  **
960  ** Call unset_t_scale_factor() to allow other factors such
961  ** as scale or desired speed to determine the time scale factor.
962  **
963  *b Mode Restrictions:
964  **
965  *- - This function can only be called in free action mode.
966  **
967  *b Arguments:
968  **
969  *a t_scale_factor - time scale factor
970  **
971  *b Returns:
972  **
973  ** 0 on success, -1 on failure
974  */
975  int set_t_scale_factor(float t_scale_factor);
976 
977  /*l
978  *b Description:
979  **
980  ** This function removes the manual setting of the time
981  ** scale factor as set by set_t_scale_factor().
982  **
983  *b Mode Restrictions:
984  **
985  *- - This function can only be called in free action mode.
986  **
987  *b Returns:
988  **
989  ** 0 on success, -1 on failure
990  */
991  int unset_t_scale_factor();
992 
993  /*l
994  *b Description:
995  **
996  ** This function determines whether this character is within the
997  ** specified distance of another.
998  **
999  *b Arguments:
1000  **
1001  *a character - character to be checked
1002  *a distance - distance to character in meters
1003  **
1004  *b Returns:
1005  **
1006  ** 1 if within distance; 0 if not
1007  */
1008  int is_within_distance_n_of_character(const char* character_name,
1009  float distance);
1010 
1011  /*l
1012  *b Description:
1013  **
1014  ** This function determines whether this character is within the
1015  ** specified distance of any members of the specified group.
1016  **
1017  *b Arguments:
1018  **
1019  *a group_name - name of group to be checked
1020  *a distance - distance in meters
1021  **
1022  *b Returns:
1023  **
1024  ** 1 if member of group is within distance; 0 if not
1025  */
1026  int is_within_distance_n_of_member_of_group(const char* group_name,
1027  float distance);
1028 
1029  /*l
1030  *b Description:
1031  **
1032  ** This function determines whether a character is a member of
1033  ** a particular group.
1034  **
1035  ** Also see diguyCharacterGroup::is_member().
1036  **
1037  *b Arguments:
1038  **
1039  *a group_name - name of group to be checked
1040  **
1041  *b Returns:
1042  **
1043  ** 1 if character is in group, 0 if not
1044  */
1045  int is_group_member(const char* group_name);
1046 
1047  /*l
1048  *b Description:
1049  **
1050  ** This function returns the number of groups that a character is a
1051  ** member of.
1052  **
1053  ** Also see diguyCharacterGroup::is_member().
1054  */
1055  int get_num_group_memberships();
1056 
1057  /*l
1058  *b Description:
1059  **
1060  ** This function returns a pointer to the nth group that this
1061  ** character is a member of.
1062  **
1063  ** Also see diguyCharacterGroup::is_member().
1064  **
1065  *b Returns:
1066  **
1067  ** pointer of type diguyCharacterGroup; NULL if no
1068  ** group at the specified index
1069  **
1070  *b Arguments:
1071  **
1072  *a index - index of the group; indices start at 0
1073  */
1074  diguyCharacterGroup* get_group_membership_at_index(int index);
1075 
1076  /*l
1077  *b Description:
1078  **
1079  ** This function will check all characters in the scenario and return
1080  ** the nearest character that is both alive and enabled. An optional
1081  ** argument specifies whether to skip characters that are invisible
1082  ** to the caller because a scene object is in the way. Checking
1083  ** visibility is only an option if an octtree is generated from scene
1084  ** objects. Typically only DI-Guy Scenario does this.
1085  **
1086  *b Arguments:
1087  **
1088  *a check_visibility - whether to check that characters are
1089  *a visible to calling character; pass 1
1090  *a to check, 0 to not check
1091  *a xy_distance - whether to include the z component
1092  *a in distance calculations; pass 1 to
1093  *a check only XY distance, 0 to check
1094  *a XYZ distance
1095  **
1096  *b Returns:
1097  **
1098  ** pointer of type diguyCharacter; may be NULL
1099  */
1100  diguyCharacter* get_nearest_active_character(int check_visibility,
1101  int xy_distance = 0,
1102  float max_distance_to_check = 100000);
1103 
1104  /*l
1105  *b Description:
1106  **
1107  ** This function will check all characters in a group and return the
1108  ** nearest character that is both alive and enabled. An optional
1109  ** argument specifies whether to skip characters that are invisible
1110  ** to the caller because a scene object is in the way. Checking
1111  ** visibility is only an option if an octtree is generated from scene
1112  ** objects. Typically only DI-Guy Scenario does this.
1113  **
1114  *b Arguments:
1115  **
1116  *a group_name - name of group to check
1117  *a check_visibility - whether to check that characters are
1118  *a visible to calling character; pass 1
1119  *a to check, 0 to not check
1120  *a xy_distance - whether to include the z component
1121  *a in distance calculations; pass 1 to
1122  *a check only XY distance, 0 to check
1123  *a XYZ distance
1124  **
1125  *b Returns:
1126  **
1127  ** pointer of type diguyCharacter; may be NULL
1128  */
1129  diguyCharacter* get_nearest_active_character_in_group(const char* group_name,
1130  int check_visibility = 1,
1131  int xy_distance = 0,
1132  float max_distance_to_check = 100000);
1133 
1134  /*l
1135  *b Description:
1136  **
1137  ** This function will check all characters in the scenario and return
1138  ** a random character within max_distance that is both alive and
1139  ** enabled. An optional argument specifies whether to skip characters
1140  ** that are invisible to the caller because a scene object is in the
1141  ** way. Checking visibility is only an option if an octtree is
1142  ** generated from scene objects. Typically only DI-Guy Scenario does
1143  ** this.
1144  **
1145  *b Arguments:
1146  **
1147  *a check_visibility - whether to check that characters are
1148  *a visible to calling character; pass 1
1149  *a to check, 0 to not check
1150  *a max_distance - how far away the search cut off should be pass
1151  *a in -1.0f to use all characters
1152  *a xy_distance - whether to include the z component
1153  *a in distance calculations; pass 1 to
1154  *a check only XY distance, 0 to check
1155  *a XYZ distance
1156  **
1157  *b Returns:
1158  **
1159  ** pointer of type diguyCharacter; may be NULL
1160  */
1161  diguyCharacter* get_random_active_character(float max_distance = 10.0f,
1162  int check_visibility = 1,
1163  int xy_distance = 0);
1164 
1165  /*l
1166  *b Description:
1167  **
1168  ** This function will check all characters in a group and return a
1169  ** random character within max_distance that is both alive and
1170  ** enabled. An optional argument specifies whether to skip characters
1171  ** that are invisible to the caller because a scene object is in the
1172  ** way. Checking visibility is only an option if an octtree is
1173  ** generated from scene objects. Typically only DI-Guy Scenario does
1174  ** this.
1175  **
1176  *b Arguments:
1177  **
1178  *a group_name - name of group to check
1179  *a max_distance - how far away the search cut off should be, pass
1180  *a in -1.0f to use all characters
1181  *a check_visibility - whether to check that characters are
1182  *a visible to calling character; pass 1
1183  *a to check, 0 to not check
1184  *a xy_distance - whether to include the z component
1185  *a in distance calculations; pass 1 to
1186  *a check only XY distance, 0 to check
1187  *a XYZ distance
1188  **
1189  *b Returns:
1190  **
1191  ** pointer of type diguyCharacter; may be NULL
1192  */
1193  diguyCharacter* get_random_active_character_in_group(const char* group_name,
1194  float max_distance = 10,
1195  int check_visibility = 1,
1196  int xy_distance = 0);
1197 
1198  /*l
1199  *b Description:
1200  **
1201  ** This function returns the 3D distance from this character to the
1202  ** specified character, in meters. The distance is calculated from
1203  ** the characters' idealized positions.
1204  */
1205  float get_distance_to_character(diguyCharacter* character);
1206 
1207  /*l
1208  *b Description:
1209  **
1210  ** This function returns the 2D distance in X and Y coordinates only
1211  ** from this character to the specified character, in meters. The
1212  ** distance is calculated from the characters' idealized positions.
1213  */
1214  float get_distance_xy_to_character(diguyCharacter* character);
1215 
1216  /*l
1217  *b Description:
1218  **
1219  ** This function returns the 3D distance from this character to the
1220  ** specified impact, in meters. The distance is calculated from the
1221  ** characters' idealized positions.
1222  */
1223  float get_distance_to_impact(diguyImpact* impact);
1224 
1225  /*l
1226  *b Description:
1227  **
1228  ** Each character has a "random factor" between 0 and 1. This value
1229  ** is persistent with the character; i.e., the random factor will
1230  ** stay constant for the entire lifetime of the character.
1231  **
1232  ** This random factor can be used to add some variability between
1233  ** different characters.
1234  **
1235  ** Though each character has a random factor that has a very good
1236  ** chance of being different from all other characters' in the
1237  ** scenario, this is not guaranteed and so should not be used as a
1238  ** unique identifier.
1239  **
1240  ** An example of use: Instead of all characters beginning an action
1241  ** or behavior at the same time, have each one begin (random_factor *
1242  ** 2.0) seconds from the current time. This will result in more
1243  ** natural looking behavior as characters one by one begin the new
1244  ** behavior in the next two seconds, rather than all beginning at
1245  ** once.
1246  **
1247  *b Returns:
1248  **
1249  ** the character's random factor, a value between 0 and 1
1250  */
1251  float get_random_factor();
1252 
1253 
1254 /*****************************************************************************/
1259  /*l
1260  *b Description:
1261  **
1262  ** This function draws this character in immediate mode graphics
1263  ** environments (see below). This is the equivalent of calling
1264  ** draw_pass1() immediately followed by draw_pass2().
1265  **
1266  *b Returns:
1267  **
1268  ** 0 on success, -1 on failure
1269  **
1270  *i OpenGL Version:
1271  **
1272  ** This function immediately draws this character. Either this
1273  ** function or draw_pass1() and draw_pass2() should be called once per
1274  ** frame.
1275  **
1276  *b Callable From:
1277  **
1278  *- - C++
1279  */
1280  int draw();
1281 
1282  /*l
1283  *b Description:
1284  **
1285  ** This function, along with draw_pass2(), allows the drawing of
1286  ** opaque and transparent polygons to be separated. This function
1287  ** draws all opaque polygons of this character.
1288  **
1289  *b Returns:
1290  **
1291  ** 0 on success, -1 on failure
1292  **
1293  *i OpenGL Version:
1294  **
1295  ** This function immediately draws the opaque character parts. Either
1296  ** this function or draw() should be called once per frame.
1297  **
1298  *b Callable From:
1299  **
1300  *- - C++
1301  */
1302  int draw_pass1();
1303 
1304  /*l
1305  *b Description:
1306  **
1307  ** Same as draw_pass1(), but draws transparent character parts.
1308  **
1309  *b Callable From:
1310  **
1311  *- - C++
1312  */
1313  int draw_pass2();
1314 
1315 #ifdef CPLUSPLUS_ONLY
1316 
1317  /*l
1318  *b Returns:
1319  **
1320  ** A pointer to the character's graphics.
1321  **
1322  *i Vega Prime Version:
1323  **
1324  ** The return pointer may be cast to point to a vpDiguyCharacter,
1325  ** which is derived from vpObject.
1326  **
1327  *i OpenGL Version:
1328  **
1329  ** This function returns NULL.
1330  **
1331  *i DirectX 9 Version:
1332  **
1333  ** This function returns NULL.
1334  **
1335  *i DI-Guy Graphics API:
1336  **
1337  ** This function returns the pointer set from the most recent
1338  ** set_graphics_ptr() call.
1339  **
1340  *b Callable From:
1341  **
1342  *- - C++
1343  */
1344  void* get_graphics_ptr();
1345 
1346  /*l
1347  *b Description:
1348  **
1349  ** Sets a graphics environment-specific pointer to graphics data.
1350  ** The pointer can be retrieved using get_graphics_ptr().
1351  **
1352  *b Arguments:
1353  **
1354  *a graphics_ptr - pointer to graphics data
1355  **
1356  *b Returns:
1357  **
1358  ** 0 on success, -1 on failure
1359  **
1360  *i Vega Prime Version:
1361  *i OpenGL Version:
1362  *i DirectX 9 Version:
1363  **
1364  *b This function should not be called for these environments.
1365  **
1366  *i DI-Guy Graphics API Version:
1367  **
1368  ** This function allows graphics environment-specific data to be
1369  ** stored for later retrieval by get_graphics_ptr(). DI-Guy does
1370  ** not directly use the pointer, beyond returning it using the
1371  ** get_graphics_ptr() function.
1372  **
1373  *b Callable From:
1374  **
1375  *- - C++
1376  */
1377  int set_graphics_ptr(void* graphics_ptr);
1378 
1379  /*l
1380  *b Description:
1381  **
1382  ** This function sets a generic node pointer that can later be
1383  ** retrieved by the get_graphics_api_node_ptr() call. The pointer is
1384  ** otherwise not used.
1385  **
1386  *i Callback Info:
1387  **
1388  ** This function can be safely be called in the
1389  ** CALLBACK_ID_SET_GRAPHICS_API_NODE_PTR callback.
1390  **
1391  *b Arguments:
1392  **
1393  *a node_ptr - generic void* pointer
1394  **
1395  *b Callable From:
1396  **
1397  *- - C++
1398  *- - Script
1399  */
1400  void set_graphics_api_node_ptr(void* node_ptr);
1401 
1402  /*l
1403  *b Returns:
1404  **
1405  ** pointer set by most recent call to set_graphics_api_node_ptr
1406  **
1407  *b Callable From:
1408  **
1409  *- - C++
1410  */
1411  void* get_graphics_api_node_ptr();
1412 
1413  /*l
1414  *b Description:
1415  **
1416  ** This function stores a pointer to user data.
1417  **
1418  *b Arguments:
1419  **
1420  *a user_data - pointer for user's own use; DI-Guy will
1421  *a do nothing to the contents of this pointer
1422  *a beyond passing it back when requested
1423  *a by get_user_data()
1424  **
1425  *b Returns:
1426  **
1427  ** 0 on success, -1 on failure
1428  **
1429  *b Callable From:
1430  **
1431  *- - C++
1432  */
1433  int set_user_data(void* user_data);
1434 
1435  /*l
1436  *b Returns:
1437  **
1438  ** The user data pointer set by set_user_data()
1439  **
1440  *b Callable From:
1441  **
1442  *- - C++
1443  */
1444  void* get_user_data();
1445 
1446 #endif
1447 
1448 /*****************************************************************************/
1458  /*l
1459  *b Description:
1460  **
1461  ** This function sets the desired action of the character.
1462  **
1463  ** This function will put the character into free action mode. If
1464  ** the character was in path action mode, actions will no longer be
1465  ** set by action beads on the path.
1466  **
1467  ** If the character is in path position mode and 1 is passed for
1468  ** retain_path_shape, the character will stay in path position mode.
1469  ** If 0 is passed for retain_path_shape, the character will be put
1470  ** into free position mode.
1471  **
1472  ** If the character is in free position mode the retain_path_shape
1473  ** argument will have no effect.
1474  **
1475  ** If this call is interrupting a character in path action mode
1476  ** and path position mode, the character will not be able to resume
1477  ** the interrupted path unless retain_path_shape is set to 1.
1478  ** See resume_interrupted_path().
1479  **
1480  ** This function will have no effect on a dead character (see
1481  ** die_now() and get_dead()).
1482  **
1483  *b Mode Effects:
1484  **
1485  *- - This function will put the character into free action mode.
1486  *- - This function may change the position mode; see Description.
1487  **
1488  *b Arguments:
1489  **
1490  *a action_name - name of the desired action to be performed by
1491  *a the character
1492  *a speed - the speed at which the character should travel
1493  *a while performing the action; pass
1494  *a DIGUY_DEFAULT_FLOAT for the optimal speed to
1495  *a be used
1496  *a retain_path_shape - pass 1 to remain in path position mode; pass
1497  *a 0 to change to free position mode
1498  **
1499  *b Returns:
1500  **
1501  ** 0 on success, -1 on failure
1502  */
1503  int set_desired_action(const char* action_name,
1504  float speed = DIGUY_DEFAULT_FLOAT,
1505  int retain_path_shape = 0);
1506 
1507  /*l
1508  *b Returns:
1509  **
1510  ** name of desired action; see set_desired_action()
1511  **
1512  *b Mode Restrictions:
1513  **
1514  *- - This function can only be called in free action mode.
1515  */
1516  const char* get_desired_action();
1517 
1518  /*l
1519  *b Returns:
1520  **
1521  ** name of current action being performed by the character
1522  */
1523  const char* get_current_action();
1524 
1525  /*l
1526  *b Description:
1527  **
1528  ** This function forces the current action of the character to be the
1529  ** action identified by action_name.
1530  **
1531  ** See set_desired_action() for a discussion of the effects on
1532  ** position mode.
1533  **
1534  ** This function will have no effect on a dead character (see
1535  ** die_now() and get_dead()).
1536  **
1537  ** By passing a value greater than 0 for t_offset_into_new_action,
1538  ** the character can be made to begin the action partway in. This is
1539  ** useful when forcing actions for a lot of characters at the same
1540  ** time; without the offset, the characters would move in lockstep.
1541  **
1542  ** The most recent forced action, the time at which it was forced,
1543  ** and any time offset can be queried using the functions
1544  ** get_most_recent_forced_action(),
1545  ** get_most_recent_forced_action_t(), and
1546  ** get_most_recent_forced_action_t_offset().
1547  **
1548  *b Mode Effects:
1549  **
1550  *- - This function will put the character into free action mode.
1551  *- - This function may change the position mode; see Description.
1552  **
1553  *b Arguments:
1554  **
1555  *a action_name - name of the action to be performed by
1556  *a the character
1557  *a speed - the speed at which the character should
1558  *a travel while performing the action; pass
1559  *a DIGUY_DEFAULT_FLOAT for the optimal speed
1560  *a to be used
1561  *a include_transition_arc - flag for whether the transition
1562  *a motion from the current action to
1563  *a the new action is included;
1564  *a pass 1 for best chance of good looking
1565  *a transition;
1566  *a pass 0 for fastest response
1567  *a max_rampdown_interval - max amount of time spent trying to
1568  *a smooth over any motion seams; set
1569  *a to 0.5 for a smooth transition, set
1570  *a to 0 for a potentially rough transition
1571  *a retain_path_shape - pass 1 to remain in path position mode;
1572  *a pass 0 to change to free position mode
1573  *a t_offset_into_new_action - how much to shift time forward into
1574  *a new action; must be >= 0; see comment
1575  *a above for more info
1576  **
1577  *b Returns:
1578  **
1579  ** 0 on success, -1 on failure
1580  */
1581  int force_action(const char* action_name,
1582  float speed = DIGUY_DEFAULT_FLOAT,
1583  int include_transition_arc = 1,
1584  float max_rampdown_interval = 0.5f,
1585  int retain_path_shape = 0,
1586  float t_offset_into_new_action = 0.0f);
1587 
1588  /*l
1589  *b Description:
1590  **
1591  ** This function is similar to force_action(), but allows the
1592  ** specification of how long the interruption should last.
1593  **
1594  ** This function will have no effect on a dead character (see
1595  ** die_now() and get_dead()).
1596  **
1597  *b Mode Restrictions:
1598  **
1599  *- - This function can only be called if the character is in
1600  *- path action mode *and* path position mode.
1601  **
1602  *b Mode Effects:
1603  **
1604  *- - This function will put the character into free action mode.
1605  *- - This function will not change the position mode.
1606  **
1607  *b Arguments:
1608  **
1609  *a duration - how long the action should be performed before
1610  *a an automatic resume_interrupted_path() call is
1611  *a made
1612  **
1613  *b Returns:
1614  **
1615  ** 0 on success, -1 on failure
1616  */
1617  int force_action_with_duration(const char* action_name,
1618  float duration,
1619  int include_transition_arc = 1,
1620  float max_rampdown_interval = 0.5f);
1621 
1622  /*l
1623  *b Description:
1624  **
1625  ** This function forces the current action of the character to be the
1626  ** action identified by action_name, to be executed along the path
1627  ** shape specified by path_shape_name.
1628  **
1629  ** This function will have no effect on a dead character (see
1630  ** die_now() and get_dead()).
1631  **
1632  *b Mode Effects:
1633  **
1634  *- - This function will put the character into free action mode.
1635  *- - This function will put the character into path position mode.
1636  **
1637  *b Arguments:
1638  **
1639  *a action_name - name of the action to be performed by
1640  *a the character
1641  *a path_shape_name - name of the path shape on which action
1642  *a should be performed
1643  *a waypoint_name - name of waypoint on path shape to begin at;
1644  *a default of NULL will start at first waypoint
1645  *a distance_into_path - distance into path shape to start at, if
1646  *a waypoint_name isn't specified
1647  **
1648  *b Returns:
1649  **
1650  ** 0 on success, -1 on failure
1651  */
1652  int force_action_and_path_shape(const char* action_name,
1653  const char* path_shape_name,
1654  const char* waypoint_name = NULL,
1655  float distance_into_path = 0.0f);
1656 
1657  /*l
1658  *b Description:
1659  **
1660  ** This function returns the most recently forced action as set by
1661  ** by force_action(), force_action_with_duration(), or
1662  ** force_action_and_path_shape().
1663  **
1664  *b Returns:
1665  **
1666  ** the name of the most recent forced action, or NULL if no action
1667  ** has been forced
1668  */
1669  const char* get_most_recent_forced_action();
1670 
1671  /*l
1672  *b Description:
1673  **
1674  ** This function returns the time at which the most recently forced
1675  ** action occurred.
1676  **
1677  *b Returns:
1678  **
1679  ** time at which force action occurred; -1.0 if no action has been
1680  ** forced
1681  */
1682  float get_most_recent_forced_action_t();
1683 
1684  /*l
1685  *b Description:
1686  **
1687  ** This function returns the action time offset of the most recently
1688  ** forced action. This is typically value of the
1689  ** t_offset_into_new_action argument of the force_action() call.
1690  **
1691  *b Returns:
1692  **
1693  ** time at which force action occurred; -1.0 if no action has been
1694  ** forced
1695  */
1696  float get_most_recent_forced_action_t_offset();
1697 
1698  /*l
1699  *b Description:
1700  **
1701  ** This function adds a "pending action" to the character. This is
1702  ** essentially a delayed set_desired_action() call. The desired
1703  ** action will be set at the passed scenario t, just as if
1704  ** set_desired_action() is called at that time.
1705  **
1706  ** *Note:* Any call to set_desired_action() or force_action(), or
1707  ** their related variants, will clear any pending actions.
1708  **
1709  *b Arguments:
1710  **
1711  *a action - name of pending desired action
1712  *a scenario_t - time at which to set desired action
1713  *a remove_existing_pending_actions - pass 1 to remove any previously
1714  *a added pending actions, 0 to leave them
1715  *a speed - as passed to set_desired_action()
1716  *a retain_path_shape - as passed to set_desired_action()
1717  **
1718  *b Returns:
1719  **
1720  ** 0 on success, -1 on failure
1721  */
1722  int add_pending_desired_action(const char* action,
1723  float scenario_t,
1724  int remove_existing_pending_actions = 0,
1725  float speed = DIGUY_DEFAULT_FLOAT,
1726  int retain_path_shape = 1);
1727 
1728  /*l
1729  *b Description:
1730  **
1731  ** Similar to add_pending_desired_action(), but will do a
1732  ** force_action() at the passed scenario_t instead of a
1733  ** set_desired_action().
1734  **
1735  ** *Note:* Any call to set_desired_action() or force_action(), or
1736  ** their related variants, will clear any pending actions.
1737  **
1738  *b Returns:
1739  **
1740  ** 0 on success, -1 on failure
1741  */
1742  int add_pending_force_action(const char* action,
1743  float scenario_t,
1744  int remove_existing_pending_actions = 0,
1745  float speed = DIGUY_DEFAULT_FLOAT,
1746  int include_transition_arc = 1,
1747  float max_rampdown_interval = 0.5f,
1748  int retain_path_shape = 1,
1749  float first_arc_time_shift = 0.0f);
1750 
1751  /*l
1752  *b Returns:
1753  **
1754  ** 1 if the passed action name is an action available to this
1755  ** character, 0 if not
1756  */
1757  int is_valid_action(const char* action);
1758 
1759  /*l
1760  *b Description:
1761  **
1762  ** This function sends this character a signal to die as soon as
1763  ** possible. The character will transition to a dead action.
1764  **
1765  ** The following side-effects will also happen:
1766  *>
1767  *- - all aiming is ended
1768  *- - all gazing is ended
1769  *- - all pointing is ended
1770  *- - head nodding and shaking are stopped
1771  *- - all gestures are aborted
1772  *- - all sounds originated by the character are stopped
1773  *<
1774  ** Many function calls will have no effect on dead characters;
1775  ** see individual function descriptions for limitations.
1776  **
1777  ** Use the get_dead() call to retrieve the dead state of a
1778  ** character.
1779  **
1780  *b Mode Effects:
1781  **
1782  *- - This function will put the character into free action mode.
1783  *- - This function will not change the position mode.
1784  **
1785  *b Returns:
1786  **
1787  ** 0 on success, -1 on failure
1788  **
1789  *b Callable From:
1790  **
1791  *- - C++
1792  *- - Script
1793  *- - Decision Bead
1794  */
1795  int die_now(const char* preferred_dead_action_name = "(default)");
1796 
1797  /*l
1798  *b Description:
1799  **
1800  ** This function revives a dead character. The limitations of dead
1801  ** characters will be lifted from the revived character; e.g., the
1802  ** character will be able to gaze, execute gestures, etc.
1803  **
1804  *b Returns:
1805  **
1806  ** 0 on success, -1 on failure
1807  **
1808  *b Callable From:
1809  **
1810  *- - C++
1811  *- - Script
1812  *- - Decision Bead
1813  */
1814  int revive_now(const char* preferred_revive_action_name = "(default)");
1815 
1816  /*l
1817  *b Description:
1818  **
1819  ** This function returns whether or not the character is dead.
1820  ** Characters can be killed by die_now() function calls, as well as
1821  ** by being hit by weapon fire.
1822  **
1823  *b Returns:
1824  **
1825  ** 1 if character is dead (die_now() function has been called),
1826  ** 0 if not.
1827  */
1828  int get_dead();
1829 
1830  /*l
1831  *b Description:
1832  **
1833  ** Sets the speed the character should attempt to move, in meters per
1834  ** second.
1835  **
1836  ** This setting takes effect immediately. To set a desired action
1837  ** and a desired speed at the same time, use the speed argument of
1838  ** the set_desired_action() call.
1839  **
1840  ** This desired speed setting can be undone in a couple of ways:
1841  **
1842  *- 1. by calling set_speed() with an argument of
1843  *- DIGUY_DEFAULT_FLOAT, or
1844  *- 2. by calling set_desired_action(), or
1845  *- 3. by calling one of the force_action() functions
1846  **
1847  *b Arguments:
1848  **
1849  *a speed - desired speed in meters per second
1850  **
1851  *b Returns:
1852  **
1853  ** 0 on success, -1 on failure
1854  */
1855  int set_speed(float speed);
1856 
1857  /*l
1858  *b Returns:
1859  **
1860  ** the approximate speed at which the character is moving, in meters
1861  ** per second
1862  */
1863  float get_speed();
1864 
1865 
1866 /*****************************************************************************/
1876  /*l
1877  *b Description:
1878  **
1879  ** Sets the position of the character relative to the origin of the
1880  ** Boston Dynamics global coordinate system.
1881  **
1882  ** The new settings will take effect immediately, possibly causing
1883  ** the character to "teleport" if the new values are significantly
1884  ** different than the old.
1885  **
1886  ** The Boston Dynamics global coordinate system is right-handed, with
1887  ** X forward, Z up, and Y to the left. Rotation directions follow
1888  ** standard right-handed coordinate system conventions:
1889  **
1890  *- - positive rotations about X cause a counter-clockwise roll
1891  *- - position rotations about Y cause a forward pitch
1892  *- - positive rotations about Z cause a yaw to the left
1893  **
1894  ** Note that if the character has an altitude function (see
1895  ** set_altitude_function()), the tz argument will effectively be
1896  ** ignored as the altitude function will override it.
1897  **
1898  ** If the magnitude of the numbers is large (say 32000 or higher),
1899  ** the function set_position_double() should be used instead.
1900  **
1901  *b Mode Effects:
1902  **
1903  *- - This function will put the character into free position mode.
1904  *- - This function will put the character into free action mode.
1905  **
1906  *b Arguments:
1907  **
1908  *a tx, ty, tz - position in meters from the origin
1909  **
1910  *b Returns:
1911  **
1912  ** 0 on success, -1 on failure
1913  */
1914  int set_position(float tx, float ty, float tz);
1915 
1916  /*l
1917  *b Description:
1918  **
1919  ** Similar to set_position(), but using double-precision rather than
1920  ** single-precision numbers. If the magnitude of the numbers is large
1921  ** (say 32000 or higher), this function should be used.
1922  **
1923  *b Mode Effects:
1924  **
1925  *- - This function will put the character into free position mode.
1926  *- - This function will put the character into free action mode.
1927  **
1928  *b Arguments:
1929  **
1930  *a tx, ty, tz - position in meters from the origin
1931  **
1932  *b Returns:
1933  **
1934  ** 0 on success, -1 on failure
1935  */
1936  int set_position_double(double tx, double ty, double tz);
1937 
1938  /*l
1939  *b Description:
1940  **
1941  ** Retrieves the position of the character in the Boston Dynamics
1942  ** global coordinate system.
1943  **
1944  ** See set_position() for a description of the coordinate system.
1945  **
1946  *b Arguments:
1947  **
1948  *a tx, ty, tz - position in meters from the origin
1949  **
1950  ** Pass NULL for any values that are not needed.
1951  **
1952  *b Returns:
1953  **
1954  ** 0 on success, -1 on failure
1955  */
1956  int get_position(float* tx, float* ty, float* tz);
1957 
1958  /*l
1959  *b Description:
1960  **
1961  ** Retrieves the position of the character in the Boston Dynamics
1962  ** global coordinate system.
1963  **
1964  ** See set_position() for a description of the coordinate system.
1965  **
1966  ** Unlike get_position(), this function returns higher-precision
1967  ** values for the position, which is important when the character is
1968  ** far from the coordinate system origin.
1969  **
1970  *b Arguments:
1971  **
1972  *a tx, ty, tz - position in meters from the origin
1973  **
1974  ** Pass NULL for any values that are not needed.
1975  **
1976  *b Returns:
1977  **
1978  ** 0 on success, -1 on failure
1979  */
1980  int get_position_double(double* tx, double* ty, double* tz);
1981 
1982  /*l
1983  *b Description:
1984  **
1985  ** Sets the position of the character relative to its parent or the
1986  ** origin of the Boston Dynamics global coordinate system if this
1987  ** character is not parented.
1988  **
1989  ** See set_position() for a description of the coordinate system.
1990  **
1991  ** The new settings will take effect immediately, possibly causing the
1992  ** character to "teleport" if the new values are significantly
1993  ** different than the old.
1994  **
1995  *b Mode Effects:
1996  **
1997  *- - This function will put the character into free position mode.
1998  *- - This function will put the character into free action mode.
1999  **
2000  *b Arguments:
2001  **
2002  *a tx, ty, tz - position in meters from the origin
2003  **
2004  *b Returns:
2005  **
2006  ** 0 on success, -1 on failure
2007  */
2008  int set_position_relative_to_parent(float tx, float ty, float tz);
2009 
2010  /*l
2011  *b Description:
2012  **
2013  ** Retrieves the position of the character relative to its parent, or
2014  ** relative to the origin of the Boston Dynamics global coordinate
2015  ** system if this character is not parented.
2016  **
2017  ** See set_position() for a description of the coordinate system.
2018  **
2019  *b Arguments:
2020  **
2021  *a tx, ty, tz - position in meters from the origin
2022  **
2023  ** Pass NULL for any values that are not needed.
2024  **
2025  *b Returns:
2026  **
2027  ** 0 on success, -1 on failure
2028  */
2029  int get_position_relative_to_parent(float* tx, float* ty, float* tz);
2030 
2031  /*l
2032  *b Description:
2033  **
2034  ** Similar to set_position_relative_to_parent(), but the position is
2035  ** either from the other character's overall position (if
2036  ** other_link_name is NULL), or the position of the other character's
2037  ** link (if other_link_name specifies a link on the other character).
2038  **
2039  ** The position that is set is relative to this character's parent.
2040  **
2041  *b Mode Effects:
2042  **
2043  *- - This function will put the character into free position mode.
2044  *- - This function will put the character into free action mode.
2045  **
2046  *b Arguments:
2047  **
2048  *a other_character_name - other character from which to read
2049  *a position
2050  *a other_link_name - optional link on other character; if
2051  *a NULL, other character's base position is
2052  *a used
2053  *a offset_x, offset_y, offset_z - offset to apply to position
2054  *a read from other character
2055  *a also_set_orientation - pass 1 to also set this character's
2056  *a orientation from the other character's
2057  *a orientation
2058  **
2059  *b Returns:
2060  **
2061  ** 0 on success, -1 on failure
2062  */
2063  int set_position_to_other_character_position(const char* other_character_name,
2064  const char* other_link_name = NULL,
2065  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2066  int also_set_orientation = 1);
2067 
2068  /*l
2069  *b Description:
2070  **
2071  ** Sets the desired position of the character. How the character
2072  ** moves toward the desired position is determined by its current
2073  ** guides; see add_guide() and create_guide().
2074  **
2075  *b Mode Effects:
2076  **
2077  *- - This function will put the character into free position mode.
2078  *- - This function will put the character into free action mode.
2079  **
2080  *b Arguments:
2081  **
2082  *a tx, ty, tz - desired position in meters from the origin
2083  *a force_guide_unacquired - this optional argument will set any guides
2084  *a the character has to be unacquired
2085  *b Returns:
2086  **
2087  ** 0 on success, -1 on failure
2088  */
2089  int set_desired_position(float tx, float ty, float tz,
2090  int force_guide_unacquired = 0);
2091 
2092  /*l
2093  *b Description:
2094  **
2095  ** Like set_desired_position(), but uses the character's current
2096  ** position as the desired position.
2097  **
2098  *b Mode Effects:
2099  **
2100  *- - This function will put the character into free position mode.
2101  *- - This function will put the character into free action mode.
2102  **
2103  *b Arguments:
2104  **
2105  *a also_set_orientation - pass 1 to also set this character's
2106  *a orientation to its current orientation
2107  **
2108  *b Returns:
2109  **
2110  ** 0 on success, -1 on failure
2111  */
2112  int set_desired_position_to_current_position(int also_set_orientation = 1);
2113 
2114  /*l
2115  *b Description:
2116  **
2117  ** Like set_desired_position(), but sets the character's desired
2118  ** position to passed waypoint's position.
2119  **
2120  ** The passed waypoint can be one created by
2121  ** diguyScenario::create_waypoint, a waypoint from a character's
2122  ** diguyCharacterPath, or waypoint from a diguyPathShape.
2123  **
2124  *b Mode Effects:
2125  **
2126  *- - This function will put the character into free position mode.
2127  *- - This function will put the character into free action mode.
2128  **
2129  *b Arguments:
2130  **
2131  *a waypoint - pointer to diguyWaypoint object
2132  *a offset_x, offset_y, offset_z - offset to apply to waypoint
2133  *a position
2134  *a offset_in_world_coords - 1 if offset is to be in world
2135  *a coordinates, 0 if it is to be
2136  *a in waypoint-local coordinates
2137  **
2138  *b Returns:
2139  **
2140  ** 0 on success, -1 on failure
2141  */
2142  int set_desired_position_to_waypoint(diguyWaypoint* waypoint,
2143  float offset_x = 0.0f, float offset_y = 0.0f, float offset_z = 0.0f,
2144  int offset_in_world_coords = 0);
2145 
2146  /*l
2147  *b Description:
2148  **
2149  ** Like set_desired_position(), but finds the specified waypoint on
2150  ** the specified path and sets the character's desired position to the
2151  ** waypoint's position.
2152  **
2153  *b Mode Effects:
2154  **
2155  *- - This function will put the character into free position mode.
2156  *- - This function will put the character into free action mode.
2157  **
2158  *b Arguments:
2159  **
2160  *a path_name - name of path on which to find waypoint
2161  *a waypoint_name - name of waypoint
2162  **
2163  *b Returns:
2164  **
2165  ** 0 on success, -1 on failure
2166  */
2167  int set_desired_position_to_path_waypoint(const char* path_name,
2168  const char* waypoint_name);
2169 
2170  /*l
2171  *b Description:
2172  **
2173  ** Like set_desired_position(), but finds the specified waypoint on
2174  ** the specified path shape and sets the character's desired position
2175  ** to the waypoint's position.
2176  **
2177  *b Mode Effects:
2178  **
2179  *- - This function will put the character into free position mode.
2180  *- - This function will put the character into free action mode.
2181  **
2182  *b Arguments:
2183  **
2184  *a path_shape_name - name of path shape on which to find waypoint
2185  *a waypoint_name - name of waypoint
2186  **
2187  *b Returns:
2188  **
2189  ** 0 on success, -1 on failure
2190  */
2191  int set_desired_position_to_path_shape_waypoint(const char* path_shape_name,
2192  const char* waypoint_name);
2193 
2194  /*l
2195  *b Description:
2196  **
2197  ** Retrieves the desired position of the character.
2198  **
2199  *b Mode Restrictions:
2200  **
2201  *- - This function can only be called in free position mode.
2202  **
2203  *b Arguments:
2204  **
2205  *a tx, ty, tz - desired position in meters from the origin
2206  **
2207  ** Pass NULL for any values that are not needed.
2208  **
2209  *b Returns:
2210  **
2211  ** 0 on success, -1 on failure
2212  */
2213  int get_desired_position(float* tx, float* ty, float* tz);
2214 
2215  /*l
2216  *b Description:
2217  **
2218  ** Retrieves the delta vector from current position to desired one.
2219  **
2220  *b Mode Restrictions:
2221  **
2222  *- - This function can only be called in free position mode.
2223  **
2224  *b Arguments:
2225  **
2226  *a tx, ty, tz - delta in meters
2227  **
2228  ** Pass NULL for any values that are not needed.
2229  **
2230  *b Returns:
2231  **
2232  ** 0 on success, -1 on failure
2233  */
2234  int get_delta_to_desired_position(float* tx, float* ty, float* tz);
2235 
2236  /*l
2237  *b Description:
2238  **
2239  ** Sets the initial position the character should move to on a call to
2240  ** diguyScenario::reset().
2241  **
2242  ** If the character has an initial path, that path, not this function
2243  ** call, will determine its initial position.
2244  **
2245  *b Arguments:
2246  **
2247  *a tx, ty, tz - initial position in meters from the origin
2248  **
2249  *b Returns:
2250  **
2251  ** 0 on success, -1 on failure
2252  */
2253  int set_initial_position(float tx, float ty, float tz);
2254 
2255  /*l
2256  *b Description:
2257  **
2258  ** Retrieves the initial position of the character.
2259  **
2260  ** If the character is in free position mode or has no initial path,
2261  ** this will be the position set by set_initial_position().
2262  **
2263  ** Otherwise this will be the position of the first waypoint of the
2264  ** initial path.
2265  **
2266  *b Arguments:
2267  **
2268  *a tx, ty, tz - initial position in meters from the origin
2269  **
2270  ** Pass NULL for any values that are not needed.
2271  **
2272  *b Returns:
2273  **
2274  ** 0 on success, -1 on failure
2275  */
2276  int get_initial_position(float* tx, float* ty, float* tz);
2277 
2278  /*l
2279  *b Description:
2280  **
2281  ** Sets the orientation of the character relative to the origin of the
2282  ** Boston Dynamics global coordinate system.
2283  **
2284  ** See set_position() for a description of the coordinate system.
2285  **
2286  ** The new settings will take effect immediately, possibly causing the
2287  ** character to "teleport" if the new values are significantly
2288  ** different than the old.
2289  **
2290  ** Note that if the character has an up vector of 'z' or 'n' or even
2291  ** sometimes 'd' (as set by the set_up_vector() call) the rx and ry
2292  ** values will not have any effect. To be able to set rx and ry
2293  ** values, set the up vector of the character to 'c', for "custom".
2294  **
2295  *b Mode Effects:
2296  **
2297  *- - This function will put the character into free position mode.
2298  *- - This function will put the character into free action mode.
2299  **
2300  *b Arguments:
2301  **
2302  *a rz, rx, ry - orientations in degrees
2303  **
2304  *b Returns:
2305  **
2306  ** 0 on success, -1 on failure
2307  */
2308  int set_orientation(float rz, float rx, float ry);
2309 
2310  /*l
2311  *b Description:
2312  **
2313  ** Retrieves the orientation of the character in the Boston Dynamics
2314  ** global coordinate system. See set_position() for a description of
2315  ** the coordinate system.
2316  **
2317  *i Note:
2318  **
2319  ** For vehicles, you may want to use the function
2320  ** get_vehicle_body_orientation(). See that function for more
2321  ** information.
2322  **
2323  *b Arguments:
2324  **
2325  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2326  *a positive X axis
2327  **
2328  ** Pass NULL for any values that are not needed.
2329  **
2330  *b Returns:
2331  **
2332  ** 0 on success, -1 on failure
2333  */
2334  int get_orientation(float* rz, float* rx, float* ry);
2335 
2336  /*l
2337  *b Description:
2338  **
2339  ** Sets the orientation of the character relative to its parent or the
2340  ** origin of the Boston Dynamics global coordinate system if this
2341  ** character is not parented.
2342  **
2343  ** See set_position() for a description of the coordinate system.
2344  **
2345  ** The new settings will take effect immediately, possibly causing the
2346  ** character to "teleport" if the new values are significantly
2347  ** different than the old.
2348  **
2349  *b Mode Effects:
2350  **
2351  *- - This function will put the character into free position mode.
2352  *- - This function will put the character into free action mode.
2353  **
2354  *b Arguments:
2355  **
2356  *a rz, rx, ry - orientations in degrees
2357  **
2358  *b Returns:
2359  **
2360  ** 0 on success, -1 on failure
2361  */
2362  int set_orientation_relative_to_parent(float rz, float rx, float ry);
2363 
2364  /*l
2365  *b Description:
2366  **
2367  ** Retrieves the orientation of the character relative to its parent,
2368  ** or the origin of the Boston Dynamics global coordinate system if
2369  ** this character does not have a parent.
2370  **
2371  ** See set_position() for a description of the coordinate system.
2372  **
2373  *b Arguments:
2374  **
2375  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2376  *a positive X axis
2377  **
2378  ** Pass NULL for any values that are not needed.
2379  **
2380  *b Returns:
2381  **
2382  ** 0 on success, -1 on failure
2383  */
2384  int get_orientation_relative_to_parent(float* rz, float* rx, float* ry);
2385 
2386  /*l
2387  *b Description:
2388  **
2389  ** This function sets how the character should be oriented relative
2390  ** to its surroundings.
2391  **
2392  ** This function changes the current up vector, and the up vector
2393  ** that will be set when the character is reset. To change only the
2394  ** current up vector (a temporary change that goes away on reset),
2395  ** call set_up_vector()).
2396  **
2397  *b Arguments:
2398  **
2399  *a axis - the up vector the character should use; legal
2400  *a values shown below:
2401  **
2402  *- - 'd' - use default settings; character will change
2403  *- up vector depending on current action and
2404  *- path shape parameters
2405  *- - 'z' - Z axis is up; character will be oriented
2406  *- so that positive Z in character coordinates is
2407  *- always oriented along the positive world Z axis
2408  *- - 'n' - normal to path; character will be oriented
2409  *- so that positive Z in character coordinates is
2410  *- normal to the path shape the character is on
2411  *- - 'g' - ground-clamped; the vehicle will attempt to cling
2412  *- to the terrain, in an approximation of real rigid
2413  *- body physics
2414  *- - 'c' - custom; character's rx and ry orientation values
2415  *- will not be modified
2416  **
2417  ** Having an up vector of 'z' effectively zeroes out the rx and ry
2418  ** values of the character's orientation.
2419  **
2420  ** Having an up vector of 'n' may override rx and ry values of the
2421  ** character's orientation with values derived from the character's
2422  ** path shape.
2423  **
2424  ** Having an up vector of 'c' allows the pitch and roll of the
2425  ** character to be changed without taking it off the path it in on by
2426  ** calling set_custom_orientation_rx_and_ry(). Calling
2427  ** set_orientation() has the side-effect of putting the character
2428  ** into free position mode, taking it off of any path it's on.
2429  **
2430  *b Returns:
2431  **
2432  ** 0 on success, -1 on failure
2433  */
2434  int set_initial_up_vector(char axis);
2435 
2436  /*l
2437  *b Returns:
2438  **
2439  ** current up vector; see set_initial_up_vector()
2440  */
2441  char get_initial_up_vector();
2442 
2443  /*l
2444  *b Description:
2445  **
2446  ** This function sets how the character should be oriented relative
2447  ** to its surroundings.
2448  **
2449  ** This function changes only the current up vector. To change the
2450  ** up vector that will be used when the character is reset, call
2451  ** set_initial_up_vector().
2452  **
2453  *b Arguments:
2454  **
2455  *a axis - the up vector the character should use; see
2456  *a set_initial_up_vector() for description
2457  **
2458  *b Returns:
2459  **
2460  ** 0 on success, -1 on failure
2461  **
2462  *b Callable From:
2463  **
2464  *- - C++
2465  *- - Script
2466  *- - Decision Bead
2467  */
2468  int set_up_vector(char axis);
2469 
2470  /*l
2471  *b Returns:
2472  **
2473  ** current up vector; see set_up_vector()
2474  */
2475  char get_up_vector();
2476 
2477  /*l
2478  *b Description:
2479  **
2480  ** This function sets the rx and ry components of the character's
2481  ** orientation. Unlike set_orientation(), this function does not
2482  ** put the character into free position mode if it is currently in
2483  ** path position mode.
2484  **
2485  ** Note that if the character has an up vector of 'z' or 'n' or even
2486  ** sometimes 'd' (as set by the set_up_vector() call) this function
2487  ** will not have any effect. To be able to set rx and ry values,
2488  ** set the up vector of the character to 'c', for "custom".
2489  **
2490  ** The passed rx and ry values are in character-local coordinates,
2491  ** not parent coordinates if the character has a parent.
2492  **
2493  *b Mode Effects:
2494  **
2495  *- - None.
2496  **
2497  *b Arguments:
2498  **
2499  *a rx, ry - orientations in degrees
2500  **
2501  *b Returns:
2502  **
2503  ** 0 on success, -1 on failure
2504  */
2505  int set_custom_orientation_rx_and_ry(float rx,
2506  float ry);
2507 
2508  /*l
2509  *b Description:
2510  **
2511  ** Sets the desired orientation of the character. See
2512  ** set_desired_position().
2513  **
2514  *b Mode Effects:
2515  **
2516  *- - This function will put the character into free position mode.
2517  *- - This function will put the character into free action mode.
2518  **
2519  *b Arguments:
2520  **
2521  *a rz, rx, ry - orientations in degrees counter-clockwise from
2522  *a the positive X axis
2523  **
2524  *b Returns:
2525  **
2526  ** 0 on success, -1 on failure
2527  */
2528  int set_desired_orientation(float rz, float rx, float ry,
2529  int force_guide_unacquired = 0);
2530 
2531  /*l
2532  *b Description:
2533  **
2534  ** Retrieves the desired orientation of the character.
2535  **
2536  *b Mode Restrictions:
2537  **
2538  *- - This function can only be called in free position mode.
2539  **
2540  *b Arguments:
2541  **
2542  *a rz, rx, ry - orientations in degrees counter-clockwise from
2543  *a the positive X axis
2544  **
2545  ** Pass NULL for any values that are not needed.
2546  **
2547  *b Returns:
2548  **
2549  ** 0 on success, -1 on failure
2550  */
2551  int get_desired_orientation(float* rz, float* rx, float* ry);
2552 
2553  /*l
2554  *b Description:
2555  **
2556  ** Retrieves the delta from current orientation of the character
2557  ** to the desired one.
2558  **
2559  *b Mode Restrictions:
2560  **
2561  *- - This function can only be called in free position mode.
2562  **
2563  *b Arguments:
2564  **
2565  *a rz, rx, ry - orientation deltas in degrees counter-clockwise from
2566  *a the positive X axis
2567  **
2568  ** Pass NULL for any values that are not needed.
2569  **
2570  *b Returns:
2571  **
2572  ** 0 on success, -1 on failure
2573  */
2574  int get_delta_to_desired_orientation(float* rz, float* rx, float* ry);
2575 
2576  /*l
2577  *b Description:
2578  **
2579  ** Like set_desired_orientation(), but uses the character's current
2580  ** orientation as the desired orientation.
2581  **
2582  *b Mode Effects:
2583  **
2584  *- - This function will put the character into free position mode.
2585  *- - This function will put the character into free action mode.
2586  **
2587  *b Returns:
2588  **
2589  ** 0 on success, -1 on failure
2590  */
2591  int set_desired_orientation_to_current_orientation();
2592 
2593  /*l
2594  *b Description:
2595  **
2596  ** Like set_desired_orientation(), but orients the character towards
2597  ** the position specified.
2598  **
2599  *b Mode Effects:
2600  **
2601  *- - This function will put the character into free position mode.
2602  *- - This function will put the character into free action mode.
2603  **
2604  *b Returns:
2605  **
2606  ** 0 on success, -1 on failure
2607  */
2608  int set_desired_orientation_towards_position(float x, float y, float z,
2609  int force_guide_unacquired = 0);
2610 
2611  /*l
2612  *b Description:
2613  **
2614  ** Sets the initial orientation the character should move
2615  ** to on a call to diguyScenario::reset().
2616  **
2617  ** If the character is on a path the path, not this function
2618  ** call, will determine its initial orientation.
2619  **
2620  *b Arguments:
2621  **
2622  *a rz, rx, ry - orientations in degrees counter-clockwise from
2623  *a the positive X axis
2624  **
2625  *b Returns:
2626  **
2627  ** 0 on success, -1 on failure
2628  */
2629  int set_initial_orientation(float rz, float rx, float ry);
2630 
2631  /*l
2632  *b Description:
2633  **
2634  ** Retrieves the initial orientation of the character.
2635  **
2636  ** If the character is in free position mode or has no
2637  ** initial path, this will be the orientation set by
2638  ** set_initial_orientation().
2639  **
2640  ** Otherwise this will be the orientation of the first
2641  ** waypoint of the initial path.
2642  **
2643  *b Arguments:
2644  **
2645  *a rz, rx, ry - orientations in degrees counter-clockwise from
2646  *a the positive X axis
2647  **
2648  ** Pass NULL for any values that are not needed.
2649  **
2650  *b Returns:
2651  **
2652  ** 0 on success, -1 on failure
2653  */
2654  int get_initial_orientation(float* rz, float* rx, float* ry);
2655 
2656  /*l
2657  *b Description:
2658  **
2659  ** Returns the location and orientation of a specific link of the
2660  ** character.
2661  **
2662  *b Arguments:
2663  **
2664  *a link_name - name of the link; links are named after their inbound
2665  *a joint name
2666  *a tx, ty, tz - position in meters from the origin
2667  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2668  *a positive X axis
2669  **
2670  ** Pass NULL for any values that are not needed.
2671  **
2672  *b Returns:
2673  **
2674  ** 0 on success, -1 on failure
2675  */
2676  int get_link_position(const char* link_name,
2677  float* tx, float* ty, float* tz,
2678  float* rz, float* rx, float* ry);
2679 
2680  /*l
2681  *b Description:
2682  **
2683  ** Returns the location and orientation of a specific link
2684  ** of the character.
2685  **
2686  *b Arguments:
2687  **
2688  *a link_name - name of the link; links are named after their inbound
2689  *a joint name
2690  *a tx, ty, tz - position in meters from the origin
2691  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2692  *a positive X axis
2693  **
2694  ** Pass NULL for any values that are not needed.
2695  **
2696  *b Returns:
2697  **
2698  ** 0 on success, -1 on failure
2699  */
2700  int get_link_position_double(const char* link_name,
2701  double* tx, double* ty, double* tz,
2702  double* rz, double* rx, double* ry);
2703 
2704  /*l
2705  *b Description:
2706  **
2707  ** Similar to get_link_position(), but allows specification
2708  ** of offset into ending link.
2709  **
2710  *b Arguments:
2711  **
2712  *a link_name - name of the link
2713  *a offset_tx, offset_ty, offset_tz - offset in link
2714  *a tx, ty, tz - position in meters from the origin
2715  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2716  *a positive X axis
2717  **
2718  ** Pass NULL for any values that are not needed.
2719  **
2720  *b Returns:
2721  **
2722  ** 0 on success, -1 on failure
2723  */
2724  int get_link_position_with_offset(const char* link_name,
2725  float offset_tx, float offset_ty, float offset_tz,
2726  float* tx, float* ty, float* tz,
2727  float* rz, float* rx, float* ry);
2728 
2729  /*l
2730  *b Description:
2731  **
2732  ** Similar to get_link_position(), but allows specification
2733  ** of offset into ending link.
2734  **
2735  *b Arguments:
2736  **
2737  *a link_name - name of the link
2738  *a offset_tx, offset_ty, offset_tz - offset in link
2739  *a tx, ty, tz - position in meters from the origin
2740  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2741  *a positive X axis
2742  **
2743  ** Pass NULL for any values that are not needed.
2744  **
2745  *b Returns:
2746  **
2747  ** 0 on success, -1 on failure
2748  */
2749  int get_link_position_with_offset_double(const char* link_name,
2750  double offset_tx, double offset_ty, double offset_tz,
2751  double* tx, double* ty, double* tz,
2752  double* rz, double* rx, double* ry);
2753 
2754  /*l
2755  *b Description:
2756  **
2757  ** Returns the location and orientation of a specific link
2758  ** of the character relative to the position of another link.
2759  **
2760  *b Arguments:
2761  **
2762  *a beginning_link_name - name of the first link; send NULL to
2763  *a to specify the position link
2764  *a ending_link_name - name of the last link; send NULL to
2765  *a to specify the position link
2766  *a tx, ty, tz - position in meters from the origin
2767  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2768  *a positive X axis
2769  **
2770  ** Pass NULL for any values that are not needed.
2771  **
2772  *b Returns:
2773  **
2774  ** 0 on success, -1 on failure
2775  */
2776  int get_link_relative_position(const char* beginning_link_name,
2777  const char* ending_link_name,
2778  float* tx, float* ty, float* tz,
2779  float* rz, float* rx, float* ry);
2780 
2781  /*l
2782  *b Description:
2783  **
2784  ** Similar to get_link_relative_position(), but allows specification
2785  ** of offset into ending link.
2786  **
2787  *b Arguments:
2788  **
2789  *a beginning_link_name - name of the first link; send NULL to
2790  *a to specify the position link
2791  *a ending_link_name - name of the last link; send NULL to
2792  *a to specify the position link
2793  *a offset_tx, offset_ty, offset_tz - offset in ending link
2794  *a tx, ty, tz - position in meters from the origin
2795  *a rz, rx, ry - orientations in degrees counter-clockwise from the
2796  *a positive X axis
2797  **
2798  ** Pass NULL for any values that are not needed.
2799  **
2800  *b Returns:
2801  **
2802  ** 0 on success, -1 on failure
2803  */
2804  int get_link_relative_position_with_offset(const char* beginning_link_name,
2805  const char* ending_link_name,
2806  float offset_tx, float offset_ty, float offset_tz,
2807  float* tx, float* ty, float* tz,
2808  float* rz, float* rx, float* ry);
2809 
2810  /*l
2811  *b Description:
2812  **
2813  ** By default characters on a path will scale their movement speed
2814  ** and velocity based on the scale of the actor the character is
2815  ** based on. For example, if a tall character and short character
2816  ** are both playing the exact same walk motion, the tall character
2817  ** will move further per motion repetition than the short character.
2818  **
2819  ** Scaling the travel in this way leads to more realistic looking
2820  ** motion, but can cause different characters using the same actions
2821  ** and underlying motions to move at different speeds. At times it
2822  ** is convenient to not scale the travel.
2823  **
2824  ** If actor scaling is disabled, characters of different sizes will
2825  ** all move the same distance, and at the same speed, if they have
2826  ** the same path shapes and action beads. Note that in cases of
2827  ** extreme differences between the actor the motion is based on
2828  ** and the actor the character's current appearance is based on,
2829  ** the characters feet may slip on the ground more than normal.
2830  **
2831  *b Arguments:
2832  **
2833  *a apply_scale_flag - pass 1 to apply actor scale to travel;
2834  *a 0 to not
2835  */
2836  void set_apply_actor_scale_to_action_bead_travel(int apply_scale_flag);
2837 
2838  /*l
2839  *b Returns:
2840  **
2841  ** 1 if actor scale is being applied to travel, 0 if not
2842  */
2843  int get_apply_actor_scale_to_action_bead_travel();
2844 
2845  /*l
2846  *b Description:
2847  **
2848  ** This function transforms a point that is in the local space of the
2849  ** character into a location in the world. Useful for things like
2850  ** navigating AIs to a location near a prop. Or moving to a spot
2851  ** in front of someone else.
2852  **
2853  ** This code presumes up_axis is 'z' and that there is only rotation
2854  ** about that axis.
2855  */
2856  int local_to_global(float x, float y, float z,
2857  float* res_x, float* res_y, float* res_z);
2858 
2859  /*l
2860  *b Description:
2861  **
2862  ** This function transforms a point that is in world space into the
2863  ** local space of a character. Useful for figuring out if something
2864  ** was seen.
2865  **
2866  ** This code presumes up_axis is 'z' and that there is only rotation
2867  ** about that axis.
2868  **
2869  */
2870  int global_to_local(float x, float y, float z,
2871  float* res_x, float* res_y, float* res_z);
2872 
2873  /*l
2874  *b Description:
2875  **
2876  ** Retrieves the current estimated velocity of the character. Note
2877  ** this value may not be valid in environments where characters are
2878  ** transformed independent of DI-Guy function calls. Teleporting
2879  ** characters can also temporarily make this calculation incorrect.
2880  **
2881  *b Arguments:
2882  **
2883  *a vel_x, vel_y, vel_z - meters/sec
2884  **
2885  ** Pass NULL for any values that are not needed.
2886  **
2887  */
2888  void get_velocity(float* vel_x, float* vel_y, float* vel_z);
2889 
2890  /*l
2891  *b Description:
2892  **
2893  ** Currently only used by the Adaptive guide
2894  **
2895  *b Arguments:
2896  **
2897  *a vel_x, vel_y, vel_z - meters/sec
2898  */
2899  void set_desired_velocity(float vel_x, float vel_y, float vel_z);
2900 
2901  /*l
2902  *b Description:
2903  **
2904  ** Retrieves the current estimated angular velocity of the character.
2905  ** As above, changes made to characters independent of DI-Guy
2906  ** function calls will temporarily make this value incorrect.
2907  **
2908  ** Currently only the angular velocity in yaw is measured.
2909  **
2910  *b Arguments:
2911  **
2912  *a vel_rz - degrees/sec
2913  **
2914  ** Pass NULL for any values that are not needed.
2915  **
2916  */
2917  void get_angular_velocity(float* vel_rz);
2918 
2919 
2920 /*****************************************************************************/
2926  /*l
2927  *b Description:
2928  **
2929  ** Returns the base appearance of the character, as passed to
2930  ** the function diguyScenario::create_character(). This pointer will
2931  ** never be NULL.
2932  **
2933  ** Note that the current appearance (as returned by
2934  ** get_current_appearance()) may be different than the base
2935  ** appearance. This base appearance is the starting appearance
2936  ** of the character before any calls to set_current_appearance()
2937  ** have been made.
2938  **
2939  *b Returns:
2940  **
2941  ** name of base appearance of the character
2942  */
2943  const char* get_appearance();
2944 
2945  /*l
2946  *b Description:
2947  **
2948  ** This function sets the base appearance of the character.
2949  ** The base appearance is the appearance the character will take
2950  ** if the scenario is reset, undoing any appearance changes made
2951  ** be calls to set_current_appearance().
2952  **
2953  ** Calling this function also makes an implicit call to
2954  ** set_current_appearance().
2955  **
2956  *b Arguments:
2957  **
2958  *a appearance - name of new base appearance
2959  **
2960  *b Returns:
2961  **
2962  ** 0 on success, -1 on failure
2963  */
2964  int set_appearance(const char* appearance);
2965 
2966  /*l
2967  *b Description:
2968  **
2969  ** This function sets the current appearance of this character.
2970  **
2971  ** Note that different appearances may be based on different actors.
2972  ** Different actors represent people of different sizes, so
2973  ** changing to an appearance that has a different actor can
2974  ** cause a pronounced change in character size.
2975  **
2976  ** Also, changing actors can take some time, as more internal
2977  ** character state needs to be updated to support the new size
2978  ** of the character.
2979  **
2980  *b Arguments:
2981  **
2982  *a appearance - name of new desired appearance
2983  *a allow_actor_change - pass 1 to allow the appearance change
2984  *a even if the actor changes, 0 to not
2985  **
2986  *b See Also:
2987  **
2988  ** get_current_appearance(), set_current_head_appearance()
2989  **
2990  *b Returns:
2991  **
2992  ** 0 on success, -1 on failure
2993  **
2994  *b Callable From:
2995  **
2996  *- - C++
2997  *- - Script
2998  *- - Decision Bead
2999  */
3000  int set_current_appearance(const char* appearance,
3001  int allow_actor_change = 1);
3002 
3003  /*l
3004  *b Returns:
3005  **
3006  ** current appearance; see set_current_appearance()
3007  */
3008  const char* get_current_appearance();
3009 
3010  /*l
3011  *b Description:
3012  **
3013  ** This function can be used to see if the current appearance
3014  ** has the passed name. This is primarily useful for decisions
3015  ** and other limited logic applications.
3016  **
3017  *b Returns:
3018  **
3019  ** 1 if current appearance has passed name; 0 if not
3020  **
3021  *b Callable From:
3022  **
3023  *- - C++
3024  *- - Script
3025  *- - Decision
3026  */
3027  int get_current_appearance_is(const char* appearance);
3028 
3029  /*l
3030  *b Description:
3031  **
3032  ** This function sets the current head appearance of this character.
3033  **
3034  *b Arguments:
3035  **
3036  *a head_appearance - name of the new desired head appearance
3037  **
3038  *b Returns:
3039  **
3040  ** 0 on success, -1 on failure
3041  **
3042  *b Callable From:
3043  **
3044  *- - C++
3045  *- - Script
3046  *- - Decision Bead
3047  */
3048  int set_current_head_appearance(const char* head_appearance);
3049 
3050  /*l
3051  *b Returns:
3052  **
3053  ** current head appearance; see set_current_head_appearance()
3054  */
3055  const char* get_current_head_appearance();
3056 
3057  /*l
3058  *b Description:
3059  **
3060  ** Similar to get_current_appearance_is(), but for head appearance.
3061  **
3062  *b Returns:
3063  **
3064  ** 1 if current head appearance has passed name; 0 if not
3065  **
3066  *b Callable From:
3067  **
3068  *- - C++
3069  *- - Script
3070  *- - Decision
3071  */
3072  int get_current_head_appearance_is(const char* head_appearance);
3073 
3074 
3075 /*****************************************************************************/
3098  /*l
3099  *b Description:
3100  **
3101  ** Sets the graphics level of detail (LOD) ranges for this character.
3102  ** Compare with diguyScenario::set_default_lod_ranges(), which sets
3103  ** the LOD ranges for newly created characters of a particular type.
3104  ** In both cases, ranges must be a static array of 8 floats,
3105  ** each larger than the one before.
3106  **
3107  ** This function sets graphics LOD ranges only. Motion levels of
3108  ** detail can be set by calling set_motion_lod().
3109  **
3110  *b Arguments:
3111  **
3112  *a lod_ranges - new lod ranges for this character;
3113  **
3114  ** See diguyScenario::set_default_lod_ranges() for a description
3115  ** of what to pass in lod_ranges.
3116  **
3117  *b Returns:
3118  **
3119  ** 0 on success, -1 on failure
3120  **
3121  *b Callable From:
3122  **
3123  *- - C++
3124  */
3125  int set_lod_ranges(float* lod_ranges);
3126 
3127  /*l
3128  *b Description:
3129  **
3130  ** Set the desired graphics level of detail (LOD) for this character.
3131  ** This may be overridden if this character uses automatic LOD
3132  ** switching. See
3133  ** diguyScenario::set_automatic_graphics_lod_switching().
3134  **
3135  ** DI-Guy graphics LODs are numbered 1 (most detail) through 7
3136  ** (least detail).
3137  **
3138  *b Arguments:
3139  **
3140  *a lod - an integer between 1 and 7
3141  **
3142  *b Returns:
3143  **
3144  ** 0 on success, -1 on failure
3145  */
3146  int set_graphics_lod(int lod);
3147 
3148  /*l
3149  *b Returns:
3150  **
3151  ** current graphics LOD
3152  */
3153  int get_graphics_lod();
3154 
3155  /*l
3156  *b Description:
3157  **
3158  ** Set the desired shader level of detail (LOD) for this character.
3159  ** By default this is -1 and the shader is automatically picked by distance.
3160  **
3161  ** DI-Guy shaders LODs are numbered 1 (most quality) through the number of shaders in the
3162  ** current technique.
3163  **
3164  *b Arguments:
3165  **
3166  *a lod - an integer between 1 and the number of shaders in the current technique
3167  **
3168  *b Returns:
3169  **
3170  ** 0 on success, -1 on failure
3171  */
3172  int set_shader_lod(int lod);
3173 
3174  /*l
3175  *b Returns:
3176  **
3177  ** current shader LOD
3178  */
3179  int get_shader_lod();
3180 
3181  /*l
3182  *b Description:
3183  **
3184  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3185  ** multi-threaded pipeline for increasing performance.
3186  **
3187  ** Sets the motion level of detail (LOD) for this character.
3188  ** LOD 1 animates all joints of a character. Higher LODs
3189  ** animate fewer joints.
3190  **
3191  ** For LOD 6, *nothing* in the pose is updated. The character's
3192  ** pose will remain whatever it was the last time pose data
3193  ** was changed.
3194  **
3195  *a LOD - Effect
3196  *a 1 - animate all joints
3197  *a 2 - stop animating wrists and ankles
3198  *a 3 - stop animating elbows and knees
3199  *a 4 - stop animating everything but pelvis and position
3200  *a 5 - stop animating everything but position
3201  *a 6 - stop animating everything but position
3202  **
3203  ** Note that characters that are load managed
3204  ** (get_is_load_managed() returns 1) have this parameter managed
3205  ** automatically. The corresponding function for load managed
3206  ** characters is diguyLoadManager::set_zone_motion_lod().
3207  **
3208  *b Arguments:
3209  **
3210  *a motion_lod - an integer between 1 and 6
3211  **
3212  *b Returns:
3213  **
3214  ** 0 on success, -1 on failure
3215  */
3216  int set_motion_lod(int motion_lod);
3217 
3218  /*l
3219  *b Returns:
3220  **
3221  ** character's current motion LOD setting; see set_motion_lod()
3222  */
3223  int get_motion_lod();
3224 
3225  /*l
3226  *b Returns:
3227  **
3228  ** character's current motion LOD based on load manangement and culling; see set_motion_lod()
3229  */
3230  int get_current_motion_lod();
3231 
3232  /*l
3233  *b Description:
3234  **
3235  *b Note: As of DI-Guy 12.5 we strongly recommend using the
3236  ** multi-threaded pipeline for increasing performance.
3237  **
3238  ** This function sets the minimum CPL (character performance
3239  ** level) of the character.
3240  **
3241  ** A higher CPL will limit the types of operations that the character
3242  ** can perform, but will allow for more optimized update() calls.
3243  **
3244  ** The following CPL limitations are cumulative:
3245  **
3246  *- - CPL 1: all character function calls are available
3247  *- - CPL 2: the character cannot save history
3248  *- - CPL 3: no advanced pose operations that alter the basic pose
3249  *- of the character, including:
3250  *>
3251  *- - gazing
3252  *- - pointing
3253  *- - aiming
3254  *- - gestures
3255  *- - head nodding and shaking
3256  *- - pose overrides
3257  *- - features relying on link matrices
3258  *- - wheel rolling and turning on vehicles
3259  **
3260  ** Since link matrices are not computed, the DI-Guy Graphics API
3261  ** function diguyGraphicsLink::get_transformation_matrix() will
3262  ** not return valid results.
3263  *<
3264  *- - CPL 4: no blends between motions
3265  *- - CPL 5: (not currently implemented)
3266  **
3267  ** Note that characters that are load managed (get_is_load_managed()
3268  ** returns 1) have this parameter managed automatically. The
3269  ** corresponding function for load managed characters is
3270  ** diguyLoadManager::set_zone_minimum_cpl().
3271  **
3272  ** The passed minimum_cpl may not be achievable if the character
3273  ** is already in the process of doing something not allowed by the
3274  ** new CPL. For example, if the character is already gazing, trying
3275  ** to set the minimum CPL to 3 will fail, as CPL 3 would disable
3276  ** gazing. In this case the minimum CPL will be set to the current
3277  ** highest possible CPL based on what the character is already doing.
3278  ** In this example the minimum CPL would be set to 2, as gazing is
3279  ** allowed at that CPL.
3280  **
3281  ** Conversely, if the minimum CPL has been successfully been set to
3282  ** 3 or higher, any gaze calls such as diguyCharacter::gaze_at_point()
3283  ** will fail.
3284  **
3285  *b Arguments:
3286  **
3287  *a cpl - minimum CPL allowed for this character
3288  **
3289  *b Returns:
3290  **
3291  ** 0 on success, -1 on failure
3292  */
3293  int set_minimum_cpl(int minimum_cpl);
3294 
3295  /*l
3296  *b Returns:
3297  **
3298  ** most recent setting of set_minimum_cpl()
3299  */
3300  int get_minimum_cpl();
3301 
3302  /*l
3303  *b Description:
3304  **
3305  ** This function returns that maximum possible CPL the character
3306  ** can attain based on what it is currently doing. Advanced pose
3307  ** operations like gazing and pose overrides will limit the maximum
3308  ** CPL that can be achieved.
3309  **
3310  ** See diguyCharacter::set_minimum_cpl() for a description of
3311  ** what is possible under the different CPL levels.
3312  **
3313  *b Returns:
3314  **
3315  ** maximum possible current CPL
3316  */
3317  int get_maximum_possible_current_cpl();
3318 
3319  /*l
3320  *b Description:
3321  **
3322  ** This function puts the character into the maximum possible CPL
3323  ** that can be achieved based on what the character is currently
3324  ** doing.
3325  **
3326  ** This current CPL does not prevent the character from starting
3327  ** operations that will potentially lower the CPL. e.g., if the
3328  ** character starts gazing, the CPL will potentially go down.
3329  ** Use set_minimum_cpl() to prevent that character from starting
3330  ** such operations.
3331  **
3332  ** See diguyCharacter::set_minimum_cpl() for a description of
3333  ** what is possible under the different CPL levels.
3334  **
3335  *b Returns:
3336  **
3337  ** 0 on success, -1 on failure
3338  */
3339  int maximize_current_cpl();
3340 
3341  /*l
3342  *b Description:
3343  **
3344  ** This function sets a flag that determines whether the character
3345  ** should raise and lower its CPL automatically. If automatic
3346  ** CPL switching is enabled then any time a potential CPL-changing
3347  ** operation is performed, the character will check the maximum
3348  ** possible current CPL (as per a call to maximize_current_cpl())
3349  ** and set its current CPL to the maximum possible.
3350  **
3351  *b Arguments:
3352  **
3353  *a enabled - pass 1 to enable automatic CPL switching, 0 to
3354  *a disable it
3355  **
3356  *b Returns:
3357  **
3358  ** 0 on success, -1 on failure
3359  */
3360  int set_automatic_cpl_switching_enabled(int enabled);
3361 
3362  /*l
3363  *b Returns:
3364  **
3365  ** most recent setting of get_automatic_cpl_switching_enabled()
3366  */
3367  int get_automatic_cpl_switching_enabled();
3368 
3369  /*l
3370  *b Description:
3371  **
3372  ** This function sets the current CPL of the character. Trying
3373  ** to set the CPL lower than the minimum (as set by
3374  ** set_minimum_cpl()) of higher than the maximum (as returned by
3375  ** get_maximum_possible_current_cpl()) will fail.
3376  **
3377  ** Note that characters that have automatic CPL switching enabled
3378  ** (get_automatic_cpl_switching_enabled() returns 1) will override
3379  ** this value.
3380  **
3381  ** See diguyCharacter::set_minimum_cpl() for a description of
3382  ** what is possible under the different CPL levels.
3383  **
3384  *b Arguments:
3385  **
3386  *a cpl - new current CPL
3387  **
3388  *b Returns:
3389  **
3390  ** 0 on success, -1 on failure
3391  */
3392  int set_current_cpl(int current_cpl);
3393 
3394  /*l
3395  *b Returns:
3396  **
3397  ** the current CPL the character is using
3398  */
3399  int get_current_cpl();
3400 
3401  /*l
3402  *b Description:
3403  **
3404  ** This function sets the position update rate of the character. If
3405  ** the character's position is not updated on a particular update
3406  ** tick, its position will not change for that tick. This can
3407  ** result is a modest performance increase.
3408  **
3409  ** The default value for new characters is 100.
3410  **
3411  ** This value may be overridden by the minimum full update period, as
3412  ** set by set_minimum_full_update_period().
3413  **
3414  ** Note that if the character's pose is updated, (see
3415  ** diguyCharacter::set_pose_update_rate()) its position will be
3416  ** updated as well.
3417  **
3418  ** Note that characters that are load managed
3419  ** (get_is_load_managed() returns 1) have this parameter managed
3420  ** automatically. The corresponding function for load managed
3421  ** characters is diguyLoadManager::set_zone_position_update_rate().
3422  **
3423  *b Arguments:
3424  **
3425  *a update_rate - percentage of scenario ticks for which
3426  *a position should update; can be between
3427  *a 1 and 100
3428  **
3429  ** Passing 100 means position will update every tick.
3430  ** Passing 50 means position will update every other tick.
3431  **
3432  *b Returns:
3433  **
3434  ** 0 on success, -1 on failure
3435  */
3436  int set_position_update_rate(int update_rate);
3437 
3438  /*l
3439  *b Returns:
3440  **
3441  ** character's position update rate as set by
3442  ** set_position_update_rate()
3443  */
3444  int get_position_update_rate();
3445 
3446  /*l
3447  *b Description:
3448  **
3449  ** This function is very similar to set_position_update_rate(), but
3450  ** sets the percentage of ticks for which the character's pose is
3451  ** updated.
3452  **
3453  ** The default value for new characters is 100.
3454  **
3455  ** This value may be overridden by the minimum full update period,
3456  ** as set by set_minimum_full_update_period().
3457  **
3458  ** Note that if the character's pose is updated, its position will
3459  ** be updated as well.
3460  **
3461  ** Note that characters that are load managed (get_is_load_managed()
3462  ** returns 1) have this parameter managed automatically. The
3463  ** corresponding function for load managed characters is
3464  ** diguyLoadManager::set_zone_pose_update_rate().
3465  **
3466  *b Arguments:
3467  **
3468  *a update_rate - percentage of scenario ticks for which
3469  *a pose should update; can be between
3470  *a 1 and 100
3471  **
3472  ** Passing 100 means pose will update every tick.
3473  ** Passing 50 means pose will update every other tick.
3474  **
3475  *b Returns:
3476  **
3477  ** 0 on success, -1 on failure
3478  */
3479  int set_pose_update_rate(int update_rate);
3480 
3481  /*l
3482  *b Returns:
3483  **
3484  ** character's pose update rate as set by
3485  ** set_pose_update_rate()
3486  */
3487  int get_pose_update_rate();
3488 
3489  /*l
3490  *b Description:
3491  **
3492  ** This function sets the minimum period for position or pose
3493  ** updates. If the passed amount of time passes with no position or
3494  ** pose update (see set_position_update_rate() and
3495  ** set_pose_update_rate()), the character's position and potentially
3496  ** pose will be updated.
3497  **
3498  ** Note that characters that are load managed (get_is_load_managed()
3499  ** returns 1) have this parameter managed automatically. The
3500  ** corresponding function for load managed characters is
3501  ** diguyLoadManager::set_minimum_full_update_period().
3502  **
3503  ** The default for new characters is 1.0 seconds.
3504  **
3505  *b Arguments:
3506  **
3507  *a min_period - in seconds
3508  **
3509  *b Returns:
3510  **
3511  ** 0 on success, -1 on failure
3512  */
3513  int set_minimum_full_update_period(float min_period);
3514 
3515  /*l
3516  *b Returns:
3517  **
3518  ** character's minimum full update period, as set by
3519  ** set_minimum_full_update_period()
3520  */
3521  float get_minimum_full_update_period();
3522 
3523  /*l
3524  *b Description:
3525  **
3526  ** This function disables position accumulation due to played
3527  ** actions. The character will stay in whatever position has most
3528  ** recently been set by set_position(), regardless of action.
3529  ** Because of this the character will, for example, walk in place.
3530  ** It is up to the user application to correctly set and update the
3531  ** character's position.
3532  **
3533  ** This function can be used when a host application provides
3534  ** absolute control over character positions.
3535  **
3536  ** Disabling position accumulation will result in a modest
3537  ** performance increase.
3538  **
3539  *b Arguments:
3540  **
3541  *a disabled_flag - pass 1 to disable position accumulation, 0
3542  *a to enable it
3543  **
3544  *b Returns:
3545  **
3546  ** 0 on success, -1 on failure
3547  */
3548  int set_position_accumulation_disabled(int disabled_flag);
3549 
3550  /*l
3551  *b Returns:
3552  **
3553  ** most recent setting of set_position_accumulation_disabled()
3554  */
3555  int get_position_accumulation_disabled();
3556 
3557  /*l
3558  *b Description:
3559  **
3560  ** This function disables all blends between motions of the
3561  ** character. This will speed up performance at the expense of
3562  ** visual quality of the motions. If the character is far from the
3563  ** current camera position, however, the lack of blends may be
3564  ** visually acceptable.
3565  **
3566  ** Note that characters that are load managed (get_is_load_managed()
3567  ** returns 1) have this parameter managed automatically.
3568  **
3569  *b Arguments:
3570  **
3571  *a disabled_flag - pass 1 to disable all blends, 0
3572  *a to enable them
3573  **
3574  *b Returns:
3575  **
3576  ** 0 on success, -1 on failure
3577  */
3578  int set_all_blends_disabled(int disabled_flag);
3579 
3580  /*l
3581  *b Returns:
3582  **
3583  ** most recent setting of set_all_blends_disabled()
3584  */
3585  int get_all_blends_disabled();
3586 
3587  /*l
3588  *b Description:
3589  **
3590  *b Note: This function is not recommend. There is minimal perf gain.
3591  ** This function disables all update calls for shape switches.
3592  **
3593  ** Switches currently control:
3594  **
3595  *- - muzzle flashes
3596  *- - hand switching for selected characters
3597  **
3598  ** For DI-Guy Graphics API users this means that most calls to
3599  ** diguyGraphicsShape::show() and diguyGraphicsShape::hide() will not
3600  ** be made.
3601  **
3602  ** Note that characters that are load managed (get_is_load_managed()
3603  ** returns 1) have this parameter managed automatically.
3604  **
3605  *b Arguments:
3606  **
3607  *a disabled_flag - pass 1 to disable shape switches, 0
3608  *a to enable them
3609  **
3610  *b Returns:
3611  **
3612  ** 0 on success, -1 on failure
3613  */
3614  int set_shape_switches_disabled(int disabled_flag);
3615 
3616  /*l
3617  *b Returns:
3618  **
3619  ** most recent setting of set_shape_switches_disabled()
3620  */
3621  int get_shape_switches_disabled();
3622 
3623  /*l
3624  *b Description:
3625  **
3626  *b Note: This function is not recommend. There is minimal perf gain.
3627  ** This function disables all shape callbacks. Shape callbacks are
3628  ** used internally for updating some advanced visual effects.
3629  **
3630  ** Shape callbacks currently control:
3631  **
3632  *- - expressive faces
3633  *- - particle systems
3634  **
3635  ** Disabling shape callbacks will make these visual effects work
3636  ** incorrectly but will result in a performance increase for
3637  ** characters that do not use them.
3638  **
3639  ** Note that characters that are load managed (get_is_load_managed()
3640  ** returns 1) have this parameter managed automatically.
3641  **
3642  *b Arguments:
3643  **
3644  *a disabled_flag - pass 1 to disable shape callbacks, 0
3645  *a to enable them
3646  **
3647  *b Returns:
3648  **
3649  ** 0 on success, -1 on failure
3650  */
3651  int set_shape_callbacks_disabled(int disabled_flag);
3652 
3653  /*l
3654  *b Returns:
3655  **
3656  ** most recent setting of set_shape_callbacks_disabled()
3657  */
3658  int get_shape_callbacks_disabled();
3659 
3660  /*l
3661  *b Description:
3662  **
3663  *b Note: This function is not recommend. There is minimal perf gain.
3664  ** This function disables all calls to the virtual diguyGraphicsShape::update()
3665  ** function.
3666  **
3667  ** Note that characters that are load managed (get_is_load_managed()
3668  ** returns 1) have this parameter managed automatically.
3669  **
3670  *b Arguments:
3671  **
3672  *a disabled_flag - pass 1 to disable update calls, 0
3673  *a to enable them
3674  **
3675  *b Returns:
3676  **
3677  ** 0 on success, -1 on failure
3678  */
3679  int set_graphics_api_shape_update_disabled(int disabled_flag);
3680 
3681  /*l
3682  *b Returns:
3683  **
3684  ** most recent setting of set_graphics_api_shape_update_disabled()
3685  */
3686  int get_graphics_api_shape_update_disabled();
3687 
3688  /*l
3689  *b Description:
3690  **
3691  ** This function is a stripped-down version of the normal update()
3692  ** function. This function is for high performance applications that
3693  ** are willing to sacrifice advanced character functionality in
3694  ** exchange for faster performance.
3695  **
3696  ** Characters using optimized_update() must not do any of the
3697  ** following:
3698  **
3699  *- - change character types (e.g., set_character_type())
3700  *- - play sounds (e.g., play_sound())
3701  *- - use history (e.g., set_history_type())
3702  *- - use paths (e.g., push_path())
3703  *- - weapon firing (e.g., fire_weapon())
3704  *- - advanced pose operations (as per CPL 3)
3705  *- - be a DI-Guy Network Module character
3706  *- - need to use character callbacks
3707  *- - use advanced visual effects, such as expressive faces
3708  *- and particle systems
3709  **
3710  ** Like update(), the scenario must not call the character's update()
3711  ** function (return value of get_t_controlled_by_scenario_t() is 0)
3712  ** for this function to work properly.
3713  **
3714  ** In some cases the regular update() call can be used for a time in
3715  ** place of optimized_update() if one of the above operations is
3716  ** desired.
3717  **
3718  *b Arguments:
3719  **
3720  *a t - new time for the character
3721  **
3722  *b Returns:
3723  **
3724  ** 0 on success, -1 on failure
3725  */
3726  int optimized_update(float t);
3727 
3728  /*l
3729  *b Description:
3730  **
3731  ** This function sets whether many of the performance tuning
3732  ** functions above are automatically managed by a diguyLoadManager
3733  ** object, which can be obtained by calling
3734  ** diguyApp::create_load_manager().
3735  **
3736  ** Note that this function will have no effect if a load manager has
3737  ** not been enabled.
3738  **
3739  ** The default for new characters is to be load managed if the load
3740  ** manager has been enabled.
3741  **
3742  *b Arguments:
3743  **
3744  *a is_load_managed - pass 1 to have character automatically
3745  *a load managed, 0 for manual management
3746  **
3747  *b Returns:
3748  **
3749  ** 0 on success, -1 on failure
3750  */
3751  int set_is_load_managed(int is_load_managed);
3752 
3753  /*l
3754  *b Returns:
3755  **
3756  ** most recent setting of set_graphics_api_shape_update_disabled()
3757  */
3758  int get_is_load_managed();
3759 
3760 
3761 /*****************************************************************************/
3771  /*l
3772  *b Description:
3773  **
3774  ** This is an enumeration of the different callbacks that can be
3775  ** registered with add_callback() and add_callback_script().
3776  **
3777  ** Callbacks return a value of type diguyCallbackReturn, which will
3778  ** be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the
3779  ** callback returns DIGUY_CALLBACK_STOP, in some cases the default
3780  ** handler of the function will not be called; the callback is
3781  ** asserting that it has done everything necessary for the function
3782  ** call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default
3783  ** handler for the function will be called after the callback.
3784  **
3785  *b Usable From:
3786  **
3787  *- - C++
3788  *- - Script
3789  **
3790  *************************************************************************
3791  *4 Callback Enums:
3792  **
3793  *i CALLBACK_ID_CREATE
3794  **
3795  ** This callback will be called when a new character is created,
3796  ** *after* the character is fully initialized.
3797  **
3798  ** Note that this callback can only be added by calling
3799  ** diguyScenario::add_default_character_callback(); adding it with
3800  ** diguyCharacter::add_callback() will have no effect, as by that
3801  ** time the character has already been created.
3802  **
3803  *i CALLBACK_ID_DESTROY
3804  **
3805  ** This callback will be called when a character is
3806  ** destroyed.
3807  **
3808  *i CALLBACK_ID_PRE_CREATE
3809  **
3810  ** Like CALLBACK_ID_CREATE, this callback will be called when a
3811  ** new character is created; however, it is called *before* the
3812  ** character is fully initialized.
3813  **
3814  *b NOTE: Care must be taken when using this callback!
3815  ** As mentioned above, the character is not fully initialized,
3816  ** meaning that most member functions of the diguyCharacter object
3817  ** should not be called. Those member functions that are safe
3818  ** to call will be mentioned in the documentation for the function;
3819  ** e.g., set_graphics_api_node_ptr().
3820  **
3821  ** Note that this callback can only be added by calling
3822  ** diguyScenario::add_default_character_callback(); adding it
3823  ** with diguyCharacter::add_callback() will have no effect, as
3824  ** by that time the character has already been created.
3825  **
3826  *i CALLBACK_ID_CURRENT_APPEARANCE_CHANGED
3827  **
3828  ** This callback will be called when a character's current
3829  ** appearance is changed.
3830  **
3831  *i CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED
3832  **
3833  ** This callback will be called when a character's current head
3834  ** appearance is changed.
3835  **
3836  *i CALLBACK_ID_PRE_UPDATE
3837  **
3838  ** This callback will be called before the character is updated as
3839  ** a result of the diguyScenario::update() function.
3840  **
3841  *i CALLBACK_ID_POST_UPDATE
3842  **
3843  ** This callback will be called after the character is updated as a
3844  ** result of the diguyScenario::update() function.
3845  **
3846  *i CALLBACK_ID_DONE_SPEAKING
3847  **
3848  ** This callback will be called when the character has finished
3849  ** speaking the contents of a speak() function call.
3850  **
3851  *i CALLBACK_ID_GAZE_STATUS
3852  **
3853  ** This callback will be called after the character's gaze has
3854  ** experienced a status change.
3855  **
3856  *i CALLBACK_ID_LPOINT_STATUS
3857  **
3858  ** This callback will be called after the character's lpoint (left
3859  ** arm pointing) has experienced a status change.
3860  **
3861  *i CALLBACK_ID_SHOW
3862  **
3863  ** This callback will be called when the character is being shown
3864  ** for any reason.
3865  **
3866  *i CALLBACK_ID_HIDE
3867  **
3868  ** This callback will be called when the character is being hidden
3869  ** for any reason.
3870  **
3871  *i CALLBACK_ID_PRE_DIE
3872  **
3873  ** This callback will be called when the character has been told to
3874  ** die, before a die action has been selected and initiated.
3875  **
3876  ** If the returned diguyCallbackReturn value is
3877  ** DIGUY_CALLBACK_STOP, the character will not die.
3878  **
3879  *i CALLBACK_ID_POST_DIE
3880  **
3881  ** This callback will be called when the character has been told to
3882  ** die, after a die action has been selected and initiated.
3883  **
3884  *i CALLBACK_ID_PRE_FIRE_WEAPON
3885  **
3886  ** This callback will be called when the character has been told to
3887  ** fire its weapon, before a final decision has been made to fire.
3888  **
3889  ** If the returned diguyCallbackReturn value is
3890  ** DIGUY_CALLBACK_STOP, the character will not fire.
3891  **
3892  *i CALLBACK_ID_IMPACT
3893  **
3894  ** This callback will be called when the character has been hit.
3895  ** diguyCharacter::get_last_impact_record() contains a pointer to
3896  ** the impact information. If a character has this callback the
3897  ** standard behavior (killing the character) is skipped and the
3898  ** system assumes the end user has handled the impact.
3899  **
3900  ** Similar behavior results if
3901  ** diguyCrowd::CALLBACK_ID_CROWD_MEMBER_IMPACT is registered.
3902  **
3903  *i CALLBACK_ID_POST_FIRE_WEAPON
3904  **
3905  ** This callback will be called when the character has been told to
3906  ** fire its weapon, after a final decision has been made to fire.
3907  **
3908  *i CALLBACK_ID_CURRENT_ACTION_CHANGED
3909  **
3910  ** This callback will be called whenever the character's current
3911  ** action changes, typically after a call to set_desired_action()
3912  ** or force_action().
3913  **
3914  *i CALLBACK_ID_DESIRED_ACTION_CHANGED
3915  **
3916  ** This callback will be called whenever the character's desired
3917  ** action changes, typically after a call to set_desired_action().
3918  **
3919  *i CALLBACK_ID_DESIRED_ACTION_REACHED
3920  **
3921  ** This callback will be called when the character reaches its
3922  ** desired action as set by a call to set_desired_action().
3923  **
3924  *i CALLBACK_ID_MANUALLY_INVOKED
3925  **
3926  ** This callback id will be supplied to event handlers invoked by a
3927  ** call to manually_invoke_event_handler().
3928  **
3929  *i CALLBACK_ID_USER_SELECTED
3930  **
3931  ** This callback will be called when the character is selected in DI-Guy Scenario.
3932  **
3933  *i CALLBACK_ID_USER_UNSELECTED
3934  **
3935  ** This callback will be called on a currently selected character when a different
3936  ** character is selected in DI-Guy Scenario.
3937  **
3938  *i CALLBACK_ID_IGUY_INTERACT
3939  **
3940  ** This callback will be called when the character has been clicked
3941  ** on while DI-Guy Scenario is in I-Guy Input Mode. Note that this
3942  ** is called on the character clicked, not the I-Guy character.
3943  **
3944  *i CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT
3945  **
3946  ** This callback will be called when the character, as the I-Guy
3947  ** character, has clicked another character in I-Guy Input Mode.
3948  ** Note that this is called for the I-Guy character, not the
3949  ** clicked character.
3950  **
3951  *i CALLBACK_ID_GUIDE_POSITION_ACQUIRED
3952  **
3953  ** This callback will be called when the character has reached its
3954  ** desired position as set by set_desired_position().
3955  **
3956  *i CALLBACK_ID_GUIDE_POSITION_UNACQUIRED
3957  **
3958  ** This callback will be called if the character moves too far away
3959  ** from its desired position after it has been previously reached.
3960  **
3961  *i CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED
3962  **
3963  ** This callback will be called when the character has reached its
3964  ** desired orientation as set by set_desired_orientation().
3965  **
3966  *i CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED
3967  **
3968  ** This callback will be called if the character turns too far away
3969  ** from its desired orientation after it has been previously
3970  ** reached.
3971  **
3972  *i CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED
3973  **
3974  ** This callback will be called when the character has reached its
3975  ** desired altitude as set by set_desired_orientation() or other functions.
3976  **
3977  *i CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED
3978  **
3979  ** This callback will be called if the character turns too far away
3980  ** from its desired orientation after it has been previously
3981  ** reached.
3982  **
3983  *i CALLBACK_ID_CURRENT_TOUT_REACHED
3984  **
3985  ** This callback will be called when scenario time reaches this
3986  ** character's tout time as set by set_current_tout().
3987  **
3988  *i CALLBACK_ID_POST_CREATE_GEOMETRY
3989  **
3990  ** This callback will be called just after the character's geometry
3991  ** has been created.
3992  **
3993  *i CALLBACK_ID_PRE_DESTROY_GEOMETRY
3994  **
3995  ** This callback will be called just before the character's
3996  ** geometry is broken down and destroyed.
3997  **
3998  *i CALLBACK_ID_END_OF_PATH_REACHED
3999  **
4000  ** This callback will be called when a character reaches the end of
4001  ** their current path. Note the path must finish, forcing to other
4002  ** paths will not trigger this callback.
4003  **
4004  **
4005  *************************************************************************
4006  *4 DI-Guy Scenario UI Callback enums:
4007  **
4008  *i CALLBACK_ID_UI_PRE_TRANSLATION
4009  **
4010  ** This callback will be called when the user interface starts
4011  ** moving a character.
4012  **
4013  *i CALLBACK_ID_UI_POST_TRANSLATION
4014  **
4015  ** This callback will be called when the user interface finishes
4016  ** moving a character.
4017  **
4018  *i CALLBACK_ID_UI_MOUSE_DOWN
4019  **
4020  ** This callback will be called when the user interface gets a
4021  ** mouse click in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT input
4022  ** mode.
4023  **
4024  *i CALLBACK_ID_UI_MOUSE_UP
4025  **
4026  ** This callback will be called when the user interface gets a
4027  ** mouse release in the DIGUY_SCENARIO_INPUT_MODE_POINT_SELECT
4028  ** input mode.
4029  **
4030  *************************************************************************
4031  *4 DI-Guy AI Agent Callback enums:
4032  **
4033  *i CALLBACK_ID_AGENT_NEW_BEHAVIOR
4034  **
4035  ** This callback will be called when an agent changes its current
4036  ** behavior.
4037  **
4038  *i CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER
4039  **
4040  ** This callback will be called when an agent changes its current
4041  ** focus character; this happens most frequently when it is focused
4042  ** on a group.
4043  **
4044  *i CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS
4045  **
4046  ** This callback will be called when an agent in attack behavior
4047  ** evaluates the group it's focused on and cannot find an
4048  ** appropriate target. This can happen if all group members are
4049  ** dead.
4050  **
4051  *i CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS
4052  **
4053  ** This callback will be called when an agent in attack behavior
4054  ** can't see any potential members of the group it's focused on.
4055  **
4056  *i CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED
4057  **
4058  ** This callback will be called when an agent in pursue behavior
4059  ** has come within the pursuit distance of its pursuit target.
4060  **
4061  *i CALLBACK_ID_AGENT_PURSUE_TARGET_LOST
4062  **
4063  ** This callback will be called when an agent in pursue behavior
4064  ** is no longer within the pursuit distance of its pursuit target.
4065  **
4066  *i CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED
4067  **
4068  ** This callback will be called when an agent in mingle behavior
4069  ** has reached its mingle target.
4070  **
4071  *i CALLBACK_ID_AGENT_MINGLE_TARGET_LOST
4072  **
4073  ** This callback will be called when an agent in mingle behavior
4074  ** is no longer is range of its mingle target.
4075  **
4076  *i CALLBACK_ID_AGENT_WANDER_TARGET_REACHED
4077  **
4078  ** This callback will be called when an agent in wander behavior
4079  ** has reached its wander target.
4080  **
4081  *i CALLBACK_ID_AGENT_WANDER_TARGET_LOST
4082  **
4083  ** This callback will be called when an agent in wander behavior
4084  ** is no longer is range of its wander target.
4085  **
4086  *i CALLBACK_ID_AGENT_FLEE_AREA_LEFT
4087  **
4088  ** This callback will be called when an agent in flee behavior has
4089  ** successfully moved out range of all fled characters or
4090  ** locations. This will only be called when the agent is
4091  ** transitioning from inside the flee area to outside of it.
4092  **
4093  *i CALLBACK_ID_AGENT_FLEE_AREA_ENTERED
4094  **
4095  ** This callback will be called when an agent in flee behavior has
4096  ** moved inside of the range of any fled characters or locations.
4097  ** This will only be called when the agent is transitioning from
4098  ** outside the flee area to inside of it.
4099  **
4100  *i CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED
4101  **
4102  ** This callback will be called when an agent in travel behavior
4103  ** has reached in intermediate waypoint and is about to move
4104  ** on to the next.
4105  **
4106  *i CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
4107  **
4108  ** This callback will be called when an agent in travel behavior
4109  ** has reached the end of its travel path when moving forward
4110  ** along the path.
4111  **
4112  *i CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED
4113  **
4114  ** This callback will be called when an agent in travel behavior
4115  ** has reached the beginning of its travel path when moving
4116  ** backward along the path.
4117  **
4118  *i CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED
4119  **
4120  ** This callback will be called when fellow member of the crowd is
4121  ** killed.
4122  **
4123  *- - This is the character version of
4124  *- diguyCrowd::CALLBACK_ID_CROWD_MEMBER_KILLED
4125  *- - The crowd's callback character is the crowd member that was
4126  *- killed.
4127  *- - The crowd's callback impact contains the impact information.
4128  **
4129  *i CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT
4130  **
4131  ** This callback will be called when a fellow member of the crowd
4132  ** is hit by a detonation. This callback does not replace
4133  ** diguyCharacter::CALLBACK_ID_IMPACT, which still needs to be
4134  ** handled to implement damage models.
4135  **
4136  *- - The crowd's callback character is the crowd member that was
4137  *- hit.
4138  *- - The crowd's callback impact contains the impact information.
4139  **
4140  *i CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT
4141  **
4142  ** This callback will be called when a detonation occurs within the
4143  ** awareness radius (as set by set_awareness_radius()) of the
4144  ** crowd's current bounds.
4145  **
4146  *- - This is the character version of
4147  *- diguyCrowd::CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT
4148  *- - The crowd's callback character is the character that caused
4149  *- the detonation.
4150  *- - The crowd's callback impact contains the impact information.
4151  **
4152  *i CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED
4153  **
4154  ** This callback will be called when a weapon is fired within the
4155  ** awareness radius (as set by set_awareness_radius()) of the
4156  ** crowd's current bounds.
4157  **
4158  *- - The crowd's callback character is the character that fired the
4159  *- weapon.
4160  **
4161  *i CALLBACK_ID_AGENT_VEHICLE_COLLISION
4162  **
4163  ** This callback will be called on a vehicle agent when it hits a
4164  ** member of a companion crowd.
4165  **
4166  *i CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION
4167  **
4168  ** This callback will be called on a vehicle agent when it
4169  ** approaches another vehicle.
4170  **
4171  *i CALLBACK_ID_AGENT_NON_ZERO_REPULSION
4172  **
4173  ** This callback will be called when an agent character's repulsion
4174  ** forces become non-zero.
4175  **
4176  *i CALLBACK_ID_AGENT_ZERO_REPULSION
4177  **
4178  ** This callback will be called when an agent character's repulsion
4179  ** forces become zero.
4180  **
4181  *i CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED
4182  **
4183  ** This callback will be called when a character who's requested a
4184  ** path plan via the background path planner
4185  ** (agent_move_to_point_bg) gets a path result. Call
4186  ** diguyCharacter::get_path_planning_result() to get the status of
4187  ** the result.
4188  **
4189  *i CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED
4190  **
4191  ** This callback will be called when the current state the agent's
4192  ** mind, if it has one, has changed. Call
4193  ** diguyCharacter::get_mind_current_state_name() to get the new
4194  ** state name.
4195  */
4196  enum {
4197  CALLBACK_ID_CREATE = 1,
4198  CALLBACK_ID_DESTROY,
4199  CALLBACK_ID_PRE_CREATE,
4200  CALLBACK_ID_CURRENT_APPEARANCE_CHANGED,
4201  CALLBACK_ID_CURRENT_HEAD_APPEARANCE_CHANGED,
4202  CALLBACK_ID_PRE_UPDATE,
4203  CALLBACK_ID_POST_UPDATE,
4204  CALLBACK_ID_DONE_SPEAKING,
4205  CALLBACK_ID_GAZE_STATUS,
4206  CALLBACK_ID_LPOINT_STATUS,
4207  CALLBACK_ID_SHOW,
4208  CALLBACK_ID_HIDE,
4209  CALLBACK_ID_PRE_DIE,
4210  CALLBACK_ID_POST_DIE,
4211  CALLBACK_ID_PRE_FIRE_WEAPON,
4212  CALLBACK_ID_POST_FIRE_WEAPON,
4213  CALLBACK_ID_IMPACT,
4214  CALLBACK_ID_FIRE_WEAPON_SUCCESS,
4215  CALLBACK_ID_CURRENT_ACTION_CHANGED,
4216  CALLBACK_ID_DESIRED_ACTION_CHANGED,
4217  CALLBACK_ID_DESIRED_ACTION_REACHED,
4218  CALLBACK_ID_MANUALLY_INVOKED,
4219  CALLBACK_ID_USER_SELECTED,
4220  CALLBACK_ID_USER_UNSELECTED,
4221  CALLBACK_ID_IGUY_INTERACT,
4222  CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT,
4223  CALLBACK_ID_GUIDE_POSITION_ACQUIRED,
4224  CALLBACK_ID_GUIDE_POSITION_UNACQUIRED,
4225  CALLBACK_ID_GUIDE_ORIENTATION_ACQUIRED,
4226  CALLBACK_ID_GUIDE_ORIENTATION_UNACQUIRED,
4227  CALLBACK_ID_GUIDE_ALTITUDE_ACQUIRED,
4228  CALLBACK_ID_GUIDE_ALTITUDE_UNACQUIRED,
4229  CALLBACK_ID_CURRENT_TOUT_REACHED,
4230  CALLBACK_ID_POST_CREATE_GEOMETRY,
4231  CALLBACK_ID_PRE_DESTROY_GEOMETRY,
4232  CALLBACK_ID_END_OF_PATH_REACHED,
4233 
4234  // DI-Guy Scenario UI callbacks:
4235  CALLBACK_ID_UI_PRE_TRANSLATION,
4236  CALLBACK_ID_UI_POST_TRANSLATION,
4237  CALLBACK_ID_UI_MOUSE_DOWN,
4238  CALLBACK_ID_UI_MOUSE_UP,
4239  CALLBACK_ID_UI_RIGHT_MOUSE_DOWN,
4240  CALLBACK_ID_UI_RIGHT_MOUSE_UP,
4241 
4242  // DI-Guy AI agent callbacks:
4243  CALLBACK_ID_AGENT_NEW_BEHAVIOR,
4244  CALLBACK_ID_AGENT_NEW_PATH_SHAPE,
4245  CALLBACK_ID_AGENT_NEW_FOCUS_CHARACTER,
4246  CALLBACK_ID_AGENT_ATTACK_OUT_OF_TARGETS,
4247  CALLBACK_ID_AGENT_ATTACK_NO_VISIBLE_TARGETS,
4248  CALLBACK_ID_AGENT_PURSUE_TARGET_REACHED,
4249  CALLBACK_ID_AGENT_PURSUE_TARGET_LOST,
4250  CALLBACK_ID_AGENT_MINGLE_TARGET_REACHED,
4251  CALLBACK_ID_AGENT_MINGLE_TARGET_LOST,
4252  CALLBACK_ID_AGENT_WANDER_TARGET_REACHED,
4253  CALLBACK_ID_AGENT_WANDER_TARGET_LOST,
4254  CALLBACK_ID_AGENT_FLEE_AREA_LEFT,
4255  CALLBACK_ID_AGENT_FLEE_AREA_ENTERED,
4256  CALLBACK_ID_AGENT_TRAVEL_WAYPOINT_REACHED,
4257  CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED,
4258  CALLBACK_ID_AGENT_TRAVEL_BACKWARD_DEST_REACHED,
4259  CALLBACK_ID_AGENT_CROWD_MEMBER_KILLED,
4260  CALLBACK_ID_AGENT_CROWD_MEMBER_IMPACT,
4261  CALLBACK_ID_AGENT_NEARBY_SCENE_OBJECT_IMPACT,
4262  CALLBACK_ID_AGENT_NEARBY_WEAPON_FIRED,
4263  CALLBACK_ID_AGENT_VEHICLE_COLLISION,
4264  CALLBACK_ID_AGENT_VEHICLE_NEAR_COLLISION,
4265  CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED,
4266  CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED,
4267  CALLBACK_ID_AGENT_NON_ZERO_REPULSION,
4268  CALLBACK_ID_AGENT_ZERO_REPULSION
4269  };
4270 
4271 #ifdef CPLUSPLUS_ONLY
4272 
4273  /*l
4274  *b Description:
4275  **
4276  ** This function adds a user callback. Callbacks can be removed
4277  ** with remove_callback() or remove_callback_with_user_data().
4278  **
4279  *b Arguments:
4280  **
4281  *a callback - pointer to function with prototype
4282  *a diguyCharacterCallback (typedefed above)
4283  *a callback_id - integer id of when this callback is to be called
4284  *a callback_params - not currently used; pass NULL
4285  *a callback_user_data - pointer for user's own use; DI-Guy will
4286  *a do nothing to the contents of this pointer
4287  *a beyond passing it back when the callback is
4288  *a invoked
4289  **
4290  *b Returns:
4291  **
4292  ** 0 on success, -1 on failure
4293  **
4294  *b Callable From:
4295  **
4296  *- - C++
4297  */
4298  int add_callback(int callback_id,
4299  diguyCharacterCallback* callback,
4300  void* callback_params = 0,
4301  void* callback_user_data = 0);
4302 
4303  /*l
4304  *b Description:
4305  **
4306  ** This function removes a user callback. All callbacks matching
4307  ** the specified callback_id and callback function will be removed.
4308  **
4309  *b Arguments:
4310  **
4311  *a callback_id - integer id of when this callback is to be called
4312  *a callback - pointer to function with prototype
4313  *a diguyCharacterCallback (typedefed above)
4314  **
4315  *b Returns:
4316  **
4317  ** 0 on success, -1 on failure
4318  **
4319  *b Callable From:
4320  **
4321  *- - C++
4322  */
4323  int remove_callback(int callback_id,
4324  diguyCharacterCallback* callback);
4325 
4326  /*l
4327  *b Description:
4328  **
4329  ** This function removes a user callback. All callbacks matching
4330  ** the specified callback_id and callback_user_data pointer will
4331  ** be removed.
4332  **
4333  *b Arguments:
4334  **
4335  *a callback_id - integer id of when this callback is to be
4336  *a called
4337  *a callback_user_data - pointer for user's own use
4338  **
4339  *b Returns:
4340  **
4341  ** 0 on success, -1 on failure
4342  **
4343  *b Callable From:
4344  **
4345  *- - C++
4346  */
4347  int remove_callback_with_user_data(int callback_id,
4348  void* callback_user_data);
4349 
4350 #endif
4351 
4352  /*l
4353  *b Description:
4354  **
4355  ** This function adds a user callback script. Callback scripts can
4356  ** be removed with remove_callback_script().
4357  **
4358  *b Arguments:
4359  **
4360  *a callback_id - integer id of the callback
4361  *a callback_script - script text of callback to be added
4362  *a callback_script_type - the type of script contained in
4363  *a callback_script
4364  **
4365  ** If NULL is passed for callback_script_type, a default script type
4366  ** will be derived based on the default script interpreter of the
4367  ** scenario.
4368  **
4369  *i lua specific:
4370  **
4371  ** When the script is called, the object for which it is being called
4372  ** will be in the callback_object global.
4373  **
4374  ** To pass NULL when calling from a lua script, use nil.
4375  **
4376  *b Returns:
4377  **
4378  ** 0 on success, -1 on failure
4379  **
4380  *b Lua Example:
4381  **
4382  *e -------------------------------------------------------------------
4383  *e local pre_fire_weapon_callback = [[
4384  *e
4385  *e local ch_name = callback_object:get_name();
4386  *e bdi_log_print(BDI_LOG_WARN, "Calling pre_fire_weapon_callback for character ".. ch_name .. ".\n");
4387  *e
4388  *e ]]
4389  *e -------------------------------------------------------------------
4390  *e
4391  *e character:add_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4392  *e pre_fire_weapon_callback,
4393  *e "lua");
4394  */
4395  int add_callback_script(int callback_id,
4396  const char* callback_script,
4397  const char* callback_script_type = NULL);
4398 
4399  /*l
4400  *b Description:
4401  **
4402  ** This function removes a user callback script previously added with
4403  ** add_callback_script().
4404  **
4405  *b Arguments:
4406  **
4407  *a callback_id - integer id of the callback
4408  *a callback_script - script text of callback previously added
4409  *a callback_script_type - the type of script contained in
4410  *a callback_script
4411  **
4412  ** If NULL is passed for callback_script, all callback
4413  ** scripts whose ids match callback_id and whose types match
4414  ** callback_script_type will be removed.
4415  **
4416  ** If NULL is passed for callback_script_type, a default script type
4417  ** will be derived based on the default script interpreter of the
4418  ** scenario.
4419  **
4420  *i lua specific:
4421  **
4422  ** To pass NULL when calling from a lua script, use nil.
4423  **
4424  *b Returns:
4425  **
4426  ** 0 on success, -1 on failure
4427  **
4428  *b lua Example:
4429  **
4430  *e #
4431  *e # Remove all callback scripts with id
4432  *e # diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON
4433  *e #
4434  *e character:remove_callback_script(diguyCharacter_CALLBACK_ID_PRE_FIRE_WEAPON,
4435  *e nil,
4436  *e "lua");
4437  */
4438  int remove_callback_script(int callback_id,
4439  const char* callback_script,
4440  const char* callback_script_type = NULL);
4441 
4442 
4443 /*****************************************************************************/
4453  /*l
4454  *b Description:
4455  **
4456  ** This function maps the event handler with the given name
4457  ** to a callback id. This mapping will be saved in the .dss
4458  ** file and restored when the .dss file is loaded.
4459  **
4460  ** Mappings can also be made via the DI-Guy Scenario UI.
4461  **
4462  ** The event handler is one of the following:
4463  **
4464  *- - a character callback function registered by
4465  *- diguyScenario::register_character_event_handler() or
4466  *- diguyScenario::register_character_event_handler_from_library()
4467  *- - a script registered by
4468  *- diguyScenario::register_character_event_handler_script()
4469  *- - a Script, Decision, or Library Function in the scenario
4470  *- whose "Event Type" is "Character"
4471  **
4472  *b Arguments:
4473  **
4474  *a callback_id - integer id of callback
4475  *a handler_name - name of the event handler to map
4476  **
4477  *b Returns:
4478  **
4479  ** 0 on success, -1 on failure
4480  */
4481  int map_event_handler_to_callback_id(int callback_id,
4482  const char* handler_name);
4483 
4484  /*l
4485  *b Description:
4486  **
4487  ** This function unmaps the event handler with the given name
4488  ** from a callback id.
4489  **
4490  *b Arguments:
4491  **
4492  *a callback_id - integer id of callback
4493  *a handler_name - name of the event handler to unmap
4494  *a unmap_all_matches - pass 0 to unmap only the first match,
4495  *a pass 1 to unmap all matches
4496  **
4497  *b Returns:
4498  **
4499  ** 0 on success, -1 on failure
4500  */
4501  int unmap_event_handler_from_callback_id(int callback_id,
4502  const char* handler_name,
4503  int unmap_all_matches = 0);
4504 
4505  /*l
4506  *b Description:
4507  **
4508  ** This function manually invokes the named character event
4509  ** handler. The callback_id that will be passed to the event
4510  ** handler will be CALLBACK_ID_MANUALLY_INVOKED.
4511  **
4512  ** See diguyCharacter::map_event_handler_to_callback_id() for
4513  ** a description of what comprises a character event handler.
4514  **
4515  ** Note that care should be taken not to end up in an
4516  ** infinite loop of event calls. In general an event handler
4517  ** should not end up directly or indirectly invoking itself.
4518  **
4519  *b Arguments:
4520  **
4521  *a handler_name - name of the event handler to invoke
4522  **
4523  *b Returns:
4524  **
4525  ** DIGUY_CALLBACK_CONTINUE or DIGUY_CALLBACK_STOP
4526  **
4527  *b Callable From:
4528  **
4529  *- - C++
4530  *- - Script
4531  *- - Decision
4532  */
4533  diguyCallbackReturn manually_invoke_event_handler(const char* handler_name);
4534 
4535 
4536 /*****************************************************************************/
4542  /*l
4543  *b Description:
4544  **
4545  ** This function creates a new path. The created path has no
4546  ** waypoints and no actions. Waypoints can be added using
4547  ** diguyCharacterPath::create_waypoint() or
4548  ** diguyCharacterPath::add_waypoint(). Action beads should be added
4549  ** using diguyCharacterPath::create_action_bead().
4550  **
4551  ** To create a simple path that has a few waypoints and actions, use
4552  ** create_simple_path().
4553  **
4554  ** The waypoints for the path should be created using the function
4555  ** diguyScenario::create_waypoint(). They should be deleted using the
4556  ** function diguyScenario::destroy_waypoint(). Copies of the
4557  ** waypoints are made during the function call, so it is safe to
4558  ** destroy them immediately after this function call returns, or use
4559  ** the waypoints again for another path.
4560  **
4561  ** The returned diguyCharacterPath pointer should be destroyed using
4562  ** destroy_path().
4563  **
4564  *b Arguments:
4565  **
4566  ** The path makes internal copies of all arguments.
4567  **
4568  *a name - name of the new path
4569  **
4570  *b Returns:
4571  **
4572  ** pointer to type diguyCharacterPath
4573  **
4574  *b Callable From:
4575  **
4576  *- - C++
4577  */
4578  diguyCharacterPath* create_path(const char* name);
4579 
4580  /*l
4581  *b Description:
4582  **
4583  ** This function creates a new simple path. The path is simple
4584  ** because it has only two waypoints and three specified actions.
4585  **
4586  ** The waypoints for the path should be created using the function
4587  ** diguyScenario::create_waypoint(). They should be deleted using the
4588  ** function diguyScenario::destroy_waypoint(). Copies of the
4589  ** waypoints are made during the function call, so it is safe to
4590  ** destroy them immediately after this function call returns, or use
4591  ** the waypoints again for another path.
4592  **
4593  ** The returned diguyCharacterPath pointer should be destroyed using
4594  ** destroy_path().
4595  **
4596  *b Arguments:
4597  **
4598  ** The path makes internal copies of all arguments.
4599  **
4600  *a name - name of the new path
4601  *a waypoint0 - beginning waypoint
4602  *a waypoint1 - ending waypoint
4603  *a transition_from_action_name - name of the action the character
4604  *a should be transitioning from at the
4605  *a beginning of the path; can be NULL
4606  *a fill_action_name - name of the action that should fill
4607  *a the majority of the path; can be
4608  *a NULL, but see below
4609  *a transition_to_action_name - name of the action the character
4610  *a should transition into at the end of
4611  *a the path
4612  **
4613  ** If transition_from_action_name is NULL, an initial action bead that
4614  ** transitions to the fill action will not be created.
4615  **
4616  ** If fill_action_name is NULL, no action beads will be created for
4617  ** the path, even if transition_from_action_name and/or
4618  ** transition_to_action_name are non-NULL.
4619  **
4620  ** If transition_to_action_name is NULL, a final action bead that
4621  ** transitions from the fill action will not be created.
4622  **
4623  *b Returns:
4624  **
4625  ** pointer to type diguyCharacterPath
4626  **
4627  *b Callable From:
4628  **
4629  *- - C++
4630  */
4631  diguyCharacterPath* create_simple_path(const char* name,
4632  diguyWaypoint* waypoint0,
4633  diguyWaypoint* waypoint1,
4634  const char* transition_from_action_name,
4635  const char* fill_action_name,
4636  const char* transition_to_action_name);
4637 
4638  /*l
4639  *b Description:
4640  **
4641  ** This function is similar to create_simple_path(), but creates its
4642  ** waypoints based on waypoints from the passed path shape.
4643  **
4644  *b Arguments:
4645  **
4646  ** The path makes internal copies of all arguments.
4647  **
4648  *a name - name of the new path
4649  *a source_path_shape - path shape whose waypoints are used
4650  *a to define shape of new path
4651  *a transition_from_action_name - same as for create_simple_path()
4652  *a fill_action_name - same as for create_simple_path()
4653  *a transition_to_action_name - same as for create_simple_path()
4654  **
4655  *b Returns:
4656  **
4657  ** pointer to type diguyCharacterPath
4658  **
4659  *b Callable From:
4660  **
4661  *- - C++
4662  */
4663  diguyCharacterPath* create_path_from_path_shape(const char* name,
4664  diguyPathShape* source_path_shape,
4665  const char* transition_from_action_name,
4666  const char* fill_action_name,
4667  const char* transition_to_action_name);
4668 
4669  /*l
4670  *b Description:
4671  **
4672  ** This function creates a temporary path and immediately forces it as
4673  ** the character's current path. Once it has been traversed it will
4674  ** be automatically deleted.
4675  **
4676  ** The beginning waypoint of this path is at the character's current
4677  ** position; the ending waypoint is at the specified action bead on
4678  ** the specified path (or the first action bead of the specified path
4679  ** if no action bead is specified). The character will use the
4680  ** specified action to move from the beginning waypoint to the ending
4681  ** waypoint.
4682  **
4683  ** This function is useful for getting a free position mode character
4684  ** back onto a path.
4685  **
4686  ** This function will have no effect on a dead character (see
4687  ** die_now() and get_dead()).
4688  **
4689  *b Mode Effects:
4690  **
4691  *- - This function will put the character into path position mode.
4692  *- - This function will put the character into path action mode.
4693  **
4694  *b Arguments:
4695  **
4696  *a destination_path_name - the path the character is trying to
4697  *a reach
4698  *a via_action_name - the action used over the majority of
4699  *a the bridge path
4700  *a destination_path_action_bead_name - the target action bead on the
4701  *a destination path; pass NULL
4702  *a to start at the beginning
4703  *a of the path
4704  **
4705  *b Returns:
4706  **
4707  ** 0 on success, -1 on failure
4708  */
4709  int create_and_force_bridge_path(const char* destination_path_name,
4710  const char* destination_path_action_bead_name,
4711  const char* via_action_name);
4712 
4713  /*l
4714  *b Description:
4715  **
4716  ** This function creates a temporary path and immediately forces it as
4717  ** the character's current path. Once the path has been traversed it
4718  ** will be automatically deleted. The character then begins the local
4719  ** path specified by path_to_push.
4720  **
4721  ** The beginning waypoint of this path is at the character's current
4722  ** position; the ending waypoint is at the specified x, y, z. A
4723  ** path_offset is available to shorten the distance to the end point
4724  ** along the vector to the destination. The character will use the
4725  ** specified action to move from the beginning waypoint to the ending
4726  ** waypoint.
4727  **
4728  ** An optional follow-on path can be specified that the character will
4729  ** move onto once the end position is reached. This must be the name
4730  ** of an existing path for the character. A local path copy of the
4731  ** specified path will be created, and will be pushed to occur after
4732  ** this bridge path completes.
4733  **
4734  ** This function is useful for branching from one location to another
4735  ** in the world.
4736  **
4737  ** This function will have no effect on a dead character (see
4738  ** die_now() and get_dead()).
4739  **
4740  *b Mode Effects:
4741  **
4742  *- - This function will put the character into path position mode.
4743  *- - This function will put the character into path action mode.
4744  **
4745  *b Arguments:
4746  **
4747  *a x, y, z - location in world space the bridge path
4748  *a should aim for
4749  *a path_offset - the amount to shorten the bridge path
4750  *a via_action_name - the action used over the majority of the
4751  *a bridge path
4752  *a next_local_path - local path to push when the character
4753  *a arrives at it's destination; pass NULL
4754  *a to not push a local path
4755  *a orientation - amount to rotate the local path
4756  **
4757  *b Returns:
4758  **
4759  ** 0 on success, -1 on failure
4760  */
4761  int create_and_force_bridge_path_to_point(float x, float y, float z,
4762  float path_offset,
4763  const char* via_action_name,
4764  const char* next_local_path = NULL,
4765  float orientation = 0.0f);
4766 
4767  /*l
4768  *b Description:
4769  **
4770  ** This function destroys a path created by create_path(),
4771  ** create_simple_path(), or a path from a loaded scenario.
4772  **
4773  ** The path the character is currently traveling, as returned by
4774  ** get_current_traveled_path(), cannot be destroyed. Attempting to
4775  ** destroy it will result in an error.
4776  **
4777  *b Arguments:
4778  **
4779  *a path - path to be destroyed
4780  **
4781  *b Returns:
4782  **
4783  ** 0 on success, -1 on failure
4784  */
4785  int destroy_path(diguyCharacterPath* path);
4786 
4787  /*l
4788  *b Returns:
4789  **
4790  ** the number of paths belonging to this character
4791  */
4792  int get_num_paths();
4793 
4794  /*l
4795  *b Returns:
4796  **
4797  ** pointer of type diguyCharacterPath; NULL if no
4798  ** path at the specified index
4799  **
4800  *b Arguments:
4801  **
4802  *a index - index of the path; indices start at 0
4803  */
4804  diguyCharacterPath* get_path_at_index(int index);
4805 
4806  /*l
4807  *b Returns:
4808  **
4809  ** the name of the path at the given index; NULL if no
4810  ** path at the specified index
4811  */
4812  const char* get_path_name_at_index(int index);
4813 
4814  /*l
4815  *b Description:
4816  **
4817  ** This function returns the index of the path the character
4818  ** is currently following. If the character is not following
4819  ** a path the returned index will be -1. (i.e., the character
4820  ** must be in path action mode *and* path position mode.)
4821  **
4822  *b Mode Restrictions:
4823  **
4824  *- - This function will only return a 0 or greater index if the
4825  ** character is in path action mode *and* path position mode.
4826  **
4827  *b Returns:
4828  **
4829  ** the index of the current path; -1 if not on a path
4830  */
4831  int get_current_path_index();
4832 
4833  /*l
4834  *b Description:
4835  **
4836  ** This function returns the path the character is currently
4837  ** traveling.
4838  **
4839  *b Mode Restrictions:
4840  **
4841  *- - This function can only be called in path position mode.
4842  **
4843  *b Returns:
4844  **
4845  ** pointer of type diguyCharacterPath; NULL if no path is currently
4846  ** being traveled
4847  */
4848  diguyCharacterPath* get_current_traveled_path();
4849 
4850  /*l
4851  *b Description:
4852  **
4853  ** This function can be used to see if the current traveled has the
4854  ** passed name. This is primarily useful for decisions and other
4855  ** limited logic applications.
4856  **
4857  *b Returns:
4858  **
4859  ** 1 if currently traveled path has the passed name; 0 if the name
4860  ** doesn't match, or no path is currently being traveled
4861  **
4862  *b Callable From:
4863  **
4864  *- - C++
4865  *- - Script
4866  *- - Decision
4867  */
4868  int get_current_traveled_path_is(const char* path_name);
4869 
4870  /*l
4871  *b Description:
4872  **
4873  ** This function pushes the path with the specified name
4874  ** onto the queue of paths this character will follow.
4875  **
4876  ** This function will have no effect on a dead character (see
4877  ** die_now() and get_dead()).
4878  **
4879  *b Arguments:
4880  **
4881  *a name - name of the path to be pushed
4882  **
4883  *b Returns:
4884  **
4885  ** 0 on success, -1 on failure
4886  **
4887  *b Callable From:
4888  **
4889  *- - C++
4890  *- - Script
4891  *- - Decision Bead
4892  */
4893  int push_path(const char* path_name);
4894 
4895  /*l
4896  *b Description:
4897  **
4898  ** This function clears the queue of paths the character will follow
4899  ** and then pushes the path with the specified name.
4900  **
4901  ** This function will have no effect on a dead character (see
4902  ** die_now() and get_dead()).
4903  **
4904  *b Arguments:
4905  **
4906  *a name - name of the path to be pushed
4907  *a max_rampdown_interval - max amount of time spent trying to
4908  *a smooth over any motion seams; set
4909  *a to 0.5 for a smooth transition, set
4910  *a to 0 for a potentially rough transition
4911  **
4912  *b Returns:
4913  **
4914  ** 0 on success, -1 on failure
4915  **
4916  *b Callable From:
4917  **
4918  *- - C++
4919  *- - Script
4920  *- - Decision Bead
4921  */
4922  int force_path(const char* path_name,
4923  float max_rampdown_interval = 0.5f);
4924 
4925  /*l
4926  *b Description:
4927  **
4928  ** Same as force_path(), but only motions at or after the specified
4929  ** action bead are added.
4930  **
4931  ** This function will have no effect on a dead character (see
4932  ** die_now() and get_dead()).
4933  **
4934  *b Callable From:
4935  **
4936  *- - C++
4937  *- - Script
4938  *- - Decision Bead
4939  */
4940  int force_partial_path(const char* path_name,
4941  const char* beginning_action_bead_name,
4942  float max_rampdown_interval = 0.5f);
4943 
4944  /*l
4945  *b Description:
4946  **
4947  ** Resumes a path that was interrupted with a call such as
4948  ** set_desired_action() or force_action(). Note that the
4949  ** retain_path_shape argument to these functions must have been 1 for
4950  ** the path to be resumable.
4951  **
4952  ** This function will have no effect on a dead character (see
4953  ** die_now() and get_dead()).
4954  **
4955  *b Mode Restrictions:
4956  **
4957  *- - This function can only be called if the character is in
4958  *- free action mode *and* path position mode.
4959  **
4960  *b Mode Effects:
4961  **
4962  *- - This function will put the character into path position mode.
4963  *- - This function will put the character into path action mode.
4964  **
4965  *b Arguments:
4966  **
4967  *a max_rampdown_interval - max amount of time spent trying to
4968  *a smooth over any motion seams; set
4969  *a to 0.5 for a smooth transition, set
4970  *a to 0 for a potentially rough transition
4971  **
4972  *b Returns:
4973  **
4974  ** 0 on success, -1 on failure
4975  **
4976  *b Callable From:
4977  **
4978  *- - C++
4979  *- - Script
4980  *- - Decision Bead
4981  */
4982  int resume_interrupted_path(float max_rampdown_interval = 0.5f);
4983 
4984  /*l
4985  *b Description:
4986  **
4987  ** This function creates a temporary path that is a copy of path_name
4988  ** but transformed so that the starting point is the same as where
4989  ** the character currently is. It then forces it as the character's
4990  ** current path.
4991  **
4992  *b Arguments:
4993  **
4994  *a path_name - path to copy
4995  *a use_character_orientation - whether the character's orientation be
4996  *a incorporated into the transform of the
4997  *a path
4998  *a rotation - additional amount to rotate the path,
4999  *a in degrees
5000  *a clamp_path - whether the path be ground clamped
5001  **
5002  *b Returns:
5003  **
5004  ** pointer to type diguyCharacterPath
5005  */
5006  diguyCharacterPath* force_local_path(const char* path_name,
5007  int use_character_orientation,
5008  float rotation = 0.0f,
5009  int clamp_path = 1);
5010 
5011  /*l
5012  *b Description:
5013  **
5014  ** This function sets which path the character will start on when the
5015  ** scenario is reset.
5016  **
5017  *b Arguments:
5018  **
5019  *a name - name of the path that will be the initial path
5020  **
5021  *b Returns:
5022  **
5023  ** 0 on success, -1 on failure
5024  */
5025  int set_initial_path(const char* name);
5026 
5027  /*l
5028  *b Description:
5029  **
5030  ** This function returns the name of the path the character will start
5031  ** on when the scenario is reset.
5032  **
5033  ** See set_initial_path().
5034  **
5035  *b Returns:
5036  **
5037  ** name of initial path; NULL if there is none
5038  */
5039  const char* get_initial_path();
5040 
5041  /*l
5042  *b Description:
5043  **
5044  ** This function translates all of the paths of this character.
5045  **
5046  *b Arguments:
5047  **
5048  *a tx, ty, tz - distance in meters to move all waypoints
5049  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5050  */
5051  void translate_all_paths(float tx, float ty, float tz,
5052  int reclamp_waypoints = 1);
5053 
5054  /*l
5055  *b Description:
5056  **
5057  ** This function rotates all of the paths of this character.
5058  ** The rotation will occur about the specified point.
5059  **
5060  ** *Note:* It is currently recommended that only rotations
5061  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5062  **
5063  *b Arguments:
5064  **
5065  *a rz, rx, ry - amount of rotation, in degrees
5066  *a rotation_pt_x, rotation_pt_y, rotation_pt_z - point around
5067  *a which rotation should occur
5068  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5069  */
5070  int rotate_all_paths_about_point(float rz, float rx, float ry,
5071  float rotation_pt_x, float rotation_pt_y, float rotation_pt_z,
5072  int reclamp_waypoints = 1);
5073 
5074  /*l
5075  *b Description:
5076  **
5077  ** This function is similar to rotate_all_paths_about_point(),
5078  ** but rotates around the character's current waypoint instead
5079  ** of an explicitly specified point.
5080  **
5081  ** *Note:* It is currently recommended that only rotations
5082  ** about the Z axis be done. (i.e., only rz should be non-zero.)
5083  **
5084  *b Arguments:
5085  **
5086  *a rz, rx, ry - amount of rotation, in degrees
5087  *a reclamp_waypoints - pass 1 to reclamp waypoints to ground
5088  */
5089  int rotate_all_paths_about_current_waypoint(float rz, float rx, float ry,
5090  int reclamp_waypoints = 1);
5091 
5092  /*l
5093  *b Description:
5094  **
5095  ** This function causes the character to jump forward along
5096  ** its current path to the specified action bead. Motions
5097  ** and beads that would have otherwise been played or processed
5098  ** will be skipped.
5099  **
5100  *b Arguments:
5101  **
5102  *a bead_name - name of the bead to jump to
5103  *a max_rampdown_interval - max amount of time spent trying to
5104  *a smooth over any motion seams; set
5105  *a to 0.5 for a smooth transition, set
5106  *a to 0 for a potentially rough transition
5107  **
5108  *b Returns:
5109  **
5110  ** 0 on success, -1 on failure
5111  */
5112  int jump_to_action_bead(const char* bead_name,
5113  float max_rampdown_interval = 0.5f);
5114 
5115  /*l
5116  *b Description:
5117  **
5118  ** This function finds and returns a pointer to the specified path.
5119  **
5120  *b Arguments:
5121  **
5122  *a name - name of the path to be found
5123  **
5124  *b Returns:
5125  **
5126  ** Pointer to object of type diguyCharacterPath;
5127  ** NULL if path not found.
5128  */
5129  diguyCharacterPath* find_path(const char* path_name);
5130 
5131  /*l
5132  *b Description:
5133  **
5134  ** This function causes the effects of the given aim bead to be
5135  ** applied to this character, regardless of whether the
5136  ** bead belongs to the character or whether character is within
5137  ** the bead's time interval.
5138  **
5139  *b Arguments:
5140  **
5141  *a how_far - how far into the bead the call should be; should
5142  *a be between 0 (beginning of bead time interval) and
5143  *a 1 (end of bead time interval)
5144  **
5145  *b Returns:
5146  **
5147  ** 0 on success, -1 on failure
5148  */
5149  int apply_aim_bead(diguyCharacterPathAimBead* bead,
5150  float how_far = 0.0f);
5151 
5152  /*l
5153  *b Description:
5154  **
5155  ** This function causes the effects of the given decision bead to be
5156  ** applied to this character, regardless of whether the
5157  ** bead belongs to the character or whether character is within
5158  ** the bead's time interval.
5159  **
5160  *b Arguments:
5161  **
5162  *a how_far - how far into the bead the call should be; should
5163  *a be between 0 (beginning of bead time interval) and
5164  *a 1 (end of bead time interval)
5165  **
5166  *b Returns:
5167  **
5168  ** 0 on success, -1 on failure
5169  */
5170  int apply_decision_bead(diguyCharacterPathDecisionBead* bead,
5171  float how_far = 0.0f);
5172 
5173  /*l
5174  *b Description:
5175  **
5176  ** This function causes the effects of the given gaze bead to be
5177  ** applied to this character, regardless of whether the
5178  ** bead belongs to the character or whether character is within
5179  ** the bead's time interval.
5180  **
5181  *b Arguments:
5182  **
5183  *a how_far - how far into the bead the call should be; should
5184  *a be between 0 (beginning of bead time interval) and
5185  *a 1 (end of bead time interval)
5186  **
5187  *b Returns:
5188  **
5189  ** 0 on success, -1 on failure
5190  */
5191  int apply_gaze_bead(diguyCharacterPathGazeBead* bead,
5192  float how_far = 0.0f);
5193 
5194  /*l
5195  *b Description:
5196  **
5197  ** This function causes the effects of the given script bead to be
5198  ** applied to this character, regardless of whether the
5199  ** bead belongs to the character or whether character is within
5200  ** the bead's time interval.
5201  **
5202  *b Arguments:
5203  **
5204  *a how_far - how far into the bead the call should be; should
5205  *a be between 0 (beginning of bead time interval) and
5206  *a 1 (end of bead time interval)
5207  **
5208  *b Returns:
5209  **
5210  ** 0 on success, -1 on failure
5211  */
5212  int apply_script_bead(diguyCharacterPathScriptBead* bead,
5213  float how_far = 0.0f);
5214 
5215  /*l
5216  *b Description:
5217  **
5218  ** This function sets how far along the current path shape
5219  ** the character will be.
5220  **
5221  *b Mode Restrictions:
5222  **
5223  *- - This function can only be called if the character is in
5224  *- free action mode *and* path position mode. i.e., the
5225  *- character is following a path shape, and is not on a
5226  *- diguyCharacterPath.
5227  **
5228  *b Arguments:
5229  **
5230  *a distance - distance in meters; 0.0 is the beginning of the
5231  *a path shape
5232  **
5233  *b Returns:
5234  **
5235  ** 0 on success, -1 on failure
5236  */
5237  int set_distance_along_path(float distance);
5238 
5239  /*l
5240  *b Returns:
5241  **
5242  ** the distance in meters along the path shape; see
5243  ** set_distance_along_path()
5244  **
5245  *b Mode Restrictions:
5246  **
5247  *- - This function can only be called in path position mode.
5248  */
5249  float get_distance_along_path();
5250 
5251  /*l
5252  *b Description:
5253  **
5254  ** This function takes the character off of its current path
5255  ** or path shape.
5256  **
5257  *b Mode Restrictions:
5258  **
5259  *- - This function can only be called in path position mode.
5260  **
5261  *b Mode Effects:
5262  **
5263  *- - This function will put the character into free position mode.
5264  *- - This function will put the character into free action mode.
5265  **
5266  *b Returns:
5267  **
5268  ** 0 on success, -1 on failure
5269  */
5270  int leave_path();
5271 
5272  /*l
5273  *b Description:
5274  **
5275  ** This function returns the index of the nearest waypoint in a path,
5276  ** the path argument is looked up in both the character's path list
5277  ** and the scenario's paths.
5278  **
5279  *b Returns:
5280  **
5281  ** waypoint index
5282  */
5283  int get_nearest_waypoint_index_in_path(const char* path_name);
5284 
5285  /*l
5286  *b Returns:
5287  **
5288  ** Distance to action bead or first waypoint, 100000000.0 on failure
5289  */
5290  float get_distance_to_path(const char* path_name,
5291  const char* action_bead_name = NULL);
5292 
5293 
5294 /*****************************************************************************/
5302  /*l
5303  *b Description:
5304  **
5305  ** This function gets the position link of the character skeleton.
5306  ** The rest of the skeleton can then be traversed by recursively
5307  ** calling the diguyGraphicsLink::get_num_child_links() and
5308  ** diguyGraphicsLink::get_child_link_at_index() functions.
5309  **
5310  ** Alternatively, the links of the character can be traversed
5311  ** by calling the get_num_links() and get_link_at_index()
5312  ** functions below.
5313  **
5314  *b Returns:
5315  **
5316  ** pointer of type diguyGraphicsLink; NULL if there is no
5317  ** position link
5318  */
5319  diguyGraphicsLink* get_position_link();
5320 
5321  /*l
5322  *b Returns:
5323  **
5324  ** number of links on this character
5325  */
5326  int get_num_links();
5327 
5328  /*l
5329  *b Returns:
5330  **
5331  ** pointer of type diguyGraphicsLink; NULL if no
5332  ** link at the specified index
5333  **
5334  *b Arguments:
5335  **
5336  *a index - index of the link; indices start at 0
5337  */
5338  diguyGraphicsLink* get_link_at_index(int index);
5339 
5340  /*l
5341  *b Description:
5342  **
5343  ** This function returns a pointer to the specified link.
5344  **
5345  *b Arguments:
5346  **
5347  *a name - name of link to be found
5348  **
5349  *b Returns:
5350  **
5351  ** pointer of type diguyGraphicsLink; NULL if not found
5352  */
5353  diguyGraphicsLink* find_link(const char* name);
5354 
5355  /*l
5356  *b Returns:
5357  **
5358  ** the string identifying the link at the given index
5359  **
5360  *b Arguments:
5361  **
5362  *a link_index - index of the link; indices start at 0
5363  */
5364  const char* get_link_name_at_index(int link_index);
5365 
5366  /*l
5367  *b Returns:
5368  **
5369  ** the number of shapes on the specified link
5370  **
5371  *b Arguments:
5372  **
5373  *a link_name - name of the link
5374  */
5375  int get_num_link_shapes(const char* link_name);
5376 
5377  /*l
5378  *b Returns:
5379  **
5380  ** the name of the shape at the specified index on the link
5381  **
5382  *b Arguments:
5383  **
5384  *a link_name - name of the link
5385  *a shape_index - index of the shape on the link; indices start at 0
5386  */
5387  const char* get_link_shape_name_at_index(const char* link_name,
5388  int shape_index);
5389 
5390 
5391 /*****************************************************************************/
5413 #ifdef CPLUSPLUS_ONLY
5414 
5415  /*l
5416  *b Description:
5417  **
5418  ** The following prototype should be used for the altitude
5419  ** function:
5420  **
5421  *e float altitude_func(diguyCharacter* character,
5422  *e float x,
5423  *e float y,
5424  *e float old_z);
5425  **
5426  ** When a character needs new altitude info, DI-Guy calls this
5427  ** function with a pointer to the diguyCharacter in question,
5428  ** the character's current (x, y) coordinates, and its previous
5429  ** altitude in old_z.
5430  **
5431  ** The altitude function should then compute and return the new
5432  ** altitude based on this information. This can be done in a
5433  ** number of ways; a typical approach is to do an intersection
5434  ** test with the visual scene.
5435  **
5436  ** A default altitude function that should be set for all
5437  ** characters can be set by calling
5438  ** diguyScenario::set_default_character_altitude_function().
5439  **
5440  *b Callable From:
5441  **
5442  *- - C++
5443  */
5444  int set_altitude_function(diguyAltitudeFunction* altitude_function);
5445 
5446  /*l
5447  *b Returns:
5448  **
5449  ** current altitude function; see set_altitude_function()
5450  **
5451  *b Callable From:
5452  **
5453  *- - C++
5454  */
5455  diguyAltitudeFunction* get_altitude_function();
5456 
5457 #endif
5458 
5459  /*l
5460  *b Description:
5461  **
5462  ** This function sets whether the character's altitude function is
5463  ** enabled in free position mode. Altitude functions are set by the
5464  ** functions set_altitude_function() or
5465  ** diguyScenario::set_default_character_altitude_function().
5466  **
5467  *b Arguments:
5468  **
5469  *a enabled - pass 1 to enable, 0 to disable
5470  **
5471  *b Mode Effects:
5472  **
5473  *- - This function will not change the position mode.
5474  **
5475  *b Mode Restrictions:
5476  **
5477  *- - This function will only affect characters in free position mode.
5478  **
5479  *b Returns:
5480  **
5481  ** 0 on success, -1 on failure
5482  */
5483  int set_altitude_function_enabled_in_free_position_mode(int enabled);
5484 
5485  /*l
5486  *b Returns:
5487  **
5488  ** whether the character's altitude function is enabled in free
5489  ** position mode; see
5490  ** set_altitude_function_enabled_in_free_position_mode()
5491  */
5492  int get_altitude_function_enabled_in_free_position_mode();
5493 
5494  /*l
5495  *b Description:
5496  **
5497  ** This function sets whether the character's altitude function is
5498  ** enabled in path position mode. Altitude functions are set by
5499  ** the functions set_altitude_function() or
5500  ** diguyScenario::set_default_character_altitude_function().
5501  **
5502  *b Arguments:
5503  **
5504  *a enabled - pass 1 to enable, 0 to disable
5505  **
5506  *b Mode Effects:
5507  **
5508  *- - This function will not change the position mode.
5509  **
5510  *b Mode Restrictions:
5511  **
5512  *- - This function will only affect characters in path position mode.
5513  **
5514  *b Returns:
5515  **
5516  ** 0 on success, -1 on failure
5517  */
5518  int set_altitude_function_enabled_in_path_position_mode(int value);
5519 
5520  /*l
5521  *b Returns:
5522  **
5523  ** whether the character's altitude function is enabled in path
5524  ** position mode;
5525  ** see set_altitude_function_enabled_in_path_position_mode()
5526  */
5527  int get_altitude_function_enabled_in_path_position_mode();
5528 
5529  /*l
5530  *b Description
5531  **
5532  ** This function sets the altitude update rate of the character.
5533  **
5534  ** The default value for new characters is 100.
5535  **
5536  ** Note that characters that are load managed (get_is_load_managed()
5537  ** returns 1) have this parameter managed automatically. The
5538  ** corresponding function for load managed characters is
5539  ** diguyLoadManager::set_zone_altitude_update_rate().
5540  **
5541  *b Arguments:
5542  **
5543  *a update_rate - percentage of scenario ticks for which altitude
5544  *a should update; can be between 1 and 100
5545  **
5546  ** Passing 100 means altitude will update every tick.
5547  ** Passing 50 means altitude will update every other tick.
5548  **
5549  *b Returns:
5550  **
5551  ** 0 on success, -1 on failure
5552  */
5553  int set_altitude_update_rate(int update_rate);
5554 
5555  /*l
5556  *b Returns:
5557  **
5558  ** character's altitude update rate as set by
5559  ** set_altitude_update_rate()
5560  */
5561  int get_altitude_update_rate();
5562 
5563  /*l
5564  *b Description
5565  **
5566  ** This function sets the altitude interpolation rate of the
5567  ** character. This function only has an effect if the character's
5568  ** altitude function is enabled.
5569  **
5570  ** When the altitude function determines that the character's Z
5571  ** position should be updated to bring it closer to the ground, the
5572  ** altitude interpolation rate determines how quickly the Z height
5573  ** is adjusted.
5574  **
5575  ** The default value is 10.
5576  **
5577  *b Arguments:
5578  **
5579  *a interpolation_rate - how much of the error will be made up
5580  *a each second
5581  **
5582  ** An interpolation_rate of 100 means that all error will be made
5583  ** up each frame.
5584  */
5585  void set_altitude_interpolation_rate(float interpolation_rate);
5586 
5587  /*l
5588  *b Returns:
5589  **
5590  ** character's altitude update rate as set by
5591  ** set_altitude_interpolation_rate()
5592  */
5593  float get_altitude_interpolation_rate();
5594 
5595 /*****************************************************************************/
5707  /*l
5708  *b Description:
5709  **
5710  ** Returns the number of variables in this character's pose array.
5711  ** See get_pose_in_radians() for an example of use.
5712  **
5713  *b Returns:
5714  **
5715  ** size of this character's pose array
5716  */
5717  int get_pose_array_size();
5718 
5719 #ifdef CPLUSPLUS_ONLY
5720 
5721  /*l
5722  *b Description:
5723  **
5724  ** Fills an array of floats with the character's current joint angles.
5725  ** Angles are expressed in radians. The size of the float array must
5726  ** be at least as large as that returned by get_pose_array_size().
5727  **
5728  *b Arguments:
5729  **
5730  *a pose_array - an array of floats
5731  **
5732  *b Returns:
5733  **
5734  ** 0 on success, -1 on failure
5735  **
5736  *b Callable From:
5737  **
5738  *- - C++
5739  **
5740  *b C++ Example:
5741  **
5742  *e diguyCharacter* ch = scenario->get_character_at_index(0);
5743  *e float* pose_array;
5744  *e
5745  *e // allocate a float array of the proper size
5746  *e int n = ch->get_pose_array_size();
5747  *e pose_array = new float[n];
5748  *e
5749  *e // get the pose array
5750  *e ch->get_pose_in_radians(pose_array);
5751  */
5752  int get_pose_in_radians(float* pose_array);
5753 
5754 #endif
5755 
5756  /*l
5757  *b Description:
5758  **
5759  ** Creates and returns a pose override object. The newly created
5760  ** pose override object is added to the character's previously
5761  ** created override objects, if any.
5762  **
5763  ** How the pose override interacts with other effects that affect
5764  ** the pose of the character depends on the override stage. See
5765  ** the section "Pose Override Stages" for a discussion of pose
5766  ** override stages.
5767  **
5768  *b Arguments:
5769  **
5770  *a override_stage - the stage in the DI-Guy motion engine at
5771  *a which the override should be applied
5772  **
5773  *b Returns:
5774  **
5775  ** object of type diguyCharacterPoseOverride
5776  */
5777  diguyCharacterPoseOverride* create_pose_override(int override_stage = 3);
5778 
5779  /*l
5780  *b Description:
5781  **
5782  ** Destroys a pose override object, ending its influence on the
5783  ** character.
5784  **
5785  *b Arguments:
5786  **
5787  *a po - pose override object to be destroyed
5788  **
5789  *b Returns:
5790  **
5791  ** 0 on success, -1 on failure
5792  */
5793  int destroy_pose_override(diguyCharacterPoseOverride* po);
5794 
5795  /*l
5796  *b Returns:
5797  **
5798  ** the number of pose overrides belonging to this character
5799  */
5800  int get_num_pose_overrides();
5801 
5802  /*l
5803  *b Returns:
5804  **
5805  ** pointer of type diguyCharacterPoseOverride; NULL if no
5806  ** pose override at the specified index
5807  **
5808  *b Arguments:
5809  **
5810  *a index - index of the pose override; indices start at 0
5811  */
5812  diguyCharacterPoseOverride* get_pose_override_at_index(int index);
5813 
5814  /*l
5815  *b Description:
5816  **
5817  ** Creates and returns a pose override object that completely
5818  ** overrides all other character pose operations, including motions,
5819  ** aiming, gazing, gestures, other pose overrides, etc. The values
5820  ** set in the complete pose override object will be the values used
5821  ** to animate the character.
5822  **
5823  ** Having only one thing that affects a character's pose allows for
5824  ** much faster updating of the character.
5825  **
5826  ** There can only be one complete pose override object per character.
5827  **
5828  ** To remove the complete pose override, call
5829  ** destroy_complete_pose_override().
5830  **
5831  *b Returns:
5832  **
5833  ** object of type diguyCharacterPoseOverride
5834  */
5835  diguyCharacterPoseOverride* create_complete_pose_override();
5836 
5837  /*l
5838  *b Description:
5839  **
5840  ** Removes and destroys the complete pose override created by
5841  ** create_complete_pose_override().
5842  */
5843  void destroy_complete_pose_override();
5844 
5845 
5846 /*****************************************************************************/
5852  /*l
5853  *b Description:
5854  **
5855  ** This function sets the current azimuth, elevation, and
5856  ** distance of the character's gaze. A fixed point in 3D space
5857  ** is then found using the two angles and the given distance
5858  ** from the Boston Dynamics coordinate system origin. Angles are
5859  ** given with respect to the Boston Dynamics coordinate system.
5860  **
5861  ** See set_position() for a description of the coordinate
5862  ** system.
5863  **
5864  ** Gazing will continue until end_gaze() is called.
5865  **
5866  ** This function will have no effect on a dead character (see
5867  ** die_now() and get_dead()).
5868  **
5869  *b Arguments:
5870  **
5871  *a azimuth - rotation in degrees about up (vertical) axis;
5872  *a positive rotates to character's left
5873  *a elevation - rotation in degrees about forward (horizontal) axis;
5874  *a positive rotates down
5875  *a distance - distance in meters from the position of the character
5876  *a to the gaze target; positive values only,
5877  *a typically this is a large value (e.g. 10,000 meters)
5878  *a is_new_gaze - set to 1 if this is a new gaze;
5879  *a set to 0 if this is continuing an already started
5880  *a gaze
5881  **
5882  *b Returns:
5883  **
5884  ** 0 on success, -1 on failure
5885  */
5886  int gaze_at_angle(float azimuth,
5887  float elevation,
5888  float distance,
5889  int is_new_gaze = 1);
5890 
5891  /*l
5892  *b Description:
5893  **
5894  ** This function is identical to gaze_at_angle() except that it uses
5895  ** body local coordinates for the character. The angles
5896  ** are given with respect to the idealized position of the
5897  ** character. Use get_position() to learn the idealized position.
5898  ** The distance is between the idealized position of the character
5899  ** and the fixation point.
5900  **
5901  ** This function will have no effect on a dead character (see
5902  ** die_now() and get_dead()).
5903  */
5904  int gaze_at_angle_local(float azimuth,
5905  float elevation,
5906  float distance = 10000.0f,
5907  int is_new_gaze = 1);
5908 
5909  /*l
5910  *b Description:
5911  **
5912  ** This function sets the current fixation point of the character's
5913  ** gaze. Point coordinates are given in meters in the Boston Dynamics
5914  ** global coordinate system. The function uses default gaze behavior
5915  ** settings. Gazing will continue until end_gaze() is called.
5916  **
5917  ** This function will have no effect on a dead character (see
5918  ** die_now() and get_dead()).
5919  **
5920  *b Arguments:
5921  **
5922  *a tx, ty, tz - position in meters from the Boston Dynamics global
5923  *a origin
5924  *a is_new_gaze - set to 1 if this is a new gaze;
5925  *a set to 0 if this is continuing an already started
5926  *a gaze
5927  **
5928  *b Returns:
5929  **
5930  ** 0 on success, -1 on failure
5931  */
5932  int gaze_at_point(float tx,
5933  float ty,
5934  float tz,
5935  int is_new_gaze = 1);
5936 
5937  /*l
5938  *b Description:
5939  **
5940  ** This function is identical to gaze_at_point() except that it uses
5941  ** body local coordinates for the character. Use get_position()
5942  ** to learn the idealized position of the character if necessary.
5943  **
5944  ** This function will have no effect on a dead character (see
5945  ** die_now() and get_dead()).
5946  */
5947  int gaze_at_point_local(float tx,
5948  float ty,
5949  float tz,
5950  int is_new_gaze = 1);
5951 
5952  /*l
5953  *b Description:
5954  **
5955  ** This function effectively does a gaze_at_point() each tick.
5956  ** The point to be gazed at is updated each tick to be the position
5957  ** of the specified link on the specified character.
5958  **
5959  ** This function will have no effect on a dead character (see
5960  ** die_now() and get_dead()).
5961  **
5962  *b Arguments:
5963  **
5964  *a target_character_name - name of the character to be
5965  *a gazed at
5966  *a target_character_link_name - link on the character that should
5967  *a be gazed at; pass NULL to gaze at
5968  *a the position link of the character
5969  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
5970  **
5971  *b Returns:
5972  **
5973  ** 0 on success, -1 on failure
5974  **
5975  *b Callable From:
5976  **
5977  *- - C++
5978  *- - Script
5979  *- - Decision Bead
5980  **
5981  *b C++ Example:
5982  **
5983  *e // gaze at the head of character "soldier-1".
5984  *e ch->gaze_at_character("soldier-1",
5985  *e "cervical",
5986  *e 0.0,
5987  *e 0.0,
5988  *e 0.0);
5989  */
5990  int gaze_at_character(const char* target_character_name,
5991  const char* target_character_link_name = NULL,
5992  float offset_tx = 0.0f,
5993  float offset_ty = 0.0f,
5994  float offset_tz = 0.0f);
5995 
5996  /*l
5997  *b Returns:
5998  **
5999  ** 1 if the character is actively gazing, 0 if not
6000  */
6001  int get_gaze_is_active();
6002 
6003  /*l
6004  *b Returns:
6005  **
6006  ** the current gaze point relative to the Boston Dynamics
6007  ** global coordinate system
6008  */
6009  int get_gaze_point(float* x, float* y, float* z);
6010 
6011  /*l
6012  *b Description:
6013  **
6014  ** A gaze is acquired if the final link in the gaze link chain
6015  ** has fully oriented toward the gaze target, even if other
6016  ** links in the gaze chain are still moving.
6017  **
6018  ** If the gaze is acquired, but any links in the gaze chain
6019  ** are still moving, the gaze is considered acquired but not
6020  ** steady (see get_gaze_is_steady().) If all links have reached
6021  ** a relatively steady state, the gaze is considered acquired
6022  ** and steady.
6023  **
6024  ** If either the acquired or steady status of a gaze has changed
6025  ** (e.g., was acquired but now is not, or was steady but now
6026  ** a link is moving), the diguyCharacter callback with callback_id
6027  ** CALLBACK_ID_GAZE_STATUS will be called.
6028  **
6029  *b Returns:
6030  **
6031  *- - 1 if the final link in the gaze can and has become oriented
6032  *- toward the gaze target
6033  *- - 0 if not
6034  *- - -1 on error
6035  */
6036  int get_gaze_is_acquired();
6037 
6038  /*l
6039  *b Description:
6040  **
6041  ** A gaze is steady if it is acquired, and if all links involved
6042  ** in the gaze have reached a steady state.
6043  **
6044  ** For example, since the eyes move faster than the neck, which
6045  ** moves faster than the back, it's possible for the gaze to
6046  ** be acquired (see get_gaze_is_acquired()) by the eyes as the
6047  ** neck and back are still moving. As the neck and back move into
6048  ** a more natural position, the eyes will not need to be turned
6049  ** as far to keep the gaze acquired.
6050  **
6051  ** If either the acquired or steady status of a gaze has changed
6052  ** (e.g., was acquired but now is not, or was steady but now
6053  ** a link is moving), the diguyCharacter callback with callback_id
6054  ** CALLBACK_ID_GAZE_STATUS will be called.
6055  **
6056  *b Returns:
6057  **
6058  *- - 1 if all links participating in the gaze have reached a
6059  *- relatively steady state
6060  *- - 0 if not
6061  *- - -1 on error
6062  */
6063  int get_gaze_is_steady();
6064 
6065  /*l
6066  *b Description:
6067  **
6068  ** This function removes the fixation target of an ongoing gaze,
6069  ** allowing the character to return to a non-gaze posture and
6070  ** behavior. This effectively frees the character's posture to
6071  ** other influences.
6072  */
6073  int end_gaze();
6074 
6075  /*l
6076  *b Description:
6077  **
6078  ** This function is similar to gaze_at_angle(), but sets the target
6079  ** of left pointing rather than gaze.
6080  **
6081  ** This function will have no effect on a dead character (see
6082  ** die_now() and get_dead()).
6083  **
6084  *b Arguments:
6085  **
6086  *a azimuth - rotation in degrees about up (vertical) axis;
6087  *a positive rotates to character's left
6088  *a elevation - rotation in degrees about forward (horizontal) axis;
6089  *a positive rotates down
6090  *a distance - distance in meters from the position of the character
6091  *a to the lpoint target; positive values only
6092  *a is_new_lpoint - set to 1 if this is a new lpoint;
6093  *a set to 0 if this is continuing an already started
6094  *a lpoint
6095  *a base_gesture_name - the underlying gesture that should be used for
6096  *a motion of the arm; this is a placeholder
6097  *a argument for future functionality and should
6098  *a be set to NULL
6099  */
6100  int lpoint_at_angle(float azimuth,
6101  float elevation,
6102  float distance,
6103  int is_new_lpoint = 1,
6104  const char* base_gesture_name = 0);
6105 
6106  /*l
6107  *b Description:
6108  **
6109  ** This function is identical to gaze_at_local() except that it uses
6110  ** body local coordinates for the character. Use get_position()
6111  ** to learn the idealized position of the character if necessary.
6112  **
6113  ** This function will have no effect on a dead character (see
6114  ** die_now() and get_dead()).
6115  */
6116  int lpoint_at_angle_local(float azimuth,
6117  float elevation,
6118  float distance = 10000.0f,
6119  int is_new_lpoint = 1,
6120  const char* base_gesture_name = 0);
6121 
6122  /*l
6123  *b Description:
6124  **
6125  ** This function sets the current fixation point for the character's
6126  ** left pointing. Point coordinates are given in meters in the
6127  ** Boston Dynamics global coordinate system.
6128  **
6129  ** See set_position() for a description of the coordinate
6130  ** system.
6131  **
6132  ** Pointing will continue until end_lpoint() is called.
6133  **
6134  ** This function will have no effect on a dead character (see
6135  ** die_now() and get_dead()).
6136  **
6137  *b Arguments:
6138  **
6139  *a tx, ty, tz - position in meters from the Boston Dynamics global
6140  *a origin of the lpoint target
6141  *a is_new_gaze - set to 1 if this is a new lpoint;
6142  *a set to 0 if this is continuing an already started
6143  *a lpoint
6144  *a base_gesture_name - the underlying gesture that should be used for
6145  *a motion of the arm; this is a placeholder
6146  *a argument for future functionality and should
6147  *a be set to NULL
6148  **
6149  *b Returns:
6150  **
6151  ** 0 on success, -1 on failure
6152  */
6153  int lpoint_at_point(float tx,
6154  float ty,
6155  float tz,
6156  int is_new_lpoint = 1,
6157  const char* base_gesture_name = 0);
6158 
6159  /*l
6160  *b Description:
6161  **
6162  ** This function is identical to lpoint_at_local() except that it uses
6163  ** body local coordinates for the character. Use get_position()
6164  ** to learn the idealized position of the character if necessary.
6165  **
6166  ** This function will have no effect on a dead character (see
6167  ** die_now() and get_dead()).
6168  */
6169  int lpoint_at_point_local(float tx,
6170  float ty,
6171  float tz,
6172  int is_new_lpoint = 1,
6173  const char* base_gesture_name = 0);
6174 
6175  /*l
6176  *b Description:
6177  **
6178  ** This function is identical to gaze_at_character(), but sets the
6179  ** target of left pointing rather than gaze.
6180  **
6181  ** This function will have no effect on a dead character (see
6182  ** die_now() and get_dead()).
6183  */
6184  int lpoint_at_character(const char* target_character_name,
6185  const char* target_character_link_name = NULL,
6186  float offset_tx = 0.0f,
6187  float offset_ty = 0.0f,
6188  float offset_tz = 0.0f);
6189 
6190  /*l
6191  *b Returns:
6192  **
6193  ** the current lpoint target point relative to the Boston Dynamics
6194  ** global coordinate system
6195  */
6196  int get_lpoint_point(float* x, float* y, float* z);
6197 
6198  /*l
6199  *b Returns:
6200  **
6201  ** the current base gesture of the lpoint
6202  */
6203  const char* get_lpoint_base_gesture_name();
6204 
6205  /*l
6206  *b Returns:
6207  **
6208  ** 1 if the character is actively lpointing, 0 if not
6209  */
6210  int get_lpoint_is_active();
6211 
6212  /*l
6213  *b Returns:
6214  **
6215  ** 1 if the final link in the lpoint can and has become oriented
6216  ** toward the lpoint target;
6217  ** 0 if not;
6218  ** -1 on error
6219  */
6220  int get_lpoint_is_acquired();
6221 
6222  /*l
6223  *b Returns:
6224  **
6225  ** 1 if all links participating in the lpoint have reached a
6226  ** relatively steady state;
6227  ** 0 if not;
6228  ** -1 on error
6229  */
6230  int get_lpoint_is_steady();
6231 
6232  /*l
6233  *b Description:
6234  **
6235  ** This function removes the fixation target of an ongoing lpoint,
6236  ** allowing the character to return to a non-point posture and
6237  ** behavior. This effectively frees the character's posture to
6238  ** other influences.
6239  */
6240  int end_lpoint();
6241 
6242  /*l
6243  *b Description:
6244  **
6245  ** This function sets all gaze control parameters back to their
6246  ** default settings. This undoes modifications to gaze control
6247  ** parameters made by the following calls:
6248  **
6249  *- - set_gaze_param_desired_locate_time()
6250  *- - set_gaze_link_uses_desired_locate_time()
6251  *- - set_gaze_link_azimuth_limits()
6252  *- - set_gaze_link_elevation_limits()
6253  *- - set_gaze_link_azimuth_tolerance()
6254  *- - set_gaze_link_elevation_tolerance()
6255  *- - set_gaze_link_max_angular_vel()
6256  *- - set_gaze_link_scale_factor()
6257  **
6258  *b Returns:
6259  **
6260  ** 0 on success, -1 on failure
6261  */
6262  int set_gaze_params_to_defaults();
6263 
6264  /*l
6265  *b Description:
6266  **
6267  ** This function sets the desired amount of time in seconds it
6268  ** will take for the gaze or point target to be acquired.
6269  **
6270  ** Having a desired locate time effectively limits how fast links
6271  ** in the gaze chain can turn; they will turn as fast as it
6272  ** takes for them to arrive at their proper values, or as fast
6273  ** as their maximum angular velocity, whichever is longer.
6274  **
6275  ** The use of desired locate time can be turned on and off on a
6276  ** link by link bases using the function
6277  ** set_gaze_link_uses_desired_locate_time().
6278  **
6279  ** This value is only a guideline and may be overridden on a link
6280  ** by link basis during the actual gaze, as links try not to
6281  ** exceed their maximum angular velocities.
6282  **
6283  ** The default locate time is 1.0 seconds.
6284  **
6285  *b Arguments:
6286  **
6287  *a t - lower value results in faster turning rate
6288  **
6289  *b Returns:
6290  **
6291  ** 0 on success, -1 on failure
6292  */
6293  int set_gaze_param_desired_locate_time(float t);
6294 
6295  /*l
6296  *b Returns:
6297  **
6298  ** the most recent setting of set_gaze_param_desired_locate_time()
6299  */
6300  float get_gaze_param_desired_locate_time();
6301 
6302  /*l
6303  *b Description:
6304  **
6305  ** This function sets whether the specified link will pay attention
6306  ** to the desired locate time (as set by
6307  ** set_gaze_param_desired_locate_time()), or whether the link turns
6308  ** as fast as its maximum angular velocity allows (as set by
6309  ** set_gaze_link_max_angular_vel()).
6310  **
6311  ** Note that if this value is set to 1, the link still pays attention
6312  ** to its maximum angular velocity as an upper limit on how fast
6313  ** it can turn.
6314  **
6315  ** Valid link names and defaults:
6316  **
6317  *a orientation - 1
6318  *a back - 1
6319  *a cervical - 1
6320  *a eye_l - 0
6321  *a shoulder_l - 1
6322  *a elbow_l - 1
6323  **
6324  *b Arguments:
6325  **
6326  *a link_name - name of the link
6327  *a uses_desired_locate_time - 1 to use desired locate time, 0
6328  *a to disregard
6329  **
6330  *b Returns:
6331  **
6332  ** 0 on success, -1 on failure
6333  */
6334  int set_gaze_link_uses_desired_locate_time(const char* link_name,
6335  int uses_desired_locate_time);
6336 
6337  /*l
6338  *b Returns:
6339  **
6340  ** the most recent setting of set_gaze_link_uses_desired_locate_time()
6341  */
6342  int get_gaze_link_uses_desired_locate_time(const char* link_name);
6343 
6344  /*l
6345  *b Description:
6346  **
6347  ** This function sets the maximum amount the character can turn
6348  ** the specified link horizontally in pursuit of a gaze or point
6349  ** target.
6350  **
6351  ** Valid link names and defaults:
6352  **
6353  *a back - -45 to 45
6354  *a cervical - -80 to 80
6355  *a eye_l - -50 to 50
6356  *a shoulder_l - -30 to 135
6357  *a elbow_l - -30 to 10
6358  **
6359  *b Arguments:
6360  **
6361  *a link_name - name of the link
6362  *a min - value <= 0; in degrees
6363  *a max - value >= 0; in degrees
6364  **
6365  *b Returns:
6366  **
6367  ** 0 on success, -1 on failure
6368  */
6369  int set_gaze_link_azimuth_limits(const char* link_name, float min, float max);
6370 
6371  /*l
6372  *b Returns:
6373  **
6374  ** the most recent setting of set_gaze_link_azimuth_max()
6375  */
6376  int get_gaze_link_azimuth_limits(const char* link_name,
6377  float* min,
6378  float* max);
6379 
6380  /*l
6381  *b Description:
6382  **
6383  ** This function sets the maximum amount the character can turn
6384  ** the specified link vertically in pursuit of a gaze or point
6385  ** target.
6386  **
6387  ** Valid link names and defaults:
6388  **
6389  *a back - -15 to 45
6390  *a cervical - -80 to 45
6391  *a eye_l - -40 to 40
6392  *a shoulder_l - -80 to 80
6393  *a elbow_l - -170 to 0
6394  **
6395  *b Arguments:
6396  **
6397  *a link_name - name of the link
6398  *a min - value <= 0; in degrees
6399  *a max - value >= 0; in degrees
6400  **
6401  *b Returns:
6402  **
6403  ** 0 on success, -1 on failure
6404  */
6405  int set_gaze_link_elevation_limits(const char* link_name,
6406  float min,
6407  float max);
6408 
6409  /*l
6410  *b Returns:
6411  **
6412  ** the most recent setting of set_gaze_link_elevation_max()
6413  */
6414  int get_gaze_link_elevation_limits(const char* link_name,
6415  float* min,
6416  float* max);
6417 
6418  /*l
6419  *b Description:
6420  **
6421  ** This function sets how much difference there can be between
6422  ** the link's current horizontal orientation and the gaze or point
6423  ** target before the link begins to turn to acquire the gaze or
6424  ** point target.
6425  **
6426  ** The combination of this function and
6427  ** set_gaze_link_scale_factor() determine how close the link will
6428  ** turn toward the gaze or point target.
6429  **
6430  ** With a looser (higher) tolerance the link will not turn as much
6431  ** toward the target. With a tighter (lower) tolerance the link
6432  ** will turn more toward the target.
6433  **
6434  ** Valid link names and defaults:
6435  **
6436  *a orientation - -30 to 30
6437  *a back - -45 to 45
6438  *a cervical - -5 to 5
6439  *a eye_l - -1 to 1
6440  *a shoulder_l - -5 to 5
6441  *a elbow_l - -5 to 5
6442  **
6443  *b Arguments:
6444  **
6445  *a link_name - name of the link
6446  *a min - value <= 0; in degrees
6447  *a max - value >= 0; in degrees
6448  **
6449  *b Returns:
6450  **
6451  ** 0 on success, -1 on failure
6452  */
6453  int set_gaze_link_azimuth_tolerance(const char* link_name,
6454  float min,
6455  float max);
6456 
6457  /*l
6458  *b Returns:
6459  **
6460  ** the most recent setting of set_gaze_link_azimuth_max()
6461  */
6462  int get_gaze_link_azimuth_tolerance(const char* link_name,
6463  float* min,
6464  float* max);
6465 
6466  /*l
6467  *b Description:
6468  **
6469  ** The elevation equivalent of set_gaze_link_azimuth_tolerance(),
6470  **
6471  ** Valid link names and defaults:
6472  **
6473  *a orientation - -90 to 90
6474  *a back - -45 to 45
6475  *a cervical - -5 to 5
6476  *a eye_l - -1 to 1
6477  *a shoulder_l - -5 to 5
6478  *a elbow_l - -5 to 5
6479  **
6480  *b Arguments:
6481  **
6482  *a link_name - name of the link
6483  *a min - value <= 0; in degrees
6484  *a max - value >= 0; in degrees
6485  **
6486  *b Returns:
6487  **
6488  ** 0 on success, -1 on failure
6489  */
6490  int set_gaze_link_elevation_tolerance(const char* link_name,
6491  float min,
6492  float max);
6493 
6494  /*l
6495  *b Returns:
6496  **
6497  ** the most recent setting of set_gaze_link_elevation_max()
6498  */
6499  int get_gaze_link_elevation_tolerance(const char* link_name,
6500  float* min,
6501  float* max);
6502 
6503  /*l
6504  *b Description:
6505  **
6506  ** This function sets the maximum angular velocity that the
6507  ** back link angles may attain in pursuit of a gaze or point target.
6508  **
6509  ** Valid link names and defaults:
6510  **
6511  *a back - 30 deg/s
6512  *a cervical - 60 deg/s
6513  *a eye_l - 180 deg/s
6514  *a shoulder_l - 180 deg/s
6515  *a elbow_l - 180 deg/s
6516  **
6517  *b Arguments:
6518  **
6519  *a link_name - name of the link
6520  *a angular_vel - angular velocity in degrees per second
6521  **
6522  *b Returns:
6523  **
6524  ** 0 on success, -1 on failure
6525  */
6526  int set_gaze_link_max_angular_vel(const char* link_name, float angular_vel);
6527 
6528  /*l
6529  *b Returns:
6530  **
6531  ** the most recent setting of set_gaze_link_max_angular_vel()
6532  */
6533  int get_gaze_link_max_angular_vel(const char* link_name, float* angular_vel);
6534 
6535  /*l
6536  *b Description:
6537  **
6538  ** This function sets how much the link will make up the difference
6539  ** toward the gaze or point target.
6540  **
6541  ** The combination of this function and
6542  ** the tolerances determine how close the
6543  ** link will turn toward the gaze or point target.
6544  **
6545  ** With a smaller scale factor the link will not turn as much toward
6546  ** the target. With a higher scale factor the link will turn more
6547  ** toward the target.
6548  **
6549  ** For example, if the gaze or point target is at 60 degrees yaw in
6550  ** back coordinates and the scale factor is 0.5, the back will turn
6551  ** 30 degrees in pursuit of the target.
6552  **
6553  ** Valid link names and defaults:
6554  **
6555  *a back - 0.75
6556  *a cervical - 0.5
6557  *a eye_l - 1.0
6558  *a shoulder_l - 0.9
6559  *a elbow_l - 1.0
6560  **
6561  *b Arguments:
6562  **
6563  *a link_name - name of the link
6564  *a scale_factor - scale factor between 0 and 1
6565  **
6566  *b Returns:
6567  **
6568  ** 0 on success, -1 on failure
6569  */
6570  int set_gaze_link_scale_factor(const char* link_name, float scale_factor);
6571 
6572  /*l
6573  *b Returns:
6574  **
6575  ** the most recent setting of set_gaze_link_scale_factor()
6576  */
6577  int get_gaze_link_scale_factor(const char* link_name, float* scale_factor);
6578 
6579  /*l
6580  *b Description:
6581  **
6582  ** This function sets whether the character can turn the specified
6583  ** link in pursuit of the gaze target.
6584  **
6585  ** Valid link names and defaults:
6586  **
6587  *a orientation - 0
6588  *a back - 1
6589  *a cervical - 1
6590  *a eye_l - 1 if character has movable eyes, else 0
6591  *a shoulder_l - 0
6592  *a elbow_l - 0
6593  **
6594  *b Arguments:
6595  **
6596  *a link_name - name of the link
6597  *a enabled - 1 to enable, 0 to disable
6598  **
6599  *b Returns:
6600  **
6601  ** 0 on success, -1 on failure
6602  */
6603  int set_link_enabled_for_gaze(const char* link_name, int enabled);
6604 
6605  /*l
6606  *b Returns:
6607  **
6608  ** the most recent setting of set_link_enabled_for_gaze()
6609  */
6610  int get_link_enabled_for_gaze(const char* link_name);
6611 
6612  /*l
6613  *b Description:
6614  **
6615  ** This function sets whether the character can change its current
6616  ** posture in pursuit of the gaze target.
6617  **
6618  ** Gaze can change current posture by default.
6619  **
6620  *b Arguments:
6621  **
6622  *a enabled - 1 to enable, 0 to disable
6623  **
6624  *b Returns:
6625  **
6626  ** 0 on success, -1 on failure
6627  */
6628  int set_gaze_can_change_posture(int enabled);
6629 
6630  /*l
6631  *b Returns:
6632  **
6633  ** the most recent setting of set_gaze_can_change_posture()
6634  */
6635  int get_gaze_can_change_posture();
6636 
6637  /*l
6638  *b Description:
6639  **
6640  ** This function sets whether the character can change its current
6641  ** variant in pursuit of the gaze target.
6642  **
6643  ** Gaze can change current variant by default.
6644  **
6645  *b Arguments:
6646  **
6647  *a enabled - 1 to enable, 0 to disable
6648  **
6649  *b Returns:
6650  **
6651  ** 0 on success, -1 on failure
6652  */
6653  int set_gaze_can_change_variant(int enabled);
6654 
6655  /*l
6656  *b Returns:
6657  **
6658  ** the most recent setting of set_gaze_can_change_variant()
6659  */
6660  int get_gaze_can_change_variant();
6661 
6662  /*l
6663  *b Description:
6664  **
6665  ** This function sets whether the character can move the specified
6666  ** link in pursuit of the lpoint target.
6667  **
6668  ** Valid link names and defaults:
6669  **
6670  *a orientation - 0
6671  *a back - 1
6672  *a cervical - 0
6673  *a eye_l - 0
6674  *a shoulder_l - 1
6675  *a elbow_l - 1
6676  **
6677  *b Arguments:
6678  **
6679  *a link_name - name of the link
6680  *a enabled - 1 to enable, 0 to disable
6681  **
6682  *b Returns:
6683  **
6684  ** 0 on success, -1 on failure
6685  */
6686  int set_link_enabled_for_lpoint(const char* link_name, int enabled);
6687 
6688  /*l
6689  *b Returns:
6690  **
6691  ** the most recent setting of set_link_enabled_for_lpoint()
6692  */
6693  int get_link_enabled_for_lpoint(const char* link_name);
6694 
6695  /*l
6696  *b Description:
6697  **
6698  ** This function adjusts the current azimuth and elevation offsets
6699  ** of the character's head. If a gaze is ongoing, then the nod will
6700  ** be supplemented to the gazing, and the character will attempt to
6701  ** maintain its gaze.
6702  **
6703  ** This function will have no effect on a dead character (see
6704  ** die_now() and get_dead()).
6705  **
6706  *b Arguments:
6707  **
6708  *a azimuth - rotation offset about z (vertical) axis, in degrees;
6709  *a positive rotates to character's left
6710  *a elevation - rotation offset about y (horizontal) axis, in degrees;
6711  *a positive rotates down
6712  *a duration - how long it should take to attain the new azimuth
6713  *a and elevation
6714  **
6715  *b Returns:
6716  **
6717  ** 0 on success, -1 on failure
6718  */
6719  int set_nod(float azimuth,
6720  float elevation,
6721  float duration = 0.5f);
6722 
6723  /*l
6724  *b Description:
6725  **
6726  ** This function causes the character to nod its head for the
6727  ** specified number of times over the specified duration.
6728  **
6729  ** If nod_count is 0.5, the elevation of the head will move from its
6730  ** current elevation straight to nod_elevation_out. The arguments
6731  ** nod_elevation0 and nod_elevation1 will be ignored.
6732  **
6733  ** If nod_count is 1.0, the elevation of the head will move from
6734  ** its current elevation to nod_elevation0, then to
6735  ** nod_elevation_out. The argument nod_elevation1 will be ignored.
6736  **
6737  ** If nod_count is 1.5 or greater, the nod elevation will begin at
6738  ** its current elevation, move to nod_elevation0, then alternate
6739  ** between nod_elevation0 and nod_elevation1, before finally ending
6740  ** at nod_elevation_out.
6741  **
6742  ** The head will maintain an elevation offset of nod_elevation_out
6743  ** until a new call to nod_head() or set_nod() is made.
6744  **
6745  ** This function overrides any nod settings made by the set_nod()
6746  ** function.
6747  **
6748  ** This function will have no effect on a dead character (see
6749  ** die_now() and get_dead()).
6750  **
6751  *b Arguments:
6752  **
6753  *a duration - for how long the nod should be executed
6754  *a nod_count - how many nods the character should perform;
6755  *a this will be rounded to the nearest multiple
6756  *a of 0.5
6757  *a nod_elevation0 - elevation of initial nod in degrees
6758  *a nod_elevation1 - elevation of return nod in degrees
6759  *a nod_elevation_out - ending elevation when nod is complete
6760  **
6761  *b Returns:
6762  **
6763  ** 0 on success, -1 on failure
6764  **
6765  *b Callable From:
6766  **
6767  *- - C++
6768  *- - Script
6769  *- - Decision Bead
6770  */
6771  int nod_head(float duration,
6772  float nod_count,
6773  float nod_elevation0 = 15.0f,
6774  float nod_elevation1 = 0.0f,
6775  float nod_elevation_out = 0.0f);
6776 
6777  /*l
6778  *b Description:
6779  **
6780  ** This function is similar to nod_head(), except the direction
6781  ** of head movement is side to side rather than up and down.
6782  ** See the nod_head() function for a detailed description of usage.
6783  **
6784  ** This function will have no effect on a dead character (see
6785  ** die_now() and get_dead()).
6786  **
6787  *b Arguments:
6788  **
6789  *a duration - for how long the shake should be executed
6790  *a shake_count - how shakes the character should perform; this
6791  *a will be rounded to the nearest multiple of
6792  *a 0.5
6793  *a shake_azimuth0 - azimuth of initial shake in degrees
6794  *a shake_azimuth1 - azimuth of return shake in degrees
6795  *a shake_azimuth_out - ending azimuth when shake is complete
6796  **
6797  *b Returns:
6798  **
6799  ** 0 on success, -1 on failure
6800  **
6801  *b Callable From:
6802  **
6803  *- - C++
6804  *- - Script
6805  *- - Decision Bead
6806  */
6807  int shake_head(float duration,
6808  float shake_count,
6809  float shake_azimuth0 = -20.0f,
6810  float shake_azimuth1 = 20.0f,
6811  float shake_azimuth_out = 0.0f);
6812 
6813  /*l
6814  *b Returns:
6815  **
6816  ** current nod azimuth setting; see set_nod(), nod_head(), and
6817  ** shake_head()
6818  */
6819  float get_nod_azimuth();
6820 
6821  /*l
6822  *b Returns:
6823  **
6824  ** current nod elevation setting; see set_nod(), nod_head(), and
6825  ** shake_head()
6826  */
6827  float get_nod_elevation();
6828 
6829 
6830 /*****************************************************************************/
6851  /*l
6852  *b Description:
6853  **
6854  ** This function sets the current desired azimuth and elevation of
6855  ** the character's aim. The angles are in character-local
6856  ** coordinates. Zero values mean straight ahead and level.
6857  ** Aiming will continue until end_aim() is called.
6858  **
6859  ** This function effectively calls aim_at_angle_local(), with a
6860  ** distance of 10000 meters, and is_new_aim set to 1.
6861  **
6862  ** This function will have no effect on a dead character (see
6863  ** die_now() and get_dead()).
6864  **
6865  *b Arguments:
6866  **
6867  *a azimuth - rotation about z (vertical) axis, in degrees;
6868  *a positive rotates to character's left
6869  *a elevation - rotation about y (horizontal) axis, in degrees;
6870  *a positive rotates down
6871  **
6872  *b Returns:
6873  **
6874  ** 0 on success, -1 on failure
6875  */
6876  int set_aim(float azimuth, float elevation);
6877 
6878  /*l
6879  *b Description:
6880  **
6881  ** This function sets the current azimuth, elevation, and
6882  ** distance of the character's aim. A fixed point in 3D space is
6883  ** then found using the two angles and the given distance from
6884  ** the character's idealized position. Angles are given with
6885  ** respect to the Boston Dynamics global coordinate system.
6886  **
6887  ** See set_position() for a description of the coordinate
6888  ** system.
6889  **
6890  ** Aiming will continue until end_aim() is called.
6891  **
6892  ** This function will have no effect on a dead character (see
6893  ** die_now() and get_dead()).
6894  **
6895  *b Arguments:
6896  **
6897  *a azimuth - rotation in degrees about up (vertical) axis;
6898  *a positive rotates to the character's left; zero means
6899  *a in the direction of the positive X axis of the Boston
6900  *a Dynamics coordinate system
6901  *a elevation - rotation in degrees about horizontal axis; positive
6902  *a rotates down
6903  *a distance - distance in meters from the idealized position of the
6904  *a character to the aim target; positive values only,
6905  *a typically this is a large value (e.g. 10,000 meters)
6906  *a is_new_aim - set to 1 if this is a new aim, for jumping to a
6907  *a new target;
6908  *a set to 0 if this is continuing an already
6909  *a started aim, for tracking an existing target
6910  **
6911  *b Returns:
6912  **
6913  ** 0 on success, -1 on failure
6914  */
6915  int aim_at_angle(float azimuth,
6916  float elevation,
6917  float distance,
6918  int is_new_aim = 1);
6919 
6920  /*l
6921  *b Description:
6922  **
6923  ** This function is identical to aim_at_angle() except that it
6924  ** uses body local coordinates for the character. The angles are
6925  ** given with respect to the idealized position of the character.
6926  ** Use get_position() to learn the idealized position. The
6927  ** distance is between the idealized position of the character
6928  ** and the fixation point. Aiming will continue until end_aim()
6929  ** is called.
6930  **
6931  ** This function will have no effect on a dead character (see
6932  ** die_now() and get_dead()).
6933  */
6934  int aim_at_angle_local(float azimuth,
6935  float elevation,
6936  float distance,
6937  int is_new_aim = 1);
6938 
6939  /*l
6940  *b Description:
6941  **
6942  ** This function sets the current fixation point of the
6943  ** character's aim. Point coordinates are given in meters in the
6944  ** Boston Dynamics global coordinate system.
6945  **
6946  ** The function uses default aim behavior settings. Aiming will
6947  ** continue until end_aim() is called.
6948  **
6949  ** This function will have no effect on a dead character (see
6950  ** die_now() and get_dead()).
6951  **
6952  *b Arguments:
6953  **
6954  *a tx, ty, tz - position in meters from the Boston Dynamics global
6955  *a origin
6956  *a is_new_aim - set to 1 if this is a new aim;
6957  *a set to 0 if this is continuing an already started aim
6958  **
6959  *b Returns:
6960  **
6961  ** 0 on success, -1 on failure
6962  */
6963  int aim_at_point(float x, float y, float z, int is_new_aim = 1);
6964 
6965  /*l
6966  *b Description:
6967  **
6968  ** This function is identical to aim_at_point() except that it
6969  ** uses body local coordinates for the character. Use
6970  ** get_position() to learn the idealized position of the
6971  ** character if necessary.
6972  **
6973  ** This function will have no effect on a dead character (see
6974  ** die_now() and get_dead()).
6975  */
6976  int aim_at_point_local(float x, float y, float z, int is_new_aim = 1);
6977 
6978  /*l
6979  *b Description:
6980  **
6981  ** This function effectively does an aim_at_point() each tick.
6982  ** The point to be aimed at is updated each tick to be the position
6983  ** of the specified link on the specified character.
6984  **
6985  ** This function will have no effect on a dead character (see
6986  ** die_now() and get_dead()).
6987  **
6988  *b Callable From:
6989  **
6990  *- - C++
6991  *- - Script
6992  *- - Decision Bead
6993  **
6994  *b Arguments:
6995  **
6996  *a target_character_name - name of the character to be
6997  *a aimed at
6998  *a target_character_link_name - link on the character that should
6999  *a be aimed at; pass NULL or "" to
7000  *a aim at the position link of the
7001  *a character
7002  *a offset_tx, offset_ty, offset_tz - offset onto the link, in meters
7003  **
7004  *b Returns:
7005  **
7006  ** 0 on success, -1 on failure
7007  **
7008  *b C++ Example:
7009  **
7010  *e // aim at the head of character "soldier-1".
7011  *e ch->aim_at_character("soldier-1",
7012  *e "cervical",
7013  *e 0.0,
7014  *e 0.0,
7015  *e 0.0);
7016  */
7017  int aim_at_character(const char* target_character_name,
7018  const char* target_character_link_name = NULL,
7019  float offset_tx = 0.0f,
7020  float offset_ty = 0.0f,
7021  float offset_tz = 0.0f);
7022 
7023  /*l
7024  *b Description:
7025  **
7026  ** This function terminates aiming started by the set_aim(),
7027  ** aim_at_point(), aim_at_point_local(), aim_at_angle(),
7028  ** aim_at_angle_local(), and aim_at_character() functions.
7029  */
7030  void end_aim();
7031 
7032  /*l
7033  *b Description:
7034  **
7035  ** This function attempts to have the character reach its desired
7036  ** aim angles instantly. Because of the algorithm used, this can
7037  ** take a number of iterations to achieve.
7038  **
7039  ** The max_iterations argument sets a maximum limit this function
7040  ** will use to try to acquire the aim. Setting this value too high
7041  ** can reduce performance.
7042  **
7043  *b Arguments:
7044  **
7045  *a max_iterations - maximum number of internal iterations to use
7046  *a to acquire aim
7047  **
7048  *b Returns:
7049  **
7050  ** 1 if aim converged to within tolerances; 0 if not
7051  */
7052  int aim_converge(int max_iterations = 30);
7053 
7054  /*l
7055  *b Returns:
7056  **
7057  ** current aim azimuth; see set_aim()
7058  */
7059  float get_aim_azimuth();
7060 
7061  /*l
7062  *b Returns:
7063  **
7064  ** 1 if the character is aiming 0 if not
7065  **
7066  *b Arguments:
7067  **
7068  *a muzzle_x, muzzle_y, muzzle_z - position of muzzle in meters from
7069  *a the origin
7070  *a far_x, far_y, far_z - position of end target in meters from the
7071  *a origin
7072  **
7073  ** Pass NULL for any values that are not needed.
7074  ** Note: values will be zero if the character isn't currently aiming
7075  */
7076  int get_aim_trajectory(float* muzzle_x, float* muzzle_y, float* muzzle_z,
7077  float* far_x, float* far_y, float* far_z);
7078 
7079  /*l
7080  *b Returns:
7081  **
7082  ** current aim elevation; see set_aim()
7083  */
7084  float get_aim_elevation();
7085 
7086  /*l
7087  *b Description:
7088  **
7089  ** Not all actions of a character will be affected by aim
7090  ** commands. This function returns 1 if this character
7091  ** is currently in an aim-able action.
7092  **
7093  *b Returns:
7094  **
7095  ** 1 if current action is aim-able; 0 if not
7096  */
7097  int get_aim_is_possible();
7098 
7099  /*l
7100  *b Returns:
7101  **
7102  ** 1 if the aim is acquired, 0 if not
7103  */
7104  int get_aim_is_acquired();
7105 
7106  /*l
7107  *b Returns:
7108  **
7109  ** 1 if all links participating in the aim have reached a
7110  ** relatively steady state, 0 if not, -1 on error
7111  */
7112  int get_aim_is_steady();
7113 
7114  /*l
7115  *b Description:
7116  **
7117  ** Currently, 8 is the only valid input for this function,
7118  ** makes a DI-Guy 8 style aim.
7119  */
7120  void set_aim_algorithm(int aim_algorithm);
7121 
7122  /*l
7123  *b Returns:
7124  **
7125  ** current aim algorithm defaults to 8
7126  */
7127  int get_aim_algorithm();
7128 
7129  /*l
7130  *b Returns:
7131  **
7132  ** 1 if character is currently aiming, 0 if not
7133  */
7134  int get_is_aiming();
7135 
7136 
7137  /******************************************************
7138  **
7139  *3 Aim Algorithm 8 Parameters
7140  **
7141  ** This aim algorithm works by adjusting the aiming character's pose
7142  ** such that the difference between the current aim angles and the
7143  ** desired aim angles is decreased each scenario tick.
7144  **
7145  ** How much of that difference that is made up each frame is
7146  ** determined by the factor parameters. The difference between the
7147  ** desired aim angles and the current aim angles, multiplied by a
7148  ** calculated factor, is added to the current aim angles each frame.
7149  ** This causes the aim to "home in" on the desired aim angles.
7150  **
7151  ** For example, if for each frame the calculated factor is 0.5, half
7152  ** of the difference between the desired and current aim angles is
7153  ** made up.
7154  **
7155  ** Unless otherwise specified, all functions callable from:
7156  **
7157  *- - C++
7158  *- - Script
7159  */
7160 
7161  /*l
7162  *b Description:
7163  **
7164  ** This function sets the steady-state factor that is used once
7165  ** an aim is no longer considered "new".
7166  **
7167  ** See the function set_aim_param_new_aim_duration() for information
7168  ** on when an aim is considered new, and how the effective acquire
7169  ** is calculated from this steady-state acquire factor and the
7170  ** new aim factor.
7171  **
7172  ** Setting the acquire factor to something very close to 1 (which
7173  ** would try to make up all of the difference in one frame) can
7174  ** result in an unstable, jittery convergence. The maximum
7175  ** recommended value is 0.95. If the aim is jittery, back off to
7176  ** 0.9 or lower.
7177  **
7178  ** To get "instant" convergence, call aim_converge() or
7179  ** set_aim_converge_every_frame().
7180  **
7181  *b Arguments:
7182  **
7183  *a factor - unitless value between 0 and 1; default is 0.6
7184  */
7185  void set_aim_param_acquire_factor(float factor);
7186 
7187  /*l
7188  *b Returns:
7189  **
7190  ** the current aim acquire factor parameter
7191  */
7192  float get_aim_param_acquire_factor();
7193 
7194  /*l
7195  *b Description:
7196  **
7197  ** This function sets the factor that is used when an aim is
7198  ** considered new.
7199  **
7200  ** See the function set_aim_param_new_aim_duration() for information
7201  ** on when an aim is considered new, and how the effective acquire
7202  ** is calculated from this new aim factor and the steady-state acquire
7203  ** factor.
7204  **
7205  *b Arguments:
7206  **
7207  *a factor - unitless value between 0 and 1; default is 0.05
7208  */
7209  void set_aim_param_new_aim_factor(float factor);
7210 
7211  /*l
7212  *b Returns:
7213  **
7214  ** the current new aim factor parameter
7215  */
7216  float get_aim_param_new_aim_factor();
7217 
7218  /*l
7219  *b Description:
7220  **
7221  ** This function sets how long an aim is considered "new".
7222  **
7223  ** When an aim is brand-new, the effective acquire factor is equal
7224  ** to the new aim factor as set by set_aim_param_new_aim_factor().
7225  ** When the new aim duration has expired, the effective acquire factor
7226  ** is equal to the steady-state acquire factor as set by
7227  ** set_aim_param_acquire_factor(). In between, the effective acquire
7228  ** factor moves smoothly between the two.
7229  **
7230  ** For example, say that the new aim factor is 0.1, the acquire factor
7231  ** is 0.5, and the new aim duration is 0.2 seconds.
7232  ** If a new aim is started, say by a call to aim_at_angle_local(),
7233  ** the effective acquire factor of the first frame will be 0.1. Over
7234  ** the next 0.2 seconds, the effective acquire factor will smoothly
7235  ** ramp up to 0.5, where it will stay until the aim is acquired.
7236  **
7237  *b Arguments:
7238  **
7239  *a duration - how long, in seconds, a new aim should be considered
7240  *a new; default is 1 second
7241  */
7242  void set_aim_param_new_aim_duration(float duration);
7243 
7244  /*l
7245  *b Returns:
7246  **
7247  ** how long, in seconds, a new aim is considered new
7248  */
7249  float get_aim_param_new_aim_duration();
7250 
7251  /*l
7252  *b Description:
7253  **
7254  ** This function sets the maximum factor that can be used for any
7255  ** single frame for aim convergence attempts.
7256  **
7257  ** See set_aim_param_acquire_factor() for a discussion of why setting
7258  ** this too close to 1 is not recommended.
7259  **
7260  *b Arguments:
7261  **
7262  *a factor - unitless value between 0 and 1; default is 0.95
7263  */
7264  void set_aim_param_max_per_frame_adj_factor(float factor);
7265 
7266  /*l
7267  *b Returns:
7268  **
7269  ** the maximum per-frame adjustment factor parameter
7270  */
7271  float get_aim_param_max_per_frame_adj_factor();
7272 
7273  /*l
7274  *b Description:
7275  **
7276  ** This function sets how close the current aim azimuth must be to
7277  ** the desired aim azimuth in order for the aim to be considered
7278  ** acquired.
7279  **
7280  ** Note that the aim isn't fully acquired until both azimuth and
7281  ** elevation are acquired.
7282  **
7283  ** Setting this value too close to 0 will result in the aim never
7284  ** being acquired.
7285  **
7286  *b Arguments:
7287  **
7288  *a range - how close, in degrees, the azimuth must be for the
7289  *a aim to be acquired; default is 0.5 degrees
7290  */
7291  void set_aim_param_azimuth_acquired_range(float range);
7292 
7293  /*l
7294  *b Returns:
7295  **
7296  ** how close, in degrees, the azimuth must be for the aim to be
7297  *a acquired
7298  */
7299  float get_aim_param_azimuth_acquired_range();
7300 
7301  /*l
7302  *b Description:
7303  **
7304  ** This function sets how close the current aim elevation must be to
7305  ** the desired aim elevation in order for the aim to be considered
7306  ** acquired.
7307  **
7308  ** Note that the aim isn't fully acquired until both azimuth and
7309  ** elevation are acquired.
7310  **
7311  ** Setting this value too close to 0 will result in the aim never
7312  ** being acquired.
7313  **
7314  *b Arguments:
7315  **
7316  *a range - how close, in degrees, the elevation must be for the
7317  *a aim to be acquired; default is 1.0 degrees
7318  */
7319  void set_aim_param_elevation_acquired_range(float range);
7320 
7321  /*l
7322  *b Returns:
7323  **
7324  ** how close, in degrees, the elevation must be for the aim to be
7325  *a acquired
7326  */
7327  float get_aim_param_elevation_acquired_range();
7328 
7329  /*l
7330  *b Description:
7331  **
7332  ** This function attempts to have the character reach its desired
7333  ** aim angles instantly, every frame. Because of the algorithm used,
7334  ** this can take a number of iterations to achieve.
7335  **
7336  ** The max_iterations argument sets a maximum limit this function
7337  ** will use to try to acquire the aim. Setting this value too high
7338  ** can reduce performance.
7339  **
7340  ** Set max_iterations to 0 to disable instant aim convergence.
7341  **
7342  ** For a one-time instant convergence, call aim_converge().
7343  **
7344  *b Arguments:
7345  **
7346  *a max_iterations - maximum number of internal iterations to use
7347  *a to acquire aim
7348  */
7349  void set_aim_converge_every_frame(int max_iterations = 30);
7350 
7351  /*l
7352  *b Returns:
7353  **
7354  ** how many iterations will be used each frame for attempt at
7355  ** per-frame instant convergence; 0 if instant convergence is
7356  ** disabled
7357  */
7358  int get_aim_converge_every_frame();
7359 
7360 
7361 
7362 /*****************************************************************************/
7372  /*l
7373  *b Description:
7374  **
7375  ** This function causes a character to fire his weapon.
7376  **
7377  ** Different weapons have different "munition types", which specify,
7378  ** among other things, the sound to be played, the network info to be
7379  ** sent, and muzzle flash effect. See
7380  ** get_weapon_muzzle_munition_type() for more information on munition
7381  ** types.
7382  **
7383  ** If the weapon fires live rounds (as set by
7384  ** set_weapon_fires_live_rounds()) this function also computes a
7385  ** bullet trajectory, perhaps hitting and killing another character.
7386  **
7387  ** This function will have no effect on a dead character (see
7388  ** die_now() and get_dead()).
7389  **
7390  *b Returns:
7391  **
7392  ** 0 on success, -1 on failure
7393  **
7394  *b Callable From:
7395  **
7396  *- - C++
7397  *- - Script
7398  *- - Decision Bead
7399  */
7400  int fire_weapon(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7401 
7402  /*l
7403  *b Description:
7404  **
7405  ** This function causes a character to fire his weapon the
7406  ** specified number of times. This causes a muzzle flash and
7407  ** the weapon's sound (if any) to be played.
7408  **
7409  ** The sound played will be one of, in order:
7410  **
7411  *- - the passed override_sound_name, or
7412  *- - the sound set by set_weapon_sound_override(), or
7413  *- - the default weapon sound based on the character's appearance
7414  **
7415  ** If the weapon fires live rounds (as set by
7416  ** set_weapon_fires_live_rounds()), this function also computes a
7417  ** trajectory for each round, perhaps hitting and killing
7418  ** another character.
7419  **
7420  ** This function will have no effect on a dead character (see
7421  ** die_now() and get_dead()).
7422  **
7423  *b Arguments:
7424  **
7425  *a count - number of times weapon should be fired
7426  *a override_sound_name - override sound to be played
7427  *a dt - time between firings if count > 1
7428  *a muzzle - muzzle on which flash should appear
7429  **
7430  *b Returns:
7431  **
7432  ** 0 on success, -1 on failure
7433  **
7434  *b Callable From:
7435  **
7436  *- - C++
7437  *- - Script
7438  *- - Decision Bead
7439  */
7440  int fire_weapon_n_times(int count,
7441  float dt = 0.2f,
7442  const char* override_sound_name = NULL,
7444 
7445  /*l
7446  *b Description:
7447  **
7448  ** Fires a bullet at point (x, y) from the camera, using this
7449  ** character as the attacker.
7450  **
7451  *i Currently OpenGL only.
7452  **
7453  ** This function will have no effect on a dead character (see
7454  ** die_now() and get_dead()).
7455  **
7456  *b Returns:
7457  **
7458  ** number of hits
7459  */
7460  int fire_screen_space_bullet(diguyView* view, float x, float y);
7461 
7462  /*l
7463  *b Returns:
7464  **
7465  ** number of times weapon has been fired from specified muzzle
7466  **
7467  *b Callable From:
7468  **
7469  *- - C++
7470  *- - Script
7471  *- - Decision Bead
7472  */
7473  int get_weapon_fire_count(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7474 
7475  /*l
7476  *b Description:
7477  **
7478  ** This function sets the default muzzle that will flash when
7479  ** the character fires its weapon due to a call to fire_weapon()
7480  ** or fire_weapon_n_times().
7481  **
7482  ** The default value is DIGUY_MUZZLE_DEFAULT.
7483  **
7484  *b Arguments:
7485  **
7486  *a muzzle - the muzzle that will flash; muzzle 1 is common
7487  **
7488  *b Returns:
7489  **
7490  ** 0 on success, -1 on failure
7491  */
7492  int set_default_weapon_muzzle(diguyMuzzle muzzle);
7493 
7494  /*l
7495  *b Returns:
7496  **
7497  ** current default weapon muzzle that flashes when the character's
7498  ** weapon is fired; see set_default_weapon_muzzle()
7499  */
7500  diguyMuzzle get_default_weapon_muzzle();
7501 
7502  /*l
7503  *b Description:
7504  **
7505  ** When the character fires its weapon, the results depend on the
7506  ** munition type of the muzzle fired from. Munition types specify,
7507  ** among other things:
7508  **
7509  *- - sound played
7510  *- - muzzle flash effect
7511  *- - network data sent (DIS septet)
7512  *- - detonation effect
7513  *- - detonation radius
7514  *- - etc.
7515  **
7516  ** Default munition types for the each muzzle are set automatically
7517  ** when the character's appearance is set. The munition type of the
7518  ** weapon can be overridden by calling
7519  ** set_weapon_munition_type_override().
7520  **
7521  ** Current munition types include:
7522  **
7523  *- - m16
7524  *- - m4
7525  *- - m60
7526  *- - m240
7527  *- - m249
7528  *- - m9
7529  *- - hand_gun
7530  *- - 50cal
7531  *- - m256
7532  *- - ak47
7533  *- - pk74
7534  *- - dragunov
7535  *- - sa80
7536  *- - rpg
7537  *- - m203
7538  *- - 40mm_hedp
7539  *- - javelin
7540  *- - stinger
7541  *- - at4
7542  *- - sa7
7543  *- - molotov_cocktail
7544  *- - 60mm_mortar
7545  *- - 82mm_mortar
7546  *- - 155mm_artillery
7547  *- - IED_mortar
7548  *- - VBIED
7549  *- - m242
7550  *- - 120mm
7551  *- - 125mm
7552  *- - ced
7553  *- - pepper_spray
7554  **
7555  *b Returns:
7556  **
7557  ** munition type of specified muzzle
7558  */
7559  const char* get_weapon_muzzle_munition_type(diguyMuzzle muzzle);
7560 
7561  /*l
7562  *b Returns:
7563  **
7564  ** munition type of default muzzle, as set by
7565  ** set_default_weapon_muzzle()
7566  */
7567  const char* get_default_muzzle_munition_type();
7568 
7569  /*l
7570  *b Description:
7571  **
7572  ** This function allows the default munition type to be overridden.
7573  ** The default value is NULL (don't override default munition type).
7574  **
7575  *b Arguments:
7576  **
7577  *a munition_type - name of a munition type
7578  **
7579  *b Returns:
7580  **
7581  ** 0 on success, -1 on failure
7582  */
7583  int set_weapon_munition_type_override(const char* munition_type);
7584 
7585  /*l
7586  *b Returns:
7587  **
7588  ** current munition type override in effect, or NULL if none;
7589  ** set_weapon_munition_type_override()
7590  */
7591  const char* get_weapon_munition_type_override();
7592 
7593  /*l
7594  *b Description:
7595  **
7596  ** This function sets whether the character's weapons fire live
7597  ** rounds. If so, when fire_weapon() and fire_weapon_n_times() are
7598  ** called the trajectory of the bullet will be calculated and checked
7599  ** against characters in the scenario.
7600  **
7601  ** The default value is 1.
7602  **
7603  *b Arguments:
7604  **
7605  *a weapon_fires_live_rounds - set to 1 for live rounds; set to 0
7606  *a for "blanks"
7607  **
7608  *b Returns:
7609  **
7610  ** 0 on success, -1 on failure
7611  **
7612  *b Callable From:
7613  **
7614  *- - C++
7615  *- - Script
7616  *- - Decision Bead
7617  */
7618  int set_weapon_fires_live_rounds(int weapon_fires_live_rounds);
7619 
7620  /*l
7621  *b Returns:
7622  **
7623  ** current setting of whether weapon fires live rounds or blanks; see
7624  ** set_weapon_fires_live_rounds()
7625  **
7626  *b Callable From:
7627  **
7628  *- - C++
7629  *- - Script
7630  *- - Decision Bead
7631  */
7632  int get_weapon_fires_live_rounds();
7633 
7634  /*l
7635  *b Description:
7636  **
7637  ** A weapon sound is played when the character fires its weapon
7638  ** due to a call to fire_weapon() or fire_weapon_n_times().
7639  ** The sound that is played is generally derived from the weapon's
7640  ** munition type, which can be different for each muzzle.
7641  **
7642  ** This function overrides the default sound that will be played.
7643  ** Note that this overrides the sound for all muzzles.
7644  **
7645  ** The default value is NULL (don't override default sound).
7646  **
7647  ** To *not* play a sound at all, set the weapon sound gain override
7648  ** to 0.
7649  **
7650  *b Arguments:
7651  **
7652  *a sound - name of a sound defined in the scenario;
7653  *a pass NULL to specify that default should be played
7654  **
7655  *b Returns:
7656  **
7657  ** 0 on success, -1 on failure
7658  */
7659  int set_weapon_sound_override(const char* sound_name);
7660 
7661  /*l
7662  *b Description:
7663  **
7664  ** The function returns the current weapon sound override, if one
7665  ** is set; see set_weapon_sound_override().
7666  **
7667  ** This function will not return NULL. The empty string ("") is
7668  ** returned if a weapon sound override is not set.
7669  **
7670  *b Returns:
7671  **
7672  ** name of weapon sound override
7673  */
7674  const char* get_weapon_sound_override();
7675 
7676  /*l
7677  *b Description:
7678  **
7679  ** This function overrides the default gain on the sound played
7680  ** due to a call to fire_weapon() or fire_weapon_n_times().
7681  **
7682  ** Pass 1.0 to use the sound's default amplitude. Lower numbers
7683  ** decrease volume, higher numbers increase volume.
7684  **
7685  ** Pass 0.0 to completely disable playing of weapon sound.
7686  **
7687  ** The default value is 3.0.
7688  **
7689  ** See set_weapon_sound_override().
7690  **
7691  *b Arguments:
7692  **
7693  *a sound_gain - amount by which to change sound volume
7694  **
7695  *b Returns:
7696  **
7697  ** 0 on success, -1 on failure
7698  */
7699  int set_weapon_sound_gain_override(float gain);
7700 
7701  /*l
7702  *b Returns:
7703  **
7704  ** current override gain for weapon sound; see
7705  ** set_weapon_sound_gain_override()
7706  */
7707  float get_weapon_sound_gain_override();
7708 
7709  /*l
7710  *b Description:
7711  **
7712  ** This function provides aiming assistance by making it possible for
7713  ** roughly-aimed weapons to hit targets. When spread is nonzero,
7714  ** fire_weapon searches for a target within a conical space centered
7715  ** on the muzzle. Within this cone, the live character within weapon
7716  ** range, and with the smallest angular deviation from the weapon, is
7717  ** chosen, by default, as the target. Other function calls may alter
7718  ** this aiming behavior, making it aim only at enemy targets, for
7719  ** example, or making it prefer close targets to far ones.
7720  **
7721  *b Arguments:
7722  **
7723  *a spread - angular deviation from weapon muzzle within which a
7724  *a target will be found
7725  **
7726  ** Spread values above 145 are suicidal (character can shoot himself).
7727  ** 90 is the highest sensible value, which covers everything ahead
7728  ** of the weapon muzzle. A value of 0 is the default, meaning that
7729  ** only targets in line with the muzzle are hit.
7730  */
7731  void set_weapon_spread(float spread);
7732 
7733  /*l
7734  *b Description:
7735  **
7736  ** This function affects how targets are chosen when
7737  ** the character's weapon_spread is nonzero. Only
7738  ** characters more than near_range meters away from the muzzle
7739  ** will be fired upon. Characters which are closer than
7740  ** near_range meters will not be fired upon.
7741  **
7742  ** This value does not affect weapon behavior when weapon_spread
7743  ** is zero.
7744  **
7745  ** If this function is never called for a character, it is as if
7746  ** the function had been called with a value of zero.
7747  **
7748  *b Arguments:
7749  **
7750  *a near_range - distance closer than which no character will be
7751  *a targeted
7752  */
7753  void set_weapon_near_range(float near_range);
7754 
7755  /*l
7756  *b Description:
7757  **
7758  ** This function sets the range of the character's
7759  ** weapon.
7760  **
7761  ** If this function is never called for a character, it is as if
7762  ** the function had been called with a value of 500.0.
7763  **
7764  *b Arguments:
7765  **
7766  *a far_range - range of the weapon in meters
7767  */
7768  void set_weapon_far_range(float far_range);
7769 
7770  /*l
7771  *b Description:
7772  **
7773  ** This function sets a weapon's ratio of hits to fired rounds. A
7774  ** value of 1.0 (the default) means the weapon will hit everything it
7775  ** is aimed at. Values less than 1.0 cause the weapon to
7776  ** probabilistically miss targets, even when perfectly aimed at them.
7777  ** A value of zero means the weapon doesn't hit anything, even if it
7778  ** is perfectly aimed. A value of 0.5 will hit half of the time.
7779  */
7780  void set_weapon_hit_ratio(float hit_ratio);
7781 
7782  /*l
7783  *b Description:
7784  **
7785  ** This function sets the number of potential impacts a fired round
7786  ** can have. The default is 1. Specifying more than 1 means the
7787  ** round will completely go through objects, triggering a
7788  ** CALLBACK_ID_IMPACT callback each time, until the maximum number of
7789  ** impacts has been reached.
7790  */
7791  void set_weapon_max_impacts(int val);
7792 
7793  /*l
7794  *b Returns:
7795  **
7796  ** state of accessory1
7797  */
7798  int get_accessory1_state();
7799 
7800  /*l
7801  *b Returns:
7802  **
7803  ** state of the character's rifle
7804  */
7805  int get_rifle_state();
7806 
7807  /*l
7808  *b Description
7809  **
7810  ** This function sets whether the projectiles of certain appearances'
7811  ** weapons (such as rocket launchers and RPGs) are visible. Note that
7812  ** most weapons do not have visible projectiles and this function will
7813  ** therefore have no effect.
7814  **
7815  *b Arguments:
7816  **
7817  *a muzzle - which muzzle's projectile should be shown/hidden
7818  *a is_visible - pass 1 to show, pass 0 to hide
7819  **
7820  *b Returns:
7821  **
7822  ** 0 on success, -1 on failure
7823  */
7824  int set_weapon_projectile_is_visible(diguyMuzzle muzzle, int is_visible);
7825 
7826  /*l
7827  *b Description
7828  **
7829  ** This function returns the most recent setting of
7830  ** set_weapon_projectile_is_visible().
7831  **
7832  *b Arguments:
7833  **
7834  *a muzzle - which muzzle's projectile should be queried
7835  **
7836  *b Returns:
7837  **
7838  ** 1 if visible, 0 if not
7839  */
7840  int get_weapon_projectile_is_visible(diguyMuzzle muzzle);
7841 
7842  /*l
7843  *b Description:
7844  **
7845  ** Retrieves the position and direction of the character's weapon.
7846  **
7847  *b Arguments:
7848  **
7849  *a muzzle_tx, muzzle_ty, muzzle_tz - muzzle position, and beginning
7850  *a of aim vector
7851  *a end_pt_tx, end_pt_ty, end_pt_tz - end point of aim vector
7852  *a muzzle_rz, muzzle_rx, muzzle_ry - orientation of muzzle in degrees
7853  *a muzzle - the muzzle for which the aim vector is needed
7854  *a in_character_local_coordinates - pass 0 for values in world
7855  *a coordinates (the default), 1 for values in character-local
7856  *a coordinates
7857  **
7858  ** The muzzle position and end point are in meters from the origin
7859  ** (if using world coordinates) or in meters from the character's
7860  ** position (if using character-local coordinates).
7861  **
7862  ** The distance of the end point from the muzzle position should
7863  ** be the weapon's far range, set by set_weapon_far_range().
7864  **
7865  ** Pass NULL for any values that are not needed.
7866  **
7867  ** *Note:* The muzzle argument is currently not used, and is present
7868  ** for future implementation.
7869  **
7870  *b Returns:
7871  **
7872  ** 0 on success, -1 on failure
7873  */
7874  int get_weapon_aim_vector(float* muzzle_tx, float* muzzle_ty, float* muzzle_tz,
7875  float* end_pt_tx = NULL, float* end_pt_ty = NULL, float* end_pt_tz = NULL,
7876  float* muzzle_rz = NULL, float* muzzle_rx = NULL, float* muzzle_ry = NULL,
7877  int in_character_local_coordinates = 0,
7879 
7880  /*l
7881  *b Description
7882  **
7883  ** This function returns the link the passed muzzle is associated
7884  ** with. For example, soldier rifle muzzles are attached to the
7885  ** "rifle_joint" link.
7886  **
7887  ** Call get_muzzle_offset() to get the offset of the muzzle on this
7888  ** link.
7889  **
7890  *b Arguments:
7891  **
7892  *a muzzle - muzzle of interest
7893  **
7894  *b Returns:
7895  **
7896  ** name of link, or NULL if the character doesn't have the specified
7897  ** muzzle
7898  */
7899  const char* get_muzzle_link(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT);
7900 
7901  /*l
7902  *b Description
7903  **
7904  ** This function returns the offset of the muzzle from the link it
7905  ** is attached to as returned by get_muzzle_link().
7906  **
7907  *b Arguments:
7908  **
7909  *a muzzle - muzzle of interest
7910  *a offset_x, offset_y, offset_z - variables in which to return results
7911  **
7912  *b Returns:
7913  **
7914  ** 0 on success, -1 on failure
7915  */
7916  int get_muzzle_offset(diguyMuzzle muzzle = DIGUY_MUZZLE_DEFAULT,
7917  float* offset_x = NULL,
7918  float* offset_y = NULL,
7919  float* offset_z = NULL);
7920 
7921  /*l
7922  *b Description
7923  **
7924  ** This function sets the highest horizontal error possible when the
7925  ** weapon is fired. If non-0, a random horizontal error angle will
7926  ** be computed and added to the weapon's horizontal aim angle.
7927  **
7928  *b Arguments:
7929  **
7930  *a h_error - highest possible horizontal error
7931  **
7932  *b Returns:
7933  **
7934  ** 0 on success, -1 on failure
7935  */
7936  int set_weapon_max_azimuth_error(float h_error);
7937 
7938  /*l
7939  *b Returns:
7940  **
7941  ** maximum horizontal aim error
7942  */
7943  float get_weapon_max_azimuth_error();
7944 
7945  /*l
7946  *b Description
7947  **
7948  ** Similar to set_weapon_max_azimuth_error(), but for vertical aim.
7949  */
7950  int set_weapon_max_elevation_error(float v_error);
7951 
7952  /*l
7953  *b Description
7954  **
7955  ** Similar to get_weapon_max_azimuth_error(), but for vertical aim.
7956  */
7957  float get_weapon_max_elevation_error();
7958 
7959  /*l
7960  *b Description
7961  **
7962  ** This function sets whether tracer effects will be shown when
7963  ** the weapon is fired. Not all weapons will support this effect.
7964  **
7965  *b Arguments:
7966  **
7967  *a enabled - pass 1 to enable, 0 to disable
7968  **
7969  *b Returns:
7970  **
7971  ** 0 on success, -1 on failure
7972  */
7973  int set_weapon_tracers_enabled(int enabled);
7974 
7975  /*l
7976  *b Returns:
7977  **
7978  ** 1 if tracer effect is enabled, 0 if not
7979  */
7980  int get_weapon_tracers_enabled();
7981 
7982  /*l
7983  *b Returns:
7984  **
7985  ** number of rounds until next tracer
7986  */
7987  int get_weapon_rounds_until_tracer(diguyMuzzle muzzle);
7988 
7989  /*l
7990  *b Description
7991  **
7992  ** This function sets whether a shell eject effect will be shown when
7993  ** the weapon is fired. Not all weapons will support this effect.
7994  **
7995  *b Arguments:
7996  **
7997  *a enabled - pass 1 to enable, 0 to disable
7998  **
7999  *b Returns:
8000  **
8001  ** 0 on success, -1 on failure
8002  */
8003  int set_weapon_shell_eject_enabled(int enabled);
8004 
8005  /*l
8006  *b Returns:
8007  **
8008  ** 1 if shell eject effect is enabled, 0 if not
8009  */
8010  int get_weapon_shell_eject_enabled();
8011 
8012  /*l
8013  *b Description
8014  **
8015  ** This function sets whether a smoke effect will be shown when the
8016  ** weapon is fired. Not all weapons will support this effect.
8017  **
8018  *b Arguments:
8019  **
8020  *a enabled - pass 1 to enable, 0 to disable
8021  **
8022  *b Returns:
8023  **
8024  ** 0 on success, -1 on failure
8025  */
8026  int set_weapon_smoke_enabled(int enabled);
8027 
8028  /*l
8029  *b Returns:
8030  **
8031  ** 1 if muzzle smoke effect is enabled, 0 if not
8032  */
8033  int get_weapon_smoke_enabled();
8034 
8035  /*l
8036  *b Description:
8037  **
8038  ** Similar to diguyScenario::trigger_detonation(), but detonation
8039  ** occurs at character's position.
8040  **
8041  *b Arguments:
8042  **
8043  *a munition_name - name of the munition to detonate
8044  *a attacker_name - this MUST be specified if the detonation is being
8045  *a broadcast over the network
8046  *a radius_override - defaults to the data in the munition config file
8047  *a broadcast_on_network - pass 0 to not broadcast detonation on DIS
8048  *a network
8049  **
8050  ** Note: Overriding the detonation radius will NOT work on broadcast
8051  ** detonations since the override value is not transmitted.
8052  */
8053  int trigger_detonation_on_character(const char* munition_name,
8054  const char* attacker_name = NULL,
8055  float radius_override = -1.0f,
8056  int broadcast_on_network = 1);
8057 
8058 
8059 /*****************************************************************************/
8070  /*l
8071  *b Description:
8072  **
8073  ** This function changes the face of the character to reflect the
8074  ** specified user-defined named facial expression.
8075  **
8076  ** Currently affects only "facefx" appearances.
8077  **
8078  *b Arguments:
8079  **
8080  *a facex_name - name of face expression to be applied
8081  *a blend_duration - how long (in seconds) to take to change the face
8082  *a strength - a multiplier between 0 and 1 on the expression
8083  **
8084  ** Face expressions available by default in new scenarios are:
8085  **
8086  *- - Neutral
8087  *- - Smile_cl
8088  *- - Trust
8089  *- - Sad
8090  *- - Mad
8091  *- - Distrust
8092  *- - Conniving
8093  *- - Smile
8094  *- - BrowsDown
8095  *- - BrowsUp
8096  **
8097  ** New face expressions can be added using the
8098  ** diguyScenario::create_face_expression() function.
8099  **
8100  *b Returns:
8101  **
8102  ** 0 on success, -1 on failure
8103  **
8104  *b Callable From:
8105  **
8106  *- - C++
8107  *- - Script
8108  *- - Decision Bead
8109  **
8110  *b C++ Example:
8111  **
8112  *e diguyCharacter* ch = scenario->get_character_at_index(0);
8113  *e
8114  *e // take one second to get mad
8115  *e ch->set_face_expression("Mad", 1.0);
8116  */
8117  int set_face_expression(const char* facex_name, float blend_duration, float strength = 1.0f);
8118 
8119  /*l
8120  *b Description:
8121  **
8122  ** This function sets the current azimuth and elevation of the
8123  ** character's eyes.
8124  **
8125  ** Currently affects only "facefx" appearances.
8126  **
8127  *b Arguments:
8128  **
8129  *a azimuth - rotation about up (vertical) axis, in degrees;
8130  *a positive rotates to character's left
8131  *a elevation - rotation about forward (horizontal) axis, in degrees;
8132  *a positive rotates down
8133  *a blend_time - how long to take to reach new orientation
8134  **
8135  *b Returns:
8136  **
8137  ** 0 on success, -1 on failure
8138  **
8139  */
8140  int set_orientation_eyes(float azimuth,
8141  float elevation,
8142  float blend_time = 0.0f);
8143 
8144  /*l
8145  *b Description:
8146  **
8147  ** This function gets the current azimuth and elevation of the
8148  ** character's eyes. It currently doesn't take blending into account.
8149  **
8150  ** Currently affects only "facefx" appearances.
8151  **/
8152  int get_orientation_eyes(float* azimuth, float* elevation);
8153 
8154  /*l
8155  *b Description:
8156  **
8157  ** Sets how open the eyes are. The eyes will stay at this level
8158  ** indefinitely. To get automatic blinking behavior, call blink().
8159  **
8160  *b Arguments:
8161  **
8162  *a droop_amount - 1 = eyes closed, 0 = eyes open, 0.5 = half open
8163  **
8164  *b Returns:
8165  **
8166  ** 0 on success, -1 on failure
8167  **
8168  *b Callable From:
8169  **
8170  *- - C++
8171  *- - Script
8172  *- - Decision Bead
8173  */
8174  int set_eye_droop(float droop_amount, float blend_time = 0.0f);
8175 
8176  /*l
8177  *b Returns:
8178  **
8179  ** how open the eyes are as set by set_eye_droop().
8180  */
8181  float get_eye_droop();
8182 
8183  /*l
8184  *b Description:
8185  **
8186  ** This function blinks the eyes. To have the eyes close to a
8187  ** specific amount and stay there, call set_eye_droop().
8188  **
8189  ** Only characters with expressive face appearances can blink.
8190  **
8191  *b Arguments:
8192  **
8193  *a duration_in - how long in seconds the first part of the blink
8194  *a (typically eyes closing) should take
8195  *a duration_out - how long in seconds the second part of the blink
8196  *a (typically eyes opening) should take
8197  *a target_in - how closed the eyes should be at duration_in
8198  *a target_out - how open the eyes should be at duration_out and
8199  *a thereafter
8200  *a tin - time at which blink should occur; default is now
8201  **
8202  *b Returns:
8203  **
8204  ** 0 on success, -1 on failure
8205  **
8206  *b Callable From:
8207  **
8208  *- - C++
8209  *- - Script
8210  *- - Decision Bead
8211  */
8212  int blink(float duration_in = 0.1f,
8213  float duration_out = 0.2f,
8214  float target_in = 1.0f,
8215  float target_out = 0.0f,
8216  float tin = DIGUY_DEFAULT_FLOAT);
8217 
8218  /*l
8219  *b Description:
8220  **
8221  ** This function enables automatic eye blinking, so that blinks
8222  ** will happen without further function calls. The various
8223  ** controlling factors of blinks are set by the following functions:
8224  **
8225  *- - set_automatic_blink_duration_in()
8226  *- - set_automatic_blink_duration_out()
8227  *- - set_automatic_blink_target_in()
8228  *- - set_automatic_blink_target_out()
8229  **
8230  ** See blink() for information on what these factors mean.
8231  **
8232  ** Only characters with expressive face appearances can blink.
8233  **
8234  *b Arguments:
8235  **
8236  *a enabled - pass 1 to enable automatic blinks; 0 to disable
8237  *a period - how many seconds between each blink
8238  *a period_variation - variation on how many seconds between
8239  *a each blink
8240  **
8241  ** If blinks are enabled, the first blink will happen immediately.
8242  ** Successive blinks will happen between times (period -
8243  ** period_variation) and (period + period_variation) after the
8244  ** previous blink ends.
8245  **
8246  *b Returns:
8247  **
8248  ** 0 on success, -1 on failure
8249  **
8250  *b Callable From:
8251  **
8252  *- - C++
8253  *- - Script
8254  *- - Decision Bead
8255  */
8256  int set_automatic_blinks_enabled(int enabled,
8257  float period = 6.0f,
8258  float period_variation = 3.0f);
8259 
8260  /*l
8261  *b Returns:
8262  **
8263  ** 1 if automatic eye blinks are enabled, 0 if not; see
8264  ** set_automatic_blinks_enabled()
8265  */
8266  int get_automatic_blinks_enabled();
8267 
8268  /*l
8269  *b Description:
8270  **
8271  ** This function sets how long it will take the eye to close during
8272  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8273  ** blink().
8274  **
8275  *b Arguments:
8276  **
8277  *a duration_in - time in seconds for eye droop to go from droop
8278  *a target in to target out
8279  **
8280  *b Callable From:
8281  **
8282  *- - C++
8283  *- - Script
8284  *- - Decision Bead
8285  */
8286  void set_automatic_blink_duration_in(float duration_in);
8287 
8288  /*l
8289  *b Returns:
8290  **
8291  ** most recent setting of set_automatic_blink_duration_in()
8292  */
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 Callable From:
8308  **
8309  *- - C++
8310  *- - Script
8311  *- - Decision Bead
8312  */
8313  void set_automatic_blink_duration_out(float duration_out);
8314 
8315  /*l
8316  *b Returns:
8317  **
8318  ** most recent setting of set_automatic_blink_duration_out()
8319  */
8320  float get_automatic_blink_duration_out();
8321 
8322  /*l
8323  *b Description:
8324  **
8325  ** This function sets how much the eye will close during
8326  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8327  ** blink().
8328  **
8329  *b Arguments:
8330  **
8331  *a target_in - how far to close eye; 1.0 is all closed, 0.0 is
8332  *a all open
8333  **
8334  *b Callable From:
8335  **
8336  *- - C++
8337  *- - Script
8338  *- - Decision Bead
8339  */
8340  void set_automatic_blink_target_in(float target_in);
8341 
8342  /*l
8343  *b Returns:
8344  **
8345  ** most recent setting of set_automatic_blink_target_in()
8346  */
8347  float get_automatic_blink_target_in();
8348 
8349  /*l
8350  *b Description:
8351  **
8352  ** This function sets how much the eye will open during
8353  ** automatic eye blinks. See set_automatic_blinks_enabled() and
8354  ** blink().
8355  **
8356  *b Arguments:
8357  **
8358  *a target_out - how far to open eye; 1.0 is all closed, 0.0 is
8359  *a all open
8360  **
8361  *b Callable From:
8362  **
8363  *- - C++
8364  *- - Script
8365  *- - Decision Bead
8366  */
8367  void set_automatic_blink_target_out(float target_out);
8368 
8369  /*l
8370  *b Returns:
8371  **
8372  ** most recent setting of set_automatic_blink_target_out()
8373  */
8374  float get_automatic_blink_target_out();
8375 
8376  /*l
8377  *b Returns:
8378  **
8379  ** 1 if the character is speaking, 0 if not. With a FaceFX character
8380  ** this is true if a character is actively playing a FaceFX animation
8381  */
8382  int is_speaking();
8383 
8384  /*l
8385  *b Description:
8386  **
8387  ** FaceFX animations are referred to as a group/animation name.
8388  ** This function allows you to set the current group once.
8389  ** See diguyScenario::facefx_mount_animset() for how to load a new
8390  ** animset on an actor.
8391  */
8392  int set_current_facefx_animation_group(const char* anim_group);
8393 
8394  /*l
8395  *b Returns:
8396  **
8397  ** the current FaceFX animation group set for this character
8398  */
8399  const char* get_current_facefx_animation_group();
8400 
8401  /*l
8402  *b Returns:
8403  **
8404  ** the name of the FaceFX actor that goes with the current head
8405  ** appearance; returns NULL if there's no FaceFX actor
8406  */
8407  const char* get_facefx_actor();
8408 
8409  /*l
8410  *b Description:
8411  **
8412  ** Mounts an animset on the current FaceFX actor. See also
8413  ** diguyScenario::facefx_mount_animset()
8414  */
8415  int facefx_mount_animset(const char* file_name);
8416 
8417  /*l
8418  *b Description:
8419  **
8420  ** Plays a FaceFX animation. This is the main way a facial animation
8421  ** sequence is triggered. The animation can be named
8422  ** "group_name/animation" or just "animation" if the proper group has
8423  ** been set with set_current_facefx_animation_group().
8424  */
8425  int play_facefx_animation(const char* animation,
8426  float magnitude_scale = 1.0f,
8427  float duration_scale = 1.0f,
8428  float blendin_time = 0.1f,
8429  float blendout_time = 0.1f,
8430  int loop = 0);
8431 
8432  /*l
8433  *b Description:
8434  **
8435  ** Stops all active FaceFX animation.
8436  */
8437  int stop_facefx_animations(float blend_time = 0.25f, int stop_sounds = 1);
8438 
8439  //
8440  // Lower level FaceFX control functions
8441  //
8442 
8443  /*l
8444  *b Returns:
8445  **
8446  ** the number of nodes in the FaceFX actor's face graph
8447  */
8448  int get_num_facefx_nodes();
8449 
8450  /*l
8451  *b Returns:
8452  **
8453  ** the name of the node with index 'index' in the FaceFX actor's face
8454  ** graph
8455  */
8456  const char* get_facefx_node_name(int index);
8457 
8458  /*l
8459  *b Returns:
8460  **
8461  ** the index of the node with name 'node_name'
8462  */
8463  int find_facefx_node_index(const char* node_name);
8464 
8465  /*l
8466  *b Description:
8467  **
8468  ** Allows low level control of individual nodes of the characters face
8469  ** graph. End users can use this function to get finer grained
8470  ** control over eye direction and emotional state.
8471  */
8472  int set_facefx_node_value(int node_index,
8473  float value,
8474  float blend_time = 0.25f);
8475 
8476  /*l
8477  *b Description:
8478  **
8479  ** Retreives the current final value of a node
8480  **/
8481  float get_facefx_node_value(int node_index);
8482 
8483 /*****************************************************************************/
8527  /*l
8528  *b Description:
8529  **
8530  ** This function creates (but does not begin) the specified gesture.
8531  ** Exact control over the gesture, such as number of repetitions,
8532  ** when the gesture should begin, when it should end, when it
8533  ** should reach specific points within the gestures, etc., is then
8534  ** possible by making calls through the returned
8535  ** diguyCharacterGesture object.
8536  **
8537  ** To begin execution of the gesture, call the begin_now() function
8538  ** of the diguyCharacterGesture object.
8539  **
8540  ** *Do not* call delete on the returned object. It should be
8541  ** destroyed either by calling destroy_gesture(), or by calling
8542  ** set_automatic_destroy_flag(1) on the diguyCharacterGesture
8543  ** object.
8544  **
8545  *b Arguments:
8546  **
8547  *a gesture_name - name of the gesture of create
8548  **
8549  *b Returns:
8550  **
8551  ** pointer to object of type diguyCharacterGesture
8552  */
8553  diguyCharacterGesture* create_gesture(const char* gesture_name);
8554 
8555  /*l
8556  *b Description:
8557  **
8558  ** This function destroys a gesture object created by
8559  ** create_gesture().
8560  **
8561  *b Arguments:
8562  **
8563  *a gesture - gesture to destroy
8564  **
8565  *b Returns:
8566  **
8567  ** 0 on success, -1 on failure
8568  */
8569  int destroy_gesture(diguyCharacterGesture* gesture);
8570 
8571  /*l
8572  *b Description:
8573  **
8574  ** This function executes the specified gesture.
8575  **
8576  ** The gesture will automatically begin and end. The only control
8577  ** over the executed gesture is whether is should be ended or aborted
8578  ** early. See end_executing_gesture() and abort_executing_gesture().
8579  ** For full control of gesture attributes, use create_gesture()
8580  ** instead.
8581  **
8582  ** A gesture takes over control of a subset of a character's pose
8583  ** variables and can be overlaid on top of most base actions of the
8584  ** character.
8585  **
8586  ** Note that gestures should be preloaded at the beginning of a
8587  ** scenario to avoid a hitch in frame rate. See the function
8588  ** diguyScenario::preload_gesture().
8589  **
8590  ** This function will have no effect on a dead character (see
8591  ** die_now() and get_dead()).
8592  **
8593  *b Arguments:
8594  **
8595  *a gesture_name - name of the gesture of execute
8596  *a reps - how many times the gesture should be
8597  *a repeated; default is 1 if no duration
8598  *a is specified, or best fit if there is
8599  *a a duration specified
8600  *a overall_duration - for how long the gesture should be executed;
8601  *a default is such that no time scaling occurs
8602  *a channel_A_weight - the weight given to channel A of the
8603  *a gesture; ignored if the gesture does not
8604  *a have multiple channels
8605  **
8606  ** If the gesture is a multi-stage gesture, the overall duration
8607  ** will be spread proportionately over each stage.
8608  **
8609  *b Returns:
8610  **
8611  ** 0 on success, -1 on failure
8612  **
8613  *b Callable From:
8614  **
8615  *- - C++
8616  *- - Script
8617  *- - Decision Bead
8618  */
8619  int execute_gesture(const char* gesture_name,
8620  int reps = DIGUY_DEFAULT_INT,
8621  float overall_duration = DIGUY_DEFAULT_FLOAT,
8622  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8623 
8624  /*l
8625  *b Description:
8626  **
8627  ** The gesture will automatically begin and end. The only control
8628  ** over the executed gesture is whether is should be ended or aborted
8629  ** early. See end_executing_gesture() and abort_executing_gesture().
8630  ** For full control of gesture attributes, use create_gesture()
8631  ** instead.
8632  **
8633  ** If the specified gesture is not a 1 stage gesture, no gesture
8634  ** is executed and an error value is returned.
8635  **
8636  ** The specified gesture can be a one or two channel 1 stage gesture,
8637  ** in which case the specified channel weight will be used over the
8638  ** course of the entire gesture.
8639  **
8640  ** A 1 stage gesture is a comprised of a single motion that begins
8641  ** and ends the gesture.
8642  **
8643  ** n repetitions of a 1 stage gesture will repeat the stage 1
8644  ** motion n times.
8645  **
8646  ** This function will have no effect on a dead character (see
8647  ** die_now() and get_dead()).
8648  **
8649  *b Arguments:
8650  **
8651  *a gesture_name - name of the gesture of execute
8652  *a reps - how many times the gesture should be
8653  *a repeated; default is 1 if no duration
8654  *a is specified, or best fit if there is
8655  *a a duration specified
8656  *a stage1_duration - how long stage 1 of the gesture should take;
8657  *a default is such that no time scaling occurs
8658  *a channel_A_weight - the weight given to channel A of the
8659  *a gesture; ignored if the gesture does not
8660  *a have multiple channels
8661  **
8662  *b Returns:
8663  **
8664  ** 0 on success, -1 on failure
8665  */
8666  int execute_1stage_gesture(const char* gesture_name,
8667  int reps = DIGUY_DEFAULT_INT,
8668  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8669  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8670 
8671  /*l
8672  *b Description:
8673  **
8674  ** This function is similar to execute_1stage_gesture().
8675  **
8676  ** Stage 1 of a 2 stage gesture is a motion that begins the gesture
8677  ** and leads to the "peak" of the gesture.
8678  **
8679  ** Stage 2 of a 2 stage gesture is the motion that returns the
8680  ** gesture from the "peak" to the starting position.
8681  **
8682  ** n repetitions of a 2 stage gesture will repeat the stage 1 motion
8683  ** followed by the stage 2 motion n times.
8684  **
8685  ** This function will have no effect on a dead character (see
8686  ** die_now() and get_dead()).
8687  **
8688  *b Arguments:
8689  **
8690  *a gesture_name - name of the gesture of execute
8691  *a reps - how many times the gesture should be
8692  *a repeated; default is 1 if no duration
8693  *a is specified, or best fit if there is
8694  *a a duration specified
8695  *a stage1_duration - how long stage 1 of the gesture should take,
8696  *a i.e., how far into the gesture the "peak"
8697  *a will occur;
8698  *a default is such that no time scaling occurs
8699  *a stage2_duration - how long stage 2 of the gesture should take;
8700  *a default is such that no time scaling occurs
8701  *a channel_A_weight - the weight given to channel A of the
8702  *a gesture; ignored if the gesture does not
8703  *a have multiple channels
8704  **
8705  *b Returns:
8706  **
8707  ** 0 on success, -1 on failure
8708  */
8709  int execute_2stage_gesture(const char* gesture_name,
8710  int reps = DIGUY_DEFAULT_INT,
8711  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8712  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8713  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8714 
8715  /*l
8716  *b Description:
8717  **
8718  ** This function is similar to execute_1stage_gesture().
8719  **
8720  ** Stage 1 of a 3 stage gesture is a motion that begins the gesture
8721  ** and leads to stage 2; e.g., raising the right arm in preparation
8722  ** for waving.
8723  **
8724  ** Stage 2 of a 3 stage gesture is a motion that can loop
8725  ** indefinitely; e.g., waving the right arm back and forth.
8726  **
8727  ** Stage 3 of a 3 stage gesture is the motion that ends the gesture;
8728  ** e.g., returning the right arm to the side of the body to complete
8729  ** the wave.
8730  **
8731  ** n repetitions of a 3 stage gesture will play the stage 1 motion
8732  ** once, followed by n reps of the stage 2 motion, followed by 1
8733  ** stage 3 motion.
8734  **
8735  ** This function will have no effect on a dead character (see
8736  ** die_now() and get_dead()).
8737  **
8738  *b Arguments:
8739  **
8740  *a gesture_name - name of the gesture of execute
8741  *a reps - how many times the gesture should be
8742  *a repeated; default is 1 if no duration
8743  *a is specified, or best fit if there is
8744  *a a duration specified
8745  *a stage1_duration - how long stage 1 of the gesture should take;
8746  *a default is such that no time scaling occurs
8747  *a stage2_duration - how long each repetition of stage 2 of the
8748  *a gesture should take;
8749  *a default is such that no time scaling occurs
8750  *a stage3_duration - how long stage 3 of the gesture should take;
8751  *a default is such that no time scaling occurs
8752  *a channel_A_weight - the weight given to channel A of the
8753  *a gesture; ignored if the gesture does not
8754  *a have multiple channels
8755  **
8756  *b Returns:
8757  **
8758  ** 0 on success, -1 on failure
8759  */
8760  int execute_3stage_gesture(const char* gesture_name,
8761  int reps = DIGUY_DEFAULT_INT,
8762  float stage1_duration = DIGUY_DEFAULT_FLOAT,
8763  float stage2_duration = DIGUY_DEFAULT_FLOAT,
8764  float stage3_duration = DIGUY_DEFAULT_FLOAT,
8765  float channel_A_weight = DIGUY_DEFAULT_FLOAT);
8766 
8767  /*l
8768  *b Description:
8769  **
8770  ** The gesture will automatically begin and end. The only control
8771  ** over the executed gesture is whether is should be ended or aborted
8772  ** early. See end_executing_gesture() and abort_executing_gesture().
8773  ** For full control of gesture attributes, use create_gesture()
8774  ** instead.
8775  **
8776  ** This function serves as a quick way of executing a table gesture.
8777  ** There are many capabilities of table gestures that are accessible
8778  ** only through the full diguyCharacterGesture object.
8779  **
8780  ** If the specified gesture is not a table gesture, no gesture is
8781  ** executed and an error value is returned.
8782  **
8783  ** A table stage gesture is a comprised of a table of gesture actions
8784  ** that can be transitioned between without going through a neutral
8785  ** position.
8786  **
8787  ** n repetitions of a table gesture will repeat the loop action
8788  ** n times.
8789  **
8790  ** This function will have no effect on a dead character (see
8791  ** die_now() and get_dead()).
8792  **
8793  *b Arguments:
8794  **
8795  *a gesture_name - name of the gesture of execute
8796  *a reps - how many times the gesture should be repeated;
8797  *a default is 1
8798  *a loop_action - which action in the gesture should be looped;
8799  *a default is action at index 1 of table
8800  *a begin_action - which action the gesture should begin from;
8801  *a default is action at index 0
8802  *a end_action - which action the gesture should end at;
8803  *a default is action at index 0
8804  **
8805  *b Returns:
8806  **
8807  ** 0 on success, -1 on failure
8808  */
8809  int execute_table_gesture(const char* gesture_name,
8810  int reps = DIGUY_DEFAULT_INT,
8811  const char* loop_action = NULL,
8812  const char* begin_action = NULL,
8813  const char* end_action = NULL);
8814 
8815  /*l
8816  *b Description:
8817  **
8818  ** Documentation Pending
8819  **/
8820  int set_executing_table_gesture_desired_action(const char* gesture_name,
8821  const char* desired_action);
8822 
8823  /*l
8824  *b Description:
8825  **
8826  ** This function alerts all the specified gesture that it should end.
8827  ** The gesture will stop repeating and play its "out" motions as
8828  ** soon as possible.
8829  **
8830  ** In order to immediately stop the gesture, use the
8831  ** abort_executing_gesture() function.
8832  **
8833  *b Arguments:
8834  **
8835  *a gesture_name - name of executing gesture to end
8836  **
8837  *b Returns:
8838  **
8839  ** 0 on success, -1 on failure
8840  **
8841  *b See Also:
8842  **
8843  ** abort_executing_gesture()
8844  */
8845  int end_executing_gesture(const char* gesture_name);
8846 
8847  /*l
8848  *b Description:
8849  **
8850  ** This function aborts a gesture previously executed by one of
8851  ** the execute_*_gesture() calls, if it is currently executing.
8852  ** If a gesture with the given name is not executing, this function
8853  ** will have no effect.
8854  **
8855  ** This call won't cause the gesture to switch to its "out" motion;
8856  ** it is a straight-forward blend out of whatever the gesture is
8857  ** currently doing. Use the end_executing_gesture() call to make
8858  ** the gesture play its "out" motion as soon as possible,
8859  ** therefore ending the gesture in a smoother way.
8860  **
8861  *b Arguments:
8862  **
8863  *a gesture_name - name of executing gesture to abort
8864  *a max_rampdown_interval - max amount of time spent trying to
8865  *a smooth over any motion seams; set
8866  *a to 0.5 for a smooth transition, set
8867  *a to 0 for an immediate abort
8868  **
8869  *b Returns:
8870  **
8871  ** 0 on success, -1 on failure
8872  **
8873  *b See Also:
8874  **
8875  ** end_executing_gesture(), abort_all_gestures()
8876  */
8877  int abort_executing_gesture(const char* gesture_name,
8878  float max_rampdown_interval);
8879 
8880  /*l
8881  *b Description:
8882  **
8883  ** This function alerts all active gestures that they should end.
8884  ** The gestures will stop repeating and play their "out" motions as
8885  ** soon as possible.
8886  **
8887  ** In order to immediately stop all gestures, use the
8888  ** abort_all_gestures() function.
8889  **
8890  *b Returns:
8891  **
8892  ** 0 on success, -1 on failure
8893  **
8894  *b See Also:
8895  **
8896  ** abort_all_gestures(), diguyCharacterGesture::end_gesture()
8897  */
8898  int end_all_gestures();
8899 
8900  /*l
8901  *b Description:
8902  **
8903  ** This function aborts all active gestures. All gestures will
8904  ** immediately begin to lose their effect on the
8905  ** character's pose.
8906  **
8907  ** This won't cause the gestures to switch to their "out" motions;
8908  ** it is a straight-forward blend out of whatever the gesture is
8909  ** currently doing. Use the end_all_gestures() call to make all
8910  ** active gestures play their "out" motions as soon as possible,
8911  ** therefore ending the gestures in a smoother way.
8912  **
8913  *b Arguments:
8914  **
8915  *a max_rampdown_interval - max amount of time spent trying to
8916  *a smooth over any motion seams; set
8917  *a to 0.5 for a smooth transition, set
8918  *a to 0 for an immediate abort
8919  **
8920  *b Returns:
8921  **
8922  ** 0 on success, -1 on failure
8923  **
8924  *b See Also:
8925  **
8926  ** end_all_gestures(), diguyCharacterGesture::abort_now()
8927  */
8928  int abort_all_gestures(float max_rampdown_interval);
8929 
8930 
8931 /*****************************************************************************/
8963  /*l
8964  *b Description:
8965  **
8966  ** This function will play the specified sound. The sound will be
8967  ** "ambient"; i.e., it will be equally audible from everywhere within
8968  ** the world. Use the function play_3d_sound() to play a sound that
8969  ** moves with the character.
8970  **
8971  ** This function will have no effect on a dead character (see
8972  ** die_now() and get_dead()).
8973  **
8974  ** Unless the sound loops, the sound will play to completion and then
8975  ** stop. To stop the sound early or stop a looping sound call
8976  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
8977  **
8978  *b Arguments
8979  **
8980  *a sound_name - name of sound to play
8981  *a sound_gain - by how much sound's amplitude should be multiplied
8982  *a sound_loop - indicates that sound should loop indefinitely
8983  **
8984  ** There must be a diguySound in the scenario with the passed
8985  ** sound_name. See diguyScenario::create_sound().
8986  **
8987  ** See set_current_voice_actor() for information on how a voice actor
8988  ** can change which sound in the scenario is selected.
8989  **
8990  *b Returns:
8991  **
8992  ** 0 on success, -1 on failure
8993  **
8994  *b Callable From:
8995  **
8996  *- - C++
8997  *- - Script
8998  *- - Decision Bead
8999  */
9000  int play_sound(const char* sound_name,
9001  float sound_gain = 1.0f,
9002  int sound_loops = 0);
9003 
9004  /*l
9005  *b Description:
9006  **
9007  ** This function will play the specified sound at the character's
9008  ** location. As the character moves, the sound will move with it.
9009  ** Use the function play_sound() to play a sound that is ambient and
9010  ** does not move with the character.
9011  **
9012  ** Note that not all sound modules support 3D sounds.
9013  **
9014  ** This function will have no effect on a dead character (see
9015  ** die_now() and get_dead()).
9016  **
9017  ** Unless the sound loops, the sound will play to completion and then
9018  ** stop. To stop the sound early or stop a looping sound call
9019  ** diguyCharacter::stop_all_sounds() or diguyCharacter::stop_sound().
9020  **
9021  *b Arguments
9022  **
9023  *a sound_name - the name of the sound to play
9024  *a sound_gain - by how much the sound's amplitude
9025  *a should be multiplied
9026  *a sound_loop - indicates that the sound should loop
9027  *a indefinitely
9028  **
9029  ** There must be a diguySound in the scenario with the passed
9030  ** sound_name. See diguyScenario::create_sound().
9031  **
9032  ** See set_current_voice_actor() for information on how a voice actor
9033  ** can change which sound in the scenario is selected.
9034  **
9035  *b Returns:
9036  **
9037  ** 0 on success, -1 on failure
9038  **
9039  *b Callable From:
9040  **
9041  *- - C++
9042  *- - Script
9043  *- - Decision Bead
9044  */
9045  int play_3d_sound(const char* sound_name,
9046  float sound_gain = 1.0f,
9047  int sound_loops = 0);
9048 
9049  /*l
9050  *b Description:
9051  **
9052  ** This function creates (but does not start playing) an instance of
9053  ** the specified sound.
9054  **
9055  ** Exact control over the sound instance is possible by making calls
9056  ** through the returned diguySoundInstance object.
9057  **
9058  ** To begin playing the sound, call diguySoundInstance::begin_now().
9059  **
9060  ** *Do not* call delete on the returned object. It should be
9061  ** destroyed either by calling diguyCharacter::destroy_sound_instance()
9062  ** or by calling diguySoundInstance::set_automatic_destroy_flag(1) on
9063  ** the returned object.
9064  **
9065  *b Arguments:
9066  **
9067  *a sound_name - name of the sound for which to create an instance
9068  **
9069  ** There must be a diguySound in the scenario with the passed
9070  ** sound_name. See diguyScenario::create_sound().
9071  **
9072  *b Returns:
9073  **
9074  ** pointer to object of type diguySoundInstance
9075  */
9076  diguySoundInstance* create_sound_instance(const char* sound_name);
9077 
9078  /*l
9079  *b Description:
9080  **
9081  ** This function destroys a sound instance object created by
9082  ** create_sound_instance().
9083  **
9084  ** Do not destroy a sound for which the
9085  ** diguySoundInstance::set_automatic_destroy_flag(1) has been called.
9086  **
9087  *b Arguments:
9088  **
9089  *a sound_instance - sound instance to destroy
9090  **
9091  *b Returns:
9092  **
9093  ** 0 on success, -1 on failure
9094  */
9095  int destroy_sound_instance(diguySoundInstance* sound_instance);
9096 
9097  /*l
9098  *b Description:
9099  **
9100  ** This function stops all active sound instances from this character.
9101  ** All sounds being played by this character will fade out and stop
9102  ** after rampdown_time, by default fade out is instant.
9103  **
9104  ** Sound instances that are automatically managed will be destroyed.
9105  ** This includes sound started by a call to
9106  ** diguyCharacter::play_sound() or a sound instance whose
9107  ** set_automatic_destroy_flag() function has been called.
9108  **
9109  ** diguySoundInstance pointers returned by a call to
9110  ** diguyCharacter::create_sound_instance(), which have not been set to
9111  ** be automatically destroyed, will still be valid.
9112  **
9113  *b Arguments:
9114  **
9115  *a rampdown_time - how long to fade out the sound
9116  **
9117  *b Returns:
9118  **
9119  ** 0 on success, -1 on failure
9120  **
9121  *b Callable From:
9122  **
9123  *- - C++
9124  *- - Script
9125  *- - Decision Bead
9126  */
9127  int stop_all_sounds(float rampdown_time = 0.0f);
9128 
9129  /*l
9130  *b Description:
9131  **
9132  ** This function stops a named sound instance from this character.
9133  **
9134  ** Sound instances that are automatically managed will be destroyed.
9135  ** This includes sound started by a call to
9136  ** diguyCharacter::play_sound() or a sound instance whose
9137  ** set_automatic_destroy_flag() function has been called.
9138  **
9139  ** diguySoundInstance pointers returned by a call to
9140  ** diguyCharacter::create_sound_instance(), which have not been set to
9141  ** be automatically destroyed, will still be valid.
9142  **
9143  *b Arguments:
9144  **
9145  *a sound_name - the name of the sound to stop
9146  *a rampdown_time - how long to fade out the sound
9147  **
9148  *b Returns:
9149  **
9150  ** 0 on success, -1 on failure
9151  **
9152  *b Callable From:
9153  **
9154  *- - C++
9155  *- - Script
9156  *- - Decision Bead
9157  */
9158  int stop_sound(const char* sound_name, float rampdown_time = 0.0f);
9159 
9160  /*l
9161  *b Returns:
9162  **
9163  ** 1 if the character is playing a the sound specified, 0 if not
9164  */
9165  int is_playing_sound(const char* sound_name);
9166 
9167  /*l
9168  *b Description:
9169  **
9170  ** Sets the "voice actor" for the character.
9171  **
9172  ** Having a voice actor can change which sounds from the scenario a
9173  ** character selects when the diguyCharacter::play_sound() or
9174  ** diguyCharacter::play_3d_sound().
9175  **
9176  ** When play_sound() is called the character asks the scenario for
9177  ** the sound with the specified name. If a voice actor has been set
9178  ** the character will first ask the scenario for the sound name
9179  ** prepended with the voice actor and a slash ("/"). If there isn't
9180  ** a sound with that modified name, it will ask the scenario for a
9181  ** sound with the exact specified name.
9182  **
9183  ** For example, if the character has the voice actor "carl" and is
9184  ** told to play the sound "run_away", the character will first look
9185  ** for a sound named "carl/run_away". If that isn't found, it will
9186  ** look for a sound named "run_away". (If that isn't found no sound
9187  ** is played.)
9188  **
9189  *b Lua Example:
9190  **
9191  ** A more specific example: say that various characters in the
9192  ** scenario need to say "hello". Some of the characters are male,
9193  ** some are female. There are two ways this can be set up.
9194  **
9195  ** The first way, not using a voice actor, is to have two sounds
9196  ** specified in the scenario: "male_hello" and "female_hello". These
9197  ** sounds specify the sound files "male_hello.wav" and
9198  ** "female_hello.wav", respectively. A male character would then do
9199  ** the following to say hello:
9200  **
9201  *e male_character:play_sound("male_hello")
9202  **
9203  ** A female character would do:
9204  **
9205  *e female_character:play_sound("female_hello")
9206  **
9207  ** This is fine, except when one script or character mind needs to be
9208  ** shared by a range of characters, some male and some female.
9209  **
9210  ** In this case it's better to use a voice actor. Say that the sounds
9211  ** specified above have the names "male/hello" and "female/hello";
9212  ** they still have the separate sound files specified. If the
9213  ** character has its voice actor specified as "male" and is told to
9214  ** play the sound "hello", it will select the sound "male/hello" as
9215  ** the sound to play. If its voice actor is "female" and is told to
9216  ** play the sound "hello", it will select the sound "female/hello".
9217  **
9218  *e -- called earlier: character:set_voice_actor("male")
9219  *e character:play_sound("hello") -- plays sound "male/hello"
9220  **
9221  *e -- called earlier: character:set_voice_actor("female")
9222  *e character:play_sound("hello") -- plays sound "female/hello"
9223  **
9224  *b Arguments:
9225  **
9226  *a voice_actor - name of voice actor
9227  **
9228  ** voice_actor can be an arbitrary string. It doesn't need to match
9229  ** any character name, but should have matching sounds specified in
9230  ** the scenario.
9231  **
9232  *b Returns:
9233  **
9234  ** 0 on success, -1 on failure
9235  */
9236  int set_current_voice_actor(const char* voice_actor);
9237 
9238  /*l
9239  *b Returns:
9240  **
9241  ** name of current voice actor, as set by set_current_voice_actor()
9242  */
9243  const char* get_current_voice_actor();
9244 
9245 
9246 /*****************************************************************************/
9282  /*l
9283  *b Description:
9284  **
9285  ** This function returns the state of the character in the form
9286  ** required by DIS.
9287  **
9288  ** Note that there is no corresponding set_DIS_lifeform_state()
9289  ** function. The lifeform state is derived from the character's
9290  ** action, posture, and variant information.
9291  **
9292  *b Returns:
9293  **
9294  ** one of the following values defined in diguy_dis_constants.h:
9295  **
9296  *- DIGUY_DIS_LIFEFORM_UNUSED (0)
9297  *- DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9298  *- DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9299  *- DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9300  *- DIGUY_DIS_LIFEFORM_KNEELING (4)
9301  *- DIGUY_DIS_LIFEFORM_PRONE (5)
9302  *- DIGUY_DIS_LIFEFORM_CRAWLING (6)
9303  *- DIGUY_DIS_LIFEFORM_SWIMMING (7)
9304  *- DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9305  *- DIGUY_DIS_LIFEFORM_JUMPING (9)
9306  *- DIGUY_DIS_LIFEFORM_SITTING (10)
9307  *- DIGUY_DIS_LIFEFORM_SQUATTING (11)
9308  *- DIGUY_DIS_LIFEFORM_CROUCHING (12)
9309  *- DIGUY_DIS_LIFEFORM_WADING (13)
9310  **
9311  *b Callable For Networked Entities That Are:
9312  **
9313  *- - DIS published and reflected
9314  */
9315  int get_DIS_lifeform_state();
9316 
9317  /*l
9318  *b Description:
9319  **
9320  ** This function returns the position of the character's
9321  ** primary weapon, in the form required by DIS.
9322  **
9323  *b Returns:
9324  **
9325  ** one of the following values defined in diguy_dis_constants.h:
9326  **
9327  *- DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9328  *- DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9329  *- DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9330  *- DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9331  **
9332  *b Callable For Networked Entities That Are:
9333  **
9334  *- - DIS published
9335  */
9336  int get_DIS_primary_weapon_position();
9337 
9338  /*l
9339  *b Description:
9340  **
9341  ** This function returns the position of the character's
9342  ** secondary weapon, in the form required by DIS.
9343  **
9344  *b Returns:
9345  **
9346  ** one of the following values defined in diguy_dis_constants.h:
9347  **
9348  *- DIGUY_DIS_SECONDARY_WEAPON_NOT_PRESENT (0)
9349  *- DIGUY_DIS_SECONDARY_WEAPON_STOWED (1)
9350  *- DIGUY_DIS_SECONDARY_WEAPON_DEPLOYED (2)
9351  *- DIGUY_DIS_SECONDARY_WEAPON_IN_FIRING_POSITION (3)
9352  **
9353  *b Callable For Networked Entities That Are:
9354  **
9355  *- - DIS published
9356  */
9357  int get_DIS_secondary_weapon_position();
9358 
9359  /*l
9360  *b Description:
9361  **
9362  ** This function sets the Marking Text for characters that are
9363  ** published to the network by DI-Guy Networking. The default
9364  ** network marking is the empty string "".
9365  **
9366  ** This function should only be called for published characters.
9367  ** The Marking Text is set internally for reflected characters.
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_network_marking(const char* network_marking);
9379 
9380  /*l
9381  *b Description:
9382  **
9383  ** This function gets the Marking Text for characters.
9384  **
9385  ** For published characters this value will be what was most
9386  ** recently set by set_network_marking().
9387  **
9388  ** For reflected characters this value will be read from the
9389  ** reflected characters' entity state information.
9390  **
9391  *b Returns:
9392  **
9393  ** character's Marking Text; will never be NULL
9394  **
9395  *b Callable For Networked Entities That Are:
9396  **
9397  *- - DIS published and reflected
9398  *- - HLA published and reflected
9399  */
9400  const char* get_network_marking();
9401 
9402  /*l
9403  *b Description:
9404  **
9405  ** This function sets whether this character will be published
9406  ** by DI-Guy Networking. This value is persistent, and does
9407  ** not depend on whether there actually *is* currently a
9408  ** network connection.
9409  **
9410  ** The default is 1, the character is published.
9411  **
9412  ** This function should *not* be called for reflected characters.
9413  ** It affects to both DIS and HLA networking.
9414  **
9415  *b Returns:
9416  **
9417  ** 0 on success, -1 on failure
9418  **
9419  *b Callable For Networked Entities That Are:
9420  **
9421  *- - DIS published
9422  *- - HLA published
9423  */
9424  int set_is_network_published(int is_network_published);
9425 
9426  /*l
9427  *b Description:
9428  **
9429  ** This function returns whether the character is published
9430  ** by DI-Guy Networking. It will always return 0 for reflected
9431  ** characters.
9432  **
9433  ** This function can be called for any character.
9434  **
9435  *b Returns:
9436  **
9437  ** 1 if published, 0 if not
9438  **
9439  *b Callable From:
9440  **
9441  *- - C++
9442  *- - Script
9443  *- - Decision
9444  **
9445  *b Callable For Networked Entities That Are:
9446  **
9447  *- - DIS published and reflected
9448  *- - HLA published and reflected
9449  */
9450  int get_is_network_published();
9451 
9452  /*l
9453  *b Description:
9454  **
9455  ** This function returns whether the character is a
9456  ** reflected character created by DI-Guy Networking.
9457  **
9458  ** This function can be called for any character.
9459  **
9460  *b Returns:
9461  **
9462  ** 1 if reflected, 0 if not
9463  **
9464  *b Callable From:
9465  **
9466  *- - C++
9467  *- - Script
9468  *- - Decision
9469  **
9470  *b Callable For Networked Entities That Are:
9471  **
9472  *- - DIS published and reflected
9473  *- - HLA published and reflected
9474  */
9475  int get_is_network_reflected();
9476 
9477  /*l
9478  *b Description:
9479  **
9480  ** This function returns whether this character is in a
9481  ** "paused" state. This will only be true for reflected
9482  ** characters.
9483  **
9484  ** A reflected character will be paused if the network
9485  ** entity it is representing is paused; i.e., its personal
9486  ** timeline is not advancing. The most common case of this
9487  ** is when this character is reflecting a published character
9488  ** of a DI-Guy Scenario application that is in a paused or
9489  ** stopped state.
9490  **
9491  ** If DI-Guy Scenario, paused characters will remain frozen
9492  ** in their current postures.
9493  **
9494  *b Returns:
9495  **
9496  ** 1 if paused, 0 if not
9497  **
9498  *b Callable From:
9499  **
9500  *- - C++
9501  *- - Script
9502  *- - Decision
9503  */
9504  int get_is_network_paused();
9505 
9506  /*l
9507  *b Description:
9508  **
9509  ** This function returns the character's "network entity number".
9510  ** This number is valid and persistent regardless of whether the
9511  ** character is currently published.
9512  **
9513  ** This number is primarily used internally by DI-Guy Networking
9514  ** for creating entity IDs.
9515  **
9516  *b Returns:
9517  **
9518  ** character's network entity number
9519  **
9520  *b Callable For Networked Entities That Are:
9521  **
9522  *- - DIS published and reflected
9523  *- - HLA published and reflected
9524  */
9525  int get_network_entity_number();
9526 
9527  /*l
9528  *b Description:
9529  **
9530  ** This function returns the name of an action for a character,
9531  ** given the DIS damage state, lifeform state, primary weapon
9532  ** state, speed of the character, and direction of travel.
9533  **
9534  *b Arguments:
9535  **
9536  *a damage_state - one of the values listed below
9537  *a life_form_state - one of the values listed below
9538  *a primary_weapon_state - one of the values listed below
9539  *a speed - in meters/second
9540  *a forward - whether the action should move
9541  *a forward (pass 1), or backward (pass 0)
9542  **
9543  ** Valid values for damage_state (defined in
9544  ** diguy_dis_constants.h):
9545  **
9546  *- - DIGUY_DIS_DAMAGE_NONE (0)
9547  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9548  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9549  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9550  **
9551  ** Valid values for life_form_state (defined in
9552  ** diguy_dis_constants.h):
9553  **
9554  *- - DIGUY_DIS_LIFEFORM_UNUSED (0)
9555  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_STANDING_STILL (1)
9556  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_WALKING (2)
9557  *- - DIGUY_DIS_LIFEFORM_UPRIGHT_RUNNING (3)
9558  *- - DIGUY_DIS_LIFEFORM_KNEELING (4)
9559  *- - DIGUY_DIS_LIFEFORM_PRONE (5)
9560  *- - DIGUY_DIS_LIFEFORM_CRAWLING (6)
9561  *- - DIGUY_DIS_LIFEFORM_SWIMMING (7)
9562  *- - DIGUY_DIS_LIFEFORM_PARACHUTING (8)
9563  *- - DIGUY_DIS_LIFEFORM_JUMPING (9)
9564  *- - DIGUY_DIS_LIFEFORM_SITTING (10)
9565  *- - DIGUY_DIS_LIFEFORM_SQUATTING (11)
9566  *- - DIGUY_DIS_LIFEFORM_CROUCHING (12)
9567  *- - DIGUY_DIS_LIFEFORM_WADING (13)
9568  **
9569  ** Valid values for primary_weapon_state (defined in
9570  ** diguy_dis_constants.h):
9571  **
9572  *- - DIGUY_DIS_PRIMARY_WEAPON_NOT_PRESENT (0)
9573  *- - DIGUY_DIS_PRIMARY_WEAPON_STOWED (1)
9574  *- - DIGUY_DIS_PRIMARY_WEAPON_DEPLOYED (2)
9575  *- - DIGUY_DIS_PRIMARY_WEAPON_IN_FIRING_POSITION (3)
9576  **
9577  ** Note that a backward motion can be requested in a couple of
9578  ** ways: either by passing a negative speed, or by passing
9579  ** 0 for the forward argument, or both.
9580  **
9581  *b Returns:
9582  **
9583  ** name of an action if a match is found, NULL if not
9584  **
9585  *b Callable For Networked Entities That Are:
9586  **
9587  *- - DIS published
9588  */
9589  const char* get_action_from_entity_state(int damage_state,
9590  int life_form_state,
9591  int primary_weapon_state,
9592  float speed,
9593  int forward);
9594 
9595  /*l
9596  *b Description:
9597  **
9598  ** Sets the damage state for the network published character.
9599  ** It's still up to the end user to change the appearance based on
9600  ** this information.
9601  **
9602  *b Arguments:
9603  **
9604  *a state - one of the values listed below
9605  **
9606  ** Valid values for state (defined in
9607  ** diguy_dis_constants.h):
9608  **
9609  *- - DIGUY_DIS_DAMAGE_NONE (0)
9610  *- - DIGUY_DIS_DAMAGE_SLIGHT (1)
9611  *- - DIGUY_DIS_DAMAGE_MODERATE (2)
9612  *- - DIGUY_DIS_DAMAGE_DESTROYED (3)
9613  **
9614  *b Callable For Networked Entities That Are:
9615  **
9616  *- - DIS published
9617  */
9618  void set_DIS_damage_state(int state);
9619 
9620  /*l
9621  *b Description:
9622  **
9623  ** Returns the damage state of a network published character.
9624  ** Note that it's still up to the end user to change the
9625  ** character appearance based on this information.
9626  **
9627  *b Returns:
9628  **
9629  *a one of the values shown in set_DIS_damage_state()
9630  */
9631  int get_DIS_damage_state();
9632 
9633  /*l
9634  *b Description:
9635  **
9636  ** Sets the smoke state for a network published character.
9637  ** Starts or stops the "smoke" and "engine_smoke" appearance
9638  ** effects as appropriate.
9639  **
9640  *b Arguments:
9641  **
9642  *a state - one of the values listed below
9643  **
9644  ** Valid values for state (defined in
9645  ** diguy_dis_constants.h):
9646  **
9647  *- - DIGUY_DIS_SMOKE_NOT_SMOKING (0)
9648  *- - DIGUY_DIS_SMOKE_SMOKE_PLUME (1)
9649  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE (2)
9650  *- - DIGUY_DIS_SMOKE_ENGINE_SMOKE_AND_SMOKE_PLUME (3)
9651  **
9652  *b Callable For Networked Entities That Are:
9653  **
9654  *- - DIS published
9655  */
9656  void set_DIS_smoke_state(int state);
9657 
9658  /*l
9659  *b Description:
9660  **
9661  ** Returns the smoke state of a network published character.
9662  **
9663  *b Returns:
9664  **
9665  *a one of the values shown in set_DIS_smoke_state()
9666  */
9667  int get_DIS_smoke_state();
9668 
9669  /*l
9670  *b Description:
9671  **
9672  ** Sets the flames state for a network published character.
9673  ** Starts or stops the "flames" appearance effect as appropriate.
9674  **
9675  *b Arguments:
9676  **
9677  ** state - one of the values listed below
9678  **
9679  ** Valid values for state (defined in
9680  ** diguy_dis_constants.h):
9681  **
9682  *- - DIGUY_DIS_FLAMES_NONE (0)
9683  *- - DIGUY_DIS_FLAMES_PRESENT (1)
9684  **
9685  *b Callable For Networked Entities That Are:
9686  **
9687  *- - DIS published
9688  */
9689  void set_DIS_flames_state(int state);
9690 
9691  /*l
9692  *b Description:
9693  **
9694  ** Returns the flames state of a network published character.
9695  **
9696  *b Returns:
9697  **
9698  *a one of the values shown in set_DIS_flames_state()
9699  */
9700  int get_DIS_flames_state();
9701 
9702  /*l
9703  *b Description:
9704  **
9705  ** Sets the power plant state for a network published character.
9706  ** Vehicle power plants default to being on.
9707  **
9708  *b Arguments:
9709  **
9710  ** state - one of the values listed below
9711  **
9712  ** Valid values for state (defined in
9713  ** diguy_dis_constants.h):
9714  **
9715  *- - DIGUY_DIS_POWER_PLANT_OFF (0)
9716  *- - DIGUY_DIS_POWER_PLANT_ON (1)
9717  **
9718  *b Callable For Networked Entities That Are:
9719  **
9720  *- - DIS published
9721  */
9722  void set_DIS_power_plant_state(int state);
9723 
9724  /*l
9725  *b Description:
9726  **
9727  ** Returns the power plant state of a network published character.
9728  **
9729  *b Returns:
9730  **
9731  *a one of the values shown in set_DIS_power_plant_state()
9732  */
9733  int get_DIS_power_plant_state();
9734 
9735  /*l
9736  *b Description:
9737  **
9738  ** Sets the trailing effect state for a network published character.
9739  **
9740  *b Arguments:
9741  **
9742  ** state - one of the values listed below
9743  **
9744  ** Valid values for state (defined in diguy_dis_constants.h):
9745  **
9746  *- - DIGUY_DIS_TRAILING_EFFECT_NONE (0)
9747  *- - DIGUY_DIS_TRAILING_EFFECT_SMALL (1)
9748  *- - DIGUY_DIS_TRAILING_EFFECT_MEDIUM (2)
9749  *- - DIGUY_DIS_TRAILING_EFFECT_LARGE (3)
9750  **
9751  *b Callable For Networked Entities That Are:
9752  **
9753  *- - DIS published
9754  */
9755  void set_DIS_trailing_effect_state(int state);
9756 
9757  /*l
9758  *b Description:
9759  **
9760  ** Returns the trailing effect state of a network published
9761  ** character.
9762  **
9763  *b Returns:
9764  **
9765  *a one of the values shown in set_DIS_smoke_trail_state()
9766  */
9767  int get_DIS_trailing_effect_state();
9768 
9769 
9770 /*****************************************************************************/
9780  /*l
9781  *b Description:
9782  **
9783  ** This function will create a new active formation with this
9784  ** character as its leader. The formation followers will fall
9785  ** into the formation given by the formation name.
9786  **
9787  ** The formation is broken up, or disbanded, by calling
9788  ** break_formation().
9789  **
9790  *b Arguments:
9791  **
9792  *a formation_name - the name of the formation
9793  *a snap_to_position_flag - if 1, following characters will
9794  *a immediately snap to their assigned
9795  *a positions; otherwise following characters
9796  *a will move toward their assigned
9797  *a positions from their current positions
9798  *a break_existing_formations_flag - if 1, any formations this
9799  *a character is leading with be broken
9800  *a as if the break_formation() call were
9801  *a made
9802  **
9803  *b Returns:
9804  **
9805  ** 0 on success, -1 on failure
9806  **
9807  *b Callable From:
9808  **
9809  *- - C++
9810  *- - Script
9811  *- - Decision Bead
9812  */
9813  int call_formation(const char* formation_name,
9814  int snap_to_position_flag = 0,
9815  int break_existing_formations_flag = 1);
9816 
9817  /*l
9818  *b Description:
9819  **
9820  ** This function breaks up a formation initiated by call_formation().
9821  **
9822  *b Arguments:
9823  **
9824  *a formation_name - the name of the formation to break;
9825  *a passing NULL or "(all)" will break all formations
9826  *a this character is leading
9827  **
9828  *b Returns:
9829  **
9830  ** 0 on success, -1 on failure
9831  **
9832  *b Callable From:
9833  **
9834  *- - C++
9835  *- - Script
9836  *- - Decision Bead
9837  */
9838  int break_formation(const char* formation_name = NULL);
9839 
9840 
9841 /*****************************************************************************/
10116  /*l
10117  *b Description:
10118  **
10119  ** This function adds a copy of the specified scenario guide
10120  ** to the character. Any changes that are subsequently made
10121  ** to the added guide -- for example by a call to
10122  ** diguyCharacterGuide::set_algorithm_float_parameter() -- are
10123  ** private to this copy of the guide and will not affect others.
10124  **
10125  ** The guide will be enabled by default. Guides can be disabled
10126  ** by calling diguyCharacterGuide::set_guide_enabled(0), or by
10127  ** passing 1 for the argument automatically_disable_when_acquired.
10128  **
10129  ** Note that disabling a guide is not the same as removing it.
10130  ** Disabled guides are still a part of the character and can
10131  ** later be re-enabled by calling diguyCharacterGuide::set_enabled().
10132  **
10133  *b Arguments:
10134  **
10135  *a guide_name - name of guide to find and copy
10136  *a automatically_disable_when_acquired - set to 1 to have the guide
10137  *a be automatically disabled when it has acquired
10138  *a its target
10139  **
10140  *b Returns:
10141  **
10142  ** object of type diguyCharacterGuide; if a guide with guide_name
10143  ** is not found, returns NULL
10144  */
10145  diguyCharacterGuide* add_guide(const char* guide_name,
10146  int automatically_disable_when_acquired = 0);
10147 
10148  /*l
10149  *b Description:
10150  **
10151  ** This function creates a new guide and adds it to the character.
10152  **
10153  ** The guide will be enabled by default. Guides can be disabled
10154  ** by calling diguyCharacterGuide::set_guide_enabled(), or by
10155  ** passing 1 for the argument automatically_disable_when_acquired.
10156  **
10157  ** Important note: a new guide will always be created, even if one with
10158  ** the same name already exists
10159  **
10160  *b Arguments:
10161  **
10162  *a guide_name - name of guide to find and copy
10163  *a guide_algorithm - name of guide algorithm to be used
10164  *a automatically_disable_when_acquired - set to 1 to have the guide
10165  *a be automatically disabled when it has
10166  *a acquired its target
10167  **
10168  *b Returns:
10169  **
10170  ** object of type diguyCharacterGuide; if a guide with guide_name
10171  ** is not found, returns NULL
10172  */
10173  diguyCharacterGuide* create_guide(const char* guide_name,
10174  const char* guide_algorithm,
10175  int automatically_disable_when_acquired = 0);
10176 
10177  /*l
10178  *b Description:
10179  **
10180  ** Like create_guide(), but returns guide if it already exists
10181  **
10182  *b Arguments:
10183  **
10184  *a guide_name - name of guide to find and copy
10185  *a guide_algorithm - name of guide algorithm to be used
10186  *a automatically_disable_when_acquired - set to 1 to have the guide
10187  *a be automatically disabled when it has
10188  *a acquired its target
10189  **
10190  *b Returns:
10191  **
10192  ** object of type diguyCharacterGuide; if a guide with guide_name
10193  ** is not found, returns NULL
10194  */
10195  diguyCharacterGuide* find_or_create_guide(const char* guide_name,
10196  const char* guide_algorithm,
10197  int automatically_disable_when_acquired = 0);
10198 
10199  /*l
10200  *b Description:
10201  **
10202  ** This function returns a pointer to the specified guide
10203  ** of the character, if is exists.
10204  **
10205  *b Arguments:
10206  **
10207  *a guide_name - name of guide to find
10208  **
10209  *b Returns:
10210  **
10211  ** object of type diguyCharacterGuide; if a guide with guide_name
10212  ** is not found, returns NULL
10213  */
10214  diguyCharacterGuide* find_guide(const char* guide_name);
10215 
10216  /*l
10217  *b Description:
10218  **
10219  ** This function removes the specified guide from the
10220  ** character.
10221  **
10222  *b Arguments:
10223  **
10224  *a guide_name - name of the guide to remove; must match name
10225  *a used by add_guide() or create_guide() call
10226  **
10227  *b Returns:
10228  **
10229  ** 0 on success, -1 on failure
10230  */
10231  int remove_guide_with_name(const char* guide_name);
10232 
10233  /*l
10234  *b Description:
10235  **
10236  ** This function removes the specified guide from the
10237  ** character.
10238  **
10239  *b Arguments:
10240  **
10241  *a guide - object returned by add_guide() call
10242  **
10243  *b Returns:
10244  **
10245  ** 0 on success, -1 on failure
10246  */
10247  int remove_guide(diguyCharacterGuide* guide);
10248 
10249  /*l
10250  *b Description:
10251  **
10252  ** This function removes all guides from the character.
10253  **
10254  *b Returns:
10255  **
10256  ** 0 on success, -1 on failure
10257  */
10258  int remove_all_guides();
10259 
10260  /*l
10261  *b Description:
10262  **
10263  ** This function removes all guides that are disabled.
10264  **
10265  *b Returns:
10266  **
10267  ** 0 on success, -1 on failure
10268  */
10269  int remove_all_disabled_guides();
10270 
10271 
10272 /*****************************************************************************/
10282  /*l
10283  *b Description:
10284  **
10285  ** This function adds a "motion texture" to the character. A
10286  ** motion texture is a relatively long (usually 10 seconds or
10287  ** more) loop that will add natural-looking, low amplitude
10288  ** joint angle adjustments.
10289  **
10290  ** This function will have no effect on a dead character (see
10291  ** die_now() and get_dead()).
10292  **
10293  *b Arguments:
10294  **
10295  *a motex_name - name of the motion texture to add; see below
10296  *a texture_gain - the relative amplitude of the motion texture;
10297  *a higher numbers result in more pronounced
10298  *a movements
10299  *a end_previous_motex - flag denoting whether this motion texture
10300  *a replaces all previously added motion
10301  *a textures; pass 1 to end existing textures
10302  *a rampup_interval - how long, in seconds, to take ramping up
10303  *a into the motion texture
10304  **
10305  ** List of currently available motion textures:
10306  **
10307  *- - "default"
10308  *- - "motex_stand_casual"
10309  **
10310  ** If 1 is passed for the argument end_previous_motex, the
10311  ** rampup_interval argument will be used as the interval for
10312  ** ending existing motion textures.
10313  **
10314  *b Returns:
10315  **
10316  ** 0 on success, -1 on failure
10317  **
10318  */
10319  int add_motion_texture(const char* motex_name = "default",
10320  float texture_gain = 1.0f,
10321  int end_previous_motex = 1,
10322  float rampup_interval = 0.2f);
10323 
10324  /*l
10325  *b Description:
10326  **
10327  ** This function gradually ends any active motion textures added by
10328  ** add_motion_texture().
10329  **
10330  *b Arguments:
10331  **
10332  *a rampdown_interval - how long, in seconds, to take ending the
10333  *a motion texture
10334  **
10335  *b Returns:
10336  **
10337  ** 0 on success, -1 on failure
10338  */
10339  int end_motion_texture(float rampdown_interval = 0.2f);
10340 
10341  /*l
10342  *b Description:
10343  **
10344  ** This function sets an initial motion texture that should be
10345  ** used by the character whenever the character is loaded from
10346  ** a scenario or the character's scenario is reset.
10347  **
10348  ** The gain of the motion texture can be set by calling
10349  ** set_initial_motion_texture_gain(). The initial motion
10350  ** texture gain is 1.0 by default.
10351  **
10352  *b See Also:
10353  **
10354  ** add_motion_texture(), set_initial_motion_texture_gain()
10355  **
10356  *b Arguments:
10357  **
10358  *a motex_name - name of the motion texture
10359  **
10360  *b Returns:
10361  **
10362  ** 0 on success, -1 on failure
10363  */
10364  int set_initial_motion_texture(const char* motex_name);
10365 
10366  /*l
10367  *b Description:
10368  **
10369  ** This function returns the initial motion texture as set
10370  ** by a call to set_initial_motion_texture().
10371  **
10372  *b Returns:
10373  **
10374  ** name of initial motion texture
10375  */
10376  const char* get_initial_motion_texture();
10377 
10378  /*l
10379  *b Description:
10380  **
10381  ** This function sets the gain of the initial motion texture
10382  ** of the character. The initial motion texture can be set
10383  ** by calling set_initial_motion_texture().
10384  **
10385  *b Arguments:
10386  **
10387  *a motex_gain - gain of the motion texture; higher gains
10388  *a result in more pronounced motion
10389  **
10390  *b Returns:
10391  **
10392  ** 0 on success, -1 on failure
10393  */
10394  int set_initial_motion_texture_gain(float motex_gain);
10395 
10396  /*l
10397  *b Description:
10398  **
10399  ** This function returns the initial motion texture gain as set
10400  ** by a call to set_initial_motion_texture_gain().
10401  **
10402  *b Returns:
10403  **
10404  ** gain of initial motion texture
10405  */
10406  float get_initial_motion_texture_gain();
10407 
10408 
10409 /*****************************************************************************/
10419  /*l
10420  *b Description:
10421  **
10422  ** This function sets what type of "history" will be kept for the
10423  ** character.
10424  **
10425  ** If time is run backwards in a scenario, characters
10426  ** with history will replay the motions they performed at that
10427  ** time. Characters without history will stay frozen in place
10428  ** until time advances past the point from which it was run
10429  ** backwards.
10430  **
10431  ** The default is DIGUY_HISTORY_TYPE_NONE for characters created
10432  ** using the diguyScenario::create_character() function.
10433  ** Characters loaded from a .dss file will retain their history
10434  ** settings from the DI-Guy Scenario editing session.
10435  **
10436  *b Arguments:
10437  **
10438  *a history_type - history type to be used for the character
10439  **
10440  ** history_type should be one of the following values:
10441  **
10442  *i DIGUY_HISTORY_TYPE_NONE
10443  **
10444  ** This history type saves no history.
10445  **
10446  *i DIGUY_HISTORY_TYPE_COMPLETE
10447  **
10448  ** This history type saves all of a character's history.
10449  **
10450  ** The initial amount of history to be saved, before memory buffers
10451  ** need to be resized, can be set by the function
10452  ** set_history_size_t(). The size by which memory buffers grow each
10453  ** time they do need to get resized by be set by
10454  ** set_history_size_increment_t().
10455  **
10456  *i DIGUY_HISTORY_TYPE_FIRST
10457  **
10458  ** This history type is no longer supported. Characters from
10459  ** a .dss that have this history type will have their history
10460  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10461  **
10462  *i DIGUY_HISTORY_TYPE_LAST
10463  **
10464  ** This history type is no longer supported. Characters from
10465  ** a .dss that have this history type will have their history
10466  ** type set to DIGUY_HISTORY_TYPE_COMPLETE.
10467  **
10468  *b Returns:
10469  **
10470  ** 0 on success, -1 on failure
10471  */
10472  int set_history_type(diguyHistoryType history_type);
10473 
10474  /*l
10475  *b Returns:
10476  **
10477  ** the current history type of the character; see
10478  ** set_history_type()
10479  */
10480  diguyHistoryType get_history_type();
10481 
10482  /*l
10483  *b Description:
10484  **
10485  ** This function sets the size of the character's history
10486  ** buffer, in seconds.
10487  **
10488  *b Arguments:
10489  **
10490  *a t - length of history buffer, in seconds
10491  **
10492  *b Returns:
10493  **
10494  ** 0 on success, -1 on failure
10495  */
10496  int set_history_size_t(float t);
10497 
10498  /*l
10499  *b Description:
10500  **
10501  ** This function returns the current history buffer size.
10502  ** See set_history_size_t().
10503  **
10504  *b Returns:
10505  **
10506  ** current history size
10507  */
10508  float get_history_size_t();
10509 
10510  /*l
10511  *b Description:
10512  **
10513  ** This function sets the size of the character's history
10514  ** buffer increment, in seconds.
10515  **
10516  *b Arguments:
10517  **
10518  *a t - length of history buffer increment, in seconds
10519  **
10520  *b Returns:
10521  **
10522  ** 0 on success, -1 on failure
10523  */
10524  int set_history_size_increment_t(float t);
10525 
10526  /*l
10527  *b Description:
10528  **
10529  ** This function returns the current history buffer size increment.
10530  ** See set_history_size_increment_t().
10531  **
10532  *b Returns:
10533  **
10534  ** current history size increment
10535  */
10536  float get_history_size_increment_t();
10537 
10538 
10539 /*****************************************************************************/
10549  /*l
10550  *b Description:
10551  **
10552  ** This function sets the desired posture of the character. This,
10553  ** along with the desired variant, is used primarily by some guides.
10554  ** Specifically, to help choose which actions are used to reach the
10555  ** desired position and orientation of the character.
10556  **
10557  ** Pass DIGUY_MOTION_POSTURE_ANY for there to be no desired posture.
10558  **
10559  *b Arguments:
10560  **
10561  *a posture - new desired posture
10562  */
10563  void set_desired_posture(diguyMotionPosture desired_posture);
10564 
10565  /*l
10566  *b Returns:
10567  **
10568  ** current desired posture of the character
10569  */
10570  diguyMotionPosture get_desired_posture();
10571 
10572  /*l
10573  *b Description:
10574  **
10575  ** This function sets the desired variant of the character. This,
10576  ** along with the desired posture, is used primarily by some guides.
10577  ** Specifically, to help choose which actions are used to reach the
10578  ** desired position and orientation of the character.
10579  **
10580  ** Pass DIGUY_MOTION_VARIANT_ANY for there to be no desired variant.
10581  **
10582  *b Arguments:
10583  **
10584  *a variant - new desired variant
10585  */
10586  void set_desired_variant(diguyMotionVariant desired_variant);
10587 
10588  /*l
10589  *b Returns:
10590  **
10591  ** current desired variant of the character
10592  */
10593  diguyMotionVariant get_desired_variant();
10594 
10595  /*l
10596  *b Description:
10597  **
10598  ** This function looks up the character action that most closely
10599  ** matches the given criteria.
10600  **
10601  *b Arguments:
10602  **
10603  *a direction - the direction of travel relative to
10604  *a the character's facing direction
10605  *a posture - overall desired posture; pass
10606  *a DIGUY_MOTION_POSTURE_ANY
10607  *a to specify that any posture will do
10608  *a variant - overall desired variant; pass
10609  *a DIGUY_MOTION_VARIANT_ANY
10610  *a to specify that any variant will do
10611  *a speed - speed in meters per second
10612  *a comparison - how the passed speed should compare
10613  *a to the action's speed
10614  *a comparison_tolerance - tolerance of comparison
10615  *a match_posture_before_variant - pass 1 if posture should be matched
10616  *a before variant if an exact match is
10617  *a not found; pass 0 if variant should
10618  *a be matched before posture
10619  *a posture_alternate1 - if an exact match is not found, use this
10620  *a as the first alternate posture; pass
10621  *a DIGUY_MOTION_POSTURE_UNKNOWN
10622  *a to specify that no alternate should be used
10623  *a posture_alternate2 - if an exact match is not found, use this
10624  *a as the second alternate posture; pass
10625  *a DIGUY_MOTION_POSTURE_UNKNOWN
10626  *a to specify that no alternate should be used
10627  *a variant_alternate1 - if an exact match is not found, use this
10628  *a as the first alternate variant; pass
10629  *a DIGUY_MOTION_VARIANT_UNKNOWN
10630  *a to specify that no alternate should be used
10631  *a variant_alternate2 - if an exact match is not found, use this
10632  *a as the second alternate variant; pass
10633  *a DIGUY_MOTION_VARIANT_UNKNOWN
10634  *a to specify that no alternate should be used
10635  *a return_random_match - (Experimental) if multiple actions match the
10636  *a specified criteria randomly return one of
10637  *a them. Typically only used for still motions
10638  *a and restricted to EQUAL and NEAREST
10639  *a comparisons
10640  **
10641  ** The direction argument should be one of the following:
10642  **
10643  *- - DIGUY_MOTION_DIRECTION_NONE - does not move character
10644  *- - DIGUY_MOTION_DIRECTION_FORWARD - moves character forward
10645  *- - DIGUY_MOTION_DIRECTION_BACKWARD - moves character backward
10646  *- - DIGUY_MOTION_DIRECTION_LEFT - moves character left
10647  *- - DIGUY_MOTION_DIRECTION_RIGHT - moves character right
10648  *- - DIGUY_MOTION_DIRECTION_UP - moves character up
10649  *- - DIGUY_MOTION_DIRECTION_DOWN - moves character down
10650  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10651  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10652  *- - DIGUY_MOTION_DIRECTION_NONLINEAR - moves character in
10653  *- multiple directions
10654  *- - DIGUY_MOTION_DIRECTION_LINEAR_OFFAXIS - moves character in a
10655  *- line, but not on any
10656  *- of the principle axes
10657  **
10658  ** Not every direction is supported by every character. If the
10659  ** character does not have any actions that move in the specified
10660  ** direction, the returned action will be NULL.
10661  **
10662  ** Use the calls diguyScenario::get_character_type_num_directions()
10663  ** and diguyScenario::get_character_type_direction_at_index() to
10664  ** enumerate which directions a character can travel.
10665  **
10666  ** The posture arguments should be one of the following:
10667  **
10668  *- - DIGUY_MOTION_POSTURE_UNKNOWN - unknown posture
10669  *- - DIGUY_MOTION_POSTURE_ANY - any posture; a wildcard
10670  *- - DIGUY_MOTION_POSTURE_UPRIGHT - upright posture; e.g., standing
10671  *- or walking
10672  *- - DIGUY_MOTION_POSTURE_CROUCHED - crouched posture; e.g., kneeling
10673  *- or walking low
10674  *- - DIGUY_MOTION_POSTURE_PRONE - prone posture; e.g., lying prone
10675  *- or crawling
10676  *- - DIGUY_MOTION_POSTURE_SITTING - sitting posture
10677  **
10678  ** The posture arguments specify the overall posture the action
10679  ** should have. Most characters have an upright posture.
10680  ** The other postures a character has is dependent on character type.
10681  ** Passing DIGUY_MOTION_POSTURE_ANY for the arguments posture,
10682  ** posture_alternate1, or posture_alternate2 means that the posture of
10683  ** the action should not be used to determine a match.
10684  **
10685  ** Use the calls diguyScenario::get_character_type_num_postures()
10686  ** and diguyScenario::get_character_type_posture_at_index() to
10687  ** enumerate which postures a specific character type has.
10688  **
10689  ** The variant arguments specify the overall mood the action should
10690  ** convey. Most characters have a "normal" variant. The other
10691  ** variants a character has is dependent on character type. Passing
10692  ** DIGUY_MOTION_VARIANT_ANY for the arguments variant,
10693  ** variant_alternate1, or variant_alternate2 means that the variant of
10694  ** the action should not be used to determine a match.
10695  **
10696  ** Use the calls diguyScenario::get_character_type_num_variants()
10697  ** and diguyScenario::get_character_type_variant_at_index() to
10698  ** enumerate which variants a specific character type has.
10699  **
10700  ** The comparison argument should be one of the following:
10701  **
10702  *- - DIGUY_PARAMETER_COMPARISON_EQUAL - matched action's speed
10703  *- must be within
10704  *- comparison_tolerance of
10705  *- passed speed
10706  *- - DIGUY_PARAMETER_COMPARISON_NEAREST - matched action's speed
10707  *- is closer than any other
10708  *- potential match's, but
10709  *- still within
10710  *- comparison_tolerance
10711  *- - DIGUY_PARAMETER_COMPARISON_GREATER - matched action's speed
10712  *- faster than passed speed,
10713  *- but still within
10714  *- comparison_tolerance
10715  *- - DIGUY_PARAMETER_COMPARISON_LESS - matched action's speed
10716  *- slower than passed speed,
10717  *- but still within
10718  *- comparison_tolerance
10719  *-
10720  ** The difference between DIGUY_PARAMETER_COMPARISON_EQUAL and
10721  ** DIGUY_PARAMETER_COMPARISON_NEAREST is largely in the
10722  ** value used for comparison_tolerance if DIGUY_DEFAULT_FLOAT is
10723  ** passed; the comparison_tolerance argument defaults to 0.001 for
10724  ** DIGUY_PARAMETER_COMPARISON_EQUAL, and 16384.0 for all
10725  ** other comparison types. Otherwise these two comparison types
10726  ** operate the same.
10727  **
10728  *b Returns:
10729  **
10730  ** name of an action if a match is found, NULL if not
10731  **
10732  *b C++ Example:
10733  **
10734  *e diguyCharacter* ch = scenario->get_character_at_index(0);
10735  *e const char* new_action;
10736  *e
10737  *e //
10738  *e // Get an action that moves forward in an upright posture,
10739  *e // whose speed move at least 2.0 meters per second:
10740  *e //
10741  *e new_action = ch->get_action_from_description(
10742  *e DIGUY_MOTION_DIRECTION_FORWARD,
10743  *e DIGUY_MOTION_POSTURE_UPRIGHT,
10744  *e DIGUY_MOTION_VARIANT_ANY,
10745  *e 2.0,
10746  *e DIGUY_PARAMETER_COMPARISON_GREATER, DIGUY_DEFAULT_FLOAT);
10747  *e
10748  *e //
10749  *e // Get an action that is standing still, with the variant
10750  *e // DIGUY_MOTION_VARIANT_READY. If no action has that variant,
10751  *e // try DIGUY_MOTION_VARIANT_AIM as variant_alternate1,
10752  *e // and DIGUY_MOTION_VARIANT_ANY as variant_alternate2:
10753  *e //
10754  *e new_action = ch->get_action_from_description(
10755  *e DIGUY_MOTION_DIRECTION_NONE,
10756  *e DIGUY_MOTION_POSTURE_ANY,
10757  *e DIGUY_MOTION_VARIANT_READY,
10758  *e 0.0,
10759  *e DIGUY_PARAMETER_COMPARISON_NEAREST, DIGUY_DEFAULT_FLOAT,
10760  *e 0,
10761  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10762  *e DIGUY_MOTION_POSTURE_UNKNOWN,
10763  *e DIGUY_MOTION_VARIANT_AIM,
10764  *e DIGUY_MOTION_VARIANT_ANY);
10765  **
10766  */
10767  const char* get_action_from_description(diguyMotionDirection direction,
10768  diguyMotionPosture posture,
10769  diguyMotionVariant variant,
10770  float speed,
10772  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10773  int match_posture_before_variant = 1,
10774  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10775  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10776  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10777  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN,
10778  int return_random_match = 0);
10779 
10780  /*l
10781  *b Description:
10782  **
10783  ** This function is very similar to get_action_from_description(),
10784  ** but substitutes turn amount per action iteration for speed.
10785  **
10786  *b Arguments:
10787  **
10788  *a direction - the direction of travel relative to
10789  *a the character's facing direction
10790  *a posture - overall desired posture; pass
10791  *a DIGUY_MOTION_POSTURE_ANY
10792  *a to specify that any posture will do
10793  *a variant - overall desired variant; pass
10794  *a DIGUY_MOTION_VARIANT_ANY
10795  *a to specify that any variant will do
10796  *a turn_amount - how many degrees each iteration of the
10797  *a action should turn the character
10798  *a comparison - how the passed turn amount should compare
10799  *a to the action's turn amount
10800  *a comparison_tolerance - tolerance of comparison
10801  *a match_posture_before_variant - pass 1 if posture should be matched
10802  *a before variant if an exact match is
10803  *a not found; pass 0 if variant should
10804  *a be matched before posture
10805  *a posture_alternate1 - if an exact match is not found, use this
10806  *a as the first alternate posture; pass
10807  *a DIGUY_MOTION_POSTURE_UNKNOWN
10808  *a to specify that no alternate should be used
10809  *a posture_alternate2 - if an exact match is not found, use this
10810  *a as the second alternate posture; pass
10811  *a DIGUY_MOTION_POSTURE_UNKNOWN
10812  *a to specify that no alternate should be used
10813  *a variant_alternate1 - if an exact match is not found, use this
10814  *a as the first alternate variant; pass
10815  *a DIGUY_MOTION_VARIANT_UNKNOWN
10816  *a to specify that no alternate should be used
10817  *a variant_alternate2 - if an exact match is not found, use this
10818  *a as the second alternate variant; pass
10819  *a DIGUY_MOTION_VARIANT_UNKNOWN
10820  *a to specify that no alternate should be used
10821  **
10822  ** The direction argument should be one of the following:
10823  **
10824  *- - DIGUY_MOTION_DIRECTION_TURN_LEFT - turns character left
10825  *- - DIGUY_MOTION_DIRECTION_TURN_RIGHT - turns character right
10826  **
10827  ** Not every direction is supported by every character. If the
10828  ** character does not have any actions that move in the specified
10829  ** direction, the returned action will be NULL.
10830  **
10831  ** The turn amount argument should be a positive number.
10832  **
10833  ** Refer to get_action_from_description() for more information on
10834  ** other arguments.
10835  **
10836  *b Returns:
10837  **
10838  ** name of an action if a match is found, NULL if not
10839  **
10840  */
10841  const char* get_turning_action_from_description(diguyMotionDirection direction,
10842  diguyMotionPosture posture,
10843  diguyMotionVariant variant,
10844  float turn_amount,
10846  float comparison_tolerance = DIGUY_DEFAULT_FLOAT,
10847  int match_posture_before_variant = 1,
10848  diguyMotionPosture posture_alternate1 = DIGUY_MOTION_POSTURE_UNKNOWN,
10849  diguyMotionPosture posture_alternate2 = DIGUY_MOTION_POSTURE_UNKNOWN,
10850  diguyMotionVariant variant_alternate1 = DIGUY_MOTION_VARIANT_UNKNOWN,
10851  diguyMotionVariant variant_alternate2 = DIGUY_MOTION_VARIANT_UNKNOWN);
10852 
10853 
10854 /*****************************************************************************/
10864  /*l
10865  *b Returns:
10866  **
10867  ** number of variables the character has
10868  */
10869  int get_num_variables();
10870 
10871  /*l
10872  *b Returns:
10873  **
10874  ** pointer of type diguyVariable; NULL if no
10875  ** variable at the specified index
10876  **
10877  *b Arguments:
10878  **
10879  *a index - index of the variable; indices start at 0
10880  */
10881  diguyVariable* get_variable_at_index(int index);
10882 
10883  /*l
10884  *b Description:
10885  **
10886  ** This function returns a pointer to the specified variable.
10887  **
10888  *b Arguments:
10889  **
10890  *a name - name of variable to be found
10891  **
10892  *b Returns:
10893  **
10894  ** pointer of type diguyVariable; NULL if not found
10895  */
10896  diguyVariable* find_variable(const char* name);
10897 
10898  /*l
10899  *b Description:
10900  **
10901  ** This function finds the variable with the given name or
10902  ** creates it if it doesn't exist.
10903  **
10904  *b Arguments:
10905  **
10906  *a name - name of the variable to find or create
10907  **
10908  *b Returns:
10909  **
10910  ** pointer of type diguyVariable; should never be NULL
10911  */
10912  diguyVariable* find_or_create_variable(const char* name);
10913 
10914  /*l
10915  *b Description:
10916  **
10917  ** This function destroys the passed variable.
10918  **
10919  *b Arguments:
10920  **
10921  *a variable - pointer to a diguyVariable
10922  **
10923  *b Returns:
10924  **
10925  ** 0 on success, -1 on failure
10926  */
10927  int destroy_variable(diguyVariable* variable);
10928 
10929  /*l
10930  *b Returns:
10931  **
10932  ** 1 if variable is equal to passed value,
10933  ** 0 if not
10934  **
10935  *b Arguments:
10936  **
10937  *a varname - name of variable to compare
10938  *a value - value to compare against
10939  **
10940  *b Callable From:
10941  **
10942  *- - C++
10943  *- - Script
10944  *- - Decision
10945  */
10946  int variable_equal_to_int(const char* varname, int value);
10947 
10948  /*l
10949  *b Returns:
10950  **
10951  ** 1 if variable is greater than passed value,
10952  ** 0 if not
10953  **
10954  *b Arguments:
10955  **
10956  *a varname - name of variable to compare
10957  *a value - value to compare against
10958  **
10959  *b Callable From:
10960  **
10961  *- - C++
10962  *- - Script
10963  *- - Decision
10964  */
10965  int variable_greater_than_int(const char* varname, int value);
10966 
10967  /*l
10968  *b Returns:
10969  **
10970  ** 1 if variable is less than passed value,
10971  ** 0 if not
10972  **
10973  *b Arguments:
10974  **
10975  *a varname - name of variable to compare
10976  *a value - value to compare against
10977  **
10978  *b Callable From:
10979  **
10980  *- - C++
10981  *- - Script
10982  *- - Decision
10983  */
10984  int variable_less_than_int(const char* varname, int value);
10985 
10986  /*l
10987  *b Returns:
10988  **
10989  ** 1 if variable is equal to passed value,
10990  ** 0 if not
10991  **
10992  *b Arguments:
10993  **
10994  *a varname - name of variable to compare
10995  *a value - value to compare against
10996  **
10997  *b Callable From:
10998  **
10999  *- - C++
11000  *- - Script
11001  *- - Decision
11002  */
11003  int variable_equal_to_float(const char* varname, float value);
11004 
11005  /*l
11006  *b Returns:
11007  **
11008  ** 1 if variable is greater than passed value,
11009  ** 0 if not
11010  **
11011  *b Arguments:
11012  **
11013  *a varname - name of variable to compare
11014  *a value - value to compare against
11015  **
11016  *b Callable From:
11017  **
11018  *- - C++
11019  *- - Script
11020  *- - Decision
11021  */
11022  int variable_greater_than_float(const char* varname, float value);
11023 
11024  /*l
11025  *b Returns:
11026  **
11027  ** 1 if variable is less than passed value,
11028  ** 0 if not
11029  **
11030  *b Arguments:
11031  **
11032  *a varname - name of variable to compare
11033  *a value - value to compare against
11034  **
11035  *b Callable From:
11036  **
11037  *- - C++
11038  *- - Script
11039  *- - Decision
11040  */
11041  int variable_less_than_float(const char* varname, float value);
11042 
11043  /*l
11044  *b Returns:
11045  **
11046  ** 1 if variable is equal than passed value,
11047  ** 0 if not
11048  **
11049  *b Arguments:
11050  **
11051  *a varname - name of variable to compare
11052  *a value - value to compare against
11053  **
11054  *b Callable From:
11055  **
11056  *- - C++
11057  *- - Script
11058  *- - Decision
11059  */
11060  int variable_equal_to_string(const char* varname, const char* value);
11061 
11062  /*l
11063  *b Returns:
11064  **
11065  ** 1 if variable is greater than passed value (comes
11066  ** later alphabetically), 0 if not
11067  **
11068  *b Arguments:
11069  **
11070  *a varname - name of variable to compare
11071  *a value - value to compare against
11072  **
11073  *b Callable From:
11074  **
11075  *- - C++
11076  *- - Script
11077  *- - Decision
11078  */
11079  int variable_greater_than_string(const char* varname, const char* value);
11080 
11081  /*l
11082  *b Returns:
11083  **
11084  ** 1 if variable is less than passed value (comes
11085  ** sooner alphabetically), 0 if not
11086  **
11087  *b Arguments:
11088  **
11089  *a varname - name of variable to compare
11090  *a value - value to compare against
11091  **
11092  *b Callable From:
11093  **
11094  *- - C++
11095  *- - Script
11096  *- - Decision
11097  */
11098  int variable_less_than_string(const char* varname, const char* value);
11099 
11100  /*l
11101  *b Description:
11102  **
11103  ** This function decrements the variable by the passed amount.
11104  **
11105  *b Arguments:
11106  **
11107  *a varname - name of variable to modify
11108  *a value - amount to decrement
11109  **
11110  *b Returns:
11111  **
11112  ** 0 on success, -1 on failure
11113  **
11114  *b Callable From:
11115  **
11116  *- - C++
11117  *- - Script
11118  *- - Decision
11119  */
11120  int variable_decrement_value_as_int(const char* varname, int value = 1);
11121 
11122  /*l
11123  *b Description:
11124  **
11125  ** This function increments the variable by the passed amount.
11126  **
11127  *b Arguments:
11128  **
11129  *a varname - name of variable to modify
11130  *a value - amount to increment
11131  **
11132  *b Returns:
11133  **
11134  ** 0 on success, -1 on failure
11135  **
11136  *b Callable From:
11137  **
11138  *- - C++
11139  *- - Script
11140  *- - Decision
11141  */
11142  int variable_increment_value_as_int(const char* varname, int value = 1);
11143 
11144  /*l
11145  *b Description:
11146  **
11147  ** This function is a convenience function for setting the variable
11148  ** to a new integer value without retrieving the diguyVariable
11149  ** object.
11150  **
11151  *b Arguments:
11152  **
11153  *a varname - name of variable to modify
11154  *a value - new value
11155  *a create_if_doesnt_exist - pass 1 to create the variable if it
11156  *a doesn't exist
11157  **
11158  *b Returns:
11159  **
11160  ** 0 on success, -1 on failure
11161  **
11162  *b Callable From:
11163  **
11164  *- - C++
11165  *- - Script
11166  *- - Decision
11167  */
11168  int variable_set_value_as_int(const char* varname,
11169  int value,
11170  int create_if_doesnt_exist = 1);
11171 
11172  /*l
11173  *b Description:
11174  **
11175  ** Short form of variable_set_value_as_int().
11176  */
11177  int set_ivar(const char* varname,
11178  int value,
11179  int create_if_doesnt_exist = 1);
11180 
11181  /*l
11182  *b Description:
11183  **
11184  ** This function is a convenience function for retrieving the
11185  ** value of a variable without retrieving the diguyVariable
11186  ** object.
11187  **
11188  ** If the variable doesn't exist and create_if_doesnt_exist is
11189  ** 0, the returned value will be 0.
11190  **
11191  *b Arguments:
11192  **
11193  *a varname - name of variable to query
11194  *a create_if_doesnt_exist - pass 1 to create the variable if it
11195  *a doesn't exist
11196  **
11197  *b Returns:
11198  **
11199  ** value of variable as int
11200  */
11201  int get_ivar(const char* varname,
11202  int create_if_doesnt_exist = 1);
11203 
11204  /*l
11205  *b Description:
11206  **
11207  ** Similar to variable_set_value_as_int(), for sets a
11208  ** floating point value instead.
11209  */
11210  int variable_set_value_as_float(const char* varname,
11211  float value,
11212  int create_if_doesnt_exist = 1);
11213 
11214  /*l
11215  *b Description:
11216  **
11217  ** Short form of variable_set_value_as_float().
11218  */
11219  int set_fvar(const char* varname,
11220  float value,
11221  int create_if_doesnt_exist = 1);
11222 
11223  /*l
11224  *b Description:
11225  **
11226  ** Similar to variable_get_value_as_int(), for returns a
11227  ** floating point value instead.
11228  **
11229  ** If the variable doesn't exist and create_if_doesnt_exist is
11230  ** 0, the returned value will be 0.0.
11231  */
11232  float get_fvar(const char* varname,
11233  int create_if_doesnt_exist = 1);
11234 
11235  /*l
11236  *b Description:
11237  **
11238  ** Similar to variable_set_value_as_int(), for sets a
11239  ** string value instead.
11240  */
11241  int variable_set_value_as_string(const char* varname,
11242  const char* value,
11243  int create_if_doesnt_exist = 1);
11244 
11245  /*l
11246  *b Description:
11247  **
11248  ** Short form of variable_set_value_as_string().
11249  */
11250  int set_svar(const char* varname,
11251  const char* value,
11252  int create_if_doesnt_exist = 1);
11253 
11254  /*l
11255  *b Description:
11256  **
11257  ** Similar to variable_get_value_as_int(), for returns a
11258  ** string value instead.
11259  **
11260  ** If the variable doesn't exist and create_if_doesnt_exist is
11261  ** 0, the returned value will be "".
11262  */
11263  const char* get_svar(const char* varname,
11264  int create_if_doesnt_exist = 1);
11265 
11266 
11267 /*****************************************************************************/
11282  /*l
11283  *b Description:
11284  **
11285  ** This function returns a pointer to the label object of
11286  ** the character.
11287  **
11288  ** Currently character labels are only enabled in DI-Guy Scenario.
11289  **
11290  *b Returns:
11291  **
11292  ** pointer to the character's label
11293  */
11294  diguyViewLabel* get_name_label();
11295 
11296  /*l
11297  *b Description:
11298  **
11299  ** This function sets the text of the character's label.
11300  ** By default the label text matches the character's name.
11301  **
11302  ** Currently character labels are only enabled in DI-Guy Scenario.
11303  **
11304  *b Arguments:
11305  **
11306  *a label_text - new text for the label
11307  **
11308  *b Returns:
11309  **
11310  ** 0 on success, -1 on failure
11311  */
11312  int set_label_text(const char* label_text);
11313 
11314  /*l
11315  *b Description:
11316  **
11317  ** This function returns the character's label text.
11318  ** See set_label_text().
11319  **
11320  *b Returns:
11321  **
11322  ** current label text; the returned pointer will never be NULL
11323  */
11324  const char* get_label_text();
11325 
11326  /*l
11327  *b Description:
11328  **
11329  ** This function sets whether the label of this character
11330  ** is visible. This setting will only be taken into account
11331  ** if the visibility flag for Character Labels is set to
11332  ** "Per Object".
11333  **
11334  ** Currently character labels are only enabled in DI-Guy Scenario.
11335  **
11336  *b Arguments:
11337  **
11338  *a is_visible - pass 1 to show, pass 0 to hide
11339  **
11340  *b Returns:
11341  **
11342  ** 0 on success, -1 on failure
11343  */
11344  int set_label_is_visible(int is_visible);
11345 
11346  /*l
11347  *b Description:
11348  **
11349  ** This function returns the most recent setting of
11350  ** set_label_is_visible().
11351  **
11352  *b Returns:
11353  **
11354  ** 1 if visible, 0 if not
11355  */
11356  int get_label_is_visible();
11357 
11358  /*l
11359  *b Description:
11360  **
11361  ** This function sets the text color of the character's label. By
11362  ** default the label text color is opaque white.
11363  **
11364  ** Currently character labels are only enabled in DI-Guy Scenario.
11365  **
11366  *b Arguments:
11367  **
11368  *a r, g, b, a - the red, green, blue, and alpha
11369  *a components of the text color
11370  **
11371  ** An alpha component of 0 makes the text completely transparent.
11372  ** An alpha component of 1 makes the text completely opaque.
11373  ** Values in between result in varying levels of transparency.
11374  **
11375  *b Returns:
11376  **
11377  ** 0 on success, -1 on failure
11378  */
11379  int set_label_text_color(float r, float g, float b, float a);
11380 
11381  /*l
11382  *b Description:
11383  **
11384  ** Alternate version of set_label_text_color().
11385  */
11386  int set_label_text_color_vec4(diguyVec4f color);
11387 
11388  /*l
11389  *b Description:
11390  **
11391  ** This function returns, in the passed variable pointers, the
11392  ** most recent setting of set_label_text_color().
11393  **
11394  *b Returns:
11395  **
11396  ** 0 on success, -1 on failure
11397  */
11398  int get_label_text_color(float* r, float* g, float* b, float* a);
11399 
11400  /*l
11401  *b Description:
11402  **
11403  ** Alternate version of get_label_text_color().
11404  */
11405  diguyVec4f get_label_text_color_vec4();
11406 
11407  /*l
11408  *b Description:
11409  **
11410  ** This function sets the text shadow color of the character's label.
11411  ** By default the label text shadow color is gray.
11412  **
11413  ** Currently character labels are only enabled in DI-Guy Scenario.
11414  **
11415  *b Arguments:
11416  **
11417  *a r, g, b, a - the red, green, blue, and alpha
11418  *a components of the text shadow color
11419  **
11420  ** An alpha component of 0 makes the text completely transparent.
11421  ** An alpha component of 1 makes the text completely opaque.
11422  ** Values in between result in varying levels of transparency.
11423  **
11424  *b Returns:
11425  **
11426  ** 0 on success, -1 on failure
11427  */
11428  int set_label_text_shadow_color(float r, float g, float b, float a);
11429 
11430  /*l
11431  *b Description:
11432  **
11433  ** Alternate version of set_label_text_shadow_color().
11434  */
11435  int set_label_text_shadow_color_vec4(diguyVec4f color);
11436 
11437  /*l
11438  *b Description:
11439  **
11440  ** This function returns, in the passed variable pointers, the
11441  ** most recent setting of set_label_text_shadow_color().
11442  **
11443  *b Returns:
11444  **
11445  ** 0 on success, -1 on failure
11446  */
11447  int get_label_text_shadow_color(float* r, float* g, float* b, float* a);
11448 
11449  /*l
11450  *b Description:
11451  **
11452  ** Alternate version of get_label_text_shadow_color().
11453  */
11454  diguyVec4f get_label_text_shadow_color_vec4();
11455 
11456  /*l
11457  *b Description:
11458  **
11459  ** This function sets the whether the text shadow is visible.
11460  **
11461  *b Arguments:
11462  **
11463  *a visible - pass 1 to make shadow visible, 0 to make it invisible
11464  **
11465  *b Returns:
11466  **
11467  ** 0 on success, -1 on failure
11468  */
11469  int set_label_text_shadow_is_visible(int is_visible);
11470 
11471  /*l
11472  *b Returns:
11473  **
11474  ** 1 if text shadow is visible, 0 if not
11475  */
11476  int get_label_text_shadow_is_visible();
11477 
11478  /*l
11479  *b Description:
11480  **
11481  ** This function sets the background color of the character's
11482  ** label. By default the label background color is transparent
11483  ** blue.
11484  **
11485  ** Currently character labels are only enabled in DI-Guy Scenario.
11486  **
11487  *b Arguments:
11488  **
11489  *a r, g, b, a - the red, green, blue, and alpha
11490  *a components of the text color
11491  **
11492  ** An alpha component of 0 makes the text completely transparent.
11493  ** An alpha component of 1 makes the text completely opaque.
11494  ** Values in between result in varying levels of transparency.
11495  **
11496  *b Returns:
11497  **
11498  ** 0 on success, -1 on failure
11499  */
11500  int set_label_background_color(float r, float g, float b, float a);
11501 
11502  /*l
11503  *b Description:
11504  **
11505  ** Alternate version of set_label_background_color().
11506  */
11507  int set_label_background_color_vec4(diguyVec4f color);
11508 
11509  /*l
11510  *b Description:
11511  **
11512  ** This function returns, in the passed variable pointers, the
11513  ** most recent setting of set_label_background_color().
11514  **
11515  *b Returns:
11516  **
11517  ** 0 on success, -1 on failure
11518  */
11519  int get_label_background_color(float* r, float* g, float* b, float* a);
11520 
11521  /*l
11522  *b Description:
11523  **
11524  ** Alternate version of get_label_background_color().
11525  */
11526  diguyVec4f get_label_background_color_vec4();
11527 
11528  /*l
11529  *b Description:
11530  **
11531  ** This function sets how high the label of the character will float
11532  ** above the character.
11533  **
11534  *b Arguments:
11535  **
11536  *a offset - offset, in meters, of label above character
11537  */
11538  void set_label_link_offset_override(float offset);
11539 
11540  /*l
11541  *b Returns:
11542  **
11543  ** how high the label of the character will float above the character
11544  */
11545  float get_label_link_offset_override();
11546 
11547  /*l
11548  *b Description:
11549  **
11550  ** This function sets whether the label text should show some basic
11551  ** state information about the character instead of its name or
11552  ** the text set by set_label_text().
11553  **
11554  ** The state shown is: Character name, current path, current action.
11555  ** The current path and current action will change as the character
11556  ** moves through paths and actions.
11557  **
11558  *b Arguments:
11559  **
11560  *a show_state - pass 1 to show state, 0 to show original text
11561  */
11562  int set_label_shows_character_state(int show_state);
11563 
11564  /*l
11565  *b Returns:
11566  **
11567  ** whether character state information is shown instead of the
11568  ** character's name or other label text
11569  */
11570  int get_label_shows_character_state();
11571 
11572 
11573 /*****************************************************************************/
11586  /*l
11587  *b Returns:
11588  **
11589  ** pointer of type diguyImpact; NULL if there has been no recent
11590  ** impact recorded; useful for finding out who or what was hit
11591  */
11592  diguyImpact* get_last_impact_record();
11593 
11594  /*l
11595  *b Returns:
11596  **
11597  ** the last impact number
11598  */
11599  int get_last_impact_number();
11600 
11601  /*l
11602  *b Returns:
11603  **
11604  ** the processed flag on the diguyImpact class
11605  */
11606  int get_last_impact_been_processed();
11607 
11608  /*l
11609  *b Description:
11610  **
11611  ** Sets the processed flag on the diguyImpact object.
11612  */
11613  void set_last_impact_been_processed();
11614 
11615  /*l
11616  *b Description:
11617  **
11618  ** Sets the maximum number of unprocessed impacts there can be.
11619  **
11620  ** The unprocessed impact array is a first-in-first-out queue. If an
11621  ** impact occurs that pushes the number of unprocessed impacts past
11622  ** this maximum number, earlier impacts will be dropped from the
11623  ** array.
11624  **
11625  ** The initial value is 10.
11626  */
11627  void set_max_unprocessed_impacts(int max_unprocessed_impacts);
11628 
11629  /*l
11630  *b Returns:
11631  **
11632  ** maximum number of unprocessed impacts
11633  */
11634  int get_max_unprocessed_impacts();
11635 
11636  /*l
11637  *b Returns:
11638  **
11639  ** the last impact link
11640  */
11641  const char* get_last_impact_link();
11642 
11643  /*l
11644  *b Returns:
11645  **
11646  ** 1 if the last impact link is the link named
11647  */
11648  int get_last_impact_link_is(const char* link_name);
11649 
11650  /*l
11651  *b Returns:
11652  **
11653  ** 1 if the last impact resulted from an impact with a vehicle,
11654  ** 0 if not
11655  */
11656  int get_last_impact_is_from_vehicle();
11657 
11658  /*l
11659  *b Returns:
11660  **
11661  ** 1 if the last impact speed is greater than the passed speed,
11662  ** 0 if not
11663  */
11664  int get_last_impact_speed_is_greater_than(float impact_speed);
11665 
11666  /*l
11667  *b Description:
11668  **
11669  ** Sets if impacts are ever processed on this character.
11670  ** Useful for temporary effects and the like.
11671  */
11672  void set_is_immune_to_impacts(int immune);
11673 
11674  /*l
11675  *b Returns:
11676  **
11677  ** 1 if the character is immune to impacts
11678  ** 0 if not
11679  */
11680  int get_is_immune_to_impacts();
11681 
11682 
11683 /*****************************************************************************/
11705  /*l
11706  *b Description:
11707  **
11708  ** This function starts the specified appearance effect on
11709  ** the character.
11710  **
11711  ** The following appearance effects are available:
11712  **
11713  *- - "brake_lights"
11714  *- - "debris"
11715  *- - "debris_dark"
11716  *- - "dust"
11717  *- - "engine_smoke"
11718  *- - "explosion"
11719  *- - "explosion_dark"
11720  *- - "flames"
11721  *- - "flashing_lights"
11722  *- - "ground_dust_burst"
11723  *- - "headlights"
11724  *- - "rotor_wash"
11725  *- - "smoke"
11726  *- - "smoke_dark"
11727  *- - "smoke_trail"
11728  **
11729  *b Arguments:
11730  **
11731  *a effect - name of appearance effect to be started
11732  *a override_link - link to attach to; overrides default
11733  *a override_scale - scale to use for effect; overrides default
11734  *a override_offset_x - x offset to use for effect; overrides default
11735  *a override_offset_y - y offset to use for effect; overrides default
11736  *a override_offset_z - z offset to use for effect; overrides default
11737  *a override_duration - overrides how long the effect should show
11738  *a before automatically ending
11739  **
11740  *b Returns:
11741  **
11742  ** 0 on success, -1 on failure
11743  **
11744  *b Callable From:
11745  **
11746  *- - C++
11747  *- - Script
11748  *- - Decision
11749  */
11750  int begin_appearance_effect(const char* effect,
11751  const char* override_link = NULL,
11752  float override_scale = DIGUY_DEFAULT_FLOAT,
11753  float override_offset_x = DIGUY_DEFAULT_FLOAT,
11754  float override_offset_y = DIGUY_DEFAULT_FLOAT,
11755  float override_offset_z = DIGUY_DEFAULT_FLOAT,
11756  float override_duration = DIGUY_DEFAULT_FLOAT);
11757 
11758  /*l
11759  *b Description:
11760  **
11761  ** This function ends the specified appearance effect on the
11762  ** character.
11763  **
11764  ** The active particles of the effect will go to completion. Use
11765  ** stop_all_appearance_effects() to immediately stop effects,
11766  ** including their active particles.
11767  **
11768  ** If the effect hasn't been started, nothing happens.
11769  **
11770  *b Arguments:
11771  **
11772  *a effect - name of appearance effect to be ended
11773  *a override_link - optional override link effect is attached to
11774  **
11775  ** Pass "all" for the effect argument to end all of this character's
11776  ** appearance effects.
11777  **
11778  *b Returns:
11779  **
11780  ** 0 on success, -1 on failure
11781  **
11782  *b Callable From:
11783  **
11784  *- - C++
11785  *- - Script
11786  *- - Decision
11787  */
11788  int end_appearance_effect(const char* effect,
11789  const char* override_link = NULL);
11790 
11791  /*l
11792  *b Description:
11793  **
11794  ** This function stops the specified appearance effect on the
11795  ** character.
11796  **
11797  ** The active particle systems of the effect will immediately be
11798  ** removed. Use end_appearance_effect() to gradually stop effects;
11799  ** that function lets active particles move to completion.
11800  **
11801  ** If the effect hasn't been started, nothing happens.
11802  **
11803  *b Arguments:
11804  **
11805  *a effect - name of appearance effect to be ended
11806  *a override_link - optional override link effect is attached to
11807  **
11808  ** Pass "all" for the effect argument to stop all of this character's
11809  ** appearance effects.
11810  **
11811  *b Returns:
11812  **
11813  ** 0 on success, -1 on failure
11814  **
11815  *b Callable From:
11816  **
11817  *- - C++
11818  *- - Script
11819  *- - Decision
11820  */
11821  int stop_appearance_effect(const char* effect,
11822  const char* override_link = NULL);
11823 
11824  /*l
11825  *b Description:
11826  **
11827  ** Equivalent to stop_appearance_effect("all");
11828  */
11829  int stop_all_appearance_effects();
11830 
11831  /*l
11832  *b Description:
11833  **
11834  ** This function checks to see if the specified appearance effect
11835  ** has been started with begin_appearance_effect().
11836  **
11837  *b Arguments:
11838  **
11839  *a effect - name of appearance effect to check
11840  *a override_link - optional override link effect is attached to
11841  **
11842  *b Returns:
11843  **
11844  ** 1 if appearance is active, 0 if not
11845  */
11846  int appearance_effect_is_active(const char* effect,
11847  const char* override_link = NULL);
11848 
11849 
11850 /*****************************************************************************/
11863  /*l
11864  *b Description:
11865  **
11866  ** This function returns a pointer to a diguyChainSimulation if the
11867  ** character is a chain_simulation type of character.
11868  **
11869  *b Returns:
11870  **
11871  ** pointer to a diguyChainSimulation
11872  */
11873  diguyChainSimulation* get_chain_simulation();
11874 
11875 
11876 /*****************************************************************************/
11889  /*l
11890  *b Description:
11891  **
11892  ** This function returns a pointer to a diguyVehicleController if the
11893  ** character has one.
11894  **
11895  *b Returns:
11896  **
11897  ** pointer to a diguyVehicleController; may return NULL if character
11898  ** does not have a vehicle controller object
11899  */
11900  diguyVehicleController* get_vehicle_controller();
11901 
11902  /*l
11903  *b Description:
11904  **
11905  ** For most characters playing a travel forward action, the
11906  ** character's facing direction matches the direction of travel. For
11907  ** example, when humans walk forward their pelvis is generally
11908  ** aligned in the direction of travel.
11909  **
11910  ** Some vehicle characters behave differently. For vehicles whose
11911  ** front wheels steer, when turning the vehicle body will pivot around
11912  ** the rear axle. Only gradually will the rear of the vehicle swing
11913  ** in behind the direction of travel. Think of a car making a very
11914  ** sharp turn, and how the rear of the car swings in behind the front
11915  ** as the turn is completed.
11916  **
11917  ** This function will return the orientation of the body of the
11918  ** vehicle; i.e., the orientation of the forward vector along the
11919  ** vehicle's long axis. As mentioned above this may be different
11920  ** than the orientation of the direction of travel.
11921  **
11922  ** This function will return valid results for all characters, though
11923  ** the returned values from this function and that of
11924  ** get_orientation() will be the same for non-vehicle characters.
11925  **
11926  *b Returns:
11927  **
11928  ** 0 on success, -1 on failure
11929  */
11930  int get_vehicle_body_orientation(float* rz, float* rx, float* ry);
11931 
11932 
11933 /*****************************************************************************/
11950  /*l
11951  *b Description:
11952  **
11953  ** This function sets the name of the shader program that will be
11954  ** used by the character when the scenario is using the specified
11955  ** render mode. See diguyScenario::set_current_render_mode().
11956  **
11957  ** Note that care should be taken when changing the shader of
11958  ** characters with skinned appearances. A shader capable of properly
11959  ** transforming vertices must be used for such characters.
11960  **
11961  ** The shader with the given name should be loaded first. If the
11962  ** shader program is not one of DI-Guy's stock shaders, a custom
11963  ** shader program can be loaded explicitly by calling
11964  ** the diguyApp::load_shader_program() function.
11965  **
11966  *b NOTE:
11967  **
11968  ** The specified shader program may not take effect immediately,
11969  ** if the scenario's current render mode is different than the
11970  ** passed render mode. See
11971  ** diguyScenario::set_current_render_mode().
11972  **
11973  *b Arguments:
11974  **
11975  *a shader_name - shader program name; can be NULL
11976  *a render_mode - render mode to modify; passing NULL will
11977  *a modify shader "normal" render mode
11978  **
11979  *b Returns:
11980  **
11981  ** 0 on success, -1 on failure
11982  */
11983  int set_render_mode_shader(const char* shader_name,
11984  const char* render_mode = NULL);
11985 
11986  /*l
11987  *b Description:
11988  **
11989  ** This function resets the shader program for the specified render
11990  ** mode to its default. This will be the shader program name
11991  ** returned by
11992  ** diguyScenario::get_default_character_shader_program_name().
11993  **
11994  ** If the specified render mode is the current scenario render mode,
11995  ** the current shader will change immediately. If not, the change
11996  ** will not take effect until the specified render mode becomes the
11997  ** current scenario render mode. See
11998  ** diguyScenario::set_current_render_mode().
11999  **
12000  *b Arguments:
12001  **
12002  *a render_mode - render mode to modify; passing NULL will
12003  *a modify shader of "normal" render mode
12004  */
12005  void reset_render_mode_shader_to_default(const char* render_mode = NULL);
12006 
12007  /*l
12008  *b Description:
12009  **
12010  ** This function returns the name of the shader that will be used by
12011  ** the character when the scenario is using the specified render
12012  ** mode.
12013  **
12014  *b Arguments:
12015  **
12016  *a render_mode - render mode for which to get program name;
12017  *a pass NULL for "normal" render mode
12018  **
12019  *b Returns:
12020  **
12021  ** name of shader program; NULL if none or error
12022  */
12023  const char* get_render_mode_shader(const char* render_mode = NULL);
12024 
12025  /*l
12026  *b Description:
12027  **
12028  ** This function returns the shader program that is in use by the
12029  ** character. Shader programs are shared objects that can be used
12030  ** by multiple characters.
12031  **
12032  *b Returns:
12033  **
12034  ** object of type diguyGraphicsShaderProgram; NULL if none
12035  */
12036  diguyGraphicsShaderProgram* get_shader_program();
12037 
12038  /*l
12039  *b Description:
12040  **
12041  ** This function overrides the current shader with the specified
12042  ** temporary shader. This temporary shader will remain in effect
12043  ** until:
12044  **
12045  *- - the scenario is reset
12046  *- - reset_current_shader_to_default() is called
12047  *- - set_temporary_current_shader() is called with NULL
12048  **
12049  *b Arguments:
12050  **
12051  *a shader_name - shader name; can be NULL
12052  **
12053  ** Passing NULL for the shader name will un-set the temporary shader,
12054  ** resetting the render mode shader to its default.
12055  **
12056  *b Returns:
12057  **
12058  ** 0 on success, -1 on failure
12059  */
12060  int set_temporary_current_shader(const char* shader_name);
12061 
12062  /*l
12063  *b Description:
12064  **
12065  ** This is a convenience function for resetting the current render
12066  ** mode shader to its default.
12067  **
12068  ** It is equivalent to retrieving the current render mode using
12069  ** diguyScenario::get_current_render_mode(), and calling
12070  ** reset_render_mode_shader_to_default() with that render mode.
12071  */
12072  void reset_current_shader_to_default();
12073 
12074  /*l
12075  *b Description:
12076  **
12077  ** This is a convenience function for refreshing the shader
12078  ** of a character. Usually used in conjunction with logic
12079  ** provided by the user with the graphics API.
12080  */
12081  void trigger_shader_refresh();
12082 
12083  /*l
12084  *b Description:
12085  **
12086  ** This function returns the shader instance that is in use by the
12087  ** character. Each character has its own shader instance.
12088  **
12089  ** Note that the shader instance of a character can change over the
12090  ** lifetime of the character. For example, it will change if the
12091  ** appearance of the character changes. Therefore the returned
12092  ** pointer should not be stored, but should be re-read each time
12093  ** it is needed.
12094  **
12095  *b Returns:
12096  **
12097  ** object of type diguyGraphicsShaderInstance; NULL if none
12098  */
12099  diguyGraphicsShaderInstance* get_shader_instance();
12100 
12101  /*l
12102  *b Description:
12103  **
12104  ** This function resets current values of the variables of the shader
12105  ** back to their initial reset values.
12106  */
12107  void reset_shader_instance_variables_to_initial_values();
12108 
12109  /*l
12110  *b Description:
12111  **
12112  ** This function resets the current and initial values of variables
12113  ** of the shader to the built-in DI-Guy configuration defaults.
12114  */
12115  void reset_shader_instance_variables_to_program_defaults();
12116 
12117 
12118 /*****************************************************************************/
12142  /*l
12143  *b Description:
12144  **
12145  ** This function sets the named character as the attack
12146  ** target of this agent. This agent will pursue the
12147  ** target until it is within range, and then will fire its
12148  ** weapon in an attempt to kill the target.
12149  **
12150  ** This function will implicitly put this agent into the
12151  ** attack behavior.
12152  **
12153  ** The current focus character will be set the specified character.
12154  ** Pass NULL or the empty string ("") to not change the focus
12155  ** character, but still change to the pursue behavior.
12156  **
12157  ** The current focus group will be un-set.
12158  **
12159  *b Arguments:
12160  **
12161  *a character_name - character to attack
12162  **
12163  *b Returns:
12164  **
12165  ** 0 on success, -1 on failure
12166  **
12167  *b Callable From:
12168  **
12169  *- - C++
12170  *- - Script
12171  *- - Decision
12172  */
12173  int agent_attack_character(const char* character_name);
12174 
12175  /*l
12176  *b Description:
12177  **
12178  ** This function is similar to agent_attack_character(), but instead
12179  ** will choose attack targets from the characters in the specified
12180  ** group.
12181  **
12182  ** This function will implicitly put this agent into the attack
12183  ** behavior.
12184  **
12185  ** The current focus group will be set to the specified group. Pass
12186  ** NULL or the empty string ("") to not change the focus group, but
12187  ** still change to the attack behavior.
12188  **
12189  ** The current focus character will be un-set.
12190  **
12191  *b Arguments:
12192  **
12193  *a group_name - name of group from which attack targets should
12194  *a be chosen
12195  **
12196  *b Returns:
12197  **
12198  ** 0 on success, -1 on failure
12199  **
12200  *b Callable From:
12201  **
12202  *- - C++
12203  *- - Script
12204  *- - Decision
12205  */
12206  int agent_attack_group(const char* group_name);
12207 
12208  /*l
12209  *b Description:
12210  **
12211  ** See diguyAgentParams::set_attack_zone_enabled().
12212  */
12213  int agent_set_attack_zone_enabled(int use_attack_zone);
12214 
12215  /*l
12216  *b Description:
12217  **
12218  ** See diguyAgentParams::get_attack_zone_enabled().
12219  */
12220  int agent_get_attack_zone_enabled();
12221 
12222  /*l
12223  *b Description:
12224  **
12225  ** See diguyAgentParams::set_attack_zone().
12226  */
12227  int agent_set_attack_zone(float x, float y, float z, float radius);
12228 
12229  /*l
12230  *b Description:
12231  **
12232  ** See diguyAgentParams::get_attack_zone().
12233  */
12234  int agent_get_attack_zone(float* x, float* y, float* z, float* radius);
12235 
12242  /*l
12243  *b Description:
12244  **
12245  ** This function adds a flee object to this agent.
12246  ** This agent will attempt to move away from the specified
12247  ** character until it is beyond the specified flee distance.
12248  **
12249  ** Note: Currently there can only be one flee object. This
12250  ** restriction will be lifted in a future version.
12251  **
12252  ** This function will implicitly put this agent into the
12253  ** flee behavior.
12254  **
12255  ** Neither the current focus character nor group will be
12256  ** changed by this function.
12257  **
12258  *b Arguments:
12259  **
12260  *a character_name - character from which to flee
12261  *a distance - minimum distance to move away from character
12262  *a danger_level - how "strong" the flee should be; set from
12263  *a 0 to 100
12264  **
12265  ** The danger_level argument is not currently used, but will be in
12266  ** a future version.
12267  **
12268  *b Returns:
12269  **
12270  ** 0 on success, -1 on failure
12271  **
12272  *b Callable From:
12273  **
12274  *- - C++
12275  *- - Script
12276  *- - Decision
12277  */
12278  int agent_flee_character(const char* character_name,
12279  float distance,
12280  int danger_level = 50);
12281 
12282  /*l
12283  *b Description:
12284  **
12285  ** This function adds a flee object to this agent. This agent
12286  ** will attempt to move away from the specified group until it is
12287  ** beyond the specified flee distance.
12288  **
12289  ** This function will implicitly put this agent into the flee
12290  ** behavior.
12291  **
12292  ** Neither the current focus character nor group will be changed
12293  ** by this function.
12294  **
12295  *b Arguments:
12296  **
12297  *a group_name - group from which to flee
12298  *a distance - minimum distance to move away from character
12299  *a danger_level - how "strong" the flee should be; set from
12300  *a 0 to 100
12301  **
12302  ** The danger_level argument is not currently used, but will be in
12303  ** a future version.
12304  **
12305  *b Returns:
12306  **
12307  ** 0 on success, -1 on failure
12308  **
12309  *b Callable From:
12310  **
12311  *- - C++
12312  *- - Script
12313  *- - Decision
12314  */
12315  int agent_flee_group(const char* group_name,
12316  float distance,
12317  int danger_level = 50);
12318 
12319  /*l
12320  *b Description:
12321  **
12322  ** This function is similar to agent_flee_group(), but the
12323  ** agent will instead flee the members of the specified
12324  ** crowd.
12325  */
12326  int agent_flee_crowd(const char* crowd_name,
12327  float distance,
12328  int danger_level = 50);
12329 
12330  /*l
12331  *b Description:
12332  **
12333  ** This function adds a flee object to this agent.
12334  ** This agent will attempt to move away from the specified
12335  ** location until it is beyond the specified flee distance.
12336  **
12337  ** Note: Currently there can only be one flee object. This
12338  ** restriction will be lifted in a future version.
12339  **
12340  ** This function will implicitly put this agent into the
12341  ** flee behavior.
12342  **
12343  ** Neither the current focus character nor group will be
12344  ** changed by this function.
12345  **
12346  *b Arguments:
12347  **
12348  *a x, y, z - location from which to flee
12349  *a distance - minimum distance to move away from character
12350  *a danger_level - how "strong" the flee should be; set from
12351  *a 0 to 100
12352  **
12353  ** The danger_level argument is not currently used, but will be in
12354  ** a future version.
12355  **
12356  *b Returns:
12357  **
12358  ** 0 on success, -1 on failure
12359  */
12360  int agent_flee_location(float x, float y, float z,
12361  float distance,
12362  int danger_level = 50);
12363 
12364  /*l
12365  *b Description:
12366  **
12367  ** This function removes all flee objects.
12368  **
12369  ** This function has no effect on current behavior.
12370  **
12371  *b Returns:
12372  **
12373  ** 0 on success, -1 on failure
12374  **
12375  *b Callable From:
12376  **
12377  *- - C++
12378  *- - Script
12379  *- - Decision
12380  */
12381  void agent_remove_all_flee_objects();
12382 
12393  /*l
12394  *b Description:
12395  **
12396  ** This function puts this agent into the mingle behavior, in which
12397  ** it will choose semi-random points in the specified region and
12398  ** subregion to move to. The agent will remain at the selected
12399  ** points for some amount of time, and the select a new point.
12400  **
12401  ** If all members of a crowd have this behavior they will tend to get
12402  ** together in small groups.
12403  **
12404  ** Use diguyAgentParams::set_move_on_t_min() and
12405  ** diguyAgentParams::set_move_on_t_max() for setting how long the
12406  ** agent will remain at the selected mingle points.
12407  **
12408  *b Arguments:
12409  **
12410  *a region_name - region in which to mingle
12411  *a subregion_name - subregion in which to mingle
12412  **
12413  ** The behavior region will be set the specified region. Pass NULL
12414  ** or "(current)" to not change the current behavior region.
12415  **
12416  *b Returns:
12417  **
12418  ** 0 on success, -1 on failure
12419  **
12420  *b Callable From:
12421  **
12422  *- - C++
12423  *- - Script
12424  *- - Decision
12425  */
12426  int agent_mingle_in_region(const char* region_name = "(current)",
12427  const char* subregion_name = "base");
12428 
12439  /*l
12440  *b Description:
12441  **
12442  ** This function is similar to agent_mingle_in_region(), but agents
12443  ** will pick completely random points and not try to clump together
12444  ** in small groups.
12445  **
12446  *b Returns:
12447  **
12448  ** 0 on success, -1 on failure
12449  **
12450  *b Callable From:
12451  **
12452  *- - C++
12453  *- - Script
12454  *- - Decision
12455  */
12456  int agent_wander_region(const char* region_name = "(current)",
12457  const char* subregion_name = "base");
12458 
12469  /*l
12470  *b Description:
12471  **
12472  ** This function will cause this agent to pursue the specified
12473  ** character. This agent will attempt to move toward the specified
12474  ** character until it is within its still distance as specified in
12475  ** its agent params.
12476  **
12477  ** This function will implicitly put this agent into the pursue
12478  ** behavior.
12479  **
12480  ** The current focus group will be set to the specified group. Pass
12481  ** NULL or the empty string ("") to not change the focus group, but
12482  ** still change to the attack behavior.
12483  **
12484  ** The current focus character will be un-set.
12485  **
12486  *b Arguments:
12487  **
12488  *a character_name - character to pursue
12489  **
12490  *b Returns:
12491  **
12492  ** 0 on success, -1 on failure
12493  **
12494  *b Callable From:
12495  **
12496  *- - C++
12497  *- - Script
12498  *- - Decision
12499  */
12500  int agent_pursue_character(const char* character_name);
12501 
12502  /*l
12503  *b Description:
12504  **
12505  ** This function is similar to agent_pursue_character(), but the
12506  ** point toward the agent will move will be offset from the pursued
12507  ** character by the passed offset.
12508  */
12509  int agent_pursue_character_with_offset(const char* character_name,
12510  float offset_x,
12511  float offset_y);
12512 
12513  /*l
12514  *b Description:
12515  **
12516  ** This function is similar to agent_pursue_character(), but instead
12517  ** will choose pursue characters from the characters in the specified
12518  ** group.
12519  **
12520  ** This function will implicitly put this agent into the pursue
12521  ** behavior.
12522  **
12523  ** The current focus group will be set to the specified group. Pass
12524  ** NULL or the empty string ("") to not change the focus group, but
12525  ** still change to the pursue behavior.
12526  **
12527  ** The current focus character will be un-set.
12528  **
12529  *b Arguments:
12530  **
12531  *a group_name - name of group from which pursue characters should
12532  *a be chosen
12533  **
12534  *b Returns:
12535  **
12536  ** 0 on success, -1 on failure
12537  **
12538  *b Callable From:
12539  **
12540  *- - C++
12541  *- - Script
12542  *- - Decision
12543  */
12544  int agent_pursue_group(const char* group_name);
12545 
12546  /*l
12547  *b Description:
12548  **
12549  ** Calls a formation with this character as a leader, oriented towards
12550  ** (target_x, target_y).
12551  **
12552  *b Returns:
12553  **
12554  ** 0 on success, -1 on failure
12555  */
12556  int agent_call_formation(const char* formation_name,
12557  float target_x,
12558  float target_y);
12559 
12570  /*l
12571  *b Description:
12572  **
12573  ** This function has the character travel along its behavior path
12574  ** shape, typically to the end and then back to the beginning. It
12575  ** will put the agent into the travel behavior.
12576  **
12577  *b Arguments:
12578  **
12579  *a direction - should be either "forward" or "backward"; pass NULL
12580  *a for default forward
12581  *a at_end - what to do when end of path reached
12582  *a waypoint_index - index of waypoint to start at; -1 for nearest,
12583  *a -2 for random
12584  *a offset_y - sideways offset from behavior path
12585  **
12586  ** Valid values for at_end are:
12587  **
12588  *- - "reverse"
12589  *- - "loop"
12590  *- - "stop"
12591  *- - "teleport"
12592  **
12593  ** See the documentation for diguyNavPathAtEnd for information on
12594  ** what each value means.
12595  */
12596  int agent_travel_behavior_path(const char* direction = NULL,
12597  const char* at_end = NULL,
12598  int waypoint_index = -1,
12599  float offset_y = 0.5f);
12600 
12601  /*l
12602  *b Description:
12603  **
12604  ** Similar to agent_travel_behavior_path(), but specific path can be
12605  ** set rather than using behavior path.
12606  */
12607  int agent_travel_path_shape(const char* path_shape_name,
12608  const char* direction = NULL,
12609  const char* at_end = NULL,
12610  int waypoint_index = -1,
12611  float offset_y = 0.5f);
12612 
12613  /*l
12614  *b Description:
12615  **
12616  ** The agent will create a travel path around the border of the
12617  ** region specified. A CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED
12618  ** callback will be triggered every time a character completes a loop
12619  ** around the border.
12620  **
12621  *b Arguments:
12622  **
12623  *a region_name - the name of the region to patrol; leaving blank or
12624  *a passing NULL will use the agent's current region
12625  *a subregion - name of the subregion to use; defaults to the base
12626  *a subregion
12627  **
12628  *b Returns:
12629  **
12630  ** 0 on success, -1 on failure
12631  */
12632  int agent_travel_region_border(const char* region_name = NULL,
12633  const char* subregion_name = "base");
12634 
12635  /*l
12636  *b Description:
12637  **
12638  ** Agent will attempt to create a navigation path on the via_region
12639  ** and then travel it. An A* path planning algorithm is used to find
12640  ** the path, cost preferences from the character's current
12641  ** diguyAgentParams are used in the search.
12642  **
12643  *b Note: as of DI-Guy 12 there is a version of this function
12644  ** agent_move_to_point_bg() that uses a multi-threaded infrastructure.
12645  ** We strongly recommend using it for future developments.
12646  **
12647  *b Arguments:
12648  **
12649  *a x, y, z - the target location
12650  *a via_region - the name of the region to run A* on (pass in "*"
12651  *a to have the code attempt to find the nearest
12652  *a region automatically.)
12653  *a subregion_name - the name of the subregion to restrict search to
12654  **
12655  *b Returns:
12656  **
12657  ** 0 on success, -1 on failure
12658  */
12659  int agent_move_to_point(float x, float y, float z,
12660  const char* via_region = NULL,
12661  const char* subregion_name = "base");
12662 
12663  /*l
12664  *b Description:
12665  **
12666  ** A multi-threaded version of agent_move_to_point(). See that
12667  ** function for more information.
12668  **
12669  ** We recommend switching to using this over the single threaded
12670  ** version. When the path result has been computed a callback with id
12671  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12672  ** stored in get_path_planning_result(). You can also poll for
12673  ** completion via get_is_path_planning().
12674  **
12675  *b Returns:
12676  **
12677  ** diguyNavPathSearchResults enum value
12678  **
12679  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12680  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12681  ** for multi-threading, or a negative value on failure.
12682  */
12683  int agent_move_to_point_bg(float x, float y, float z,
12684  const char* via_region = NULL,
12685  const char* subregion_name = "base");
12686 
12687  /*l
12688  *b Description:
12689  **
12690  ** Agent will attempt to create a navigation path on the region
12691  ** via_region and then travel it. An A* path planning algorithm is
12692  ** used to find the path.
12693  **
12694  ** The subregion masks are used to specify which subregions to use or
12695  ** avoid. Cost bias values can be used to make tweak how strong the
12696  ** repulsion values are.
12697  **
12698  *b Note:
12699  **
12700  ** As of DI-Guy 12 there is a version of this function
12701  ** agent_move_to_point_via_subregions_bg that uses a multi-threaded
12702  ** infrastructure. We strongly recommend using it for future
12703  ** developments.
12704  **
12705  ** This function will fail and return -1 if a path cannot be found.
12706  **
12707  *b Arguments:
12708  **
12709  *a x, y, z - the target location
12710  *a via_region - the name of the region to run A* on (pass in "*"
12711  *a to have the code attempt to find the nearest
12712  *a region automatically)
12713  *a preferred_subregions_mask - diguySubregionMask value of regions
12714  *a preferred for travel
12715  *a cost_bias_for_preferred_regions - how much cheaper it will be
12716  *a to cross spaces that are part of desired subregion;
12717  *a should be < 1.0
12718  *a cost_bias_for_neutral_regions - how much more expensive it will be
12719  *a to cross spaces that are not part of desired subregion; see
12720  *a below for more information
12721  *a repulsed_regions_mask - diguySubregionMask value of regions *not*
12722  *a preferred for travel
12723  *a cost_bias_for_repulsed_regions - how much more expensive it will be
12724  *a to cross regions that are marked as repulsive; pass
12725  *a DIGUY_DEFAULT_FLOAT to avoid completely
12726  **
12727  ** Pass DIGUY_DEFAULT_FLOAT for cost_bias_for_neutral_regions and
12728  ** cost_bias_for_repulsed_regions to specify that they should be
12729  ** avoided completely.
12730  **
12731  ** The preferred_subregions_mask and repulsed_regions_mask use
12732  ** DI-Guy subregion mask values combined together. For example,
12733  ** DIGUY_SUBREGION_MASK_SIDEWALK | DIGUY_SUBREGION_MASK_CROSSWALK.
12734  **
12735  ** For cost_bias_for_neutral_regions, specifying a non-zero value for
12736  ** this lowers the likelihood that searches fail on disjointed
12737  ** subregions. A value < 1 will cause the planner to run faster but
12738  ** explore fewer points, possibly missing preferred regions. Values
12739  ** greater then 1 will explore more points but will be slower.
12740  **
12741  *b NOTE:
12742  **
12743  *b THIS API has changed for DI-GUY 11.
12744  **
12745  ** cost_bias_for_preferred_regions has been added and the neutral and
12746  ** repulsed default values have changed.
12747  **
12748  *b Returns:
12749  **
12750  ** 0 on success, -1 on failure
12751  */
12752  int agent_move_to_point_via_subregions(float x, float y, float z,
12753  const char* via_region = NULL,
12754  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12755  float cost_bias_for_preferred_regions = 0.25f,
12756  float cost_bias_for_neutral_regions = 1.1f,
12757  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12758  float cost_bias_for_repulsed_regions = 10.0f,
12759  int cost_rule = 0);
12760 
12761  /*l
12762  *b Description:
12763  **
12764  ** A multi-threaded version of agent_move_to_point_via_subregions().
12765  ** We recommend switching to using this over the single threaded
12766  ** version. When the result is found a
12767  ** CALLBACK_ID_AGENT_PATH_PLAN_COMPLETED is triggered and the result is
12768  ** stored in get_path_planning_result(), you can also poll for
12769  ** completion via get_is_path_planning().
12770  **
12771  *b Returns:
12772  **
12773  ** diguyNavPathSearchResults enum value
12774  **
12775  ** The return value is typically DIGUY_NAV_PATH_ERROR_NONE (0) on
12776  ** success, DIGUY_NAV_PATH_ERROR_SEARCH_QUEUED if this has been queued
12777  ** for multi-threading, or a negative value on failure.
12778  */
12779  int agent_move_to_point_via_subregions_bg(float x, float y, float z,
12780  const char* via_region = NULL,
12781  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12782  float cost_bias_for_preferred_regions = 0.25f,
12783  float cost_bias_for_neutral_regions = 1.1f,
12784  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12785  float cost_bias_for_repulsed_regions = 10.0f,
12786  int cost_rule = 0);
12787 
12788  /*l
12789  *b Returns:
12790  **
12791  ** diguyNavPathSearchResults value after agent_move_to_point_bg()
12792  ** or agent_move_to_point_via_subregions_bg() has been called when
12793  ** the multi-threaded path planner has completed.
12794  */
12795  int get_path_planning_result();
12796 
12797  /*l
12798  *b Returns:
12799  **
12800  ** 1 if character is currently waiting for a result from the
12801  ** multi-threaded path planner, else 0
12802  */
12803  int get_is_path_planning();
12804 
12805  /*l
12806  *b Description:
12807  **
12808  ** Agent will attempt to create a navigation path on the via_region
12809  ** to a point in the target region, and then travel it. An A* path
12810  ** planning algorithm is used to find the path. Cost preferences from
12811  ** the character's current diguyAgentParams are used in the search.
12812  **
12813  *b Arguments:
12814  **
12815  *a region - target region
12816  *a subregion_name - target subregion
12817  *a via_region - name of the region travel in
12818  **
12819  *b Returns:
12820  **
12821  ** 0 on success, -1 on failure
12822  **
12823  *b Callable From:
12824  **
12825  *- - C++
12826  *- - Script
12827  *- - Decision
12828  */
12829  int agent_move_to_region(const char* region,
12830  const char* subregion_name = "base",
12831  const char* via_region = NULL);
12832 
12833  /*l
12834  *b Description:
12835  **
12836  ** Similar to agent_move_to_point_via_subregions(), but for moving to
12837  ** another region.
12838  **
12839  *b NOTE:
12840  **
12841  *b THIS API has changed for DI-GUY 11.
12842  **
12843  ** cost_bias_for_preferred_regions has been added and the neutral and
12844  ** repulsed default values have changed.
12845  **
12846  *b See Also:
12847  **
12848  ** diguyScenario::set_max_distance_planning_multiplier();
12849  ** diguyScenario::get_time_spent_path_planning_this_frame();
12850  **
12851  *b Returns:
12852  **
12853  ** 0 on success, -1 on failure
12854  */
12855  int agent_move_to_region_via_subregions(const char* region_name,
12856  const char* subregion_name = "base",
12857  const char* via_region = NULL,
12858  float cost_bias_for_preferred_regions = 0.25f,
12859  int preferred_subregions_mask = DIGUY_SUBREGION_MASK_NONE,
12860  float cost_bias_for_neutral_regions = 1.1f,
12861  int repulsed_regions_mask = DIGUY_SUBREGION_MASK_NONE,
12862  float cost_bias_for_repulsed_regions = 10.0f);
12863 
12874  /*l
12875  *b Description:
12876  **
12877  ** The agent will begin following the specified path, using the path
12878  ** follow behavior (DIGUY_AGENT_BEHAVIOR_PATH_FOLLOW).
12879  **
12880  ** The path follow behavior allows an agent to approximately follow a
12881  ** diguyCharacterPath without being in path position mode. The agent
12882  ** can respond to external stimuli (e.g., run away from gunfire), and
12883  ** later return to and resume the path.
12884  **
12885  ** Currently the path must be a path previously defined for the
12886  ** character, through either DI-Guy Scenario or via path API calls.
12887  **
12888  *b Arguments:
12889  **
12890  *a path_name - name of a path of this character
12891  **
12892  *b Returns:
12893  **
12894  ** 0 on success, -1 on failure
12895  **
12896  *b Callable From:
12897  **
12898  *- - C++
12899  *- - Script
12900  *- - Decision
12901  */
12902  int agent_path_follow(const char* path_name);
12903 
12904  /*l
12905  *b Description:
12906  **
12907  ** The agent will resume following the path specified by a previous
12908  ** call to agent_path_follow(). This will put the agent back into
12909  ** the path follow behavior.
12910  **
12911  *b Returns:
12912  **
12913  ** 0 on success, -1 on failure
12914  **
12915  *b Callable From:
12916  **
12917  *- - C++
12918  *- - Script
12919  *- - Decision
12920  */
12921  int agent_resume_path_follow();
12922 
12923  /*l
12924  *b Returns:
12925  **
12926  ** the path being followed in path behavior mode
12927  */
12928  diguyCharacterPath* agent_get_path_follow_path();
12929 
12930  /*l
12931  *b Description:
12932  **
12933  ** In path follow behavior the agent moves along the path specified
12934  ** in agent_path_follow(). How far along the agent is on the path is
12935  ** specified in seconds. This function returns that time.
12936  **
12937  ** Note that advancing along the path may be paused for some reason,
12938  ** typically because the agent is resuming path follow behavior
12939  ** after being in a different behavior, or the agent is too far away
12940  ** from the current desired position on the path. In this case the
12941  ** returned time may not advance for awhile until the agent is close
12942  ** enough to the path to resume advancing along it.
12943  **
12944  ** Call diguyAgentParams::set_path_follow_pause_t_when_off_path()
12945  ** to set whether time will be paused when off of the path.
12946  **
12947  ** Call diguyAgentParams::set_path_follow_unpause_t_at_radius() to
12948  ** set how close the agent must be to the last point on the path
12949  ** before time will resume.
12950  **
12951  *b Returns:
12952  **
12953  ** how far, in seconds, the agent is along its path follow path
12954  */
12955  float agent_get_path_follow_path_t();
12956 
12957  /*l
12958  *b Returns:
12959  **
12960  ** 1 if time along the path is not advancing, else 0
12961  */
12962  int agent_get_path_follow_path_t_paused();
12963 
12974  /*l
12975  *b Returns:
12976  **
12977  ** the crowd this agent is a part of, if any; returns NULL if not in
12978  ** a crowd
12979  */
12980  diguyCrowd* agent_get_crowd();
12981 
12982  /*l
12983  *b Description:
12984  **
12985  ** This function allows the end user to directly change an agent's
12986  ** current behavior. This function currently the only way to start
12987  ** an agent "idling".
12988  */
12989  int agent_begin_behavior(const char* behavior_name);
12990 
12991  /*l
12992  *b Description:
12993  **
12994  ** This function sets the behavior of the agent to "none".
12995  */
12996  int agent_stop_behavior();
12997 
12998  /*l
12999  *b Description:
13000  **
13001  ** This function is a convenience function that changes the focus
13002  ** character of this agent's current crowd params.
13003  **
13004  ** This can also be done by getting the character's current params
13005  ** using get_agent_current_params(), and then calling
13006  ** set_focus_character() on that object. This function
13007  ** call, however, is available in decisions.
13008  **
13009  ** The agent currently need not be part of a crowd for this function
13010  ** to work.
13011  **
13012  *b Arguments:
13013  **
13014  *a character_name - name of character to become new focus
13015  *a character; pass NULL or "" to un-set
13016  *a the focus character
13017  **
13018  *b Returns:
13019  **
13020  ** 0 on success, -1 on failure
13021  **
13022  *b Callable From:
13023  **
13024  *- - C++
13025  *- - Script
13026  *- - Decision
13027  */
13028  int agent_set_current_focus_character(const char* character_name);
13029 
13030  /*l
13031  *b Description:
13032  **
13033  ** This function returns the current character this agent
13034  ** is focused on. This will either be the character named
13035  ** by the focus character, or the character chosen from the
13036  ** focus group to be the current focus character.
13037  **
13038  ** The agent currently need not be part of a crowd for this function
13039  ** to work.
13040  **
13041  *b Returns:
13042  **
13043  *a pointer to type diguyCharacter
13044  */
13045  diguyCharacter* agent_get_current_focus_character();
13046 
13047  /*l
13048  *b Description:
13049  **
13050  ** Similar to set_current_focus_character(), but sets
13051  ** the current focus group instead of character.
13052  **
13053  ** The agent currently need not be part of a crowd for this function
13054  ** to work.
13055  **
13056  *b Arguments:
13057  **
13058  *a group_name - name of group to become new focus
13059  *a group; pass NULL or "" to un-set
13060  *a the focus group
13061  **
13062  *b Returns:
13063  **
13064  ** 0 on success, -1 on failure
13065  **
13066  *b Callable From:
13067  **
13068  *- - C++
13069  *- - Script
13070  *- - Decision
13071  */
13072  int agent_set_current_focus_group(const char* group_name);
13073 
13074  /*l
13075  *b Description:
13076  **
13077  ** This function returns the initial agent parameters of
13078  ** this agent. The initial parameters of this agent
13079  ** can then be edited through this object.
13080  **
13081  ** Changes to the initial parameters will have no effect until
13082  ** the scenario is reset.
13083  **
13084  ** The current agent parameters will be set to these
13085  ** initial parameters whenever the scenario is reset.
13086  **
13087  ** The agent currently need not be part of a crowd for this function
13088  ** to work.
13089  **
13090  *b Returns:
13091  **
13092  *a pointer to type diguyAgentParams
13093  */
13094  diguyAgentParams* agent_get_initial_params();
13095 
13096  /*l
13097  *b Description:
13098  **
13099  ** This function returns the current agent parameters of
13100  ** this agent. The current parameters of this agent
13101  ** can then be edited through this object.
13102  **
13103  ** Changes to the current parameters should take effect immediately.
13104  **
13105  ** The current agent parameters will be reset to the
13106  ** initial parameters whenever the scenario is reset.
13107  **
13108  ** The agent currently need not be part of a crowd for this function
13109  ** to work.
13110  **
13111  *b Returns:
13112  **
13113  *a pointer to type diguyAgentParams
13114  */
13115  diguyAgentParams* agent_get_current_params();
13116 
13117  /*l
13118  *b Description:
13119  **
13120  ** This function gets the name of the agent's current profile.
13121  **
13122  *b Returns:
13123  **
13124  ** the name of the agent's current profile
13125  */
13126  const char* agent_get_current_params_profile_name();
13127 
13128  /*l
13129  *b Description:
13130  **
13131  ** This function sets this agent's current agent parameters from the
13132  ** specified crowd profile.
13133  **
13134  ** The agent currently need not be part of a crowd for this function
13135  ** to work.
13136  **
13137  *b Arguments:
13138  **
13139  *a profile_name - name of existing crowd profile
13140  *a retain_focus_objects - pass 1 to not change focus object from
13141  *a current focus
13142  *a retain_navigation_values - pass 1 to not change current navigation
13143  *a parameters
13144  *a retain_behavior - pass 1 to not change current behavior
13145  **
13146  ** Navigation values are things like:
13147  **
13148  *- - behavior path
13149  *- - behavior region and subregion
13150  *- - region masks
13151  *- - cost biases
13152  *- - path planner settings
13153  **
13154  *b Returns:
13155  **
13156  ** 0 on success, -1 on failure
13157  **
13158  *b Callable From:
13159  **
13160  *- - C++
13161  *- - Script
13162  *- - Decision
13163  */
13164  int agent_set_current_params_from_profile(const char* profile_name,
13165  int retain_focus_objects = 1,
13166  int retain_navigation_values = 1,
13167  int retain_behavior = 0);
13168 
13169  /*l
13170  *b Description:
13171  **
13172  ** Similar to agent_set_current_params_from_profile(), but initial
13173  ** parameters are changed.
13174  */
13175  int agent_set_initial_params_from_profile(const char* profile_name);
13176 
13177  /*l
13178  *b Description:
13179  **
13180  ** This function sets the current parameters from the agent's
13181  ** initial parameters.
13182  */
13183  void agent_set_current_params_from_initial_params();
13184 
13185  /*l
13186  *b Description:
13187  **
13188  ** This function sets whether the borders of the current behavior
13189  ** region of the agent is solid.
13190  **
13191  ** If they are, the agent will treat the walls as if they are
13192  ** solid walls in the environment. If not, the agent is free to
13193  ** walk through them.
13194  **
13195  ** The agent currently need not be part of a crowd for this function
13196  ** to work.
13197  **
13198  *b Arguments:
13199  **
13200  *a is_solid - 1 if region border should be solid, 0 if not
13201  **
13202  *b Callable From:
13203  **
13204  *- - C++
13205  *- - Script
13206  *- - Decision
13207  */
13208  void agent_set_current_behavior_region_border_is_solid(int is_solid);
13209 
13210  /*l
13211  *b Description:
13212  **
13213  ** If the agent is in a behavior that stays in one place before moving
13214  ** to another, such as wander or mingle, this function will request
13215  ** that the agent move on to the next location.
13216  **
13217  *b Callable From:
13218  **
13219  *- - C++
13220  *- - Script
13221  *- - Decision
13222  */
13223  void agent_move_on();
13224 
13225 
13226  /*l
13227  *b Description:
13228  **
13229  ** This function controls if the AI will attempt to automatically change variants
13230  ** depending on the behavior. This should only change how still motions are performed
13231  ** when the default variant is Normal. Characters in wander and idle will automatically
13232  ** shift to ambient still motions, mingle will alternate between socialize and ambient
13233  ** motions. Attack should automatically switch from aiming to ambient.
13234  ** defaults to being on.
13235  */
13236  int agent_set_auto_variant_selection(int selection_enabled);
13237 
13238  /*l
13239  *b Description:
13240  **
13241  ** Returns if automatic variant selection is enabled, defaults to being on.
13242  */
13243  int agent_get_auto_variant_selection();
13244 
13245 
13246 #ifdef CPLUSPLUS_ONLY
13247 
13303  /*l
13304  *b Description:
13305  **
13306  ** This function sets a feeler function that will be used by this
13307  ** character for environment collision detection. The feeler will
13308  ** replace any existing feeler function (including the default
13309  ** function used in DI-Guy Scenario).
13310  **
13311  ** See the "User-Defined Feelers" information for more information.
13312  **
13313  *b Arguments:
13314  **
13315  *a feeler_function - pointer to user-defined feeler function
13316  **
13317  *b Returns:
13318  **
13319  ** 0 on success, -1 on failure
13320  **
13321  *b Callable From:
13322  **
13323  *- - C++
13324  */
13325  int agent_set_feeler_function(diguyFeelerFunction* feeler_function);
13326 
13327  /*l
13328  *b Returns:
13329  **
13330  ** current feeler function; see set_feeler_function()
13331  **
13332  *b Callable From:
13333  **
13334  *- - C++
13335  */
13336  diguyFeelerFunction* agent_get_feeler_function();
13337 
13338 #endif
13339 
13340 
13341 /*****************************************************************************/
13347  /*l
13348  *b Description:
13349  **
13350  ** Creates a Lua mind object based off of the contents of base_class.
13351  **
13352  *b Arguments:
13353  **
13354  *a base_class - the class to use as the basis for the character's
13355  *a mind
13356  *a init_arg1-2 - experimental optional arguments passed to the init
13357  *a function; your lua init function will need to take
13358  *a arguments
13359  **
13360  */
13361  int create_lua_mind(const char* base_class, const char* init_arg1 = NULL,
13362  const char* init_arg2 = NULL);
13363 
13364  /*l
13365  *b Description:
13366  **
13367  ** Returns the name of the mind, e.g. "luaPedestrian". This is, in other
13368  ** words, the mind's base class
13369  */
13370  const char *get_mind_name();
13371 
13372  /*l
13373  *b Description:
13374  **
13375  ** Agent characters with minds will typically have the mind be in
13376  ** some state, such as "patrolling", "fleeing", "mobbing", etc. This
13377  ** function returns the name of that state.
13378  **
13379  ** Currently this is only applicable to characters with Lua minds.
13380  **
13381  *b Returns:
13382  **
13383  ** the name of the agent's current mind state
13384  */
13385  const char* get_mind_current_state_name();
13386 
13387  /*l
13388  *b Description:
13389  **
13390  ** This function causes callback functions with the callback id
13391  ** CALLBACK_ID_AGENT_MIND_CURRENT_STATE_CHANGED to be called.
13392  ** It's intended use is for mind implementations that need to
13393  ** signal that the mind's current state has changed.
13394  **
13395  ** Currently this is only applicable to characters with Lua minds.
13396  */
13397  void do_mind_current_state_changed_callback();
13398 
13399  /*l
13400  *b Description:
13401  **
13402  ** How long until the character's main coroutine thread should be
13403  ** resumed. This function is typically used by various luaCharacter
13404  ** sleep functions.
13405  **
13406  *b Arguments:
13407  **
13408  *a sleep_length - how long relative to the current time the character
13409  *a should sleep
13410  */
13411  int set_sleep_timer(float sleep_length);
13412 
13413  /*l
13414  *b Returns:
13415  **
13416  ** How long until the character's main coroutine thread resumes,
13417  ** relative to the current time.
13418  */
13419  float get_sleep_timer();
13420 
13421  /*l
13422  *b Description:
13423  **
13424  ** The frequency at which the luaCharacter's heartbeat function
13425  ** should run. This defaults to once per second. The character
13426  ** must have a Lua function named heartbeat.
13427  **
13428  *b Arguments:
13429  **
13430  *a heartbeat_dt - frequency of heartbeat
13431  */
13432  int set_heartbeat_dt(float heartbeat_dt);
13433 
13434  /*l
13435  *b Description:
13436  **
13437  ** This function allows the addition of additional heartbeat
13438  ** functions.
13439  **
13440  *b Arguments:
13441  **
13442  *a function_name - the name of the Lua function to treat as a
13443  *a heartbeat; the function_name should not include
13444  *a the name of the character object
13445  *a heartbeat_dt - frequency of heartbeat
13446  **
13447  *b Returns:
13448  **
13449  ** 0 on success, -1 on failure
13450  */
13451  int add_secondary_heartbeat(const char* function_name,
13452  float heartbeat_dt);
13453 
13454  /*l
13455  *b Description:
13456  **
13457  ** This function removes an added heartbeat function.
13458  **
13459  *b Arguments:
13460  **
13461  *a function_name - the name of the Lua function to treat as a
13462  *a heartbeat; the function_name should not include
13463  *a the name of the character object
13464  **
13465  *b Returns:
13466  **
13467  ** 0 on success, -1 on failure
13468  */
13469  int remove_secondary_heartbeat(const char* function_name);
13470 
13471  /*l
13472  *b Description:
13473  **
13474  ** The frequency at which a luaCharacter's secondary heartbeat
13475  ** function should run. The character must have a Lua function named
13476  ** function_name.
13477  **
13478  *b Arguments:
13479  **
13480  *a function_name - heartbeat function to adjust
13481  *a heartbeat_dt - frequency of heartbeat
13482  **
13483  *b Returns:
13484  **
13485  ** 0 on success, -1 on failure
13486  */
13487  int set_secondary_heartbeat_dt(const char* function_name, float heartbeat_dt);
13488 
13489  /*l
13490  *b Description:
13491  **
13492  ** This function creates a request that whenever the specified
13493  ** callback is triggered, the character is woken up with a message.
13494  ** The message will be of the form:
13495  *>
13496  *- - message_type = "callback"
13497  *- - message = the string representation of the callback
13498  *<
13499  ** A good example of the use for this is a flexible "move to"
13500  ** command:
13501  **
13502  *b Lua Example:
13503  **
13504  *e self.character:add_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13505  *e -- begin to move to a location
13506  *e self.character:agent_move_to_region_via_subregions("navmesh", "green", "navmesh",
13507  *e DIGUY_SUBREGION_MASK_BASE, 12);
13508  *e -- sleep till arrived
13509  *e self:sleep(100);
13510  *e self.character:remove_wakeup_callback(diguyCharacter_CALLBACK_ID_AGENT_TRAVEL_FORWARD_DEST_REACHED);
13511  **
13512  ** Effectively the character will wake up either after 100 seconds or
13513  ** when they arrive at their desired destination.
13514  **
13515  *b Arguments:
13516  **
13517  *a callback - the callback id that should wake up the character
13518  **
13519  *b Returns:
13520  **
13521  ** 0 on success, -1 on failure
13522  */
13523  int add_wakeup_callback(int callback);
13524 
13525  /*l
13526  *b Description:
13527  **
13528  ** This function removes a request to trigger a message when a
13529  ** callback is triggered.
13530  **
13531  *b Arguments:
13532  **
13533  *a callback - callback id that should no longer wake up the
13534  *a character
13535  **
13536  *b Returns:
13537  **
13538  ** 0 on success, -1 on failure
13539  */
13540  int remove_wakeup_callback(int callback);
13541 
13542  /*l
13543  *b Description:
13544  **
13545  ** This function removes all requests to trigger a message when
13546  ** callbacks are triggered.
13547  **
13548  *b Returns:
13549  **
13550  ** 0 on success, -1 on failure
13551  */
13552  int remove_all_wakeup_callbacks();
13553 
13554  /*l
13555  *b Description:
13556  **
13557  ** This function check for a requests to trigger a message when
13558  ** a given callback is triggered.
13559  **
13560  *b Returns:
13561  **
13562  ** 0 on false, 1 on true
13563  */
13564  int has_wakeup_callback(int callback);
13565 
13566  /*l
13567  *b Description:
13568  **
13569  ** This function wakes up a character and sends them a message.
13570  ** Currently this is only applicable to characters with Lua minds.
13571  **
13572  *b Arguments:
13573  **
13574  *a sender - who is sending the message
13575  *a message_type - what type of message is being sent
13576  *a message - the message string
13577  *a message_params - optional parameter string
13578  **
13579  *b Returns:
13580  **
13581  ** number of times message was successfully parsed
13582  */
13583  int agent_accept_message(const char* sender,
13584  const char* message_type,
13585  const char* message,
13586  const char* message_params = NULL);
13587 
13588  /*l
13589  **
13590  *b Description:
13591  **
13592  ** This function wakes up nearby characters and sends them a message.
13593  ** The sender of the message is implicitly set to the individual
13594  ** calling the broadcast function
13595  **
13596  ** Currently this is only applicable to characters with Lua minds.
13597  **
13598  *b Arguments:
13599  **
13600  *a radius - how far to broadcast the message
13601  *a message_type - what type of message is being sent
13602  *a message - the message string
13603  *a message_params - optional parameter string
13604  **
13605  *b Returns:
13606  **
13607  ** number of times message was successfully parsed
13608  */
13609  int agent_broadcast_message(float radius,
13610  const char* message_type,
13611  const char* message,
13612  const char* message_params = NULL);
13613 
13614  /*l
13615  *b Description:
13616  **
13617  ** This function wakes up nearby characters in the group specified
13618  ** and sends them a message. The sender of the message is implicitly
13619  ** set to the individual calling the broadcast function.
13620  **
13621  ** Currently this is only applicable to characters with Lua minds.
13622  **
13623  *b Arguments:
13624  **
13625  *a group_name - group to broadcast message to
13626  *a radius - how far to broadcast the message
13627  *a message_type - what type of message is being sent
13628  *a message - the message string
13629  *a message_params - optional parameter string
13630  **
13631  **
13632  *b Returns:
13633  **
13634  ** number of times message was successfully parsed,
13635  ** -1 on failure
13636  */
13637  int agent_broadcast_message_to_group(const char* group_name,
13638  float radius,
13639  const char* message_type,
13640  const char* message,
13641  const char* message_params = NULL);
13642 
13643  /*l
13644  **
13645  *b Returns:
13646  **
13647  ** name of character's lua mind object; typically this is the
13648  ** character's name with '-' replaced by '_'
13649  */
13650  const char* get_lua_object_name();
13651 
13652  /*l
13653  *b Description:
13654  **
13655  ** Sets the specified field of the mind to the string field_value.
13656  */
13657  void set_mind_field_as_string(const char* field_name,
13658  const char* field_value);
13659 
13660  /*l
13661  *b Description:
13662  **
13663  ** Queries the luaCharacter object for a specific field, and attempts
13664  ** to convert it into a string. This works for strings and
13665  ** numbers.
13666  **
13667  ** This returned pointer will stay valid until the next time this
13668  ** function is called, so if the results need to be saved they must
13669  ** be copied.
13670  **
13671  *b Returns:
13672  **
13673  ** field_name as string
13674  */
13675  const char* get_mind_field_as_string(const char* field_name,
13676  int warn_if_no_field = 1);
13677 
13678  /*l
13679  *b Description:
13680  **
13681  ** Sets the specified field of the mind to the floating point
13682  ** number field_value.
13683  */
13684  void set_mind_field_as_float(const char* field_name, float field_value);
13685 
13686  /*l
13687  *b Description:
13688  **
13689  ** Similar to get_mind_field_as_string(), but returns field as
13690  ** a float.
13691  **
13692  *b Returns:
13693  **
13694  ** field_name as double
13695  */
13696  float get_mind_field_as_float(const char* field_name,
13697  int warn_if_no_field = 1,
13698  int* found_field = NULL);
13699 
13700  /*l
13701  *b Description:
13702  **
13703  ** Sets the specified field of the mind to the integer number
13704  ** field_value.
13705  */
13706  void set_mind_field_as_int(const char* field_name, int field_value);
13707 
13708  /*l
13709  *b Description:
13710  **
13711  ** Similar to get_mind_field_as_int(), but returns field as
13712  ** an integer.
13713  **
13714  *b Returns:
13715  **
13716  ** field_name as int
13717  */
13718  int get_mind_field_as_int(const char* field_name,
13719  int warn_if_no_field = 1,
13720  int* found_field = NULL);
13721 
13722  /*l
13723  *b Description:
13724  **
13725  ** Attempts to run a luaCharacter member function, and can optionally
13726  ** return the function's result. Lua return values can be converted
13727  ** to strings and numbers -- other data types will cause an error.
13728  **
13729  ** This returned pointer will stay valid until the next time this
13730  ** function is called, so if the results need to be saved they must
13731  ** be copied.
13732  **
13733  *b *Note:* This function should be considered experimental, as the
13734  *b API may change.
13735  **
13736  *b Arguments:
13737  **
13738  *a function_name - luaCharacter function field to invoke
13739  *a argument - optional string argument to the function
13740  *a has_return_string - 0 or 1; determines if lua interface should
13741  *a attempt to retrieve a string value
13742  **
13743  *b Returns:
13744  **
13745  ** Lua function return value
13746  */
13747  const char* evaluate_mind_function(const char* function_name,
13748  const char* argument = NULL,
13749  int has_return_string = 0);
13750 
13751  /*l
13752  *b Description:
13753  **
13754  ** This function produces a string with a long list of character
13755  ** information, including: current path, crowd, behavior, lua state,
13756  ** lua call stack, wakeup callbacks and lua object fields. It is
13757  ** meant to help with debugging agents.
13758  **
13759  ** This returned pointer will stay valid until the next time this
13760  ** function is called, so if the results need to be saved they must
13761  ** be copied.
13762  **
13763  *b Arguments:
13764  **
13765  *a include_stack - pass 1 to include callstack info, 0 to not
13766  *a include_locals - pass 1 to include local variable info, 0 to not
13767  **
13768  *b Returns:
13769  **
13770  ** string containing character information
13771  */
13772  const char* get_ai_state_string(int include_stack = 1, int include_locals = 1);
13773 
13774 
13775 /*****************************************************************************/
13785 /*
13786  *3 Visibility Tests
13787  */
13788 
13789  /*l
13790  *b Description:
13791  **
13792  ** This function tests whether this character can see the passed
13793  ** character. Currently this tests if the cervical link of this
13794  ** character has a clear line of sight to either the cervical or the
13795  ** position links of the target. Currently the orientation of this
13796  ** character isn't factored in.
13797  **
13798  ** This function does not fail if other characters are between the
13799  ** two characters in question.
13800  **
13801  ** Checking visibility is only an option if an octtree is generated
13802  ** from scene objects; typically only DI-Guy Scenario does this.
13803  ** Outside of DI-Guy Scenario set_character_los_function() should be
13804  ** used if no octtree is present.
13805  **
13806  *b Arguments:
13807  **
13808  *a character - character to check
13809  *a los_check_type - currently unused but passed to callback function
13810  *a if end users wish to pass an additional parameter
13811  **
13812  *b Returns:
13813  **
13814  ** 1 if character is visible, 0 if not
13815  */
13816  int check_character_visibility(diguyCharacter* character,
13817  int los_check_type = 0);
13818 
13819  /*l
13820  *b Description:
13821  **
13822  ** This function tests whether this character can see the x, y, z
13823  ** location specified. Currently this tests if the cervical link of
13824  ** this character has a clear line of sight to the x, y, z location.
13825  ** Currently the orientation of this character isn't factored in.
13826  **
13827  ** This function does not fail if other characters are between the
13828  ** character and the location in question.
13829  **
13830  ** Checking visibility is only an option if an octtree is generated
13831  ** from scene objects; typically only DI-Guy Scenario does this.
13832  **
13833  *b Arguments:
13834  **
13835  *a x, y, z - location to check
13836  **
13837  *b Returns:
13838  **
13839  ** 1 if location is visible, 0 if not
13840  */
13841  int check_point_visibility(float x, float y, float z);
13842 
13843 
13844 
13845 /*****************************************************************************/
13862 #ifdef CPLUSPLUS_ONLY
13863 
13864  /*l
13865  *b Description:
13866  **
13867  ** When a character needs to check if it can see a location, DI-Guy
13868  ** calls this function with a pointer to the diguyCharacter in
13869  ** question, and the coordinates of the point that is being looked
13870  ** at. This currently happens when an agent is told to move to a new
13871  ** region.
13872  **
13873  ** The following prototype should be used for the point line-of-sight
13874  ** function:
13875  **
13876  *e int diguyPointLOSFunction(diguyCharacter* character,
13877  *e float x,
13878  *e float y,
13879  *e float z);
13880  **
13881  ** The function should then check if the desired location is visible.
13882  ** This can be done in a number of ways; a typical approach is to do
13883  ** an intersection test with the static scene.
13884  **
13885  ** The function should return 1 if the path to the target is clear, 0
13886  ** if there is an obstruction.
13887  **
13888  ** A default point line-of-sight function can be set for all
13889  ** subsequently created characters by calling
13890  ** diguyScenario::set_default_point_los_function().
13891  **
13892  *b Callable From:
13893  **
13894  *- - C++
13895  */
13896  int set_point_los_function(diguyPointLOSFunction* point_los_function);
13897 
13898  /*l
13899  *b Returns:
13900  **
13901  ** current point line-of-sight function; see set_point_los_function()
13902  **
13903  *b Callable From:
13904  **
13905  *- - C++
13906  */
13907  diguyPointLOSFunction* get_point_los_function();
13908 
13909  /*l
13910  *b Description:
13911  **
13912  ** When a character needs to check if it can see another character,
13913  ** DI-Guy calls this function with a pointer to the diguyCharacter in
13914  ** question. This can happen when check_character_visibility() is
13915  ** invoked or when AI attack code assesses if it should take a shot.
13916  **
13917  ** The following prototype should be used for the character
13918  ** line-of-sight function:
13919  **
13920  *e int diguyCharacterLOSFunction(diguyCharacter* character,
13921  *e diguyCharacter* target_character,
13922  *e int los_test_type) // (currently unused)
13923  **
13924  ** Currently the los_test_type argument defaults to 0 and is not used
13925  ** internally. It is, however, available in
13926  ** check_character_visibility() and will be passed to the callback.
13927  ** This can be useful if the end user wants to write scripting code
13928  ** that has alternative Line of Sight tests depending on agent
13929  ** conditions. (e.g. a test that factors in the character's field of
13930  ** view.)
13931  **
13932  ** The function then checks if the target character is visible. This
13933  ** can be done in a number of ways; a typical approach is to do an
13934  ** intersection test with the static scene. The default
13935  ** implementation tests the path from the characters head to the
13936  ** target's head and then to the target's feet.
13937  **
13938  ** The function should return 1 if the path to the target is clear,
13939  ** and 0 if there is an obstruction.
13940  **
13941  ** A default character line-of-sight function can be set for all
13942  ** subsequently created characters by calling
13943  ** diguyScenario::set_default_character_los_function().
13944  **
13945  *b Callable From:
13946  **
13947  *- - C++
13948  */
13949  int set_character_los_function(diguyCharacterLOSFunction* character_los_function);
13950 
13951  /*l
13952  *b Returns:
13953  **
13954  ** current character line-of-sight function; see
13955  ** set_character_los_function()
13956  **
13957  *b Callable From:
13958  **
13959  *- - C++
13960  */
13961  diguyCharacterLOSFunction* get_character_los_function();
13962 
13963 #endif
13964 
13965 
13966 /*****************************************************************************/
13982  /*l
13983  *b Description:
13984  **
13985  ** This function sets the initial character simulator this character
13986  ** will use. The current simulator will be set to this value on
13987  ** scenario reset.
13988  **
13989  ** The current simulator can be set by calling
13990  ** set_current_character_simulator().
13991  **
13992  ** The default simulator is
13993  ** DIGUY_CHARACTER_SIMULATOR_DIGUY_MOTION_ENGINE.
13994  **
13995  ** Requires active physics module if character simulator is set to
13996  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
13997  **
13998  *b Arguments:
13999  **
14000  *a character_simulator - which simulator to use at reset
14001  **
14002  *b Returns:
14003  **
14004  ** 0 on success, -1 on failure
14005  */
14006  int set_initial_character_simulator(diguyCharacterSimulator character_simulator);
14007 
14008  /*l
14009  *b Returns:
14010  **
14011  ** initial character simulator
14012  */
14013  diguyCharacterSimulator get_initial_character_simulator();
14014 
14015  /*l
14016  *b Description:
14017  **
14018  ** This function sets the current character simulator this character
14019  ** will use. The current simulator will be reset to the initial
14020  ** character simulator on scenario reset.
14021  **
14022  ** The initial simulator can be set by calling
14023  ** set_initial_character_simulator().
14024  **
14025  *b Arguments:
14026  **
14027  *a character_simulator - new current character simulator
14028  **
14029  *b Returns:
14030  **
14031  ** 0 on success, -1 on failure
14032  */
14033  int set_current_character_simulator(diguyCharacterSimulator character_simulator);
14034 
14035  /*l
14036  *b Returns:
14037  **
14038  ** current character simulator
14039  */
14040  diguyCharacterSimulator get_current_character_simulator();
14041 
14042  /*l
14043  *b Description:
14044  **
14045  ** This function sets the initial physics simulation mode this
14046  ** character will use. The current simulation mode will be set to
14047  ** this value on scenario reset.
14048  **
14049  ** The current simulation mode can be set by calling
14050  ** set_current_physics_simulation_mode().
14051  **
14052  ** The default simulation mode is
14053  ** DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER.
14054  **
14055  ** The physics simulation mode will have no effect unless the current
14056  ** character simulator is
14057  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
14058  **
14059  *b Arguments:
14060  **
14061  *a physics_simulation_mode - which simulation mode to use at reset
14062  **
14063  *b Returns:
14064  **
14065  ** 0 on success, -1 on failure
14066  */
14067  int set_initial_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
14068 
14069  /*l
14070  *b Returns:
14071  **
14072  ** initial physics simulation mode
14073  */
14074  diguyPhysicsSimulationMode get_initial_physics_simulation_mode();
14075 
14076  /*l
14077  *b Description:
14078  **
14079  ** This function sets the current physics simulation mode this
14080  ** character will use. The current simulation mode will be reset to
14081  ** the initial physics simulator mode on scenario reset.
14082  **
14083  ** The initial simulation mode can be set by calling
14084  ** set_initial_physics_simulation_mode().
14085  **
14086  ** The physics simulation mode will have no effect unless the current
14087  ** character simulator is
14088  ** DIGUY_CHARACTER_SIMULATOR_PHYSICS_SIM_MODULE.
14089  **
14090  *b Arguments:
14091  **
14092  *a physics_simulation_mode - new current physics simulation mode
14093  **
14094  *b Returns:
14095  **
14096  ** 0 on success, -1 on failure
14097  */
14098  int set_current_physics_simulation_mode(diguyPhysicsSimulationMode physics_simulation_mode);
14099 
14100  /*l
14101  *b Returns:
14102  **
14103  ** initial physics simulation mode
14104  */
14105  diguyPhysicsSimulationMode get_current_physics_simulation_mode();
14106 
14107  /*l
14108  *b Description:
14109  **
14110  ** This function sets the physics collision group this character will
14111  ** be in when being simulated. For improved performance, collision
14112  ** detection between various characters and scene objects will not
14113  ** be performed, based on which collision groups the objects are in.
14114  **
14115  ** By default:
14116  **
14117  *- - characters in character group n collide against props in prop
14118  *- group n and scene objects in scene object group n
14119  *- in group n
14120  *- - characters in group ghost don't collide against any other
14121  *- characters, but do against scene objects and props
14122  *- - characters in group everything collide against all characters,
14123  *- props, and scene objects
14124  *- - all props collide against all other props and scene objects
14125  **
14126  ** Collision group relationships can be modified using
14127  ** diguyApp::set_collision_group_detection_flag().
14128  **
14129  *b Arguments:
14130  **
14131  *a physics_simulation_mode - new current physics simulation mode
14132  **
14133  *b Returns:
14134  **
14135  ** 0 on success, -1 on failure
14136  */
14137  int set_physics_collision_group(diguyPhysicsCollisionGroup collision_group);
14138 
14139  /*l
14140  *b Returns:
14141  **
14142  ** physics collision group
14143  */
14144  diguyPhysicsCollisionGroup get_physics_collision_group();
14145 
14146  /*l
14147  *b Description:
14148  **
14149  ** This function sets a time at which active simulation of a physics
14150  ** controlled character will stop. This is useful for:
14151  **
14152  *- - reducing simulation processing overhead
14153  *- - freezing a simulation that is mostly in steady state, but some
14154  *- small part remains oscillating
14155  **
14156  ** The physics controlled character will remain frozen in the last
14157  ** computed simulated pose.
14158  **
14159  *b Arguments:
14160  **
14161  *a t - scenario t at which simulation will freeze
14162  **
14163  ** t should be large enough for the simulation to reach a reasonably
14164  ** steady state, such as a human lying on the ground. A value that
14165  ** is usually reasonable is around 5 seconds.
14166  */
14167  void set_stop_physics_sim_at_t(float t);
14168 
14169  /*l
14170  *b Description:
14171  **
14172  ** Similar to set_stop_physics_sim_at_t(), but the passed time will
14173  ** be relative to the current simulation time as returned by
14174  ** diguyScenario::get_t().
14175  */
14176  void set_stop_physics_sim_in_t_seconds(float relative_t);
14177 
14178  /*l
14179  *b Returns:
14180  **
14181  ** time at which physics simulation will freeze
14182  */
14183  float get_stop_physics_sim_at_t();
14184 
14185  /*l
14186  *b Description:
14187  **
14188  ** This function applied an impulse force to the character. An
14189  ** impulse is a force that is applied all at one time, such as an
14190  ** explosion shock wave.
14191  **
14192  *b Arguments:
14193  **
14194  *a link - link to which impulse should be applied
14195  *a impulse_magnitude_[xyz] - magnitude of impulse in x direction
14196  *a link_offset_[xyz] - offset on link at which to apply impulse
14197  *a set_simulation_drives_character - pass 1 to automatically change
14198  *a the character's current simulation mode
14199  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
14200  */
14201  void apply_impulse_to_physics_sim(const char* link,
14202  float impulse_magnitude_x,
14203  float impulse_magnitude_y,
14204  float impulse_magnitude_z,
14205  float link_offset_x = 0.0f,
14206  float link_offset_y = 0.0f,
14207  float link_offset_z = 0.0f,
14208  int set_simulation_drives_character = 1);
14209 
14210  /*l
14211  *b Description:
14212  **
14213  ** Similar to apply_impulse_to_physics_sim(), but impulse can be
14214  ** calculated relative to a world position. This is useful if, for
14215  ** example, a character should react to a nearby explosion.
14216  **
14217  *b Arguments:
14218  **
14219  *a link - link to which impulse should be applied
14220  *a impulse_magnitude_[xyz] - magnitude of impulse
14221  *a impulse_generator_position_[xyz] - world coordinates of impulse
14222  *a generating object
14223  *a max_distance - maximum distance from above position at
14224  *a which the impulse can affect this
14225  *a character
14226  *a impulse_rolloff - how much the impulse magnitude should
14227  *a decrease as distance from impulse source
14228  *a increases
14229  *a link_offset_[xyz] - offset on link at which to apply impulse
14230  *a set_simulation_drives_character - pass 1 to automatically change
14231  *a the character's current simulation mode
14232  *a to DIGUY_PHYSICS_SIMULATION_MODE_SIM_DRIVES_CHARACTER
14233  */
14234  void apply_impulse_to_physics_sim_from_world_position(const char* link,
14235  float impulse_magnitude_x,
14236  float impulse_magnitude_y,
14237  float impulse_magnitude_z,
14238  float impulse_generator_position_x,
14239  float impulse_generator_position_y,
14240  float impulse_generator_position_z,
14241  float max_distance = 20.0f,
14242  float impulse_rolloff = 0.0f,
14243  float link_offset_x = 0.0f,
14244  float link_offset_y = 0.0f,
14245  float link_offset_z = 0.0f,
14246  int set_simulation_drives_character = 1);
14247 
14248 
14249 
14250 /****************************************************************************/
14251 /****************************************************************************/
14252 /****************************************************************************/
14259 /****************************************************************************/
14260 /****************************************************************************/
14261 /****************************************************************************/
14262 
14263  /*l
14264  *b Description:
14265  **
14266  ** Sets texture load behavior to DIGUY_LOAD_INSTANTLY, DIGUY_LOAD_PRIORITY_ASYNC, or
14267  ** DIGUY_LOAD_ASYNC
14268  */
14269  static int set_texture_load_behavior(diguyGraphicsTextureLoadingBehavior mode);
14270 
14271  /*l
14272  *b Returns current behavior, as set in set_texture_load_behavior()
14273  */
14274  static diguyGraphicsTextureLoadingBehavior get_texture_load_behavior();
14275 
14276  /*l
14277  ** Returns 1 if the current appearance has bump maps
14278  */
14279  int get_has_bump_maps();
14280 
14281  /*l
14282  *b Description:
14283  **
14284  ** This function returns how many channels the specified action has.
14285  ** If an action has more than one channel, the relative weights of
14286  ** its channels can be set using the set_action_channel_weight()
14287  ** function.
14288  **
14289  *b Arguments:
14290  **
14291  *a action_name - name of action to be queried
14292  **
14293  *b Returns:
14294  **
14295  ** number of channels in specified action
14296  */
14297  int get_action_num_channels(const char* action_name);
14298 
14299  /*l
14300  *b Description:
14301  **
14302  ** This function sets the weight one channel of a multi-channel
14303  ** action.
14304  **
14305  ** The passed weight should be between 0 and 1. The weights of
14306  ** the other channels in the action will be adjusted so that the
14307  ** total weight of all channels is 1.
14308  **
14309  *b Arguments:
14310  **
14311  *a action_name - name of action to be affected
14312  *a channel - which channel's weight to set
14313  *a weight - weight of the channel, between 0 and 1
14314  **
14315  *b Returns:
14316  **
14317  ** 0 on success, -1 on failure
14318  */
14319  int set_action_channel_weight(const char* action_name,
14320  char channel,
14321  float weight);
14322 
14323  /*l
14324  *b Description:
14325  **
14326  ** This function returns the weight of one channel of a multi-channel
14327  ** action.
14328  **
14329  *b Arguments:
14330  **
14331  *a action_name - name of action to be queried
14332  *a channel - which channel's weight to return
14333  **
14334  *b Returns:
14335  **
14336  ** weight of a channel
14337  */
14338  float get_action_channel_weight(const char* action_name,
14339  char channel);
14340 
14341  /*l
14342  *b Description:
14343  **
14344  ** This function returns the number of seconds before the transition
14345  ** to the desired action begins. If the character is already
14346  ** performing the desired action the function returns 0.
14347  **
14348  *b THIS FUNCTION DOES NOT YET RETURN VALID RESULTS.
14349  **
14350  *b Returns:
14351  **
14352  ** time to reach desired action, in seconds
14353  */
14354  float get_time_to_reach_desired_action();
14355 
14356  /*l
14357  *b Description:
14358  **
14359  ** Maps a character type map field to its value. See diguyCharacterTypeMap.
14360  **
14361  ** Returns:
14362  **
14363  ** The value, as a string.
14364  */
14365  const char* get_type_map_field(diguyCharacterTypeMapField field);
14366 
14367  /*l
14368  *b Description:
14369  **
14370  ** Maps a character type map field to its value, using a string version (e.g.
14371  ** "age") of the field name. See diguyCharacterTypeMap.
14372  **
14373  ** Returns:
14374  **
14375  ** The value, as a string.
14376  */
14377  const char* get_type_map_field_using_string(const char* field);
14378 
14379  /*l
14380  *b Description:
14381  **
14382  ** This function performs a "micro merge", allowing a diguyCharacter
14383  ** to have objects added to it by parsing a .dss file fragment in the
14384  ** form of a string.
14385  **
14386  ** This function can be used, for example, to add paths to
14387  ** dynamically created agents. A Lua Package can contain a number of
14388  ** text strings representing local paths for agents. On character
14389  ** creation these strings can be merged in and turned into
14390  ** per-character objects.
14391  **
14392  ** The DI-Guy Scenario path page has a "Display Asset" button for
14393  ** generating merge_object() compatible strings.
14394  **
14395  ** There is also a diguyScenario::merge_object() function that allows
14396  ** the merging of text blocks that represent sounds and particle
14397  ** systems.
14398  **
14399  ** Note: the parser is very sensitive to tabs and formatting!
14400  */
14401  int merge_object(const char* object);
14402 
14403  /*l
14404  *b Description:
14405  **
14406  ** Returns 1 if any active character in the named group is visible,
14407  ** otherwise 0.
14408  **
14409  *b Arguments:
14410  **
14411  *a group_name
14412  *a max_distance_to_check
14413  */
14414  int is_active_character_in_group_visible(const char* group_name,
14415  float max_distance_to_check = 100000.0f);
14416 
14417  /*l
14418  *b Description:
14419  **
14420  ** Gets local space bounding box, this function is currently expensive
14421  ** and should be used with care.
14422  **
14423  *b Arguments:
14424  **
14425  *a x1,y1,z1,x2,y2,z2 - output parameters
14426  **
14427  *b Returns:
14428  **
14429  ** 0 on success, -1 on failure
14430  ** (float * arguments converted to return values in Lua)
14431  */
14432  int get_local_space_bounding_box(float* x1, float* y1, float* z1,
14433  float* x2, float* y2, float* z2);
14434 
14435  /*l
14436  *b Description:
14437  **
14438  ** Get a spherical area containing geometry with specified tag,
14439  ** in specified world space.
14440  **
14441  *b Arguments:
14442  **
14443  *a tag - the tag
14444  *a world_space - the world space
14445  *a x1,y1,z1,radius - output parameters returning sphere definition
14446  **
14447  *b Returns:
14448  **
14449  ** 0 on success, -1 on failure
14450  ** (float * arguments converted to return values in Lua)
14451  */
14452  int get_geometry_tag(int tag,
14453  int world_space,
14454  float* x1, float* y1, float* z1, float* radius);
14455 
14456  /*l
14457  *b Description:
14458  **
14459  ** This causes a character's mind to get an update call even if time
14460  ** isn't passing in the scenario. This is occasionally useful for
14461  ** characters that are managing the UI.
14462  **
14463  ** Note that there is now a luaUIStateMachine that might be a better
14464  ** solution.
14465  */
14466  void set_mind_always_updates(int force_update);
14467 
14468  /*l
14469  *b Description:
14470  **
14471  ** Returns value set by set_mind_always_updates()
14472  */
14473  int get_mind_always_updates();
14474 
14475  /*l
14476  *b Description:
14477  **
14478  ** Returns angle in degrees from character's "forward facing" vector
14479  ** to the specified action bead, on the specified path
14480  */
14481  float get_angle_to_path(const char* path_name,
14482  const char* action_bead_name = NULL);
14483 
14484  /*l
14485  *b Returns:
14486  **
14487  ** Name of a reasonable link that other characters could aim at.
14488  */
14489  const char* get_aim_at_link();
14490 
14491  /*l
14492  *b Returns:
14493  **
14494  ** xyz offset from link returned by get_aim_at_link()
14495  */
14496  int get_aim_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
14497 
14498  /*l
14499  *b Returns:
14500  **
14501  ** Name of a reasonable link that other characters could look at.
14502  */
14503  const char* get_gaze_at_link();
14504 
14505  /*l
14506  *b Returns:
14507  **
14508  ** xyz offset from link returned by get_gaze_at_link()
14509  */
14510  int get_gaze_at_link_offset(float* offset_x, float* offset_y, float* offset_z);
14511 
14512  /*
14513  * DI-Guy doesn't use these masks internally, but they can be useful
14514  * for some DI-Guy Graphics API scene graph implementations.
14515  */
14516  void set_scene_graph_mask(unsigned int mask);
14517  unsigned int get_scene_graph_mask();
14518 
14519  /*l
14520  *b Description:
14521  **
14522  ** Turns on texture modulation system that tries to make all character look
14523  ** unique only supported by some appearances currently.
14524  */
14525  int set_use_texture_variations(int value);
14526 
14527  /*l
14528  *b Returns:
14529  **
14530  ** If texture variations have been enabled for this character.
14531  */
14532  int get_use_texture_variations();
14533 
14534  /*l
14535  *b Description:
14536  **
14537  ** Sets whether or not character emits light.
14538  **
14539  *b Arguments:
14540  **
14541  *a emit_light - 0 or 1
14542  */
14543  int set_emit_light(int emit_light);
14544 
14545  /*l
14546  *b Returns:
14547  **
14548  ** 0 or 1, depending on whether or not character emits light.
14549  */
14550  int get_emit_light();
14551 
14552  /*l
14553  *b Description:
14554  **
14555  ** Sets maximum quality of shader to use (actual quality varies
14556  ** by distance from camera). See diguyGraphicsShaderQualityLevel for
14557  ** possible values.
14558  **
14559  *b Arguments:
14560  **
14561  *a quality_level - a value between DIGUY_GRAPHICS_SHADER_QUALITY_UNLIT
14562  *- and DIGUY_GRAPHICS_SHADER_QUALITY_MAX
14563  */
14564  static int set_max_shader_quality_level(int quality_level);
14565 
14566  /*l
14567  *b Returns:
14568  **
14569  ** max shader quality level, as set by set_max_shader_quality_level()
14570  */
14571  static int get_max_shader_quality_level();
14572 
14573 /****************************************************************************/
14574 /****************************************************************************/
14585 /****************************************************************************/
14586 /****************************************************************************/
14587 /****************************************************************************/
14588 
14589  /*l
14590  ** Deprecated as of 9.1.3; use diguyCharacter::get_position_link()
14591  ** instead.
14592  */
14593  diguyGraphicsLink* get_base_link();
14594 
14595 
14596  /*l
14597  *i Deprecated as of 9.0.1; use set_apply_actor_scale_to_action_bead_travel()
14598  *i instead.
14599  */
14600  void set_apply_actor_scale_to_action_bead_xy_travel(int apply_scale_flag);
14601 
14602  /*l
14603  *i Deprecated as of 9.0.1; use get_apply_actor_scale_to_action_bead_travel()
14604  *i instead.
14605  */
14606  int get_apply_actor_scale_to_action_bead_xy_travel();
14607 
14608  /*l
14609  ** Deprecated as of 9.1.4. In general setting the weapon sound
14610  ** should no longer be necessary, as weapon sounds are now specified
14611  ** by the weapon's munition type. If this function is called, it
14612  ** will have the same effect as calling
14613  ** diguyCharacter::set_weapon_sound_override().
14614  */
14615  int set_default_weapon_sound(const char* sound_name);
14616 
14617  /*l
14618  ** Deprecated as of 9.1.4. See comments for
14619  ** set_default_weapon_sound().
14620  */
14621  const char* get_default_weapon_sound();
14622 
14623  /*l
14624  ** Deprecated as of 9.1.4. See comments for
14625  ** set_default_weapon_sound().
14626  */
14627  int set_default_weapon_sound_gain(float gain);
14628 
14629  /*l
14630  ** Deprecated as of 9.1.4. See comments for
14631  ** set_default_weapon_sound().
14632  */
14633  float get_default_weapon_sound_gain();
14634 
14635  /*l
14636  ** Deprecated as of 9.1.4. Call set_weapon_munition_type_override()
14637  ** instead.
14638  */
14639  int set_weapon_munition_type(const char* munition_type);
14640 
14641  /*l
14642  ** Deprecated as of 9.1.4. Call get_weapon_munition_type_override()
14643  ** instead.
14644  */
14645  const char* get_weapon_munition_type();
14646 
14647  /*l
14648  ** Deprecated as of 10.5.2. Call set_weapon_max_azimuth_error()
14649  ** instead.
14650  */
14651  int set_weapon_horizontal_error(float h_error);
14652 
14653  /*l
14654  ** Deprecated as of 10.5.2. Call get_weapon_max_azimuth_error()
14655  ** instead.
14656  */
14657  float get_weapon_horizontal_error();
14658 
14659  /*l
14660  ** Deprecated as of 10.5.2. Call set_weapon_max_elevation_error()
14661  ** instead.
14662  */
14663  int set_weapon_vertical_error(float v_error);
14664 
14665  /*l
14666  ** Deprecated as of 10.5.2. Call get_weapon_max_elevation_error()
14667  ** instead.
14668  */
14669  float get_weapon_vertical_error();
14670 
14671  /*l
14672  ** Added as of 10.1.6. Invokes the old implementation of
14673  ** begin_appearance_effect().
14674  */
14675  int begin_legacy_appearance_effect(const char* effect,
14676  const char* override_link = "",
14677  float override_scale = DIGUY_DEFAULT_FLOAT,
14678  float override_offset_x = DIGUY_DEFAULT_FLOAT,
14679  float override_offset_y = DIGUY_DEFAULT_FLOAT,
14680  float override_offset_z = DIGUY_DEFAULT_FLOAT);
14681 
14682  /*l
14683  ** Added as of 10.1.6. Invokes the old implementation of
14684  ** end_appearance_effect().
14685  */
14686  int end_legacy_appearance_effect(const char* effect);
14687 
14688  /*l
14689  ** Added as of 10.1.6. Invokes the old implementation of
14690  ** appearance_effect_is_active().
14691  */
14692  int legacy_appearance_effect_is_active(const char* effect);
14693 
14694  /*l
14695  ** Deprecated as of 10.1.8. Use set_render_mode_shader() instead.
14696  */
14697  //int set_shader_program(const char* shader_name);
14698 
14699  /*l
14700  ** Deprecated as of 10.5.2. Use get_render_mode_shader() instead.
14701  */
14702  //const char* get_recommended_appearance_shader_program_name();
14703 
14704  /*l
14705  ** Deprecated as of 10.5.1. Use merge_object() instead.
14706  */
14707  int merge_asset(const char* asset);
14708 
14709  /*l
14710  ** Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state()
14711  ** instead.
14712  */
14713  void set_DIS_smoke_trail_state(int state);
14714 
14715  /*l
14716  ** Deprecated as of 10.5.2. Use get_DIS_trailing_effect_state()
14717  ** instead.
14718  */
14719  int get_DIS_smoke_trail_state();
14720 
14721  /*l
14722  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14723  */
14724  int speak(const char* string);
14725 
14726  /*l
14727  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14728  */
14729  int set_viseme(const char* viseme_name, float weight);
14730 
14731  /*l
14732  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14733  */
14734  float get_viseme(const char* viseme_name);
14735 
14736  /*l
14737  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14738  */
14739  int set_orientation_eye_left(float azimuth, float elevation);
14740 
14741  /*l
14742  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14743  */
14744  int set_orientation_eye_right(float azimuth, float elevation);
14745 
14746  /*l
14747  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14748  */
14749  float get_azimuth_eye_left();
14750 
14751  /*l
14752  ** Deprecated as of 12.0.0. Not supported in FaceFX.
14753  */
14754  float get_elevation_eye_left();
14755 
14756  /*l
14757  *b Returns:
14758  **
14759  ** the current azimuth of the right eye; see set_orientation_eyes()
14760  */
14761  float get_azimuth_eye_right();
14762 
14763  /*l
14764  *b Returns:
14765  **
14766  ** the current elevation of the right eye; see set_orientation_eyes()
14767  */
14768  float get_elevation_eye_right();
14769 
14770 /****************************************************************************/
14771 /****************************************************************************/
14772 
14777 #ifdef CPLUSPLUS_ONLY
14778 
14779  bdiScenarioCharacter* get_scripted_object() {return m_scripted_object;}
14780 
14781 private:
14782 
14783  /*l
14784  ** A private constructor.
14785  */
14786  diguyCharacter(bdiScenarioCharacter* character);
14787 
14788  /*l
14789  ** A private destructor.
14790  */
14791  ~diguyCharacter();
14792 
14793  /*l
14794  ** A pointer to internal data.
14795  */
14796  bdiScenarioCharacter* m_scripted_object;
14797 
14798  friend class bdiPublishedCharacter;
14799  friend class bdiScenarioCharacter;
14800  friend class diguySensorRegion;
14801  friend class diguyScenario;
14802 
14803 #endif
14804 
14805 };
14806 
14807 
14808 #endif /* __diguyCharacter_H */
14809