Option to add outlines to ships in radar (#156)
Some checks failed
GenerateBuilds / generate-port-o2r (push) Has been cancelled
GenerateBuilds / build-windows (push) Has been cancelled
GenerateBuilds / build-macos (push) Has been cancelled
GenerateBuilds / build-linux (push) Has been cancelled

* Add outlines to ships in radar

* Move Outline feature to hooks

* Missing semicolon
This commit is contained in:
Kiloku 2025-02-10 21:40:30 -03:00 committed by GitHub
parent a466e0d75a
commit 1b534ccd70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 80 additions and 7 deletions

View File

@ -1885,17 +1885,21 @@ void HUD_RadarMark_Draw(s32 type) {
} else {
arwingMarkColor = arwingMarkColor * 2;
}
CALL_CANCELLABLE_EVENT(DrawRadarMarkArwingEvent, arwingMarkColor) {
HUD_RadarMark_Arwing_Draw(arwingMarkColor);
}
break;
case RADARMARK_WOLF:
case RADARMARK_LEON:
case RADARMARK_PIGMA:
case RADARMARK_ANDREW:
{ //This won't compile without braces, for some reason.
CALL_CANCELLABLE_EVENT(DrawRadarMarkWolfenEvent) {
HUD_RadarMark_StarWolf_Draw();
}
break;
}
case RADARMARK_KATT:
HUD_RadarMark_Katt_Draw();
break;

View File

@ -15,6 +15,8 @@ DEFINE_EVENT(PlayerPreUpdateEvent, Player* player;);
DEFINE_EVENT(PlayerPostUpdateEvent, Player* player;);
DEFINE_EVENT(DrawRadarHUDEvent);
DEFINE_EVENT(DrawRadarMarkArwingEvent, s32 colorIdx;);
DEFINE_EVENT(DrawRadarMarkWolfenEvent);
DEFINE_EVENT(DrawBoostGaugeHUDEvent);
DEFINE_EVENT(DrawBombCounterHUDEvent);
DEFINE_EVENT(DrawIncomingMsgHUDEvent);

View File

@ -3,6 +3,7 @@
#include "hit64.h"
#include "mods.h"
#include "hud.h"
#include "assets/ast_star_wolf.h"
#define INIT_EVENT_IDS
#include "port/hooks/Events.h"
@ -318,6 +319,64 @@ void OnPreSetupRadioMsgEvent(PreSetupRadioMsgEvent* ev){
}
}
void OnRadarMarkArwingDraw(DrawRadarMarkArwingEvent* ev){
bool outlines = CVarGetInteger("gFighterOutlines", 0);
if (!outlines){
return;
}
ev->event.cancelled = true;
s32 arwingMarkColor[][4] = {
{ 177, 242, 12, 255 }, { 89, 121, 6, 128 }, { 90, 90, 255, 255 }, { 45, 45, 128, 128 },
{ 0, 179, 67, 255 }, { 0, 90, 34, 128 }, { 255, 30, 0, 255 }, { 128, 15, 0, 128 },
};
f32 var_fv1;
f32 var_fv2;
if (gCamCount != 1) {
var_fv1 = 38.0f;
var_fv2 = 38.0f;
} else {
var_fv1 = 54.0f;
var_fv2 = 54.0f;
}
RCP_SetupDL(&gMasterDisp, SETUPDL_62);
gDPSetPrimColor(gMasterDisp++, 0, 0,0,0,0,255);
Matrix_Scale(gGfxMatrix, var_fv1, var_fv2, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aRadarMarkArwingDL);
gDPSetPrimColor(gMasterDisp++, 0, 0, arwingMarkColor[ev->colorIdx][0], arwingMarkColor[ev->colorIdx][1],
arwingMarkColor[ev->colorIdx][2], arwingMarkColor[ev->colorIdx][3]);
Matrix_Translate(gGfxMatrix, 0.0f, 1.0f, 0.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, 0.8f, 0.7f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aRadarMarkArwingDL);
}
void OnRadarMarkWolfenDraw(IEvent* ev) {
bool outlines = CVarGetInteger("gFighterOutlines", 0);
if (!outlines){
return;
}
ev->cancelled = true;
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL);
gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255);
Matrix_Translate(gGfxMatrix, 0.0f, -1.2f, 0.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, 0.9f, 0.8f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL);
}
void OnLivesCounterDraw(IEvent* ev){
bool restore = CVarGetInteger("gRestoreBetaBoostGauge", 0) == 1;
if(!restore){
@ -347,6 +406,8 @@ void PortEnhancements_Init() {
REGISTER_LISTENER(DrawLivesCounterHUDEvent, OnLivesCounterDraw, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(DrawBombCounterHUDEvent, OnBombCounterDraw, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(PreSetupRadioMsgEvent, OnPreSetupRadioMsgEvent, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(DrawRadarMarkArwingEvent, OnRadarMarkArwingDraw, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(DrawRadarMarkWolfenEvent, OnRadarMarkWolfenDraw, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(ObjectUpdateEvent, OnItemGoldRingUpdate, EVENT_PRIORITY_NORMAL);
REGISTER_LISTENER(ObjectDrawPostSetupEvent, OnItemGoldRingDraw, EVENT_PRIORITY_NORMAL);
@ -375,6 +436,8 @@ void PortEnhancements_Register() {
REGISTER_EVENT(PlayerPostUpdateEvent);
REGISTER_EVENT(DrawRadarHUDEvent);
REGISTER_EVENT(DrawRadarMarkArwingEvent);
REGISTER_EVENT(DrawRadarMarkWolfenEvent);
REGISTER_EVENT(DrawBoostGaugeHUDEvent);
REGISTER_EVENT(DrawBombCounterHUDEvent);
REGISTER_EVENT(DrawIncomingMsgHUDEvent);

View File

@ -567,6 +567,10 @@ void DrawEnhancementsMenu() {
.tooltip = "Gorgon flashes the screen repeatedly when firing its beam or when teleporting, which causes eye pain for some players and may be harmful to those with photosensitivity.",
.defaultValue = false
});
UIWidgets::CVarCheckbox("Add outline to Arwing and Wolfen in radar", "gFighterOutlines", {
.tooltip = "Increases visibility of ships in the radar.",
.defaultValue = false
});
ImGui::EndMenu();
}