Attempt to decompile lasersightRenderBeam

This commit is contained in:
Ryan Dwyer
2021-03-02 22:41:47 +10:00
parent 8836a9dbeb
commit 88938e16ec
5 changed files with 160 additions and 7 deletions
+1 -1
View File
@@ -18424,7 +18424,7 @@ glabel var7f1aca90
/* f0a73f0: 24010001 */ addiu $at,$zero,0x1
/* f0a73f4: 51010005 */ beql $t0,$at,.L0f0a740c
/* f0a73f8: 0000a025 */ or $s4,$zero,$zero
/* f0a73fc: 0fc2be93 */ jal func0f0afa4c
/* f0a73fc: 0fc2be93 */ jal lasersightRenderBeam
/* f0a7400: 8fa4014c */ lw $a0,0x14c($sp)
/* f0a7404: afa2014c */ sw $v0,0x14c($sp)
.L0f0a7408:
+155 -2
View File
@@ -6,6 +6,7 @@
#include "game/game_0b0fd0.h"
#include "game/game_0b3350.h"
#include "game/game_0c33f0.h"
#include "game/gfxmemory.h"
#include "game/file.h"
#include "gvars/gvars.h"
#include "lib/main.h"
@@ -3545,7 +3546,7 @@ bool lasersightExists(s32 id, s32 *index)
}
GLOBAL_ASM(
glabel func0f0af158
glabel lasersightRenderDot
.late_rodata
glabel var7f1acd70
.word 0x3e4ccccd
@@ -4155,7 +4156,7 @@ glabel var7f1acd8c
);
GLOBAL_ASM(
glabel func0f0afa4c
glabel lasersightRenderBeam
.late_rodata
glabel var7f1acd90
.word 0x3e4ccccd
@@ -4685,6 +4686,158 @@ glabel var7f1acd90
/* f0b0264: 27bd01e8 */ addiu $sp,$sp,0x1e8
);
// Mismatch: Two load instructions are swapped at afddc, and regalloc
//Gfx *lasersightRenderBeam(Gfx *gdl)
//{
// f32 tmp;
// struct player *player = g_Vars.currentplayer;
// Mtxf *mtx;
// s32 i;
// Mtxf sp198;
// struct coord campos; // 18c
// Mtxf sp14c;
// Mtxf sp10c;
//
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
// gDPSetTexturePersp(gdl++, G_TP_PERSP);
// gDPSetColorDither(gdl++, G_CD_DISABLE);
// gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
// gDPSetTextureLOD(gdl++, G_TL_TILE);
// gDPSetTextureConvert(gdl++, G_TC_FILT);
// gDPSetTextureLUT(gdl++, G_TT_NONE);
// gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA);
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
//
// func0f0b39c0(&gdl, &var800ab5a8[3], 4, 0, 2, 1, 0);
// func000159b0(&sp14c);
//
// func00015be0(currentPlayerGetMatrix1740(), &sp14c);
// func000159b0(&sp10c);
// func00015be0(currentPlayerGetUnk174c(), &sp10c);
//
// sp10c.m[3][1] = 0;
// sp10c.m[3][0] = 0;
// sp10c.m[3][2] = 0;
//
// func000159b0(&sp198);
// func00015be0(currentPlayerGetMatrix1740(), &sp198);
//
// campos.x = player->cam_pos.x;
// campos.y = player->cam_pos.y;
// campos.z = player->cam_pos.z;
//
// sp198.m[3][0] = 0;
// sp198.m[3][1] = 0;
// sp198.m[3][2] = 0;
//
// func00015f88(0.2f, &sp198);
// mtx = gfxAllocateMatrix();
// func00016054(&sp198, mtx);
//
// gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
//
// for (i = 0; i < 4; i++) {
// if (g_LaserSights[i].id != -1) {
// u32 *colours;
// struct coord spcc;
// struct coord spc0;
// struct coord spb4;
// struct coord spa8;
// struct gfxvtx *vertices;
// struct coord sp98;
//
// sp98.f[0] = g_LaserSights[i].beamnear.f[0];
// sp98.f[1] = g_LaserSights[i].beamnear.f[1];
// sp98.f[2] = g_LaserSights[i].beamnear.f[2];
//
// func00015b64(&sp14c, &sp98);
//
// spa8.f[0] = sp98.f[0] < 0.0f ? 1 : -1;
// spa8.f[1] = 2;
// spa8.f[2] = 0.0f;
//
// guNormalize(&spa8.x, &spa8.y, &spa8.z);
//
// func00015b10(&sp10c, &spa8);
//
// spcc.f[0] = (g_LaserSights[i].beamnear.f[0] - campos.f[0]) * 5;
// spcc.f[1] = (g_LaserSights[i].beamnear.f[1] - campos.f[1]) * 5;
// spcc.f[2] = (g_LaserSights[i].beamnear.f[2] - campos.f[2]) * 5;
//
// spc0.f[0] = (g_LaserSights[i].beamfar.f[0] - campos.f[0]) * 5;
// spc0.f[1] = (g_LaserSights[i].beamfar.f[1] - campos.f[1]) * 5;
// spc0.f[2] = (g_LaserSights[i].beamfar.f[2] - campos.f[2]) * 5;
//
// spb4.f[0] = spc0.f[0] - spcc.f[0];
// spb4.f[1] = spc0.f[1] - spcc.f[1];
// spb4.f[2] = spc0.f[2] - spcc.f[2];
//
// guNormalize(&spb4.x, &spb4.y, &spb4.z);
//
// colours = gfxAllocateColours(2);
//
// colours[0] = 0xff00005f;
// colours[1] = 0xff00000f;
//
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2);
//
// vertices = gfxAllocateVertices(6);
//
// vertices[0].s = 0;
// vertices[1].s = 0;
// vertices[2].s = 0;
// vertices[3].s = 0;
// vertices[4].s = 4;
// vertices[5].s = 4;
//
// vertices[0].unk08 = 0;
// vertices[0].unk0a = 0;
// vertices[1].unk08 = 0;
// vertices[1].unk0a = 256;
// vertices[2].unk08 = 32;
// vertices[2].unk0a = 0;
// vertices[3].unk08 = 32;
// vertices[3].unk0a = 256;
// vertices[4].unk08 = 0;
// vertices[4].unk0a = 0;
// vertices[5].unk08 = 0;
// vertices[5].unk0a = 256;
//
// vertices[0].x = spcc.f[0] - spa8.f[0] * 15;
// vertices[0].y = spcc.f[1] - spa8.f[1] * 15;
// vertices[0].z = spcc.f[2] - spa8.f[2] * 15;
//
// vertices[1].x = spcc.f[0] + spa8.f[0] * 15;
// vertices[1].y = spcc.f[1] + spa8.f[1] * 15;
// vertices[1].z = spcc.f[2] + spa8.f[2] * 15;
//
// vertices[2].x = spcc.f[0] + (200 * spb4.f[0]) - (spa8.f[0] * 15);
// vertices[2].y = spcc.f[1] + (200 * spb4.f[1]) - (spa8.f[1] * 15);
// vertices[2].z = spcc.f[2] + (200 * spb4.f[2]) - (spa8.f[2] * 15);
//
// vertices[3].x = spcc.f[0] + (200 * spb4.f[0]) + (spa8.f[0] * 15);
// vertices[3].y = spcc.f[1] + (200 * spb4.f[1]) + (spa8.f[1] * 15);
// vertices[3].z = spcc.f[2] + (200 * spb4.f[2]) + (spa8.f[2] * 15);
//
// vertices[4].x = spcc.f[0] + (400 * spb4.f[0]) - (spa8.f[0] * 15);
// vertices[4].y = spcc.f[1] + (400 * spb4.f[1]) - (spa8.f[1] * 15);
// vertices[4].z = spcc.f[2] + (400 * spb4.f[2]) - (spa8.f[2] * 15);
//
// vertices[5].x = spcc.f[0] + (400 * spb4.f[0]) + (spa8.f[0] * 15);
// vertices[5].y = spcc.f[1] + (400 * spb4.f[1]) + (spa8.f[1] * 15);
// vertices[5].z = spcc.f[2] + (400 * spb4.f[2]) + (spa8.f[2] * 15);
//
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6);
//
// gDPTri4(gdl++, 0, 1, 2, 2, 3, 1, 2, 3, 5, 2, 5, 4);
// }
// }
//
// return gdl;
//}
void func0f0b0268(s32 id, s32 arg1, struct coord *near, struct coord *far)
{
s32 i;
+1 -1
View File
@@ -9125,7 +9125,7 @@ Gfx *func0f0c07c8(Gfx *gdl)
func0f0a6c30();
gdl = func0f0aeed8(gdl);
func0f0a7138(&gdl);
gdl = func0f0af158(gdl);
gdl = lasersightRenderDot(gdl);
if (g_Vars.currentplayer->visionmode != VISIONMODE_XRAY) {
gdl = func0f15b114(gdl);
+2 -2
View File
@@ -22,8 +22,8 @@ void func0f0aeea8(s32 index, f32 arg1);
Gfx *func0f0aeed8(Gfx *gdl);
void func0f0aefb8(void);
bool lasersightExists(s32 id, s32 *index);
Gfx *func0f0af158(Gfx *gdl);
u32 func0f0afa4c(void);
Gfx *lasersightRenderDot(Gfx *gdl);
Gfx *lasersightRenderBeam(Gfx *gdl);
void func0f0b0268(s32 id, s32 arg1, struct coord *near, struct coord *far);
void lasersightSetDot(s32 arg0, struct coord *pos, struct coord *rot);
void lasersightFree(s32 arg0);
+1 -1
View File
@@ -26,7 +26,7 @@ u32 func00015ea8(void);
void func00015edc(f32 mult, f32 *matrix);
void func00015f04(f32 scale, Mtxf *arg1);
u32 func00015f4c(void);
u32 func00015f88(void);
void func00015f88(f32 arg0, Mtxf *arg1);
u32 func00015fd0(void);
void func00016054(Mtxf *matrix, Mtxf *arg1);