From 6e3d0957134edae5feca6a5a175ff1428c561a75 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 11 Jan 2021 00:30:31 +1000 Subject: [PATCH] Decompile bwalkCalculateNewPosition --- src/game/bondbike.c | 16 +- src/game/bondeyespy.c | 20 +- src/game/bondgrab.c | 20 +- src/game/bondwalk.c | 427 ++++++++++----------------------- src/game/chr/chraction.c | 30 +-- src/game/game_0601b0.c | 2 +- src/game/game_0b63b0.c | 2 +- src/game/propobj.c | 44 ++-- src/include/game/bondeyespy.h | 2 +- src/include/game/bondwalk.h | 2 +- src/include/game/game_0601b0.h | 2 +- src/include/gvars/gvars.h | 4 +- src/include/types.h | 2 +- src/lib/lib_15860.c | 4 +- 14 files changed, 195 insertions(+), 382 deletions(-) diff --git a/src/game/bondbike.c b/src/game/bondbike.c index c1ab84a3e..7db82d93a 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -146,8 +146,8 @@ void currentPlayerTryBikeDismountAngle(f32 relativeangle, f32 distance) pos.y = g_Vars.currentplayer->hoverbike->pos.y; pos.z = g_Vars.currentplayer->hoverbike->pos.z + cosf(angle) * distance; - func0f064178(g_Vars.currentplayer->hoverbike, false); - func0f064178(g_Vars.currentplayer->prop, false); + propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, false); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, false); func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &pos, rooms); func0f0cb79c(g_Vars.currentplayer, &pos, rooms); @@ -157,7 +157,7 @@ void currentPlayerTryBikeDismountAngle(f32 relativeangle, f32 distance) ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); - func0f064178(g_Vars.currentplayer->hoverbike, true); + propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, true); if (usable == true) { usable = func0002a684(&pos, width, rooms, 0x3f, true, @@ -177,7 +177,7 @@ void currentPlayerTryBikeDismountAngle(f32 relativeangle, f32 distance) g_Vars.currentplayer->moveinitspeed.z = bike->speed[1]; } - func0f064178(g_Vars.currentplayer->prop, true); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); } } @@ -907,11 +907,11 @@ glabel var7f1adb7c /* f0d2eb0: c7a4013c */ lwc1 $f4,0x13c($sp) /* f0d2eb4: 8c6400bc */ lw $a0,0xbc($v1) .L0f0d2eb8: -/* f0d2eb8: 0fc1905e */ jal func0f064178 +/* f0d2eb8: 0fc1905e */ jal propSetCollisionsEnabled /* f0d2ebc: afa60138 */ sw $a2,0x138($sp) /* f0d2ec0: 8e390284 */ lw $t9,0x284($s1) /* f0d2ec4: 00002825 */ or $a1,$zero,$zero -/* f0d2ec8: 0fc1905e */ jal func0f064178 +/* f0d2ec8: 0fc1905e */ jal propSetCollisionsEnabled /* f0d2ecc: 8f241a6c */ lw $a0,0x1a6c($t9) /* f0d2ed0: 8fa20138 */ lw $v0,0x138($sp) /* f0d2ed4: c7a40128 */ lwc1 $f4,0x128($sp) @@ -1066,11 +1066,11 @@ glabel var7f1adb7c .L0f0d311c: /* f0d311c: 8e390284 */ lw $t9,0x284($s1) /* f0d3120: 24050001 */ addiu $a1,$zero,0x1 -/* f0d3124: 0fc1905e */ jal func0f064178 +/* f0d3124: 0fc1905e */ jal propSetCollisionsEnabled /* f0d3128: 8f2400bc */ lw $a0,0xbc($t9) /* f0d312c: 8e280284 */ lw $t0,0x284($s1) /* f0d3130: 24050001 */ addiu $a1,$zero,0x1 -/* f0d3134: 0fc1905e */ jal func0f064178 +/* f0d3134: 0fc1905e */ jal propSetCollisionsEnabled /* f0d3138: 8d041a6c */ lw $a0,0x1a6c($t0) /* f0d313c: 44800000 */ mtc1 $zero,$f0 /* f0d3140: 00000000 */ nop diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 8c769faf9..feb25243f 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -141,7 +141,7 @@ glabel var7f1ada8c /* f0cf2f0: 0fc087ea */ jal func0f021fa8 /* f0cf2f4: 27a60050 */ addiu $a2,$sp,0x50 /* f0cf2f8: 02002025 */ or $a0,$s0,$zero -/* f0cf2fc: 0fc1905e */ jal func0f064178 +/* f0cf2fc: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf300: 00002825 */ or $a1,$zero,$zero /* f0cf304: 3c017f1b */ lui $at,%hi(var7f1ada84) /* f0cf308: c7a00044 */ lwc1 $f0,0x44($sp) @@ -160,7 +160,7 @@ glabel var7f1ada8c /* f0cf33c: e7aa0014 */ swc1 $f10,0x14($sp) /* f0cf340: afa20074 */ sw $v0,0x74($sp) /* f0cf344: 02002025 */ or $a0,$s0,$zero -/* f0cf348: 0fc1905e */ jal func0f064178 +/* f0cf348: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf34c: 24050001 */ addiu $a1,$zero,0x1 /* f0cf350: 8faa0074 */ lw $t2,0x74($sp) /* f0cf354: 24010001 */ addiu $at,$zero,0x1 @@ -180,7 +180,7 @@ glabel var7f1ada8c /* f0cf388: 27bd0078 */ addiu $sp,$sp,0x78 ); -s32 func0f0cf38c(struct coord *vel) +s32 eyespyCalculateNewPosition(struct coord *vel) { bool result = true; struct prop *eyespyprop = g_Vars.currentplayer->eyespy->prop; @@ -204,17 +204,13 @@ s32 func0f0cf38c(struct coord *vel) eyespyFindGround(&floorroom); if (vel->x || vel->y || vel->z) { - func0f064178(eyespyprop, false); + propSetCollisionsEnabled(eyespyprop, false); dstpos.x = vel->x + eyespyprop->pos.x; dstpos.y = vel->y + eyespyprop->pos.y; dstpos.z = vel->z + eyespyprop->pos.z; - if (g_Vars.unk000328) { - sp70 = 63; - } else { - sp70 = 32; - } + sp70 = g_Vars.bondcollisions ? 63 : 32; // Allow eyespy to go up steps 30cm or less if (g_Vars.currentplayer->eyespy->oldground <= chr->manground + 30) { @@ -269,7 +265,7 @@ s32 func0f0cf38c(struct coord *vel) } } - func0f064178(eyespyprop, true); + propSetCollisionsEnabled(eyespyprop, true); if (result == 1) { // Apply the destination @@ -288,7 +284,7 @@ s32 func0f0cf38c(struct coord *vel) bool func0f0cf728(struct coord *vel) { - s32 moved = func0f0cf38c(vel); + s32 moved = eyespyCalculateNewPosition(vel); struct prop *prop; if (moved != true) { @@ -1373,7 +1369,7 @@ glabel var7f1ada9c /* f0d07a8: e62200d0 */ swc1 $f2,0xd0($s1) /* f0d07ac: 8e190284 */ lw $t9,0x284($s0) /* f0d07b0: 8f290480 */ lw $t1,0x480($t9) -/* f0d07b4: 0fc1905e */ jal func0f064178 +/* f0d07b4: 0fc1905e */ jal propSetCollisionsEnabled /* f0d07b8: 8d240000 */ lw $a0,0x0($t1) /* f0d07bc: 0fc5b9f1 */ jal langGet /* f0d07c0: 240458da */ addiu $a0,$zero,0x58da diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index 04e12b1da..b6092e180 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -498,7 +498,7 @@ bool func0f0cd05c(f32 y) propPlayerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin); func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &newpos, rooms); func0f0cb79c(g_Vars.currentplayer, &newpos, rooms); - func0f064178(g_Vars.currentplayer->prop, false); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, false); ymin -= 0.1f; @@ -506,7 +506,7 @@ bool func0f0cd05c(f32 y) ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); - func0f064178(g_Vars.currentplayer->prop, true); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); if (result == 1) { g_Vars.currentplayer->prop->pos.y = newpos.y; @@ -568,11 +568,11 @@ glabel var7f1ad9c4 /* f0cd1f4: 8de400bc */ lw $a0,0xbc($t7) /* f0cd1f8: 8e180284 */ lw $t8,0x284($s0) /* f0cd1fc: 00002825 */ or $a1,$zero,$zero -/* f0cd200: 0fc1905e */ jal func0f064178 +/* f0cd200: 0fc1905e */ jal propSetCollisionsEnabled /* f0cd204: 8f0400bc */ lw $a0,0xbc($t8) /* f0cd208: 8e190284 */ lw $t9,0x284($s0) /* f0cd20c: 00002825 */ or $a1,$zero,$zero -/* f0cd210: 0fc1905e */ jal func0f064178 +/* f0cd210: 0fc1905e */ jal propSetCollisionsEnabled /* f0cd214: 8f241b5c */ lw $a0,0x1b5c($t9) /* f0cd218: 8e080284 */ lw $t0,0x284($s0) /* f0cd21c: 8fa300f0 */ lw $v1,0xf0($sp) @@ -676,7 +676,7 @@ glabel var7f1ad9c4 /* f0cd39c: 8e0c0284 */ lw $t4,0x284($s0) .L0f0cd3a0: /* f0cd3a0: 24050001 */ addiu $a1,$zero,0x1 -/* f0cd3a4: 0fc1905e */ jal func0f064178 +/* f0cd3a4: 0fc1905e */ jal propSetCollisionsEnabled /* f0cd3a8: 8d841b5c */ lw $a0,0x1b5c($t4) /* f0cd3ac: 8fad00ec */ lw $t5,0xec($sp) /* f0cd3b0: 24010001 */ addiu $at,$zero,0x1 @@ -971,7 +971,7 @@ glabel var7f1ad9c4 .L0f0cd7ec: /* f0cd7ec: c7b600b8 */ lwc1 $f22,0xb8($sp) /* f0cd7f0: 24050001 */ addiu $a1,$zero,0x1 -/* f0cd7f4: 0fc1905e */ jal func0f064178 +/* f0cd7f4: 0fc1905e */ jal propSetCollisionsEnabled /* f0cd7f8: 8d6400bc */ lw $a0,0xbc($t3) /* f0cd7fc: 3c017f1b */ lui $at,%hi(var7f1ad9c4) /* f0cd800: c422d9c4 */ lwc1 $f2,%lo(var7f1ad9c4)($at) @@ -2292,10 +2292,10 @@ glabel var7f1ada30 /* f0cf03c: 46002181 */ sub.s $f6,$f4,$f0 /* f0cf040: 46083281 */ sub.s $f10,$f6,$f8 /* f0cf044: e7aa0030 */ swc1 $f10,0x30($sp) -/* f0cf048: 0fc1905e */ jal func0f064178 +/* f0cf048: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf04c: 8e0400bc */ lw $a0,0xbc($s0) /* f0cf050: 8fa4002c */ lw $a0,0x2c($sp) -/* f0cf054: 0fc1905e */ jal func0f064178 +/* f0cf054: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf058: 00002825 */ or $a1,$zero,$zero /* f0cf05c: 3c10800a */ lui $s0,%hi(g_Vars+0x284) /* f0cf060: 8e10a244 */ lw $s0,%lo(g_Vars+0x284)($s0) @@ -2347,10 +2347,10 @@ glabel var7f1ada30 /* f0cf110: 3c18800a */ lui $t8,%hi(g_Vars+0x284) /* f0cf114: 8f18a244 */ lw $t8,%lo(g_Vars+0x284)($t8) /* f0cf118: 24050001 */ addiu $a1,$zero,0x1 -/* f0cf11c: 0fc1905e */ jal func0f064178 +/* f0cf11c: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf120: 8f0400bc */ lw $a0,0xbc($t8) /* f0cf124: 8fa4002c */ lw $a0,0x2c($sp) -/* f0cf128: 0fc1905e */ jal func0f064178 +/* f0cf128: 0fc1905e */ jal propSetCollisionsEnabled /* f0cf12c: 24050001 */ addiu $a1,$zero,0x1 /* f0cf130: 8fbf0024 */ lw $ra,0x24($sp) .L0f0cf134: diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 80f67c8c0..ef73f42a4 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -109,9 +109,9 @@ void currentPlayerWalkInit(void) delta.y = 0; delta.z = g_Vars.currentplayer->walkinitpos.z - g_Vars.currentplayer->prop->pos.z; - func0f064178(g_Vars.currentplayer->hoverbike, false); + propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, false); func0f0c4250(&delta, 0, 1, 0, 63); - func0f064178(g_Vars.currentplayer->hoverbike, true); + propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, true); } else if (prevmode != MOVEMODE_GRAB && prevmode != MOVEMODE_WALK) { g_Vars.currentplayer->moveinitspeed.x = 0; g_Vars.currentplayer->moveinitspeed.y = 0; @@ -278,21 +278,21 @@ bool currentPlayerHasGapToCeiling(f32 y) f32 width; if (g_Vars.currentplayer->floorflags & FLOORFLAG_0100) { - g_Vars.unk00032c = false; + g_Vars.enableslopes = false; } else { - g_Vars.unk00032c = true; + g_Vars.enableslopes = true; } 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; - something = g_Vars.unk000328 ? 63 : 32; + something = g_Vars.bondcollisions ? 63 : 32; propPlayerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin); func0f065e74(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &newpos, rooms); func0f0cb79c(g_Vars.currentplayer, &newpos, rooms); - func0f064178(g_Vars.currentplayer->prop, false); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, false); ymin -= 0.1f; @@ -300,7 +300,7 @@ bool currentPlayerHasGapToCeiling(f32 y) ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); - func0f064178(g_Vars.currentplayer->prop, true); + propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); if (result == true) { g_Vars.currentplayer->prop->pos.y = newpos.y; @@ -308,305 +308,122 @@ bool currentPlayerHasGapToCeiling(f32 y) roomsCopy(rooms, g_Vars.currentplayer->prop->rooms); } - g_Vars.unk00032c = true; + g_Vars.enableslopes = true; return result; } -GLOBAL_ASM( -glabel func0f0c3e14 -.late_rodata -glabel var7f1ad788 -.word 0x40c907a9 -.text -/* f0c3e14: 27bdff48 */ addiu $sp,$sp,-184 -/* f0c3e18: afb00030 */ sw $s0,0x30($sp) -/* f0c3e1c: 3c10800a */ lui $s0,%hi(g_Vars) -/* f0c3e20: 26109fc0 */ addiu $s0,$s0,%lo(g_Vars) -/* f0c3e24: 8e020284 */ lw $v0,0x284($s0) -/* f0c3e28: afbf0034 */ sw $ra,0x34($sp) -/* f0c3e2c: afa400b8 */ sw $a0,0xb8($sp) -/* f0c3e30: afa500bc */ sw $a1,0xbc($sp) -/* f0c3e34: afa600c0 */ sw $a2,0xc0($sp) -/* f0c3e38: afa700c4 */ sw $a3,0xc4($sp) -/* f0c3e3c: afa00090 */ sw $zero,0x90($sp) -/* f0c3e40: 944e161c */ lhu $t6,0x161c($v0) -/* f0c3e44: 00803825 */ or $a3,$a0,$zero -/* f0c3e48: 24030001 */ addiu $v1,$zero,0x1 -/* f0c3e4c: 31cf0100 */ andi $t7,$t6,0x100 -/* f0c3e50: 11e00003 */ beqz $t7,.L0f0c3e60 -/* f0c3e54: 24180001 */ addiu $t8,$zero,0x1 -/* f0c3e58: 10000002 */ b .L0f0c3e64 -/* f0c3e5c: ae00032c */ sw $zero,0x32c($s0) -.L0f0c3e60: -/* f0c3e60: ae18032c */ sw $t8,0x32c($s0) -.L0f0c3e64: -/* f0c3e64: 8c5900bc */ lw $t9,0xbc($v0) -/* f0c3e68: 44808000 */ mtc1 $zero,$f16 -/* f0c3e6c: c7240008 */ lwc1 $f4,0x8($t9) -/* f0c3e70: e7a400a4 */ swc1 $f4,0xa4($sp) -/* f0c3e74: 8c4800bc */ lw $t0,0xbc($v0) -/* f0c3e78: c506000c */ lwc1 $f6,0xc($t0) -/* f0c3e7c: e7a600a8 */ swc1 $f6,0xa8($sp) -/* f0c3e80: 8c4900bc */ lw $t1,0xbc($v0) -/* f0c3e84: c5280010 */ lwc1 $f8,0x10($t1) -/* f0c3e88: e7a800ac */ swc1 $f8,0xac($sp) -/* f0c3e8c: c4ea0000 */ lwc1 $f10,0x0($a3) -/* f0c3e90: 460a8032 */ c.eq.s $f16,$f10 -/* f0c3e94: 00000000 */ nop -/* f0c3e98: 4502000c */ bc1fl .L0f0c3ecc -/* f0c3e9c: 8c441aec */ lw $a0,0x1aec($v0) -/* f0c3ea0: c4f20004 */ lwc1 $f18,0x4($a3) -/* f0c3ea4: 46128032 */ c.eq.s $f16,$f18 -/* f0c3ea8: 00000000 */ nop -/* f0c3eac: 45020007 */ bc1fl .L0f0c3ecc -/* f0c3eb0: 8c441aec */ lw $a0,0x1aec($v0) -/* f0c3eb4: c4e40008 */ lwc1 $f4,0x8($a3) -/* f0c3eb8: 46048032 */ c.eq.s $f16,$f4 -/* f0c3ebc: 00000000 */ nop -/* f0c3ec0: 450300a3 */ bc1tl .L0f0c4150 -/* f0c3ec4: 24010001 */ addiu $at,$zero,0x1 -/* f0c3ec8: 8c441aec */ lw $a0,0x1aec($v0) -.L0f0c3ecc: -/* f0c3ecc: 00002825 */ or $a1,$zero,$zero -/* f0c3ed0: 50800006 */ beqzl $a0,.L0f0c3eec -/* f0c3ed4: 8c4400bc */ lw $a0,0xbc($v0) -/* f0c3ed8: 0fc1905e */ jal func0f064178 -/* f0c3edc: afa700b8 */ sw $a3,0xb8($sp) -/* f0c3ee0: 8fa700b8 */ lw $a3,0xb8($sp) -/* f0c3ee4: 8e020284 */ lw $v0,0x284($s0) -/* f0c3ee8: 8c4400bc */ lw $a0,0xbc($v0) -.L0f0c3eec: -/* f0c3eec: afa700b8 */ sw $a3,0xb8($sp) -/* f0c3ef0: 0fc1905e */ jal func0f064178 -/* f0c3ef4: 00002825 */ or $a1,$zero,$zero -/* f0c3ef8: 8fa700b8 */ lw $a3,0xb8($sp) -/* f0c3efc: c7a600a4 */ lwc1 $f6,0xa4($sp) -/* f0c3f00: c7b200a8 */ lwc1 $f18,0xa8($sp) -/* f0c3f04: c4e80000 */ lwc1 $f8,0x0($a3) -/* f0c3f08: 8e0a0328 */ lw $t2,0x328($s0) -/* f0c3f0c: 240c0020 */ addiu $t4,$zero,0x20 -/* f0c3f10: 46083280 */ add.s $f10,$f6,$f8 -/* f0c3f14: c7a800ac */ lwc1 $f8,0xac($sp) -/* f0c3f18: 8fab00c8 */ lw $t3,0xc8($sp) -/* f0c3f1c: 27a50054 */ addiu $a1,$sp,0x54 -/* f0c3f20: e7aa00a4 */ swc1 $f10,0xa4($sp) -/* f0c3f24: c4e40004 */ lwc1 $f4,0x4($a3) -/* f0c3f28: 27a6005c */ addiu $a2,$sp,0x5c -/* f0c3f2c: 46049180 */ add.s $f6,$f18,$f4 -/* f0c3f30: e7a600a8 */ swc1 $f6,0xa8($sp) -/* f0c3f34: c4ea0008 */ lwc1 $f10,0x8($a3) -/* f0c3f38: 460a4480 */ add.s $f18,$f8,$f10 -/* f0c3f3c: 11400003 */ beqz $t2,.L0f0c3f4c -/* f0c3f40: e7b200ac */ swc1 $f18,0xac($sp) -/* f0c3f44: 10000002 */ b .L0f0c3f50 -/* f0c3f48: afab0060 */ sw $t3,0x60($sp) -.L0f0c3f4c: -/* f0c3f4c: afac0060 */ sw $t4,0x60($sp) -.L0f0c3f50: -/* f0c3f50: 8e0d0284 */ lw $t5,0x284($s0) -/* f0c3f54: 27a70058 */ addiu $a3,$sp,0x58 -/* f0c3f58: 0fc3082e */ jal propPlayerGetBbox -/* f0c3f5c: 8da400bc */ lw $a0,0xbc($t5) -/* f0c3f60: c7a40054 */ lwc1 $f4,0x54($sp) -/* f0c3f64: c7a600c4 */ lwc1 $f6,0xc4($sp) -/* f0c3f68: 8e0e0284 */ lw $t6,0x284($s0) -/* f0c3f6c: 27af0064 */ addiu $t7,$sp,0x64 -/* f0c3f70: 46062200 */ add.s $f8,$f4,$f6 -/* f0c3f74: 24180014 */ addiu $t8,$zero,0x14 -/* f0c3f78: 27a600a4 */ addiu $a2,$sp,0xa4 -/* f0c3f7c: 27a70094 */ addiu $a3,$sp,0x94 -/* f0c3f80: e7a80054 */ swc1 $f8,0x54($sp) -/* f0c3f84: 8dc200bc */ lw $v0,0xbc($t6) -/* f0c3f88: afb80014 */ sw $t8,0x14($sp) -/* f0c3f8c: afaf0010 */ sw $t7,0x10($sp) -/* f0c3f90: 24440008 */ addiu $a0,$v0,0x8 -/* f0c3f94: 0fc1977f */ jal func0f065dfc -/* f0c3f98: 24450028 */ addiu $a1,$v0,0x28 -/* f0c3f9c: 8e040284 */ lw $a0,0x284($s0) -/* f0c3fa0: 27a500a4 */ addiu $a1,$sp,0xa4 -/* f0c3fa4: 0fc32de7 */ jal func0f0cb79c -/* f0c3fa8: 27a60094 */ addiu $a2,$sp,0x94 -/* f0c3fac: 8e080284 */ lw $t0,0x284($s0) -/* f0c3fb0: 24190001 */ addiu $t9,$zero,0x1 -/* f0c3fb4: afb90090 */ sw $t9,0x90($sp) -/* f0c3fb8: 8d0200bc */ lw $v0,0xbc($t0) -/* f0c3fbc: c7aa00a4 */ lwc1 $f10,0xa4($sp) -/* f0c3fc0: 3c013f00 */ lui $at,0x3f00 -/* f0c3fc4: c4520008 */ lwc1 $f18,0x8($v0) -/* f0c3fc8: c7a80054 */ lwc1 $f8,0x54($sp) -/* f0c3fcc: c7a400ac */ lwc1 $f4,0xac($sp) -/* f0c3fd0: 46125081 */ sub.s $f2,$f10,$f18 -/* f0c3fd4: 44815000 */ mtc1 $at,$f10 -/* f0c3fd8: c4460010 */ lwc1 $f6,0x10($v0) -/* f0c3fdc: c7b20054 */ lwc1 $f18,0x54($sp) -/* f0c3fe0: 460a4002 */ mul.s $f0,$f8,$f10 -/* f0c3fe4: 240a0001 */ addiu $t2,$zero,0x1 -/* f0c3fe8: 46062301 */ sub.s $f12,$f4,$f6 -/* f0c3fec: 4602003c */ c.lt.s $f0,$f2 -/* f0c3ff0: 00000000 */ nop -/* f0c3ff4: 45030010 */ bc1tl .L0f0c4038 -/* f0c3ff8: 8fa90060 */ lw $t1,0x60($sp) -/* f0c3ffc: 460c003c */ c.lt.s $f0,$f12 -/* f0c4000: 00000000 */ nop -/* f0c4004: 4503000c */ bc1tl .L0f0c4038 -/* f0c4008: 8fa90060 */ lw $t1,0x60($sp) -/* f0c400c: 46000387 */ neg.s $f14,$f0 -/* f0c4010: 460e103c */ c.lt.s $f2,$f14 -/* f0c4014: 00000000 */ nop -/* f0c4018: 45030007 */ bc1tl .L0f0c4038 -/* f0c401c: 8fa90060 */ lw $t1,0x60($sp) -/* f0c4020: 460e603c */ c.lt.s $f12,$f14 -/* f0c4024: 8fae0060 */ lw $t6,0x60($sp) -/* f0c4028: 240f0001 */ addiu $t7,$zero,0x1 -/* f0c402c: 45020029 */ bc1fl .L0f0c40d4 -/* f0c4030: afae0010 */ sw $t6,0x10($sp) -/* f0c4034: 8fa90060 */ lw $t1,0x60($sp) -.L0f0c4038: -/* f0c4038: e7b20010 */ swc1 $f18,0x10($sp) -/* f0c403c: afaa0018 */ sw $t2,0x18($sp) -/* f0c4040: afa90014 */ sw $t1,0x14($sp) -/* f0c4044: c440000c */ lwc1 $f0,0xc($v0) -/* f0c4048: c7a4005c */ lwc1 $f4,0x5c($sp) -/* f0c404c: c7a80058 */ lwc1 $f8,0x58($sp) -/* f0c4050: 24440008 */ addiu $a0,$v0,0x8 -/* f0c4054: 46002181 */ sub.s $f6,$f4,$f0 -/* f0c4058: 24450028 */ addiu $a1,$v0,0x28 -/* f0c405c: 27a600a4 */ addiu $a2,$sp,0xa4 -/* f0c4060: 46004281 */ sub.s $f10,$f8,$f0 -/* f0c4064: e7a6001c */ swc1 $f6,0x1c($sp) -/* f0c4068: 27a70094 */ addiu $a3,$sp,0x94 -/* f0c406c: 0c00b657 */ jal func0002d95c -/* f0c4070: e7aa0020 */ swc1 $f10,0x20($sp) -/* f0c4074: 24010001 */ addiu $at,$zero,0x1 -/* f0c4078: 14410024 */ bne $v0,$at,.L0f0c410c -/* f0c407c: 00401825 */ or $v1,$v0,$zero -/* f0c4080: 8e0b0284 */ lw $t3,0x284($s0) -/* f0c4084: 8fac0060 */ lw $t4,0x60($sp) -/* f0c4088: 240d0001 */ addiu $t5,$zero,0x1 -/* f0c408c: 8d6200bc */ lw $v0,0xbc($t3) -/* f0c4090: afad0014 */ sw $t5,0x14($sp) -/* f0c4094: afac0010 */ sw $t4,0x10($sp) -/* f0c4098: c440000c */ lwc1 $f0,0xc($v0) -/* f0c409c: c7b2005c */ lwc1 $f18,0x5c($sp) -/* f0c40a0: c7a60058 */ lwc1 $f6,0x58($sp) -/* f0c40a4: 27a500a4 */ addiu $a1,$sp,0xa4 -/* f0c40a8: 46009101 */ sub.s $f4,$f18,$f0 -/* f0c40ac: 8fa60054 */ lw $a2,0x54($sp) -/* f0c40b0: 27a70094 */ addiu $a3,$sp,0x94 -/* f0c40b4: 46003201 */ sub.s $f8,$f6,$f0 -/* f0c40b8: e7a40018 */ swc1 $f4,0x18($sp) -/* f0c40bc: 24440008 */ addiu $a0,$v0,0x8 -/* f0c40c0: 0c00aa7c */ jal func0002a9f0 -/* f0c40c4: e7a8001c */ swc1 $f8,0x1c($sp) -/* f0c40c8: 10000010 */ b .L0f0c410c -/* f0c40cc: 00401825 */ or $v1,$v0,$zero -/* f0c40d0: afae0010 */ sw $t6,0x10($sp) -.L0f0c40d4: -/* f0c40d4: afaf0014 */ sw $t7,0x14($sp) -/* f0c40d8: c440000c */ lwc1 $f0,0xc($v0) -/* f0c40dc: c7aa005c */ lwc1 $f10,0x5c($sp) -/* f0c40e0: c7a40058 */ lwc1 $f4,0x58($sp) -/* f0c40e4: 24440008 */ addiu $a0,$v0,0x8 -/* f0c40e8: 46005481 */ sub.s $f18,$f10,$f0 -/* f0c40ec: 27a500a4 */ addiu $a1,$sp,0xa4 -/* f0c40f0: 8fa60054 */ lw $a2,0x54($sp) -/* f0c40f4: 46002181 */ sub.s $f6,$f4,$f0 -/* f0c40f8: e7b20018 */ swc1 $f18,0x18($sp) -/* f0c40fc: 27a70064 */ addiu $a3,$sp,0x64 -/* f0c4100: 0c00aa7c */ jal func0002a9f0 -/* f0c4104: e7a6001c */ swc1 $f6,0x1c($sp) -/* f0c4108: 00401825 */ or $v1,$v0,$zero -.L0f0c410c: -/* f0c410c: 8e180284 */ lw $t8,0x284($s0) -/* f0c4110: 24050001 */ addiu $a1,$zero,0x1 -/* f0c4114: 8f0400bc */ lw $a0,0xbc($t8) -/* f0c4118: 0fc1905e */ jal func0f064178 -/* f0c411c: afa300b4 */ sw $v1,0xb4($sp) -/* f0c4120: 8e190284 */ lw $t9,0x284($s0) -/* f0c4124: 44808000 */ mtc1 $zero,$f16 -/* f0c4128: 8fa300b4 */ lw $v1,0xb4($sp) -/* f0c412c: 8f241aec */ lw $a0,0x1aec($t9) -/* f0c4130: 24050001 */ addiu $a1,$zero,0x1 -/* f0c4134: 50800006 */ beqzl $a0,.L0f0c4150 -/* f0c4138: 24010001 */ addiu $at,$zero,0x1 -/* f0c413c: 0fc1905e */ jal func0f064178 -/* f0c4140: afa300b4 */ sw $v1,0xb4($sp) -/* f0c4144: 44808000 */ mtc1 $zero,$f16 -/* f0c4148: 8fa300b4 */ lw $v1,0xb4($sp) -/* f0c414c: 24010001 */ addiu $at,$zero,0x1 -.L0f0c4150: -/* f0c4150: 14610038 */ bne $v1,$at,.L0f0c4234 -/* f0c4154: 8fa800c0 */ lw $t0,0xc0($sp) -/* f0c4158: 11000036 */ beqz $t0,.L0f0c4234 -/* f0c415c: 3c0143b4 */ lui $at,0x43b4 -/* f0c4160: 44811000 */ mtc1 $at,$f2 -/* f0c4164: c7a800bc */ lwc1 $f8,0xbc($sp) -/* f0c4168: 3c017f1b */ lui $at,%hi(var7f1ad788) -/* f0c416c: c432d788 */ lwc1 $f18,%lo(var7f1ad788)($at) -/* f0c4170: 46024282 */ mul.s $f10,$f8,$f2 -/* f0c4174: 8e020284 */ lw $v0,0x284($s0) -/* f0c4178: c4460144 */ lwc1 $f6,0x144($v0) -/* f0c417c: 46125103 */ div.s $f4,$f10,$f18 -/* f0c4180: 46043000 */ add.s $f0,$f6,$f4 -/* f0c4184: 4610003c */ c.lt.s $f0,$f16 -/* f0c4188: 00000000 */ nop -/* f0c418c: 45020007 */ bc1fl .L0f0c41ac -/* f0c4190: 4600103e */ c.le.s $f2,$f0 -/* f0c4194: 46020000 */ add.s $f0,$f0,$f2 -.L0f0c4198: -/* f0c4198: 4610003c */ c.lt.s $f0,$f16 -/* f0c419c: 00000000 */ nop -/* f0c41a0: 4503fffd */ bc1tl .L0f0c4198 -/* f0c41a4: 46020000 */ add.s $f0,$f0,$f2 -/* f0c41a8: 4600103e */ c.le.s $f2,$f0 -.L0f0c41ac: -/* f0c41ac: 00000000 */ nop -/* f0c41b0: 45020007 */ bc1fl .L0f0c41d0 -/* f0c41b4: e4400144 */ swc1 $f0,0x144($v0) -/* f0c41b8: 46020001 */ sub.s $f0,$f0,$f2 -.L0f0c41bc: -/* f0c41bc: 4600103e */ c.le.s $f2,$f0 -/* f0c41c0: 00000000 */ nop -/* f0c41c4: 4503fffd */ bc1tl .L0f0c41bc -/* f0c41c8: 46020001 */ sub.s $f0,$f0,$f2 -/* f0c41cc: e4400144 */ swc1 $f0,0x144($v0) -.L0f0c41d0: -/* f0c41d0: 8e090284 */ lw $t1,0x284($s0) -/* f0c41d4: c7a800a4 */ lwc1 $f8,0xa4($sp) -/* f0c41d8: 8d2a00bc */ lw $t2,0xbc($t1) -/* f0c41dc: e5480008 */ swc1 $f8,0x8($t2) -/* f0c41e0: 8e0b0284 */ lw $t3,0x284($s0) -/* f0c41e4: c7aa00a8 */ lwc1 $f10,0xa8($sp) -/* f0c41e8: 8d6c00bc */ lw $t4,0xbc($t3) -/* f0c41ec: e58a000c */ swc1 $f10,0xc($t4) -/* f0c41f0: 8e0d0284 */ lw $t5,0x284($s0) -/* f0c41f4: c7b200ac */ lwc1 $f18,0xac($sp) -/* f0c41f8: 8dae00bc */ lw $t6,0xbc($t5) -/* f0c41fc: e5d20010 */ swc1 $f18,0x10($t6) -/* f0c4200: 8faf0090 */ lw $t7,0x90($sp) -/* f0c4204: 51e0000c */ beqzl $t7,.L0f0c4238 -/* f0c4208: 8fbf0034 */ lw $ra,0x34($sp) -/* f0c420c: 8e180284 */ lw $t8,0x284($s0) -/* f0c4210: 8f0400bc */ lw $a0,0xbc($t8) -/* f0c4214: 0fc19711 */ jal func0f065c44 -/* f0c4218: afa300b4 */ sw $v1,0xb4($sp) -/* f0c421c: 8e190284 */ lw $t9,0x284($s0) -/* f0c4220: 27a40094 */ addiu $a0,$sp,0x94 -/* f0c4224: 8f2500bc */ lw $a1,0xbc($t9) -/* f0c4228: 0fc195e9 */ jal roomsCopy -/* f0c422c: 24a50028 */ addiu $a1,$a1,0x28 -/* f0c4230: 8fa300b4 */ lw $v1,0xb4($sp) -.L0f0c4234: -/* f0c4234: 8fbf0034 */ lw $ra,0x34($sp) -.L0f0c4238: -/* f0c4238: 24080001 */ addiu $t0,$zero,0x1 -/* f0c423c: ae08032c */ sw $t0,0x32c($s0) -/* f0c4240: 8fb00030 */ lw $s0,0x30($sp) -/* f0c4244: 27bd00b8 */ addiu $sp,$sp,0xb8 -/* f0c4248: 03e00008 */ jr $ra -/* f0c424c: 00601025 */ or $v0,$v1,$zero -); +bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4) +{ + bool valid = true; + f32 halfwidth; + struct coord dstpos; + s16 dstrooms[8]; + bool copyrooms = false; + s16 sp64[22]; + s32 sp60; + f32 ymax; + f32 ymin; + f32 width; + f32 xdiff; + f32 zdiff; + u32 stack; + + if (g_Vars.currentplayer->floorflags & FLOORFLAG_0100) { + g_Vars.enableslopes = false; + } else { + g_Vars.enableslopes = true; + } + + dstpos.x = g_Vars.currentplayer->prop->pos.x; + dstpos.y = g_Vars.currentplayer->prop->pos.y; + dstpos.z = g_Vars.currentplayer->prop->pos.z; + + if (vel->x || vel->y || vel->z) { + if (g_Vars.currentplayer->unk1aec) { + propSetCollisionsEnabled(g_Vars.currentplayer->unk1aec, false); + } + + propSetCollisionsEnabled(g_Vars.currentplayer->prop, false); + + dstpos.x += vel->x; + dstpos.y += vel->y; + dstpos.z += vel->z; + + sp60 = g_Vars.bondcollisions ? arg4 : 32; + + propPlayerGetBbox(g_Vars.currentplayer->prop, &width, &ymax, &ymin); + width += extrawidth; + + func0f065dfc(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, + &dstpos, dstrooms, sp64, 20); + func0f0cb79c(g_Vars.currentplayer, &dstpos, dstrooms); + + copyrooms = true; + + // 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. + 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) { + valid = func0002d95c(&g_Vars.currentplayer->prop->pos, + g_Vars.currentplayer->prop->rooms, + &dstpos, dstrooms, width, sp60, 1, + ymax - g_Vars.currentplayer->prop->pos.y, + ymin - g_Vars.currentplayer->prop->pos.y); + + if (valid == true) { + valid = func0002a9f0(&g_Vars.currentplayer->prop->pos, + &dstpos, + width, dstrooms, sp60, 1, + ymax - g_Vars.currentplayer->prop->pos.y, + ymin - g_Vars.currentplayer->prop->pos.y); + } + } else { + valid = func0002a9f0(&g_Vars.currentplayer->prop->pos, + &dstpos, + width, sp64, sp60, 1, + ymax - g_Vars.currentplayer->prop->pos.y, + ymin - g_Vars.currentplayer->prop->pos.y); + } + + propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); + + if (g_Vars.currentplayer->unk1aec) { + propSetCollisionsEnabled(g_Vars.currentplayer->unk1aec, true); + } + } + + if (valid == true && apply) { + f32 angle = g_Vars.currentplayer->vv_theta + (rotateamount * 360) / M_BADTAU; + + while (angle < 0) { + angle += 360; + } + + while (angle >= 360) { + angle -= 360; + } + + g_Vars.currentplayer->vv_theta = angle; + + g_Vars.currentplayer->prop->pos.x = dstpos.x; + g_Vars.currentplayer->prop->pos.y = dstpos.y; + g_Vars.currentplayer->prop->pos.z = dstpos.z; + + if (copyrooms) { + func0f065c44(g_Vars.currentplayer->prop); + roomsCopy(dstrooms, g_Vars.currentplayer->prop->rooms); + } + } + + g_Vars.enableslopes = true; + + return valid; +} GLOBAL_ASM( glabel func0f0c4250 @@ -617,7 +434,7 @@ glabel func0f0c4250 /* f0c4260: afa500ac */ sw $a1,0xac($sp) /* f0c4264: afa600b0 */ sw $a2,0xb0($sp) /* f0c4268: afa700b4 */ sw $a3,0xb4($sp) -/* f0c426c: 0fc30f85 */ jal func0f0c3e14 +/* f0c426c: 0fc30f85 */ jal bwalkCalculateNewPosition /* f0c4270: afae0010 */ sw $t6,0x10($sp) /* f0c4274: 24010001 */ addiu $at,$zero,0x1 /* f0c4278: 10410135 */ beq $v0,$at,.L0f0c4750 @@ -846,7 +663,7 @@ glabel func0f0c4250 /* f0c45d8: 8fa500ac */ lw $a1,0xac($sp) /* f0c45dc: 8fa600b0 */ lw $a2,0xb0($sp) /* f0c45e0: 8fa700b4 */ lw $a3,0xb4($sp) -/* f0c45e4: 0fc30f85 */ jal func0f0c3e14 +/* f0c45e4: 0fc30f85 */ jal bwalkCalculateNewPosition /* f0c45e8: afac0010 */ sw $t4,0x10($sp) /* f0c45ec: 10000058 */ b .L0f0c4750 /* f0c45f0: afa200a4 */ sw $v0,0xa4($sp) @@ -939,7 +756,7 @@ glabel func0f0c4250 /* f0c4738: 8fa500ac */ lw $a1,0xac($sp) /* f0c473c: 8fa600b0 */ lw $a2,0xb0($sp) /* f0c4740: 8fa700b4 */ lw $a3,0xb4($sp) -/* f0c4744: 0fc30f85 */ jal func0f0c3e14 +/* f0c4744: 0fc30f85 */ jal bwalkCalculateNewPosition /* f0c4748: afa90010 */ sw $t1,0x10($sp) /* f0c474c: afa200a4 */ sw $v0,0xa4($sp) .L0f0c4750: diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 3c995e5d2..6686b3e4f 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -9943,7 +9943,7 @@ glabel chrCanSeeEntity /* f039028: 11a00068 */ beqz $t5,.L0f0391cc .L0f03902c: /* f03902c: 00002825 */ or $a1,$zero,$zero -/* f039030: 0fc1905e */ jal func0f064178 +/* f039030: 0fc1905e */ jal propSetCollisionsEnabled /* f039034: afa40054 */ sw $a0,0x54($sp) /* f039038: 8fae0084 */ lw $t6,0x84($sp) /* f03903c: 8faf0078 */ lw $t7,0x78($sp) @@ -10002,7 +10002,7 @@ glabel chrCanSeeEntity .L0f039108: /* f039108: 8fa40054 */ lw $a0,0x54($sp) .L0f03910c: -/* f03910c: 0fc1905e */ jal func0f064178 +/* f03910c: 0fc1905e */ jal propSetCollisionsEnabled /* f039110: 24050001 */ addiu $a1,$zero,0x1 /* f039114: 1000002e */ b .L0f0391d0 /* f039118: 8fa40078 */ lw $a0,0x78($sp) @@ -10247,9 +10247,9 @@ bool chrCanSeeProp(struct chrdata *chr, struct prop *prop) { bool result; - func0f064178(prop, false); + propSetCollisionsEnabled(prop, false); result = chrCanSeePos(chr, &prop->pos, prop->rooms); - func0f064178(prop, true); + propSetCollisionsEnabled(prop, true); return result; } @@ -11414,7 +11414,7 @@ glabel var7f1a8ed4 /* f03b42c: 00000000 */ nop /* f03b430: 4502005a */ bc1fl .L0f03b59c /* f03b434: 02002025 */ or $a0,$s0,$zero -/* f03b438: 0fc1905e */ jal func0f064178 +/* f03b438: 0fc1905e */ jal propSetCollisionsEnabled /* f03b43c: 26740008 */ addiu $s4,$s3,0x8 /* f03b440: 02802025 */ or $a0,$s4,$zero /* f03b444: 8fa5004c */ lw $a1,0x4c($sp) @@ -11423,7 +11423,7 @@ glabel var7f1a8ed4 /* f03b450: 24070022 */ addiu $a3,$zero,0x22 /* f03b454: 10400050 */ beqz $v0,.L0f03b598 /* f03b458: 02002025 */ or $a0,$s0,$zero -/* f03b45c: 0fc1905e */ jal func0f064178 +/* f03b45c: 0fc1905e */ jal propSetCollisionsEnabled /* f03b460: 24050001 */ addiu $a1,$zero,0x1 /* f03b464: c6000008 */ lwc1 $f0,0x8($s0) /* f03b468: c6ca0008 */ lwc1 $f10,0x8($s6) @@ -11510,7 +11510,7 @@ glabel var7f1a8ed4 .L0f03b598: /* f03b598: 02002025 */ or $a0,$s0,$zero .L0f03b59c: -/* f03b59c: 0fc1905e */ jal func0f064178 +/* f03b59c: 0fc1905e */ jal propSetCollisionsEnabled /* f03b5a0: 24050001 */ addiu $a1,$zero,0x1 /* f03b5a4: 26520001 */ addiu $s2,$s2,0x1 .L0f03b5a8: @@ -16341,7 +16341,7 @@ glabel var7f1a9184 /* f040950: 0c0011e4 */ jal scaleTo1 /* f040954: e7b201e8 */ swc1 $f18,0x1e8($sp) /* f040958: 8fa4025c */ lw $a0,0x25c($sp) -/* f04095c: 0fc1905e */ jal func0f064178 +/* f04095c: 0fc1905e */ jal propSetCollisionsEnabled /* f040960: 24050001 */ addiu $a1,$zero,0x1 /* f040964: 1000002f */ b .L0f040a24 /* f040968: 8fab0278 */ lw $t3,0x278($sp) @@ -17445,7 +17445,7 @@ glabel var7f1a9184 /* f041960: 8fa4025c */ lw $a0,0x25c($sp) /* f041964: 51c00004 */ beqzl $t6,.L0f041978 /* f041968: 8fa80268 */ lw $t0,0x268($sp) -/* f04196c: 0fc1905e */ jal func0f064178 +/* f04196c: 0fc1905e */ jal propSetCollisionsEnabled /* f041970: 00002825 */ or $a1,$zero,$zero /* f041974: 8fa80268 */ lw $t0,0x268($sp) .L0f041978: @@ -23199,11 +23199,11 @@ bool chrStartSkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4) propChrGetBbox(prop, &width, &ymax, &ymin); chrSetOrUnsetHiddenFlag00000100(chr, false); - func0f064178(target, false); + propSetCollisionsEnabled(target, false); iVar2 = func0002d6ac(&prop->pos, prop->rooms, &target->pos, 51, 1, ymax - prop->pos.y, ymin - prop->pos.y); chrSetOrUnsetHiddenFlag00000100(chr, true); - func0f064178(target, true); + propSetCollisionsEnabled(target, true); if (iVar2) { diffs[0] = target->pos.x - chr->prop->pos.x; @@ -26174,7 +26174,7 @@ bool func0f04b658(struct chrdata *chr) if (chr->proppreset1 >= 0) { chrSetOrUnsetHiddenFlag00000100(chr, false); - func0f064178(target, false); + propSetCollisionsEnabled(target, false); if (!func0002dc18(&prop->pos, prop->rooms, &target->pos, 0x33)) { struct prop *thing = func00024eb0(); @@ -26186,7 +26186,7 @@ bool func0f04b658(struct chrdata *chr) } chrSetOrUnsetHiddenFlag00000100(chr, true); - func0f064178(target, true); + propSetCollisionsEnabled(target, true); } return result; @@ -26212,7 +26212,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, pos2.z = pos->z; roomsCopy(rooms, rooms2); - func0f064178(chr->prop, false); + 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, @@ -26252,7 +26252,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, result = true; } - func0f064178(chr->prop, true); + propSetCollisionsEnabled(chr->prop, true); return result; } diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index b06c4f36f..9b3471cbb 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -4027,7 +4027,7 @@ glabel var7f1a9f2c /* f064174: 27bd00f8 */ addiu $sp,$sp,0xf8 ); -void func0f064178(struct prop *prop, s32 enable) +void propSetCollisionsEnabled(struct prop *prop, s32 enable) { if (prop->type == PROPTYPE_CHR) { chrSetOrUnsetHiddenFlag00000100(prop->chr, enable); diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 8499e38af..b3f0fcec6 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -10307,7 +10307,7 @@ void setGvars324(s32 arg0) void setGvars328(s32 arg0) { - g_Vars.unk000328 = arg0; + g_Vars.bondcollisions = arg0; } void currentPlayerSetCameraMode(s32 mode) diff --git a/src/game/propobj.c b/src/game/propobj.c index 86c04a7e1..304e43fac 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -13744,7 +13744,7 @@ glabel var7f1aa31c /* f0722cc: c488000c */ lwc1 $f8,0xc($a0) /* f0722d0: e7a80454 */ swc1 $f8,0x454($sp) /* f0722d4: c48a0010 */ lwc1 $f10,0x10($a0) -/* f0722d8: 0fc1905e */ jal func0f064178 +/* f0722d8: 0fc1905e */ jal propSetCollisionsEnabled /* f0722dc: e7aa0458 */ swc1 $f10,0x458($sp) /* f0722e0: 8fa3048c */ lw $v1,0x48c($sp) /* f0722e4: 44801000 */ mtc1 $zero,$f2 @@ -13893,7 +13893,7 @@ glabel var7f1aa31c /* f0724fc: afa20484 */ sw $v0,0x484($sp) .L0f072500: /* f072500: 8fa400e8 */ lw $a0,0xe8($sp) -/* f072504: 0fc1905e */ jal func0f064178 +/* f072504: 0fc1905e */ jal propSetCollisionsEnabled /* f072508: 24050001 */ addiu $a1,$zero,0x1 /* f07250c: 8faa0484 */ lw $t2,0x484($sp) /* f072510: 24010001 */ addiu $at,$zero,0x1 @@ -15270,7 +15270,7 @@ glabel var7f1aa3d0 /* f0737a0: 8e460088 */ lw $a2,0x88($s2) /* f0737a4: 10c00003 */ beqz $a2,.L0f0737b4 /* f0737a8: 00c02025 */ or $a0,$a2,$zero -/* f0737ac: 0fc1905e */ jal func0f064178 +/* f0737ac: 0fc1905e */ jal propSetCollisionsEnabled /* f0737b0: 00002825 */ or $a1,$zero,$zero .L0f0737b4: /* f0737b4: 8fa40188 */ lw $a0,0x188($sp) @@ -15282,7 +15282,7 @@ glabel var7f1aa3d0 /* f0737cc: 8e460088 */ lw $a2,0x88($s2) /* f0737d0: 10c00003 */ beqz $a2,.L0f0737e0 /* f0737d4: 00c02025 */ or $a0,$a2,$zero -/* f0737d8: 0fc1905e */ jal func0f064178 +/* f0737d8: 0fc1905e */ jal propSetCollisionsEnabled /* f0737dc: 24050001 */ addiu $a1,$zero,0x1 .L0f0737e0: /* f0737e0: 8fa90184 */ lw $t1,0x184($sp) @@ -15512,7 +15512,7 @@ glabel func0f073ae8 /* f073b14: 12000004 */ beqz $s0,.L0f073b28 /* f073b18: 8c910014 */ lw $s1,0x14($a0) /* f073b1c: 02002025 */ or $a0,$s0,$zero -/* f073b20: 0fc1905e */ jal func0f064178 +/* f073b20: 0fc1905e */ jal propSetCollisionsEnabled /* f073b24: 00002825 */ or $a1,$zero,$zero .L0f073b28: /* f073b28: 266500c4 */ addiu $a1,$s3,0xc4 @@ -15525,7 +15525,7 @@ glabel func0f073ae8 /* f073b44: 8e700088 */ lw $s0,0x88($s3) /* f073b48: 12000003 */ beqz $s0,.L0f073b58 /* f073b4c: 02002025 */ or $a0,$s0,$zero -/* f073b50: 0fc1905e */ jal func0f064178 +/* f073b50: 0fc1905e */ jal propSetCollisionsEnabled /* f073b54: 24050001 */ addiu $a1,$zero,0x1 .L0f073b58: /* f073b58: 8fae005c */ lw $t6,0x5c($sp) @@ -15961,7 +15961,7 @@ glabel var7f1aa438 .L0f0740bc: /* f0740bc: 50800004 */ beqzl $a0,.L0f0740d0 /* f0740c0: 86240006 */ lh $a0,0x6($s1) -/* f0740c4: 0fc1905e */ jal func0f064178 +/* f0740c4: 0fc1905e */ jal propSetCollisionsEnabled /* f0740c8: 00002825 */ or $a1,$zero,$zero /* f0740cc: 86240006 */ lh $a0,0x6($s1) .L0f0740d0: @@ -16605,7 +16605,7 @@ glabel var7f1aa438 .L0f074a48: /* f074a48: 50800004 */ beqzl $a0,.L0f074a5c /* f074a4c: c6060004 */ lwc1 $f6,0x4($s0) -/* f074a50: 0fc1905e */ jal func0f064178 +/* f074a50: 0fc1905e */ jal propSetCollisionsEnabled /* f074a54: 24050001 */ addiu $a1,$zero,0x1 /* f074a58: c6060004 */ lwc1 $f6,0x4($s0) .L0f074a5c: @@ -17235,7 +17235,7 @@ glabel var7f1aa438 /* f0753bc: 8e040088 */ lw $a0,0x88($s0) /* f0753c0: 50800004 */ beqzl $a0,.L0f0753d4 /* f0753c4: 8e0c0000 */ lw $t4,0x0($s0) -/* f0753c8: 0fc1905e */ jal func0f064178 +/* f0753c8: 0fc1905e */ jal propSetCollisionsEnabled /* f0753cc: 00002825 */ or $a1,$zero,$zero /* f0753d0: 8e0c0000 */ lw $t4,0x0($s0) .L0f0753d4: @@ -17259,7 +17259,7 @@ glabel var7f1aa438 /* f075410: 8e040088 */ lw $a0,0x88($s0) /* f075414: 50800004 */ beqzl $a0,.L0f075428 /* f075418: 240e0001 */ addiu $t6,$zero,0x1 -/* f07541c: 0fc1905e */ jal func0f064178 +/* f07541c: 0fc1905e */ jal propSetCollisionsEnabled /* f075420: 24050001 */ addiu $a1,$zero,0x1 /* f075424: 240e0001 */ addiu $t6,$zero,0x1 .L0f075428: @@ -22211,10 +22211,10 @@ glabel var7f1aa580 /* f0796c8: afa30044 */ sw $v1,0x44($sp) /* f0796cc: afa800ac */ sw $t0,0xac($sp) /* f0796d0: e7a00048 */ swc1 $f0,0x48($sp) -/* f0796d4: 0fc1905e */ jal func0f064178 +/* f0796d4: 0fc1905e */ jal propSetCollisionsEnabled /* f0796d8: e7b200a4 */ swc1 $f18,0xa4($sp) /* f0796dc: 8fa4006c */ lw $a0,0x6c($sp) -/* f0796e0: 0fc1905e */ jal func0f064178 +/* f0796e0: 0fc1905e */ jal propSetCollisionsEnabled /* f0796e4: 00002825 */ or $a1,$zero,$zero /* f0796e8: 8fa800ac */ lw $t0,0xac($sp) /* f0796ec: c7a00048 */ lwc1 $f0,0x48($sp) @@ -22286,10 +22286,10 @@ glabel var7f1aa580 .L0f0797e8: /* f0797e8: 24050001 */ addiu $a1,$zero,0x1 /* f0797ec: afa800ac */ sw $t0,0xac($sp) -/* f0797f0: 0fc1905e */ jal func0f064178 +/* f0797f0: 0fc1905e */ jal propSetCollisionsEnabled /* f0797f4: e7b200a4 */ swc1 $f18,0xa4($sp) /* f0797f8: 8fa4006c */ lw $a0,0x6c($sp) -/* f0797fc: 0fc1905e */ jal func0f064178 +/* f0797fc: 0fc1905e */ jal propSetCollisionsEnabled /* f079800: 24050001 */ addiu $a1,$zero,0x1 /* f079804: 3c09800a */ lui $t1,%hi(g_Vars) /* f079808: 25299fc0 */ addiu $t1,$t1,%lo(g_Vars) @@ -22920,7 +22920,7 @@ glabel var7f1aa5a8 /* f07a0b0: 8fa40198 */ lw $a0,0x198($sp) .L0f07a0b4: /* f07a0b4: 00002825 */ or $a1,$zero,$zero -/* f07a0b8: 0fc1905e */ jal func0f064178 +/* f07a0b8: 0fc1905e */ jal propSetCollisionsEnabled /* f07a0bc: afa70120 */ sw $a3,0x120($sp) /* f07a0c0: 8fa20198 */ lw $v0,0x198($sp) /* f07a0c4: 8fa70120 */ lw $a3,0x120($sp) @@ -23438,7 +23438,7 @@ glabel var7f1aa5a8 .L0f07a84c: /* f07a84c: 8fa40198 */ lw $a0,0x198($sp) .L0f07a850: -/* f07a850: 0fc1905e */ jal func0f064178 +/* f07a850: 0fc1905e */ jal propSetCollisionsEnabled /* f07a854: 24050001 */ addiu $a1,$zero,0x1 /* f07a858: 8fae018c */ lw $t6,0x18c($sp) /* f07a85c: 8fab0188 */ lw $t3,0x188($sp) @@ -34584,7 +34584,7 @@ glabel var7f1aa978 /* f083bb0: 0c0056f9 */ jal func00015be4 /* f083bb4: 27a600f0 */ addiu $a2,$sp,0xf0 /* f083bb8: 02002025 */ or $a0,$s0,$zero -/* f083bbc: 0fc1905e */ jal func0f064178 +/* f083bbc: 0fc1905e */ jal propSetCollisionsEnabled /* f083bc0: 00002825 */ or $a1,$zero,$zero /* f083bc4: c7a40120 */ lwc1 $f4,0x120($sp) /* f083bc8: c7a80124 */ lwc1 $f8,0x124($sp) @@ -34628,7 +34628,7 @@ glabel var7f1aa978 /* f083c5c: e7a80128 */ swc1 $f8,0x128($sp) /* f083c60: 02002025 */ or $a0,$s0,$zero .L0f083c64: -/* f083c64: 0fc1905e */ jal func0f064178 +/* f083c64: 0fc1905e */ jal propSetCollisionsEnabled /* f083c68: 24050001 */ addiu $a1,$zero,0x1 /* f083c6c: 8fae0048 */ lw $t6,0x48($sp) /* f083c70: 8fb80140 */ lw $t8,0x140($sp) @@ -46664,7 +46664,7 @@ glabel doorDoCalc /* f08f1c8: 5501005d */ bnel $t0,$at,.L0f08f340 /* f08f1cc: 8e1000bc */ lw $s0,0xbc($s0) .L0f08f1d0: -/* f08f1d0: 0fc1905e */ jal func0f064178 +/* f08f1d0: 0fc1905e */ jal propSetCollisionsEnabled /* f08f1d4: 00002825 */ or $a1,$zero,$zero /* f08f1d8: 8e040044 */ lw $a0,0x44($s0) /* f08f1dc: 26250028 */ addiu $a1,$s1,0x28 @@ -46672,7 +46672,7 @@ glabel doorDoCalc /* f08f1e4: 2406041d */ addiu $a2,$zero,0x41d /* f08f1e8: 00409825 */ or $s3,$v0,$zero /* f08f1ec: 02202025 */ or $a0,$s1,$zero -/* f08f1f0: 0fc1905e */ jal func0f064178 +/* f08f1f0: 0fc1905e */ jal propSetCollisionsEnabled /* f08f1f4: 24050001 */ addiu $a1,$zero,0x1 /* f08f1f8: 56600051 */ bnezl $s3,.L0f08f340 /* f08f1fc: 8e1000bc */ lw $s0,0xbc($s0) @@ -49001,7 +49001,7 @@ glabel var7f1ab214 /* f091840: c4720008 */ lwc1 $f18,0x8($v1) /* f091844: 46003402 */ mul.s $f16,$f6,$f0 /* f091848: 46128100 */ add.s $f4,$f16,$f18 -/* f09184c: 0fc1905e */ jal func0f064178 +/* f09184c: 0fc1905e */ jal propSetCollisionsEnabled /* f091850: e7a401f8 */ swc1 $f4,0x1f8($sp) /* f091854: 8fa50200 */ lw $a1,0x200($sp) /* f091858: 24090010 */ addiu $t1,$zero,0x10 @@ -49025,7 +49025,7 @@ glabel var7f1ab214 /* f0918a0: afa201d8 */ sw $v0,0x1d8($sp) .L0f0918a4: /* f0918a4: 8fa40200 */ lw $a0,0x200($sp) -/* f0918a8: 0fc1905e */ jal func0f064178 +/* f0918a8: 0fc1905e */ jal propSetCollisionsEnabled /* f0918ac: 24050001 */ addiu $a1,$zero,0x1 /* f0918b0: 8fab0208 */ lw $t3,0x208($sp) /* f0918b4: 8fac0214 */ lw $t4,0x214($sp) diff --git a/src/include/game/bondeyespy.h b/src/include/game/bondeyespy.h index 5fff192c9..f198c6553 100644 --- a/src/include/game/bondeyespy.h +++ b/src/include/game/bondeyespy.h @@ -5,7 +5,7 @@ f32 eyespyFindGround(s16 *floorroom); u32 func0f0cf230(void); -s32 func0f0cf38c(struct coord *vel); +s32 eyespyCalculateNewPosition(struct coord *vel); bool func0f0cf728(struct coord *vel); u32 func0f0cf890(void); u32 func0f0cf9f8(void); diff --git a/src/include/game/bondwalk.h b/src/include/game/bondwalk.h index 7b53e0d65..61abe38d9 100644 --- a/src/include/game/bondwalk.h +++ b/src/include/game/bondwalk.h @@ -8,7 +8,7 @@ void currentPlayerSetSwayTarget(s32 value); void currentPlayerAdjustCrouchPos(s32 value); void func0f0c3b38(struct coord *param_1, struct defaultobj *obj); bool currentPlayerHasGapToCeiling(f32 y); -u32 func0f0c3e14(void); +bool bwalkCalculateNewPosition(struct coord *vel, f32 arg1, bool arg2, f32 arg3, s32 arg4); bool func0f0c4250(struct coord *delta, f32 arg1, bool arg2, f32 arg3, s32 arg4); bool 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); diff --git a/src/include/game/game_0601b0.h b/src/include/game/game_0601b0.h index 2de9d2c9c..e80121ed8 100644 --- a/src/include/game/game_0601b0.h +++ b/src/include/game/game_0601b0.h @@ -34,7 +34,7 @@ void propPrependToList2(struct prop *prop); void propMoveFromList2To1(struct prop *prop); void func0f06302c(ubool arg0); void func0f063dcc(void); -void func0f064178(struct prop *prop, bool enable); +void propSetCollisionsEnabled(struct prop *prop, bool enable); void func0f0641f4(void); u32 func0f06438c(void); u32 func0f064a24(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 638bbbfab..54b6ded7f 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -83,8 +83,8 @@ struct g_vars { /*00031c*/ s32 lvmpbotlevel; /*000320*/ s32 unk000320; /*000324*/ s32 unk000324; - /*000328*/ s32 unk000328; - /*00032c*/ u32 unk00032c; + /*000328*/ bool bondcollisions; + /*00032c*/ bool enableslopes; /*000330*/ u32 unk000330; /*000334*/ s32 maxprops; /*000338*/ struct prop *props; // pointer to array diff --git a/src/include/types.h b/src/include/types.h index 63e385f53..fddd99637 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2727,7 +2727,7 @@ struct player { /*0x1a9c*/ Mtxf bondentermtx; /*0x1adc*/ struct coord bondenteraim; /*0x1ae8*/ f32 bondonground; - /*0x1aec*/ u32 unk1aec; + /*0x1aec*/ struct prop *unk1aec; /*0x1af0*/ struct prop *unk1af0; /*0x1af4*/ u32 unk1af4; /*0x1af8*/ s32 walkinitmove; diff --git a/src/lib/lib_15860.c b/src/lib/lib_15860.c index fc0a60973..3946daecd 100644 --- a/src/lib/lib_15860.c +++ b/src/lib/lib_15860.c @@ -46,13 +46,13 @@ void initGlobalVariables(void) g_Vars.unk000458 = 0; g_Vars.numaibuddies = 0; g_Vars.unk000324 = 1; - g_Vars.unk000328 = 1; + g_Vars.bondcollisions = true; g_Vars.tickmode = TICKMODE_0; g_Vars.roomcount = 350; g_Vars.mplayerisrunning = 0; g_Vars.normmplayerisrunning = 0; g_Vars.perfectbuddynum = 0; - g_Vars.unk00032c = 0; + g_Vars.enableslopes = false; g_Vars.restartlevel = 0; g_Vars.unk00048c = 0; g_Vars.unk000490 = 0;