From 2e62193289ced94303a7758a66b2c759f00039b4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 15 May 2021 18:28:37 +1000 Subject: [PATCH] Attempt to decompile func0002a6fc --- src/include/lib/lib_24e40.h | 4 +-- src/include/types.h | 2 +- src/lib/lib_24e40.c | 71 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/include/lib/lib_24e40.h b/src/include/lib/lib_24e40.h index b9b4e00f7..a4690b841 100644 --- a/src/include/lib/lib_24e40.h +++ b/src/include/lib/lib_24e40.h @@ -13,7 +13,7 @@ void cdGetPos(struct coord *pos, u32 line, char *file); void func00024ee8(struct coord *arg0); u32 cdGetTileFlags(void); void func00024f6c(void); -u32 func00024fb0(void); +void func00024fb0(struct coord *arg0, struct coord *arg1, struct prop *prop); u32 func00025038(void); void func000250cc(struct coord *arg0, struct coord *arg1, f32 width); void func00025168(struct prop *prop); @@ -27,7 +27,7 @@ u32 func000254d8(void); f32 func00025654(f32 x1, f32 z1, f32 x2, f32 z2, f32 x3, f32 z3); f32 func00025724(f32 x1, f32 z1, f32 x2, f32 z2); bool func00025774(f32 x1, f32 z1, f32 x2, f32 z2, f32 x3, f32 z3); -u32 func00025848(void); +void func00025848(f32 tilex, f32 tilez, f32 tilewidth, f32 posx, f32 posz, f32 *x1, f32 *z1, f32 *x2, f32 *z2); void func00025928(struct tile *tile, struct coord *arg1); void tileGetFloorCol(struct tile *tile, u16 *floorcol); void tileGetFloorType(struct tile *tile, u8 *floortype); diff --git a/src/include/types.h b/src/include/types.h index 58a51d5e9..a7d3402b9 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6950,7 +6950,7 @@ struct var800ab570 { struct collisionthing { struct tile *tile; u32 unk04; - u32 unk08; + s32 unk08; struct prop *prop; u32 roomnum; }; diff --git a/src/lib/lib_24e40.c b/src/lib/lib_24e40.c index f6616bf4f..c9c60377a 100644 --- a/src/lib/lib_24e40.c +++ b/src/lib/lib_24e40.c @@ -5425,6 +5425,77 @@ glabel func0002a6fc /* 2a9ec: 27bd00a8 */ addiu $sp,$sp,0xa8 ); +// Mismatch: Goal copies tile from t1 to v0 in the type 0 block +//s32 func0002a6fc(struct coord *pos, struct coord *pos2, f32 width, s16 *rooms, s32 types, bool arg5, f32 arg6, f32 arg7) +//{ +// u32 stack[5]; +// struct collisionthing thing; // 80 +// s32 cdresult; +// struct coord sp70; +// struct coord sp64; +// +// cdresult = CDRESULT_NOCOLLISION; +// +// func00027d1c(pos2, width, rooms, types, 4, arg5, arg6, arg7, &thing, 1); +// +// // 768 +// if (thing.tile != NULL) { +// cdresult = CDRESULT_COLLISION; +// +// // 778 +// if (thing.tile->type == TILETYPE_00) { +// struct tiletype0 *type0 = (struct tiletype0 *) thing.tile; +// s32 this = thing.unk08; +// s32 next = (this + 1) % thing.tile->numvertices; +// +// sp70.x = type0->vertices[this][0]; +// sp70.y = type0->vertices[this][1]; +// sp70.z = type0->vertices[this][2]; +// +// sp64.x = type0->vertices[next][0]; +// sp64.y = type0->vertices[next][1]; +// sp64.z = type0->vertices[next][2]; +// } else /*854*/ if (thing.tile->type == TILETYPE_01) { +// struct tiletype1 *type1 = (struct tiletype1 *) thing.tile; +// s32 this = thing.unk08; +// s32 next = (this + 1) % thing.tile->numvertices; +// +// sp70.x = type1->vertices[this].x; +// sp70.y = type1->vertices[this].y; +// sp70.z = type1->vertices[this].z; +// +// sp64.x = type1->vertices[next].x; +// sp64.y = type1->vertices[next].y; +// sp64.z = type1->vertices[next].z; +// } else if (thing.tile->type == TILETYPE_02) { +// struct tiletype2 *type2 = (struct tiletype2 *) thing.tile; +// s32 this = thing.unk08; +// s32 next = (this + 1) % thing.tile->numvertices; +// +// sp70.x = type2->vertices[this][0]; +// sp70.y = pos->y; +// sp70.z = type2->vertices[this][1]; +// +// sp64.x = type2->vertices[next][0]; +// sp64.y = pos->y; +// sp64.z = type2->vertices[next][1]; +// } else if (thing.tile->type == TILETYPE_03) { +// struct tiletype3 *type3 = (struct tiletype3 *) thing.tile; +// +// if (1); +// +// func00025848(type3->x, type3->z, type3->width, pos->x, pos->z, &sp70.x, &sp70.z, &sp64.x, &sp64.z); +// +// sp70.y = pos->y; +// sp64.y = pos->y; +// } +// +// func00024fb0(&sp70, &sp64, thing.prop); +// } +// +// return cdresult; +//} + s32 cdTestAToB1(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg5, f32 ymax, f32 ymin) { struct collisionthing things[21];