diff --git a/src/game/game_127910.c b/src/game/game_127910.c index 12d3f8d82..80160731f 100644 --- a/src/game/game_127910.c +++ b/src/game/game_127910.c @@ -380,15 +380,15 @@ void playerAllocate(s32 index) g_Vars.players[index]->floorflags = 0; for (i = 0; i < 2; i++) { - g_Vars.players[index]->viewport[i].unk00 = 640; - g_Vars.players[index]->viewport[i].unk02 = (PAL ? 544 : 480); - g_Vars.players[index]->viewport[i].unk04 = 511; - g_Vars.players[index]->viewport[i].unk06 = 0; + g_Vars.players[index]->viewport[i].vp.vscale[0] = 640; + g_Vars.players[index]->viewport[i].vp.vscale[1] = (PAL ? 544 : 480); + g_Vars.players[index]->viewport[i].vp.vscale[2] = 511; + g_Vars.players[index]->viewport[i].vp.vscale[3] = 0; - g_Vars.players[index]->viewport[i].unk08 = 640; - g_Vars.players[index]->viewport[i].unk0a = (PAL ? 544 : 480); - g_Vars.players[index]->viewport[i].unk0c = 511; - g_Vars.players[index]->viewport[i].unk0e = 0; + g_Vars.players[index]->viewport[i].vp.vtrans[0] = 640; + g_Vars.players[index]->viewport[i].vp.vtrans[1] = (PAL ? 544 : 480); + g_Vars.players[index]->viewport[i].vp.vtrans[2] = 511; + g_Vars.players[index]->viewport[i].vp.vtrans[3] = 0; } g_Vars.players[index]->viewwidth = 100; diff --git a/src/game/savebuffer.c b/src/game/savebuffer.c index aef63851f..6691dc4b5 100644 --- a/src/game/savebuffer.c +++ b/src/game/savebuffer.c @@ -139,7 +139,7 @@ Gfx *func0f0d479c(Gfx *gdl) Gfx *func0f0d49c8(Gfx *gdl) { - gSPViewport(gdl++, OS_K0_TO_PHYSICAL(vi0000ab4c())); + gSPViewport(gdl++, OS_K0_TO_PHYSICAL(viGetCurrentPlayerViewport())); gSPMatrix(gdl++, osVirtualToPhysical(currentPlayerGetUnk1750()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); return gdl; diff --git a/src/include/lib/lib_09a80.h b/src/include/lib/lib_09a80.h index 8ad969e37..0762c153c 100644 --- a/src/include/lib/lib_09a80.h +++ b/src/include/lib/lib_09a80.h @@ -21,7 +21,7 @@ void vi0000aa50(f32 arg0); void vi0000aab0(s32 arg0); void *viGetUnk28(void); void *vi2GetUnk28(void); -Vp *vi0000ab4c(void); +Vp *viGetCurrentPlayerViewport(void); u32 vi0000ab6c(void); u32 vi0000ab78(void); u32 vi0000aca4(void); diff --git a/src/include/types.h b/src/include/types.h index 3ffd5f48f..a40ca3541 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2433,17 +2433,6 @@ struct hand { /*0x0dd8*/ u32 unk0dd8; }; -struct player0610 { - /*0x00*/ u16 unk00; - /*0x02*/ u16 unk02; - /*0x04*/ u16 unk04; - /*0x06*/ u16 unk06; - /*0x08*/ u16 unk08; - /*0x0a*/ u16 unk0a; - /*0x0c*/ u16 unk0c; - /*0x0e*/ u16 unk0e; -}; - struct gunctrl { /*0x1580*/ s8 weaponnum; /*0x1581*/ s8 prevweaponnum; // previously drawn weapon, switched to when throwing Dragon/Laptop or when ammo depleted @@ -2686,7 +2675,7 @@ struct player { /*0x0494*/ union modelrwdata *bondheadsave[30]; /*0x050c*/ u32 unk050c; /*0x0510*/ Mtxf bondheadmatrices[4]; - /*0x0610*/ struct player0610 viewport[2]; + /*0x0610*/ Vp viewport[2]; /*0x0630*/ s16 viewwidth; // 320 lo-res, 640 hi-res /*0x0632*/ s16 viewheight; // 220 regardless of res /*0x0634*/ s16 viewleft; // 0 diff --git a/src/lib/lib_09a80.c b/src/lib/lib_09a80.c index bce45f422..dfcf256a3 100644 --- a/src/lib/lib_09a80.c +++ b/src/lib/lib_09a80.c @@ -1972,17 +1972,10 @@ void viSetUnk28(void *arg0) g_ViData->unk28 = arg0; } -GLOBAL_ASM( -glabel vi0000ab4c -/* ab4c: 3c0f8009 */ lui $t7,%hi(var80092874+0x3) -/* ab50: 91ef2877 */ lbu $t7,%lo(var80092874+0x3)($t7) -/* ab54: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) -/* ab58: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) -/* ab5c: 000fc100 */ sll $t8,$t7,0x4 -/* ab60: 01d81021 */ addu $v0,$t6,$t8 -/* ab64: 03e00008 */ jr $ra -/* ab68: 24420610 */ addiu $v0,$v0,0x610 -); +Vp *viGetCurrentPlayerViewport(void) +{ + return &g_Vars.currentplayer->viewport[var80092877]; +} GLOBAL_ASM( glabel vi0000ab6c