1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-29 08:16:11 +00:00

more cleanup around Room_DrawBackground2D

This commit is contained in:
Dragorn421 2022-06-16 17:50:38 +02:00
parent 685c06e913
commit 6e39368186
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
5 changed files with 16 additions and 17 deletions

View file

@ -1,6 +1,6 @@
<Root>
<File Name="icon_item_field_static" Segment="12">
<Texture Name="gWorldMapImageTex" OutName="world_map_image" Format="ci8" Width="216" Height="128" Offset="0x0"/>
<Texture Name="gWorldMapImageTex" OutName="world_map_image" Format="ci8" Width="216" Height="128" Offset="0x0" TlutOffset="0x6C00"/>
<Texture Name="gWorldMapImageTLUT" OutName="world_map_image_tlut" Format="rgba16" Width="16" Height="16" Offset="0x6C00"/>
<Texture Name="gWorldMapDotTex" OutName="world_map_dot" Format="ia8" Width="8" Height="8" Offset="0x6E00"/>
<Texture Name="gWorldMapAreaBox1Tex" OutName="world_map_area_box_1" Format="ia4" Width="32" Height="19" Offset="0x6E40"/>

View file

@ -1162,7 +1162,7 @@ Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
void func_80095974(GraphicsContext* gfxCtx);
void func_80095AA0(PlayState* play, Room* room, Input* input, s32 arg3);
void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode,
u16 tlutCount, f32 offsetX, f32 offsetY);
void func_80096FD4(PlayState* play, Room* room);
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx);

View file

@ -103,7 +103,7 @@ typedef struct {
/* 0x16 */ u16 height;
/* 0x18 */ u8 fmt;
/* 0x19 */ u8 siz;
/* 0x1A */ u16 mode0;
/* 0x1A */ u16 tlutMode;
/* 0x1C */ u16 tlutCount;
} MeshHeader1Single; // size = 0x20
@ -117,7 +117,7 @@ typedef struct {
/* 0x12 */ u16 height;
/* 0x14 */ u8 fmt;
/* 0x15 */ u8 siz;
/* 0x16 */ u16 mode0;
/* 0x16 */ u16 tlutMode;
/* 0x18 */ u16 tlutCount;
} BgImage; // size = 0x1C

View file

@ -271,7 +271,7 @@ s32 Room_DecodeJpeg(void* data) {
return 0;
}
void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode,
u16 tlutCount, f32 offsetX, f32 offsetY) {
Gfx* gfx = *gfxP;
uObjBg* bg;
@ -306,7 +306,7 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
bg->b.frameW = width * (1 << 2);
bg->b.frameH = height * (1 << 2);
guS2DInitBg(bg);
gDPSetOtherMode(gfx++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
gDPSetOtherMode(gfx++, tlutMode | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
gSPBgRectCopy(gfx++, bg);
@ -317,8 +317,8 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
bg->s.scaleH = 1 << 10;
bg->s.imageYorig = bg->b.imageY;
gDPSetOtherMode(gfx++,
mode0 | G_AD_DISABLE | G_CD_DISABLE | 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,
tlutMode | G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TL_TILE |
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA));
@ -371,7 +371,7 @@ void Room_Draw1Single(PlayState* play, Room* room, u32 flags) {
Camera_GetSkyboxOffset(&offset, activeCam);
Room_DrawBackground2D(&gfx, meshHeader1Single->source, meshHeader1Single->tlut,
meshHeader1Single->width, meshHeader1Single->height, meshHeader1Single->fmt,
meshHeader1Single->siz, meshHeader1Single->mode0, meshHeader1Single->tlutCount,
meshHeader1Single->siz, meshHeader1Single->tlutMode, meshHeader1Single->tlutCount,
(offset.x + offset.z) * 1.2f + offset.y * 0.6f,
offset.y * 2.4f + (offset.x + offset.z) * 0.3f);
POLY_OPA_DISP = gfx;
@ -465,7 +465,7 @@ void Room_Draw1Multi(PlayState* play, Room* room, u32 flags) {
gfx = POLY_OPA_DISP;
Camera_GetSkyboxOffset(&offset, activeCam);
Room_DrawBackground2D(&gfx, bgImage->source, bgImage->tlut, bgImage->width, bgImage->height,
bgImage->fmt, bgImage->siz, bgImage->mode0, bgImage->tlutCount,
bgImage->fmt, bgImage->siz, bgImage->tlutMode, bgImage->tlutCount,
(offset.x + offset.z) * 1.2f + offset.y * 0.6f,
offset.y * 2.4f + (offset.x + offset.z) * 0.3f);
POLY_OPA_DISP = gfx;

View file

@ -526,17 +526,16 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
} else if (HREG(15) == 1) {
Gfx* sp1CC = POLY_OPA_DISP;
void* mapImage = gWorldMapImageTex;
Gfx* gfx = POLY_OPA_DISP;
gSPLoadUcodeL(sp1CC++, gspS2DEX2d_fifo);
gSPLoadUcodeL(gfx++, gspS2DEX2d_fifo);
Room_DrawBackground2D(&sp1CC, mapImage, gWorldMapImageTLUT, 216, 128, G_IM_FMT_CI, G_IM_SIZ_8b, 0x8000, 256,
HREG(13) / 100.0f, HREG(14) / 100.0f);
Room_DrawBackground2D(&gfx, gWorldMapImageTex, gWorldMapImageTLUT, 216, 128, G_IM_FMT_CI, G_IM_SIZ_8b,
G_TT_RGBA16, 256, HREG(13) / 100.0f, HREG(14) / 100.0f);
gSPLoadUcode(sp1CC++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
POLY_OPA_DISP = sp1CC;
POLY_OPA_DISP = gfx;
}
if (HREG(15) == 2) {