From a8139c14570b514edb5668ece4599a21a76fa0c5 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 11 Jul 2022 19:02:09 +1000 Subject: [PATCH] Rename player mtx properties --- src/game/bg.c | 46 ++++++------ src/game/bondgun.c | 40 +++++----- src/game/bondmove.c | 2 +- src/game/camera.c | 152 +++++++++++++++++++------------------- src/game/chr.c | 32 ++++---- src/game/chraction.c | 20 ++--- src/game/credits.c | 2 +- src/game/dlights.c | 8 +- src/game/env.c | 2 +- src/game/explosions.c | 8 +- src/game/game_13c510.c | 4 +- src/game/gunfx.c | 38 +++++----- src/game/menu.c | 42 +++++------ src/game/nbomb.c | 4 +- src/game/player.c | 62 ++++++++-------- src/game/playermgr.c | 22 +++--- src/game/prop.c | 12 +-- src/game/propobj.c | 84 ++++++++++----------- src/game/savebuffer.c | 2 +- src/game/shards.c | 24 +++--- src/game/sky.c | 22 +++--- src/game/smoke.c | 8 +- src/game/sparks.c | 2 +- src/game/stars.c | 2 +- src/game/wallhit.c | 6 +- src/game/weather.c | 8 +- src/include/game/camera.h | 36 ++++----- src/include/types.h | 32 ++++---- src/lib/vi.c | 10 +-- 29 files changed, 366 insertions(+), 366 deletions(-) diff --git a/src/game/bg.c b/src/game/bg.c index b9136f999..f4e0a2ea3 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -2401,7 +2401,7 @@ Gfx *bgRenderSceneInXray(Gfx *gdl) gDPSetTextureFilter(gdl++, G_TF_BILERP); gDPSetCycleType(gdl++, G_CYC_1CYCLE); gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); texSelect(&gdl, NULL, 2, 0, 2, 1, NULL); @@ -2423,7 +2423,7 @@ Gfx *bgRenderSceneInXray(Gfx *gdl) // Render props gdl = currentPlayerScissorToViewport(gdl); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); if (var800a4ce4); \ if (var8007fc2c); \ @@ -2432,11 +2432,11 @@ Gfx *bgRenderSceneInXray(Gfx *gdl) struct var800a4640_00 *thing = &var800a4640.unk000[k]; if (thing->draworder == i) { - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = currentPlayerScissorWithinViewportF(gdl, thing->box.xmin, thing->box.ymin, thing->box.xmax, thing->box.ymax); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); if (debugIsPropRenderingEnabled() && getVar80084040()) { if (thing->roomnum == -1) { @@ -2556,7 +2556,7 @@ Gfx *bgRenderScene(Gfx *gdl) || stagenum == STAGE_ATTACKSHIP)) { gdl = text0f153628(gdl); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = playerLoadMatrix(gdl); gdl = envStopFog(gdl); @@ -2613,7 +2613,7 @@ Gfx *bgRenderScene(Gfx *gdl) thing = &var800a4640.unk000[roomnum]; // Render prop opaque components - pre BG pass - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = envStopFog(gdl); if (debugIsPropRenderingEnabled() && getVar80084040()) { @@ -2625,7 +2625,7 @@ Gfx *bgRenderScene(Gfx *gdl) } // Render BG opaque components - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = currentPlayerScissorWithinViewportF(gdl, thing->box.xmin, thing->box.ymin, thing->box.xmax, thing->box.ymax); gdl = envStartFog(gdl, false); @@ -2637,7 +2637,7 @@ Gfx *bgRenderScene(Gfx *gdl) } // Render prop opaque components - post BG pass - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = envStopFog(gdl); @@ -2654,7 +2654,7 @@ Gfx *bgRenderScene(Gfx *gdl) gdl = currentPlayerScissorToViewport(gdl); // Render wall hits - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); if (getVar80084040() && g_Vars.currentplayer->visionmode != VISIONMODE_XRAY) { for (i = 0; i < var8007fc2c; i++) { @@ -2673,7 +2673,7 @@ Gfx *bgRenderScene(Gfx *gdl) for (i = var8007fc2c - 1; i >= 0; i--) { roomnum = roomnums[i]; - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); thing = &var800a4640.unk000[roomnum]; @@ -2685,7 +2685,7 @@ Gfx *bgRenderScene(Gfx *gdl) gdl = bgRenderRoomAlpha(gdl, thing->roomnum); } - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = envStopFog(gdl); @@ -2991,7 +2991,7 @@ glabel bgRenderScene /* f155128: 35ef0040 */ ori $t7,$t7,0x40 /* f15512c: ac4f0000 */ sw $t7,0x0($v0) /* f155130: 00408025 */ or $s0,$v0,$zero -/* f155134: 0fc2cb5a */ jal camGetUnk1758 +/* f155134: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f155138: 24510008 */ addiu $s1,$v0,0x8 /* f15513c: 0c013100 */ jal osVirtualToPhysical /* f155140: 00402025 */ or $a0,$v0,$zero @@ -3114,7 +3114,7 @@ glabel bgRenderScene /* f1552e0: 0018c080 */ sll $t8,$t8,0x2 /* f1552e4: 030b8021 */ addu $s0,$t8,$t3 /* f1552e8: afa20084 */ sw $v0,0x84($sp) -/* f1552ec: 0fc2cb52 */ jal camGetUnk1750 +/* f1552ec: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f1552f0: 26310008 */ addiu $s1,$s1,0x8 /* f1552f4: 0c013100 */ jal osVirtualToPhysical /* f1552f8: 00402025 */ or $a0,$v0,$zero @@ -3151,7 +3151,7 @@ glabel bgRenderScene /* f15536c: 02201025 */ or $v0,$s1,$zero /* f155370: ac4c0000 */ sw $t4,0x0($v0) /* f155374: afa20080 */ sw $v0,0x80($sp) -/* f155378: 0fc2cb5a */ jal camGetUnk1758 +/* f155378: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f15537c: 26310008 */ addiu $s1,$s1,0x8 /* f155380: 0c013100 */ jal osVirtualToPhysical /* f155384: 00402025 */ or $a0,$v0,$zero @@ -3201,7 +3201,7 @@ glabel bgRenderScene /* f15542c: 02201025 */ or $v0,$s1,$zero /* f155430: ac4c0000 */ sw $t4,0x0($v0) /* f155434: afa2007c */ sw $v0,0x7c($sp) -/* f155438: 0fc2cb52 */ jal camGetUnk1750 +/* f155438: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f15543c: 26310008 */ addiu $s1,$s1,0x8 /* f155440: 0c013100 */ jal osVirtualToPhysical /* f155444: 00402025 */ or $a0,$v0,$zero @@ -3249,7 +3249,7 @@ glabel bgRenderScene /* f1554e0: 35ef0040 */ ori $t7,$t7,0x40 /* f1554e4: ac4f0000 */ sw $t7,0x0($v0) /* f1554e8: 00408025 */ or $s0,$v0,$zero -/* f1554ec: 0fc2cb5a */ jal camGetUnk1758 +/* f1554ec: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f1554f0: 24510008 */ addiu $s1,$v0,0x8 /* f1554f4: 0c013100 */ jal osVirtualToPhysical /* f1554f8: 00402025 */ or $a0,$v0,$zero @@ -3302,7 +3302,7 @@ glabel bgRenderScene /* f1555a8: 02201025 */ or $v0,$s1,$zero /* f1555ac: ac580000 */ sw $t8,0x0($v0) /* f1555b0: afa20074 */ sw $v0,0x74($sp) -/* f1555b4: 0fc2cb5a */ jal camGetUnk1758 +/* f1555b4: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f1555b8: 26310008 */ addiu $s1,$s1,0x8 /* f1555bc: 0c013100 */ jal osVirtualToPhysical /* f1555c0: 00402025 */ or $a0,$v0,$zero @@ -3353,7 +3353,7 @@ glabel bgRenderScene /* f15566c: 02201025 */ or $v0,$s1,$zero /* f155670: ac4b0000 */ sw $t3,0x0($v0) /* f155674: afa20070 */ sw $v0,0x70($sp) -/* f155678: 0fc2cb52 */ jal camGetUnk1750 +/* f155678: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f15567c: 26310008 */ addiu $s1,$s1,0x8 /* f155680: 0c013100 */ jal osVirtualToPhysical /* f155684: 00402025 */ or $a0,$v0,$zero @@ -7909,7 +7909,7 @@ bool func0f15cd90(u32 room, struct screenbox *screen) bool func0f15d08c(struct coord *a, struct coord *b) { - Mtxf *matrix = camGetMatrix1740(); + Mtxf *matrix = camGetWorldToScreenMtxf(); b->x = a->x; b->y = a->y; @@ -14452,7 +14452,7 @@ glabel func0f162d9c /* f162ea4: e7a00094 */ swc1 $f0,0x94($sp) /* f162ea8: e7a00098 */ swc1 $f0,0x98($sp) /* f162eac: c6d2002c */ lwc1 $f18,0x2c($s6) -/* f162eb0: 0fc2d5de */ jal camGetUnk174c +/* f162eb0: 0fc2d5de */ jal camGetProjectionMtxF /* f162eb4: e7b2009c */ swc1 $f18,0x9c($sp) /* f162eb8: 00402025 */ or $a0,$v0,$zero /* f162ebc: 0c0056d9 */ jal mtx4TransformVecInPlace @@ -15373,9 +15373,9 @@ Gfx *func0f164150(Gfx *gdl) radius = g_Rooms[i].radius; - if (var8009dd6c + radius < player->unk174c->m[2][0] * g_Rooms[i].centre.f[0] - + player->unk174c->m[2][1] * g_Rooms[i].centre.f[1] - + player->unk174c->m[2][2] * g_Rooms[i].centre.f[2]) { + if (var8009dd6c + radius < player->projectionmtx->m[2][0] * g_Rooms[i].centre.f[0] + + player->projectionmtx->m[2][1] * g_Rooms[i].centre.f[1] + + player->projectionmtx->m[2][2] * g_Rooms[i].centre.f[2]) { value *= 3.0f; } diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 8184ac150..431d743b0 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -12055,7 +12055,7 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset) playerSetPerimEnabled(playerprop, true); bgunCalculatePlayerShotSpread(&sp1e8, &sp1dc, handnum, true); - mtx4RotateVecInPlace(camGetUnk174c(), &sp1dc); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp1dc); if (droppinggrenade) { // Dropping a grenade because player is in an nbomb storm @@ -12292,7 +12292,7 @@ void bgunCreateFiredProjectile(s32 handnum) mtx4LoadIdentity(&sp270); bgunCalculatePlayerShotSpread(&sp204, &sp1f8, handnum, true); - mtx4RotateVecInPlace(camGetUnk174c(), &sp1f8); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp1f8); spawnpos.x = hand->muzzlepos.x; spawnpos.y = hand->muzzlepos.y; @@ -12616,7 +12616,7 @@ void bgunSwivel(f32 screenx, f32 screeny, f32 crossdamp, f32 aimdamp) sp94.y = hand->dotpos.y; sp94.z = hand->dotpos.z; - mtx4TransformVecInPlace(camGetMatrix1740(), &sp94); + mtx4TransformVecInPlace(camGetWorldToScreenMtxf(), &sp94); if (!(sp94.z < 0.0000001f) || !(sp94.z > -0.0000001f)) { if (sp94.z > -6000.0f) { @@ -14533,7 +14533,7 @@ void bgunUpdateLasersight(struct hand *hand, struct modelfiledata *modeldef, s32 beamnear.y = ((Mtxf *)((u32)allocation + mtxindex * sizeof(Mtxf)))->m[3][1]; beamnear.z = ((Mtxf *)((u32)allocation + mtxindex * sizeof(Mtxf)))->m[3][2]; - mtx4TransformVecInPlace(camGetUnk174c(), &beamnear); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &beamnear); if (hand->useposrot || (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_XRAYSCANNER)) { @@ -14551,14 +14551,14 @@ void bgunUpdateLasersight(struct hand *hand, struct modelfiledata *modeldef, s32 sp3c.y = beamnear.y; sp3c.z = beamnear.z; - mtx4TransformVec(camGetMatrix1740(), &sp3c, &sp54); - mtx4RotateVec(camGetUnk174c(), &sp48, &sp30); + mtx4TransformVec(camGetWorldToScreenMtxf(), &sp3c, &sp54); + mtx4RotateVec(camGetProjectionMtxF(), &sp48, &sp30); beamfar.x *= 500.0f; beamfar.y *= 500.0f; beamfar.z *= 500.0f; - mtx4RotateVecInPlace(camGetUnk174c(), &beamfar); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &beamfar); beamfar.x += beamnear.x; beamfar.y += beamnear.y; @@ -14590,7 +14590,7 @@ void bgunUpdateLasersight(struct hand *hand, struct modelfiledata *modeldef, s32 beamfar.z *= 500.0f; } - mtx4TransformVecInPlace(camGetUnk174c(), &beamfar); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &beamfar); lasersightSetBeam(handnum, 1, &beamnear, &beamfar); if (handnum == HAND_RIGHT && hand->hasdotinfo && !busy) { @@ -14854,7 +14854,7 @@ void bgunUpdateMagnum(struct hand *hand, s32 handnum, struct modelfiledata *mode mtx4Copy(tmp, &sp4c); mtx00015f04(9.999999f, &sp4c); - mtx4MultMtx4InPlace(camGetUnk174c(), &sp4c); + mtx4MultMtx4InPlace(camGetProjectionMtxF(), &sp4c); casingCreateForHand(handnum, ground, &sp4c); } @@ -17339,7 +17339,7 @@ void bgunCreateFx(struct hand *hand, s32 handnum, struct weaponfunc *funcdef, s3 mtx4Copy(mtx, &sp24); mtx00015f04(9.999999f, &sp24); - mtx4MultMtx4InPlace(camGetUnk174c(), &sp24); + mtx4MultMtx4InPlace(camGetProjectionMtxF(), &sp24); casingCreateForHand(handnum, ground, &sp24); } else { @@ -17614,7 +17614,7 @@ void bgun0f0a5550(s32 handnum) mtx4Copy(&sp2c4, &hand->cammtx); mtx4Copy(&hand->posmtx, &hand->prevmtx); - mtx00015be4(camGetUnk174c(), &hand->cammtx, &hand->posmtx); + mtx00015be4(camGetProjectionMtxF(), &hand->cammtx, &hand->posmtx); if (hand->visible) { for (j = 0x5a; j < 0x5d; j++) { @@ -17881,7 +17881,7 @@ void bgun0f0a5550(s32 handnum) hand->muzzlepos.f[2] = mtx->m[3][2]; mtx4Copy(mtx, &hand->muzzlemat); - mtx4TransformVecInPlace(camGetUnk174c(), &hand->muzzlepos); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &hand->muzzlepos); hand->muzzlez = -((Mtxf *)((u32)mtxallocation + sp6c * sizeof(Mtxf)))->m[3][2]; @@ -17903,7 +17903,7 @@ void bgun0f0a5550(s32 handnum) hand->muzzlepos.z = mtx->m[3][2]; mtx4Copy(mtx, &hand->muzzlemat); - mtx4TransformVecInPlace(camGetUnk174c(), &hand->muzzlepos); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &hand->muzzlepos); hand->muzzlez = -((Mtxf *)((u32)mtxallocation + sp6c * sizeof(Mtxf)))->m[3][2]; } else { @@ -18532,7 +18532,7 @@ glabel var7f1aca90 /* f0a74d4: 25ae0008 */ addiu $t6,$t5,0x8 /* f0a74d8: afae014c */ sw $t6,0x14c($sp) /* f0a74dc: adaf0000 */ sw $t7,0x0($t5) -/* f0a74e0: 0fc2d5ea */ jal camGetUnk175c +/* f0a74e0: 0fc2d5ea */ jal camGetLookAt /* f0a74e4: afad00d4 */ sw $t5,0xd4($sp) /* f0a74e8: 8fa500d4 */ lw $a1,0xd4($sp) /* f0a74ec: 3c080382 */ lui $t0,0x382 @@ -18542,7 +18542,7 @@ glabel var7f1aca90 /* f0a74fc: 25890008 */ addiu $t1,$t4,0x8 /* f0a7500: afa9014c */ sw $t1,0x14c($sp) /* f0a7504: ad880000 */ sw $t0,0x0($t4) -/* f0a7508: 0fc2d5ea */ jal camGetUnk175c +/* f0a7508: 0fc2d5ea */ jal camGetLookAt /* f0a750c: afac00d0 */ sw $t4,0xd0($sp) /* f0a7510: 8fa300d0 */ lw $v1,0xd0($sp) /* f0a7514: 244a0010 */ addiu $t2,$v0,0x10 @@ -19373,7 +19373,7 @@ glabel var7f1aca90 /* f0a74d4: 25ae0008 */ addiu $t6,$t5,0x8 /* f0a74d8: afae014c */ sw $t6,0x14c($sp) /* f0a74dc: adaf0000 */ sw $t7,0x0($t5) -/* f0a74e0: 0fc2d5ea */ jal camGetUnk175c +/* f0a74e0: 0fc2d5ea */ jal camGetLookAt /* f0a74e4: afad00d4 */ sw $t5,0xd4($sp) /* f0a74e8: 8fa500d4 */ lw $a1,0xd4($sp) /* f0a74ec: 3c080382 */ lui $t0,0x382 @@ -19383,7 +19383,7 @@ glabel var7f1aca90 /* f0a74fc: 25890008 */ addiu $t1,$t4,0x8 /* f0a7500: afa9014c */ sw $t1,0x14c($sp) /* f0a7504: ad880000 */ sw $t0,0x0($t4) -/* f0a7508: 0fc2d5ea */ jal camGetUnk175c +/* f0a7508: 0fc2d5ea */ jal camGetLookAt /* f0a750c: afac00d0 */ sw $t4,0xd0($sp) /* f0a7510: 8fa300d0 */ lw $v1,0xd0($sp) /* f0a7514: 244a0010 */ addiu $t2,$v0,0x10 @@ -20214,7 +20214,7 @@ glabel var7f1aca90 /* f0a5220: 25ae0008 */ addiu $t6,$t5,0x8 /* f0a5224: afae0144 */ sw $t6,0x144($sp) /* f0a5228: adaf0000 */ sw $t7,0x0($t5) -/* f0a522c: 0fc2cd42 */ jal camGetUnk175c +/* f0a522c: 0fc2cd42 */ jal camGetLookAt /* f0a5230: afad00cc */ sw $t5,0xcc($sp) /* f0a5234: 8fa500cc */ lw $a1,0xcc($sp) /* f0a5238: 3c080382 */ lui $t0,0x382 @@ -20224,7 +20224,7 @@ glabel var7f1aca90 /* f0a5248: 25890008 */ addiu $t1,$t4,0x8 /* f0a524c: afa90144 */ sw $t1,0x144($sp) /* f0a5250: ad880000 */ sw $t0,0x0($t4) -/* f0a5254: 0fc2cd42 */ jal camGetUnk175c +/* f0a5254: 0fc2cd42 */ jal camGetLookAt /* f0a5258: afac00c8 */ sw $t4,0xc8($sp) /* f0a525c: 8fa300c8 */ lw $v1,0xc8($sp) /* f0a5260: 244a0010 */ addiu $t2,$v0,0x10 @@ -20856,7 +20856,7 @@ glabel var7f1aca90 // gSPNumLights(gdl++, 1); // gSPLight(gdl++, &var80070098, 1); // gSPLight(gdl++, &var80070090, 2); -// gSPLookAt(gdl++, camGetUnk175c()); +// gSPLookAt(gdl++, camGetLookAt()); // } // // gSPPerspNormalize(gdl++, mtx00016dcc(0, 300)); diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 6def7cd3d..4c356740f 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1500,7 +1500,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->gunzoomfovs[1] = eraserfov; - mtx4TransformVec(camGetMatrix1740(), &g_Vars.currentplayer->autoerasertarget->pos, &spa0); + mtx4TransformVec(camGetWorldToScreenMtxf(), &g_Vars.currentplayer->autoerasertarget->pos, &spa0); cam0f0b4eb8(&spa0, crosspos, eraserfov, g_Vars.currentplayer->c_perspaspect); diff --git a/src/game/camera.c b/src/game/camera.c index f3e21705c..5c726ca19 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -182,78 +182,78 @@ void cam0f0b4eb8(struct coord *arg0, f32 arg1[2], f32 zoom, f32 aspect) arg1[0] = player->c_screenleft + player->c_halfwidth - f14 * arg0->f[0]; } -void camSetUnk1738(void *value) +void camSetMtxL1738(Mtx *mtx) { - g_Vars.currentplayer->unk1738 = value; + g_Vars.currentplayer->mtxl1738 = mtx; } -void *camGetUnk1738(void) +Mtx *camGetMtxL1738(void) { - return g_Vars.currentplayer->unk1738; + return g_Vars.currentplayer->mtxl1738; } -void camSetUnk173c(Mtx *matrix) +void camSetMtxL173c(Mtx *mtx) { - g_Vars.currentplayer->unk173c = matrix; + g_Vars.currentplayer->mtxl173c = mtx; } -Mtx *camGetUnk173c(void) +Mtx *camGetMtxL173c(void) { - return g_Vars.currentplayer->unk173c; + return g_Vars.currentplayer->mtxl173c; } -void camSetUnk006c(Mtxf *matrix) +void camSetMtxF006c(Mtxf *mtx) { - g_Vars.currentplayer->matrix6c = matrix; + g_Vars.currentplayer->mtxf006c = mtx; } -Mtxf *camGetUnk006c(void) +Mtxf *camGetMtxF006c(void) { - return g_Vars.currentplayer->matrix6c; + return g_Vars.currentplayer->mtxf006c; } -void camSetUnk1750(void *value) +void camSetPerspectiveMtxL(Mtx *mtx) { - g_Vars.currentplayer->unk1750 = value; + g_Vars.currentplayer->perspmtxl = mtx; } -void *camGetUnk1750(void) +Mtx *camGetPerspectiveMtxL(void) { - return g_Vars.currentplayer->unk1750; + return g_Vars.currentplayer->perspmtxl; } -void camSetUnk1758(Mtx *matrix) +void camSetOrthogonalMtxL(Mtx *mtx) { - g_Vars.currentplayer->unk1758 = matrix; + g_Vars.currentplayer->orthomtxl = mtx; } -Mtx *camGetUnk1758(void) +Mtx *camGetOrthogonalMtxL(void) { - return g_Vars.currentplayer->unk1758; + return g_Vars.currentplayer->orthomtxl; } -void camSetMatrix1740(Mtxf *matrix) +void camSetWorldToScreenMtxf(Mtxf *mtx) { struct player *player = g_Vars.currentplayer; - player->prev1740 = player->matrix1740; - player->matrix1740 = matrix; + player->prevworldtoscreenmtx = player->worldtoscreenmtx; + player->worldtoscreenmtx = mtx; player->c_viewfmdynticknum = g_GfxNumSwaps; player->unk0488 = player->unk0484; player->unk0484 = g_GfxMemPos; } -void *cam0f0b5050(u8 *arg0) +Mtxf *cam0f0b5050(u8 *arg0) { - u8 *result = NULL; + Mtxf *result = NULL; s32 i; if (arg0 >= g_VtxBuffers[g_GfxActiveBufferIndex] && arg0 < g_VtxBuffers[g_GfxActiveBufferIndex + 1]) { for (i = 0; i < PLAYERCOUNT(); i++) { if (g_Vars.currentplayerindex >= playermgrGetOrderOfPlayer(i)) { if (g_GfxNumSwaps == g_Vars.players[i]->c_viewfmdynticknum) { - if (arg0 >= g_Vars.players[i]->unk0484 && result < g_Vars.players[i]->unk0484) { - result = (u8 *)g_Vars.players[i]->matrix1740; + if (arg0 >= g_Vars.players[i]->unk0484 && (u8 *)result < g_Vars.players[i]->unk0484) { + result = g_Vars.players[i]->worldtoscreenmtx; } } } @@ -262,14 +262,14 @@ void *cam0f0b5050(u8 *arg0) for (i = 0; i < PLAYERCOUNT(); i++) { if (g_Vars.currentplayerindex >= playermgrGetOrderOfPlayer(i)) { if (g_GfxNumSwaps == g_Vars.players[i]->c_prevviewfmdynticknum + 1) { - if (arg0 >= g_Vars.players[i]->unk0488 && result < g_Vars.players[i]->unk0488) { - result = (u8 *)g_Vars.players[i]->prev1740; + if (arg0 >= g_Vars.players[i]->unk0488 && (u8 *)result < g_Vars.players[i]->unk0488) { + result = g_Vars.players[i]->prevworldtoscreenmtx; } } } else { if (g_GfxNumSwaps == g_Vars.players[i]->c_viewfmdynticknum + 1) { - if (arg0 >= g_Vars.players[i]->unk0484 && result < g_Vars.players[i]->unk0484) { - result = (u8 *)g_Vars.players[i]->matrix1740; + if (arg0 >= g_Vars.players[i]->unk0484 && (u8 *)result < g_Vars.players[i]->unk0484) { + result = g_Vars.players[i]->worldtoscreenmtx; } } } @@ -289,7 +289,7 @@ Mtxf *cam0f0b53a4(u8 *arg0) if (g_Vars.currentplayerindex >= playermgrGetOrderOfPlayer(i)) { if (g_GfxNumSwaps == g_Vars.players[i]->c_viewfmdynticknum) { if (arg0 >= g_Vars.players[i]->unk0484 && (u8 *)result < g_Vars.players[i]->unk0484) { - result = g_Vars.players[i]->unk174c; + result = g_Vars.players[i]->projectionmtx; } } } @@ -299,13 +299,13 @@ Mtxf *cam0f0b53a4(u8 *arg0) if (g_Vars.currentplayerindex >= playermgrGetOrderOfPlayer(i)) { if (g_GfxNumSwaps == g_Vars.players[i]->c_prevviewfmdynticknum + 1) { if (arg0 >= g_Vars.players[i]->unk0488 && (u8 *)result < g_Vars.players[i]->unk0488) { - result = g_Vars.players[i]->unk1768; + result = g_Vars.players[i]->prevprojectionmtx; } } } else { if (g_GfxNumSwaps == g_Vars.players[i]->c_viewfmdynticknum + 1) { if (arg0 >= g_Vars.players[i]->unk0484 && (u8 *)result < g_Vars.players[i]->unk0484) { - result = g_Vars.players[i]->unk174c; + result = g_Vars.players[i]->projectionmtx; } } } @@ -315,63 +315,63 @@ Mtxf *cam0f0b53a4(u8 *arg0) return result; } -Mtxf *camGetMatrix1740(void) +Mtxf *camGetWorldToScreenMtxf(void) { - return g_Vars.currentplayer->matrix1740; + return g_Vars.currentplayer->worldtoscreenmtx; } -void camSetUnk1754(Mtxf *matrix) +void camSetMtxF1754(Mtxf *mtx) { - g_Vars.currentplayer->unk1754 = matrix; + g_Vars.currentplayer->mtxf1754 = mtx; } -Mtxf *camGetUnk1754(void) +Mtxf *camGetMtxF1754(void) { - return g_Vars.currentplayer->unk1754; + return g_Vars.currentplayer->mtxf1754; } -Mtxf *camGetPrevMatrix(void) +Mtxf *camGetPrevWorldToScreenMtxf(void) { - return g_Vars.currentplayer->prev1740; + return g_Vars.currentplayer->prevworldtoscreenmtx; } -void camSetUnk1748(u32 value) +void camSetMtxF1748(Mtxf *mtx) { - g_Vars.currentplayer->unk1748 = value; + g_Vars.currentplayer->mtxf1748 = mtx; } -u32 camGetUnk1748(void) +Mtxf *camGetMtxF1748(void) { - return g_Vars.currentplayer->unk1748; + return g_Vars.currentplayer->mtxf1748; } -void camSetUnk174c(Mtxf *matrix) +void camSetProjectionMtxF(Mtxf *mtx) { struct player *player = g_Vars.currentplayer; player->c_prevviewfmdynticknum = player->c_viewfmdynticknum; - player->unk1768 = player->unk174c; - player->unk174c = matrix; + player->prevprojectionmtx = player->projectionmtx; + player->projectionmtx = mtx; } -Mtxf *camGetUnk174c(void) +Mtxf *camGetProjectionMtxF(void) { - return g_Vars.currentplayer->unk174c; + return g_Vars.currentplayer->projectionmtx; } -Mtxf *camGetUnk1768(void) +Mtxf *camGetPrevProjectionMtxF(void) { - return g_Vars.currentplayer->unk1768; + return g_Vars.currentplayer->prevprojectionmtx; } -void camSetUnk175c(Mtxf *mtx) +void camSetLookAt(LookAt *lookat) { - g_Vars.currentplayer->unk175c = mtx; + g_Vars.currentplayer->lookat = lookat; } -Mtxf *camGetUnk175c(void) +LookAt *camGetLookAt(void) { - return g_Vars.currentplayer->unk175c; + return g_Vars.currentplayer->lookat; } f32 camGetLodScaleZ(void) @@ -427,7 +427,7 @@ void cam0f0b5838(void) player = g_Vars.currentplayer; sp24 = player->c_halfheight * player->c_scaley; - mtx = player->unk174c; + mtx = player->projectionmtx; sp2c = 1.0f / sqrtf(sp24 * sp24 + 1.0f); sp24 *= sp2c; @@ -472,7 +472,7 @@ void cam0f0b5838(void) bool cam0f0b5b9c(struct coord *arg0, f32 arg1) { - Mtxf *mtx = g_Vars.currentplayer->unk174c; + Mtxf *mtx = g_Vars.currentplayer->projectionmtx; if (var8009dd6c + arg1 < mtx->m[2][0] * arg0->f[0] + mtx->m[2][1] * arg0->f[1] + mtx->m[2][2] * arg0->f[2]) { return false; @@ -518,7 +518,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg f32 sp1c; f32 sp18; - if (var8009dd6c + arg1 < g_Vars.currentplayer->unk174c->m[2][0] * pos->f[0] + g_Vars.currentplayer->unk174c->m[2][1] * pos->f[1] + g_Vars.currentplayer->unk174c->m[2][2] * pos->f[2]) { + if (var8009dd6c + arg1 < g_Vars.currentplayer->projectionmtx->m[2][0] * pos->f[0] + g_Vars.currentplayer->projectionmtx->m[2][1] * pos->f[1] + g_Vars.currentplayer->projectionmtx->m[2][2] * pos->f[2]) { return false; } @@ -528,11 +528,11 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg sp38 *= sp3c; sp24 = -sp3c; - sp54.f[0] = sp24 * g_Vars.currentplayer->unk174c->m[0][0] - sp38 * g_Vars.currentplayer->unk174c->m[2][0]; - sp54.f[1] = sp24 * g_Vars.currentplayer->unk174c->m[0][1] - sp38 * g_Vars.currentplayer->unk174c->m[2][1]; - sp54.f[2] = sp24 * g_Vars.currentplayer->unk174c->m[0][2] - sp38 * g_Vars.currentplayer->unk174c->m[2][2]; + sp54.f[0] = sp24 * g_Vars.currentplayer->projectionmtx->m[0][0] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][0]; + sp54.f[1] = sp24 * g_Vars.currentplayer->projectionmtx->m[0][1] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][1]; + sp54.f[2] = sp24 * g_Vars.currentplayer->projectionmtx->m[0][2] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][2]; - sp50 = sp54.f[0] * g_Vars.currentplayer->unk174c->m[3][0] + sp54.f[1] * g_Vars.currentplayer->unk174c->m[3][1] + sp54.f[2] * g_Vars.currentplayer->unk174c->m[3][2]; + sp50 = sp54.f[0] * g_Vars.currentplayer->projectionmtx->m[3][0] + sp54.f[1] * g_Vars.currentplayer->projectionmtx->m[3][1] + sp54.f[2] * g_Vars.currentplayer->projectionmtx->m[3][2]; if (sp50 + arg1 < sp54.f[0] * pos->f[0] + sp54.f[1] * pos->f[1] + sp54.f[2] * pos->f[2]) { return false; @@ -543,11 +543,11 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg sp38 *= sp30; sp20 = -sp30; - sp44.f[0] = -sp20 * g_Vars.currentplayer->unk174c->m[0][0] - sp38 * g_Vars.currentplayer->unk174c->m[2][0]; - sp44.f[1] = -sp20 * g_Vars.currentplayer->unk174c->m[0][1] - sp38 * g_Vars.currentplayer->unk174c->m[2][1]; - sp44.f[2] = -sp20 * g_Vars.currentplayer->unk174c->m[0][2] - sp38 * g_Vars.currentplayer->unk174c->m[2][2]; + sp44.f[0] = -sp20 * g_Vars.currentplayer->projectionmtx->m[0][0] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][0]; + sp44.f[1] = -sp20 * g_Vars.currentplayer->projectionmtx->m[0][1] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][1]; + sp44.f[2] = -sp20 * g_Vars.currentplayer->projectionmtx->m[0][2] - sp38 * g_Vars.currentplayer->projectionmtx->m[2][2]; - sp40 = sp44.f[0] * g_Vars.currentplayer->unk174c->m[3][0] + sp44.f[1] * g_Vars.currentplayer->unk174c->m[3][1] + sp44.f[2] * g_Vars.currentplayer->unk174c->m[3][2]; + sp40 = sp44.f[0] * g_Vars.currentplayer->projectionmtx->m[3][0] + sp44.f[1] * g_Vars.currentplayer->projectionmtx->m[3][1] + sp44.f[2] * g_Vars.currentplayer->projectionmtx->m[3][2]; if (sp40 + arg1 < sp44.f[0] * pos->f[0] + sp44.f[1] * pos->f[1] + sp44.f[2] * pos->f[2]) { return false; @@ -558,11 +558,11 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg sp34 *= sp2c; sp1c = -sp2c; - sp74.f[0] = -sp1c * g_Vars.currentplayer->unk174c->m[1][0] + sp34 * g_Vars.currentplayer->unk174c->m[2][0]; - sp74.f[1] = -sp1c * g_Vars.currentplayer->unk174c->m[1][1] + sp34 * g_Vars.currentplayer->unk174c->m[2][1]; - sp74.f[2] = -sp1c * g_Vars.currentplayer->unk174c->m[1][2] + sp34 * g_Vars.currentplayer->unk174c->m[2][2]; + sp74.f[0] = -sp1c * g_Vars.currentplayer->projectionmtx->m[1][0] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][0]; + sp74.f[1] = -sp1c * g_Vars.currentplayer->projectionmtx->m[1][1] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][1]; + sp74.f[2] = -sp1c * g_Vars.currentplayer->projectionmtx->m[1][2] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][2]; - sp70 = sp74.f[0] * g_Vars.currentplayer->unk174c->m[3][0] + sp74.f[1] * g_Vars.currentplayer->unk174c->m[3][1] + sp74.f[2] * g_Vars.currentplayer->unk174c->m[3][2]; + sp70 = sp74.f[0] * g_Vars.currentplayer->projectionmtx->m[3][0] + sp74.f[1] * g_Vars.currentplayer->projectionmtx->m[3][1] + sp74.f[2] * g_Vars.currentplayer->projectionmtx->m[3][2]; if (sp70 + arg1 < sp74.f[0] * pos->f[0] + sp74.f[1] * pos->f[1] + sp74.f[2] * pos->f[2]) { return false; @@ -573,11 +573,11 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg sp34 *= sp28; sp18 = -sp28; - sp64.f[0] = sp18 * g_Vars.currentplayer->unk174c->m[1][0] + sp34 * g_Vars.currentplayer->unk174c->m[2][0]; - sp64.f[1] = sp18 * g_Vars.currentplayer->unk174c->m[1][1] + sp34 * g_Vars.currentplayer->unk174c->m[2][1]; - sp64.f[2] = sp18 * g_Vars.currentplayer->unk174c->m[1][2] + sp34 * g_Vars.currentplayer->unk174c->m[2][2]; + sp64.f[0] = sp18 * g_Vars.currentplayer->projectionmtx->m[1][0] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][0]; + sp64.f[1] = sp18 * g_Vars.currentplayer->projectionmtx->m[1][1] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][1]; + sp64.f[2] = sp18 * g_Vars.currentplayer->projectionmtx->m[1][2] + sp34 * g_Vars.currentplayer->projectionmtx->m[2][2]; - sp60 = sp64.f[0] * g_Vars.currentplayer->unk174c->m[3][0] + sp64.f[1] * g_Vars.currentplayer->unk174c->m[3][1] + sp64.f[2] * g_Vars.currentplayer->unk174c->m[3][2]; + sp60 = sp64.f[0] * g_Vars.currentplayer->projectionmtx->m[3][0] + sp64.f[1] * g_Vars.currentplayer->projectionmtx->m[3][1] + sp64.f[2] * g_Vars.currentplayer->projectionmtx->m[3][2]; if (sp60 + arg1 < sp64.f[0] * pos->f[0] + sp64.f[1] * pos->f[1] + sp64.f[2] * pos->f[2]) { return false; diff --git a/src/game/chr.c b/src/game/chr.c index 9c2523f2e..e6741bc34 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -1660,7 +1660,7 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx) return; } - mtx00015be0(camGetUnk174c(), mtx); + mtx00015be0(camGetProjectionMtxF(), mtx); sp138.x = mtx->m[3][0]; sp138.y = mtx->m[3][1]; @@ -1706,7 +1706,7 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx) mtx->m[3][1] = sp138.y; mtx->m[3][2] = sp138.z; - mtx00015be0(camGetMatrix1740(), mtx); + mtx00015be0(camGetWorldToScreenMtxf(), mtx); } else { if (g_CurModelChr->model->filedata->skel == &g_SkelChr) { lshoulderjoint = 2; @@ -1869,7 +1869,7 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx) yrot += M_BADTAU; } - mtx00015be0(camGetUnk174c(), mtx); + mtx00015be0(camGetProjectionMtxF(), mtx); sp70.x = mtx->m[3][0]; sp70.y = mtx->m[3][1]; @@ -1914,7 +1914,7 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx) mtx->m[3][1] = sp70.y; mtx->m[3][2] = sp70.z; - mtx00015be0(camGetMatrix1740(), mtx); + mtx00015be0(camGetWorldToScreenMtxf(), mtx); } } } @@ -2720,7 +2720,7 @@ s32 chrTick(struct prop *prop) sp190.z = cosf(angle) * 19; mtx4LoadTranslation(&sp190, &sp1a8); - mtx4MultMtx4InPlace(camGetMatrix1740(), &sp1a8); + mtx4MultMtx4InPlace(camGetWorldToScreenMtxf(), &sp1a8); sp210.unk00 = &sp1a8; } else if (prop->type == PROPTYPE_PLAYER) { u8 stack[0x14]; @@ -2737,13 +2737,13 @@ s32 chrTick(struct prop *prop) sp17c.z = sinf(-sp178) * sp130; mtx4LoadTranslation(&sp17c, &sp1a8); - mtx4MultMtx4InPlace(camGetMatrix1740(), &sp1a8); + mtx4MultMtx4InPlace(camGetWorldToScreenMtxf(), &sp1a8); sp210.unk00 = &sp1a8; } else { - sp210.unk00 = camGetMatrix1740(); + sp210.unk00 = camGetWorldToScreenMtxf(); } } else { - sp210.unk00 = camGetMatrix1740(); + sp210.unk00 = camGetWorldToScreenMtxf(); } sp210.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf)); @@ -3082,7 +3082,7 @@ bool chr0f024738(struct chrdata *chr) + thing->unk06c.m[1][2] * campos->f[1] + thing->unk06c.m[2][2] * campos->f[2]) + thing->unk06c.m[3][2]; - mtx00015be4(&thing->unk06c, camGetUnk174c(), &thing->unk0ac); + mtx00015be4(&thing->unk06c, camGetProjectionMtxF(), &thing->unk0ac); thing->unk00c = true; } @@ -3190,7 +3190,7 @@ bool chr0f024b18(struct model *model, struct modelnode *node) sp88.z = thing->bbox.zmin; } - mtx00015be4(camGetMatrix1740(), &thing->unk02c, &thing->unk0ec); + mtx00015be4(camGetWorldToScreenMtxf(), &thing->unk02c, &thing->unk0ec); mtx4TransformVec(&thing->unk0ec, &spa0, &sp70); cam0f0b4dec(&sp70, thing->unk134); mtx4TransformVec(&thing->unk0ec, &sp94, &sp70); @@ -5190,9 +5190,9 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a while (spc0 > 0) { if (func0f084594(model, node, &shotdata->unk00, &shotdata->unk0c, &sp88, &sp84, &sp80)) { mtx4TransformVec(&model->matrices[sp84], &sp88.unk00, &spdc); - mtx4TransformVecInPlace(camGetUnk174c(), &spdc); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &spdc); mtx4RotateVec(&model->matrices[sp84], &sp88.unk0c, &spd0); - mtx4RotateVecInPlace(camGetUnk174c(), &spd0); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &spd0); break; } @@ -5204,8 +5204,8 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a if (spc0 > 0) { if (func0f06bea0(model, model->filedata->rootnode, model->filedata->rootnode, &shotdata->unk00, &shotdata->unk0c, &sp88.unk00, &sp70, &node, &spc0, &sp84, &sp80)) { - mtx4TransformVec(camGetUnk174c(), &sp88.unk00, &spdc); - mtx4RotateVec(camGetUnk174c(), &sp88.unk0c, &spd0); + mtx4TransformVec(camGetProjectionMtxF(), &sp88.unk00, &spdc); + mtx4RotateVec(camGetProjectionMtxF(), &sp88.unk0c, &spd0); } else { spc0 = 0; } @@ -5218,7 +5218,7 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a } if (spc0 > 0) { - mtx = camGetMatrix1740(); + mtx = camGetWorldToScreenMtxf(); sp68 = spdc.x * mtx->m[0][2] + spdc.y * mtx->m[1][2] + spdc.z * mtx->m[2][2] + mtx->m[3][2]; sp68 = -sp68; @@ -5272,7 +5272,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit) sp98.y = shotdata->unk00.y - (hit->distance * shotdata->unk0c.y) / shotdata->unk0c.z; sp98.z = shotdata->unk00.z - hit->distance; - mtx4TransformVec(camGetUnk174c(), &sp98, &hitpos); + mtx4TransformVec(camGetProjectionMtxF(), &sp98, &hitpos); bgunSetHitPos(&hitpos); bgunPlayPropHitSound(&shotdata->gset, hit->prop, -1); diff --git a/src/game/chraction.c b/src/game/chraction.c index 9198f45f5..b76de2cae 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -9606,13 +9606,13 @@ bool chrGetGunPos(struct chrdata *chr, s32 handnum, struct coord *gunpos) gunpos->y = rodata->pos.y; gunpos->z = rodata->pos.z; - mtx00015be4(camGetUnk174c(), spac, &sp6c); + mtx00015be4(camGetProjectionMtxF(), spac, &sp6c); mtx4TransformVecInPlace(&sp6c, gunpos); result = true; } else if ((part1 = modelGetPart(model->filedata, MODELPART_0001))) { sp64 = model0001a5cc(model, part1, 0); - mtx00015be4(camGetUnk174c(), sp64, &sp24); + mtx00015be4(camGetProjectionMtxF(), sp64, &sp24); gunpos->x = sp24.m[3][0]; gunpos->y = sp24.m[3][1]; @@ -9653,7 +9653,7 @@ void chrCalculateShieldHit(struct chrdata *chr, struct coord *pos, struct coord u32 stack2[2]; Mtxf spc8; f32 bestvolume; - Mtxf *lVar4; + Mtxf *worldtoscreenmtx; struct modelnode *node; f32 x; f32 y; @@ -9668,13 +9668,13 @@ void chrCalculateShieldHit(struct chrdata *chr, struct coord *pos, struct coord if (prop->flags & (PROPFLAG_ONTHISSCREENTHISTICK | PROPFLAG_ONANYSCREENTHISTICK | PROPFLAG_ONANYSCREENPREVTICK)) { bestnode = NULL; bestvolume = MAXFLOAT; - lVar4 = cam0f0b5050((u8 *)chr->model->matrices); + worldtoscreenmtx = cam0f0b5050((u8 *)chr->model->matrices); - if (lVar4) { - mtx4TransformVec(lVar4, pos, &sp124); - mtx4RotateVec(lVar4, vector, &sp118); + if (worldtoscreenmtx) { + mtx4TransformVec(worldtoscreenmtx, pos, &sp124); + mtx4RotateVec(worldtoscreenmtx, vector, &sp118); - isdifferentmtx = (camGetMatrix1740() != lVar4); + isdifferentmtx = (camGetWorldToScreenMtxf() != worldtoscreenmtx); node = chr->model->filedata->rootnode; while (node) { @@ -24637,7 +24637,7 @@ bool chrCanSeeTargetWithExtraCheck(struct chrdata *chr) bgun0f0a0c08(&sp68, &sp56); modelGetRootPosition(model, &sp44); - mtx4TransformVecInPlace(camGetMatrix1740(), &sp44); + mtx4TransformVecInPlace(camGetWorldToScreenMtxf(), &sp44); if (func0f06b39c(&sp68, &sp56, &sp44, somefloat)) { return true; @@ -26235,7 +26235,7 @@ Gfx *chrsRenderChrStats(Gfx *gdl, s16 *rooms) sp20c.y = chr->ground + chr->chrheight - 30; sp20c.z = chr->prop->pos.z; - mtx4TransformVecInPlace(g_Vars.currentplayer->matrix1740, &sp20c); + mtx4TransformVecInPlace(g_Vars.currentplayer->worldtoscreenmtx, &sp20c); if (sp20c.z < -100 && sp20c.z > -1000) { cam0f0b4eb8(&sp20c, sp204, g_Vars.currentplayer->c_perspfovy, g_Vars.currentplayer->c_perspaspect); diff --git a/src/game/credits.c b/src/game/credits.c index dcc7ef22e..1270ca421 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -1825,7 +1825,7 @@ Gfx *creditsDraw(Gfx *gdl) mtx4LoadIdentity(&sp68); mtx00016054(&sp68, matrix); - camSetMatrix1740(&sp68); + camSetWorldToScreenMtxf(&sp68); gSPMatrix(gdl++, osVirtualToPhysical(matrix), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/game/dlights.c b/src/game/dlights.c index 79597318b..3ba56956c 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -340,8 +340,8 @@ Gfx *func0f001138(Gfx *gdl, s16 roomnum) gSPSetLights1(gdl++, (*lights)); - gSPLookAtX(gdl++, camGetUnk175c()->m[0]); - gSPLookAtY(gdl++, camGetUnk175c()->m[1]); + gSPLookAtX(gdl++, &camGetLookAt()->l[0]); + gSPLookAtY(gdl++, &camGetLookAt()->l[1]); return gdl; } @@ -350,8 +350,8 @@ Gfx *func0f001300(Gfx *gdl) { gSPSetLights1(gdl++, var80061460); - gSPLookAtX(gdl++, camGetUnk175c()->m[0]); - gSPLookAtY(gdl++, camGetUnk175c()->m[1]); + gSPLookAtX(gdl++, &camGetLookAt()->l[0]); + gSPLookAtY(gdl++, &camGetLookAt()->l[1]); return gdl; } diff --git a/src/game/env.c b/src/game/env.c index 8351c379d..ddb6c941d 100644 --- a/src/game/env.c +++ b/src/game/env.c @@ -404,7 +404,7 @@ bool env0f1666f8(struct coord *pos, f32 arg1) return true; } - mtx = camGetMatrix1740(); + mtx = camGetWorldToScreenMtxf(); sp24.x = pos->x - campos->x; sp24.y = pos->y - campos->y; diff --git a/src/game/explosions.c b/src/game/explosions.c index d63d1522e..5c1691853 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -1247,7 +1247,7 @@ u32 explosionTick(struct prop *prop) u32 explosionTickPlayer(struct prop *prop) { - Mtxf *matrix = camGetMatrix1740(); + Mtxf *matrix = camGetWorldToScreenMtxf(); prop->z = -(matrix->m[0][2] * prop->pos.x + matrix->m[1][2] * prop->pos.y + matrix->m[2][2] * prop->pos.z + matrix->m[3][2]); @@ -1300,7 +1300,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) } gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = room0f166d7c(gdl, roomnum); @@ -1369,7 +1369,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) } } - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); #if PAL tmp = (g_ExplosionTypes[exp->type].flarespeed * 15.0f) * 0.83333331346512f; @@ -1390,7 +1390,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) Gfx *explosionRenderPart(struct explosion *exp, struct explosionpart *part, Gfx *gdl, struct coord *coord, s32 arg4) { struct gfxvtx *vertices = gfxAllocateVertices(4); - Mtxf *mtx = camGetUnk174c(); + Mtxf *mtx = camGetProjectionMtxF(); struct coord spbc; struct coord spb0; struct coord spa4; diff --git a/src/game/game_13c510.c b/src/game/game_13c510.c index 9821aacbe..0d9e4ecb6 100644 --- a/src/game/game_13c510.c +++ b/src/game/game_13c510.c @@ -195,7 +195,7 @@ glabel var7f1b59dc /* f13c870: 46000306 */ mov.s $f12,$f0 /* f13c874: 0c0057e2 */ jal mtx00015f88 /* f13c878: 02002825 */ or $a1,$s0,$zero -/* f13c87c: 0fc2d3f2 */ jal camGetUnk006c +/* f13c87c: 0fc2d3f2 */ jal camGetMtxF006c /* f13c880: 00000000 */ nop /* f13c884: 00402025 */ or $a0,$v0,$zero /* f13c888: 02002825 */ or $a1,$s0,$zero @@ -1409,7 +1409,7 @@ glabel var7f1b5a0c /* f13dae4: 460a3481 */ sub.s $f18,$f6,$f10 /* f13dae8: 14a8ffe4 */ bne $a1,$t0,.L0f13da7c /* f13daec: e4b2fffc */ swc1 $f18,-0x4($a1) -/* f13daf0: 0fc2d5be */ jal camGetMatrix1740 +/* f13daf0: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f13daf4: 00000000 */ nop /* f13daf8: 00402025 */ or $a0,$v0,$zero /* f13dafc: 0c0056c4 */ jal mtx4RotateVecInPlace diff --git a/src/game/gunfx.c b/src/game/gunfx.c index 5e9c54e3a..ce563090d 100644 --- a/src/game/gunfx.c +++ b/src/game/gunfx.c @@ -121,7 +121,7 @@ void beamCreateForHand(s32 handnum) { struct player *player = g_Vars.currentplayer; struct hand *hand = player->hands + handnum; - Mtxf *mtx = camGetMatrix1740(); + Mtxf *mtx = camGetWorldToScreenMtxf(); f32 tmp; tmp = hand->hitpos.f[0] * mtx->m[0][2] + hand->hitpos.f[1] * mtx->m[1][2] + hand->hitpos.f[2] * mtx->m[2][2] + mtx->m[3][2]; @@ -213,7 +213,7 @@ glabel var7f1acc68 /* f0ac4dc: 24040002 */ addiu $a0,$zero,0x2 /* f0ac4e0: 0fc59e73 */ jal gfxAllocateColours /* f0ac4e4: 26101bb0 */ addiu $s0,$s0,7088 -/* f0ac4e8: 0fc2d5be */ jal camGetMatrix1740 +/* f0ac4e8: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0ac4ec: afa200c4 */ sw $v0,0xc4($sp) /* f0ac4f0: 3c0c8007 */ lui $t4,%hi(var80070500) /* f0ac4f4: afa20080 */ sw $v0,0x80($sp) @@ -272,7 +272,7 @@ glabel var7f1acc68 /* f0ac5c4: e7a800e4 */ swc1 $f8,0xe4($sp) /* f0ac5c8: 46023283 */ div.s $f10,$f6,$f2 /* f0ac5cc: e7a400e8 */ swc1 $f4,0xe8($sp) -/* f0ac5d0: 0fc2d5be */ jal camGetMatrix1740 +/* f0ac5d0: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0ac5d4: e7aa00ec */ swc1 $f10,0xec($sp) /* f0ac5d8: 00402025 */ or $a0,$v0,$zero /* f0ac5dc: 8fa500fc */ lw $a1,0xfc($sp) @@ -324,7 +324,7 @@ glabel var7f1acc68 /* f0ac680: 1000013e */ b .L0f0acb7c /* f0ac684: 8fa200f0 */ lw $v0,0xf0($sp) .L0f0ac688: -/* f0ac688: 0fc2d5be */ jal camGetMatrix1740 +/* f0ac688: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0ac68c: 00000000 */ nop /* f0ac690: 00402025 */ or $a0,$v0,$zero /* f0ac694: 8fa50108 */ lw $a1,0x108($sp) @@ -785,7 +785,7 @@ glabel var7f1accf4 /* f0acc54: 01cf6821 */ addu $t5,$t6,$t7 /* f0acc58: afad00ec */ sw $t5,0xec($sp) /* f0acc5c: e7a20124 */ swc1 $f2,0x124($sp) -/* f0acc60: 0fc2d5be */ jal camGetMatrix1740 +/* f0acc60: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0acc64: e7aa00f0 */ swc1 $f10,0xf0($sp) /* f0acc68: afa200e4 */ sw $v0,0xe4($sp) /* f0acc6c: 82230001 */ lb $v1,0x1($s1) @@ -1256,7 +1256,7 @@ glabel var7f1accf4 /* f0ad348: e7ae00d0 */ swc1 $f14,0xd0($sp) /* f0ad34c: e7aa00d4 */ swc1 $f10,0xd4($sp) .L0f0ad350: -/* f0ad350: 0fc2d5de */ jal camGetUnk174c +/* f0ad350: 0fc2d5de */ jal camGetProjectionMtxF /* f0ad354: 00000000 */ nop /* f0ad358: 00402025 */ or $a0,$v0,$zero /* f0ad35c: 0c0056d9 */ jal mtx4TransformVecInPlace @@ -3563,7 +3563,7 @@ void casingRender(struct casing *casing, Gfx **gdlptr) mtx00015f04(0.1000000089407f, &mtx); mtx4SetTranslation(&casing->pos, &mtx); - mtx00015be4(camGetMatrix1740(), &mtx, model.matrices); + mtx00015be4(camGetWorldToScreenMtxf(), &mtx, model.matrices); // Check if any coordinate is out of range for (i = 0; i < 3; i++) { @@ -3902,7 +3902,7 @@ glabel var7f1acd8c /* f0af32c: af090004 */ sw $t1,0x4($t8) /* f0af330: 0c00566c */ jal mtx4LoadIdentity /* f0af334: af080000 */ sw $t0,0x0($t8) -/* f0af338: 0fc2d5be */ jal camGetMatrix1740 +/* f0af338: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0af33c: 00000000 */ nop /* f0af340: 00402025 */ or $a0,$v0,$zero /* f0af344: 0c0056f8 */ jal mtx00015be0 @@ -3910,7 +3910,7 @@ glabel var7f1acd8c /* f0af34c: 27b10124 */ addiu $s1,$sp,0x124 /* f0af350: 0c00566c */ jal mtx4LoadIdentity /* f0af354: 02202025 */ or $a0,$s1,$zero -/* f0af358: 0fc2d5de */ jal camGetUnk174c +/* f0af358: 0fc2d5de */ jal camGetProjectionMtxF /* f0af35c: 00000000 */ nop /* f0af360: 00402025 */ or $a0,$v0,$zero /* f0af364: 0c0056f8 */ jal mtx00015be0 @@ -3922,7 +3922,7 @@ glabel var7f1acd8c /* f0af37c: e7a00154 */ swc1 $f0,0x154($sp) /* f0af380: 0c00566c */ jal mtx4LoadIdentity /* f0af384: e7a0015c */ swc1 $f0,0x15c($sp) -/* f0af388: 0fc2d5be */ jal camGetMatrix1740 +/* f0af388: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0af38c: 00000000 */ nop /* f0af390: 00402025 */ or $a0,$v0,$zero /* f0af394: 0c0056f8 */ jal mtx00015be0 @@ -4412,16 +4412,16 @@ glabel var7f1acd8c // gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA); // // mtx4LoadIdentity(&sp164); -// mtx00015be0(camGetMatrix1740(), &sp164); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp164); // mtx4LoadIdentity(&sp124); -// mtx00015be0(camGetUnk174c(), &sp124); +// mtx00015be0(camGetProjectionMtxF(), &sp124); // // sp124.m[3][1] = 0; // sp124.m[3][0] = 0; // sp124.m[3][2] = 0; // // mtx4LoadIdentity(&sp1b0); -// mtx00015be0(camGetMatrix1740(), &sp1b0); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp1b0); // // campos.x = player->cam_pos.x; // campos.y = player->cam_pos.y; @@ -4704,14 +4704,14 @@ glabel var7f1acd90 /* f0afc18: 24a50024 */ addiu $a1,$a1,0x0024 /* f0afc1c: 0c00566c */ jal mtx4LoadIdentity /* f0afc20: 27a4014c */ addiu $a0,$sp,0x14c -/* f0afc24: 0fc2d5be */ jal camGetMatrix1740 +/* f0afc24: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0afc28: 00000000 */ nop /* f0afc2c: 00402025 */ or $a0,$v0,$zero /* f0afc30: 0c0056f8 */ jal mtx00015be0 /* f0afc34: 27a5014c */ addiu $a1,$sp,0x14c /* f0afc38: 0c00566c */ jal mtx4LoadIdentity /* f0afc3c: 27a4010c */ addiu $a0,$sp,0x10c -/* f0afc40: 0fc2d5de */ jal camGetUnk174c +/* f0afc40: 0fc2d5de */ jal camGetProjectionMtxF /* f0afc44: 00000000 */ nop /* f0afc48: 00402025 */ or $a0,$v0,$zero /* f0afc4c: 0c0056f8 */ jal mtx00015be0 @@ -4723,7 +4723,7 @@ glabel var7f1acd90 /* f0afc64: e7b4013c */ swc1 $f20,0x13c($sp) /* f0afc68: 0c00566c */ jal mtx4LoadIdentity /* f0afc6c: e7b40144 */ swc1 $f20,0x144($sp) -/* f0afc70: 0fc2d5be */ jal camGetMatrix1740 +/* f0afc70: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0afc74: 00000000 */ nop /* f0afc78: 00402025 */ or $a0,$v0,$zero /* f0afc7c: 0c0056f8 */ jal mtx00015be0 @@ -5138,16 +5138,16 @@ glabel var7f1acd90 // texSelect(&gdl, &g_TexGeneralConfigs[3], 4, 0, 2, 1, NULL); // mtx4LoadIdentity(&sp14c); // -// mtx00015be0(camGetMatrix1740(), &sp14c); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp14c); // mtx4LoadIdentity(&sp10c); -// mtx00015be0(camGetUnk174c(), &sp10c); +// mtx00015be0(camGetProjectionMtxF(), &sp10c); // // sp10c.m[3][1] = 0; // sp10c.m[3][0] = 0; // sp10c.m[3][2] = 0; // // mtx4LoadIdentity(&sp198); -// mtx00015be0(camGetMatrix1740(), &sp198); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp198); // // campos.x = player->cam_pos.x; // campos.y = player->cam_pos.y; diff --git a/src/game/menu.c b/src/game/menu.c index 9d88d15c5..2561d31d1 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -4994,7 +4994,7 @@ glabel var7f1b3658jf /* f0f53f8: 37180040 */ ori $t8,$t8,0x40 /* f0f53fc: afa90440 */ sw $t1,0x440($sp) /* f0f5400: ac580000 */ sw $t8,0x0($v0) -/* f0f5404: 0fc2d81a */ jal camGetUnk1750 +/* f0f5404: 0fc2d81a */ jal camGetPerspectiveMtxL /* f0f5408: 00408825 */ move $s1,$v0 /* f0f540c: 0c012b34 */ jal osVirtualToPhysical /* f0f5410: 00402025 */ move $a0,$v0 @@ -5418,7 +5418,7 @@ glabel var7f1b3658jf /* f0f5a2c: 25ec0008 */ addiu $t4,$t7,0x8 /* f0f5a30: afac0440 */ sw $t4,0x440($sp) /* f0f5a34: adf90000 */ sw $t9,0x0($t7) -/* f0f5a38: 0fc2da0a */ jal camGetUnk175c +/* f0f5a38: 0fc2da0a */ jal camGetLookAt /* f0f5a3c: afaf00b8 */ sw $t7,0xb8($sp) /* f0f5a40: 8fa500b8 */ lw $a1,0xb8($sp) /* f0f5a44: 3c180382 */ lui $t8,0x382 @@ -5428,7 +5428,7 @@ glabel var7f1b3658jf /* f0f5a54: 25cd0008 */ addiu $t5,$t6,0x8 /* f0f5a58: afad0440 */ sw $t5,0x440($sp) /* f0f5a5c: add80000 */ sw $t8,0x0($t6) -/* f0f5a60: 0fc2da0a */ jal camGetUnk175c +/* f0f5a60: 0fc2da0a */ jal camGetLookAt /* f0f5a64: afae00b4 */ sw $t6,0xb4($sp) /* f0f5a68: 8fa600b4 */ lw $a2,0xb4($sp) /* f0f5a6c: 24490010 */ addiu $t1,$v0,0x10 @@ -6600,7 +6600,7 @@ glabel var7f1b3c40pf /* f0f4e98: 35290040 */ ori $t1,$t1,0x40 /* f0f4e9c: afad0440 */ sw $t5,0x440($sp) /* f0f4ea0: ac490000 */ sw $t1,0x0($v0) -/* f0f4ea4: 0fc2d542 */ jal camGetUnk1750 +/* f0f4ea4: 0fc2d542 */ jal camGetPerspectiveMtxL /* f0f4ea8: 00408825 */ move $s1,$v0 /* f0f4eac: 0c012ab0 */ jal osVirtualToPhysical /* f0f4eb0: 00402025 */ move $a0,$v0 @@ -7024,7 +7024,7 @@ glabel var7f1b3c40pf /* f0f54cc: 258b0008 */ addiu $t3,$t4,0x8 /* f0f54d0: afab0440 */ sw $t3,0x440($sp) /* f0f54d4: ad8f0000 */ sw $t7,0x0($t4) -/* f0f54d8: 0fc2d732 */ jal camGetUnk175c +/* f0f54d8: 0fc2d732 */ jal camGetLookAt /* f0f54dc: afac00b8 */ sw $t4,0xb8($sp) /* f0f54e0: 8fa500b8 */ lw $a1,0xb8($sp) /* f0f54e4: 3c090382 */ lui $t1,0x382 @@ -7034,7 +7034,7 @@ glabel var7f1b3c40pf /* f0f54f4: 272e0008 */ addiu $t6,$t9,0x8 /* f0f54f8: afae0440 */ sw $t6,0x440($sp) /* f0f54fc: af290000 */ sw $t1,0x0($t9) -/* f0f5500: 0fc2d732 */ jal camGetUnk175c +/* f0f5500: 0fc2d732 */ jal camGetLookAt /* f0f5504: afb900b4 */ sw $t9,0xb4($sp) /* f0f5508: 8fa600b4 */ lw $a2,0xb4($sp) /* f0f550c: 244d0010 */ addiu $t5,$v0,0x10 @@ -8206,7 +8206,7 @@ glabel var7f1b3c40pf /* f0f4cb0: 35290040 */ ori $t1,$t1,0x40 /* f0f4cb4: afad0440 */ sw $t5,0x440($sp) /* f0f4cb8: ac490000 */ sw $t1,0x0($v0) -/* f0f4cbc: 0fc2d4fe */ jal camGetUnk1750 +/* f0f4cbc: 0fc2d4fe */ jal camGetPerspectiveMtxL /* f0f4cc0: 00408825 */ move $s1,$v0 /* f0f4cc4: 0c012de0 */ jal osVirtualToPhysical /* f0f4cc8: 00402025 */ move $a0,$v0 @@ -8630,7 +8630,7 @@ glabel var7f1b3c40pf /* f0f52e4: 258b0008 */ addiu $t3,$t4,0x8 /* f0f52e8: afab0440 */ sw $t3,0x440($sp) /* f0f52ec: ad8f0000 */ sw $t7,0x0($t4) -/* f0f52f0: 0fc2d6ee */ jal camGetUnk175c +/* f0f52f0: 0fc2d6ee */ jal camGetLookAt /* f0f52f4: afac00b8 */ sw $t4,0xb8($sp) /* f0f52f8: 8fa500b8 */ lw $a1,0xb8($sp) /* f0f52fc: 3c090382 */ lui $t1,0x382 @@ -8640,7 +8640,7 @@ glabel var7f1b3c40pf /* f0f530c: 272e0008 */ addiu $t6,$t9,0x8 /* f0f5310: afae0440 */ sw $t6,0x440($sp) /* f0f5314: af290000 */ sw $t1,0x0($t9) -/* f0f5318: 0fc2d6ee */ jal camGetUnk175c +/* f0f5318: 0fc2d6ee */ jal camGetLookAt /* f0f531c: afb900b4 */ sw $t9,0xb4($sp) /* f0f5320: 8fa600b4 */ lw $a2,0xb4($sp) /* f0f5324: 244d0010 */ addiu $t5,$v0,0x10 @@ -9819,7 +9819,7 @@ glabel var7f1b2948 /* f0f4768: 35ef0040 */ ori $t7,$t7,0x40 /* f0f476c: afac0440 */ sw $t4,0x440($sp) /* f0f4770: ac4f0000 */ sw $t7,0x0($v0) -/* f0f4774: 0fc2d3fa */ jal camGetUnk1750 +/* f0f4774: 0fc2d3fa */ jal camGetPerspectiveMtxL /* f0f4778: 00408825 */ or $s1,$v0,$zero /* f0f477c: 0c012d20 */ jal osVirtualToPhysical /* f0f4780: 00402025 */ or $a0,$v0,$zero @@ -10240,7 +10240,7 @@ glabel var7f1b2948 /* f0f4d8c: 25ae0008 */ addiu $t6,$t5,0x8 /* f0f4d90: afae0440 */ sw $t6,0x440($sp) /* f0f4d94: adac0000 */ sw $t4,0x0($t5) -/* f0f4d98: 0fc2d5ea */ jal camGetUnk175c +/* f0f4d98: 0fc2d5ea */ jal camGetLookAt /* f0f4d9c: afad00b8 */ sw $t5,0xb8($sp) /* f0f4da0: 8fa500b8 */ lw $a1,0xb8($sp) /* f0f4da4: 3c0a0382 */ lui $t2,0x382 @@ -10250,7 +10250,7 @@ glabel var7f1b2948 /* f0f4db4: 25f80008 */ addiu $t8,$t7,0x8 /* f0f4db8: afb80440 */ sw $t8,0x440($sp) /* f0f4dbc: adea0000 */ sw $t2,0x0($t7) -/* f0f4dc0: 0fc2d5ea */ jal camGetUnk175c +/* f0f4dc0: 0fc2d5ea */ jal camGetLookAt /* f0f4dc4: afaf00b4 */ sw $t7,0xb4($sp) /* f0f4dc8: 8fa600b4 */ lw $a2,0xb4($sp) /* f0f4dcc: 24590010 */ addiu $t9,$v0,0x10 @@ -11453,7 +11453,7 @@ glabel var7f1b2948 /* f0f130c: 35ad0040 */ ori $t5,$t5,0x40 /* f0f1310: afab0468 */ sw $t3,0x468($sp) /* f0f1314: ac4d0000 */ sw $t5,0x0($v0) -/* f0f1318: 0fc2cb52 */ jal camGetUnk1750 +/* f0f1318: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f0f131c: 00408025 */ or $s0,$v0,$zero /* f0f1320: 0c013100 */ jal osVirtualToPhysical /* f0f1324: 00402025 */ or $a0,$v0,$zero @@ -11874,7 +11874,7 @@ glabel var7f1b2948 /* f0f1930: 25590008 */ addiu $t9,$t2,0x8 /* f0f1934: afb90468 */ sw $t9,0x468($sp) /* f0f1938: ad4b0000 */ sw $t3,0x0($t2) -/* f0f193c: 0fc2cd42 */ jal camGetUnk175c +/* f0f193c: 0fc2cd42 */ jal camGetLookAt /* f0f1940: afaa00bc */ sw $t2,0xbc($sp) /* f0f1944: 8fa500bc */ lw $a1,0xbc($sp) /* f0f1948: 3c0f0382 */ lui $t7,0x382 @@ -11884,7 +11884,7 @@ glabel var7f1b2948 /* f0f1958: 25ae0008 */ addiu $t6,$t5,0x8 /* f0f195c: afae0468 */ sw $t6,0x468($sp) /* f0f1960: adaf0000 */ sw $t7,0x0($t5) -/* f0f1964: 0fc2cd42 */ jal camGetUnk175c +/* f0f1964: 0fc2cd42 */ jal camGetLookAt /* f0f1968: afad00b8 */ sw $t5,0xb8($sp) /* f0f196c: 8fa600b8 */ lw $a2,0xb8($sp) /* f0f1970: 244c0010 */ addiu $t4,$v0,0x10 @@ -12473,7 +12473,7 @@ glabel var7f1b2948 // if (arg2 < 3) { // if (arg2 != 0) { // gdl = func0f0d49c8(gdl); -// gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); +// gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); // } else { // static u32 znear = 10; // static u32 zfar = 300; @@ -12586,8 +12586,8 @@ glabel var7f1b2948 // gSPNumLights(gdl++, 1); // gSPLight(gdl++, &var80071470, 1); // gSPLight(gdl++, &var80071468, 2); -// gSPLookAtX(gdl++, camGetUnk175c()->m[0]); -// gSPLookAtY(gdl++, camGetUnk175c()->m[1]); +// gSPLookAtX(gdl++, camGetLookAt()->m[0]); +// gSPLookAtY(gdl++, camGetLookAt()->m[1]); // // renderdata.unk30 = 1; // renderdata.envcolour = 0xffffffff; @@ -28268,7 +28268,7 @@ glabel var7f1b381cjf /* f0fce98: 356b0040 */ ori $t3,$t3,0x40 /* f0fce9c: 02a08025 */ move $s0,$s5 /* f0fcea0: ae0b0000 */ sw $t3,0x0($s0) -/* f0fcea4: 0fc2d81a */ jal camGetUnk1750 +/* f0fcea4: 0fc2d81a */ jal camGetPerspectiveMtxL /* f0fcea8: 26b50008 */ addiu $s5,$s5,0x8 /* f0fceac: 0c012b34 */ jal osVirtualToPhysical /* f0fceb0: 00402025 */ move $a0,$v0 @@ -29004,7 +29004,7 @@ Gfx *menuRender(Gfx *gdl) g_MpPlayerNum = 0; - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPDisplayList(gdl++, var800613a0); text0f153b40(); @@ -29602,7 +29602,7 @@ void func0f0fd494(struct coord *pos) g_MenuData.unk5d5_04 = true; - matrix = camGetMatrix1740(); + matrix = camGetWorldToScreenMtxf(); mtx4TransformVec(matrix, pos, &coord); cam0f0b4d04(&coord, xy); diff --git a/src/game/nbomb.c b/src/game/nbomb.c index fa6550bdc..b14d9c877 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -611,7 +611,7 @@ glabel var7f1a7ee8 /* f007440: 8fa40154 */ lw $a0,0x154($sp) /* f007444: 0c0059b7 */ jal mtx4LoadTranslation /* f007448: 02002825 */ or $a1,$s0,$zero -/* f00744c: 0fc2d5be */ jal camGetMatrix1740 +/* f00744c: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f007450: 00000000 */ nop /* f007454: 00402025 */ or $a0,$v0,$zero /* f007458: 0c0056f8 */ jal mtx00015be0 @@ -2826,7 +2826,7 @@ Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl) mtx00015f04(nbomb->radius / 2000.0f, &sp88); mtx4MultMtx4(&sp48, &sp88, &spc8); - mtx00015be0(camGetMatrix1740(), &spc8); + mtx00015be0(camGetWorldToScreenMtxf(), &spc8); mtx00016054(&spc8, mtx); gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/game/player.c b/src/game/player.c index 1e8694b72..114f8e66e 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -975,8 +975,8 @@ void playerSpawn(void) s32 prevplayernum = g_Vars.currentplayernum; setCurrentPlayerNum(g_Vars.bondplayernum); bgun0f0a0c08(&sp84, &sp9c); - mtx4RotateVec(camGetUnk174c(), &sp9c, &sp90); - mtx4TransformVec(camGetUnk174c(), &sp84, &sp78); + mtx4RotateVec(camGetProjectionMtxF(), &sp9c, &sp90); + mtx4TransformVec(camGetProjectionMtxF(), &sp84, &sp78); setCurrentPlayerNum(prevplayernum); } @@ -2919,7 +2919,7 @@ Gfx *playerRenderHealthBar(Gfx *gdl) gdl = healthbarDraw(gdl, NULL, 0, 0); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); return gdl; } @@ -4760,7 +4760,7 @@ void playerSetGlobalDrawCameraOffset(void) g_Vars.currentplayer->globaldrawcameraoffset.y = g_Vars.currentplayer->globaldrawworldoffset.y; g_Vars.currentplayer->globaldrawcameraoffset.z = g_Vars.currentplayer->globaldrawworldoffset.z; - mtx4RotateVecInPlace(camGetMatrix1740(), &g_Vars.currentplayer->globaldrawcameraoffset); + mtx4RotateVecInPlace(camGetWorldToScreenMtxf(), &g_Vars.currentplayer->globaldrawcameraoffset); } GLOBAL_ASM( @@ -4901,7 +4901,7 @@ glabel player0f0bfc7c /* f0bfe90: 00000000 */ nop /* f0bfe94: 0fc59e66 */ jal gfxAllocateMatrix /* f0bfe98: 00408825 */ or $s1,$v0,$zero -/* f0bfe9c: 0fc2d5c6 */ jal camGetUnk1754 +/* f0bfe9c: 0fc2d5c6 */ jal camGetMtxF1754 /* f0bfea0: 00408025 */ or $s0,$v0,$zero /* f0bfea4: 00402025 */ or $a0,$v0,$zero /* f0bfea8: 27a5008c */ addiu $a1,$sp,0x8c @@ -4939,12 +4939,12 @@ glabel player0f0bfc7c /* f0bff18: 24a50001 */ addiu $a1,$a1,0x1 /* f0bff1c: 14a8ffed */ bne $a1,$t0,.L0f0bfed4 /* f0bff20: 24c60010 */ addiu $a2,$a2,0x10 -/* f0bff24: 0fc2d3ee */ jal camSetUnk006c +/* f0bff24: 0fc2d3ee */ jal camSetMtxF006c /* f0bff28: 02002025 */ or $a0,$s0,$zero /* f0bff2c: 02002025 */ or $a0,$s0,$zero /* f0bff30: 0c0128d8 */ jal guMtxF2L /* f0bff34: 02202825 */ or $a1,$s1,$zero -/* f0bff38: 0fc2d3fe */ jal camSetUnk1758 +/* f0bff38: 0fc2d3fe */ jal camSetOrthogonalMtxL /* f0bff3c: 02202025 */ or $a0,$s1,$zero /* f0bff40: c7ac0070 */ lwc1 $f12,0x70($sp) /* f0bff44: 0c0057c1 */ jal mtx00015f04 @@ -4958,18 +4958,18 @@ glabel player0f0bfc7c /* f0bff64: 0c005a08 */ jal mtx00016820 /* f0bff68: 8c650060 */ lw $a1,0x60($v1) /* f0bff6c: 8e4e0284 */ lw $t6,0x284($s2) -/* f0bff70: 0fc2d3e6 */ jal camSetUnk173c +/* f0bff70: 0fc2d3e6 */ jal camSetMtxL173c /* f0bff74: 8dc4005c */ lw $a0,0x5c($t6) /* f0bff78: 8e4f0284 */ lw $t7,0x284($s2) -/* f0bff7c: 0fc2d3de */ jal camSetUnk1738 +/* f0bff7c: 0fc2d3de */ jal camSetMtxL1738 /* f0bff80: 8de40060 */ lw $a0,0x60($t7) /* f0bff84: 8e580284 */ lw $t8,0x284($s2) -/* f0bff88: 0fc2d406 */ jal camSetMatrix1740 +/* f0bff88: 0fc2d406 */ jal camSetWorldToScreenMtxf /* f0bff8c: 8f040064 */ lw $a0,0x64($t8) /* f0bff90: 8e590284 */ lw $t9,0x284($s2) -/* f0bff94: 0fc2d5d6 */ jal camSetUnk174c +/* f0bff94: 0fc2d5d6 */ jal camSetProjectionMtxF /* f0bff98: 8f240068 */ lw $a0,0x68($t9) -/* f0bff9c: 0fc2d5e6 */ jal camSetUnk175c +/* f0bff9c: 0fc2d5e6 */ jal camSetLookAt /* f0bffa0: 8fa400cc */ lw $a0,0xcc($sp) /* f0bffa4: 0fc2d60e */ jal cam0f0b5838 /* f0bffa8: 00000000 */ nop @@ -5003,10 +5003,10 @@ glabel player0f0bfc7c // scale = currentPlayerGetScaleBg2Gfx(); // playerSetGlobalDrawWorldOffset(g_Vars.currentplayer->cam_room); // -// g_Vars.currentplayer->matrix5c = gfxAllocateMatrix(); -// g_Vars.currentplayer->matrix60 = gfxAllocateMatrix(); -// g_Vars.currentplayer->matrix64 = gfxAllocateMatrix(); -// g_Vars.currentplayer->matrix68 = gfxAllocateMatrix(); +// g_Vars.currentplayer->mtxl005c = gfxAllocateMatrix(); +// g_Vars.currentplayer->mtxl0060 = gfxAllocateMatrix(); +// g_Vars.currentplayer->mtxf0064 = gfxAllocateMatrix(); +// g_Vars.currentplayer->mtxf0068 = gfxAllocateMatrix(); // // spcc = gfxAllocateLookAt(2); // @@ -5028,19 +5028,19 @@ glabel player0f0bfc7c // sp80.x, sp80.y, sp80.z, // cam_up->x, cam_up->y, cam_up->z); // -// mtx00016874(g_Vars.currentplayer->matrix64, +// mtx00016874(g_Vars.currentplayer->mtxf0064, // cam_pos->x, cam_pos->y, cam_pos->z, // cam_look->x, cam_look->y, cam_look->z, // cam_up->x, cam_up->y, cam_up->z); // -// mtx00016b58(g_Vars.currentplayer->matrix68, +// mtx00016b58(g_Vars.currentplayer->mtxf0068, // cam_pos->x, cam_pos->y, cam_pos->z, // cam_look->x, cam_look->y, cam_look->z, // cam_up->x, cam_up->y, cam_up->z); // // s1 = gfxAllocateMatrix(); // s0 = gfxAllocateMatrix(); -// mtx4MultMtx4(camGetUnk1754(), &sp8c, s0); +// mtx4MultMtx4(camGetMtxF1754(), &sp8c, s0); // // for (i = 0; i < 4; i++) { // for (j = 0; j < 4; j++) { @@ -5052,17 +5052,17 @@ glabel player0f0bfc7c // } // } // -// camSetUnk006c(s0); +// camSetMtxF006c(s0); // guMtxF2L(s0, s1); -// camSetUnk1758(s1); +// camSetOrthogonalMtxL(s1); // mtx00015f04(scale, &sp8c); -// guMtxF2L(&sp8c, g_Vars.currentplayer->matrix5c); -// mtx00016820(g_Vars.currentplayer->matrix5c, g_Vars.currentplayer->matrix60); -// camSetUnk173c(g_Vars.currentplayer->matrix5c); -// camSetUnk1738(g_Vars.currentplayer->matrix60); -// camSetMatrix1740(g_Vars.currentplayer->matrix64); -// camSetUnk174c(g_Vars.currentplayer->matrix68); -// camSetUnk175c(spcc); +// guMtxF2L(&sp8c, g_Vars.currentplayer->mtxl005c); +// mtx00016820(g_Vars.currentplayer->mtxl005c, g_Vars.currentplayer->mtxl0060); +// camSetMtxL173c(g_Vars.currentplayer->mtxl005c); +// camSetMtxL1738(g_Vars.currentplayer->mtxl0060); +// camSetWorldToScreenMtxf(g_Vars.currentplayer->mtxf0064); +// camSetProjectionMtxF(g_Vars.currentplayer->mtxf0068); +// camSetLookAt(spcc); // cam0f0b5838(); // playerSetGlobalDrawCameraOffset(); //} @@ -6084,7 +6084,7 @@ s32 playerTickThirdPerson(struct prop *prop) spe8 = player->model00d4->matrices; } - mtx00015be4(camGetUnk174c(), spe8, &spa8); + mtx00015be4(camGetProjectionMtxF(), spe8, &spa8); sp9c.x = spa8.m[3][0] + spa8.m[1][0] * 7; sp9c.y = spa8.m[3][1] + spa8.m[1][1] * 7; @@ -6481,7 +6481,7 @@ Gfx *playerRender(struct prop *prop, Gfx *gdl, bool xlupass) Gfx *playerLoadMatrix(Gfx *gdl) { - gSPMatrix(gdl++, g_Vars.currentplayer->matrix5c, G_MTX_LOAD); + gSPMatrix(gdl++, g_Vars.currentplayer->mtxl005c, G_MTX_LOAD); return gdl; } @@ -6492,7 +6492,7 @@ void player0f0c3320(Mtxf *matrices, s32 count) s32 j; for (i = 0, j = 0; i < count; i++, j += sizeof(Mtxf)) { - mtx00015be4(camGetUnk174c(), (Mtxf *)((u32)matrices + j), &sp40); + mtx00015be4(camGetProjectionMtxF(), (Mtxf *)((u32)matrices + j), &sp40); sp40.m[3][0] -= g_Vars.currentplayer->globaldrawworldoffset.x; sp40.m[3][1] -= g_Vars.currentplayer->globaldrawworldoffset.y; diff --git a/src/game/playermgr.c b/src/game/playermgr.c index d93f15c95..bd320e44e 100644 --- a/src/game/playermgr.c +++ b/src/game/playermgr.c @@ -490,19 +490,19 @@ void playermgrAllocatePlayer(s32 index) g_Vars.players[index]->c_recipscalex = 1; g_Vars.players[index]->c_recipscaley = 1; - g_Vars.players[index]->unk1738 = NULL; - g_Vars.players[index]->unk173c = NULL; - g_Vars.players[index]->matrix1740 = NULL; + g_Vars.players[index]->mtxl1738 = NULL; + g_Vars.players[index]->mtxl173c = NULL; + g_Vars.players[index]->worldtoscreenmtx = NULL; g_Vars.players[index]->c_viewfmdynticknum = -1; - g_Vars.players[index]->unk1748 = 0; - g_Vars.players[index]->unk174c = NULL; - g_Vars.players[index]->unk1750 = NULL; - g_Vars.players[index]->unk1754 = NULL; - g_Vars.players[index]->unk1758 = NULL; - g_Vars.players[index]->unk175c = NULL; - g_Vars.players[index]->prev1740 = NULL; + g_Vars.players[index]->mtxf1748 = NULL; + g_Vars.players[index]->projectionmtx = NULL; + g_Vars.players[index]->perspmtxl = NULL; + g_Vars.players[index]->mtxf1754 = NULL; + g_Vars.players[index]->orthomtxl = NULL; + g_Vars.players[index]->lookat = NULL; + g_Vars.players[index]->prevworldtoscreenmtx = NULL; g_Vars.players[index]->c_prevviewfmdynticknum = -1; - g_Vars.players[index]->unk1768 = NULL; + g_Vars.players[index]->prevprojectionmtx = NULL; g_Vars.players[index]->unk0484 = NULL; g_Vars.players[index]->unk0488 = NULL; diff --git a/src/game/prop.c b/src/game/prop.c index 8753b4cb8..86efcb27e 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -716,7 +716,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc } if (hitbg && shotdata.gset.weaponnum != WEAPON_FARSIGHT) { - mtx4TransformVec(camGetMatrix1740(), &sp694.unk00, &sp658); + mtx4TransformVec(camGetWorldToScreenMtxf(), &sp694.unk00, &sp658); if (shotdata.unk34 > -sp658.z) { shotdata.unk34 = -sp658.z; @@ -987,8 +987,8 @@ struct prop *func0f061d54(s32 handnum, u32 arg1, u32 arg2) sp58.y -= 15 * RANDOMFRAC(); } - mtx4TransformVec(camGetUnk174c(), &sp58, &sp40); - mtx4RotateVec(camGetUnk174c(), &sp64, &sp4c); + mtx4TransformVec(camGetProjectionMtxF(), &sp58, &sp40); + mtx4RotateVec(camGetProjectionMtxF(), &sp64, &sp4c); shotCalculateHits(handnum, arg1, &sp58, &sp64, &sp40, &sp4c, 0, 4294836224, PLAYERCOUNT() >= 2); } @@ -1003,8 +1003,8 @@ void handCreateBulletRaycast(s32 handnum, bool arg1, bool dorandom, s32 arg3, bo bgunCalculatePlayerShotSpread(&sp38, &sp44, handnum, dorandom); if (arg3 > 0) { - mtx4TransformVec(camGetUnk174c(), &sp38, &shootpos); - mtx4RotateVec(camGetUnk174c(), &sp44, &shootdir); + mtx4TransformVec(camGetProjectionMtxF(), &sp38, &shootpos); + mtx4RotateVec(camGetProjectionMtxF(), &sp44, &shootdir); shotCalculateHits(handnum, arg1, &sp38, &sp44, &shootpos, &shootdir, 0, 4294836224, arg4); @@ -1225,7 +1225,7 @@ void handInflictCloseRangeDamage(s32 handnum, struct gset *gset, bool arg2) if (!chrIsAvoiding(chr)) { bgunCalculatePlayerShotSpread(&spb8, &vector, handnum, true); skipthething = true; - mtx4RotateVecInPlace(camGetUnk174c(), &vector); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &vector); bgunPlayPropHitSound(gset, prop, -1); if (chr->model && chrGetShield(chr) > 0) { diff --git a/src/game/propobj.c b/src/game/propobj.c index f1d674c40..076b08efb 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -5484,8 +5484,8 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2 *arg9 = sum2; - mtx4TransformVec(camGetUnk174c(), &spfc, arg7); - mtx4RotateVec(camGetUnk174c(), &spf0, arg8); + mtx4TransformVec(camGetProjectionMtxF(), &spfc, arg7); + mtx4RotateVec(camGetProjectionMtxF(), &spf0, arg8); if (arg8->x != 0.0f || arg8->y != 0.0f || arg8->z != 0.0f) { guNormalize(&arg8->x, &arg8->y, &arg8->z); @@ -5555,7 +5555,7 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2 *arg9 = sum1; - mtx4TransformVec(camGetUnk174c(), &spfc, arg7); + mtx4TransformVec(camGetProjectionMtxF(), &spfc, arg7); if (spf0.f[0] * arg6->f[0] + spf0.f[1] * arg6->f[1] + spf0.f[2] * arg6->f[2] > 0.0f) { spf0.f[0] = -spf0.f[0]; @@ -5563,7 +5563,7 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2 spf0.f[2] = -spf0.f[2]; } - mtx4RotateVec(camGetUnk174c(), &spf0, arg8); + mtx4RotateVec(camGetProjectionMtxF(), &spf0, arg8); if (arg8->f[0] != 0.0f || arg8->f[1] != 0.0f || arg8->f[2] != 0.0f) { guNormalize(&arg8->x, &arg8->y, &arg8->z); @@ -5816,8 +5816,8 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s *arg9 = spec; - mtx4TransformVec(camGetUnk174c(), &spb8, arg7); - mtx4RotateVec(camGetUnk174c(), &spac, arg8); + mtx4TransformVec(camGetProjectionMtxF(), &spb8, arg7); + mtx4RotateVec(camGetProjectionMtxF(), &spac, arg8); if (arg8->x != 0.0f || arg8->y != 0.0f || arg8->z != 0.0f) { guNormalize(&arg8->x, &arg8->y, &arg8->z); @@ -5848,8 +5848,8 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s && func0f06bea0(model, model->filedata->rootnode, model->filedata->rootnode, arg5, arg6, &sp7c.unk00, &spec, &spcc, &hitpart, &sp78, &sp74) && spec < *arg9) { *arg9 = spec; - mtx4TransformVec(camGetUnk174c(), &sp7c.unk00, arg7); - mtx4RotateVec(camGetUnk174c(), &sp7c.unk0c, arg8); + mtx4TransformVec(camGetProjectionMtxF(), &sp7c.unk00, arg7); + mtx4RotateVec(camGetProjectionMtxF(), &sp7c.unk0c, arg8); if (arg8->x != 0.0f || arg8->y != 0.0f || arg8->z != 0.0f) { guNormalize(&arg8->x, &arg8->y, &arg8->z); @@ -5926,13 +5926,13 @@ bool projectileFindCollidingProp(struct prop *prop, struct coord *pos1, struct c sp88.y = pos1->y; sp88.z = pos1->z; - mtx4TransformVecInPlace(camGetMatrix1740(), &sp88); + mtx4TransformVecInPlace(camGetWorldToScreenMtxf(), &sp88); sp7c.x = sp98.x; sp7c.y = sp98.y; sp7c.z = sp98.z; - mtx4RotateVecInPlace(camGetMatrix1740(), &sp7c); + mtx4RotateVecInPlace(camGetWorldToScreenMtxf(), &sp7c); spa8 = dist; @@ -7526,7 +7526,7 @@ bool objEmbed(struct prop *prop, struct prop *parent, struct model *model, struc mtx3ToMtx4(obj->realrot, &sp34); mtx4SetTranslation(&prop->pos, &sp34); mtx00015be4(&sp34, &sp74, &sp134); - mtx00015be4(camGetUnk174c(), sp24, &spf4); + mtx00015be4(camGetProjectionMtxF(), sp24, &spf4); mtx000172f0(spf4.m, spb4.m); mtx00015be4(&spb4, &sp134, &obj->embedment->matrix); @@ -7630,7 +7630,7 @@ bool propExplode(struct prop *prop, s32 exptype) pos.y = mtx->m[3][1]; pos.z = mtx->m[3][2]; - mtx4TransformVecInPlace(camGetUnk174c(), &pos); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &pos); } else { pos.x = parent->pos.x; pos.y = parent->pos.y; @@ -19094,7 +19094,7 @@ glabel var7f1ab110jf /* f076a04: 8ca5d534 */ lw $a1,-0x2acc($a1) /* f076a08: 0c00695b */ jal model0001a5cc /* f076a0c: 00003025 */ move $a2,$zero -/* f076a10: 0fc2d9de */ jal camGetMatrix1740 +/* f076a10: 0fc2d9de */ jal camGetWorldToScreenMtxf /* f076a14: afa20184 */ sw $v0,0x184($sp) /* f076a18: 00402025 */ move $a0,$v0 /* f076a1c: 27a505e8 */ addiu $a1,$sp,0x5e8 @@ -22633,7 +22633,7 @@ glabel var7f1ab6dcpf /* f075b64: 8ca5d3d4 */ lw $a1,-0x2c2c($a1) /* f075b68: 0c0068d7 */ jal model0001a5cc /* f075b6c: 00003025 */ move $a2,$zero -/* f075b70: 0fc2d706 */ jal camGetMatrix1740 +/* f075b70: 0fc2d706 */ jal camGetWorldToScreenMtxf /* f075b74: afa20184 */ sw $v0,0x184($sp) /* f075b78: 00402025 */ move $a0,$v0 /* f075b7c: 27a505e8 */ addiu $a1,$sp,0x5e8 @@ -26178,7 +26178,7 @@ glabel var7f1ab6dcpf /* f075ab4: 8ca51394 */ lw $a1,0x1394($a1) /* f075ab8: 0c006c07 */ jal model0001a5cc /* f075abc: 00003025 */ move $a2,$zero -/* f075ac0: 0fc2d6c2 */ jal camGetMatrix1740 +/* f075ac0: 0fc2d6c2 */ jal camGetWorldToScreenMtxf /* f075ac4: afa20184 */ sw $v0,0x184($sp) /* f075ac8: 00402025 */ move $a0,$v0 /* f075acc: 27a505e8 */ addiu $a1,$sp,0x5e8 @@ -29716,7 +29716,7 @@ glabel var7f1aa438 /* f0758e0: 8ca5ce74 */ lw $a1,%lo(g_EmbedNode)($a1) /* f0758e4: 0c006973 */ jal model0001a5cc /* f0758e8: 00003025 */ or $a2,$zero,$zero -/* f0758ec: 0fc2d5be */ jal camGetMatrix1740 +/* f0758ec: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f0758f0: afa20184 */ sw $v0,0x184($sp) /* f0758f4: 00402025 */ or $a0,$v0,$zero /* f0758f8: 27a505e8 */ addiu $a1,$sp,0x5e8 @@ -33218,7 +33218,7 @@ glabel var7f1aa438 /* f07460c: 8ca515a4 */ lw $a1,0x15a4($a1) /* f074610: 0c006dcf */ jal model0001a5cc /* f074614: 00003025 */ or $a2,$zero,$zero -/* f074618: 0fc2cd16 */ jal camGetMatrix1740 +/* f074618: 0fc2cd16 */ jal camGetWorldToScreenMtxf /* f07461c: afa20188 */ sw $v0,0x188($sp) /* f074620: 00402025 */ or $a0,$v0,$zero /* f074624: 27a505e8 */ addiu $a1,$sp,0x5e8 @@ -34906,7 +34906,7 @@ glabel var7f1aa44c /* f077484: 8ed5000c */ lw $s5,0xc($s6) /* f077488: 0fc23109 */ jal func0f08c424 /* f07748c: 02a02825 */ or $a1,$s5,$zero -/* f077490: 0fc2d5be */ jal camGetMatrix1740 +/* f077490: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f077494: 00000000 */ nop /* f077498: 00402025 */ or $a0,$v0,$zero /* f07749c: 0c0056f8 */ jal mtx00015be0 @@ -35041,7 +35041,7 @@ glabel var7f1aa44c // union modelrodata *rodata; // // func0f08c424(door, matrices); -// mtx00015be0(camGetMatrix1740(), matrices); +// mtx00015be0(camGetWorldToScreenMtxf(), matrices); // // if (model->filedata->type == &g_Skel11) { // f32 xrot = M_BADTAU - door->frac * 0.017450513318181f; @@ -35675,7 +35675,7 @@ void cctvInitMatrices(struct prop *prop, Mtxf *mtx) mtx4TransformVecInPlace(mtx, &sp64); mtx4SetTranslation(&sp64, &matrices[1]); - mtx00015be0(camGetMatrix1740(), &matrices[1]); + mtx00015be0(camGetWorldToScreenMtxf(), &matrices[1]); } void fanTick(struct prop *prop) @@ -38648,7 +38648,7 @@ void autogunInitMatrices(struct prop *prop, Mtxf *mtx) mtx4LoadYRotation(yrot, &matrices[1]); mtx4SetTranslation(&sp4c, &matrices[1]); mtx00015f04(autogun->base.model->scale, &matrices[1]); - mtx00015be0(camGetMatrix1740(), &matrices[1]); + mtx00015be0(camGetWorldToScreenMtxf(), &matrices[1]); node2 = modelGetPart(model->filedata, MODELPART_AUTOGUN_0002); rodata = node2->rodata; @@ -38867,7 +38867,7 @@ glabel var7f1aa5a8 /* f07a14c: e7b0016c */ swc1 $f16,0x16c($sp) /* f07a150: e7b20170 */ swc1 $f18,0x170($sp) .L0f07a154: -/* f07a154: 0fc2d5de */ jal camGetUnk174c +/* f07a154: 0fc2d5de */ jal camGetProjectionMtxF /* f07a158: afa50108 */ sw $a1,0x108($sp) /* f07a15c: 8fa50108 */ lw $a1,0x108($sp) /* f07a160: 00402025 */ or $a0,$v0,$zero @@ -39829,7 +39829,7 @@ glabel var7f1aa5a8 /* f07a2ec: e7b0016c */ swc1 $f16,0x16c($sp) /* f07a2f0: e7b20170 */ swc1 $f18,0x170($sp) .PB0f07a2f4: -/* f07a2f4: 0fc2d6e2 */ jal camGetUnk174c +/* f07a2f4: 0fc2d6e2 */ jal camGetProjectionMtxF /* f07a2f8: afa50108 */ sw $a1,0x108($sp) /* f07a2fc: 8fa50108 */ lw $a1,0x108($sp) /* f07a300: 00402025 */ move $a0,$v0 @@ -40791,7 +40791,7 @@ glabel var7f1aa5a8 /* f07a14c: e7b0016c */ swc1 $f16,0x16c($sp) /* f07a150: e7b20170 */ swc1 $f18,0x170($sp) .L0f07a154: -/* f07a154: 0fc2d5de */ jal camGetUnk174c +/* f07a154: 0fc2d5de */ jal camGetProjectionMtxF /* f07a158: afa50108 */ sw $a1,0x108($sp) /* f07a15c: 8fa50108 */ lw $a1,0x108($sp) /* f07a160: 00402025 */ or $a0,$v0,$zero @@ -41753,7 +41753,7 @@ glabel var7f1aa5a8 /* f07a14c: e7b0016c */ swc1 $f16,0x16c($sp) /* f07a150: e7b20170 */ swc1 $f18,0x170($sp) .L0f07a154: -/* f07a154: 0fc2d5de */ jal camGetUnk174c +/* f07a154: 0fc2d5de */ jal camGetProjectionMtxF /* f07a158: afa50108 */ sw $a1,0x108($sp) /* f07a15c: 8fa50108 */ lw $a1,0x108($sp) /* f07a160: 00402025 */ or $a0,$v0,$zero @@ -49771,7 +49771,7 @@ void objInitMatrices(struct prop *prop) } else { mtx3ToMtx4(obj->realrot, &mtx); mtx4SetTranslation(&prop->pos, &mtx); - mtx00015be4(camGetMatrix1740(), &mtx, obj->model->matrices); + mtx00015be4(camGetWorldToScreenMtxf(), &mtx, obj->model->matrices); if (obj->type == OBJTYPE_CCTV) { cctvInitMatrices(prop, &mtx); @@ -50015,11 +50015,11 @@ s32 objTickPlayer(struct prop *prop) sp556 = true; sp476.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf)); - sp476.unk00 = camGetMatrix1740(); + sp476.unk00 = camGetWorldToScreenMtxf(); model0001cebc(&sp476, model); if (fulltick) { - mtx00015be4(camGetUnk174c(), model->matrices, &sp412); + mtx00015be4(camGetProjectionMtxF(), model->matrices, &sp412); mtx4ToMtx3(&sp412, obj->realrot); sp400.x = sp412.m[3][0]; @@ -50109,7 +50109,7 @@ s32 objTickPlayer(struct prop *prop) mtx3ToMtx4(obj->realrot, &sp248); mtx4SetTranslation(&prop->pos, &sp248); - mtx4MultMtx4(camGetMatrix1740(), &sp248, &sp152); + mtx4MultMtx4(camGetWorldToScreenMtxf(), &sp248, &sp152); sp556 = true; sp312.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf)); @@ -50130,7 +50130,7 @@ s32 objTickPlayer(struct prop *prop) if (modelGetCurAnimFrame(model) >= modelGetNumAnimFrames(model) - 1) { animTurnOff(model->anim); model->anim = NULL; - mtx00015be4(camGetUnk174c(), model->matrices, &sp248); + mtx00015be4(camGetProjectionMtxF(), model->matrices, &sp248); mtx4ToMtx3(&sp248, obj->realrot); tagnum = objGetTagNum(obj); @@ -52280,7 +52280,7 @@ void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool x s32 sp60; sp6c = 0; - sp6c += (obj->flags & OBJFLAG_00000200) && camGetUnk1758(); + sp6c += (obj->flags & OBJFLAG_00000200) && camGetOrthogonalMtxL(); gdl = renderdata->gdl; @@ -52366,7 +52366,7 @@ void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool x } if (sp6c) { - gSPMatrix(gdl++, camGetUnk1758(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, camGetOrthogonalMtxL(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); } renderdata->gdl = gdl; @@ -52382,7 +52382,7 @@ void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool x } if (sp6c) { - gSPMatrix(gdl++, camGetUnk1750(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, camGetPerspectiveMtxL(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); } renderdata->gdl = gdl; @@ -52440,7 +52440,7 @@ Gfx *gfxRenderRadialShadow(Gfx *gdl, f32 x, f32 y, f32 z, f32 angle, f32 radius, mtx = gfxAllocateMatrix(); mtx4LoadYRotationWithTranslation(&pos, angle, &spc0); - mtx4MultMtx4(camGetMatrix1740(), &spc0, &sp80); + mtx4MultMtx4(camGetWorldToScreenMtxf(), &spc0, &sp80); mtx00016054(&sp80, mtx); for (i = 0; i < 4; i++) { @@ -53089,7 +53089,7 @@ void objBounce(struct defaultobj *obj, struct coord *arg1) dir.y = arg1->y; dir.z = arg1->z; - mtx4RotateVecInPlace(camGetUnk174c(), &dir); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &dir); projectile->speed.x += 3.3333333f * dir.x; projectile->speed.z += 3.3333333f * dir.z; @@ -53487,7 +53487,7 @@ bool objDrop(struct prop *prop, bool lazy) if (!lazy && (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)) { // Do collision checks Mtxf *sp48 = model0001a60c(model); - mtx00015be4(camGetUnk174c(), sp48, &spf0); + mtx00015be4(camGetProjectionMtxF(), sp48, &spf0); propSetPerimEnabled(root, false); spe4.x = spf0.m[3][0]; @@ -54120,7 +54120,7 @@ void cctvHandleLensShot(struct defaultobj *obj) if (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK) { rodata = modelGetPartRodata(model->filedata, MODELPART_CCTV_0002); sp7c = model0001a5cc(model, modelGetPart(model->filedata, MODELPART_CCTV_LENS), 0); - mtx00015be4(camGetUnk174c(), sp7c, &matrix); + mtx00015be4(camGetProjectionMtxF(), sp7c, &matrix); shardsCreate((struct coord *) matrix.m[3], matrix.m[0], matrix.m[1], matrix.m[2], rodata->bbox.xmin, rodata->bbox.xmax, rodata->bbox.ymin, rodata->bbox.ymax, @@ -54565,9 +54565,9 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata) } } - mtx4TransformVec(camGetUnk174c(), &spd8, &sp7c); + mtx4TransformVec(camGetProjectionMtxF(), &spd8, &sp7c); mtx4RotateVec(&model->matrices[spe4], &hitthing1.unk0c, &sp70); - mtx4RotateVecInPlace(camGetUnk174c(), &sp70); + mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp70); func0f061fa8(shotdata, prop, spd4, lVar3, node1, &hitthing1, spe4, node2, @@ -54636,7 +54636,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit) sp110.y = shotdata->unk00.y - hit->distance * shotdata->unk0c.y / shotdata->unk0c.z; sp110.z = shotdata->unk00.z - hit->distance; - mtx4TransformVecInPlace(camGetUnk174c(), &sp110); + mtx4TransformVecInPlace(camGetProjectionMtxF(), &sp110); if (!spfc && chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) { spfc = true; @@ -54814,7 +54814,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit) spb0.y = shotdata->dir.y * 3.0f; spb0.z = shotdata->dir.z * 3.0f; - mtx4MultMtx4(camGetUnk174c(), &obj->model->matrices[hit->mtxindex], &sp58); + mtx4MultMtx4(camGetProjectionMtxF(), &obj->model->matrices[hit->mtxindex], &sp58); mtx4TransformVec(&sp58, &hit->hitthing.unk00, &spa4); pushdir.x = shotdata->dir.x; @@ -62429,7 +62429,7 @@ bool func0f08e794(struct coord *coord, f32 arg1) if (ptr != NULL) { struct coord *campos = &g_Vars.currentplayer->cam_pos; - Mtxf *mtx = camGetMatrix1740(); + Mtxf *mtx = camGetWorldToScreenMtxf(); tmp.x = coord->x - campos->x; tmp.y = coord->y - campos->y; diff --git a/src/game/savebuffer.c b/src/game/savebuffer.c index 0fe7ea456..f1aef5804 100644 --- a/src/game/savebuffer.c +++ b/src/game/savebuffer.c @@ -133,7 +133,7 @@ Gfx *func0f0d479c(Gfx *gdl) Gfx *func0f0d49c8(Gfx *gdl) { gSPViewport(gdl++, OS_K0_TO_PHYSICAL(viGetCurrentPlayerViewport())); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); return gdl; } diff --git a/src/game/shards.c b/src/game/shards.c index ac98e2c95..8a9955665 100644 --- a/src/game/shards.c +++ b/src/game/shards.c @@ -225,7 +225,7 @@ Gfx *shardsRenderWood(Gfx *gdl) gDPSetTextureFilter(gdl++, G_TF_BILERP); gDPSetCycleType(gdl++, G_CYC_2CYCLE); gDPSetTextureLOD(gdl++, G_TL_LOD); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); for (i = 0; i < g_MaxShards; i++) { if (g_Shards[i].age60 > 0 && g_Shards[i].type == SHARDTYPE_WOOD) { @@ -323,8 +323,8 @@ Gfx *shardsRenderWood(Gfx *gdl) } gSPClearGeometryMode(gdl++, G_LIGHTING | G_TEXTURE_GEN); - gSPMatrix(gdl++, camGetUnk1750(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPMatrix(gdl++, camGetUnk173c(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gdl++, camGetPerspectiveMtxL(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, camGetMtxL173c(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } return gdl; @@ -401,7 +401,7 @@ glabel shardsRenderWood /* f14c050: 02608025 */ or $s0,$s3,$zero /* f14c054: 26f7e6c0 */ addiu $s7,$s7,-6464 /* f14c058: ae190000 */ sw $t9,0x0($s0) -/* f14c05c: 0fc2cb5a */ jal camGetUnk1758 +/* f14c05c: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f14c060: 26730008 */ addiu $s3,$s3,0x8 /* f14c064: 0c013100 */ jal osVirtualToPhysical /* f14c068: 00402025 */ or $a0,$v0,$zero @@ -768,14 +768,14 @@ glabel shardsRenderWood /* f14c5b0: 35080040 */ ori $t0,$t0,0x40 /* f14c5b4: 02608025 */ or $s0,$s3,$zero /* f14c5b8: ae080000 */ sw $t0,0x0($s0) -/* f14c5bc: 0fc2cb52 */ jal camGetUnk1750 +/* f14c5bc: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f14c5c0: 26730008 */ addiu $s3,$s3,0x8 /* f14c5c4: 3c090102 */ lui $t1,0x102 /* f14c5c8: ae020004 */ sw $v0,0x4($s0) /* f14c5cc: 35290040 */ ori $t1,$t1,0x40 /* f14c5d0: 02608825 */ or $s1,$s3,$zero /* f14c5d4: ae290000 */ sw $t1,0x0($s1) -/* f14c5d8: 0fc2cb42 */ jal camGetUnk173c +/* f14c5d8: 0fc2cb42 */ jal camGetMtxL173c /* f14c5dc: 26730008 */ addiu $s3,$s3,0x8 /* f14c5e0: ae220004 */ sw $v0,0x4($s1) .NB0f14c5e4: @@ -825,7 +825,7 @@ Gfx *shardsRenderGlass(Gfx *gdl) gSPSetGeometryMode(gdl++, G_LIGHTING | G_TEXTURE_GEN); } - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); for (i = 0; i < g_MaxShards; i++) { if (g_Shards[i].age60 > 0 && g_Shards[i].type != SHARDTYPE_WOOD) { @@ -917,8 +917,8 @@ Gfx *shardsRenderGlass(Gfx *gdl) } gSPClearGeometryMode(gdl++, G_LIGHTING | G_TEXTURE_GEN); - gSPMatrix(gdl++, camGetUnk1750(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPMatrix(gdl++, camGetUnk173c(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gdl++, camGetPerspectiveMtxL(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, camGetMtxL173c(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } return gdl; @@ -1038,7 +1038,7 @@ glabel shardsRenderGlass /* f14c7cc: 35290040 */ ori $t1,$t1,0x40 /* f14c7d0: 26080008 */ addiu $t0,$s0,0x8 /* f14c7d4: afa80138 */ sw $t0,0x138($sp) -/* f14c7d8: 0fc2cb5a */ jal camGetUnk1758 +/* f14c7d8: 0fc2cb5a */ jal camGetOrthogonalMtxL /* f14c7dc: ae090000 */ sw $t1,0x0($s0) /* f14c7e0: 0c013100 */ jal osVirtualToPhysical /* f14c7e4: 00402025 */ or $a0,$v0,$zero @@ -1413,7 +1413,7 @@ glabel shardsRenderGlass /* f14cd4c: 35ce0040 */ ori $t6,$t6,0x40 /* f14cd50: 260d0008 */ addiu $t5,$s0,0x8 /* f14cd54: afad0138 */ sw $t5,0x138($sp) -/* f14cd58: 0fc2cb52 */ jal camGetUnk1750 +/* f14cd58: 0fc2cb52 */ jal camGetPerspectiveMtxL /* f14cd5c: ae0e0000 */ sw $t6,0x0($s0) /* f14cd60: ae020004 */ sw $v0,0x4($s0) /* f14cd64: 8fb10138 */ lw $s1,0x138($sp) @@ -1421,7 +1421,7 @@ glabel shardsRenderGlass /* f14cd6c: 35080040 */ ori $t0,$t0,0x40 /* f14cd70: 26380008 */ addiu $t8,$s1,0x8 /* f14cd74: afb80138 */ sw $t8,0x138($sp) -/* f14cd78: 0fc2cb42 */ jal camGetUnk173c +/* f14cd78: 0fc2cb42 */ jal camGetMtxL173c /* f14cd7c: ae280000 */ sw $t0,0x0($s1) /* f14cd80: ae220004 */ sw $v0,0x4($s1) .NB0f14cd84: diff --git a/src/game/sky.c b/src/game/sky.c index 0163c8c9f..65544dab1 100644 --- a/src/game/sky.c +++ b/src/game/sky.c @@ -50,7 +50,7 @@ struct coord g_TeleportToLook = {0, 1, 0}; void sky0f11f000(f32 left, f32 top, struct coord *arg2) { - Mtxf *mtx = camGetUnk174c(); + Mtxf *mtx = camGetProjectionMtxF(); f32 pos[2]; pos[0] = left + camGetScreenLeft(); @@ -1967,9 +1967,9 @@ glabel var7f1b50c8 .L0f120df0: /* f120df0: 5a200153 */ blezl $s1,.L0f121340 /* f120df4: 8fae0068 */ lw $t6,0x68($sp) -/* f120df8: 0fc2d5c6 */ jal camGetUnk1754 +/* f120df8: 0fc2d5c6 */ jal camGetMtxF1754 /* f120dfc: 00000000 */ nop -/* f120e00: 0fc2d5be */ jal camGetMatrix1740 +/* f120e00: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f120e04: 00408025 */ or $s0,$v0,$zero /* f120e08: 02002025 */ or $a0,$s0,$zero /* f120e0c: 00402825 */ or $a1,$v0,$zero @@ -3423,9 +3423,9 @@ glabel var7f1b50c8 /* f122430: 27090008 */ addiu $t1,$t8,0x8 /* f122434: afa906b0 */ sw $t1,0x6b0($sp) /* f122438: af0b0004 */ sw $t3,0x4($t8) -/* f12243c: 0fc2d5c6 */ jal camGetUnk1754 +/* f12243c: 0fc2d5c6 */ jal camGetMtxF1754 /* f122440: af190000 */ sw $t9,0x0($t8) -/* f122444: 0fc2d5be */ jal camGetMatrix1740 +/* f122444: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f122448: 00408025 */ or $s0,$v0,$zero /* f12244c: 02002025 */ or $a0,$s0,$zero /* f122450: 00402825 */ or $a1,$v0,$zero @@ -4282,7 +4282,7 @@ glabel var7f1b50c8 // struct skything38 sp274[5]; // s32 i; // 270 // -// mtx4MultMtx4(camGetUnk1754(), camGetMatrix1740(), &sp3cc); +// mtx4MultMtx4(camGetMtxF1754(), camGetWorldToScreenMtxf(), &sp3cc); // guScaleF(var800a33a8.m, 1.0f / scale, 1.0f / scale, 1.0f / scale); // mtx4MultMtx4(&sp3cc, &var800a33a8, &sp38c); // @@ -4746,7 +4746,7 @@ glabel var7f1b50c8 // SHADE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, SHADE, // SHADE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, SHADE); // -// mtx4MultMtx4(camGetUnk1754(), camGetMatrix1740(), &sp1ec); +// mtx4MultMtx4(camGetMtxF1754(), camGetWorldToScreenMtxf(), &sp1ec); // guScaleF(var800a33a8.m, 1.0f / scale, 1.0f / scale, 1.0f / scale); // mtx4MultMtx4(&sp1ec, &var800a33a8, &sp1ac); // @@ -8129,8 +8129,8 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray) bool onscreen; f32 radius; - sp16c = camGetMatrix1740(); - sp168 = camGetUnk1754(); + sp16c = camGetWorldToScreenMtxf(); + sp168 = camGetMtxF1754(); env = envGetCurrent(); xscale = 1; @@ -10199,8 +10199,8 @@ Gfx *sky0f126c3c(Gfx *gdl, f32 x, f32 y, f32 z, f32 arg4, f32 arg5) sp64.y = y; sp64.z = z; - mtx4TransformVecInPlace(camGetMatrix1740(), &sp64); - mtx4TransformVecInPlace(camGetUnk1754(), &sp64); + mtx4TransformVecInPlace(camGetWorldToScreenMtxf(), &sp64); + mtx4TransformVecInPlace(camGetMtxF1754(), &sp64); if (sp64.z > 1.0f) { f32 xpos; diff --git a/src/game/smoke.c b/src/game/smoke.c index 22e9f79ae..ae16e88e2 100644 --- a/src/game/smoke.c +++ b/src/game/smoke.c @@ -88,7 +88,7 @@ Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, stru { struct gfxvtx *vertices = gfxAllocateVertices(4); struct colour *colours = (struct colour *)gfxAllocateColours(1); - Mtxf *mtx = camGetUnk174c(); + Mtxf *mtx = camGetProjectionMtxF(); struct coord spa0; struct coord sp94; struct coord sp88; @@ -588,7 +588,7 @@ u32 smokeTick(struct prop *prop) u32 smokeTickPlayer(struct prop *prop) { - Mtxf *matrix = camGetMatrix1740(); + Mtxf *matrix = camGetWorldToScreenMtxf(); prop->z = -(matrix->m[0][2] * prop->pos.x + matrix->m[1][2] * prop->pos.y + matrix->m[2][2] * prop->pos.z + matrix->m[3][2]); @@ -655,7 +655,7 @@ Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass) } gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1758()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = room0f166d7c(gdl, roomnum); @@ -689,7 +689,7 @@ Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass) } gDPSetColorDither(gdl++, G_CD_BAYER); - gSPMatrix(gdl++, osVirtualToPhysical(camGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); } return gdl; diff --git a/src/game/sparks.c b/src/game/sparks.c index f2b76ae10..73b495fbd 100644 --- a/src/game/sparks.c +++ b/src/game/sparks.c @@ -432,7 +432,7 @@ Gfx *sparksRender(Gfx *gdl) spd4.m[3][3] = 0.05f; mtx4SetTranslation(&group->pos, &spd4); - mtx00015be0(camGetMatrix1740(), &spd4); + mtx00015be0(camGetWorldToScreenMtxf(), &spd4); mtx = gfxAllocateMatrix(); mtx00016054(&spd4, mtx); diff --git a/src/game/stars.c b/src/game/stars.c index caad60111..855c99a9f 100644 --- a/src/game/stars.c +++ b/src/game/stars.c @@ -795,7 +795,7 @@ Gfx *starsRender(Gfx *gdl) sp154 = cosf(0.017453199252486f * (90.0f - viGetFovY() / viGetAspect() * 0.5f)); mtx4LoadIdentity(&mtx); - mtx00015be0(camGetMatrix1740(), &mtx); + mtx00015be0(camGetWorldToScreenMtxf(), &mtx); mtx.m[3][0] = 0.0f; mtx.m[3][1] = 0.0f; diff --git a/src/game/wallhit.c b/src/game/wallhit.c index 8082f411b..8fc5432a4 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -1771,9 +1771,9 @@ s32 wallhit0f140750(struct coord *coord) f32 z; f32 tmp; - x = g_Vars.currentplayer->unk174c->m[3][0] - coord->f[0]; - y = g_Vars.currentplayer->unk174c->m[3][1] - coord->f[1]; - z = g_Vars.currentplayer->unk174c->m[3][2] - coord->f[2]; + x = g_Vars.currentplayer->projectionmtx->m[3][0] - coord->f[0]; + y = g_Vars.currentplayer->projectionmtx->m[3][1] - coord->f[1]; + z = g_Vars.currentplayer->projectionmtx->m[3][2] - coord->f[2]; var8007f740++; diff --git a/src/game/weather.c b/src/game/weather.c index 1625558cc..fcc088812 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -951,7 +951,7 @@ glabel var7f1b5780 /* f133070: afa00194 */ sw $zero,0x194($sp) /* f133074: 0c00566c */ jal mtx4LoadIdentity /* f133078: 02002025 */ or $a0,$s0,$zero -/* f13307c: 0fc2d5be */ jal camGetMatrix1740 +/* f13307c: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f133080: 00000000 */ nop /* f133084: 00402025 */ or $a0,$v0,$zero /* f133088: 0c0056f8 */ jal mtx00015be0 @@ -2592,7 +2592,7 @@ u32 var8007f0fc = 22000; // sp194 = 0; // // mtx4LoadIdentity(&sp1c8); -// mtx00015be0(camGetMatrix1740(), &sp1c8); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp1c8); // // sp1c8.m[3][0] = 0.0f; // sp1c8.m[3][1] = 0.0f; @@ -3220,7 +3220,7 @@ glabel var7f1b5790 /* f134878: afa00198 */ sw $zero,0x198($sp) /* f13487c: 0c00566c */ jal mtx4LoadIdentity /* f134880: 02002025 */ or $a0,$s0,$zero -/* f134884: 0fc2d5be */ jal camGetMatrix1740 +/* f134884: 0fc2d5be */ jal camGetWorldToScreenMtxf /* f134888: 00000000 */ nop /* f13488c: 00402025 */ or $a0,$v0,$zero /* f134890: 0c0056f8 */ jal mtx00015be0 @@ -4644,7 +4644,7 @@ u32 var8007f110 = 0xffffff7f; // sp198 = 0; // // mtx4LoadIdentity(&sp1cc); -// mtx00015be0(camGetMatrix1740(), &sp1cc); +// mtx00015be0(camGetWorldToScreenMtxf(), &sp1cc); // // sp1cc.m[3][0] = 0.0f; // sp1cc.m[3][1] = 0.0f; diff --git a/src/include/game/camera.h b/src/include/game/camera.h index eebc932bd..45614205e 100644 --- a/src/include/game/camera.h +++ b/src/include/game/camera.h @@ -15,25 +15,25 @@ void cam0f0b4d68(struct coord *in, f32 out[2]); void cam0f0b4dec(struct coord *in, f32 out[2]); void cam0f0b4e68(struct coord *in, f32 divisor, struct coord *out); void cam0f0b4eb8(struct coord *arg0, f32 arg1[2], f32 zoom, f32 aspect); -void camSetUnk1738(void *matrix); -void camSetUnk173c(Mtx *matrix); -Mtx *camGetUnk173c(void); -void camSetUnk006c(Mtxf *matrix); -Mtxf *camGetUnk006c(void); -void camSetUnk1750(void *value); -void *camGetUnk1750(void); -void camSetUnk1758(Mtx *matrix); -Mtx *camGetUnk1758(void); -void camSetMatrix1740(Mtxf *value); -void *cam0f0b5050(u8 *arg0); +void camSetMtxL1738(Mtx *mtx); +void camSetMtxL173c(Mtx *mtx); +Mtx *camGetMtxL173c(void); +void camSetMtxF006c(Mtxf *mtx); +Mtxf *camGetMtxF006c(void); +void camSetPerspectiveMtxL(Mtx *value); +Mtx *camGetPerspectiveMtxL(void); +void camSetOrthogonalMtxL(Mtx *mtx); +Mtx *camGetOrthogonalMtxL(void); +void camSetWorldToScreenMtxf(Mtxf *mtx); +Mtxf *cam0f0b5050(u8 *arg0); Mtxf *cam0f0b53a4(u8 *arg0); -Mtxf *camGetMatrix1740(void); -void camSetUnk1754(Mtxf *matrix); -Mtxf *camGetUnk1754(void); -void camSetUnk174c(Mtxf *matrix); -Mtxf *camGetUnk174c(void); -void camSetUnk175c(Mtxf *matrix); -Mtxf *camGetUnk175c(void); +Mtxf *camGetWorldToScreenMtxf(void); +void camSetMtxF1754(Mtxf *mtx); +Mtxf *camGetMtxF1754(void); +void camSetProjectionMtxF(Mtxf *mtx); +Mtxf *camGetProjectionMtxF(void); +void camSetLookAt(LookAt *lookat); +LookAt *camGetLookAt(void); f32 camGetLodScaleZ(void); f32 camGetScreenWidth(void); f32 camGetScreenHeight(void); diff --git a/src/include/types.h b/src/include/types.h index 57e74dc6a..d78910bda 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2360,11 +2360,11 @@ struct player { /*0x0038*/ struct coord globaldrawworldoffset; /*0x0044*/ struct coord globaldrawcameraoffset; /*0x0050*/ struct coord globaldrawworldbgoffset; - /*0x005c*/ Mtx *matrix5c; - /*0x0060*/ Mtx *matrix60; - /*0x0064*/ Mtxf *matrix64; - /*0x0068*/ Mtxf *matrix68; - /*0x006c*/ Mtxf *matrix6c; + /*0x005c*/ Mtx *mtxl005c; + /*0x0060*/ Mtx *mtxl0060; + /*0x0064*/ Mtxf *mtxf0064; + /*0x0068*/ Mtxf *mtxf0068; + /*0x006c*/ Mtxf *mtxf006c; /*0x0070*/ f32 sumground; /*0x0074*/ f32 vv_manground; // Feet Y value in absolute coordinates /*0x0078*/ f32 vv_ground; // Ground Y value in absolute coordinates @@ -2590,19 +2590,19 @@ struct player { /*0x172c*/ f32 c_scaley; /*0x1730*/ f32 c_recipscalex; /*0x1734*/ f32 c_recipscaley; - /*0x1738*/ void *unk1738; - /*0x173c*/ Mtx *unk173c; - /*0x1740*/ Mtxf *matrix1740; + /*0x1738*/ Mtx *mtxl1738; + /*0x173c*/ Mtx *mtxl173c; + /*0x1740*/ Mtxf *worldtoscreenmtx; /*0x1744*/ s32 c_viewfmdynticknum; - /*0x1748*/ u32 unk1748; - /*0x174c*/ Mtxf *unk174c; - /*0x1750*/ void *unk1750; - /*0x1754*/ Mtxf *unk1754; - /*0x1758*/ Mtx *unk1758; - /*0x175c*/ Mtxf *unk175c; - /*0x1760*/ Mtxf *prev1740; + /*0x1748*/ Mtxf *mtxf1748; + /*0x174c*/ Mtxf *projectionmtx; + /*0x1750*/ Mtx *perspmtxl; + /*0x1754*/ Mtxf *mtxf1754; + /*0x1758*/ Mtx *orthomtxl; + /*0x175c*/ LookAt *lookat; + /*0x1760*/ Mtxf *prevworldtoscreenmtx; /*0x1764*/ s32 c_prevviewfmdynticknum; - /*0x1768*/ Mtxf *unk1768; + /*0x1768*/ Mtxf *prevprojectionmtx; /*0x176c*/ f32 c_scalelod60; /*0x1770*/ f32 c_scalelod; /*0x1774*/ f32 c_lodscalez; diff --git a/src/lib/vi.c b/src/lib/vi.c index 27477cbf9..50f481fe1 100644 --- a/src/lib/vi.c +++ b/src/lib/vi.c @@ -2380,7 +2380,7 @@ Gfx *vi0000ab78(Gfx *gdl) u16 sp46; guPerspectiveF(sp110.m, &sp46, g_ViBackData->fovy, g_ViBackData->aspect, g_ViBackData->znear, g_ViBackData->zfar + g_ViBackData->zfar, 1); - mtx4Copy(camGetMatrix1740(), &sp90); + mtx4Copy(camGetWorldToScreenMtxf(), &sp90); sp90.m[3][0] = 0; sp90.m[3][1] = 0; @@ -2433,8 +2433,8 @@ Gfx *vi0000ad5c(Gfx *gdl, Vp *vp) gSPMatrix(gdl++, OS_K0_TO_PHYSICAL(var80092870), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPPerspNormalize(gdl++, g_ViPerspScale); - camSetUnk1750(var80092870); - camSetUnk1754(&var80092830); + camSetPerspectiveMtxL(var80092870); + camSetMtxF1754(&var80092830); return gdl; } @@ -2462,8 +2462,8 @@ Gfx *vi0000af00(Gfx *gdl, Vp *vp) gSPMatrix(gdl++, OS_K0_TO_PHYSICAL(var80092870), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPPerspNormalize(gdl++, g_ViPerspScale); - camSetUnk1750(var80092870); - camSetUnk1754(&var80092830); + camSetPerspectiveMtxL(var80092870); + camSetMtxF1754(&var80092830); return gdl; }