Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mm/2s2h/BenPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ extern "C" uint32_t Ship_GetInterpolationFPS() {
return OTRGlobals::Instance->GetInterpolationFPS();
}

// Number of interpolated frames
extern "C" uint32_t Ship_GetInterpolationFrameCount() {
return ceil((float)Ship_GetInterpolationFPS() / 20.0f);
}

struct ExtensionEntry {
std::string path;
std::string ext;
Expand Down Expand Up @@ -909,8 +914,12 @@ void RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>
// Process window events for resize, mouse, keyboard events
wnd->HandleEvents();

auto intp = wnd->GetInterpreterWeak().lock().get();
intp->mInterpolationIndex = 0;

for (const auto& m : mtx_replacements) {
wnd->DrawAndRunGraphicsCommands(Commands, m);
intp->mInterpolationIndex++;
}
}

Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/BenPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void Controller_UnblockGameInput();
void Overlay_DisplayText(float duration, const char* text);
void Overlay_DisplayText_Seconds(int seconds, const char* text);
uint32_t Ship_GetInterpolationFPS();
uint32_t Ship_GetInterpolationFrameCount();

void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement);
void Gfx_UnregisterBlendedTexture(const char* name);
Expand Down
4 changes: 2 additions & 2 deletions mm/2s2h/Rando/DrawFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void DrawEnLight(Color_RGB8 flameColor, Vec3f flameSize) {
Matrix_ReplaceRotation(&gPlayState->billboardMtxF);

gSPSegment(POLY_XLU_DISP++, 0x08,
(uintptr_t)Gfx_TwoTexScroll(gPlayState->state.gfxCtx, 0, 0, 0, 0x10, 0x20, 1, (unk_144 * 2) & 0x3F,
(unk_144 * -6) & 0x7F, 0x10, 0x20));
(uintptr_t)Gfx_TwoTexScrollEx(gPlayState->state.gfxCtx, 0, 0, 0, 0x10, 0x20, 1, (unk_144 * 2) & 0x3F,
(unk_144 * -6) & 0x7F, 0x10, 0x20, 0, 0, 2, -6));
sp68 = (Gfx*)gameplay_keep_DL_01ACF0;
gDPSetPrimColor(POLY_XLU_DISP++, 0xC0, 0xC0, flameColor.r, flameColor.g, flameColor.b, 0);
gDPSetEnvColor(POLY_XLU_DISP++, flameColor.r, flameColor.g, flameColor.b, 0);
Expand Down
12 changes: 6 additions & 6 deletions mm/2s2h/Rando/DrawItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ void DrawMilkRefill() {
Gfx_SetupDL25_Opa(gPlayState->state.gfxCtx);

gSPSegment(POLY_OPA_DISP++, 0x08,
(uintptr_t)Gfx_TwoTexScroll(gPlayState->state.gfxCtx, G_TX_RENDERTILE, -gPlayState->state.frames,
gPlayState->state.frames, 32, 32, 1, -gPlayState->state.frames,
gPlayState->state.frames, 32, 32));
(uintptr_t)Gfx_TwoTexScrollEx(gPlayState->state.gfxCtx, G_TX_RENDERTILE, -gPlayState->state.frames,
gPlayState->state.frames, 32, 32, 1, -gPlayState->state.frames,
gPlayState->state.frames, 32, 32, -1, 1, -1, 1));
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, gPlayState->state.gfxCtx);
// Container Color
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
Expand Down Expand Up @@ -290,9 +290,9 @@ void DrawSkulltulaToken(RandoItemId randoItemId, Actor* actor) {
}

gSPSegment(POLY_XLU_DISP++, 0x08,
(uintptr_t)Gfx_TwoTexScroll(gPlayState->state.gfxCtx, G_TX_RENDERTILE, gPlayState->state.frames * 0,
-(gPlayState->state.frames * 5), 32, 32, 1, gPlayState->state.frames * 0,
gPlayState->state.frames * 0, 32, 64));
(uintptr_t)Gfx_TwoTexScrollEx(gPlayState->state.gfxCtx, G_TX_RENDERTILE, gPlayState->state.frames * 0,
-(gPlayState->state.frames * 5), 32, 32, 1, gPlayState->state.frames * 0,
gPlayState->state.frames * 0, 32, 64, 0, -5, 0, 0));
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gPlayState->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gSkulltulaTokenFlameCopyDL);

Expand Down
4 changes: 4 additions & 0 deletions mm/include/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height);
void func_8012CB04(Gfx** gfxP, u32 x, u32 y);
Gfx* func_8012CB28(GraphicsContext* gfxCtx, u32 x, u32 y);
Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height);
Gfx* Gfx_TexScrollEx(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height, s32 xStep, s32 yStep);
Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
u32 y2, s32 width2, s32 height2);
Gfx* Gfx_TwoTexScrollEx(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
u32 y2, s32 width2, s32 height2, s32 xStep1, s32 yStep1, s32 xStep2, s32 yStep2);
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2,
u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a);
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
Expand All @@ -106,6 +109,7 @@ void gSPSegmentLoadRes(void* value, int segNum, uintptr_t target);
// void gDPSetTextureImage(Gfx* pkt, u32 format, u32 size, u32 width, uintptr_t i);
// void gDPSetTextureImageFB(Gfx* pkt, u32 format, u32 size, u32 width, int fb);
void gSPDisplayList(Gfx* pkt, Gfx* dl);
void gDPSetTileSizeInterp(Gfx* pkt, int t, float uls, float ult, float lrs, float lrt);
void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset);
void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0);
void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr);
Expand Down
14 changes: 14 additions & 0 deletions mm/src/code/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,20 @@ void gSPDisplayList(Gfx* pkt, Gfx* dl) {
__gSPDisplayList(pkt, dl);
}

void gDPSetTileSizeInterp(Gfx* pkt, int t, float uls, float ult, float lrs, float lrt) {
__gDPSetTileSizeInterp(pkt, t, 0, 0, 0, 0);
pkt->words.w0 = _SHIFTL(G_SETTILESIZE_INTERP, 24, 8);
pkt++;

pkt->words.w0 = *(u32*)&uls;
pkt->words.w1 = *(u32*)&ult;
pkt++;

pkt->words.w0 = *(u32*)&lrs;
pkt->words.w1 = *(u32*)&lrt;
pkt++;
}

void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset) {
char* imgData = (char*)dl;

Expand Down
13 changes: 7 additions & 6 deletions mm/src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -5393,8 +5393,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
// Setup to draw ice over frozen actor

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0,
(gameplayFrames * 2) & 0xFF, 64, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0,
(gameplayFrames * 2) & 0xFF, 64, 32, 0, 1, 0, 2));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255);
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL);

Expand Down Expand Up @@ -5451,8 +5451,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
FrameInterpolation_RecordOpenChild(bodyPartsPos, type);
twoTexScrollParam = ((bodyPartIndex * 3) + gameplayFrames);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, twoTexScrollParam * 3, twoTexScrollParam * -12,
32, 64, 1, 0, 0, 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, 0, twoTexScrollParam * 3, twoTexScrollParam * -12,
32, 64, 1, 0, 0, 32, 32, 3, -12, 0, 0));

Matrix_Translate(bodyPartsPos->x, bodyPartsPos->y, bodyPartsPos->z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Expand Down Expand Up @@ -5499,8 +5499,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[]
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, type, (u8)alpha);

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
((bodyPartIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128));
Gfx_TwoTexScrollEx(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
((bodyPartIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128, 0, 0,
0, -20));

Matrix_RotateYF(M_PIf, MTXMODE_APPLY);
currentMatrix->mf[3][0] = bodyPartsPos->x;
Expand Down
34 changes: 18 additions & 16 deletions mm/src/code/z_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ void GetItem_DrawPoes(PlayState* play, s16 drawId) {
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]);

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0, 16,
32, 1, play->state.frames, -(play->state.frames * 6), 16, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0,
16, 32, 1, play->state.frames, -(play->state.frames * 6), 16, 32, 0, 0, 1, -6));

Matrix_Push();
Matrix_ReplaceRotation(&play->billboardMtxF);
Expand Down Expand Up @@ -442,8 +442,8 @@ void GetItem_DrawFairyBottle(PlayState* play, s16 drawId) {
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0, 32,
32, 1, play->state.frames, -(play->state.frames * 6), 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0,
32, 32, 1, play->state.frames, -(play->state.frames * 6), 32, 320, 0, 0, 1, -6));

Matrix_Push();
Matrix_ReplaceRotation(&play->billboardMtxF);
Expand All @@ -469,8 +469,9 @@ void GetItem_DrawSkullToken(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, -(play->state.frames * 5),
32, 32, 1, play->state.frames * 0, play->state.frames * 0, 32, 64));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0,
-(play->state.frames * 5), 32, 32, 1, play->state.frames * 0, play->state.frames * 0,
32, 64, 0, -5, 0, 0));
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]);

Expand Down Expand Up @@ -503,8 +504,8 @@ void GetItem_DrawPotion(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);

gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -play->state.frames, play->state.frames, 32, 32, 1,
-play->state.frames, play->state.frames, 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, -play->state.frames, play->state.frames, 32, 32,
1, -play->state.frames, play->state.frames, 32, 32, -1, 1, -1, 1));
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]);
Expand All @@ -528,8 +529,8 @@ void GetItem_DrawGoronSword(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);

gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 1, play->state.frames * 0, 32,
32, 1, play->state.frames * 0, play->state.frames * 0, 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 1, play->state.frames * 0,
32, 32, 1, play->state.frames * 0, play->state.frames * 0, 32, 32, 1, 0, 0, 0));
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]);

Expand All @@ -544,8 +545,8 @@ void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);

gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 6, play->state.frames * 6, 32,
32, 1, play->state.frames * 6, play->state.frames * 6, 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 6, play->state.frames * 6,
32, 32, 1, play->state.frames * 6, play->state.frames * 6, 32, 32, 6, 6, 6, 6));
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]);

Expand All @@ -560,8 +561,9 @@ void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, -(play->state.frames * 3),
32, 32, 1, play->state.frames * 0, -(play->state.frames * 2), 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0,
-(play->state.frames * 3), 32, 32, 1, play->state.frames * 0,
-(play->state.frames * 2), 32, 32, 0, -3, 0, -2));
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[0]);

Expand All @@ -576,8 +578,8 @@ void GetItem_DrawFish(PlayState* play, s16 drawId) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);

gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 1, 32,
32, 1, play->state.frames * 0, play->state.frames * 1, 32, 32));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 1,
32, 32, 1, play->state.frames * 0, play->state.frames * 1, 32, 32, 0, 1, 0, 1));
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[0]);

Expand Down
3 changes: 2 additions & 1 deletion mm/src/code/z_fireobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ void FireObj_Draw(PlayState* play, FireObj* fire) {

Gfx_SetupDL25_Xlu(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->timer * -20) % 512U, 32, 128));
Gfx_TwoTexScrollEx(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->timer * -20) % 512U, 32, 128, 0,
0, 0, -20));

gDPSetPrimColor(POLY_XLU_DISP++, 0, fireColors->lod, fireColors->primColor.r, fireColors->primColor.g,
fireColors->primColor.b, fireColors->primColor.a);
Expand Down
5 changes: 3 additions & 2 deletions mm/src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2967,8 +2967,9 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA);
gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1,
(u32)sp94 % 4096, 4095 - ((u32)sp92 % 4096), 256, 64));
Gfx_TwoTexScrollEx(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1,
(u32)sp94 % 4096, 4095 - ((u32)sp92 % 4096), 256, 64, sp98, 0, sp98 * 1.5f,
-sp98));
gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE);
// #region 2S2H [Widescreen] Widescreen Sandstorm
// gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); // Original Dlist call
Expand Down
Loading
Loading