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/libultraship b/libultraship index e641b377..b7040484 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit e641b3777cbefb18a9cf4b95353d650b3a2abf65 +Subproject commit b7040484f185de8409dfd559f37a43da50d60a28 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/engine/fox_play.c b/src/engine/fox_play.c index df77f166..9d501d66 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; } @@ -7161,8 +7167,9 @@ void Play_Main(void) { } gDrawMode = DRAW_PLAY; - - Play_Update(); + CALL_CANCELLABLE_EVENT(PlayUpdateEvent){ + Play_Update(); + } if ((gControllerPress[gMainController].button & START_BUTTON) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 87ee7f7d..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; - + CALL_EVENT(PreSetupRadioMsgEvent, &sRadioUseRedBox); switch (gCurrentRadioPortrait) { case RCID_FOX_RED: sRadioUseRedBox = true; 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() { diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index 50db9c83..df4115cd 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -9,13 +9,18 @@ DEFINE_EVENT(DisplayPostUpdateEvent); DEFINE_EVENT(GamePreUpdateEvent); DEFINE_EVENT(GamePostUpdateEvent); +DEFINE_EVENT(PlayUpdateEvent); + 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); +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 3c156bec..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" @@ -163,6 +164,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; @@ -295,6 +300,83 @@ 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 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){ @@ -318,10 +400,14 @@ 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); 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); @@ -331,6 +417,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() { @@ -341,13 +430,18 @@ void PortEnhancements_Register() { REGISTER_EVENT(GamePreUpdateEvent); REGISTER_EVENT(GamePostUpdateEvent); + REGISTER_EVENT(PlayUpdateEvent); + REGISTER_EVENT(PlayerPreUpdateEvent); REGISTER_EVENT(PlayerPostUpdateEvent); REGISTER_EVENT(DrawRadarHUDEvent); + REGISTER_EVENT(DrawRadarMarkArwingEvent); + REGISTER_EVENT(DrawRadarMarkWolfenEvent); REGISTER_EVENT(DrawBoostGaugeHUDEvent); REGISTER_EVENT(DrawBombCounterHUDEvent); REGISTER_EVENT(DrawIncomingMsgHUDEvent); + REGISTER_EVENT(PreSetupRadioMsgEvent); REGISTER_EVENT(DrawGoldRingsHUDEvent); REGISTER_EVENT(DrawLivesCounterHUDEvent); REGISTER_EVENT(DrawTrainingRingPassCountHUDEvent); diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 122c446b..71c294be 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); @@ -566,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(); } @@ -713,6 +718,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());