diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 8d3c529cb..fb37646cd 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -256,7 +256,9 @@ static void gfx_sdl_handle_events(void) { break; case SDL_DROPFILE: { + #ifndef __linux__ LoadItemLocations(event.drop.file); + #endif break; } case SDL_QUIT: diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 3efb91429..21a3013d4 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -240,6 +240,11 @@ namespace SohImGui { stbi_image_free(img_data); } + // thought this might be a way to work around the LoadItemLocations not defined issue + // void LoadItemLocations(const char* spoilerFileName) { + // CVar_SetString("gSpoilerFileName", spoilerFileName); + // } + void LoadInterfaceEditor(){//This function is necessary as without it IMGui wont load the updated float array. hearts_colors[0] = (float)CVar_GetS32("gCCHeartsPrimR", 255)/255; hearts_colors[1] = (float)CVar_GetS32("gCCHeartsPrimG", 70)/255; diff --git a/libultraship/libultraship/SohImGuiImpl.h b/libultraship/libultraship/SohImGuiImpl.h index 210a26db9..602f1098f 100644 --- a/libultraship/libultraship/SohImGuiImpl.h +++ b/libultraship/libultraship/SohImGuiImpl.h @@ -82,4 +82,5 @@ namespace SohImGui { void LoadInterfaceEditor(); ImTextureID GetTextureByID(int id); ImTextureID GetTextureByName(const std::string& name); + // void LoadItemLocations(const char* spoilerFileName); } diff --git a/soh/include/z64save.h b/soh/include/z64save.h index 34cd54e9a..a17f7d37d 100644 --- a/soh/include/z64save.h +++ b/soh/include/z64save.h @@ -180,6 +180,7 @@ typedef struct { /* 0x1422 */ s16 sunsSongState; // controls the effects of suns song /* 0x1424 */ s16 healthAccumulator; ItemLocation itemLocations[512]; + Sprite seedIcons[5]; } SaveContext; // size = 0x1428 typedef enum { diff --git a/soh/randomizerTypes.h b/soh/randomizerTypes.h index b9fa7a833..28675f85f 100644 --- a/soh/randomizerTypes.h +++ b/soh/randomizerTypes.h @@ -1,5 +1,12 @@ #pragma once +typedef struct { + char tex[512]; + uint16_t width; + uint16_t height; + uint8_t im_fmt; + uint8_t im_siz; +} Sprite; typedef enum { LINKS_POCKET, diff --git a/soh/soh/Enhancements/randomizer.cpp b/soh/soh/Enhancements/randomizer.cpp index 6b0a934b0..e13697408 100644 --- a/soh/soh/Enhancements/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer.cpp @@ -6,11 +6,46 @@ #include #include #include +#include +#include using json = nlohmann::json; +std::unordered_map gSeedTextures; + Randomizer::Randomizer() { - //todo something? + gSeedTextures["Deku Stick"] = Sprite({ gHookshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Deku Nut"] = Sprite({ gDekuNutIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Bow"] = Sprite({ gFairyBowIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Slingshot"] = Sprite({ gFairySlingshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Fairy Ocarina"] = Sprite({ gFairyOcarinaIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Bombchu"] = Sprite({ gBombchuIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Longshot"] = Sprite({ gLongshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Boomerang"] = Sprite({ gBoomerangIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Lens of Truth"] = Sprite({ gLensofTruthIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Beans"] = Sprite({ gMagicBeansIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Megaton Hammer"] = Sprite({ gMegatonHammerIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Bottled Fish"] = Sprite({ gFishIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Bottled Milk"] = Sprite({ gMilkFullIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Mask of Truth"] = Sprite({ gMaskofTruthIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["SOLD OUT"] = Sprite({ gSoldOutIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Cucco"] = Sprite({ gCuccoIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Mushroom"] = Sprite({ gOddMushroomIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Saw"] = Sprite({ gPoachersSawIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Frog"] = Sprite({ gEyeBallFrogIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Master Sword"] = Sprite({ gMasterSwordIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Mirror Shield"] = Sprite({ gMirrorShieldIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Kokiri Tunic"] = Sprite({ gKokiriTunicIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Hover Boots"] = Sprite({ gHoverBootsIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Silver Gauntlets"] = Sprite({ gSilverGauntletsIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Gold Scale"] = Sprite({ gGoldenScaleIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Stone of Agony"] = Sprite({ gStoneOfAgonyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Skull Token"] = Sprite({ gGoldSkulltulaIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Heart Container"] = Sprite({ gHeartContainerIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Boss Key"] = Sprite({ gBossKeyIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Compass"] = Sprite({ gCompassIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Map"] = Sprite({ gDungeonMapIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); + gSeedTextures["Big Magic"] = Sprite({ gBigMagicJarIconTex, 24, 24, G_IM_FMT_RGBA, G_IM_SIZ_32b }); } Randomizer::~Randomizer() { this->itemLocations.clear(); @@ -668,7 +703,7 @@ void Randomizer::ParseItemLocations(const char* spoilerFileName) { int index = 0; for (auto it = hashJson.begin(); it != hashJson.end(); ++it) { - //gSaveContext.seedIcons[index] = gSeedTextures[it.value()]; + gSaveContext.seedIcons[index] = gSeedTextures[it.value()]; index++; } diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 13da4f664..19bf38cc2 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -165,14 +165,6 @@ void FileChoose_FinishFadeIn(GameState* thisx) { } } -typedef struct { - char tex[512]; - uint16_t width; - uint16_t height; - uint8_t im_fmt; - uint8_t im_siz; -} Sprite; - Sprite sprDPad = { gHookshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }; void SpriteLoad(FileChooseContext* this, Sprite* sprite) { @@ -215,8 +207,14 @@ void DrawSeedHashSprites(FileChooseContext* this) { // Draw Seed Icons u16 xStart = 64; for (u8 i = 0; i < 5; i++) { - SpriteLoad(this, &sprDPad); - SpriteDraw(this, &sprDPad, xStart + (40 * i), 10, 24, 24); + // gSaveContext.seedIcons[i]; + // hacky check to make sure we leaded the icons + if(gSaveContext.seedIcons[i].height) { + SpriteLoad(this, &gSaveContext.seedIcons[i]); + SpriteDraw(this, &gSaveContext.seedIcons[i], xStart + (40 * i), 10, 24, 24); + } + // SpriteLoad(this, &sprDPad); + // SpriteDraw(this, &sprDPad, xStart + (40 * i), 10, 24, 24); } gDPPipeSync(POLY_OPA_DISP++);