From b540b7fcfcaca50ddaa42f9018232c8634cfd2fa Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sun, 24 Apr 2022 16:50:41 +0200 Subject: [PATCH 01/10] Add Enhancement 3D Dropped Items (#144) * Add Enhancement 3D Dropped Items It will change most of dropped item to there 3D models variant, Exclude Rupee from Hyrule Castle (when you are child and in quest to see Zelda.) * Fix z_kaleido_scope_PAL.c L and R button color issues This fix an issue in IF and gDPSetPrimColor for button L & R icon. making it with an else to place the on hover and normal color properly in both button so they both have exact same colour * Fix quite a big logic issue for 3D item drops In short,case logic required to be different with break; old version make it all fucked up with improper values. * Clean Const that was present nor not. * Update z_kaleido_scope_PAL.c * Update z_kaleido_scope_PAL.c --- libultraship/libultraship/GameSettings.cpp | 4 + libultraship/libultraship/GameSettings.h | 1 + libultraship/libultraship/SohImGuiImpl.cpp | 6 + soh/soh/Enhancements/bootcommands.c | 2 + soh/src/code/z_en_item00.c | 326 ++++++++++++++++++--- 5 files changed, 293 insertions(+), 46 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 2ce22d6f9..c056dec71 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -73,6 +73,9 @@ namespace Game { Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]); CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood); + Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]); + CVar_SetS32("gNewDrops", Settings.enhancements.newdrops); + // Audio Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]); CVar_SetFloat("gGameMasterVolume", Settings.audio.master); @@ -178,6 +181,7 @@ namespace Game { Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon); Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui); + Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops); Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 070bdce38..990132f4e 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -26,6 +26,7 @@ struct SoHConfigType { bool animated_pause_menu = false; bool dynamic_wallet_icon = false; bool minimal_ui = false; + bool newdrops = false; bool visualagony = false; bool mm_bunny_hood = false; diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 7355d16a2..72a44162e 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -431,8 +431,14 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("Enable 3D Dropped items", &Game::Settings.enhancements.newdrops)) { + CVar_SetS32("gNewDrops", Game::Settings.enhancements.newdrops); + needs_save = true; + } + if (ImGui::Checkbox("Dynamic Wallet Icon", &Game::Settings.enhancements.dynamic_wallet_icon)) { CVar_SetS32(const_cast("gDynamicWalletIcon"), Game::Settings.enhancements.dynamic_wallet_icon); + needs_save = true; } diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index c58a11b6b..f3ad9aaac 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -25,7 +25,9 @@ void BootCommands_Init() CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gPauseLiveLink", 0); CVar_RegisterS32("gMinimalUI", 0); + CVar_RegisterS32("gNewDrops", 0); CVar_RegisterS32("gVisualAgony", 0); + } //void BootCommands_ParseBootArgs(char* str) diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index 2693c4b0f..d0179a5e1 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -5,6 +5,9 @@ #define FLAGS 0 +//Used to force variable to be used in different function, feel free to correct me if you have a better way +static s16 DroppedItemRot = 0; + void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); @@ -355,11 +358,34 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_RUPEE_BLUE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } case ITEM00_RUPEE_RED: - Actor_SetScale(&this->actor, 0.015f); - this->scale = 0.015f; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.015f); + this->scale = 0.015f; + yOffset = 750.0f; + } break; case ITEM00_SMALL_KEY: this->unk_158 = 0; @@ -374,10 +400,18 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.02f; break; case ITEM00_HEART: - this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); - yOffset = 430.0f; - Actor_SetScale(&this->actor, 0.02f); - this->scale = 0.02f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); + yOffset = 25.0f; + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + shadowScale = 0.5f; + } else { + this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); + yOffset = 430.0f; + Actor_SetScale(&this->actor, 0.02f); + this->scale = 0.02f; + } break; case ITEM00_HEART_CONTAINER: yOffset = 430.0f; @@ -386,42 +420,154 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.02f; break; case ITEM00_ARROWS_SINGLE: - yOffset = 400.0f; - Actor_SetScale(&this->actor, 0.02f); - this->scale = 0.02f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + yOffset = 400.0f; + Actor_SetScale(&this->actor, 0.02f); + this->scale = 0.02f; + } + break; case ITEM00_ARROWS_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_ARROWS_MEDIUM: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_ARROWS_LARGE: - Actor_SetScale(&this->actor, 0.035f); - this->scale = 0.035f; - yOffset = 250.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.035f); + this->scale = 0.035f; + yOffset = 250.0f; + } + break; case ITEM00_BOMBS_A: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_BOMBS_B: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_NUTS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_STICK: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_MAGIC_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_SEEDS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_BOMBS_SPECIAL: - Actor_SetScale(&this->actor, 0.03f); - this->scale = 0.03f; - yOffset = 320.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.03f); + this->scale = 0.03f; + yOffset = 320.0f; + } + break; case ITEM00_MAGIC_LARGE: - Actor_SetScale(&this->actor, 0.045 - 1e-10); - this->scale = 0.045 - 1e-10; - yOffset = 320.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.045 - 1e-10); + this->scale = 0.045 - 1e-10; + yOffset = 320.0f; + } + break; case ITEM00_RUPEE_ORANGE: - Actor_SetScale(&this->actor, 0.045 - 1e-10); - this->scale = 0.045 - 1e-10; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.45f); + this->scale = 0.45f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.045 - 1e-10); + this->scale = 0.045 - 1e-10; + yOffset = 750.0f; + } break; case ITEM00_RUPEE_PURPLE: - Actor_SetScale(&this->actor, 0.03f); - this->scale = 0.03f; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.4f); + this->scale = 0.4f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.03f); + this->scale = 0.03f; + yOffset = 750.0f; + } break; case ITEM00_FLEXIBLE: yOffset = 500.0f; @@ -558,6 +704,19 @@ void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { + + if (CVar_GetS32("gNewDrops", 0) !=0) { //set the rotation system on selected model only :) + if ((this->actor.params == ITEM_RUPEE_GOLD) || (this->actor.params == ITEM_RUPEE_PURPLE) || + (this->actor.params == ITEM00_ARROWS_SINGLE) || (this->actor.params == ITEM00_ARROWS_SMALL) || + (this->actor.params == ITEM00_ARROWS_MEDIUM) || (this->actor.params == ITEM00_ARROWS_LARGE) || + (this->actor.params == ITEM00_BOMBS_A) || (this->actor.params == ITEM00_BOMBS_B) || + (this->actor.params == ITEM00_NUTS) || (this->actor.params == ITEM00_STICK) || + (this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) || + (this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) || (this->actor.params == ITEM00_BOMBS_SPECIAL)) { + this->actor.shape.rot.y = DroppedItemRot; + } + } + if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || (this->actor.params == ITEM00_HEART_PIECE)) { this->actor.shape.rot.y += 960; @@ -731,6 +890,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = (EnItem00*)thisx; s32 pad; + if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :) + DroppedItemRot += 100; + } + if (this->unk_15A > 0) { this->unk_15A--; } @@ -934,15 +1097,35 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = (EnItem00*)thisx; f32 mtxScale; - + if (!(this->unk_156 & this->unk_158)) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_GREEN); + break; + } case ITEM00_RUPEE_BLUE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_BLUE); + break; + } case ITEM00_RUPEE_RED: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_RED); + break; + } case ITEM00_RUPEE_ORANGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_GOLD); + break; + } case ITEM00_RUPEE_PURPLE: - EnItem00_DrawRupee(this, globalCtx); + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_PURPLE); + } else { + EnItem00_DrawRupee(this, globalCtx); + } break; case ITEM00_HEART_PIECE: EnItem00_DrawHeartPiece(this, globalCtx); @@ -951,34 +1134,85 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { EnItem00_DrawHeartContainer(this, globalCtx); break; case ITEM00_HEART: - if (this->unk_15A < 0) { - if (this->unk_15A == -1) { - s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); - - if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { - this->actor.objBankIndex = bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); - this->unk_15A = -2; - } - } else { - mtxScale = 16.0f; - Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItem_Draw(globalCtx, GID_HEART); - } - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_HEART); + mtxScale = 16.0f; + Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); + break; + } else { + if (this->unk_15A < 0) { + if (this->unk_15A == -1) { + s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); + + if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { + this->actor.objBankIndex = bankIndex; + Actor_SetObjectDependency(globalCtx, &this->actor); + this->unk_15A = -2; + } + } else { + mtxScale = 16.0f; + Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_HEART); + } + break; + } } case ITEM00_BOMBS_A: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_BOMB); + break; + } case ITEM00_BOMBS_B: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_BOMB); + break; + } case ITEM00_BOMBS_SPECIAL: case ITEM00_ARROWS_SINGLE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + break; + } case ITEM00_ARROWS_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + break; + } case ITEM00_ARROWS_MEDIUM: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM); + break; + } case ITEM00_ARROWS_LARGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_LARGE); + break; + } case ITEM00_NUTS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_NUTS); + break; + } case ITEM00_STICK: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_STICK); + break; + } case ITEM00_MAGIC_LARGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_MAGIC_LARGE); + break; + } case ITEM00_MAGIC_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_MAGIC_SMALL); + break; + } case ITEM00_SEEDS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_SEEDS); + break; + } case ITEM00_SMALL_KEY: EnItem00_DrawCollectible(this, globalCtx); break; From 6860600648b06778b5ff57e0aab5f2fd48749a1b Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sun, 24 Apr 2022 16:51:29 +0200 Subject: [PATCH 02/10] Potential fix for Title being over Kaleido. (#162) * Potential fix for Title being over Kaleido. Changing "OVERLAY_DISP" to "POLY_XLU_DISP" seem to fix and do not bring any errors (I did tried scene one by one and walked around in game) It may be no correct but it could point to the right direction if that is not correct. * Update z_actor.c * Update graph.c * Update z64.h * Update macros.h --- soh/include/macros.h | 1 + soh/include/z64.h | 3 +++ soh/src/code/graph.c | 5 +++++ soh/src/code/z_actor.c | 13 +++++++------ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/soh/include/macros.h b/soh/include/macros.h index 0d86c56c3..8563449b1 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -129,6 +129,7 @@ extern GraphicsContext* __gfxCtx; #define WORK_DISP __gfxCtx->work.p #define POLY_OPA_DISP __gfxCtx->polyOpa.p #define POLY_XLU_DISP __gfxCtx->polyXlu.p +#define TITLE_CARD_DISP __gfxCtx->titlecard.p #define POLY_KAL_DISP __gfxCtx->polyKal.p #define OVERLAY_DISP __gfxCtx->overlay.p diff --git a/soh/include/z64.h b/soh/include/z64.h index 24ec79946..92966f239 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -83,6 +83,7 @@ typedef struct { /* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC /* 0x00008 */ Gfx polyOpaBuffer[0x2FC0]; /* 0x0BF08 */ Gfx polyXluBuffer[0x1000]; + /* 0xXXXXX */ Gfx titlecardBuffer[0x1000]; /* 0x0BF08 */ Gfx polyKalBuffer[0x1000]; /* 0x0FF08 */ Gfx overlayBuffer[0x800]; /* 0x11F08 */ Gfx workBuffer[0x100]; @@ -130,6 +131,7 @@ typedef struct OSScTask { typedef struct GraphicsContext { /* 0x0000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0" /* 0x0004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1" + /* 0xXXX */ Gfx* titlecardBuffer; // Pointer to "Paris" /* 0xXXX */ Gfx* polyKalBuffer; // Pointer to "Rome" /* 0x0008 */ char unk_008[0x08]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3" /* 0x0010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4" @@ -149,6 +151,7 @@ typedef struct GraphicsContext { /* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4" /* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0" /* 0x02C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1" + /* 0x0XXX */ TwoHeadGfxArena titlecard; // When in Paris... /* 0x0XXX */ TwoHeadGfxArena polyKal; // When in Rome... /* 0x02D8 */ u32 gfxPoolIdx; /* 0x02DC */ u16* curFrameBuffer; diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 34283f342..3a1719731 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -95,12 +95,14 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) { pool->tailMagic = GFXPOOL_TAIL_MAGIC; THGA_Ct(&gfxCtx->polyOpa, pool->polyOpaBuffer, sizeof(pool->polyOpaBuffer)); THGA_Ct(&gfxCtx->polyXlu, pool->polyXluBuffer, sizeof(pool->polyXluBuffer)); + THGA_Ct(&gfxCtx->titlecard, pool->titlecardBuffer, sizeof(pool->titlecardBuffer)); THGA_Ct(&gfxCtx->polyKal, pool->polyKalBuffer, sizeof(pool->polyKalBuffer)); THGA_Ct(&gfxCtx->overlay, pool->overlayBuffer, sizeof(pool->overlayBuffer)); THGA_Ct(&gfxCtx->work, pool->workBuffer, sizeof(pool->workBuffer)); gfxCtx->polyOpaBuffer = pool->polyOpaBuffer; gfxCtx->polyXluBuffer = pool->polyXluBuffer; + gfxCtx->titlecardBuffer = pool->titlecardBuffer; gfxCtx->polyKalBuffer = pool->polyKalBuffer; gfxCtx->overlayBuffer = pool->overlayBuffer; gfxCtx->workBuffer = pool->workBuffer; @@ -274,6 +276,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0); gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 開始", 0); gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 開始", 0); + gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 開始", 0);//unsure if needed gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 開始", 0); CLOSE_DISPS(gfxCtx, "../graph.c", 975); @@ -286,6 +289,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0); gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 終了", 0); gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 終了", 0); + gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 終了", 0); gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 終了", 0); CLOSE_DISPS(gfxCtx, "../graph.c", 996); @@ -294,6 +298,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gSPBranchList(WORK_DISP++, gfxCtx->polyOpaBuffer); gSPBranchList(POLY_OPA_DISP++, gfxCtx->polyXluBuffer); + gSPBranchList(POLY_XLU_DISP++, gfxCtx->titlecardBuffer); gSPBranchList(POLY_XLU_DISP++, gfxCtx->polyKalBuffer); gSPBranchList(POLY_KAL_DISP++, gfxCtx->overlayBuffer); gDPPipeSync(OVERLAY_DISP++); diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index fee697055..eee9d8882 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -992,29 +992,30 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { height = (width * height > 0x1000) ? 0x1000 / width : height; titleSecondY = titleY + (height * 4); - OVERLAY_DISP = func_80093808(OVERLAY_DISP); + //TITLE_CARD_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP + TITLE_CARD_DISP = func_80093808(TITLE_CARD_DISP); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity, + gDPSetPrimColor(TITLE_CARD_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->alpha); - gDPLoadTextureBlock(OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset, G_IM_FMT_IA, + gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, + gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); height = titleCtx->height - height; // If texture is bigger than 0x1000, display the rest if (height > 0) { - gDPLoadTextureBlock(OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset + 0x1000, + gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, + gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } From 7d26b322f580e29855dba20a71670cbcfbfd423f Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sun, 24 Apr 2022 16:51:54 +0200 Subject: [PATCH 03/10] Fix minimap update in dungeon (#171) Thanks to Rozelette for this method ! --- soh/src/code/z_map_exp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 734209770..cfef800c9 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -664,6 +664,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha); + gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->mapSegment); gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_I, 96, 85, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); From 73ede53447c842c1c48d82a6636d9288490dbf71 Mon Sep 17 00:00:00 2001 From: sholdee <102821812+sholdee@users.noreply.github.com> Date: Sun, 24 Apr 2022 09:58:29 -0500 Subject: [PATCH 04/10] Fix build dates (#194) * Delete build.c * Update build.c * Update soh.vcxproj --- soh/build.c | 8 -------- soh/soh.vcxproj | 5 +---- soh/src/boot/build.c | 4 ---- 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 soh/build.c diff --git a/soh/build.c b/soh/build.c deleted file mode 100644 index f3f9bdae6..000000000 --- a/soh/build.c +++ /dev/null @@ -1,8 +0,0 @@ -const char gBuildVersion[] = "DECKARD ALFA (1.0.0)"; -const char gBuildTeam[] = "github.com/harbourmasters"; -#ifdef __TIMESTAMP__ -const char gBuildDate[] = __TIMESTAMP__; -#else -const char gBuildDate[] = __DATE__ " " __TIME__; -#endif -const char gBuildMakeOption[] = ""; diff --git a/soh/soh.vcxproj b/soh/soh.vcxproj index adf205f14..d35dd18b3 100644 --- a/soh/soh.vcxproj +++ b/soh/soh.vcxproj @@ -112,9 +112,6 @@ true true - - copy /b $(ProjectDir)src\boot\build.c +,, - @@ -1407,4 +1404,4 @@ - \ No newline at end of file + diff --git a/soh/src/boot/build.c b/soh/src/boot/build.c index f3f9bdae6..f60380467 100644 --- a/soh/src/boot/build.c +++ b/soh/src/boot/build.c @@ -1,8 +1,4 @@ const char gBuildVersion[] = "DECKARD ALFA (1.0.0)"; const char gBuildTeam[] = "github.com/harbourmasters"; -#ifdef __TIMESTAMP__ -const char gBuildDate[] = __TIMESTAMP__; -#else const char gBuildDate[] = __DATE__ " " __TIME__; -#endif const char gBuildMakeOption[] = ""; From 5a40f394944a69c1fa16d993eee3a2ae8752cd04 Mon Sep 17 00:00:00 2001 From: Ada <60364512+GreatArgorath@users.noreply.github.com> Date: Sun, 24 Apr 2022 15:59:41 +0100 Subject: [PATCH 05/10] Adds checkbox for visual stone of agony (#200) --- libultraship/libultraship/SohImGuiImpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 72a44162e..3556177d7 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -416,6 +416,11 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("Visual Stone of Agony", &Game::Settings.enhancements.visualagony)) { + CVar_SetS32("gVisualAgony", Game::Settings.enhancements.visualagony); + needs_save = true; + } + ImGui::Text("Graphics"); ImGui::Separator(); From eb97186f73187089d6b5134f639b5942b2295cbd Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 24 Apr 2022 09:00:14 -0600 Subject: [PATCH 06/10] readme build instructions split (#201) * Create BUILDING.md * Update README.md * Update README.md * Update README.md --- BUILDING.md | 22 ++++++++++++++++++++++ README.md | 20 +------------------- 2 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 BUILDING.md diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 000000000..82c26bff4 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,22 @@ +# Building Ship of Harkinian + + 1. Install [Python](https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe) + 2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/) + 2b. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`. + 4. Clone the Ship of Harkinian repository. + 5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice. + 6. Run `OTRExporter/OTRExporter.sln`. + 7. Switch the solution to `Release x64`. + 8. Build the solution. + 9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`. + 10. Run `soh/soh.sln` + 11. Switch the solution to `Release x86`. + 12. Build the solution. + 13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`. + 14. Launch `soh.exe`. + +## Compatible Roms +``` +OOT_PAL_GC checksum 0x09465AC3 +OOT_PAL_GC_DBG1 checksum 0x871E1C92 (debug non-master quest) +``` diff --git a/README.md b/README.md index e9e7b9070..65a6b90e0 100644 --- a/README.md +++ b/README.md @@ -51,26 +51,8 @@ Official Discord: https://discord.com/invite/BtBmd55HVH ## Building The Ship of Harkinian - 1. Install [Python](https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe) - 2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/) - 2b. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`. - 4. Clone the Ship of Harkinian repository. - 5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice. - 6. Run `OTRExporter/OTRExporter.sln`. - 7. Switch the solution to `Release x64`. - 8. Build the solution. - 9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`. - 10. Run `soh/soh.sln` - 11. Switch the solution to `Release x86`. - 12. Build the solution. - 13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`. - 14. Launch `soh.exe`. +Refer to the [building instructions](https://github.com/HarbourMasters/Shipwright/BUILDING.md) to compile SoH. -## Compatible Roms -``` -OOT_PAL_GC checksum 0x09465AC3 -OOT_PAL_GC_DBG1 checksum 0x871E1C92 (debug non-master quest) -``` ## Troubleshooting The Exporter - Affirm that you have an `/assets` folder filled with XMLs in the same directory as OTRGui.exe - Affirm that `zapd.exe` exists in the `/assets/extractor` folder From 17858fb67c6aee7813e3e4310785803815b9ff08 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sun, 24 Apr 2022 17:00:46 +0200 Subject: [PATCH 07/10] Fix languages Zone name on Kaleido (#203) This fix town/village and zone on maps in Kaleido menu. --- .../misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 9db5399a4..3c023105f 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -3177,15 +3177,9 @@ void KaleidoScope_Update(GlobalContext* globalCtx) if (gSaveContext.language == LANGUAGE_ENG) { memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[36 + gSaveContext.worldMapArea]), 0xA00); } else if (gSaveContext.language == LANGUAGE_GER) { - DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400, - (uintptr_t)_map_name_staticSegmentRomStart + - (((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x16C00, - 0xA00, "../z_kaleido_scope_PAL.c", 3780); + memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[59 + gSaveContext.worldMapArea]), 0xA00); } else { - DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400, - (uintptr_t)_map_name_staticSegmentRomStart + - (((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x24800, - 0xA00, "../z_kaleido_scope_PAL.c", 3784); + memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[81 + gSaveContext.worldMapArea]), 0xA00); } } // OTRTODO - player on pause From bb3227a7c20c0a6ddbac285a4047ccab3e29b1ea Mon Sep 17 00:00:00 2001 From: Ada <60364512+GreatArgorath@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:02:15 +0100 Subject: [PATCH 08/10] Fixes default text speed (#207) * Fixes text speed * Adds text speed default to ConfigFile.cpp + removes workaround --- libultraship/libultraship/ConfigFile.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libultraship/libultraship/ConfigFile.cpp b/libultraship/libultraship/ConfigFile.cpp index 1b4952139..2e9a8cc94 100644 --- a/libultraship/libultraship/ConfigFile.cpp +++ b/libultraship/libultraship/ConfigFile.cpp @@ -2,6 +2,7 @@ #include "spdlog/spdlog.h" #include "GlobalCtx2.h" #include "Window.h" +#include "GameSettings.h" namespace Ship { ConfigFile::ConfigFile(std::shared_ptr Context, const std::string& Path) : Context(Context), Path(Path), File(Path.c_str()) { @@ -149,6 +150,8 @@ namespace Ship { (*this)["KEYBOARD CONTROLLER BINDING 4"][STR(BTN_STICKDOWN)] = std::to_string(0x01F); (*this)["KEYBOARD CONTROLLER BINDING 4"][STR(BTN_STICKUP)] = std::to_string(0x011); + (*this)["ENHANCEMENT SETTINGS"]["TEXT_SPEED"] = "1"; + (*this)["SDL CONTROLLER 1"]["GUID"] = ""; (*this)["SDL CONTROLLER 2"]["GUID"] = ""; (*this)["SDL CONTROLLER 3"]["GUID"] = ""; From 576842ac74f2e18c2ad75d345be68ea446ad2d2f Mon Sep 17 00:00:00 2001 From: Ada <60364512+GreatArgorath@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:03:25 +0100 Subject: [PATCH 09/10] Makes text speed slider consistent with the rest of the UI (#208) --- libultraship/libultraship/SohImGuiImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 3556177d7..7af532a09 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -395,8 +395,8 @@ namespace SohImGui { ImGui::Text("Gameplay"); ImGui::Separator(); - ImGui::Text("Text Speed", Game::Settings.enhancements.text_speed); - if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5)) { + ImGui::Text("Text Speed: %dx", Game::Settings.enhancements.text_speed); + if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5, "")) { CVar_SetS32("gTextSpeed", Game::Settings.enhancements.text_speed); needs_save = true; } From ffa4a111484cd95cb20985e8f378e59af30eb5dc Mon Sep 17 00:00:00 2001 From: Ada <60364512+GreatArgorath@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:04:06 +0100 Subject: [PATCH 10/10] Fixes visual bug in shops when above 2x text speed (#211) --- soh/src/code/z_message_PAL.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index a767ede79..4780044a6 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -1144,7 +1144,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1); + msgCtx->textDrawPos = i + 1; msgCtx->textDelayTimer = msgCtx->textDelay; } else { msgCtx->textDelayTimer--;