added link's pocket medallion/gem

This commit is contained in:
MelonSpeedruns 2022-05-29 13:00:14 -04:00
commit 3a84be3a48
5 changed files with 78 additions and 10 deletions

View file

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

View file

@ -713,11 +713,20 @@ s16 Randomizer::GetItemModelFromId(s16 itemId) {
}
void Randomizer::LoadItemLocations(const char* spoilerFileName) {
// bandaid until new save stuff happens
ParseItemLocations(spoilerFileName);
if (strcmp(spoilerFileName, "") != 0) {
// bandaid until new save stuff happens
ParseItemLocations(spoilerFileName);
for(auto itemLocation : gSaveContext.itemLocations) {
this->itemLocations[itemLocation.check] = itemLocation.get;
for (auto itemLocation : gSaveContext.itemLocations) {
this->itemLocations[itemLocation.check] = itemLocation.get;
}
} else {
u16 index = 0;
for (auto itemLocation : this->itemLocations) {
gSaveContext.itemLocations[index].check = itemLocation.first;
gSaveContext.itemLocations[index].get = itemLocation.second;
index++;
}
}
}
@ -1026,7 +1035,7 @@ RandomizerCheck Randomizer::GetCheckFromSceneAndParams(s16 sceneNum, s16 actorPa
}
case 84:
switch (actorParams) {
case 0x0406:
case 1030:
return ZR_NEAR_OPEN_GROTTO_FREESTANDING_POH;
case 2822:
return ZR_NEAR_DOMAIN_FREESTANDING_POH;

View file

@ -4,7 +4,7 @@ void TitleSetup_InitImpl(GameState* gameState) {
osSyncPrintf("ゼルダ共通データ初期化\n"); // "Zelda common data initalization"
SaveContext_Init();
gameState->running = false;
SET_NEXT_GAMESTATE(gameState, FileChoose_Init, TitleContext);
SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
}
void TitleSetup_Destroy(GameState* gameState) {

View file

@ -193,11 +193,67 @@ void Gameplay_Destroy(GameState* thisx) {
gGlobalCtx = NULL;
}
void GiveLinksPocketMedallion(GlobalContext* globalCtx) {
if (gSaveContext.n64ddFlag) {
RandomizerGet get = gSaveContext.itemLocations[LINKS_POCKET].get;
s16 item;
u8 medallion = 0;
switch (get) {
case FOREST_MEDALLION:
item = ITEM_MEDALLION_FOREST;
medallion = 1;
break;
case FIRE_MEDALLION:
item = ITEM_MEDALLION_FIRE;
medallion = 1;
break;
case WATER_MEDALLION:
item = ITEM_MEDALLION_WATER;
medallion = 1;
break;
case SHADOW_MEDALLION:
item = ITEM_MEDALLION_SHADOW;
medallion = 1;
break;
case SPIRIT_MEDALLION:
item = ITEM_MEDALLION_SPIRIT;
medallion = 1;
break;
case LIGHT_MEDALLION:
item = ITEM_MEDALLION_LIGHT;
medallion = 1;
break;
case KOKIRI_EMERALD:
item = ITEM_KOKIRI_EMERALD;
break;
case GORON_RUBY:
item = ITEM_GORON_RUBY;
break;
case ZORA_SAPPHIRE:
item = ITEM_ZORA_SAPPHIRE;
break;
}
if (medallion == 1) {
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST];
if (item == ITEM_MEDALLION_WATER) {
func_8006D0AC(globalCtx);
}
} else {
gSaveContext.inventory.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD];
}
}
}
void Gameplay_Init(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
gGlobalCtx = globalCtx;
//globalCtx->state.gfxCtx = NULL;
// globalCtx->state.gfxCtx = NULL;
u32 zAlloc;
u32 zAllocAligned;
size_t zAllocSize;
@ -207,6 +263,8 @@ void Gameplay_Init(GameState* thisx) {
u8 tempSetupIndex;
s32 pad[2];
GiveLinksPocketMedallion(globalCtx);
if (gSaveContext.entranceIndex == -1) {
gSaveContext.entranceIndex = 0;
globalCtx->state.running = false;

View file

@ -1519,7 +1519,6 @@ void FileChoose_LoadGame(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSaveContext.fileNum = this->buttonIndex;
Sram_OpenSave(&this->sramCtx);
// LoadItemLocations();
gSaveContext.gameMode = 0;
SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext);
this->state.running = false;
@ -1527,12 +1526,14 @@ void FileChoose_LoadGame(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSaveContext.fileNum = this->buttonIndex;
Sram_OpenSave(&this->sramCtx);
// LoadItemLocations();
gSaveContext.gameMode = 0;
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
this->state.running = false;
}
LoadItemLocations("");
gSaveContext.respawn[0].entranceIndex = -1;
gSaveContext.respawnFlag = 0;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;