Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve better song of double time experience #963

Merged
merged 6 commits into from
Jan 27, 2025
Merged
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
3 changes: 2 additions & 1 deletion mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,8 @@ void BenMenu::AddEnhancements() {
.CVar("gEnhancements.Songs.BetterSongOfDoubleTime")
.Options(CheckboxOptions().Tooltip(
"When playing the Song of Double Time, you can now choose the exact time you want to go "
"to, similar to the 3DS version."));
"to, similar to the 3DS version.\n\n"
"Holding Z allows decreasing the time adjustment factor, while holding R will increase the factor"));
AddWidget(path, "Enable Sun's Song", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Songs.EnableSunsSong")
.Options(CheckboxOptions().Tooltip(
Expand Down
25 changes: 18 additions & 7 deletions mm/2s2h/BenGui/HudEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern "C" int16_t OTRGetRectDimensionFromLeftEdge(float v);
extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v);

HudEditorElementID hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
HudEditorElementMode hudEditorOverrideNextElemMode = HUD_EDITOR_ELEMENT_MODE_NONE;

HudEditorElement hudEditorElements[HUD_EDITOR_ELEMENT_MAX] = {
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_B, "B Button", "B", 167, 17, 100, 255, 120, 255),
Expand All @@ -30,25 +31,35 @@ HudEditorElement hudEditorElements[HUD_EDITOR_ELEMENT_MAX] = {
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER, "Skulltulas", "Skulltulas", 26, 190, 255, 255, 255, 255),
};

// Allows specifying an override mode to the next active element.
// Must be called again with HUD_EDITOR_ELEMENT_MODE_NONE when done overriding.
extern "C" void HudEditor_OverrideNextElementMode(HudEditorElementMode mode) {
hudEditorOverrideNextElemMode = mode;
}

extern "C" bool HudEditor_ShouldOverrideDraw() {
return hudEditorActiveElement != HUD_EDITOR_ELEMENT_NONE &&
CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) !=
HUD_EDITOR_ELEMENT_MODE_VANILLA;
(hudEditorOverrideNextElemMode != HUD_EDITOR_ELEMENT_MODE_NONE
? hudEditorOverrideNextElemMode
: CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar,
HUD_EDITOR_ELEMENT_MODE_VANILLA)) != HUD_EDITOR_ELEMENT_MODE_VANILLA;
}

extern "C" void HudEditor_SetActiveElement(HudEditorElementID id) {
hudEditorActiveElement = id;
}

extern "C" bool HudEditor_IsActiveElementHidden() {
return hudEditorActiveElement != HUD_EDITOR_ELEMENT_NONE
? CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) ==
HUD_EDITOR_ELEMENT_MODE_HIDDEN
: false;
return hudEditorActiveElement != HUD_EDITOR_ELEMENT_NONE &&
(hudEditorOverrideNextElemMode != HUD_EDITOR_ELEMENT_MODE_NONE
? hudEditorOverrideNextElemMode
: CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar,
HUD_EDITOR_ELEMENT_MODE_VANILLA)) == HUD_EDITOR_ELEMENT_MODE_HIDDEN;
}

extern "C" f32 HudEditor_GetActiveElementScale() {
return hudEditorActiveElement != HUD_EDITOR_ELEMENT_NONE
return (hudEditorActiveElement != HUD_EDITOR_ELEMENT_NONE &&
hudEditorOverrideNextElemMode == HUD_EDITOR_ELEMENT_MODE_NONE)
? CVarGetFloat(hudEditorElements[hudEditorActiveElement].scaleCvar, 1.0f)
: 1.0f;
}
Expand Down
2 changes: 2 additions & 0 deletions mm/2s2h/BenGui/HudEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ typedef enum {
} HudEditorElementID;

typedef enum {
HUD_EDITOR_ELEMENT_MODE_NONE = -1,
HUD_EDITOR_ELEMENT_MODE_VANILLA,
HUD_EDITOR_ELEMENT_MODE_HIDDEN,
HUD_EDITOR_ELEMENT_MODE_MOVABLE_43,
HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT,
HUD_EDITOR_ELEMENT_MODE_MOVABLE_RIGHT,
} HudEditorElementMode;

void HudEditor_OverrideNextElementMode(HudEditorElementMode mode);
void HudEditor_SetActiveElement(HudEditorElementID id);
bool HudEditor_ShouldOverrideDraw();
bool HudEditor_IsActiveElementHidden();
Expand Down
8 changes: 7 additions & 1 deletion mm/2s2h/Enhancements/Graphics/3DSClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ void Draw3DSClock() {

sThreeDayClockAlpha = gPlayState->interfaceCtx.bAlpha;

OPEN_DISPS(gPlayState->state.gfxCtx);
s16 posX = 160;
s16 posY = 210;

OPEN_DISPS(gPlayState->state.gfxCtx);

Gfx_SetupDL42_Overlay(gPlayState->state.gfxCtx);
gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);

// Draw background of 3DS clock
// TODO: Replace this with matrix/vertex handling to avoid gaps when scaled
OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadow(
Expand Down
4 changes: 3 additions & 1 deletion mm/2s2h/Enhancements/Graphics/TextBasedClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ void DrawTextBasedClock() {
s16 posX = 13 * 8;
s16 posY = 26 * 8;

HudEditor_ModifyRectPosValues(&posX, &posY);
if (HudEditor_ShouldOverrideDraw()) {
HudEditor_ModifyRectPosValues(&posX, &posY);
}

// scale back down and clamp to avoid negative values
posX = std::max(posX / 8, 0);
Expand Down
Loading
Loading