Skip to content

Commit

Permalink
Merge branch 'develop' into test-things-together-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarge-117 committed Feb 11, 2025
2 parents 51354be + 46c6d2f commit 543b3fb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 33 deletions.
36 changes: 21 additions & 15 deletions soh/soh/Enhancements/Restorations/PauseBufferInputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ static u16 pauseInputs = 0;
#define PAUSE_STATE_OFF 0
#define PAUSE_STATE_OPENING_1 2
#define PAUSE_STATE_UNPAUSE_SETUP 18
#define PAUSE_STATE_SAVEPROMPT 7

void RegisterPauseBufferInputs() {
COND_VB_SHOULD(VB_KALEIDO_UNPAUSE_CLOSE, CVAR_BUFFER_VALUE || CVAR_INCLUDE_VALUE, {
Input* input = &gPlayState->state.input[0];

// Store all inputs that were pressed during the buffer window
pauseInputs |= input->press.button;

// If the user opts to include held inputs in the buffer window, store the held inputs, minus the held inputs when the pause menu was opened
// STEP #3: If the user opts to include held inputs in the buffer window, store the currnently held inputs, minus
// the held inputs when the pause menu was opened. This only applies to the first frame of the buffer window
if (CVAR_INCLUDE_VALUE && inputBufferTimer == 0) {
pauseInputs |= input->cur.button & ~prePauseInputs;
prePauseInputs = 0;
}

// STEP #4: Store all inputs that were pressed during the buffer window
pauseInputs |= input->press.button;

// Wait a specified number of frames before continuing the unpause
inputBufferTimer++;
if (inputBufferTimer < CVAR_BUFFER_VALUE) {
Expand All @@ -54,28 +56,32 @@ void RegisterPauseBufferInputs() {
Input* input = &gPlayState->state.input[0];
PauseContext* pauseCtx = &gPlayState->pauseCtx;

// if the input buffer timer is not 0 and the pause state is off, then the player just unpaused
if (inputBufferTimer != 0 && pauseCtx->state == PAUSE_STATE_OFF) {
// STEP #1: If the user opts to include held inputs in the buffer window, store the held inputs at the beginning
// of the pause process, minus the START input
if (pauseCtx->state == PAUSE_STATE_OPENING_1 && CVAR_INCLUDE_VALUE) {
prePauseInputs = input->cur.button & ~BTN_START;
}

// STEP #2: The unpause process has begun, so let's reset the input buffer timer
if (pauseCtx->state == PAUSE_STATE_UNPAUSE_SETUP || (
pauseCtx->state == PAUSE_STATE_SAVEPROMPT && (pauseCtx->unk_1EC == 2 || pauseCtx->unk_1EC == 5)
)) {
inputBufferTimer = 0;
}

// STEP #5: If the input buffer timer is not 0 and the pause state is off, then the player just unpaused
if (inputBufferTimer != 0 && pauseCtx->state == PAUSE_STATE_OFF) {
// If the user opts into easy frame advance, remove START input
if (CVAR_FRAME_ADVANCE_VALUE) {
pauseInputs &= ~BTN_START;
}

// So we need to re-apply the inputs that were pressed during the buffer window
input->press.button |= pauseInputs;
}

// Reset the timer and stored inputs at the beginning of the unpause process
if (pauseCtx->state == PAUSE_STATE_UNPAUSE_SETUP && pauseCtx->unk_1F4 != 160.0f) {
inputBufferTimer = 0;
// Reset the used variables
pauseInputs = 0;
}

// If the user opts to include held inputs in the buffer window, store the held inputs at the beginning of the pause process, minus the START input
if (pauseCtx->state == PAUSE_STATE_OPENING_1 && CVAR_INCLUDE_VALUE) {
prePauseInputs = input->cur.button & ~BTN_START;
inputBufferTimer = 0;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/randomizer/3drando/hint_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ void StaticData::HintTable_Init() {
/*french*/ "J'admire ce que tu as fait à l'Île Koholint... Toi et moi, nous devrions faire équipe!"));
// /*spanish*/Después de lo que le hiciste a la Isla Koholint, ¿cómo te atreves a llamarme malvado?

hintTextTable[RHT_GANON_JOKE10] = HintText(CustomMessage("Today, let's begin down&'The Hero is Defeated' timeline.",
hintTextTable[RHT_GANON_JOKE11] = HintText(CustomMessage("Today, let's begin down&'The Hero is Defeated' timeline.",
/*german*/ "",
/*french*/ "Si tu me vaincs, Hyrule sera englouti... mais si tu meurs, on aura A Link to the Past, le meilleur opus "
"de la série!"));
Expand Down
44 changes: 29 additions & 15 deletions soh/src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,12 +2141,11 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,
// Note: the viewport x and y values are overwritten below, before usage
static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0,
(PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 };
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172);
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, -84);
static Vec3f lightDir = { 89.8f, 0.0f, 89.8f };
u8 playerSwordAndShield[2];
Gfx* opaRef;
Gfx* xluRef;
Gfx* kalRef;
u16 perspNorm;
Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
Expand All @@ -2155,8 +2154,18 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,

OPEN_DISPS(play->state.gfxCtx);

opaRef = POLY_OPA_DISP;
POLY_OPA_DISP++;

xluRef = POLY_XLU_DISP;
POLY_XLU_DISP++;

gSPDisplayList(WORK_DISP++, POLY_OPA_DISP);
gSPDisplayList(WORK_DISP++, POLY_XLU_DISP);

if (mirrorWorldActive) {
gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING);
gSPSetExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING);
}

gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
Expand All @@ -2170,7 +2179,14 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);

// Also matches if some of the previous graphics commands are moved inside this block too. Possible macro?
if (1) {
s32 pad[2];

gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
}

gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height);
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);

Expand All @@ -2192,8 +2208,8 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,

gDPSetDepthImage(POLY_OPA_DISP++, depthFrameBuffer);

viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * ((1 << 2) / 2);
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * ((1 << 2) / 2);
gSPViewport(POLY_OPA_DISP++, &viewport);

guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
Expand Down Expand Up @@ -2226,28 +2242,26 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);

Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield);

if (CVarGetInteger(CVAR_GENERAL("PauseMenuAnimatedLinkTriforce"), 0)) {
Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield);

if (CVarGetInteger(CVAR_GENERAL("PauseMenuAnimatedLinkTriforce"), 0)) {
Matrix_SetTranslateRotateYXZ(pos->x - (LINK_AGE_IN_YEARS == YEARS_ADULT ? 25 : 0),
pos->y + 280 + (LINK_AGE_IN_YEARS == YEARS_ADULT ? 48 : 0), pos->z, rot);
Matrix_Scale(scale * (mirrorWorldActive ? -1 : 1), scale * 1, scale * 1, MTXMODE_APPLY);

Gfx* ohNo = POLY_XLU_DISP;
POLY_XLU_DISP = POLY_OPA_DISP;

Pause_DrawTriforceSpot(play, 1);

POLY_OPA_DISP = POLY_XLU_DISP;
POLY_XLU_DISP = ohNo;
}

if (mirrorWorldActive) {
gSPClearExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING);
gSPClearExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING);
}

POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP++);
gSPEndDisplayList(POLY_OPA_DISP++);
gSPEndDisplayList(POLY_XLU_DISP++);

gSPBranchList(opaRef, POLY_OPA_DISP);
gSPBranchList(xluRef, POLY_XLU_DISP);

CLOSE_DISPS(play->state.gfxCtx);
}
Expand Down
9 changes: 7 additions & 2 deletions soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,20 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) {
scale = 0.047f;
}

gsSPSetFB(play->state.gfxCtx->polyOpa.p++, gPauseLinkFrameBuffer);
// SOH [Port] Draw the pause Link on a separate framebuffer starting in the work buffer
OPEN_DISPS(play->state.gfxCtx);
gsSPSetFB(WORK_DISP++, gPauseLinkFrameBuffer);

rot.y = 32300;
rot.x = rot.z = 0;
Player_DrawPause(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale,
SWORD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)),
TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)),
SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD)),
BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS)));
gsSPResetFB(play->state.gfxCtx->polyOpa.p++);

gsSPResetFB(WORK_DISP++);
CLOSE_DISPS(play->state.gfxCtx);
}

void KaleidoScope_DrawEquipment(PlayState* play) {
Expand Down

0 comments on commit 543b3fb

Please sign in to comment.