mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-01 09:57:19 -04:00
Merge branch 'rando-next' of https://github.com/HarbourMasters/Shipwright into keysanity
This commit is contained in:
@@ -2228,6 +2228,52 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
||||
osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp);
|
||||
INV_CONTENT(item) = item;
|
||||
|
||||
// Autosave after getting items by default (cvars are not shown in the UI)
|
||||
if (CVar_GetS32("gAutosave", 0)) {
|
||||
if (CVar_GetS32("gAutosaveAllItems", 1)) {
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
}
|
||||
else if (CVar_GetS32("gAutosaveMajorItems", 1)) {
|
||||
switch (item) {
|
||||
case ITEM_STICK:
|
||||
case ITEM_NUT:
|
||||
case ITEM_BOMB:
|
||||
case ITEM_BOW:
|
||||
case ITEM_SEEDS:
|
||||
case ITEM_FISHING_POLE:
|
||||
case ITEM_MAGIC_SMALL:
|
||||
case ITEM_MAGIC_LARGE:
|
||||
case ITEM_INVALID_4:
|
||||
case ITEM_INVALID_5:
|
||||
case ITEM_INVALID_6:
|
||||
case ITEM_INVALID_7:
|
||||
case ITEM_HEART:
|
||||
case ITEM_RUPEE_GREEN:
|
||||
case ITEM_RUPEE_BLUE:
|
||||
case ITEM_RUPEE_RED:
|
||||
case ITEM_RUPEE_PURPLE:
|
||||
case ITEM_RUPEE_GOLD:
|
||||
case ITEM_INVALID_8:
|
||||
case ITEM_STICKS_5:
|
||||
case ITEM_STICKS_10:
|
||||
case ITEM_NUTS_5:
|
||||
case ITEM_NUTS_10:
|
||||
case ITEM_BOMBS_5:
|
||||
case ITEM_BOMBS_10:
|
||||
case ITEM_BOMBS_20:
|
||||
case ITEM_BOMBS_30:
|
||||
case ITEM_ARROWS_SMALL:
|
||||
case ITEM_ARROWS_MEDIUM:
|
||||
case ITEM_ARROWS_LARGE:
|
||||
case ITEM_SEEDS_30:
|
||||
break;
|
||||
default:
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -698,6 +698,11 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
||||
gTrnsnUnkState = 0;
|
||||
R_UPDATE_RATE = 3;
|
||||
}
|
||||
|
||||
// Don't autosave in grottos or cutscenes
|
||||
if (CVar_GetS32("gAutosave", 0) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (globalCtx->sceneNum != SCENE_KAKUSIANA) && (gSaveContext.cutsceneIndex == 0)) {
|
||||
Gameplay_PerformSave(globalCtx);
|
||||
}
|
||||
}
|
||||
globalCtx->sceneLoadFlag = 0;
|
||||
} else {
|
||||
@@ -1972,3 +1977,19 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Gameplay_PerformSave(GlobalContext* globalCtx) {
|
||||
Gameplay_SaveSceneFlags(globalCtx);
|
||||
gSaveContext.savedSceneNum = globalCtx->sceneNum;
|
||||
if (gSaveContext.temporaryWeapon) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
|
||||
Save_SaveFile();
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
||||
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
|
||||
} else {
|
||||
Save_SaveFile();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#define NUM_DUNGEONS 8
|
||||
#define NUM_TRIALS 6
|
||||
#define NUM_COWS 10
|
||||
|
||||
/**
|
||||
* Initialize new save.
|
||||
@@ -619,6 +620,11 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
||||
gSaveContext.trialsDone[i] = 0;
|
||||
}
|
||||
|
||||
// Sets all cows to unmilked when generating a rando save.
|
||||
for (u8 i = 0; i < NUM_COWS; i++) {
|
||||
gSaveContext.cowsMilked[i] = 0;
|
||||
}
|
||||
|
||||
// Set Cutscene flags to skip them
|
||||
gSaveContext.eventChkInf[0xC] |= 0x10; // returned to tot with medallions
|
||||
gSaveContext.eventChkInf[0xC] |= 0x20; //sheik at tot pedestal
|
||||
|
||||
Reference in New Issue
Block a user