Fixing inconsistency between day and nights on uni_int location
This commit is contained in:
parent
f52b6872b0
commit
a9f4025333
@ -18,7 +18,7 @@
|
||||
"hysteresis": 0.5,
|
||||
"enabled": true
|
||||
},{
|
||||
"id": "darklands_exit002",
|
||||
"id": "darklands_exit003",
|
||||
"positionX": 13.3522,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -10.0046,
|
||||
@ -26,13 +26,21 @@
|
||||
"hysteresis": 0.5,
|
||||
"enabled": true
|
||||
},{
|
||||
"id": "darklands_exit002",
|
||||
"id": "darklands_exit004",
|
||||
"positionX": 9.92273,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -15.5795,
|
||||
"radius": 3.3,
|
||||
"hysteresis": 0.5,
|
||||
"enabled": true
|
||||
},{
|
||||
"id": "darklands_exit005",
|
||||
"positionX": 8.57705,
|
||||
"positionY": 0.0,
|
||||
"positionZ": -4.06573,
|
||||
"radius": 5.0,
|
||||
"hysteresis": 0.7,
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -658,7 +658,7 @@
|
||||
"type": "Line",
|
||||
"speaker": "Бекзат",
|
||||
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||
"text": "Мне некогда деградировать, мне нужно сегодня 100% быть на лекции!",
|
||||
"text": "Мне некогда деградировать сегодня, у меня много дел!",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
|
||||
@ -206,7 +206,7 @@
|
||||
"type": "Line",
|
||||
"speaker": "Бекзат",
|
||||
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||
"text": "Мне некогда деградировать, мне нужно сегодня 100% быть на лекции!",
|
||||
"text": "Мне некогда деградировать сегодня, у меня много дел!",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
|
||||
@ -1266,7 +1266,7 @@
|
||||
"type": "Line",
|
||||
"speaker": "Бекзат",
|
||||
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||
"text": "Мне некогда деградировать сейчас!",
|
||||
"text": "Мне некогда деградировать сегодня, у меня много дел!",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
|
||||
@ -106,6 +106,9 @@ function on_bed_sleep()
|
||||
game_api.setIntValue("need_sleep", 0)
|
||||
game_api.set_player_hp(200)
|
||||
--game_api.set_day() - done in cutscene
|
||||
local day = game_api.getIntValue("day")
|
||||
game_api.setIntValue("day", day+1)
|
||||
print("Setting to day 1----x")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -84,6 +84,15 @@ game_api.set_trigger_zone_callbacks("darklands_exit003",
|
||||
darklands_exit001_enter_callback,
|
||||
nil
|
||||
)
|
||||
game_api.set_trigger_zone_callbacks("darklands_exit004",
|
||||
darklands_exit001_enter_callback,
|
||||
nil
|
||||
)
|
||||
game_api.set_trigger_zone_callbacks("darklands_exit005",
|
||||
darklands_exit001_enter_callback,
|
||||
nil
|
||||
)
|
||||
|
||||
|
||||
|
||||
function taxi_zone001_enter_callback()
|
||||
|
||||
@ -8,11 +8,21 @@ player_hold_key = false
|
||||
teacher_arrived = false
|
||||
teacher_told_about_book = false
|
||||
|
||||
night_time = false
|
||||
|
||||
--player_left_darklands = false
|
||||
|
||||
was_darklands = false
|
||||
--was_darklands = false
|
||||
|
||||
|
||||
--[[
|
||||
0 - day0
|
||||
1 - darklands
|
||||
2 - morning
|
||||
3 - night
|
||||
4 - day
|
||||
|
||||
]]
|
||||
was_state_when_player_left = 0
|
||||
was_day_when_player_left = 0
|
||||
|
||||
morning_can_open_door_index = 0
|
||||
morning_did_open_door_index = 0
|
||||
@ -58,7 +68,7 @@ function knife_dialog_zone001_enter_callback()
|
||||
game_api.switch_navigation(4)
|
||||
end
|
||||
else
|
||||
if (night_time == false) then
|
||||
if (game_api.is_night() == false) then
|
||||
game_api.start_dialogue("knife_dialog_second001")
|
||||
game_api.set_trigger_zone_enabled(1, false)
|
||||
end
|
||||
@ -103,7 +113,7 @@ function on_book_pickup()
|
||||
if (teacher_told_about_book) then
|
||||
print("on_book_pickup step1")
|
||||
if not player_hold_book then
|
||||
if (night_time) or (day >= 1) then
|
||||
if (game_api.is_night()) or (day >= 1) then
|
||||
game_api.start_dialogue("book_dialog006")
|
||||
else
|
||||
game_api.pickup_item("book")
|
||||
@ -224,7 +234,7 @@ function on_library_door_click()
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 0) then
|
||||
if (night_time) then
|
||||
if (game_api.is_night()) then
|
||||
game_api.start_dialogue("door_night_dialog001")
|
||||
else
|
||||
if (not lection_is_over) then
|
||||
@ -247,13 +257,6 @@ function on_library_door_click()
|
||||
print("Library door step 4")
|
||||
end
|
||||
print("Library door step5")
|
||||
--[[
|
||||
if (game_api.is_night() and not game.is_dawn()) then
|
||||
game_api.start_dialogue("door_dialog001")
|
||||
end
|
||||
if (game_api.is_night() and game.is_dawn() and not (morning_did_open_door_index == 4) then
|
||||
game_api.start_dialogue("door_dialog001")
|
||||
end]]
|
||||
end
|
||||
print("Library door step 5")
|
||||
end
|
||||
@ -266,7 +269,7 @@ function on_teachers_door_click()
|
||||
print("day is")
|
||||
print(day)
|
||||
|
||||
if (day == 0) then
|
||||
if (day == 0) and not game_api.is_dawn() then
|
||||
if (player_hold_key) then
|
||||
if (not teacher_door_opened) then
|
||||
teacher_door_opened = true
|
||||
@ -373,7 +376,7 @@ function on_hall_door_click()
|
||||
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 0) then
|
||||
if (day == 0) and not game_api.is_dawn() then
|
||||
if (not hall_door_opened) then
|
||||
hall_door_opened = true
|
||||
game_api.switch_navigation(1)
|
||||
@ -499,7 +502,7 @@ function book_dialog_zone001_enter_callback()
|
||||
game_api.advance_darklands_hud()
|
||||
else
|
||||
print("book_dialog_zone001_enter_callback step 3")
|
||||
if (player_hold_book) and (night_time == false) then
|
||||
if (player_hold_book) and (game_api.is_night() == false) then
|
||||
print("book_dialog_zone001_enter_callback step 4")
|
||||
game_api.start_dialogue("book_dialog001")
|
||||
game_api.switch_navigation(0)
|
||||
@ -510,7 +513,7 @@ end
|
||||
|
||||
function book_dialog_zone001_exit_callback()
|
||||
print("book_dialog_zone001_exit_callback step 1")
|
||||
if (player_hold_book) and (night_time == false) then
|
||||
if (player_hold_book) and (game_api.is_night() == false) then
|
||||
game_api.switch_navigation(3)
|
||||
end
|
||||
end
|
||||
@ -519,17 +522,15 @@ function on_computer_clicked()
|
||||
print("on_computer_clicked--")
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 1) then
|
||||
-- TODO: some dialog like I don't need it
|
||||
if game_api.is_darklands() then
|
||||
game_api.start_dialogue("computer_dialog004")
|
||||
elseif (day >= 1) or game_api.is_dawn() then
|
||||
print("on_computer_clicked--1")
|
||||
game_api.start_dialogue("computer_dialog003")
|
||||
else
|
||||
if game_api.is_darklands() then
|
||||
game_api.start_dialogue("computer_dialog004")
|
||||
else
|
||||
if teacher_told_about_book then
|
||||
print("on_computer_clicked--2")
|
||||
if (night_time == false) then
|
||||
if (game_api.is_night() == false) then
|
||||
print("on_computer_clicked--3")
|
||||
if (player_hold_book) then
|
||||
print("on_computer_clicked--4")
|
||||
@ -548,12 +549,11 @@ function on_computer_clicked()
|
||||
game_api.start_dialogue("computer_dialog001")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_sleep_cutscene()
|
||||
print("Cutscene 2 done!")
|
||||
night_time = true
|
||||
|
||||
game_api.set_night()
|
||||
--game_api.set_trigger_zone_enabled(1, false)
|
||||
game_api.set_npc_enabled(0, false)
|
||||
@ -662,8 +662,6 @@ game_api.set_darklands_callbacks(
|
||||
game_api.npc_set_position(5, 5.0, 0, 12)
|
||||
end
|
||||
|
||||
night_time = false
|
||||
|
||||
game_api.switch_navigation(5)
|
||||
end,
|
||||
function()
|
||||
@ -674,8 +672,7 @@ game_api.set_darklands_callbacks(
|
||||
game_api.set_npc_enabled(3, false)
|
||||
game_api.set_npc_enabled(4, false)
|
||||
game_api.set_npc_enabled(5, false)
|
||||
game_api.setIntValue("day", 1)
|
||||
print("Setting to day 1----x")
|
||||
|
||||
--game_api.setIntValue("need_sleep", 1)
|
||||
--player_left_darklands = true
|
||||
morning_did_open_door_index = 0
|
||||
@ -902,7 +899,7 @@ function setDay1MorningSetup()
|
||||
end
|
||||
|
||||
function setDay1NightSetup()
|
||||
night_time = true
|
||||
|
||||
teacher_door_opened = false
|
||||
|
||||
print("setDay1NightSetup")
|
||||
@ -1168,6 +1165,67 @@ game_api.set_location_callbacks(
|
||||
print("day is:")
|
||||
print(day)
|
||||
|
||||
local resetState = false
|
||||
if not (day == was_day_when_player_left) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 1) and game_api.is_darklands() == false then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 2) and (game_api.is_darklands() or game_api.is_dawn() == false) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 3) and (game_api.is_darklands() or game_api.is_night() == false) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 4) and (game_api.is_night() or game_api.is_darklands()) then
|
||||
resetState = true
|
||||
end
|
||||
|
||||
if (day > 0) and resetState then
|
||||
|
||||
if (game_api.is_darklands()) then
|
||||
--Currently not possible
|
||||
print("Entered darklands setup")
|
||||
elseif (game_api.is_dawn()) then
|
||||
print("setDay1MorningSetup entered-")
|
||||
setDay1MorningSetup()
|
||||
elseif (game_api.is_night()) then
|
||||
print("entered night setup")
|
||||
setDay1NightSetup()
|
||||
game_api.switch_navigation(17)
|
||||
else
|
||||
print("entered day setup")
|
||||
setDay1setup()
|
||||
game_api.switch_navigation(3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
local day = game_api.getIntValue("day")
|
||||
if (day == 0)then
|
||||
was_state_when_player_left = 0
|
||||
elseif game_api.is_darklands() then
|
||||
was_state_when_player_left = 1
|
||||
elseif game_api.is_dawn() then
|
||||
was_state_when_player_left = 2
|
||||
elseif game_api.is_night() then
|
||||
was_state_when_player_left = 3
|
||||
else
|
||||
was_state_when_player_left = 4
|
||||
end
|
||||
possible situation combinations:
|
||||
left from darklands
|
||||
left from morning
|
||||
left from day
|
||||
left from night
|
||||
|
||||
arrive in darklands
|
||||
arrive in morning
|
||||
arrive in day
|
||||
arrive in night
|
||||
|
||||
]]
|
||||
|
||||
|
||||
|
||||
if (day > 0) and (game_api.is_night() == false) then
|
||||
print("entered day setup")
|
||||
setDay1setup()
|
||||
@ -1182,18 +1240,6 @@ game_api.set_location_callbacks(
|
||||
setDay1MorningSetup()
|
||||
end
|
||||
|
||||
--[[
|
||||
|
||||
local need_sleep = game_api.getIntValue("need_sleep")
|
||||
local day = game_api.getIntValue("day")
|
||||
if (day > 0) and (need_sleep == 1) then
|
||||
setDay1MorningSetup()
|
||||
elseif (day > 0) then
|
||||
setDay1setup()
|
||||
game_api.switch_navigation(3)
|
||||
else
|
||||
--Do nothing, it should have been already set up
|
||||
end]]
|
||||
end,
|
||||
function()
|
||||
print("Exit location uni interior")
|
||||
@ -1201,7 +1247,30 @@ game_api.set_location_callbacks(
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
|
||||
was_darklands = game_api.is_darklands()
|
||||
|
||||
--[[
|
||||
0 - day0
|
||||
1 - darklands
|
||||
2 - morning
|
||||
3 - night
|
||||
4 - day
|
||||
|
||||
]]
|
||||
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
was_day_when_player_left = day
|
||||
if (day == 0)then
|
||||
was_state_when_player_left = 0
|
||||
elseif game_api.is_darklands() then
|
||||
was_state_when_player_left = 1
|
||||
elseif game_api.is_dawn() then
|
||||
was_state_when_player_left = 2
|
||||
elseif game_api.is_night() then
|
||||
was_state_when_player_left = 3
|
||||
else
|
||||
was_state_when_player_left = 4
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ namespace ZL
|
||||
Game::Game()
|
||||
: newTickCount(0)
|
||||
, lastTickCount(0)
|
||||
, menuManager(renderer)
|
||||
, menuManager(renderer, globalInts)
|
||||
, audioPlayer(std::make_unique<AudioPlayerAsync>())
|
||||
{
|
||||
}
|
||||
|
||||
@ -75,8 +75,9 @@ namespace ZL {
|
||||
}
|
||||
}
|
||||
|
||||
MenuManager::MenuManager(Renderer& iRenderer) :
|
||||
renderer(iRenderer)
|
||||
MenuManager::MenuManager(Renderer& iRenderer, std::unordered_map<std::string, int>& globalInts) :
|
||||
renderer(iRenderer),
|
||||
globalInts(globalInts)
|
||||
{
|
||||
}
|
||||
|
||||
@ -492,14 +493,23 @@ namespace ZL {
|
||||
});
|
||||
uiManager.setButtonCallback("videoSkip", [this](const std::string&) {
|
||||
closePhoneEntirely();
|
||||
|
||||
if (isNight)
|
||||
{
|
||||
startDialogueFunc("dialog_video002");
|
||||
}
|
||||
else
|
||||
{
|
||||
auto day = globalInts["day"];
|
||||
if (day == 0)
|
||||
{
|
||||
startDialogueFunc("dialog_video003");
|
||||
}
|
||||
else
|
||||
{
|
||||
startNightTransitionFunc();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -38,13 +38,14 @@ namespace ZL {
|
||||
UiManager uiManager;
|
||||
UiManager topUiManager;
|
||||
ZL::Quest::QuestJournal questJournal;
|
||||
std::unordered_map<std::string, int>& globalInts;
|
||||
|
||||
// Global night mode state — persists across location transitions.
|
||||
bool isNight = false;
|
||||
bool isDawn = false; // sub-variant of night: brighter pink ambient, same lighting
|
||||
|
||||
|
||||
MenuManager(Renderer& iRenderer);
|
||||
MenuManager(Renderer& iRenderer, std::unordered_map<std::string, int>& globalInts);
|
||||
|
||||
void setup(Inventory& inv, const std::string& zipFile);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user