Skip to content

Commit

Permalink
Merge pull request #747 from Berthalamew/development
Browse files Browse the repository at this point in the history
object definition work + added new ai mission dialogue definition
  • Loading branch information
Berthalamew authored Nov 22, 2024
2 parents 08a2e42 + 288c23f commit 5854c57
Show file tree
Hide file tree
Showing 42 changed files with 400 additions and 332 deletions.
31 changes: 0 additions & 31 deletions xlive/Blam/Cache/TagGroups/ai_mission_dialogue_definition.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion xlive/Blam/Cache/TagGroups/crate_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma pack(push,1)
struct s_crate_group_definition
{
object_definition objectTag;
object_definition object;
enum class e_flags : __int16
{
does_not_block_aoe = FLAG(0),
Expand Down
2 changes: 1 addition & 1 deletion xlive/Blam/Cache/TagGroups/creature_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma pack(push,1)
struct s_creature_group_definition
{
object_definition objectTag;
object_definition object;
enum class e_flags : __int32
{
unused = FLAG(0),
Expand Down
39 changes: 0 additions & 39 deletions xlive/Blam/Cache/TagGroups/scenery_definition.hpp

This file was deleted.

213 changes: 125 additions & 88 deletions xlive/Blam/Engine/ai/ai_mission_dialogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,142 +2,179 @@
#include "ai_scenario_definitions.h"
#include "ai_orders.h"


#include "tag_files/tag_block.h"
#include "tag_files/string_id.h"

/* constants */

#define k_max_roles_per_scene 10
#define k_max_variants_per_line 10
#define k_max_lines_per_scenario 500

/* enums */

enum e_ai_scene_flags : int
enum e_ai_scene_flags : uint32
{
ai_scene_flag_scene_can_play_multiple_times = FLAG(0),
ai_scene_flag_enable_combat_dialogue = FLAG(1)
_ai_scene_flag_scene_can_play_multiple_times_bit = 0,
_ai_scene_flag_enable_combat_dialogue_bit = 1,
k_ai_scene_flag_count
};

// max count: 1
struct ai_scene_trigger
enum e_ai_scene_role_group : int16
{
e_combination_rule combination_rule;
short pad;
tag_block<order_trigger_reference> triggers;
_ai_scene_role_group_group1 = 0,
_ai_scene_role_group_group2 = 1,
_ai_scene_role_group_group3 = 2
};
ASSERT_STRUCT_SIZE(ai_scene_trigger, 12);

enum e_ai_scene_role_group : short
enum e_ai_conversation_flags : uint16
{
_ai_conversation_stop_if_anyone_dies_bit = 0, // This Conversation Will Be Aborted If Any Participant Dies
_ai_conversation_stop_if_damaged_bit = 1, // An Actor Will Abort This Conversation If They Are Damaged
_ai_conversation_stop_if_visible_enemy_bit = 2, // An Actor Will Abort This Conversation If They See An Enemy
_ai_conversation_stop_if_alerted_to_enemy_bit = 3, // An Actor Will Abort This Conversation If They Suspect An Enemy
_ai_conversation_player_must_be_visible_bit = 4, // This Conversation Cannot Take Place Unless The Participants Can See A Nearby Player
_ai_conversation_stop_other_actions_bit = 5, // Participants Stop Doing Whatever They Were Doing In Order To Perform This Conversation
_ai_conversation_keep_trying_to_play_bit = 6, // If This Conversation Fails Initially It Will Keep Testing To See When It Can Play
_ai_conversation_player_must_be_looking_at_bit = 7, // This Conversation Will Not Start Until The Player Is Looking At One Of The Participants
k_number_of_conversation_definition_flags
};

enum e_ai_conversation_line_flags : uint16
{
_ai_conversation_line_look_at_speaker_bit = 0,
_ai_conversation_line_everyone_look_at_speaker_bit = 1,
_ai_conversation_line_everyone_look_at_addressee_bit = 2,
_ai_conversation_line_wait_after_until_told_to_advance_bit = 3,
_ai_conversation_line_wait_until_speaker_nearby_bit = 4,
_ai_conversation_line_wait_until_everyone_nearby_bit = 5,
k_number_of_conversation_line_flags
};

enum e_conversation_line_addressee : short
{
conversation_line_addressee_none = 0,
conversation_line_addressee_player = 1,
conversation_line_addressee_participant = 2
};

/* structures */

// max count: 1
struct ai_scene_trigger
{
ai_scene_role_group_group1 = 0,
ai_scene_role_group_group2 = 1,
ai_scene_role_group_group3 = 2
e_combination_rule combination_rule;
int16 pad;
tag_block<order_trigger_reference> triggers;
};
ASSERT_STRUCT_SIZE(ai_scene_trigger, 12);

// max count: k_max_variants_per_line 10
struct ai_scene_role_variant
{
string_id variant_designation;
string_id variant_designation;
};
ASSERT_STRUCT_SIZE(ai_scene_role_variant, 4);

// max count: k_max_roles_per_scene 10
struct ai_scene_role
{
string_id name;
e_ai_scene_role_group group;
short pad;
tag_block<ai_scene_role_variant> role_variants;
string_id name;
e_ai_scene_role_group group;
int16 pad;
tag_block<ai_scene_role_variant> role_variants;
};
ASSERT_STRUCT_SIZE(ai_scene_role, 16);

// max count: k_max_scenes_per_scenario 100
struct ai_scene
{
string_id name;
e_ai_scene_flags flags;
tag_block<ai_scene_trigger> trigger_conditions;
tag_block<ai_scene_role> roles;
string_id name;
c_flags_no_init<e_ai_scene_flags, uint32, k_ai_scene_flag_count> flags;
tag_block<ai_scene_trigger> trigger_conditions;
tag_block<ai_scene_role> roles;
};
ASSERT_STRUCT_SIZE(ai_scene, 24);

enum e_ai_conversation_flags : short
{
ai_conversation_flag_stop_if_death = FLAG(0), // This Conversation Will Be Aborted If Any Participant Dies
ai_conversation_flag_stop_if_damaged = FLAG(1), // An Actor Will Abort This Conversation If They Are Damaged
ai_conversation_flag_stop_if_visible_enemy = FLAG(2), // An Actor Will Abort This Conversation If They See An Enemy
ai_conversation_flag_stop_if_alerted_to_enemy = FLAG(3), // An Actor Will Abort This Conversation If They Suspect An Enemy
ai_conversation_flag_player_must_be_visible = FLAG(4), // This Conversation Cannot Take Place Unless The Participants Can See A Nearby Player
ai_conversation_flag_stop_other_actions = FLAG(5), // Participants Stop Doing Whatever They Were Doing In Order To Perform This Conversation
ai_conversation_flag_keep_trying_to_play = FLAG(6), // If This Conversation Fails Initially It Will Keep Testing To See When It Can Play
ai_conversation_flag_player_must_be_looking = FLAG(7) // This Conversation Will Not Start Until The Player Is Looking At One Of The Participants
};

// max count: 8
struct ai_conversation_participant
{
int pad[2];

// if a unit with this name exists, we try to pick them to start the conversation
// Block index: scenario_object_names_block
short use_this_object;
// once we pick a unit, we name it this
// Block index: scenario_object_names_block
short set_new_name;

int pad1[6];
static_string32 encounter_name;
int pad2[4];
uint16 pad;
uint16 flags;

int16 selection_type;
int16 actor_type;

// if a unit with this name exists, we try to pick them to start the conversation
// Block index: scenario_object_names_block
int16 preexisting_object_name_index;
// once we pick a unit, we name it this
// Block index: scenario_object_names_block
int16 new_attach_object_name_index;

uint32 unused[3];
int16 dialogue_variants[6];
char ai_index_name[32];
int32 runtime_ai_index;
uint32 unused2[3];
};
ASSERT_STRUCT_SIZE(ai_conversation_participant, 84);

enum e_ai_conversation_line_flags : short
{
ai_conversation_line_flag_addressee_look_at_speaker = FLAG(0),
ai_conversation_line_flag_everyone_look_at_speaker = FLAG(1),
ai_conversation_line_flag_everyone_look_at_addressee = FLAG(2),
ai_conversation_line_flag_wait_after_until_told_to_advance = FLAG(3),
ai_conversation_line_flag_wait_until_speaker_nearby = FLAG(4),
ai_conversation_line_flag_wait_until_everyone_nearby = FLAG(5)
};

enum e_conversation_line_addressee : short
{
conversation_line_addressee_none = 0,
conversation_line_addressee_player = 1,
conversation_line_addressee_participant = 2
};

// max count: 32
struct ai_conversation_line
{
e_ai_conversation_line_flags flags;
short participant; // Block index: ai_conversation_participant
e_conversation_line_addressee addressee;

// this field is only used if the addressee type is 'participant'
// Block index: ai_conversation_participant
short addressee_participant;
int pad;
float line_delay_time;
int pad1[3];
tag_reference variant_1; // snd!
tag_reference variant_2; // snd!
tag_reference variant_3; // snd!
tag_reference variant_4; // snd!
tag_reference variant_5; // snd!
tag_reference variant_6; // snd!
c_flags_no_init<e_ai_conversation_line_flags, uint16, k_number_of_conversation_line_flags> flags;
int16 participant_index; // Block index: ai_conversation_participant
e_conversation_line_addressee address_type;

// this field is only used if the addressee type is 'participant'
// Block index: ai_conversation_participant
int16 address_participant_index;
uint32 unused;
real32 delay_time;
uint32 unused2[3];
tag_reference dialogue[6]; // snd!
};
ASSERT_STRUCT_SIZE(ai_conversation_participant, 84);

// max count: 128
struct ai_conversation
{
static_string32 name;
e_ai_conversation_flags flags;
short pad;
float trigger_distance_world_units; // distance the player must enter before the conversation can trigger
float run_to_player_distance_world_units; // if the 'involves player' flag is set, when triggered the conversation's participant(s) will run to within this distance of the player

tag_block<ai_conversation_participant> participants;
tag_block<ai_conversation_line> lines;
tag_block<> null_tagblock;
char name[32];
c_flags_no_init<e_ai_conversation_flags, uint16, k_number_of_conversation_definition_flags> flags;
uint16 pad;

real32 trigger_dist; // (World Units) distance the player must enter before the conversation can trigger
real32 run_to_player_dist; // (World Units) if the 'involves player' flag is set, when triggered the conversation's participant(s) will run to within this distance of the player

tag_block<ai_conversation_participant> participants;
tag_block<ai_conversation_line> lines;
tag_block<> null_tagblock;
};
ASSERT_STRUCT_SIZE(ai_scene, 24);

// max count: k_max_variants_per_line
struct mission_dialogue_variant
{
string_id variant; // 3-letter designation for the character^
tag_reference sound; // snd!
string_id sound_effect;
};
ASSERT_STRUCT_SIZE(mission_dialogue_variant, 16);

// max count: k_max_lines_per_scenario
struct mission_dialogue_line
{
string_id name;
tag_block<mission_dialogue_variant> variants;
string_id default_sound_effect;
};
ASSERT_STRUCT_SIZE(mission_dialogue_line, 16);

// max count: 1
struct ai_mission_dialogue
{
tag_block<mission_dialogue_line> lines;
};
ASSERT_STRUCT_SIZE(ai_mission_dialogue, 8);
2 changes: 1 addition & 1 deletion xlive/Blam/Engine/camera/first_person_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void __cdecl first_person_camera_build_observer_command(datum player_unit_index,
unit_datum* vehicle_unit = (unit_datum*)object_try_and_get_and_verify_type(player_unit->object.parent_object_index, _object_type_vehicle);
if(vehicle_unit)
{
_vehicle_definition* vehicle_definition = (_vehicle_definition*)tag_get_fast(vehicle_unit->object.tag_definition_index);
struct vehicle_definition* vehicle_definition = (struct vehicle_definition*)tag_get_fast(vehicle_unit->object.tag_definition_index);

if(vehicle_definition->unit.seats[player_unit->parent_seat_index]->flags.test(_unit_seat_definition_first_person_camera_slaved_to_gun))
{
Expand Down
Loading

0 comments on commit 5854c57

Please sign in to comment.