mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-18 01:00:26 +02:00
Match actor type dispatch object
This commit is contained in:
1 parent
983b979e7f
commit
d2f32b0309
15 files changed
+245
-19
No files matched your search
+1
-1
@@ -810,7 +810,7 @@
|
||||
{ "name": "source/ai/ai_communication.c", "index": 436, "status": "NonMatching" },
|
||||
{ "name": "source/ai/ai.c", "index": 437, "status": "NonMatching" },
|
||||
{ "name": "source/ai/actors.c", "index": 438, "status": "NonMatching" },
|
||||
{ "name": "source/ai/actor_types.c", "index": 439, "status": "NonMatching" },
|
||||
{ "name": "source/ai/actor_types.c", "index": 439, "status": "Matching" },
|
||||
{ "name": "source/ai/actor_type_sentinel.c", "index": 440, "status": "Matching" },
|
||||
{ "name": "source/ai/actor_type_mounted_weapon.c", "index": 441, "status": "Matching" },
|
||||
{ "name": "source/ai/actor_type_marine.c", "index": 442, "status": "Matching" },
|
||||
|
||||
@@ -41,7 +41,8 @@ struct actor_type_definition actor_type_carrier =
|
||||
2,
|
||||
1,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
carrier_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -40,7 +40,8 @@ struct actor_type_definition actor_type_crew =
|
||||
0,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
crew_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -41,7 +41,8 @@ struct actor_type_definition actor_type_elite =
|
||||
1,
|
||||
1,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
elite_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -40,7 +40,8 @@ struct actor_type_definition actor_type_engineer =
|
||||
0,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
engineer_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -53,7 +53,8 @@ struct actor_type_definition actor_type_flood =
|
||||
0,
|
||||
1,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
flood_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -42,7 +42,8 @@ __declspec(align(4)) struct actor_type_definition actor_type_grunt=
|
||||
0,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
grunt_decide_action,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -39,7 +39,8 @@ struct actor_type_definition actor_type_hunter =
|
||||
1,
|
||||
1,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
hunter_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -60,7 +60,10 @@ void infection_decide_action(
|
||||
void code_00027470(
|
||||
long actor_index);
|
||||
void infection_swarm_aim_jump(
|
||||
long actor_index);
|
||||
long actor_index,
|
||||
void *arg1,
|
||||
void *arg2,
|
||||
void *arg3);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -71,9 +74,10 @@ struct actor_type_definition actor_type_infection =
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
256,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
0,
|
||||
TRUE,
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
infection_decide_action,
|
||||
code_00027470,
|
||||
infection_swarm_aim_jump
|
||||
|
||||
@@ -41,7 +41,8 @@ struct actor_type_definition actor_type_jackal =
|
||||
2,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
jackal_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -40,7 +40,8 @@ struct actor_type_definition actor_type_marine =
|
||||
0,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
marine_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -37,7 +37,8 @@ struct actor_type_definition actor_type_mounted_weapon =
|
||||
2,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
mounted_weapon_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -40,7 +40,8 @@ struct actor_type_definition actor_type_sentinel =
|
||||
0,
|
||||
0,
|
||||
FALSE,
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0 },
|
||||
NULL,
|
||||
sentinel_decide_action,
|
||||
NULL,
|
||||
NULL
|
||||
|
||||
@@ -71,16 +71,195 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
|
||||
#include "actors.h"
|
||||
#include "actor_types.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define actor_type_definitions data_002b6c68
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes */
|
||||
|
||||
static struct actor_type_definition *code_00028c10(
|
||||
short actor_type);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
extern struct actor_type_definition actor_type_elite;
|
||||
extern struct actor_type_definition actor_type_jackal;
|
||||
extern struct actor_type_definition actor_type_grunt;
|
||||
extern struct actor_type_definition actor_type_hunter;
|
||||
extern struct actor_type_definition actor_type_engineer;
|
||||
extern struct actor_type_definition actor_type_marine;
|
||||
extern struct actor_type_definition actor_type_crew;
|
||||
extern struct actor_type_definition actor_type_flood;
|
||||
extern struct actor_type_definition actor_type_infection;
|
||||
extern struct actor_type_definition actor_type_carrier;
|
||||
extern struct actor_type_definition actor_type_sentinel;
|
||||
extern struct actor_type_definition actor_type_mounted_weapon;
|
||||
|
||||
struct actor_type_definition *data_002b6c68[NUMBER_OF_ACTOR_TYPES] =
|
||||
{
|
||||
&actor_type_elite,
|
||||
&actor_type_jackal,
|
||||
&actor_type_grunt,
|
||||
&actor_type_hunter,
|
||||
&actor_type_engineer,
|
||||
&actor_type_elite,
|
||||
&actor_type_marine,
|
||||
&actor_type_marine,
|
||||
&actor_type_crew,
|
||||
&actor_type_flood,
|
||||
&actor_type_infection,
|
||||
&actor_type_carrier,
|
||||
&actor_type_sentinel,
|
||||
&actor_type_sentinel,
|
||||
&actor_type_grunt,
|
||||
&actor_type_mounted_weapon
|
||||
};
|
||||
|
||||
const char *global_actor_type_names[NUMBER_OF_ACTOR_TYPES] =
|
||||
{
|
||||
"elite",
|
||||
"jackal",
|
||||
"grunt",
|
||||
"hunter",
|
||||
"engineer",
|
||||
"assassin",
|
||||
"player",
|
||||
"marine",
|
||||
"crew",
|
||||
"combat_form",
|
||||
"infection_form",
|
||||
"carrier_form",
|
||||
"monitor",
|
||||
"sentinel",
|
||||
"none",
|
||||
"mounted_weapon"
|
||||
};
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void actor_types_initialize(
|
||||
void)
|
||||
{
|
||||
short actor_type;
|
||||
|
||||
for (actor_type = 0; actor_type < NUMBER_OF_ACTOR_TYPES; actor_type++)
|
||||
code_00028c10(actor_type);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const char *actor_type_get_name(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->name;
|
||||
}
|
||||
|
||||
short actor_type_get_race(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->race;
|
||||
}
|
||||
|
||||
short actor_type_get_when_to_search_at_target(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->when_to_search_at_target;
|
||||
}
|
||||
|
||||
short actor_type_get_when_to_pursue(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->when_to_pursue;
|
||||
}
|
||||
|
||||
short actor_type_get_when_to_search_pursuit(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->when_to_search_pursuit;
|
||||
}
|
||||
|
||||
byte actor_type_get_pursuit_controller(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->pursuit_controller;
|
||||
}
|
||||
|
||||
boolean actor_type_get_swarm(
|
||||
short actor_type)
|
||||
{
|
||||
return code_00028c10(actor_type)->swarm;
|
||||
}
|
||||
|
||||
void actor_type_initialize(
|
||||
long actor_index)
|
||||
{
|
||||
struct actor_type_definition *actor_type_definition = code_00028c10(actor_get(actor_index)->meta.type);
|
||||
|
||||
if (actor_type_definition->initialize)
|
||||
actor_type_definition->initialize(actor_index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void actor_type_decide_action(
|
||||
long actor_index)
|
||||
{
|
||||
struct actor_type_definition *actor_type_definition = code_00028c10(actor_get(actor_index)->meta.type);
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\ai\\actor_types.c", 129, actor_type_definition->decide_action);
|
||||
actor_type_definition->decide_action(actor_index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void actor_type_swarm_control(
|
||||
long actor_index)
|
||||
{
|
||||
struct actor_type_definition *actor_type_definition = code_00028c10(actor_get(actor_index)->meta.type);
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\ai\\actor_types.c", 141, actor_type_definition->swarm);
|
||||
match_assert("c:\\halo\\SOURCE\\ai\\actor_types.c", 142, actor_type_definition->swarm_control);
|
||||
actor_type_definition->swarm_control(actor_index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void actor_type_swarm_aim_jump(
|
||||
long actor_index,
|
||||
void *arg1,
|
||||
void *arg2,
|
||||
void *arg3)
|
||||
{
|
||||
struct actor_type_definition *actor_type_definition = code_00028c10(actor_get(actor_index)->meta.type);
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\ai\\actor_types.c", 157, actor_type_definition->swarm);
|
||||
if (actor_type_definition->swarm_aim_jump)
|
||||
actor_type_definition->swarm_aim_jump(actor_index, arg1, arg2, arg3);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
|
||||
static struct actor_type_definition *code_00028c10(
|
||||
short actor_type)
|
||||
{
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 46, actor_type>=0 && actor_type<NUMBER_OF_ACTOR_TYPES);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 47, actor_type_definitions[actor_type]);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 50, actor_type_definitions[actor_type]->name);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 51, actor_type_definitions[actor_type]->decide_action);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 53, actor_type_definitions[actor_type]->when_to_search_at_target < NUMBER_OF_ACTOR_PURSUIT_SETTINGS);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 54, actor_type_definitions[actor_type]->when_to_pursue < NUMBER_OF_ACTOR_PURSUIT_SETTINGS);
|
||||
match_assert("c:\\halo\\source\\ai\\actor_type_definitions.h", 55, actor_type_definitions[actor_type]->when_to_search_pursuit < NUMBER_OF_ACTOR_PURSUIT_SETTINGS);
|
||||
|
||||
return actor_type_definitions[actor_type];
|
||||
}
|
||||
+35
-3
@@ -29,15 +29,21 @@ enum
|
||||
_actor_none,
|
||||
_actor_mounted_weapon,
|
||||
NUMBER_OF_ACTOR_TYPES,
|
||||
NUMBER_OF_ACTOR_PURSUIT_SETTINGS = 3,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
typedef void (*actor_initialize_proc)(long actor_index);
|
||||
typedef void (*actor_decide_action_proc)(long actor_index);
|
||||
typedef void (*actor_swarm_control_proc)(long actor_index);
|
||||
typedef void (*actor_swarm_aim_jump_proc)(long actor_index);
|
||||
typedef void (*actor_swarm_aim_jump_proc)(
|
||||
long actor_index,
|
||||
void *arg1,
|
||||
void *arg2,
|
||||
void *arg3);
|
||||
|
||||
struct actor_type_definition
|
||||
{
|
||||
@@ -46,9 +52,10 @@ struct actor_type_definition
|
||||
short when_to_search_at_target;
|
||||
short when_to_pursue;
|
||||
short when_to_search_pursuit;
|
||||
long pursuit_controller;
|
||||
byte pursuit_controller;
|
||||
boolean swarm;
|
||||
byte pad[3];
|
||||
byte pad[2];
|
||||
actor_initialize_proc initialize;
|
||||
actor_decide_action_proc decide_action;
|
||||
actor_swarm_control_proc swarm_control;
|
||||
actor_swarm_aim_jump_proc swarm_aim_jump;
|
||||
@@ -58,6 +65,31 @@ struct actor_type_definition
|
||||
|
||||
void actor_types_initialize(
|
||||
void);
|
||||
const char *actor_type_get_name(
|
||||
short actor_type);
|
||||
short actor_type_get_race(
|
||||
short actor_type);
|
||||
short actor_type_get_when_to_search_at_target(
|
||||
short actor_type);
|
||||
short actor_type_get_when_to_pursue(
|
||||
short actor_type);
|
||||
short actor_type_get_when_to_search_pursuit(
|
||||
short actor_type);
|
||||
byte actor_type_get_pursuit_controller(
|
||||
short actor_type);
|
||||
boolean actor_type_get_swarm(
|
||||
short actor_type);
|
||||
void actor_type_initialize(
|
||||
long actor_index);
|
||||
void actor_type_decide_action(
|
||||
long actor_index);
|
||||
void actor_type_swarm_control(
|
||||
long actor_index);
|
||||
void actor_type_swarm_aim_jump(
|
||||
long actor_index,
|
||||
void *arg1,
|
||||
void *arg2,
|
||||
void *arg3);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
Reference in new issue
Block a user