From 9bce23cb0728a997b3af1168d548b3c13691fc71 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Wed, 5 Feb 2025 01:33:10 -0600 Subject: [PATCH 01/10] Fixed wrong offsets --- assets/yaml/cn/{rev0 => rev1}/ast_audio.yaml | 4 +-- config.yml | 31 +++++++++++++++++++- src/port/extractor/GameExtractor.cpp | 2 ++ 3 files changed, 34 insertions(+), 3 deletions(-) rename assets/yaml/cn/{rev0 => rev1}/ast_audio.yaml (92%) diff --git a/assets/yaml/cn/rev0/ast_audio.yaml b/assets/yaml/cn/rev1/ast_audio.yaml similarity index 92% rename from assets/yaml/cn/rev0/ast_audio.yaml rename to assets/yaml/cn/rev1/ast_audio.yaml index e6bb775a..67d19af2 100644 --- a/assets/yaml/cn/rev0/ast_audio.yaml +++ b/assets/yaml/cn/rev1/ast_audio.yaml @@ -9,8 +9,8 @@ audio_setup: type: NAUDIO:V1:AUDIO_SETUP driver: SF64 audio_seq: - size: 0x3AFD0 - offset: 0xE9950 + size: 0x3AB10 + offset: 0xDD890 audio_bank: size: 0x1CB20 offset: 0x1183A0 diff --git a/config.yml b/config.yml index 33cec5b7..3c4b0d50 100644 --- a/config.yml +++ b/config.yml @@ -118,4 +118,33 @@ d064229a32cc05ab85e2381ce07744eb3ffaf530: # - include/sf64mesg.h # - include/sf64audio_external.h # - include/sf64event.h - # - include/sf64player. \ No newline at end of file + # - include/sf64player.h + +c8a10699dea52f4bb2e2311935c1376dfb352e7a: + name: Star Fox 64 (CN) (V1.1) (Compressed) + preprocess: + decompress_mio0: + method: mio0-comptool + type: decompress + target: 3a05aba5549fa71e8b16a0c6e2c8481b070818a9 + restart: true + +3a05aba5549fa71e8b16a0c6e2c8481b070818a9: + name: Star Fox 64 (CN) (V1.1) + path: assets/yaml/cn/rev1 + config: + gbi: F3DEX + sort: OFFSET + logging: INFO + output: + binary: ./mods/sf64cn.o2r + code: src/cn/assets + headers: include/assets + modding: src/cn/assets + # enums: + # - include/sf64object.h + # - include/sf64level.h + # - include/sf64mesg.h + # - include/sf64audio_external.h + # - include/sf64event.h + # - include/sf64player.h \ No newline at end of file diff --git a/src/port/extractor/GameExtractor.cpp b/src/port/extractor/GameExtractor.cpp index e4c2864d..4b325a33 100644 --- a/src/port/extractor/GameExtractor.cpp +++ b/src/port/extractor/GameExtractor.cpp @@ -16,6 +16,8 @@ std::unordered_map mGameList = { { "d064229a32cc05ab85e2381ce07744eb3ffaf530", "Star Fox 64 (J) (V1.0) (Uncompressed)" }, { "05b307b8804f992af1a1e2fbafbd588501fdf799", "Star Fox 64 (E) (V1.0)" }, { "09f5d5c14219fc77a36c5a6ad5e63f7abd8b3385", "Star Fox 64 (E) (V1.0) (Uncompressed)" }, + { "c8a10699dea52f4bb2e2311935c1376dfb352e7a", "Star Fox 64 (C) (V1.1)" }, + { "3a05aba5549fa71e8b16a0c6e2c8481b070818a9", "Star Fox 64 (C) (V1.1) (Uncompressed)" }, }; bool GameExtractor::SelectGameFromUI() { From 6a52c9a2ae9290247062744bb9e69f6b6c3b49c9 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Wed, 5 Feb 2025 01:33:55 -0600 Subject: [PATCH 02/10] Bump LUS --- libultraship | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libultraship b/libultraship index e641b377..b7040484 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit e641b3777cbefb18a9cf4b95353d650b3a2abf65 +Subproject commit b7040484f185de8409dfd559f37a43da50d60a28 From fb130d48ba92e2f72e51b3d10d53bbab6e9478e5 Mon Sep 17 00:00:00 2001 From: Jed Date: Sun, 2 Feb 2025 19:19:14 -0800 Subject: [PATCH 03/10] Fix invuln cheat on Solar and terrain. --- src/engine/fox_play.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index df77f166..ff6f09cb 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -974,6 +974,10 @@ void Player_ApplyDamage(Player* player, s32 direction, s32 damage) { Vec3f sp38; f32 sp34 = 20.0f; + if (CVarGetInteger("gInvincible", 0)) { + damage = 0; + } + player->dmgType = damage; player->hitDirection = direction; @@ -6945,7 +6949,9 @@ void Play_UpdateLevel(void) { } if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && ((gGameFrameCount & cycleMask) == 0)) { - gPlayer[0].shields--; + if (!CVarGetInteger("gInvincible", 0)) { + gPlayer[0].shields--; + } if (gPlayer[0].shields <= 0) { gPlayer[0].shields = 0; } From e3378709e46b1d849550072296ed0bbea0ffa536 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sun, 2 Feb 2025 23:00:59 -0300 Subject: [PATCH 04/10] Add Debug Pause --- src/engine/fox_play.c | 5 +++-- src/port/ui/ImguiUI.cpp | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index ff6f09cb..e080d479 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -7167,8 +7167,9 @@ void Play_Main(void) { } gDrawMode = DRAW_PLAY; - - Play_Update(); + if (CVarGetInteger("gDebugPause", 0) == 0){ + Play_Update(); + } if ((gControllerPress[gMainController].button & START_BUTTON) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 122c446b..4091a943 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -713,6 +713,10 @@ void DrawDebugMenu() { .tooltip = "Jump to credits at the main menu" }); + if (gGameState == GSTATE_PLAY){ + UIWidgets::CVarCheckbox("Debug Pause", "gDebugPause"); + } + if (CVarGetInteger(StringHelper::Sprintf("gCheckpoint.%d.Set", gCurrentLevel).c_str(), 0)) { if (UIWidgets::Button("Clear Checkpoint")) { CVarClear(StringHelper::Sprintf("gCheckpoint.%d.Set", gCurrentLevel).c_str()); From dd9c8107143650a311e389d85c2f9824c9caca61 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sun, 2 Feb 2025 23:23:42 -0300 Subject: [PATCH 05/10] Disable debug pause on init --- src/port/mods/PortEnhancements.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index 3c156bec..bae0e695 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -331,6 +331,9 @@ void PortEnhancements_Init() { REGISTER_LISTENER(PlayerActionBrakeEvent, OnPlayerBrake, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerActionPostShootEvent, OnPlayerShootPost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerActionPreShootChargedEvent, OnPlayerShootChargedPre, EVENT_PRIORITY_NORMAL); + + //If we close the game while debug pause is active, we want it to be deactivated when we run again. + CVarSetInteger("gDebugPause", 0); } void PortEnhancements_Register() { From 3f028c979e3634bdc63d349d7afd30e219d7786f Mon Sep 17 00:00:00 2001 From: Kiloku Date: Mon, 10 Feb 2025 18:46:43 -0300 Subject: [PATCH 06/10] Move Debug Pause to Hooks! --- src/engine/fox_play.c | 2 +- src/port/hooks/list/EngineEvent.h | 2 ++ src/port/mods/PortEnhancements.c | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index e080d479..9d501d66 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -7167,7 +7167,7 @@ void Play_Main(void) { } gDrawMode = DRAW_PLAY; - if (CVarGetInteger("gDebugPause", 0) == 0){ + CALL_CANCELLABLE_EVENT(PlayUpdateEvent){ Play_Update(); } diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index 50db9c83..e968e8a0 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -9,6 +9,8 @@ DEFINE_EVENT(DisplayPostUpdateEvent); DEFINE_EVENT(GamePreUpdateEvent); DEFINE_EVENT(GamePostUpdateEvent); +DEFINE_EVENT(PlayUpdateEvent); + DEFINE_EVENT(PlayerPreUpdateEvent, Player* player;); DEFINE_EVENT(PlayerPostUpdateEvent, Player* player;); diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index bae0e695..042da8e8 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -163,6 +163,10 @@ void OnGameUpdatePost(IEvent* event) { } } +void OnPlayUpdateEvent(IEvent* event){ + event->cancelled = CVarGetInteger("gDebugPause", 0); +} + void RefillBoostMeter(Player* player) { if (player->boostMeter > 1.0f) { player->boostMeter = 1.0f; @@ -318,6 +322,7 @@ void PortEnhancements_Init() { // Register event listeners REGISTER_LISTENER(DisplayPostUpdateEvent, OnDisplayUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(PlayUpdateEvent, OnPlayUpdateEvent, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerPostUpdateEvent, OnPlayerUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawBoostGaugeHUDEvent, OnBoostGaugeDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawLivesCounterHUDEvent, OnLivesCounterDraw, EVENT_PRIORITY_NORMAL); @@ -344,6 +349,8 @@ void PortEnhancements_Register() { REGISTER_EVENT(GamePreUpdateEvent); REGISTER_EVENT(GamePostUpdateEvent); + REGISTER_EVENT(PlayUpdateEvent); + REGISTER_EVENT(PlayerPreUpdateEvent); REGISTER_EVENT(PlayerPostUpdateEvent); From 9b9cf0ca5ad05ba85181cb575f39c343caf434f0 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sat, 8 Feb 2025 16:27:06 -0300 Subject: [PATCH 07/10] Option to show red message box from enemies --- src/engine/fox_radio.c | 50 ++++++++++++++++++++++++++++++++++++++++- src/port/ui/ImguiUI.cpp | 1 + 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 87ee7f7d..2678495a 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -174,7 +174,7 @@ void func_radio_800BAAE8(void) { sRadioUseRedBox = false; mirror = false; - + bool enemyRedRadio = CVarGetInteger("gEnemyRedRadio", 0); switch (gCurrentRadioPortrait) { case RCID_FOX_RED: sRadioUseRedBox = true; @@ -232,105 +232,139 @@ void func_radio_800BAAE8(void) { break; case RCID_WOLF: radioPortraitTex = D_STAR_WOLF_F00B580; + sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF + 1: radioPortraitTex = D_STAR_WOLF_F00C4A0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA: radioPortraitTex = D_STAR_WOLF_F003C80; + sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA + 1: radioPortraitTex = D_STAR_WOLF_F004BA0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON: radioPortraitTex = D_STAR_WOLF_F007900; + sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON + 1: radioPortraitTex = D_STAR_WOLF_F008820; + sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW: radioPortraitTex = D_STAR_WOLF_F000000; + sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW + 1: radioPortraitTex = D_STAR_WOLF_F000F20; + sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF_2: radioPortraitTex = D_STAR_WOLF_F00D3C0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF_2 + 1: radioPortraitTex = D_STAR_WOLF_F00E2E0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA_2: radioPortraitTex = D_STAR_WOLF_F005AC0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA_2 + 1: radioPortraitTex = D_STAR_WOLF_F0069E0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON_2: radioPortraitTex = D_STAR_WOLF_F009740; + sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON_2 + 1: radioPortraitTex = D_STAR_WOLF_F00A660; + sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW_2: radioPortraitTex = D_STAR_WOLF_F001E40; + sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW_2 + 1: radioPortraitTex = D_STAR_WOLF_F002D60; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA: radioPortraitTex = D_CO_6026420; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA + 1: radioPortraitTex = D_CO_6027340; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA2: radioPortraitTex = D_CO_60245E0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA2 + 1: radioPortraitTex = D_CO_6025500; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_METEO: radioPortraitTex = D_ME_601C8E0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_METEO + 1: radioPortraitTex = D_ME_601D800; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_AREA6: radioPortraitTex = D_A6_60047E0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_AREA6 + 1: radioPortraitTex = D_A6_6005700; + sRadioUseRedBox = enemyRedRadio; break; case RCID_CAIMAN_AREA6: radioPortraitTex = D_A6_60029A0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_CAIMAN_AREA6 + 1: radioPortraitTex = D_A6_60038C0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_ZONESS: radioPortraitTex = D_ZO_6014510; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_ZONESS + 1: radioPortraitTex = D_ZO_6015430; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORX: radioPortraitTex = D_SX_6020FB0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORX + 1: radioPortraitTex = D_SX_6021ED0; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORY: radioPortraitTex = D_SY_6018F30; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORY + 1: radioPortraitTex = D_SY_6019E50; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_MACBETH: radioPortraitTex = D_MA_6010C20; + sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_MACBETH + 1: radioPortraitTex = D_MA_6011B40; + sRadioUseRedBox = enemyRedRadio; break; case RCID_ROB64_RED: sRadioUseRedBox = true; @@ -423,6 +457,20 @@ void func_radio_800BAAE8(void) { if (((s32) gRadioMsgRadioId == RCID_ANDROSS) || ((s32) gRadioMsgRadioId == RCID_ANDROSS_RED)) { sRadioUseRedBox = true; } + if (enemyRedRadio) + { //This ensures the box stays red when the message is closing and already showing static in the portrait. + if (gRadioMsgRadioId == RCID_BOSS_CORNERIA || gRadioMsgRadioId == RCID_BOSS_CORNERIA2 || + gRadioMsgRadioId == RCID_BOSS_METEO || gRadioMsgRadioId == RCID_BOSS_SECTORX || + gRadioMsgRadioId == RCID_BOSS_SECTORY || gRadioMsgRadioId == RCID_BOSS_MACBETH || + gRadioMsgRadioId == RCID_BOSS_ZONESS || gRadioMsgRadioId == RCID_BOSS_AREA6 || + gRadioMsgRadioId == RCID_CAIMAN_AREA6 || gRadioMsgRadioId == RCID_WOLF || + gRadioMsgRadioId == RCID_PIGMA || gRadioMsgRadioId == RCID_LEON || + gRadioMsgRadioId == RCID_ANDREW || gRadioMsgRadioId == RCID_WOLF_2 || + gRadioMsgRadioId == RCID_PIGMA_2 || gRadioMsgRadioId == RCID_LEON_2 || + gRadioMsgRadioId == RCID_ANDREW_2) { + sRadioUseRedBox = true; + } + } break; } if ((radioPortraitTex != NULL) && (gRadioPortraitScaleY != 0.0f)) { diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 4091a943..937751ad 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -473,6 +473,7 @@ void DrawEnhancementsMenu() { .tooltip = "Character heads are displayed inside Arwings in all cutscenes", .defaultValue = true }); + UIWidgets::CVarCheckbox("Use red radio backgrounds for enemies.", "gEnemyRedRadio"); UIWidgets::CVarSliderInt("Cockpit Glass Opacity: %d", "gCockpitOpacity", 0, 255, 120); From 2b9b3875391994d1884c98ce7bb1286480e189ef Mon Sep 17 00:00:00 2001 From: Kiloku Date: Mon, 10 Feb 2025 18:30:17 -0300 Subject: [PATCH 08/10] Move Radio Message changes to Hooks --- src/engine/fox_radio.c | 51 ++----------------------------- src/port/hooks/list/EngineEvent.h | 1 + src/port/mods/PortEnhancements.c | 21 +++++++++++++ 3 files changed, 24 insertions(+), 49 deletions(-) diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 2678495a..ef83004d 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -18,6 +18,7 @@ #include "assets/ast_area_6.h" #include "assets/ast_title.h" #include "assets/ast_zoness.h" +#include "port/hooks/Events.h" u16** gRadioMsgList; s32 gRadioMsgListIndex; @@ -174,7 +175,7 @@ void func_radio_800BAAE8(void) { sRadioUseRedBox = false; mirror = false; - bool enemyRedRadio = CVarGetInteger("gEnemyRedRadio", 0); + CALL_EVENT(PreSetupRadioMsgEvent, &sRadioUseRedBox); switch (gCurrentRadioPortrait) { case RCID_FOX_RED: sRadioUseRedBox = true; @@ -232,139 +233,105 @@ void func_radio_800BAAE8(void) { break; case RCID_WOLF: radioPortraitTex = D_STAR_WOLF_F00B580; - sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF + 1: radioPortraitTex = D_STAR_WOLF_F00C4A0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA: radioPortraitTex = D_STAR_WOLF_F003C80; - sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA + 1: radioPortraitTex = D_STAR_WOLF_F004BA0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON: radioPortraitTex = D_STAR_WOLF_F007900; - sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON + 1: radioPortraitTex = D_STAR_WOLF_F008820; - sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW: radioPortraitTex = D_STAR_WOLF_F000000; - sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW + 1: radioPortraitTex = D_STAR_WOLF_F000F20; - sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF_2: radioPortraitTex = D_STAR_WOLF_F00D3C0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_WOLF_2 + 1: radioPortraitTex = D_STAR_WOLF_F00E2E0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA_2: radioPortraitTex = D_STAR_WOLF_F005AC0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_PIGMA_2 + 1: radioPortraitTex = D_STAR_WOLF_F0069E0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON_2: radioPortraitTex = D_STAR_WOLF_F009740; - sRadioUseRedBox = enemyRedRadio; break; case RCID_LEON_2 + 1: radioPortraitTex = D_STAR_WOLF_F00A660; - sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW_2: radioPortraitTex = D_STAR_WOLF_F001E40; - sRadioUseRedBox = enemyRedRadio; break; case RCID_ANDREW_2 + 1: radioPortraitTex = D_STAR_WOLF_F002D60; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA: radioPortraitTex = D_CO_6026420; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA + 1: radioPortraitTex = D_CO_6027340; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA2: radioPortraitTex = D_CO_60245E0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_CORNERIA2 + 1: radioPortraitTex = D_CO_6025500; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_METEO: radioPortraitTex = D_ME_601C8E0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_METEO + 1: radioPortraitTex = D_ME_601D800; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_AREA6: radioPortraitTex = D_A6_60047E0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_AREA6 + 1: radioPortraitTex = D_A6_6005700; - sRadioUseRedBox = enemyRedRadio; break; case RCID_CAIMAN_AREA6: radioPortraitTex = D_A6_60029A0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_CAIMAN_AREA6 + 1: radioPortraitTex = D_A6_60038C0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_ZONESS: radioPortraitTex = D_ZO_6014510; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_ZONESS + 1: radioPortraitTex = D_ZO_6015430; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORX: radioPortraitTex = D_SX_6020FB0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORX + 1: radioPortraitTex = D_SX_6021ED0; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORY: radioPortraitTex = D_SY_6018F30; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_SECTORY + 1: radioPortraitTex = D_SY_6019E50; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_MACBETH: radioPortraitTex = D_MA_6010C20; - sRadioUseRedBox = enemyRedRadio; break; case RCID_BOSS_MACBETH + 1: radioPortraitTex = D_MA_6011B40; - sRadioUseRedBox = enemyRedRadio; break; case RCID_ROB64_RED: sRadioUseRedBox = true; @@ -457,20 +424,6 @@ void func_radio_800BAAE8(void) { if (((s32) gRadioMsgRadioId == RCID_ANDROSS) || ((s32) gRadioMsgRadioId == RCID_ANDROSS_RED)) { sRadioUseRedBox = true; } - if (enemyRedRadio) - { //This ensures the box stays red when the message is closing and already showing static in the portrait. - if (gRadioMsgRadioId == RCID_BOSS_CORNERIA || gRadioMsgRadioId == RCID_BOSS_CORNERIA2 || - gRadioMsgRadioId == RCID_BOSS_METEO || gRadioMsgRadioId == RCID_BOSS_SECTORX || - gRadioMsgRadioId == RCID_BOSS_SECTORY || gRadioMsgRadioId == RCID_BOSS_MACBETH || - gRadioMsgRadioId == RCID_BOSS_ZONESS || gRadioMsgRadioId == RCID_BOSS_AREA6 || - gRadioMsgRadioId == RCID_CAIMAN_AREA6 || gRadioMsgRadioId == RCID_WOLF || - gRadioMsgRadioId == RCID_PIGMA || gRadioMsgRadioId == RCID_LEON || - gRadioMsgRadioId == RCID_ANDREW || gRadioMsgRadioId == RCID_WOLF_2 || - gRadioMsgRadioId == RCID_PIGMA_2 || gRadioMsgRadioId == RCID_LEON_2 || - gRadioMsgRadioId == RCID_ANDREW_2) { - sRadioUseRedBox = true; - } - } break; } if ((radioPortraitTex != NULL) && (gRadioPortraitScaleY != 0.0f)) { diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index e968e8a0..40339226 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -18,6 +18,7 @@ DEFINE_EVENT(DrawRadarHUDEvent); DEFINE_EVENT(DrawBoostGaugeHUDEvent); DEFINE_EVENT(DrawBombCounterHUDEvent); DEFINE_EVENT(DrawIncomingMsgHUDEvent); +DEFINE_EVENT(PreSetupRadioMsgEvent, s32* radioRedBox); DEFINE_EVENT(DrawGoldRingsHUDEvent); DEFINE_EVENT(DrawLivesCounterHUDEvent); DEFINE_EVENT(DrawTrainingRingPassCountHUDEvent); diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index 042da8e8..abc9d0f2 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -299,6 +299,25 @@ void OnBombCounterDraw(IEvent* ev){ HUD_BombCounter_Draw(253.0f, 18.0f); } +void OnPreSetupRadioMsgEvent(PreSetupRadioMsgEvent* ev){ + bool enemyRedRadio = CVarGetInteger("gEnemyRedRadio", 0); + if (!enemyRedRadio) + { + return; + } + if (gRadioMsgRadioId == RCID_BOSS_CORNERIA || gRadioMsgRadioId == RCID_BOSS_CORNERIA2 || + gRadioMsgRadioId == RCID_BOSS_METEO || gRadioMsgRadioId == RCID_BOSS_SECTORX || + gRadioMsgRadioId == RCID_BOSS_SECTORY || gRadioMsgRadioId == RCID_BOSS_MACBETH || + gRadioMsgRadioId == RCID_BOSS_ZONESS || gRadioMsgRadioId == RCID_BOSS_AREA6 || + gRadioMsgRadioId == RCID_CAIMAN_AREA6 || gRadioMsgRadioId == RCID_WOLF || + gRadioMsgRadioId == RCID_PIGMA || gRadioMsgRadioId == RCID_LEON || + gRadioMsgRadioId == RCID_ANDREW || gRadioMsgRadioId == RCID_WOLF_2 || + gRadioMsgRadioId == RCID_PIGMA_2 || gRadioMsgRadioId == RCID_LEON_2 || + gRadioMsgRadioId == RCID_ANDREW_2) { + *ev->radioRedBox = true; + } +} + void OnLivesCounterDraw(IEvent* ev){ bool restore = CVarGetInteger("gRestoreBetaBoostGauge", 0) == 1; if(!restore){ @@ -327,6 +346,7 @@ void PortEnhancements_Init() { REGISTER_LISTENER(DrawBoostGaugeHUDEvent, OnBoostGaugeDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawLivesCounterHUDEvent, OnLivesCounterDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawBombCounterHUDEvent, OnBombCounterDraw, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(PreSetupRadioMsgEvent, OnPreSetupRadioMsgEvent, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(ObjectUpdateEvent, OnItemGoldRingUpdate, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(ObjectDrawPostSetupEvent, OnItemGoldRingDraw, EVENT_PRIORITY_NORMAL); @@ -358,6 +378,7 @@ void PortEnhancements_Register() { REGISTER_EVENT(DrawBoostGaugeHUDEvent); REGISTER_EVENT(DrawBombCounterHUDEvent); REGISTER_EVENT(DrawIncomingMsgHUDEvent); + REGISTER_EVENT(PreSetupRadioMsgEvent); REGISTER_EVENT(DrawGoldRingsHUDEvent); REGISTER_EVENT(DrawLivesCounterHUDEvent); REGISTER_EVENT(DrawTrainingRingPassCountHUDEvent); From a466e0d75ae8eb44c5f313cd087d3f72452710fa Mon Sep 17 00:00:00 2001 From: Kiloku Date: Mon, 10 Feb 2025 18:53:35 -0300 Subject: [PATCH 09/10] Missing semicolon --- src/port/hooks/list/EngineEvent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index 40339226..93535dae 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -18,7 +18,7 @@ DEFINE_EVENT(DrawRadarHUDEvent); DEFINE_EVENT(DrawBoostGaugeHUDEvent); DEFINE_EVENT(DrawBombCounterHUDEvent); DEFINE_EVENT(DrawIncomingMsgHUDEvent); -DEFINE_EVENT(PreSetupRadioMsgEvent, s32* radioRedBox); +DEFINE_EVENT(PreSetupRadioMsgEvent, s32* radioRedBox;); DEFINE_EVENT(DrawGoldRingsHUDEvent); DEFINE_EVENT(DrawLivesCounterHUDEvent); DEFINE_EVENT(DrawTrainingRingPassCountHUDEvent); From 1b534ccd70e510b39ae0688f882e4984b92afd39 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Mon, 10 Feb 2025 21:40:30 -0300 Subject: [PATCH 10/10] Option to add outlines to ships in radar (#156) * Add outlines to ships in radar * Move Outline feature to hooks * Missing semicolon --- src/engine/fox_hud.c | 18 +++++---- src/port/hooks/list/EngineEvent.h | 2 + src/port/mods/PortEnhancements.c | 63 +++++++++++++++++++++++++++++++ src/port/ui/ImguiUI.cpp | 4 ++ 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/src/engine/fox_hud.c b/src/engine/fox_hud.c index 051ec0b6..7bb51bff 100644 --- a/src/engine/fox_hud.c +++ b/src/engine/fox_hud.c @@ -1790,7 +1790,7 @@ void HUD_RadarMark_Arwing_Draw(s32 colorIdx) { RCP_SetupDL(&gMasterDisp, SETUPDL_62); gDPSetPrimColor(gMasterDisp++, 0, 0, arwingMarkColor[colorIdx][0], arwingMarkColor[colorIdx][1], - arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3]); + arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3]); Matrix_Scale(gGfxMatrix, var_fv1, var_fv2, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, aRadarMarkArwingDL); @@ -1801,7 +1801,7 @@ void HUD_RadarMark_StarWolf_Draw(void) { gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255); Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL); + gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL); } void HUD_RadarMark_Katt_Draw(void) { @@ -1885,17 +1885,21 @@ void HUD_RadarMark_Draw(s32 type) { } else { arwingMarkColor = arwingMarkColor * 2; } - - HUD_RadarMark_Arwing_Draw(arwingMarkColor); + CALL_CANCELLABLE_EVENT(DrawRadarMarkArwingEvent, arwingMarkColor) { + HUD_RadarMark_Arwing_Draw(arwingMarkColor); + } break; case RADARMARK_WOLF: case RADARMARK_LEON: case RADARMARK_PIGMA: case RADARMARK_ANDREW: - HUD_RadarMark_StarWolf_Draw(); - break; - + { //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; diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index 93535dae..df4115cd 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -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); diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index abc9d0f2..641ad55f 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -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); diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 937751ad..71c294be 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -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(); }