mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
Decompile remaining z_vis... files (#131)
* Decompile z_vismono.c / code_800AD920.c - z_vismono.c: OK - code_800AD920.c: OK * Minor fixes in PR #131
This commit is contained in:
parent
461525b40c
commit
d556999b2b
19 changed files with 1682 additions and 911 deletions
|
@ -1,5 +1,8 @@
|
|||
#include <global.h>
|
||||
|
||||
// Note : This file is related to z_vismono, the original name was probably z_vis<something before "mono"
|
||||
// alphabetically>
|
||||
|
||||
Gfx D_8012AC00[] = {
|
||||
gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
|
@ -46,7 +49,7 @@ Gfx D_8012AC58[] = {
|
|||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
// Init func
|
||||
// Init
|
||||
void func_800ACE70(struct_801664F0* this) {
|
||||
this->type = 0;
|
||||
this->setScissor = false;
|
||||
|
@ -56,11 +59,11 @@ void func_800ACE70(struct_801664F0* this) {
|
|||
this->color.a = 0xFF;
|
||||
}
|
||||
|
||||
// Destroy func
|
||||
// Destroy
|
||||
void func_800ACE90(struct_801664F0* this) {
|
||||
}
|
||||
|
||||
// Update func
|
||||
// Draw
|
||||
void func_800ACE98(struct_801664F0* this, Gfx** gfxp) {
|
||||
Gfx* gfx;
|
||||
|
||||
|
|
65
src/code/code_800AD920.c
Normal file
65
src/code/code_800AD920.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include <global.h>
|
||||
|
||||
// Note : This file is related to z_vismono, the original name was probably z_vis<something after "mono" alphabetically>
|
||||
|
||||
// z-buffer
|
||||
extern u16 D_0E000000[];
|
||||
|
||||
// Init
|
||||
void func_800AD920(struct_80166500* this) {
|
||||
this->useRgba = false;
|
||||
this->setScissor = false;
|
||||
this->primColor.r = 0xFF;
|
||||
this->primColor.g = 0xFF;
|
||||
this->primColor.b = 0xFF;
|
||||
this->primColor.a = 0xFF;
|
||||
this->envColor.a = 0xFF;
|
||||
this->envColor.r = 0x00;
|
||||
this->envColor.g = 0x00;
|
||||
this->envColor.b = 0x00;
|
||||
}
|
||||
|
||||
// Destroy
|
||||
void func_800AD950(struct_80166500* this) {
|
||||
}
|
||||
|
||||
// Draw
|
||||
void func_800AD958(struct_80166500* this, Gfx** gfxp) {
|
||||
Gfx* gfx;
|
||||
u16* tex;
|
||||
s32 fmt;
|
||||
s32 y;
|
||||
s32 height = 6;
|
||||
|
||||
gfx = *gfxp;
|
||||
tex = D_0E000000;
|
||||
|
||||
fmt = this->useRgba == false ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
if (this->setScissor == true) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2);
|
||||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT);
|
||||
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba);
|
||||
|
||||
for (y = 0; y <= SCREEN_HEIGHT - height; y += height) {
|
||||
gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gSPTextureRectangle(gfx++, 0, (y) << 2, (SCREEN_WIDTH << 2), (y + height) << 2, G_TX_RENDERTILE, 0, 0,
|
||||
(1 << 10), (1 << 10));
|
||||
tex += SCREEN_WIDTH * height;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxp = gfx;
|
||||
}
|
|
@ -10,8 +10,8 @@ typedef struct {
|
|||
|
||||
SpeedMeter D_801664D0;
|
||||
struct_801664F0 D_801664F0;
|
||||
struct_801664F0 D_80166500;
|
||||
VisMonoStruct sMonoColors;
|
||||
struct_80166500 D_80166500;
|
||||
VisMono sMonoColors;
|
||||
unk_80166528 D_80166528;
|
||||
FaultClient sGameFaultClient;
|
||||
u16 sLastButtonPressed;
|
||||
|
@ -42,18 +42,18 @@ void GameState_SetFBFilter(Gfx** gfx) {
|
|||
D_801664F0.color.a = R_FB_FILTER_A;
|
||||
func_800ACE98(&D_801664F0, &gfxP);
|
||||
} else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
|
||||
D_80166500.type = (R_FB_FILTER_TYPE == 6);
|
||||
D_80166500.color.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
D_80166500.color.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_80166500.color.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_80166500.color.a = R_FB_FILTER_A;
|
||||
D_80166500.useRgba = (R_FB_FILTER_TYPE == 6);
|
||||
D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
D_80166500.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_80166500.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_80166500.primColor.a = R_FB_FILTER_A;
|
||||
D_80166500.envColor.r = R_FB_FILTER_ENV_COLOR(0);
|
||||
D_80166500.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
D_80166500.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
D_80166500.envColor.a = R_FB_FILTER_A;
|
||||
func_800AD958(&D_80166500, &gfxP);
|
||||
} else if (R_FB_FILTER_TYPE == 7) {
|
||||
sMonoColors.colorFormat = 0;
|
||||
sMonoColors.unk_00 = 0;
|
||||
sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
|
||||
sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
|
@ -62,7 +62,7 @@ void GameState_SetFBFilter(Gfx** gfx) {
|
|||
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sMonoColors.envColor.a = R_FB_FILTER_A;
|
||||
func_800AD5C0(&sMonoColors, &gfxP);
|
||||
VisMono_Draw(&sMonoColors, &gfxP);
|
||||
}
|
||||
*gfx = gfxP;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
LogUtils_CheckNullPointer("this->cleanup", gameState->destroy, "../game.c", 1088);
|
||||
func_800ACE70(&D_801664F0);
|
||||
func_800AD920(&D_80166500);
|
||||
func_800AD000(&sMonoColors);
|
||||
VisMono_Init(&sMonoColors);
|
||||
if (SREG(48) == 0) {
|
||||
func_800ACA28(&D_80166528);
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ void GameState_Destroy(GameState* gameState) {
|
|||
SpeedMeter_Destroy(&D_801664D0);
|
||||
func_800ACE90(&D_801664F0);
|
||||
func_800AD950(&D_80166500);
|
||||
func_800AD054(&sMonoColors);
|
||||
VisMono_Destroy(&sMonoColors);
|
||||
if (SREG(48) == 0) {
|
||||
func_800ACA90(&D_80166528);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ Input* D_8012D1F8 = NULL;
|
|||
|
||||
TransitionUnk sTrnsnUnk;
|
||||
s32 gTrnsnUnkState;
|
||||
VisMonoStruct D_80161498;
|
||||
VisMono D_80161498;
|
||||
Color_RGBA8 D_801614B0;
|
||||
FaultClient D_801614B8;
|
||||
s16 D_801614C8;
|
||||
|
@ -174,7 +174,7 @@ void Gameplay_Destroy(GlobalContext* globalCtx) {
|
|||
|
||||
func_800B3968();
|
||||
TransitionFade_Destroy(&globalCtx->transitionFade);
|
||||
func_800AD054(&D_80161498);
|
||||
VisMono_Destroy(&D_80161498);
|
||||
|
||||
if (gSaveContext.linkAge != globalCtx->linkAgeOnLoad) {
|
||||
Inventory_SwapAgeEquipment();
|
||||
|
@ -365,7 +365,7 @@ void Gameplay_Init(GlobalContext* globalCtx) {
|
|||
TransitionFade_SetType(&globalCtx->transitionFade, 3);
|
||||
TransitionFade_SetColor(&globalCtx->transitionFade, RGBA8(0xA0, 0xA0, 0xA0, 0xFF));
|
||||
TransitionFade_Start(&globalCtx->transitionFade);
|
||||
func_800AD000(&D_80161498);
|
||||
VisMono_Init(&D_80161498);
|
||||
D_801614B0.a = 0x00;
|
||||
Flags_UnsetAllEnv(globalCtx);
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
if (D_801614B0.a > 0x00) {
|
||||
D_80161498.primColor.rgba = D_801614B0.rgba;
|
||||
func_800AD5C0(&D_80161498, &gfxP);
|
||||
VisMono_Draw(&D_80161498, &gfxP);
|
||||
}
|
||||
|
||||
gSPEndDisplayList(gfxP++);
|
||||
|
|
|
@ -1,14 +1,142 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD000.s")
|
||||
// Note : This file is related to z_vismono, the original name was probably z_vis<something before "mono"
|
||||
// alphabetically>
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD054.s")
|
||||
// (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture)
|
||||
// Did the devs forget to update this? 1+1+1+80*(7+2+2+3)+1+1 makes more sense
|
||||
#define DLSIZE (1 + 3 + 1 + 1 + 80 * (7 + 2 + 2 + 3) + 1)
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD080.s")
|
||||
// framebuffer
|
||||
extern u16 D_0F000000[];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD394.s")
|
||||
void VisMono_Init(VisMono* this) {
|
||||
bzero(this, sizeof(VisMono));
|
||||
this->unk_00 = 0;
|
||||
this->setScissor = false;
|
||||
this->primColor.r = 0xFF;
|
||||
this->primColor.g = 0xFF;
|
||||
this->primColor.b = 0xFF;
|
||||
this->primColor.a = 0xFF;
|
||||
this->envColor.r = 0x00;
|
||||
this->envColor.g = 0x00;
|
||||
this->envColor.b = 0x00;
|
||||
this->envColor.a = 0x00;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD5C0.s")
|
||||
void VisMono_Destroy(VisMono* this) {
|
||||
SystemArena_FreeDebug(this->monoDl, "../z_vismono.c", 137);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD870.s")
|
||||
void VisMono_UpdateTexture(VisMono* this, u16* tex) {
|
||||
s32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
tex[i] = ((((i >> 3 & 0x1F) * 2 + (i << 2 & 0x1F) * 4) * 0xFF / 0xD9) << 8) |
|
||||
(((i >> 6 & 0x1F) * 4 + (i >> 1 & 0x1F)) * 0xFF / 0xD9);
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* VisMono_DrawTexture(VisMono* this, Gfx* gfx) {
|
||||
s32 y;
|
||||
s32 height = 3;
|
||||
u16* tex;
|
||||
|
||||
tex = D_0F000000;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetOtherMode(gfx++,
|
||||
G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_IA16 | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_2CYCLE | G_PM_1PRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) | G_RM_CLD_SURF2);
|
||||
gDPSetCombineLERP(gfx++, 1, 0, TEXEL1_ALPHA, TEXEL0, 0, 0, 0, 1, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, 0,
|
||||
0, 0, PRIMITIVE);
|
||||
|
||||
for (y = 0; y <= SCREEN_HEIGHT - height; y += height) {
|
||||
gDPLoadTextureBlock(gfx++, tex, G_IM_FMT_CI, G_IM_SIZ_8b, SCREEN_WIDTH * 2, height, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, 80, 0x0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 0, 0);
|
||||
gDPSetTileSize(gfx++, G_TX_RENDERTILE, (2 << 2), 0, (SCREEN_WIDTH * 2 + 1 << 2), (2 << 2));
|
||||
|
||||
gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, 80, 0x0, 1, 1, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 0, 0);
|
||||
gDPSetTileSize(gfx++, 1, (1 << 2), 0, (SCREEN_WIDTH * 2 << 2), (2 << 2));
|
||||
|
||||
gSPTextureRectangle(gfx++, 0, (y) << 2, (SCREEN_WIDTH << 2), (y + height) << 2, G_TX_RENDERTILE, 2 << 5, 0,
|
||||
(2 << 10), (1 << 10));
|
||||
tex += SCREEN_WIDTH * height;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gSPEndDisplayList(gfx++);
|
||||
return gfx;
|
||||
}
|
||||
|
||||
void VisMono_Draw(VisMono* this, Gfx** gfxp) {
|
||||
Gfx* gfx;
|
||||
u16* tlut;
|
||||
Gfx* monoDL;
|
||||
Gfx* glistpEnd;
|
||||
|
||||
gfx = *gfxp;
|
||||
|
||||
if (this->tlut) {
|
||||
tlut = this->tlut;
|
||||
} else {
|
||||
tlut = Graph_DlistAlloc(&gfx, 256 * sizeof(u16));
|
||||
VisMono_UpdateTexture(this, tlut);
|
||||
}
|
||||
|
||||
if (this->monoDl) {
|
||||
monoDL = this->monoDl;
|
||||
} else {
|
||||
monoDL = Graph_DlistAlloc(&gfx, DLSIZE * sizeof(Gfx));
|
||||
glistpEnd = VisMono_DrawTexture(this, monoDL);
|
||||
|
||||
if (!(glistpEnd <= monoDL + DLSIZE)) {
|
||||
LOG_ADDRESS("glistp_end", glistpEnd, "../z_vismono.c", 257);
|
||||
LOG_ADDRESS("mono_dl", monoDL, "../z_vismono.c", 258);
|
||||
LOG_ADDRESS("mono_dl + (1+3+1+1+80*(7+2+2+3)+1)", monoDL + DLSIZE, "../z_vismono.c", 259);
|
||||
LOG_ADDRESS("(1+3+1+1+80*(7+2+2+3)+1)", DLSIZE, "../z_vismono.c", 260);
|
||||
}
|
||||
|
||||
if (!(glistpEnd <= monoDL + DLSIZE)) {
|
||||
__assert("glistp_end <= mono_dl + DLSIZE", "../z_vismono.c", 262);
|
||||
}
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
if (this->setScissor == true) {
|
||||
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba);
|
||||
|
||||
gDPLoadTLUT_pal256(gfx++, tlut);
|
||||
|
||||
gSPDisplayList(gfx++, monoDL);
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
*gfxp = gfx;
|
||||
}
|
||||
|
||||
void VisMono_DrawOld(VisMono* this) {
|
||||
Gfx* glistpEnd;
|
||||
|
||||
if (!this->tlut) {
|
||||
this->tlut = SystemArena_MallocDebug(256 * sizeof(u16), "../z_vismono.c", 283);
|
||||
VisMono_UpdateTexture(this, this->tlut);
|
||||
}
|
||||
|
||||
if (!this->monoDl) {
|
||||
this->monoDl = SystemArena_MallocDebug(DLSIZE * sizeof(Gfx), "../z_vismono.c", 289);
|
||||
glistpEnd = VisMono_DrawTexture(this, this->monoDl);
|
||||
if (!(glistpEnd <= this->monoDl + DLSIZE)) {
|
||||
__assert("glistp_end <= this->mono_dl + DLSIZE", "../z_vismono.c", 292);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue