DI-Guy SDK Documentation  13.7.1
diguyIGuyController.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyIGuyController
10  **
11  */
12 
13 #ifndef __diguyIGuyController_H
14 #define __diguyIGuyController_H
15 
16 #ifdef SWIG
17 %module diguyIGuyController
18 #else
19 #define CPLUSPLUS_ONLY
20 #endif
21 
22 #ifdef CPLUSPLUS_ONLY
23 
24 #include <declspec_diguy.h>
25 #include <diguyMotionPosture.h>
26 #include <diguyMotionVariant.h>
27 
28 class bdiScenarioIGuy;
29 class diguyCharacter;
30 
31 #endif
32 
33 
34 /****************************************************************************/
35 class BDI_DECLSPEC_diguy diguyIGuyController
36 {
37 
38 public:
39 
40 /*****************************************************************************/
50  /*l
51  *b Description:
52  **
53  ** This function sets the interactive character (I-Guy).
54  **
55  ** The I-Guy character's actions, position, and orientation
56  ** can be 'driven' by input from the mouse, keyboard, or
57  ** a joystick.
58  **
59  ** There can be at most one I-Guy at a time.
60  **
61  *b Arguments:
62  **
63  *a name - name of character to become I-Guy
64  *a initial_posture - this argument is not currently used,
65  *a but will be implemented in a future
66  *a version of DI-Guy
67  *a initial_variant - the initial motion variant the
68  *a I-Guy character should assume
69  **
70  ** Passing DIGUY_MOTION_VARIANT_ANY as the initial
71  ** variant will cause DI-Guy to select a default initial
72  ** variant. Passing DIGUY_MOTION_VARIANT_NORMAL will
73  ** cause the character to start in a non-aiming action.
74  ** Passing DIGUY_MOTION_VARIANT_AIM will cause the
75  ** character to start in an aiming action, if available.
76  ** Other variants will be supported in a future version.
77  */
78  void set_iguy_character(const char* name,
81 
82  /*l
83  *b Returns:
84  **
85  ** pointer of type diguyCharacter* to the current I-Guy character
86  */
87  diguyCharacter* get_iguy_character();
88 
89 
90 /*****************************************************************************/
96  /*l
97  *b Description:
98  **
99  ** This function returns the character clicked on when in I-Guy
100  ** Input Mode. The pointer is valid during
101  ** CALLBACK_ID_IGUY_INTERACT_WITH_SUBJECT callbacks.
102  **
103  *b Returns:
104  **
105  ** pointer to type diguyCharacter; NULL if there is no interaction
106  ** subject
107  **
108  *b Callable From:
109  **
110  *- - C++
111  *- - Script
112  */
113  diguyCharacter* get_interaction_subject();
114 
115 
116 
117 /*****************************************************************************/
127  /*l
128  *b Description:
129  **
130  ** This function sets whether the I-Guy controller should update
131  ** the primary view's camera to keep the I-Guy in view.
132  **
133  *b Arguments:
134  **
135  *a enabled - pass 1 to enable camera changes, 0 to disable
136  */
137  void set_camera_change_enabled(int enabled);
138 
139  /*l
140  *b Returns:
141  **
142  ** 1 if I-Guy affects camera, 0 if not
143  */
144  int get_camera_change_enabled();
145 
146  /*l
147  *b Description:
148  **
149  ** This function sets whether the I-Guy controlled camera should be
150  ** 1st person (from-the-eyes view), or 3rd person (over the shoulder).
151  **
152  *b Arguments:
153  **
154  *a flag - pass 1 for 1st person, 0 for 3rd
155  */
156  void set_camera_use_1st_person_flag(int flag);
157 
158  /*l
159  *b Returns:
160  **
161  ** 1 if I-Guy controlled camera is 1st person, 0 if 3rd
162  */
163  int get_camera_use_1st_person_flag();
164 
165  /*l
166  *b Description:
167  **
168  ** This function sets which link the I-Guy controlled camera will
169  ** be attached to. For human characters, the best link is typically
170  ** "cervical" (the neck), or NULL (to use the base position of the
171  ** character). The default is "cervical".
172  **
173  ** This setting affects both 1st person and 3rd person cameras.
174  **
175  *b Arguments:
176  **
177  *a attachment_link - name of the link to attach to
178  **
179  ** Pass NULL to have the camera be attached to the I-Guy character's
180  ** base position.
181  */
182  void set_camera_attachment_link(const char* attachment_link);
183 
184  /*l
185  *b Returns:
186  **
187  ** the name of the current camera attachment link, or the empty
188  ** string ("") if there is none
189  */
190  const char* get_camera_attachment_link();
191 
192  /*l
193  *b Description:
194  **
195  ** This function sets the offset that is used from the attachment
196  ** link's position for the 3rd person camera's position.
197  **
198  ** Typically this has a slightly negative x value, to move the
199  ** camera behind the I-Guy character, and a positive z value, to
200  ** move the camera up so it can see over the character's head.
201  **
202  ** The default is x=-2.0, y=0.0f, z=0.35.
203  **
204  ** This setting affects only 3rd person cameras.
205  **
206  *b Arguments:
207  **
208  *a x, y, z - offset of camera position from attachment link
209  */
210  void set_camera_3rd_person_look_from_offset(float x, float y, float z);
211 
212  /*l
213  *b Description:
214  **
215  ** This function retrieves the offset that is used from the
216  ** attachment link's position for the 3rd person camera's position.
217  ** The offset values should be put into the variables pointed to.
218  **
219  *b Arguments:
220  **
221  *a x, y, z - pointers to variables in which offset should be
222  *a returned
223  */
224  void get_camera_3rd_person_look_from_offset(float* x, float* y, float* z);
225 
226  /*l
227  *b Description:
228  **
229  ** This function is similar to
230  ** set_camera_3rd_person_look_from_offset(), but affects the look-at
231  ** point instead.
232  **
233  ** The default is x=0.0, y=0.0, z=0.3.
234  **
235  *b Arguments:
236  **
237  *a x, y, z - offset of camera look-at point from attachment link
238  */
239  void set_camera_3rd_person_look_at_offset(float x, float y, float z);
240 
241  /*l
242  *b Description:
243  **
244  ** This function is similar to
245  ** get_camera_3rd_person_look_from_offset(), but affects the look-at
246  ** point instead.
247  **
248  *b Arguments:
249  **
250  *a x, y, z - pointers to variables in which offset should be
251  *a returned
252  */
253  void get_camera_3rd_person_look_at_offset(float* x, float* y, float* z);
254 
255 
256 /*****************************************************************************/
266  /*l
267  *b Description:
268  **
269  ** This function sets whether mouse input will affect the I-Guy
270  ** character.
271  **
272  *b Arguments:
273  **
274  *a enabled - pass 1 to enable mouse input, 0 to disable
275  */
276  void set_mouse_input_enabled(int enabled);
277 
278  /*l
279  *b Returns:
280  **
281  ** 1 if mouse input is enabled, 0 if not
282  */
283  int get_mouse_input_enabled();
284 
285  /*l
286  *b Description:
287  **
288  ** This function sets whether mouse input should be "captured".
289  **
290  ** A captured mouse's cursor doesn't move, but stays in the middle of
291  ** the view. This mode is common in first-person shooter (FPS) style
292  ** games.
293  **
294  ** A non-captured mouse's cursor is free to move anywhere on the
295  ** screen.
296  **
297  ** The setting only has an effect in DI-Guy Scenario.
298  **
299  *b Arguments:
300  **
301  *a enabled - pass 1 to enable input capture, 0 to disable
302  */
303  void set_input_capture_enabled(int enabled);
304 
305  /*l
306  *b Returns:
307  **
308  ** 1 if input is captured, 0 if not
309  */
310  int get_input_capture_enabled();
311 
312 
313 /*****************************************************************************/
323  /*l
324  *b Description:
325  **
326  ** This function sets whether keyboard input will affect the I-Guy
327  ** character.
328  **
329  *b Arguments:
330  **
331  *a enabled - pass 1 to enable keyboard input, 0 to disable
332  */
333  void set_keyboard_input_enabled(int enabled);
334 
335  /*l
336  *b Returns:
337  **
338  ** 1 if keyboard input is enabled, 0 if not
339  */
340  int get_keyboard_input_enabled();
341 
342 
343 /*****************************************************************************/
353  /*l
354  *b Description:
355  **
356  ** This function sets whether joystick input will affect the I-Guy
357  ** character.
358  **
359  *b Arguments:
360  **
361  *a enabled - pass 1 to enable joystick input, 0 to disable
362  */
363  void set_joystick_input_enabled(int enabled);
364 
365  /*l
366  *b Returns:
367  **
368  ** 1 if joystick input is enabled, 0 if not
369  */
370  int get_joystick_input_enabled();
371 
372 
373 /*****************************************************************************/
384  /*l
385  *b Description:
386  **
387  ** This function sets whether the I-Guy controller can affect the
388  ** posture of the character.
389  **
390  ** The default is 1, posture change enabled.
391  **
392  *b Arguments:
393  **
394  *a enabled - pass 1 to enable posture changes, 0 to disable
395  */
396  void set_posture_change_enabled(int enabled);
397 
398  /*l
399  *b Returns:
400  **
401  ** 1 if posture changes enabled, 0 if not
402  */
403  int get_posture_change_enabled();
404 
405  /*l
406  *b Description:
407  **
408  ** This function sets the desired posture of the I-Guy character.
409  **
410  ** Note that the character may not be able to maintain this posture.
411  ** For example, if the desired posture is prone but the character type
412  ** has no moving prone actions, a crouched action may be used for
413  ** moving instead.
414  **
415  ** This function will have no effect if posture changes are disabled,
416  ** as set by set_posture_change_enabled().
417  **
418  *b Arguments:
419  **
420  *a posture - desired posture
421  */
422  void set_posture(diguyMotionPosture posture);
423 
424  /*l
425  *b Returns:
426  **
427  ** the desired posture of the I-Guy character
428  */
429  diguyMotionPosture get_posture();
430 
431  /*l
432  *b Description:
433  **
434  ** This function sets whether the I-Guy controller can affect the
435  ** variant of the character.
436  **
437  ** The default is 1, variant change enabled.
438  **
439  *b Arguments:
440  **
441  *a enabled - pass 1 to enable variant changes, 0 to disable
442  */
443  void set_variant_change_enabled(int enabled);
444 
445  /*l
446  *b Returns:
447  **
448  ** 1 if variant changes enabled, 0 if not
449  */
450  int get_variant_change_enabled();
451 
452  /*l
453  *b Description:
454  **
455  ** This function sets the desired variant of the I-Guy character.
456  **
457  ** This function will have no effect if variant changes are disabled,
458  ** as set by set_variant_change_enabled().
459  **
460  ** Most often the variant of an I-Guy character should be one of:
461  **
462  *- - DIGUY_MOTION_VARIANT_NORMAL
463  *- - DIGUY_MOTION_VARIANT_AIM
464  **
465  *b Arguments:
466  **
467  *a variant - desired variant
468  */
469  void set_variant(diguyMotionVariant variant);
470 
471  /*l
472  *b Returns:
473  **
474  ** the desired variant of the I-Guy character
475  */
476  diguyMotionVariant get_variant();
477 
478 
479 /*****************************************************************************/
489  /*l
490  *b Description:
491  **
492  ** This function sets whether the I-Guy controller can affect the gaze
493  ** state of the character.
494  **
495  ** The default is 1, gaze change enabled.
496  **
497  *b Arguments:
498  **
499  *a enabled - pass 1 to enable gaze changes, 0 to disable
500  */
501  void set_gaze_change_enabled(int enabled);
502 
503  /*l
504  *b Returns:
505  **
506  ** 1 if gaze changes enabled, 0 if not
507  */
508  int get_gaze_change_enabled();
509 
510  /*l
511  *b Description:
512  **
513  ** This function sets whether the I-Guy controller can affect the
514  ** orientation of the character.
515  **
516  ** The default is 1, orientation change enabled.
517  **
518  *b Arguments:
519  **
520  *a enabled - pass 1 to enable orientation changes, 0 to disable
521  */
522  void set_orientation_change_enabled(int enabled);
523 
524  /*l
525  *b Returns:
526  **
527  ** 1 if gaze orientation enabled, 0 if not
528  */
529  int get_orientation_change_enabled();
530 
531  /*l
532  *b Description:
533  **
534  ** This function sets whether the I-Guy controller can affect the
535  ** position of the character.
536  **
537  ** The default is 1, position change enabled.
538  **
539  *b Arguments:
540  **
541  *a enabled - pass 1 to enable position changes, 0 to disable
542  */
543  void set_position_change_enabled(int enabled);
544 
545  /*l
546  *b Returns:
547  **
548  ** 1 if position changes enabled, 0 if not
549  */
550  int get_position_change_enabled();
551 
552 
553 /*****************************************************************************/
563  /*l
564  *b Description:
565  **
566  ** This function sets whether the I-Guy controller will change the
567  ** controlled character's action abruptly or allow action changes to
568  ** take place smoothly.
569  **
570  ** Forced action changes provide better responsiveness, but don't
571  ** look as nice.
572  **
573  ** See the functions diguyCharacter::force_action() and
574  ** diguyCharacter::set_desired_action().
575  **
576  ** The set_skip_transitions_flag() also has an effect on
577  ** responsiveness and how nice the action transitions look.
578  **
579  ** The default is 1, force actions.
580  **
581  *b Arguments:
582  **
583  *a use_force_action_flag - pass 1 to force quick action changes,
584  *a 0 to smooth action changes
585  */
586  void set_use_force_action_flag(int use_force_action_flag);
587 
588  /*l
589  *b Returns:
590  **
591  ** whether actions are forced (returns 1) or not (returns 0)
592  */
593  int get_use_force_action_flag();
594 
595  /*l
596  *b Description:
597  **
598  ** This function sets whether the I-Guy controller will, when new
599  ** actions are forced, the transition motions from the current
600  ** to the new action are skipped.
601  **
602  ** Skipping transitions provides better responsiveness, but doesn't
603  ** look as nice.
604  **
605  ** This setting only has an effect if the force action flag is set
606  ** to 1 (see set_use_force_action_flag()).
607  **
608  ** The default is 1, skip transitions.
609  **
610  *b Arguments:
611  **
612  *a skip_transitions_flag - pass 1 to skip transition motions,
613  *a 0 to play them
614  */
615  void set_skip_transitions_flag(int skip_transitions_flag);
616 
617  /*l
618  *b Returns:
619  **
620  ** whether transitions between actions are skipped (returns 1) or
621  ** not (returns 0)
622  */
623  int get_skip_transitions_flag();
624 
625 
626 /*****************************************************************************/
636  /*l
637  *b Description:
638  **
639  ** This function sets whether the I-Guy character will always try
640  ** to run, or move at its top speed.
641  **
642  ** The default is 0, don't always run.
643  **
644  *b Arguments:
645  **
646  *a always_run_flag - pass 1 to always run, 0 to be able to walk
647  *a and/or jog when moving slower
648  */
649  void set_always_run_flag(int always_run_flag);
650 
651  /*l
652  *b Returns:
653  **
654  ** whether the I-Guy character will always try to run (returns 1),
655  ** or not (returns 0)
656  */
657  int get_always_run_flag();
658 
659 
660  /*l
661  *b Returns:
662  **
663  ** whether the I-Guy character is currently bumping into something in the world limiting its motion.
664  */
665  int get_is_colliding();
666 
667 /*****************************************************************************/
677  /*l
678  *b Description:
679  **
680  ** This function returns the current azimiuth (left/right) facing
681  ** angle of the I-Guy character. This value will change as the
682  ** character is moved around by the I-Guy controller.
683  **
684  *b Returns:
685  **
686  ** current rz facing angle, in degrees
687  */
688  float get_face_rz();
689 
690  /*l
691  *b Description:
692  **
693  ** This function returns the current elevation (down/up) facing
694  ** angle of the I-Guy character. This value will change as the
695  ** character is moved around by the I-Guy controller.
696  **
697  *b Returns:
698  **
699  ** current ry facing angle, in degrees
700  */
701  float get_face_ry();
702 
703  /*l
704  *b Description:
705  **
706  ** This function sets the desired azimiuth (left/right) facing
707  ** angle of the I-Guy character.
708  **
709  ** Most often this value is changed via mouse, keyboard, or joystick
710  ** input, not by this function.
711  */
712  void set_face_rz_desired(float face_rz_desired);
713 
714  /*l
715  *b Returns:
716  **
717  ** desired rz facing angle, in degrees
718  */
719  float get_face_rz_desired();
720 
721  /*l
722  *b Description:
723  **
724  ** This function sets the desired elevation (down/up) facing
725  ** angle of the I-Guy character.
726  **
727  ** Most often this value is changed via mouse, keyboard, or joystick
728  ** input, not by this function.
729  */
730  void set_face_ry_desired(float face_ry_desired);
731 
732  /*l
733  *b Returns:
734  **
735  ** desired ry facing angle, in degrees
736  */
737  float get_face_ry_desired();
738 
739  /*l
740  *b Description:
741  **
742  ** This function sets the desired rz and ry facing angles of the
743  ** I-Guy controlled character toward the specified character.
744  */
745  void face_character(const char* character_name,
746  const char* link,
747  float offset_rz = 0.0f,
748  float offset_ry = 0.0f);
749 
750 
751 
752 
753 /****************************************************************************/
754 /****************************************************************************/
765 /****************************************************************************/
766 /****************************************************************************/
767 
768  /*l
769  ** Deprecated; use set_orientation_change_enabled() instead.
770  */
771  void set_mouse_look_changes_orientation(int val);
772 
773  /*l
774  ** Deprecated; use get_orientation_change_enabled() instead.
775  */
776  int get_mouse_look_changes_orientation();
777 
778 
783 #ifdef CPLUSPLUS_ONLY
784 
785  bdiScenarioIGuy* get_scripted_object() {return m_scripted_object;}
786 
787 private:
788 
789  /*l
790  ** A private constructor.
791  */
792  diguyIGuyController(bdiScenarioIGuy* iguy);
793 
794  /*l
795  ** A pointer to internal data.
796  */
797  bdiScenarioIGuy* m_scripted_object;
798 
799  friend class bdiScenarioIGuy;
800 
801 #endif
802 
803 };
804 
805 #endif /* __diguyIGuyController_H */
806 
Contains the diguyMotionVariant enumeration and utility function declarations.
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:81
Definition: diguyMotionVariant.h:63
Contains the diguyMotionPosture enumeration and utility function declarations.
Definition: diguyMotionPosture.h:41
diguyMotionVariant
Definition: diguyMotionVariant.h:28
A class that gives access to IGuy's parameters.
Definition: diguyIGuyController.h:33
diguyMotionPosture
Definition: diguyMotionPosture.h:28