From dcc13c5077c5232c07a32ccca6ec24b93e48ef78 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 28 Jan 2021 23:59:48 +1000 Subject: [PATCH] Decompile guPerspective --- src/game/game_015470.c | 2 +- src/game/game_0b69d0.c | 4 ++-- src/include/lib/lib_04840.h | 2 -- src/lib/lib_04840.c | 34 ++++++++-------------------------- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/game/game_015470.c b/src/game/game_015470.c index 931c5e3c0..e8a5dda42 100644 --- a/src/game/game_015470.c +++ b/src/game/game_015470.c @@ -121,7 +121,7 @@ glabel func0f0155f0 /* f015718: e7a80010 */ swc1 $f8,0x10($sp) /* f01571c: e7aa0014 */ swc1 $f10,0x14($sp) /* f015720: 032e2021 */ addu $a0,$t9,$t6 -/* f015724: 0c001289 */ jal func00004a24 +/* f015724: 0c001289 */ jal guPerspective /* f015728: e7b00018 */ swc1 $f16,0x18($sp) /* f01572c: 3c0fbc00 */ lui $t7,0xbc00 /* f015730: 35ef000e */ ori $t7,$t7,0xe diff --git a/src/game/game_0b69d0.c b/src/game/game_0b69d0.c index cfd2a2b54..ae2021aa8 100644 --- a/src/game/game_0b69d0.c +++ b/src/game/game_0b69d0.c @@ -3786,10 +3786,10 @@ void func0f0baf38(void) Gfx *func0f0baf84(Gfx *gdl) { if (g_Vars.currentplayer->pausemode != PAUSEMODE_UNPAUSED) { - f32 *a = gfxAllocateMatrix(); + Mtx *a = gfxAllocateMatrix(); u16 b; - func00004a24(a, &b, g_Vars.currentplayer->zoominfovy, + guPerspective(a, &b, g_Vars.currentplayer->zoominfovy, 1.4545454978943f, 10, 300, 1); gSPMatrix(gdl++, 0x80000000 + (u32)a, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); diff --git a/src/include/lib/lib_04840.h b/src/include/lib/lib_04840.h index 0e55f3f83..7b010a21c 100644 --- a/src/include/lib/lib_04840.h +++ b/src/include/lib/lib_04840.h @@ -3,6 +3,4 @@ #include #include "types.h" -void func00004a24(f32 *matrix, u16 *arg1, f32 fovy, f32 arg3, f32 arg4, f32 arg5, f32 arg6); - #endif diff --git a/src/lib/lib_04840.c b/src/lib/lib_04840.c index 4956197c9..dad997c88 100644 --- a/src/lib/lib_04840.c +++ b/src/lib/lib_04840.c @@ -49,29 +49,11 @@ void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, fl } } -GLOBAL_ASM( -glabel func00004a24 -/* 4a24: 27bdff98 */ addiu $sp,$sp,-104 -/* 4a28: 44866000 */ mtc1 $a2,$f12 -/* 4a2c: 44877000 */ mtc1 $a3,$f14 -/* 4a30: c7a40078 */ lwc1 $f4,0x78($sp) -/* 4a34: c7a6007c */ lwc1 $f6,0x7c($sp) -/* 4a38: c7a80080 */ lwc1 $f8,0x80($sp) -/* 4a3c: afbf0024 */ sw $ra,0x24($sp) -/* 4a40: afa40068 */ sw $a0,0x68($sp) -/* 4a44: 44066000 */ mfc1 $a2,$f12 -/* 4a48: 44077000 */ mfc1 $a3,$f14 -/* 4a4c: 27a40028 */ addiu $a0,$sp,0x28 -/* 4a50: e7a40010 */ swc1 $f4,0x10($sp) -/* 4a54: e7a60014 */ swc1 $f6,0x14($sp) -/* 4a58: 0c001210 */ jal guPerspectiveF -/* 4a5c: e7a80018 */ swc1 $f8,0x18($sp) -/* 4a60: 27a40028 */ addiu $a0,$sp,0x28 -/* 4a64: 0c0128d8 */ jal guMtxF2L -/* 4a68: 8fa50068 */ lw $a1,0x68($sp) -/* 4a6c: 8fbf0024 */ lw $ra,0x24($sp) -/* 4a70: 27bd0068 */ addiu $sp,$sp,0x68 -/* 4a74: 03e00008 */ jr $ra -/* 4a78: 00000000 */ nop -/* 4a7c: 00000000 */ nop -); +void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) +{ + float mf[4][4]; + + guPerspectiveF(mf, perspNorm, fovy, aspect, near, far, scale); + + guMtxF2L(mf, m); +}