Rename chrwidth to radius

This commit is contained in:
Ryan Dwyer 2022-07-17 10:27:25 +10:00
parent 2658f5ecb5
commit b5fd42aed2
25 changed files with 312 additions and 312 deletions

View File

@ -433,8 +433,8 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
if (bodynum == BODY_DRCAROLL) {
chr->drcarollimage_left = 0;
chr->drcarollimage_right = 0;
chr->chrheight = 185;
chr->chrwidth = 30;
chr->height = 185;
chr->radius = 30;
} else if (bodynum == BODY_CHICROB) {
chr->unk348[0] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
chr->unk348[1] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
@ -442,8 +442,8 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
chr->unk348[1]->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
chr->unk348[0]->beam->age = -1;
chr->unk348[1]->beam->age = -1;
chr->chrheight = 200;
chr->chrwidth = 42;
chr->height = 200;
chr->radius = 42;
}
if (packed->spawnflags & SPAWNFLAG_INVINCIBLE) {
@ -603,8 +603,8 @@ struct prop *bodyAllocateEyespy(struct pad *pad, s16 room)
chr->yvisang = 0;
chr->teamscandist = 0;
chr->convtalk = 0;
chr->chrwidth = 26;
chr->chrheight = 200;
chr->radius = 26;
chr->height = 200;
func0f02e9a0(chr, 0);
chr->chrflags |= CHRCFLAG_HIDDEN;

View File

@ -109,15 +109,15 @@ void bbikeTryDismountAngle(f32 relativeangle, f32 distance)
s32 result;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
if (g_Vars.currentplayer->walkinitmove == 0) {
bike = (struct hoverbikeobj *)g_Vars.currentplayer->hoverbike->obj;
angle = hoverpropGetTurnAngle(&bike->base);
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
distance += width + 10;
distance += radius + 10;
angle += relativeangle;
@ -143,7 +143,7 @@ void bbikeTryDismountAngle(f32 relativeangle, f32 distance)
propSetPerimEnabled(g_Vars.currentplayer->hoverbike, true);
if (result == CDRESULT_NOCOLLISION) {
result = cdTestVolume(&pos, width, rooms, CDTYPE_ALL, true,
result = cdTestVolume(&pos, radius, rooms, CDTYPE_ALL, true,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
}
@ -1060,8 +1060,8 @@ s32 bbikeCalculateNewPosition(struct coord *vel, f32 angledelta)
f32 zdiff;
f32 ymax;
f32 ymin;
f32 width;
f32 halfwidth;
f32 radius;
f32 halfradius;
dstpos.x = g_Vars.currentplayer->hoverbike->pos.x;
dstpos.y = g_Vars.currentplayer->hoverbike->pos.y;
@ -1074,7 +1074,7 @@ s32 bbikeCalculateNewPosition(struct coord *vel, f32 angledelta)
dstpos.x += vel->x;
dstpos.z += vel->z;
propObjGetBbox(g_Vars.currentplayer->hoverbike, &width, &ymax, &ymin);
propObjGetBbox(g_Vars.currentplayer->hoverbike, &radius, &ymax, &ymin);
func0f065dfc(&g_Vars.currentplayer->hoverbike->pos,
g_Vars.currentplayer->hoverbike->rooms,
&dstpos, dstrooms, spa8, 20);
@ -1089,26 +1089,26 @@ s32 bbikeCalculateNewPosition(struct coord *vel, f32 angledelta)
dstpos.y += hov.ground - bike->hov.ground;
halfwidth = width * 0.5f;
halfradius = radius * 0.5f;
xdiff = dstpos.x - g_Vars.currentplayer->hoverbike->pos.x;
zdiff = dstpos.z - g_Vars.currentplayer->hoverbike->pos.z;
if (xdiff > halfwidth || zdiff > halfwidth || xdiff < -halfwidth || zdiff < -halfwidth) {
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
result = cdTestAToB3(&g_Vars.currentplayer->hoverbike->pos,
g_Vars.currentplayer->hoverbike->rooms,
&dstpos, dstrooms, width, CDTYPE_ALL, 1,
&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, width, dstrooms, CDTYPE_ALL, 1,
&dstpos, radius, dstrooms, CDTYPE_ALL, 1,
ymax - g_Vars.currentplayer->hoverbike->pos.y,
ymin - g_Vars.currentplayer->hoverbike->pos.y);
}
} else {
result = cdTestAToB1(&g_Vars.currentplayer->hoverbike->pos,
&dstpos, width, spa8, CDTYPE_ALL, 1,
&dstpos, radius, spa8, CDTYPE_ALL, 1,
ymax - g_Vars.currentplayer->hoverbike->pos.y,
ymin - g_Vars.currentplayer->hoverbike->pos.y);
}
@ -1244,7 +1244,7 @@ void bbikeUpdateVertical(struct coord *pos)
g_Vars.currentplayer->prop->pos.z = pos->z;
ground = cdFindGroundY(&g_Vars.currentplayer->prop->pos,
g_Vars.currentplayer->bond2.width,
g_Vars.currentplayer->bond2.radius,
g_Vars.currentplayer->prop->rooms,
&g_Vars.currentplayer->floorcol,
&g_Vars.currentplayer->floortype,
@ -1383,14 +1383,14 @@ s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
f32 ymax;
f32 ymin;
f32 tmp;
f32 width;
f32 radius;
propObjGetBbox(g_Vars.currentplayer->hoverbike, &width, &ymax, &ymin);
propObjGetBbox(g_Vars.currentplayer->hoverbike, &radius, &ymax, &ymin);
sp34.x = arg1->x - (g_Vars.currentplayer->hoverbike->pos.x + arg0->f[0]);
sp34.z = arg1->z - (g_Vars.currentplayer->hoverbike->pos.z + arg0->f[2]);
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= width * width) {
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
if (arg1->f[0] != g_Vars.currentplayer->hoverbike->pos.f[0] || arg1->f[2] != g_Vars.currentplayer->hoverbike->pos.f[2]) {
sp34.x = -(arg1->z - g_Vars.currentplayer->hoverbike->pos.z);
sp34.y = 0;
@ -1418,7 +1418,7 @@ s32 bbike0f0d3940(struct coord *arg0, struct coord *arg1, struct coord *arg2)
sp34.x = arg2->x - (g_Vars.currentplayer->hoverbike->pos.x + arg0->f[0]);
sp34.z = arg2->z - (g_Vars.currentplayer->hoverbike->pos.z + arg0->f[2]);
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= width * width) {
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
if (arg2->f[0] != g_Vars.currentplayer->hoverbike->pos.f[0] || arg2->f[2] != g_Vars.currentplayer->hoverbike->pos.f[2]) {
sp34.x = -(arg2->z - g_Vars.currentplayer->hoverbike->pos.z);
sp34.y = 0;

View File

@ -287,20 +287,20 @@ bool bgrabTryMoveUpwards(f32 y)
s16 rooms[8];
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
newpos.x = g_Vars.currentplayer->prop->pos.x;
newpos.y = g_Vars.currentplayer->prop->pos.y + y;
newpos.z = g_Vars.currentplayer->prop->pos.z;
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &newpos, rooms);
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &newpos, rooms);
propSetPerimEnabled(g_Vars.currentplayer->prop, false);
ymin -= 0.1f;
result = cdTestVolume(&newpos, width, rooms, CDTYPE_ALL, 1,
result = cdTestVolume(&newpos, radius, rooms, CDTYPE_ALL, 1,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
@ -324,7 +324,7 @@ s32 bgrabCalculateNewPosition(struct coord *delta, f32 angle, bool arg2)
bool ismoving = false;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
f32 rotextrasum;
struct coord posextrasum;
f32 rotextra;
@ -335,7 +335,7 @@ s32 bgrabCalculateNewPosition(struct coord *delta, f32 angle, bool arg2)
var80070e80 = 0;
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
propSetPerimEnabled(g_Vars.currentplayer->prop, false);
propSetPerimEnabled(g_Vars.currentplayer->grabbedprop, false);
@ -375,7 +375,7 @@ s32 bgrabCalculateNewPosition(struct coord *delta, f32 angle, bool arg2)
ymin - g_Vars.currentplayer->prop->pos.y);
if (cdresult == CDRESULT_NOCOLLISION) {
cdresult = cd0002a6fc(&g_Vars.currentplayer->prop->pos, &pos, width, rooms, CDTYPE_ALL, true,
cdresult = cd0002a6fc(&g_Vars.currentplayer->prop->pos, &pos, radius, rooms, CDTYPE_ALL, true,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
}
@ -625,7 +625,7 @@ bool bgrab0f0cdb68(f32 angle)
f32 sp60 = -1.0f;
struct coord sp54;
f32 f12;
f32 width;
f32 radius;
f32 ymax;
f32 ymin;
@ -681,10 +681,10 @@ bool bgrab0f0cdb68(f32 angle)
} else if (var80070e80 != 0) {
if (g_Vars.currentplayer->grabbedprop->type == PROPTYPE_OBJ) {
if (g_Vars.currentplayer->grabbedprop->obj->flags3 & OBJFLAG3_GEOTYPE3) {
propObjGetBbox(g_Vars.currentplayer->grabbedprop, &width, &ymax, &ymin);
propObjGetBbox(g_Vars.currentplayer->grabbedprop, &radius, &ymax, &ymin);
f0 = (var8009de78.f[0] - spa4.f[0]) * f20 + (var8009de78.f[2] - spa4.f[2]) * f22;
f0 -= width;
f0 -= radius;
if (f0 < 0.0f) {
sp60 = -f0;
@ -820,7 +820,7 @@ void bgrabUpdateVertical(void)
f32 f0;
f14 = cdFindGroundY(&g_Vars.currentplayer->prop->pos,
g_Vars.currentplayer->bond2.width,
g_Vars.currentplayer->bond2.radius,
g_Vars.currentplayer->prop->rooms,
&g_Vars.currentplayer->floorcol,
&g_Vars.currentplayer->floortype,

View File

@ -381,7 +381,7 @@ f32 bmoveCalculateLookahead(void)
struct coord sp150;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
u32 stack2;
f32 angles[5];
bool populated[5];
@ -412,7 +412,7 @@ f32 bmoveCalculateLookahead(void)
return result;
}
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
sp100.x = g_Vars.currentplayer->bond2.unk00.x;
sp100.y = g_Vars.currentplayer->bond2.unk00.y;

View File

@ -190,7 +190,7 @@ s32 bwalkTryMoveUpwards(f32 amount)
u32 types;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
if (g_Vars.currentplayer->floorflags & TILEFLAG_0100) {
g_Vars.enableslopes = false;
@ -204,14 +204,14 @@ s32 bwalkTryMoveUpwards(f32 amount)
types = g_Vars.bondcollisions ? CDTYPE_ALL : CDTYPE_BG;
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &newpos, rooms);
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &newpos, rooms);
propSetPerimEnabled(g_Vars.currentplayer->prop, false);
ymin -= 0.1f;
result = cdTestVolume(&newpos, width, rooms, types, 1,
result = cdTestVolume(&newpos, radius, rooms, types, 1,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
@ -231,7 +231,7 @@ s32 bwalkTryMoveUpwards(f32 amount)
bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 checktypes)
{
s32 result = CDRESULT_NOCOLLISION;
f32 halfwidth;
f32 halfradius;
struct coord dstpos;
s16 dstrooms[8];
bool copyrooms = false;
@ -239,7 +239,7 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply,
s32 types;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
f32 xdiff;
f32 zdiff;
s32 i;
@ -267,8 +267,8 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply,
types = g_Vars.bondcollisions ? checktypes : CDTYPE_BG;
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
width += extrawidth;
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
radius += extrawidth;
func0f065dfc(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms,
&dstpos, dstrooms, sp64, 20);
@ -287,29 +287,29 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply,
copyrooms = true;
// Check if the player is moving at least half their width along the
// Check if the player is moving at least half their radius along the
// X or Z axis in a single frame. If less, only do a collision check for
// the dst position. If more, do a halfway check too?
xdiff = dstpos.x - g_Vars.currentplayer->prop->pos.x;
zdiff = dstpos.z - g_Vars.currentplayer->prop->pos.z;
halfwidth = width * 0.5f;
halfradius = radius * 0.5f;
if (xdiff > halfwidth || zdiff > halfwidth || xdiff < -halfwidth || zdiff < -halfwidth) {
if (xdiff > halfradius || zdiff > halfradius || xdiff < -halfradius || zdiff < -halfradius) {
result = cdTestAToB3(&g_Vars.currentplayer->prop->pos,
g_Vars.currentplayer->prop->rooms,
&dstpos, dstrooms, width, types, 1,
&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, width, dstrooms, types, 1,
&dstpos, radius, dstrooms, types, 1,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
}
} else {
result = cdTestAToB1(&g_Vars.currentplayer->prop->pos,
&dstpos, width, sp64, types, 1,
&dstpos, radius, sp64, types, 1,
ymax - g_Vars.currentplayer->prop->pos.y,
ymin - g_Vars.currentplayer->prop->pos.y);
}
@ -585,14 +585,14 @@ s32 bwalk0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s3
f32 ymax;
f32 ymin;
f32 tmp;
f32 width;
f32 radius;
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
sp34.x = arg1->x - (g_Vars.currentplayer->prop->pos.x + arg0->f[0]);
sp34.z = arg1->z - (g_Vars.currentplayer->prop->pos.z + arg0->f[2]);
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= width * width) {
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
if (arg1->f[0] != g_Vars.currentplayer->prop->pos.f[0] || arg1->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
sp34.x = -(arg1->z - g_Vars.currentplayer->prop->pos.z);
sp34.y = 0;
@ -620,7 +620,7 @@ s32 bwalk0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s3
sp34.x = arg2->x - (g_Vars.currentplayer->prop->pos.x + arg0->f[0]);
sp34.z = arg2->z - (g_Vars.currentplayer->prop->pos.z + arg0->f[2]);
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= width * width) {
if (sp34.f[0] * sp34.f[0] + sp34.f[2] * sp34.f[2] <= radius * radius) {
if (arg2->f[0] != g_Vars.currentplayer->prop->pos.f[0] || arg2->f[2] != g_Vars.currentplayer->prop->pos.f[2]) {
sp34.x = -(arg2->z - g_Vars.currentplayer->prop->pos.z);
sp34.y = 0;
@ -705,7 +705,7 @@ void bwalkUpdateVertical(void)
{
s32 i;
f32 newfallspeed;
f32 width;
f32 radius;
f32 ymax;
f32 ymin;
f32 ground;
@ -732,18 +732,18 @@ void bwalkUpdateVertical(void)
struct defaultobj *obj;
#endif
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
#if VERSION >= VERSION_NTSC_1_0
// Maybe reset counter-op's width - not sure why
// Maybe reset counter-op's radius - not sure why
// Maybe it gets set to 0 when they die?
if (g_Vars.antiplayernum >= 0
&& g_Vars.currentplayer == g_Vars.anti
&& g_Vars.currentplayer->bond2.width != 30
&& 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)) {
g_Vars.currentplayer->prop->chr->chrwidth = 30;
g_Vars.currentplayer->bond2.width = 30;
width = 30;
g_Vars.currentplayer->prop->chr->radius = 30;
g_Vars.currentplayer->bond2.radius = 30;
radius = 30;
}
#endif
@ -752,7 +752,7 @@ void bwalkUpdateVertical(void)
// player is touching a ladder from a room which shares the same coordinate
// space?
onladder = cd00029ffc(&g_Vars.currentplayer->prop->pos,
width * 1.2f, ymax - g_Vars.currentplayer->prop->pos.y,
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);
@ -763,7 +763,7 @@ void bwalkUpdateVertical(void)
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms);
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &testpos, rooms);
onladder2 = cd00029ffc(&g_Vars.currentplayer->prop->pos,
width * 1.1f, ymax - g_Vars.currentplayer->prop->pos.y,
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);
}
@ -778,7 +778,7 @@ void bwalkUpdateVertical(void)
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms);
bmoveFindEnteredRoomsByPos(g_Vars.currentplayer, &testpos, rooms);
ground = cdFindGroundY(&testpos, g_Vars.currentplayer->bond2.width, rooms,
ground = cdFindGroundY(&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);
@ -1395,7 +1395,7 @@ void bwalk0f0c69b8(void)
f32 speedtheta;
f32 maxspeed;
f32 sp74;
f32 width;
f32 radius;
f32 ymax;
f32 ymin;
f32 xdiff;
@ -1590,10 +1590,10 @@ void bwalk0f0c69b8(void)
spcc.f[2] += sp74 * g_Vars.currentplayer->laddernormal.f[2];
g_Vars.currentplayer->ladderupdown = sp74 * 0.3f;
} else {
playerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin);
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
cdresult = cd0002a13c(&g_Vars.currentplayer->prop->pos,
width * 1.1f, ymax - g_Vars.currentplayer->prop->pos.y,
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);

View File

@ -104,7 +104,7 @@ void botReset(struct chrdata *chr, u8 respawning)
chr->liftaction = 0;
chr->inlift = 0;
chr->lift = NULL;
chr->chrheight = 185;
chr->height = 185;
for (i = 0; i < 33; i++) {
aibot->ammoheld[i] = 0;
@ -241,7 +241,7 @@ void botSpawn(struct chrdata *chr, u8 respawning)
if (aibot) {
botReset(chr, respawning);
splatResetChr(chr);
thing = scenarioChooseSpawnLocation(chr->chrwidth, &pos, rooms, chr->prop);
thing = scenarioChooseSpawnLocation(chr->radius, &pos, rooms, chr->prop);
chr->hidden |= CHRHFLAG_00100000;
chrMoveToPos(chr, &pos, rooms, thing, true);
chr->aibot->unk0a4 = model0001ae44(chr->model);
@ -1884,9 +1884,9 @@ s32 botGuessCrouchPos(struct chrdata *chr)
{
s32 crouchpos;
if (chr->chrheight <= 90) {
if (chr->height <= 90) {
crouchpos = CROUCHPOS_SQUAT;
} else if (chr->chrheight <= 135) {
} else if (chr->height <= 135) {
crouchpos = CROUCHPOS_DUCK;
} else {
crouchpos = CROUCHPOS_STAND;

View File

@ -259,13 +259,13 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
{
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
bool moveok = false;
f32 movex;
f32 movez;
struct prop *prop = chr->prop;
u32 stack;
f32 halfwidth;
f32 halfradius;
struct defaultobj *chair = NULL;
s32 cdresult;
s16 sp84[20];
@ -291,8 +291,8 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
return;
}
chrGetBbox(prop, &width, &ymax, &ymin);
halfwidth = width * 0.5f;
chrGetBbox(prop, &radius, &ymax, &ymin);
halfradius = radius * 0.5f;
chrSetPerimEnabled(chr, false);
// myspecial is the chr's chair
@ -321,14 +321,14 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
movex = dstpos->x - prop->pos.x;
movez = dstpos->z - prop->pos.z;
if (movex > halfwidth || movez > halfwidth || movex < -halfwidth || movez < -halfwidth) {
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);
if (cdresult == CDRESULT_NOCOLLISION) {
cdresult = cd0002a6fc(&prop->pos, dstpos, width, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cd0002a6fc(&prop->pos, dstpos, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
} else {
cdresult = cd0002a6fc(&prop->pos, dstpos, width, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cd0002a6fc(&prop->pos, dstpos, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
if (cdresult != CDRESULT_ERROR) {
@ -387,14 +387,14 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
movex = sp44.x - prop->pos.x;
movez = sp44.z - prop->pos.z;
if (movex > halfwidth || movez > halfwidth || movex < -halfwidth || movez < -halfwidth) {
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);
if (cdresult == CDRESULT_NOCOLLISION) {
cdresult = cdTestVolume(&sp44, width, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
} else {
cdresult = cdTestVolume(&sp44, width, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
if (cdresult == CDRESULT_NOCOLLISION) {
@ -410,7 +410,7 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
sp54.x = sp78.x - dstpos->x;
sp54.z = sp78.z - dstpos->z;
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= width * width) {
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= radius * radius) {
if (sp78.f[0] != prop->pos.f[0] || sp78.f[2] != prop->pos.f[2]) {
sp54.x = -(sp78.z - prop->pos.z);
sp54.z = sp78.x - prop->pos.x;
@ -443,14 +443,14 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
movex = sp44.x - prop->pos.x;
movez = sp44.z - prop->pos.z;
if (movex > halfwidth || movez > halfwidth || movex < -halfwidth || movez < -halfwidth) {
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);
if (cdresult == CDRESULT_NOCOLLISION) {
cdresult = cdTestVolume(&sp44, width, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
} else {
cdresult = cdTestVolume(&sp44, width, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
if (cdresult == CDRESULT_NOCOLLISION) {
@ -464,7 +464,7 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
sp54.x = sp6c.x - dstpos->x;
sp54.z = sp6c.z - dstpos->z;
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= width * width) {
if (sp54.f[0] * sp54.f[0] + sp54.f[2] * sp54.f[2] <= radius * radius) {
if (sp6c.f[0] != prop->pos.f[0] || sp6c.f[2] != prop->pos.f[2]) {
sp54.x = -(sp6c.z - prop->pos.z);
sp54.z = sp6c.x - prop->pos.x;
@ -497,14 +497,14 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom
movex = sp44.x - prop->pos.x;
movez = sp44.z - prop->pos.z;
if (movex > halfwidth || movez > halfwidth || movex < -halfwidth || movez < -halfwidth) {
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);
if (cdresult == CDRESULT_NOCOLLISION) {
cdresult = cdTestVolume(&sp44, width, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, dstrooms, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
} else {
cdresult = cdTestVolume(&sp44, width, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
cdresult = cdTestVolume(&sp44, radius, sp84, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y);
}
if (cdresult == CDRESULT_NOCOLLISION) {
@ -546,17 +546,17 @@ bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3)
s16 newrooms[8];
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
newpos.x = pos->x;
newpos.y = pos->y + arg3;
newpos.z = pos->z;
chrGetBbox(chr->prop, &width, &ymax, &ymin);
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
func0f065e74(pos, rooms, &newpos, newrooms);
chr0f021fa8(chr, &newpos, newrooms);
chrSetPerimEnabled(chr, false);
result = cdTestVolume(&newpos, width, newrooms, CDTYPE_ALL, 1,
result = cdTestVolume(&newpos, radius, newrooms, CDTYPE_ALL, 1,
ymax - chr->prop->pos.y,
ymin - chr->prop->pos.y);
chrSetPerimEnabled(chr, true);
@ -612,7 +612,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
func0f065e74(&prop->pos, prop->rooms, arg2, spfc);
}
ground = cdFindGroundY(arg2, chr->chrwidth, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
ground = cdFindGroundY(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
if (ground < -1000000) {
ground = 0.0f;
@ -665,8 +665,8 @@ 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->chrwidth * 2.5f,
chr->manground + chr->chrheight - chr->prop->pos.y,
chr->onladder = cd00029ffc(&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);
} else {
@ -674,22 +674,22 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
}
if (chr->aibot != NULL) {
chr->chrheight = 185.0f;
chr->height = 185.0f;
if (chr->actiontype == ACT_GOPOS && (chr->act_gopos.flags & GOPOSFLAG_WALKDIRECT)) {
chr->chrheight = 135.0f;
chr->height = 135.0f;
} else if (chr->actiontype == ACT_GOPOS && (chr->act_gopos.flags & GOPOSFLAG_DUCK)) {
chr->chrheight = 90.0f;
} else if (cd0002a13c(&chr->prop->pos, chr->chrwidth * 1.1f,
chr->height = 90.0f;
} 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->chrheight = 135.0f;
} else if (cd0002a13c(&chr->prop->pos, chr->chrwidth * 1.1f,
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->chrheight = 90.0f;
chr->height = 90.0f;
}
bmove0f0cb904(&chr->aibot->shotspeed);
@ -877,7 +877,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
sp94 = spfc;
}
ground = cdFindGroundY(sp98, chr->chrwidth, sp94,
ground = cdFindGroundY(sp98, chr->radius, sp94,
&chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
#if VERSION >= VERSION_NTSC_1_0
@ -896,7 +896,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3
lvupdate240freal = 0.0f;
ground = cdFindGroundY(arg2, chr->chrwidth, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
ground = cdFindGroundY(arg2, chr->radius, spfc, &chr->floorcol, &chr->floortype, &floorflags, &chr->floorroom, &inlift, &lift);
}
#endif
@ -1194,8 +1194,8 @@ void chrInit(struct prop *prop, u8 *ailist)
chr->aidarkroomlist = -1;
chr->aiplayerdeadlist = -1;
chr->chrwidth = 20;
chr->chrheight = 185;
chr->radius = 20;
chr->height = 185;
chr->morale = 0;
chr->alertness = 0;
chr->flags = 0;
@ -1365,7 +1365,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->chrwidth, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
chr->ground = chr->manground = ground = cdFindGroundY(&testpos, chr->radius, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL);
chr->sumground = ground * (PAL ? 8.4175090789795f : 9.999998f);
@ -3635,15 +3635,15 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
// distance.
if (shadowalpha > -65536.0f && chr->ground < 65536.0f) {
f32 gaptoground = prop->pos.y - chr->ground;
f32 size; // unsure if radius or diameter
f32 radius;
if (gaptoground <= 400 && g_Vars.currentplayer->visionmode != VISIONMODE_XRAY) {
if (chr->bodynum == BODY_SKEDAR || chr->bodynum == BODY_SKEDARKING) {
size = 80;
radius = 80;
} else if (chr->bodynum == BODY_EYESPY) {
size = 12;
radius = 12;
} else {
size = 35;
radius = 35;
}
if (chr->chrflags & CHRCFLAG_NOSHADOW) {
@ -3659,10 +3659,10 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
}
if (cheatIsActive(CHEAT_SMALLCHARACTERS)) {
size *= 0.4f;
radius *= 0.4f;
}
gdl = gfxRenderRadialShadow(gdl, prop->pos.x, chr->ground, prop->pos.z, chrGetInverseTheta(chr), size, shadowalpha | ~0xff);
gdl = gfxRenderRadialShadow(gdl, prop->pos.x, chr->ground, prop->pos.z, chrGetInverseTheta(chr), radius, 0xffffff00 | shadowalpha);
}
}
}
@ -5606,7 +5606,7 @@ bool chrUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
}
chr->geo.ymin = chr->manground;
chr->geo.ymax = chr->manground + chr->chrheight;
chr->geo.ymax = chr->manground + chr->height;
if (chr->actiontype == ACT_SKJUMP) {
if (chr->manground > chr->act_skjump.ground) {
@ -5616,10 +5616,10 @@ bool chrUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
chr->geo.x = prop->pos.x;
chr->geo.z = prop->pos.z;
chr->geo.width = chr->chrwidth;
chr->geo.radius = chr->radius;
if (g_Vars.unk00048c) {
chr->geo.width = 15;
if (g_Vars.useperimshoot) {
chr->geo.radius = 15;
}
*start = (void *) &chr->geo;
@ -5632,15 +5632,14 @@ bool chrUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
*start = NULL;
return false;
}
void chrGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin)
void chrGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin)
{
struct chrdata *chr = prop->chr;
*width = chr->chrwidth;
*ymax = chr->manground + chr->chrheight;
*radius = chr->radius;
*ymax = chr->manground + chr->height;
*ymin = chr->manground + 20;
if (chr->actiontype == ACT_SKJUMP && chr->act_skjump.ground < chr->manground) {

View File

@ -1647,9 +1647,9 @@ f32 func0f02e684(struct prop *prop, f32 arg1, f32 arg2)
{
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
chrGetBbox(prop, &width, &ymax, &ymin);
chrGetBbox(prop, &radius, &ymax, &ymin);
return func0f02e550(prop, arg1, arg2, CDTYPE_ALL, ymax, ymin);
}
@ -3206,7 +3206,7 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
modelSetAnimEndFrame(model, row->endframe);
}
chr->chrwidth = 10;
chr->radius = 10;
chr->chrflags &= ~CHRCFLAG_HAS_SPECIAL_DEATH_ANIMATION;
overridden = true;
@ -5120,13 +5120,13 @@ bool func0f03645c(struct chrdata *chr, struct coord *arg1, s16 *arg2, struct coo
bool result = false;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
u32 stack[3];
s16 sp32;
s16 sp30;
struct prop *prop = chr->prop;
chrGetBbox(prop, &width, &ymax, &ymin);
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) {
@ -5149,7 +5149,7 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
bool result = false;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
struct coord sp5c;
struct coord sp50;
s16 sp40[8];
@ -5158,7 +5158,7 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
prop = chr->prop;
chrSetPerimEnabled(chr, false);
chrGetBbox(prop, &width, &ymax, &ymin);
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))) {
@ -5215,7 +5215,7 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo
bool propchrHasClearLineToPos(struct prop *prop, struct coord *dstpos, struct coord *vector)
{
return func0f03654c(prop->chr, &prop->pos, prop->rooms, dstpos, NULL, vector, prop->chr->chrwidth * 1.2f, CDTYPE_ALL);
return func0f03654c(prop->chr, &prop->pos, prop->rooms, dstpos, NULL, vector, prop->chr->radius * 1.2f, CDTYPE_ALL);
}
bool propchrHasClearLineInVector(struct prop *prop, struct coord *vector, f32 mult)
@ -5231,7 +5231,7 @@ bool propchrHasClearLineInVector(struct prop *prop, struct coord *vector, f32 mu
bool func0f036974(struct prop *prop, struct coord *pos)
{
return func0f03654c(prop->chr, &prop->pos, prop->rooms, pos, NULL, NULL, prop->chr->chrwidth * 1.2f, CDTYPE_ALL);
return func0f03654c(prop->chr, &prop->pos, prop->rooms, pos, NULL, NULL, prop->chr->radius * 1.2f, CDTYPE_ALL);
}
void chrGetSideVectorToTarget(struct chrdata *chr, bool side, struct coord *vector)
@ -5661,7 +5661,7 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st
s16 sp118[8];
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
f32 ground;
u16 floorcol;
u8 floortype;
@ -5688,7 +5688,7 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st
roomsCopy(rooms, sp118);
chr0f021fa8(chr, arg3, sp118);
ground = cdFindGroundY(arg3, chr->chrwidth, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
ground = cdFindGroundY(arg3, chr->radius, sp118, &floorcol, &floortype, 0, &floorroom, NULL, NULL);
spf4.x = arg3->x;
spf4.y = prop->pos.y - chr->ground + ground;
@ -5696,9 +5696,9 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st
roomsCopy(rooms, sp118);
chr0f021fa8(chr, &spf4, sp118);
chrGetBbox(chr->prop, &width, &ymax, &ymin);
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
if (cdTestVolume(&spf4, chr->chrwidth, sp118, CDTYPE_ALL, 1, ymax - prop->pos.y, ymin - prop->pos.y) != CDRESULT_COLLISION) {
if (cdTestVolume(&spf4, chr->radius, sp118, CDTYPE_ALL, 1, 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;
@ -6266,7 +6266,7 @@ void chrStartPatrol(struct chrdata *chr, struct path *path)
s16 rooms[8];
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
f32 bestdistance = 0;
s32 nextstep = -1;
struct prop *prop = chr->prop;
@ -6282,7 +6282,7 @@ void chrStartPatrol(struct chrdata *chr, struct path *path)
rooms[0] = pad.room;
rooms[1] = -1;
chrGetBbox(prop, &width, &ymax, &ymin);
chrGetBbox(prop, &radius, &ymax, &ymin);
chrSetPerimEnabled(chr, false);
@ -6321,7 +6321,7 @@ void chrStartPatrol(struct chrdata *chr, struct path *path)
// If chr has line of sight to the pad then begin the patrol,
// otherwise use gopos to get to the starting pad
if (func0f03654c(chr, &prop->pos, prop->rooms, &pad.pos, rooms, NULL,
chr->chrwidth * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG) != CDRESULT_COLLISION) {
chr->radius * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG) != CDRESULT_COLLISION) {
chrStopFiring(chr);
chr->actiontype = ACT_PATROL;
@ -6489,7 +6489,7 @@ bool chrCanSeeChr(struct chrdata *chr, struct chrdata *target, s16 *room)
s16 rooms[8];
pos.x = prop->pos.x;
pos.y = chr->ground + chr->chrheight - 20;
pos.y = chr->ground + chr->height - 20;
pos.z = prop->pos.z;
chrSetPerimEnabled(chr, false);
@ -6548,7 +6548,7 @@ bool chrHasLineOfSightToPos(struct chrdata *viewerchr, struct coord *pos, s16 *r
s16 viewerrooms[8];
viewerpos.x = viewerprop->pos.x;
viewerpos.y = viewerchr->ground + viewerchr->chrheight - 20;
viewerpos.y = viewerchr->ground + viewerchr->height - 20;
viewerpos.z = viewerprop->pos.z;
chrSetPerimEnabled(viewerchr, false);
@ -7371,7 +7371,7 @@ bool chrTryRunFromTarget(struct chrdata *chr)
struct prop *prop = chr->prop;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
struct coord dst;
s16 rooms[8];
struct coord diff;
@ -7397,7 +7397,7 @@ bool chrTryRunFromTarget(struct chrdata *chr)
dst.z = prop->pos.z - diff.z * 1000;
dst.y = prop->pos.y;
propGetBbox(prop, &width, &ymax, &ymin);
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,
@ -7414,8 +7414,8 @@ bool chrTryRunFromTarget(struct chrdata *chr)
}
// Adjust dst to be two chr widths closer to avoid collision with wall
dst.x = dst.x + (diff.x * width + diff.x * width);
dst.z = dst.z + (diff.z * width + diff.z * width);
dst.x = dst.x + (diff.x * radius + diff.x * radius);
dst.z = dst.z + (diff.z * radius + diff.z * radius);
if (func0f036974(prop, &dst)) {
u32 speed = SPEED_RUN;
@ -7499,17 +7499,17 @@ bool chrGoToCoverProp(struct chrdata *chr)
if (chrdist < 300 && chrdist > targetdist + targetdist && targetdist > 800) {
f32 propymax;
f32 propymin;
f32 propwidth;
f32 propradius;
f32 chrymax;
f32 chrymin;
f32 chrwidth;
f32 chrradius;
f32 propheight;
f32 chrheight;
struct coord dstpos;
s16 dstrooms[8];
propGetBbox(prop, &propwidth, &propymax, &propymin);
propGetBbox(chrprop, &chrwidth, &chrymax, &chrymin);
propGetBbox(prop, &propradius, &propymax, &propymin);
propGetBbox(chrprop, &chrradius, &chrymax, &chrymin);
propheight = propymax - propymin;
chrheight = chrymax - chrymin;
@ -7520,8 +7520,8 @@ bool chrGoToCoverProp(struct chrdata *chr)
if (cd0002dc18(&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 * (propwidth * 1.25f + chrwidth);
dstpos.z = prop->pos.z - (targetprop->pos.z - prop->pos.z) / targetdist * (propwidth * 1.25f + chrwidth);
dstpos.x = prop->pos.x - (targetprop->pos.x - prop->pos.x) / targetdist * (propradius * 1.25f + chrradius);
dstpos.z = prop->pos.z - (targetprop->pos.z - prop->pos.z) / targetdist * (propradius * 1.25f + chrradius);
dstpos.y = prop->pos.y;
if (func0f036974(chrprop, &dstpos)) {
@ -17953,7 +17953,7 @@ glabel var7f1a9184
// chrSetPerimEnabled(chr, false);
//
// if (isaibot) {
// g_Vars.unk00048c = true;
// g_Vars.useperimshoot = true;
// }
//
// if (cdTestAToB4(&gunpos, gunrooms, &hitpos, sp1c8, 0x10) == CDRESULT_COLLISION) {
@ -17965,7 +17965,7 @@ glabel var7f1a9184
// chrSetPerimEnabled(chr, true);
//
// if (isaibot) {
// g_Vars.unk00048c = false;
// g_Vars.useperimshoot = false;
// }
//
// // Eyespy is small and hard to hit, so make it a 50/50 chance
@ -20108,7 +20108,7 @@ void func0f044b68(struct coord *arg0, struct coord *arg1, struct coord *arg2)
* This is similar to chrNavCheckForObstacle. The difference between the two are
* not yet understood.
*/
bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrwidth, f32 chrwidth, s32 cdtypes, s32 arg9)
bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9)
{
struct coord spd4;
f32 spd0;
@ -20125,14 +20125,14 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
bool result = false;
f32 ymax;
f32 ymin;
f32 width2;
f32 radius2;
struct coord sp6c;
struct coord sp60;
s16 sp50[8];
s16 sp40[8];
struct prop *prop = chr->prop;
chrGetBbox(prop, &width2, &ymax, &ymin);
chrGetBbox(prop, &radius2, &ymax, &ymin);
spd4.x = aimpos->x - chrpos->x;
spd4.y = 0.0f;
@ -20146,19 +20146,19 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
spd4.x *= norm;
spd4.z *= norm;
spd0 = spd4.x * chrwidth * 0.95f;
spcc = spd4.z * chrwidth * 0.95f;
spc8 = spd4.x * chrwidth * 1.2f;
spc4 = spd4.z * chrwidth * 1.2f;
spd0 = spd4.x * chrradius * 0.95f;
spcc = spd4.z * chrradius * 0.95f;
spc8 = spd4.x * chrradius * 1.2f;
spc4 = spd4.z * chrradius * 1.2f;
chrSetPerimEnabled(chr, false);
sp6c.x = chrpos->x + spcc;
sp6c.y = chrpos->y;
sp6c.z = chrpos->z - spd0;
sp60.x = (spd4.x * negchrwidth) + (aimpos->x + spc4);
sp60.x = (spd4.x * negchrradius) + (aimpos->x + spc4);
sp60.y = aimpos->y;
sp60.z = (spd4.z * negchrwidth) + (aimpos->z - spc8);
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) {
@ -20181,9 +20181,9 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
sp6c.y = chrpos->y;
sp6c.z = chrpos->z + spd0;
sp60.x = (spd4.x * negchrwidth) + (aimpos->x - spc4);
sp60.x = (spd4.x * negchrradius) + (aimpos->x - spc4);
sp60.y = aimpos->y;
sp60.z = (spd4.z * negchrwidth) + (aimpos->z + spc8);
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) {
@ -20230,7 +20230,7 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
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, chrwidth, 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)) {
result = true;
} else {
#if VERSION >= VERSION_JPN_FINAL
@ -20265,7 +20265,7 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom
* This is similar to chrNavCanSeeNextPos. The only difference is this one uses
* the value1 and value2 variables.
*/
bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrwidth, f32 chrwidth, s32 cdtypes, bool hasobstacle)
bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle)
{
struct coord spd4;
f32 spd0;
@ -20284,14 +20284,14 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
f32 value2;
f32 ymax;
f32 ymin;
f32 width2;
f32 radius2;
struct coord sp6c;
struct coord sp60;
s16 sp50[8];
s16 sp40[8];
struct prop *prop = chr->prop;
chrGetBbox(prop, &width2, &ymax, &ymin);
chrGetBbox(prop, &radius2, &ymax, &ymin);
spd4.x = aimpos->x - chrpos->x;
spd4.y = 0.0f;
@ -20305,19 +20305,19 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
spd4.x *= norm;
spd4.z *= norm;
spd0 = spd4.x * chrwidth * 0.95f;
spcc = spd4.z * chrwidth * 0.95f;
spc8 = spd4.x * chrwidth * 1.2f;
spc4 = spd4.z * chrwidth * 1.2f;
spd0 = spd4.x * chrradius * 0.95f;
spcc = spd4.z * chrradius * 0.95f;
spc8 = spd4.x * chrradius * 1.2f;
spc4 = spd4.z * chrradius * 1.2f;
chrSetPerimEnabled(chr, false);
sp6c.x = chrpos->x + spcc;
sp6c.y = chrpos->y;
sp6c.z = chrpos->z - spd0;
sp60.x = (spd4.x * negchrwidth) + (aimpos->x + spc4);
sp60.x = (spd4.x * negchrradius) + (aimpos->x + spc4);
sp60.y = aimpos->y;
sp60.z = (spd4.z * negchrwidth) + (aimpos->z - spc8);
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) {
@ -20341,9 +20341,9 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
sp6c.y = chrpos->y;
sp6c.z = chrpos->z + spd0;
sp60.x = (spd4.x * negchrwidth) + (aimpos->x - spc4);
sp60.x = (spd4.x * negchrradius) + (aimpos->x - spc4);
sp60.y = aimpos->y;
sp60.z = (spd4.z * negchrwidth) + (aimpos->z + spc8);
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) {
@ -20398,7 +20398,7 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr
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, chrwidth, 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)) {
result = true;
} else {
#if VERSION >= VERSION_JPN_FINAL
@ -20641,7 +20641,7 @@ glabel var7f1a925c
);
// Mismatch: regalloc
//bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 width, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10)
//bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 radius, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10)
//{
// struct prop *prop = chr->prop; // 74
// struct coord sp68;
@ -20669,16 +20669,16 @@ glabel var7f1a925c
//
// if (tmp > 0) {
// norm = 1 / tmp;
// sp68.f[0] *= width * norm;
// sp68.f[2] *= width * norm;
// sp54 = width * norm;
// sp68.f[0] *= radius * norm;
// sp68.f[2] *= radius * norm;
// sp54 = radius * norm;
// } else {
// sp68.f[2] = width;
// sp54 = width * norm;
// sp68.f[2] = radius;
// sp54 = radius * norm;
// }
// } else {
// sp68.f[2] = width;
// sp54 = width * norm;
// sp68.f[2] = radius;
// sp54 = radius * norm;
// }
//
// if (sp54 > 1) {
@ -20699,7 +20699,7 @@ glabel var7f1a925c
// sp5c.y = arg1->f[1];
// sp5c.z = arg1->f[2] + sp48.f[2];
//
// if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp5c, sp44, sp40, arg8, chr->chrwidth, cdtypes, 1)) {
// if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp5c, sp44, sp40, arg8, chr->radius, cdtypes, 1)) {
// if (!arg5 || func0f03645c(chr, &prop->pos, prop->rooms, &sp5c, nextpos, cdtypes)) {
// if (arg10) {
// waydata->gotaimposobj = true;
@ -20824,7 +20824,7 @@ void chrNavTickMain(struct chrdata *chr, struct coord *nextpos, struct waydata *
// Check to see if the chr can see the next pad. This is almost
// always true, but if the chr has tried to avoid an object they
// may have gone behind a wall and can't see the pad any more.
if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp100, &waydata->obstacleleft, &waydata->obstacleright, -chr->chrwidth, chr->chrwidth, CDTYPE_PATHBLOCKER | CDTYPE_BG, arg3)) {
if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp100, &waydata->obstacleleft, &waydata->obstacleright, -chr->radius, chr->radius, CDTYPE_PATHBLOCKER | CDTYPE_BG, arg3)) {
// Can see the next pad
waydata->gotaimpos = true;
waydata->aimpos.x = sp100.x;
@ -20843,7 +20843,7 @@ void chrNavTickMain(struct chrdata *chr, struct coord *nextpos, struct waydata *
// longer see the next pad. The chr will try to get back on the
// route by navigating to either side of the obstacle they were
// trying to avoid.
f32 wantclearance = chr->chrwidth * 1.26f;
f32 wantclearance = chr->radius * 1.26f;
if (chrNavTryObstacle(chr, &waydata->obstacleleft, true, &spf4, wantclearance, true, nextpos, waydata, 0, CDTYPE_PATHBLOCKER | CDTYPE_BG, 0)) {
// Will go to left side
@ -20866,7 +20866,7 @@ void chrNavTickMain(struct chrdata *chr, struct coord *nextpos, struct waydata *
// tried to find the next pad but can't see that either. Try
// navigating to the obstacle again, but with different arguments.
// This is a more desparate attempt at returning to the path.
f32 wantclearance = chr->chrwidth * 1.26f;
f32 wantclearance = chr->radius * 1.26f;
u32 stack;
if (chrNavTryObstacle(chr, &waydata->obstacleleft, true, &spf4, wantclearance, false, NULL, waydata, 0, CDTYPE_PATHBLOCKER | CDTYPE_BG, 0)) {
@ -20908,7 +20908,7 @@ void chrNavTickMain(struct chrdata *chr, struct coord *nextpos, struct waydata *
hasobstacle = false;
}
if (chrNavCheckForObstacle(chr, &prop->pos, prop->rooms, &waydata->aimpos, &waydata->obstacleleft, &waydata->obstacleright, -chr->chrwidth, chr->chrwidth, cdtypes, hasobstacle)) {
if (chrNavCheckForObstacle(chr, &prop->pos, prop->rooms, &waydata->aimpos, &waydata->obstacleleft, &waydata->obstacleright, -chr->radius, chr->radius, cdtypes, hasobstacle)) {
// No obstacle ahead
waydata->gotaimposobj = true;
waydata->mode = WAYMODE_INIT;
@ -20931,7 +20931,7 @@ void chrNavTickMain(struct chrdata *chr, struct coord *nextpos, struct waydata *
f32 spd0;
f32 spcc;
u32 stack2;
f32 f24 = chr->chrwidth * 1.26f;
f32 f24 = chr->radius * 1.26f;
f20 = atan2f(waydata->aimpos.x - prop->pos.x, waydata->aimpos.z - prop->pos.z);
spd0 = f20 - atan2f(waydata->obstacleleft.x - prop->pos.x, waydata->obstacleleft.z - prop->pos.z);
@ -21480,7 +21480,7 @@ void chrTickGoPos(struct chrdata *chr)
}
// Some bbox related check
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->chrwidth * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->radius * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
chrGoPosAdvanceWaypoint(chr);
chrGoPosAdvanceWaypoint(chr);
}
@ -21540,13 +21540,13 @@ void chrTickGoPos(struct chrdata *chr)
// sp160 < DEG2RAD(45) || sp160 > DEG2RAD(315)
if (sp160 < 0.7852731347084f || sp160 > 5.4969120025635f) {
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->chrwidth * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->radius * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
chrGoPosAdvanceWaypoint(chr);
}
}
}
} else {
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->chrwidth * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
if (func0f03654c(chr, &prop->pos, prop->rooms, &nextpos, nextrooms, NULL, chr->radius * 1.2f, CDTYPE_PATHBLOCKER | CDTYPE_BG)) {
chrGoPosAdvanceWaypoint(chr);
}
}
@ -21664,7 +21664,7 @@ bool chrTrySkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4)
bool chrStartSkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4)
{
f32 width;
f32 radius;
f32 ymax;
f32 ymin;
struct prop *prop = chr->prop;
@ -21679,7 +21679,7 @@ bool chrStartSkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4)
return false;
}
chrGetBbox(prop, &width, &ymax, &ymin);
chrGetBbox(prop, &radius, &ymax, &ymin);
chrSetPerimEnabled(chr, false);
propSetPerimEnabled(target, false);
iVar2 = cd0002d6ac(&prop->pos, prop->rooms, &target->pos, 51, 1,
@ -21703,7 +21703,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->chrwidth, chr->prop->rooms, NULL, NULL);
chr->act_skjump.ground = cdFindGroundYSimple(&chr->prop->pos, chr->radius, chr->prop->rooms, NULL, NULL);
} else {
return false;
}
@ -25135,7 +25135,7 @@ bool chrIsPosOffScreen(struct coord *pos, s16 *rooms)
* If the spawn cannot happen, the function return false.
*/
#if VERSION >= VERSION_NTSC_1_0
bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool ignorebg, bool arg6)
bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool ignorebg, bool arg6)
{
struct coord testpos;
s32 i;
@ -25169,13 +25169,13 @@ bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, b
// 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, width, rooms, NULL, NULL);
ground = cdFindGroundYSimple(pos, chrradius, rooms, NULL, NULL);
if (ground > -100000 && ground - pos->y < -200) {
ymin = ground - pos->y;
}
if (cdTestVolume(pos, width, rooms, types, 1, ymax, ymin) != CDRESULT_COLLISION
if (cdTestVolume(pos, chrradius, rooms, types, 1, ymax, ymin) != CDRESULT_COLLISION
&& (allowonscreen || chrIsPosOffScreen(pos, rooms))) {
return true;
}
@ -25190,14 +25190,14 @@ bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, b
if ((arg6 && cd0002d840(pos, rooms, &testpos, testrooms, CDTYPE_ALL & ~CDTYPE_PLAYERS, 1, ymax, -200) != CDRESULT_COLLISION)
|| (!arg6 && cd0002deac(pos, rooms, &testpos, testrooms, CDTYPE_BG))) {
chr0f021fa8(NULL, &testpos, testrooms);
ground = cdFindGroundYSimple(&testpos, width, testrooms, 0, 0);
ground = cdFindGroundYSimple(&testpos, chrradius, testrooms, 0, 0);
ymin = -200;
if (ground > -100000 && ground - pos->y < -200) {
ymin = ground - pos->y;
}
if (cdTestVolume(&testpos, width, testrooms, CDTYPE_ALL, 1, ymax, ymin) != CDRESULT_COLLISION
if (cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, 1, ymax, ymin) != CDRESULT_COLLISION
&& (allowonscreen || chrIsPosOffScreen(&testpos, testrooms))
&& (!arg6 || ground > -100000)) {
pos->x = testpos.x;
@ -25222,7 +25222,7 @@ bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, b
* ntsc-beta's version of this function doesn't have the arg6 argument
* nor out of bounds checking, and lacks the reduction for the volume test.
*/
bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool ignorebg)
bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool ignorebg)
{
struct coord testpos;
s32 i;
@ -25237,7 +25237,7 @@ bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, b
types = CDTYPE_ALL;
}
if (cdTestVolume(pos, width, rooms, types, 1, 200, -200) != CDRESULT_COLLISION
if (cdTestVolume(pos, chrradius, rooms, types, 1, 200, -200) != CDRESULT_COLLISION
&& (allowonscreen || chrIsPosOffScreen(pos, rooms))) {
return true;
}
@ -25248,7 +25248,7 @@ bool chrAdjustPosForSpawn(f32 width, struct coord *pos, s16 *rooms, f32 angle, b
testpos.z = cosf(curangle) * 60 + pos->z;
if (cd0002deac(pos, rooms, &testpos, testrooms, CDTYPE_BG)
&& cdTestVolume(&testpos, width, testrooms, CDTYPE_ALL, 1, 200, -200.0f) != CDRESULT_COLLISION
&& cdTestVolume(&testpos, chrradius, testrooms, CDTYPE_ALL, 1, 200, -200.0f) != CDRESULT_COLLISION
&& (allowonscreen || chrIsPosOffScreen(&testpos, testrooms))) {
pos->x = testpos.x;
pos->y = testpos.y;
@ -25462,12 +25462,12 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle,
propSetPerimEnabled(chr->prop, false);
#if VERSION >= VERSION_NTSC_1_0
if (chrAdjustPosForSpawn(chr->chrwidth, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen, (chr->hidden & CHRHFLAG_00000200) != 0))
if (chrAdjustPosForSpawn(chr->radius, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen, (chr->hidden & CHRHFLAG_00000200) != 0))
#else
if (chrAdjustPosForSpawn(chr->chrwidth, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen))
if (chrAdjustPosForSpawn(chr->radius, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen))
#endif
{
ground = cdFindGroundY(&pos2, chr->chrwidth, rooms2, &chr->floorcol,
ground = cdFindGroundY(&pos2, chr->radius, rooms2, &chr->floorcol,
&chr->floortype, NULL, &chr->floorroom, NULL, NULL);
chr->ground = ground;
@ -25944,7 +25944,7 @@ bool chr0f04c874(struct chrdata *chr, u32 angle360, struct coord *pos, u8 arg3,
s32 result;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
chrpos.x = chr->prop->pos.x;
chrpos.y = chr->prop->pos.y;
@ -25969,7 +25969,7 @@ bool chr0f04c874(struct chrdata *chr, u32 angle360, struct coord *pos, u8 arg3,
pos->y = chrpos.y;
pos->z = target->pos.z + (xdiff * sine + zdiff * cosine);
chrGetBbox(chr->prop, &width, &ymax, &ymin);
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
result = cd0002d7c0(&chrpos, chr->prop->rooms, pos,
CDTYPE_BG | CDTYPE_OBJS | CDTYPE_DOORS, 1,
@ -26226,7 +26226,7 @@ Gfx *chrsRenderChrStats(Gfx *gdl, s16 *rooms)
if (chr && chr->prop && arrayIntersects(chr->prop->rooms, rooms)) {
sp20c.x = chr->prop->pos.x;
sp20c.y = chr->ground + chr->chrheight - 30;
sp20c.y = chr->ground + chr->height - 30;
sp20c.z = chr->prop->pos.z;
mtx4TransformVecInPlace(g_Vars.currentplayer->worldtoscreenmtx, &sp20c);
@ -26309,11 +26309,11 @@ void chrAvoid(struct chrdata *chr)
u32 chranimflags = 0;
f32 ymax;
f32 ymin;
f32 width;
f32 radius;
s32 cdresult = CDRESULT_NOCOLLISION;
f32 xdiff;
f32 zdiff;
f32 halfchrwidth;
f32 halfchrradius;
f32 chrangle = model0001ae44(chr->model);
s16 dstrooms[8];
struct coord dstpos;
@ -26354,9 +26354,9 @@ void chrAvoid(struct chrdata *chr)
dstpos.y = chr->prop->pos.y;
dstpos.z = chr->prop->pos.z + cosf(chrangle) * 100;
chrGetBbox(chr->prop, &width, &ymax, &ymin);
chrGetBbox(chr->prop, &radius, &ymax, &ymin);
halfchrwidth = width * 0.5f;
halfchrradius = radius * 0.5f;
func0f065e74(&chr->prop->pos, chr->prop->rooms, &dstpos, dstrooms);
chr0f021fa8(chr, &dstpos, dstrooms);
@ -26364,7 +26364,7 @@ void chrAvoid(struct chrdata *chr)
xdiff = dstpos.x - chr->prop->pos.x;
zdiff = dstpos.z - chr->prop->pos.z;
if (xdiff > halfchrwidth || zdiff > halfchrwidth || xdiff < -halfchrwidth || zdiff < -halfchrwidth) {
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);
}

View File

@ -6067,8 +6067,9 @@ bool aiIfPropPresetHeightLessThan(void)
f32 value = cmd[3] | (cmd[2] << 8);
f32 ymax;
f32 ymin;
f32 width;
propGetBbox(prop, &width, &ymax, &ymin);
f32 radius;
propGetBbox(prop, &radius, &ymax, &ymin);
if (ymax - ymin < value) {
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);

View File

@ -891,7 +891,7 @@ void explosionInflictDamage(struct prop *expprop)
f32 xdist = prop->pos.f[0] - expprop->pos.f[0];
f32 ydist = prop->pos.f[1] - expprop->pos.f[1];
f32 zdist = prop->pos.f[2] - expprop->pos.f[2];
f32 width;
f32 radius;
f32 ymax;
f32 ymin;
struct coord spcc;
@ -904,21 +904,21 @@ void explosionInflictDamage(struct prop *expprop)
if (xdist <= damageradius && xdist >= -damageradius
&& ydist <= damageradius && ydist >= -damageradius
&& zdist <= damageradius && zdist >= -damageradius) {
propGetBbox(prop, &width, &ymax, &ymin);
propGetBbox(prop, &radius, &ymax, &ymin);
width -= 20.0f;
radius -= 20.0f;
if (width <= 0.0f) {
width = 0.0f;
if (radius <= 0.0f) {
radius = 0.0f;
}
spcc.f[0] = prop->pos.f[0] - width;
spcc.f[0] = prop->pos.f[0] - radius;
spcc.f[1] = ymin;
spcc.f[2] = prop->pos.f[2] - width;
spcc.f[2] = prop->pos.f[2] - radius;
spc0.f[0] = prop->pos.f[0] + width;
spc0.f[0] = prop->pos.f[0] + radius;
spc0.f[1] = ymax;
spc0.f[2] = prop->pos.f[2] + width;
spc0.f[2] = prop->pos.f[2] + radius;
if (explosionOverlapsProp(exp, prop, &spcc, &spc0)) {
candamage = true;

View File

@ -790,16 +790,16 @@ bool scenarioHighlightProp(struct prop *prop, s32 *colour)
*
* CTC uses this to ensure the chrs spawn near their base.
*/
f32 scenarioChooseSpawnLocation(f32 arg0, struct coord *pos, s16 *rooms, struct prop *prop)
f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop)
{
f32 result;
if (g_Vars.normmplayerisrunning && g_MpScenarios[g_MpSetup.scenario].spawnfunc &&
g_MpScenarios[g_MpSetup.scenario].spawnfunc(arg0, pos, rooms, prop, &result)) {
g_MpScenarios[g_MpSetup.scenario].spawnfunc(chrradius, pos, rooms, prop, &result)) {
return result;
}
return playerChooseGeneralSpawnLocation(arg0, pos, rooms, prop);
return playerChooseGeneralSpawnLocation(chrradius, pos, rooms, prop);
}
/**

View File

@ -210,7 +210,7 @@ s32 g_NumDeathAnimations = 0;
* @dangerous: If there are too many pads (24+) in the setup then array
* overflows may occur.
*/
f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *pads, s32 numpads)
f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *pads, s32 numpads)
{
u8 verybadpads[24];
u8 badpads[24];
@ -329,12 +329,12 @@ f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms,
slangles[sllen] = atan2f(pad.look.x, pad.look.z);
#if VERSION >= VERSION_NTSC_1_0
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
slpadindexes[sllen] = p;
sllen++;
}
#else
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
slpadindexes[sllen] = p;
sllen++;
}
@ -368,12 +368,12 @@ f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms,
slangles[sllen] = atan2f(pad.look.x, pad.look.z);
#if VERSION >= VERSION_NTSC_1_0
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
slpadindexes[sllen] = p;
sllen++;
}
#else
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
slpadindexes[sllen] = p;
sllen++;
}
@ -429,12 +429,12 @@ f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms,
slangles[sllen] = atan2f(pad.look.x, pad.look.z);
#if VERSION >= VERSION_NTSC_1_0
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false, false)) {
slpadindexes[sllen] = i;
sllen++;
}
#else
if (chrAdjustPosForSpawn(chrwidth, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
if (chrAdjustPosForSpawn(chrradius, &slpositions[sllen], slrooms[sllen], slangles[sllen], true, false)) {
slpadindexes[sllen] = i;
sllen++;
}
@ -471,9 +471,9 @@ f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms,
return dstangle;
}
f32 playerChooseGeneralSpawnLocation(f32 chrwidth, struct coord *pos, s16 *rooms, struct prop *prop)
f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop)
{
return playerChooseSpawnLocation(chrwidth, pos, rooms, prop, g_SpawnPoints, g_NumSpawnPoints);
return playerChooseSpawnLocation(chrradius, pos, rooms, prop, g_SpawnPoints, g_NumSpawnPoints);
}
void playerStartNewLife(void)
@ -694,7 +694,7 @@ void playerLoadDefaults(void)
g_Vars.currentplayer->periminfo.ymin = 0;
g_Vars.currentplayer->periminfo.x = 0;
g_Vars.currentplayer->periminfo.z = 0;
g_Vars.currentplayer->periminfo.width = 0;
g_Vars.currentplayer->periminfo.radius = 0;
g_Vars.currentplayer->bondactivateorreload = false;
g_Vars.currentplayer->isdead = false;
@ -814,7 +814,7 @@ bool playerSpawnAnti(struct chrdata *hostchr, bool force)
hostchr->chrflags |= CHRCFLAG_PERIMDISABLEDTMP;
playerchr->hidden |= CHRHFLAG_00100000;
playerchr->chrwidth = hostchr->chrwidth;
playerchr->radius = hostchr->radius;
if (chrMoveToPos(playerchr, &hostchr->prop->pos, hostchr->prop->rooms, chrGetInverseTheta(hostchr), false) || force) {
if (hostchr->weapons_held[0] && hostchr->weapons_held[1]) {
@ -903,8 +903,8 @@ bool playerSpawnAnti(struct chrdata *hostchr, bool force)
playerrootrwdata->chrinfo.unk24.y = 10;
}
playerchr->chrwidth = hostchr->chrwidth;
g_Vars.currentplayer->bond2.width = hostchr->chrwidth;
playerchr->radius = hostchr->radius;
g_Vars.currentplayer->bond2.radius = hostchr->radius;
chrRemove(hostprop, true);
propDeregisterRooms(hostprop);
@ -1121,7 +1121,7 @@ void playerResetBond(struct playerbond *pb, struct coord *pos)
pb->unk00.y = 0;
pb->unk00.z = 1;
pb->width = 30;
pb->radius = 30;
}
void playersTickAllChrBodies(void)
@ -1469,7 +1469,7 @@ void playerTickChrBody(void)
chr->headnum = headnum;
chr->bodynum = bodynum;
chr->race = bodyGetRace(chr->bodynum);
chr->chrwidth = g_Vars.currentplayer->bond2.width;
chr->radius = g_Vars.currentplayer->bond2.radius;
g_Vars.currentplayer->vv_eyeheight = (s32)g_HeadsAndBodies[bodynum].height;
@ -5675,9 +5675,9 @@ bool playerUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
if (g_Vars.players[playernum]->bondperimenabled
&& (!g_Vars.mplayerisrunning || !g_Vars.players[playernum]->isdead)) {
if (g_Vars.unk00048c) {
if (g_Vars.useperimshoot) {
g_Vars.players[playernum]->perimshoot = g_Vars.players[playernum]->periminfo;
g_Vars.players[playernum]->perimshoot.width = 15;
g_Vars.players[playernum]->perimshoot.radius = 15;
*start = (void *) &g_Vars.players[playernum]->perimshoot;
} else {
@ -5716,7 +5716,7 @@ void playerUpdatePerimInfo(void)
g_Vars.currentplayer->periminfo.x = g_Vars.currentplayer->prop->pos.x;
g_Vars.currentplayer->periminfo.z = g_Vars.currentplayer->prop->pos.z;
g_Vars.currentplayer->periminfo.width = g_Vars.currentplayer->bond2.width;
g_Vars.currentplayer->periminfo.radius = g_Vars.currentplayer->bond2.radius;
}
/**
@ -5728,11 +5728,11 @@ void playerUpdatePerimInfo(void)
* ymax is the top of the head, minus some if crouching, and always at least 80
* units above the feet.
*/
void playerGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin)
void playerGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin)
{
s32 playernum = playermgrGetPlayerNumByProp(prop);
*width = g_Vars.players[playernum]->bond2.width;
*radius = g_Vars.players[playernum]->bond2.radius;
*ymin = g_Vars.currentplayer->vv_manground + 30;
*ymax = g_Vars.currentplayer->vv_manground + g_Vars.players[playernum]->vv_headheight;

View File

@ -243,7 +243,7 @@ void playermgrAllocatePlayer(s32 index)
g_Vars.players[index]->periminfo.ymin = 0;
g_Vars.players[index]->periminfo.x = 0;
g_Vars.players[index]->periminfo.z = 0;
g_Vars.players[index]->periminfo.width = 0;
g_Vars.players[index]->periminfo.radius = 0;
g_Vars.players[index]->bondactivateorreload = 0;
g_Vars.players[index]->model00d4 = 0;

View File

@ -7183,16 +7183,16 @@ void func0f0661fc(void)
// empty
}
void propGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin)
void propGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin)
{
if (prop->type == PROPTYPE_CHR) {
chrGetBbox(prop, width, ymax, ymin);
chrGetBbox(prop, radius, ymax, ymin);
} else if (prop->type == PROPTYPE_PLAYER) {
playerGetBbox(prop, width, ymax, ymin);
playerGetBbox(prop, radius, ymax, ymin);
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) {
propObjGetBbox(prop, width, ymax, ymin);
propObjGetBbox(prop, radius, ymax, ymin);
} else {
*width = 0;
*radius = 0;
*ymin = 0;
*ymax = 0;
}

View File

@ -3977,7 +3977,7 @@ void func0f069850(struct defaultobj *obj, struct coord *pos, f32 rot[3][3], stru
tile->x = pos->x;
tile->z = pos->z;
tile->width = 90.0f;
tile->radius = 90.0f;
} else {
if (rodata19 != NULL) {
func0f0674bc(rodata19, bbox, &mtx, (struct tiletype2 *)tile);
@ -6027,7 +6027,7 @@ bool func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
sp200 = true;
if (g_Vars.normmplayerisrunning) {
g_Vars.unk00048c = true;
g_Vars.useperimshoot = true;
}
g_EmbedProp = 0;
@ -6150,7 +6150,7 @@ bool func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
}
if (g_Vars.normmplayerisrunning) {
g_Vars.unk00048c = false;
g_Vars.useperimshoot = false;
}
return sp200;
@ -14591,7 +14591,7 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3
func0f069850(obj, &pos, sp460, &tile);
if (obj->flags3 & OBJFLAG3_GEOTYPE3) {
cdresult = cd0002a6fc(&prop->pos, &pos, tile.width, rooms, CDTYPE_ALL, true, tile.ymax - pos.y, tile.ymin - pos.y);
cdresult = cd0002a6fc(&prop->pos, &pos, tile.radius, rooms, CDTYPE_ALL, true, tile.ymax - pos.y, tile.ymin - pos.y);
} else {
cdresult = cd0002f02c((struct tiletype2 *)&tile, rooms, CDTYPE_ALL);
}
@ -55184,22 +55184,22 @@ bool objUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
return false;
}
void propObjGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin)
void propObjGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin)
{
struct defaultobj *obj = prop->obj;
if (obj->unkgeo && obj->hidden2 & OBJH2FLAG_08) {
if (obj->flags3 & OBJFLAG3_GEOTYPE3) {
*width = obj->geo3->width;
*radius = obj->geo3->radius;
*ymin = obj->geo3->ymin;
*ymax = obj->geo3->ymax;
} else {
*width = model0001af80(obj->model);
*radius = model0001af80(obj->model);
*ymin = obj->geo2->ymin;
*ymax = obj->geo2->ymax;
}
} else {
*width = 1;
*radius = 1;
*ymin = 0;
*ymax = 0;
}

View File

@ -95,6 +95,6 @@ struct prop *chrGetHeldProp(struct chrdata *chr, s32 hand);
struct prop *chrGetHeldUsableProp(struct chrdata *chr, s32 hand);
struct prop *chrGetTargetProp(struct chrdata *chr);
bool chrUpdateGeometry(struct prop *prop, u8 **start, u8 **end);
void chrGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin);
void chrGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin);
#endif

View File

@ -166,9 +166,9 @@ bool posIsArrivingLaterallyAtPos(struct coord *prevpos, struct coord *curpos, st
bool posIsArrivingAtPos(struct coord *prevpos, struct coord *curpos, struct coord *targetpos, f32 range);
void chrTickRunPos(struct chrdata *chr);
void func0f044b68(struct coord *arg0, struct coord *arg1, struct coord *arg2);
bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *aimpos, struct coord *arg4, struct coord *arg5, f32 negwidth, f32 width, s32 cdtypes, s32 arg9);
bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrwidth, f32 chrwidth, s32 cdtypes, bool hasobstacle);
bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 width, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10);
bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *aimpos, struct coord *arg4, struct coord *arg5, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9);
bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle);
bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 radius, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10);
struct prop *chrOpenDoor(struct chrdata *chr, struct coord *coord);
void chrNavTickMain(struct chrdata *chr, struct coord *pos, struct waydata *waydata, bool arg3);
bool chrGoPosUpdateLiftAction(struct chrdata *chr, u32 curpadflags, bool arg2, bool arrivingatlift, s16 curpadnum, s32 nextpadnum);
@ -206,9 +206,9 @@ bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr);
bool chrIsPosOffScreen(struct coord *pos, s16 *rooms);
#if VERSION >= VERSION_NTSC_1_0
bool chrAdjustPosForSpawn(f32 chrwidth, struct coord *pos, s16 *rooms, f32 angle, bool arg4, bool arg5, bool arg6);
bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool arg4, bool arg5, bool arg6);
#else
bool chrAdjustPosForSpawn(f32 chrwidth, struct coord *pos, s16 *rooms, f32 angle, bool arg4, bool arg5);
bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool arg4, bool arg5);
#endif
struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, s16 *room, f32 angle, u8 *ailist, u32 spawnflags);

View File

@ -26,7 +26,7 @@ void scenarioTick(void);
void scenarioTickChr(struct chrdata *chr);
Gfx *scenarioRadarExtra(Gfx *gdl);
bool scenarioRadarChr(Gfx **gdl, struct prop *prop);
f32 scenarioChooseSpawnLocation(f32 arg0, struct coord *pos, s16 *rooms, struct prop *prop);
f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop);
s32 scenarioGetMaxTeams(void);
void scenarioHighlightRoom(s16 room, s32 *arg1, s32 *arg2, s32 *arg3);

View File

@ -4,8 +4,8 @@
#include "data.h"
#include "types.h"
f32 playerChooseSpawnLocation(f32 chrwidth, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *spawnpads, s32 numspawnpads);
f32 playerChooseGeneralSpawnLocation(f32 chrwidth, struct coord *pos, s16 *rooms, struct prop *prop);
f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *spawnpads, s32 numspawnpads);
f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop);
void playerStartNewLife(void);
void playerLoadDefaults(void);
bool playerSpawnAnti(struct chrdata *chr, s32 param_2);
@ -70,7 +70,7 @@ void playersClearMemCamRoom(void);
void playerSetPerimEnabled(struct prop *prop, bool enable);
bool playerUpdateGeometry(struct prop *prop, u8 **start, u8 **end);
void playerUpdatePerimInfo(void);
void playerGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin);
void playerGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin);
f32 playerGetHealthFrac(void);
f32 playerGetShieldFrac(void);
void playerSetShieldFrac(f32 frac);

View File

@ -58,7 +58,7 @@ void func0f065e74(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newr
void func0f065e98(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2);
void roomGetProps(s16 *room, s16 *propnums, s32 len);
void propsDefragRoomProps(void);
void propGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin);
void propGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin);
bool propUpdateGeometry(struct prop *prop, u8 **start, u8 **end);
#endif

View File

@ -243,7 +243,7 @@ bool currentPlayerTryMountHoverbike(struct prop *prop);
bool propobjInteract(struct prop *prop);
void objSetPerimEnabled(struct prop *prop, bool enable);
bool objUpdateGeometry(struct prop *prop, u8 **start, u8 **end);
void propObjGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin);
void propObjGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin);
void ammotypeGetPickedUpText(char *dst);
void ammotypeGetDeterminer(char *dst, s32 ammotype, s32 qty);
void ammotypeGetPickupName(char *dst, s32 ammotype, s32 qty);

View File

@ -47,11 +47,11 @@ void cdGetPropsOnPlatform(struct prop *platform, s16 *propnums, s32 len);
bool cd00026a04(struct coord *pos, u8 *start, u8 *end, u16 flags, s32 room, struct tile **tileptr, s32 *roomptr, f32 *groundptr, bool arg8);
void cd00026e7c(struct coord *pos, s16 *rooms, u16 arg2, struct tile **tileptr, s16 *room, f32 *arg5, struct prop **arg6, s32 arg7);
bool cd0002709c(struct tiletype0 *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collisionthing *thing);
bool cd000272f8(struct tiletype1 *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collisionthing *thing);
bool cd000272f8(struct tiletype1 *tile, f32 x, f32 z, f32 radius, struct prop *prop, struct collisionthing *thing);
s32 cd000274e0(struct tiletype2 *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collisionthing *thing);
bool cd000276c8(struct tiletype3 *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collisionthing *thing);
void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags, bool checkvertical, f32 arg6, f32 arg7, struct prop *prop, struct collisionthing *things, s32 maxthings, s32 *thingnum, s32 roomnum);
void cd00027d1c(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u32 arg5, f32 arg6, f32 arg7, struct collisionthing *arg8, s32 arg9);
void cd00027d1c(struct coord *pos, f32 radius, s16 *rooms, u32 types, u16 arg4, u32 arg5, f32 arg6, f32 arg7, struct collisionthing *arg8, s32 arg9);
u32 cd00027f78(void);
s32 cd00028200(struct tiletype0 *tile, struct coord *pos, f32 width, f32 y1, f32 y2);
u32 cd0002840c(void);
@ -62,8 +62,8 @@ void cd00028df0(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u
void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisionthing *arg3);
f32 cd000296a0(struct collisionthing *arg0, struct coord *pos, struct tilething **arg2, f32 width);
bool cd00029ffc(struct coord *pos, f32 width, f32 foreheadheight, f32 inversefeettoeyesheight, s16 *rooms, u16 arg5, struct coord *laddernormal);
bool cd0002a13c(struct coord *pos, f32 width, f32 arg2, f32 arg3, s16 *rooms, u16 arg5);
f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift);
bool cd0002a13c(struct coord *pos, f32 radius, f32 arg2, f32 arg3, s16 *rooms, u16 arg5);
f32 cdFindGroundY(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift);
f32 cd0002a324(void);
f32 cdFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype);
f32 cd0002a36c(struct coord *coord, s16 *rooms, u16 *floorcol, u8 *floortype);
@ -78,7 +78,7 @@ s16 cd0002a440(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr);
s16 cd0002a4d0(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr);
s32 cd0002a564(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, struct coord *arg4, struct prop **propptr);
s32 cd0002a5e4(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, u16 *arg4, struct coord *arg5);
s32 cdTestVolume(struct coord *pos, f32 width, s16 *rooms, s32 types, s32 arg4, f32 ymax, f32 ymin);
s32 cdTestVolume(struct coord *pos, f32 radius, s16 *rooms, s32 types, s32 arg4, f32 ymax, f32 ymin);
s32 cd0002a6fc(struct coord *pos, struct coord *pos2, f32 width, s16 *rooms, s32 types, bool arg5, f32 arg6, f32 arg7);
s32 cdTestAToB1(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg5, f32 ymax, f32 ymin);
u32 cd0002aac0(void);

View File

@ -194,7 +194,7 @@ struct g_vars {
/*000482*/ u16 language;
/*000484*/ s32 mphilltime;
/*000488*/ s32 totalkills;
/*00048c*/ bool unk00048c;
/*00048c*/ bool useperimshoot;
/*000490*/ s32 mpsetupmenu;
/*000494*/ s8 waitingtojoin[4];
/*000498*/ s32 unk000498;
@ -885,7 +885,7 @@ struct tiletype3 {
/*0x08*/ f32 ymin;
/*0x0c*/ f32 x;
/*0x10*/ f32 z;
/*0x14*/ f32 width; // radius
/*0x14*/ f32 radius;
};
struct tilething {
@ -1135,8 +1135,8 @@ struct chrdata {
/*0x018*/ u32 chrflags;
/*0x01c*/ struct prop *prop;
/*0x020*/ struct model *model;
/*0x024*/ f32 chrwidth;
/*0x028*/ f32 chrheight;
/*0x024*/ f32 radius;
/*0x028*/ f32 height;
union {
struct act_stand act_stand;
@ -2025,7 +2025,7 @@ struct playerbond {
// unk00.z = look vector z (-1 to +1)
/*0x0338 0x036c*/ struct coord unk00;
/*0x0344 0x0378*/ f32 width; // always 30?
/*0x0344 0x0378*/ f32 radius; // always 30?
/*0x0348 0x037c*/ struct coord unk10;

View File

@ -862,7 +862,7 @@ bool cdIs2dPointInTileType3(struct tiletype3 *tile, f32 x, f32 z)
f32 xdiff = x - tile->x;
f32 zdiff = z - tile->z;
return xdiff * xdiff + zdiff * zdiff <= tile->width * tile->width;
return xdiff * xdiff + zdiff * zdiff <= tile->radius * tile->radius;
}
bool func000266a4(f32 x, f32 z, struct tile *tile)
@ -1143,7 +1143,7 @@ bool cd0002709c(struct tiletype0 *tile, f32 x, f32 z, f32 width, struct prop *pr
return result;
}
bool cd000272f8(struct tiletype1 *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collisionthing *thing)
bool cd000272f8(struct tiletype1 *tile, f32 x, f32 z, f32 radius, struct prop *prop, struct collisionthing *thing)
{
bool result = false;
@ -1164,9 +1164,9 @@ bool cd000272f8(struct tiletype1 *tile, f32 x, f32 z, f32 width, struct prop *pr
value = -value;
}
if (value <= width
&& (cd00025724(tile->vertices[i].x, tile->vertices[i].z, x, z) <= width
|| cd00025724(tile->vertices[next].x, tile->vertices[next].z, x, z) <= width
if (value <= radius
&& (cd00025724(tile->vertices[i].x, tile->vertices[i].z, x, z) <= radius
|| cd00025724(tile->vertices[next].x, tile->vertices[next].z, x, z) <= radius
|| cd00025774(tile->vertices[i].x, tile->vertices[i].z, tile->vertices[next].x, tile->vertices[next].z, x, z))) {
thing->tile = &tile->header;
thing->unk08 = i;
@ -1231,7 +1231,7 @@ bool cd000276c8(struct tiletype3 *tile, f32 x, f32 z, f32 width, struct prop *pr
f32 sumx = x - tile->x;
f32 sumz = z - tile->z;
f32 sumwidth = tile->width + width;
f32 sumwidth = tile->radius + width;
if (sumx * sumx + sumz * sumz <= sumwidth * sumwidth) {
result = true;
@ -1246,7 +1246,7 @@ bool cd000276c8(struct tiletype3 *tile, f32 x, f32 z, f32 width, struct prop *pr
return result;
}
void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
void cd00027738(struct coord *pos, f32 radius, u8 *start, u8 *end, u16 flags,
bool checkvertical, f32 arg6, f32 arg7, struct prop *prop,
struct collisionthing *things, s32 maxthings, s32 *thingnum, s32 roomnum)
{
@ -1258,20 +1258,20 @@ void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
struct tiletype0 *type0 = (struct tiletype0 *) tile;
if ((tile->flags & flags)
&& pos->x >= *(s16 *)(type0->xmin + (u32)type0) - width
&& pos->x <= *(s16 *)(type0->xmax + (u32)type0) + width
&& pos->z >= *(s16 *)(type0->zmin + (u32)type0) - width
&& pos->z <= *(s16 *)(type0->zmax + (u32)type0) + width
&& pos->x >= *(s16 *)(type0->xmin + (u32)type0) - radius
&& pos->x <= *(s16 *)(type0->xmax + (u32)type0) + radius
&& pos->z >= *(s16 *)(type0->zmin + (u32)type0) - radius
&& pos->z <= *(s16 *)(type0->zmax + (u32)type0) + radius
&& (!checkvertical || (pos->y + arg6 >= *(s16 *)(type0->ymin + (u32)type0)
&& pos->y + arg7 <= *(s16 *)(type0->ymax + (u32)type0)))) {
if (tile->flags & TILEFLAG_0080) {
result = cd00028200(type0, pos, width, pos->y + arg7, pos->y + arg6);
result = cd00028200(type0, pos, radius, pos->y + arg7, pos->y + arg6);
} else {
result = 1;
}
if (result != 0) {
if (cd0002709c(type0, pos->x, pos->z, width, prop, &things[*thingnum])) {
if (cd0002709c(type0, pos->x, pos->z, radius, prop, &things[*thingnum])) {
things[*thingnum].roomnum = roomnum;
*thingnum = *thingnum + 1;
@ -1288,13 +1288,13 @@ void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
s32 tmp = 0x40;
if ((tile->flags & flags)
&& pos->x >= *(f32 *)((u32)type1 + type1->xmin * 0xc + 0x10) - width
&& pos->x <= *(f32 *)((u32)type1 + type1->xmax * 0xc + 0x10) + width
&& pos->z >= *(f32 *)((u32)type1 + type1->zmin * 0xc + 0x18) - width
&& pos->z <= *(f32 *)((u32)type1 + type1->zmax * 0xc + 0x18) + width
&& pos->x >= *(f32 *)((u32)type1 + type1->xmin * 0xc + 0x10) - radius
&& pos->x <= *(f32 *)((u32)type1 + type1->xmax * 0xc + 0x10) + radius
&& pos->z >= *(f32 *)((u32)type1 + type1->zmin * 0xc + 0x18) - radius
&& pos->z <= *(f32 *)((u32)type1 + type1->zmax * 0xc + 0x18) + radius
&& (!checkvertical || (pos->y + arg6 >= *(f32*)((u32)type1 + type1->ymin * 0xc + 0x14)
&& pos->y + arg7 <= *(f32 *)((u32)type1 + type1->ymax * 0xc + 0x14)))) {
result = cd000272f8(type1, pos->x, pos->z, width, prop, &things[*thingnum]);
result = cd000272f8(type1, pos->x, pos->z, radius, prop, &things[*thingnum]);
if (result != 0) {
things[*thingnum].roomnum = roomnum;
@ -1313,7 +1313,7 @@ void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
if ((flags & (TILEFLAG_0004 | TILEFLAG_0008 | TILEFLAG_0010))
&& (!checkvertical || (pos->y + arg6 >= tile2->ymin
&& pos->y + arg7 <= tile2->ymax))) {
result = cd000274e0(tile2, pos->x, pos->z, width, prop, &things[*thingnum]);
result = cd000274e0(tile2, pos->x, pos->z, radius, prop, &things[*thingnum]);
if (result) {
things[*thingnum].roomnum = roomnum;
@ -1332,7 +1332,7 @@ void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
if ((flags & tile->flags)
&& (!checkvertical || (pos->y + arg6 >= tile3->ymin
&& pos->y + arg7 <= tile3->ymax))) {
result = cd000276c8(tile3, pos->x, pos->z, width, prop, &things[*thingnum]);
result = cd000276c8(tile3, pos->x, pos->z, radius, prop, &things[*thingnum]);
if (result) {
things[*thingnum].roomnum = roomnum;
@ -1349,7 +1349,7 @@ void cd00027738(struct coord *pos, f32 width, u8 *start, u8 *end, u16 flags,
}
}
void cd00027d1c(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u32 arg5, f32 arg6, f32 arg7, struct collisionthing *arg8, s32 arg9)
void cd00027d1c(struct coord *pos, f32 radius, s16 *rooms, u32 types, u16 arg4, u32 arg5, f32 arg6, f32 arg7, struct collisionthing *arg8, s32 arg9)
{
s16 *roomptr;
s32 roomnum;
@ -1369,7 +1369,7 @@ void cd00027d1c(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u
start = g_TileFileData.u8 + g_TileRooms[roomnum];
end = g_TileFileData.u8 + g_TileRooms[roomnum + 1];
cd00027738(pos, width, start, end, arg4, arg5, arg6, arg7, NULL, arg8, arg9, &sp294, roomnum);
cd00027738(pos, radius, start, end, arg4, arg5, arg6, arg7, NULL, arg8, arg9, &sp294, roomnum);
if (sp294 >= arg9) {
goto end;
@ -1389,7 +1389,7 @@ void cd00027d1c(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u
struct prop *prop = &g_Vars.props[*propnumptr];
if (propIsOfCdType(prop, types) && propUpdateGeometry(prop, &start, &end)) {
cd00027738(pos, width, start, end, arg4, arg5, arg6, arg7, prop, arg8, arg9, &sp294, prop->rooms[0]);
cd00027738(pos, radius, start, end, arg4, arg5, arg6, arg7, prop, arg8, arg9, &sp294, prop->rooms[0]);
if (sp294 >= arg9) {
break;
@ -4121,12 +4121,12 @@ bool cd00029ffc(struct coord *pos, f32 width, f32 foreheadheight, f32 inversefee
return false;
}
bool cd0002a13c(struct coord *pos, f32 width, f32 arg2, f32 arg3, s16 *rooms, u16 arg5)
bool cd0002a13c(struct coord *pos, f32 radius, f32 arg2, f32 arg3, s16 *rooms, u16 arg5)
{
u32 stack[5];
struct collisionthing thing;
cd00027d1c(pos, width, rooms, CDTYPE_BG, arg5, 1, arg2, arg3, &thing, 1);
cd00027d1c(pos, radius, rooms, CDTYPE_BG, arg5, 1, arg2, arg3, &thing, 1);
if (thing.tile) {
return true;
@ -4135,7 +4135,7 @@ bool cd0002a13c(struct coord *pos, f32 width, f32 arg2, f32 arg3, s16 *rooms, u1
return false;
}
f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol,
f32 cdFindGroundY(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol,
u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift)
{
struct collisionthing cdthings[21];
@ -4143,8 +4143,8 @@ f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol,
f32 ground;
struct tile *tile = NULL;
cd00027d1c(pos, width, rooms, CDTYPE_ALL, 3, 0, 0, 0, cdthings, 20);
ground = cd000296a0(cdthings, pos, &sp72, width);
cd00027d1c(pos, radius, rooms, CDTYPE_ALL, 3, 0, 0, 0, cdthings, 20);
ground = cd000296a0(cdthings, pos, &sp72, radius);
if (sp72) {
tile = sp72->tile;
@ -8127,7 +8127,7 @@ s32 cd0002e278(u8 *start, u8 *end, struct tiletype2 *ref, u16 flags)
if ((flags & tile->flags)
&& tile3->ymax >= ref->ymin
&& tile3->ymin <= ref->ymax
&& cd000274e0(ref, tile3->x, tile3->z, tile3->width, NULL, NULL)) {
&& cd000274e0(ref, tile3->x, tile3->z, tile3->radius, NULL, NULL)) {
return false;
}

View File

@ -53,7 +53,7 @@ void varsInit(void)
g_Vars.perfectbuddynum = 0;
g_Vars.enableslopes = false;
g_Vars.restartlevel = 0;
g_Vars.unk00048c = 0;
g_Vars.useperimshoot = false;
g_Vars.mpsetupmenu = 0;
g_Vars.waitingtojoin[0] = false;
g_Vars.waitingtojoin[1] = false;