Working on night and day transition

This commit is contained in:
Vladislav Khorev 2026-06-04 17:14:10 +03:00
parent ed8d6f2e92
commit 83b92e9881
6 changed files with 25 additions and 0 deletions

View File

@ -616,6 +616,7 @@
"cutscenes": [{ "cutscenes": [{
"id": "sleep_cutscene001", "id": "sleep_cutscene001",
"background": "resources/test_cutscene001.png", "background": "resources/test_cutscene001.png",
"onFadeInCallback": "on_sleep_cutscene",
"durationMs": 5000, "durationMs": 5000,
"fadeOutMs": 500, "fadeOutMs": 500,
"fadeInMs": 500, "fadeInMs": 500,

View File

@ -99,6 +99,7 @@ else
game_api.start_cutscene("sleep_cutscene001") game_api.start_cutscene("sleep_cutscene001")
game_api.setIntValue("need_sleep", 0) game_api.setIntValue("need_sleep", 0)
game_api.set_player_hp(200) game_api.set_player_hp(200)
--game_api.set_day() - done in cutscene
end end
end end
@ -110,6 +111,11 @@ function on_locked_door_click()
game_api.start_dialogue("door_locked_dialog001") game_api.start_dialogue("door_locked_dialog001")
end end
function on_sleep_cutscene()
print("Cutscene 2 done!")
night_time = true
game_api.set_day()
end
function on_alik_door_click() function on_alik_door_click()

View File

@ -468,6 +468,7 @@ end
function on_sleep_cutscene() function on_sleep_cutscene()
print("Cutscene 2 done!") print("Cutscene 2 done!")
night_time = true night_time = true
game_api.set_night()
--game_api.set_trigger_zone_enabled(1, false) --game_api.set_trigger_zone_enabled(1, false)
game_api.set_npc_enabled(0, false) game_api.set_npc_enabled(0, false)
game_api.switch_navigation(5) game_api.switch_navigation(5)

View File

@ -271,6 +271,7 @@ namespace ZL
locations["uni_interior"]->setup(uniInteriorParams, &menuManager.questJournal); locations["uni_interior"]->setup(uniInteriorParams, &menuManager.questJournal);
locations["uni_interior"]->scriptEngine.setGlobalStore(&globalInts); locations["uni_interior"]->scriptEngine.setGlobalStore(&globalInts);
locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&globalFloats); locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&globalFloats);
locations["uni_interior"]->requestNightDayTransition = [this](bool isNight) { this->isNight = isNight; };
locations["uni_interior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); }; locations["uni_interior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
locations["uni_interior"]->requestAdvanceDarklandsHud = [this]() { menuManager.advanceUniIntDarklandsHud(); }; locations["uni_interior"]->requestAdvanceDarklandsHud = [this]() { menuManager.advanceUniIntDarklandsHud(); };
if (locations["uni_interior"]->player) if (locations["uni_interior"]->player)
@ -299,6 +300,7 @@ namespace ZL
locations["uni_exterior"]->setup(uniExteriorParams, &menuManager.questJournal); locations["uni_exterior"]->setup(uniExteriorParams, &menuManager.questJournal);
locations["uni_exterior"]->scriptEngine.setGlobalStore(&globalInts); locations["uni_exterior"]->scriptEngine.setGlobalStore(&globalInts);
locations["uni_exterior"]->scriptEngine.setGlobalFloatStore(&globalFloats); locations["uni_exterior"]->scriptEngine.setGlobalFloatStore(&globalFloats);
locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight) { this->isNight = isNight; };
locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); }; locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
if (locations["uni_exterior"]->player) if (locations["uni_exterior"]->player)
locations["uni_exterior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); }; locations["uni_exterior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
@ -361,6 +363,7 @@ namespace ZL
locations["location_dorm"]->setup(params_dorm, &menuManager.questJournal); locations["location_dorm"]->setup(params_dorm, &menuManager.questJournal);
locations["location_dorm"]->scriptEngine.setGlobalStore(&globalInts); locations["location_dorm"]->scriptEngine.setGlobalStore(&globalInts);
locations["location_dorm"]->scriptEngine.setGlobalFloatStore(&globalFloats); locations["location_dorm"]->scriptEngine.setGlobalFloatStore(&globalFloats);
locations["location_dorm"]->requestNightDayTransition = [this](bool isNight) { this->isNight = isNight; };
locations["location_dorm"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); }; locations["location_dorm"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
if (locations["location_dorm"]->player) if (locations["location_dorm"]->player)
locations["location_dorm"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); }; locations["location_dorm"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };

View File

@ -109,6 +109,8 @@ namespace ZL
// request the transition without coupling Location to Game directly. // request the transition without coupling Location to Game directly.
std::function<bool()> requestDarklandsTransition; std::function<bool()> requestDarklandsTransition;
std::function<void(bool)> requestNightDayTransition;
// Set by Game after setup(). Lua calls this to advance the uni_interior HUD // Set by Game after setup(). Lua calls this to advance the uni_interior HUD
// from step12 to step13 (trigger-zone encounter hint). // from step12 to step13 (trigger-zone encounter hint).
std::function<void()> requestAdvanceDarklandsHud; std::function<void()> requestAdvanceDarklandsHud;

View File

@ -204,6 +204,18 @@ namespace ZL {
game->requestDarklandsTransition(); game->requestDarklandsTransition();
}); });
api.set_function("set_day",
[game]() {
game->requestNightDayTransition(false);
});
api.set_function("set_night",
[game]() {
game->requestNightDayTransition(true);
std::cout << "Set night called" << std::endl;
});
// advance_darklands_hud() // advance_darklands_hud()
// Advances the uni_interior darklands HUD from step12 to step13. // Advances the uni_interior darklands HUD from step12 to step13.
// Call when the player enters the ghost trigger zone in darklands. // Call when the player enters the ghost trigger zone in darklands.