khan -> dev

This commit is contained in:
briaguya 2023-03-02 17:13:31 -05:00 committed by GitHub
commit 76ceda3118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 51 deletions

View File

@ -90,39 +90,39 @@ void RegisterInfiniteNayrusLove() {
void RegisterMoonJumpOnL() { void RegisterMoonJumpOnL() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!gPlayState) return;
if (CVarGetInteger("gMoonJumpOnL", 0) != 0) { if (CVarGetInteger("gMoonJumpOnL", 0) != 0) {
if (gPlayState) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) { if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
player->actor.velocity.y = 6.34375f; player->actor.velocity.y = 6.34375f;
} }
} }
}
}); });
} }
void RegisterInfiniteISG() { void RegisterInfiniteISG() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!gPlayState) return;
if (CVarGetInteger("gEzISG", 0) != 0) { if (CVarGetInteger("gEzISG", 0) != 0) {
if (gPlayState) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
player->swordState = 1; player->swordState = 1;
} }
}
}); });
} }
void RegisterUnrestrictedItems() { void RegisterUnrestrictedItems() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!gPlayState) return;
if (CVarGetInteger("gNoRestrictItems", 0) != 0) { if (CVarGetInteger("gNoRestrictItems", 0) != 0) {
if (gPlayState) {
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong; u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions)); memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions));
gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup; gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup;
} }
}
}); });
} }
@ -143,36 +143,32 @@ void RegisterFreezeTime() {
/// Switches Link's age and respawns him at the last entrance he entered. /// Switches Link's age and respawns him at the last entrance he entered.
void RegisterSwitchAge() { void RegisterSwitchAge() {
bool warped = false; GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
Vec3f playerPos; static bool warped = false;
int16_t playerYaw; static Vec3f playerPos;
static int16_t playerYaw;
if (!gPlayState) return;
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&warped, &playerPos, &playerYaw]() {
if (CVarGetInteger("gSwitchAge", 0) != 0) { if (CVarGetInteger("gSwitchAge", 0) != 0) {
CVarSetInteger("gSwitchAge", 0); CVarSetInteger("gSwitchAge", 0);
if (gPlayState) {
playerPos = GET_PLAYER(gPlayState)->actor.world.pos; playerPos = GET_PLAYER(gPlayState)->actor.world.pos;
playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y; playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y;
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex; gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
gPlayState->sceneLoadFlag = 0x14; gPlayState->sceneLoadFlag = 0x14;
gPlayState->fadeTransition = 11; gPlayState->fadeTransition = 11;
gSaveContext.nextTransitionType = 11; gSaveContext.nextTransitionType = 11;
gPlayState->linkAgeOnLoad ^= 1;
warped = true; warped = true;
if (gPlayState->linkAgeOnLoad == 1) {
gPlayState->linkAgeOnLoad = 0;
} else {
gPlayState->linkAgeOnLoad = 1;
}
}
} }
if (gPlayState) {
if (warped && gPlayState->sceneLoadFlag != 0x0014 && gSaveContext.nextTransitionType == 255) { if (warped && gPlayState->sceneLoadFlag != 0x0014 && gSaveContext.nextTransitionType == 255) {
GET_PLAYER(gPlayState)->actor.shape.rot.y = playerYaw; GET_PLAYER(gPlayState)->actor.shape.rot.y = playerYaw;
GET_PLAYER(gPlayState)->actor.world.pos = playerPos; GET_PLAYER(gPlayState)->actor.world.pos = playerPos;
warped = false; warped = false;
} }
}
}); });
} }

View File

@ -846,18 +846,9 @@ namespace GameMenuBar {
UIWidgets::PaddedSeparator(false, true); UIWidgets::PaddedSeparator(false, true);
// Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility // Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility
const uint16_t selectedAutosaveId = CVarGetInteger("gAutosave", 0);
std::string autosaveLabels[] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
UIWidgets::PaddedText("Autosave", false, true); UIWidgets::PaddedText("Autosave", false, true);
if (ImGui::BeginCombo("##AutosaveComboBox", autosaveLabels[selectedAutosaveId].c_str())) { const char* autosaveLabels[] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
for (int index = 0; index < sizeof(autosaveLabels) / sizeof(autosaveLabels[0]); index++) { UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, (sizeof(autosaveLabels) / sizeof(autosaveLabels[0])), CVarGetInteger("gAutosave", 0));
if (ImGui::Selectable(autosaveLabels[index].c_str(), index == selectedAutosaveId)) {
CVarSetInteger("gAutosave", index);
}
}
ImGui::EndCombo();
}
UIWidgets::Tooltip("Automatically save the game every time a new area is entered and/or item is obtained\n" UIWidgets::Tooltip("Automatically save the game every time a new area is entered and/or item is obtained\n"
"Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)"); "Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)");