diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index cb1ad8dd9..e53137f0e 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -52,7 +52,7 @@ u32 var80070edc = 0x00000bb8; f32 eyespyFindGround(s16 *floorroom) { struct prop *prop = g_Vars.currentplayer->eyespy->prop; - bool thing; + s32 inlift; struct prop *lift; struct coord pos; f32 yoffset = 50; @@ -70,7 +70,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, &thing, &lift); + ground = coordFindGroundY(&pos, 26, prop->rooms, NULL, NULL, NULL, floorroom, &inlift, &lift); if (ground < -30000) { ground = -30000; diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index e20f49942..4555b4937 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -1638,7 +1638,7 @@ void func0f0ce1ac(void) f32 stack; s32 i; f32 tmp; - bool inlift; + s32 inlift; struct prop *lift = NULL; f32 dist; f32 f14; diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 50e05b460..ca039a397 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -1352,7 +1352,7 @@ void currentPlayerUpdateVerticalMovement(void) struct coord testpos; struct coord newpos; s16 newrooms[8]; - bool newinlift; + s32 newinlift; struct prop *lift = NULL; f32 sumground; f32 moveamount; diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index ad6c04877..568b4cf41 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -32138,16 +32138,16 @@ s32 func0f004cd84(s32 arg0, s32 arg1) void func0f04cf90(struct chrdata *chr, s32 arg1) { if (chr && chr->animdata && chr->animdata->unk08) { - s32 value = func0001a91c(chr->animdata->unk08, arg1); - u32 *ptr = NULL; + void *value = func0001a91c(chr->animdata->unk08, arg1); + struct animdata10 *animdata10 = NULL; if (value != 0) { - ptr = func0001aa1c(chr->animdata, value); + animdata10 = func0001aa1c(chr->animdata, value); } - if (ptr) { - u32 value = *ptr; - *ptr = (value == 0); + if (animdata10) { + u32 value = animdata10->unk00; + animdata10->unk00 = (value == 0); } } } diff --git a/src/game/game_02cde0.c b/src/game/game_02cde0.c index b20a6ca8a..3e443615e 100644 --- a/src/game/game_02cde0.c +++ b/src/game/game_02cde0.c @@ -958,8 +958,8 @@ struct prop *propAllocateEyespy(struct pad *pad, s16 room) s16 rooms[2]; struct prop *prop; struct chrdata *chr; - u32 lVar3; - bool thing; + struct animdata *animdata; + s32 inlift; struct prop *lift; f32 ground; u32 stack[2]; @@ -991,10 +991,10 @@ struct prop *propAllocateEyespy(struct pad *pad, s16 room) } #endif - lVar3 = func0f02d36c(BODY_EYESPY, 0, 0); + animdata = func0f02d36c(BODY_EYESPY, 0, 0); - if (lVar3) { - prop = func0f020cc8(lVar3, &pad->pos, rooms, 0, ailistFindById(GAILIST_IDLE)); + if (animdata) { + prop = func0f020cc8(animdata, &pad->pos, rooms, 0, ailistFindById(GAILIST_IDLE)); if (prop) { func0f0604bc(prop); @@ -1009,7 +1009,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, &thing, &lift); + ground = coordFindGroundY(&pad->pos, 30, rooms, NULL, NULL, NULL, NULL, &inlift, &lift); chr->ground = ground; chr->manground = ground; diff --git a/src/include/constants.h b/src/include/constants.h index f75dbeb5c..c745039b6 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -551,6 +551,8 @@ #define FLOORFLAG_0100 0x0100 #define FLOORFLAG_DIE 0x4000 +#define FLOORTYPE_ESCALATOR 4 + #define FRFAILREASON_NOTFAILED 0 #define FRFAILREASON_OUTOFAMMO 1 #define FRFAILREASON_TIMEOVER 2 @@ -2527,6 +2529,11 @@ #define TEAM_32 0x32 #define TEAM_NONCOMBAT 0x80 +#define TELEPORTSTATE_0 0 +#define TELEPORTSTATE_STARTING 1 +#define TELEPORTSTATE_3 3 +#define TELEPORTSTATE_4 4 + #define TICKMODE_0 0 #define TICKMODE_1 1 #define TICKMODE_3 3 @@ -2535,10 +2542,7 @@ #define TICKMODE_6 6 #define TICKMODE_AUTOWALK 7 -#define TELEPORTSTATE_0 0 -#define TELEPORTSTATE_STARTING 1 -#define TELEPORTSTATE_3 3 -#define TELEPORTSTATE_4 4 +#define TILEFLAG_0020 0x0020 #define VISIONMODE_NORMAL 0 #define VISIONMODE_XRAY 1 diff --git a/src/include/game/game_02cde0.h b/src/include/game/game_02cde0.h index 2e43d97f1..a696a0d92 100644 --- a/src/include/game/game_02cde0.h +++ b/src/include/game/game_02cde0.h @@ -7,7 +7,7 @@ u32 bodyGetRace(s32 bodynum); bool bodyLoad(u32 bodynum); u32 func0f02ce8c(void); u32 func0f02d338(void); -u32 func0f02d36c(u32 bodynum, u32 arg1, u32 arg2); +struct animdata *func0f02d36c(u32 bodynum, u32 arg1, u32 arg2); u32 func0f02d3f8(void); u32 bodyGetHead(u32 bodynum); u32 func0f02d4fc(void); diff --git a/src/include/lib/lib_1a500.h b/src/include/lib/lib_1a500.h index fa95978f6..b7b710650 100644 --- a/src/include/lib/lib_1a500.h +++ b/src/include/lib/lib_1a500.h @@ -14,7 +14,7 @@ u32 func0001a740(void); u32 func0001a784(void); u32 func0001a7cc(void); u32 func0001a85c(void); -s32 func0001a91c(u32 arg0, s32 arg1); +void *func0001a91c(struct animdata08 *arg0, s32 arg1); u32 func0001a9bc(void); u32 func0001a9e8(void); struct animdata10 *func0001aa1c(struct animdata *animdata, void *arg1); diff --git a/src/include/lib/lib_233c0.h b/src/include/lib/lib_233c0.h index e0b6c88a2..6eb9fc4dc 100644 --- a/src/include/lib/lib_233c0.h +++ b/src/include/lib/lib_233c0.h @@ -47,8 +47,8 @@ u32 func00025724(void); u32 func00025774(void); u32 func00025848(void); u32 func00025928(void); -u32 func00025b70(void); -u32 func00025bdc(void); +void func00025b70(struct tile *tile, u16 *floorcol); +void func00025bdc(struct tile *tile, u8 *floortype); u32 func00025c74(void); u32 func00025f90(void); u32 func000260cc(void); @@ -65,7 +65,7 @@ u32 func000272f8(void); s32 func000274e0(struct geo *geo, f32 x, f32 z, f32 angle, s32 arg4, s32 arg5); s32 func000276c8(struct geo *geo, f32 x, f32 z, f32 angle, s32 arg4, s32 arg5); u32 func00027738(void); -u32 func00027d1c(void); +void func00027d1c(struct coord *pos, f32 width, s16 *rooms, u32 arg3, u32 arg4, u32 arg5, f32 arg6, f32 arg7, u32 *arg8, u32 arg9); u32 func00027f78(void); u32 func00028200(void); u32 func0002840c(void); @@ -74,10 +74,10 @@ u32 func0002885c(void); u32 func00028914(void); u32 func00028df0(void); u32 func0002901c(void); -u32 func000296a0(void); +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, bool *inlift, struct prop **lift); +f32 coordFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift); f32 func0002a330(struct coord *pos, f32 width, s16 *rooms, s32 arg3, s32 arg4); f32 func0002a36c(struct coord *coord, s16 *arg1, s32 arg2, s32 arg3); u32 func0002a400(void); diff --git a/src/include/types.h b/src/include/types.h index 4f80cb078..c1a27447e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5683,4 +5683,21 @@ struct mpconfigfull { struct mpstrings strings; }; +struct tile { + /*0x00*/ u8 unk00; // 0 or 1 to enable floorcol, 2 or 3 to disable + /*0x01*/ u8 unk01; + /*0x02*/ u16 flags; + /*0x04*/ u8 floortype; + /*0x08*/ u32 unk08; + /*0x0c*/ u32 floorcol; +}; + +struct tilething { + struct tile *tile; + u32 unk04; + u32 unk08; + struct prop *lift; + u32 floorroom; +}; + #endif diff --git a/src/lib/lib_233c0.c b/src/lib/lib_233c0.c index 357cf3b6f..937721d4b 100644 --- a/src/lib/lib_233c0.c +++ b/src/lib/lib_233c0.c @@ -7782,112 +7782,60 @@ glabel func0002a13c /* 2a1ac: 27bd0058 */ addiu $sp,$sp,0x58 ); +f32 coordFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, + u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift) +{ + u32 sp76[105]; + struct tilething *sp72 = NULL; + f32 ground; + struct tile *tile = NULL; + + func00027d1c(pos, width, rooms, 0x3f, 3, 0, 0, 0, sp76, 20); + ground = func000296a0(sp76, pos, &sp72, width); + + if (sp72) { + tile = sp72->tile; + } + + if (floorcol) { + func00025b70(tile, floorcol); + } + + if (floortype) { + func00025bdc(tile, floortype); + } + + if (floorflags && tile) { + *floorflags = tile->flags; + } + + if (floorroom) { + if (sp72) { + *floorroom = sp72->floorroom; + } else { + *floorroom = -1; + } + } + + if (inlift) { + if (tile && tile->unk00 == 1 && (tile->flags & TILEFLAG_0020)) { + *inlift = true; + *lift = sp72->lift; + + if (*lift && (*lift)->obj->obj == MODEL_ESCA_STEP && floortype) { + *floortype = FLOORTYPE_ESCALATOR; + } + } else { + *inlift = false; + *lift = NULL; + } + } + + return ground; +} + GLOBAL_ASM( -glabel coordFindGroundY -/* 2a1b0: 27bdfe10 */ addiu $sp,$sp,-496 -/* 2a1b4: 44800000 */ mtc1 $zero,$f0 -/* 2a1b8: afbf0034 */ sw $ra,0x34($sp) -/* 2a1bc: afb00030 */ sw $s0,0x30($sp) -/* 2a1c0: afa701fc */ sw $a3,0x1fc($sp) -/* 2a1c4: 27af004c */ addiu $t7,$sp,0x4c -/* 2a1c8: 240e0003 */ addiu $t6,$zero,0x3 -/* 2a1cc: 24180014 */ addiu $t8,$zero,0x14 -/* 2a1d0: afa401f0 */ sw $a0,0x1f0($sp) -/* 2a1d4: afa501f4 */ sw $a1,0x1f4($sp) -/* 2a1d8: afa00048 */ sw $zero,0x48($sp) -/* 2a1dc: 00008025 */ or $s0,$zero,$zero -/* 2a1e0: afb80024 */ sw $t8,0x24($sp) -/* 2a1e4: afae0010 */ sw $t6,0x10($sp) -/* 2a1e8: afaf0020 */ sw $t7,0x20($sp) -/* 2a1ec: 2407003f */ addiu $a3,$zero,0x3f -/* 2a1f0: afa00014 */ sw $zero,0x14($sp) -/* 2a1f4: e7a00018 */ swc1 $f0,0x18($sp) -/* 2a1f8: 0c009f47 */ jal func00027d1c -/* 2a1fc: e7a0001c */ swc1 $f0,0x1c($sp) -/* 2a200: 27a4004c */ addiu $a0,$sp,0x4c -/* 2a204: 8fa501f0 */ lw $a1,0x1f0($sp) -/* 2a208: 27a60048 */ addiu $a2,$sp,0x48 -/* 2a20c: 0c00a5a8 */ jal func000296a0 -/* 2a210: 8fa701f4 */ lw $a3,0x1f4($sp) -/* 2a214: 8fb90048 */ lw $t9,0x48($sp) -/* 2a218: e7a00044 */ swc1 $f0,0x44($sp) -/* 2a21c: 8fa501fc */ lw $a1,0x1fc($sp) -/* 2a220: 13200002 */ beqz $t9,.L0002a22c -/* 2a224: 00000000 */ sll $zero,$zero,0x0 -/* 2a228: 8f300000 */ lw $s0,0x0($t9) -.L0002a22c: -/* 2a22c: 50a00004 */ beqzl $a1,.L0002a240 -/* 2a230: 8fa50200 */ lw $a1,0x200($sp) -/* 2a234: 0c0096dc */ jal func00025b70 -/* 2a238: 02002025 */ or $a0,$s0,$zero -/* 2a23c: 8fa50200 */ lw $a1,0x200($sp) -.L0002a240: -/* 2a240: 50a00005 */ beqzl $a1,.L0002a258 -/* 2a244: 8fa20204 */ lw $v0,0x204($sp) -/* 2a248: 0c0096f7 */ jal func00025bdc -/* 2a24c: 02002025 */ or $a0,$s0,$zero -/* 2a250: 8fa50200 */ lw $a1,0x200($sp) -/* 2a254: 8fa20204 */ lw $v0,0x204($sp) -.L0002a258: -/* 2a258: 50400006 */ beqzl $v0,.L0002a274 -/* 2a25c: 8fa20208 */ lw $v0,0x208($sp) -/* 2a260: 52000004 */ beqzl $s0,.L0002a274 -/* 2a264: 8fa20208 */ lw $v0,0x208($sp) -/* 2a268: 96080002 */ lhu $t0,0x2($s0) -/* 2a26c: a4480000 */ sh $t0,0x0($v0) -/* 2a270: 8fa20208 */ lw $v0,0x208($sp) -.L0002a274: -/* 2a274: 8fa90048 */ lw $t1,0x48($sp) -/* 2a278: 50400008 */ beqzl $v0,.L0002a29c -/* 2a27c: 8fa3020c */ lw $v1,0x20c($sp) -/* 2a280: 11200004 */ beqz $t1,.L0002a294 -/* 2a284: 240bffff */ addiu $t3,$zero,-1 -/* 2a288: 8d2a0010 */ lw $t2,0x10($t1) -/* 2a28c: 10000002 */ beqz $zero,.L0002a298 -/* 2a290: a44a0000 */ sh $t2,0x0($v0) -.L0002a294: -/* 2a294: a44b0000 */ sh $t3,0x0($v0) -.L0002a298: -/* 2a298: 8fa3020c */ lw $v1,0x20c($sp) -.L0002a29c: -/* 2a29c: 5060001d */ beqzl $v1,.L0002a314 -/* 2a2a0: 8fbf0034 */ lw $ra,0x34($sp) -/* 2a2a4: 12000018 */ beqz $s0,.L0002a308 -/* 2a2a8: 8fa40210 */ lw $a0,0x210($sp) -/* 2a2ac: 920c0000 */ lbu $t4,0x0($s0) -/* 2a2b0: 24060001 */ addiu $a2,$zero,0x1 -/* 2a2b4: 54cc0015 */ bnel $a2,$t4,.L0002a30c -/* 2a2b8: ac600000 */ sw $zero,0x0($v1) -/* 2a2bc: 960d0002 */ lhu $t5,0x2($s0) -/* 2a2c0: 31ae0020 */ andi $t6,$t5,0x20 -/* 2a2c4: 51c00011 */ beqzl $t6,.L0002a30c -/* 2a2c8: ac600000 */ sw $zero,0x0($v1) -/* 2a2cc: 8fa40210 */ lw $a0,0x210($sp) -/* 2a2d0: ac660000 */ sw $a2,0x0($v1) -/* 2a2d4: 8faf0048 */ lw $t7,0x48($sp) -/* 2a2d8: 8df8000c */ lw $t8,0xc($t7) -/* 2a2dc: 1300000c */ beqz $t8,.L0002a310 -/* 2a2e0: ac980000 */ sw $t8,0x0($a0) -/* 2a2e4: 8f190004 */ lw $t9,0x4($t8) -/* 2a2e8: 240100e4 */ addiu $at,$zero,0xe4 -/* 2a2ec: 87280004 */ lh $t0,0x4($t9) -/* 2a2f0: 55010008 */ bnel $t0,$at,.L0002a314 -/* 2a2f4: 8fbf0034 */ lw $ra,0x34($sp) -/* 2a2f8: 10a00005 */ beqz $a1,.L0002a310 -/* 2a2fc: 24090004 */ addiu $t1,$zero,0x4 -/* 2a300: 10000003 */ beqz $zero,.L0002a310 -/* 2a304: a0a90000 */ sb $t1,0x0($a1) -.L0002a308: -/* 2a308: ac600000 */ sw $zero,0x0($v1) -.L0002a30c: -/* 2a30c: ac800000 */ sw $zero,0x0($a0) -.L0002a310: -/* 2a310: 8fbf0034 */ lw $ra,0x34($sp) -.L0002a314: -/* 2a314: c7a00044 */ lwc1 $f0,0x44($sp) -/* 2a318: 8fb00030 */ lw $s0,0x30($sp) -/* 2a31c: 03e00008 */ jr $ra -/* 2a320: 27bd01f0 */ addiu $sp,$sp,0x1f0 +glabel func0002a324 /* 2a324: 44800000 */ mtc1 $zero,$f0 /* 2a328: 03e00008 */ jr $ra /* 2a32c: 00000000 */ sll $zero,$zero,0x0