From a17a2b6a70ec7a440ac2e54c30ff6b4691dd57b5 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 18 May 2021 22:07:11 +1000 Subject: [PATCH] Decompile func0f08c424 --- src/game/propobj.c | 49 ++++++++++++------------------------- src/include/game/propobj.h | 4 +-- src/include/lib/lib_159b0.h | 2 +- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/game/propobj.c b/src/game/propobj.c index 2158ea2ab..d3d41ba93 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -59116,7 +59116,7 @@ void doorDestroyGlass(struct doorobj *door) struct model *model = door->base.model; union modelrodata *rodata; union modelrwdata *rwdata; - f32 matrix[16]; + Mtxf matrix; rodata = modelGetPartRodata(model->filedata, 2); @@ -59131,8 +59131,8 @@ void doorDestroyGlass(struct doorobj *door) } } - func0f08c424(door, matrix); - shardsCreate((struct coord *) &matrix[12], &matrix[0], &matrix[4], &matrix[8], + func0f08c424(door, &matrix); + shardsCreate((struct coord *) &matrix.m[3][0], &matrix.m[0][0], &matrix.m[1][0], &matrix.m[2][0], rodata->bbox.xmin, rodata->bbox.xmax, rodata->bbox.ymin, rodata->bbox.ymax, SHARDTYPE_GLASS, prop); func0f13e40c(prop, 1); @@ -70330,34 +70330,15 @@ glabel doorsCheckAutomatic // } //} -GLOBAL_ASM( -glabel func0f08c424 -/* f08c424: 27bdffe8 */ addiu $sp,$sp,-24 -/* f08c428: afbf0014 */ sw $ra,0x14($sp) -/* f08c42c: afa40018 */ sw $a0,0x18($sp) -/* f08c430: afa5001c */ sw $a1,0x1c($sp) -/* f08c434: 0c005755 */ jal func00015d54 -/* f08c438: 2484001c */ addiu $a0,$a0,0x1c -/* f08c43c: 8fae0018 */ lw $t6,0x18($sp) -/* f08c440: 8fa5001c */ lw $a1,0x1c($sp) -/* f08c444: 8dc40014 */ lw $a0,0x14($t6) -/* f08c448: 0c005775 */ jal func00015dd4 -/* f08c44c: 24840008 */ addiu $a0,$a0,0x8 -/* f08c450: 8faf0018 */ lw $t7,0x18($sp) -/* f08c454: 3c01bf80 */ lui $at,0xbf80 -/* f08c458: 95f80070 */ lhu $t8,0x70($t7) -/* f08c45c: 33190008 */ andi $t9,$t8,0x8 -/* f08c460: 53200005 */ beqzl $t9,.L0f08c478 -/* f08c464: 8fbf0014 */ lw $ra,0x14($sp) -/* f08c468: 44816000 */ mtc1 $at,$f12 -/* f08c46c: 0c0057b7 */ jal func00015edc -/* f08c470: 8fa5001c */ lw $a1,0x1c($sp) -/* f08c474: 8fbf0014 */ lw $ra,0x14($sp) -.L0f08c478: -/* f08c478: 27bd0018 */ addiu $sp,$sp,0x18 -/* f08c47c: 03e00008 */ jr $ra -/* f08c480: 00000000 */ nop -); +void func0f08c424(struct doorobj *door, Mtxf *matrix) +{ + func00015d54(door->base.realrot, matrix); + func00015dd4(&door->base.prop->pos, matrix); + + if (door->doorflags & DOORFLAG_FLIP) { + func00015edc(-1, matrix); + } +} GLOBAL_ASM( glabel func0f08c484 @@ -74657,12 +74638,12 @@ bool doorTestForInteract(struct prop *prop) maybe = true; } else if ((door->doorflags & (DOORFLAG_0080 | DOORFLAG_0100)) != DOORFLAG_0080) { u8 stack1[0x20]; - u8 stack2[0x40]; + Mtxf matrix; func0f08c484(door, stack1); - func0f08c424(door, stack2); + func0f08c424(door, &matrix); - if (func0f0675c8(&playerprop->pos, 150, stack1, stack2)) { + if (func0f0675c8(&playerprop->pos, 150, stack1, &matrix)) { maybe = true; } } diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index b23506109..94fee7cba 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -54,7 +54,7 @@ u32 func0f066abc(void); u32 func0f066b5c(void); u32 func0f067424(void); u32 func0f0674bc(void); -bool func0f0675c8(struct coord *coord, f32 arg1, void *arg2, void *arg3); +bool func0f0675c8(struct coord *coord, f32 arg1, void *arg2, Mtxf *arg3); u32 func0f0677ac(void); bool func0f0678f8(struct coord *coord, f32 *arg1, s32 padnum); bool func0f06797c(struct coord *coord, f32 arg1, s32 padnum); @@ -301,7 +301,7 @@ bool func0f08be80(struct doorobj *door, struct defaultobj *obj, bool isbike); bool vectorIsInFrontOfDoor(struct doorobj *door, struct coord *vector); s32 func0f08c040(struct doorobj *door); void doorsCheckAutomatic(void); -void func0f08c424(struct doorobj *door, void *arg1); +void func0f08c424(struct doorobj *door, Mtxf *matrix); void func0f08c484(struct doorobj *door, void *arg1); u32 func0f08c54c(struct doorobj *door); u32 func0f08cb20(void); diff --git a/src/include/lib/lib_159b0.h b/src/include/lib/lib_159b0.h index 5e27bd870..e0d6b9363 100644 --- a/src/include/lib/lib_159b0.h +++ b/src/include/lib/lib_159b0.h @@ -23,7 +23,7 @@ void func00015e24(f32 mult, f32 *matrix); u32 func00015e4c(void); void func00015e80(f32 mult, f32 *matrix); u32 func00015ea8(void); -void func00015edc(f32 mult, f32 *matrix); +void func00015edc(f32 mult, Mtxf *matrix); void func00015f04(f32 scale, Mtxf *arg1); void func00015f4c(f32 scale, Mtxf *arg1); void func00015f88(f32 arg0, Mtxf *arg1);