DI-Guy SDK Documentation  13.1
diguyCharacterPathActionBead.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyCharacterPathActionBead
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyCharacterPathActionBead_H
15 #define __diguyCharacterPathActionBead_H
16 
17 #ifdef SWIG
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 class bdiBeadAction;
25 #endif
26 
27 
28 #include <declspec_diguy.h>
29 
36 /****************************************************************************/
37 class BDI_DECLSPEC_diguy diguyCharacterPathActionBead
38 {
39 
40 public:
41 
42 /*****************************************************************************/
52  /*l
53  *b Description:
54  **
55  ** Returns the name of the object. This pointer will
56  ** never be NULL.
57  **
58  *b Returns:
59  **
60  ** name of the object
61  */
62  const char* get_name();
63 
64  /*l
65  *b Description:
66  **
67  ** This function sets the name of this object.
68  **
69  *b Returns:
70  **
71  ** 0 on success, -1 on failure
72  */
73  int set_name(const char* name);
74 
75  /*l
76  *b Description:
77  **
78  ** This function returns the action this bead specifies.
79  ** This pointer will never be NULL.
80  **
81  *b Returns:
82  **
83  ** action of this bead
84  */
85  const char* get_action();
86 
87  /*l
88  *b Description:
89  **
90  ** This function sets the action this bead specifies. When
91  ** a character is traversing the path containing this
92  ** bead, the specified action will be performed when this bead
93  ** is reached.
94  **
95  ** If this action bead is part of a diguyCharacterPath,
96  ** the diguyCharacterPath::update() function must be called for
97  ** changes to take effect.
98  **
99  *b Arguments:
100  **
101  *a action - the action the character should perform when
102  *a this bead is reached
103  **
104  *b Returns:
105  **
106  ** 0 on success, -1 on failure
107  */
108  int set_action(const char* action);
109 
110  /*l
111  *b Description:
112  **
113  ** This function returns how far into the path this bead is.
114  **
115  *b Returns:
116  **
117  ** distance into path of this bead, in meters
118  */
119  float get_distance_into_path();
120 
121  /*l
122  *b Description:
123  **
124  ** This function sets how far into the path this bead is.
125  **
126  ** Since distances and times on paths are interrelated,
127  ** calling this function will have the side-effect of setting
128  ** when on the path the bead is located, as if to a call to
129  ** set_tin().
130  **
131  ** If this script bead is part of a diguyCharacterPath,
132  ** the diguyCharacterPath::update() function must be called for
133  ** changes to take effect.
134  **
135  *b Arguments:
136  **
137  *a distance_into_path - how far into the path this bead is,
138  *a in meters
139  **
140  *b Returns:
141  **
142  ** 0 on success, -1 on failure
143  */
144  int set_distance_into_path(float distance_into_path);
145 
146  /*l
147  *b Description:
148  **
149  ** This function returns where on the path this bead is.
150  **
151  *b Returns:
152  **
153  ** location of this bead, in meters
154  */
155  float get_length();
156 
157  /*l
158  *b Description:
159  **
160  ** This function sets how long this bead will have an
161  ** effect. The bead will have an effect from its initial
162  ** distance into the path (as set by set_distance_into_path())
163  ** to (distance + length) seconds.
164  **
165  ** Since distances and times on paths are interrelated,
166  ** calling this function will have the side-effect of setting
167  ** when on the path the bead's effect ends, as if to a call
168  ** to set_duration().
169  **
170  ** If this script bead is part of a diguyCharacterPath,
171  ** the diguyCharacterPath::update() function must be called for
172  ** changes to take effect.
173  **
174  *b Arguments:
175  **
176  *a duration - duration of this bead, in seconds
177  **
178  *b Returns:
179  **
180  ** 0 on success, -1 on failure
181  */
182  int set_length(float length);
183 
184  /*l
185  *b Description:
186  **
187  ** This function returns whether the length of this bead is
188  ** derived from other information in the bead. If so, calling
189  ** set_length() will have no effect.
190  **
191  ** See set_derive_length_flag() for information on how length
192  ** is derived.
193  **
194  *b Returns:
195  **
196  ** integer flag; 1 means length is derived, 0 means it is not
197  */
198  int get_derive_length_flag();
199 
200  /*l
201  *b Description:
202  **
203  ** This function sets whether the length of this bead is
204  ** derived from other information in the bead. If so, calling
205  ** set_length() will have no effect.
206  **
207  ** (More documentation needed to explain how length is derived.)
208  **
209  *b Arguments:
210  **
211  *a derive_length_flag - pass 1 for length to be derived, else 0
212  **
213  *b Returns:
214  **
215  ** 0 on success, -1 on failure
216  */
217  int set_derive_length_flag(int derive_length_flag);
218 
219  /*l
220  *b Description:
221  **
222  ** This function returns when on the path this bead is.
223  **
224  *b Returns:
225  **
226  ** time location of this bead, in seconds
227  */
228  float get_tin();
229 
230  /*l
231  *b Description:
232  **
233  ** This function sets when this bead will begin to have
234  ** an effect.
235  **
236  ** Since distances and times on paths are interrelated,
237  ** calling this function will have the side-effect of setting
238  ** where on the path the bead is located, as if to a call to
239  ** set_distance_into_path().
240  **
241  ** If this script bead is part of a diguyCharacterPath,
242  ** the diguyCharacterPath::update() function must be called for
243  ** changes to take effect.
244  **
245  *b Arguments:
246  **
247  *a tin - when this bead begins to have an effect, in seconds
248  **
249  *b Returns:
250  **
251  ** 0 on success, -1 on failure
252  */
253  int set_tin(float tin);
254 
255  /*l
256  *b Description:
257  **
258  ** This function returns how long this bead will have an
259  ** effect.
260  **
261  *b Returns:
262  **
263  ** duration of this bead, in seconds
264  */
265  float get_duration();
266 
267  /*l
268  *b Description:
269  **
270  ** This function sets how long this bead will have an
271  ** effect. The bead will have an effect from tin seconds
272  ** (as set by set_tin()) to (tin + duration) seconds.
273  **
274  ** Note that if duration is derived (as by a call to
275  ** set_derive_duration_flag()), this function will have
276  ** no effect.
277  **
278  ** Since distances and times on paths are interrelated,
279  ** calling this function will have the side-effect of setting
280  ** where on the path the bead's effect ends, as if to a call
281  ** to set_length().
282  **
283  ** If this script bead is part of a diguyCharacterPath,
284  ** the diguyCharacterPath::update() function must be called for
285  ** changes to take effect.
286  **
287  *b Arguments:
288  **
289  *a duration - duration of this bead, in seconds
290  **
291  *b Returns:
292  **
293  ** 0 on success, -1 on failure
294  */
295  int set_duration(float duration);
296 
297  /*l
298  *b Description:
299  **
300  ** This function returns whether the duration of this bead is
301  ** derived from other information in the bead. If so, calling
302  ** set_duration() will have no effect.
303  **
304  ** See set_derive_duration_flag() for information on how length
305  ** is derived.
306  **
307  *b Returns:
308  **
309  ** integer flag; 1 means duration is derived, 0 means it is not
310  **
311  *b Callable From:
312  **
313  *- - C++
314  *- - Script
315  */
316  int get_derive_duration_flag();
317 
318  /*l
319  *b Description:
320  **
321  ** This function sets whether the duration of this bead is
322  ** derived from other information in the bead. If so, calling
323  ** set_duration() will have no effect.
324  **
325  ** (More documentation needed to explain how duration is derived.)
326  **
327  *b Arguments:
328  **
329  *a derive_length_flag - pass 1 for duration to be derived, else 0
330  **
331  *b Returns:
332  **
333  ** 0 on success, -1 on failure
334  */
335  int set_derive_duration_flag(int derive_duration_flag);
336 
337  /*l
338  *b Returns:
339  **
340  ** the desired duration of this bead
341  */
342  float get_desired_duration();
343 
344  /*l
345  *b Description:
346  **
347  ** This function sets the desired duration of the action bead.
348  **
349  *b Arguments:
350  **
351  *a desired_duration - desired duration of action in seconds
352  **
353  *b Returns:
354  **
355  ** 0 on success, -1 on failure
356  */
357  int set_desired_duration(float desired_duration);
358 
359  /*l
360  *b Description:
361  **
362  ** This function returns whether the desired duration of this bead
363  ** is derived from other information in the bead. If so, calling
364  ** set_desired_duration() will have no effect.
365  **
366  *b Returns:
367  **
368  ** integer flag; 1 means duration is derived, 0 means it is not
369  **
370  */
371  int get_derive_desired_duration_flag();
372 
373  /*l
374  *b Description:
375  **
376  ** This function sets whether the desired duration of this bead is
377  ** derived from other information in the bead. If so, calling
378  ** set_desired_duration() will have no effect.
379  **
380  *b Arguments:
381  **
382  *a derive_desired_duration_flag - pass 1 for duration to be derived,
383  *a else 0
384  **
385  *b Returns:
386  **
387  ** 0 on success, -1 on failure
388  */
389  int set_derive_desired_duration_flag(int derive_desired_duration_flag);
390 
391  /*l
392  *b Returns:
393  **
394  ** how many repetitions of the action's looping motion will be played
395  */
396  int get_motion_reps();
397 
398  /*l
399  *b Description:
400  **
401  ** This function sets how many repetitions of the action's looping
402  ** motion will be played.
403  **
404  *b Arguments:
405  **
406  *a motion_reps - how many times to play the looping motion
407  **
408  *b Returns:
409  **
410  ** 0 on success, -1 on failure
411  */
412  int set_motion_reps(int motion_reps);
413 
414  /*l
415  *b Description:
416  **
417  ** This function returns whether the number of motion repetitions
418  ** for this action is derived from other data in the bead. If so,
419  ** calling set_motion_reps() will have no effect.
420  **
421  *b Returns:
422  **
423  ** integer flag; 1 means number of motion reps is derived, 0 means
424  ** it is not
425  */
426  int get_derive_motion_reps_flag();
427 
428  /*l
429  *b Description:
430  **
431  ** This function sets whether the number of motion repetitions
432  ** for this bead is derived from other information in the bead.
433  ** If so, calling set_motion_reps() will have no effect.
434  **
435  *b Arguments:
436  **
437  *a derive_motion_reps - pass 1 for number of motion reps to be
438  *a derived, else 0
439  **
440  *b Returns:
441  **
442  ** 0 on success, -1 on failure
443  */
444  int set_derive_motion_reps_flag(int derive_motion_reps);
445 
446  /*l
447  *b Description:
448  **
449  ** This function returns whether the transition motion for this
450  ** action bead from the previous action bead (if any) occurs
451  ** before this action bead or after.
452  **
453  *b Returns:
454  **
455  ** integer flag; 1 means transition happens before, 0 means
456  ** it happens after
457  */
458  int get_transition_before_bead_flag();
459 
460  /*l
461  *b Description:
462  **
463  ** This function sets whether the transition motion for this
464  ** action bead from the previous action bead (if any) occurs
465  ** before this action bead or after.
466  **
467  *b Arguments:
468  **
469  *a transition_before_bead_flag - pass 1 for transition to happen
470  *a before, 0 for it to happen after
471  **
472  *b Returns:
473  **
474  ** 0 on success, -1 on failure
475  */
476  int set_transition_before_bead_flag(int transition_before_bead_flag);
477 
478  /*l
479  *b Description:
480  **
481  ** This function returns the name of this bead's companion waypoint.
482  **
483  *b Returns:
484  **
485  ** C string identifying name of companion waypoint; NULL if there is
486  ** no companion waypoint
487  */
488  const char* get_companion_waypoint_name();
489 
490  /*l
491  *b Description:
492  **
493  ** This function sets the name of this action bead's companion
494  ** waypoint. The action bead will be constrained to stay at the
495  ** companion waypoint as the waypoint is moved around.
496  **
497  *b Arguments:
498  **
499  *a companion_waypoint_name - name of companion waypoint; pass
500  *a NULL to un-set the companion waypoint
501  **
502  *b Returns:
503  **
504  ** 0 on success, -1 on failure
505  */
506  int set_companion_waypoint_name(const char* companion_waypoint_name);
507 
508  /*l
509  *b Description:
510  **
511  ** This function creates a companion waypoint for this action bead
512  ** if it doesn't already have one. The created waypoint will be
513  ** at the action bead's current position. If this action bead
514  ** already has a companion waypoint, it may be modified to show
515  ** facing direction changes if this action or the previous action
516  ** have changed since the companion waypoint was assigned.
517  **
518  *b Returns:
519  **
520  ** 0 on success, -1 on failure
521  */
522  int create_or_update_companion_waypoint();
523 
524 
525 /****************************************************************************/
526 /****************************************************************************/
527 
532 #ifdef CPLUSPLUS_ONLY
533 
534  bdiBeadAction* get_scripted_object() {return m_scripted_object;}
535 
536  friend class bdiBeadAction;
537 
538 private:
539 
540  /*l
541  ** A private constructor.
542  */
543  diguyCharacterPathActionBead(bdiBeadAction* scripted_object);
544 
545  /*l
546  ** A private destructor.
547  */
549 
550  /*l
551  ** A pointer to internal data.
552  */
553  bdiBeadAction* m_scripted_object;
554 
555 #endif
556 
557 };
558 
559 
560 #endif /* __diguyCharacterPathActionBead_H */
561 
562 
563 /*********************************************************************
564  ** Copyright (c) 1992-2015 VT MAK
565  ** All rights reserved.
566  *********************************************************************/
567 
A bead that sits on a character's spline path and triggers a new action.
Definition: diguyCharacterPathActionBead.h:35