make setup still works

This commit is contained in:
briaguya 2022-05-29 01:18:01 -04:00
commit 5c39e52390
7 changed files with 61 additions and 12 deletions

View file

@ -256,7 +256,9 @@ static void gfx_sdl_handle_events(void) {
break; break;
case SDL_DROPFILE: case SDL_DROPFILE:
{ {
#ifndef __linux__
LoadItemLocations(event.drop.file); LoadItemLocations(event.drop.file);
#endif
break; break;
} }
case SDL_QUIT: case SDL_QUIT:

View file

@ -240,6 +240,11 @@ namespace SohImGui {
stbi_image_free(img_data); 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. 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[0] = (float)CVar_GetS32("gCCHeartsPrimR", 255)/255;
hearts_colors[1] = (float)CVar_GetS32("gCCHeartsPrimG", 70)/255; hearts_colors[1] = (float)CVar_GetS32("gCCHeartsPrimG", 70)/255;

View file

@ -82,4 +82,5 @@ namespace SohImGui {
void LoadInterfaceEditor(); void LoadInterfaceEditor();
ImTextureID GetTextureByID(int id); ImTextureID GetTextureByID(int id);
ImTextureID GetTextureByName(const std::string& name); ImTextureID GetTextureByName(const std::string& name);
// void LoadItemLocations(const char* spoilerFileName);
} }

View file

@ -180,6 +180,7 @@ typedef struct {
/* 0x1422 */ s16 sunsSongState; // controls the effects of suns song /* 0x1422 */ s16 sunsSongState; // controls the effects of suns song
/* 0x1424 */ s16 healthAccumulator; /* 0x1424 */ s16 healthAccumulator;
ItemLocation itemLocations[512]; ItemLocation itemLocations[512];
Sprite seedIcons[5];
} SaveContext; // size = 0x1428 } SaveContext; // size = 0x1428
typedef enum { typedef enum {

View file

@ -1,5 +1,12 @@
#pragma once #pragma once
typedef struct {
char tex[512];
uint16_t width;
uint16_t height;
uint8_t im_fmt;
uint8_t im_siz;
} Sprite;
typedef enum { typedef enum {
LINKS_POCKET, LINKS_POCKET,

View file

@ -6,11 +6,46 @@
#include <objects/gameplay_keep/gameplay_keep.h> #include <objects/gameplay_keep/gameplay_keep.h>
#include <functions.h> #include <functions.h>
#include <Cvar.h> #include <Cvar.h>
#include <textures/icon_item_static/icon_item_static.h>
#include <textures/icon_item_24_static/icon_item_24_static.h>
using json = nlohmann::json; using json = nlohmann::json;
std::unordered_map<std::string, Sprite> gSeedTextures;
Randomizer::Randomizer() { 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() { Randomizer::~Randomizer() {
this->itemLocations.clear(); this->itemLocations.clear();
@ -668,7 +703,7 @@ void Randomizer::ParseItemLocations(const char* spoilerFileName) {
int index = 0; int index = 0;
for (auto it = hashJson.begin(); it != hashJson.end(); ++it) { for (auto it = hashJson.begin(); it != hashJson.end(); ++it) {
//gSaveContext.seedIcons[index] = gSeedTextures[it.value()]; gSaveContext.seedIcons[index] = gSeedTextures[it.value()];
index++; index++;
} }

View file

@ -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 }; Sprite sprDPad = { gHookshotIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b };
void SpriteLoad(FileChooseContext* this, Sprite* sprite) { void SpriteLoad(FileChooseContext* this, Sprite* sprite) {
@ -215,8 +207,14 @@ void DrawSeedHashSprites(FileChooseContext* this) {
// Draw Seed Icons // Draw Seed Icons
u16 xStart = 64; u16 xStart = 64;
for (u8 i = 0; i < 5; i++) { for (u8 i = 0; i < 5; i++) {
SpriteLoad(this, &sprDPad); // gSaveContext.seedIcons[i];
SpriteDraw(this, &sprDPad, xStart + (40 * i), 10, 24, 24); // 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++); gDPPipeSync(POLY_OPA_DISP++);