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