mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-17 12:59:41 -04:00
Rename a heap of collision detection functions
This commit is contained in:
+2
-2
@@ -361,7 +361,7 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
|
||||
rooms[0] = pad.room;
|
||||
rooms[1] = -1;
|
||||
|
||||
if (cdTestVolume(&pad.pos, 20, rooms, CDTYPE_ALL, 1, 200, -200) == CDRESULT_COLLISION
|
||||
if (cdTestVolume(&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 *bodyAllocateEyespy(struct pad *pad, s16 room)
|
||||
chr->visionrange = 0;
|
||||
chr->race = bodyGetRace(chr->bodynum);
|
||||
|
||||
ground = cdFindGroundY(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift);
|
||||
ground = cdFindGroundInfoAtCyl(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift);
|
||||
chr->ground = ground;
|
||||
chr->manground = ground;
|
||||
|
||||
|
||||
+14
-14
@@ -137,7 +137,7 @@ void bbikeTryDismountAngle(f32 relativeangle, f32 distance)
|
||||
func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &pos, rooms);
|
||||
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &pos, rooms);
|
||||
|
||||
result = cdTestAToB2(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
result = cdTestCylMove02(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, true,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
@@ -145,7 +145,7 @@ void bbikeTryDismountAngle(f32 relativeangle, f32 distance)
|
||||
propSetPerimEnabled(g_Vars.currentplayer->hoverbike, true);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cdTestVolume(&pos, radius, rooms, CDTYPE_ALL, true,
|
||||
result = cdTestVolume(&pos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ void bbike0f0d2b40(struct defaultobj *bike, struct coord *arg1, f32 arg2, struct
|
||||
struct coord sp60;
|
||||
struct coord sp54;
|
||||
|
||||
cd00024e4c(&sp78, &sp6c, 333, "bondbike.c");
|
||||
cdGetEdge(&sp78, &sp6c, 333, "bondbike.c");
|
||||
|
||||
sp60.x = bike->prop->pos.x;
|
||||
sp60.y = bike->prop->pos.y;
|
||||
@@ -414,21 +414,21 @@ s32 bbikeCalculateNewPosition(struct coord *vel, f32 angledelta)
|
||||
zdiff = dstpos.z - g_Vars.currentplayer->hoverbike->pos.z;
|
||||
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
result = cdTestAToB3(&g_Vars.currentplayer->hoverbike->pos,
|
||||
result = cdExamCylMove06(&g_Vars.currentplayer->hoverbike->pos,
|
||||
g_Vars.currentplayer->hoverbike->rooms,
|
||||
&dstpos, dstrooms, radius, CDTYPE_ALL, 1,
|
||||
ymax - g_Vars.currentplayer->hoverbike->pos.y,
|
||||
ymin - g_Vars.currentplayer->hoverbike->pos.y);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cdTestAToB1(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, dstrooms, CDTYPE_ALL, 1,
|
||||
result = cdExamCylMove02(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, dstrooms, CDTYPE_ALL, true,
|
||||
ymax - g_Vars.currentplayer->hoverbike->pos.y,
|
||||
ymin - g_Vars.currentplayer->hoverbike->pos.y);
|
||||
}
|
||||
} else {
|
||||
result = cdTestAToB1(&g_Vars.currentplayer->hoverbike->pos,
|
||||
&dstpos, radius, spa8, CDTYPE_ALL, 1,
|
||||
result = cdExamCylMove02(&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);
|
||||
}
|
||||
@@ -473,7 +473,7 @@ s32 bbikeCalculateNewPositionWithPush(struct coord *arg0, f32 arg1)
|
||||
s32 result = bbikeCalculateNewPosition(arg0, arg1);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cdGetObstacle();
|
||||
struct prop *obstacle = cdGetObstacleProp();
|
||||
|
||||
if (obstacle && g_Vars.lvupdate240 > 0) {
|
||||
if (obstacle->type == PROPTYPE_CHR) {
|
||||
@@ -563,7 +563,7 @@ void bbikeUpdateVertical(struct coord *pos)
|
||||
g_Vars.currentplayer->prop->pos.y = pos->y;
|
||||
g_Vars.currentplayer->prop->pos.z = pos->z;
|
||||
|
||||
ground = cdFindGroundY(&g_Vars.currentplayer->prop->pos,
|
||||
ground = cdFindGroundInfoAtCyl(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->bond2.radius,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
@@ -618,9 +618,9 @@ s32 bbike0f0d3680(struct coord *arg0, struct coord *arg1, struct coord *arg2)
|
||||
|
||||
if (!result) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(arg1, arg2, 659, "bondbike.c");
|
||||
cdGetEdge(arg1, arg2, 659, "bondbike.c");
|
||||
#else
|
||||
cd00024e4c(arg1, arg2, 656, "bondbike.c");
|
||||
cdGetEdge(arg1, arg2, 656, "bondbike.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -646,9 +646,9 @@ s32 bbike0f0d36d4(struct coord *arg0, struct coord *arg1, struct coord *arg2, st
|
||||
|
||||
if (someint == 0) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(arg3, arg4, 685, "bondbike.c");
|
||||
cdGetEdge(arg3, arg4, 685, "bondbike.c");
|
||||
#else
|
||||
cd00024e4c(arg3, arg4, 682, "bondbike.c");
|
||||
cdGetEdge(arg3, arg4, 682, "bondbike.c");
|
||||
#endif
|
||||
|
||||
if (arg3->f[0] != arg1->f[0]
|
||||
|
||||
+26
-22
@@ -60,7 +60,7 @@ f32 eyespyFindGround(s16 *floorroom)
|
||||
pos.y = prop->pos.y + yoffset;
|
||||
pos.z = prop->pos.z;
|
||||
|
||||
ground = cdFindGroundY(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift);
|
||||
ground = cdFindGroundInfoAtCyl(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift);
|
||||
|
||||
if (ground < -30000) {
|
||||
ground = -30000;
|
||||
@@ -100,7 +100,7 @@ s32 eyespyTryMoveUpwards(f32 yvel)
|
||||
|
||||
f0 -= 0.1f;
|
||||
|
||||
result = cdTestVolume(&dstpos, 26, dstrooms, types, 1, 15, f0);
|
||||
result = cdTestVolume(&dstpos, 26, dstrooms, types, CHECKVERTICAL_YES, 15, f0);
|
||||
propSetPerimEnabled(prop, true);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
@@ -123,12 +123,12 @@ s32 eyespyCalculateNewPosition(struct coord *vel)
|
||||
s16 sp74[24];
|
||||
s32 types;
|
||||
s32 i;
|
||||
f32 f18;
|
||||
f32 ymin;
|
||||
f32 xdiff;
|
||||
f32 zdiff;
|
||||
u32 stack;
|
||||
f32 limit;
|
||||
f32 halflimit;
|
||||
f32 radius;
|
||||
f32 halfradius;
|
||||
struct prop *prop;
|
||||
s32 playernum;
|
||||
u32 stack2;
|
||||
@@ -146,9 +146,9 @@ s32 eyespyCalculateNewPosition(struct coord *vel)
|
||||
|
||||
// Allow eyespy to go up steps 30cm or less
|
||||
if (g_Vars.currentplayer->eyespy->oldground <= chr->manground + 30) {
|
||||
f18 = chr->manground - eyespyprop->pos.y + 30;
|
||||
ymin = chr->manground - eyespyprop->pos.y + 30;
|
||||
} else {
|
||||
f18 = g_Vars.currentplayer->eyespy->oldground - eyespyprop->pos.y;
|
||||
ymin = g_Vars.currentplayer->eyespy->oldground - eyespyprop->pos.y;
|
||||
}
|
||||
|
||||
// This must be populating dstrooms at least
|
||||
@@ -172,21 +172,21 @@ s32 eyespyCalculateNewPosition(struct coord *vel)
|
||||
xdiff = dstpos.x - eyespyprop->pos.x;
|
||||
zdiff = dstpos.z - eyespyprop->pos.z;
|
||||
|
||||
limit = 26;
|
||||
halflimit = limit * 0.5f;
|
||||
radius = 26;
|
||||
halfradius = radius * 0.5f;
|
||||
|
||||
if (xdiff > halflimit || zdiff > halflimit || xdiff < -halflimit || zdiff < -halflimit) {
|
||||
result = cdTestAToB3(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, limit, types, 1, 15, f18);
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
result = cdExamCylMove06(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, radius, types, 1, 15, ymin);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cdTestAToB1(&eyespyprop->pos, &dstpos, limit, dstrooms, types, 1, 15, f18);
|
||||
result = cdExamCylMove02(&eyespyprop->pos, &dstpos, radius, dstrooms, types, true, 15, ymin);
|
||||
}
|
||||
} else {
|
||||
result = cdTestAToB1(&eyespyprop->pos, &dstpos, limit, sp74, types, 1, 15, f18);
|
||||
result = cdExamCylMove02(&eyespyprop->pos, &dstpos, radius, sp74, types, true, 15, ymin);
|
||||
}
|
||||
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
prop = cdGetObstacle();
|
||||
prop = cdGetObstacleProp();
|
||||
|
||||
if (prop && prop->type == PROPTYPE_PLAYER) {
|
||||
playernum = g_Vars.currentplayernum;
|
||||
@@ -222,7 +222,7 @@ bool eyespyCalculateNewPositionWithPush(struct coord *vel)
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
g_EyespyHit = EYESPYHIT_BG;
|
||||
|
||||
prop = cdGetObstacle();
|
||||
prop = cdGetObstacleProp();
|
||||
|
||||
if (prop && g_Vars.lvupdate240 > 0) {
|
||||
if (prop->type == PROPTYPE_DOOR) {
|
||||
@@ -235,7 +235,7 @@ bool eyespyCalculateNewPositionWithPush(struct coord *vel)
|
||||
struct coord sp2c;
|
||||
struct coord sp20;
|
||||
|
||||
cd00024e4c(&sp2c, &sp20, 286, "bondeyespy.c");
|
||||
cdGetEdge(&sp2c, &sp20, 286, "bondeyespy.c");
|
||||
|
||||
// Nothing is actually done with these coordinates...
|
||||
// This code was likely copied from bondwalk then the bounce
|
||||
@@ -286,7 +286,7 @@ s32 eyespy0f0cf890(struct coord *arg0, struct coord *arg1, struct coord *arg2, s
|
||||
}
|
||||
|
||||
if (someint == 0) {
|
||||
cd00024e4c(arg3, arg4, 350, "bondeyespy.c");
|
||||
cdGetEdge(arg3, arg4, 350, "bondeyespy.c");
|
||||
|
||||
if (arg3->f[0] != arg1->f[0]
|
||||
|| arg3->f[1] != arg1->f[1]
|
||||
@@ -405,7 +405,7 @@ s32 eyespy0f0cfdd0(struct coord *vel, struct coord *arg1, struct coord *arg2)
|
||||
bool result = eyespyCalculateNewPositionWithPush(vel);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
cd00024e4c(arg1, arg2, 473, "bondeyespy.c");
|
||||
cdGetEdge(arg1, arg2, 473, "bondeyespy.c");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -635,8 +635,10 @@ bool eyespyTryLaunch(void)
|
||||
|
||||
playerSetPerimEnabled(g_Vars.currentplayer->prop, false);
|
||||
|
||||
if (insafe || !cdTestAToB4(&testfrompos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->eyespy->prop->pos, CDTYPE_ALL, 15)) {
|
||||
if (insafe || !cdExamLos08(&testfrompos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->eyespy->prop->pos,
|
||||
CDTYPE_ALL,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT)) {
|
||||
// Launch failed due to not enough physical space, or we're in the G5 safe
|
||||
g_Vars.currentplayer->eyespy->deployed = false;
|
||||
|
||||
@@ -1142,8 +1144,10 @@ void eyespyProcessInput(bool allowbuttons)
|
||||
g_EyespyPickup = false;
|
||||
}
|
||||
|
||||
cdresult = cdHasLineOfSight(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->eyespy->prop->pos, g_Vars.currentplayer->eyespy->prop->rooms, 0x22, 0x1c);
|
||||
cdresult = cdTestLos05(&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);
|
||||
|
||||
if (cdresult == CDRESULT_COLLISION) {
|
||||
// Something's in the way
|
||||
|
||||
+26
-24
@@ -65,7 +65,7 @@ void bgrabInit(void)
|
||||
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
|
||||
struct defaultobj *obj = prop->obj;
|
||||
struct hov *hov = NULL;
|
||||
bool withforce;
|
||||
s32 cdresult;
|
||||
|
||||
if (obj->hidden & OBJHFLAG_PROJECTILE) {
|
||||
struct projectile *projectile = obj->projectile;
|
||||
@@ -96,18 +96,18 @@ void bgrabInit(void)
|
||||
obj->hidden |= OBJHFLAG_GRABBED;
|
||||
|
||||
if (obj->flags3 & OBJFLAG3_GEOCYL) {
|
||||
withforce = cd000276c8(obj->geocyl,
|
||||
cdresult = cd000276c8Cyl(obj->geocyl,
|
||||
g_Vars.currentplayer->prop->pos.x,
|
||||
g_Vars.currentplayer->prop->pos.z,
|
||||
VERSION >= VERSION_NTSC_1_0 ? 45 : 40, 0, 0);
|
||||
} else {
|
||||
withforce = cd000274e0(obj->geoblock,
|
||||
cdresult = cd000274e0Block(obj->geoblock,
|
||||
g_Vars.currentplayer->prop->pos.x,
|
||||
g_Vars.currentplayer->prop->pos.z,
|
||||
VERSION >= VERSION_NTSC_1_0 ? 45 : 40, 0, 0);
|
||||
}
|
||||
|
||||
if (withforce) {
|
||||
if (cdresult != CDRESULT_COLLISION) {
|
||||
g_Vars.currentplayer->grabbedforcez = VERSION >= VERSION_NTSC_1_0 ? 15 : 10;
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,9 @@ void bgrab0f0ccbf0(struct coord *delta, f32 angle, struct defaultobj *obj)
|
||||
sp98.z = delta->z + g_Vars.currentplayer->prop->pos.z;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&spb0, &spa4, 201, "bondgrab.c");
|
||||
cdGetEdge(&spb0, &spa4, 201, "bondgrab.c");
|
||||
#else
|
||||
cd00024e4c(&spb0, &spa4, 200, "bondgrab.c");
|
||||
cdGetEdge(&spb0, &spa4, 200, "bondgrab.c");
|
||||
#endif
|
||||
|
||||
spc8.x = spa4.z - spb0.z;
|
||||
@@ -217,12 +217,12 @@ void bgrab0f0ccbf0(struct coord *delta, f32 angle, struct defaultobj *obj)
|
||||
struct coord sp44;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp68, &sp5c, 228, "bondgrab.c");
|
||||
cdGetEdge(&sp68, &sp5c, 228, "bondgrab.c");
|
||||
#else
|
||||
cd00024e4c(&sp68, &sp5c, 227, "bondgrab.c");
|
||||
cdGetEdge(&sp68, &sp5c, 227, "bondgrab.c");
|
||||
#endif
|
||||
|
||||
if (cd00025364(&sp50, &sp44)) {
|
||||
if (cdGetSavedPos(&sp50, &sp44)) {
|
||||
sp44.x -= sp50.x;
|
||||
sp44.y -= sp50.y;
|
||||
sp44.z -= sp50.z;
|
||||
@@ -300,7 +300,7 @@ bool bgrabTryMoveUpwards(f32 y)
|
||||
|
||||
ymin -= 0.1f;
|
||||
|
||||
result = cdTestVolume(&newpos, radius, rooms, CDTYPE_ALL, 1,
|
||||
result = cdTestVolume(&newpos, radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
@@ -369,13 +369,13 @@ s32 bgrabCalculateNewPosition(struct coord *delta, f32 angle, bool arg2)
|
||||
|
||||
ismoving = true;
|
||||
|
||||
cdresult = cd0002d8b8(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
cdresult = cdExamCylMove05(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&pos, rooms, CDTYPE_ALL, true,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd0002a6fc(&g_Vars.currentplayer->prop->pos, &pos, radius, rooms, CDTYPE_ALL, true,
|
||||
cdresult = cdExamCylMove01(&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);
|
||||
}
|
||||
@@ -543,7 +543,7 @@ bool bgrabCalculateNewPositiontWithPush(struct coord *delta, f32 angle, bool arg
|
||||
s32 result = bgrabCalculateNewPosition(delta, angle, arg2);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cdGetObstacle();
|
||||
struct prop *obstacle = cdGetObstacleProp();
|
||||
|
||||
if (obstacle && g_Vars.lvupdate240 > 0) {
|
||||
if (obstacle->type == PROPTYPE_CHR) {
|
||||
@@ -630,9 +630,9 @@ bool bgrab0f0cdb68(f32 angle)
|
||||
f32 ymin;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&spa4, &sp98, 678, "bondgrab.c");
|
||||
cdGetEdge(&spa4, &sp98, 678, "bondgrab.c");
|
||||
#else
|
||||
cd00024e4c(&spa4, &sp98, 674, "bondgrab.c");
|
||||
cdGetEdge(&spa4, &sp98, 674, "bondgrab.c");
|
||||
#endif
|
||||
|
||||
sp7c = sp98.f[0] - spa4.f[0];
|
||||
@@ -654,9 +654,9 @@ bool bgrab0f0cdb68(f32 angle)
|
||||
f22 = -f22;
|
||||
}
|
||||
|
||||
if (var8005f034) {
|
||||
for (i = 0; i < var8009a918.header.numvertices; i++) {
|
||||
f0 = (var8009a918.vertices[i][0] - spa4.f[0]) * f20 + (var8009a918.vertices[i][1] - spa4.f[2]) * 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 (f0 < 0.0f) {
|
||||
f0 = -f0;
|
||||
@@ -667,7 +667,7 @@ bool bgrab0f0cdb68(f32 angle)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cd00025364(&sp8c, &sp80)) {
|
||||
if (cdGetSavedPos(&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]);
|
||||
|
||||
@@ -734,9 +734,9 @@ bool bgrab0f0cdf64(struct coord *delta, struct coord *arg1, struct coord *arg2)
|
||||
|
||||
if (!result) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(arg1, arg2, 815, "bondgrab.c");
|
||||
cdGetEdge(arg1, arg2, 815, "bondgrab.c");
|
||||
#else
|
||||
cd00024e4c(arg1, arg2, 811, "bondgrab.c");
|
||||
cdGetEdge(arg1, arg2, 811, "bondgrab.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -819,7 +819,7 @@ void bgrabUpdateVertical(void)
|
||||
f32 fVar3;
|
||||
f32 f0;
|
||||
|
||||
f14 = cdFindGroundY(&g_Vars.currentplayer->prop->pos,
|
||||
f14 = cdFindGroundInfoAtCyl(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->bond2.radius,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
@@ -1218,8 +1218,10 @@ void bgrabTick(void)
|
||||
if (g_Vars.currentplayer->vv_ground <= -30000
|
||||
|| ydiff < -100 || ydiff > 100
|
||||
|| g_Vars.currentplayer->vv_ground < g_Vars.currentplayer->vv_manground - 50
|
||||
|| !cdHasLineOfSight(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
|
||||
&g_Vars.currentplayer->grabbedprop->pos, g_Vars.currentplayer->grabbedprop->rooms, CDTYPE_ALL, 12)) {
|
||||
|| !cdTestLos05(&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)) {
|
||||
bmoveSetMode(MOVEMODE_WALK);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6110,7 +6110,7 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
|
||||
|
||||
playerSetPerimEnabled(playerprop, false);
|
||||
|
||||
if (cd0002deac(&playerprop->pos, playerprop->rooms, &muzzlepos, spawnrooms, CDTYPE_ALL) != CDRESULT_COLLISION) {
|
||||
if (cdTestLos11(&playerprop->pos, playerprop->rooms, &muzzlepos, spawnrooms, CDTYPE_ALL) != CDRESULT_COLLISION) {
|
||||
spawnpos.x = muzzlepos.x;
|
||||
spawnpos.y = muzzlepos.y;
|
||||
spawnpos.z = muzzlepos.z;
|
||||
|
||||
+7
-5
@@ -429,16 +429,18 @@ f32 bmoveCalculateLookahead(void)
|
||||
sp150.y = sp100.y * 400 + spf0.y;
|
||||
sp150.z = sp100.z * 400 + spf0.z;
|
||||
|
||||
if (cdTestAToB4(&spf0, spe0, &sp150, CDTYPE_BG | CDTYPE_CLOSEDDOORS, 0xf) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&spf0, spe0, &sp150,
|
||||
CDTYPE_BG | CDTYPE_CLOSEDDOORS,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT) == CDRESULT_COLLISION) {
|
||||
cdGetPos(&sp150, 455, "bondmove.c");
|
||||
flags = cdGetTileFlags();
|
||||
flags = cdGetGeoFlags();
|
||||
|
||||
sp160 = sqrtf((sp150.x - spf0.x) * (sp150.x - spf0.x)
|
||||
+ (sp150.y - spf0.y) * (sp150.y - spf0.y)
|
||||
+ (sp150.z - spf0.z) * (sp150.z - spf0.z));
|
||||
}
|
||||
|
||||
if (sp160 > 60.0f || (flags & GEOFLAG_0001)) {
|
||||
if (sp160 > 60.0f || (flags & GEOFLAG_FLOOR1)) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
populated[i] = false;
|
||||
value = (i + 1) * sp160 * 0.2f;
|
||||
@@ -457,9 +459,9 @@ f32 bmoveCalculateLookahead(void)
|
||||
|
||||
if (
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd0002a440(&spbc, sp80, &sp78, NULL, NULL) > 0
|
||||
cdFindFloorRoomYColourFlagsAtPos(&spbc, sp80, &sp78, NULL, NULL) > 0
|
||||
#else
|
||||
cd0002a440(&spbc, sp80, &sp78, NULL) > 0
|
||||
cdFindFloorRoomYColourFlagsAtPos(&spbc, sp80, &sp78, NULL) > 0
|
||||
#endif
|
||||
&& sp78 - ground < 200
|
||||
&& sp78 - ground > -200) {
|
||||
|
||||
+28
-29
@@ -148,9 +148,9 @@ void bwalk0f0c3b38(struct coord *reltarget, struct defaultobj *obj)
|
||||
abstarget.z = reltarget->z + g_Vars.currentplayer->prop->pos.z;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&globalthinga, &globalthingb, 223, "bondwalk.c");
|
||||
cdGetEdge(&globalthinga, &globalthingb, 223, "bondwalk.c");
|
||||
#else
|
||||
cd00024e4c(&globalthinga, &globalthingb, 221, "bondwalk.c");
|
||||
cdGetEdge(&globalthinga, &globalthingb, 221, "bondwalk.c");
|
||||
#endif
|
||||
|
||||
vector.x = globalthingb.z - globalthinga.z;
|
||||
@@ -192,7 +192,7 @@ s32 bwalkTryMoveUpwards(f32 amount)
|
||||
f32 ymin;
|
||||
f32 radius;
|
||||
|
||||
if (g_Vars.currentplayer->floorflags & GEOFLAG_0100) {
|
||||
if (g_Vars.currentplayer->floorflags & GEOFLAG_SLOPE) {
|
||||
g_Vars.enableslopes = false;
|
||||
} else {
|
||||
g_Vars.enableslopes = true;
|
||||
@@ -211,7 +211,7 @@ s32 bwalkTryMoveUpwards(f32 amount)
|
||||
|
||||
ymin -= 0.1f;
|
||||
|
||||
result = cdTestVolume(&newpos, radius, rooms, types, 1,
|
||||
result = cdTestVolume(&newpos, radius, rooms, types, CHECKVERTICAL_YES,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
@@ -244,7 +244,7 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply,
|
||||
f32 zdiff;
|
||||
s32 i;
|
||||
|
||||
if (g_Vars.currentplayer->floorflags & GEOFLAG_0100) {
|
||||
if (g_Vars.currentplayer->floorflags & GEOFLAG_SLOPE) {
|
||||
g_Vars.enableslopes = false;
|
||||
} else {
|
||||
g_Vars.enableslopes = true;
|
||||
@@ -295,21 +295,21 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply,
|
||||
halfradius = radius * 0.5f;
|
||||
|
||||
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
|
||||
result = cdTestAToB3(&g_Vars.currentplayer->prop->pos,
|
||||
result = cdExamCylMove06(&g_Vars.currentplayer->prop->pos,
|
||||
g_Vars.currentplayer->prop->rooms,
|
||||
&dstpos, dstrooms, radius, types, 1,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
|
||||
if (result == CDRESULT_NOCOLLISION) {
|
||||
result = cdTestAToB1(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, dstrooms, types, 1,
|
||||
result = cdExamCylMove02(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, dstrooms, types, true,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
result = cdTestAToB1(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, sp64, types, 1,
|
||||
result = cdExamCylMove02(&g_Vars.currentplayer->prop->pos,
|
||||
&dstpos, radius, sp64, types, true,
|
||||
ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
ymin - g_Vars.currentplayer->prop->pos.y);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo
|
||||
s32 result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, types);
|
||||
|
||||
if (result != CDRESULT_NOCOLLISION) {
|
||||
struct prop *obstacle = cdGetObstacle();
|
||||
struct prop *obstacle = cdGetObstacleProp();
|
||||
|
||||
if (obstacle && g_Vars.lvupdate240 > 0) {
|
||||
if (obstacle->type == PROPTYPE_DOOR) {
|
||||
@@ -366,9 +366,9 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo
|
||||
if (door->doorflags & DOORFLAG_DAMAGEONCONTACT) {
|
||||
if (!g_Vars.currentplayer->isdead) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp84, &sp78, 465, "bondwalk.c");
|
||||
cdGetEdge(&sp84, &sp78, 465, "bondwalk.c");
|
||||
#else
|
||||
cd00024e4c(&sp84, &sp78, 460, "bondwalk.c");
|
||||
cdGetEdge(&sp84, &sp78, 460, "bondwalk.c");
|
||||
#endif
|
||||
|
||||
sp90.x = sp78.f[2] - sp84.f[2];
|
||||
@@ -503,9 +503,9 @@ s32 bwalk0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s
|
||||
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(arg1, arg2, 607, "bondwalk.c");
|
||||
cdGetEdge(arg1, arg2, 607, "bondwalk.c");
|
||||
#else
|
||||
cd00024e4c(arg1, arg2, 602, "bondwalk.c");
|
||||
cdGetEdge(arg1, arg2, 602, "bondwalk.c");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -531,9 +531,9 @@ s32 bwalk0f0c47d0(struct coord *a, struct coord *b, struct coord *c,
|
||||
|
||||
if (result == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(d, e, 635, "bondwalk.c");
|
||||
cdGetEdge(d, e, 635, "bondwalk.c");
|
||||
#else
|
||||
cd00024e4c(d, e, 630, "bondwalk.c");
|
||||
cdGetEdge(d, e, 630, "bondwalk.c");
|
||||
#endif
|
||||
|
||||
if (b->x != d->x
|
||||
@@ -740,7 +740,7 @@ void bwalkUpdateVertical(void)
|
||||
if (g_Vars.antiplayernum >= 0
|
||||
&& g_Vars.currentplayer == g_Vars.anti
|
||||
&& g_Vars.currentplayer->bond2.radius != 30
|
||||
&& cdTestVolume(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
|
||||
&& cdTestVolume(&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;
|
||||
@@ -751,10 +751,11 @@ void bwalkUpdateVertical(void)
|
||||
// If this comes up false, a second check is done... maybe checking if the
|
||||
// player is touching a ladder from a room which shares the same coordinate
|
||||
// space?
|
||||
onladder = cd00029ffc(&g_Vars.currentplayer->prop->pos,
|
||||
onladder = cdFindLadder(&g_Vars.currentplayer->prop->pos,
|
||||
radius * 1.2f, ymax - g_Vars.currentplayer->prop->pos.y,
|
||||
g_Vars.currentplayer->vv_manground - g_Vars.currentplayer->prop->pos.y + 1,
|
||||
g_Vars.currentplayer->prop->rooms, 0x8040, &g_Vars.currentplayer->laddernormal);
|
||||
g_Vars.currentplayer->prop->rooms, GEOFLAG_LADDER | GEOFLAG_LADDER_PLAYERONLY,
|
||||
&g_Vars.currentplayer->laddernormal);
|
||||
|
||||
if (!onladder) {
|
||||
testpos.x = g_Vars.currentplayer->prop->pos.x;
|
||||
@@ -762,10 +763,10 @@ void bwalkUpdateVertical(void)
|
||||
testpos.z = g_Vars.currentplayer->prop->pos.z;
|
||||
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms);
|
||||
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &testpos, rooms);
|
||||
onladder2 = cd00029ffc(&g_Vars.currentplayer->prop->pos,
|
||||
onladder2 = cdFindLadder(&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 - 10,
|
||||
rooms, 0x8040, &g_Vars.currentplayer->laddernormal);
|
||||
rooms, GEOFLAG_LADDER | GEOFLAG_LADDER_PLAYERONLY, &g_Vars.currentplayer->laddernormal);
|
||||
}
|
||||
|
||||
testpos.x = g_Vars.currentplayer->prop->pos.x;
|
||||
@@ -778,7 +779,7 @@ void bwalkUpdateVertical(void)
|
||||
|
||||
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms);
|
||||
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &testpos, rooms);
|
||||
ground = cdFindGroundY(&testpos, g_Vars.currentplayer->bond2.radius, rooms,
|
||||
ground = cdFindGroundInfoAtCyl(&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);
|
||||
@@ -888,7 +889,7 @@ void bwalkUpdateVertical(void)
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
else {
|
||||
// Not enough room above. If on a hoverbike, blow it up
|
||||
prop = cdGetObstacle();
|
||||
prop = cdGetObstacleProp();
|
||||
|
||||
if (prop
|
||||
&& g_Vars.currentplayer->prop->pos.y < prop->pos.y
|
||||
@@ -963,7 +964,7 @@ void bwalkUpdateVertical(void)
|
||||
&& g_Vars.currentplayer->vv_ground < g_Vars.currentplayer->vv_manground - 30) {
|
||||
// Not falling - but still at least 30 units off the ground.
|
||||
// Must be something in the way...
|
||||
prop = cdGetObstacle();
|
||||
prop = cdGetObstacleProp();
|
||||
|
||||
if (prop) {
|
||||
if (prop->type == PROPTYPE_CHR) {
|
||||
@@ -1592,12 +1593,10 @@ void bwalk0f0c69b8(void)
|
||||
} else {
|
||||
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
|
||||
|
||||
cdresult = cd0002a13c(&g_Vars.currentplayer->prop->pos,
|
||||
if (!cd0002a13c(&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, 0x8040);
|
||||
|
||||
if (cdresult == CDRESULT_COLLISION) {
|
||||
g_Vars.currentplayer->prop->rooms, GEOFLAG_LADDER | GEOFLAG_LADDER_PLAYERONLY)) {
|
||||
g_Vars.currentplayer->ladderupdown = 0.0f;
|
||||
} else {
|
||||
spcc.f[0] += sp74 * g_Vars.currentplayer->laddernormal.f[0];
|
||||
|
||||
+1
-1
@@ -978,7 +978,7 @@ bool botTestPropForPickup(struct prop *prop, struct chrdata *chr)
|
||||
dprint();
|
||||
|
||||
if ((obj->flags2 & OBJFLAG2_PICKUPWITHOUTLOS) == 0
|
||||
&& !cd0002dcd0(&chrprop->pos, chrprop->rooms, &prop->pos, prop->rooms, 0x22)) {
|
||||
&& !cdTestLos06(&chrprop->pos, chrprop->rooms, &prop->pos, prop->rooms, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
sp3c = false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -489,7 +489,7 @@ void botactGetRocketNextStepPos(u16 padnum, struct coord *pos)
|
||||
rooms[1] = -1;
|
||||
|
||||
pos->x = pad.pos.x;
|
||||
pos->y = cd0002a36c(&pad.pos, rooms, 0, 0) + 150;
|
||||
pos->y = cdFindFloorYColourTypeAtPos(&pad.pos, rooms, 0, 0) + 150;
|
||||
pos->z = pad.pos.z;
|
||||
}
|
||||
|
||||
|
||||
+28
-28
@@ -260,13 +260,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
|
||||
movez = dstpos->z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cd0002d8b8(&prop->pos, prop->rooms, dstpos, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdExamCylMove05(&prop->pos, prop->rooms, dstpos, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cd0002a6fc(&prop->pos, dstpos, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdExamCylMove01(&prop->pos, dstpos, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cd0002a6fc(&prop->pos, dstpos, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdExamCylMove01(&prop->pos, dstpos, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult != CDRESULT_ERROR) {
|
||||
@@ -280,13 +280,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
|
||||
moveok = true;
|
||||
} else {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
cdGetEdge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp78, &sp6c, 453, "chr.c");
|
||||
cdGetEdge(&sp78, &sp6c, 453, "chr.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
cdGetEdge(&sp78, &sp6c, 453, "chr/chr.c");
|
||||
#else
|
||||
cd00024e4c(&sp78, &sp6c, 451, "chr.c");
|
||||
cdGetEdge(&sp78, &sp6c, 451, "chr.c");
|
||||
#endif
|
||||
|
||||
// Attempt to find a valid position - method #1
|
||||
@@ -326,13 +326,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cdTestAToB2(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestCylMove02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
@@ -382,13 +382,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cdTestAToB2(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestCylMove02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
@@ -436,13 +436,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
|
||||
movez = sp44.z - prop->pos.z;
|
||||
|
||||
if (movex > halfradius || movez > halfradius || movex < -halfradius || movez < -halfradius) {
|
||||
cdresult = cdTestAToB2(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestCylMove02(&prop->pos, prop->rooms, &sp44, dstrooms, CDTYPE_ALL, true, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
} else {
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
@@ -494,7 +494,7 @@ bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3)
|
||||
func0f065e74(pos, rooms, &newpos, newrooms);
|
||||
chr0f021fa8(chr, &newpos, newrooms);
|
||||
chrSetPerimEnabled(chr, false);
|
||||
result = cdTestVolume(&newpos, radius, newrooms, CDTYPE_ALL, 1,
|
||||
result = cdTestVolume(&newpos, radius, newrooms, CDTYPE_ALL, CHECKVERTICAL_YES,
|
||||
ymax - chr->prop->pos.y,
|
||||
ymin - chr->prop->pos.y);
|
||||
chrSetPerimEnabled(chr, true);
|
||||
@@ -550,7 +550,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
|
||||
func0f065e74(&prop->pos, prop->rooms, arg2, spfc);
|
||||
}
|
||||
|
||||
ground = cdFindGroundY(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
ground = cdFindGroundInfoAtCyl(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
|
||||
if (ground < -1000000) {
|
||||
ground = 0.0f;
|
||||
@@ -603,10 +603,10 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
|
||||
}
|
||||
|
||||
if (chr->actiontype == ACT_PATROL || chr->actiontype == ACT_GOPOS) {
|
||||
chr->onladder = cd00029ffc(&chr->prop->pos, chr->radius * 2.5f,
|
||||
chr->onladder = cdFindLadder(&chr->prop->pos, chr->radius * 2.5f,
|
||||
chr->manground + chr->height - chr->prop->pos.y,
|
||||
chr->manground + 1.0f - chr->prop->pos.y,
|
||||
chr->prop->rooms, 0x40, &chr->laddernormal);
|
||||
chr->prop->rooms, GEOFLAG_LADDER, &chr->laddernormal);
|
||||
} else {
|
||||
chr->onladder = false;
|
||||
}
|
||||
@@ -621,12 +621,12 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
|
||||
} else if (cd0002a13c(&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, 0x1000) != CDRESULT_COLLISION) {
|
||||
chr->prop->rooms, GEOFLAG_AIBOTDUCK)) {
|
||||
chr->height = 135.0f;
|
||||
} else if (cd0002a13c(&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, 0x800) != CDRESULT_COLLISION) {
|
||||
chr->prop->rooms, GEOFLAG_AIBOTCROUCH)) {
|
||||
chr->height = 90.0f;
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
|
||||
sp94 = spfc;
|
||||
}
|
||||
|
||||
ground = cdFindGroundY(sp98, chr->radius, sp94,
|
||||
ground = cdFindGroundInfoAtCyl(sp98, chr->radius, sp94,
|
||||
&chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
@@ -834,7 +834,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
|
||||
|
||||
lvupdate240freal = 0.0f;
|
||||
|
||||
ground = cdFindGroundY(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
ground = cdFindGroundInfoAtCyl(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1303,7 +1303,7 @@ struct prop *chr0f020b14(struct prop *prop, struct model *model,
|
||||
testpos.y = pos->y + 100;
|
||||
testpos.z = pos->z;
|
||||
|
||||
chr->ground = chr->manground = ground = cdFindGroundY(&testpos, chr->radius, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
chr->ground = chr->manground = ground = cdFindGroundInfoAtCyl(&testpos, chr->radius, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
|
||||
chr->sumground = ground * (PAL ? 8.4175090789795f : 9.999998f);
|
||||
|
||||
@@ -2037,7 +2037,7 @@ void chrUncloak(struct chrdata *chr, bool value)
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
((u32 *)&cd0002a324)[-2] = 0;
|
||||
((u32 *)&cdReturnZero)[-2] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -5499,9 +5499,9 @@ bool chrUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
|
||||
chr->geo.header.type = GEOTYPE_CYL;
|
||||
|
||||
if (chr->actiontype == ACT_DIE || chr->actiontype == ACT_DRUGGEDDROP) {
|
||||
chr->geo.header.flags = GEOFLAG_OPAQUE;
|
||||
chr->geo.header.flags = GEOFLAG_BLOCK_SHOOT;
|
||||
} else {
|
||||
chr->geo.header.flags = GEOFLAG_COLLISIONS | GEOFLAG_OPAQUE;
|
||||
chr->geo.header.flags = GEOFLAG_WALL | GEOFLAG_BLOCK_SHOOT;
|
||||
}
|
||||
|
||||
chr->geo.ymin = chr->manground;
|
||||
|
||||
+141
-124
@@ -1583,17 +1583,17 @@ void func0f02e4f8(struct coord *arg0, struct coord *arg1, struct coord *dst)
|
||||
struct coord sp20;
|
||||
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp2c, &sp20, 2298, "chr/chraction.c");
|
||||
cdGetEdge(&sp2c, &sp20, 2298, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp2c, &sp20, 2298, "chraction.c");
|
||||
cdGetEdge(&sp2c, &sp20, 2298, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(&sp2c, &sp20, 2338, "chraction.c");
|
||||
cdGetEdge(&sp2c, &sp20, 2338, "chraction.c");
|
||||
#endif
|
||||
|
||||
func0f02e3dc(&sp2c, &sp20, arg0, arg1, dst);
|
||||
}
|
||||
|
||||
f32 func0f02e550(struct prop *prop, f32 arg1, f32 arg2, u32 arg3, f32 ymax, f32 ymin)
|
||||
f32 func0f02e550(struct prop *prop, f32 arg1, f32 arg2, u32 cdtypes, f32 ymax, f32 ymin)
|
||||
{
|
||||
struct coord sp5c;
|
||||
struct coord sp50;
|
||||
@@ -1613,7 +1613,7 @@ f32 func0f02e550(struct prop *prop, f32 arg1, f32 arg2, u32 arg3, f32 ymax, f32
|
||||
|
||||
chrSetPerimEnabled(chr, false);
|
||||
|
||||
if (cd0002d7c0(&prop->pos, prop->rooms, &sp50, arg3, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove03(&prop->pos, prop->rooms, &sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
result = arg2;
|
||||
} else {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
@@ -5121,8 +5121,8 @@ bool func0f03645c(struct chrdata *chr, struct coord *arg1, s16 *arg2, struct coo
|
||||
chrGetBbox(prop, &radius, &ymax, &ymin);
|
||||
chrSetPerimEnabled(chr, false);
|
||||
|
||||
if (cd0002d840(arg1, arg2, arg3, &sp30, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cd0002d6ac(arg3, &sp30, arg4, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cdTestCylMove04(arg1, arg2, arg3, &sp30, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cdTestCylMove01(arg3, &sp30, arg4, arg5, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -5152,8 +5152,8 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
|
||||
chrSetPerimEnabled(chr, false);
|
||||
chrGetBbox(prop, &radius, &ymax, &ymin);
|
||||
|
||||
if ((rooms2 && cdTestAToB2(pos, rooms, pos2, rooms2, types, 1, ymax - prop->pos.y, ymin - prop->pos.y))
|
||||
|| (rooms2 == NULL && cd0002d6ac(pos, rooms, pos2, types, 1, ymax - prop->pos.y, ymin - prop->pos.y))) {
|
||||
if ((rooms2 && cdTestCylMove02(pos, rooms, pos2, rooms2, types, true, ymax - prop->pos.y, ymin - prop->pos.y))
|
||||
|| (rooms2 == NULL && cdTestCylMove01(pos, rooms, pos2, types, 1, ymax - prop->pos.y, ymin - prop->pos.y))) {
|
||||
if (vector == NULL) {
|
||||
vector = &tmp;
|
||||
|
||||
@@ -5183,8 +5183,8 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
|
||||
sp50.y = pos2->y;
|
||||
sp50.z = pos2->z - a;
|
||||
|
||||
if (cd0002d840(pos, rooms, &sp5c, sp40, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)
|
||||
&& cd0002d6ac(&sp5c, sp40, &sp50, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)) {
|
||||
if (cdTestCylMove04(pos, rooms, &sp5c, sp40, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)
|
||||
&& cdTestCylMove01(&sp5c, sp40, &sp50, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)) {
|
||||
sp5c.x = pos->x - b;
|
||||
sp5c.y = pos->y;
|
||||
sp5c.z = pos->z + a;
|
||||
@@ -5193,8 +5193,8 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
|
||||
sp50.y = pos2->y;
|
||||
sp50.z = pos2->z + a;
|
||||
|
||||
if (cd0002d840(pos, rooms, &sp5c, sp40, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)
|
||||
&& cd0002d6ac(&sp5c, sp40, &sp50, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)) {
|
||||
if (cdTestCylMove04(pos, rooms, &sp5c, sp40, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)
|
||||
&& cdTestCylMove01(&sp5c, sp40, &sp50, types, 1, ymax - prop->pos.y, ymin - prop->pos.y)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -5680,7 +5680,7 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st
|
||||
roomsCopy(rooms, sp118);
|
||||
chr0f021fa8(chr, arg3, sp118);
|
||||
|
||||
ground = cdFindGroundY(arg3, chr->radius, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
|
||||
ground = cdFindGroundInfoAtCyl(arg3, chr->radius, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
|
||||
|
||||
spf4.x = arg3->x;
|
||||
spf4.y = prop->pos.y - chr->ground + ground;
|
||||
@@ -5690,7 +5690,7 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st
|
||||
chr0f021fa8(chr, &spf4, sp118);
|
||||
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
|
||||
|
||||
if (cdTestVolume(&spf4, chr->radius, sp118, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
if (cdTestVolume(&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;
|
||||
@@ -6278,7 +6278,7 @@ void chrStartPatrol(struct chrdata *chr, struct path *path)
|
||||
|
||||
chrSetPerimEnabled(chr, false);
|
||||
|
||||
if (cd0002d840(&prop->pos, prop->rooms, &pad.pos, rooms, CDTYPE_BG, 1,
|
||||
if (cdTestCylMove04(&prop->pos, prop->rooms, &pad.pos, rooms, CDTYPE_BG, 1,
|
||||
ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
|
||||
nextstep = chr->patrolnextstep;
|
||||
}
|
||||
@@ -6417,12 +6417,12 @@ bool chrCanSeeEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, b
|
||||
|
||||
func0f065dd8(chrpos, chrrooms, &frompos, fromrooms);
|
||||
|
||||
if (cdHasLineOfSight(&frompos, fromrooms, &targetpos, targetrooms, types, 0x10)) {
|
||||
if (cdTestLos05(&frompos, fromrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
chrRecordLastVisibleTargetTime(chr);
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
if (cdHasLineOfSight(chrpos, chrrooms, &targetpos, targetrooms, types, 0x10)) {
|
||||
if (cdTestLos05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
chrRecordLastVisibleTargetTime(chr);
|
||||
result = true;
|
||||
}
|
||||
@@ -6439,13 +6439,13 @@ bool chrCanSeeEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, b
|
||||
|
||||
chrSetPerimEnabled(targetchr, false);
|
||||
|
||||
if (cdHasLineOfSight(chrpos, chrrooms, &targetpos, targetrooms, types, 0x10)) {
|
||||
if (cdTestLos05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
chrSetPerimEnabled(targetchr, true);
|
||||
} else if (attackflags & ATTACKFLAG_AIMATPAD) {
|
||||
if (cdHasLineOfSight(chrpos, chrrooms, &targetpos, targetrooms, types, 0x10)) {
|
||||
if (cdTestLos05(chrpos, chrrooms, &targetpos, targetrooms, types, GEOFLAG_BLOCK_SHOOT)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -6489,7 +6489,9 @@ bool chrCanSeeChr(struct chrdata *chr, struct chrdata *target, s16 *room)
|
||||
|
||||
func0f065e74(&prop->pos, prop->rooms, &pos, rooms);
|
||||
|
||||
if (cd0002dcfc(&pos, rooms, &target->prop->pos, target->prop->rooms, sp88, 307, 8)) {
|
||||
if (cdTestLos07(&pos, rooms, &target->prop->pos, target->prop->rooms, sp88,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
cansee = true;
|
||||
}
|
||||
|
||||
@@ -6532,25 +6534,27 @@ bool chrCanSeeTarget(struct chrdata *chr)
|
||||
return cansee;
|
||||
}
|
||||
|
||||
bool chrHasLineOfSightToPos(struct chrdata *viewerchr, struct coord *pos, s16 *rooms)
|
||||
bool chrHasLineOfSightToPos(struct chrdata *chr, struct coord *pos, s16 *rooms)
|
||||
{
|
||||
struct prop *viewerprop = viewerchr->prop;
|
||||
struct prop *prop = chr->prop;
|
||||
bool result = false;
|
||||
struct coord viewerpos;
|
||||
s16 viewerrooms[8];
|
||||
struct coord eyepos;
|
||||
s16 chrrooms[8];
|
||||
|
||||
viewerpos.x = viewerprop->pos.x;
|
||||
viewerpos.y = viewerchr->ground + viewerchr->height - 20;
|
||||
viewerpos.z = viewerprop->pos.z;
|
||||
eyepos.x = prop->pos.x;
|
||||
eyepos.y = chr->ground + chr->height - 20;
|
||||
eyepos.z = prop->pos.z;
|
||||
|
||||
chrSetPerimEnabled(viewerchr, false);
|
||||
func0f065e74(&viewerprop->pos, viewerprop->rooms, &viewerpos, viewerrooms);
|
||||
chrSetPerimEnabled(chr, false);
|
||||
func0f065e74(&prop->pos, prop->rooms, &eyepos, chrrooms);
|
||||
|
||||
if (cdHasLineOfSight(&viewerpos, viewerrooms, pos, rooms, 307, 8)) {
|
||||
if (cdTestLos05(&eyepos, chrrooms, pos, rooms,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE,
|
||||
GEOFLAG_BLOCK_SIGHT)) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
chrSetPerimEnabled(viewerchr, true);
|
||||
chrSetPerimEnabled(chr, true);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -7392,8 +7396,9 @@ bool chrTryRunFromTarget(struct chrdata *chr)
|
||||
propGetBbox(prop, &radius, &ymax, &ymin);
|
||||
|
||||
// If dst runs into a wall, set it to closest valid spot
|
||||
if (!cd0002d7c0(&prop->pos, prop->rooms, &dst, 0x33, 1,
|
||||
ymax - prop->pos.y, ymin - prop->pos.y)) {
|
||||
if (cdExamCylMove03(&prop->pos, prop->rooms, &dst,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cdGetPos(&dst, 8796, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
@@ -7495,7 +7500,7 @@ bool chrGoToCoverProp(struct chrdata *chr)
|
||||
if (propheight > chrheight * 0.4f && propheight < chrheight * 0.9f) {
|
||||
propSetPerimEnabled(prop, false);
|
||||
|
||||
if (cd0002dc18(&chrprop->pos, chrprop->rooms, &prop->pos, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
if (cdTestLos04(&chrprop->pos, chrprop->rooms, &prop->pos, CDTYPE_DOORS | CDTYPE_BG)) {
|
||||
propSetPerimEnabled(prop, true);
|
||||
|
||||
dstpos.x = prop->pos.x - (targetprop->pos.x - prop->pos.x) / targetdist * (propradius * 1.25f + chrradius);
|
||||
@@ -7554,7 +7559,7 @@ bool chrTryStartAlarm(struct chrdata *chr, s32 pad_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 chrConsiderGrenadeThrow(struct chrdata *chr, u32 attackflags, u32 entityid)
|
||||
bool chrConsiderGrenadeThrow(struct chrdata *chr, u32 attackflags, u32 entityid)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
@@ -7571,9 +7576,10 @@ s32 chrConsiderGrenadeThrow(struct chrdata *chr, u32 attackflags, u32 entityid)
|
||||
pos.z = target->pos.z;
|
||||
}
|
||||
|
||||
if (target && cd0002dc18(&chr->prop->pos, chr->prop->rooms, &pos, 0x33)) {
|
||||
struct prop *leftprop = chrGetHeldProp(chr, 1);
|
||||
struct prop *rightprop = chrGetHeldProp(chr, 0);
|
||||
if (target && cdTestLos04(&chr->prop->pos, chr->prop->rooms, &pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
|
||||
struct prop *leftprop = chrGetHeldProp(chr, HAND_LEFT);
|
||||
struct prop *rightprop = chrGetHeldProp(chr, HAND_RIGHT);
|
||||
struct weaponobj *weapon;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
@@ -7689,7 +7695,8 @@ void chrPunchInflictDamage(struct chrdata *chr, s32 damage, s32 range, u8 revers
|
||||
|
||||
if (chrIsTargetInFov(chr, 20, reverse)
|
||||
&& chrGetDistanceToTarget(chr) < range
|
||||
&& cd0002dc18(&chr->prop->pos, chr->prop->rooms, &targetprop->pos, 0x33)) {
|
||||
&& cdTestLos04(&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;
|
||||
vector.z = targetprop->pos.z - chr->prop->pos.z;
|
||||
@@ -9942,9 +9949,9 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
|
||||
// How nice of the developers to check for this!
|
||||
chrSetPerimEnabled(chr, false);
|
||||
|
||||
if (cd0002de34(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms,
|
||||
if (cdTestLos10(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms,
|
||||
CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | extracdtypes,
|
||||
0x10) == CDRESULT_COLLISION) {
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
firingthisframe = false;
|
||||
}
|
||||
|
||||
@@ -10010,7 +10017,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
|
||||
g_Vars.useperimshoot = true;
|
||||
}
|
||||
|
||||
if (cdTestAToB4(&gunpos, gunrooms, &hitpos, cdtypes, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos, cdtypes, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
hitsomething = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cdGetPos(&hitpos, 12080, "chr/chraction.c");
|
||||
@@ -10021,7 +10028,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
|
||||
#else
|
||||
cdGetPos(&hitpos, 12086, "chraction.c");
|
||||
#endif
|
||||
hitprop = cdGetObstacle();
|
||||
hitprop = cdGetObstacleProp();
|
||||
}
|
||||
|
||||
chrSetPerimEnabled(chr, true);
|
||||
@@ -11809,19 +11816,19 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
|
||||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z - spc8);
|
||||
|
||||
if (cd0002da50(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd0002d7c0(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cdExamCylMove03(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spbc = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd00024e4c(&spac, &spa0, 14154, "chr/chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14154, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&spac, &spa0, 14151, "chr/chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14151, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&spac, &spa0, 14146, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14146, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&spac, &spa0, 14145, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14145, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(&spac, &spa0, 14158, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14158, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(&spac, &spa0, &spd4);
|
||||
}
|
||||
@@ -11834,19 +11841,19 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
|
||||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z + spc8);
|
||||
|
||||
if (cd0002da50(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd0002d7c0(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cdExamCylMove03(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spb8 = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd00024e4c(&sp94, &sp88, 14169, "chr/chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14169, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp94, &sp88, 14166, "chr/chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14166, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp94, &sp88, 14161, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14161, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp94, &sp88, 14160, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14160, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(&sp94, &sp88, 14173, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14173, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(&sp94, &sp88, &spd4);
|
||||
}
|
||||
@@ -11878,20 +11885,20 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
|
||||
rightpos->x = sp88.x;
|
||||
rightpos->y = sp88.y;
|
||||
rightpos->z = sp88.z;
|
||||
} else if (cd0002da50(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!arg9 || cd0002a6fc(chrpos, aimpos, chrradius, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
} else if (cdExamCylMove07(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!arg9 || cdExamCylMove01(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
|
||||
cd00024e4c(leftpos, rightpos, 14239, "chr/chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14239, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(leftpos, rightpos, 14236, "chr/chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14236, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(leftpos, rightpos, 14231, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14231, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(leftpos, rightpos, 14230, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14230, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(leftpos, rightpos, 14243, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14243, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(leftpos, rightpos, &spd4);
|
||||
}
|
||||
@@ -11968,19 +11975,19 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
|
||||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z - spc8);
|
||||
|
||||
if (cd0002da50(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd0002d7c0(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cdExamCylMove03(&sp6c, sp50, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spbc = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd00024e4c(&spac, &spa0, 14319, "chr/chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14319, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&spac, &spa0, 14316, "chr/chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14316, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&spac, &spa0, 14311, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14311, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&spac, &spa0, 14310, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14310, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(&spac, &spa0, 14323, "chraction.c");
|
||||
cdGetEdge(&spac, &spa0, 14323, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(&spac, &spa0, &spd4);
|
||||
value1 = cd00024e40();
|
||||
@@ -11994,19 +12001,19 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
|
||||
sp60.y = aimpos->y;
|
||||
sp60.z = (spd4.z * negchrradius) + (aimpos->z + spc8);
|
||||
|
||||
if (cd0002da50(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cd0002d7c0(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove07(chrpos, chrrooms, &sp6c, sp50, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION
|
||||
|| cdExamCylMove03(&sp6c, chrrooms, &sp60, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) == CDRESULT_COLLISION) {
|
||||
spb8 = true;
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cd00024e4c(&sp94, &sp88, 14334, "chr/chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14334, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp94, &sp88, 14331, "chr/chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14331, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp94, &sp88, 14326, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14326, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp94, &sp88, 14325, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14325, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(&sp94, &sp88, 14338, "chraction.c");
|
||||
cdGetEdge(&sp94, &sp88, 14338, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(&sp94, &sp88, &spd4);
|
||||
value2 = cd00024e40();
|
||||
@@ -12046,20 +12053,20 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
|
||||
rightpos->x = sp88.x;
|
||||
rightpos->y = sp88.y;
|
||||
rightpos->z = sp88.z;
|
||||
} else if (cd0002da50(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!hasobstacle || cd0002a6fc(chrpos, aimpos, chrradius, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION)) {
|
||||
} else if (cdExamCylMove07(chrpos, chrrooms, aimpos, sp40, cdtypes, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION
|
||||
&& (!hasobstacle || cdExamCylMove01(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
|
||||
cd00024e4c(leftpos, rightpos, 14404, "chr/chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14404, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(leftpos, rightpos, 14401, "chr/chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14401, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(leftpos, rightpos, 14396, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14396, "chraction.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(leftpos, rightpos, 14395, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14395, "chraction.c");
|
||||
#else
|
||||
cd00024e4c(leftpos, rightpos, 14408, "chraction.c");
|
||||
cdGetEdge(leftpos, rightpos, 14408, "chraction.c");
|
||||
#endif
|
||||
func0f044b68(leftpos, rightpos, &spd4);
|
||||
}
|
||||
@@ -12170,12 +12177,14 @@ const char var7f1a8cb4[] = "chrdisttopad : %x -> %d : Dist=%f";
|
||||
*
|
||||
* The chr must be within 200cm of the door unless it's a laser.
|
||||
*/
|
||||
struct prop *chrOpenDoor(struct chrdata *chr, struct coord *coord)
|
||||
struct prop *chrOpenDoor(struct chrdata *chr, struct coord *rangepos)
|
||||
{
|
||||
struct prop *doorprop = NULL;
|
||||
|
||||
if (cd0002d7c0(&chr->prop->pos, chr->prop->rooms, coord, 0x5020, 1, 0, 0) == CDRESULT_COLLISION) {
|
||||
doorprop = cdGetObstacle();
|
||||
if (cdExamCylMove03(&chr->prop->pos, chr->prop->rooms, rangepos,
|
||||
CDTYPE_BG | CDTYPE_CLOSEDDOORS | CDTYPE_AJARDOORS,
|
||||
1, 0, 0) == CDRESULT_COLLISION) {
|
||||
doorprop = cdGetObstacleProp();
|
||||
}
|
||||
|
||||
if (doorprop) {
|
||||
@@ -12645,7 +12654,7 @@ bool chrGoPosUpdateLiftAction(struct chrdata *chr, u32 curpadflags, bool arg2, b
|
||||
|
||||
rooms[0] = nextpad.room;
|
||||
|
||||
nextground = cd0002a36c(&nextpad.pos, rooms, NULL, NULL);
|
||||
nextground = cdFindFloorYColourTypeAtPos(&nextpad.pos, rooms, NULL, NULL);
|
||||
|
||||
// Begin exiting lift if lift is 30cm under destination or higher
|
||||
advance = (lifty >= nextground - 30);
|
||||
@@ -13109,8 +13118,9 @@ bool chrStartSkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4)
|
||||
chrGetBbox(prop, &radius, &ymax, &ymin);
|
||||
chrSetPerimEnabled(chr, false);
|
||||
propSetPerimEnabled(target, false);
|
||||
iVar2 = cd0002d6ac(&prop->pos, prop->rooms, &target->pos, 51, 1,
|
||||
ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
iVar2 = cdTestCylMove01(&prop->pos, prop->rooms, &target->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
1, ymax - prop->pos.y, ymin - prop->pos.y);
|
||||
chrSetPerimEnabled(chr, true);
|
||||
propSetPerimEnabled(target, true);
|
||||
|
||||
@@ -13130,7 +13140,7 @@ bool chrStartSkJump(struct chrdata *chr, u8 arg1, 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 = cdFindGroundYSimple(&chr->prop->pos, chr->radius, chr->prop->rooms, NULL, NULL);
|
||||
chr->act_skjump.ground = cdFindGroundAtCyl(&chr->prop->pos, chr->radius, chr->prop->rooms, NULL, NULL);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -14429,7 +14439,9 @@ bool chrCanSeeTargetWithExtraCheck(struct chrdata *chr)
|
||||
|
||||
if (target->type == PROPTYPE_PLAYER) {
|
||||
if (g_Vars.bondvisible &&
|
||||
(cdHasLineOfSight(&target->pos, target->rooms, &chr->prop->pos, chr->prop->rooms, 51, 8))) {
|
||||
(cdTestLos05(&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 sp68;
|
||||
struct coord sp56;
|
||||
@@ -14854,9 +14866,10 @@ void chrSetPadPresetByChrnum(struct chrdata *basechr, s32 chrnum, s32 pad_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if chr has line of sight (I think?) to their target. If so, find a
|
||||
* route to them, then iterate the route backwards (from target to chr). Find
|
||||
* the first waypoint with line of sight and store it as the chr's pad preset.
|
||||
* Check if chr has line of sight to their target. If not, find a route
|
||||
* to them then iterate the route backwards (from target to chr).
|
||||
* Find the first waypoint in view of both the chr and their target
|
||||
* and store it as the chr's pad preset.
|
||||
*/
|
||||
bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr)
|
||||
{
|
||||
@@ -14870,7 +14883,7 @@ bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr)
|
||||
struct pad pad;
|
||||
|
||||
if (target->type != PROPTYPE_PLAYER || g_Vars.bondvisible) {
|
||||
if (cd0002dc18(&prop->pos, prop->rooms, &target->pos, CDTYPE_BG)) {
|
||||
if (cdTestLos04(&prop->pos, prop->rooms, &target->pos, CDTYPE_BG)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14891,8 +14904,8 @@ bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr)
|
||||
|
||||
padUnpack(wp->padnum, PADFIELD_POS, &pad);
|
||||
|
||||
if (cd0002dc18(&target->pos, target->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cd0002dc18(&prop->pos, prop->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cdTestLos04(&target->pos, target->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
if (cdTestLos04(&prop->pos, prop->rooms, &pad.pos, CDTYPE_BG)) {
|
||||
chr->padpreset1 = wp->padnum;
|
||||
return true;
|
||||
}
|
||||
@@ -14970,13 +14983,13 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl
|
||||
// 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 = cdFindGroundYSimple(pos, chrradius, rooms, NULL, NULL);
|
||||
ground = cdFindGroundAtCyl(pos, chrradius, rooms, NULL, NULL);
|
||||
|
||||
if (ground > -100000 && ground - pos->y < -200) {
|
||||
ymin = ground - pos->y;
|
||||
}
|
||||
|
||||
if (cdTestVolume(pos, chrradius, rooms, types, 1, ymax, ymin) != CDRESULT_COLLISION
|
||||
if (cdTestVolume(pos, chrradius, rooms, types, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chrIsPosOffScreen(pos, rooms))) {
|
||||
return true;
|
||||
}
|
||||
@@ -14988,17 +15001,17 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl
|
||||
testpos.y = pos->y;
|
||||
testpos.z = pos->z + cosf(curangle) * 60;
|
||||
|
||||
if ((arg6 && cd0002d840(pos, rooms, &testpos, testrooms, CDTYPE_ALL & ~CDTYPE_PLAYERS, 1, ymax, -200) != CDRESULT_COLLISION)
|
||||
|| (!arg6 && cd0002deac(pos, rooms, &testpos, testrooms, CDTYPE_BG))) {
|
||||
if ((arg6 && cdTestCylMove04(pos, rooms, &testpos, testrooms, CDTYPE_ALL & ~CDTYPE_PLAYERS, 1, ymax, -200) != CDRESULT_COLLISION)
|
||||
|| (!arg6 && cdTestLos11(pos, rooms, &testpos, testrooms, CDTYPE_BG))) {
|
||||
chr0f021fa8(NULL, &testpos, testrooms);
|
||||
ground = cdFindGroundYSimple(&testpos, chrradius, testrooms, 0, 0);
|
||||
ground = cdFindGroundAtCyl(&testpos, chrradius, testrooms, 0, 0);
|
||||
ymin = -200;
|
||||
|
||||
if (ground > -100000 && ground - pos->y < -200) {
|
||||
ymin = ground - pos->y;
|
||||
}
|
||||
|
||||
if (cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, 1, ymax, ymin) != CDRESULT_COLLISION
|
||||
if (cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax, ymin) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chrIsPosOffScreen(&testpos, testrooms))
|
||||
&& (!arg6 || ground > -100000)) {
|
||||
pos->x = testpos.x;
|
||||
@@ -15038,7 +15051,7 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl
|
||||
types = CDTYPE_ALL;
|
||||
}
|
||||
|
||||
if (cdTestVolume(pos, chrradius, rooms, types, 1, 200, -200) != CDRESULT_COLLISION
|
||||
if (cdTestVolume(pos, chrradius, rooms, types, CHECKVERTICAL_YES, 200, -200) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chrIsPosOffScreen(pos, rooms))) {
|
||||
return true;
|
||||
}
|
||||
@@ -15048,8 +15061,8 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl
|
||||
testpos.y = pos->y;
|
||||
testpos.z = cosf(curangle) * 60 + pos->z;
|
||||
|
||||
if (cd0002deac(pos, rooms, &testpos, testrooms, CDTYPE_BG)
|
||||
&& cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, 1, 200, -200.0f) != CDRESULT_COLLISION
|
||||
if (cdTestLos11(pos, rooms, &testpos, testrooms, CDTYPE_BG)
|
||||
&& cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200.0f) != CDRESULT_COLLISION
|
||||
&& (allowonscreen || chrIsPosOffScreen(&testpos, testrooms))) {
|
||||
pos->x = testpos.x;
|
||||
pos->y = testpos.y;
|
||||
@@ -15214,7 +15227,7 @@ struct prop *chrSpawnAtChr(struct chrdata *basechr, s32 body, s32 head, u32 chrn
|
||||
return chrSpawnAtCoord(body, head, &chr->prop->pos, chr->prop->rooms, fvalue, ailist, spawnflags);
|
||||
}
|
||||
|
||||
bool func0f04b658(struct chrdata *chr)
|
||||
bool chrIsPropPresetBlockingSightToTarget(struct chrdata *chr)
|
||||
{
|
||||
bool result = false;
|
||||
struct prop *prop = chr->prop;
|
||||
@@ -15224,11 +15237,12 @@ bool func0f04b658(struct chrdata *chr)
|
||||
chrSetPerimEnabled(chr, false);
|
||||
propSetPerimEnabled(target, false);
|
||||
|
||||
if (!cd0002dc18(&prop->pos, prop->rooms, &target->pos, 0x33)) {
|
||||
struct prop *thing = cdGetObstacle();
|
||||
if (!cdTestLos04(&prop->pos, prop->rooms, &target->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
|
||||
struct prop *obstacle = cdGetObstacleProp();
|
||||
|
||||
if (thing && thing->type == PROPTYPE_OBJ
|
||||
&& chr->proppreset1 == (s16)(thing - g_Vars.props)) {
|
||||
if (obstacle && obstacle->type == PROPTYPE_OBJ
|
||||
&& chr->proppreset1 == (s16)(obstacle - g_Vars.props)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -15268,7 +15282,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle,
|
||||
if (chrAdjustPosForSpawn(chr->radius, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen))
|
||||
#endif
|
||||
{
|
||||
ground = cdFindGroundY(&pos2, chr->radius, rooms2, &chr->floorcol,
|
||||
ground = cdFindGroundInfoAtCyl(&pos2, chr->radius, rooms2, &chr->floorcol,
|
||||
&chr->floortype, NULL, &chr->floorroom, NULL, NULL);
|
||||
|
||||
chr->ground = ground;
|
||||
@@ -15328,9 +15342,12 @@ bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft)
|
||||
}
|
||||
|
||||
if (soft) {
|
||||
targetcanseecover = cd0002db98(&target->pos, target->rooms, cover.pos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_BG, 8);
|
||||
targetcanseecover = cdTestLos03(&target->pos, target->rooms, cover.pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SIGHT);
|
||||
} else {
|
||||
targetcanseecover = cd0002f450(&target->pos, target->rooms, cover.pos, 50, 35);
|
||||
targetcanseecover = cdIsNearlyInSight(&target->pos, target->rooms, cover.pos, 50.0f,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_BG);
|
||||
}
|
||||
|
||||
if (!targetcanseecover != false) {
|
||||
@@ -15604,7 +15621,7 @@ s16 chrGoToCover(struct chrdata *chr, u8 speed)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool chrRunFromPos(struct chrdata *chr, u32 speed, f32 rundist, struct coord *frompos)
|
||||
bool chrRunFromPos(struct chrdata *chr, u32 goposflags, f32 rundist, struct coord *frompos)
|
||||
{
|
||||
f32 curdistfrompos;
|
||||
struct coord delta;
|
||||
@@ -15628,7 +15645,7 @@ bool chrRunFromPos(struct chrdata *chr, u32 speed, f32 rundist, struct coord *fr
|
||||
|
||||
chrSetPerimEnabled(chr, false);
|
||||
|
||||
if (cdTestAToB4(&chr->prop->pos, chr->prop->rooms, &delta, CDTYPE_ALL, 4) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&chr->prop->pos, chr->prop->rooms, &delta, CDTYPE_ALL, GEOFLAG_WALL) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
cdGetPos(&delta, 18592, "chr/chraction.c");
|
||||
#elif VERSION >= VERSION_PAL_FINAL
|
||||
@@ -15646,7 +15663,7 @@ bool chrRunFromPos(struct chrdata *chr, u32 speed, f32 rundist, struct coord *fr
|
||||
|
||||
func0f065e74(&chr->prop->pos, chr->prop->rooms, &delta, rooms);
|
||||
|
||||
return chrGoToRoomPos(chr, &delta, rooms, speed);
|
||||
return chrGoToRoomPos(chr, &delta, rooms, goposflags);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -15693,14 +15710,14 @@ bool chrIsTargetNearlyInSight(struct chrdata *chr, u32 distance)
|
||||
{
|
||||
struct prop *target = chrGetTargetProp(chr);
|
||||
|
||||
return cd0002f450(&chr->prop->pos, chr->prop->rooms, &target->pos, distance, 32);
|
||||
return cdIsNearlyInSight(&chr->prop->pos, chr->prop->rooms, &target->pos, distance, CDTYPE_BG);
|
||||
}
|
||||
|
||||
bool chrIsNearlyInTargetsSight(struct chrdata *chr, u32 distance)
|
||||
{
|
||||
struct prop *target = chrGetTargetProp(chr);
|
||||
|
||||
return cd0002f450(&target->pos, target->rooms, &chr->prop->pos, distance, 32);
|
||||
return cdIsNearlyInSight(&target->pos, target->rooms, &chr->prop->pos, distance, CDTYPE_BG);
|
||||
}
|
||||
|
||||
f32 func0f04c784(struct chrdata *chr)
|
||||
@@ -15772,7 +15789,7 @@ bool chr0f04c874(struct chrdata *chr, u32 angle360, struct coord *pos, u8 arg3,
|
||||
|
||||
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
|
||||
|
||||
result = cd0002d7c0(&chrpos, chr->prop->rooms, pos,
|
||||
result = cdExamCylMove03(&chrpos, chr->prop->rooms, pos,
|
||||
CDTYPE_BG | CDTYPE_OBJS | CDTYPE_DOORS, 1,
|
||||
ymax - chrpos.f[1],
|
||||
ymin - chrpos.f[1]);
|
||||
@@ -16166,7 +16183,7 @@ void chrAvoid(struct chrdata *chr)
|
||||
zdiff = dstpos.z - chr->prop->pos.z;
|
||||
|
||||
if (xdiff > halfchrradius || zdiff > halfchrradius || xdiff < -halfchrradius || zdiff < -halfchrradius) {
|
||||
cdresult = cd0002d8b8(&chr->prop->pos, chr->prop->rooms, &dstpos, dstrooms, CDTYPE_ALL, true, ymax - chr->prop->pos.y, ymin - chr->prop->pos.y);
|
||||
cdresult = cdExamCylMove05(&chr->prop->pos, chr->prop->rooms, &dstpos, dstrooms, CDTYPE_ALL, true, ymax - chr->prop->pos.y, ymin - chr->prop->pos.y);
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ bool (*g_CommandPointers[])(void) = {
|
||||
/*0x0100*/ aiNoOp0100,
|
||||
/*0x0101*/ aiNoOp0101,
|
||||
/*0x0102*/ aiSetLights,
|
||||
/*0x0103*/ ai0103,
|
||||
/*0x0103*/ aiIfPropPresetIsBlockingSightToTarget,
|
||||
/*0x0104*/ aiRemoveObjectAtPropPreset,
|
||||
/*0x0105*/ aiIfPropPresetHeightLessThan,
|
||||
/*0x0106*/ aiSetTarget,
|
||||
|
||||
@@ -5844,9 +5844,9 @@ bool aiSetLights(void)
|
||||
/**
|
||||
* @cmd 0103
|
||||
*/
|
||||
bool ai0103(void)
|
||||
bool aiIfPropPresetIsBlockingSightToTarget(void)
|
||||
{
|
||||
if (func0f04b658(g_Vars.chrdata)) {
|
||||
if (chrIsPropPresetBlockingSightToTarget(g_Vars.chrdata)) {
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
|
||||
} else {
|
||||
|
||||
@@ -91,7 +91,7 @@ bool explosionCreateComplex(struct prop *prop, struct coord *pos, s16 *rooms, s1
|
||||
struct coord sp88;
|
||||
struct explosiontype *etype;
|
||||
bool makescorch = true;
|
||||
s16 ret;
|
||||
s16 room;
|
||||
f32 y;
|
||||
bool sp68;
|
||||
|
||||
@@ -100,12 +100,12 @@ bool explosionCreateComplex(struct prop *prop, struct coord *pos, s16 *rooms, s1
|
||||
}
|
||||
|
||||
if (prop) {
|
||||
ret = cd0002a564(&prop->pos, prop->rooms, &y, 0, &sp88, &sp68);
|
||||
room = cdFindFloorRoomYColourNormalPropAtPos(&prop->pos, prop->rooms, &y, 0, &sp88, &sp68);
|
||||
sp100.x = prop->pos.x;
|
||||
sp100.y = y;
|
||||
sp100.z = prop->pos.z;
|
||||
} else {
|
||||
ret = cd0002a564(pos, rooms, &y, 0, &sp88, &sp68);
|
||||
room = cdFindFloorRoomYColourNormalPropAtPos(pos, rooms, &y, 0, &sp88, &sp68);
|
||||
sp100.x = pos->x;
|
||||
sp100.y = y;
|
||||
sp100.z = pos->z;
|
||||
@@ -113,12 +113,12 @@ bool explosionCreateComplex(struct prop *prop, struct coord *pos, s16 *rooms, s1
|
||||
|
||||
etype = &g_ExplosionTypes[type];
|
||||
|
||||
if (sp68 || ret <= 0
|
||||
if (sp68 || room <= 0
|
||||
|| !(pos->y - y <= (etype->rangev + etype->changeratev * etype->duration + etype->innersize) * 0.5f || pos->y - y <= 75)) {
|
||||
makescorch = false;
|
||||
}
|
||||
|
||||
return explosionCreate(prop, pos, rooms, type, playernum, makescorch, &sp100, ret, &sp88);
|
||||
return explosionCreate(prop, pos, rooms, type, playernum, makescorch, &sp100, room, &sp88);
|
||||
}
|
||||
|
||||
f32 explosionGetHorizontalRangeAtFrame(struct explosion *exp, s32 frame)
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "game/weather.h"
|
||||
#include "lib/anim.h"
|
||||
#include "lib/args.h"
|
||||
#include "lib/collision.h"
|
||||
#include "lib/joy.h"
|
||||
#include "lib/lib_06440.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
||||
@@ -201,7 +201,7 @@ void kohInitProps(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 = cd0002a36c(&g_ScenarioData.koh.hillpos, &g_ScenarioData.koh.hillrooms[0], 0, 0);
|
||||
g_ScenarioData.koh.hillpos.y = cdFindFloorYColourTypeAtPos(&g_ScenarioData.koh.hillpos, &g_ScenarioData.koh.hillrooms[0], 0, 0);
|
||||
g_ScenarioData.koh.movehill = false;
|
||||
roomSetLighting(g_ScenarioData.koh.hillrooms[0], LIGHTOP_5, 0, 0, 0);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void kohTick(void)
|
||||
g_ScenarioData.koh.hillpos.y = pad.pos.y;
|
||||
g_ScenarioData.koh.hillpos.z = pad.pos.z;
|
||||
|
||||
g_ScenarioData.koh.hillpos.y = cd0002a36c(&g_ScenarioData.koh.hillpos, g_ScenarioData.koh.hillrooms, NULL, NULL);
|
||||
g_ScenarioData.koh.hillpos.y = cdFindFloorYColourTypeAtPos(&g_ScenarioData.koh.hillpos, g_ScenarioData.koh.hillrooms, NULL, NULL);
|
||||
|
||||
roomSetLighting(g_ScenarioData.koh.hillrooms[0], 5, 0, 0, 0);
|
||||
|
||||
|
||||
@@ -121,14 +121,14 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms)
|
||||
padrooms[0] = pad.room;
|
||||
padrooms[1] = -1;
|
||||
|
||||
if (cdHasLineOfSight(pos, rooms, &pad.pos, padrooms, CDTYPE_BG, 3) != CDRESULT_COLLISION) {
|
||||
s32 cdresult = cd0002d8b8(pos, rooms, &pad.pos, padrooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, true, 0.0f, 0.0f);
|
||||
if (cdTestLos05(pos, rooms, &pad.pos, padrooms, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2) != CDRESULT_COLLISION) {
|
||||
s32 cdresult = cdExamCylMove05(pos, rooms, &pad.pos, padrooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, true, 0.0f, 0.0f);
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
checkmore[i] = false;
|
||||
} else if (cdresult == CDRESULT_COLLISION) {
|
||||
checkmore[i] = true;
|
||||
cd00024e4c(&sp250[i], &sp1d8[i], 441, "padhalllv.c");
|
||||
cdGetEdge(&sp250[i], &sp1d8[i], 441, "padhalllv.c");
|
||||
} else {
|
||||
closest = candwaypoints[i];
|
||||
break;
|
||||
@@ -171,7 +171,7 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms)
|
||||
tmppos.y = pos->y;
|
||||
tmppos.z = sp250[i].f[2] + sp98.f[2];
|
||||
|
||||
if (cd0002d840(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdTestCylMove04(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
closest = candwaypoints[i];
|
||||
break;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms)
|
||||
tmppos.y = pos->y;
|
||||
tmppos.z = sp1d8[i].z - sp98.z;
|
||||
|
||||
if (cd0002d840(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdTestCylMove04(pos, rooms, &tmppos, tmprooms, CDTYPE_BG | CDTYPE_PATHBLOCKER, 1, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
closest = candwaypoints[i];
|
||||
break;
|
||||
}
|
||||
|
||||
+5
-5
@@ -515,7 +515,7 @@ void playerStartNewLife(void)
|
||||
|
||||
angle = M_BADTAU - scenarioChooseSpawnLocation(30, &pos, rooms, g_Vars.currentplayer->prop); // var7f1ad534
|
||||
|
||||
groundy = cdFindGroundY(&pos, 30, rooms,
|
||||
groundy = cdFindGroundInfoAtCyl(&pos, 30, rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
&g_Vars.currentplayer->floortype,
|
||||
&g_Vars.currentplayer->floorflags,
|
||||
@@ -689,7 +689,7 @@ void playerLoadDefaults(void)
|
||||
|
||||
g_Vars.currentplayer->bondperimenabled = true;
|
||||
g_Vars.currentplayer->periminfo.header.type = GEOTYPE_CYL;
|
||||
g_Vars.currentplayer->periminfo.header.flags = GEOFLAG_COLLISIONS | GEOFLAG_OPAQUE;
|
||||
g_Vars.currentplayer->periminfo.header.flags = GEOFLAG_WALL | GEOFLAG_BLOCK_SHOOT;
|
||||
g_Vars.currentplayer->periminfo.ymax = 0;
|
||||
g_Vars.currentplayer->periminfo.ymin = 0;
|
||||
g_Vars.currentplayer->periminfo.x = 0;
|
||||
@@ -5326,7 +5326,7 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str
|
||||
bgFindRoomsByPos(pos, inrooms, aboverooms, 20, &bestroom);
|
||||
|
||||
if (inrooms[0] != -1) {
|
||||
tmp = room = cdFindRoom(pos, inrooms);
|
||||
tmp = room = cdFindFloorRoomAtPos(pos, inrooms);
|
||||
|
||||
if (room > 0) {
|
||||
playerSetCamPropertiesWithRoom(pos, up, look, tmp);
|
||||
@@ -5334,7 +5334,7 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str
|
||||
playerSetCamPropertiesWithRoom(pos, up, look, inrooms[0]);
|
||||
}
|
||||
} else if (aboverooms[0] != -1) {
|
||||
tmp = room = cdFindRoom(pos, aboverooms);
|
||||
tmp = room = cdFindFloorRoomAtPos(pos, aboverooms);
|
||||
|
||||
if (room > 0) {
|
||||
playerSetCamPropertiesWithoutRoom(pos, up, look, tmp);
|
||||
@@ -5467,7 +5467,7 @@ bool playerUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
|
||||
void playerUpdatePerimInfo(void)
|
||||
{
|
||||
g_Vars.currentplayer->periminfo.header.type = GEOTYPE_CYL;
|
||||
g_Vars.currentplayer->periminfo.header.flags = GEOFLAG_COLLISIONS | GEOFLAG_OPAQUE;
|
||||
g_Vars.currentplayer->periminfo.header.flags = GEOFLAG_WALL | GEOFLAG_BLOCK_SHOOT;
|
||||
|
||||
g_Vars.currentplayer->periminfo.ymin = g_Vars.currentplayer->vv_manground;
|
||||
g_Vars.currentplayer->periminfo.ymax = g_Vars.currentplayer->vv_manground + g_Vars.currentplayer->vv_headheight;
|
||||
|
||||
@@ -238,7 +238,7 @@ void playermgrAllocatePlayer(s32 index)
|
||||
|
||||
g_Vars.players[index]->bondperimenabled = true;
|
||||
g_Vars.players[index]->periminfo.header.type = GEOTYPE_CYL;
|
||||
g_Vars.players[index]->periminfo.header.flags = GEOFLAG_COLLISIONS | GEOFLAG_OPAQUE;
|
||||
g_Vars.players[index]->periminfo.header.flags = GEOFLAG_WALL | GEOFLAG_BLOCK_SHOOT;
|
||||
g_Vars.players[index]->periminfo.ymax = 0;
|
||||
g_Vars.players[index]->periminfo.ymin = 0;
|
||||
g_Vars.players[index]->periminfo.x = 0;
|
||||
|
||||
@@ -409,7 +409,7 @@ void playerReset(void)
|
||||
}
|
||||
}
|
||||
|
||||
groundy = cdFindGroundY(&pos, 30, rooms,
|
||||
groundy = cdFindGroundInfoAtCyl(&pos, 30, rooms,
|
||||
&g_Vars.currentplayer->floorcol,
|
||||
&g_Vars.currentplayer->floortype,
|
||||
&g_Vars.currentplayer->floorflags,
|
||||
|
||||
+16
-12
@@ -1104,7 +1104,7 @@ void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hi
|
||||
|
||||
void handInflictCloseRangeDamage(s32 handnum, struct gset *gset, bool arg2)
|
||||
{
|
||||
s32 someval;
|
||||
s32 cdtypes;
|
||||
struct prop **ptr;
|
||||
struct prop *playerprop;
|
||||
bool skipthething;
|
||||
@@ -1190,13 +1190,13 @@ void handInflictCloseRangeDamage(s32 handnum, struct gset *gset, bool arg2)
|
||||
if (func0f0679ac(model, &distance, &sp110, spfc, spf4)
|
||||
&& sp110 <= 0
|
||||
&& distance >= -rangelimit) {
|
||||
someval = 0x33;
|
||||
cdtypes = CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG;
|
||||
|
||||
if (isglass) {
|
||||
someval = 0;
|
||||
cdtypes = 0;
|
||||
}
|
||||
|
||||
if (cd0002dc18(&playerprop->pos, playerprop->rooms, &prop->pos, someval)) {
|
||||
if (cdTestLos04(&playerprop->pos, playerprop->rooms, &prop->pos, cdtypes)) {
|
||||
if (isglass) {
|
||||
struct model *model = obj->model;
|
||||
struct coord spd8;
|
||||
@@ -2351,7 +2351,7 @@ void propsTestForPickup(void)
|
||||
}
|
||||
}
|
||||
|
||||
f32 func0f06438c(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *arg3, f32 *arg4, s32 arg5, bool cangangsta, s32 arg7)
|
||||
f32 func0f06438c(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *arg3, f32 *arg4, bool throughobjects, bool cangangsta, s32 arg7)
|
||||
{
|
||||
f32 spa0[2];
|
||||
struct coord sp94;
|
||||
@@ -2371,7 +2371,7 @@ f32 func0f06438c(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *arg3, f3
|
||||
bool sp4c;
|
||||
f32 sp48;
|
||||
struct prop *playerprop;
|
||||
s32 lVar3;
|
||||
s32 ok;
|
||||
|
||||
if (func && bgun0f0a27c8()) {
|
||||
sp50 = true;
|
||||
@@ -2439,13 +2439,17 @@ f32 func0f06438c(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *arg3, f3
|
||||
|
||||
playerSetPerimEnabled(playerprop, false);
|
||||
|
||||
if (arg5) {
|
||||
lVar3 = cd0002db98(&playerprop->pos, playerprop->rooms, &prop->pos, 0x32, 16);
|
||||
if (throughobjects) {
|
||||
ok = cdTestLos03(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT);
|
||||
} else {
|
||||
lVar3 = cd0002db98(&playerprop->pos, playerprop->rooms, &prop->pos, 0x33, 16);
|
||||
ok = cdTestLos03(&playerprop->pos, playerprop->rooms, &prop->pos,
|
||||
CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT);
|
||||
}
|
||||
|
||||
if (lVar3) {
|
||||
if (ok) {
|
||||
f32 value = spa0[1];
|
||||
|
||||
if (value < top) {
|
||||
@@ -2682,7 +2686,7 @@ void autoaimTick(void)
|
||||
|| (chr->chrflags & CHRCFLAG_FORCEAUTOAIM)
|
||||
|| chr->gunprop)
|
||||
&& chrCalculateAutoAim(prop, &sp94, sp8c, sp84)) {
|
||||
f32 thing = func0f06438c(prop, &sp94, sp8c, sp84, sp78, 0, cangangsta, 0);
|
||||
f32 thing = func0f06438c(prop, &sp94, sp8c, sp84, sp78, false, cangangsta, 0);
|
||||
|
||||
if (thing > bestthing) {
|
||||
bestthing = thing;
|
||||
@@ -3110,7 +3114,7 @@ void func0f065e98(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *dstroo
|
||||
}
|
||||
|
||||
if (ptr) {
|
||||
s32 room = cdFindRoom(pos2, ptr);
|
||||
s32 room = cdFindFloorRoomAtPos(pos2, ptr);
|
||||
|
||||
if (room > 0) {
|
||||
dstrooms[0] = room;
|
||||
|
||||
+126
-105
@@ -994,7 +994,7 @@ struct defaultobj *objFindByPos(struct coord *pos, s16 *rooms)
|
||||
if (prop->type == PROPTYPE_OBJ
|
||||
&& arrayIntersects(prop->rooms, rooms)
|
||||
&& propUpdateGeometry(prop, &sp38, &sp34)
|
||||
&& func000266a4(pos->x, pos->z, (struct geo *)sp38)) {
|
||||
&& cd000266a4(pos->x, pos->z, (struct geo *)sp38)) {
|
||||
return prop->obj;
|
||||
}
|
||||
|
||||
@@ -1764,7 +1764,7 @@ void func0f069850(struct defaultobj *obj, struct coord *pos, f32 rot[3][3], stru
|
||||
|
||||
if (obj->flags3 & OBJFLAG3_GEOCYL) {
|
||||
cyl->header.type = GEOTYPE_CYL;
|
||||
cyl->header.flags = GEOFLAG_COLLISIONS | GEOFLAG_0008 | GEOFLAG_OPAQUE;
|
||||
cyl->header.flags = GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT;
|
||||
|
||||
if (obj->type == OBJTYPE_HOVERBIKE) {
|
||||
hoverbike = (struct hoverbikeobj *)obj;
|
||||
@@ -1818,7 +1818,7 @@ void func0f069b4c(struct defaultobj *obj)
|
||||
rodata = modelGetPartRodata(obj->model->filedata, MODELPART_0065);
|
||||
|
||||
if (rodata != NULL) {
|
||||
u32 flags = GEOFLAG_0001 | GEOFLAG_0002;
|
||||
u32 flags = GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2;
|
||||
|
||||
if (obj->type == OBJTYPE_ESCASTEP) {
|
||||
flags |= GEOFLAG_LIFTFLOOR;
|
||||
@@ -1832,7 +1832,7 @@ void func0f069b4c(struct defaultobj *obj)
|
||||
rodata = modelGetPartRodata(obj->model->filedata, MODELPART_0066);
|
||||
|
||||
if (rodata != NULL) {
|
||||
func0f070ca0(obj, (struct geotilef *)ptr, GEOFLAG_COLLISIONS | GEOFLAG_0008 | GEOFLAG_OPAQUE, NULL, &rodata->type19);
|
||||
func0f070ca0(obj, (struct geotilef *)ptr, GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT, NULL, &rodata->type19);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2177,9 +2177,9 @@ void func0f06a650(struct defaultobj *obj, struct coord *pos, Mtxf *arg2, s16 *ro
|
||||
bbox = modelFindBboxRodata(obj->model);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
room = cd0002a440(pos, rooms, &sp3c, &obj->floorcol, NULL);
|
||||
room = cdFindFloorRoomYColourFlagsAtPos(pos, rooms, &sp3c, &obj->floorcol, NULL);
|
||||
#else
|
||||
room = cd0002a440(pos, rooms, &sp3c, &obj->floorcol);
|
||||
room = cdFindFloorRoomYColourFlagsAtPos(pos, rooms, &sp3c, &obj->floorcol);
|
||||
#endif
|
||||
|
||||
if (room > 0) {
|
||||
@@ -2289,9 +2289,9 @@ void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *mtx, s16 *ro
|
||||
func0f065e74(arg1, rooms, &pos2, rooms2);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (cd0002a440(&pos2, rooms2, &y, &obj->floorcol, NULL) > 0)
|
||||
if (cdFindFloorRoomYColourFlagsAtPos(&pos2, rooms2, &y, &obj->floorcol, NULL) > 0)
|
||||
#else
|
||||
if (cd0002a440(&pos2, rooms2, &y, &obj->floorcol) > 0)
|
||||
if (cdFindFloorRoomYColourFlagsAtPos(&pos2, rooms2, &y, &obj->floorcol) > 0)
|
||||
#endif
|
||||
{
|
||||
bool updated;
|
||||
@@ -2557,7 +2557,7 @@ void objFreePermanently(struct defaultobj *obj, bool freeprop)
|
||||
objFree(obj, freeprop, false);
|
||||
}
|
||||
|
||||
f32 objGetWidth(struct defaultobj *obj)
|
||||
f32 objGetRadius(struct defaultobj *obj)
|
||||
{
|
||||
if (obj->type == OBJTYPE_KEY) {
|
||||
return 20;
|
||||
@@ -2598,16 +2598,16 @@ bool func0f06b488(struct prop *prop, struct coord *arg1, struct coord *arg2, str
|
||||
|
||||
if (!cd0002ded8(arg1, arg2, prop)) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp3c, &sp30, 2910, "prop/propobj.c");
|
||||
cdGetEdge(&sp3c, &sp30, 2910, "prop/propobj.c");
|
||||
cdGetPos(&sp20, 2911, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp3c, &sp30, 2910, "propobj.c");
|
||||
cdGetEdge(&sp3c, &sp30, 2910, "propobj.c");
|
||||
cdGetPos(&sp20, 2911, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp3c, &sp30, 2909, "propobj.c");
|
||||
cdGetEdge(&sp3c, &sp30, 2909, "propobj.c");
|
||||
cdGetPos(&sp20, 2910, "propobj.c");
|
||||
#else
|
||||
cd00024e4c(&sp3c, &sp30, 2898, "propobj.c");
|
||||
cdGetEdge(&sp3c, &sp30, 2898, "propobj.c");
|
||||
cdGetPos(&sp20, 2899, "propobj.c");
|
||||
#endif
|
||||
|
||||
@@ -3287,7 +3287,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
|
||||
spa0[0] = spcc[i];
|
||||
spa0[1] = -1;
|
||||
|
||||
if (cd0002de10(&prop->pos, spa0, &sp1c4, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos09(&prop->pos, spa0, &sp1c4, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
s0 = true;
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cdGetPos(&hitthing.unk00, 4258, "prop/propobj.c");
|
||||
@@ -3298,7 +3298,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
|
||||
#else
|
||||
cdGetPos(&hitthing.unk00, 4246, "propobj.c");
|
||||
#endif
|
||||
cd00024ee8(&hitthing.unk0c);
|
||||
cdGetObstacleNormal(&hitthing.unk0c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3368,7 +3368,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
|
||||
bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2, struct coord *arg3)
|
||||
{
|
||||
struct prop *prop = obj->prop;
|
||||
f32 width = objGetWidth(obj);
|
||||
f32 radius = objGetRadius(obj);
|
||||
bool result = true;
|
||||
bool sp98 = false;
|
||||
struct coord sp8c;
|
||||
@@ -3388,10 +3388,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 (cd0002dac8(&prop->pos, prop->rooms, &sp80, rooms, width, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove08(&prop->pos, prop->rooms, &sp80, rooms, radius, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
setup0f09233c(obj, &sp80, obj->realrot, rooms);
|
||||
|
||||
if (cdTestAToB1(&prop->pos, &sp80, width, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove02(&prop->pos, &sp80, radius, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
prop->pos.x = sp80.x;
|
||||
prop->pos.y = sp80.y;
|
||||
prop->pos.z = sp80.z;
|
||||
@@ -3407,13 +3407,13 @@ bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
|
||||
|
||||
if (!result) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp64, &sp58, 4386, "prop/propobj.c");
|
||||
cdGetEdge(&sp64, &sp58, 4386, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp64, &sp58, 4386, "propobj.c");
|
||||
cdGetEdge(&sp64, &sp58, 4386, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp64, &sp58, 4385, "propobj.c");
|
||||
cdGetEdge(&sp64, &sp58, 4385, "propobj.c");
|
||||
#else
|
||||
cd00024e4c(&sp64, &sp58, 4374, "propobj.c");
|
||||
cdGetEdge(&sp64, &sp58, 4374, "propobj.c");
|
||||
#endif
|
||||
|
||||
arg3->x = sp58.z - sp64.z;
|
||||
@@ -3481,10 +3481,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 (cd0002da50(&prop->pos, prop->rooms, &sp4c, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdExamCylMove07(&prop->pos, prop->rooms, &sp4c, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
setup0f09233c(obj, &sp4c, obj->realrot, rooms);
|
||||
|
||||
if (cdTestVolume(&sp4c, width, rooms, CDTYPE_ALL, false, 0.0f, 0.0f) != CDRESULT_COLLISION) {
|
||||
if (cdTestVolume(&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;
|
||||
@@ -5785,7 +5785,7 @@ f32 liftGetY(struct liftobj *lift)
|
||||
struct geotilef *tile = lift->base.geotilef;
|
||||
|
||||
if (tile && tile->header.type == GEOTYPE_TILE_F) {
|
||||
if (tile->header.flags & GEOFLAG_0001) {
|
||||
if (tile->header.flags & GEOFLAG_FLOOR1) {
|
||||
y = tile->vertices[tile->max[1]].y;
|
||||
}
|
||||
}
|
||||
@@ -5843,9 +5843,9 @@ void liftUpdateTiles(struct liftobj *lift, bool stationary)
|
||||
do {
|
||||
if (i == 0) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
flags = GEOFLAG_0001 | GEOFLAG_0002 | GEOFLAG_0008 | GEOFLAG_OPAQUE | GEOFLAG_LIFTFLOOR;
|
||||
flags = GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT | GEOFLAG_LIFTFLOOR;
|
||||
#else
|
||||
flags = GEOFLAG_0001 | GEOFLAG_0002 | GEOFLAG_LIFTFLOOR;
|
||||
flags = GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_LIFTFLOOR;
|
||||
#endif
|
||||
|
||||
// Look for a non-rectangular floor with fallback to rectangular
|
||||
@@ -5861,13 +5861,13 @@ void liftUpdateTiles(struct liftobj *lift, bool stationary)
|
||||
}
|
||||
}
|
||||
} else if (i == 1) {
|
||||
flags = GEOFLAG_COLLISIONS;
|
||||
flags = GEOFLAG_WALL;
|
||||
rodata = modelGetPartRodata(lift->base.model->filedata, MODELPART_LIFT_WALL1);
|
||||
} else if (i == 2) {
|
||||
flags = GEOFLAG_COLLISIONS;
|
||||
flags = GEOFLAG_WALL;
|
||||
rodata = modelGetPartRodata(lift->base.model->filedata, MODELPART_LIFT_WALL2);
|
||||
} else if (i == 3) {
|
||||
flags = GEOFLAG_COLLISIONS;
|
||||
flags = GEOFLAG_WALL;
|
||||
rodata = modelGetPartRodata(lift->base.model->filedata, MODELPART_LIFT_WALL3);
|
||||
} else if (i == 4) {
|
||||
// The doorblock model part exists in the dataDyne tower lifts.
|
||||
@@ -5875,14 +5875,14 @@ void liftUpdateTiles(struct liftobj *lift, bool stationary)
|
||||
// is moving. Without it, the player could exit the lift through
|
||||
// the doorway while it's moving.
|
||||
if (!stationary) {
|
||||
flags = GEOFLAG_COLLISIONS;
|
||||
flags = GEOFLAG_WALL;
|
||||
rodata = modelGetPartRodata(lift->base.model->filedata, MODELPART_LIFT_DOORBLOCK);
|
||||
}
|
||||
} else if (i == 5) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
flags = GEOFLAG_0001 | GEOFLAG_0002 | GEOFLAG_0008 | GEOFLAG_OPAQUE | GEOFLAG_LIFTFLOOR;
|
||||
flags = GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT | GEOFLAG_LIFTFLOOR;
|
||||
#else
|
||||
flags = GEOFLAG_0001 | GEOFLAG_0002 | GEOFLAG_LIFTFLOOR;
|
||||
flags = GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_LIFTFLOOR;
|
||||
#endif
|
||||
rodata = modelGetPartRodata(lift->base.model->filedata, MODELPART_LIFT_FLOORNONRECT2);
|
||||
} else {
|
||||
@@ -6004,7 +6004,7 @@ void hovUpdateGround(struct defaultobj *obj, struct hov *hov, struct coord *pos,
|
||||
roomsCopy(rooms, testrooms);
|
||||
setup0f09233c(obj, &testpos, matrix, testrooms);
|
||||
|
||||
ground = cdFindGroundYSimple(pos, 5, testrooms, &obj->floorcol, NULL);
|
||||
ground = cdFindGroundAtCyl(pos, 5, testrooms, &obj->floorcol, NULL);
|
||||
|
||||
if (ground < -30000) {
|
||||
ground = hov->ground;
|
||||
@@ -6089,11 +6089,11 @@ void hovTick(struct defaultobj *obj, struct hov *hov)
|
||||
|
||||
func0f065e74(&prop->pos, prop->rooms, &sp1b4, sp198);
|
||||
roomsAppend(sp9c, sp198, ARRAYCOUNT(sp198));
|
||||
ground1 = cdFindGroundYSimple(&sp1b4, 5, sp198, &obj->floorcol, NULL);
|
||||
ground1 = cdFindGroundAtCyl(&sp1b4, 5, sp198, &obj->floorcol, NULL);
|
||||
|
||||
func0f065e74(&prop->pos, prop->rooms, &sp1a8, sp188);
|
||||
roomsAppend(sp9c, sp188, ARRAYCOUNT(sp188));
|
||||
ground2 = cdFindGroundYSimple(&sp1a8, 5, sp188, NULL, NULL);
|
||||
ground2 = cdFindGroundAtCyl(&sp1a8, 5, sp188, NULL, NULL);
|
||||
|
||||
if (ground1 >= -30000.0f && ground2 >= -30000.0f) {
|
||||
spb4 = atan2f(ground1 - ground2, sp1cc - sp1d0);
|
||||
@@ -6388,12 +6388,12 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3
|
||||
pos.y += hov->ground - prevhov.ground;
|
||||
}
|
||||
|
||||
cdresult = cd0002d8b8(&prop->pos, prop->rooms, &pos, rooms, CDTYPE_ALL, true, 0.0f, 0.0f);
|
||||
cdresult = cdExamCylMove05(&prop->pos, prop->rooms, &pos, rooms, CDTYPE_ALL, true, 0.0f, 0.0f);
|
||||
|
||||
if (cdresult == CDRESULT_ERROR) {
|
||||
// empty
|
||||
} else if (cdresult == CDRESULT_COLLISION) {
|
||||
cd00025314(&prop->pos, &pos);
|
||||
cdSetSavedPos(&prop->pos, &pos);
|
||||
}
|
||||
} else {
|
||||
roomsCopy(prop->rooms, rooms);
|
||||
@@ -6404,7 +6404,7 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3
|
||||
func0f069850(obj, &pos, sp460, &cyl);
|
||||
|
||||
if (obj->flags3 & OBJFLAG3_GEOCYL) {
|
||||
cdresult = cd0002a6fc(&prop->pos, &pos, cyl.radius, rooms, CDTYPE_ALL, true, cyl.ymax - pos.y, cyl.ymin - pos.y);
|
||||
cdresult = cdExamCylMove01(&prop->pos, &pos, cyl.radius, rooms, CDTYPE_ALL, CHECKVERTICAL_YES, cyl.ymax - pos.y, cyl.ymin - pos.y);
|
||||
} else {
|
||||
cdresult = cd0002f02c((struct geoblock *)&cyl, rooms, CDTYPE_ALL);
|
||||
}
|
||||
@@ -6513,7 +6513,7 @@ void hovercarIncrementStep(struct hovercarobj *hovercar)
|
||||
f32 objCollide(struct defaultobj *movingobj, struct coord *movingvel, f32 rotation)
|
||||
{
|
||||
f32 force = 1.0f;
|
||||
struct prop *obstacle = cdGetObstacle();
|
||||
struct prop *obstacle = cdGetObstacleProp();
|
||||
|
||||
if (obstacle && g_Vars.lvupdate240 > 0) {
|
||||
if (obstacle->type == PROPTYPE_CHR || obstacle->type == PROPTYPE_PLAYER) {
|
||||
@@ -6538,16 +6538,16 @@ f32 objCollide(struct defaultobj *movingobj, struct coord *movingvel, f32 rotati
|
||||
objApplyMomentum(obstacleobj, &obstaclevel, 0.0f, true, true);
|
||||
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp70, &sp64, 7356, "prop/propobj.c");
|
||||
cdGetEdge(&sp70, &sp64, 7356, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp70, &sp64, 7356, "propobj.c");
|
||||
cdGetEdge(&sp70, &sp64, 7356, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp70, &sp64, 7355, "propobj.c");
|
||||
cdGetEdge(&sp70, &sp64, 7355, "propobj.c");
|
||||
#else
|
||||
cd00024e4c(&sp70, &sp64, 7308, "propobj.c");
|
||||
cdGetEdge(&sp70, &sp64, 7308, "propobj.c");
|
||||
#endif
|
||||
|
||||
if (cd00025364(&sp58, &sp4c)) {
|
||||
if (cdGetSavedPos(&sp58, &sp4c)) {
|
||||
sp4c.x -= sp58.x;
|
||||
sp4c.y -= sp58.y;
|
||||
sp4c.z -= sp58.z;
|
||||
@@ -8018,7 +8018,7 @@ void platformDisplaceProps2(struct prop *platform, Mtxf *arg1)
|
||||
|
||||
if (prop->pos.y > platform->pos.y
|
||||
&& (obj->hidden & OBJHFLAG_00008000)
|
||||
&& func000266a4(prop->pos.x, prop->pos.z, (struct geo *)sp9c)) {
|
||||
&& cd000266a4(prop->pos.x, prop->pos.z, (struct geo *)sp9c)) {
|
||||
mtx3ToMtx4(obj->realrot, &sp58);
|
||||
mtx4SetTranslation(&prop->pos, &sp58);
|
||||
mtx4MultMtx4InPlace(arg1, &sp58);
|
||||
@@ -8192,7 +8192,9 @@ bool rocketTickFbw(struct weaponobj *rocket)
|
||||
// Check if rocket can fly directly to target
|
||||
if (chrGetTargetProp(ownerchr) == chr->prop
|
||||
&& mpPlayerGetIndex(ownerchr) == g_Vars.lvframenum % g_MpNumChrs
|
||||
&& cdHasLineOfSight(&rocketprop->pos, rocketprop->rooms, &chr->prop->pos, chr->prop->rooms, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, 8)) {
|
||||
&& cdTestLos05(&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;
|
||||
projectile->nextsteppos.y = chr->prop->pos.y;
|
||||
projectile->nextsteppos.z = chr->prop->pos.z;
|
||||
@@ -8486,19 +8488,19 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
struct coord sp3ac;
|
||||
f32 f0_2;
|
||||
|
||||
if (cd00025364(&sp3d0, &sp3c4)) {
|
||||
if (cdGetSavedPos(&sp3d0, &sp3c4)) {
|
||||
sp3c4.x -= sp3d0.x;
|
||||
sp3c4.y -= sp3d0.y;
|
||||
sp3c4.z -= sp3d0.z;
|
||||
} else {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp3d0, &sp3c4, 8360, "prop/propobj.c");
|
||||
cdGetEdge(&sp3d0, &sp3c4, 8360, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp3d0, &sp3c4, 8360, "propobj.c");
|
||||
cdGetEdge(&sp3d0, &sp3c4, 8360, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp3d0, &sp3c4, 8339, "propobj.c");
|
||||
cdGetEdge(&sp3d0, &sp3c4, 8339, "propobj.c");
|
||||
#else
|
||||
cd00024e4c(&sp3d0, &sp3c4, 8289, "propobj.c");
|
||||
cdGetEdge(&sp3d0, &sp3c4, 8289, "propobj.c");
|
||||
#endif
|
||||
|
||||
sp3d0.x -= sp3c4.x;
|
||||
@@ -8534,13 +8536,13 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
projectile->unk0dc += f0;
|
||||
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cd00024e4c(&sp3e8, &sp3dc, 8398, "prop/propobj.c");
|
||||
cdGetEdge(&sp3e8, &sp3dc, 8398, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
cd00024e4c(&sp3e8, &sp3dc, 8398, "propobj.c");
|
||||
cdGetEdge(&sp3e8, &sp3dc, 8398, "propobj.c");
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
cd00024e4c(&sp3e8, &sp3dc, 8377, "propobj.c");
|
||||
cdGetEdge(&sp3e8, &sp3dc, 8377, "propobj.c");
|
||||
#else
|
||||
cd00024e4c(&sp3e8, &sp3dc, 8327, "propobj.c");
|
||||
cdGetEdge(&sp3e8, &sp3dc, 8327, "propobj.c");
|
||||
#endif
|
||||
|
||||
sp3f4.x = sp3dc.z - sp3e8.z;
|
||||
@@ -8700,7 +8702,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
}
|
||||
|
||||
if (cdresult == CDRESULT_NOCOLLISION) {
|
||||
ground = cdFindGroundYSimple(&prop->pos, 2, prop->rooms, &obj->floorcol, NULL);
|
||||
ground = cdFindGroundAtCyl(&prop->pos, 2, prop->rooms, &obj->floorcol, NULL);
|
||||
|
||||
if (ground > -30000.0f) {
|
||||
prop->pos.y = ground + objGetHov04(obj);
|
||||
@@ -9244,12 +9246,16 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
sp5ac.y = prop->pos.y + sp37c;
|
||||
sp5ac.z = prop->pos.z;
|
||||
|
||||
roomnum = cd0002a5e4(&sp5ac, prop->rooms, &sp390, &obj->floorcol, &geoflags, &sp380);
|
||||
roomnum = cdFindCeilingRoomYColourFlagsNormalAtPos(&sp5ac, prop->rooms, &sp390, &obj->floorcol, &geoflags, &sp380);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (roomnum > 0 && prop->pos.y + sp37c < sp390 && !cd0002db98(&sp5c8, sp5b8, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, 3))
|
||||
if (roomnum > 0
|
||||
&& prop->pos.y + sp37c < sp390
|
||||
&& !cdTestLos03(&sp5c8, sp5b8, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
#else
|
||||
if (roomnum > 0 && prop->pos.y + sp37c < sp390 && !cd0002db98(&sp5c8, sp5b8, &sp5ac, CDTYPE_BG, 3))
|
||||
if (roomnum > 0
|
||||
&& prop->pos.y + sp37c < sp390
|
||||
&& !cdTestLos03(&sp5c8, sp5b8, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2))
|
||||
#endif
|
||||
{
|
||||
sp354 = true;
|
||||
@@ -9269,14 +9275,14 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
obj->hidden |= OBJHFLAG_REAPABLE;
|
||||
}
|
||||
} else {
|
||||
roomnum = cd0002a564(&prop->pos, prop->rooms, &sp390, &obj->floorcol, &sp380, NULL);
|
||||
roomnum = cdFindFloorRoomYColourNormalPropAtPos(&prop->pos, prop->rooms, &sp390, &obj->floorcol, &sp380, NULL);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (roomnum <= 0 && (projectile->flags & PROJECTILEFLAG_STICKY) == 0) {
|
||||
if ((projectile->flags & PROJECTILEFLAG_00010000) == 0) {
|
||||
projectile->flags |= PROJECTILEFLAG_00010000;
|
||||
|
||||
if (cdFindRoom(&sp5c8, sp5b8) > 0) {
|
||||
if (cdFindFloorRoomAtPos(&sp5c8, sp5b8) > 0) {
|
||||
projectile->flags |= PROJECTILEFLAG_INROOM;
|
||||
}
|
||||
}
|
||||
@@ -9289,7 +9295,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
propDeregisterRooms(prop);
|
||||
roomsCopy(sp5b8, prop->rooms);
|
||||
|
||||
roomnum = cd0002a440(&prop->pos, prop->rooms, &sp390, &obj->floorcol, NULL);
|
||||
roomnum = cdFindFloorRoomYColourFlagsAtPos(&prop->pos, prop->rooms, &sp390, &obj->floorcol, NULL);
|
||||
|
||||
projectile->speed.x = 0.0f;
|
||||
projectile->speed.z = 0.0f;
|
||||
@@ -9546,16 +9552,16 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
sp5ac.z = prop->pos.z;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
roomnum = cd0002a4d0(&sp5ac, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
roomnum = cdFindCeilingRoomYColourFlagsAtPos(&sp5ac, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
|
||||
if (roomnum <= 0 || cd0002db98(&sp5c8, sp5b8, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, 3)) {
|
||||
roomnum = cd0002a440(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
if (roomnum <= 0 || cdTestLos03(&sp5c8, sp5b8, &sp5ac, CDTYPE_OBJS | CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cdFindFloorRoomYColourFlagsAtPos(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
}
|
||||
#else
|
||||
roomnum = cd0002a4d0(&sp5ac, prop->rooms, &spa4, &obj->floorcol);
|
||||
roomnum = cdFindCeilingRoomYColourFlagsAtPos(&sp5ac, prop->rooms, &spa4, &obj->floorcol);
|
||||
|
||||
if (roomnum <= 0 || cd0002db98(&sp5c8, sp5b8, &sp5ac, CDTYPE_BG, 3)) {
|
||||
roomnum = cd0002a440(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
if (roomnum <= 0 || cdTestLos03(&sp5c8, sp5b8, &sp5ac, CDTYPE_BG, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2)) {
|
||||
roomnum = cdFindFloorRoomYColourFlagsAtPos(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9567,9 +9573,9 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
|
||||
roomsCopy(sp5b8, prop->rooms);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
roomnum = cd0002a440(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
roomnum = cdFindFloorRoomYColourFlagsAtPos(&prop->pos, prop->rooms, &spa4, &obj->floorcol, &geoflags);
|
||||
#else
|
||||
roomnum = cd0002a440(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
roomnum = cdFindFloorRoomYColourFlagsAtPos(&prop->pos, prop->rooms, &spa4, &obj->floorcol);
|
||||
#endif
|
||||
|
||||
projectile->speed.x = 0.0f;
|
||||
@@ -10208,7 +10214,7 @@ void escastepTick(struct prop *prop)
|
||||
prop->pos.z = newpos.z;
|
||||
|
||||
if ((obj->flags & OBJFLAG_IGNOREFLOORCOLOUR) == 0) {
|
||||
cd0002a36c(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
cdFindFloorYColourTypeAtPos(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
}
|
||||
|
||||
func0f069c70(obj, true, true);
|
||||
@@ -10326,7 +10332,9 @@ void cctvTick(struct prop *camprop)
|
||||
if (canseeplayer) {
|
||||
playerSetPerimEnabled(playerprop, false);
|
||||
|
||||
if (!cdHasLineOfSight(&camprop->pos, camprop->rooms, &playerprop->pos, playerprop->rooms, 315, 8)) {
|
||||
if (!cdTestLos05(&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;
|
||||
}
|
||||
|
||||
@@ -10815,7 +10823,7 @@ void autogunTick(struct prop *prop)
|
||||
if (relangleh <= autogun->ymaxleft
|
||||
&& relangleh >= autogun->ymaxright
|
||||
&& track
|
||||
&& cdHasLineOfSight(&prop->pos, prop->rooms, &target->pos, target->rooms, CDTYPE_ALL, 8)) {
|
||||
&& cdTestLos05(&prop->pos, prop->rooms, &target->pos, target->rooms, CDTYPE_ALL, GEOFLAG_BLOCK_SIGHT)) {
|
||||
// Target is in sight
|
||||
obj->flags |= OBJFLAG_AUTOGUN_SEENTARGET;
|
||||
insight = true;
|
||||
@@ -11114,7 +11122,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
mtx00015be4(camGetProjectionMtxF(), sp108, &spc8);
|
||||
mtx4TransformVecInPlace(&spc8, &gunpos);
|
||||
|
||||
if (cd0002de34(&autogunprop->pos, autogunprop->rooms, &gunpos, gunrooms, CDTYPE_BG, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdTestLos10(&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;
|
||||
@@ -11142,7 +11150,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
if (g_Vars.normmplayerisrunning
|
||||
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|
||||
|| (g_Vars.antiplayernum >= 0 && targetprop && targetprop == g_Vars.anti->prop)) {
|
||||
if (cdTestAToB4(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cdGetPos(&hitpos, 11480, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
@@ -11153,7 +11161,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
cdGetPos(&hitpos, 11296, "propobj.c");
|
||||
#endif
|
||||
|
||||
hitprop = cdGetObstacle();
|
||||
hitprop = cdGetObstacleProp();
|
||||
|
||||
// SP: If the hit prop is a chr and it's our target
|
||||
// MP: If the hit prop is a chr
|
||||
@@ -11197,7 +11205,9 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
// Laptop in firing range
|
||||
struct prop *hitprop = NULL;
|
||||
|
||||
if (cdTestAToB4(&gunpos, gunrooms, &hitpos, CDTYPE_ALL & ~CDTYPE_PLAYERS, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos,
|
||||
CDTYPE_ALL & ~CDTYPE_PLAYERS,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cdGetPos(&hitpos, 11535, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
@@ -11208,7 +11218,7 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
cdGetPos(&hitpos, 11351, "propobj.c");
|
||||
#endif
|
||||
|
||||
hitprop = cdGetObstacle();
|
||||
hitprop = cdGetObstacleProp();
|
||||
missed = true;
|
||||
}
|
||||
|
||||
@@ -11233,7 +11243,9 @@ void autogunTickShoot(struct prop *autogunprop)
|
||||
}
|
||||
} else {
|
||||
// Enemy autogun in solo
|
||||
if (cdTestAToB4(&gunpos, gunrooms, &hitpos, CDTYPE_DOORS | CDTYPE_BG, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(&gunpos, gunrooms, &hitpos,
|
||||
CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
cdGetPos(&hitpos, 11561, "prop/propobj.c");
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
@@ -11511,7 +11523,9 @@ bool chopperCheckTargetInSight(struct chopperobj *obj)
|
||||
struct prop *target = chopperGetTargetProp(chopper);
|
||||
|
||||
if (target->type != PROPTYPE_PLAYER || g_Vars.bondvisible) {
|
||||
visible = cdHasLineOfSight(&target->pos, target->rooms, &chopper->base.prop->pos, chopper->base.prop->rooms, 307, 16);
|
||||
visible = cdTestLos05(&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);
|
||||
}
|
||||
|
||||
chopper->targetvisible = visible;
|
||||
@@ -12106,7 +12120,7 @@ void chopperTickFall(struct prop *chopperprop)
|
||||
newpos.y = chopperprop->pos.y + newspeed.f[1] * g_Vars.lvupdate240freal;
|
||||
newpos.z = chopperprop->pos.z + newspeed.f[2] * g_Vars.lvupdate240freal;
|
||||
|
||||
if (cd0002de10(&chopperprop->pos, chopperprop->rooms, &newpos, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos09(&chopperprop->pos, chopperprop->rooms, &newpos, CDTYPE_BG) == CDRESULT_COLLISION) {
|
||||
struct coord sp74;
|
||||
s16 room;
|
||||
struct coord sp64;
|
||||
@@ -12114,7 +12128,7 @@ void chopperTickFall(struct prop *chopperprop)
|
||||
s16 newrooms[8];
|
||||
|
||||
chopperprop->pos.y += 100;
|
||||
ground = cdFindGroundYSimple(&chopperprop->pos, 5, chopperprop->rooms, NULL, NULL);
|
||||
ground = cdFindGroundAtCyl(&chopperprop->pos, 5, chopperprop->rooms, NULL, NULL);
|
||||
chopperprop->pos.y -= 100;
|
||||
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
@@ -12353,7 +12367,7 @@ void chopperTickCombat(struct prop *chopperprop)
|
||||
goalpos.y = sp6c.y;
|
||||
goalpos.z = sp6c.z;
|
||||
}
|
||||
} else if (cd0002db98(&targetprop->pos, targetprop->rooms, &goalpos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, 0x10) == 0) {
|
||||
} else if (cdTestLos03(&targetprop->pos, targetprop->rooms, &goalpos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, GEOFLAG_BLOCK_SHOOT) == 0) {
|
||||
padUnpack(chopper->path->pads[chopper->cw ? (sp8c + 1) % chopper->path->len : sp8c], PADFIELD_POS, &pad);
|
||||
|
||||
pad.pos.y += -250.0f;
|
||||
@@ -12523,7 +12537,7 @@ void hovercarTick(struct prop *prop)
|
||||
sp210[0] = pad.room;
|
||||
sp210[1] = -1;
|
||||
|
||||
sp214.y = cdFindGroundYSimple(&pad.pos, 5, sp210, NULL, NULL) + 35;
|
||||
sp214.y = cdFindGroundAtCyl(&pad.pos, 5, sp210, NULL, NULL) + 35;
|
||||
} else {
|
||||
sp214.y = pad.pos.y;
|
||||
}
|
||||
@@ -12552,8 +12566,9 @@ void hovercarTick(struct prop *prop)
|
||||
}
|
||||
|
||||
if (active) {
|
||||
if (cd0002d7c0(&prop->pos, prop->rooms, &sp214, 0x5000, 0, 0, 0) == 0) {
|
||||
doorprop = cdGetObstacle();
|
||||
if (cdExamCylMove03(&prop->pos, prop->rooms, &sp214,
|
||||
CDTYPE_CLOSEDDOORS | CDTYPE_AJARDOORS, 0, 0, 0) == CDRESULT_COLLISION) {
|
||||
doorprop = cdGetObstacleProp();
|
||||
}
|
||||
|
||||
if (doorprop) {
|
||||
@@ -12687,7 +12702,7 @@ void hovercarTick(struct prop *prop)
|
||||
func0f065e74(&prop->pos, prop->rooms, &sp150, sp140);
|
||||
|
||||
if (active) {
|
||||
sp150.y = cdFindGroundYSimple(&sp150, 5, sp140, NULL, NULL) + 35;
|
||||
sp150.y = cdFindGroundAtCyl(&sp150, 5, sp140, NULL, NULL) + 35;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (sp150.y < -100000) {
|
||||
@@ -13136,7 +13151,7 @@ s32 objTickPlayer(struct prop *prop)
|
||||
}
|
||||
|
||||
if ((obj->flags & OBJFLAG_IGNOREFLOORCOLOUR) == 0) {
|
||||
cd0002a36c(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
cdFindFloorYColourTypeAtPos(&prop->pos, prop->rooms, &obj->floorcol, 0);
|
||||
}
|
||||
|
||||
func0f069c70(obj, true, true);
|
||||
@@ -13229,7 +13244,7 @@ s32 objTickPlayer(struct prop *prop)
|
||||
roomsCopy(sp220, prop->rooms);
|
||||
|
||||
if (sp148 <= sp144) {
|
||||
prop->pos.y = cdFindGroundYSimple(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL)
|
||||
prop->pos.y = cdFindGroundAtCyl(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL)
|
||||
+ func0f06a620(obj) + sp112;
|
||||
}
|
||||
|
||||
@@ -13238,7 +13253,7 @@ s32 objTickPlayer(struct prop *prop)
|
||||
|
||||
if (objUpdateGeometry(prop, (u8 **)geos, &end)
|
||||
&& geos[0]->type == GEOTYPE_BLOCK
|
||||
&& cd0002e4c4((struct geoblock *) geos[0], prop->rooms, 4) == 0) {
|
||||
&& cdTestBlockOverlapsAnyProp((struct geoblock *) geos[0], prop->rooms, CDTYPE_PLAYERS) == CDRESULT_COLLISION) {
|
||||
damage = ((obj->maxdamage - obj->damage) + 1) / 250.0f;
|
||||
obj->flags &= ~OBJFLAG_INVINCIBLE;
|
||||
objDamage(obj, damage, &prop->pos, WEAPON_REMOTEMINE, -1);
|
||||
@@ -15567,15 +15582,15 @@ Gfx *objRenderShadow(struct defaultobj *obj, Gfx *gdl)
|
||||
f32 y;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
s32 value = cd0002a440(&obj->prop->pos, obj->prop->rooms, &y, NULL, NULL);
|
||||
s32 room = cdFindFloorRoomYColourFlagsAtPos(&obj->prop->pos, obj->prop->rooms, &y, NULL, NULL);
|
||||
#else
|
||||
s32 value = cd0002a440(&obj->prop->pos, obj->prop->rooms, &y, NULL);
|
||||
s32 room = cdFindFloorRoomYColourFlagsAtPos(&obj->prop->pos, obj->prop->rooms, &y, NULL);
|
||||
#endif
|
||||
|
||||
if (value > 0 && (obj->modelnum == MODEL_HOOVERBOT || obj->modelnum == MODEL_TESTERBOT)) {
|
||||
if (room > 0 && (obj->modelnum == MODEL_HOOVERBOT || obj->modelnum == MODEL_TESTERBOT)) {
|
||||
angle = hoverpropGetTurnAngle(obj);
|
||||
gdl = gfxRenderRadialShadow(gdl, obj->prop->pos.x, y, obj->prop->pos.z, angle, 20, 0xffffff78);
|
||||
} else if (value > 0) {
|
||||
} else if (room > 0) {
|
||||
angle = hoverpropGetTurnAngle(obj);
|
||||
gdl = gfxRenderRadialShadow(gdl, obj->prop->pos.x, y, obj->prop->pos.z, angle, 30, 0xffffff78);
|
||||
}
|
||||
@@ -16573,9 +16588,10 @@ bool objDrop(struct prop *prop, bool lazy)
|
||||
spe4.y = spf0.m[3][1];
|
||||
spe4.z = spf0.m[3][2];
|
||||
|
||||
if (cd0002de34(&root->pos, root->rooms, &spe4, rooms, CDTYPE_ALL, 7) == CDRESULT_COLLISION
|
||||
if (cdTestLos10(&root->pos, root->rooms, &spe4, rooms, CDTYPE_ALL,
|
||||
GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2 | GEOFLAG_WALL) == CDRESULT_COLLISION
|
||||
|| (projectile->flags & PROJECTILEFLAG_STICKY) == 0) {
|
||||
if (cdTestVolume(&spe4, objGetWidth(obj), rooms, CDTYPE_ALL, 0, 0.0f, 0) == CDRESULT_COLLISION) {
|
||||
if (cdTestVolume(&spe4, objGetRadius(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;
|
||||
}
|
||||
@@ -16720,7 +16736,7 @@ void objDestroySupportedObjects(struct prop *tableprop, s32 playernum)
|
||||
{
|
||||
if (prop->pos.y > tableprop->pos.y
|
||||
&& (obj->hidden & OBJHFLAG_00008000)
|
||||
&& func000266a4(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
&& cd000266a4(prop->pos.x, prop->pos.z, (struct geo *)start)) {
|
||||
objFall(obj, playernum);
|
||||
}
|
||||
}
|
||||
@@ -18026,7 +18042,8 @@ bool objTestForInteract(struct prop *prop)
|
||||
}
|
||||
|
||||
if (angle <= 0.3926365673542f) {
|
||||
if ((obj->flags2 & OBJFLAG2_INTERACTCHECKLOS) == 0 || cd0002dcd0(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, 0x20)) {
|
||||
if ((obj->flags2 & OBJFLAG2_INTERACTCHECKLOS) == 0
|
||||
|| cdTestLos06(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
g_InteractProp = prop;
|
||||
}
|
||||
}
|
||||
@@ -20534,7 +20551,9 @@ s32 objTestForPickup(struct prop *prop)
|
||||
if (pickup
|
||||
&& (obj->flags2 & OBJFLAG2_PICKUPWITHOUTLOS) == 0
|
||||
&& !usebigrange
|
||||
&& cdHasLineOfSight(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, 0x22, 0x1c) == 0) {
|
||||
&& cdTestLos05(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms,
|
||||
CDTYPE_DOORS | CDTYPE_BG,
|
||||
GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT) == false) {
|
||||
pickup = false;
|
||||
}
|
||||
|
||||
@@ -23053,13 +23072,13 @@ void doorsCalcFrac(struct doorobj *door)
|
||||
{
|
||||
propSetPerimEnabled(loopprop, false);
|
||||
|
||||
cdresult = cd0002e4c4(loopdoor->base.geoblock, loopprop->rooms,
|
||||
cdresult = cdTestBlockOverlapsAnyProp(loopdoor->base.geoblock, loopprop->rooms,
|
||||
CDTYPE_OBJS | CDTYPE_PLAYERS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_OBJSNOTSAFEORHELI);
|
||||
|
||||
propSetPerimEnabled(loopprop, true);
|
||||
|
||||
if (cdresult == CDRESULT_COLLISION) {
|
||||
struct prop *blockerprop = cdGetObstacle();
|
||||
struct prop *blockerprop = cdGetObstacleProp();
|
||||
|
||||
if (blockerprop && blockerprop->type == PROPTYPE_CHR) {
|
||||
struct chrdata *chr = blockerprop->chr;
|
||||
@@ -23441,7 +23460,7 @@ bool doorTestForInteract(struct prop *prop)
|
||||
|
||||
if (maybe) {
|
||||
if ((door->base.flags2 & OBJFLAG2_INTERACTCHECKLOS) == 0
|
||||
|| cd0002dcd0(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, 0x20)) {
|
||||
|| cdTestLos06(&playerprop->pos, playerprop->rooms, &prop->pos, prop->rooms, CDTYPE_BG)) {
|
||||
checkmore = func0f08f968(door, false);
|
||||
|
||||
if (checkmore && (door->base.flags2 & OBJFLAG2_80000000)) {
|
||||
@@ -24125,7 +24144,9 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct
|
||||
|
||||
propSetPerimEnabled(fromprop, false);
|
||||
|
||||
if (cdTestAToB4(pos, fromprop->rooms, &endpos, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER| CDTYPE_BG, 0x10) == CDRESULT_COLLISION) {
|
||||
if (cdExamLos08(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
|
||||
cdGetPos(&endpos, 24883, "prop/propobj.c");
|
||||
@@ -24138,7 +24159,7 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct
|
||||
#else
|
||||
cdGetPos(&endpos, 24137, "propobj.c");
|
||||
#endif
|
||||
obstacle = cdGetObstacle();
|
||||
obstacle = cdGetObstacleProp();
|
||||
}
|
||||
|
||||
propSetPerimEnabled(fromprop, true);
|
||||
|
||||
+1
-1
@@ -1865,7 +1865,7 @@ void setupCreateProps(s32 stagenum)
|
||||
car->nextstep = 0;
|
||||
|
||||
if (obj->flags & OBJFLAG_CHOPPER_INACTIVE) {
|
||||
prop->pos.y = cd0002a36c(&prop->pos, prop->rooms, NULL, 0) + 30;
|
||||
prop->pos.y = cdFindFloorYColourTypeAtPos(&prop->pos, prop->rooms, NULL, 0) + 30;
|
||||
}
|
||||
|
||||
prop->forcetick = true;
|
||||
|
||||
@@ -76,7 +76,7 @@ void setupPrepareCover(void)
|
||||
g_CoverRooms[i] = -1;
|
||||
|
||||
if (roomsptr != NULL) {
|
||||
s32 room = cdFindRoom(cover.pos, roomsptr);
|
||||
s32 room = cdFindFloorRoomAtPos(cover.pos, roomsptr);
|
||||
|
||||
if (room > 0) {
|
||||
g_CoverRooms[i] = (s16)room;
|
||||
@@ -102,7 +102,7 @@ void setupPrepareCover(void)
|
||||
}
|
||||
|
||||
if (roomsptr) {
|
||||
s32 aimroom = cdFindRoom(&aimpos, roomsptr);
|
||||
s32 aimroom = cdFindFloorRoomAtPos(&aimpos, roomsptr);
|
||||
|
||||
if (aimroom > 0) {
|
||||
g_CoverFlags[i] |= (g_CoverRooms[i] == (s16)aimroom) ? COVERFLAG_AIMSAMEROOM : COVERFLAG_AIMDIFFROOM;
|
||||
|
||||
@@ -59,7 +59,7 @@ void setupPreparePads(void)
|
||||
}
|
||||
|
||||
if (roomsptr != NULL) {
|
||||
roomnum = cdFindRoom(&pad.pos, roomsptr);
|
||||
roomnum = cdFindFloorRoomAtPos(&pad.pos, roomsptr);
|
||||
|
||||
if (roomnum > 0) {
|
||||
packedpad->room = roomnum;
|
||||
|
||||
Reference in New Issue
Block a user