Fixing minor bugs in scripts
This commit is contained in:
parent
80133aa8c8
commit
87fb6d4655
@ -151,7 +151,7 @@
|
|||||||
"positionX": 1.5,
|
"positionX": 1.5,
|
||||||
"positionY": 0.975,
|
"positionY": 0.975,
|
||||||
"positionZ": 6.965,
|
"positionZ": 6.965,
|
||||||
"approachRadius": 0.7,
|
"approachRadius": 0.8,
|
||||||
"boundsMaxX": 0.067857146263122559,
|
"boundsMaxX": 0.067857146263122559,
|
||||||
"boundsMaxY": 1.0,
|
"boundsMaxY": 1.0,
|
||||||
"boundsMaxZ": 0.49353456497192383,
|
"boundsMaxZ": 0.49353456497192383,
|
||||||
|
|||||||
@ -151,7 +151,7 @@
|
|||||||
"positionX": 1.5,
|
"positionX": 1.5,
|
||||||
"positionY": 0.975,
|
"positionY": 0.975,
|
||||||
"positionZ": 6.965,
|
"positionZ": 6.965,
|
||||||
"approachRadius": 0.7,
|
"approachRadius": 0.8,
|
||||||
"boundsMaxX": 0.06785714626312256,
|
"boundsMaxX": 0.06785714626312256,
|
||||||
"boundsMaxY": 1.0,
|
"boundsMaxY": 1.0,
|
||||||
"boundsMaxZ": 0.49353456497192383,
|
"boundsMaxZ": 0.49353456497192383,
|
||||||
|
|||||||
@ -28,9 +28,9 @@
|
|||||||
"meshTextures": {
|
"meshTextures": {
|
||||||
"Girl_Low": "resources/w/girlfriend/Girl_Base_color.png"
|
"Girl_Low": "resources/w/girlfriend/Girl_Base_color.png"
|
||||||
},
|
},
|
||||||
"positionX": 1.0,
|
"positionX": 0.799619,
|
||||||
"positionY": 0.0,
|
"positionY": 0.0,
|
||||||
"positionZ": -7.525,
|
"positionZ": -9.55679,
|
||||||
"facingAngle" : 180,
|
"facingAngle" : 180,
|
||||||
"walkSpeed": 1.66,
|
"walkSpeed": 1.66,
|
||||||
"rotationSpeed": 8.0,
|
"rotationSpeed": 8.0,
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
"positionZ": 0.0,
|
"positionZ": 0.0,
|
||||||
"radius": 1.5,
|
"radius": 1.5,
|
||||||
"active": false,
|
"active": false,
|
||||||
|
"automatic": true,
|
||||||
|
"automaticRadius": 1.4,
|
||||||
"destinationLocation": "uni_exterior",
|
"destinationLocation": "uni_exterior",
|
||||||
"destinationPositionX": -14.8449,
|
"destinationPositionX": -14.8449,
|
||||||
"destinationPositionY": 0.0,
|
"destinationPositionY": 0.0,
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
"positionY": 0.0,
|
"positionY": 0.0,
|
||||||
"positionZ": 6.17516,
|
"positionZ": 6.17516,
|
||||||
"radius": 2.5,
|
"radius": 2.5,
|
||||||
"hysteresis": 0.2,
|
"hysteresis": 0.3,
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -659,10 +659,10 @@
|
|||||||
{
|
{
|
||||||
"id": "game_complete_cutscene001",
|
"id": "game_complete_cutscene001",
|
||||||
"skippable": true,
|
"skippable": true,
|
||||||
"durationMs": 5000,
|
"durationMs": 12000,
|
||||||
"fadeOutMs": 0,
|
"fadeOutMs": 0,
|
||||||
"fadeInMs": 500,
|
"fadeInMs": 500,
|
||||||
"endFadeOutMs": 500,
|
"endFadeOutMs": 0,
|
||||||
"endFadeInMs": 500,
|
"endFadeInMs": 500,
|
||||||
"onFadeInCallback": "",
|
"onFadeInCallback": "",
|
||||||
"imageSegments": [
|
"imageSegments": [
|
||||||
@ -671,7 +671,7 @@
|
|||||||
"width": 1280,
|
"width": 1280,
|
||||||
"height": 720,
|
"height": 720,
|
||||||
"startMs": 0,
|
"startMs": 0,
|
||||||
"endMs": 12500,
|
"endMs": 13500,
|
||||||
"fadeInMs": 0,
|
"fadeInMs": 0,
|
||||||
"fadeOutMs": 0,
|
"fadeOutMs": 0,
|
||||||
"easing": "Linear",
|
"easing": "Linear",
|
||||||
|
|||||||
@ -35,6 +35,24 @@
|
|||||||
"type": "End"
|
"type": "End"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dialog_contaier003",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "Я уже забрал курсовую работу Бегимай, больше мне незачем сюда лезть.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "dialog_contaier002",
|
"id": "dialog_contaier002",
|
||||||
@ -62,6 +80,7 @@
|
|||||||
"speaker": "Бекзат",
|
"speaker": "Бекзат",
|
||||||
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
"text": "Ага, нашел! Вот и она!",
|
"text": "Ага, нашел! Вот и она!",
|
||||||
|
"luaCallback": "dialog_contaier002_get_coursework",
|
||||||
"next": "end_1"
|
"next": "end_1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,57 @@
|
|||||||
{
|
{
|
||||||
"dialogues": [
|
"dialogues": [
|
||||||
|
{
|
||||||
|
"id": "darklands_day_dialog001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "Это заклинание не работает днем.",
|
||||||
|
"next": "line_2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "line_2",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "Чтобы перейти в теневой мир, мне нужно дождаться ночи.",
|
||||||
|
"next": "line_3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "line_3",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "Чтобы время пролетело быстро, я могу посидеть в телефоне и позалипать в короткие видео.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "darklands_morning_dialog001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "У меня силы закончились и мне спать хочется. Достаточно теневого мира на сегодня, поехали в общагу.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "knife_dialog001",
|
"id": "knife_dialog001",
|
||||||
"start": "line_1",
|
"start": "line_1",
|
||||||
@ -310,7 +362,7 @@
|
|||||||
"type": "Line",
|
"type": "Line",
|
||||||
"speaker": "Бекзат",
|
"speaker": "Бекзат",
|
||||||
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
"text": "Хорошо что эти двери открываются изнутри.",
|
"text": "Хорошо, что у меня уже есть ключ от этой двери.",
|
||||||
"next": "end_1"
|
"next": "end_1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1079,6 +1131,24 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "computer_dialog004",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/dialogue/portrait_hero_neutral.png",
|
||||||
|
"text": "Похоже, компьютеры в теневом режиме не функционируют никак.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "dialog_report_card001",
|
"id": "dialog_report_card001",
|
||||||
"start": "line_1",
|
"start": "line_1",
|
||||||
|
|||||||
@ -22,29 +22,38 @@ end
|
|||||||
|
|
||||||
function on_container_clicked()
|
function on_container_clicked()
|
||||||
local player_container_aware = game_api.getIntValue("player_container_aware")
|
local player_container_aware = game_api.getIntValue("player_container_aware")
|
||||||
if player_container_aware == 1 then
|
local player_has_coursework = game_api.getIntValue("player_has_coursework")
|
||||||
|
if (player_has_coursework == 1) then
|
||||||
|
game_api.start_dialogue("dialog_contaier003")
|
||||||
|
elseif player_container_aware == 1 then
|
||||||
game_api.start_dialogue("dialog_contaier002")
|
game_api.start_dialogue("dialog_contaier002")
|
||||||
game_api.pickup_item("coursework")
|
|
||||||
game_api.setIntValue("player_has_coursework", 1)
|
|
||||||
game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find")
|
|
||||||
else
|
else
|
||||||
game_api.start_dialogue("dialog_contaier001")
|
game_api.start_dialogue("dialog_contaier001")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function dialog_contaier002_get_coursework()
|
||||||
|
game_api.pickup_item("coursework")
|
||||||
|
game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find")
|
||||||
|
game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find")
|
||||||
|
end
|
||||||
|
|
||||||
game_api.set_enter_night_callback(
|
game_api.set_enter_night_callback(
|
||||||
function()
|
function()
|
||||||
game_api.start_dialogue("dialog_video001")
|
game_api.start_dialogue("dialog_video001")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function on_darklands_over()
|
||||||
|
game_api.set_player_hp(10)
|
||||||
|
end
|
||||||
|
|
||||||
game_api.set_darklands_callbacks(
|
game_api.set_darklands_callbacks(
|
||||||
nil,
|
nil,
|
||||||
function()
|
function()
|
||||||
game_api.start_cutscene("darklands_exit001")
|
game_api.start_cutscene("darklands_exit001")
|
||||||
|
print("Setting to day 1----")
|
||||||
game_api.setIntValue("day", 1)
|
game_api.setIntValue("day", 1)
|
||||||
game_api.setIntValue("need_sleep", 1)
|
|
||||||
game_api.set_player_hp(10)
|
|
||||||
game_api.set_dawn()
|
game_api.set_dawn()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@ -10,7 +10,9 @@ teacher_told_about_book = false
|
|||||||
|
|
||||||
night_time = false
|
night_time = false
|
||||||
|
|
||||||
player_left_darklands = false
|
--player_left_darklands = false
|
||||||
|
|
||||||
|
was_darklands = false
|
||||||
|
|
||||||
morning_can_open_door_index = 0
|
morning_can_open_door_index = 0
|
||||||
morning_did_open_door_index = 0
|
morning_did_open_door_index = 0
|
||||||
@ -153,18 +155,6 @@ function on_npc_interact(npc_index)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
--[[
|
|
||||||
if (player_ghost_aware) then
|
|
||||||
local player_alik_aware = game_api.getIntValue("player_alik_aware")
|
|
||||||
if player_alik_aware == 1 then
|
|
||||||
game_api.start_dialogue("aiperi_dialog002")
|
|
||||||
else
|
|
||||||
game_api.start_dialogue("aiperi_dialog001")
|
|
||||||
game_api.setIntValue("player_alik_aware", 1)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
game_api.start_dialogue("aiperi_dialog003")
|
|
||||||
end]]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if npc_index == 0 then
|
if npc_index == 0 then
|
||||||
@ -292,82 +282,98 @@ function on_teachers_door_click()
|
|||||||
game_api.start_dialogue("door_teacher_dialog001")
|
game_api.start_dialogue("door_teacher_dialog001")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("morning_can_open_door_index is")
|
|
||||||
print(morning_can_open_door_index)
|
if (game_api.is_dawn()) then
|
||||||
|
print("morning_can_open_door_index is")
|
||||||
|
print(morning_can_open_door_index)
|
||||||
|
|
||||||
|
if (teacher_door_opened == false) then
|
||||||
|
teacher_door_opened = true
|
||||||
|
if (morning_can_open_door_index == 3) then
|
||||||
|
morning_did_open_door_index = 3
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(10)
|
||||||
|
else
|
||||||
|
if (morning_did_open_door_index == 1) then
|
||||||
|
--s1 + s3
|
||||||
|
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(16)
|
||||||
|
|
||||||
|
elseif (morning_did_open_door_index == 2) then
|
||||||
|
--s2 + s3
|
||||||
|
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(15)
|
||||||
|
elseif (morning_did_open_door_index == 5) then
|
||||||
|
--n3 + s3
|
||||||
|
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(13)
|
||||||
|
elseif (morning_did_open_door_index == 4) then
|
||||||
|
--n2 + s3
|
||||||
|
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(14)
|
||||||
|
elseif (morning_did_open_door_index == 6) then
|
||||||
|
--hall + s3
|
||||||
|
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(12)
|
||||||
|
else
|
||||||
|
--Player was in corridor, but tries to open the teacher's door
|
||||||
|
--s3 only
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--game_api.start_dialogue("door_unlock_dialog001")
|
elseif (game_api.is_night()) then
|
||||||
|
if (teacher_door_opened == false) then
|
||||||
|
teacher_door_opened = true
|
||||||
if (morning_can_open_door_index == 3) then
|
|
||||||
morning_did_open_door_index = 3
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(10)
|
|
||||||
else
|
|
||||||
if (morning_did_open_door_index == 1) then
|
|
||||||
--s1 + s3
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
if (morning_can_open_door_index == 3) then
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
morning_did_open_door_index = 3
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
end)
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.switch_navigation(16)
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
elseif (morning_did_open_door_index == 2) then
|
game_api.switch_navigation(10)
|
||||||
--s2 + s3
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(15)
|
|
||||||
elseif (morning_did_open_door_index == 5) then
|
|
||||||
--n3 + s3
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(13)
|
|
||||||
elseif (morning_did_open_door_index == 4) then
|
|
||||||
--n2 + s3
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(14)
|
|
||||||
elseif (morning_did_open_door_index == 6) then
|
|
||||||
--hall + s3
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(12)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
if (morning_can_open_door_index == 3) then
|
|
||||||
print("morning_did_open_door_index is")
|
|
||||||
print(morning_did_open_door_index)
|
|
||||||
if (morning_did_open_door_index == 0) then
|
|
||||||
morning_did_open_door_index = 3
|
|
||||||
game_api.start_dialogue("door_unlock_dialog001")
|
|
||||||
|
|
||||||
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
||||||
end)
|
|
||||||
game_api.switch_navigation(10)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
game_api.start_dialogue("door_dialog001")
|
|
||||||
end]]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -458,8 +464,8 @@ end
|
|||||||
function on_n2_door_click()
|
function on_n2_door_click()
|
||||||
|
|
||||||
|
|
||||||
print("player_left_darklands")
|
--print("player_left_darklands")
|
||||||
print(player_left_darklands)
|
--print(player_left_darklands)
|
||||||
print("morning_can_open_door_index")
|
print("morning_can_open_door_index")
|
||||||
print(morning_can_open_door_index)
|
print(morning_can_open_door_index)
|
||||||
print("morning_did_open_door_index")
|
print("morning_did_open_door_index")
|
||||||
@ -507,9 +513,9 @@ function book_dialog_zone001_enter_callback()
|
|||||||
print("book_dialog_zone001_enter_callback step 3")
|
print("book_dialog_zone001_enter_callback step 3")
|
||||||
if (player_hold_book) and (night_time == false) then
|
if (player_hold_book) and (night_time == false) then
|
||||||
print("book_dialog_zone001_enter_callback step 4")
|
print("book_dialog_zone001_enter_callback step 4")
|
||||||
game_api.player_stop()
|
|
||||||
game_api.start_dialogue("book_dialog001")
|
game_api.start_dialogue("book_dialog001")
|
||||||
game_api.switch_navigation(0)
|
game_api.switch_navigation(0)
|
||||||
|
game_api.player_stop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -530,25 +536,29 @@ function on_computer_clicked()
|
|||||||
print("on_computer_clicked--1")
|
print("on_computer_clicked--1")
|
||||||
game_api.start_dialogue("computer_dialog003")
|
game_api.start_dialogue("computer_dialog003")
|
||||||
else
|
else
|
||||||
if teacher_told_about_book then
|
if game_api.is_darklands() then
|
||||||
print("on_computer_clicked--2")
|
game_api.start_dialogue("computer_dialog004")
|
||||||
if (night_time == false) then
|
else
|
||||||
print("on_computer_clicked--3")
|
if teacher_told_about_book then
|
||||||
if (player_hold_book) then
|
print("on_computer_clicked--2")
|
||||||
print("on_computer_clicked--4")
|
if (night_time == false) then
|
||||||
game_api.quest_set_objective_completed("study_project", "study_project_write")
|
print("on_computer_clicked--3")
|
||||||
game_api.start_cutscene("computer_cutscene001")
|
if (player_hold_book) then
|
||||||
|
print("on_computer_clicked--4")
|
||||||
|
game_api.quest_set_objective_completed("study_project", "study_project_write")
|
||||||
|
game_api.start_cutscene("computer_cutscene001")
|
||||||
|
else
|
||||||
|
print("on_computer_clicked--5")
|
||||||
|
game_api.start_dialogue("book_dialog002")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
print("on_computer_clicked--5")
|
print("on_computer_clicked--6")
|
||||||
game_api.start_dialogue("book_dialog002")
|
game_api.start_dialogue("computer_dialog002")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("on_computer_clicked--6")
|
print("on_computer_clicked--7")
|
||||||
game_api.start_dialogue("computer_dialog002")
|
game_api.start_dialogue("computer_dialog001")
|
||||||
end
|
end
|
||||||
else
|
|
||||||
print("on_computer_clicked--7")
|
|
||||||
game_api.start_dialogue("computer_dialog001")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -576,6 +586,8 @@ function on_sleep_cutscene()
|
|||||||
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
||||||
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
||||||
game_api.activate_interactive_object("Note001")
|
game_api.activate_interactive_object("Note001")
|
||||||
|
|
||||||
|
teacher_door_opened = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_teacher_arrived_intermediate()
|
function on_teacher_arrived_intermediate()
|
||||||
@ -675,8 +687,9 @@ game_api.set_darklands_callbacks(
|
|||||||
game_api.set_npc_enabled(4, false)
|
game_api.set_npc_enabled(4, false)
|
||||||
game_api.set_npc_enabled(5, false)
|
game_api.set_npc_enabled(5, false)
|
||||||
game_api.setIntValue("day", 1)
|
game_api.setIntValue("day", 1)
|
||||||
game_api.setIntValue("need_sleep", 1)
|
print("Setting to day 1----x")
|
||||||
player_left_darklands = true
|
--game_api.setIntValue("need_sleep", 1)
|
||||||
|
--player_left_darklands = true
|
||||||
morning_did_open_door_index = 0
|
morning_did_open_door_index = 0
|
||||||
setDay1MorningSetup()
|
setDay1MorningSetup()
|
||||||
game_api.set_dawn()
|
game_api.set_dawn()
|
||||||
@ -694,9 +707,14 @@ game_api.set_darklands_callbacks(
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
||||||
morning_can_open_door_index = 5
|
morning_can_open_door_index = 5
|
||||||
elseif (pz <= 8.0) and (pz > 0) and (px <= -1.5) then
|
elseif (pz <= 8.0) and (pz > 0) and (px <= -1.5) then
|
||||||
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
if (teacher_door_opened) then
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
|
else
|
||||||
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
||||||
|
end
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
morning_can_open_door_index = 3
|
morning_can_open_door_index = 3
|
||||||
|
|
||||||
elseif (pz <= 0.0) and (pz > -8) and (px >= 1.5) then
|
elseif (pz <= 0.0) and (pz > -8) and (px >= 1.5) then
|
||||||
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
||||||
@ -711,7 +729,11 @@ game_api.set_darklands_callbacks(
|
|||||||
morning_can_open_door_index = 1
|
morning_can_open_door_index = 1
|
||||||
else
|
else
|
||||||
--All set before
|
--All set before
|
||||||
|
if (teacher_door_opened) then
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end
|
||||||
morning_can_open_door_index = 0
|
morning_can_open_door_index = 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -761,6 +783,7 @@ function setDay0setup()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function setDay1setup()
|
function setDay1setup()
|
||||||
|
print("Enter setDay1setup")
|
||||||
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
||||||
game_api.set_object_alpha("Room_Cover_North_2_001", 1)
|
game_api.set_object_alpha("Room_Cover_North_2_001", 1)
|
||||||
game_api.set_object_alpha("Room_Cover_North_3_001", 1)
|
game_api.set_object_alpha("Room_Cover_North_3_001", 1)
|
||||||
@ -802,7 +825,11 @@ function setDay1MorningSetup()
|
|||||||
|
|
||||||
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
||||||
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
||||||
game_api.activate_interactive_object("Room_Cover_South_3_001")
|
--[[if (teacher_door_opened) then
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
else]]
|
||||||
|
game_api.activate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
--end
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
game_api.activate_interactive_object("Room_Cover_Main_Hall_001")
|
game_api.activate_interactive_object("Room_Cover_Main_Hall_001")
|
||||||
|
|
||||||
@ -811,7 +838,11 @@ function setDay1MorningSetup()
|
|||||||
game_api.set_object_rotation("Room_N_2_Leaf001", 0)
|
game_api.set_object_rotation("Room_N_2_Leaf001", 0)
|
||||||
game_api.set_object_rotation("Room_S_0_Leaf001", 0)
|
game_api.set_object_rotation("Room_S_0_Leaf001", 0)
|
||||||
game_api.set_object_rotation("Room_S_1_Leaf001", 0)
|
game_api.set_object_rotation("Room_S_1_Leaf001", 0)
|
||||||
game_api.set_object_rotation("Room_S_2_Leaf001", 0)
|
if (teacher_door_opened) then
|
||||||
|
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
||||||
|
else
|
||||||
|
game_api.set_object_rotation("Room_S_2_Leaf001", 0)
|
||||||
|
end
|
||||||
game_api.set_object_rotation("Hall_Leaf001", 0)
|
game_api.set_object_rotation("Hall_Leaf001", 0)
|
||||||
|
|
||||||
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
game_api.set_object_alpha("Room_Cover_North_1_001", 1)
|
||||||
@ -822,6 +853,8 @@ function setDay1MorningSetup()
|
|||||||
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
||||||
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
||||||
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
||||||
|
|
||||||
|
-- TODO: Make check for teacher_door_opened false or true
|
||||||
|
|
||||||
game_api.set_npc_enabled(0, false)
|
game_api.set_npc_enabled(0, false)
|
||||||
game_api.set_npc_enabled(1, false)
|
game_api.set_npc_enabled(1, false)
|
||||||
@ -833,34 +866,61 @@ function setDay1MorningSetup()
|
|||||||
if morning_did_open_door_index == 1 then
|
if morning_did_open_door_index == 1 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
||||||
game_api.set_object_rotation("Room_S_0_Leaf001", 90)
|
game_api.set_object_rotation("Room_S_0_Leaf001", 90)
|
||||||
game_api.switch_navigation(8)
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(16)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(8)
|
||||||
|
end
|
||||||
elseif morning_did_open_door_index == 2 then
|
elseif morning_did_open_door_index == 2 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
||||||
game_api.set_object_rotation("Room_S_1_Leaf001", 90)
|
game_api.set_object_rotation("Room_S_1_Leaf001", 90)
|
||||||
game_api.switch_navigation(9)
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(15)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(9)
|
||||||
|
end
|
||||||
elseif morning_did_open_door_index == 3 then
|
elseif morning_did_open_door_index == 3 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
||||||
|
|
||||||
game_api.switch_navigation(10)
|
game_api.switch_navigation(10)
|
||||||
|
|
||||||
elseif morning_did_open_door_index == 4 then
|
elseif morning_did_open_door_index == 4 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
||||||
game_api.set_object_rotation("Room_N_1_Leaf001", -90)
|
game_api.set_object_rotation("Room_N_1_Leaf001", -90)
|
||||||
game_api.switch_navigation(11)
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(14)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(11)
|
||||||
|
end
|
||||||
elseif morning_did_open_door_index == 5 then
|
elseif morning_did_open_door_index == 5 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
||||||
game_api.set_object_rotation("Room_N_2_Leaf001", -90)
|
game_api.set_object_rotation("Room_N_2_Leaf001", -90)
|
||||||
game_api.switch_navigation(7)
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(13)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(7)
|
||||||
|
end
|
||||||
elseif morning_did_open_door_index == 6 then
|
elseif morning_did_open_door_index == 6 then
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
||||||
game_api.set_object_rotation("Hall_Leaf001", 90)
|
game_api.set_object_rotation("Hall_Leaf001", 90)
|
||||||
game_api.switch_navigation(6)
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(12)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(6)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if (teacher_door_opened) then
|
||||||
|
game_api.switch_navigation(10)
|
||||||
|
else
|
||||||
game_api.switch_navigation(17)
|
game_api.switch_navigation(17)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function setDay1NightSetup()
|
function setDay1NightSetup()
|
||||||
night_time = true
|
night_time = true
|
||||||
|
teacher_door_opened = false
|
||||||
|
|
||||||
print("setDay1NightSetup")
|
print("setDay1NightSetup")
|
||||||
morning_did_open_door_index = 0
|
morning_did_open_door_index = 0
|
||||||
@ -985,7 +1045,15 @@ function on_aiperi_opens_door()
|
|||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(6)
|
|
||||||
|
if (teacher_door_opened) then
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(12)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(6)
|
||||||
|
end
|
||||||
|
|
||||||
--Aiperi incoming
|
--Aiperi incoming
|
||||||
game_api.npc_set_position(1, 0, 0, 6.5)
|
game_api.npc_set_position(1, 0, 0, 6.5)
|
||||||
@ -1003,7 +1071,15 @@ function on_aiperi_opens_door()
|
|||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(7)
|
|
||||||
|
if (teacher_door_opened) then
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(13)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(7)
|
||||||
|
end
|
||||||
|
|
||||||
--Aiperi incoming
|
--Aiperi incoming
|
||||||
game_api.npc_set_position(1, 0.0, 0, 6.43818)
|
game_api.npc_set_position(1, 0.0, 0, 6.43818)
|
||||||
@ -1022,7 +1098,14 @@ function on_aiperi_opens_door()
|
|||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(11)
|
if (teacher_door_opened) then
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(14)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(11)
|
||||||
|
end
|
||||||
|
|
||||||
--Aiperi incoming
|
--Aiperi incoming
|
||||||
game_api.npc_set_position(1, 0, 0, -1.7911)
|
game_api.npc_set_position(1, 0, 0, -1.7911)
|
||||||
@ -1042,7 +1125,15 @@ function on_aiperi_opens_door()
|
|||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(9)
|
|
||||||
|
if (teacher_door_opened) then
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(15)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(9)
|
||||||
|
end
|
||||||
--Aiperi incoming
|
--Aiperi incoming
|
||||||
game_api.npc_set_position(1, 0, 0, -1.7911)
|
game_api.npc_set_position(1, 0, 0, -1.7911)
|
||||||
game_api.set_npc_enabled(1, true)
|
game_api.set_npc_enabled(1, true)
|
||||||
@ -1062,7 +1153,14 @@ function on_aiperi_opens_door()
|
|||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(8)
|
if (teacher_door_opened) then
|
||||||
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
||||||
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
|
end)
|
||||||
|
game_api.switch_navigation(16)
|
||||||
|
else
|
||||||
|
game_api.switch_navigation(8)
|
||||||
|
end
|
||||||
|
|
||||||
--Aiperi incoming
|
--Aiperi incoming
|
||||||
game_api.npc_set_position(1, 0, 0, -9.77948)
|
game_api.npc_set_position(1, 0, 0, -9.77948)
|
||||||
@ -1081,10 +1179,31 @@ end
|
|||||||
|
|
||||||
game_api.set_location_callbacks(
|
game_api.set_location_callbacks(
|
||||||
function()
|
function()
|
||||||
print("Enter location uni interior")
|
print("Enter location uni interior-")
|
||||||
player_left_darklands = false
|
--player_left_darklands = false
|
||||||
local hp = game_api.getFloatValue("player_hp")
|
local hp = game_api.getFloatValue("player_hp")
|
||||||
game_api.set_player_hp(hp)
|
game_api.set_player_hp(hp)
|
||||||
|
local day = game_api.getIntValue("day")
|
||||||
|
|
||||||
|
print("day is:")
|
||||||
|
print(day)
|
||||||
|
|
||||||
|
if (day > 0) and (game_api.is_night()==false) then
|
||||||
|
print("entered day setup")
|
||||||
|
setDay1setup()
|
||||||
|
game_api.switch_navigation(3)
|
||||||
|
end
|
||||||
|
|
||||||
|
print("entered exited-")
|
||||||
|
|
||||||
|
if (was_darklands) and (game_api.is_darklands() == false) and game_api.is_dawn() then
|
||||||
|
--Player died in exterior and then in the morning returned back
|
||||||
|
print("setDay1MorningSetup entered-")
|
||||||
|
setDay1MorningSetup()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
local need_sleep = game_api.getIntValue("need_sleep")
|
local need_sleep = game_api.getIntValue("need_sleep")
|
||||||
local day = game_api.getIntValue("day")
|
local day = game_api.getIntValue("day")
|
||||||
@ -1095,13 +1214,15 @@ game_api.set_location_callbacks(
|
|||||||
game_api.switch_navigation(3)
|
game_api.switch_navigation(3)
|
||||||
else
|
else
|
||||||
--Do nothing, it should have been already set up
|
--Do nothing, it should have been already set up
|
||||||
end
|
end]]
|
||||||
end,
|
end,
|
||||||
function()
|
function()
|
||||||
print("Exit location uni interior")
|
print("Exit location uni interior")
|
||||||
player_left_darklands = false
|
--player_left_darklands = false
|
||||||
local hp = game_api.get_player_hp()
|
local hp = game_api.get_player_hp()
|
||||||
game_api.setFloatValue("player_hp", hp)
|
game_api.setFloatValue("player_hp", hp)
|
||||||
|
|
||||||
|
was_darklands = game_api.is_darklands()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
32
src/Game.cpp
32
src/Game.cpp
@ -247,6 +247,7 @@ namespace ZL
|
|||||||
"resources/navigation/uni_interior4_locked.json" //17
|
"resources/navigation/uni_interior4_locked.json" //17
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
uniInteriorParams.navigationJsonPaths = {
|
uniInteriorParams.navigationJsonPaths = {
|
||||||
"resources/navigation/uni_interior3_darklands_all_open.json",
|
"resources/navigation/uni_interior3_darklands_all_open.json",
|
||||||
@ -310,7 +311,16 @@ 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, bool isDawn) { this->menuManager.isNight = isNight; this->menuManager.isDawn = isDawn; };
|
locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) {
|
||||||
|
this->menuManager.isNight = isNight;
|
||||||
|
this->menuManager.isDawn = isDawn;
|
||||||
|
/*for (auto& locPair : locations) {
|
||||||
|
if (locPair.second) {
|
||||||
|
locPair.second->isNight = isNight;
|
||||||
|
locPair.second->isDawn = isDawn;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
};
|
||||||
locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||||
locations["uni_exterior"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); };
|
locations["uni_exterior"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); };
|
||||||
locations["uni_exterior"]->requestReturnToMainMenu = [this]() { menuManager.showMainMenu(); };
|
locations["uni_exterior"]->requestReturnToMainMenu = [this]() { menuManager.showMainMenu(); };
|
||||||
@ -407,7 +417,12 @@ namespace ZL
|
|||||||
currentLocation->player->targetFacingAngle = destRotY;
|
currentLocation->player->targetFacingAngle = destRotY;
|
||||||
}
|
}
|
||||||
currentLocation->cameraAzimuth = destRotY;
|
currentLocation->cameraAzimuth = destRotY;
|
||||||
|
currentLocation->isDarklands = isDarklands;
|
||||||
|
currentLocation->isNight = menuManager.isNight;
|
||||||
|
currentLocation->isDawn = menuManager.isDawn;
|
||||||
currentLocation->scriptEngine.callLocationEnterCallback();
|
currentLocation->scriptEngine.callLocationEnterCallback();
|
||||||
|
|
||||||
|
|
||||||
menuManager.onLocationChanged(destName);
|
menuManager.onLocationChanged(destName);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -863,6 +878,7 @@ namespace ZL
|
|||||||
currentLocation->dialogueSystem.startCutscene("lection_cutscene001"); //.startDialogue("test_cutscene_pan_dialogue");
|
currentLocation->dialogueSystem.startCutscene("lection_cutscene001"); //.startDialogue("test_cutscene_pan_dialogue");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case SDLK_n:
|
case SDLK_n:
|
||||||
if (editorMode == EditorMode::None)
|
if (editorMode == EditorMode::None)
|
||||||
editorMode = EditorMode::Navigation;
|
editorMode = EditorMode::Navigation;
|
||||||
@ -1239,6 +1255,18 @@ namespace ZL
|
|||||||
|
|
||||||
bool Game::startDarklandsTransition()
|
bool Game::startDarklandsTransition()
|
||||||
{
|
{
|
||||||
|
if (!menuManager.isNight)
|
||||||
|
{
|
||||||
|
currentLocation->dialogueSystem.startDialogue("darklands_day_dialog001");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menuManager.isDawn)
|
||||||
|
{
|
||||||
|
currentLocation->dialogueSystem.startDialogue("darklands_morning_dialog001");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (darklandsFlashActive) return false;
|
if (darklandsFlashActive) return false;
|
||||||
darklandsFlashActive = true;
|
darklandsFlashActive = true;
|
||||||
darklandsFlashFadingIn = true;
|
darklandsFlashFadingIn = true;
|
||||||
@ -1271,6 +1299,7 @@ namespace ZL
|
|||||||
if (currentLocation)
|
if (currentLocation)
|
||||||
{
|
{
|
||||||
//currentLocation->dialogueSystem.startDialogue("dialog_video001");
|
//currentLocation->dialogueSystem.startDialogue("dialog_video001");
|
||||||
|
currentLocation->isNight = menuManager.isNight;
|
||||||
currentLocation->scriptEngine.callTriggerNightEnterCallback();
|
currentLocation->scriptEngine.callTriggerNightEnterCallback();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1280,6 +1309,7 @@ namespace ZL
|
|||||||
menuManager.setDarklandsMode(isDarklands);
|
menuManager.setDarklandsMode(isDarklands);
|
||||||
|
|
||||||
if (currentLocation) {
|
if (currentLocation) {
|
||||||
|
currentLocation->isDarklands = isDarklands;
|
||||||
if (isDarklands)
|
if (isDarklands)
|
||||||
currentLocation->scriptEngine.callDarklandsEnterCallback();
|
currentLocation->scriptEngine.callDarklandsEnterCallback();
|
||||||
else
|
else
|
||||||
|
|||||||
@ -572,6 +572,7 @@ namespace ZL {
|
|||||||
refreshChatUnreadIndicators();
|
refreshChatUnreadIndicators();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MenuManager::closePhoneEntirely() {
|
void MenuManager::closePhoneEntirely() {
|
||||||
activeChatIndex_ = -1;
|
activeChatIndex_ = -1;
|
||||||
state = GameState::Gameplay;
|
state = GameState::Gameplay;
|
||||||
@ -583,6 +584,9 @@ namespace ZL {
|
|||||||
{
|
{
|
||||||
uiManager.setNodeVisible("hint7", true);
|
uiManager.setNodeVisible("hint7", true);
|
||||||
uiManager.setNodeVisible("hint7arrow", true);
|
uiManager.setNodeVisible("hint7arrow", true);
|
||||||
|
|
||||||
|
uiManager.setNodeVisible("hint6a", false);
|
||||||
|
uiManager.setNodeVisible("hint6aarrow", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace ZL {
|
|||||||
ScriptEngine::ScriptEngine() = default;
|
ScriptEngine::ScriptEngine() = default;
|
||||||
ScriptEngine::~ScriptEngine() = default;
|
ScriptEngine::~ScriptEngine() = default;
|
||||||
|
|
||||||
void ScriptEngine::init(Location* game, Inventory* inventory, const std::string& scriptPath) {
|
void ScriptEngine::init(Location* loc, Inventory* inventory, const std::string& scriptPath) {
|
||||||
impl = std::make_unique<Impl>();
|
impl = std::make_unique<Impl>();
|
||||||
sol::state& lua = impl->lua;
|
sol::state& lua = impl->lua;
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ namespace ZL {
|
|||||||
// on_arrived is an optional Lua function called when the NPC reaches the target.
|
// on_arrived is an optional Lua function called when the NPC reaches the target.
|
||||||
// It can call npc_walk_to again (or anything else) to chain behaviour.
|
// It can call npc_walk_to again (or anything else) to chain behaviour.
|
||||||
api.set_function("npc_walk_to",
|
api.set_function("npc_walk_to",
|
||||||
[game](int index, float x, float y, float z, sol::object on_arrived) {
|
[loc](int index, float x, float y, float z, sol::object on_arrived) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] npc_walk_to: index " << index
|
std::cerr << "[script] npc_walk_to: index " << index
|
||||||
<< " out of range (0.." << npcs.size() - 1 << ")\n";
|
<< " out of range (0.." << npcs.size() - 1 << ")\n";
|
||||||
@ -68,7 +68,7 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("player_walk_to",
|
api.set_function("player_walk_to",
|
||||||
[game](float x, float y, float z, sol::object on_arrived) {
|
[loc](float x, float y, float z, sol::object on_arrived) {
|
||||||
|
|
||||||
std::function<void()> cb;
|
std::function<void()> cb;
|
||||||
if (on_arrived.is<sol::protected_function>()) {
|
if (on_arrived.is<sol::protected_function>()) {
|
||||||
@ -81,8 +81,8 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
game->player->homePosition = Eigen::Vector3f(x, 0.f, z);
|
loc->player->homePosition = Eigen::Vector3f(x, 0.f, z);
|
||||||
game->player->setTarget(Eigen::Vector3f(x, y, z), std::move(cb));
|
loc->player->setTarget(Eigen::Vector3f(x, y, z), std::move(cb));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -117,14 +117,14 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// remove_item(item_id)
|
// remove_item(item_id)
|
||||||
api.set_function("remove_item", [game, inventory](const std::string& id) {
|
api.set_function("remove_item", [loc, inventory](const std::string& id) {
|
||||||
std::cout << "[script] remove_item: " << id << std::endl;
|
std::cout << "[script] remove_item: " << id << std::endl;
|
||||||
inventory->removeItem(id);
|
inventory->removeItem(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
// deactivate_interactive_object(object_name)
|
// deactivate_interactive_object(object_name)
|
||||||
api.set_function("deactivate_interactive_object", [game](const std::string& objectName) {
|
api.set_function("deactivate_interactive_object", [loc](const std::string& objectName) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name == objectName) {
|
if (intObj.loadedObject.name == objectName) {
|
||||||
intObj.isActive = false;
|
intObj.isActive = false;
|
||||||
std::cout << "[script] deactivate_interactive_object: " << objectName << std::endl;
|
std::cout << "[script] deactivate_interactive_object: " << objectName << std::endl;
|
||||||
@ -135,8 +135,8 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// activate_interactive_object(object_name)
|
// activate_interactive_object(object_name)
|
||||||
api.set_function("activate_interactive_object", [game](const std::string& objectName) {
|
api.set_function("activate_interactive_object", [loc](const std::string& objectName) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name == objectName) {
|
if (intObj.loadedObject.name == objectName) {
|
||||||
intObj.isActive = true;
|
intObj.isActive = true;
|
||||||
std::cout << "[script] activate_interactive_object: " << objectName << std::endl;
|
std::cout << "[script] activate_interactive_object: " << objectName << std::endl;
|
||||||
@ -146,8 +146,8 @@ namespace ZL {
|
|||||||
std::cerr << "[script] activate_interactive_object: not found: " << objectName << std::endl;
|
std::cerr << "[script] activate_interactive_object: not found: " << objectName << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_object_rotation", [game](const std::string& objectName, float value) {
|
api.set_function("set_object_rotation", [loc](const std::string& objectName, float value) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name == objectName) {
|
if (intObj.loadedObject.name == objectName) {
|
||||||
intObj.rotationY = value * static_cast<float>(M_PI) / 180.f;
|
intObj.rotationY = value * static_cast<float>(M_PI) / 180.f;
|
||||||
std::cout << "[script] set_object_rotation: " << objectName << " " << value << std::endl;
|
std::cout << "[script] set_object_rotation: " << objectName << " " << value << std::endl;
|
||||||
@ -157,8 +157,8 @@ namespace ZL {
|
|||||||
std::cerr << "[script] set_object_rotation: not found: " << objectName << std::endl;
|
std::cerr << "[script] set_object_rotation: not found: " << objectName << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_object_alpha", [game](const std::string& objectName, float value) {
|
api.set_function("set_object_alpha", [loc](const std::string& objectName, float value) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name == objectName) {
|
if (intObj.loadedObject.name == objectName) {
|
||||||
intObj.alpha = value;
|
intObj.alpha = value;
|
||||||
std::cout << "[script] set_object_alpha: " <<objectName << " " << value << std::endl;
|
std::cout << "[script] set_object_alpha: " <<objectName << " " << value << std::endl;
|
||||||
@ -179,16 +179,16 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("start_dialogue",
|
api.set_function("start_dialogue",
|
||||||
[game](const std::string& dialogueId) {
|
[loc](const std::string& dialogueId) {
|
||||||
if (!game->requestDialogueStart(dialogueId)) {
|
if (!loc->requestDialogueStart(dialogueId)) {
|
||||||
std::cerr << "[script] start_dialogue failed for id: " << dialogueId << "\n";
|
std::cerr << "[script] start_dialogue failed for id: " << dialogueId << "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// start_cutscene(cutscene_id)
|
// start_cutscene(cutscene_id)
|
||||||
api.set_function("start_cutscene",
|
api.set_function("start_cutscene",
|
||||||
[game](const std::string& cutsceneId) {
|
[loc](const std::string& cutsceneId) {
|
||||||
if (!game->requestCutsceneStart(cutsceneId))
|
if (!loc->requestCutsceneStart(cutsceneId))
|
||||||
std::cerr << "[script] start_cutscene failed for id: " << cutsceneId << "\n";
|
std::cerr << "[script] start_cutscene failed for id: " << cutsceneId << "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -201,26 +201,26 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_dialogue_flag",
|
api.set_function("set_dialogue_flag",
|
||||||
[game](const std::string& flag, int value) {
|
[loc](const std::string& flag, int value) {
|
||||||
game->setDialogueFlag(flag, value);
|
loc->setDialogueFlag(flag, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("get_dialogue_flag",
|
api.set_function("get_dialogue_flag",
|
||||||
[game](const std::string& flag) {
|
[loc](const std::string& flag) {
|
||||||
return game->getDialogueFlag(flag);
|
return loc->getDialogueFlag(flag);
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_navigation_area_available",
|
api.set_function("set_navigation_area_available",
|
||||||
[game](const std::string& areaName, bool available) {
|
[loc](const std::string& areaName, bool available) {
|
||||||
if (!game->setNavigationAreaAvailable(areaName, available)) {
|
if (!loc->setNavigationAreaAvailable(areaName, available)) {
|
||||||
std::cerr << "[script] set_navigation_area_available: area not found: "
|
std::cerr << "[script] set_navigation_area_available: area not found: "
|
||||||
<< areaName << "\n";
|
<< areaName << "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("switch_navigation",
|
api.set_function("switch_navigation",
|
||||||
[game](int index) {
|
[loc](int index) {
|
||||||
if (!game->switchNavigation(index)) {
|
if (!loc->switchNavigation(index)) {
|
||||||
std::cerr << "[script] switch_navigation: index " << index << " out of range\n";
|
std::cerr << "[script] switch_navigation: index " << index << " out of range\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -240,47 +240,47 @@ namespace ZL {
|
|||||||
// Triggers the white-flash transition to toggle darklands mode.
|
// Triggers the white-flash transition to toggle darklands mode.
|
||||||
// Does nothing if a transition is already in progress.
|
// Does nothing if a transition is already in progress.
|
||||||
api.set_function("start_darklands_transition",
|
api.set_function("start_darklands_transition",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->requestDarklandsTransition)
|
if (loc->requestDarklandsTransition)
|
||||||
game->requestDarklandsTransition();
|
loc->requestDarklandsTransition();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
api.set_function("set_day",
|
api.set_function("set_day",
|
||||||
[game]() {
|
[loc]() {
|
||||||
game->requestNightDayTransition(false, false);
|
loc->requestNightDayTransition(false, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_night",
|
api.set_function("set_night",
|
||||||
[game]() {
|
[loc]() {
|
||||||
game->requestNightDayTransition(true, false);
|
loc->requestNightDayTransition(true, false);
|
||||||
std::cout << "Set night called" << std::endl;
|
std::cout << "Set night called" << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_dawn",
|
api.set_function("set_dawn",
|
||||||
[game]() {
|
[loc]() {
|
||||||
game->requestNightDayTransition(true, true);
|
loc->requestNightDayTransition(true, true);
|
||||||
std::cout << "Set dawn called" << std::endl;
|
std::cout << "Set dawn called" << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
api.set_function("is_night",
|
api.set_function("is_night",
|
||||||
[game]() {
|
[loc]() {
|
||||||
return game->isNight;
|
return loc->isNight;
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("is_dawn",
|
api.set_function("is_dawn",
|
||||||
[game]() {
|
[loc]() {
|
||||||
return game->isDawn;
|
return loc->isDawn;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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.
|
||||||
api.set_function("advance_darklands_hud",
|
api.set_function("advance_darklands_hud",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->requestAdvanceDarklandsHud)
|
if (loc->requestAdvanceDarklandsHud)
|
||||||
game->requestAdvanceDarklandsHud();
|
loc->requestAdvanceDarklandsHud();
|
||||||
});
|
});
|
||||||
|
|
||||||
// set_location_callbacks(on_enter, on_exit)
|
// set_location_callbacks(on_enter, on_exit)
|
||||||
@ -296,7 +296,7 @@ namespace ZL {
|
|||||||
|
|
||||||
// is_darklands() → bool
|
// is_darklands() → bool
|
||||||
api.set_function("is_darklands",
|
api.set_function("is_darklands",
|
||||||
[game]() { return game->isDarklands; });
|
[loc]() { return loc->isDarklands; });
|
||||||
|
|
||||||
api.set_function("setFloatValue",
|
api.set_function("setFloatValue",
|
||||||
[this_impl = impl.get()](const std::string& key, float value) {
|
[this_impl = impl.get()](const std::string& key, float value) {
|
||||||
@ -311,31 +311,31 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("get_player_x",
|
api.set_function("get_player_x",
|
||||||
[game]() -> float {
|
[loc]() -> float {
|
||||||
return game->player ? game->player->position.x() : 0.0f;
|
return loc->player ? loc->player->position.x() : 0.0f;
|
||||||
});
|
});
|
||||||
api.set_function("get_player_z",
|
api.set_function("get_player_z",
|
||||||
[game]() -> float {
|
[loc]() -> float {
|
||||||
return game->player ? game->player->position.z() : 0.0f;
|
return loc->player ? loc->player->position.z() : 0.0f;
|
||||||
});
|
});
|
||||||
|
|
||||||
// set_player_hp(value) — sets the player's current HP directly.
|
// set_player_hp(value) — sets the player's current HP directly.
|
||||||
api.set_function("set_player_hp",
|
api.set_function("set_player_hp",
|
||||||
[game](float value) {
|
[loc](float value) {
|
||||||
if (game->player)
|
if (loc->player)
|
||||||
{
|
{
|
||||||
game->player->hp = value;
|
loc->player->hp = value;
|
||||||
if (game->player->currentState == AnimationState::ACTION_TO_DEATH || game->player->currentState == AnimationState::DEATH_IDLE)
|
if (loc->player->currentState == AnimationState::ACTION_TO_DEATH || loc->player->currentState == AnimationState::DEATH_IDLE)
|
||||||
{
|
{
|
||||||
game->player->currentState = AnimationState::STAND;
|
loc->player->currentState = AnimationState::STAND;
|
||||||
game->player->resetAnim = true;
|
loc->player->resetAnim = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// get_player_hp() → float (0 if no player)
|
// get_player_hp() → float (0 if no player)
|
||||||
api.set_function("get_player_hp",
|
api.set_function("get_player_hp",
|
||||||
[game]() -> float {
|
[loc]() -> float {
|
||||||
return game->player ? game->player->hp : 0.0f;
|
return loc->player ? loc->player->hp : 0.0f;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Global integer store — shared across all location scripts.
|
// Global integer store — shared across all location scripts.
|
||||||
@ -365,15 +365,15 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("close_phone",
|
api.set_function("close_phone",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->requestClosePhone)
|
if (loc->requestClosePhone)
|
||||||
game->requestClosePhone();
|
loc->requestClosePhone();
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("return_to_main_menu",
|
api.set_function("return_to_main_menu",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->requestReturnToMainMenu)
|
if (loc->requestReturnToMainMenu)
|
||||||
game->requestReturnToMainMenu();
|
loc->requestReturnToMainMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_chat_callbacks",
|
api.set_function("set_chat_callbacks",
|
||||||
@ -396,8 +396,8 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("set_trigger_zone_enabled",
|
api.set_function("set_trigger_zone_enabled",
|
||||||
[game](int index, bool value) {
|
[loc](int index, bool value) {
|
||||||
auto& triggerZones = game->triggerZones;
|
auto& triggerZones = loc->triggerZones;
|
||||||
if (index < 0 || index >= static_cast<int>(triggerZones.size())) {
|
if (index < 0 || index >= static_cast<int>(triggerZones.size())) {
|
||||||
std::cerr << "[script] set_trigger_zone_enabled: index " << index << " out of range\n";
|
std::cerr << "[script] set_trigger_zone_enabled: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -408,8 +408,8 @@ namespace ZL {
|
|||||||
// set_teleport_active(index, active) — activates or deactivates a teleport zone by index.
|
// set_teleport_active(index, active) — activates or deactivates a teleport zone by index.
|
||||||
// Swaps the particle effect texture to match the new state.
|
// Swaps the particle effect texture to match the new state.
|
||||||
api.set_function("set_teleport_active",
|
api.set_function("set_teleport_active",
|
||||||
[game](int index, bool value) {
|
[loc](int index, bool value) {
|
||||||
auto& zones = game->teleportZones;
|
auto& zones = loc->teleportZones;
|
||||||
if (index < 0 || index >= static_cast<int>(zones.size())) {
|
if (index < 0 || index >= static_cast<int>(zones.size())) {
|
||||||
std::cerr << "[script] set_teleport_active: index " << index << " out of range\n";
|
std::cerr << "[script] set_teleport_active: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -419,8 +419,8 @@ namespace ZL {
|
|||||||
|
|
||||||
// is_teleport_active(index) → bool
|
// is_teleport_active(index) → bool
|
||||||
api.set_function("is_teleport_active",
|
api.set_function("is_teleport_active",
|
||||||
[game](int index) -> bool {
|
[loc](int index) -> bool {
|
||||||
auto& zones = game->teleportZones;
|
auto& zones = loc->teleportZones;
|
||||||
if (index < 0 || index >= static_cast<int>(zones.size())) {
|
if (index < 0 || index >= static_cast<int>(zones.size())) {
|
||||||
std::cerr << "[script] is_teleport_active: index " << index << " out of range\n";
|
std::cerr << "[script] is_teleport_active: index " << index << " out of range\n";
|
||||||
return false;
|
return false;
|
||||||
@ -431,8 +431,8 @@ namespace ZL {
|
|||||||
|
|
||||||
// npc_set_hp(index, value) — sets an NPC's current HP directly.
|
// npc_set_hp(index, value) — sets an NPC's current HP directly.
|
||||||
api.set_function("npc_set_hp",
|
api.set_function("npc_set_hp",
|
||||||
[game](int index, float value) {
|
[loc](int index, float value) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] npc_set_hp: index " << index << " out of range\n";
|
std::cerr << "[script] npc_set_hp: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -442,8 +442,8 @@ namespace ZL {
|
|||||||
|
|
||||||
// npc_set_position(index, x, y, z) — teleports an NPC instantly, no walking.
|
// npc_set_position(index, x, y, z) — teleports an NPC instantly, no walking.
|
||||||
api.set_function("npc_set_position",
|
api.set_function("npc_set_position",
|
||||||
[game](int index, float x, float y, float z) {
|
[loc](int index, float x, float y, float z) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] npc_set_position: index " << index << " out of range\n";
|
std::cerr << "[script] npc_set_position: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -456,8 +456,8 @@ namespace ZL {
|
|||||||
|
|
||||||
// npc_set_rotation(index, angle) — sets NPC facing angle around Y axis (degrees).
|
// npc_set_rotation(index, angle) — sets NPC facing angle around Y axis (degrees).
|
||||||
api.set_function("npc_set_rotation",
|
api.set_function("npc_set_rotation",
|
||||||
[game](int index, float angle) {
|
[loc](int index, float angle) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] npc_set_rotation: index " << index << " out of range\n";
|
std::cerr << "[script] npc_set_rotation: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -469,8 +469,8 @@ namespace ZL {
|
|||||||
|
|
||||||
// set_npc_enabled(index, enabled)
|
// set_npc_enabled(index, enabled)
|
||||||
api.set_function("set_npc_enabled",
|
api.set_function("set_npc_enabled",
|
||||||
[game](int index, bool value) {
|
[loc](int index, bool value) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] set_npc_enabled: index " << index << " out of range\n";
|
std::cerr << "[script] set_npc_enabled: index " << index << " out of range\n";
|
||||||
return;
|
return;
|
||||||
@ -481,16 +481,16 @@ namespace ZL {
|
|||||||
npcs[index]->currentState = AnimationState::STAND;
|
npcs[index]->currentState = AnimationState::STAND;
|
||||||
if (npcs[index]->canAttack)
|
if (npcs[index]->canAttack)
|
||||||
{
|
{
|
||||||
npcs[index]->attackTarget = game->player.get();
|
npcs[index]->attackTarget = loc->player.get();
|
||||||
}
|
}
|
||||||
npcs[index]->battle_state = 0;
|
npcs[index]->battle_state = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// move_object(name, x, y, z, duration_sec [, on_complete])
|
// move_object(name, x, y, z, duration_sec [, on_complete])
|
||||||
api.set_function("move_object",
|
api.set_function("move_object",
|
||||||
[game](const std::string& name, float x, float y, float z,
|
[loc](const std::string& name, float x, float y, float z,
|
||||||
float durationSec, sol::object onComplete) {
|
float durationSec, sol::object onComplete) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name != name) continue;
|
if (intObj.loadedObject.name != name) continue;
|
||||||
if (intObj.isAnimating) {
|
if (intObj.isAnimating) {
|
||||||
std::cerr << "[script] move_object: '" << name << "' is already animating\n";
|
std::cerr << "[script] move_object: '" << name << "' is already animating\n";
|
||||||
@ -515,9 +515,9 @@ namespace ZL {
|
|||||||
|
|
||||||
// rotate_object(name, angle_deg, duration_sec [, on_complete])
|
// rotate_object(name, angle_deg, duration_sec [, on_complete])
|
||||||
api.set_function("rotate_object",
|
api.set_function("rotate_object",
|
||||||
[game](const std::string& name, float angleDeg,
|
[loc](const std::string& name, float angleDeg,
|
||||||
float durationSec, sol::object onComplete) {
|
float durationSec, sol::object onComplete) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name != name) continue;
|
if (intObj.loadedObject.name != name) continue;
|
||||||
if (intObj.isAnimating) {
|
if (intObj.isAnimating) {
|
||||||
std::cerr << "[script] rotate_object: '" << name << "' is already animating\n";
|
std::cerr << "[script] rotate_object: '" << name << "' is already animating\n";
|
||||||
@ -543,9 +543,9 @@ namespace ZL {
|
|||||||
|
|
||||||
// fade_object(name, target_alpha, duration_sec [, on_complete])
|
// fade_object(name, target_alpha, duration_sec [, on_complete])
|
||||||
api.set_function("fade_object",
|
api.set_function("fade_object",
|
||||||
[game](const std::string& name, float targetAlpha,
|
[loc](const std::string& name, float targetAlpha,
|
||||||
float durationSec, sol::object onComplete) {
|
float durationSec, sol::object onComplete) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name != name) continue;
|
if (intObj.loadedObject.name != name) continue;
|
||||||
if (intObj.isAnimating) {
|
if (intObj.isAnimating) {
|
||||||
std::cerr << "[script] fade_object: '" << name << "' is already animating\n";
|
std::cerr << "[script] fade_object: '" << name << "' is already animating\n";
|
||||||
@ -570,9 +570,9 @@ namespace ZL {
|
|||||||
|
|
||||||
// scale_object(name, target_scale, duration_sec [, on_complete])
|
// scale_object(name, target_scale, duration_sec [, on_complete])
|
||||||
api.set_function("scale_object",
|
api.set_function("scale_object",
|
||||||
[game](const std::string& name, float targetScale,
|
[loc](const std::string& name, float targetScale,
|
||||||
float durationSec, sol::object onComplete) {
|
float durationSec, sol::object onComplete) {
|
||||||
for (auto& intObj : game->interactiveObjects) {
|
for (auto& intObj : loc->interactiveObjects) {
|
||||||
if (intObj.loadedObject.name != name) continue;
|
if (intObj.loadedObject.name != name) continue;
|
||||||
if (intObj.isAnimating) {
|
if (intObj.isAnimating) {
|
||||||
std::cerr << "[script] scale_object: '" << name << "' is already animating\n";
|
std::cerr << "[script] scale_object: '" << name << "' is already animating\n";
|
||||||
@ -596,20 +596,20 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("resetPlayerAfterDeath",
|
api.set_function("resetPlayerAfterDeath",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->player) game->player->resetPlayerAfterDeath();
|
if (loc->player) loc->player->resetPlayerAfterDeath();
|
||||||
});
|
});
|
||||||
|
|
||||||
// player_stop() — cancels the player's current walk target and stops them immediately.
|
// player_stop() — cancels the player's current walk target and stops them immediately.
|
||||||
api.set_function("player_stop",
|
api.set_function("player_stop",
|
||||||
[game]() {
|
[loc]() {
|
||||||
if (game->player) game->player->stopInPlace();
|
if (loc->player) loc->player->stopInPlace();
|
||||||
});
|
});
|
||||||
|
|
||||||
// npc_stop(index) — cancels an NPC's current walk target and stops them immediately.
|
// npc_stop(index) — cancels an NPC's current walk target and stops them immediately.
|
||||||
api.set_function("npc_stop",
|
api.set_function("npc_stop",
|
||||||
[game](int index) {
|
[loc](int index) {
|
||||||
auto& npcs = game->npcs;
|
auto& npcs = loc->npcs;
|
||||||
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
if (index < 0 || index >= static_cast<int>(npcs.size())) {
|
||||||
std::cerr << "[script] npc_stop: index " << index
|
std::cerr << "[script] npc_stop: index " << index
|
||||||
<< " out of range (0.." << npcs.size() - 1 << ")\n";
|
<< " out of range (0.." << npcs.size() - 1 << ")\n";
|
||||||
@ -694,11 +694,11 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.set_function("call_tutorial_taxi_required",
|
api.set_function("call_tutorial_taxi_required",
|
||||||
[game]() -> void {
|
[loc]() -> void {
|
||||||
if (game->onPlayerTaxiRequired)
|
if (loc->onPlayerTaxiRequired)
|
||||||
{
|
{
|
||||||
game->onPlayerTaxiRequired();
|
loc->onPlayerTaxiRequired();
|
||||||
game->onPlayerTaxiRequired = nullptr;
|
loc->onPlayerTaxiRequired = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "[script] call_tutorial_taxi_required: function is empty\n";
|
std::cerr << "[script] call_tutorial_taxi_required: function is empty\n";
|
||||||
|
|||||||
@ -48,6 +48,7 @@ void DialogueOverlay::update(const PresentationModel& model, int deltaMs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
||||||
if (model.mode != PresentationMode::Dialogue && model.mode != PresentationMode::Choice) {
|
if (model.mode != PresentationMode::Dialogue && model.mode != PresentationMode::Choice) {
|
||||||
lastChoiceRects.clear();
|
lastChoiceRects.clear();
|
||||||
@ -59,7 +60,7 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
|||||||
|
|
||||||
UiRect portraitRect{ 24.0f + 90, 24.0f + 16, 176.0f, 176.0f };
|
UiRect portraitRect{ 24.0f + 90, 24.0f + 16, 176.0f, 176.0f };
|
||||||
UiRect textboxRect{ 30.f, -48.f, 1222.f, 340.0f };
|
UiRect textboxRect{ 30.f, -48.f, 1222.f, 340.0f };
|
||||||
UiRect textboxChoiceRect{ 30.f, -48.f, 1200.f, 619.5f };
|
UiRect textboxChoiceRect{ 30.f, -90.f, 1200.f, 619.5f };
|
||||||
|
|
||||||
lastDialogueAdvanceRect = { portraitRect.x, portraitRect.y, textboxRect.x + textboxRect.w - portraitRect.x, textboxRect.h };
|
lastDialogueAdvanceRect = { portraitRect.x, portraitRect.y, textboxRect.x + textboxRect.w - portraitRect.x, textboxRect.h };
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
|||||||
|
|
||||||
if (model.mode == PresentationMode::Choice)
|
if (model.mode == PresentationMode::Choice)
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, textboxTexture->getTexID());
|
glBindTexture(GL_TEXTURE_2D, textboxChoiceTexture->getTexID());
|
||||||
renderer.DrawVertexRenderStruct(textboxChoiceQuad.mesh);
|
renderer.DrawVertexRenderStruct(textboxChoiceQuad.mesh);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -101,7 +102,7 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
|||||||
|
|
||||||
if (model.mode == PresentationMode::Choice)
|
if (model.mode == PresentationMode::Choice)
|
||||||
{
|
{
|
||||||
renderer.TranslateMatrix(Vector3f{ 0, 230, 0 });
|
renderer.TranslateMatrix(Vector3f{ 20, 230, 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto portrait = loadTextureCached(model.portraitPath);
|
auto portrait = loadTextureCached(model.portraitPath);
|
||||||
@ -128,12 +129,12 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
|||||||
|
|
||||||
if (model.mode == PresentationMode::Choice)
|
if (model.mode == PresentationMode::Choice)
|
||||||
{
|
{
|
||||||
nameRenderer->drawText(model.speaker, nameX+x, nameY+230, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
nameRenderer->drawText(model.speaker, nameX+20, nameY+230, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
nameRenderer->drawText(model.speaker, nameX+x, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
nameRenderer->drawText(model.speaker, nameX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
|||||||
|
|
||||||
for (size_t i = 0; i < model.choices.size(); ++i) {
|
for (size_t i = 0; i < model.choices.size(); ++i) {
|
||||||
const float cy = choiceStartY + (choiceHeight + choiceSpacing) * static_cast<float>(model.choices.size() - 1 - i);
|
const float cy = choiceStartY + (choiceHeight + choiceSpacing) * static_cast<float>(model.choices.size() - 1 - i);
|
||||||
UiRect rect{ 300.f, cy, choiceWidth, choiceHeight };
|
UiRect rect{ 320.f, cy, choiceWidth, choiceHeight };
|
||||||
lastChoiceRects.push_back(rect);
|
lastChoiceRects.push_back(rect);
|
||||||
choiceQuads[i].rebuild(rect);
|
choiceQuads[i].rebuild(rect);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user