Added an option to restore the old boost gauge and fixed coin

This commit is contained in:
KiritoDv 2025-01-04 15:40:12 -06:00
parent 37f06a9b38
commit 903cfc811c
12 changed files with 68 additions and 0 deletions

14
include/hud.h Normal file
View File

@ -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";

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,7 @@
#include "global.h" #include "global.h"
#include "hit64.h" #include "hit64.h"
#include "mods.h" #include "mods.h"
#include "hud.h"
#define INIT_EVENT_IDS #define INIT_EVENT_IDS
#include "port/hooks/Events.h" #include "port/hooks/Events.h"
@ -224,6 +225,7 @@ void OnItemGoldRingUpdate(ObjectUpdateEvent* event){
case 0: case 0:
if (item->collected) { if (item->collected) {
item->state = 1; item->state = 1;
item->timer_48 = 0;
gGoldRingCount[0]++; gGoldRingCount[0]++;
if (gGoldRingCount[0] == 3) { if (gGoldRingCount[0] == 3) {
Object_PlayerSfx(gPlayer[item->playerNum].sfxSource, NA_SE_SHIELD_UPGRADE, item->playerNum); 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() { void PortEnhancements_Init() {
PortEnhancements_Register(); PortEnhancements_Register();
@ -259,6 +306,9 @@ void PortEnhancements_Init() {
REGISTER_LISTENER(DisplayPostUpdateEvent, OnDisplayUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DisplayPostUpdateEvent, OnDisplayUpdatePost, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(PlayerPostUpdateEvent, OnPlayerUpdatePost, 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(ObjectUpdateEvent, OnItemGoldRingUpdate, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(ObjectDrawPostSetupEvent, OnItemGoldRingDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(ObjectDrawPostSetupEvent, OnItemGoldRingDraw, EVENT_PRIORITY_NORMAL);

View File

@ -473,6 +473,10 @@ void DrawEnhancementsMenu() {
.tooltip = "Restores the beta coin that got replaced with the gold ring" .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(); ImGui::EndMenu();
} }