Set names for remaining chraction.c functions

This commit is contained in:
Ryan Dwyer 2025-02-10 18:32:05 +10:00
parent c44895b2b2
commit e9768fa727
17 changed files with 843 additions and 762 deletions

View File

@ -605,7 +605,7 @@ struct prop *body_instantiate_eyespy(struct pad *pad, RoomNum room)
chr->convtalk = 0;
chr->radius = 26;
chr->height = 200;
func0f02e9a0(chr, 0);
chr_stand_immediate(chr, 0);
chr->chrflags |= CHRCFLAG_HIDDEN;
#if VERSION >= VERSION_NTSC_1_0

View File

@ -325,7 +325,7 @@ void bbike0f0d2b40(struct defaultobj *bike, struct coord *arg1, f32 arg2, struct
sp54.y = obstacle->prop->pos.y - bike->prop->pos.y;
sp54.z = obstacle->prop->pos.z - bike->prop->pos.z;
func0f02e3dc(&sp78, &sp6c, &sp60, &sp54, &sp9c);
chr_calculate_push_contact_pos(&sp78, &sp6c, &sp60, &sp54, &sp9c);
sp90.x = arg1->f[0];
sp90.y = 0;

View File

@ -200,7 +200,7 @@ void bgrab0f0ccbf0(struct coord *delta, f32 angle, struct defaultobj *obj)
spc8.z = 1.0f;
}
func0f02e3dc(&spb0, &spa4, &sp98, &spc8, &spd4);
chr_calculate_push_contact_pos(&spb0, &spa4, &sp98, &spc8, &spd4);
spbc.x = (sp98.x - g_Vars.currentplayer->prop->pos.x) / g_Vars.lvupdate60freal;
spbc.y = 0.0f;
@ -236,7 +236,7 @@ void bgrab0f0ccbf0(struct coord *delta, f32 angle, struct defaultobj *obj)
sp44.z = obj->prop->pos.z - var8009de70->pos.z;
}
func0f02e3dc(&sp68, &sp5c, &sp50, &sp44, &sp8c);
chr_calculate_push_contact_pos(&sp68, &sp5c, &sp50, &sp44, &sp8c);
sp80.x = delta->x;
sp80.y = 0.0f;

View File

@ -144,8 +144,8 @@ void bwalk0f0c3b38(struct coord *reltarget, struct defaultobj *obj)
struct coord posunk;
struct coord vector;
struct coord tween;
struct coord globalthinga;
struct coord globalthingb;
struct coord edge1;
struct coord edge2;
struct coord abstarget;
abstarget.x = reltarget->x + g_Vars.currentplayer->prop->pos.x;
@ -153,14 +153,14 @@ void bwalk0f0c3b38(struct coord *reltarget, struct defaultobj *obj)
abstarget.z = reltarget->z + g_Vars.currentplayer->prop->pos.z;
#if VERSION >= VERSION_NTSC_1_0
cd_get_edge(&globalthinga, &globalthingb, 223, "bondwalk.c");
cd_get_edge(&edge1, &edge2, 223, "bondwalk.c");
#else
cd_get_edge(&globalthinga, &globalthingb, 221, "bondwalk.c");
cd_get_edge(&edge1, &edge2, 221, "bondwalk.c");
#endif
vector.x = globalthingb.z - globalthinga.z;
vector.x = edge2.z - edge1.z;
vector.y = 0;
vector.z = globalthinga.x - globalthingb.x;
vector.z = edge1.x - edge2.x;
if (vector.f[0] != 0 || vector.f[2] != 0) {
guNormalize(&vector.x, &vector.y, &vector.z);
@ -168,7 +168,7 @@ void bwalk0f0c3b38(struct coord *reltarget, struct defaultobj *obj)
vector.z = 1;
}
func0f02e3dc(&globalthinga, &globalthingb, &abstarget, &vector, &posunk);
chr_calculate_push_contact_pos(&edge1, &edge2, &abstarget, &vector, &posunk);
tween.x = (abstarget.x - g_Vars.currentplayer->prop->pos.x) / g_Vars.lvupdate60freal;
tween.y = 0;

View File

@ -288,13 +288,15 @@ void bot_spawn(struct chrdata *chr, u8 respawning)
thing = scenario_choose_spawn_location(chr->radius, &pos, rooms, chr->prop);
chr->hidden |= CHRHFLAG_WARPONSCREEN;
chr_move_to_pos(chr, &pos, rooms, thing, true);
chr->aibot->roty = model_get_chr_rot_y(chr->model);
chr->aibot->angleoffset = 0;
chr->aibot->speedtheta = 0;
chr->aibot->lookangle = model_get_chr_rot_y(chr->model);
chr->aibot->moveratex = 0;
chr->aibot->moveratey = 0;
func0f02e9a0(chr, 0);
chr_stand_immediate(chr, 0);
}
}
@ -864,7 +866,7 @@ bool bot_is_about_to_attack(struct chrdata *chr, bool arg1)
if (!arg1
&& (chr->aibot->config->difficulty == BOTDIFF_MEAT || chr->aibot->config->difficulty == BOTDIFF_EASY)
&& !chr_go_pos_is_waiting(chr)) {
&& !chr_gopos_is_waiting(chr)) {
f32 tmp = chr_get_rot_y(chr);
f32 angle = atan2f(target->pos.x - chr->prop->pos.x, target->pos.z - chr->prop->pos.z) - tmp;
@ -1038,9 +1040,9 @@ s32 bot_tick(struct prop *prop)
bool left = chr->weapons_held[HAND_LEFT] ? true : false;
bool right = (0, chr->weapons_held[HAND_RIGHT] ? true : false);
func0f03e9f4(chr, aibot->attackanimconfig, left, right, 0);
chr_calculate_aimend(chr, aibot->attackanimconfig, left, right, 0);
} else {
chr_reset_aim_end_properties(chr);
chr_reset_aimend(chr);
}
if (chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD) {

View File

@ -343,7 +343,7 @@ void botact_throw(struct chrdata *chr)
struct coord sp152;
struct prop *prop = chr->prop;
Mtxf sp84;
f32 sp80 = chr_get_aim_angle(chr);
f32 sp80 = chr_get_aimx_angle(chr);
u32 stack;
struct gset gset = {0};
struct prop *target = chr_get_target_prop(chr);
@ -504,8 +504,8 @@ void botact_create_slayer_rocket(struct chrdata *chr)
f32 xrot;
struct coord sp100;
yrot = chr_get_aim_angle(chr);
xrot = chr_get_pitch_angle(chr);
yrot = chr_get_aimx_angle(chr);
xrot = chr_get_aimy_angle(chr);
sp100.x = cosf(xrot) * sinf(yrot);
sp100.y = sinf(xrot);

View File

@ -1502,7 +1502,10 @@ f32 chrs_get_anim_speed(void)
return g_ChrsAnimSpeed;
}
void chr_update_aim_properties(struct chrdata *chr)
/**
* Tween the chr's aim properties towards their aimend properties.
*/
void chr_tween_aim(struct chrdata *chr)
{
if (chr->aimendcount >= 2) {
f32 mult = g_Vars.lvupdate60f / chr->aimendcount;
@ -1826,7 +1829,7 @@ void chr_handle_joint_positioned(s32 joint, Mtxf *mtx)
f32 aimangle;
Mtxf tmpmtx;
aimangle = chr_get_aim_angle(g_CurModelChr);
aimangle = chr_get_aimx_angle(g_CurModelChr);
if (xrot < 0.0f) {
xrot = -xrot;
@ -2635,7 +2638,7 @@ s32 chr_tick(struct prop *prop)
#endif
}
chr_update_aim_properties(chr);
chr_tween_aim(chr);
}
if (prop->pos.y < -65536) {
@ -2894,7 +2897,7 @@ s32 chr_tick(struct prop *prop)
chr->hidden &= ~CHRHFLAG_DROPPINGITEM;
}
func0f041a74(chr);
chr_tick_shots(chr);
}
return TICKOP_NONE;

File diff suppressed because it is too large Load Diff

View File

@ -329,7 +329,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x013b*/ ai_set_squadron,
/*0x013c*/ ai_face_cover,
/*0x013d*/ ai_if_dangerous_object_nearby,
/*0x013e*/ ai013e,
/*0x013e*/ ai_run_from_grenade,
/*0x013f*/ ai_if_heli_weapons_armed,
/*0x0140*/ ai_if_hoverbot_next_step,
/*0x0141*/ ai_shuffle_investigation_terminals,

View File

@ -430,7 +430,7 @@ bool ai_chr_do_animation(void)
chr->prop->propupdate240 = 0;
}
chr_try_start_anim(chr, anim_id, fstartframe, fendframe, cmd[8], cmd[9], speed);
chr_try_anim(chr, anim_id, fstartframe, fendframe, cmd[8], cmd[9], speed);
if (startframe == 0xfffe) {
chr_update_anim(chr, 1, true);
@ -474,7 +474,7 @@ bool func0f04e418(void)
*/
bool ai_be_surprised_one_hand(void)
{
chr_try_surprised_one_hand(g_Vars.chrdata);
chr_try_surprised_onehand(g_Vars.chrdata);
g_Vars.aioffset += 2;
return false;
@ -485,7 +485,7 @@ bool ai_be_surprised_one_hand(void)
*/
bool ai_be_surprised_look_around(void)
{
chr_try_surprised_look_around(g_Vars.chrdata);
chr_try_surprised_lookaround(g_Vars.chrdata);
g_Vars.aioffset += 2;
return false;
@ -605,7 +605,7 @@ bool ai_try_sidestep(void)
*/
bool ai_try_jump_out(void)
{
if (chr_try_jump_out(g_Vars.chrdata)) {
if (chr_try_jumpout(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -620,7 +620,7 @@ bool ai_try_jump_out(void)
*/
bool ai_try_run_sideways(void)
{
if (chr_try_run_sideways(g_Vars.chrdata)) {
if (chr_try_runsideways(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -635,7 +635,7 @@ bool ai_try_run_sideways(void)
*/
bool ai_try_attack_walk(void)
{
if (chr_try_attack_walk(g_Vars.chrdata)) {
if (chr_try_attackwalk(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -650,7 +650,7 @@ bool ai_try_attack_walk(void)
*/
bool ai_try_attack_run(void)
{
if (chr_try_attack_run(g_Vars.chrdata)) {
if (chr_try_attackrun(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -665,7 +665,7 @@ bool ai_try_attack_run(void)
*/
bool ai_try_attack_roll(void)
{
if (chr_try_attack_roll(g_Vars.chrdata)) {
if (chr_try_attackroll(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -684,7 +684,7 @@ bool ai_try_attack_stand(void)
u32 thingid = cmd[5] | (cmd[4] << 8);
u32 thingtype = cmd[3] | (cmd[2] << 8);
if (chr_try_attack_stand(g_Vars.chrdata, thingtype, thingid)) {
if (chr_try_attackstand(g_Vars.chrdata, thingtype, thingid)) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[6]);
} else {
g_Vars.aioffset += 7;
@ -702,7 +702,7 @@ bool ai_try_attack_kneel(void)
u32 thingid = cmd[5] | (cmd[4] << 8);
u32 thingtype = cmd[3] | (cmd[2] << 8);
if (chr_try_attack_kneel(g_Vars.chrdata, thingtype, thingid)) {
if (chr_try_attackkneel(g_Vars.chrdata, thingtype, thingid)) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[6]);
} else {
g_Vars.aioffset += 7;
@ -720,7 +720,7 @@ bool ai_try_attack_lie(void)
u32 thingid = cmd[5] | (cmd[4] << 8);
u32 thingtype = cmd[3] | (cmd[2] << 8);
if (chr_try_attack_lie(g_Vars.chrdata, thingtype, thingid)) {
if (chr_try_attacklie(g_Vars.chrdata, thingtype, thingid)) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[6]);
} else {
g_Vars.aioffset += 7;
@ -772,7 +772,7 @@ bool ai_try_modify_attack(void)
u32 thingid = cmd[5] | (cmd[4] << 8);
u32 thingtype = cmd[3] | (cmd[2] << 8);
if ((g_Vars.chrdata && chr_try_modify_attack(g_Vars.chrdata, thingtype, thingid)) ||
if ((g_Vars.chrdata && chr_try_modifyattack(g_Vars.chrdata, thingtype, thingid)) ||
(g_Vars.hovercar && chopper_attack(g_Vars.hovercar))) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[6]);
} else {
@ -937,7 +937,7 @@ bool ai_try_start_alarm(void)
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
u16 pad_id = cmd[3] | (cmd[2] << 8);
if (chr_try_start_alarm(g_Vars.chrdata, pad_id)) {
if (chr_try_startalarm(g_Vars.chrdata, pad_id)) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
} else {
g_Vars.aioffset += 5;
@ -1561,7 +1561,7 @@ bool ai_if_target_aiming_at_me(void)
*/
bool ai_if_near_miss(void)
{
if (chr_reset_near_miss(g_Vars.chrdata)) {
if (chr_reset_nearmiss(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
@ -1629,7 +1629,7 @@ bool ai_if_check_fov_with_target(void)
if (cmd[4] == 0) {
if (cmd[3]) {
pass = chr_is_in_targets_fov_x(g_Vars.chrdata, cmd[2]);
pass = chr_is_in_targets_fovx(g_Vars.chrdata, cmd[2]);
} else {
pass = chr_is_vertical_angle_to_target_within(g_Vars.chrdata, cmd[2]);
}
@ -2646,7 +2646,7 @@ bool ai_if_num_close_arghs_less_than(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
if (chr_get_num_close_arghs(g_Vars.chrdata) < cmd[2]) {
if (chr_get_num_closearghs(g_Vars.chrdata) < cmd[2]) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[3]);
} else {
g_Vars.aioffset += 4;
@ -2662,7 +2662,7 @@ bool ai_if_num_close_arghs_greater_than(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
if (chr_get_num_close_arghs(g_Vars.chrdata) > cmd[2]) {
if (chr_get_num_closearghs(g_Vars.chrdata) > cmd[2]) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[3]);
} else {
g_Vars.aioffset += 4;
@ -7225,25 +7225,25 @@ bool ai_set_team_orders(void)
switch (chractions[0].myaction) {
case MA_COVERGOTO:
if (!chr_is_in_targets_fov_x(chr, 45)) {
if (!chr_is_in_targets_fovx(chr, 45)) {
chr->orders = MA_SHOOTING;
}
break;
case MA_COVERBREAK:
if (!chr_is_in_targets_fov_x(chr, 30)) {
if (!chr_is_in_targets_fovx(chr, 30)) {
chr->orders = MA_SHOOTING;
}
num++;
break;
case MA_COVERSEEN:
if (!chr_is_in_targets_fov_x(chr, 30)) {
if (!chr_is_in_targets_fovx(chr, 30)) {
chr->orders = MA_SHOOTING;
g_Vars.chrdata->orders = MA_COVERGOTO;
}
num++;
break;
case MA_FLANKLEFT:
if (chr_is_in_targets_fov_x(chr, 50)) {
if (chr_is_in_targets_fovx(chr, 50)) {
chr->orders = MA_FLANKRIGHT;
} else {
chr->orders = MA_SHOOTING;
@ -7252,7 +7252,7 @@ bool ai_set_team_orders(void)
g_Vars.chrdata->orders = MA_FLANKLEFT;
break;
case MA_FLANKRIGHT:
if (chr_is_in_targets_fov_x(chr, 50)) {
if (chr_is_in_targets_fovx(chr, 50)) {
chr->orders = MA_FLANKLEFT;
} else {
chr->orders = MA_SHOOTING;
@ -7261,7 +7261,7 @@ bool ai_set_team_orders(void)
g_Vars.chrdata->orders = MA_FLANKRIGHT;
break;
case MA_DODGE:
if (!chr_is_in_targets_fov_x(chr, 30) &&
if (!chr_is_in_targets_fovx(chr, 30) &&
chr_has_flag_by_id(chr, CHR_SELF, CHRFLAG0_CAN_BACKOFF, BANK_0)) {
chr->orders = MA_WITHDRAW;
} else {
@ -7278,7 +7278,7 @@ bool ai_set_team_orders(void)
num++;
break;
case MA_WAITSEEN:
if (chr_is_in_targets_fov_x(chr, 30) &&
if (chr_is_in_targets_fovx(chr, 30) &&
chr_has_flag_by_id(chr, CHR_SELF, CHRFLAG0_CAN_BACKOFF, BANK_0)) {
chr->orders = MA_WITHDRAW;
} else {
@ -7522,10 +7522,12 @@ bool ai_if_dangerous_object_nearby(void)
/**
* @cmd 013e
*/
bool ai013e(void)
bool ai_run_from_grenade(void)
{
if (func0f03aca0(g_Vars.chrdata, 400, true) == 0 && chr_assign_cover_away_from_danger(g_Vars.chrdata, 1000, 12000) != -1) {
chr_go_to_cover(g_Vars.chrdata, GOPOSFLAG_RUN);
if (!chr_go_to_cover_opposite_runfrompos(g_Vars.chrdata, 400, true)) {
if (chr_assign_cover_away_from_danger(g_Vars.chrdata, 1000, 12000) != -1) {
chr_go_to_cover(g_Vars.chrdata, GOPOSFLAG_RUN);
}
}
g_Vars.aioffset += 2;
@ -8308,7 +8310,7 @@ bool ai_if_target_is_player(void)
bool ai0184(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
chr_try_attack_amount(g_Vars.chrdata, 512, 0, cmd[2], cmd[3]);
chr_try_attackamount(g_Vars.chrdata, 512, 0, cmd[2], cmd[3]);
g_Vars.aioffset += 4;
return false;
@ -8494,7 +8496,7 @@ bool ai_mini_skedar_try_pounce(void)
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
u16 thing = cmd[4] | (cmd[3] << 8);
if (chr_try_sk_jump(g_Vars.chrdata, g_Vars.chrdata->pouncebits, cmd[2], thing, cmd[5])) {
if (chr_try_skjump(g_Vars.chrdata, g_Vars.chrdata->pouncebits, cmd[2], thing, cmd[5])) {
g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[6]);
} else {
g_Vars.aioffset += 7;
@ -8791,20 +8793,20 @@ bool ai_do_preset_animation(void)
};
if (cmd[2] == 255) {
chr_try_start_anim(g_Vars.chrdata, anims[7 + (random() % 8)], 0, -1, 0, 15, 0.5);
chr_try_anim(g_Vars.chrdata, anims[7 + (random() % 8)], 0, -1, 0, 15, 0.5);
} else if (cmd[2] == 254) {
struct prop *prop0 = chr_get_held_prop(g_Vars.chrdata, 1);
struct prop *prop1 = chr_get_held_prop(g_Vars.chrdata, 0);
if (weapon_is_one_handed(prop0) || weapon_is_one_handed(prop1)) {
chr_try_start_anim(g_Vars.chrdata, ANIM_FIX_GUN_JAM_EASY, 0, -1, 0, 5, 0.5);
if (weapon_is_onehanded(prop0) || weapon_is_onehanded(prop1)) {
chr_try_anim(g_Vars.chrdata, ANIM_FIX_GUN_JAM_EASY, 0, -1, 0, 5, 0.5);
} else {
chr_try_start_anim(g_Vars.chrdata, ANIM_FIX_GUN_JAM_HARD, 0, -1, 0, 5, 0.5);
chr_try_anim(g_Vars.chrdata, ANIM_FIX_GUN_JAM_HARD, 0, -1, 0, 5, 0.5);
}
} else if (cmd[2] == 3) {
chr_try_start_anim(g_Vars.chrdata, anims[3 + (random() & 1)], 0, -1, 0, 15, 0.5);
chr_try_anim(g_Vars.chrdata, anims[3 + (random() & 1)], 0, -1, 0, 15, 0.5);
} else {
chr_try_start_anim(g_Vars.chrdata, anims[cmd[2]], 0, -1, 0, 15, 0.5);
chr_try_anim(g_Vars.chrdata, anims[cmd[2]], 0, -1, 0, 15, 0.5);
}
g_Vars.aioffset += 3;
@ -9563,7 +9565,7 @@ bool ai_chr_emit_sparks(void)
struct chrdata *chr = chr_find_by_id(g_Vars.chrdata, cmd[2]);
if (chr) {
chr_dr_caroll_emit_sparks(chr);
chr_drcaroll_emit_sparks(chr);
}
g_Vars.aioffset += 3;

View File

@ -899,7 +899,7 @@ bool player_spawn_anti(struct chrdata *hostchr, bool force)
player_tick_chr_body();
model_copy_anim_data(hostchr->model, playerchr->model);
func0f02e9a0(playerchr, 12);
chr_stand_immediate(playerchr, 12);
chrrootrwdata = model_get_node_rw_data(hostchr->model, hostchr->model->definition->rootnode);
playerrootrwdata = model_get_node_rw_data(playerchr->model, playerchr->model->definition->rootnode);
@ -1520,14 +1520,14 @@ void player_tick_chr_body(void)
}
chr->fireslots[0] = bgun_allocate_fireslot();
func0f02e9a0(chr, 0);
chr_stand_immediate(chr, 0);
bmove_update_rooms(g_Vars.currentplayer);
} else {
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
if (chr->model->anim == NULL) {
chr->chrflags |= CHRCFLAG_FORCETOGROUND;
func0f02e9a0(chr, 0);
chr_stand_immediate(chr, 0);
model_set_root_position(g_Vars.currentplayer->model00d4, &g_Vars.currentplayer->prop->pos);
chr_set_theta(g_Vars.currentplayer->prop->chr, turnangle);
bmove_update_rooms(g_Vars.currentplayer);
@ -5368,7 +5368,7 @@ s32 player_tick_third_person(struct prop *prop)
if (model_get_anim_num(chr->model) == animnum) {
if (chr->act_bondmulti.animcfg) {
chr->hidden2 &= ~CHRH2FLAG_AUTOANIM;
chr_calculate_aim_end_properties(chr, chr->act_bondmulti.animcfg, leftprop != NULL, rightprop != NULL, shootrotx);
chr_calculate_aimend_vertical(chr, chr->act_bondmulti.animcfg, leftprop != NULL, rightprop != NULL, shootrotx);
} else {
chr->hidden2 |= CHRH2FLAG_AUTOANIM;
chr->aimendback = shootrotx;

View File

@ -3465,7 +3465,7 @@ bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
sp8c.y = sp80.y - prop->pos.y;
sp8c.z = sp80.z - prop->pos.z;
func0f02e4f8(&prop->pos, &sp8c, arg2);
chr_calculate_push_contact_pos_using_saved_edge(&prop->pos, &sp8c, arg2);
if (prop->pos.x < sp80.x) {
if (arg2->x > sp80.x) {
@ -5761,7 +5761,7 @@ f32 obj_collide(struct defaultobj *movingobj, struct coord *movingvel, f32 rotat
sp4c.z = obstacle->pos.z - movingobj->prop->pos.z;
}
func0f02e3dc(&sp70, &sp64, &sp58, &sp4c, &sp88);
chr_calculate_push_contact_pos(&sp70, &sp64, &sp58, &sp4c, &sp88);
force = 0.5f;
@ -6494,7 +6494,7 @@ s32 projectile_tick(struct defaultobj *obj, bool *embedded)
sp3d0.z = prop->pos.z;
}
func0f02e4f8(&sp3d0, &sp3c4, &sp3b8);
chr_calculate_push_contact_pos_using_saved_edge(&sp3d0, &sp3c4, &sp3b8);
sp3ac.x = prop->pos.x - sp5dc.x;
sp3ac.y = 0.0f;
@ -13381,9 +13381,9 @@ void obj_push(struct defaultobj *obj, struct coord *pos, struct coord *dir, stru
{
struct coord speed = {0, 0, 0};
f32 a = tween->f[0] * dir->f[0] + tween->f[2] * dir->f[2];
f32 b = pos->f[0] - obj->prop->pos.f[0];
f32 c = pos->f[2] - obj->prop->pos.f[2];
f32 d = -b * dir->f[2] + c * dir->f[0];
f32 xdiff = pos->f[0] - obj->prop->pos.f[0];
f32 zdiff = pos->f[2] - obj->prop->pos.f[2];
f32 d = -xdiff * dir->f[2] + zdiff * dir->f[0];
speed.f[0] += a * dir->f[0] * 0.2f;
speed.f[2] += a * dir->f[2] * 0.2f;
@ -19237,7 +19237,7 @@ void doors_calc_frac(struct doorobj *door)
if (isliftdoor) {
if (chr->actiontype == ACT_STAND
|| (chr->actiontype == ACT_ATTACK && (chr->act_attack.flags & ATTACKFLAG_DONTTURN))
|| (chr->actiontype == ACT_GOPOS && chr_go_pos_is_waiting(chr))) {
|| (chr->actiontype == ACT_GOPOS && chr_gopos_is_waiting(chr))) {
struct prop *target = chr_get_target_prop(chr);
if (chr_go_to_room_pos(chr, &target->pos, target->rooms, 0)) {

View File

@ -44,12 +44,12 @@ s32 race_init_anim_group(struct attackanimconfig *configs)
if (config->unk04 > 0) {
if (angle < 32768) {
config->unk08 = angle * (1.0f / (32768 / BADDTOR(180))) / config->unk04;
config->turnangleperframe = angle * (1.0f / (32768 / BADDTOR(180))) / config->unk04;
} else {
config->unk08 = (angle * (1.0f / (32768 / BADDTOR(180))) - BADDTOR(360)) / config->unk04;
config->turnangleperframe = (angle * (1.0f / (32768 / BADDTOR(180))) - BADDTOR(360)) / config->unk04;
}
} else {
config->unk08 = 0;
config->turnangleperframe = 0;
}
config++;

View File

@ -227,7 +227,7 @@ void *vtxstore_allocate(s32 count, s32 type, struct modelnode *node, s32 level)
} else {
rand = random() % corpsecount;
osSyncPrintf("vtxstore: GROSS! CorspeCount > MAX_CORPSES corpses! Freeing corpse %x\n", &corpses[rand]);
chr_fade_corpse_when_off_screen(corpses[rand]);
chr_fade_corpse_when_offscreen(corpses[rand]);
corpses[rand] = chr;
}
}
@ -245,7 +245,7 @@ void *vtxstore_allocate(s32 count, s32 type, struct modelnode *node, s32 level)
if (corpses[i]) {
osSyncPrintf("vtxstore: Freeing corpse %x\n", &corpses[i]);
chr_fade_corpse_when_off_screen(corpses[i]);
chr_fade_corpse_when_offscreen(corpses[i]);
corpses[i] = NULL;
rand--;
}

View File

@ -4,11 +4,11 @@
#include "data.h"
#include "types.h"
bool chr_go_pos_is_waiting(struct chrdata *chr);
bool weapon_is_one_handed(struct prop *prop);
bool chr_gopos_is_waiting(struct chrdata *chr);
bool weapon_is_onehanded(struct prop *prop);
f32 chr_get_attack_entity_distance(struct chrdata *chr, u32 attackflags, s32 entityid);
void func0f02e3dc(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *dst);
void func0f02e4f8(struct coord *arg0, struct coord *arg1, struct coord *dst);
void chr_calculate_push_contact_pos(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *dst);
void chr_calculate_push_contact_pos_using_saved_edge(struct coord *arg0, struct coord *arg1, struct coord *dst);
void chr_stand(struct chrdata *chr);
bool chr_face_cover(struct chrdata *chr);
void chr_begin_death(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hitpart, struct gset *gset, bool knockout, s32 aplayernum);
@ -29,14 +29,14 @@ bool chr_has_los_to_prop(struct chrdata *chr, struct prop *prop);
bool chr_is_stopped(struct chrdata *chr);
bool chr_check_can_see_target(struct chrdata *chr);
bool chr_try_sidestep(struct chrdata *chr);
bool chr_try_jump_out(struct chrdata *chr);
bool chr_try_run_sideways(struct chrdata *chr);
bool chr_try_attack_walk(struct chrdata *chr);
bool chr_try_attack_run(struct chrdata *chr);
bool chr_try_attack_roll(struct chrdata *chr);
bool chr_try_attack_amount(struct chrdata *chr, u32 arg1, u32 arg2, u8 arg3, u8 arg4);
bool chr_try_jumpout(struct chrdata *chr);
bool chr_try_runsideways(struct chrdata *chr);
bool chr_try_attackwalk(struct chrdata *chr);
bool chr_try_attackrun(struct chrdata *chr);
bool chr_try_attackroll(struct chrdata *chr);
bool chr_try_attackamount(struct chrdata *chr, u32 arg1, u32 arg2, u8 arg3, u8 arg4);
bool chr_go_to_pad(struct chrdata *chr, s32 padnum, u32 goposflags);
s32 func0f03aca0(struct chrdata *chr, f32 arg1, u8 arg2);
s32 chr_go_to_cover_opposite_runfrompos(struct chrdata *chr, f32 arg1, u8 arg2);
bool chr_try_run_from_target(struct chrdata *chr);
bool chr_go_to_cover_prop(struct chrdata *chr);
bool chr_drop_item(struct chrdata *chr, u32 modelnum, u32 weaponnum);
@ -45,22 +45,22 @@ bool chr_try_punch(struct chrdata *chr, u8 reverse);
struct eyespy *chr_to_eyespy(struct chrdata *chr);
void chr_update_fireslot(struct chrdata *chr, s32 handnum, bool withsound, bool withbeam, struct coord *from, struct coord *to);
f32 chr_get_theta(struct chrdata *chr);
f32 chr_get_aim_angle(struct chrdata *chr);
f32 chr_get_pitch_angle(struct chrdata *chr);
bool func0f03e9f4(struct chrdata *chr, struct attackanimconfig *animcfg, s32 arg2, s32 arg3, f32 arg4);
void chr_calculate_aim_end_properties(struct chrdata *chr, struct attackanimconfig *animcfg, bool firingleft, bool firingright, f32 shootrotx);
f32 chr_get_aimx_angle(struct chrdata *chr);
f32 chr_get_aimy_angle(struct chrdata *chr);
bool chr_calculate_aimend(struct chrdata *chr, struct attackanimconfig *animcfg, bool hasleftgun, bool hasrightgun, f32 arg4);
void chr_calculate_aimend_vertical(struct chrdata *chr, struct attackanimconfig *animcfg, bool hasleftgun, bool hasrightgun, f32 shootrotx);
f32 chr_get_aim_limit_angle(f32 sqdist);
bool chr_get_gun_pos(struct chrdata *chr, s32 handnum, struct coord *gunpos);
void chr_calculate_shield_hit(struct chrdata *chr, struct coord *pos, struct coord *vector, struct modelnode **node, s32 *hitpart, struct model **model, s32 *side);
void chr_calculate_trajectory(struct coord *frompos, f32 arg1, struct coord *aimpos, struct coord *arg3);
void func0f041a74(struct chrdata *chr);
void chr_tick_shots(struct chrdata *chr);
bool pos_is_moving_towards_pos_or_stopped_in_range(struct coord *prevpos, struct coord *moveddelta, struct coord *targetpos, f32 range);
bool pos_is_arriving_laterally_at_pos(struct coord *prevpos, struct coord *curpos, struct coord *targetpos, f32 range);
void chra_tick(struct chrdata *chr);
void cutscene_start(u32 ailistid);
void chra_tick_bg(void);
f32 chr_get_angle_to_pos(struct chrdata *chr, struct coord *pos);
bool chr_is_in_targets_fov_x(struct chrdata *chr, u8 fov360);
bool chr_is_in_targets_fovx(struct chrdata *chr, u8 fov360);
bool chr_is_vertical_angle_to_target_within(struct chrdata *chr, u8 arg1);
bool chr_is_target_in_fov(struct chrdata *chr, u8 arg1, u8 reverse);
bool chr_is_looking_at_pos(struct chrdata *chr, struct coord *pos, u8 arg2);
@ -92,17 +92,17 @@ bool chr_flank(struct chrdata *chr, u32 angle360, struct coord *pos, u8 use_clos
void rebuild_teams(void);
void rebuild_squadrons(void);
void chr_avoid(struct chrdata *chr);
void func0f02e9a0(struct chrdata *chr, f32 mergetime);
void chr_stand_immediate(struct chrdata *chr, f32 mergetime);
f32 chr_get_shield(struct chrdata *chr);
void chr_die(struct chrdata *chr, s32 aplayernum);
struct path *path_find_by_id(u32 path_id);
bool chr_has_los_to_target(struct chrdata *chr);
void chr_record_last_hear_target_time(struct chrdata *chr);
bool chr_is_dead(struct chrdata *chr);
bool chr_try_attack_stand(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_attack_kneel(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_attack_lie(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_modify_attack(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_attackstand(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_attackkneel(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_attacklie(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_try_modifyattack(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_face_entity(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chr_set_path(struct chrdata *chr, u32 path_id);
bool chr_try_start_patrol(struct chrdata *chr);
@ -112,17 +112,17 @@ bool chr_go_to_target(struct chrdata *chr, u32 goposflags);
bool chr_go_to_chr(struct chrdata *chr, u32 dst_chrnum, u32 goposflags);
bool chr_go_to_prop(struct chrdata *chr, struct prop *prop, u32 goposflags);
bool chr_try_stop(struct chrdata *chr);
bool chr_try_surprised_one_hand(struct chrdata *chr);
bool chr_try_surprised_onehand(struct chrdata *chr);
bool chr_try_surprised_surrender(struct chrdata *chr);
bool chr_try_surprised_look_around(struct chrdata *chr);
bool chr_try_surprised_lookaround(struct chrdata *chr);
bool chr_try_kneel(struct chrdata *chr);
bool chr_try_start_anim(struct chrdata *chr, s32 animnum, f32 startframe, f32 endframe, u8 chranimflags, s32 merge, f32 speed);
bool chr_try_start_alarm(struct chrdata *chr, s32 pad_id);
bool chr_try_anim(struct chrdata *chr, s32 animnum, f32 startframe, f32 endframe, u8 chranimflags, s32 merge, f32 speed);
bool chr_try_startalarm(struct chrdata *chr, s32 pad_id);
bool chr_consider_grenade_throw(struct chrdata *chr, u32 attackflags, u32 entityid);
void chr_fade_corpse_when_off_screen(struct chrdata *chr);
void chr_fade_corpse_when_offscreen(struct chrdata *chr);
void chr_set_theta(struct chrdata *chr, f32 angle);
f32 chr_get_rot_y(struct chrdata *chr);
void chr_reset_aim_end_properties(struct chrdata *chr);
void chr_reset_aimend(struct chrdata *chr);
void chr_set_firing(struct chrdata *chr, s32 hand, bool firing);
void chr_stop_firing(struct chrdata *chr);
void chr_set_hand_firing(struct chrdata *chr, s32 hand, bool arg2);
@ -130,7 +130,7 @@ void prop_unset_dangerous(struct prop *prop);
void prop_set_dangerous(struct prop *prop);
bool chr_detect_dangerous_object(struct chrdata *chr, u8 flags);
s32 chr_is_using_lift(struct chrdata *chr);
bool chr_try_sk_jump(struct chrdata *chr, u8 pouncebits, u8 arg2, s32 arg3, u8 arg4);
bool chr_try_skjump(struct chrdata *chr, u8 pouncebits, u8 arg2, s32 arg3, u8 arg4);
bool chr_saw_target_recently(struct chrdata *chr);
bool chr_heard_target_recently(struct chrdata *chr);
f32 chr_get_angle_to_target(struct chrdata *chr);
@ -159,9 +159,9 @@ void chr_unset_stage_flag(struct chrdata *chr, u32 flag);
bool chr_has_stage_flag(struct chrdata *chr, u32 flag);
bool chr_is_hearing_target(struct chrdata *chr);
void chr_restart_timer(struct chrdata *chr);
bool chr_reset_near_miss(struct chrdata *chr);
bool chr_reset_nearmiss(struct chrdata *chr);
s32 chr_get_num_arghs(struct chrdata *chr);
s32 chr_get_num_close_arghs(struct chrdata *chr);
s32 chr_get_num_closearghs(struct chrdata *chr);
void decrement_byte(u8 *dst, u8 amount);
void increment_byte(u8 *dst, u8 amount);
bool chr_can_hear_alarm(struct chrdata *chr);
@ -186,6 +186,6 @@ bool audio_was_not_played_recently(s16 audioid);
Gfx *chrs_render_chr_stats(Gfx *gdl, RoomNum *rooms);
void chr_toggle_model_part(struct chrdata *chr, s32 partnum);
bool chr_is_avoiding(struct chrdata *chr);
void chr_dr_caroll_emit_sparks(struct chrdata *chr);
void chr_drcaroll_emit_sparks(struct chrdata *chr);
#endif

View File

@ -317,7 +317,7 @@
/*0x013b*/ bool ai_set_squadron(void);
/*0x013c*/ bool ai_face_cover(void);
/*0x013d*/ bool ai_if_dangerous_object_nearby(void);
/*0x013e*/ bool ai013e(void);
/*0x013e*/ bool ai_run_from_grenade(void);
/*0x013f*/ bool ai_if_heli_weapons_armed(void);
/*0x0140*/ bool ai_if_hoverbot_next_step(void);
/*0x0141*/ bool ai_shuffle_investigation_terminals(void);

View File

@ -333,22 +333,35 @@ union filedataptr {
struct attackanimconfig {
/*0x00*/ s16 animnum;
/*0x04*/ f32 unk04; // frame number
/*0x08*/ f32 unk08;
/*0x0c*/ f32 unk0c;
/*0x10*/ f32 unk10; // frame number
/*0x14*/ f32 unk14; // frame number
/*0x18*/ f32 unk18; // frame number
/*0x1c*/ f32 unk1c; // frame number
/*0x20*/ f32 unk20; // frame number
/*0x24*/ f32 unk24; // frame number
/*0x28*/ f32 unk28; // frame number
/*0x2c*/ f32 unk2c; // frame number
/*0x30*/ f32 unk30;
/*0x34*/ f32 unk34;
/*0x38*/ f32 unk38;
/*0x3c*/ f32 unk3c;
/*0x40*/ f32 unk40;
/*0x44*/ f32 unk44;
/*0x08*/ f32 turnangleperframe;
/*0x0c*/ f32 angleoffset; // how far the "zero" X angle is off the chr's facing angle
// start <= aimstart <= shootstart <= recoilstart <= recoilend <= shootend <= aimend <= end
// start/end: Allows starting on a later frame or finishing on an earlier
// frame than what's in the animation. endframe may be -1.
// aimstart/aimend: When the chr can start swiveling their aim. They can do
// this while still raising their arm, before they are ready to shoot.
// shootstart/shootend: Chr will shoot during these frames if they have line
// of sight.
// recoilstart/recoilend: Recoil frames, for single shot pistols.
// Can be -1 if the anim doesn't have recoil frames.
/*0x10*/ f32 startframe;
/*0x14*/ f32 endframe;
/*0x18*/ f32 shootstartframe;
/*0x1c*/ f32 shootendframe;
/*0x20*/ f32 recoilstartframe;
/*0x24*/ f32 recoilendframe;
/*0x28*/ f32 aimstartframe;
/*0x2c*/ f32 aimendframe;
/*0x30*/ f32 maxup; // if aiming up more than this angle, chr will lean backwards
/*0x34*/ f32 maxdown; // if aiming down more than this angle, chr will lean forwards
/*0x38*/ f32 maxleft; // positive
/*0x3c*/ f32 maxright; // negative
/*0x40*/ f32 freearmfracup; // when aiming up, gunless arm will move by this fraction of the gun arm
/*0x44*/ f32 freearmfracdown; // when aiming down, gunless arm will move by this fraction of the gun arm
};
struct model;
@ -2659,8 +2672,8 @@ struct player {
/*0x1960*/ u32 killsthislife;
/*0x1964*/ u32 healthdisplaytime60;
/*0x1968*/ f32 guncloseroffset;
/*0x196c*/ f32 shootrotx;
/*0x1970*/ f32 shootroty;
/*0x196c*/ f32 shootrotx; // up/down (rotation on X axis)
/*0x1970*/ f32 shootroty; // left/right (rotation on Y axis)
/*0x1974*/ char *award1;
/*0x1978*/ char *award2;
/*0x197c*/ struct coord chrmuzzlelastpos[2];