Skip to content

Commit

Permalink
ADD: 24 Hours Clock + .gitignore on the 2s2h.h (#229)
Browse files Browse the repository at this point in the history
* ADD: 24 Hours Clock

* TWEAK: gitignore
  • Loading branch information
PurpleHato authored Apr 21, 2024
1 parent c826757 commit dc2d311
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 6 deletions.
1 change: 1 addition & 0 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void DrawEnhancementsMenu() {
});
UIWidgets::CVarCheckbox("Skip Entrance Cutscenes", "gEnhancements.TimeSavers.SkipEntranceCutscenes");
UIWidgets::CVarCheckbox("Hide Title Cards", "gEnhancements.TimeSavers.HideTitleCards");
UIWidgets::CVarCheckbox("24 Hours Clock", "gEnhancements.General.24HoursClock");

if (mHudEditorWindow) {
UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow, {
Expand Down
3 changes: 2 additions & 1 deletion mm/assets/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
*.vtx.inc
*.dlist.inc

# Unignore our custom assets
# Unignore our custom assets and header file
!custom/**/*
!2s2h_assets.h
57 changes: 57 additions & 0 deletions mm/assets/2s2h_assets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#include "align_asset_macro.h"

// This file is manually made
// When new assets are added to the soh.otr file
// We need to add the aligned version of the resource names here and use in code
// On Mac, not using aligned resource names was causing crashes in release builds

// textures
#define dgDPad "__OTR__textures/parameter_static/gDPad"
static const ALIGN_ASSET(2) char gDPadTex[] = dgDPad;

#define dgArrowUp "__OTR__textures/parameter_static/gArrowUp"
static const ALIGN_ASSET(2) char gArrowUpTex[] = dgArrowUp;

#define dgArrowDown "__OTR__textures/parameter_static/gArrowDown"
static const ALIGN_ASSET(2) char gArrowDownTex[] = dgArrowDown;

#define dgTriforcePiece "__OTR__textures/parameter_static/gTriforcePiece"
static const ALIGN_ASSET(2) char gTriforcePieceTex[] = dgTriforcePiece;

#define dgThreeDayClockHour13Tex "__OTR__textures/parameter_static/gThreeDayClockHour13Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour13Tex[] = dgThreeDayClockHour13Tex;

#define dgThreeDayClockHour14Tex "__OTR__textures/parameter_static/gThreeDayClockHour14Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour14Tex[] = dgThreeDayClockHour14Tex;

#define dgThreeDayClockHour15Tex "__OTR__textures/parameter_static/gThreeDayClockHour15Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour15Tex[] = dgThreeDayClockHour15Tex;

#define dgThreeDayClockHour16Tex "__OTR__textures/parameter_static/gThreeDayClockHour16Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour16Tex[] = dgThreeDayClockHour16Tex;

#define dgThreeDayClockHour17Tex "__OTR__textures/parameter_static/gThreeDayClockHour17Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour17Tex[] = dgThreeDayClockHour17Tex;

#define dgThreeDayClockHour18Tex "__OTR__textures/parameter_static/gThreeDayClockHour18Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour18Tex[] = dgThreeDayClockHour18Tex;

#define dgThreeDayClockHour19Tex "__OTR__textures/parameter_static/gThreeDayClockHour19Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour19Tex[] = dgThreeDayClockHour19Tex;

#define dgThreeDayClockHour20Tex "__OTR__textures/parameter_static/gThreeDayClockHour20Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour20Tex[] = dgThreeDayClockHour20Tex;

#define dgThreeDayClockHour21Tex "__OTR__textures/parameter_static/gThreeDayClockHour21Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour21Tex[] = dgThreeDayClockHour21Tex;

#define dgThreeDayClockHour22Tex "__OTR__textures/parameter_static/gThreeDayClockHour22Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour22Tex[] = dgThreeDayClockHour22Tex;

#define dgThreeDayClockHour23Tex "__OTR__textures/parameter_static/gThreeDayClockHour23Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour23Tex[] = dgThreeDayClockHour23Tex;

#define dgThreeDayClockHour24Tex "__OTR__textures/parameter_static/gThreeDayClockHour24Tex"
static const ALIGN_ASSET(2) char gThreeDayClockHour24Tex[] = dgThreeDayClockHour24Tex;
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ static const ALIGN_ASSET(2) char gQuestIconDungeonMapTex[] = dgQuestIconDungeonM
#define dgQuestIconGoldSkulltula2Tex "__OTR__icon_item_24_static_yar/gQuestIconGoldSkulltula2Tex"
static const ALIGN_ASSET(2) char gQuestIconGoldSkulltula2Tex[] = dgQuestIconGoldSkulltula2Tex;

#define dgQuestIconSmallMagicJarTex "__OTR__icon_item_24_static_yar/gQuestIconSmallMagicJarTex"
static const ALIGN_ASSET(2) char gQuestIconSmallMagicJarTex[] = dgQuestIconSmallMagicJarTex;

#define dgQuestIconSmallKeyTex "__OTR__icon_item_24_static_yar/gQuestIconSmallKeyTex"
static const ALIGN_ASSET(2) char gQuestIconSmallKeyTex[] = dgQuestIconSmallKeyTex;

#define dgQuestIconSmallMagicJarTex "__OTR__icon_item_24_static_yar/gQuestIconSmallMagicJarTex"
static const ALIGN_ASSET(2) char gQuestIconSmallMagicJarTex[] = dgQuestIconSmallMagicJarTex;

#define dgQuestIconBigMagicJarTex "__OTR__icon_item_24_static_yar/gQuestIconBigMagicJarTex"
static const ALIGN_ASSET(2) char gQuestIconBigMagicJarTex[] = dgQuestIconBigMagicJarTex;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions mm/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "BenPort.h"
#include <string.h>
#include "BenGui/HudEditor.h"
#include "2s2h_assets.h"
#include "Enhancements/GameInteractor/GameInteractor.h"

// #region 2S2H [Port] Asset tables we can pull from instead of from ROM
Expand Down Expand Up @@ -4850,6 +4851,17 @@ void Interface_DrawClock(PlayState* play) {
gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex,
gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex,
gEmptyTexture, gEmptyTexture, // 2S2H [Port] To account for the vanilla bug detailed later on in this function
};
// 2S2H Region [Enhancements] 24 Hours Clock
static TexturePtr sThreeDayClockHourTwentyHourHoursTextures[] = {
gThreeDayClockHour24Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex,
gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex,
gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex,
gThreeDayClockHour12Tex, gThreeDayClockHour13Tex, gThreeDayClockHour14Tex, gThreeDayClockHour15Tex,
gThreeDayClockHour16Tex, gThreeDayClockHour17Tex, gThreeDayClockHour18Tex, gThreeDayClockHour19Tex,
gThreeDayClockHour20Tex, gThreeDayClockHour21Tex, gThreeDayClockHour22Tex, gThreeDayClockHour23Tex,
gEmptyTexture, gEmptyTexture, // 2S2H [Port] To account for the vanilla bug detailed later on in this function
// #endregison
};
static s16 sClockInvDiamondPrimRed = 0;
static s16 sClockInvDiamondPrimGreen = 155;
Expand Down Expand Up @@ -5212,7 +5224,9 @@ void Interface_DrawClock(PlayState* play) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[24], 8, 0);

OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
OVERLAY_DISP = CVarGetInteger("gEnhancements.General.24HoursClock", 0) ?
Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTwentyHourHoursTextures[sp1C6], 4, 16, 11, 0) :
Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);

// Colours the Three-Day Clocks's Hour Digit Above the Sun
gDPPipeSync(OVERLAY_DISP++);
Expand All @@ -5236,7 +5250,10 @@ void Interface_DrawClock(PlayState* play) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[32], 8, 0);

OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
OVERLAY_DISP = CVarGetInteger("gEnhancements.General.24HoursClock", 0) ?
Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTwentyHourHoursTextures[sp1C6], 4, 16, 11, 0) :
Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);


// Colours the Three-Day Clocks's Hour Digit Above the Moon
gDPPipeSync(OVERLAY_DISP++);
Expand Down

0 comments on commit dc2d311

Please sign in to comment.