mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-16 15:20:11 -05:00
Fixed Lens of truth and sandstorm to be widescreen (#254)
This commit is contained in:
parent
8c18b4b057
commit
c5f120b6f8
@ -4575,6 +4575,20 @@ _DW({ \
|
||||
_g2->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
|
||||
}
|
||||
|
||||
# define gsSPWideTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{ \
|
||||
(_SHIFTL(G_TEXRECT_WIDE, 24, 8) | _SHIFTL((xh), 0, 24)), \
|
||||
_SHIFTL((yh), 0, 24), \
|
||||
}}, \
|
||||
{{ \
|
||||
(_SHIFTL((tile), 24, 3) | _SHIFTL((xl), 0, 24)), \
|
||||
_SHIFTL((yl), 0, 24), \
|
||||
}}, \
|
||||
{{ \
|
||||
_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16), \
|
||||
_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16) \
|
||||
}}
|
||||
|
||||
/* like gSPTextureRectangle but accepts negative position arguments */
|
||||
#define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
_DW({ \
|
||||
|
@ -289,6 +289,13 @@ extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
|
||||
return (Gfx*)&res->instructions[0];
|
||||
}
|
||||
|
||||
extern "C" Gfx* ResourceMgr_PatchGfxByName(const char* path, int size) {
|
||||
auto res = std::static_pointer_cast<Ship::DisplayList>(
|
||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||
res->instructions.resize(res->instructions.size() + size);
|
||||
return (Gfx*)&res->instructions[0];
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadArrayByName(const char* path)
|
||||
{
|
||||
auto res = std::static_pointer_cast<Ship::Array>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||
|
@ -38,6 +38,7 @@ char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
||||
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||
Gfx* ResourceMgr_PatchGfxByName(const char* path, int size);
|
||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
|
@ -2547,10 +2547,16 @@ void func_80030FA8(GraphicsContext* gfxCtx) {
|
||||
gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0,
|
||||
G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, 384, 224, 892, 732);
|
||||
gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2;
|
||||
s32 w = OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH) << 2;
|
||||
|
||||
float ratio = OTRGetAspectRatio();
|
||||
|
||||
gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, 384, 224, 892, 732);
|
||||
// TODO: Do correct math to fix it
|
||||
gSPWideTextureRectangle(POLY_XLU_DISP++, x, 0, x + abs(x), 960, G_TX_RENDERTILE, 0, 0, 0, 0);
|
||||
gSPWideTextureRectangle(POLY_XLU_DISP++, 0, 0, w, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183);
|
||||
}
|
||||
|
||||
|
@ -145,8 +145,6 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) {
|
||||
|
||||
modelView = this->modelView[this->frame];
|
||||
|
||||
this->color.rgba = 0xFFFFFFFF;
|
||||
|
||||
this->frame ^= 1;
|
||||
gDPPipeSync(gfx++);
|
||||
texScroll = Gfx_BranchTexScroll(&gfx, this->texX, this->texY, 0x10, 0x40);
|
||||
|
@ -2275,6 +2275,29 @@ Color_RGB8 sSandstormEnvColors[] = {
|
||||
{ 50, 40, 0 },
|
||||
};
|
||||
|
||||
Gfx* gFieldSandstormDL_Custom = NULL;
|
||||
|
||||
void Environment_PatchSandstorm(GlobalContext* globalCtx) {
|
||||
if (gFieldSandstormDL_Custom) return;
|
||||
|
||||
gFieldSandstormDL_Custom = ResourceMgr_PatchGfxByName(gFieldSandstormDL, -3);
|
||||
|
||||
const Gfx gFSPatchDL[2] = { gsSPEndDisplayList() };
|
||||
bool patched = false;
|
||||
Gfx* cmd = gFieldSandstormDL_Custom;
|
||||
int id = 0;
|
||||
|
||||
while (!patched) {
|
||||
const uint32_t opcode = cmd->words.w0 >> 24;
|
||||
if (opcode == G_TEXRECT) {
|
||||
gFieldSandstormDL_Custom[id] = gFSPatchDL[0];
|
||||
patched = true;
|
||||
}
|
||||
++cmd;
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) {
|
||||
s32 primA1;
|
||||
s32 envA1;
|
||||
@ -2288,6 +2311,8 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) {
|
||||
u16 sp94;
|
||||
u16 sp92;
|
||||
|
||||
Environment_PatchSandstorm(globalCtx);
|
||||
|
||||
switch (sandstormState) {
|
||||
case 3:
|
||||
if ((globalCtx->sceneNum == SCENE_SPOT13) && (globalCtx->roomCtx.curRoom.num == 0)) {
|
||||
@ -2394,8 +2419,11 @@ void Environment_DrawSandstorm(GlobalContext* globalCtx, u8 sandstormState) {
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (u32)sp96 % 0x1000, 0, 0x200, 0x20, 1, (u32)sp94 % 0x1000,
|
||||
0xFFF - ((u32)sp92 % 0x1000), 0x100, 0x40));
|
||||
gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL_Custom);
|
||||
gSPWideTextureRectangle(POLY_XLU_DISP++, OTRGetRectDimensionFromLeftEdge(0) << 2, 0,
|
||||
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH) << 2, 0x03C0, G_TX_RENDERTILE, 0, 0, 0x008C,
|
||||
-0x008C);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 4068);
|
||||
|
||||
D_8015FDB0 += (s32)sp98;
|
||||
|
@ -295,13 +295,16 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h
|
||||
bg->b.frameH = height * 4;
|
||||
guS2DInitBg(bg);
|
||||
|
||||
gDPSetOtherMode(displayListHead++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
|
||||
gDPSetOtherMode(displayListHead++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE,
|
||||
G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
|
||||
|
||||
gDPSetFillColor(displayListHead++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1));
|
||||
gDPFillWideRectangle(displayListHead++, OTRGetRectDimensionFromLeftEdge(0), 0,
|
||||
OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), SCREEN_HEIGHT);
|
||||
|
||||
gDPSetOtherMode(displayListHead++, mode0 | 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);
|
||||
|
||||
gDPLoadMultiTile(displayListHead++, bg->b.imagePtr, 0,
|
||||
G_TX_RENDERTILE, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, 0, 0, 0, 0 + 31,
|
||||
0 + 31, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
|
||||
|
Loading…
Reference in New Issue
Block a user