
/*********************************************************************
 ** Copyright (c) 1992-2022 MAK Technologies, Inc.
 ** All rights reserved.
 *********************************************************************/

/*********************************************************************
 **
 *t  diguyCharacterPathActionBead
 **
 *b    Link against: libdiguy
 */

#ifndef __diguyCharacterPathActionBead_H
#define __diguyCharacterPathActionBead_H

#ifdef SWIG
%module diguyCharacterPathActionBead
#else
#define CPLUSPLUS_ONLY
#endif

#ifdef CPLUSPLUS_ONLY
class bdiBeadAction;
#endif


#include <declspec_diguy.h>

/*!
 ** \brief A bead that sits on a character's spline path and triggers a new action.
 **
 ** \ingroup diguyCore
 */

class BDI_DECLSPEC_diguy diguyCharacterPathActionBead
{

public:

/*****************************************************************************/
/**
 *2  General Functions
 **
 **  Unless otherwise specified, all functions callable from:
 **
 *-    - C++
 *-    - Script
 */

   /*l
    *b  Description:
    **
    **    Returns the name of the object.  This pointer will
    **    never be NULL.
    **
    *b  Returns:
    **
    **    name of the object
    */
   const char* get_name();

   /*l
    *b  Description:
    **
    **    This function sets the name of this object.
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_name(const char* name);

   /*l
    *b  Description:
    **
    **    This function returns the action this bead specifies.
    **    This pointer will never be NULL.
    **
    *b  Returns:
    **
    **    action of this bead
    */
   const char* get_action();

   /*l
    *b  Description:
    **
    **    This function sets the action this bead specifies.  When
    **    a character is traversing the path containing this
    **    bead, the specified action will be performed when this bead
    **    is reached.
    **
    **    If this action bead is part of a diguyCharacterPath,
    **    the diguyCharacterPath::update() function must be called for
    **    changes to take effect.
    **
    *b  Arguments:
    **
    *a    action - the action the character should perform when
    *a             this bead is reached
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_action(const char* action);

   /*l
    *b  Description:
    **
    **    This function returns how far into the path this bead is.
    **
    *b  Returns:
    **
    **    distance into path of this bead, in meters
    */
   float get_distance_into_path();

   /*l
    *b  Description:
    **
    **    This function sets how far into the path this bead is.
    **
    **    Since distances and times on paths are interrelated,
    **    calling this function will have the side-effect of setting
    **    when on the path the bead is located, as if to a call to
    **    set_tin().
    **
    **    If this script bead is part of a diguyCharacterPath,
    **    the diguyCharacterPath::update() function must be called for
    **    changes to take effect.
    **
    *b  Arguments:
    **
    *a    distance_into_path - how far into the path this bead is,
    *a                         in meters
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_distance_into_path(float distance_into_path);

   /*l
    *b  Description:
    **
    **    This function returns where on the path this bead is.
    **
    *b  Returns:
    **
    **    location of this bead, in meters
    */
   float get_length();

   /*l
    *b  Description:
    **
    **    This function sets how long this bead will have an
    **    effect.   The bead will have an effect from its initial
    **    distance into the path (as set by set_distance_into_path())
    **    to (distance + length) seconds.
    **
    **    Since distances and times on paths are interrelated,
    **    calling this function will have the side-effect of setting
    **    when on the path the bead's effect ends, as if to a call
    **    to set_duration().
    **
    **    If this script bead is part of a diguyCharacterPath,
    **    the diguyCharacterPath::update() function must be called for
    **    changes to take effect.
    **
    *b  Arguments:
    **
    *a    duration - duration of this bead, in seconds
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_length(float length);

   /*l
    *b  Description:
    **
    **    This function returns whether the length of this bead is
    **    derived from other information in the bead.  If so, calling
    **    set_length() will have no effect.
    **
    **    See set_derive_length_flag() for information on how length
    **    is derived.
    **
    *b  Returns:
    **
    **    integer flag; 1 means length is derived, 0 means it is not
    */
   int get_derive_length_flag();

   /*l
    *b  Description:
    **
    **    This function sets whether the length of this bead is
    **    derived from other information in the bead.  If so, calling
    **    set_length() will have no effect.
    **
    **    (More documentation needed to explain how length is derived.)
    **
    *b  Arguments:
    **
    *a    derive_length_flag - pass 1 for length to be derived, else 0
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_derive_length_flag(int derive_length_flag);

   /*l
    *b  Description:
    **
    **    This function returns when on the path this bead is.
    **
    *b  Returns:
    **
    **    time location of this bead, in seconds
    */
   float get_tin();

   /*l
    *b  Description:
    **
    **    This function sets when this bead will begin to have
    **    an effect.
    **
    **    Since distances and times on paths are interrelated,
    **    calling this function will have the side-effect of setting
    **    where on the path the bead is located, as if to a call to
    **    set_distance_into_path().
    **
    **    If this script bead is part of a diguyCharacterPath,
    **    the diguyCharacterPath::update() function must be called for
    **    changes to take effect.
    **
    *b  Arguments:
    **
    *a    tin - when this bead begins to have an effect, in seconds
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_tin(float tin);

   /*l
    *b  Description:
    **
    **    This function returns how long this bead will have an
    **    effect.
    **
    *b  Returns:
    **
    **    duration of this bead, in seconds
    */
   float get_duration();

   /*l
    *b  Description:
    **
    **    This function sets how long this bead will have an
    **    effect.   The bead will have an effect from tin seconds
    **    (as set by set_tin()) to (tin + duration) seconds.
    **
    **    Note that if duration is derived (as by a call to
    **    set_derive_duration_flag()), this function will have
    **    no effect.
    **
    **    Since distances and times on paths are interrelated,
    **    calling this function will have the side-effect of setting
    **    where on the path the bead's effect ends, as if to a call
    **    to set_length().
    **
    **    If this script bead is part of a diguyCharacterPath,
    **    the diguyCharacterPath::update() function must be called for
    **    changes to take effect.
    **
    *b  Arguments:
    **
    *a    duration - duration of this bead, in seconds
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_duration(float duration);

   /*l
    *b  Description:
    **
    **    This function returns whether the duration of this bead is
    **    derived from other information in the bead.  If so, calling
    **    set_duration() will have no effect.
    **
    **    See set_derive_duration_flag() for information on how length
    **    is derived.
    **
    *b  Returns:
    **
    **    integer flag; 1 means duration is derived, 0 means it is not
    **
    *b  Callable From:
    **
    *-    - C++
    *-    - Script
    */
   int get_derive_duration_flag();

   /*l
    *b  Description:
    **
    **    This function sets whether the duration of this bead is
    **    derived from other information in the bead.  If so, calling
    **    set_duration() will have no effect.
    **
    **    (More documentation needed to explain how duration is derived.)
    **
    *b  Arguments:
    **
    *a    derive_length_flag - pass 1 for duration to be derived, else 0
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_derive_duration_flag(int derive_duration_flag);

   /*l
    *b  Returns:
    **
    **    the desired duration of this bead
    */
   float get_desired_duration();

   /*l
    *b  Description:
    **
    **    This function sets the desired duration of the action bead.
    **
    *b  Arguments:
    **
    *a    desired_duration - desired duration of action in seconds
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_desired_duration(float desired_duration);

   /*l
    *b  Description:
    **
    **    This function returns whether the desired duration of this bead
    **    is derived from other information in the bead.  If so, calling
    **    set_desired_duration() will have no effect.
    **
    *b  Returns:
    **
    **    integer flag; 1 means duration is derived, 0 means it is not
    **
    */
   int get_derive_desired_duration_flag();

   /*l
    *b  Description:
    **
    **    This function sets whether the desired duration of this bead is
    **    derived from other information in the bead.  If so, calling
    **    set_desired_duration() will have no effect.
    **
    *b  Arguments:
    **
    *a    derive_desired_duration_flag - pass 1 for duration to be derived,
    *a                                   else 0
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_derive_desired_duration_flag(int derive_desired_duration_flag);

   /*l
    *b  Returns:
    **
    **    how many repetitions of the action's looping motion will be played
    */
   int get_motion_reps();

   /*l
    *b  Description:
    **
    **    This function sets how many repetitions of the action's looping
    **    motion will be played.
    **
    *b  Arguments:
    **
    *a    motion_reps - how many times to play the looping motion
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_motion_reps(int motion_reps);

   /*l
    *b  Description:
    **
    **    This function returns whether the number of motion repetitions
    **    for this action is derived from other data in the bead.  If so,
    **    calling set_motion_reps() will have no effect.
    **
    *b  Returns:
    **
    **    integer flag; 1 means number of motion reps is derived, 0 means
    **    it is not
    */
   int get_derive_motion_reps_flag();

   /*l
    *b  Description:
    **
    **    This function sets whether the number of motion repetitions
    **    for this bead is derived from other information in the bead.
    **    If so, calling set_motion_reps() will have no effect.
    **
    *b  Arguments:
    **
    *a    derive_motion_reps - pass 1 for number of motion reps to be
    *a                         derived, else 0
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_derive_motion_reps_flag(int derive_motion_reps);

   /*l
    *b  Description:
    **
    **    This function returns whether the transition motion for this
    **    action bead from the previous action bead (if any) occurs
    **    before this action bead or after.
    **
    *b  Returns:
    **
    **    integer flag; 1 means transition happens before, 0 means
    **    it happens after
    */
   int get_transition_before_bead_flag();

   /*l
    *b  Description:
    **
    **    This function sets whether the transition motion for this
    **    action bead from the previous action bead (if any) occurs
    **    before this action bead or after.
    **
    *b  Arguments:
    **
    *a    transition_before_bead_flag - pass 1 for transition to happen
    *a                                  before, 0 for it to happen after
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_transition_before_bead_flag(int transition_before_bead_flag);

   /*l
    *b  Description:
    **
    **    This function returns the name of this bead's companion waypoint.
    **
    *b  Returns:
    **
    **    C string identifying name of companion waypoint; NULL if there is
    **    no companion waypoint
    */
   const char* get_companion_waypoint_name();

   /*l
    *b  Description:
    **
    **    This function sets the name of this action bead's companion
    **    waypoint.  The action bead will be constrained to stay at the
    **    companion waypoint as the waypoint is moved around.
    **
    *b  Arguments:
    **
    *a    companion_waypoint_name - name of companion waypoint; pass
    *a                              NULL to un-set the companion waypoint
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int set_companion_waypoint_name(const char* companion_waypoint_name);

   /*l
    *b  Description:
    **
    **    This function creates a companion waypoint for this action bead
    **    if it doesn't already have one.  The created waypoint will be
    **    at the action bead's current position.  If this action bead
    **    already has a companion waypoint, it may be modified to show
    **    facing direction changes if this action or the previous action
    **    have changed since the companion waypoint was assigned.
    **
    *b  Returns:
    **
    **    0 on success, -1 on failure
    */
   int create_or_update_companion_waypoint();


/****************************************************************************/
/****************************************************************************/

/**
 *x  The functions and variables past this point are for internal use only.
 **   No external access to them is expected or necessary.
 */
#ifdef CPLUSPLUS_ONLY

   bdiBeadAction* get_scripted_object() {return m_scripted_object;}

   friend class bdiBeadAction;

private:

   /*l
    **    A private constructor.
    */
   diguyCharacterPathActionBead(bdiBeadAction* scripted_object);

   /*l
    **    A private destructor.
    */
   ~diguyCharacterPathActionBead();

   /*l
    **    A pointer to internal data.
    */
   bdiBeadAction* m_scripted_object;

#endif

};


#endif /* __diguyCharacterPathActionBead_H */


/*********************************************************************
 ** Copyright (c) 1992-2022 MAK Technologies, Inc.
 ** All rights reserved.
 *********************************************************************/

