From aaec2853bde36f212f238fdcca47f351249e9e25 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 13 Jan 2021 17:31:36 +1000 Subject: [PATCH] Introduce CDTYPE constants and rename some symbols relating to collision detection --- src/game/bondbike.c | 20 +++--- src/game/bondeyespy.c | 24 +++---- src/game/bondgrab.c | 4 +- src/game/bondmove.c | 2 +- src/game/bondwalk.c | 112 +++++++++++++++++-------------- src/game/chr/chr.c | 28 ++++---- src/game/chr/chraction.c | 34 +++++----- src/game/game_011110.c | 4 +- src/game/game_02cde0.c | 4 +- src/game/game_0b63b0.c | 4 +- src/game/propobj.c | 36 +++++----- src/include/constants.h | 8 +++ src/include/game/bondwalk.h | 14 ++-- src/include/game/chr/chraction.h | 2 +- src/include/lib/lib_233c0.h | 20 +++--- src/lib/lib_233c0.c | 26 +++---- 16 files changed, 180 insertions(+), 162 deletions(-) diff --git a/src/game/bondbike.c b/src/game/bondbike.c index a0e54aa81..131fdf4c1 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -123,7 +123,7 @@ void currentPlayerTryBikeDismountAngle(f32 relativeangle, f32 distance) f32 angle; struct coord pos; s16 rooms[8]; - s32 usable; + s32 result; f32 ymax; f32 ymin; f32 width; @@ -152,20 +152,20 @@ void currentPlayerTryBikeDismountAngle(f32 relativeangle, f32 distance) func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &pos, rooms); func0f0cb79c(g_Vars.currentplayer, &pos, rooms); - usable = func0002d72c(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, - &pos, rooms, 0x3f, true, + result = cdTestAToB2(&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); propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, true); - if (usable == true) { - usable = func0002a684(&pos, width, rooms, 0x3f, true, + if (result == CDRESULT_NOCOLLISION) { + result = cdTestVolume(&pos, width, rooms, CDTYPE_ALL, true, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); } - if (usable == true) { + if (result == CDRESULT_NOCOLLISION) { g_Vars.currentplayer->walkinitmove = true; g_Vars.currentplayer->walkinitpos.x = pos.x; @@ -1022,7 +1022,7 @@ glabel var7f1adb7c /* f0d3070: 46005201 */ sub.s $f8,$f10,$f0 /* f0d3074: e7a6001c */ swc1 $f6,0x1c($sp) /* f0d3078: 27a70118 */ addiu $a3,$sp,0x118 -/* f0d307c: 0c00b657 */ jal func0002d95c +/* f0d307c: 0c00b657 */ jal cdTestAToB3 /* f0d3080: e7a80020 */ swc1 $f8,0x20($sp) /* f0d3084: 24010001 */ addiu $at,$zero,0x1 /* f0d3088: 14410024 */ bne $v0,$at,.L0f0d311c @@ -1043,7 +1043,7 @@ glabel var7f1adb7c /* f0d30c4: 46002181 */ sub.s $f6,$f4,$f0 /* f0d30c8: e7b20018 */ swc1 $f18,0x18($sp) /* f0d30cc: 24440008 */ addiu $a0,$v0,0x8 -/* f0d30d0: 0c00aa7c */ jal func0002a9f0 +/* f0d30d0: 0c00aa7c */ jal cdTestAToB1 /* f0d30d4: e7a6001c */ swc1 $f6,0x1c($sp) /* f0d30d8: 10000010 */ b .L0f0d311c /* f0d30dc: afa20134 */ sw $v0,0x134($sp) @@ -1060,7 +1060,7 @@ glabel var7f1adb7c /* f0d3104: 46008481 */ sub.s $f18,$f16,$f0 /* f0d3108: e7a80018 */ swc1 $f8,0x18($sp) /* f0d310c: 27a700a8 */ addiu $a3,$sp,0xa8 -/* f0d3110: 0c00aa7c */ jal func0002a9f0 +/* f0d3110: 0c00aa7c */ jal cdTestAToB1 /* f0d3114: e7b2001c */ swc1 $f18,0x1c($sp) /* f0d3118: afa20134 */ sw $v0,0x134($sp) .L0f0d311c: @@ -1352,7 +1352,7 @@ glabel var7f1adb84 /* f0d3528: afab001c */ sw $t3,0x1c($sp) /* f0d352c: 2447161a */ addiu $a3,$v0,0x161a /* f0d3530: 24640008 */ addiu $a0,$v1,0x8 -/* f0d3534: 0c00a86c */ jal coordFindGroundY +/* f0d3534: 0c00a86c */ jal cdFindGroundY /* f0d3538: 24660028 */ addiu $a2,$v1,0x28 /* f0d353c: 3c017f1b */ lui $at,%hi(var7f1adb84) /* f0d3540: c42cdb84 */ lwc1 $f12,%lo(var7f1adb84)($at) diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 6ec55aaa3..3297e2998 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -67,7 +67,7 @@ f32 eyespyFindGround(s16 *floorroom) pos.y = prop->pos.y + yoffset; pos.z = prop->pos.z; - ground = coordFindGroundY(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift); + ground = cdFindGroundY(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift); if (ground < -30000) { ground = -30000; @@ -83,7 +83,7 @@ s32 eyespyCalculateNewY(f32 yvel) struct chrdata *chr = prop->chr; struct coord dstpos; s16 dstrooms[8]; - s32 sp4c; + s32 types; u32 stack; f32 f0; u32 stack2; @@ -92,7 +92,7 @@ s32 eyespyCalculateNewY(f32 yvel) dstpos.y = prop->pos.y + yvel; dstpos.z = prop->pos.z; - sp4c = g_Vars.bondcollisions ? 63 : 32; + types = g_Vars.bondcollisions ? CDTYPE_ALL : CDTYPE_BG; // Allow eyespy to go up steps 30cm or less if (chr->manground + 30 >= g_Vars.currentplayer->eyespy->oldground) { @@ -107,7 +107,7 @@ s32 eyespyCalculateNewY(f32 yvel) f0 -= 0.1f; - result = func0002a684(&dstpos, 26, dstrooms, sp4c, 1, 15, f0); + result = cdTestVolume(&dstpos, 26, dstrooms, types, 1, 15, f0); propSetCollisionsEnabled(prop, true); if (result == CDRESULT_NOCOLLISION) { @@ -128,7 +128,7 @@ s32 eyespyCalculateNewPosition(struct coord *vel) s16 dstrooms[8]; s16 floorroom; s16 sp74[24]; - s32 sp70; + s32 types; s32 i; f32 f18; f32 xdiff; @@ -149,7 +149,7 @@ s32 eyespyCalculateNewPosition(struct coord *vel) dstpos.y = vel->y + eyespyprop->pos.y; dstpos.z = vel->z + eyespyprop->pos.z; - sp70 = g_Vars.bondcollisions ? 63 : 32; + types = g_Vars.bondcollisions ? CDTYPE_ALL : CDTYPE_BG; // Allow eyespy to go up steps 30cm or less if (g_Vars.currentplayer->eyespy->oldground <= chr->manground + 30) { @@ -175,7 +175,7 @@ s32 eyespyCalculateNewPosition(struct coord *vel) // Check if the eyespy is moving 13cm or more along either 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. + // dst position. If more, do a halfway check too? xdiff = dstpos.x - eyespyprop->pos.x; zdiff = dstpos.z - eyespyprop->pos.z; @@ -183,13 +183,13 @@ s32 eyespyCalculateNewPosition(struct coord *vel) halflimit = limit * 0.5f; if (xdiff > halflimit || zdiff > halflimit || xdiff < -halflimit || zdiff < -halflimit) { - result = func0002d95c(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, limit, sp70, 1, 15, f18); + result = cdTestAToB3(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, limit, types, 1, 15, f18); if (result == CDRESULT_NOCOLLISION) { - result = func0002a9f0(&eyespyprop->pos, &dstpos, limit, dstrooms, sp70, 1, 15, f18); + result = cdTestAToB1(&eyespyprop->pos, &dstpos, limit, dstrooms, types, 1, 15, f18); } } else { - result = func0002a9f0(&eyespyprop->pos, &dstpos, limit, sp74, sp70, 1, 15, f18); + result = cdTestAToB1(&eyespyprop->pos, &dstpos, limit, sp74, types, 1, 15, f18); } if (result == CDRESULT_COLLISION) { @@ -641,8 +641,8 @@ bool eyespyTryLaunch(void) func0f0c1e54(g_Vars.currentplayer->prop, 0); - if (insafe || !func0002dd90(&testfrompos, g_Vars.currentplayer->prop->rooms, - &g_Vars.currentplayer->eyespy->prop->pos, 63, 15)) { + if (insafe || !cdTestAToB4(&testfrompos, g_Vars.currentplayer->prop->rooms, + &g_Vars.currentplayer->eyespy->prop->pos, CDTYPE_ALL, 15)) { // Launch failed due to not enough physical space, or we're in the G5 safe g_Vars.currentplayer->eyespy->initialised = false; diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index f885211ff..47def1554 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -502,7 +502,7 @@ bool func0f0cd05c(f32 y) ymin -= 0.1f; - result = func0002a684(&newpos, width, rooms, 63, 1, + result = cdTestVolume(&newpos, width, rooms, CDTYPE_ALL, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); @@ -1587,7 +1587,7 @@ void func0f0ce1ac(void) f32 fVar3; f32 f0; - f14 = coordFindGroundY(&g_Vars.currentplayer->prop->pos, + f14 = cdFindGroundY(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->bond2.width, g_Vars.currentplayer->prop->rooms, &g_Vars.currentplayer->floorcol, diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 9529691ed..a2d3bc4c4 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -467,7 +467,7 @@ glabel var7f1ad8b4 /* f0c86d8: e7b00154 */ swc1 $f16,0x154($sp) /* f0c86dc: 24071020 */ addiu $a3,$zero,0x1020 /* f0c86e0: 46062200 */ add.s $f8,$f4,$f6 -/* f0c86e4: 0c00b764 */ jal func0002dd90 +/* f0c86e4: 0c00b764 */ jal cdTestAToB4 /* f0c86e8: e7a80158 */ swc1 $f8,0x158($sp) /* f0c86ec: 14400018 */ bnez $v0,.L0f0c8750 /* f0c86f0: 02002025 */ or $a0,$s0,$zero diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 48a45b447..d52a87748 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -110,7 +110,7 @@ void currentPlayerWalkInit(void) delta.z = g_Vars.currentplayer->walkinitpos.z - g_Vars.currentplayer->prop->pos.z; propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, false); - func0f0c4250(&delta, 0, true, 0, 63); + func0f0c4250(&delta, 0, true, 0, CDTYPE_ALL); propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, true); } else if (prevmode != MOVEMODE_GRAB && prevmode != MOVEMODE_WALK) { g_Vars.currentplayer->moveinitspeed.x = 0; @@ -169,13 +169,22 @@ void func0f0c3b38(struct coord *reltarget, struct defaultobj *obj) func0f082e84(obj, &posunk, &vector, &tween, false); } -bool currentPlayerHasGapToCeiling(f32 y) +/** + * Attempt to move the current player up vertically by the given amount. + * + * Collision checks are done for the new location, and if successful the + * player's positional values are updated. + * + * The function is called with amount = 0 when attempting to stand up from a + * crouch, after increasing the player's bbox to the standing size. + */ +s32 bwalkTryMoveUpwards(f32 amount) { bool result; struct coord newpos; s16 rooms[8]; u32 stack; - u32 something; + u32 types; f32 ymax; f32 ymin; f32 width; @@ -187,10 +196,10 @@ bool currentPlayerHasGapToCeiling(f32 y) } newpos.x = g_Vars.currentplayer->prop->pos.x; - newpos.y = g_Vars.currentplayer->prop->pos.y + y; + newpos.y = g_Vars.currentplayer->prop->pos.y + amount; newpos.z = g_Vars.currentplayer->prop->pos.z; - something = g_Vars.bondcollisions ? 63 : 32; + types = g_Vars.bondcollisions ? CDTYPE_ALL : CDTYPE_BG; propPlayerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin); func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &newpos, rooms); @@ -199,7 +208,7 @@ bool currentPlayerHasGapToCeiling(f32 y) ymin -= 0.1f; - result = func0002a684(&newpos, width, rooms, something, 1, + result = cdTestVolume(&newpos, width, rooms, types, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); @@ -216,7 +225,7 @@ bool currentPlayerHasGapToCeiling(f32 y) return result; } -bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4) +bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 checktypes) { s32 result = CDRESULT_NOCOLLISION; f32 halfwidth; @@ -224,7 +233,7 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, s16 dstrooms[8]; bool copyrooms = false; s16 sp64[22]; - s32 sp60; + s32 types; f32 ymax; f32 ymin; f32 width; @@ -253,7 +262,7 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, dstpos.y += vel->y; dstpos.z += vel->z; - sp60 = g_Vars.bondcollisions ? arg4 : 32; + types = g_Vars.bondcollisions ? checktypes : CDTYPE_BG; propPlayerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin); width += extrawidth; @@ -266,27 +275,27 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, // Check if the player is moving at least half their width 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. + // 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; if (xdiff > halfwidth || zdiff > halfwidth || xdiff < -halfwidth || zdiff < -halfwidth) { - result = func0002d95c(&g_Vars.currentplayer->prop->pos, + result = cdTestAToB3(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, - &dstpos, dstrooms, width, sp60, 1, + &dstpos, dstrooms, width, types, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); if (result == CDRESULT_NOCOLLISION) { - result = func0002a9f0(&g_Vars.currentplayer->prop->pos, - &dstpos, width, dstrooms, sp60, 1, + result = cdTestAToB1(&g_Vars.currentplayer->prop->pos, + &dstpos, width, dstrooms, types, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); } } else { - result = func0002a9f0(&g_Vars.currentplayer->prop->pos, - &dstpos, width, sp64, sp60, 1, + result = cdTestAToB1(&g_Vars.currentplayer->prop->pos, + &dstpos, width, sp64, types, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); } @@ -672,9 +681,9 @@ glabel func0f0c4250 ); // Mismatch: The below loads 0.5f twice in the chr push code while goal reuses it. -//bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4) +//bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types) //{ -// s32 result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// s32 result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, types); // // if (result != CDRESULT_NOCOLLISION) { // struct prop *obstacle = cdGetObstacle(); @@ -760,7 +769,7 @@ glabel func0f0c4250 // func0f0220ac(chr); // modelSetRootPosition(chr->model, &newpos); // -// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, types); // } // } // } @@ -801,7 +810,7 @@ glabel func0f0c4250 // } // // if (somevalue) { -// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, types); // } // } // } @@ -814,9 +823,9 @@ glabel func0f0c4250 // return result; //} -s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3) +s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 types) { - s32 result = func0f0c4250(delta, 0, true, 0, arg3); + s32 result = func0f0c4250(delta, 0, true, 0, types); if (result == CDRESULT_COLLISION) { func00024e4c(arg1, arg2, 0x25f, "bondwalk.c"); @@ -826,7 +835,7 @@ s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s3 } s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, - struct coord *d, struct coord *e, s32 arg6) + struct coord *d, struct coord *e, s32 types) { struct coord quarter; bool result; @@ -836,7 +845,7 @@ s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, quarter.x = a->x * mult * 0.25f; quarter.y = a->y * mult * 0.25f; quarter.z = a->z * mult * 0.25f; - result = func0f0c4250(&quarter, 0, true, 0, arg6); + result = func0f0c4250(&quarter, 0, true, 0, types); if (result == CDRESULT_NOCOLLISION) { return CDRESULT_NOCOLLISION; @@ -859,7 +868,7 @@ s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, return CDRESULT_ERROR; } -s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3) +s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 types) { if (b->f[0] != c->f[0] || b->f[2] != c->f[2]) { f32 tmp; @@ -881,13 +890,13 @@ s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3) sp2c.y = 0; sp2c.z = sp38.z * tmp; - return func0f0c4250(&sp2c, 0, true, 0, arg3); + return func0f0c4250(&sp2c, 0, true, 0, types); } return -1; } -s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 arg3) +s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 types) { struct coord sp34; struct coord sp28; @@ -921,7 +930,7 @@ s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 sp28.y = 0; sp28.z = sp34.z; - if (func0f0c4250(&sp28, 0, true, 0, arg3) == 1) { + if (func0f0c4250(&sp28, 0, true, 0, types) == CDRESULT_NOCOLLISION) { return true; } } @@ -949,7 +958,7 @@ s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 sp28.y = 0; sp28.z = sp34.z; - if (func0f0c4250(&sp28, 0, true, 0, arg3) == 1) { + if (func0f0c4250(&sp28, 0, true, 0, types) == CDRESULT_NOCOLLISION) { return true; } } @@ -958,6 +967,7 @@ s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 return false; } + void func0f0c4d98(void) { // empty @@ -1043,7 +1053,7 @@ void currentPlayerUpdateVerticalMovement(void) if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti && g_Vars.currentplayer->bond2.width != 30 - && func0002a684(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, 0x3f, 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, 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; @@ -1080,7 +1090,7 @@ void currentPlayerUpdateVerticalMovement(void) roomsCopy(g_Vars.currentplayer->prop->rooms, rooms); func0f0cb79c(g_Vars.currentplayer, &testpos, rooms); - ground = coordFindGroundY(&testpos, g_Vars.currentplayer->bond2.width, rooms, + ground = cdFindGroundY(&testpos, g_Vars.currentplayer->bond2.width, rooms, &g_Vars.currentplayer->floorcol, &g_Vars.currentplayer->floortype, &g_Vars.currentplayer->floorflags, &g_Vars.currentplayer->floorroom, &newinlift, &lift); @@ -1112,7 +1122,7 @@ void currentPlayerUpdateVerticalMovement(void) || lift == NULL || lift->obj == NULL || (lift->obj->flags & OBJFLAG_CHOPPER_INACTIVE) == 0 - || currentPlayerHasGapToCeiling(moveamount) == true) { + || bwalkTryMoveUpwards(moveamount) == CDRESULT_NOCOLLISION) { // Going up g_Vars.currentplayer->vv_manground += moveamount; g_Vars.currentplayer->sumground = g_Vars.currentplayer->vv_manground / 0.045499980449677f; @@ -1142,11 +1152,11 @@ void currentPlayerUpdateVerticalMovement(void) (ground <= g_Vars.currentplayer->vv_manground && ground <= g_Vars.currentplayer->vv_manground + g_Vars.currentplayer->ladderupdown)) { // Still on ladder - if (currentPlayerHasGapToCeiling(g_Vars.currentplayer->ladderupdown) == true) { + if (bwalkTryMoveUpwards(g_Vars.currentplayer->ladderupdown) == CDRESULT_NOCOLLISION) { g_Vars.currentplayer->vv_manground += g_Vars.currentplayer->ladderupdown; } } else { - if (currentPlayerHasGapToCeiling(ground - g_Vars.currentplayer->vv_manground) == true) { + if (bwalkTryMoveUpwards(ground - g_Vars.currentplayer->vv_manground) == CDRESULT_NOCOLLISION) { g_Vars.currentplayer->vv_manground = ground; onladder = false; } @@ -1181,7 +1191,7 @@ void currentPlayerUpdateVerticalMovement(void) sumground = limit; } - if (currentPlayerHasGapToCeiling(sumground - g_Vars.currentplayer->vv_manground) == true) { + if (bwalkTryMoveUpwards(sumground - g_Vars.currentplayer->vv_manground) == CDRESULT_NOCOLLISION) { g_Vars.currentplayer->vv_manground = sumground; } else { // Not enough room above. If on a hoverbike, blow it up @@ -1237,7 +1247,7 @@ void currentPlayerUpdateVerticalMovement(void) fallspeed = -fallspeed; } - if (currentPlayerHasGapToCeiling(newmanground - g_Vars.currentplayer->vv_manground) == true) { + if (bwalkTryMoveUpwards(newmanground - g_Vars.currentplayer->vv_manground) == CDRESULT_NOCOLLISION) { // Falling g_Vars.currentplayer->vv_manground = newmanground; g_Vars.currentplayer->bdeltapos.y = fallspeed; @@ -1471,7 +1481,7 @@ void func0f0c6180(void) currentPlayerUpdateCrouchOffsetWalk(); - if (!currentPlayerHasGapToCeiling(0)) { + if (bwalkTryMoveUpwards(0) == CDRESULT_COLLISION) { // Crouch adjustment is blocked by ceiling g_Vars.currentplayer->crouchoffset = prevcrouchoffset; g_Vars.currentplayer->crouchoffsetreal = prevcrouchoffsetreal; @@ -1500,7 +1510,7 @@ void func0f0c6318(void) rotateamount = g_Vars.currentplayer->speedtheta * mult * g_Vars.lvupdate240freal * 0.0174505133f * 3.5f; - func0f0c4250(&delta, rotateamount, true, 0, 63); + func0f0c4250(&delta, rotateamount, true, 0, CDTYPE_ALL); } u32 var80070e68 = 0x00000000; @@ -1510,7 +1520,7 @@ u32 var80070e74 = 0x00000000; u32 var80070e78 = 0x00000000; u32 var80070e7c = 0x00000000; -void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2) +void func0f0c63bc(struct coord *arg0, u32 arg1, s32 types) { struct coord sp100; struct coord sp88; @@ -1520,35 +1530,35 @@ void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2) func0f0c4d98(); - if (func0f0c4764(arg0, &sp100, &sp88, arg2) == CDRESULT_COLLISION) { + if (func0f0c4764(arg0, &sp100, &sp88, types) == CDRESULT_COLLISION) { struct coord sp76; struct coord sp64; - s32 lVar1 = func0f0c47d0(arg0, &sp100, &sp88, &sp76, &sp64, arg2); + s32 result = func0f0c47d0(arg0, &sp100, &sp88, &sp76, &sp64, types); - if (lVar1 > 0 || lVar1 < 0) { - if (lVar1 > 0) { + if (result >= CDRESULT_NOCOLLISION || result <= CDRESULT_ERROR) { + if (result >= CDRESULT_NOCOLLISION) { func0f0c4d98(); } if (arg1 - && func0f0c494c(arg0, &sp100, &sp88, arg2) <= CDRESULT_COLLISION - && func0f0c4a5c(arg0, &sp100, &sp88, arg2) <= 0) { + && func0f0c494c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION + && func0f0c4a5c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION) { // empty } - } else if (lVar1 == 0) { + } else if (result == CDRESULT_COLLISION) { struct coord sp48; struct coord sp36; - if (func0f0c47d0(arg0, &sp76, &sp64, &sp48, &sp36, arg2) > 0) { + if (func0f0c47d0(arg0, &sp76, &sp64, &sp48, &sp36, types) >= CDRESULT_NOCOLLISION) { func0f0c4d98(); } if (arg1 - && func0f0c494c(arg0, &sp76, &sp64, arg2) <= CDRESULT_COLLISION - && func0f0c494c(arg0, &sp100, &sp88, arg2) <= CDRESULT_COLLISION - && func0f0c4a5c(arg0, &sp76, &sp64, arg2) < 1) { - func0f0c4a5c(arg0, &sp100, &sp88, arg2); + && func0f0c494c(arg0, &sp76, &sp64, types) <= CDRESULT_COLLISION + && func0f0c494c(arg0, &sp100, &sp88, types) <= CDRESULT_COLLISION + && func0f0c4a5c(arg0, &sp76, &sp64, types) <= CDRESULT_COLLISION) { + func0f0c4a5c(arg0, &sp100, &sp88, types); } } } diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index c9bcab945..85979f4ad 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -593,7 +593,7 @@ glabel func0f01e7f4 /* f01ec1c: 46009201 */ sub.s $f8,$f18,$f0 /* f01ec20: e7a40018 */ swc1 $f4,0x18($sp) /* f01ec24: 8fa700e0 */ lw $a3,0xe0($sp) -/* f01ec28: 0c00b5cb */ jal func0002d72c +/* f01ec28: 0c00b5cb */ jal cdTestAToB2 /* f01ec2c: e7a8001c */ swc1 $f8,0x1c($sp) /* f01ec30: 24010001 */ addiu $at,$zero,0x1 /* f01ec34: 1441001d */ bne $v0,$at,.L0f01ecac @@ -609,7 +609,7 @@ glabel func0f01e7f4 /* f01ec5c: 46008101 */ sub.s $f4,$f16,$f0 /* f01ec60: e7a60014 */ swc1 $f6,0x14($sp) /* f01ec64: 2407003f */ addiu $a3,$zero,0x3f -/* f01ec68: 0c00a9a1 */ jal func0002a684 +/* f01ec68: 0c00a9a1 */ jal cdTestVolume /* f01ec6c: e7a40018 */ swc1 $f4,0x18($sp) /* f01ec70: 1000000f */ b .L0f01ecb0 /* f01ec74: 24010001 */ addiu $at,$zero,0x1 @@ -625,7 +625,7 @@ glabel func0f01e7f4 /* f01ec98: 46005181 */ sub.s $f6,$f10,$f0 /* f01ec9c: e7a80014 */ swc1 $f8,0x14($sp) /* f01eca0: 2407003f */ addiu $a3,$zero,0x3f -/* f01eca4: 0c00a9a1 */ jal func0002a684 +/* f01eca4: 0c00a9a1 */ jal cdTestVolume /* f01eca8: e7a60018 */ swc1 $f6,0x18($sp) .L0f01ecac: /* f01ecac: 24010001 */ addiu $at,$zero,0x1 @@ -764,7 +764,7 @@ glabel func0f01e7f4 /* f01eeac: 46003281 */ sub.s $f10,$f6,$f0 /* f01eeb0: e7b00018 */ swc1 $f16,0x18($sp) /* f01eeb4: 8fa700e0 */ lw $a3,0xe0($sp) -/* f01eeb8: 0c00b5cb */ jal func0002d72c +/* f01eeb8: 0c00b5cb */ jal cdTestAToB2 /* f01eebc: e7aa001c */ swc1 $f10,0x1c($sp) /* f01eec0: 24010001 */ addiu $at,$zero,0x1 /* f01eec4: 1441001d */ bne $v0,$at,.L0f01ef3c @@ -780,7 +780,7 @@ glabel func0f01e7f4 /* f01eeec: 46009401 */ sub.s $f16,$f18,$f0 /* f01eef0: e7a80014 */ swc1 $f8,0x14($sp) /* f01eef4: 2407003f */ addiu $a3,$zero,0x3f -/* f01eef8: 0c00a9a1 */ jal func0002a684 +/* f01eef8: 0c00a9a1 */ jal cdTestVolume /* f01eefc: e7b00018 */ swc1 $f16,0x18($sp) /* f01ef00: 1000000f */ b .L0f01ef40 /* f01ef04: 24010001 */ addiu $at,$zero,0x1 @@ -796,7 +796,7 @@ glabel func0f01e7f4 /* f01ef28: 46002201 */ sub.s $f8,$f4,$f0 /* f01ef2c: e7aa0014 */ swc1 $f10,0x14($sp) /* f01ef30: 2407003f */ addiu $a3,$zero,0x3f -/* f01ef34: 0c00a9a1 */ jal func0002a684 +/* f01ef34: 0c00a9a1 */ jal cdTestVolume /* f01ef38: e7a80018 */ swc1 $f8,0x18($sp) .L0f01ef3c: /* f01ef3c: 24010001 */ addiu $at,$zero,0x1 @@ -931,7 +931,7 @@ glabel func0f01e7f4 /* f01f12c: 46002401 */ sub.s $f16,$f4,$f0 /* f01f130: e7a80018 */ swc1 $f8,0x18($sp) /* f01f134: 8fa700e0 */ lw $a3,0xe0($sp) -/* f01f138: 0c00b5cb */ jal func0002d72c +/* f01f138: 0c00b5cb */ jal cdTestAToB2 /* f01f13c: e7b0001c */ swc1 $f16,0x1c($sp) /* f01f140: 24010001 */ addiu $at,$zero,0x1 /* f01f144: 1441001d */ bne $v0,$at,.L0f01f1bc @@ -947,7 +947,7 @@ glabel func0f01e7f4 /* f01f16c: 46005201 */ sub.s $f8,$f10,$f0 /* f01f170: e7a60014 */ swc1 $f6,0x14($sp) /* f01f174: 2407003f */ addiu $a3,$zero,0x3f -/* f01f178: 0c00a9a1 */ jal func0002a684 +/* f01f178: 0c00a9a1 */ jal cdTestVolume /* f01f17c: e7a80018 */ swc1 $f8,0x18($sp) /* f01f180: 1000000f */ b .L0f01f1c0 /* f01f184: 24010001 */ addiu $at,$zero,0x1 @@ -963,7 +963,7 @@ glabel func0f01e7f4 /* f01f1a8: 46009181 */ sub.s $f6,$f18,$f0 /* f01f1ac: e7b00014 */ swc1 $f16,0x14($sp) /* f01f1b0: 2407003f */ addiu $a3,$zero,0x3f -/* f01f1b4: 0c00a9a1 */ jal func0002a684 +/* f01f1b4: 0c00a9a1 */ jal cdTestVolume /* f01f1b8: e7a60018 */ swc1 $f6,0x18($sp) .L0f01f1bc: /* f01f1bc: 24010001 */ addiu $at,$zero,0x1 @@ -1032,7 +1032,7 @@ bool func0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3, func0f065e74(pos, rooms, &newpos, newrooms); func0f021fa8(chr, &newpos, newrooms); chrSetOrUnsetHiddenFlag00000100(chr, false); - result = func0002a684(&newpos, width, newrooms, 63, 1, + result = cdTestVolume(&newpos, width, newrooms, CDTYPE_ALL, 1, ymax - chr->prop->pos.y, ymin - chr->prop->pos.y); chrSetOrUnsetHiddenFlag00000100(chr, true); @@ -1186,7 +1186,7 @@ glabel var7f1a8720 /* f01f490: afb90010 */ sw $t9,0x10($sp) /* f01f494: 02202025 */ or $a0,$s1,$zero /* f01f498: 27a600fc */ addiu $a2,$sp,0xfc -/* f01f49c: 0c00a86c */ jal coordFindGroundY +/* f01f49c: 0c00a86c */ jal cdFindGroundY /* f01f4a0: 2607018a */ addiu $a3,$s0,0x18a /* f01f4a4: 3c017f1b */ lui $at,%hi(var7f1a86ac) /* f01f4a8: c42886ac */ lwc1 $f8,%lo(var7f1a86ac)($at) @@ -1915,7 +1915,7 @@ glabel var7f1a8720 /* f01ff50: afa20044 */ sw $v0,0x44($sp) /* f01ff54: afa7004c */ sw $a3,0x4c($sp) /* f01ff58: 8fa40098 */ lw $a0,0x98($sp) -/* f01ff5c: 0c00a86c */ jal coordFindGroundY +/* f01ff5c: 0c00a86c */ jal cdFindGroundY /* f01ff60: 8fa60094 */ lw $a2,0x94($sp) /* f01ff64: 8e0202d4 */ lw $v0,0x2d4($s0) /* f01ff68: 3c08800a */ lui $t0,%hi(g_Vars) @@ -1972,7 +1972,7 @@ glabel var7f1a8720 /* f020034: 27a600fc */ addiu $a2,$sp,0xfc /* f020038: 8fa7004c */ lw $a3,0x4c($sp) /* f02003c: afae0010 */ sw $t6,0x10($sp) -/* f020040: 0c00a86c */ jal coordFindGroundY +/* f020040: 0c00a86c */ jal cdFindGroundY /* f020044: afb80018 */ sw $t8,0x18($sp) /* f020048: 3c08800a */ lui $t0,%hi(g_Vars) /* f02004c: 3c017f1b */ lui $at,%hi(var7f1a86fc) @@ -2617,7 +2617,7 @@ struct prop *func0f020b14(struct prop *prop, struct model *model, testpos.y = pos->y + 100; testpos.z = pos->z; - chr->ground = chr->manground = ground = coordFindGroundY(&testpos, chr->chrwidth, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL); + chr->ground = chr->manground = ground = cdFindGroundY(&testpos, chr->chrwidth, rooms, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL); chr->sumground = ground * 9.999998f; diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 76495cc0e..efc03fb2f 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -378,7 +378,7 @@ f32 func0f02e684(struct prop *prop, f32 arg1, f32 arg2) propChrGetBbox(prop, &width, &ymax, &ymin); - return func0f02e550(prop, arg1, arg2, 0x3f, ymax, ymin); + return func0f02e550(prop, arg1, arg2, CDTYPE_ALL, ymax, ymin); } void chrStandChooseAnimation(struct chrdata *chr, f32 arg1) @@ -7884,7 +7884,7 @@ glabel func0f03654c /* f0365c8: 02203025 */ or $a2,$s1,$zero /* f0365cc: 46004281 */ sub.s $f10,$f8,$f0 /* f0365d0: e7a60018 */ swc1 $f6,0x18($sp) -/* f0365d4: 0c00b5cb */ jal func0002d72c +/* f0365d4: 0c00b5cb */ jal cdTestAToB2 /* f0365d8: e7aa001c */ swc1 $f10,0x1c($sp) /* f0365dc: 14400012 */ bnez $v0,.L0f036628 /* f0365e0: 8fa700a0 */ lw $a3,0xa0($sp) @@ -8081,7 +8081,7 @@ glabel func0f03654c 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, 0x3f); + return func0f03654c(prop->chr, &prop->pos, prop->rooms, dstpos, NULL, vector, prop->chr->chrwidth * 1.2f, CDTYPE_ALL); } bool propchrHasClearLineInVector(struct prop *prop, struct coord *vector, f32 mult) @@ -8097,7 +8097,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, 0x3f); + return func0f03654c(prop->chr, &prop->pos, prop->rooms, pos, NULL, NULL, prop->chr->chrwidth * 1.2f, CDTYPE_ALL); } void chrGetSideVectorToTarget(struct chrdata *chr, bool side, struct coord *vector) @@ -8738,7 +8738,7 @@ glabel var7f1a8dac /* f0376a4: afa00014 */ sw $zero,0x14($sp) /* f0376a8: 8fa40134 */ lw $a0,0x134($sp) /* f0376ac: 27a60118 */ addiu $a2,$sp,0x118 -/* f0376b0: 0c00a86c */ jal coordFindGroundY +/* f0376b0: 0c00a86c */ jal cdFindGroundY /* f0376b4: 27a70106 */ addiu $a3,$sp,0x106 /* f0376b8: 8fa80134 */ lw $t0,0x134($sp) /* f0376bc: e7a00108 */ swc1 $f0,0x108($sp) @@ -8777,7 +8777,7 @@ glabel var7f1a8dac /* f037740: 2407003f */ addiu $a3,$zero,0x3f /* f037744: 46005481 */ sub.s $f18,$f10,$f0 /* f037748: e7b00014 */ swc1 $f16,0x14($sp) -/* f03774c: 0c00a9a1 */ jal func0002a684 +/* f03774c: 0c00a9a1 */ jal cdTestVolume /* f037750: e7b20018 */ swc1 $f18,0x18($sp) /* f037754: 1040007b */ beqz $v0,.L0f037944 /* f037758: 8fa400f0 */ lw $a0,0xf0($sp) @@ -16300,7 +16300,7 @@ glabel var7f1a9184 .L0f040b00: /* f040b00: 24190010 */ addiu $t9,$zero,0x10 /* f040b04: afb90010 */ sw $t9,0x10($sp) -/* f040b08: 0c00b764 */ jal func0002dd90 +/* f040b08: 0c00b764 */ jal cdTestAToB4 /* f040b0c: 8fa701c8 */ lw $a3,0x1c8($sp) /* f040b10: 1440000a */ bnez $v0,.L0f040b3c /* f040b14: 240d0001 */ addiu $t5,$zero,0x1 @@ -22727,7 +22727,7 @@ void chrTickGoPos(struct chrdata *chr) } // Some bbox related check - if (func0f03654c(chr, &prop->pos, prop->rooms, &pos, rooms, NULL, chr->chrwidth * 1.2f, 48)) { + if (func0f03654c(chr, &prop->pos, prop->rooms, &pos, rooms, NULL, chr->chrwidth * 1.2f, CDTYPE_10 | CDTYPE_BG)) { chrGoPosAdvanceWaypoint(chr); chrGoPosAdvanceWaypoint(chr); } @@ -22787,13 +22787,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, &pos, rooms, NULL, chr->chrwidth * 1.2f, 48)) { + if (func0f03654c(chr, &prop->pos, prop->rooms, &pos, rooms, NULL, chr->chrwidth * 1.2f, CDTYPE_10 | CDTYPE_BG)) { chrGoPosAdvanceWaypoint(chr); } } } } else { - if (func0f03654c(chr, &prop->pos, prop->rooms, &pos, rooms, NULL, chr->chrwidth * 1.2f, 48)) { + if (func0f03654c(chr, &prop->pos, prop->rooms, &pos, rooms, NULL, chr->chrwidth * 1.2f, CDTYPE_10 | CDTYPE_BG)) { chrGoPosAdvanceWaypoint(chr); } } @@ -23066,7 +23066,7 @@ bool chrStartSkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4) chr->act_skjump.hit = false; chr->act_skjump.unk03c = hspeed; chr->act_skjump.unk04c = hspeed; - chr->act_skjump.y = coordFindGroundYSimple(&chr->prop->pos, chr->chrwidth, chr->prop->rooms, NULL, NULL); + chr->act_skjump.y = cdFindGroundYSimple(&chr->prop->pos, chr->chrwidth, chr->prop->rooms, NULL, NULL); } else { return false; } @@ -25703,7 +25703,7 @@ glabel var7f1a941c /* f04b038: 4481a000 */ mtc1 $at,$f20 /* f04b03c: 02a03025 */ or $a2,$s5,$zero /* f04b040: 00003825 */ or $a3,$zero,$zero -/* f04b044: 0c00a8cc */ jal coordFindGroundYSimple +/* f04b044: 0c00a8cc */ jal cdFindGroundYSimple /* f04b048: afa00010 */ sw $zero,0x10($sp) /* f04b04c: 3c017f1b */ lui $at,%hi(var7f1a940c) /* f04b050: c426940c */ lwc1 $f6,%lo(var7f1a940c)($at) @@ -25729,7 +25729,7 @@ glabel var7f1a941c /* f04b09c: 4481f000 */ mtc1 $at,$f30 /* f04b0a0: afb80010 */ sw $t8,0x10($sp) /* f04b0a4: e7b40018 */ swc1 $f20,0x18($sp) -/* f04b0a8: 0c00a9a1 */ jal func0002a684 +/* f04b0a8: 0c00a9a1 */ jal cdTestVolume /* f04b0ac: e7be0014 */ swc1 $f30,0x14($sp) /* f04b0b0: 10400009 */ beqz $v0,.L0f04b0d8 /* f04b0b4: 8fb900b8 */ lw $t9,0xb8($sp) @@ -25802,7 +25802,7 @@ glabel var7f1a941c /* f04b1ac: 8fa500a8 */ lw $a1,0xa8($sp) /* f04b1b0: 02003025 */ or $a2,$s0,$zero /* f04b1b4: 00003825 */ or $a3,$zero,$zero -/* f04b1b8: 0c00a8cc */ jal coordFindGroundYSimple +/* f04b1b8: 0c00a8cc */ jal cdFindGroundYSimple /* f04b1bc: afa00010 */ sw $zero,0x10($sp) /* f04b1c0: 3c017f1b */ lui $at,%hi(var7f1a9414) /* f04b1c4: c4249414 */ lwc1 $f4,%lo(var7f1a9414)($at) @@ -25827,7 +25827,7 @@ glabel var7f1a941c /* f04b20c: afab0010 */ sw $t3,0x10($sp) .L0f04b210: /* f04b210: e7be0014 */ swc1 $f30,0x14($sp) -/* f04b214: 0c00a9a1 */ jal func0002a684 +/* f04b214: 0c00a9a1 */ jal cdTestVolume /* f04b218: e7b40018 */ swc1 $f20,0x18($sp) /* f04b21c: 10400019 */ beqz $v0,.L0f04b284 /* f04b220: 8fac00b8 */ lw $t4,0xb8($sp) @@ -26060,7 +26060,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, propSetCollisionsEnabled(chr->prop, false); if (func0f04af84(chr->chrwidth, &pos2, rooms2, angle, (chr->hidden & CHRHFLAG_00100000) != 0, allowonscreen, (chr->hidden & CHRHFLAG_00000200) != 0)) { - ground = coordFindGroundY(&pos2, chr->chrwidth, rooms2, &chr->floorcol, + ground = cdFindGroundY(&pos2, chr->chrwidth, rooms2, &chr->floorcol, &chr->floortype, NULL, &chr->floorroom, NULL, NULL); chr->ground = ground; @@ -26760,7 +26760,7 @@ bool chrRunFromPos(struct chrdata *chr, u32 speed, f32 rundist, struct coord *fr chrSetOrUnsetHiddenFlag00000100(chr, false); - if (!func0002dd90(&chr->prop->pos, chr->prop->rooms, &delta, 0x3f, 4)) { + if (cdTestAToB4(&chr->prop->pos, chr->prop->rooms, &delta, CDTYPE_ALL, 4) == CDRESULT_COLLISION) { func00024ebc(&delta, 18547, "chraction.c"); } diff --git a/src/game/game_011110.c b/src/game/game_011110.c index 59003f10a..e9e951182 100644 --- a/src/game/game_011110.c +++ b/src/game/game_011110.c @@ -1104,7 +1104,7 @@ glabel var7f1a827c /* f01219c: 27a6008c */ addiu $a2,$sp,0x8c /* f0121a0: afa0001c */ sw $zero,0x1c($sp) /* f0121a4: afa00020 */ sw $zero,0x20($sp) -/* f0121a8: 0c00a86c */ jal coordFindGroundY +/* f0121a8: 0c00a86c */ jal cdFindGroundY /* f0121ac: 2447161a */ addiu $a3,$v0,0x161a /* f0121b0: 8e220284 */ lw $v0,0x284($s1) /* f0121b4: 3c0143b4 */ lui $at,0x43b4 @@ -1572,7 +1572,7 @@ glabel var7f1a827c // } // } // -// groundy = coordFindGroundY(&pos, 30, rooms, +// groundy = cdFindGroundY(&pos, 30, rooms, // &g_Vars.currentplayer->floorcol, // &g_Vars.currentplayer->floortype, // &g_Vars.currentplayer->floorflags, diff --git a/src/game/game_02cde0.c b/src/game/game_02cde0.c index 59804bac0..deccc0dde 100644 --- a/src/game/game_02cde0.c +++ b/src/game/game_02cde0.c @@ -482,7 +482,7 @@ glabel chrUnpack /* f02d554: 2407003f */ addiu $a3,$zero,0x3f /* f02d558: e7a40014 */ swc1 $f4,0x14($sp) /* f02d55c: a7ae0060 */ sh $t6,0x60($sp) -/* f02d560: 0c00a9a1 */ jal func0002a684 +/* f02d560: 0c00a9a1 */ jal cdTestVolume /* f02d564: e7a60018 */ swc1 $f6,0x18($sp) /* f02d568: 5440000a */ bnezl $v0,.L0f02d594 /* f02d56c: 8e020004 */ lw $v0,0x4($s0) @@ -978,7 +978,7 @@ struct prop *propAllocateEyespy(struct pad *pad, s16 room) chr->visionrange = 0; chr->race = bodyGetRace(chr->bodynum); - ground = coordFindGroundY(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift); + ground = cdFindGroundY(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift); chr->ground = ground; chr->manground = ground; diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index d1014be2d..918450e3b 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -1296,7 +1296,7 @@ glabel var7f1ad568 /* f0b7418: 27a600fc */ addiu $a2,$sp,0xfc /* f0b741c: afa0001c */ sw $zero,0x1c($sp) /* f0b7420: afa00020 */ sw $zero,0x20($sp) -/* f0b7424: 0c00a86c */ jal coordFindGroundY +/* f0b7424: 0c00a86c */ jal cdFindGroundY /* f0b7428: 2607161a */ addiu $a3,$s0,0x161a /* f0b742c: 8e500284 */ lw $s0,0x284($s2) /* f0b7430: 3c0143b4 */ lui $at,0x43b4 @@ -1596,7 +1596,7 @@ glabel var7f1ad568 // // angle = M_BADTAU - scenarioCallback2c(30, &pos, rooms, g_Vars.currentplayer->prop); // var7f1ad534 // -// groundy = coordFindGroundY(&pos, 30, rooms, +// groundy = cdFindGroundY(&pos, 30, rooms, // &g_Vars.currentplayer->floorcol, // &g_Vars.currentplayer->floortype, // &g_Vars.currentplayer->floorflags, diff --git a/src/game/propobj.c b/src/game/propobj.c index ab5fb4610..b416544bb 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -8348,7 +8348,7 @@ glabel var7f1aa26c /* f06d4a4: 27a70070 */ addiu $a3,$sp,0x70 /* f06d4a8: afa00014 */ sw $zero,0x14($sp) /* f06d4ac: e7a00018 */ swc1 $f0,0x18($sp) -/* f06d4b0: 0c00aa7c */ jal func0002a9f0 +/* f06d4b0: 0c00aa7c */ jal cdTestAToB1 /* f06d4b4: e7a0001c */ swc1 $f0,0x1c($sp) /* f06d4b8: 1040000d */ beqz $v0,.L0f06d4f0 /* f06d4bc: c7aa0080 */ lwc1 $f10,0x80($sp) @@ -8599,7 +8599,7 @@ glabel var7f1aa26c /* f06d838: 2407003f */ addiu $a3,$zero,0x3f /* f06d83c: afa00010 */ sw $zero,0x10($sp) /* f06d840: e7b00014 */ swc1 $f16,0x14($sp) -/* f06d844: 0c00a9a1 */ jal func0002a684 +/* f06d844: 0c00a9a1 */ jal cdTestVolume /* f06d848: e7b20018 */ swc1 $f18,0x18($sp) /* f06d84c: 10400014 */ beqz $v0,.L0f06d8a0 /* f06d850: c7a4004c */ lwc1 $f4,0x4c($sp) @@ -12709,7 +12709,7 @@ glabel var7f1aa2c8 /* f07145c: 3c0540a0 */ lui $a1,0x40a0 /* f071460: 27a6002c */ addiu $a2,$sp,0x2c /* f071464: afa00010 */ sw $zero,0x10($sp) -/* f071468: 0c00a8cc */ jal coordFindGroundYSimple +/* f071468: 0c00a8cc */ jal cdFindGroundYSimple /* f07146c: 24e70058 */ addiu $a3,$a3,0x58 /* f071470: 3c017f1b */ lui $at,%hi(var7f1aa2c8) /* f071474: c432a2c8 */ lwc1 $f18,%lo(var7f1aa2c8)($at) @@ -12926,7 +12926,7 @@ glabel var7f1aa314 /* f0716f8: 3c0540a0 */ lui $a1,0x40a0 /* f0716fc: 27a60198 */ addiu $a2,$sp,0x198 /* f071700: 26270058 */ addiu $a3,$s1,0x58 -/* f071704: 0c00a8cc */ jal coordFindGroundYSimple +/* f071704: 0c00a8cc */ jal cdFindGroundYSimple /* f071708: afa00010 */ sw $zero,0x10($sp) /* f07170c: 8fa40064 */ lw $a0,0x64($sp) /* f071710: 8fa50060 */ lw $a1,0x60($sp) @@ -12942,7 +12942,7 @@ glabel var7f1aa314 /* f071738: 3c0540a0 */ lui $a1,0x40a0 /* f07173c: 27a60188 */ addiu $a2,$sp,0x188 /* f071740: 00003825 */ or $a3,$zero,$zero -/* f071744: 0c00a8cc */ jal coordFindGroundYSimple +/* f071744: 0c00a8cc */ jal cdFindGroundYSimple /* f071748: afa00010 */ sw $zero,0x10($sp) /* f07174c: 3c017f1b */ lui $at,%hi(var7f1aa2d4) /* f071750: c42ca2d4 */ lwc1 $f12,%lo(var7f1aa2d4)($at) @@ -16633,7 +16633,7 @@ glabel var7f1aa438 /* f074aac: 3c054000 */ lui $a1,0x4000 /* f074ab0: 26460028 */ addiu $a2,$s2,0x28 /* f074ab4: 26270058 */ addiu $a3,$s1,0x58 -/* f074ab8: 0c00a8cc */ jal coordFindGroundYSimple +/* f074ab8: 0c00a8cc */ jal cdFindGroundYSimple /* f074abc: afa00010 */ sw $zero,0x10($sp) /* f074ac0: 3c017f1b */ lui $at,%hi(var7f1aa3ec) /* f074ac4: c424a3ec */ lwc1 $f4,%lo(var7f1aa3ec)($at) @@ -20066,7 +20066,7 @@ glabel var7f1aa454 /* f077b4c: 1000000e */ b .L0f077b88 /* f077b50: e60a0070 */ swc1 $f10,0x70($s0) .L0f077b54: -/* f077b54: 0fc30f23 */ jal currentPlayerHasGapToCeiling +/* f077b54: 0fc30f23 */ jal bwalkTryMoveUpwards /* f077b58: 4600a306 */ mov.s $f12,$f20 /* f077b5c: 24010001 */ addiu $at,$zero,0x1 /* f077b60: 14410009 */ bne $v0,$at,.L0f077b88 @@ -23074,7 +23074,7 @@ glabel var7f1aa5a8 .L0f07a2f8: /* f07a2f8: 240e0010 */ addiu $t6,$zero,0x10 .L0f07a2fc: -/* f07a2fc: 0c00b764 */ jal func0002dd90 +/* f07a2fc: 0c00b764 */ jal cdTestAToB4 /* f07a300: afae0010 */ sw $t6,0x10($sp) /* f07a304: 14400151 */ bnez $v0,.L0f07a84c /* f07a308: 27a4013c */ addiu $a0,$sp,0x13c @@ -23216,7 +23216,7 @@ glabel var7f1aa5a8 /* f07a4fc: afa000a8 */ sw $zero,0xa8($sp) /* f07a500: afaa0010 */ sw $t2,0x10($sp) /* f07a504: 27a40168 */ addiu $a0,$sp,0x168 -/* f07a508: 0c00b764 */ jal func0002dd90 +/* f07a508: 0c00b764 */ jal cdTestAToB4 /* f07a50c: 2407003b */ addiu $a3,$zero,0x3b /* f07a510: 1440000a */ bnez $v0,.L0f07a53c /* f07a514: 27a4013c */ addiu $a0,$sp,0x13c @@ -23283,7 +23283,7 @@ glabel var7f1aa5a8 /* f07a5f8: afb90010 */ sw $t9,0x10($sp) /* f07a5fc: 27a50158 */ addiu $a1,$sp,0x158 /* f07a600: 27a6013c */ addiu $a2,$sp,0x13c -/* f07a604: 0c00b764 */ jal func0002dd90 +/* f07a604: 0c00b764 */ jal cdTestAToB4 /* f07a608: 24070022 */ addiu $a3,$zero,0x22 /* f07a60c: 14400007 */ bnez $v0,.L0f07a62c /* f07a610: 27a4013c */ addiu $a0,$sp,0x13c @@ -25536,7 +25536,7 @@ glabel var7f1aa698 /* f07c60c: e626000c */ swc1 $f6,0xc($s1) /* f07c610: afa00010 */ sw $zero,0x10($sp) /* f07c614: 8fa60040 */ lw $a2,0x40($sp) -/* f07c618: 0c00a8cc */ jal coordFindGroundYSimple +/* f07c618: 0c00a8cc */ jal cdFindGroundYSimple /* f07c61c: 8fa40044 */ lw $a0,0x44($sp) /* f07c620: e7a00060 */ swc1 $f0,0x60($sp) /* f07c624: 3c0142c8 */ lui $at,0x42c8 @@ -26594,7 +26594,7 @@ glabel var7f1aa6e4 /* f07d51c: 27a60210 */ addiu $a2,$sp,0x210 /* f07d520: 00003825 */ or $a3,$zero,$zero /* f07d524: afa00010 */ sw $zero,0x10($sp) -/* f07d528: 0c00a8cc */ jal coordFindGroundYSimple +/* f07d528: 0c00a8cc */ jal cdFindGroundYSimple /* f07d52c: a7ad0210 */ sh $t5,0x210($sp) /* f07d530: 3c01420c */ lui $at,0x420c /* f07d534: 44814000 */ mtc1 $at,$f8 @@ -27213,7 +27213,7 @@ glabel var7f1aa6e4 /* f07de08: 13000017 */ beqz $t8,.L0f07de68 /* f07de0c: 27a60140 */ addiu $a2,$sp,0x140 /* f07de10: 00003825 */ or $a3,$zero,$zero -/* f07de14: 0c00a8cc */ jal coordFindGroundYSimple +/* f07de14: 0c00a8cc */ jal cdFindGroundYSimple /* f07de18: afa00010 */ sw $zero,0x10($sp) /* f07de1c: 3c01420c */ lui $at,0x420c /* f07de20: 44812000 */ mtc1 $at,$f4 @@ -27439,7 +27439,7 @@ glabel var7f1aa6e4 // sp210[0] = pad.room; // sp210[1] = -1; // -// sp214.y = coordFindGroundYSimple(&pad.pos, 5, sp210, NULL, NULL) + 35; +// sp214.y = cdFindGroundYSimple(&pad.pos, 5, sp210, NULL, NULL) + 35; // } else { // sp214.y = pad.pos.y; // } @@ -27634,7 +27634,7 @@ glabel var7f1aa6e4 // // // e08 // if (active) { -// sp150.y = coordFindGroundYSimple(&sp150, 5, sp140, NULL, NULL) + 35; +// sp150.y = cdFindGroundYSimple(&sp150, 5, sp140, NULL, NULL) + 35; // // if (sp150.y < -100000) { // sp150.y = prop->pos.y + sp194.y * (hovercar->speed * g_Vars.lvupdate240freal); @@ -28323,7 +28323,7 @@ s32 objTick(struct prop *prop) roomsCopy(sp220, prop->rooms); if (sp148 <= sp144) { - prop->pos.y = coordFindGroundYSimple(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL) + prop->pos.y = cdFindGroundYSimple(&prop->pos, 5, prop->rooms, &obj->floorcol, NULL) + func0f06a620(obj) + sp112; } @@ -34618,7 +34618,7 @@ glabel var7f1aa978 /* f083c34: 2407003f */ addiu $a3,$zero,0x3f /* f083c38: afa00010 */ sw $zero,0x10($sp) /* f083c3c: e7aa0014 */ swc1 $f10,0x14($sp) -/* f083c40: 0c00a9a1 */ jal func0002a684 +/* f083c40: 0c00a9a1 */ jal cdTestVolume /* f083c44: e7b20018 */ swc1 $f18,0x18($sp) /* f083c48: 54400006 */ bnezl $v0,.L0f083c64 /* f083c4c: 02002025 */ or $a0,$s0,$zero @@ -49010,7 +49010,7 @@ glabel var7f1ab214 /* f091864: afa50050 */ sw $a1,0x50($sp) /* f091868: 8fa40208 */ lw $a0,0x208($sp) /* f09186c: 27a601f0 */ addiu $a2,$sp,0x1f0 -/* f091870: 0c00b764 */ jal func0002dd90 +/* f091870: 0c00b764 */ jal cdTestAToB4 /* f091874: 2407003b */ addiu $a3,$zero,0x3b /* f091878: 1440000a */ bnez $v0,.L0f0918a4 /* f09187c: 240a0001 */ addiu $t2,$zero,0x1 diff --git a/src/include/constants.h b/src/include/constants.h index 694af1ddd..50953a2ca 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -529,6 +529,14 @@ #define CDRESULT_COLLISION 0 #define CDRESULT_NOCOLLISION 1 +#define CDTYPE_OBJS 0x01 +#define CDTYPE_DOORS 0x02 +#define CDTYPE_PLAYERS 0x04 +#define CDTYPE_CHRS 0x08 +#define CDTYPE_10 0x10 +#define CDTYPE_BG 0x20 +#define CDTYPE_ALL 0x3f + #define COLOR_00_GREEN 0x00 #define COLOR_02_WHITE 0x02 #define COLOR_03_RED 0x03 diff --git a/src/include/game/bondwalk.h b/src/include/game/bondwalk.h index 72f2a1be8..ab7c4c37e 100644 --- a/src/include/game/bondwalk.h +++ b/src/include/game/bondwalk.h @@ -7,13 +7,13 @@ void currentPlayerWalkInit(void); void currentPlayerSetSwayTarget(s32 value); void currentPlayerAdjustCrouchPos(s32 value); void func0f0c3b38(struct coord *param_1, struct defaultobj *obj); -bool currentPlayerHasGapToCeiling(f32 y); +s32 bwalkTryMoveUpwards(f32 amount); bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4); -bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4); -s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3); -s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *e, s32 arg6); -s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3); -s32 func0f0c4a5c(struct coord *a, struct coord *b, struct coord *c, s32 arg3); +bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 types); +s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 types); +s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *e, s32 types); +s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 types); +s32 func0f0c4a5c(struct coord *a, struct coord *b, struct coord *c, s32 types); void func0f0c4d98(void); void currentPlayerUpdateSpeedSidewaysWalk(f32 targetspeed, f32 accelspeed, s32 mult); void currentPlayerUpdateSpeedForwardsWalk(f32 targetspeed, f32 accelspeed); @@ -22,7 +22,7 @@ void currentPlayerApplyCrouchSpeed(void); void currentPlayerUpdateCrouchOffsetWalk(void); void func0f0c6180(void); void func0f0c6318(void); -void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2); +void func0f0c63bc(struct coord *arg0, u32 arg1, s32 types); void currentPlayerUpdatePrevPosWalk(void); void func0f0c65a8(void); void currentPlayerUpdateSpeedWalk(struct movedata *data); diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index fe8a4c668..63691a23d 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -56,7 +56,7 @@ u32 func0f034410(void); u32 func0f034480(void); void func0f034524(struct chrdata *chr, f32 arg1, struct coord *vector, u8 *arg3, struct prop *prop, u32 arg5, u32 arg6, struct prop *prop2, u32 arg8, u32 arg9, u32 arg10, u32 arg11, u32 arg12, u32 arg13); u32 func0f03645c(void); -bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, struct coord *vector, f32 arg6, u32 arg7); +bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, struct coord *vector, f32 arg6, u32 types); bool propchrHasClearLineToPos(struct prop *prop, struct coord *dstpos, struct coord *vector); bool propchrHasClearLineInVector(struct prop *prop, struct coord *coord, f32 arg2); bool func0f036974(struct prop *prop, struct coord *coord); diff --git a/src/include/lib/lib_233c0.h b/src/include/lib/lib_233c0.h index 84303ad9d..0c853ba40 100644 --- a/src/include/lib/lib_233c0.h +++ b/src/include/lib/lib_233c0.h @@ -33,7 +33,7 @@ u32 func00024f10(void); void func00024f6c(void); u32 func00024fb0(void); u32 func00025038(void); -void func000250cc(struct coord *arg0, struct coord *arg1, f32 arg2); +void func000250cc(struct coord *arg0, struct coord *arg1, f32 width); u32 func00025168(void); u32 func000251ac(void); u32 func00025254(void); @@ -72,22 +72,22 @@ u32 func0002840c(void); u32 func00028638(void); u32 func0002885c(void); u32 func00028914(void); -void func00028df0(struct coord *dstpos, f32 width, s16 *dstrooms, s32 arg3, s32 arg4, s32 arg5, f32 ymax, f32 ymin, s32 *arg8, s32 arg9); +void func00028df0(struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg4, s32 arg5, f32 ymax, f32 ymin, s32 *arg8, s32 arg9); void func0002901c(struct coord *pos, struct coord *dist, f32 width, s32 *arg3); f32 func000296a0(u32 *arg0, struct coord *pos, struct tilething **arg2, f32 width); bool func00029ffc(struct coord *pos, f32 width, f32 foreheadheight, f32 inversefeettoeyesheight, s16 *rooms, u32 arg5, struct coord *laddernormal); u32 func0002a13c(void); -f32 coordFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift); -f32 coordFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype); +f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift); +f32 cdFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype); f32 func0002a36c(struct coord *coord, s16 *rooms, u16 *floorcol, s32 arg3); u32 func0002a400(void); u32 func0002a440(void); u32 func0002a4d0(void); s32 func0002a564(struct coord *pos, s16 *rooms, f32 *arg2, u32 arg3, struct coord *arg4, bool *arg5); u32 func0002a5e4(void); -s32 func0002a684(struct coord *pos, f32 width, s16 *rooms, s32 arg3, s32 arg4, f32 arg5, f32 arg6); +s32 cdTestVolume(struct coord *pos, f32 width, s16 *rooms, s32 types, s32 arg4, f32 ymax, f32 ymin); u32 func0002a6fc(void); -s32 func0002a9f0(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 arg4, s32 arg5, f32 ymax, f32 ymin); +s32 cdTestAToB1(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg5, f32 ymax, f32 ymin); u32 func0002aac0(void); u32 func0002ab98(void); u32 func0002ac70(void); @@ -99,13 +99,13 @@ u32 func0002c328(void); u32 func0002c528(void); u32 func0002c714(void); u32 func0002d15c(void); -s32 func0002d3b0(struct coord *arg0, struct coord *arg1, void *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, f32 arg7, f32 arg8); +s32 func0002d3b0(struct coord *arg0, struct coord *arg1, void *arg2, s32 types, s32 arg4, s32 arg5, s32 arg6, f32 ymax, f32 ymin); bool func0002d6ac(struct coord *pos, s16 *rooms, struct coord *targetpos, u32 arg3, u32 arg4, f32 arg5, f32 arg6); -s32 func0002d72c(struct coord *pos, s16 *rooms, struct coord *coord2, s16 *rooms2, u32 arg4, s32 arg5, f32 arg6, f32 arg7); +s32 cdTestAToB2(struct coord *pos, s16 *rooms, struct coord *coord2, s16 *rooms2, u32 types, s32 arg5, f32 arg6, f32 arg7); bool func0002d7c0(struct coord *pos, s16 *rooms, struct coord *arg2, u32 arg3, u32 arg4, f32 arg5, f32 arg6); u32 func0002d840(void); u32 func0002d8b8(void); -s32 func0002d95c(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 arg4, s32 arg5, s32 arg6, f32 arg7, f32 arg8); +s32 cdTestAToB3(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 arg4, s32 types, s32 arg6, f32 ymax, f32 ymin); u32 func0002da50(void); u32 func0002dac8(void); bool func0002db98(struct coord *viewpos, s16 *rooms, struct coord *targetpos, s32 arg3, u32 arg4); @@ -113,7 +113,7 @@ u32 func0002dc18(struct coord *coord, s16 *room, struct coord *coord2, s32 arg3) bool hasLineOfSight(struct coord *coord, s16 *room, struct coord *coord2, s16 *room2, s32 arg4, s32 arg5); bool func0002dcd0(struct coord *arg0, s16 *rooms1, struct coord *arg2, s16 *rooms2, u32 arg4); bool func0002dcfc(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, s16 *rooms3, u32 arg5, u32 arg6); -u32 func0002dd90(struct coord *pos, s16 *rooms, struct coord *pos2, u32 arg3, u32 arg4); +s32 cdTestAToB4(struct coord *pos, s16 *rooms, struct coord *pos2, u32 types, u32 arg4); u32 func0002de10(void); u32 func0002de34(void); u32 func0002deac(void); diff --git a/src/lib/lib_233c0.c b/src/lib/lib_233c0.c index 08e5fbc87..8424eb8f1 100644 --- a/src/lib/lib_233c0.c +++ b/src/lib/lib_233c0.c @@ -7743,7 +7743,7 @@ glabel func0002a13c /* 2a1ac: 27bd0058 */ addiu $sp,$sp,0x58 ); -f32 coordFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, +f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift) { u32 sp76[105]; @@ -7751,7 +7751,7 @@ f32 coordFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, f32 ground; struct tile *tile = NULL; - func00027d1c(pos, width, rooms, 0x3f, 3, 0, 0, 0, sp76, 20); + func00027d1c(pos, width, rooms, CDTYPE_ALL, 3, 0, 0, 0, sp76, 20); ground = func000296a0(sp76, pos, &sp72, width); if (sp72) { @@ -7800,9 +7800,9 @@ f32 func0002a324(void) return 0; } -f32 coordFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype) +f32 cdFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype) { - return coordFindGroundY(pos, width, rooms, floorcol, floortype, NULL, NULL, NULL, NULL); + return cdFindGroundY(pos, width, rooms, floorcol, floortype, NULL, NULL, NULL, NULL); } GLOBAL_ASM( @@ -8042,7 +8042,7 @@ glabel func0002a5e4 ); GLOBAL_ASM( -glabel func0002a684 +glabel cdTestVolume /* 2a684: 27bdffa0 */ addiu $sp,$sp,-96 /* 2a688: 44856000 */ mtc1 $a1,$f12 /* 2a68c: 8fb80070 */ lw $t8,0x70($sp) @@ -8280,14 +8280,14 @@ glabel func0002a6fc /* 2a9ec: 27bd00a8 */ addiu $sp,$sp,0xa8 ); -s32 func0002a9f0(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 arg4, s32 arg5, f32 ymax, f32 ymin) +s32 cdTestAToB1(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg5, f32 ymax, f32 ymin) { u32 stack[104]; s32 sp44; struct coord dist; s32 result = CDRESULT_NOCOLLISION; - func00028df0(dstpos, width, dstrooms, arg4, 4, arg5, ymax, ymin, &sp44, 20); + func00028df0(dstpos, width, dstrooms, types, 4, arg5, ymax, ymin, &sp44, 20); if (sp44) { result = CDRESULT_COLLISION; @@ -11349,7 +11349,7 @@ glabel func0002d6ac ); GLOBAL_ASM( -glabel func0002d72c +glabel cdTestAToB2 /* 2d72c: 27bdff90 */ addiu $sp,$sp,-112 /* 2d730: afbf002c */ sw $ra,0x2c($sp) /* 2d734: afa7007c */ sw $a3,0x7c($sp) @@ -11506,7 +11506,7 @@ glabel func0002d8b8 /* 2d958: 00000000 */ nop ); -s32 func0002d95c(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 arg4, s32 arg5, s32 arg6, f32 arg7, f32 arg8) +s32 cdTestAToB3(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 width, s32 types, s32 arg6, f32 ymax, f32 ymin) { u32 stack[7]; s16 sp5c[8]; @@ -11516,14 +11516,14 @@ s32 func0002d95c(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f func0f065d1c(arg0, arg1, arg2, sp4c, sp5c, 20); - result = func0002d3b0(arg0, arg2, sp5c, arg5, 4, 0, arg6, arg7, arg8); + result = func0002d3b0(arg0, arg2, sp5c, types, 4, 0, arg6, ymax, ymin); if (result == CDRESULT_COLLISION) { sp40.x = arg2->x - arg0->x; sp40.y = arg2->y - arg0->y; sp40.z = arg2->z - arg0->z; - func000250cc(arg0, &sp40, arg4); + func000250cc(arg0, &sp40, width); } else if (!arrayIntersects(sp4c, arg3)) { func00024f6c(); result = -1; @@ -11772,7 +11772,7 @@ glabel func0002dcfc ); GLOBAL_ASM( -glabel func0002dd90 +glabel cdTestAToB4 /* 2dd90: 27bdff90 */ addiu $sp,$sp,-112 /* 2dd94: afa60078 */ sw $a2,0x78($sp) /* 2dd98: 00a03025 */ or $a2,$a1,$zero @@ -11812,7 +11812,7 @@ glabel func0002de10 /* 2de10: 27bdffe0 */ addiu $sp,$sp,-32 /* 2de14: afbf001c */ sw $ra,0x1c($sp) /* 2de18: 240e001c */ addiu $t6,$zero,0x1c -/* 2de1c: 0c00b764 */ jal func0002dd90 +/* 2de1c: 0c00b764 */ jal cdTestAToB4 /* 2de20: afae0010 */ sw $t6,0x10($sp) /* 2de24: 8fbf001c */ lw $ra,0x1c($sp) /* 2de28: 27bd0020 */ addiu $sp,$sp,0x20