mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 02:42:18 -05:00
Merge pull request #3945 from HarbourMasters/develop-macready
macready -> develop
This commit is contained in:
commit
10b6f8cf80
@ -37,12 +37,19 @@ GameInteractionEffectQueryResult GameInteractor::RemoveEffect(RemovableGameInter
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
bool GameInteractor::IsSaveLoaded() {
|
||||
bool GameInteractor::IsSaveLoaded(bool allowDbgSave) {
|
||||
Player* player;
|
||||
if (gPlayState != NULL) {
|
||||
player = GET_PLAYER(gPlayState);
|
||||
}
|
||||
return (gPlayState == NULL || player == NULL || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) ? false : true;
|
||||
|
||||
// Checking for normal game mode prevents debug saves from reporting true on title screen
|
||||
if (gPlayState == NULL || player == NULL || gSaveContext.gameMode != GAMEMODE_NORMAL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valid save file or debug save
|
||||
return (gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2) || (allowDbgSave && gSaveContext.fileNum == 0xFF);
|
||||
}
|
||||
|
||||
bool GameInteractor::IsGameplayPaused() {
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
DEFINE_HOOK(OnKaleidoUpdate, void());
|
||||
|
||||
// Helpers
|
||||
static bool IsSaveLoaded();
|
||||
static bool IsSaveLoaded(bool allowDbgSave = false);
|
||||
static bool IsGameplayPaused();
|
||||
static bool CanSpawnActor();
|
||||
static bool CanAddOrTakeAmmo(int16_t amount, int16_t item);
|
||||
|
@ -64,7 +64,7 @@ void ReloadSceneTogglingLinkAge() {
|
||||
|
||||
void RegisterInfiniteMoney() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
if (CVarGetInteger("gInfiniteMoney", 0) != 0) {
|
||||
if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) {
|
||||
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
|
||||
@ -75,7 +75,7 @@ void RegisterInfiniteMoney() {
|
||||
|
||||
void RegisterInfiniteHealth() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
if (CVarGetInteger("gInfiniteHealth", 0) != 0) {
|
||||
if (gSaveContext.health < gSaveContext.healthCapacity) {
|
||||
gSaveContext.health = gSaveContext.healthCapacity;
|
||||
@ -86,7 +86,7 @@ void RegisterInfiniteHealth() {
|
||||
|
||||
void RegisterInfiniteAmmo() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
if (CVarGetInteger("gInfiniteAmmo", 0) != 0) {
|
||||
// Deku Sticks
|
||||
if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) {
|
||||
@ -123,7 +123,7 @@ void RegisterInfiniteAmmo() {
|
||||
|
||||
void RegisterInfiniteMagic() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
if (CVarGetInteger("gInfiniteMagic", 0) != 0) {
|
||||
if (gSaveContext.isMagicAcquired && gSaveContext.magic != (gSaveContext.isDoubleMagicAcquired + 1) * 0x30) {
|
||||
gSaveContext.magic = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30;
|
||||
@ -134,7 +134,7 @@ void RegisterInfiniteMagic() {
|
||||
|
||||
void RegisterInfiniteNayrusLove() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
if (CVarGetInteger("gInfiniteNayru", 0) != 0) {
|
||||
gSaveContext.nayrusLoveTimer = 0x44B;
|
||||
}
|
||||
@ -143,7 +143,7 @@ void RegisterInfiniteNayrusLove() {
|
||||
|
||||
void RegisterMoonJumpOnL() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
|
||||
if (CVarGetInteger("gMoonJumpOnL", 0) != 0) {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
@ -158,7 +158,7 @@ void RegisterMoonJumpOnL() {
|
||||
|
||||
void RegisterInfiniteISG() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
|
||||
if (CVarGetInteger("gEzISG", 0) != 0) {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
@ -170,7 +170,7 @@ void RegisterInfiniteISG() {
|
||||
//Permanent quick put away (QPA) glitched damage value
|
||||
void RegisterEzQPA() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
|
||||
if (CVarGetInteger("gEzQPA", 0) != 0) {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
@ -182,7 +182,7 @@ void RegisterEzQPA() {
|
||||
|
||||
void RegisterUnrestrictedItems() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
|
||||
if (CVarGetInteger("gNoRestrictItems", 0) != 0) {
|
||||
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
|
||||
@ -210,11 +210,14 @@ void RegisterFreezeTime() {
|
||||
/// Switches Link's age and respawns him at the last entrance he entered.
|
||||
void RegisterSwitchAge() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) {
|
||||
static bool warped = false;
|
||||
|
||||
if (!GameInteractor::IsSaveLoaded(true)) {
|
||||
CVarClear("gSwitchAge");
|
||||
warped = false;
|
||||
return;
|
||||
}
|
||||
static bool warped = false;
|
||||
|
||||
static Vec3f playerPos;
|
||||
static int16_t playerYaw;
|
||||
static RoomContext* roomCtx;
|
||||
@ -248,7 +251,7 @@ void RegisterSwitchAge() {
|
||||
void RegisterOcarinaTimeTravel() {
|
||||
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnOcarinaSongAction>([]() {
|
||||
if (!GameInteractor::IsSaveLoaded()) {
|
||||
if (!GameInteractor::IsSaveLoaded(true)) {
|
||||
CVarClear("gTimeTravel");
|
||||
return;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ void AreaTable_Init_ForestTemple() {
|
||||
Entrance(FOREST_TEMPLE_WEST_CORRIDOR, {[]{return true;}}),
|
||||
Entrance(FOREST_TEMPLE_NW_OUTDOORS_UPPER, {[]{return CanUse(HOVER_BOOTS) || (LogicForestOutsideBackdoor && CanJumpslash && GoronBracelet);}}),
|
||||
Entrance(FOREST_TEMPLE_NW_CORRIDOR_TWISTED, {[]{return IsAdult && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}),
|
||||
Entrance(FOREST_TEMPLE_NW_CORRIDOR_STRAIGHTENED, {[]{return (CanUse(BOW) || CanUse(SLINGSHOT)) && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}),
|
||||
Entrance(FOREST_TEMPLE_NW_CORRIDOR_STRAIGHTENED, {[]{return IsAdult && (CanUse(BOW) || CanUse(SLINGSHOT)) && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}),
|
||||
});
|
||||
|
||||
areaTable[FOREST_TEMPLE_NW_CORRIDOR_TWISTED] = Area("Forest Temple NW Corridor Twisted", "Forest Temple", FOREST_TEMPLE, NO_DAY_NIGHT_CYCLE, {}, {}, {
|
||||
|
@ -4723,7 +4723,11 @@ void RandomizerSettingsWindow::DrawElement() {
|
||||
excludedLocationString += std::to_string(excludedLocationIt);
|
||||
excludedLocationString += ",";
|
||||
}
|
||||
if (excludedLocationString == "") {
|
||||
CVarClear("gRandomizeExcludedLocations");
|
||||
} else {
|
||||
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
||||
}
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
@ -4909,7 +4913,7 @@ void RandomizerSettingsWindow::DrawElement() {
|
||||
enabledTrickString += std::to_string(enabledTrickIt);
|
||||
enabledTrickString += ",";
|
||||
}
|
||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||
CVarClear("gRandomizeEnabledTricks");
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
@ -5113,7 +5117,7 @@ void RandomizerSettingsWindow::DrawElement() {
|
||||
enabledTrickString += std::to_string(enabledTrickIt);
|
||||
enabledTrickString += ",";
|
||||
}
|
||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||
CVarClear("gRandomizeEnabledTricks");
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
|
||||
@ -5151,7 +5155,11 @@ void RandomizerSettingsWindow::DrawElement() {
|
||||
enabledTrickString += std::to_string(enabledTrickIt);
|
||||
enabledTrickString += ",";
|
||||
}
|
||||
if (enabledTrickString == "") {
|
||||
CVarClear("gRandomizeEnabledTricks");
|
||||
} else {
|
||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||
}
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
DrawTagChips(*rtObject.rtTags);
|
||||
|
@ -30,6 +30,8 @@ void DrawBottle(ItemTrackerItem item);
|
||||
void DrawQuest(ItemTrackerItem item);
|
||||
void DrawSong(ItemTrackerItem item);
|
||||
|
||||
int itemTrackerSectionId;
|
||||
|
||||
bool shouldUpdateVectors = true;
|
||||
|
||||
std::vector<ItemTrackerItem> mainWindowItems = {};
|
||||
@ -282,11 +284,6 @@ void ItemTrackerOnFrame() {
|
||||
}
|
||||
}
|
||||
|
||||
void SaveNotes(uint32_t fileNum) {
|
||||
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
|
||||
bool IsValidSaveFile() {
|
||||
bool validSave = gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
|
||||
return validSave;
|
||||
@ -755,7 +752,7 @@ void DrawNotes(bool resizeable = false) {
|
||||
}
|
||||
if ((ImGui::IsItemDeactivatedAfterEdit() || (notesNeedSave && notesIdleFrames > notesMaxIdleFrames)) && IsValidSaveFile()) {
|
||||
notesNeedSave = false;
|
||||
SaveNotes(gSaveContext.fileNum);
|
||||
SaveManager::Instance->SaveSection(gSaveContext.fileNum, itemTrackerSectionId, true);
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
@ -980,6 +977,26 @@ void UpdateVectors() {
|
||||
shouldUpdateVectors = false;
|
||||
}
|
||||
|
||||
void ItemTrackerInitFile(bool isDebug) {
|
||||
itemTrackerNotes.clear();
|
||||
itemTrackerNotes.push_back(0);
|
||||
}
|
||||
|
||||
void ItemTrackerSaveFile(SaveContext* saveContext, int sectionID, bool fullSave) {
|
||||
SaveManager::Instance->SaveData("personalNotes", std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
||||
}
|
||||
|
||||
void ItemTrackerLoadFile() {
|
||||
std::string initialTrackerNotes = "";
|
||||
SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes);
|
||||
itemTrackerNotes.resize(initialTrackerNotes.length() + 1);
|
||||
if (initialTrackerNotes != "") {
|
||||
SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size());
|
||||
} else {
|
||||
itemTrackerNotes.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemTrackerWindow::DrawElement() {
|
||||
UpdateVectors();
|
||||
|
||||
@ -1249,14 +1266,9 @@ void ItemTrackerWindow::InitElement() {
|
||||
itemTrackerNotes.push_back(0);
|
||||
}
|
||||
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadFile>([](uint32_t fileNum) {
|
||||
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||
itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1);
|
||||
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
||||
});
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnDeleteFile>([](uint32_t fileNum) {
|
||||
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
});
|
||||
SaveManager::Instance->AddInitFunction(ItemTrackerInitFile);
|
||||
itemTrackerSectionId = SaveManager::Instance->AddSaveFunction("itemTrackerData", 1, ItemTrackerSaveFile, true, -1);
|
||||
SaveManager::Instance->AddLoadFunction("itemTrackerData", 1, ItemTrackerLoadFile);
|
||||
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>(ItemTrackerOnFrame);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void RegisterOnInterfaceUpdateHook() {
|
||||
|
||||
prevTimer = timer;
|
||||
|
||||
if (!GameInteractor::IsSaveLoaded()) return;
|
||||
if (!GameInteractor::IsSaveLoaded(true)) return;
|
||||
|
||||
static int16_t lostHealth = 0;
|
||||
static int16_t prevHealth = 0;
|
||||
|
@ -178,7 +178,7 @@ bool Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) {
|
||||
// Loop until a mismatch in the object lists
|
||||
// Then clear all object ids past that in the context object list and kill actors for those objects
|
||||
for (i = play->objectCtx.unk_09, k = 0; i < play->objectCtx.num; i++, k++) {
|
||||
if (play->objectCtx.status[i].id != cmdObj->objects[k]) {
|
||||
if (i >= cmdObj->objects.size() || play->objectCtx.status[i].id != cmdObj->objects[k]) {
|
||||
for (j = i; j < play->objectCtx.num; j++) {
|
||||
play->objectCtx.status[j].id = OBJECT_INVALID;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ void EnSi_Init(Actor* thisx, PlayState* play);
|
||||
void EnSi_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnSi_Update(Actor* thisx, PlayState* play);
|
||||
void EnSi_Draw(Actor* thisx, PlayState* play);
|
||||
void EnSi_Reset();
|
||||
|
||||
s32 func_80AFB748(EnSi* this, PlayState* play);
|
||||
void func_80AFB768(EnSi* this, PlayState* play);
|
||||
@ -61,7 +62,7 @@ const ActorInit En_Si_InitVars = {
|
||||
(ActorFunc)EnSi_Destroy,
|
||||
(ActorFunc)EnSi_Update,
|
||||
(ActorFunc)EnSi_Draw,
|
||||
NULL,
|
||||
(ActorResetFunc)EnSi_Reset,
|
||||
};
|
||||
|
||||
void EnSi_Init(Actor* thisx, PlayState* play) {
|
||||
@ -224,6 +225,11 @@ void EnSi_Draw(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
void EnSi_Reset() {
|
||||
textId = 0xB4;
|
||||
giveItemId = ITEM_SKULL_TOKEN;
|
||||
}
|
||||
|
||||
void Randomizer_UpdateSkullReward(EnSi* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user