Name almost all collision and movement functions
This commit is contained in:
parent
ecef69b58f
commit
169ed48bdc
|
@ -56,7 +56,7 @@ The decomp project wraps all decompiled piracy checks in `#if PIRACYCHECKS` stat
|
|||
|
||||
**What It Checks:** Checksums `bot_pickup_prop` to make sure it hasn't been modified.
|
||||
|
||||
**Payload:** Disables the ability for the player and other characters to go up or down slopes. This is done by nopping the `jr ra` instruction in `cd_find_ground_info_at_cyl`, which causes it to flow into the following function, which unconditionally returns false and only exists for this purpose.
|
||||
**Payload:** Disables the ability for the player and other characters to go up or down slopes. This is done by nopping the `jr ra` instruction in `cd_find_ground_at_cyl_ctfril`, which causes it to flow into the following function, which unconditionally returns false and only exists for this purpose.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -5745,6 +5745,7 @@ void bg_tick_portals(void)
|
|||
|
||||
if (!g_BgRoomTestsDisabled) {
|
||||
if (g_BgPortals[0].verticesoffset == 0) {
|
||||
// Unreachable because all BGs have portals
|
||||
for (room = 1; room < g_Vars.roomcount; room++) {
|
||||
if (bg_room_intersects_screen_box(room, &box)
|
||||
&& ((g_StageIndex != STAGEINDEX_INFILTRATION && g_StageIndex != STAGEINDEX_RESCUE && g_StageIndex != STAGEINDEX_ESCAPE) || room != 0xf)
|
||||
|
|
|
@ -361,7 +361,7 @@ void body_instantiate_chr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
|
|||
rooms[0] = pad.room;
|
||||
rooms[1] = -1;
|
||||
|
||||
if (cd_test_volume(&pad.pos, 20, rooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200) == CDRESULT_COLLISION
|
||||
if (cd_test_volume_simple(&pad.pos, 20, rooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200) == CDRESULT_COLLISION
|
||||
&& packed->chair == -1
|
||||
&& (packed->spawnflags & SPAWNFLAG_IGNORECOLLISION) == 0) {
|
||||
return;
|
||||
|
@ -587,7 +587,7 @@ struct prop *body_instantiate_eyespy(struct pad *pad, RoomNum room)
|
|||
chr->visionrange = 0;
|
||||
chr->race = body_get_race(chr->bodynum);
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift);
|
||||
ground = cd_find_ground_at_cyl_ctfril(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift);
|
||||
chr->ground = ground;
|
||||
chr->manground = ground;
|
||||
|
||||
|
|
|
@ -139,15 +139,15 @@ void bbike_try_dismount_angle(f32 relativeangle, f32 distance)
|
|||
los_find_final_room_exhaustive(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &pos, rooms);
|
||||
bmove_find_entered_rooms_by_pos(g_Vars.currentplayer, &pos, rooms);
|
||||
|
||||
result = cd_test_cyl_move02(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, true,
|
||||
result = cd_test_cylmove_oobfail(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
prop_set_perim_enabled(g_Vars.currentplayer->hoverbike, true);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cd_test_volume(&pos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
result = cd_test_volume_simple(&pos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ void bbike0f0d2b40(struct defaultobj *bike, struct coord *arg1, f32 arg2, struct
|
|||
}
|
||||
}
|
||||
|
||||
s32 bbike_calculate_new_position(struct coord *vel, f32 angledelta)
|
||||
s32 bbike_try_delta_nopush(struct coord *vel, f32 angledelta)
|
||||
{
|
||||
s32 result = CDRESULT_NOCOLLISION;
|
||||
struct coord dstpos;
|
||||
|
@ -416,20 +416,20 @@ s32 bbike_calculate_new_position(struct coord *vel, f32 angledelta)
|
|||
zdiff = dstpos.z - g_Vars.currentplayer->hoverbike->pos.z;
|
||||
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
result = cd_exam_cyl_move06(&g_Vars.currentplayer->hoverbike->pos,
|
||||
result = cd_test_cylmove_oobfail_findclosest_finddist(&g_Vars.currentplayer->hoverbike->pos,
|
||||
g_Vars.currentplayer->hoverbike->rooms,
|
||||
&dstpos, dstrooms, radius, CDTYPE_ALL, 1,
|
||||
&dstpos, dstrooms, radius, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->hoverbike->pos.y,
|
||||
ymin - g_Vars.currentplayer->hoverbike->pos.y);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cd_exam_cyl_move02(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, dstrooms, CDTYPE_ALL, true,
|
||||
result = cd_test_volume_fromdir(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->hoverbike->pos.y,
|
||||
ymin - g_Vars.currentplayer->hoverbike->pos.y);
|
||||
}
|
||||
} else {
|
||||
result = cd_exam_cyl_move02(&g_Vars.currentplayer->hoverbike->pos,
|
||||
result = cd_test_volume_fromdir(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, spa8, CDTYPE_ALL, true,
|
||||
ymax - g_Vars.currentplayer->hoverbike->pos.y,
|
||||
ymin - g_Vars.currentplayer->hoverbike->pos.y);
|
||||
|
@ -470,9 +470,9 @@ s32 bbike_calculate_new_position(struct coord *vel, f32 angledelta)
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 bbike_calculate_new_position_with_push(struct coord *arg0, f32 arg1)
|
||||
s32 bbike_try_delta(struct coord *arg0, f32 arg1)
|
||||
{
|
||||
s32 result = bbike_calculate_new_position(arg0, arg1);
|
||||
s32 result = bbike_try_delta_nopush(arg0, arg1);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cd_get_obstacle_prop();
|
||||
|
@ -516,7 +516,7 @@ s32 bbike_calculate_new_position_with_push(struct coord *arg0, f32 arg1)
|
|||
}
|
||||
|
||||
if (moved) {
|
||||
result = bbike_calculate_new_position(arg0, arg1);
|
||||
result = bbike_try_delta_nopush(arg0, arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ void bbike_update_vertical(struct coord *pos)
|
|||
g_Vars.currentplayer->prop->pos.y = pos->y;
|
||||
g_Vars.currentplayer->prop->pos.z = pos->z;
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(&g_Vars.currentplayer->prop->pos,
|
||||
ground = cd_find_ground_at_cyl_ctfril(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->bond2.radius,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
|
@ -607,67 +607,67 @@ void bbike_update_vertical(struct coord *pos)
|
|||
bmove_update_look();
|
||||
}
|
||||
|
||||
s32 bbike0f0d363c(f32 arg0)
|
||||
s32 bbike_resolve_turndelta(f32 turndelta)
|
||||
{
|
||||
struct coord coord = {0, 0, 0};
|
||||
|
||||
return bbike_calculate_new_position_with_push(&coord, arg0);
|
||||
return bbike_try_delta(&coord, turndelta);
|
||||
}
|
||||
|
||||
s32 bbike0f0d3680(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
s32 bbike_try_fulldelta(struct coord *deltapos, struct coord *edgevtx1, struct coord *edgevtx2)
|
||||
{
|
||||
s32 result = bbike_calculate_new_position_with_push(arg0, 0);
|
||||
s32 result = bbike_try_delta(deltapos, 0);
|
||||
|
||||
if (!result) {
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(arg1, arg2, 659, "bondbike.c");
|
||||
cd_get_edge(edgevtx1, edgevtx2, 659, "bondbike.c");
|
||||
#else
|
||||
cd_get_edge(arg1, arg2, 656, "bondbike.c");
|
||||
cd_get_edge(edgevtx1, edgevtx2, 656, "bondbike.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 bbike0f0d36d4(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3, struct coord *arg4)
|
||||
s32 bbike_try_quarterdelta(struct coord *posdelta, struct coord *prevedge_vtx1, struct coord *prevedge_vtx2, struct coord *edge_vtx1, struct coord *edge_vtx2)
|
||||
{
|
||||
if (cd_has_distance()) {
|
||||
struct coord sp24;
|
||||
f32 somefloat = cd_get_distance();
|
||||
s32 someint;
|
||||
struct coord quarter;
|
||||
f32 distance = cd_get_distance();
|
||||
s32 result;
|
||||
|
||||
sp24.x = arg0->x * somefloat * 0.25f;
|
||||
sp24.y = arg0->y * somefloat * 0.25f;
|
||||
sp24.z = arg0->z * somefloat * 0.25f;
|
||||
quarter.x = posdelta->x * distance / 4.0f;
|
||||
quarter.y = posdelta->y * distance / 4.0f;
|
||||
quarter.z = posdelta->z * distance / 4.0f;
|
||||
|
||||
someint = bbike_calculate_new_position_with_push(&sp24, 0);
|
||||
result = bbike_try_delta(&quarter, 0);
|
||||
|
||||
if (someint == 1) {
|
||||
return 1;
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
}
|
||||
|
||||
if (someint == 0) {
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(arg3, arg4, 685, "bondbike.c");
|
||||
cd_get_edge(edge_vtx1, edge_vtx2, 685, "bondbike.c");
|
||||
#else
|
||||
cd_get_edge(arg3, arg4, 682, "bondbike.c");
|
||||
cd_get_edge(edge_vtx1, edge_vtx2, 682, "bondbike.c");
|
||||
#endif
|
||||
|
||||
if (arg3->f[0] != arg1->f[0]
|
||||
|| arg3->f[1] != arg1->f[1]
|
||||
|| arg3->f[2] != arg1->f[2]
|
||||
|| arg4->f[0] != arg2->f[0]
|
||||
|| arg4->f[1] != arg2->f[1]
|
||||
|| arg4->f[2] != arg2->f[2]) {
|
||||
return 0;
|
||||
if (edge_vtx1->f[0] != prevedge_vtx1->f[0]
|
||||
|| edge_vtx1->f[1] != prevedge_vtx1->f[1]
|
||||
|| edge_vtx1->f[2] != prevedge_vtx1->f[2]
|
||||
|| edge_vtx2->f[0] != prevedge_vtx2->f[0]
|
||||
|| edge_vtx2->f[1] != prevedge_vtx2->f[1]
|
||||
|| edge_vtx2->f[2] != prevedge_vtx2->f[2]) {
|
||||
return CDRESULT_COLLISION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
s32 bbike0f0d3840(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
s32 bbike_try_slide_along_edge(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
{
|
||||
s32 result;
|
||||
|
||||
|
@ -690,7 +690,7 @@ s32 bbike0f0d3840(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
|||
sp24.y = 0;
|
||||
sp24.z = sp30.z * tmp;
|
||||
|
||||
result = bbike_calculate_new_position_with_push(&sp24, 0);
|
||||
result = bbike_try_delta(&sp24, 0);
|
||||
} else {
|
||||
result = -1;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ s32 bbike0f0d3840(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
s32 bbike_try_slide_along_corner(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
{
|
||||
struct coord sp34;
|
||||
struct coord sp28;
|
||||
|
@ -732,7 +732,7 @@ s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
|||
sp28.y = 0;
|
||||
sp28.z = sp34.z;
|
||||
|
||||
if (bbike_calculate_new_position_with_push(&sp28, 0) == CDRESULT_NOCOLLISION) {
|
||||
if (bbike_try_delta(&sp28, 0) == CDRESULT_NOCOLLISION) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
|||
sp28.y = 0;
|
||||
sp28.z = sp34.z;
|
||||
|
||||
if (bbike_calculate_new_position_with_push(&sp28, 0) == CDRESULT_NOCOLLISION) {
|
||||
if (bbike_try_delta(&sp28, 0) == CDRESULT_NOCOLLISION) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -770,31 +770,31 @@ s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
|||
return false;
|
||||
}
|
||||
|
||||
void bbike0f0d3c60(struct coord *arg0)
|
||||
void bbike_resolve_posdelta(struct coord *arg0)
|
||||
{
|
||||
struct coord sp64;
|
||||
struct coord sp58;
|
||||
struct coord sp4c;
|
||||
struct coord sp40;
|
||||
s32 value;
|
||||
struct coord sp30;
|
||||
struct coord sp24;
|
||||
struct coord edgea_vtx1;
|
||||
struct coord edgea_vtx2;
|
||||
struct coord edgeb_vtx1;
|
||||
struct coord edgeb_vtx2;
|
||||
s32 result;
|
||||
struct coord edgec_vtx1;
|
||||
struct coord edgec_vtx2;
|
||||
|
||||
if (bbike0f0d3680(arg0, &sp64, &sp58) == 0) {
|
||||
value = bbike0f0d36d4(arg0, &sp64, &sp58, &sp4c, &sp40);
|
||||
if (bbike_try_fulldelta(arg0, &edgea_vtx1, &edgea_vtx2) == CDRESULT_COLLISION) {
|
||||
result = bbike_try_quarterdelta(arg0, &edgea_vtx1, &edgea_vtx2, &edgeb_vtx1, &edgeb_vtx2);
|
||||
|
||||
if (value > 0 || value < 0) {
|
||||
if (bbike0f0d3840(arg0, &sp64, &sp58) <= 0
|
||||
&& bbike0f0d3940(arg0, &sp64, &sp58) <= 0) {
|
||||
if (result >= CDRESULT_NOCOLLISION || result <= CDRESULT_ERROR) {
|
||||
if (bbike_try_slide_along_edge(arg0, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION
|
||||
&& bbike_try_slide_along_corner(arg0, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION) {
|
||||
// empty
|
||||
}
|
||||
} else if (value == 0) {
|
||||
bbike0f0d36d4(arg0, &sp4c, &sp40, &sp30, &sp24);
|
||||
} else if (result == CDRESULT_COLLISION) {
|
||||
result = bbike_try_quarterdelta(arg0, &edgeb_vtx1, &edgeb_vtx2, &edgec_vtx1, &edgec_vtx2);
|
||||
|
||||
if (bbike0f0d3840(arg0, &sp4c, &sp40) <= 0
|
||||
&& bbike0f0d3840(arg0, &sp64, &sp58) <= 0
|
||||
&& bbike0f0d3940(arg0, &sp4c, &sp40) <= 0
|
||||
&& bbike0f0d3940(arg0, &sp64, &sp58) <= 0) {
|
||||
if (bbike_try_slide_along_edge(arg0, &edgeb_vtx1, &edgeb_vtx2) <= CDRESULT_COLLISION
|
||||
&& bbike_try_slide_along_edge(arg0, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION
|
||||
&& bbike_try_slide_along_corner(arg0, &edgeb_vtx1, &edgeb_vtx2) <= CDRESULT_COLLISION
|
||||
&& bbike_try_slide_along_corner(arg0, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION) {
|
||||
if (&arg0);
|
||||
}
|
||||
}
|
||||
|
@ -887,7 +887,7 @@ void bbike_tick(void)
|
|||
|
||||
if (1);
|
||||
|
||||
bbike0f0d363c(bike->w * g_Vars.lvupdate60freal);
|
||||
bbike_resolve_turndelta(bike->w * g_Vars.lvupdate60freal);
|
||||
|
||||
sp20c.x = bike->speed[0] * g_Vars.lvupdate60freal;
|
||||
sp20c.y = 0.0f;
|
||||
|
@ -896,7 +896,7 @@ void bbike_tick(void)
|
|||
bike->prevpos[0] = bike->base.prop->pos.x;
|
||||
bike->prevpos[1] = bike->base.prop->pos.z;
|
||||
|
||||
bbike0f0d3c60(&sp20c);
|
||||
bbike_resolve_posdelta(&sp20c);
|
||||
|
||||
sp1f8 = (bike->base.prop->pos.x - bike->prevpos[0]) / g_Vars.lvupdate60freal;
|
||||
sp1f4 = (bike->base.prop->pos.z - bike->prevpos[1]) / g_Vars.lvupdate60freal;
|
||||
|
|
|
@ -60,7 +60,7 @@ f32 eyespy_find_ground(RoomNum *floorroom)
|
|||
pos.y = prop->pos.y + yoffset;
|
||||
pos.z = prop->pos.z;
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift);
|
||||
ground = cd_find_ground_at_cyl_ctfril(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift);
|
||||
|
||||
if (ground < -30000) {
|
||||
ground = -30000;
|
||||
|
@ -100,7 +100,7 @@ s32 eyespy_try_move_upwards(f32 yvel)
|
|||
|
||||
f0 -= 0.1f;
|
||||
|
||||
result = cd_test_volume(&dstpos, 26, dstrooms, types, CHECKVERTICAL_YES, 15, f0);
|
||||
result = cd_test_volume_simple(&dstpos, 26, dstrooms, types, CHECKVERTICAL_YES, 15, f0);
|
||||
prop_set_perim_enabled(prop, true);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
|
@ -112,7 +112,7 @@ s32 eyespy_try_move_upwards(f32 yvel)
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 eyespy_calculate_new_position(struct coord *vel)
|
||||
s32 eyespy_try_delta_nopush(struct coord *vel)
|
||||
{
|
||||
bool cdresult = CDRESULT_NOCOLLISION;
|
||||
struct prop *eyespyprop = g_Vars.currentplayer->eyespy->prop;
|
||||
|
@ -176,13 +176,13 @@ s32 eyespy_calculate_new_position(struct coord *vel)
|
|||
halfradius = radius * 0.5f;
|
||||
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
cdresult = cd_exam_cyl_move06(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, radius, types, 1, 15, ymin);
|
||||
cdresult = cd_test_cylmove_oobfail_findclosest_finddist(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, radius, types, CHECKVERTICAL_YES, 15, ymin);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_exam_cyl_move02(&eyespyprop->pos, &dstpos, radius, dstrooms, types, true, 15, ymin);
|
||||
cdresult = cd_test_volume_fromdir(&eyespyprop->pos, &dstpos, radius, dstrooms, types, CHECKVERTICAL_YES, 15, ymin);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_exam_cyl_move02(&eyespyprop->pos, &dstpos, radius, sp74, types, true, 15, ymin);
|
||||
cdresult = cd_test_volume_fromdir(&eyespyprop->pos, &dstpos, radius, sp74, types, CHECKVERTICAL_YES, 15, ymin);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_COLLISION) {
|
||||
|
@ -214,9 +214,9 @@ s32 eyespy_calculate_new_position(struct coord *vel)
|
|||
return cdresult;
|
||||
}
|
||||
|
||||
bool eyespy_calculate_new_position_with_push(struct coord *vel)
|
||||
bool eyespy_try_delta(struct coord *vel)
|
||||
{
|
||||
s32 cdresult = eyespy_calculate_new_position(vel);
|
||||
s32 cdresult = eyespy_try_delta_nopush(vel);
|
||||
struct prop *prop;
|
||||
|
||||
if (cdresult != CDRESULT_NOCOLLISION) {
|
||||
|
@ -269,7 +269,7 @@ bool eyespy_calculate_new_position_with_push(struct coord *vel)
|
|||
return cdresult;
|
||||
}
|
||||
|
||||
s32 eyespy_try_quarterstep(struct coord *vel, struct coord *prevedge1, struct coord *prevedge2, struct coord *newedge1, struct coord *newedge2)
|
||||
s32 eyespy_try_quarterdelta(struct coord *vel, struct coord *prevedge1, struct coord *prevedge2, struct coord *newedge1, struct coord *newedge2)
|
||||
{
|
||||
if (cd_has_distance()) {
|
||||
struct coord tryvel;
|
||||
|
@ -280,7 +280,7 @@ s32 eyespy_try_quarterstep(struct coord *vel, struct coord *prevedge1, struct co
|
|||
tryvel.y = vel->y * distance * 0.25f;
|
||||
tryvel.z = vel->z * distance * 0.25f;
|
||||
|
||||
cdresult = eyespy_calculate_new_position_with_push(&tryvel);
|
||||
cdresult = eyespy_try_delta(&tryvel);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
|
@ -303,7 +303,7 @@ s32 eyespy_try_quarterstep(struct coord *vel, struct coord *prevedge1, struct co
|
|||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
s32 eyespy_try_move_to_edge(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
s32 eyespy_try_slide_along_edge(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
{
|
||||
f32 frac;
|
||||
struct coord tri;
|
||||
|
@ -326,13 +326,13 @@ s32 eyespy_try_move_to_edge(struct coord *vel, struct coord *edge1, struct coord
|
|||
tryvel.y = 0;
|
||||
tryvel.z = tri.z * frac;
|
||||
|
||||
return eyespy_calculate_new_position_with_push(&tryvel);
|
||||
return eyespy_try_delta(&tryvel);
|
||||
}
|
||||
|
||||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
s32 eyespy_try_grind(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
s32 eyespy_try_slide_along_corner(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
{
|
||||
struct coord tri;
|
||||
struct coord tryvel;
|
||||
|
@ -363,7 +363,7 @@ s32 eyespy_try_grind(struct coord *vel, struct coord *edge1, struct coord *edge2
|
|||
tryvel.y = 0;
|
||||
tryvel.z = tri.z;
|
||||
|
||||
if (eyespy_calculate_new_position_with_push(&tryvel) == CDRESULT_NOCOLLISION) {
|
||||
if (eyespy_try_delta(&tryvel) == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ s32 eyespy_try_grind(struct coord *vel, struct coord *edge1, struct coord *edge2
|
|||
tryvel.y = 0;
|
||||
tryvel.z = tri.z;
|
||||
|
||||
if (eyespy_calculate_new_position_with_push(&tryvel) == CDRESULT_NOCOLLISION) {
|
||||
if (eyespy_try_delta(&tryvel) == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
}
|
||||
}
|
||||
|
@ -401,9 +401,9 @@ s32 eyespy_try_grind(struct coord *vel, struct coord *edge1, struct coord *edge2
|
|||
return CDRESULT_COLLISION;
|
||||
}
|
||||
|
||||
s32 eyespy_try_fullstep(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
s32 eyespy_try_fulldelta(struct coord *vel, struct coord *edge1, struct coord *edge2)
|
||||
{
|
||||
bool cdresult = eyespy_calculate_new_position_with_push(vel);
|
||||
bool cdresult = eyespy_try_delta(vel);
|
||||
|
||||
if (cdresult != CDRESULT_NOCOLLISION) {
|
||||
cd_get_edge(edge1, edge2, 473, "bondeyespy.c");
|
||||
|
@ -414,8 +414,8 @@ s32 eyespy_try_fullstep(struct coord *vel, struct coord *edge1, struct coord *ed
|
|||
|
||||
void eyespy_update_position(void)
|
||||
{
|
||||
struct coord fulledge1;
|
||||
struct coord fulledge2;
|
||||
struct coord edgea_vtx1;
|
||||
struct coord edgea_vtx2;
|
||||
struct prop *prop = g_Vars.currentplayer->eyespy->prop;
|
||||
struct coord vel;
|
||||
f32 newground;
|
||||
|
@ -425,11 +425,11 @@ void eyespy_update_position(void)
|
|||
f32 maxfallspeed;
|
||||
u8 hit = EYESPYHIT_NONE;
|
||||
f32 newy;
|
||||
struct coord quarteredge1;
|
||||
struct coord quarteredge2;
|
||||
struct coord edgeb_vtx1;
|
||||
struct coord edgeb_vtx2;
|
||||
u32 stack;
|
||||
struct coord throwawayedge1;
|
||||
struct coord throwawayedge2;
|
||||
struct coord edgec_vtx1;
|
||||
struct coord edgec_vtx2;
|
||||
|
||||
origpos.f[0] = prop->pos.x;
|
||||
origpos.f[1] = prop->pos.y;
|
||||
|
@ -440,18 +440,18 @@ void eyespy_update_position(void)
|
|||
vel.y = 0;
|
||||
vel.z = g_Vars.currentplayer->eyespy->vel.z;
|
||||
|
||||
if (eyespy_try_fullstep(&vel, &fulledge1, &fulledge2) == CDRESULT_COLLISION) {
|
||||
if (eyespy_try_quarterstep(&vel, &fulledge1, &fulledge2, &quarteredge1, &quarteredge2) != CDRESULT_COLLISION) {
|
||||
if (eyespy_try_move_to_edge(&vel, &fulledge1, &fulledge2) <= CDRESULT_COLLISION) {
|
||||
eyespy_try_grind(&vel, &fulledge1, &fulledge2);
|
||||
if (eyespy_try_fulldelta(&vel, &edgea_vtx1, &edgea_vtx2) == CDRESULT_COLLISION) {
|
||||
if (eyespy_try_quarterdelta(&vel, &edgea_vtx1, &edgea_vtx2, &edgeb_vtx1, &edgeb_vtx2) != CDRESULT_COLLISION) {
|
||||
if (eyespy_try_slide_along_edge(&vel, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION) {
|
||||
eyespy_try_slide_along_corner(&vel, &edgea_vtx1, &edgea_vtx2);
|
||||
}
|
||||
} else {
|
||||
eyespy_try_quarterstep(&vel, &quarteredge1, &quarteredge2, &throwawayedge1, &throwawayedge2);
|
||||
eyespy_try_quarterdelta(&vel, &edgeb_vtx1, &edgeb_vtx2, &edgec_vtx1, &edgec_vtx2);
|
||||
|
||||
if (eyespy_try_move_to_edge(&vel, &quarteredge1, &quarteredge2) <= CDRESULT_COLLISION
|
||||
&& eyespy_try_move_to_edge(&vel, &fulledge1, &fulledge2) <= CDRESULT_COLLISION
|
||||
&& eyespy_try_grind(&vel, &quarteredge1, &quarteredge2) <= CDRESULT_COLLISION) {
|
||||
eyespy_try_grind(&vel, &fulledge1, &fulledge2);
|
||||
if (eyespy_try_slide_along_edge(&vel, &edgeb_vtx1, &edgeb_vtx2) <= CDRESULT_COLLISION
|
||||
&& eyespy_try_slide_along_edge(&vel, &edgea_vtx1, &edgea_vtx2) <= CDRESULT_COLLISION
|
||||
&& eyespy_try_slide_along_corner(&vel, &edgeb_vtx1, &edgeb_vtx2) <= CDRESULT_COLLISION) {
|
||||
eyespy_try_slide_along_corner(&vel, &edgea_vtx1, &edgea_vtx2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ bool eyespy_try_launch(void)
|
|||
|
||||
player_set_perim_enabled(g_Vars.currentplayer->prop, false);
|
||||
|
||||
if (insafe || !cd_exam_los08(&testfrompos, g_Vars.currentplayer->prop->rooms,
|
||||
if (insafe || !cd_test_los_oobok_findclosest(&testfrompos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->eyespy->prop->pos,
|
||||
CDTYPE_ALL,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT)) {
|
||||
|
@ -1143,7 +1143,7 @@ void eyespy_process_input(bool allowbuttons)
|
|||
g_EyespyPickup = false;
|
||||
}
|
||||
|
||||
cdresult = cd_test_los05(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
cdresult = cd_test_los_oobfail(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->eyespy->prop->pos, g_Vars.currentplayer->eyespy->prop->rooms,
|
||||
CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT);
|
||||
|
|
|
@ -27,7 +27,7 @@ u32 var8009de8c;
|
|||
|
||||
bool var80070e80 = false;
|
||||
|
||||
void bgrab0f0ce0bc(struct coord *arg0);
|
||||
void bgrab_resolve_posdelta(struct coord *arg0);
|
||||
|
||||
void bgrab_init(void)
|
||||
{
|
||||
|
@ -98,12 +98,12 @@ void bgrab_init(void)
|
|||
obj->hidden |= OBJHFLAG_GRABBED;
|
||||
|
||||
if (obj->flags3 & OBJFLAG3_GEOCYL) {
|
||||
cdresult = cd_000276c8_cyl(obj->geocyl,
|
||||
cdresult = cd_cyl_collides_with_cyl_laterally(obj->geocyl,
|
||||
g_Vars.currentplayer->prop->pos.x,
|
||||
g_Vars.currentplayer->prop->pos.z,
|
||||
VERSION >= VERSION_NTSC_1_0 ? 45 : 40, 0, 0);
|
||||
} else {
|
||||
cdresult = cd_000274e0_block(obj->geoblock,
|
||||
cdresult = cd_block_collides_with_cyl_laterally(obj->geoblock,
|
||||
g_Vars.currentplayer->prop->pos.x,
|
||||
g_Vars.currentplayer->prop->pos.z,
|
||||
VERSION >= VERSION_NTSC_1_0 ? 45 : 40, 0, 0);
|
||||
|
@ -222,7 +222,7 @@ void bgrab0f0ccbf0(struct coord *delta, f32 angle, struct defaultobj *obj)
|
|||
cd_get_edge(&sp68, &sp5c, 227, "bondgrab.c");
|
||||
#endif
|
||||
|
||||
if (cd_get_saved_pos(&sp50, &sp44)) {
|
||||
if (cd_get_block_edge(&sp50, &sp44)) {
|
||||
sp44.x -= sp50.x;
|
||||
sp44.y -= sp50.y;
|
||||
sp44.z -= sp50.z;
|
||||
|
@ -300,7 +300,7 @@ bool bgrab_try_move_upwards(f32 y)
|
|||
|
||||
ymin -= 0.1f;
|
||||
|
||||
result = cd_test_volume(&newpos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
result = cd_test_volume_simple(&newpos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
|
@ -315,7 +315,7 @@ bool bgrab_try_move_upwards(f32 y)
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 bgrab_calculate_new_position(struct coord *delta, f32 angle, bool arg2)
|
||||
s32 bgrab_try_delta_nopush(struct coord *delta, f32 angle, bool arg2)
|
||||
{
|
||||
s32 cdresult = CDRESULT_NOCOLLISION;
|
||||
s32 i;
|
||||
|
@ -369,13 +369,13 @@ s32 bgrab_calculate_new_position(struct coord *delta, f32 angle, bool arg2)
|
|||
|
||||
ismoving = true;
|
||||
|
||||
cdresult = cd_exam_cyl_move05(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, true,
|
||||
cdresult = cd_test_cylmove_oobfail_findclosest(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_exam_cyl_move01(&g_Vars.currentplayer->prop->pos, &pos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
cdresult = cd_test_volume_closestedge(&g_Vars.currentplayer->prop->pos, &pos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
|
@ -538,9 +538,9 @@ s32 bgrab_calculate_new_position(struct coord *delta, f32 angle, bool arg2)
|
|||
return cdresult;
|
||||
}
|
||||
|
||||
bool bgrab_calculate_new_positiont_with_push(struct coord *delta, f32 angle, bool arg2)
|
||||
bool bgrab_try_delta(struct coord *delta, f32 angle, bool arg2)
|
||||
{
|
||||
s32 result = bgrab_calculate_new_position(delta, angle, arg2);
|
||||
s32 result = bgrab_try_delta_nopush(delta, angle, arg2);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cd_get_obstacle_prop();
|
||||
|
@ -585,7 +585,7 @@ bool bgrab_calculate_new_positiont_with_push(struct coord *delta, f32 angle, boo
|
|||
}
|
||||
|
||||
if (moved) {
|
||||
result = bgrab_calculate_new_position(delta, angle, arg2);
|
||||
result = bgrab_try_delta_nopush(delta, angle, arg2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -597,13 +597,13 @@ bool bgrab_calculate_new_positiont_with_push(struct coord *delta, f32 angle, boo
|
|||
return result;
|
||||
}
|
||||
|
||||
bool bgrab0f0cdb04(f32 angle, bool arg2)
|
||||
bool bgrab_try_turndelta(f32 angle, bool arg2)
|
||||
{
|
||||
struct coord coord = {0, 0, 0};
|
||||
bool result;
|
||||
|
||||
g_Vars.currentplayer->grabbeddoextra = true;
|
||||
result = bgrab_calculate_new_positiont_with_push(&coord, angle, arg2);
|
||||
result = bgrab_try_delta(&coord, angle, arg2);
|
||||
g_Vars.currentplayer->grabbeddoextra = false;
|
||||
|
||||
return result;
|
||||
|
@ -654,9 +654,9 @@ bool bgrab0f0cdb68(f32 angle)
|
|||
f22 = -f22;
|
||||
}
|
||||
|
||||
if (g_CdHasSavedBlock) {
|
||||
for (i = 0; i < g_CdSavedBlock.header.numvertices; i++) {
|
||||
f0 = (g_CdSavedBlock.vertices[i][0] - spa4.f[0]) * f20 + (g_CdSavedBlock.vertices[i][1] - spa4.f[2]) * f22;
|
||||
if (g_CdHasBlock) {
|
||||
for (i = 0; i < g_CdBlock.header.numvertices; i++) {
|
||||
f0 = (g_CdBlock.vertices[i][0] - spa4.f[0]) * f20 + (g_CdBlock.vertices[i][1] - spa4.f[2]) * f22;
|
||||
|
||||
if (f0 < 0.0f) {
|
||||
f0 = -f0;
|
||||
|
@ -667,7 +667,7 @@ bool bgrab0f0cdb68(f32 angle)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (cd_get_saved_pos(&sp8c, &sp80)) {
|
||||
if (cd_get_block_edge(&sp8c, &sp80)) {
|
||||
f32 f0 = (sp8c.f[0] - spa4.f[0]) * f20 + f22 * (sp8c.f[2] - spa4.f[2]);
|
||||
f32 f16 = (sp80.f[0] - spa4.f[0]) * f20 + f22 * (sp80.f[2] - spa4.f[2]);
|
||||
|
||||
|
@ -709,30 +709,30 @@ bool bgrab0f0cdb68(f32 angle)
|
|||
sp54.y = 0.0f;
|
||||
sp54.z = sp60 * f22 * 1.01f;
|
||||
|
||||
bgrab0f0ce0bc(&sp54);
|
||||
bgrab_resolve_posdelta(&sp54);
|
||||
|
||||
return bgrab0f0cdb04(angle, true);
|
||||
return bgrab_try_turndelta(angle, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void bgrab0f0cdef0(void)
|
||||
void bgrab_resolve_turndelta(void)
|
||||
{
|
||||
if (g_Vars.lvupdate240 > 0) {
|
||||
f32 angle = g_Vars.currentplayer->speedtheta * g_Vars.lvupdate60freal * 0.017450513318181f * 3.5f;
|
||||
|
||||
if (bgrab0f0cdb04(angle, true) == 0) {
|
||||
if (bgrab_try_turndelta(angle, true) == CDRESULT_COLLISION) {
|
||||
bgrab0f0cdb68(angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool bgrab0f0cdf64(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
||||
bool bgrab_try_fulldelta(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
||||
{
|
||||
bool result = bgrab_calculate_new_positiont_with_push(delta, 0, true);
|
||||
bool result = bgrab_try_delta(delta, 0, true);
|
||||
|
||||
if (!result) {
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(arg1, arg2, 815, "bondgrab.c");
|
||||
#else
|
||||
|
@ -743,7 +743,7 @@ bool bgrab0f0cdf64(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 bgrab0f0cdfbc(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
||||
s32 bgrab_try_slide_along_edge(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
||||
{
|
||||
if (arg1->f[0] != arg2->f[0] || arg1->f[2] != arg2->f[2]) {
|
||||
f32 tmp;
|
||||
|
@ -764,29 +764,27 @@ s32 bgrab0f0cdfbc(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
|||
sp24.y = 0;
|
||||
sp24.z = sp30.z * tmp;
|
||||
|
||||
return bgrab_calculate_new_positiont_with_push(&sp24, 0, true);
|
||||
return bgrab_try_delta(&sp24, 0, true);
|
||||
}
|
||||
|
||||
return -1;
|
||||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
void bgrab0f0ce0bc(struct coord *arg0)
|
||||
void bgrab_resolve_posdelta(struct coord *arg0)
|
||||
{
|
||||
struct coord a;
|
||||
struct coord b;
|
||||
s32 value = bgrab0f0cdf64(arg0, &a, &b);
|
||||
s32 result = bgrab_try_fulldelta(arg0, &a, &b);
|
||||
|
||||
if (value == 0) {
|
||||
value = bgrab0f0cdfbc(arg0, &a, &b);
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
result = bgrab_try_slide_along_edge(arg0, &a, &b);
|
||||
|
||||
if (value <= 0) {
|
||||
value = 1;
|
||||
if (result <= CDRESULT_COLLISION) {
|
||||
result = CDRESULT_NOCOLLISION;
|
||||
}
|
||||
}
|
||||
|
||||
if (value) {
|
||||
// empty
|
||||
}
|
||||
if (result);
|
||||
}
|
||||
|
||||
void bgrab_update_prev_pos(void)
|
||||
|
@ -815,11 +813,11 @@ void bgrab_update_vertical(void)
|
|||
s32 inlift;
|
||||
struct prop *lift = NULL;
|
||||
f32 dist;
|
||||
f32 f14;
|
||||
f32 fVar3;
|
||||
f32 ground;
|
||||
f32 sumground;
|
||||
f32 f0;
|
||||
|
||||
f14 = cd_find_ground_info_at_cyl(&g_Vars.currentplayer->prop->pos,
|
||||
ground = cd_find_ground_at_cyl_ctfril(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->bond2.radius,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
|
@ -827,8 +825,8 @@ void bgrab_update_vertical(void)
|
|||
&g_Vars.currentplayer->floorflags,
|
||||
&g_Vars.currentplayer->floorroom, &inlift, &lift);
|
||||
|
||||
if (f14 < -30000) {
|
||||
f14 = -30000;
|
||||
if (ground < -30000) {
|
||||
ground = -30000;
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->inlift && inlift) {
|
||||
|
@ -836,7 +834,7 @@ void bgrab_update_vertical(void)
|
|||
dist = g_Vars.currentplayer->liftground - g_Vars.currentplayer->vv_manground;
|
||||
|
||||
if (dist < 1.0f && dist > -1.0f) {
|
||||
f0 = f14 - g_Vars.currentplayer->vv_ground;
|
||||
f0 = ground - g_Vars.currentplayer->vv_ground;
|
||||
g_Vars.currentplayer->vv_ground += f0;
|
||||
g_Vars.currentplayer->vv_manground += f0;
|
||||
g_Vars.currentplayer->sumground = g_Vars.currentplayer->vv_manground / (PAL ? 0.054400026798248f : 0.045499980449677f);
|
||||
|
@ -849,18 +847,18 @@ void bgrab_update_vertical(void)
|
|||
g_Vars.currentplayer->inlift = inlift;
|
||||
|
||||
if (inlift) {
|
||||
g_Vars.currentplayer->liftground = f14;
|
||||
g_Vars.currentplayer->liftground = ground;
|
||||
}
|
||||
|
||||
g_Vars.currentplayer->lift = lift;
|
||||
g_Vars.currentplayer->vv_ground = f14;
|
||||
g_Vars.currentplayer->vv_ground = ground;
|
||||
g_Vars.currentplayer->vv_height =
|
||||
(g_Vars.currentplayer->headpos.y / g_Vars.currentplayer->standheight) *
|
||||
g_Vars.currentplayer->vv_eyeheight;
|
||||
fVar3 = g_Vars.currentplayer->vv_manground / (PAL ? 0.054400026798248f : 0.045499980449677f);
|
||||
sumground = g_Vars.currentplayer->vv_manground / (PAL ? 0.054400026798248f : 0.045499980449677f);
|
||||
|
||||
for (i = 0; i < g_Vars.lvupdate240; i++) {
|
||||
fVar3 = (PAL ? 0.94559997320175f : 0.9545f) * fVar3 + g_Vars.currentplayer->vv_ground;
|
||||
sumground = (PAL ? 0.94559997320175f : 0.9545f) * sumground + g_Vars.currentplayer->vv_ground;
|
||||
}
|
||||
|
||||
f0 = g_Vars.currentplayer->vv_height;
|
||||
|
@ -869,7 +867,7 @@ void bgrab_update_vertical(void)
|
|||
f0 = 30;
|
||||
}
|
||||
|
||||
tmp = fVar3 * (PAL ? 0.054400026798248f : 0.045499980449677f) + f0 - g_Vars.currentplayer->prop->pos.y;
|
||||
tmp = sumground * (PAL ? 0.054400026798248f : 0.045499980449677f) + f0 - g_Vars.currentplayer->prop->pos.y;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (g_Vars.currentplayer->prop->pos.y + tmp < g_Vars.currentplayer->vv_ground + 10.0f) {
|
||||
|
@ -878,8 +876,8 @@ void bgrab_update_vertical(void)
|
|||
#endif
|
||||
|
||||
if (bgrab_try_move_upwards(tmp)) {
|
||||
g_Vars.currentplayer->sumground = fVar3;
|
||||
g_Vars.currentplayer->vv_manground = fVar3 * (PAL ? 0.054400026798248f : 0.045499980449677f);
|
||||
g_Vars.currentplayer->sumground = sumground;
|
||||
g_Vars.currentplayer->vv_manground = sumground * (PAL ? 0.054400026798248f : 0.045499980449677f);
|
||||
}
|
||||
|
||||
if ((g_Vars.currentplayer->floorflags & GEOFLAG_DIE) &&
|
||||
|
@ -1104,7 +1102,7 @@ void bgrab0f0ce924(void)
|
|||
sp74.z += (g_Vars.currentplayer->bond2.theta.f[2] * g_Vars.currentplayer->speedforwards + (g_Vars.currentplayer->bond2.theta.f[0] * g_Vars.currentplayer->speedsideways)) * g_Vars.lvupdate60freal * 10.0f;
|
||||
}
|
||||
|
||||
bgrab0f0ce0bc(&sp74);
|
||||
bgrab_resolve_posdelta(&sp74);
|
||||
|
||||
xdelta = g_Vars.currentplayer->prop->pos.f[0] - g_Vars.currentplayer->bondprevpos.f[0];
|
||||
zdelta = g_Vars.currentplayer->prop->pos.f[2] - g_Vars.currentplayer->bondprevpos.f[2];
|
||||
|
@ -1162,7 +1160,7 @@ void bgrab0f0ce924(void)
|
|||
void bgrab_tick(void)
|
||||
{
|
||||
bgrab_update_prev_pos();
|
||||
bgrab0f0cdef0();
|
||||
bgrab_resolve_turndelta();
|
||||
bmove_update_look();
|
||||
bgrab0f0ce924();
|
||||
bgrab_onmoved();
|
||||
|
@ -1219,7 +1217,7 @@ void bgrab_tick(void)
|
|||
if (g_Vars.currentplayer->vv_ground <= -30000
|
||||
|| ydiff < -100 || ydiff > 100
|
||||
|| g_Vars.currentplayer->vv_ground < g_Vars.currentplayer->vv_manground - 50
|
||||
|| !cd_test_los05(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
|| !cd_test_los_oobfail(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->grabbedprop->pos, g_Vars.currentplayer->grabbedprop->rooms,
|
||||
CDTYPE_ALL,
|
||||
GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT)) {
|
||||
|
|
|
@ -4354,7 +4354,7 @@ void bgun_create_thrown_projectile(s32 handnum, struct gset *gset)
|
|||
|
||||
player_set_perim_enabled(playerprop, false);
|
||||
|
||||
if (cd_test_los11(&playerprop->pos, playerprop->rooms, &muzzlepos, spawnrooms, CDTYPE_ALL) != CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_getfinalroom_autoflags(&playerprop->pos, playerprop->rooms, &muzzlepos, spawnrooms, CDTYPE_ALL) != CDRESULT_COLLISION) {
|
||||
spawnpos.x = muzzlepos.x;
|
||||
spawnpos.y = muzzlepos.y;
|
||||
spawnpos.z = muzzlepos.z;
|
||||
|
|
|
@ -432,10 +432,10 @@ f32 bmove_calculate_lookahead(void)
|
|||
sp150.y = spf0.y + sp100.y * 400;
|
||||
sp150.z = spf0.z + sp100.z * 400;
|
||||
|
||||
if (cd_exam_los08(&spf0, spe0, &sp150,
|
||||
if (cd_test_los_oobok_findclosest(&spf0, spe0, &sp150,
|
||||
CDTYPE_BG | CDTYPE_CLOSEDDOORS,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT) == CDRESULT_COLLISION) {
|
||||
cd_get_pos(&sp150, 455, "bondmove.c");
|
||||
cd_get_obstacle_pos(&sp150, 455, "bondmove.c");
|
||||
flags = cd_get_geo_flags();
|
||||
|
||||
sp160 = sqrtf((sp150.x - spf0.x) * (sp150.x - spf0.x)
|
||||
|
@ -462,9 +462,9 @@ f32 bmove_calculate_lookahead(void)
|
|||
|
||||
if (
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_find_floor_room_y_colour_flags_at_pos(&spbc, sp80, &sp78, NULL, NULL) > 0
|
||||
cd_find_room_at_pos_ycf(&spbc, sp80, &sp78, NULL, NULL) > 0
|
||||
#else
|
||||
cd_find_floor_room_y_colour_flags_at_pos(&spbc, sp80, &sp78, NULL) > 0
|
||||
cd_find_room_at_pos_ycf(&spbc, sp80, &sp78, NULL) > 0
|
||||
#endif
|
||||
&& sp78 - ground < 200
|
||||
&& sp78 - ground > -200) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
bool bwalk_calculate_new_position_with_push(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types);
|
||||
s32 bwalk_try_delta(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types);
|
||||
void bwalk_update_crouch_offset_real(void);
|
||||
|
||||
void bwalk_init(void)
|
||||
|
@ -114,7 +114,7 @@ void bwalk_init(void)
|
|||
delta.z = g_Vars.currentplayer->walkinitpos.z - g_Vars.currentplayer->prop->pos.z;
|
||||
|
||||
prop_set_perim_enabled(g_Vars.currentplayer->hoverbike, false);
|
||||
bwalk_calculate_new_position_with_push(&delta, 0, true, 0, CDTYPE_ALL);
|
||||
bwalk_try_delta(&delta, 0, true, 0, CDTYPE_ALL);
|
||||
prop_set_perim_enabled(g_Vars.currentplayer->hoverbike, true);
|
||||
} else if (prevmode != MOVEMODE_GRAB && prevmode != MOVEMODE_WALK) {
|
||||
g_Vars.currentplayer->moveinitspeed.x = 0;
|
||||
|
@ -216,7 +216,7 @@ s32 bwalk_try_move_upwards(f32 amount)
|
|||
|
||||
ymin -= 0.1f;
|
||||
|
||||
result = cd_test_volume(&newpos, radius, rooms, types, CHECKVERTICAL_YES,
|
||||
result = cd_test_volume_simple(&newpos, radius, rooms, types, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
|
@ -233,14 +233,14 @@ s32 bwalk_try_move_upwards(f32 amount)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool bwalk_calculate_new_position(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 checktypes)
|
||||
s32 bwalk_try_delta_nopush(struct coord *deltapos, f32 rotateamount, bool apply, f32 extrawidth, s32 checktypes)
|
||||
{
|
||||
s32 result = CDRESULT_NOCOLLISION;
|
||||
f32 halfradius;
|
||||
struct coord dstpos;
|
||||
RoomNum dstrooms[8];
|
||||
bool copyrooms = false;
|
||||
RoomNum sp64[22];
|
||||
RoomNum throughrooms[22];
|
||||
s32 types;
|
||||
f32 ymax;
|
||||
f32 ymin;
|
||||
|
@ -259,24 +259,38 @@ bool bwalk_calculate_new_position(struct coord *vel, f32 rotateamount, bool appl
|
|||
dstpos.y = g_Vars.currentplayer->prop->pos.y;
|
||||
dstpos.z = g_Vars.currentplayer->prop->pos.z;
|
||||
|
||||
if (vel->x || vel->y || vel->z) {
|
||||
if (deltapos->x || deltapos->y || deltapos->z) {
|
||||
if (g_Vars.currentplayer->ontank) {
|
||||
prop_set_perim_enabled(g_Vars.currentplayer->ontank, false);
|
||||
}
|
||||
|
||||
prop_set_perim_enabled(g_Vars.currentplayer->prop, false);
|
||||
|
||||
dstpos.x += vel->x;
|
||||
dstpos.y += vel->y;
|
||||
dstpos.z += vel->z;
|
||||
dstpos.x += deltapos->x;
|
||||
dstpos.y += deltapos->y;
|
||||
dstpos.z += deltapos->z;
|
||||
|
||||
types = g_Vars.bondcollisions ? checktypes : CDTYPE_BG;
|
||||
|
||||
player_get_bbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
|
||||
radius += extrawidth;
|
||||
|
||||
/**
|
||||
* Populate dstrooms with the room that dstpos is in, using portals to trace the path.
|
||||
* If that fails:
|
||||
* If dstpos is in the bounding box of the last portalled room, use that room.
|
||||
* If that fails:
|
||||
* Search all rooms for a bounding box that covers dstpos and use those rooms.
|
||||
* If that fails:
|
||||
* Search all rooms for a bounding box that is underneath dstpos and use those rooms.
|
||||
* If that fails:
|
||||
* Use the player's previous rooms list.
|
||||
*
|
||||
* The throughrooms list will contain all rooms that the portal test went through,
|
||||
* as well as any rooms in dstrooms.
|
||||
*/
|
||||
los_find_intersecting_rooms_exhaustive(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&dstpos, dstrooms, sp64, 20);
|
||||
&dstpos, dstrooms, throughrooms, 20);
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
for (i = 0; dstrooms[i] != -1; i++) {
|
||||
|
@ -288,33 +302,40 @@ bool bwalk_calculate_new_position(struct coord *vel, f32 rotateamount, bool appl
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If the dstpos + player's bounding box overlaps a portal,
|
||||
* include that portal's rooms in dstrooms.
|
||||
* In this case the bounding box is 50cm in each direction.
|
||||
*/
|
||||
bmove_find_entered_rooms_by_pos(g_Vars.currentplayer, &dstpos, dstrooms);
|
||||
|
||||
copyrooms = true;
|
||||
|
||||
// Check if the player is moving at least half their radius along the
|
||||
// X or Z axis in a single frame. If less, only do a collision check for
|
||||
// the dst position. If more, do a halfway check too?
|
||||
/**
|
||||
* Check if the player is moving at least half their radius along the X or Z axis in a single frame.
|
||||
* If less, only do a cylinder volume test at the dst position.
|
||||
* If more, do a cylinder move test as well.
|
||||
*/
|
||||
xdiff = dstpos.x - g_Vars.currentplayer->prop->pos.x;
|
||||
zdiff = dstpos.z - g_Vars.currentplayer->prop->pos.z;
|
||||
halfradius = radius * 0.5f;
|
||||
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
result = cd_exam_cyl_move06(&g_Vars.currentplayer->prop->pos,
|
||||
result = cd_test_cylmove_oobfail_findclosest_finddist(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&dstpos, dstrooms, radius, types, 1,
|
||||
&dstpos, dstrooms, radius, types, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cd_exam_cyl_move02(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, dstrooms, types, true,
|
||||
result = cd_test_volume_fromdir(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, dstrooms, types, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
result = cd_exam_cyl_move02(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, sp64, types, true,
|
||||
result = cd_test_volume_fromdir(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, throughrooms, types, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
|
@ -354,9 +375,9 @@ bool bwalk_calculate_new_position(struct coord *vel, f32 rotateamount, bool appl
|
|||
return result;
|
||||
}
|
||||
|
||||
bool bwalk_calculate_new_position_with_push(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types)
|
||||
s32 bwalk_try_delta(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types)
|
||||
{
|
||||
s32 result = bwalk_calculate_new_position(delta, rotateamount, apply, extrawidth, types);
|
||||
s32 result = bwalk_try_delta_nopush(delta, rotateamount, apply, extrawidth, types);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cd_get_obstacle_prop();
|
||||
|
@ -448,7 +469,7 @@ bool bwalk_calculate_new_position_with_push(struct coord *delta, f32 rotateamoun
|
|||
chr_detect_rooms(chr);
|
||||
model_set_root_position(chr->model, &newpos);
|
||||
|
||||
result = bwalk_calculate_new_position(delta, rotateamount, apply, extrawidth, types);
|
||||
result = bwalk_try_delta_nopush(delta, rotateamount, apply, extrawidth, types);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -489,7 +510,7 @@ bool bwalk_calculate_new_position_with_push(struct coord *delta, f32 rotateamoun
|
|||
}
|
||||
|
||||
if (moved) {
|
||||
result = bwalk_calculate_new_position(delta, rotateamount, apply, extrawidth, types);
|
||||
result = bwalk_try_delta_nopush(delta, rotateamount, apply, extrawidth, types);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -502,33 +523,35 @@ bool bwalk_calculate_new_position_with_push(struct coord *delta, f32 rotateamoun
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 bwalk0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 types)
|
||||
s32 bwalk_try_fulldelta(struct coord *delta, struct coord *edge1, struct coord *edge2, s32 types)
|
||||
{
|
||||
s32 result = bwalk_calculate_new_position_with_push(delta, 0, true, 0, types);
|
||||
s32 result = bwalk_try_delta(delta, 0, true, 0, types);
|
||||
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(arg1, arg2, 607, "bondwalk.c");
|
||||
cd_get_edge(edge1, edge2, 607, "bondwalk.c");
|
||||
#else
|
||||
cd_get_edge(arg1, arg2, 602, "bondwalk.c");
|
||||
cd_get_edge(edge1, edge2, 602, "bondwalk.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 bwalk0f0c47d0(struct coord *a, struct coord *b, struct coord *c,
|
||||
struct coord *d, struct coord *e, s32 types)
|
||||
s32 bwalk_try_quarterdelta(struct coord *posdelta, struct coord *prevedge1, struct coord *prevedge2,
|
||||
struct coord *edge1, struct coord *edge2, s32 types)
|
||||
{
|
||||
struct coord quarter;
|
||||
bool result;
|
||||
|
||||
if (cd_has_distance()) {
|
||||
f32 mult = cd_get_distance();
|
||||
quarter.x = a->x * mult * 0.25f;
|
||||
quarter.y = a->y * mult * 0.25f;
|
||||
quarter.z = a->z * mult * 0.25f;
|
||||
result = bwalk_calculate_new_position_with_push(&quarter, 0, true, 0, types);
|
||||
f32 distance = cd_get_distance();
|
||||
|
||||
quarter.x = posdelta->x * distance / 4.0f;
|
||||
quarter.y = posdelta->y * distance / 4.0f;
|
||||
quarter.z = posdelta->z * distance / 4.0f;
|
||||
|
||||
result = bwalk_try_delta(&quarter, 0, true, 0, types);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
|
@ -536,17 +559,17 @@ s32 bwalk0f0c47d0(struct coord *a, struct coord *b, struct coord *c,
|
|||
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(d, e, 635, "bondwalk.c");
|
||||
cd_get_edge(edge1, edge2, 635, "bondwalk.c");
|
||||
#else
|
||||
cd_get_edge(d, e, 630, "bondwalk.c");
|
||||
cd_get_edge(edge1, edge2, 630, "bondwalk.c");
|
||||
#endif
|
||||
|
||||
if (b->x != d->x
|
||||
|| b->y != d->y
|
||||
|| b->z != d->z
|
||||
|| c->x != e->x
|
||||
|| c->y != e->y
|
||||
|| c->z != e->z) {
|
||||
if (prevedge1->x != edge1->x
|
||||
|| prevedge1->y != edge1->y
|
||||
|| prevedge1->z != edge1->z
|
||||
|| prevedge2->x != edge2->x
|
||||
|| prevedge2->y != edge2->y
|
||||
|| prevedge2->z != edge2->z) {
|
||||
return CDRESULT_COLLISION;
|
||||
}
|
||||
}
|
||||
|
@ -555,38 +578,45 @@ s32 bwalk0f0c47d0(struct coord *a, struct coord *b, struct coord *c,
|
|||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
s32 bwalk0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 types)
|
||||
/**
|
||||
* This test fails when sliding past the corner of Jo's desk.
|
||||
* When this happens, the caller uses bwalk_try_slide_along_corner.
|
||||
*
|
||||
* Maybe the edge on the other side of the corner interferes with the
|
||||
* collision test due to float precision?
|
||||
*/
|
||||
s32 bwalk_try_slide_along_edge(struct coord *deltapos, struct coord *edge_vtx1, struct coord *edge_vtx2, s32 types)
|
||||
{
|
||||
if (b->f[0] != c->f[0] || b->f[2] != c->f[2]) {
|
||||
if (edge_vtx1->f[0] != edge_vtx2->f[0] || edge_vtx1->f[2] != edge_vtx2->f[2]) {
|
||||
f32 tmp;
|
||||
struct coord sp38;
|
||||
struct coord sp2c;
|
||||
struct coord edgedir;
|
||||
struct coord newdeltapos;
|
||||
|
||||
sp38.x = c->x - b->x;
|
||||
sp38.y = 0;
|
||||
sp38.z = c->z - b->z;
|
||||
edgedir.x = edge_vtx2->x - edge_vtx1->x;
|
||||
edgedir.y = 0;
|
||||
edgedir.z = edge_vtx2->z - edge_vtx1->z;
|
||||
|
||||
tmp = sqrtf(sp38.f[0] * sp38.f[0] + sp38.f[2] * sp38.f[2]);
|
||||
tmp = sqrtf(edgedir.f[0] * edgedir.f[0] + edgedir.f[2] * edgedir.f[2]);
|
||||
|
||||
sp38.x *= 1.0f / tmp;
|
||||
sp38.z *= 1.0f / tmp;
|
||||
edgedir.x *= 1.0f / tmp;
|
||||
edgedir.z *= 1.0f / tmp;
|
||||
|
||||
tmp = a->f[0] * sp38.f[0] + a->f[2] * sp38.f[2];
|
||||
tmp = deltapos->f[0] * edgedir.f[0] + deltapos->f[2] * edgedir.f[2];
|
||||
|
||||
sp2c.x = sp38.x * tmp;
|
||||
sp2c.y = 0;
|
||||
sp2c.z = sp38.z * tmp;
|
||||
newdeltapos.x = edgedir.x * tmp;
|
||||
newdeltapos.y = 0;
|
||||
newdeltapos.z = edgedir.z * tmp;
|
||||
|
||||
return bwalk_calculate_new_position_with_push(&sp2c, 0, true, 0, types);
|
||||
return bwalk_try_delta(&newdeltapos, 0, true, 0, types);
|
||||
}
|
||||
|
||||
return -1;
|
||||
return CDRESULT_ERROR;
|
||||
}
|
||||
|
||||
s32 bwalk0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 types)
|
||||
s32 bwalk_try_slide_along_corner(struct coord *deltapos, struct coord *edgevtx1, struct coord *edgevtx2, s32 types)
|
||||
{
|
||||
struct coord sp34;
|
||||
struct coord sp28;
|
||||
struct coord newdeltapos;
|
||||
f32 ymax;
|
||||
f32 ymin;
|
||||
f32 tmp;
|
||||
|
@ -594,68 +624,68 @@ s32 bwalk0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s3
|
|||
|
||||
player_get_bbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
|
||||
|
||||
sp34.x = arg1->x - (g_Vars.currentplayer->prop->pos.x + arg0->f[0]);
|
||||
sp34.z = arg1->z - (g_Vars.currentplayer->prop->pos.z + arg0->f[2]);
|
||||
sp34.x = edgevtx1->x - (g_Vars.currentplayer->prop->pos.x + deltapos->f[0]);
|
||||
sp34.z = edgevtx1->z - (g_Vars.currentplayer->prop->pos.z + deltapos->f[2]);
|
||||
|
||||
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
|
||||
if (arg1->f[0] != g_Vars.currentplayer->prop->pos.f[0] || arg1->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
|
||||
sp34.x = -(arg1->z - g_Vars.currentplayer->prop->pos.z);
|
||||
if (edgevtx1->f[0] != g_Vars.currentplayer->prop->pos.f[0] || edgevtx1->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
|
||||
sp34.x = -(edgevtx1->z - g_Vars.currentplayer->prop->pos.z);
|
||||
sp34.y = 0;
|
||||
sp34.z = arg1->x - g_Vars.currentplayer->prop->pos.x;
|
||||
sp34.z = edgevtx1->x - g_Vars.currentplayer->prop->pos.x;
|
||||
|
||||
tmp = sqrtf(sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2]);
|
||||
|
||||
sp34.x = sp34.f[0] * (1.0f / tmp);
|
||||
sp34.z = sp34.f[2] * (1.0f / tmp);
|
||||
|
||||
tmp = arg0->f[0] * sp34.f[0] + arg0->f[2] * sp34.f[2];
|
||||
tmp = deltapos->f[0] * sp34.f[0] + deltapos->f[2] * sp34.f[2];
|
||||
|
||||
sp34.x = sp34.x * tmp;
|
||||
sp34.z = sp34.z * tmp;
|
||||
|
||||
sp28.x = sp34.x;
|
||||
sp28.y = 0;
|
||||
sp28.z = sp34.z;
|
||||
newdeltapos.x = sp34.x;
|
||||
newdeltapos.y = 0;
|
||||
newdeltapos.z = sp34.z;
|
||||
|
||||
if (bwalk_calculate_new_position_with_push(&sp28, 0, true, 0, types) == CDRESULT_NOCOLLISION) {
|
||||
return true;
|
||||
if (bwalk_try_delta(&newdeltapos, 0, true, 0, types) == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sp34.x = arg2->x - (g_Vars.currentplayer->prop->pos.x + arg0->f[0]);
|
||||
sp34.z = arg2->z - (g_Vars.currentplayer->prop->pos.z + arg0->f[2]);
|
||||
sp34.x = edgevtx2->x - (g_Vars.currentplayer->prop->pos.x + deltapos->f[0]);
|
||||
sp34.z = edgevtx2->z - (g_Vars.currentplayer->prop->pos.z + deltapos->f[2]);
|
||||
|
||||
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
|
||||
if (arg2->f[0] != g_Vars.currentplayer->prop->pos.f[0] || arg2->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
|
||||
sp34.x = -(arg2->z - g_Vars.currentplayer->prop->pos.z);
|
||||
if (edgevtx2->f[0] != g_Vars.currentplayer->prop->pos.f[0] || edgevtx2->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
|
||||
sp34.x = -(edgevtx2->z - g_Vars.currentplayer->prop->pos.z);
|
||||
sp34.y = 0;
|
||||
sp34.z = arg2->x - g_Vars.currentplayer->prop->pos.x;
|
||||
sp34.z = edgevtx2->x - g_Vars.currentplayer->prop->pos.x;
|
||||
|
||||
tmp = sqrtf(sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2]);
|
||||
|
||||
sp34.x = sp34.f[0] * (1.0f / tmp);
|
||||
sp34.z = sp34.f[2] * (1.0f / tmp);
|
||||
|
||||
tmp = arg0->f[0] * sp34.f[0] + arg0->f[2] * sp34.f[2];
|
||||
tmp = deltapos->f[0] * sp34.f[0] + deltapos->f[2] * sp34.f[2];
|
||||
|
||||
sp34.x = sp34.x * tmp;
|
||||
sp34.z = sp34.z * tmp;
|
||||
|
||||
sp28.x = sp34.x;
|
||||
sp28.y = 0;
|
||||
sp28.z = sp34.z;
|
||||
newdeltapos.x = sp34.x;
|
||||
newdeltapos.y = 0;
|
||||
newdeltapos.z = sp34.z;
|
||||
|
||||
if (bwalk_calculate_new_position_with_push(&sp28, 0, true, 0, types) == CDRESULT_NOCOLLISION) {
|
||||
return true;
|
||||
if (bwalk_try_delta(&newdeltapos, 0, true, 0, types) == CDRESULT_NOCOLLISION) {
|
||||
return CDRESULT_NOCOLLISION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return CDRESULT_COLLISION;
|
||||
}
|
||||
|
||||
void bwalk0f0c4d98(void)
|
||||
void bwalk_stub(void)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
@ -745,7 +775,7 @@ void bwalk_update_vertical(void)
|
|||
if (g_Vars.antiplayernum >= 0
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& g_Vars.currentplayer->bond2.radius != 30
|
||||
&& cd_test_volume(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
|
||||
&& cd_test_volume_simple(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
|
||||
g_Vars.currentplayer->prop->chr->radius = 30;
|
||||
g_Vars.currentplayer->bond2.radius = 30;
|
||||
radius = 30;
|
||||
|
@ -784,7 +814,7 @@ void bwalk_update_vertical(void)
|
|||
|
||||
rooms_copy(g_Vars.currentplayer->prop->rooms, rooms);
|
||||
bmove_find_entered_rooms_by_pos(g_Vars.currentplayer, &testpos, rooms);
|
||||
ground = cd_find_ground_info_at_cyl(&testpos, g_Vars.currentplayer->bond2.radius, rooms,
|
||||
ground = cd_find_ground_at_cyl_ctfril(&testpos, g_Vars.currentplayer->bond2.radius, rooms,
|
||||
&g_Vars.currentplayer->floorcol, &g_Vars.currentplayer->floortype,
|
||||
&g_Vars.currentplayer->floorflags, &g_Vars.currentplayer->floorroom,
|
||||
&newinlift, &lift);
|
||||
|
@ -1217,53 +1247,73 @@ void bwalk_update_theta(void)
|
|||
rotateamount = g_Vars.currentplayer->speedtheta * mult
|
||||
* g_Vars.lvupdate60freal * 0.0174505133f * 3.5f;
|
||||
|
||||
bwalk_calculate_new_position_with_push(&delta, rotateamount, true, 0, CDTYPE_ALL);
|
||||
bwalk_try_delta(&delta, rotateamount, true, 0, CDTYPE_ALL);
|
||||
}
|
||||
|
||||
void bwalk0f0c63bc(struct coord *arg0, u32 arg1, s32 types)
|
||||
/**
|
||||
* Given a delta position (the desired distance to move in one frame),
|
||||
* figure out the actual final position and apply it.
|
||||
*/
|
||||
void bwalk_resolve_posdelta(struct coord *deltapos, bool notrleaning, s32 cdtypes)
|
||||
{
|
||||
struct coord sp100;
|
||||
struct coord sp88;
|
||||
struct coord edgea_vtx1;
|
||||
struct coord edgea_vtx2;
|
||||
|
||||
g_Vars.currentplayer->bondonturret = false;
|
||||
g_Vars.currentplayer->autocrouchpos = CROUCHPOS_STAND;
|
||||
|
||||
bwalk0f0c4d98();
|
||||
bwalk_stub();
|
||||
|
||||
if (bwalk0f0c4764(arg0, &sp100, &sp88, types) == CDRESULT_COLLISION) {
|
||||
struct coord sp76;
|
||||
struct coord sp64;
|
||||
// Try to move the delta's full distance. If there's something in the way,
|
||||
// the vertices of the obstacle's edge will be written to the edge pointers.
|
||||
if (bwalk_try_fulldelta(deltapos, &edgea_vtx1, &edgea_vtx2, cdtypes) == CDRESULT_COLLISION) {
|
||||
struct coord edgeb_vtx1;
|
||||
struct coord edgeb_vtx2;
|
||||
s32 result;
|
||||
struct coord edgec_vtx1;
|
||||
struct coord edgec_vtx2;
|
||||
|
||||
s32 result = bwalk0f0c47d0(arg0, &sp100, &sp88, &sp76, &sp64, types);
|
||||
// Take the distance to the obstacle and try a quarter of that distance.
|
||||
result = bwalk_try_quarterdelta(deltapos, &edgea_vtx1, &edgea_vtx2, &edgeb_vtx1, &edgeb_vtx2, cdtypes);
|
||||
|
||||
if (result >= CDRESULT_NOCOLLISION || result <= CDRESULT_ERROR) {
|
||||
if (result >= CDRESULT_NOCOLLISION) {
|
||||
bwalk0f0c4d98();
|
||||
bwalk_stub();
|
||||
}
|
||||
|
||||
if (arg1
|
||||
&& bwalk0f0c494c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION
|
||||
&& bwalk0f0c4a5c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION) {
|
||||
// The quarter distance had no collision, so try to move the player
|
||||
// right up to the obstacle and slide along the edge a bit.
|
||||
if (notrleaning
|
||||
&& bwalk_try_slide_along_edge(deltapos, &edgea_vtx1, &edgea_vtx2, cdtypes) <= CDRESULT_COLLISION
|
||||
&& bwalk_try_slide_along_corner(deltapos, &edgea_vtx1, &edgea_vtx2, cdtypes) <= CDRESULT_COLLISION) {
|
||||
// empty
|
||||
}
|
||||
} else if (result == CDRESULT_COLLISION) {
|
||||
struct coord sp48;
|
||||
struct coord sp36;
|
||||
// The quarter delta also had an obstacle. This must have been a
|
||||
// different obstacle to the one that was hit in the full delta.
|
||||
|
||||
if (bwalk0f0c47d0(arg0, &sp76, &sp64, &sp48, &sp36, types) >= CDRESULT_NOCOLLISION) {
|
||||
bwalk0f0c4d98();
|
||||
// Try again with a quarter of the way to the closer obstacle.
|
||||
result = bwalk_try_quarterdelta(deltapos, &edgeb_vtx1, &edgeb_vtx2, &edgec_vtx1, &edgec_vtx2, cdtypes);
|
||||
|
||||
if (result >= CDRESULT_NOCOLLISION) {
|
||||
bwalk_stub();
|
||||
}
|
||||
|
||||
if (arg1
|
||||
&& bwalk0f0c494c(arg0, &sp76, &sp64, types) <= CDRESULT_COLLISION
|
||||
&& bwalk0f0c494c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION
|
||||
&& bwalk0f0c4a5c(arg0, &sp76, &sp64, types) <= CDRESULT_COLLISION) {
|
||||
bwalk0f0c4a5c(arg0, &sp100, &sp88, types);
|
||||
// Regardless of what happened above, try to move them to the edge of the closer obstacle.
|
||||
// If that fails, try to move them to the edge of the further obstacle? This will surely fail though?
|
||||
// Then try to slide along the closer obstacle's edge, which may work.
|
||||
// Then try to slide along the further obstacle's edge, which will fail.
|
||||
if (notrleaning
|
||||
&& bwalk_try_slide_along_edge(deltapos, &edgeb_vtx1, &edgeb_vtx2, cdtypes) <= CDRESULT_COLLISION
|
||||
&& bwalk_try_slide_along_edge(deltapos, &edgea_vtx1, &edgea_vtx2, cdtypes) <= CDRESULT_COLLISION
|
||||
&& bwalk_try_slide_along_corner(deltapos, &edgeb_vtx1, &edgeb_vtx2, cdtypes) <= CDRESULT_COLLISION
|
||||
&& bwalk_try_slide_along_corner(deltapos, &edgea_vtx1, &edgea_vtx2, cdtypes) <= CDRESULT_COLLISION) {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bwalk0f0c4d98();
|
||||
bwalk_stub();
|
||||
}
|
||||
|
||||
void bwalk_update_prev_pos(void)
|
||||
|
@ -1372,7 +1422,7 @@ void bwalk_update_speed_theta(void)
|
|||
}
|
||||
}
|
||||
|
||||
void bwalk0f0c69b8(void)
|
||||
void bwalk_update_horizontal(void)
|
||||
{
|
||||
s32 i;
|
||||
f32 spe0;
|
||||
|
@ -1450,7 +1500,7 @@ void bwalk0f0c69b8(void)
|
|||
g_Vars.currentplayer->gunspeed = 0.0f;
|
||||
|
||||
bmove_update_move_init_speed(&spcc);
|
||||
bwalk_calculate_new_position_with_push(&spcc, 0.0f, true, 0.0f, CDTYPE_ALL);
|
||||
bwalk_try_delta(&spcc, 0.0f, true, 0.0f, CDTYPE_ALL);
|
||||
} else {
|
||||
bwalk_apply_crouch_speed();
|
||||
bwalk_update_crouch_offset();
|
||||
|
@ -1597,7 +1647,7 @@ void bwalk0f0c69b8(void)
|
|||
} else {
|
||||
player_get_bbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
|
||||
|
||||
if (!cd_0002a13c(&g_Vars.currentplayer->prop->pos,
|
||||
if (!is_cyl_touching_tile_with_flags(&g_Vars.currentplayer->prop->pos,
|
||||
radius * 1.1f, ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
(g_Vars.currentplayer->vv_manground - g_Vars.currentplayer->prop->pos.y) + 1.0f,
|
||||
g_Vars.currentplayer->prop->rooms, GEOFLAG_LADDER | GEOFLAG_LADDER_PLAYERONLY)) {
|
||||
|
@ -1628,7 +1678,7 @@ void bwalk0f0c69b8(void)
|
|||
sp8c = g_Vars.currentplayer->prop->pos.x;
|
||||
sp88 = g_Vars.currentplayer->prop->pos.z;
|
||||
|
||||
bwalk0f0c63bc(&spcc, g_Vars.currentplayer->swaytarget == 0.0f, CDTYPE_ALL);
|
||||
bwalk_resolve_posdelta(&spcc, g_Vars.currentplayer->swaytarget == 0.0f, CDTYPE_ALL);
|
||||
|
||||
xdelta = g_Vars.currentplayer->prop->pos.x - g_Vars.currentplayer->bondprevpos.x;
|
||||
zdelta = g_Vars.currentplayer->prop->pos.z - g_Vars.currentplayer->bondprevpos.z;
|
||||
|
@ -1743,7 +1793,7 @@ void bwalk_tick(void)
|
|||
bwalk_update_prev_pos();
|
||||
bwalk_update_theta();
|
||||
bmove_update_look();
|
||||
bwalk0f0c69b8();
|
||||
bwalk_update_horizontal();
|
||||
bwalk_update_vertical();
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
|
|
@ -648,7 +648,7 @@ bool bot_test_prop_for_pickup(struct prop *prop, struct chrdata *chr)
|
|||
dprint();
|
||||
|
||||
if ((obj->flags2 & OBJFLAG2_PICKUPWITHOUTLOS) == 0
|
||||
&& !cd_test_los06(&chrprop->pos, chrprop->rooms, &prop->pos, prop->rooms, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
&& !cd_test_los_oobtail_autoflags(&chrprop->pos, chrprop->rooms, &prop->pos, prop->rooms, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
sp3c = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -484,7 +484,7 @@ void botact_get_rocket_next_step_pos(u16 padnum, struct coord *pos)
|
|||
rooms[1] = -1;
|
||||
|
||||
pos->x = pad.pos.x;
|
||||
pos->y = cd_find_floor_y_colour_type_at_pos(&pad.pos, rooms, 0, 0) + 150;
|
||||
pos->y = cd_find_ground_at_pos_ct(&pad.pos, rooms, 0, 0) + 150;
|
||||
pos->z = pad.pos.z;
|
||||
}
|
||||
|
||||
|
|
267
src/game/chr.c
267
src/game/chr.c
|
@ -268,98 +268,154 @@ void chr_calculate_push_pos(struct chrdata *chr, struct coord *dstpos, RoomNum *
|
|||
movez = dstpos->z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_exam_cyl_move05(&prop->pos, prop->rooms, dstpos, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_cylmove_oobfail_findclosest(&prop->pos, prop->rooms, dstpos, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_exam_cyl_move01(&prop->pos, dstpos, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_volume_closestedge(&prop->pos, dstpos, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_exam_cyl_move01(&prop->pos, dstpos, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_volume_closestedge(&prop->pos, dstpos, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult != CDRESULT_ERROR) {
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
// The move was completely valid
|
||||
if (arg3) {
|
||||
chr->invalidmove = 0;
|
||||
chr->lastmoveok60 = g_Vars.lvframe60;
|
||||
}
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
// empty
|
||||
} else if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
// The move was completely valid
|
||||
if (arg3) {
|
||||
chr->invalidmove = 0;
|
||||
chr->lastmoveok60 = g_Vars.lvframe60;
|
||||
}
|
||||
|
||||
moveok = true;
|
||||
} else {
|
||||
moveok = true;
|
||||
} else {
|
||||
// Collision
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr.c");
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
cd_get_edge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
#else
|
||||
cd_get_edge(&sp78, &sp6c, 451, "chr.c");
|
||||
cd_get_edge(&sp78, &sp6c, 451, "chr.c");
|
||||
#endif
|
||||
|
||||
// Attempt to find a valid position - method #1
|
||||
sp60.x = dstpos->x - prop->pos.x;
|
||||
sp60.z = dstpos->z - prop->pos.z;
|
||||
// Attempt to find a valid position - method #1
|
||||
sp60.x = dstpos->x - prop->pos.x;
|
||||
sp60.z = dstpos->z - prop->pos.z;
|
||||
|
||||
if (sp78.f[0] != sp6c.f[0] || sp78.f[2] != sp6c.f[2]) {
|
||||
sp54.x = sp6c.x - sp78.x;
|
||||
sp54.z = sp6c.z - sp78.z;
|
||||
if (sp78.f[0] != sp6c.f[0] || sp78.f[2] != sp6c.f[2]) {
|
||||
sp54.x = sp6c.x - sp78.x;
|
||||
sp54.z = sp6c.z - sp78.z;
|
||||
|
||||
value = 1.0f / sqrtf(sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2]);
|
||||
value = 1.0f / sqrtf(sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2]);
|
||||
|
||||
sp54.x *= value;
|
||||
sp54.z *= value;
|
||||
sp54.x *= value;
|
||||
sp54.z *= value;
|
||||
|
||||
value = sp60.f[0] * sp54.f[0] + sp60.f[2] * sp54.f[2];
|
||||
value = sp60.f[0] * sp54.f[0] + sp60.f[2] * sp54.f[2];
|
||||
|
||||
sp44.x = sp54.x * value + prop->pos.x;
|
||||
sp44.y = dstpos->y;
|
||||
sp44.z = sp54.z * value + prop->pos.z;
|
||||
sp44.x = sp54.x * value + prop->pos.x;
|
||||
sp44.y = dstpos->y;
|
||||
sp44.z = sp54.z * value + prop->pos.z;
|
||||
|
||||
los_find_intersecting_rooms_exhaustive(&prop->pos, prop->rooms, &sp44, dstrooms, sp84, 20);
|
||||
los_find_intersecting_rooms_exhaustive(&prop->pos, prop->rooms, &sp44, dstrooms, sp84, 20);
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
for (j = 0; dstrooms[j] != -1; j++) {
|
||||
if (dstrooms[j] == chr->floorroom) {
|
||||
dstrooms[0] = chr->floorroom;
|
||||
dstrooms[1] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
chr_find_entered_rooms_at_pos(chr, &sp44, dstrooms);
|
||||
|
||||
movex = sp44.x - prop->pos.x;
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_test_cyl_move02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_test_volume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_test_volume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
dstpos->x = sp44.x;
|
||||
dstpos->z = sp44.z;
|
||||
chr->invalidmove = 2;
|
||||
moveok = true;
|
||||
for (j = 0; dstrooms[j] != -1; j++) {
|
||||
if (dstrooms[j] == chr->floorroom) {
|
||||
dstrooms[0] = chr->floorroom;
|
||||
dstrooms[1] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!moveok) {
|
||||
// Attempt to find a valid position - method #2
|
||||
sp54.x = sp78.x - dstpos->x;
|
||||
sp54.z = sp78.z - dstpos->z;
|
||||
chr_find_entered_rooms_at_pos(chr, &sp44, dstrooms);
|
||||
|
||||
movex = sp44.x - prop->pos.x;
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_test_cylmove_oobfail(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
dstpos->x = sp44.x;
|
||||
dstpos->z = sp44.z;
|
||||
chr->invalidmove = 2;
|
||||
moveok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!moveok) {
|
||||
// Attempt to find a valid position - method #2
|
||||
sp54.x = sp78.x - dstpos->x;
|
||||
sp54.z = sp78.z - dstpos->z;
|
||||
|
||||
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= radius * radius) {
|
||||
if (sp78.f[0] != prop->pos.f[0] || sp78.f[2] != prop->pos.f[2]) {
|
||||
sp54.x = -(sp78.z - prop->pos.z);
|
||||
sp54.z = sp78.x - prop->pos.x;
|
||||
|
||||
value = 1.0f / sqrtf(sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2]);
|
||||
|
||||
sp54.x *= value;
|
||||
sp54.z *= value;
|
||||
|
||||
value = sp60.f[0] * sp54.f[0] + sp60.f[2] * sp54.f[2];
|
||||
|
||||
sp44.x = sp54.x * value + prop->pos.x;
|
||||
sp44.y = dstpos->y;
|
||||
sp44.z = sp54.z * value + prop->pos.z;
|
||||
|
||||
los_find_intersecting_rooms_exhaustive(&prop->pos, prop->rooms, &sp44, dstrooms, sp84, 20);
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
for (k = 0; dstrooms[k] != -1; k++) {
|
||||
if (dstrooms[k] == chr->floorroom) {
|
||||
dstrooms[0] = chr->floorroom;
|
||||
dstrooms[1] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
chr_find_entered_rooms_at_pos(chr, &sp44, dstrooms);
|
||||
|
||||
movex = sp44.x - prop->pos.x;
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_test_cylmove_oobfail(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
dstpos->x = sp44.x;
|
||||
dstpos->z = sp44.z;
|
||||
chr->invalidmove = 2;
|
||||
moveok = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sp54.x = sp6c.x - dstpos->x;
|
||||
sp54.z = sp6c.z - dstpos->z;
|
||||
|
||||
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= radius * radius) {
|
||||
if (sp78.f[0] != prop->pos.f[0] || sp78.f[2] != prop->pos.f[2]) {
|
||||
sp54.x = -(sp78.z - prop->pos.z);
|
||||
sp54.z = sp78.x - prop->pos.x;
|
||||
if (sp6c.f[0] != prop->pos.f[0] || sp6c.f[2] != prop->pos.f[2]) {
|
||||
sp54.x = -(sp6c.z - prop->pos.z);
|
||||
sp54.z = sp6c.x - prop->pos.x;
|
||||
|
||||
value = 1.0f / sqrtf(sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2]);
|
||||
|
||||
|
@ -375,8 +431,8 @@ void chr_calculate_push_pos(struct chrdata *chr, struct coord *dstpos, RoomNum *
|
|||
los_find_intersecting_rooms_exhaustive(&prop->pos, prop->rooms, &sp44, dstrooms, sp84, 20);
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
for (k = 0; dstrooms[k] != -1; k++) {
|
||||
if (dstrooms[k] == chr->floorroom) {
|
||||
for (l = 0; dstrooms[l] != -1; l++) {
|
||||
if (dstrooms[l] == chr->floorroom) {
|
||||
dstrooms[0] = chr->floorroom;
|
||||
dstrooms[1] = -1;
|
||||
break;
|
||||
|
@ -390,13 +446,13 @@ void chr_calculate_push_pos(struct chrdata *chr, struct coord *dstpos, RoomNum *
|
|||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_test_cyl_move02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_cylmove_oobfail(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_test_volume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_test_volume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cd_test_volume_simple(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
|
@ -406,61 +462,6 @@ void chr_calculate_push_pos(struct chrdata *chr, struct coord *dstpos, RoomNum *
|
|||
moveok = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sp54.x = sp6c.x - dstpos->x;
|
||||
sp54.z = sp6c.z - dstpos->z;
|
||||
|
||||
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= radius * radius) {
|
||||
if (sp6c.f[0] != prop->pos.f[0] || sp6c.f[2] != prop->pos.f[2]) {
|
||||
sp54.x = -(sp6c.z - prop->pos.z);
|
||||
sp54.z = sp6c.x - prop->pos.x;
|
||||
|
||||
value = 1.0f / sqrtf(sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2]);
|
||||
|
||||
sp54.x *= value;
|
||||
sp54.z *= value;
|
||||
|
||||
value = sp60.f[0] * sp54.f[0] + sp60.f[2] * sp54.f[2];
|
||||
|
||||
sp44.x = sp54.x * value + prop->pos.x;
|
||||
sp44.y = dstpos->y;
|
||||
sp44.z = sp54.z * value + prop->pos.z;
|
||||
|
||||
los_find_intersecting_rooms_exhaustive(&prop->pos, prop->rooms, &sp44, dstrooms, sp84, 20);
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
for (l = 0; dstrooms[l] != -1; l++) {
|
||||
if (dstrooms[l] == chr->floorroom) {
|
||||
dstrooms[0] = chr->floorroom;
|
||||
dstrooms[1] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
chr_find_entered_rooms_at_pos(chr, &sp44, dstrooms);
|
||||
|
||||
movex = sp44.x - prop->pos.x;
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd_test_cyl_move02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd_test_volume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd_test_volume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
dstpos->x = sp44.x;
|
||||
dstpos->z = sp44.z;
|
||||
chr->invalidmove = 2;
|
||||
moveok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +503,7 @@ bool chr_ascend(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 amou
|
|||
los_find_final_room_exhaustive(pos, rooms, &newpos, newrooms);
|
||||
chr_find_entered_rooms_at_pos(chr, &newpos, newrooms);
|
||||
chr_set_perim_enabled(chr, false);
|
||||
result = cd_test_volume(&newpos, radius, newrooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
result = cd_test_volume_simple(&newpos, radius, newrooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - chr->prop->pos.y,
|
||||
ymin - chr->prop->pos.y);
|
||||
chr_set_perim_enabled(chr, true);
|
||||
|
@ -558,7 +559,7 @@ bool chr_update_position(struct model *model, struct coord *arg1, struct coord *
|
|||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, arg2, spfc);
|
||||
}
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
ground = cd_find_ground_at_cyl_ctfril(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
|
||||
if (ground < -1000000) {
|
||||
ground = 0.0f;
|
||||
|
@ -630,12 +631,12 @@ bool chr_update_position(struct model *model, struct coord *arg1, struct coord *
|
|||
chr->height = 135.0f;
|
||||
} else if (chr->actiontype == ACT_GOPOS && (chr->act_gopos.flags & GOPOSFLAG_CROUCH)) {
|
||||
chr->height = 90.0f;
|
||||
} else if (cd_0002a13c(&chr->prop->pos, chr->radius * 1.1f,
|
||||
} else if (is_cyl_touching_tile_with_flags(&chr->prop->pos, chr->radius * 1.1f,
|
||||
chr->manground + 185.0f - chr->prop->pos.y,
|
||||
chr->manground - 10.0f - chr->prop->pos.y,
|
||||
chr->prop->rooms, GEOFLAG_AIBOTDUCK)) {
|
||||
chr->height = 135.0f;
|
||||
} else if (cd_0002a13c(&chr->prop->pos, chr->radius * 1.1f,
|
||||
} else if (is_cyl_touching_tile_with_flags(&chr->prop->pos, chr->radius * 1.1f,
|
||||
chr->manground + 135.0f - chr->prop->pos.y,
|
||||
chr->manground - 10.0f - chr->prop->pos.y,
|
||||
chr->prop->rooms, GEOFLAG_AIBOTCROUCH)) {
|
||||
|
@ -827,7 +828,7 @@ bool chr_update_position(struct model *model, struct coord *arg1, struct coord *
|
|||
sp94 = spfc;
|
||||
}
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(sp98, chr->radius, sp94,
|
||||
ground = cd_find_ground_at_cyl_ctfril(sp98, chr->radius, sp94,
|
||||
&chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
@ -850,7 +851,7 @@ bool chr_update_position(struct model *model, struct coord *arg1, struct coord *
|
|||
|
||||
lvupdate60freal = 0.0f;
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(arg2, chr->radius, spfc,
|
||||
ground = cd_find_ground_at_cyl_ctfril(arg2, chr->radius, spfc,
|
||||
&chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
}
|
||||
#endif
|
||||
|
@ -1328,7 +1329,7 @@ struct prop *chr_place(struct prop *prop, struct model *model,
|
|||
testpos.y = pos->y + 100;
|
||||
testpos.z = pos->z;
|
||||
|
||||
chr->ground = chr->manground = ground = cd_find_ground_info_at_cyl(&testpos, chr->radius, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
chr->ground = chr->manground = ground = cd_find_ground_at_cyl_ctfril(&testpos, chr->radius, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
|
||||
chr->sumground = ground * (PAL ? 8.4175090789795f : 9.999998f);
|
||||
|
||||
|
|
|
@ -1631,15 +1631,15 @@ f32 chr_prop_get_available_dist_at_angle(struct prop *prop, f32 angle, f32 scand
|
|||
|
||||
chr_set_perim_enabled(chr, false);
|
||||
|
||||
if (cd_exam_cyl_move03(&prop->pos, prop->rooms, &farpos, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest(&prop->pos, prop->rooms, &farpos, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
result = scandist;
|
||||
} else {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&sp3c, 2377, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&sp3c, 2377, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&sp3c, 2377, "chraction.c");
|
||||
cd_get_obstacle_pos(&sp3c, 2377, "chraction.c");
|
||||
#else
|
||||
cd_get_pos(&sp3c, 2417, "chraction.c");
|
||||
cd_get_obstacle_pos(&sp3c, 2417, "chraction.c");
|
||||
#endif
|
||||
|
||||
xdiff = sp3c.x - prop->pos.x;
|
||||
|
@ -5136,7 +5136,7 @@ void chr_die(struct chrdata *chr, s32 aplayernum)
|
|||
*/
|
||||
bool chr_can_move_directly_to_pos(struct chrdata *chr,
|
||||
struct coord *frompos, RoomNum *fromrooms,
|
||||
struct coord *topos, struct coord *torooms, s32 arg5)
|
||||
struct coord *topos, struct coord *torooms, s32 cdtypes)
|
||||
{
|
||||
bool result = false;
|
||||
f32 ymax;
|
||||
|
@ -5148,8 +5148,8 @@ bool chr_can_move_directly_to_pos(struct chrdata *chr,
|
|||
chr_get_bbox(prop, &radius, &ymax, &ymin);
|
||||
chr_set_perim_enabled(chr, false);
|
||||
|
||||
if (cd_test_cyl_move04(frompos, fromrooms, topos, rooms, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cyl_move01(topos, rooms, torooms, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_getfinalroom(frompos, fromrooms, topos, rooms, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok(topos, rooms, torooms, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -5194,8 +5194,8 @@ bool chr_prop_can_move_to_pos_without_nav(struct chrdata *chr,
|
|||
chr_get_bbox(prop, &radius, &ymax, &ymin);
|
||||
|
||||
// Test if the chr has cylindar gap to topos
|
||||
if ((torooms != NULL && cd_test_cyl_move02(frompos, fromrooms, topos, torooms, cdtypes, true, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)
|
||||
|| (torooms == NULL && cd_test_cyl_move01(frompos, fromrooms, topos, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
if ((torooms != NULL && cd_test_cylmove_oobfail(frompos, fromrooms, topos, torooms, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)
|
||||
|| (torooms == NULL && cd_test_cylmove_oobok(frompos, fromrooms, topos, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
// If no dir was given to this function, calculate it
|
||||
if (dir == NULL) {
|
||||
dir = &tmpdir;
|
||||
|
@ -5228,8 +5228,8 @@ bool chr_prop_can_move_to_pos_without_nav(struct chrdata *chr,
|
|||
neartopos.y = topos->y;
|
||||
neartopos.z = topos->z - turndistx;
|
||||
|
||||
if (cd_test_cyl_move04(frompos, fromrooms, &nearfrompos, nearfromrooms, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& cd_test_cyl_move01(&nearfrompos, nearfromrooms, &neartopos, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_getfinalroom(frompos, fromrooms, &nearfrompos, nearfromrooms, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& cd_test_cylmove_oobok(&nearfrompos, nearfromrooms, &neartopos, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
// And again, but perpendicular on the other side
|
||||
nearfrompos.x = frompos->x - turndistz;
|
||||
nearfrompos.y = frompos->y;
|
||||
|
@ -5239,8 +5239,8 @@ bool chr_prop_can_move_to_pos_without_nav(struct chrdata *chr,
|
|||
neartopos.y = topos->y;
|
||||
neartopos.z = topos->z + turndistx;
|
||||
|
||||
if (cd_test_cyl_move04(frompos, fromrooms, &nearfrompos, nearfromrooms, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& cd_test_cyl_move01(&nearfrompos, nearfromrooms, &neartopos, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_getfinalroom(frompos, fromrooms, &nearfrompos, nearfromrooms, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& cd_test_cylmove_oobok(&nearfrompos, nearfromrooms, &neartopos, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -5723,7 +5723,7 @@ void chr_nav_tick_magic(struct chrdata *chr, struct waydata *waydata, f32 speed,
|
|||
rooms_copy(rooms, sp118);
|
||||
chr_find_entered_rooms_at_pos(chr, arg3, sp118);
|
||||
|
||||
ground = cd_find_ground_info_at_cyl(arg3, chr->radius, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
|
||||
ground = cd_find_ground_at_cyl_ctfril(arg3, chr->radius, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
|
||||
|
||||
spf4.x = arg3->x;
|
||||
spf4.y = prop->pos.y - chr->ground + ground;
|
||||
|
@ -5733,7 +5733,7 @@ void chr_nav_tick_magic(struct chrdata *chr, struct waydata *waydata, f32 speed,
|
|||
chr_find_entered_rooms_at_pos(chr, &spf4, sp118);
|
||||
chr_get_bbox(chr->prop, &radius, &ymax, &ymin);
|
||||
|
||||
if (cd_test_volume(&spf4, chr->radius, sp118, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd_test_volume_simple(&spf4, chr->radius, sp118, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
// Reached end of segment with no collision
|
||||
prop->pos.x = spf4.x;
|
||||
prop->pos.y = spf4.y;
|
||||
|
@ -6319,7 +6319,7 @@ void chr_start_patrol(struct chrdata *chr, struct path *path)
|
|||
|
||||
chr_set_perim_enabled(chr, false);
|
||||
|
||||
if (cd_test_cyl_move04(&prop->pos, prop->rooms, &pad.pos, rooms, CDTYPE_BG, 1,
|
||||
if (cd_test_cylmove_oobok_getfinalroom(&prop->pos, prop->rooms, &pad.pos, rooms, CDTYPE_BG, CHECKVERTICAL_YES,
|
||||
ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
nextstep = chr->patrolnextstep;
|
||||
}
|
||||
|
@ -6458,12 +6458,12 @@ bool chr_has_los_to_entity(struct chrdata *chr, struct coord *chrpos, RoomNum *c
|
|||
|
||||
los_find_final_room_properly(chrpos, chrrooms, &frompos, fromrooms);
|
||||
|
||||
if (cd_test_los05(&frompos, fromrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
if (cd_test_los_oobfail(&frompos, fromrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
chr_record_last_visible_target_time(chr);
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
if (cd_test_los05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
if (cd_test_los_oobfail(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
chr_record_last_visible_target_time(chr);
|
||||
result = true;
|
||||
}
|
||||
|
@ -6480,13 +6480,13 @@ bool chr_has_los_to_entity(struct chrdata *chr, struct coord *chrpos, RoomNum *c
|
|||
|
||||
chr_set_perim_enabled(targetchr, false);
|
||||
|
||||
if (cd_test_los05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
if (cd_test_los_oobfail(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
chr_set_perim_enabled(targetchr, true);
|
||||
} else if (attackflags & ATTACKFLAG_AIMATPAD) {
|
||||
if (cd_test_los05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
if (cd_test_los_oobfail(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -6530,7 +6530,7 @@ bool chr_has_los_to_chr(struct chrdata *chr, struct chrdata *target, RoomNum *ro
|
|||
|
||||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, &pos, rooms);
|
||||
|
||||
if (cd_test_los07(&pos, rooms, &target->prop->pos, target->prop->rooms, sp88,
|
||||
if (cd_test_los_oobfail_getfinalroom(&pos, rooms, &target->prop->pos, target->prop->rooms, sp88,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
cansee = true;
|
||||
|
@ -6589,7 +6589,7 @@ bool chr_has_los_to_pos(struct chrdata *chr, struct coord *pos, RoomNum *rooms)
|
|||
chr_set_perim_enabled(chr, false);
|
||||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, &eyepos, chrrooms);
|
||||
|
||||
if (cd_test_los05(&eyepos, chrrooms, pos, rooms,
|
||||
if (cd_test_los_oobfail(&eyepos, chrrooms, pos, rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
result = true;
|
||||
|
@ -7443,17 +7443,17 @@ bool chr_try_run_from_target(struct chrdata *chr)
|
|||
prop_get_bbox(prop, &radius, &ymax, &ymin);
|
||||
|
||||
// If dst runs into a wall, set it to closest valid spot
|
||||
if (cd_exam_cyl_move03(&prop->pos, prop->rooms, &dst,
|
||||
if (cd_test_cylmove_oobok_findclosest(&prop->pos, prop->rooms, &dst,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_pos(&dst, 8796, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&dst, 8796, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&dst, 8793, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&dst, 8793, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&dst, 8788, "chraction.c");
|
||||
cd_get_obstacle_pos(&dst, 8788, "chraction.c");
|
||||
#else
|
||||
cd_get_pos(&dst, 8782, "chraction.c");
|
||||
cd_get_obstacle_pos(&dst, 8782, "chraction.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -7547,7 +7547,7 @@ bool chr_go_to_cover_prop(struct chrdata *chr)
|
|||
if (propheight > chrheight * 0.4f && propheight < chrheight * 0.9f) {
|
||||
prop_set_perim_enabled(prop, false);
|
||||
|
||||
if (cd_test_los04(&chrprop->pos, chrprop->rooms, &prop->pos, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
if (cd_test_los_oobok_autoflags(&chrprop->pos, chrprop->rooms, &prop->pos, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
prop_set_perim_enabled(prop, true);
|
||||
|
||||
dstpos.x = prop->pos.x - (targetprop->pos.x - prop->pos.x) / targetdist * (propradius * 1.25f + chrradius);
|
||||
|
@ -7623,7 +7623,7 @@ bool chr_consider_grenade_throw(struct chrdata *chr, u32 attackflags, u32 entity
|
|||
pos.z = target->pos.z;
|
||||
}
|
||||
|
||||
if (target && cd_test_los04(&chr->prop->pos, chr->prop->rooms, &pos,
|
||||
if (target && cd_test_los_oobok_autoflags(&chr->prop->pos, chr->prop->rooms, &pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
|
||||
struct prop *leftprop = chr_get_held_prop(chr, HAND_LEFT);
|
||||
struct prop *rightprop = chr_get_held_prop(chr, HAND_RIGHT);
|
||||
|
@ -7742,7 +7742,7 @@ void chr_punch_inflict_damage(struct chrdata *chr, s32 damage, s32 range, u8 rev
|
|||
|
||||
if (chr_is_target_in_fov(chr, 20, reverse)
|
||||
&& chr_get_distance_to_target(chr) < range
|
||||
&& cd_test_los04(&chr->prop->pos, chr->prop->rooms, &targetprop->pos,
|
||||
&& cd_test_los_oobok_autoflags(&chr->prop->pos, chr->prop->rooms, &targetprop->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
|
||||
vector.x = targetprop->pos.x - chr->prop->pos.x;
|
||||
vector.y = 0;
|
||||
|
@ -10022,7 +10022,7 @@ void chr_shoot(struct chrdata *chr, s32 handnum)
|
|||
// How nice of the developers to check for this!
|
||||
chr_set_perim_enabled(chr, false);
|
||||
|
||||
if (cd_test_los10(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms,
|
||||
if (cd_test_los_oobok_getfinalroom(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms,
|
||||
CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | extracdtypes,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
firingthisframe = false;
|
||||
|
@ -10090,16 +10090,16 @@ void chr_shoot(struct chrdata *chr, s32 handnum)
|
|||
g_Vars.useperimshoot = true;
|
||||
}
|
||||
|
||||
if (cd_exam_los08(&gunpos, gunrooms, &hitpos, cdtypes, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_findclosest(&gunpos, gunrooms, &hitpos, cdtypes, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
hitsomething = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_pos(&hitpos, 12080, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&hitpos, 12080, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&hitpos, 12077, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&hitpos, 12077, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&hitpos, 12072, "chraction.c");
|
||||
cd_get_obstacle_pos(&hitpos, 12072, "chraction.c");
|
||||
#else
|
||||
cd_get_pos(&hitpos, 12086, "chraction.c");
|
||||
cd_get_obstacle_pos(&hitpos, 12086, "chraction.c");
|
||||
#endif
|
||||
hitprop = cd_get_obstacle_prop();
|
||||
}
|
||||
|
@ -11896,8 +11896,8 @@ bool chr_nav_can_see_next_pos(struct chrdata *chr, struct coord *chrpos, RoomNum
|
|||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z - spc8);
|
||||
|
||||
if (cd_exam_cyl_move07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_exam_cyl_move03(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, &sp6c, sp50, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_test_cylmove_oobok_findclosest(&sp6c, sp50, &sp60, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spbc = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_edge(&spac, &spa0, 14154, "chr/chraction.c");
|
||||
|
@ -11921,8 +11921,8 @@ bool chr_nav_can_see_next_pos(struct chrdata *chr, struct coord *chrpos, RoomNum
|
|||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z + spc8);
|
||||
|
||||
if (cd_exam_cyl_move07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_exam_cyl_move03(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, &sp6c, sp50, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_test_cylmove_oobok_findclosest(&sp6c, chrrooms, &sp60, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spb8 = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_edge(&sp94, &sp88, 14169, "chr/chraction.c");
|
||||
|
@ -11965,8 +11965,8 @@ bool chr_nav_can_see_next_pos(struct chrdata *chr, struct coord *chrpos, RoomNum
|
|||
rightpos->x = sp88.x;
|
||||
rightpos->y = sp88.y;
|
||||
rightpos->z = sp88.z;
|
||||
} else if (cd_exam_cyl_move07(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!arg9 || cd_exam_cyl_move01(chrpos, aimpos, chrradius, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
} else if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, aimpos, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!arg9 || cd_test_volume_closestedge(chrpos, aimpos, chrradius, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
result = true;
|
||||
} else {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
|
@ -12051,12 +12051,13 @@ bool chr_nav_check_for_obstacle(struct chrdata *chr, struct coord *chrpos, RoomN
|
|||
sp6c.x = chrpos->x + spcc;
|
||||
sp6c.y = chrpos->y;
|
||||
sp6c.z = chrpos->z - spd0;
|
||||
|
||||
sp60.x = (spd4.x * negchrradius) + (aimpos->x + spc4);
|
||||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z - spc8);
|
||||
|
||||
if (cd_exam_cyl_move07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_exam_cyl_move03(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, &sp6c, sp50, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_test_cylmove_oobok_findclosest(&sp6c, sp50, &sp60, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spbc = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_edge(&spac, &spa0, 14319, "chr/chraction.c");
|
||||
|
@ -12070,7 +12071,7 @@ bool chr_nav_check_for_obstacle(struct chrdata *chr, struct coord *chrpos, RoomN
|
|||
cd_get_edge(&spac, &spa0, 14323, "chraction.c");
|
||||
#endif
|
||||
chr_nav_consider_swap_edges(&spac, &spa0, &spd4);
|
||||
value1 = cd_00024e40();
|
||||
value1 = cd_get_sqdistance();
|
||||
}
|
||||
|
||||
sp6c.x = chrpos->x - spcc;
|
||||
|
@ -12081,8 +12082,8 @@ bool chr_nav_check_for_obstacle(struct chrdata *chr, struct coord *chrpos, RoomN
|
|||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z + spc8);
|
||||
|
||||
if (cd_exam_cyl_move07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_exam_cyl_move03(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, &sp6c, sp50, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd_test_cylmove_oobok_findclosest(&sp6c, chrrooms, &sp60, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spb8 = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_edge(&sp94, &sp88, 14334, "chr/chraction.c");
|
||||
|
@ -12096,7 +12097,7 @@ bool chr_nav_check_for_obstacle(struct chrdata *chr, struct coord *chrpos, RoomN
|
|||
cd_get_edge(&sp94, &sp88, 14338, "chraction.c");
|
||||
#endif
|
||||
chr_nav_consider_swap_edges(&sp94, &sp88, &spd4);
|
||||
value2 = cd_00024e40();
|
||||
value2 = cd_get_sqdistance();
|
||||
}
|
||||
|
||||
if (spbc && spb8) {
|
||||
|
@ -12133,8 +12134,8 @@ bool chr_nav_check_for_obstacle(struct chrdata *chr, struct coord *chrpos, RoomN
|
|||
rightpos->x = sp88.x;
|
||||
rightpos->y = sp88.y;
|
||||
rightpos->z = sp88.z;
|
||||
} else if (cd_exam_cyl_move07(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!hasobstacle || cd_exam_cyl_move01(chrpos, aimpos, chrradius, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
} else if (cd_test_cylmove_oobok_findclosest_getfinalroom(chrpos, chrrooms, aimpos, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!hasobstacle || cd_test_volume_closestedge(chrpos, aimpos, chrradius, sp40, cdtypes, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
result = true;
|
||||
} else {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
|
@ -12261,9 +12262,9 @@ struct prop *chr_open_door(struct chrdata *chr, struct coord *rangepos)
|
|||
{
|
||||
struct prop *doorprop = NULL;
|
||||
|
||||
if (cd_exam_cyl_move03(&chr->prop->pos, chr->prop->rooms, rangepos,
|
||||
if (cd_test_cylmove_oobok_findclosest(&chr->prop->pos, chr->prop->rooms, rangepos,
|
||||
CDTYPE_BG | CDTYPE_CLOSEDDOORS | CDTYPE_AJARDOORS,
|
||||
1, 0, 0) == CDRESULT_COLLISION) {
|
||||
CHECKVERTICAL_YES, 0, 0) == CDRESULT_COLLISION) {
|
||||
doorprop = cd_get_obstacle_prop();
|
||||
}
|
||||
|
||||
|
@ -12734,7 +12735,7 @@ bool chr_gopos_update_lift_action(struct chrdata *chr, u32 curpadflags, bool arg
|
|||
|
||||
rooms[0] = nextpad.room;
|
||||
|
||||
nextground = cd_find_floor_y_colour_type_at_pos(&nextpad.pos, rooms, NULL, NULL);
|
||||
nextground = cd_find_ground_at_pos_ct(&nextpad.pos, rooms, NULL, NULL);
|
||||
|
||||
// Begin exiting lift if lift is 30cm under destination or higher
|
||||
advance = (lifty >= nextground - 30);
|
||||
|
@ -13182,7 +13183,7 @@ bool chr_skjump(struct chrdata *chr, u8 pouncebits, u8 arg2, s32 arg3, u8 arg4)
|
|||
f32 ymin;
|
||||
struct prop *prop = chr->prop;
|
||||
struct prop *target = chr_get_target_prop(chr);
|
||||
bool iVar2;
|
||||
bool cdresult;
|
||||
f32 distance = chr_get_distance_to_coord(chr, &target->pos);
|
||||
f32 diffs[2];
|
||||
f32 thing;
|
||||
|
@ -13195,13 +13196,13 @@ bool chr_skjump(struct chrdata *chr, u8 pouncebits, u8 arg2, s32 arg3, u8 arg4)
|
|||
chr_get_bbox(prop, &radius, &ymax, &ymin);
|
||||
chr_set_perim_enabled(chr, false);
|
||||
prop_set_perim_enabled(target, false);
|
||||
iVar2 = cd_test_cyl_move01(&prop->pos, prop->rooms, &target->pos,
|
||||
cdresult = cd_test_cylmove_oobok(&prop->pos, prop->rooms, &target->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
chr_set_perim_enabled(chr, true);
|
||||
prop_set_perim_enabled(target, true);
|
||||
|
||||
if (iVar2) {
|
||||
if (cdresult != CDRESULT_COLLISION) {
|
||||
diffs[0] = target->pos.x - chr->prop->pos.x;
|
||||
diffs[1] = target->pos.z - chr->prop->pos.z;
|
||||
thing = sqrtf(diffs[0] * diffs[0] + diffs[1] * diffs[1]) * 2.5f / PALUPF(21.0f);
|
||||
|
@ -13217,7 +13218,7 @@ bool chr_skjump(struct chrdata *chr, u8 pouncebits, u8 arg2, s32 arg3, u8 arg4)
|
|||
chr->act_skjump.hit = false;
|
||||
chr->act_skjump.timer60 = time60;
|
||||
chr->act_skjump.total60 = time60;
|
||||
chr->act_skjump.ground = cd_find_ground_at_cyl(&chr->prop->pos, chr->radius, chr->prop->rooms, NULL, NULL);
|
||||
chr->act_skjump.ground = cd_find_ground_at_cyl_ct(&chr->prop->pos, chr->radius, chr->prop->rooms, NULL, NULL);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -14516,9 +14517,9 @@ bool chr_is_target_aiming_at_me(struct chrdata *chr)
|
|||
|
||||
if (target->type == PROPTYPE_PLAYER) {
|
||||
if (g_Vars.bondvisible &&
|
||||
(cd_test_los05(&target->pos, target->rooms, &chr->prop->pos, chr->prop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SIGHT))) {
|
||||
cd_test_los_oobfail(&target->pos, target->rooms, &chr->prop->pos, chr->prop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
struct model *model = chr->model;
|
||||
struct coord playerpos;
|
||||
struct coord playeraimdir;
|
||||
|
@ -14950,7 +14951,7 @@ bool chr_set_pad_preset_to_pad_on_route_to_target(struct chrdata *chr)
|
|||
struct pad pad;
|
||||
|
||||
if (target->type != PROPTYPE_PLAYER || g_Vars.bondvisible) {
|
||||
if (cd_test_los04(&prop->pos, prop->rooms, &target->pos, CDTYPE_BG)) {
|
||||
if (cd_test_los_oobok_autoflags(&prop->pos, prop->rooms, &target->pos, CDTYPE_BG)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -14969,8 +14970,8 @@ bool chr_set_pad_preset_to_pad_on_route_to_target(struct chrdata *chr)
|
|||
|
||||
pad_unpack(wp->padnum, PADFIELD_POS, &pad);
|
||||
|
||||
if (cd_test_los04(&target->pos, target->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cd_test_los04(&prop->pos, prop->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cd_test_los_oobok_autoflags(&target->pos, target->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cd_test_los_oobok_autoflags(&prop->pos, prop->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
chr->padpreset1 = wp->padnum;
|
||||
return true;
|
||||
}
|
||||
|
@ -15048,13 +15049,13 @@ bool chr_adjust_pos_for_spawn(f32 chrradius, struct coord *pos, RoomNum *rooms,
|
|||
// because if the chr was being spawned on top of another chr or object
|
||||
// then the calculated ground value would be raised.
|
||||
ymin = -200;
|
||||
ground = cd_find_ground_at_cyl(pos, chrradius, rooms, NULL, NULL);
|
||||
ground = cd_find_ground_at_cyl_ct(pos, chrradius, rooms, NULL, NULL);
|
||||
|
||||
if (ground > -100000 && ground - pos->y < -200) {
|
||||
ymin = ground - pos->y;
|
||||
}
|
||||
|
||||
if (cd_test_volume(pos, chrradius, rooms, types, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
if (cd_test_volume_simple(pos, chrradius, rooms, types, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chr_is_pos_offscreen(pos, rooms))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -15066,17 +15067,17 @@ bool chr_adjust_pos_for_spawn(f32 chrradius, struct coord *pos, RoomNum *rooms,
|
|||
testpos.y = pos->y;
|
||||
testpos.z = pos->z + cosf(curangle) * 60;
|
||||
|
||||
if ((onlysurrounding && cd_test_cyl_move04(pos, rooms, &testpos, testrooms, CDTYPE_ALL & ~CDTYPE_PLAYERS, 1, ymax, -200) != CDRESULT_COLLISION)
|
||||
|| (!onlysurrounding && cd_test_los11(pos, rooms, &testpos, testrooms, CDTYPE_BG))) {
|
||||
if ((onlysurrounding && cd_test_cylmove_oobok_getfinalroom(pos, rooms, &testpos, testrooms, CDTYPE_ALL & ~CDTYPE_PLAYERS, CHECKVERTICAL_YES, ymax, -200) != CDRESULT_COLLISION)
|
||||
|| (!onlysurrounding && cd_test_los_oobok_getfinalroom_autoflags(pos, rooms, &testpos, testrooms, CDTYPE_BG))) {
|
||||
chr_find_entered_rooms_at_pos(NULL, &testpos, testrooms);
|
||||
ground = cd_find_ground_at_cyl(&testpos, chrradius, testrooms, 0, 0);
|
||||
ground = cd_find_ground_at_cyl_ct(&testpos, chrradius, testrooms, 0, 0);
|
||||
ymin = -200;
|
||||
|
||||
if (ground > -100000 && ground - pos->y < -200) {
|
||||
ymin = ground - pos->y;
|
||||
}
|
||||
|
||||
if (cd_test_volume(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
if (cd_test_volume_simple(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chr_is_pos_offscreen(&testpos, testrooms))
|
||||
&& (!onlysurrounding || ground > -100000)) {
|
||||
pos->x = testpos.x;
|
||||
|
@ -15116,7 +15117,7 @@ bool chr_adjust_pos_for_spawn(f32 chrradius, struct coord *pos, RoomNum *rooms,
|
|||
types = CDTYPE_ALL;
|
||||
}
|
||||
|
||||
if (cd_test_volume(pos, chrradius, rooms, types, CHECKVERTICAL_YES, 200, -200) != CDRESULT_COLLISION
|
||||
if (cd_test_volume_simple(pos, chrradius, rooms, types, CHECKVERTICAL_YES, 200, -200) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chr_is_pos_offscreen(pos, rooms))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -15126,8 +15127,8 @@ bool chr_adjust_pos_for_spawn(f32 chrradius, struct coord *pos, RoomNum *rooms,
|
|||
testpos.y = pos->y;
|
||||
testpos.z = cosf(curangle) * 60 + pos->z;
|
||||
|
||||
if (cd_test_los11(pos, rooms, &testpos, testrooms, CDTYPE_BG)
|
||||
&& cd_test_volume(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200.0f) != CDRESULT_COLLISION
|
||||
if (cd_test_los_oobok_getfinalroom_autoflags(pos, rooms, &testpos, testrooms, CDTYPE_BG)
|
||||
&& cd_test_volume_simple(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200.0f) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chr_is_pos_offscreen(&testpos, testrooms))) {
|
||||
pos->x = testpos.x;
|
||||
pos->y = testpos.y;
|
||||
|
@ -15302,7 +15303,7 @@ bool chr_is_prop_preset_blocking_sight_to_target(struct chrdata *chr)
|
|||
chr_set_perim_enabled(chr, false);
|
||||
prop_set_perim_enabled(target, false);
|
||||
|
||||
if (!cd_test_los04(&prop->pos, prop->rooms, &target->pos,
|
||||
if (!cd_test_los_oobok_autoflags(&prop->pos, prop->rooms, &target->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
|
||||
struct prop *obstacle = cd_get_obstacle_prop();
|
||||
|
||||
|
@ -15347,7 +15348,7 @@ bool chr_move_to_pos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32
|
|||
if (chr_adjust_pos_for_spawn(chr->radius, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_WARPONSCREEN) != 0, force))
|
||||
#endif
|
||||
{
|
||||
ground = cd_find_ground_info_at_cyl(&pos2, chr->radius, rooms2, &chr->floorcol,
|
||||
ground = cd_find_ground_at_cyl_ctfril(&pos2, chr->radius, rooms2, &chr->floorcol,
|
||||
&chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
|
||||
chr->ground = ground;
|
||||
|
@ -15407,7 +15408,7 @@ bool chr_check_cover_out_of_sight(struct chrdata *chr, s32 covernum, bool soft)
|
|||
}
|
||||
|
||||
if (soft) {
|
||||
targetcanseecover = cd_test_los03(&target->pos, target->rooms, cover.pos,
|
||||
targetcanseecover = cd_test_los_oobok(&target->pos, target->rooms, cover.pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SIGHT);
|
||||
} else {
|
||||
|
@ -15705,22 +15706,25 @@ bool chr_run_from_pos(struct chrdata *chr, u32 goposflags, f32 rundist, struct c
|
|||
}
|
||||
|
||||
curdistfrompos = sqrtf(delta.f[0] * delta.f[0] + delta.f[2] * delta.f[2]);
|
||||
|
||||
// @bug: delta needs to be turned into an absolute position before being
|
||||
// passed to cd_test_los_oobok_findclosest. The position being tested is near 0,0,0.
|
||||
delta.x *= rundist / curdistfrompos;
|
||||
delta.z *= rundist / curdistfrompos;
|
||||
|
||||
chr_set_perim_enabled(chr, false);
|
||||
|
||||
if (cd_exam_los08(&chr->prop->pos, chr->prop->rooms, &delta, CDTYPE_ALL, GEOFLAG_WALL) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_findclosest(&chr->prop->pos, chr->prop->rooms, &delta, CDTYPE_ALL, GEOFLAG_WALL) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_pos(&delta, 18592, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&delta, 18592, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&delta, 18555, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(&delta, 18555, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&delta, 18550, "chraction.c");
|
||||
cd_get_obstacle_pos(&delta, 18550, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&delta, 18547, "chraction.c");
|
||||
cd_get_obstacle_pos(&delta, 18547, "chraction.c");
|
||||
#else
|
||||
cd_get_pos(&delta, 18277, "chraction.c");
|
||||
cd_get_obstacle_pos(&delta, 18277, "chraction.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -15857,8 +15861,8 @@ bool chr_flank(struct chrdata *chr, u32 angle360, struct coord *pos, u8 use_clos
|
|||
|
||||
chr_get_bbox(chr->prop, &radius, &ymax, &ymin);
|
||||
|
||||
result = cd_exam_cyl_move03(&chrpos, chr->prop->rooms, pos,
|
||||
CDTYPE_BG | CDTYPE_OBJS | CDTYPE_DOORS, 1,
|
||||
result = cd_test_cylmove_oobok_findclosest(&chrpos, chr->prop->rooms, pos,
|
||||
CDTYPE_BG | CDTYPE_OBJS | CDTYPE_DOORS, CHECKVERTICAL_YES,
|
||||
ymax - chrpos.f[1],
|
||||
ymin - chrpos.f[1]);
|
||||
|
||||
|
@ -15868,15 +15872,15 @@ bool chr_flank(struct chrdata *chr, u32 angle360, struct coord *pos, u8 use_clos
|
|||
f32 tmp;
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_pos(pos, 18731, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(pos, 18731, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(pos, 18694, "chr/chraction.c");
|
||||
cd_get_obstacle_pos(pos, 18694, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(pos, 18689, "chraction.c");
|
||||
cd_get_obstacle_pos(pos, 18689, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(pos, 18686, "chraction.c");
|
||||
cd_get_obstacle_pos(pos, 18686, "chraction.c");
|
||||
#else
|
||||
cd_get_pos(pos, 18416, "chraction.c");
|
||||
cd_get_obstacle_pos(pos, 18416, "chraction.c");
|
||||
#endif
|
||||
|
||||
xdiff = pos->x - chrpos.x;
|
||||
|
@ -16251,7 +16255,7 @@ void chr_avoid(struct chrdata *chr)
|
|||
zdiff = dstpos.z - chr->prop->pos.z;
|
||||
|
||||
if (xdiff > halfchrradius || zdiff > halfchrradius || xdiff < -halfchrradius || zdiff < -halfchrradius) {
|
||||
cdresult = cd_exam_cyl_move05(&chr->prop->pos, chr->prop->rooms, &dstpos, dstrooms, CDTYPE_ALL, true, ymax - chr->prop->pos.y, ymin - chr->prop->pos.y);
|
||||
cdresult = cd_test_cylmove_oobfail_findclosest(&chr->prop->pos, chr->prop->rooms, &dstpos, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - chr->prop->pos.y, ymin - chr->prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
|
|
|
@ -32,7 +32,7 @@ f32 func0f1577f0(f32 arg0[2], f32 arg1[2], f32 arg2[2], f32 arg3[2])
|
|||
return a;
|
||||
}
|
||||
|
||||
f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2)
|
||||
f32 func0f1578c8(struct radiusxz *arg0, struct xz *arg1, struct xz *arg2)
|
||||
{
|
||||
f32 value2;
|
||||
f32 value1;
|
||||
|
@ -46,7 +46,7 @@ f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2)
|
|||
value1 = mult2 * arg1->x - mult1 * arg1->z;
|
||||
value2 = mult1 * arg1->x + mult2 * arg1->z;
|
||||
|
||||
sp24 = (arg0->width - value1) * (arg0->width + value1);
|
||||
sp24 = (arg0->radius - value1) * (arg0->radius + value1);
|
||||
|
||||
if (sp24 < 0.0f) {
|
||||
return MAXFLOAT;
|
||||
|
@ -55,7 +55,7 @@ f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2)
|
|||
value2 -= sqrtf(sp24);
|
||||
|
||||
if (value2 < 0.0f) {
|
||||
if (value2 * value2 + value1 * value1 <= arg0->width * arg0->width) {
|
||||
if (value2 * value2 + value1 * value1 <= arg0->radius * arg0->radius) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2)
|
|||
return value2;
|
||||
}
|
||||
|
||||
f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct xz *arg3)
|
||||
f32 func0f1579cc(struct radiusxz *rxz, struct xz *edge_vtx1, struct xz *edge_vtx2, struct xz *diff)
|
||||
{
|
||||
f32 spac;
|
||||
f32 spa8;
|
||||
|
@ -90,17 +90,17 @@ f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct
|
|||
f32 sp58;
|
||||
f32 sp54;
|
||||
|
||||
spac = sqrtf(arg3->x * arg3->x + arg3->z * arg3->z);
|
||||
spac = sqrtf(diff->x * diff->x + diff->z * diff->z);
|
||||
|
||||
if (spac == 0.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
spa0.x = arg3->x * (1.0f / spac);
|
||||
spa0.z = arg3->z * (1.0f / spac);
|
||||
spa0.x = diff->x * (1.0f / spac);
|
||||
spa0.z = diff->z * (1.0f / spac);
|
||||
|
||||
sp98 = arg2->x - arg1->x;
|
||||
sp9c = arg2->z - arg1->z;
|
||||
sp98 = edge_vtx2->x - edge_vtx1->x;
|
||||
sp9c = edge_vtx2->z - edge_vtx1->z;
|
||||
|
||||
sp94 = sqrtf(sp98 * sp98 + sp9c * sp9c);
|
||||
|
||||
|
@ -112,22 +112,22 @@ f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct
|
|||
sp88 = sp9c * sp90;
|
||||
sp8c = -sp98 * sp90;
|
||||
|
||||
sp84 = arg0->width * sp88;
|
||||
sp80 = arg0->width * sp8c;
|
||||
sp84 = rxz->radius * sp88;
|
||||
sp80 = rxz->radius * sp8c;
|
||||
|
||||
if (sp84 * (arg0->x - arg1->x) + sp80 * (arg0->z - arg1->z) < 0.0f) {
|
||||
if (sp84 * (rxz->x - edge_vtx1->x) + sp80 * (rxz->z - edge_vtx1->z) < 0.0f) {
|
||||
sp84 = -sp84;
|
||||
sp80 = -sp80;
|
||||
}
|
||||
|
||||
sp78 = arg1->x + sp84;
|
||||
sp7c = arg1->z + sp80;
|
||||
sp70 = arg2->x + sp84;
|
||||
sp74 = arg2->z + sp80;
|
||||
sp78 = edge_vtx1->x + sp84;
|
||||
sp7c = edge_vtx1->z + sp80;
|
||||
sp70 = edge_vtx2->x + sp84;
|
||||
sp74 = edge_vtx2->z + sp80;
|
||||
|
||||
sp68 = (arg3->z * sp78) - (sp7c * arg3->x);
|
||||
sp6c = (arg0->x * arg3->z) - (arg0->z * arg3->x);
|
||||
sp64 = (arg3->z * sp70) - (sp74 * arg3->x);
|
||||
sp68 = (diff->z * sp78) - (sp7c * diff->x);
|
||||
sp6c = (rxz->x * diff->z) - (rxz->z * diff->x);
|
||||
sp64 = (diff->z * sp70) - (sp74 * diff->x);
|
||||
|
||||
if (sp64 < sp68) {
|
||||
struct xz *tmp;
|
||||
|
@ -136,35 +136,35 @@ f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct
|
|||
sp68 = sp64;
|
||||
sp64 = spa8;
|
||||
|
||||
tmp = arg1;
|
||||
arg1 = arg2;
|
||||
arg2 = tmp;
|
||||
tmp = edge_vtx1;
|
||||
edge_vtx1 = edge_vtx2;
|
||||
edge_vtx2 = tmp;
|
||||
|
||||
sp88 = -sp88;
|
||||
sp8c = -sp8c;
|
||||
}
|
||||
|
||||
if (sp64 == sp68) {
|
||||
sp60 = func0f1578c8(arg0, &spa0, arg1);
|
||||
sp5c = func0f1578c8(arg0, &spa0, arg2);
|
||||
sp60 = func0f1578c8(rxz, &spa0, edge_vtx1);
|
||||
sp5c = func0f1578c8(rxz, &spa0, edge_vtx2);
|
||||
|
||||
if (sp5c < sp60) {
|
||||
sp60 = sp5c;
|
||||
}
|
||||
} else if (sp64 < sp6c) {
|
||||
handlezero:
|
||||
sp60 = func0f1578c8(arg0, &spa0, arg2);
|
||||
sp60 = func0f1578c8(rxz, &spa0, edge_vtx2);
|
||||
} else if (sp6c < sp68) {
|
||||
sp60 = func0f1578c8(arg0, &spa0, arg1);
|
||||
sp60 = func0f1578c8(rxz, &spa0, edge_vtx1);
|
||||
} else {
|
||||
sp58 = sp88 * (arg0->x - arg1->x) + sp8c * (arg0->z - arg1->z);
|
||||
sp54 = sp88 * (arg0->x + arg3->x - arg1->x) + sp8c * (arg0->z + arg3->z - arg1->z);
|
||||
sp58 = sp88 * (rxz->x - edge_vtx1->x) + sp8c * (rxz->z - edge_vtx1->z);
|
||||
sp54 = sp88 * (rxz->x + diff->x - edge_vtx1->x) + sp8c * (rxz->z + diff->z - edge_vtx1->z);
|
||||
|
||||
if (sp58 == sp54) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
sp60 = (sp58 - arg0->width) * spac / (sp58 - sp54);
|
||||
sp60 = (sp58 - rxz->radius) * spac / (sp58 - sp54);
|
||||
}
|
||||
|
||||
if (spac < sp60) {
|
||||
|
|
|
@ -103,12 +103,12 @@ bool explosion_create_complex(struct prop *prop, struct coord *pos, RoomNum *roo
|
|||
}
|
||||
|
||||
if (prop) {
|
||||
room = cd_find_floor_room_y_colour_normal_prop_at_pos(&prop->pos, prop->rooms, &y, NULL, &sp88, &collisionprop);
|
||||
room = cd_find_room_at_pos_ycnp(&prop->pos, prop->rooms, &y, NULL, &sp88, &collisionprop);
|
||||
sp100.x = prop->pos.x;
|
||||
sp100.y = y;
|
||||
sp100.z = prop->pos.z;
|
||||
} else {
|
||||
room = cd_find_floor_room_y_colour_normal_prop_at_pos(pos, rooms, &y, NULL, &sp88, &collisionprop);
|
||||
room = cd_find_room_at_pos_ycnp(pos, rooms, &y, NULL, &sp88, &collisionprop);
|
||||
sp100.x = pos->x;
|
||||
sp100.y = y;
|
||||
sp100.z = pos->z;
|
||||
|
|
|
@ -202,7 +202,7 @@ void koh_init_props(void)
|
|||
g_ScenarioData.koh.hillpos.x = pad.pos.x;
|
||||
g_ScenarioData.koh.hillpos.y = pad.pos.y;
|
||||
g_ScenarioData.koh.hillpos.z = pad.pos.z;
|
||||
g_ScenarioData.koh.hillpos.y = cd_find_floor_y_colour_type_at_pos(&g_ScenarioData.koh.hillpos, &g_ScenarioData.koh.hillrooms[0], 0, 0);
|
||||
g_ScenarioData.koh.hillpos.y = cd_find_ground_at_pos_ct(&g_ScenarioData.koh.hillpos, &g_ScenarioData.koh.hillrooms[0], 0, 0);
|
||||
g_ScenarioData.koh.movehill = false;
|
||||
|
||||
room_set_light_op(g_ScenarioData.koh.hillrooms[0], LIGHTOP_HIGHLIGHT, 0, 0, 0);
|
||||
|
@ -294,7 +294,7 @@ void koh_tick(void)
|
|||
g_ScenarioData.koh.hillpos.y = pad.pos.y;
|
||||
g_ScenarioData.koh.hillpos.z = pad.pos.z;
|
||||
|
||||
g_ScenarioData.koh.hillpos.y = cd_find_floor_y_colour_type_at_pos(&g_ScenarioData.koh.hillpos, g_ScenarioData.koh.hillrooms, NULL, NULL);
|
||||
g_ScenarioData.koh.hillpos.y = cd_find_ground_at_pos_ct(&g_ScenarioData.koh.hillpos, g_ScenarioData.koh.hillrooms, NULL, NULL);
|
||||
|
||||
room_set_light_op(g_ScenarioData.koh.hillrooms[0], LIGHTOP_HIGHLIGHT, 0, 0, 0);
|
||||
|
||||
|
|
|
@ -159,8 +159,8 @@ struct waypoint *waypoint_find_closest_to_pos(struct coord *pos, RoomNum *rooms)
|
|||
padrooms[0] = pad.room;
|
||||
padrooms[1] = -1;
|
||||
|
||||
if (cd_test_los05(pos, rooms, &pad.pos, padrooms, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2) != CDRESULT_COLLISION) {
|
||||
s32 cdresult = cd_exam_cyl_move05(pos, rooms, &pad.pos, padrooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, true, 0.0f, 0.0f);
|
||||
if (cd_test_los_oobfail(pos, rooms, &pad.pos, padrooms, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2) != CDRESULT_COLLISION) {
|
||||
s32 cdresult = cd_test_cylmove_oobfail_findclosest(pos, rooms, &pad.pos, padrooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, CHECKVERTICAL_YES, 0.0f, 0.0f);
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
checkmore[i] = false;
|
||||
|
@ -209,7 +209,7 @@ struct waypoint *waypoint_find_closest_to_pos(struct coord *pos, RoomNum *rooms)
|
|||
tmppos.y = pos->y;
|
||||
tmppos.z = sp250[i].f[2] + sp98.f[2];
|
||||
|
||||
if (cd_test_cyl_move04(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_getfinalroom(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, CHECKVERTICAL_YES, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
closest = candwaypoints[i];
|
||||
break;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ struct waypoint *waypoint_find_closest_to_pos(struct coord *pos, RoomNum *rooms)
|
|||
tmppos.y = pos->y;
|
||||
tmppos.z = sp1d8[i].z - sp98.z;
|
||||
|
||||
if (cd_test_cyl_move04(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_getfinalroom(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, CHECKVERTICAL_YES, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
closest = candwaypoints[i];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ void player_start_new_life(void)
|
|||
|
||||
angle = BADDTOR(360) - scenario_choose_spawn_location(30, &pos, rooms, g_Vars.currentplayer->prop);
|
||||
|
||||
groundy = cd_find_ground_info_at_cyl(&pos, 30, rooms,
|
||||
groundy = cd_find_ground_at_cyl_ctfril(&pos, 30, rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
&g_Vars.currentplayer->floortype,
|
||||
&g_Vars.currentplayer->floorflags,
|
||||
|
@ -5019,7 +5019,7 @@ void player_move_camera_from_pos_rooms(struct coord *pos, struct coord *up, stru
|
|||
bg_find_rooms_by_pos(pos, inrooms, aboverooms, 20, &bestroom);
|
||||
|
||||
if (inrooms[0] != -1) {
|
||||
tmp = room = cd_find_floor_room_at_pos(pos, inrooms);
|
||||
tmp = room = cd_find_room_at_pos(pos, inrooms);
|
||||
|
||||
if (room > 0) {
|
||||
player_set_cam_properties_in_bounds(pos, up, look, tmp);
|
||||
|
@ -5027,7 +5027,7 @@ void player_move_camera_from_pos_rooms(struct coord *pos, struct coord *up, stru
|
|||
player_set_cam_properties_in_bounds(pos, up, look, inrooms[0]);
|
||||
}
|
||||
} else if (aboverooms[0] != -1) {
|
||||
tmp = room = cd_find_floor_room_at_pos(pos, aboverooms);
|
||||
tmp = room = cd_find_room_at_pos(pos, aboverooms);
|
||||
|
||||
if (room > 0) {
|
||||
player_set_cam_properties_out_of_bounds(pos, up, look, tmp);
|
||||
|
|
|
@ -409,7 +409,7 @@ void player_reset(void)
|
|||
}
|
||||
}
|
||||
|
||||
groundy = cd_find_ground_info_at_cyl(&pos, 30, rooms,
|
||||
groundy = cd_find_ground_at_cyl_ctfril(&pos, 30, rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
&g_Vars.currentplayer->floortype,
|
||||
&g_Vars.currentplayer->floorflags,
|
||||
|
|
|
@ -1221,7 +1221,7 @@ void hand_inflict_melee_damage(s32 handnum, struct gset *gset, bool arg2)
|
|||
cdtypes = 0;
|
||||
}
|
||||
|
||||
if (cd_test_los04(&playerprop->pos, playerprop->rooms, &prop->pos, cdtypes)) {
|
||||
if (cd_test_los_oobok_autoflags(&playerprop->pos, playerprop->rooms, &prop->pos, cdtypes)) {
|
||||
if (isglass) {
|
||||
struct model *model = obj->model;
|
||||
struct coord gunpos2d;
|
||||
|
@ -2467,11 +2467,11 @@ f32 prop_calculate_autoaim_score(struct prop *prop, struct coord *screenpos, f32
|
|||
player_set_perim_enabled(playerprop, false);
|
||||
|
||||
if (throughobjects) {
|
||||
ok = cd_test_los03(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
ok = cd_test_los_oobok(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT);
|
||||
} else {
|
||||
ok = cd_test_los03(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
ok = cd_test_los_oobok(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT);
|
||||
}
|
||||
|
@ -3089,24 +3089,24 @@ void prop_register_rooms(struct prop *prop)
|
|||
* If the line goes out of bounds, the intersecting list up until that point
|
||||
* will be returned.
|
||||
*/
|
||||
void los_find_intersecting_rooms_properly(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, RoomNum *intersecting, s32 maxintersecting)
|
||||
void los_find_intersecting_rooms_properly(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalroomsptr, RoomNum *intersecting, s32 maxintersecting)
|
||||
{
|
||||
RoomNum tmprooms[8];
|
||||
RoomNum finalrooms[8];
|
||||
s32 len;
|
||||
s32 i;
|
||||
|
||||
portal_find_rooms(frompos, topos, fromrooms, tmprooms, intersecting, maxintersecting);
|
||||
portal_find_rooms(frompos, topos, fromrooms, finalrooms, intersecting, maxintersecting);
|
||||
|
||||
len = 0;
|
||||
|
||||
for (i = 0; tmprooms[i] != -1; i++) {
|
||||
if (bg_room_contains_coord(topos, tmprooms[i])) {
|
||||
finalrooms[len] = tmprooms[i];
|
||||
for (i = 0; finalrooms[i] != -1; i++) {
|
||||
if (bg_room_contains_coord(topos, finalrooms[i])) {
|
||||
finalroomsptr[len] = finalrooms[i];
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
finalrooms[len] = -1;
|
||||
finalroomsptr[len] = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3173,7 +3173,7 @@ void los_find_final_room_fast(struct coord *frompos, RoomNum *fromrooms, struct
|
|||
}
|
||||
|
||||
if (ptr) {
|
||||
s32 room = cd_find_floor_room_at_pos(topos, ptr);
|
||||
s32 room = cd_find_room_at_pos(topos, ptr);
|
||||
|
||||
if (room > 0) {
|
||||
finalrooms[0] = room;
|
||||
|
|
|
@ -1022,7 +1022,7 @@ struct defaultobj *obj_find_by_pos(struct coord *pos, RoomNum *rooms)
|
|||
if (prop->type == PROPTYPE_OBJ
|
||||
&& array_intersects(prop->rooms, rooms)
|
||||
&& prop_get_geometry(prop, &start, &end)
|
||||
&& cd_is_2d_point_in_geo(pos->x, pos->z, (struct geo *)start)) {
|
||||
&& cd_is_xz_in_geo(pos->x, pos->z, (struct geo *)start)) {
|
||||
return prop->obj;
|
||||
}
|
||||
|
||||
|
@ -2207,9 +2207,9 @@ void obj_place_grounded(struct defaultobj *obj, struct coord *pos, Mtxf *rotmtx,
|
|||
bbox = model_find_bbox_rodata(obj->model);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
room = cd_find_floor_room_y_colour_flags_at_pos(pos, rooms, &ground, &obj->floorcol, NULL);
|
||||
room = cd_find_room_at_pos_ycf(pos, rooms, &ground, &obj->floorcol, NULL);
|
||||
#else
|
||||
room = cd_find_floor_room_y_colour_flags_at_pos(pos, rooms, &ground, &obj->floorcol);
|
||||
room = cd_find_room_at_pos_ycf(pos, rooms, &ground, &obj->floorcol);
|
||||
#endif
|
||||
|
||||
if (room > 0) {
|
||||
|
@ -2322,9 +2322,9 @@ void obj_place_3d(struct defaultobj *obj, struct coord *arg1, Mtxf *mtx, RoomNum
|
|||
los_find_final_room_exhaustive(arg1, rooms, &pos2, rooms2);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (cd_find_floor_room_y_colour_flags_at_pos(&pos2, rooms2, &y, &obj->floorcol, NULL) > 0)
|
||||
if (cd_find_room_at_pos_ycf(&pos2, rooms2, &y, &obj->floorcol, NULL) > 0)
|
||||
#else
|
||||
if (cd_find_floor_room_y_colour_flags_at_pos(&pos2, rooms2, &y, &obj->floorcol) > 0)
|
||||
if (cd_find_room_at_pos_ycf(&pos2, rooms2, &y, &obj->floorcol) > 0)
|
||||
#endif
|
||||
{
|
||||
s32 stack;
|
||||
|
@ -2630,19 +2630,19 @@ bool projectile_0f06b488(struct prop *prop, struct coord *arg1, struct coord *ar
|
|||
f32 f0;
|
||||
struct coord sp20;
|
||||
|
||||
if (!cd_0002ded8(arg1, arg2, prop)) {
|
||||
if (!cd_test_line_intersects_prop(arg1, arg2, prop)) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_edge(&sp3c, &sp30, 2910, "prop/propobj.c");
|
||||
cd_get_pos(&sp20, 2911, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&sp20, 2911, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_edge(&sp3c, &sp30, 2910, "propobj.c");
|
||||
cd_get_pos(&sp20, 2911, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp20, 2911, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_edge(&sp3c, &sp30, 2909, "propobj.c");
|
||||
cd_get_pos(&sp20, 2910, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp20, 2910, "propobj.c");
|
||||
#else
|
||||
cd_get_edge(&sp3c, &sp30, 2898, "propobj.c");
|
||||
cd_get_pos(&sp20, 2899, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp20, 2899, "propobj.c");
|
||||
#endif
|
||||
|
||||
f0 = (sp20.f[0] - arg1->f[0]) * arg3->f[0]
|
||||
|
@ -3320,16 +3320,16 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
|
|||
spa0[0] = spcc[i];
|
||||
spa0[1] = -1;
|
||||
|
||||
if (cd_exam_los09(&prop->pos, spa0, &sp1c4, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_findclosest_autoflags(&prop->pos, spa0, &sp1c4, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
s0 = true;
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&hitthing.pos, 4258, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&hitthing.pos, 4258, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&hitthing.pos, 4258, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitthing.pos, 4258, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&hitthing.pos, 4257, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitthing.pos, 4257, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&hitthing.pos, 4246, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitthing.pos, 4246, "propobj.c");
|
||||
#endif
|
||||
cd_get_obstacle_normal(&hitthing.unk0c);
|
||||
}
|
||||
|
@ -3421,10 +3421,10 @@ bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
|
|||
|
||||
if (prop->pos.x != arg1->x || prop->pos.y != arg1->y || prop->pos.z != arg1->z) {
|
||||
if (obj->hidden & OBJHFLAG_PROJECTILE) {
|
||||
if (cd_exam_cyl_move08(&prop->pos, prop->rooms, &sp80, rooms, radius, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom_finddist(&prop->pos, prop->rooms, &sp80, rooms, radius, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
obj_find_rooms(obj, &sp80, obj->realrot, rooms);
|
||||
|
||||
if (cd_exam_cyl_move02(&prop->pos, &sp80, radius, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_volume_fromdir(&prop->pos, &sp80, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
prop->pos.x = sp80.x;
|
||||
prop->pos.y = sp80.y;
|
||||
prop->pos.z = sp80.z;
|
||||
|
@ -3514,10 +3514,10 @@ bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
|
|||
sp4c.y = sp80.y;
|
||||
sp4c.z = sp8c.z * f2 + prop->pos.z;
|
||||
|
||||
if (cd_exam_cyl_move07(&prop->pos, prop->rooms, &sp4c, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest_getfinalroom(&prop->pos, prop->rooms, &sp4c, rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
obj_find_rooms(obj, &sp4c, obj->realrot, rooms);
|
||||
|
||||
if (cd_test_volume(&sp4c, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cd_test_volume_simple(&sp4c, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
prop->pos.x = sp4c.x;
|
||||
prop->pos.y = sp4c.y;
|
||||
prop->pos.z = sp4c.z;
|
||||
|
@ -5227,7 +5227,7 @@ void hov_update_ground(struct defaultobj *obj, struct hov *hov, struct coord *po
|
|||
rooms_copy(rooms, testrooms);
|
||||
obj_find_rooms(obj, &testpos, matrix, testrooms);
|
||||
|
||||
ground = cd_find_ground_at_cyl(pos, 5, testrooms, &obj->floorcol, NULL);
|
||||
ground = cd_find_ground_at_cyl_ct(pos, 5, testrooms, &obj->floorcol, NULL);
|
||||
|
||||
if (ground < -30000) {
|
||||
ground = hov->ground;
|
||||
|
@ -5313,11 +5313,11 @@ void hov_tick(struct defaultobj *obj, struct hov *hov)
|
|||
|
||||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, &sp1b4, sp198);
|
||||
rooms_append(sp9c, sp198, ARRAYCOUNT(sp198));
|
||||
ground1 = cd_find_ground_at_cyl(&sp1b4, 5, sp198, &obj->floorcol, NULL);
|
||||
ground1 = cd_find_ground_at_cyl_ct(&sp1b4, 5, sp198, &obj->floorcol, NULL);
|
||||
|
||||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, &sp1a8, sp188);
|
||||
rooms_append(sp9c, sp188, ARRAYCOUNT(sp188));
|
||||
ground2 = cd_find_ground_at_cyl(&sp1a8, 5, sp188, NULL, NULL);
|
||||
ground2 = cd_find_ground_at_cyl_ct(&sp1a8, 5, sp188, NULL, NULL);
|
||||
|
||||
if (ground1 >= -30000.0f && ground2 >= -30000.0f) {
|
||||
groundangle = atan2f(ground1 - ground2, sp1cc - sp1d0);
|
||||
|
@ -5611,12 +5611,12 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3
|
|||
pos.y += hov->ground - prevhov.ground;
|
||||
}
|
||||
|
||||
cdresult = cd_exam_cyl_move05(&prop->pos, prop->rooms, &pos, rooms, CDTYPE_ALL, true, 0.0f, 0.0f);
|
||||
cdresult = cd_test_cylmove_oobfail_findclosest(&prop->pos, prop->rooms, &pos, rooms, CDTYPE_ALL, CHECKVERTICAL_YES, 0.0f, 0.0f);
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
// empty
|
||||
} else if (cdresult == CDRESULT_COLLISION) {
|
||||
cd_set_saved_pos(&prop->pos, &pos);
|
||||
cd_set_block_edge(&prop->pos, &pos);
|
||||
}
|
||||
} else {
|
||||
rooms_copy(prop->rooms, rooms);
|
||||
|
@ -5627,10 +5627,10 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3
|
|||
obj_update_core_geo(obj, &pos, sp460, &geounion.cyl);
|
||||
|
||||
if (obj->flags3 & OBJFLAG3_GEOCYL) {
|
||||
cdresult = cd_exam_cyl_move01(&prop->pos, &pos, geounion.cyl.radius, rooms, CDTYPE_ALL,
|
||||
cdresult = cd_test_volume_closestedge(&prop->pos, &pos, geounion.cyl.radius, rooms, CDTYPE_ALL,
|
||||
CHECKVERTICAL_YES, geounion.cyl.ymax - pos.y, geounion.cyl.ymin - pos.y);
|
||||
} else {
|
||||
cdresult = cd_0002f02c(&geounion.block, rooms, CDTYPE_ALL);
|
||||
cdresult = cd_test_blockmove(&geounion.block, rooms, CDTYPE_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5771,7 +5771,7 @@ f32 obj_collide(struct defaultobj *movingobj, struct coord *movingvel, f32 rotat
|
|||
cd_get_edge(&sp70, &sp64, 7308, "propobj.c");
|
||||
#endif
|
||||
|
||||
if (cd_get_saved_pos(&sp58, &sp4c)) {
|
||||
if (cd_get_block_edge(&sp58, &sp4c)) {
|
||||
sp4c.x -= sp58.x;
|
||||
sp4c.y -= sp58.y;
|
||||
sp4c.z -= sp58.z;
|
||||
|
@ -6020,7 +6020,7 @@ void platform_displace_props2(struct prop *platform, Mtxf *arg1)
|
|||
|
||||
if (prop->pos.y > platform->pos.y
|
||||
&& (obj->hidden & OBJHFLAG_ONANOTHEROBJ)
|
||||
&& cd_is_2d_point_in_geo(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
&& cd_is_xz_in_geo(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
mtx3_to_mtx4(obj->realrot, &mtx);
|
||||
mtx4_set_translation(&prop->pos, &mtx);
|
||||
mtx4_mult_mtx4_in_place(arg1, &mtx);
|
||||
|
@ -6194,7 +6194,7 @@ bool rocket_tick_fbw(struct weaponobj *rocket)
|
|||
// Check if rocket can fly directly to target
|
||||
if (chr_get_target_prop(ownerchr) == chr->prop
|
||||
&& mp_chr_to_chrindex(ownerchr) == g_Vars.lvframenum % g_MpNumChrs
|
||||
&& cd_test_los05(&rocketprop->pos, rocketprop->rooms, &chr->prop->pos, chr->prop->rooms,
|
||||
&& cd_test_los_oobfail(&rocketprop->pos, rocketprop->rooms, &chr->prop->pos, chr->prop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
projectile->nextsteppos.x = chr->prop->pos.x;
|
||||
|
@ -6503,7 +6503,7 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
struct coord sp3ac;
|
||||
f32 f0_2;
|
||||
|
||||
if (cd_get_saved_pos(&sp3d0, &sp3c4)) {
|
||||
if (cd_get_block_edge(&sp3d0, &sp3c4)) {
|
||||
sp3c4.x -= sp3d0.x;
|
||||
sp3c4.y -= sp3d0.y;
|
||||
sp3c4.z -= sp3d0.z;
|
||||
|
@ -6718,7 +6718,7 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
ground = cd_find_ground_at_cyl(&prop->pos, 2, prop->rooms, &obj->floorcol, NULL);
|
||||
ground = cd_find_ground_at_cyl_ct(&prop->pos, 2, prop->rooms, &obj->floorcol, NULL);
|
||||
|
||||
if (ground > -30000.0f) {
|
||||
prop->pos.y = ground + obj_get_hov_bob_offset_y(obj);
|
||||
|
@ -7276,16 +7276,16 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
sp5ac.y = prop->pos.y + sp37c;
|
||||
sp5ac.z = prop->pos.z;
|
||||
|
||||
roomnum = cd_find_ceiling_room_y_colour_flags_normal_at_pos(&sp5ac, prop->rooms, &sp390, &obj->floorcol, &geoflags, &sp380);
|
||||
roomnum = cd_find_ceiling_room_at_pos_ycfn(&sp5ac, prop->rooms, &sp390, &obj->floorcol, &geoflags, &sp380);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (roomnum > 0
|
||||
&& prop->pos.y + sp37c < sp390
|
||||
&& !cd_test_los03(&prevpos, prevrooms, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
&& !cd_test_los_oobok(&prevpos, prevrooms, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
#else
|
||||
if (roomnum > 0
|
||||
&& prop->pos.y + sp37c < sp390
|
||||
&& !cd_test_los03(&prevpos, prevrooms, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
&& !cd_test_los_oobok(&prevpos, prevrooms, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
#endif
|
||||
{
|
||||
settle = true;
|
||||
|
@ -7305,18 +7305,18 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
obj->hidden |= OBJHFLAG_DELETING;
|
||||
}
|
||||
} else {
|
||||
roomnum = cd_find_floor_room_y_colour_normal_prop_at_pos(&prop->pos, prop->rooms, &sp390, &obj->floorcol, &sp380, NULL);
|
||||
roomnum = cd_find_room_at_pos_ycnp(&prop->pos, prop->rooms, &sp390, &obj->floorcol, &sp380, NULL);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
// If the projectile has gone out of bounds, the room
|
||||
// search above wll have failed. It's likely that
|
||||
// cd_find_floor_room_at_pos is a more expensive room
|
||||
// cd_find_room_at_pos is a more expensive room
|
||||
// search, due to it only being run once per projectile.
|
||||
if (roomnum <= 0 && (projectile->flags & PROJECTILEFLAG_STICKY) == 0) {
|
||||
if ((projectile->flags & PROJECTILEFLAG_DONEOOBSEARCH) == 0) {
|
||||
projectile->flags |= PROJECTILEFLAG_DONEOOBSEARCH;
|
||||
|
||||
if (cd_find_floor_room_at_pos(&prevpos, prevrooms) > 0) {
|
||||
if (cd_find_room_at_pos(&prevpos, prevrooms) > 0) {
|
||||
projectile->flags |= PROJECTILEFLAG_INROOM;
|
||||
}
|
||||
}
|
||||
|
@ -7329,7 +7329,7 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
prop_deregister_rooms(prop);
|
||||
rooms_copy(prevrooms, prop->rooms);
|
||||
|
||||
roomnum = cd_find_floor_room_y_colour_flags_at_pos(&prop->pos, prop->rooms, &sp390, &obj->floorcol, NULL);
|
||||
roomnum = cd_find_room_at_pos_ycf(&prop->pos, prop->rooms, &sp390, &obj->floorcol, NULL);
|
||||
|
||||
projectile->speed.x = 0.0f;
|
||||
projectile->speed.z = 0.0f;
|
||||
|
@ -7594,16 +7594,16 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
sp5ac.z = prop->pos.z;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
roomnum = cd_find_ceiling_room_y_colour_flags_at_pos(&sp5ac, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
roomnum = cd_find_ceiling_room_at_pos_ycf(&sp5ac, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
|
||||
if (roomnum <= 0 || cd_test_los03(&prevpos, prevrooms, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cd_find_floor_room_y_colour_flags_at_pos(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
if (roomnum <= 0 || cd_test_los_oobok(&prevpos, prevrooms, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cd_find_room_at_pos_ycf(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
}
|
||||
#else
|
||||
roomnum = cd_find_ceiling_room_y_colour_flags_at_pos(&sp5ac, prop->rooms, &spa4, &obj->floorcol);
|
||||
roomnum = cd_find_ceiling_room_at_pos_ycf(&sp5ac, prop->rooms, &spa4, &obj->floorcol);
|
||||
|
||||
if (roomnum <= 0 || cd_test_los03(&prevpos, prevrooms, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cd_find_floor_room_y_colour_flags_at_pos(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
if (roomnum <= 0 || cd_test_los_oobok(&prevpos, prevrooms, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cd_find_room_at_pos_ycf(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7615,9 +7615,9 @@ bool projectile_tick(struct defaultobj *obj, bool *embedded)
|
|||
rooms_copy(prevrooms, prop->rooms);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
roomnum = cd_find_floor_room_y_colour_flags_at_pos(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
roomnum = cd_find_room_at_pos_ycf(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
#else
|
||||
roomnum = cd_find_floor_room_y_colour_flags_at_pos(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
roomnum = cd_find_room_at_pos_ycf(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
#endif
|
||||
|
||||
projectile->speed.x = 0.0f;
|
||||
|
@ -7972,7 +7972,7 @@ void platform_displace_props(struct prop *platform, s16 *propnums, struct coord
|
|||
prevplayernum = g_Vars.currentplayernum;
|
||||
|
||||
set_current_player_num(playernum);
|
||||
bwalk0f0c63bc(&sp8c, 1, CDTYPE_BG);
|
||||
bwalk_resolve_posdelta(&sp8c, true, CDTYPE_BG);
|
||||
player_update_perim_info();
|
||||
bmove_update_rooms(g_Vars.players[playernum]);
|
||||
set_current_player_num(prevplayernum);
|
||||
|
@ -8038,7 +8038,7 @@ void platform_displace_props(struct prop *platform, s16 *propnums, struct coord
|
|||
sp8c.z = newpos->z - prevpos->z;
|
||||
|
||||
set_current_player_num(playernum);
|
||||
bwalk0f0c63bc(&sp8c, 1, CDTYPE_BG);
|
||||
bwalk_resolve_posdelta(&sp8c, true, CDTYPE_BG);
|
||||
|
||||
prop->pos.y += newpos->y - prevpos->y;
|
||||
|
||||
|
@ -8256,7 +8256,7 @@ void escastep_tick(struct prop *prop)
|
|||
prop->pos.z = newpos.z;
|
||||
|
||||
if ((obj->flags & OBJFLAG_IGNOREFLOORCOLOUR) == 0) {
|
||||
cd_find_floor_y_colour_type_at_pos(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
cd_find_ground_at_pos_ct(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
}
|
||||
|
||||
obj_onmoved(obj, true, true);
|
||||
|
@ -8374,7 +8374,7 @@ void cctv_tick(struct prop *camprop)
|
|||
if (canseeplayer) {
|
||||
player_set_perim_enabled(playerprop, false);
|
||||
|
||||
if (!cd_test_los05(&camprop->pos, camprop->rooms, &playerprop->pos, playerprop->rooms,
|
||||
if (!cd_test_los_oobfail(&camprop->pos, camprop->rooms, &playerprop->pos, playerprop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
canseeplayer = false;
|
||||
|
@ -8865,7 +8865,7 @@ void autogun_tick(struct prop *prop)
|
|||
if (relangleh <= autogun->ymaxleft
|
||||
&& relangleh >= autogun->ymaxright
|
||||
&& track
|
||||
&& cd_test_los05(&prop->pos, prop->rooms, &target->pos, target->rooms, CDTYPE_ALL, GEOFLAG_BLOCK_SIGHT)) {
|
||||
&& cd_test_los_oobfail(&prop->pos, prop->rooms, &target->pos, target->rooms, CDTYPE_ALL, GEOFLAG_BLOCK_SIGHT)) {
|
||||
// Target is in sight
|
||||
obj->flags |= OBJFLAG_AUTOGUN_SEENTARGET;
|
||||
insight = true;
|
||||
|
@ -9164,7 +9164,7 @@ void autogun_tick_shoot(struct prop *autogunprop)
|
|||
mtx00015be4(cam_get_projection_mtxf(), sp108, &spc8);
|
||||
mtx4_transform_vec_in_place(&spc8, &gunpos);
|
||||
|
||||
if (cd_test_los10(&autogunprop->pos, autogunprop->rooms, &gunpos, gunrooms, CDTYPE_BG, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_getfinalroom(&autogunprop->pos, autogunprop->rooms, &gunpos, gunrooms, CDTYPE_BG, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
gunpos.x = autogunprop->pos.x;
|
||||
gunpos.y = autogunprop->pos.y;
|
||||
gunpos.z = autogunprop->pos.z;
|
||||
|
@ -9192,15 +9192,15 @@ void autogun_tick_shoot(struct prop *autogunprop)
|
|||
if (g_Vars.normmplayerisrunning
|
||||
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|
||||
|| (g_Vars.antiplayernum >= 0 && targetprop && targetprop == g_Vars.anti->prop)) {
|
||||
if (cd_exam_los08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_findclosest(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&hitpos, 11480, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11480, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&hitpos, 11480, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11480, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&hitpos, 11458, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11458, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&hitpos, 11296, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11296, "propobj.c");
|
||||
#endif
|
||||
|
||||
hitprop = cd_get_obstacle_prop();
|
||||
|
@ -9247,17 +9247,17 @@ void autogun_tick_shoot(struct prop *autogunprop)
|
|||
// Laptop in firing range
|
||||
struct prop *hitprop = NULL;
|
||||
|
||||
if (cd_exam_los08(&gunpos, gunrooms, &hitpos,
|
||||
if (cd_test_los_oobok_findclosest(&gunpos, gunrooms, &hitpos,
|
||||
CDTYPE_ALL & ~CDTYPE_PLAYERS,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&hitpos, 11535, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11535, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&hitpos, 11535, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11535, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&hitpos, 11513, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11513, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&hitpos, 11351, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11351, "propobj.c");
|
||||
#endif
|
||||
|
||||
hitprop = cd_get_obstacle_prop();
|
||||
|
@ -9285,17 +9285,17 @@ void autogun_tick_shoot(struct prop *autogunprop)
|
|||
}
|
||||
} else {
|
||||
// Enemy autogun in solo
|
||||
if (cd_exam_los08(&gunpos, gunrooms, &hitpos,
|
||||
if (cd_test_los_oobok_findclosest(&gunpos, gunrooms, &hitpos,
|
||||
CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&hitpos, 11561, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11561, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&hitpos, 11561, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11561, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&hitpos, 11539, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11539, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&hitpos, 11377, "propobj.c");
|
||||
cd_get_obstacle_pos(&hitpos, 11377, "propobj.c");
|
||||
#endif
|
||||
|
||||
missed = true;
|
||||
|
@ -9565,7 +9565,7 @@ bool chopper_check_target_in_sight(struct chopperobj *obj)
|
|||
struct prop *target = chopper_get_target_prop(chopper);
|
||||
|
||||
if (target->type != PROPTYPE_PLAYER || g_Vars.bondvisible) {
|
||||
visible = cd_test_los05(&target->pos, target->rooms, &chopper->base.prop->pos, chopper->base.prop->rooms,
|
||||
visible = cd_test_los_oobfail(&target->pos, target->rooms, &chopper->base.prop->pos, chopper->base.prop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SHOOT);
|
||||
}
|
||||
|
@ -10162,7 +10162,7 @@ void chopper_tick_fall(struct prop *chopperprop)
|
|||
newpos.y = chopperprop->pos.y + newspeed.f[1] * g_Vars.lvupdate60freal;
|
||||
newpos.z = chopperprop->pos.z + newspeed.f[2] * g_Vars.lvupdate60freal;
|
||||
|
||||
if (cd_exam_los09(&chopperprop->pos, chopperprop->rooms, &newpos, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
if (cd_test_los_oobok_findclosest_autoflags(&chopperprop->pos, chopperprop->rooms, &newpos, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
struct coord sp74;
|
||||
RoomNum room;
|
||||
struct coord sp64;
|
||||
|
@ -10170,17 +10170,17 @@ void chopper_tick_fall(struct prop *chopperprop)
|
|||
RoomNum newrooms[8];
|
||||
|
||||
chopperprop->pos.y += 100;
|
||||
ground = cd_find_ground_at_cyl(&chopperprop->pos, 5, chopperprop->rooms, NULL, NULL);
|
||||
ground = cd_find_ground_at_cyl_ct(&chopperprop->pos, 5, chopperprop->rooms, NULL, NULL);
|
||||
chopperprop->pos.y -= 100;
|
||||
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&sp64, 12476, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&sp64, 12476, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&sp64, 12476, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp64, 12476, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&sp64, 12449, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp64, 12449, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&sp64, 12286, "propobj.c");
|
||||
cd_get_obstacle_pos(&sp64, 12286, "propobj.c");
|
||||
#endif
|
||||
|
||||
newpos.x = sp64.x;
|
||||
|
@ -10409,7 +10409,7 @@ void chopper_tick_combat(struct prop *chopperprop)
|
|||
goalpos.y = sp6c.y;
|
||||
goalpos.z = sp6c.z;
|
||||
}
|
||||
} else if (cd_test_los03(&targetprop->pos, targetprop->rooms, &goalpos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, GEOFLAG_BLOCK_SHOOT) == 0) {
|
||||
} else if (cd_test_los_oobok(&targetprop->pos, targetprop->rooms, &goalpos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, GEOFLAG_BLOCK_SHOOT) == 0) {
|
||||
pad_unpack(chopper->path->pads[chopper->cw ? (sp8c + 1) % chopper->path->len : sp8c], PADFIELD_POS, &pad);
|
||||
|
||||
pad.pos.y += -250.0f;
|
||||
|
@ -10579,7 +10579,7 @@ void hovercar_tick(struct prop *prop)
|
|||
sp210[0] = pad.room;
|
||||
sp210[1] = -1;
|
||||
|
||||
sp214.y = cd_find_ground_at_cyl(&pad.pos, 5, sp210, NULL, NULL) + 35;
|
||||
sp214.y = cd_find_ground_at_cyl_ct(&pad.pos, 5, sp210, NULL, NULL) + 35;
|
||||
} else {
|
||||
sp214.y = pad.pos.y;
|
||||
}
|
||||
|
@ -10608,8 +10608,8 @@ void hovercar_tick(struct prop *prop)
|
|||
}
|
||||
|
||||
if (ishoverbot) {
|
||||
if (cd_exam_cyl_move03(&prop->pos, prop->rooms, &sp214,
|
||||
CDTYPE_CLOSEDDOORS | CDTYPE_AJARDOORS, 0, 0, 0) == CDRESULT_COLLISION) {
|
||||
if (cd_test_cylmove_oobok_findclosest(&prop->pos, prop->rooms, &sp214,
|
||||
CDTYPE_CLOSEDDOORS | CDTYPE_AJARDOORS, CHECKVERTICAL_NO, 0, 0) == CDRESULT_COLLISION) {
|
||||
doorprop = cd_get_obstacle_prop();
|
||||
}
|
||||
|
||||
|
@ -10744,7 +10744,7 @@ void hovercar_tick(struct prop *prop)
|
|||
los_find_final_room_exhaustive(&prop->pos, prop->rooms, &sp150, sp140);
|
||||
|
||||
if (ishoverbot) {
|
||||
sp150.y = cd_find_ground_at_cyl(&sp150, 5, sp140, NULL, NULL) + 35;
|
||||
sp150.y = cd_find_ground_at_cyl_ct(&sp150, 5, sp140, NULL, NULL) + 35;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (sp150.y < -100000) {
|
||||
|
@ -11197,7 +11197,7 @@ s32 obj_tick_player(struct prop *prop)
|
|||
}
|
||||
|
||||
if ((obj->flags & OBJFLAG_IGNOREFLOORCOLOUR) == 0) {
|
||||
cd_find_floor_y_colour_type_at_pos(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
cd_find_ground_at_pos_ct(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
}
|
||||
|
||||
obj_onmoved(obj, true, true);
|
||||
|
@ -11294,7 +11294,7 @@ s32 obj_tick_player(struct prop *prop)
|
|||
rooms_copy(sp220, prop->rooms);
|
||||
|
||||
if (sp148 <= sp144) {
|
||||
prop->pos.y = cd_find_ground_at_cyl(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL)
|
||||
prop->pos.y = cd_find_ground_at_cyl_ct(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL)
|
||||
+ obj_get_ground_clearance(obj) + sp112;
|
||||
}
|
||||
|
||||
|
@ -11303,7 +11303,7 @@ s32 obj_tick_player(struct prop *prop)
|
|||
|
||||
if (obj_get_geometry(prop, (u8 **)geos, &end)
|
||||
&& geos[0]->type == GEOTYPE_BLOCK
|
||||
&& cd_test_block_overlaps_any_prop((struct geoblock *) geos[0], prop->rooms, CDTYPE_PLAYERS) == CDRESULT_COLLISION) {
|
||||
&& cd_test_blockvolume((struct geoblock *) geos[0], prop->rooms, CDTYPE_PLAYERS) == CDRESULT_COLLISION) {
|
||||
damage = ((obj->maxdamage - obj->damage) + 1) / 250.0f;
|
||||
obj->flags &= ~OBJFLAG_INVINCIBLE;
|
||||
obj_damage(obj, damage, &prop->pos, WEAPON_REMOTEMINE, -1);
|
||||
|
@ -12648,9 +12648,9 @@ Gfx *obj_render_shadow(struct defaultobj *obj, Gfx *gdl)
|
|||
f32 y;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
s32 room = cd_find_floor_room_y_colour_flags_at_pos(&obj->prop->pos, obj->prop->rooms, &y, NULL, NULL);
|
||||
s32 room = cd_find_room_at_pos_ycf(&obj->prop->pos, obj->prop->rooms, &y, NULL, NULL);
|
||||
#else
|
||||
s32 room = cd_find_floor_room_y_colour_flags_at_pos(&obj->prop->pos, obj->prop->rooms, &y, NULL);
|
||||
s32 room = cd_find_room_at_pos_ycf(&obj->prop->pos, obj->prop->rooms, &y, NULL);
|
||||
#endif
|
||||
|
||||
if (room > 0 && (obj->modelnum == MODEL_HOOVERBOT || obj->modelnum == MODEL_TESTERBOT)) {
|
||||
|
@ -13651,10 +13651,10 @@ bool obj_drop(struct prop *prop, bool lazy)
|
|||
spe4.y = spf0.m[3][1];
|
||||
spe4.z = spf0.m[3][2];
|
||||
|
||||
if (cd_test_los10(&root->pos, root->rooms, &spe4, rooms, CDTYPE_ALL,
|
||||
if (cd_test_los_oobok_getfinalroom(&root->pos, root->rooms, &spe4, rooms, CDTYPE_ALL,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL) == CDRESULT_COLLISION
|
||||
|| (projectile->flags & PROJECTILEFLAG_STICKY) == 0) {
|
||||
if (cd_test_volume(&spe4, obj_get_radius(obj), rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0) == CDRESULT_COLLISION) {
|
||||
if (cd_test_volume_simple(&spe4, obj_get_radius(obj), rooms, CDTYPE_ALL, CHECKVERTICAL_NO, 0.0f, 0) == CDRESULT_COLLISION) {
|
||||
spf0.m[3][0] = root->pos.x;
|
||||
spf0.m[3][2] = root->pos.z;
|
||||
}
|
||||
|
@ -13799,7 +13799,7 @@ void obj_destroy_supported_objects(struct prop *tableprop, s32 playernum)
|
|||
{
|
||||
if (prop->pos.y > tableprop->pos.y
|
||||
&& (obj->hidden & OBJHFLAG_ONANOTHEROBJ)
|
||||
&& cd_is_2d_point_in_geo(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
&& cd_is_xz_in_geo(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
obj_fall(obj, playernum);
|
||||
}
|
||||
}
|
||||
|
@ -15108,7 +15108,7 @@ bool obj_test_for_interact(struct prop *prop)
|
|||
|
||||
if (angle <= BADDTOR(22.5f)) {
|
||||
if ((obj->flags2 & OBJFLAG2_INTERACTCHECKLOS) == 0
|
||||
|| cd_test_los06(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
|| cd_test_los_oobtail_autoflags(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
g_InteractProp = prop;
|
||||
}
|
||||
}
|
||||
|
@ -16737,7 +16737,7 @@ s32 obj_test_for_pickup(struct prop *prop)
|
|||
if (pickup
|
||||
&& (obj->flags2 & OBJFLAG2_PICKUPWITHOUTLOS) == 0
|
||||
&& !usebigrange
|
||||
&& cd_test_los05(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms,
|
||||
&& cd_test_los_oobfail(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms,
|
||||
CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT) == false) {
|
||||
pickup = false;
|
||||
|
@ -19265,7 +19265,7 @@ void doors_calc_frac(struct doorobj *door)
|
|||
{
|
||||
prop_set_perim_enabled(loopprop, false);
|
||||
|
||||
cdresult = cd_test_block_overlaps_any_prop(loopdoor->base.geoblock, loopprop->rooms,
|
||||
cdresult = cd_test_blockvolume(loopdoor->base.geoblock, loopprop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_PLAYERS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_OBJSNOTSAFEORHELI);
|
||||
|
||||
prop_set_perim_enabled(loopprop, true);
|
||||
|
@ -19657,7 +19657,7 @@ bool door_test_for_interact(struct prop *prop)
|
|||
|
||||
if (maybe) {
|
||||
if ((door->base.flags2 & OBJFLAG2_INTERACTCHECKLOS) == 0
|
||||
|| cd_test_los06(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
|| cd_test_los_oobtail_autoflags(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
checkmore = door_test_interact_angle(door, false);
|
||||
|
||||
if (checkmore && (door->base.flags2 & OBJFLAG2_DOOR_ALTCOORDSYSTEM)) {
|
||||
|
@ -20341,20 +20341,20 @@ void projectile_create(struct prop *fromprop, struct fireslotthing *arg1, struct
|
|||
|
||||
prop_set_perim_enabled(fromprop, false);
|
||||
|
||||
if (cd_exam_los08(pos, fromprop->rooms, &endpos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER| CDTYPE_BG,
|
||||
if (cd_test_los_oobok_findclosest(pos, fromprop->rooms, &endpos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
blocked = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd_get_pos(&endpos, 24883, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&endpos, 24883, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd_get_pos(&endpos, 24873, "prop/propobj.c");
|
||||
cd_get_obstacle_pos(&endpos, 24873, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd_get_pos(&endpos, 24873, "propobj.c");
|
||||
cd_get_obstacle_pos(&endpos, 24873, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd_get_pos(&endpos, 24482, "propobj.c");
|
||||
cd_get_obstacle_pos(&endpos, 24482, "propobj.c");
|
||||
#else
|
||||
cd_get_pos(&endpos, 24137, "propobj.c");
|
||||
cd_get_obstacle_pos(&endpos, 24137, "propobj.c");
|
||||
#endif
|
||||
obstacle = cd_get_obstacle_prop();
|
||||
}
|
||||
|
|
|
@ -1783,7 +1783,7 @@ void setup_create_props(s32 stagenum)
|
|||
car->nextstep = 0;
|
||||
|
||||
if (obj->flags & OBJFLAG_CHOPPER_INACTIVE) {
|
||||
prop->pos.y = cd_find_floor_y_colour_type_at_pos(&prop->pos, prop->rooms, NULL, 0) + 30;
|
||||
prop->pos.y = cd_find_ground_at_pos_ct(&prop->pos, prop->rooms, NULL, 0) + 30;
|
||||
}
|
||||
|
||||
prop->forcetick = true;
|
||||
|
|
|
@ -77,7 +77,7 @@ void setup_prepare_cover(void)
|
|||
g_CoverRooms[i] = -1;
|
||||
|
||||
if (roomsptr != NULL) {
|
||||
s32 room = cd_find_floor_room_at_pos(cover.pos, roomsptr);
|
||||
s32 room = cd_find_room_at_pos(cover.pos, roomsptr);
|
||||
|
||||
if (room > 0) {
|
||||
g_CoverRooms[i] = (RoomNum)room;
|
||||
|
@ -103,7 +103,7 @@ void setup_prepare_cover(void)
|
|||
}
|
||||
|
||||
if (roomsptr) {
|
||||
s32 aimroom = cd_find_floor_room_at_pos(&aimpos, roomsptr);
|
||||
s32 aimroom = cd_find_room_at_pos(&aimpos, roomsptr);
|
||||
|
||||
if (aimroom > 0) {
|
||||
g_CoverFlags[i] |= (g_CoverRooms[i] == (RoomNum)aimroom) ? COVERFLAG_AIMSAMEROOM : COVERFLAG_AIMDIFFROOM;
|
||||
|
|
|
@ -61,7 +61,7 @@ void setup_prepare_pads(void)
|
|||
}
|
||||
|
||||
if (roomsptr != NULL) {
|
||||
roomnum = cd_find_floor_room_at_pos(&pad.pos, roomsptr);
|
||||
roomnum = cd_find_room_at_pos(&pad.pos, roomsptr);
|
||||
|
||||
if (roomnum > 0) {
|
||||
packedpad->room = roomnum;
|
||||
|
|
|
@ -39,7 +39,7 @@ extern u8 **g_AnimHeaderBytes;
|
|||
extern union filedataptr g_TileFileData;
|
||||
extern s32 g_TileNumRooms;
|
||||
extern u32 *g_TileRooms;
|
||||
extern struct geoblock g_CdSavedBlock;
|
||||
extern struct geoblock g_CdBlock;
|
||||
extern u8 g_RdpDramStack[SP_DRAM_STACK_SIZE8];
|
||||
extern N_ALSndPlayer var8009c2d0;
|
||||
extern struct var8009c340 var8009c340;
|
||||
|
|
|
@ -62,8 +62,8 @@ extern s32 g_AnimMaxBytesPerFrame;
|
|||
extern s32 g_AnimMaxHeaderLength;
|
||||
extern bool g_AnimHostEnabled;
|
||||
extern s32 var8005f030;
|
||||
extern s32 g_CdHasSavedBlock;
|
||||
extern s32 var8005f038;
|
||||
extern s32 g_CdHasBlock;
|
||||
extern s32 g_CdHasGeo;
|
||||
extern u16 *g_RdpOutBufferEnd;
|
||||
extern u16 *g_RdpOutBufferStart;
|
||||
extern struct rdptask *g_RdpCurTask;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
void bwalk_init(void);
|
||||
void bwalk_adjust_crouch_pos(s32 value);
|
||||
s32 bwalk_try_move_upwards(f32 amount);
|
||||
void bwalk0f0c63bc(struct coord *arg0, u32 arg1, s32 types);
|
||||
void bwalk_resolve_posdelta(struct coord *deltapos, bool notrleaning, s32 cdtypes);
|
||||
void bwalk_handle_activate(void);
|
||||
void bwalk_apply_move_data(struct movedata *data);
|
||||
void bwalk_update_speed_theta(void);
|
||||
|
|
|
@ -5,63 +5,68 @@
|
|||
#include "types.h"
|
||||
|
||||
f32 func0f1577f0(f32 arg0[2], f32 arg1[2], f32 arg2[2], f32 arg3[2]);
|
||||
f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct xz *arg3);
|
||||
f32 func0f1579cc(struct radiusxz *arg0, struct xz *arg1, struct xz *arg2, struct xz *arg3);
|
||||
|
||||
f32 cd_00024e40(void);
|
||||
f32 cd_get_sqdistance(void);
|
||||
void cd_get_edge(struct coord *pos1, struct coord *pos2, u32 line, char *file);
|
||||
f32 cd_get_distance(void);
|
||||
bool cd_has_distance(void);
|
||||
struct prop *cd_get_obstacle_prop(void);
|
||||
void cd_get_pos(struct coord *pos, u32 line, char *file);
|
||||
void cd_get_obstacle_pos(struct coord *pos, u32 line, char *file);
|
||||
void cd_get_obstacle_normal(struct coord *normal);
|
||||
u32 cd_get_geo_flags(void);
|
||||
void cd_set_saved_pos(struct coord *pos1, struct coord *pos2);
|
||||
bool cd_get_saved_pos(struct coord *arg0, struct coord *arg1);
|
||||
bool cd_is_2d_point_in_geo(f32 x, f32 z, struct geo *tile);
|
||||
void cd_set_block_edge(struct coord *vtx1, struct coord *vtx2);
|
||||
bool cd_get_block_edge(struct coord *vtx1, struct coord *vtx2);
|
||||
|
||||
bool cd_is_xz_in_geo(f32 x, f32 z, struct geo *tile);
|
||||
void cd_get_props_on_platform(struct prop *platform, s16 *propnums, s32 len);
|
||||
s32 cd_000274e0_block(struct geoblock *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision);
|
||||
bool cd_000276c8_cyl(struct geocyl *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision);
|
||||
s32 cd_block_collides_with_cyl_laterally(struct geoblock *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision);
|
||||
bool cd_cyl_collides_with_cyl_laterally(struct geocyl *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision);
|
||||
bool cd_find_ladder(struct coord *pos, f32 width, f32 ymax, f32 ymin, RoomNum *rooms, u16 geoflags, struct coord *laddernormal);
|
||||
bool cd_0002a13c(struct coord *pos, f32 radius, f32 arg2, f32 arg3, RoomNum *rooms, u16 geoflags);
|
||||
f32 cd_find_ground_info_at_cyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, RoomNum *floorroom, s32 *inlift, struct prop **lift);
|
||||
bool is_cyl_touching_tile_with_flags(struct coord *pos, f32 radius, f32 ymax, f32 ymin, RoomNum *rooms, u16 geoflags);
|
||||
f32 cd_find_ground_at_cyl_ctfril(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, RoomNum *floorroom, s32 *inlift, struct prop **lift);
|
||||
f32 cd_return_zero(void);
|
||||
f32 cd_find_ground_at_cyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype);
|
||||
f32 cd_find_floor_y_colour_type_at_pos(struct coord *pos, RoomNum *rooms, u16 *floorcol, u8 *floortype);
|
||||
s32 cd_find_floor_room_at_pos(struct coord *pos, RoomNum *nearrooms);
|
||||
f32 cd_find_ground_at_cyl_ct(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype);
|
||||
f32 cd_find_ground_at_pos_ct(struct coord *pos, RoomNum *rooms, u16 *floorcol, u8 *floortype);
|
||||
RoomNum cd_find_room_at_pos(struct coord *pos, RoomNum *nearrooms);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
RoomNum cd_find_floor_room_y_colour_flags_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr);
|
||||
RoomNum cd_find_ceiling_room_y_colour_flags_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr);
|
||||
RoomNum cd_find_room_at_pos_ycf(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcolptr, u16 *flagsptr);
|
||||
RoomNum cd_find_ceiling_room_at_pos_ycf(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcolptr, u16 *flagsptr);
|
||||
#else
|
||||
RoomNum cd_find_floor_room_y_colour_flags_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr);
|
||||
RoomNum cd_find_ceiling_room_y_colour_flags_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr);
|
||||
RoomNum cd_find_room_at_pos_ycf(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcolptr);
|
||||
RoomNum cd_find_ceiling_room_at_pos_ycf(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcolptr);
|
||||
#endif
|
||||
|
||||
RoomNum cd_find_floor_room_y_colour_normal_prop_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, struct coord *normal, struct prop **propptr);
|
||||
RoomNum cd_find_ceiling_room_y_colour_flags_normal_at_pos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, u16 *geoflags, struct coord *normal);
|
||||
s32 cd_test_volume(struct coord *pos, f32 radius, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move01(struct coord *pos, struct coord *pos2, f32 radius, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move02(struct coord *origpos, struct coord *dstpos, f32 width, RoomNum *dstrooms, s32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
bool cd_test_cyl_move01(struct coord *pos, RoomNum *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cyl_move02(struct coord *pos, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, u32 types, bool arg5, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move03(struct coord *pos, RoomNum *rooms, struct coord *arg2, u32 types, u32 arg4, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cyl_move04(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move05(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, s32 types, bool arg5, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move06(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 arg4, s32 types, s32 arg6, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move07(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin);
|
||||
s32 cd_exam_cyl_move08(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 width, u32 types, s32 arg6, f32 ymax, f32 ymin);
|
||||
bool cd_test_los03(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, u32 types, u16 geoflags);
|
||||
bool cd_test_los04(struct coord *coord, RoomNum *rooms, struct coord *coord2, s32 arg3);
|
||||
bool cd_test_los05(struct coord *coord, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, s32 cdtypes, u16 geoflags);
|
||||
bool cd_test_los06(struct coord *arg0, RoomNum *rooms1, struct coord *arg2, RoomNum *rooms2, u32 types);
|
||||
bool cd_test_los07(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, RoomNum *rooms3, u32 types, u16 geoflags);
|
||||
s32 cd_exam_los08(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types, u16 geoflags);
|
||||
s32 cd_exam_los09(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types);
|
||||
s32 cd_test_los10(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, u16 geoflags);
|
||||
s32 cd_test_los11(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types);
|
||||
bool cd_0002ded8(struct coord *arg0, struct coord *arg1, struct prop *prop);
|
||||
s32 cd_test_block_overlaps_any_prop(struct geoblock *geo, RoomNum *rooms, u32 types);
|
||||
s32 cd_0002f02c(struct geoblock *block, RoomNum *rooms, s32 types);
|
||||
bool cd_is_nearly_in_sight(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, f32 distance, s32 arg4);
|
||||
RoomNum cd_find_room_at_pos_ycnp(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcol, struct coord *normal, struct prop **propptr);
|
||||
RoomNum cd_find_ceiling_room_at_pos_ycfn(struct coord *pos, RoomNum *rooms, f32 *y, u16 *floorcol, u16 *geoflags, struct coord *normal);
|
||||
|
||||
s32 cd_test_volume_simple(struct coord *pos, f32 radius, RoomNum *rooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_volume_closestedge(struct coord *frompos, struct coord *topos, f32 radius, RoomNum *rooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_volume_fromdir(struct coord *frompos, struct coord *topos, f32 radius, RoomNum *dstrooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
|
||||
s32 cd_test_cylmove_oobok(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobfail(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobok_findclosest(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobok_getfinalroom(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobfail_findclosest(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobfail_findclosest_finddist(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, f32 radius, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobok_findclosest_getfinalroom(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
s32 cd_test_cylmove_oobok_findclosest_getfinalroom_finddist(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, f32 radius, u32 types, bool checkvertical, f32 ymax, f32 ymin);
|
||||
|
||||
s32 cd_test_los_oobok(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, u32 types, u16 geoflags);
|
||||
s32 cd_test_los_oobok_autoflags(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, u32 types);
|
||||
s32 cd_test_los_oobfail(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, u32 types, u16 geoflags);
|
||||
s32 cd_test_los_oobtail_autoflags(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, u32 types);
|
||||
s32 cd_test_los_oobfail_getfinalroom(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *torooms, RoomNum *finalrooms, u32 types, u16 geoflags);
|
||||
s32 cd_test_los_oobok_findclosest(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, u32 types, u16 geoflags);
|
||||
s32 cd_test_los_oobok_findclosest_autoflags(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types);
|
||||
s32 cd_test_los_oobok_getfinalroom(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, u32 types, u16 geoflags);
|
||||
s32 cd_test_los_oobok_getfinalroom_autoflags(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, RoomNum *finalrooms, u32 types);
|
||||
|
||||
bool cd_test_line_intersects_prop(struct coord *frompos, struct coord *topos, struct prop *prop);
|
||||
s32 cd_test_blockvolume(struct geoblock *block, RoomNum *rooms, u32 types);
|
||||
s32 cd_test_blockmove(struct geoblock *block, RoomNum *rooms, u32 types);
|
||||
bool cd_is_nearly_in_sight(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, f32 distance, u32 types);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5810,8 +5810,8 @@ struct xraydata {
|
|||
/*0x24a*/ s16 numtris;
|
||||
};
|
||||
|
||||
struct widthxz {
|
||||
f32 width;
|
||||
struct radiusxz {
|
||||
f32 radius;
|
||||
f32 x;
|
||||
f32 z;
|
||||
};
|
||||
|
|
2182
src/lib/collision.c
2182
src/lib/collision.c
File diff suppressed because it is too large
Load Diff
|
@ -173,10 +173,10 @@ s32 portal_calculate_intersection(s32 portalnum, struct coord *pos1, struct coor
|
|||
* Given frompos, fromrooms and a topos,
|
||||
* use portals to figure out the new rooms list.
|
||||
*
|
||||
* The final rooms are written to results1,
|
||||
* The final rooms are written to finalrooms,
|
||||
* which should only ever have 0 or 1 room in it.
|
||||
*
|
||||
* The caller may optionally pass results2 and its length,
|
||||
* The caller may optionally pass intersecting and its length,
|
||||
* which will be populated with all traversed rooms.
|
||||
*
|
||||
* This is overengineered. It allows a room to have multiple
|
||||
|
|
Loading…
Reference in New Issue