diff --git a/include/hud.h b/include/hud.h new file mode 100644 index 00000000..924fce64 --- /dev/null +++ b/include/hud.h @@ -0,0 +1,14 @@ +#pragma once + +#include "gfx.h" +#include "sf64object.h" + +static const ALIGN_ASSET(2) char sBoostGaugeArrow0[] = "__OTR__assets/textures/hud/sBoostGaugeArrow0"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow1[] = "__OTR__assets/textures/hud/sBoostGaugeArrow1"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow2[] = "__OTR__assets/textures/hud/sBoostGaugeArrow2"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow3[] = "__OTR__assets/textures/hud/sBoostGaugeArrow3"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow4[] = "__OTR__assets/textures/hud/sBoostGaugeArrow4"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow5[] = "__OTR__assets/textures/hud/sBoostGaugeArrow5"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow6[] = "__OTR__assets/textures/hud/sBoostGaugeArrow6"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow7[] = "__OTR__assets/textures/hud/sBoostGaugeArrow7"; +static const ALIGN_ASSET(2) char sBoostGaugeArrow8[] = "__OTR__assets/textures/hud/sBoostGaugeArrow8"; \ No newline at end of file diff --git a/port/assets/textures/hud/sBoostGaugeArrow0 b/port/assets/textures/hud/sBoostGaugeArrow0 new file mode 100644 index 00000000..775d711a Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow0 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow1 b/port/assets/textures/hud/sBoostGaugeArrow1 new file mode 100644 index 00000000..42e7dab9 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow1 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow2 b/port/assets/textures/hud/sBoostGaugeArrow2 new file mode 100644 index 00000000..6a0993c1 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow2 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow3 b/port/assets/textures/hud/sBoostGaugeArrow3 new file mode 100644 index 00000000..ce3f64e6 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow3 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow4 b/port/assets/textures/hud/sBoostGaugeArrow4 new file mode 100644 index 00000000..c7966199 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow4 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow5 b/port/assets/textures/hud/sBoostGaugeArrow5 new file mode 100644 index 00000000..627b511b Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow5 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow6 b/port/assets/textures/hud/sBoostGaugeArrow6 new file mode 100644 index 00000000..304c2281 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow6 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow7 b/port/assets/textures/hud/sBoostGaugeArrow7 new file mode 100644 index 00000000..e389976d Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow7 differ diff --git a/port/assets/textures/hud/sBoostGaugeArrow8 b/port/assets/textures/hud/sBoostGaugeArrow8 new file mode 100644 index 00000000..2db15458 Binary files /dev/null and b/port/assets/textures/hud/sBoostGaugeArrow8 differ diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index 530dbacb..e9c57d41 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -2,6 +2,7 @@ #include "global.h" #include "hit64.h" #include "mods.h" +#include "hud.h" #define INIT_EVENT_IDS #include "port/hooks/Events.h" @@ -224,6 +225,7 @@ void OnItemGoldRingUpdate(ObjectUpdateEvent* event){ case 0: if (item->collected) { item->state = 1; + item->timer_48 = 0; gGoldRingCount[0]++; if (gGoldRingCount[0] == 3) { Object_PlayerSfx(gPlayer[item->playerNum].sfxSource, NA_SE_SHIELD_UPGRADE, item->playerNum); @@ -252,6 +254,51 @@ void OnItemGoldRingUpdate(ObjectUpdateEvent* event){ } } +static const char* sBoostGaugeArrow[] = { + sBoostGaugeArrow0, + sBoostGaugeArrow1, + sBoostGaugeArrow2, + sBoostGaugeArrow3, + sBoostGaugeArrow4, + sBoostGaugeArrow5, + sBoostGaugeArrow6, + sBoostGaugeArrow7, + sBoostGaugeArrow8, +}; + +void OnBoostGaugeDraw(IEvent* event){ + bool restore = CVarGetInteger("gRestoreOldBoostGauge", 0) == 1; + + if(!restore){ + return; + } + + event->cancelled = true; + u8 step = MIN(8, (u8) ((gPlayer[0].boostMeter / 90.0f) * ARRAY_COUNT(sBoostGaugeArrow))); + f32 x = 70; + f32 y = 30; + + RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); + Lib_TextureRect_CI8(&gMasterDisp, D_1012290, D_10126B0, 48, 22, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - x), y, 1.0f, 1.0f); + Lib_TextureRect_CI8(&gMasterDisp, D_10126F0, D_1012750, 24, 4, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - (x - 9)), y + 3, 1.0f, 1.0f); + Lib_TextureRect_RGBA16(&gMasterDisp, sBoostGaugeArrow[step], 32, 32, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - (x - 6)), y - 1, 0.9f, 0.9f); +} + +void OnBombCounterDraw(IEvent* ev){ + bool restore = CVarGetInteger("gRestoreOldBoostGauge", 0) == 1; + if(!restore){ + return; + } + + ev->cancelled = true; + HUD_BombCounter_Draw(253.0f, 18.0f); +} + +void OnLivesCounterDraw(IEvent* ev){ + ev->cancelled = CVarGetInteger("gRestoreOldBoostGauge", 0) == 1; +} + void PortEnhancements_Init() { PortEnhancements_Register(); @@ -259,6 +306,9 @@ void PortEnhancements_Init() { REGISTER_LISTENER(DisplayPostUpdateEvent, OnDisplayUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerPostUpdateEvent, OnPlayerUpdatePost, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(DrawBoostGaugeHUDEvent, OnBoostGaugeDraw, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(DrawLivesCounterHUDEvent, OnLivesCounterDraw, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(DrawBombCounterHUDEvent, OnBombCounterDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(ObjectUpdateEvent, OnItemGoldRingUpdate, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(ObjectDrawPostSetupEvent, OnItemGoldRingDraw, EVENT_PRIORITY_NORMAL); diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 5cb3133e..49fe8e2f 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -473,6 +473,10 @@ void DrawEnhancementsMenu() { .tooltip = "Restores the beta coin that got replaced with the gold ring" }); + UIWidgets::CVarCheckbox("Beta: Restore old boost gauge", "gRestoreOldBoostGauge", { + .tooltip = "Restores the old boost gauge that was seen on some beta footage" + }); + ImGui::EndMenu(); }