![]() |
DI-Guy SDK Documentation
13.7
|
A group of DI-Guy characters, useful for organizing your scenarios. More...
#include <diguyCharacterGroup.h>
Public Member Functions | |
General Functions | |
Unless otherwise specified, all functions callable from:
| |
| const char * | get_name () |
| Returns: name of the group; this value will never be NULL. More... | |
| int | set_name (const char *name) |
| This function sets the name of this object. More... | |
| int | add_member (diguyCharacter *character) |
| Adds the passed character to the group if not already in it. More... | |
| int | add_all_characters_as_members () |
| Adds all characters of the scenario as members of the group. More... | |
| int | remove_member (diguyCharacter *character) |
| Removes the passed character from the group if it is a member. More... | |
| int | remove_all_members () |
| Removes all members of the group. More... | |
| int | is_member (diguyCharacter *character) |
| The function can be used to check if a specific character is in this group. More... | |
| int | get_num_members () |
| Returns: number of member characters in group. More... | |
| diguyCharacter * | get_member_at_index (int index) |
| Returns: group member at specified index; NULL if no character at specified index. More... | |
| int | get_index_of_member (diguyCharacter *character) |
| Returns: index of member, or -1 if not found. More... | |
| int | get_subgroup_number (diguyFormation *formation, int index) |
| See diguyFormation for a description of subgroups. More... | |
| int | get_index_in_subgroup (diguyFormation *formation, int index) |
| See diguyFormation for a description of subgroups. More... | |
| int | set_all_members_enabled (int enabled) |
| Sets whether all characters in group are enabled. More... | |
| int | update_all_members (float t) |
| Updates all characters in the group. More... | |
| int | draw_all_members () |
| This function draws all members of the group. More... | |
| int | draw_pass1_all_members () |
| This function draws pass 1 of all members of the group. More... | |
| int | draw_pass2_all_members () |
| This function draws pass 2 all members of the group. More... | |
| int | set_all_members_current_tin (float tin) |
| This function sets the current tin time of all characters in the group. More... | |
| int | set_all_members_current_tout (float tout) |
| This function sets the current tout time of all characters in the group. More... | |
Label Functions | |
The functions in this section control the text, visibility, and colors of group labels. Currently group labels are only enabled in DI-Guy Scenario. | |
| diguyViewLabel * | get_label () |
| This function returns a pointer to the label object of the group. More... | |
| void | set_label_offset_above_centroid (float offset) |
| This function sets how high the label of the group will float above the group's centroid. More... | |
| float | get_label_offset_above_centroid () |
| Returns: how high the label of the group will float above the group centroid. More... | |
Variable Functions | |
| int | get_num_variables () |
| Returns: number of variables the group has. More... | |
| diguyVariable * | get_variable_at_index (int index) |
| Returns: pointer of type diguyVariable; NULL if no variable at the specified index. More... | |
| diguyVariable * | find_variable (const char *name) |
| This function returns a pointer to the specified variable. More... | |
| diguyVariable * | find_or_create_variable (const char *name) |
| This function finds the variable with the given name or creates it if it doesn't exist. More... | |
| int | destroy_variable (diguyVariable *variable) |
| This function destroys the passed variable. More... | |
Experimental Functions | |
| int | translate_all_paths (float tx, float ty, float tz) |
| int | rotate_all_paths_about_point (float rz, float rx, float ry, float rotation_pt_x, float rotation_pt_y, float rotation_pt_z) |
| int | rotate_all_paths_about_current_waypoint (float rz, float rx, float ry) |
| diguyCharacter * | get_nearest_character_to_point (float x, float y, float z) |
| Get the character closest to the specified point. More... | |
| diguyCharacter * | get_farthest_character_to_point (float x, float y, float z) |
| Get the character furthest from the specified point. More... | |
| int | get_group_centroid (float *x, float *y, float *z) |
| Get centroid of group (average of character positions). More... | |
| int | get_group_min_circle (float *x, float *y, float *z, float *radius) |
| Get minimum enclosing circle of group. More... | |
| int | send_message_to_all_members (const char *sender, const char *message_type, const char *message, const char *message_params=NULL) |
| Send a message to all characters in group. More... | |
| int | apply_formation_to_group_with_dir (diguyCharacter *leader, diguyFormation *formation, float dir_x, float dir_y, float desired_radius=-1.0f, int require_sort=1) |
| Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader. More... | |
| int | apply_formation_to_group_with_goal (diguyCharacter *leader, diguyFormation *formation, float goal_x, float goal_y, float desired_radius=-1.0f, int require_sort=1) |
| Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader. More... | |
| int | apply_formation_to_group (diguyCharacter *leader, diguyFormation *formation, float desired_radius=-1.0f, int require_sort=1) |
| Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader. More... | |
| diguyFormation * | get_current_formation () |
| Returns the last-set formation. More... | |
| int | sort_group_based_on_pos (float x, float y, float z, diguyFormation *formation=NULL, diguyCharacter *leader=NULL) |
| Sorts group relative to the point given. More... | |
| diguyCharacter * | get_sorted_member_at_index (int index) |
| Returns: member of formation-sorted group; NULL if no character at index. More... | |
| int | get_num_active_members () |
| Returns: number of active members. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiScenarioCharacterGroup * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiScenarioCharacterGroup |
| bdiScenarioCharacterGroup * | get_scripted_object () |
| diguyCharacterGroup (bdiScenarioCharacterGroup *scripted_object) | |
| A private constructor. More... | |
| virtual | ~diguyCharacterGroup () |
| A private destructor. More... | |
A group of DI-Guy characters, useful for organizing your scenarios.
|
private |
A private constructor.
|
privatevirtual |
A private destructor.
| const char* diguyCharacterGroup::get_name | ( | ) |
Returns: name of the group; this value will never be NULL.
| int diguyCharacterGroup::set_name | ( | const char * | name | ) |
This function sets the name of this object.
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::add_member | ( | diguyCharacter * | character | ) |
Adds the passed character to the group if not already in it.
Returns:
0 if the character is now a part of the group, -1 if not
| int diguyCharacterGroup::add_all_characters_as_members | ( | ) |
Adds all characters of the scenario as members of the group.
Returns:
Always return 0.
| int diguyCharacterGroup::remove_member | ( | diguyCharacter * | character | ) |
Removes the passed character from the group if it is a member.
Returns:
0 if the character was part of the group and removed; -1 if not
| int diguyCharacterGroup::remove_all_members | ( | ) |
Removes all members of the group.
Returns:
Always return 0.
| int diguyCharacterGroup::is_member | ( | diguyCharacter * | character | ) |
The function can be used to check if a specific character is in this group.
Also see diguyCharacter::is_group_member().
Returns:
1 if the passed character is a member of the group; 0 if not
| int diguyCharacterGroup::get_num_members | ( | ) |
Returns: number of member characters in group.
| diguyCharacter* diguyCharacterGroup::get_member_at_index | ( | int | index | ) |
Returns: group member at specified index; NULL if no character at specified index.
| int diguyCharacterGroup::get_index_of_member | ( | diguyCharacter * | character | ) |
Returns: index of member, or -1 if not found.
| int diguyCharacterGroup::get_subgroup_number | ( | diguyFormation * | formation, |
| int | index | ||
| ) |
See diguyFormation for a description of subgroups.
Returns:
subgroup number within formation of character at index, or -1
| int diguyCharacterGroup::get_index_in_subgroup | ( | diguyFormation * | formation, |
| int | index | ||
| ) |
| int diguyCharacterGroup::set_all_members_enabled | ( | int | enabled | ) |
Sets whether all characters in group are enabled.
Equivalent to calling diguyCharacter::set_enabled() for group members.
Returns:
Always return 0.
| int diguyCharacterGroup::update_all_members | ( | float | t | ) |
Updates all characters in the group.
Equivalent to calling diguyCharacter::update() for all group members.
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::draw_all_members | ( | ) |
This function draws all members of the group.
Returns:
0 on success, -1 on failure
Callable From:
| int diguyCharacterGroup::draw_pass1_all_members | ( | ) |
This function draws pass 1 of all members of the group.
See diguyCharacter::draw_pass1().
Returns:
0 on success, -1 on failure
Callable From:
| int diguyCharacterGroup::draw_pass2_all_members | ( | ) |
This function draws pass 2 all members of the group.
See diguyCharacter::draw_pass2().
Returns:
0 on success, -1 on failure
Callable From:
| int diguyCharacterGroup::set_all_members_current_tin | ( | float | tin | ) |
This function sets the current tin time of all characters in the group.
See diguyCharacter::set_current_tin().
| tin | new value of current tin in seconds |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::set_all_members_current_tout | ( | float | tout | ) |
This function sets the current tout time of all characters in the group.
See diguyCharacter::set_current_tout().
| tout | new value of current tout in seconds |
Returns:
0 on success, -1 on failure
| diguyViewLabel* diguyCharacterGroup::get_label | ( | ) |
This function returns a pointer to the label object of the group.
Currently group labels are only enabled in DI-Guy Scenario.
Returns:
pointer to the group's label
| void diguyCharacterGroup::set_label_offset_above_centroid | ( | float | offset | ) |
This function sets how high the label of the group will float above the group's centroid.
| offset | offset, in meters, of label above group |
| float diguyCharacterGroup::get_label_offset_above_centroid | ( | ) |
Returns: how high the label of the group will float above the group centroid.
| int diguyCharacterGroup::get_num_variables | ( | ) |
Returns: number of variables the group has.
| diguyVariable* diguyCharacterGroup::get_variable_at_index | ( | int | index | ) |
Returns: pointer of type diguyVariable; NULL if no variable at the specified index.
| index | index of the variable; indices start at 0 |
| diguyVariable* diguyCharacterGroup::find_variable | ( | const char * | name | ) |
This function returns a pointer to the specified variable.
| name | name of variable to be found |
Returns:
pointer of type diguyVariable; NULL if not found
| diguyVariable* diguyCharacterGroup::find_or_create_variable | ( | const char * | name | ) |
This function finds the variable with the given name or creates it if it doesn't exist.
| name | name of the variable to find or create |
Returns:
pointer of type diguyVariable; should never be NULL
| int diguyCharacterGroup::destroy_variable | ( | diguyVariable * | variable | ) |
This function destroys the passed variable.
| variable | pointer to a diguyVariable |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::translate_all_paths | ( | float | tx, |
| float | ty, | ||
| float | tz | ||
| ) |
| int diguyCharacterGroup::rotate_all_paths_about_point | ( | float | rz, |
| float | rx, | ||
| float | ry, | ||
| float | rotation_pt_x, | ||
| float | rotation_pt_y, | ||
| float | rotation_pt_z | ||
| ) |
| int diguyCharacterGroup::rotate_all_paths_about_current_waypoint | ( | float | rz, |
| float | rx, | ||
| float | ry | ||
| ) |
| diguyCharacter* diguyCharacterGroup::get_nearest_character_to_point | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Get the character closest to the specified point.
| x,y,z | position in meters from the origin |
Returns:
pointer to diguyCharacter, or NULL in none found
| diguyCharacter* diguyCharacterGroup::get_farthest_character_to_point | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Get the character furthest from the specified point.
| x,y,z | position in meters from the origin |
Returns:
pointer to diguyCharacter, or NULL if none found
| int diguyCharacterGroup::get_group_centroid | ( | float * | x, |
| float * | y, | ||
| float * | z | ||
| ) |
Get centroid of group (average of character positions).
| x,y,z | position in meters from the origin |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::get_group_min_circle | ( | float * | x, |
| float * | y, | ||
| float * | z, | ||
| float * | radius | ||
| ) |
Get minimum enclosing circle of group.
Note that this is slower than getting the centroid.
| x,y,z | center of circle of group in meters from the origin |
| radius | radius of circle |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::send_message_to_all_members | ( | const char * | sender, |
| const char * | message_type, | ||
| const char * | message, | ||
| const char * | message_params = NULL |
||
| ) |
Send a message to all characters in group.
See diguyCharacter::agent_accept_message().
| sender | who is sending the message |
| message_type | what type of message is being sent |
| message | the message string |
| message_params | optional parameter string |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::apply_formation_to_group_with_dir | ( | diguyCharacter * | leader, |
| diguyFormation * | formation, | ||
| float | dir_x, | ||
| float | dir_y, | ||
| float | desired_radius = -1.0f, |
||
| int | require_sort = 1 |
||
| ) |
Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader.
| leader | leader; can be NULL |
| formation | name of formation |
| dir_x | x component of the formation's heading |
| dir_y | y component of the formation's heading |
| desired_radius | if not given (-1.0), get radius from formation |
| require_sort | if 1, group must be resorted; if 0, it may still be |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::apply_formation_to_group_with_goal | ( | diguyCharacter * | leader, |
| diguyFormation * | formation, | ||
| float | goal_x, | ||
| float | goal_y, | ||
| float | desired_radius = -1.0f, |
||
| int | require_sort = 1 |
||
| ) |
Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader.
| leader | leader; can be NULL |
| formation | name of formation |
| goal_x | x component of the formation's goal point |
| goal_y | y component of the formation's goal point |
| desired_radius | if not given (-1.0), get radius from formation |
| require_sort | if 1, group must be resorted; if 0, it may still be |
Returns:
0 on success, -1 on failure
| int diguyCharacterGroup::apply_formation_to_group | ( | diguyCharacter * | leader, |
| diguyFormation * | formation, | ||
| float | desired_radius = -1.0f, |
||
| int | require_sort = 1 |
||
| ) |
Puts the group into the specified formation, applying agent_pursue_character_with_offset() to each character except the leader.
| leader | leader; can be NULL |
| formation | name of formation |
| desired_radius | if not given (-1.0), get radius from formation |
| require_sort | if 1, group must be resorted; if 0, it may still be |
Returns:
0 on success, -1 on failure
| diguyFormation* diguyCharacterGroup::get_current_formation | ( | ) |
Returns the last-set formation.
Returns:
The formation or NULL
| int diguyCharacterGroup::sort_group_based_on_pos | ( | float | x, |
| float | y, | ||
| float | z, | ||
| diguyFormation * | formation = NULL, |
||
| diguyCharacter * | leader = NULL |
||
| ) |
Sorts group relative to the point given.
The point should be on the left or in the front, depending on what order the formation is in. This updates an internal list of sorted group members.
| x | x component of point |
| y | y component of point |
| z | z component of point |
| formation | the formation; pass NULL for no formation |
| leader | the leader; pass NULL for no formation leader |
Returns:
0 on success, -1 on failure
| diguyCharacter* diguyCharacterGroup::get_sorted_member_at_index | ( | int | index | ) |
Returns: member of formation-sorted group; NULL if no character at index.
| int diguyCharacterGroup::get_num_active_members | ( | ) |
Returns: number of active members.
|
inline |
|
friend |
|
private |
A pointer to internal data.