Rename tex.c to texselect.c, surface.c to tex.c
This commit is contained in:
parent
23c06ddab5
commit
e21e1cb33f
|
|
@ -111,7 +111,7 @@
|
|||
build/ROMID/game/game_0b0fd0.o (section); \
|
||||
build/ROMID/game/game_0b2150.o (section); \
|
||||
build/ROMID/game/game_0b28d0.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/texselect.o (section); \
|
||||
build/ROMID/game/camera.o (section); \
|
||||
build/ROMID/game/portal.o (section); \
|
||||
build/ROMID/game/player.o (section); \
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
build/ROMID/game/lang.o (section); \
|
||||
build/ROMID/game/texdecompress.o (section); \
|
||||
build/ROMID/game/texreset.o (section); \
|
||||
build/ROMID/game/surface.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/stubs/game_175f50.o (section); \
|
||||
build/ROMID/game/game_175f90.o (section); \
|
||||
build/ROMID/game/buildtime.o (section); \
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
build/ROMID/game/game_0b0fd0.o (section); \
|
||||
build/ROMID/game/game_0b2150.o (section); \
|
||||
build/ROMID/game/game_0b28d0.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/texselect.o (section); \
|
||||
build/ROMID/game/camera.o (section); \
|
||||
build/ROMID/game/portal.o (section); \
|
||||
build/ROMID/game/player.o (section); \
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
build/ROMID/game/lang.o (section); \
|
||||
build/ROMID/game/texdecompress.o (section); \
|
||||
build/ROMID/game/texreset.o (section); \
|
||||
build/ROMID/game/surface.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/stubs/game_175f50.o (section); \
|
||||
build/ROMID/game/game_175f90.o (section); \
|
||||
build/ROMID/game/buildtime.o (section); \
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
build/ROMID/game/game_0b0fd0.o (section); \
|
||||
build/ROMID/game/game_0b2150.o (section); \
|
||||
build/ROMID/game/game_0b28d0.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/texselect.o (section); \
|
||||
build/ROMID/game/camera.o (section); \
|
||||
build/ROMID/game/portal.o (section); \
|
||||
build/ROMID/game/player.o (section); \
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
build/ROMID/game/lang.o (section); \
|
||||
build/ROMID/game/texdecompress.o (section); \
|
||||
build/ROMID/game/texreset.o (section); \
|
||||
build/ROMID/game/surface.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/stubs/game_175f50.o (section); \
|
||||
build/ROMID/game/game_175f90.o (section); \
|
||||
build/ROMID/game/buildtime.o (section); \
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
build/ROMID/game/game_0b0fd0.o (section); \
|
||||
build/ROMID/game/game_0b2150.o (section); \
|
||||
build/ROMID/game/game_0b28d0.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/texselect.o (section); \
|
||||
build/ROMID/game/camera.o (section); \
|
||||
build/ROMID/game/portal.o (section); \
|
||||
build/ROMID/game/player.o (section); \
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
build/ROMID/game/lang.o (section); \
|
||||
build/ROMID/game/texdecompress.o (section); \
|
||||
build/ROMID/game/texreset.o (section); \
|
||||
build/ROMID/game/surface.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/stubs/game_175f50.o (section); \
|
||||
build/ROMID/game/game_175f90.o (section); \
|
||||
build/ROMID/game/buildtime.o (section); \
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
build/ROMID/game/game_0b0fd0.o (section); \
|
||||
build/ROMID/game/game_0b2150.o (section); \
|
||||
build/ROMID/game/game_0b28d0.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/texselect.o (section); \
|
||||
build/ROMID/game/camera.o (section); \
|
||||
build/ROMID/game/portal.o (section); \
|
||||
build/ROMID/game/player.o (section); \
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
build/ROMID/game/lang.o (section); \
|
||||
build/ROMID/game/texdecompress.o (section); \
|
||||
build/ROMID/game/texreset.o (section); \
|
||||
build/ROMID/game/surface.o (section); \
|
||||
build/ROMID/game/tex.o (section); \
|
||||
build/ROMID/game/stubs/game_175f50.o (section); \
|
||||
build/ROMID/game/game_175f90.o (section); \
|
||||
build/ROMID/game/buildtime.o (section); \
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include "game/file.h"
|
||||
#include "game/lv.h"
|
||||
#include "game/texdecompress.h"
|
||||
#include "game/surface.h"
|
||||
#include "game/wallhit.h"
|
||||
#include "bss.h"
|
||||
#include "lib/rzip.h"
|
||||
|
|
@ -9085,7 +9084,7 @@ glabel roomLoad
|
|||
/* f15e148: 02988021 */ addu $s0,$s4,$t8
|
||||
/* f15e14c: 00441823 */ subu $v1,$v0,$a0
|
||||
/* f15e150: 02032823 */ subu $a1,$s0,$v1
|
||||
/* f15e154: 0fc5d7bd */ jal surface0f175ef4
|
||||
/* f15e154: 0fc5d7bd */ jal tex0f175ef4
|
||||
/* f15e158: 00603025 */ or $a2,$v1,$zero
|
||||
/* f15e15c: 26420001 */ addiu $v0,$s2,0x1
|
||||
/* f15e160: 1840000d */ blez $v0,.L0f15e198
|
||||
|
|
@ -9120,7 +9119,7 @@ glabel roomLoad
|
|||
/* f15e1c8: afa30038 */ sw $v1,0x38($sp)
|
||||
/* f15e1cc: 00003825 */ or $a3,$zero,$zero
|
||||
/* f15e1d0: 01ae2823 */ subu $a1,$t5,$t6
|
||||
/* f15e1d4: 0fc5d5b0 */ jal surface0f1756c0
|
||||
/* f15e1d4: 0fc5d5b0 */ jal tex0f1756c0
|
||||
/* f15e1d8: afb80010 */ sw $t8,0x10($sp)
|
||||
/* f15e1dc: 8fa602dc */ lw $a2,0x2dc($sp)
|
||||
/* f15e1e0: 8fa90040 */ lw $t1,0x40($sp)
|
||||
|
|
@ -9658,7 +9657,7 @@ glabel roomLoad
|
|||
/* f158904: 02788021 */ addu $s0,$s3,$t8
|
||||
/* f158908: 00441823 */ subu $v1,$v0,$a0
|
||||
/* f15890c: 02032823 */ subu $a1,$s0,$v1
|
||||
/* f158910: 0fc5c2e5 */ jal surface0f175ef4
|
||||
/* f158910: 0fc5c2e5 */ jal tex0f175ef4
|
||||
/* f158914: 00603025 */ or $a2,$v1,$zero
|
||||
/* f158918: 26220001 */ addiu $v0,$s1,0x1
|
||||
/* f15891c: 1840000d */ blez $v0,.NB0f158954
|
||||
|
|
@ -9694,7 +9693,7 @@ glabel roomLoad
|
|||
/* f158988: afa602dc */ sw $a2,0x2dc($sp)
|
||||
/* f15898c: afa30034 */ sw $v1,0x34($sp)
|
||||
/* f158990: 00003825 */ or $a3,$zero,$zero
|
||||
/* f158994: 0fc5c0d8 */ jal surface0f1756c0
|
||||
/* f158994: 0fc5c0d8 */ jal tex0f1756c0
|
||||
/* f158998: afb80010 */ sw $t8,0x10($sp)
|
||||
/* f15899c: 8fa602dc */ lw $a2,0x2dc($sp)
|
||||
/* f1589a0: 8fa9003c */ lw $t1,0x3c($sp)
|
||||
|
|
@ -10045,7 +10044,7 @@ const char var7f1b1a60nb[] = "bg.c";
|
|||
// sp208[len] = (s32)allocation + inflatedlen;
|
||||
// allocationend = (s32)allocation + size;
|
||||
//
|
||||
// surface0f175ef4(sp208[0], allocationend - (sp208[len] - sp208[0]), sp208[len] - sp208[0]);
|
||||
// tex0f175ef4(sp208[0], allocationend - (sp208[len] - sp208[0]), sp208[len] - sp208[0]);
|
||||
//
|
||||
// for (i = 0; i < len + 1; i++) {
|
||||
// sp78[i] = sp208[i] + (allocationend - sp208[len]);
|
||||
|
|
@ -10054,7 +10053,7 @@ const char var7f1b1a60nb[] = "bg.c";
|
|||
// a2 = sp208[0];
|
||||
//
|
||||
// for (i = 0; i < len; i++) {
|
||||
// v0 = surface0f1756c0(sp78[i], sp208[i + 1] - sp208[i], a2, 0, sp140[i]);
|
||||
// v0 = tex0f1756c0(sp78[i], sp208[i + 1] - sp208[i], a2, 0, sp140[i]);
|
||||
// sp78[i] = a2;
|
||||
// a2 += v0;
|
||||
// a2 = ALIGN8(a2);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "game/playermgr.h"
|
||||
#include "game/bg.h"
|
||||
#include "game/texdecompress.h"
|
||||
#include "game/surface.h"
|
||||
#include "bss.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "game/game_1531a0.h"
|
||||
#include "game/file.h"
|
||||
#include "game/texdecompress.h"
|
||||
#include "game/surface.h"
|
||||
#include "game/tex.h"
|
||||
#include "game/modeldef.h"
|
||||
#include "game/lang.h"
|
||||
#include "game/mplayer/mplayer.h"
|
||||
|
|
@ -148,7 +148,7 @@ glabel modeldef0f1a7560
|
|||
/* f1a75f8: 02644023 */ subu $t0,$s3,$a0
|
||||
/* f1a75fc: 00684821 */ addu $t1,$v1,$t0
|
||||
/* f1a7600: afa90084 */ sw $t1,0x84($sp)
|
||||
/* f1a7604: 0fc5d7bd */ jal surface0f175ef4
|
||||
/* f1a7604: 0fc5d7bd */ jal tex0f175ef4
|
||||
/* f1a7608: 00732821 */ addu $a1,$v1,$s3
|
||||
/* f1a760c: 8fbe00a0 */ lw $s8,0xa0($sp)
|
||||
/* f1a7610: 8e640018 */ lw $a0,0x18($s3)
|
||||
|
|
@ -199,7 +199,7 @@ glabel modeldef0f1a7560
|
|||
/* f1a76b0: 01f82021 */ addu $a0,$t7,$t8
|
||||
/* f1a76b4: 02802825 */ or $a1,$s4,$zero
|
||||
/* f1a76b8: 03c03825 */ or $a3,$s8,$zero
|
||||
/* f1a76bc: 0fc5d5b0 */ jal surface0f1756c0
|
||||
/* f1a76bc: 0fc5d5b0 */ jal tex0f1756c0
|
||||
/* f1a76c0: afa30010 */ sw $v1,0x10($sp)
|
||||
/* f1a76c4: 8fa80074 */ lw $t0,0x74($sp)
|
||||
/* f1a76c8: 02a2a821 */ addu $s5,$s5,$v0
|
||||
|
|
|
|||
2640
src/game/surface.c
2640
src/game/surface.c
File diff suppressed because it is too large
Load Diff
3174
src/game/tex.c
3174
src/game/tex.c
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,575 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "game/atan2f.h"
|
||||
#include "game/tex.h"
|
||||
#include "game/playermgr.h"
|
||||
#include "game/bg.h"
|
||||
#include "game/texdecompress.h"
|
||||
#include "bss.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
s32 texGetMask(s32 value)
|
||||
{
|
||||
if (value < 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (value < 3) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (value < 5) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (value < 9) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (value < 17) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (value < 33) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (value < 65) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (value < 129) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
s32 tex0f0b33f8(s32 width, s32 height, s32 lod)
|
||||
{
|
||||
s32 sum = 0;
|
||||
|
||||
if (lod <= 0) {
|
||||
lod = 1;
|
||||
}
|
||||
|
||||
while (lod > 0) {
|
||||
sum += (width + 15) / 16 * 4 * height;
|
||||
|
||||
lod--;
|
||||
|
||||
if (width >= 2) {
|
||||
width >>= 1;
|
||||
}
|
||||
|
||||
if (height >= 2) {
|
||||
height >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
s32 tex0f0b3468(s32 width, s32 height, s32 lod)
|
||||
{
|
||||
s32 sum = 0;
|
||||
|
||||
if (lod <= 0) {
|
||||
lod = 1;
|
||||
}
|
||||
|
||||
while (lod > 0) {
|
||||
sum += (width + 7) / 8 * 4 * height;
|
||||
|
||||
lod--;
|
||||
|
||||
if (width >= 2) {
|
||||
width >>= 1;
|
||||
}
|
||||
|
||||
if (height >= 2) {
|
||||
height >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
s32 tex0f0b34d8(s32 width, s32 height, s32 lod)
|
||||
{
|
||||
s32 sum = 0;
|
||||
|
||||
if (lod <= 0) {
|
||||
lod = 1;
|
||||
}
|
||||
|
||||
while (lod > 0) {
|
||||
sum += (width + 3) / 4 * 4 * height;
|
||||
|
||||
lod--;
|
||||
|
||||
if (width >= 2) {
|
||||
width >>= 1;
|
||||
}
|
||||
|
||||
if (height >= 2) {
|
||||
height >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
s32 tex0f0b3548(s32 width, s32 height, s32 lod)
|
||||
{
|
||||
s32 sum = 0;
|
||||
|
||||
if (lod <= 0) {
|
||||
lod = 1;
|
||||
}
|
||||
|
||||
while (lod > 0) {
|
||||
sum += (width + 3) / 4 * 4 * height;
|
||||
|
||||
lod--;
|
||||
|
||||
if (width >= 2) {
|
||||
width >>= 1;
|
||||
}
|
||||
|
||||
if (height >= 2) {
|
||||
height >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
void texSetRenderMode(Gfx **gdlptr, s32 arg1, s32 numcycles, s32 arg3)
|
||||
{
|
||||
Gfx *gdl = *gdlptr;
|
||||
|
||||
if (numcycles == 1) {
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
|
||||
switch (arg1) {
|
||||
default:
|
||||
case 1:
|
||||
if (arg3) {
|
||||
if (arg3 >= 2) {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_OPA_DECAL, G_RM_AA_ZB_OPA_DECAL2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
|
||||
}
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (arg3) {
|
||||
if (arg3 >= 2) {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_DECAL, G_RM_AA_ZB_XLU_DECAL2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2);
|
||||
}
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (arg3) {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_TEX_EDGE, G_RM_AA_TEX_EDGE2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (arg3) {
|
||||
gDPSetRenderMode(gdl++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_2CYCLE);
|
||||
|
||||
switch (arg1) {
|
||||
default:
|
||||
case 1:
|
||||
if (arg3) {
|
||||
if (arg3 >= 2) {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_ZB_OPA_DECAL2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_ZB_OPA_SURF2);
|
||||
}
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_OPA_SURF2);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (arg3) {
|
||||
if (arg3 >= 2) {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
|
||||
}
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_XLU_SURF2);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (arg3) {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_ZB_TEX_EDGE2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_AA_TEX_EDGE2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (arg3) {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_ZB_CLD_SURF2);
|
||||
} else {
|
||||
gDPSetRenderMode(gdl++, G_RM_PASS, G_RM_CLD_SURF2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*gdlptr = gdl;
|
||||
}
|
||||
|
||||
void texLoadFromConfig(struct textureconfig *config)
|
||||
{
|
||||
if ((u32)config->texturenum < NUM_TEXTURES) {
|
||||
texLoadFromConfigs(config, 1, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void texSelect(Gfx **gdlptr, struct textureconfig *tconfig, u32 arg2, s32 arg3, u32 ulst, bool arg5, struct texturething *arg6)
|
||||
{
|
||||
struct texloadthing *s4;
|
||||
Gfx *gdl;
|
||||
s32 tile;
|
||||
|
||||
gdl = *gdlptr;
|
||||
|
||||
if (tconfig == NULL) {
|
||||
texSetRenderMode(&gdl, arg2, 1, arg3);
|
||||
|
||||
if (arg3 >= 2) {
|
||||
gSPTextureL(gdl++, 0xffff, 0xffff, 0, arg3, G_TX_RENDERTILE, G_ON);
|
||||
} else {
|
||||
gSPTextureL(gdl++, 0xffff, 0xffff, 0, 0, G_TX_RENDERTILE, G_ON);
|
||||
}
|
||||
|
||||
gDPSetCombineMode(gdl++, G_CC_SHADE, G_CC_SHADE);
|
||||
} else {
|
||||
s32 width = tconfig->width;
|
||||
s32 height = tconfig->height;
|
||||
u16 *ptr;
|
||||
s32 index;
|
||||
u8 format;
|
||||
u8 depth;
|
||||
s32 lutmode;
|
||||
s32 depth2;
|
||||
s32 lrs;
|
||||
s32 line;
|
||||
u16 texturenum;
|
||||
|
||||
s4 = NULL;
|
||||
|
||||
if (tconfig->texturenum < NUM_TEXTURES) {
|
||||
texLoadFromConfigs(tconfig, 1, arg6, 0);
|
||||
}
|
||||
|
||||
if (tconfig->unk0b == 1) {
|
||||
ptr = (u16 *)tconfig->textureptr;
|
||||
texturenum = ((u16 *)PHYS_TO_K0(ptr))[-4];
|
||||
index = tconfig - g_TexWallhitConfigs;
|
||||
|
||||
if (index >= 0 && index < g_TexNumConfigs) {
|
||||
s4 = g_TexWords[index];
|
||||
}
|
||||
|
||||
if (s4 == NULL) {
|
||||
s4 = tex0f172e8c(texturenum, arg6);
|
||||
|
||||
if (index >= 0 && index < g_TexNumConfigs) {
|
||||
g_TexWords[index] = s4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tconfig->level == 0) {
|
||||
if (s4) {
|
||||
format = s4->gbiformat;
|
||||
depth = s4->depth;
|
||||
lutmode = s4->lutmodeindex << G_MDSFT_TEXTLUT;
|
||||
} else {
|
||||
format = tconfig->format;
|
||||
depth = tconfig->depth;
|
||||
}
|
||||
|
||||
switch (depth) {
|
||||
default:
|
||||
break;
|
||||
case G_IM_SIZ_32b:
|
||||
depth2 = G_IM_SIZ_32b;
|
||||
lrs = tex0f0b3548(width, height, 1) - 1;
|
||||
line = (width + 3) >> 2;
|
||||
break;
|
||||
case G_IM_SIZ_16b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b34d8(width, height, 1) - 1;
|
||||
line = (width + 3) >> 2;
|
||||
break;
|
||||
case G_IM_SIZ_8b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b3468(width, height, 1) - 1;
|
||||
line = (width + 7) >> 3;
|
||||
break;
|
||||
case G_IM_SIZ_4b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b33f8(width, height, 1) - 1;
|
||||
line = (width + 15) >> 4;
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg5) {
|
||||
texSetRenderMode(&gdl, arg2, 1, arg3);
|
||||
|
||||
if (arg3 >= 2) {
|
||||
gSPTextureL(gdl++, 0xffff, 0xffff, 0, arg3, G_TX_RENDERTILE, G_ON);
|
||||
} else {
|
||||
gSPTextureL(gdl++, 0xffff, 0xffff, 0, 0, G_TX_RENDERTILE, G_ON);
|
||||
}
|
||||
|
||||
gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
|
||||
switch (format) {
|
||||
case G_IM_FMT_RGBA:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
case G_IM_FMT_IA:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
case G_IM_FMT_I:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
break;
|
||||
case G_IM_FMT_CI:
|
||||
switch (lutmode) {
|
||||
case G_TT_RGBA16:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
case G_TT_IA16:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gDPSetTextureImage(gdl++, format, depth2, 1, tconfig->textureptr);
|
||||
|
||||
if (depth2 == G_IM_SIZ_16b) {
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadBlock(gdl++, G_TX_LOADTILE, 0, 0, lrs, 0);
|
||||
} else {
|
||||
gDPSetTile(gdl++, G_IM_FMT_RGBA, depth2, 0, 0x0000, 5, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadBlock(gdl++, 5, 0, 0, lrs, 0);
|
||||
}
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
|
||||
if (format == G_IM_FMT_CI) {
|
||||
u32 a3 = lrs + 1;
|
||||
u32 t0 = (0x3ff - s4->unk0a) < a3 ? (0x3ff - s4->unk0a) : 0;
|
||||
|
||||
a3 -= t0;
|
||||
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadTLUT06(gdl++, a3, t0, s4->unk0a + a3, t0);
|
||||
gDPPipeSync(gdl++);
|
||||
|
||||
if (arg5) {
|
||||
gDPSetTextureLUT(gdl++, lutmode);
|
||||
}
|
||||
} else {
|
||||
if (arg5) {
|
||||
gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg5) {
|
||||
gDPSetTile(gdl++, format, depth, line, 0x0000, G_TX_RENDERTILE, 0,
|
||||
tconfig->t, texGetMask(height), G_TX_NOLOD,
|
||||
tconfig->s, texGetMask(width), G_TX_NOLOD);
|
||||
|
||||
gDPSetTileSize(gdl++, G_TX_RENDERTILE, ulst, ulst, ((width - 1) << 2) + ulst, ((height - 1) << 2) + ulst);
|
||||
}
|
||||
} else {
|
||||
s32 tmem = 0;
|
||||
s32 lod = tconfig->level;
|
||||
u8 format;
|
||||
u8 depth;
|
||||
s32 lutmode;
|
||||
s32 depth2;
|
||||
s32 lrs;
|
||||
|
||||
if (lod > 6) {
|
||||
lod = 6;
|
||||
}
|
||||
|
||||
if (s4) {
|
||||
format = s4->gbiformat;
|
||||
depth = s4->depth;
|
||||
lutmode = s4->lutmodeindex << G_MDSFT_TEXTLUT;
|
||||
} else {
|
||||
format = tconfig->format;
|
||||
depth = tconfig->depth;
|
||||
}
|
||||
|
||||
if (s4 && s4->unk0c_02) {
|
||||
tex0f173e50(s4, &depth2, &lrs);
|
||||
} else {
|
||||
switch (depth) {
|
||||
case G_IM_SIZ_32b:
|
||||
depth2 = G_IM_SIZ_32b;
|
||||
lrs = tex0f0b3548(width, height, lod) - 1;
|
||||
break;
|
||||
case G_IM_SIZ_16b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b34d8(width, height, lod) - 1;
|
||||
break;
|
||||
case G_IM_SIZ_8b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b3468(width, height, lod) - 1;
|
||||
break;
|
||||
case G_IM_SIZ_4b:
|
||||
depth2 = G_IM_SIZ_16b;
|
||||
lrs = tex0f0b33f8(width, height, lod) - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg5) {
|
||||
texSetRenderMode(&gdl, arg2, 2, arg3);
|
||||
|
||||
if (arg3 >= 2) {
|
||||
gSPTextureL(gdl++, 0xffff, 0xffff, lod - 1, arg3, G_TX_RENDERTILE, G_ON);
|
||||
} else {
|
||||
gSPTexture(gdl++, 0xffff, 0xffff, lod - 1, G_TX_RENDERTILE, G_ON);
|
||||
}
|
||||
|
||||
gDPSetTextureLOD(gdl++, G_TL_LOD);
|
||||
|
||||
switch (format) {
|
||||
case G_IM_FMT_RGBA:
|
||||
gDPSetCombineMode(gdl++, G_CC_TRILERP, G_CC_MODULATEIA2);
|
||||
break;
|
||||
case G_IM_FMT_IA:
|
||||
gDPSetCombineMode(gdl++, G_CC_TRILERP, G_CC_MODULATEIA2);
|
||||
break;
|
||||
case G_IM_FMT_I:
|
||||
gDPSetCombineMode(gdl++, G_CC_TRILERP, G_CC_MODULATEI2);
|
||||
break;
|
||||
case G_IM_FMT_CI:
|
||||
switch (lutmode) {
|
||||
case G_TT_RGBA16:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
case G_TT_IA16:
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gDPSetTextureImage(gdl++, format, depth2, 1, tconfig->textureptr);
|
||||
|
||||
if (depth2 == G_IM_SIZ_16b) {
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadBlock(gdl++, G_TX_LOADTILE, 0, 0, lrs, 0);
|
||||
} else {
|
||||
gDPSetTile(gdl++, G_IM_FMT_RGBA, depth2, 0, 0x0000, 5, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadBlock(gdl++, 5, 0, 0, lrs, 0);
|
||||
}
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
|
||||
if (format == G_IM_FMT_CI) {
|
||||
u32 a2 = lrs + 1;
|
||||
u32 a3 = (0x3ff - s4->unk0a) < a2 ? (0x3ff - s4->unk0a) : 0;
|
||||
|
||||
a2 -= a3;
|
||||
|
||||
gDPLoadSync(gdl++);
|
||||
gDPLoadTLUT06(gdl++, a2, a3, s4->unk0a + a2, a3);
|
||||
gDPPipeSync(gdl++);
|
||||
|
||||
if (arg5) {
|
||||
gDPSetTextureLUT(gdl++, lutmode);
|
||||
}
|
||||
} else {
|
||||
if (arg5) {
|
||||
gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
for (tile = 0; tile < lod; tile++) {
|
||||
s32 line;
|
||||
|
||||
if (tile > 0) {
|
||||
if (s4 && s4->unk0c_02) {
|
||||
width = texGetWidthAtLod(s4, tile);
|
||||
height = texGetHeightAtLod(s4, tile);
|
||||
} else {
|
||||
if (width >= 2) {
|
||||
width >>= 1;
|
||||
}
|
||||
|
||||
if (height >= 2) {
|
||||
height >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (depth) {
|
||||
default:
|
||||
break;
|
||||
case G_IM_SIZ_32b:
|
||||
line = (width + 3) / 4;
|
||||
break;
|
||||
case G_IM_SIZ_16b:
|
||||
line = (width + 3) / 4;
|
||||
break;
|
||||
case G_IM_SIZ_8b:
|
||||
line = (width + 7) / 8;
|
||||
break;
|
||||
case G_IM_SIZ_4b:
|
||||
line = (width + 15) / 16;
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg5) {
|
||||
gDPSetTile(gdl++, format, depth, line, tmem, tile, 0,
|
||||
tconfig->t, texGetMask(height), tile,
|
||||
tconfig->s, texGetMask(width), tile);
|
||||
|
||||
gDPSetTileSize(gdl++, tile, ulst, ulst, ((width - 1) << 2) + ulst, ((height - 1) << 2) + ulst);
|
||||
}
|
||||
|
||||
tmem += line * height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*gdlptr = gdl;
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
#include "game/game_1531a0.h"
|
||||
#include "game/file.h"
|
||||
#include "game/texdecompress.h"
|
||||
#include "game/surface.h"
|
||||
#include "game/trainingmenus.h"
|
||||
#include "game/training.h"
|
||||
#include "game/lang.h"
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef IN_GAME_SURFACE_H
|
||||
#define IN_GAME_SURFACE_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void surfaceReset(void);
|
||||
|
||||
void surface0f173a08(void);
|
||||
bool surface0f173a44(u32 value);
|
||||
bool surface0f173a70(s32 index, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10);
|
||||
bool surface0f173b8c(s32 index, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
s32 texGetWidthAtLod(struct texloadthing *arg0, s32 lod);
|
||||
s32 texGetHeightAtLod(struct texloadthing *arg0, s32 lod);
|
||||
s32 tex0f173d60(struct texloadthing *arg0, s32 lod);
|
||||
s32 tex0f173e10(struct texloadthing *arg0, s32 lod);
|
||||
void tex0f173e50(struct texloadthing *arg0, s32 *arg1, s32 *arg2);
|
||||
s32 surface0f173f18(s32 arg0);
|
||||
u32 surface0f173f48(u32 arg0);
|
||||
u32 surface0f173f78(void);
|
||||
u32 surface0f1742e4(void);
|
||||
u32 surface0f1743a0(void);
|
||||
u32 surface0f1747a4(void);
|
||||
u32 surface0f174b54(void);
|
||||
u32 surface0f174f30(void);
|
||||
u32 surface0f1751e4(void);
|
||||
u32 surface0f175308(void);
|
||||
u32 surface0f175490(void);
|
||||
u32 surface0f1755dc(void);
|
||||
u32 surface0f17563c(void);
|
||||
s32 surface0f1756c0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
void surface0f175ef4(s32 arg0, s32 arg1, s32 arg2);
|
||||
|
||||
extern const char var7f1b7ba0[];
|
||||
extern const char var7f1b7ba8[];
|
||||
extern const char var7f1b7bb0[];
|
||||
extern const char var7f1b7bb8[];
|
||||
extern const char var7f1b7bc0[];
|
||||
extern const char var7f1b7bc8[];
|
||||
extern const char var7f1b7bd8[];
|
||||
extern const char var7f1b7be0[];
|
||||
extern const char var7f1b7be8[];
|
||||
extern const char var7f1b7bec[];
|
||||
extern const char var7f1b7bf4[];
|
||||
extern const char var7f1b7c00[];
|
||||
extern const char var7f1b7c04[];
|
||||
extern const char var7f1b7c10[];
|
||||
extern const char var7f1b7c18[];
|
||||
|
||||
#endif
|
||||
|
|
@ -6,6 +6,12 @@
|
|||
|
||||
void texInit(void);
|
||||
|
||||
void surfaceReset(void);
|
||||
|
||||
void texSetBitstring(u8 *arg0);
|
||||
s32 texReadBits(s32 arg0);
|
||||
void texReset(void);
|
||||
|
||||
s32 texGetMask(s32 value);
|
||||
s32 tex0f0b33f8(s32 width, s32 height, s32 lod);
|
||||
s32 tex0f0b3468(s32 width, s32 height, s32 lod);
|
||||
|
|
@ -15,4 +21,29 @@ void texSetRenderMode(Gfx **gdlptr, s32 arg1, s32 numcycles, s32 arg3);
|
|||
void texLoadFromConfig(struct textureconfig *config);
|
||||
void texSelect(Gfx **gdl, struct textureconfig *tconfig, u32 arg2, s32 arg3, u32 arg4, bool arg5, struct texturething *arg6);
|
||||
|
||||
void tex0f173a08(void);
|
||||
bool tex0f173a44(u32 value);
|
||||
bool tex0f173a70(s32 index, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10);
|
||||
bool tex0f173b8c(s32 index, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
s32 texGetWidthAtLod(struct texloadthing *arg0, s32 lod);
|
||||
s32 texGetHeightAtLod(struct texloadthing *arg0, s32 lod);
|
||||
s32 tex0f173d60(struct texloadthing *arg0, s32 lod);
|
||||
s32 tex0f173e10(struct texloadthing *arg0, s32 lod);
|
||||
void tex0f173e50(struct texloadthing *arg0, s32 *arg1, s32 *arg2);
|
||||
s32 tex0f173f18(s32 arg0);
|
||||
u32 tex0f173f48(u32 arg0);
|
||||
u32 tex0f173f78(void);
|
||||
u32 tex0f1742e4(void);
|
||||
u32 tex0f1743a0(void);
|
||||
u32 tex0f1747a4(void);
|
||||
u32 tex0f174b54(void);
|
||||
u32 tex0f174f30(void);
|
||||
u32 tex0f1751e4(void);
|
||||
u32 tex0f175308(void);
|
||||
u32 tex0f175490(void);
|
||||
u32 tex0f1755dc(void);
|
||||
u32 tex0f17563c(void);
|
||||
s32 tex0f1756c0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
void tex0f175ef4(s32 arg0, s32 arg1, s32 arg2);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,8 +35,5 @@ void texLoadFromDisplayList(Gfx *gdl, struct texturething *arg1, s32 arg2);
|
|||
void texLoad(u32 *texturenum, struct texturething *arg1, s32 arg2);
|
||||
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texturething *arg2, s32 arg3);
|
||||
void texLoadFromTextureNum(u32 arg0, struct texturething *arg1);
|
||||
void texSetBitstring(u8 *arg0);
|
||||
s32 texReadBits(s32 arg0);
|
||||
void texReset(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue