Added sounds
This commit is contained in:
1 parent
c6ba8bd008
commit
124208f2a4
26 files changed
+210
-36
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -76,6 +76,7 @@ function on_bed_sleep()
|
|||||||
local day = game_api.getIntValue("day")
|
local day = game_api.getIntValue("day")
|
||||||
game_api.setIntValue("day", day + 1)
|
game_api.setIntValue("day", day + 1)
|
||||||
print("Setting to day 1----x")
|
print("Setting to day 1----x")
|
||||||
|
game_api.play_sound("audio/587036__antoineromo__bed-sheets.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -85,6 +86,8 @@ end
|
|||||||
|
|
||||||
function on_locked_door_click()
|
function on_locked_door_click()
|
||||||
game_api.start_dialogue("door_locked_dialog001")
|
game_api.start_dialogue("door_locked_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
--game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_sleep_cutscene()
|
function on_sleep_cutscene()
|
||||||
@@ -118,6 +121,8 @@ function alik_door_open_callback()
|
|||||||
else
|
else
|
||||||
game_api.switch_navigation(4) --b
|
game_api.switch_navigation(4) --b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -156,6 +161,8 @@ function on_player_bathroom_click()
|
|||||||
else
|
else
|
||||||
game_api.switch_navigation(1) --ca
|
game_api.switch_navigation(1) --ca
|
||||||
end
|
end
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -186,7 +193,9 @@ function on_player_door_click()
|
|||||||
else
|
else
|
||||||
game_api.switch_navigation(2) --ba
|
game_api.switch_navigation(2) --ba
|
||||||
end
|
end
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ game_api.set_darklands_callbacks(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
game_api.set_enter_night_callback(
|
||||||
|
function()
|
||||||
|
game_api.deactivate_interactive_object("car001")
|
||||||
|
game_api.deactivate_interactive_object("car001wheels")
|
||||||
|
game_api.switch_navigation(1)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
game_api.set_location_callbacks(
|
game_api.set_location_callbacks(
|
||||||
function()
|
function()
|
||||||
|
|||||||
@@ -257,25 +257,6 @@ function on_npc_interact(npc_index)
|
|||||||
game_api.start_dialogue("teacher_dialog007")
|
game_api.start_dialogue("teacher_dialog007")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--[[
|
|
||||||
if (player_ghost_aware == 1) then
|
|
||||||
--game_api.setIntValue("player_has_coursework", 1)
|
|
||||||
local player_has_coursework = game_api.getIntValue("player_has_coursework")
|
|
||||||
local player_has_report_card = game_api.getIntValue("player_has_report_card")
|
|
||||||
local report_card_signed = game_api.getIntValue("report_card_signed")
|
|
||||||
|
|
||||||
if (report_card_signed == 1) then
|
|
||||||
game_api.start_dialogue("teacher_dialog004")
|
|
||||||
elseif (player_has_coursework == 1 and player_has_report_card == 1) then
|
|
||||||
game_api.start_dialogue("teacher_dialog005")
|
|
||||||
game_api.remove_item("coursework")
|
|
||||||
game_api.setIntValue("report_card_signed", 1)
|
|
||||||
else
|
|
||||||
game_api.start_dialogue("teacher_dialog007")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
game_api.start_dialogue("teacher_dialog001")
|
|
||||||
end]]
|
|
||||||
end
|
end
|
||||||
if npc_index == 2 then
|
if npc_index == 2 then
|
||||||
local report_card_signed = game_api.getIntValue("report_card_signed")
|
local report_card_signed = game_api.getIntValue("report_card_signed")
|
||||||
@@ -320,12 +301,17 @@ function on_library_door_click()
|
|||||||
|
|
||||||
if (day == 0) then
|
if (day == 0) then
|
||||||
if game_api.is_dawn() then
|
if game_api.is_dawn() then
|
||||||
game_api.start_dialogue("door_dialog007")
|
if not (morning_did_open_door_index == 5) then
|
||||||
|
game_api.start_dialogue("door_dialog007")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
end
|
||||||
elseif game_api.is_night() then
|
elseif game_api.is_night() then
|
||||||
game_api.start_dialogue("door_night_dialog001")
|
game_api.start_dialogue("door_night_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
else
|
else
|
||||||
if (lection_is_over == 0) then
|
if (lection_is_over == 0) then
|
||||||
game_api.start_dialogue("door_dialog003")
|
game_api.start_dialogue("door_dialog003")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -366,9 +352,11 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(3)
|
game_api.switch_navigation(3)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
game_api.start_dialogue("door_dialog004")
|
game_api.start_dialogue("door_dialog004")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (game_api.is_dawn()) then
|
if (game_api.is_dawn()) then
|
||||||
@@ -384,6 +372,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(10)
|
game_api.switch_navigation(10)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
else
|
else
|
||||||
if (morning_did_open_door_index == 1) then
|
if (morning_did_open_door_index == 1) then
|
||||||
--s1 + s3
|
--s1 + s3
|
||||||
@@ -393,6 +382,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(11)
|
game_api.switch_navigation(11)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
elseif (morning_did_open_door_index == 2) then
|
elseif (morning_did_open_door_index == 2) then
|
||||||
--s2 + s3
|
--s2 + s3
|
||||||
|
|
||||||
@@ -401,6 +391,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(15)
|
game_api.switch_navigation(15)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
elseif (morning_did_open_door_index == 5) then
|
elseif (morning_did_open_door_index == 5) then
|
||||||
--n3 + s3
|
--n3 + s3
|
||||||
|
|
||||||
@@ -409,6 +400,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(13)
|
game_api.switch_navigation(13)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
elseif (morning_did_open_door_index == 4) then
|
elseif (morning_did_open_door_index == 4) then
|
||||||
--n2 + s3
|
--n2 + s3
|
||||||
|
|
||||||
@@ -417,6 +409,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(14)
|
game_api.switch_navigation(14)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
elseif (morning_did_open_door_index == 6) then
|
elseif (morning_did_open_door_index == 6) then
|
||||||
--hall + s3
|
--hall + s3
|
||||||
|
|
||||||
@@ -425,6 +418,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(12)
|
game_api.switch_navigation(12)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
else
|
else
|
||||||
--Player was in corridor, but tries to open the teacher's door
|
--Player was in corridor, but tries to open the teacher's door
|
||||||
--s3 only
|
--s3 only
|
||||||
@@ -433,6 +427,7 @@ function on_teachers_door_click()
|
|||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
||||||
end)
|
end)
|
||||||
game_api.switch_navigation(10)
|
game_api.switch_navigation(10)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -454,6 +449,7 @@ function on_teachers_door_click()
|
|||||||
end
|
end
|
||||||
|
|
||||||
game_api.switch_navigation(10)
|
game_api.switch_navigation(10)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -466,7 +462,10 @@ function on_hall_door_click()
|
|||||||
|
|
||||||
if (day == 0) then
|
if (day == 0) then
|
||||||
if (game_api.is_dawn()) then
|
if (game_api.is_dawn()) then
|
||||||
game_api.start_dialogue("door_dialog007")
|
if not (morning_did_open_door_index == 6) then
|
||||||
|
game_api.start_dialogue("door_dialog007")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if (not hall_door_opened) then
|
if (not hall_door_opened) then
|
||||||
hall_door_opened = true
|
hall_door_opened = true
|
||||||
@@ -478,12 +477,14 @@ function on_hall_door_click()
|
|||||||
game_api.set_npc_enabled(0, true)
|
game_api.set_npc_enabled(0, true)
|
||||||
game_api.set_npc_enabled(6, true)
|
game_api.set_npc_enabled(6, true)
|
||||||
game_api.npc_rotate_to(6, 180)
|
game_api.npc_rotate_to(6, 180)
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (game_api.is_night()) then
|
if (game_api.is_night()) then
|
||||||
if not (morning_did_open_door_index == 6) then
|
if not (morning_did_open_door_index == 6) then
|
||||||
game_api.start_dialogue("door_dialog001")
|
game_api.start_dialogue("door_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -492,14 +493,19 @@ end
|
|||||||
function on_s1_door_click()
|
function on_s1_door_click()
|
||||||
local day = game_api.getIntValue("day")
|
local day = game_api.getIntValue("day")
|
||||||
if (day == 0) and(game_api.is_dawn()) then
|
if (day == 0) and(game_api.is_dawn()) then
|
||||||
game_api.start_dialogue("door_dialog007")
|
if not (morning_did_open_door_index == 1) then
|
||||||
|
game_api.start_dialogue("door_dialog007")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if (game_api.is_night()) then
|
if (game_api.is_night()) then
|
||||||
if not (morning_did_open_door_index == 1) then
|
if not (morning_did_open_door_index == 1) then
|
||||||
game_api.start_dialogue("door_dialog001")
|
game_api.start_dialogue("door_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
game_api.start_dialogue("door_dialog006")
|
game_api.start_dialogue("door_dialog006")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -507,14 +513,19 @@ end
|
|||||||
function on_s2_door_click()
|
function on_s2_door_click()
|
||||||
local day = game_api.getIntValue("day")
|
local day = game_api.getIntValue("day")
|
||||||
if (day == 0) and(game_api.is_dawn()) then
|
if (day == 0) and(game_api.is_dawn()) then
|
||||||
game_api.start_dialogue("door_dialog007")
|
if not (morning_did_open_door_index == 2) then
|
||||||
|
game_api.start_dialogue("door_dialog007")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if (game_api.is_night()) then
|
if (game_api.is_night()) then
|
||||||
if not (morning_did_open_door_index == 2) then
|
if not (morning_did_open_door_index == 2) then
|
||||||
game_api.start_dialogue("door_dialog001")
|
game_api.start_dialogue("door_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
game_api.start_dialogue("door_dialog006")
|
game_api.start_dialogue("door_dialog006")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -522,11 +533,15 @@ end
|
|||||||
function on_n2_door_click()
|
function on_n2_door_click()
|
||||||
local day = game_api.getIntValue("day")
|
local day = game_api.getIntValue("day")
|
||||||
if (day == 0) and(game_api.is_dawn()) then
|
if (day == 0) and(game_api.is_dawn()) then
|
||||||
game_api.start_dialogue("door_dialog007")
|
if not (morning_did_open_door_index == 4) then
|
||||||
|
game_api.start_dialogue("door_dialog007")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if (game_api.is_night()) then
|
if (game_api.is_night()) then
|
||||||
if not (morning_did_open_door_index == 4) then
|
if not (morning_did_open_door_index == 4) then
|
||||||
game_api.start_dialogue("door_dialog001")
|
game_api.start_dialogue("door_dialog001")
|
||||||
|
game_api.play_sound("audio/398751__anthousai__door-lock-01.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -641,6 +656,7 @@ function on_teacher_arrived_intermediate()
|
|||||||
game_api.switch_navigation(2)
|
game_api.switch_navigation(2)
|
||||||
game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived)
|
game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived)
|
||||||
teacher_arrived = true
|
teacher_arrived = true
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_lection_cutscene_fadein_callback()
|
function on_lection_cutscene_fadein_callback()
|
||||||
@@ -1226,6 +1242,8 @@ function on_aiperi_opens_door()
|
|||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
end)
|
end)
|
||||||
game_api.player_walk_to(0.0, 0.0, 10.0, nil)
|
game_api.player_walk_to(0.0, 0.0, 10.0, nil)
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
elseif (morning_can_open_door_index == 5) then
|
elseif (morning_can_open_door_index == 5) then
|
||||||
if (morning_did_open_door_index == 0) then
|
if (morning_did_open_door_index == 0) then
|
||||||
@@ -1252,6 +1270,8 @@ function on_aiperi_opens_door()
|
|||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
end)
|
end)
|
||||||
game_api.player_walk_to(3.52174, 0, 6.28993, nil)
|
game_api.player_walk_to(3.52174, 0, 6.28993, nil)
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
elseif (morning_can_open_door_index == 4) then
|
elseif (morning_can_open_door_index == 4) then
|
||||||
if (morning_did_open_door_index == 0) then
|
if (morning_did_open_door_index == 0) then
|
||||||
@@ -1278,6 +1298,8 @@ function on_aiperi_opens_door()
|
|||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
end)
|
end)
|
||||||
game_api.player_walk_to(3.36055, 0, -2.0345, nil)
|
game_api.player_walk_to(3.36055, 0, -2.0345, nil)
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
elseif (morning_can_open_door_index == 2) then
|
elseif (morning_can_open_door_index == 2) then
|
||||||
if (morning_did_open_door_index == 0) then
|
if (morning_did_open_door_index == 0) then
|
||||||
@@ -1304,6 +1326,8 @@ function on_aiperi_opens_door()
|
|||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
end)
|
end)
|
||||||
game_api.player_walk_to(-3.63363, 0, -1.50727, nil)
|
game_api.player_walk_to(-3.63363, 0, -1.50727, nil)
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
elseif (morning_can_open_door_index == 1) then
|
elseif (morning_can_open_door_index == 1) then
|
||||||
if (morning_did_open_door_index == 0) then
|
if (morning_did_open_door_index == 0) then
|
||||||
@@ -1330,6 +1354,8 @@ function on_aiperi_opens_door()
|
|||||||
game_api.start_dialogue("dialog_aiperi_morning001")
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
||||||
end)
|
end)
|
||||||
game_api.player_walk_to(-3.64494, 0, -9.66711, nil)
|
game_api.player_walk_to(-3.64494, 0, -9.66711, nil)
|
||||||
|
|
||||||
|
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+13
-2
@@ -419,6 +419,17 @@ void Character::update(int64_t deltaMs, const CharacterResolver& resolver) {
|
|||||||
state.currentState == AnimationState::ACTION_ATTACK_2)) {
|
state.currentState == AnimationState::ACTION_ATTACK_2)) {
|
||||||
if (attackTarget != nullptr) {
|
if (attackTarget != nullptr) {
|
||||||
attackTarget->applyDamage(10.f, attackDirectionToTarget());
|
attackTarget->applyDamage(10.f, attackDirectionToTarget());
|
||||||
|
|
||||||
|
if (audioPlayer) {
|
||||||
|
if (state.isPlayer)
|
||||||
|
{
|
||||||
|
audioPlayer->playSoundAsync("audio/547041__cogfirestudios__hit-swing-sword-small-3.ogg");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
audioPlayer->playSoundAsync("audio/13925__adcbicycle__21.ogg");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1176,8 +1187,8 @@ void Character::drawNightCpuWithShadow(Renderer& renderer,
|
|||||||
void Character::setupHitSparks(std::shared_ptr<Texture> sparkTexture) {
|
void Character::setupHitSparks(std::shared_ptr<Texture> sparkTexture) {
|
||||||
hitSparkEmitter.setTexture(sparkTexture);
|
hitSparkEmitter.setTexture(sparkTexture);
|
||||||
hitSparkEmitter.setShaderProgramName("spark");
|
hitSparkEmitter.setShaderProgramName("spark");
|
||||||
hitSparkEmitter.setMaxParticles(64);
|
hitSparkEmitter.setMaxParticles(128);
|
||||||
hitSparkEmitter.setParticleSize(0.08f);
|
hitSparkEmitter.setParticleSize(0.02f);
|
||||||
hitSparkEmitter.setBiasX(0.0f);
|
hitSparkEmitter.setBiasX(0.0f);
|
||||||
hitSparkEmitter.setEmissionRate(1.0e9f);
|
hitSparkEmitter.setEmissionRate(1.0e9f);
|
||||||
hitSparkEmitter.setSpeedRange(2.0f, 4.0f);
|
hitSparkEmitter.setSpeedRange(2.0f, 4.0f);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "dialogue/TranslationDatabase.h"
|
#include "dialogue/TranslationDatabase.h"
|
||||||
|
#include "AudioPlayerAsync.h"
|
||||||
|
|
||||||
namespace ZL {
|
namespace ZL {
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@ public:
|
|||||||
std::string weaponAttachBoneName = "RightHand";
|
std::string weaponAttachBoneName = "RightHand";
|
||||||
|
|
||||||
SparkEmitter hitSparkEmitter;
|
SparkEmitter hitSparkEmitter;
|
||||||
|
AudioPlayerAsync* audioPlayer;
|
||||||
|
|
||||||
static Dialogue::TranslationDatabase nameTranslations;
|
static Dialogue::TranslationDatabase nameTranslations;
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -16,7 +16,6 @@
|
|||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -258,10 +257,12 @@ namespace ZL
|
|||||||
menuManager.onItemPickedUp(itemId);
|
menuManager.onItemPickedUp(itemId);
|
||||||
const Item* item = ItemRegistry::instance().findById(itemId);
|
const Item* item = ItemRegistry::instance().findById(itemId);
|
||||||
if (item) menuManager.showToast(menuManager.toastTextureItemAdded, item->name);
|
if (item) menuManager.showToast(menuManager.toastTextureItemAdded, item->name);
|
||||||
|
audioPlayer->playSoundAsync("audio/831642__ienba__generic-game-pick-up.ogg");
|
||||||
};
|
};
|
||||||
gameState.inventory.onItemRemoved = [this](const std::string& itemId) {
|
gameState.inventory.onItemRemoved = [this](const std::string& itemId) {
|
||||||
const Item* item = ItemRegistry::instance().findById(itemId);
|
const Item* item = ItemRegistry::instance().findById(itemId);
|
||||||
if (item) menuManager.showToast(menuManager.toastTextureItemRemoved, item->name);
|
if (item) menuManager.showToast(menuManager.toastTextureItemRemoved, item->name);
|
||||||
|
audioPlayer->playSoundAsync("audio/831642__ienba__generic-game-pick-up.ogg");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wire phone dialogue start function so MenuManager can trigger dialogues.
|
// Wire phone dialogue start function so MenuManager can trigger dialogues.
|
||||||
@@ -433,7 +434,7 @@ namespace ZL
|
|||||||
uniInteriorParams.playerPosition = Eigen::Vector3f(0.942694, 0, -9.63104);
|
uniInteriorParams.playerPosition = Eigen::Vector3f(0.942694, 0, -9.63104);
|
||||||
|
|
||||||
gameState.locations["uni_interior"] = std::make_shared<Location>(renderer, gameState.inventory);
|
gameState.locations["uni_interior"] = std::make_shared<Location>(renderer, gameState.inventory);
|
||||||
gameState.locations["uni_interior"]->setup(uniInteriorParams, &gameState.questJournal);
|
gameState.locations["uni_interior"]->setup(uniInteriorParams, &gameState.questJournal, audioPlayer.get());
|
||||||
gameState.locations["uni_interior"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
gameState.locations["uni_interior"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
||||||
gameState.locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
gameState.locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
||||||
gameState.locations["uni_interior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { gameState.isNight = isNight; gameState.isDawn = isDawn; };
|
gameState.locations["uni_interior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { gameState.isNight = isNight; gameState.isDawn = isDawn; };
|
||||||
@@ -487,7 +488,7 @@ namespace ZL
|
|||||||
|
|
||||||
|
|
||||||
gameState.locations["uni_exterior"] = std::make_shared<Location>(renderer, gameState.inventory);
|
gameState.locations["uni_exterior"] = std::make_shared<Location>(renderer, gameState.inventory);
|
||||||
gameState.locations["uni_exterior"]->setup(uniExteriorParams, &gameState.questJournal);
|
gameState.locations["uni_exterior"]->setup(uniExteriorParams, &gameState.questJournal, audioPlayer.get());
|
||||||
gameState.locations["uni_exterior"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
gameState.locations["uni_exterior"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
||||||
gameState.locations["uni_exterior"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
gameState.locations["uni_exterior"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
||||||
gameState.locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) {
|
gameState.locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) {
|
||||||
@@ -547,7 +548,7 @@ namespace ZL
|
|||||||
params_dorm.playerPosition = Eigen::Vector3f(6.76345, 0, -14.6022);
|
params_dorm.playerPosition = Eigen::Vector3f(6.76345, 0, -14.6022);
|
||||||
|
|
||||||
gameState.locations["location_dorm"] = std::make_shared<Location>(renderer, gameState.inventory);
|
gameState.locations["location_dorm"] = std::make_shared<Location>(renderer, gameState.inventory);
|
||||||
gameState.locations["location_dorm"]->setup(params_dorm, &gameState.questJournal);
|
gameState.locations["location_dorm"]->setup(params_dorm, &gameState.questJournal, audioPlayer.get());
|
||||||
gameState.locations["location_dorm"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
gameState.locations["location_dorm"]->scriptEngine.setGlobalStore(&gameState.globalInts);
|
||||||
gameState.locations["location_dorm"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
gameState.locations["location_dorm"]->scriptEngine.setGlobalFloatStore(&gameState.globalFloats);
|
||||||
gameState.locations["location_dorm"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { gameState.isNight = isNight; gameState.isDawn = isDawn; };
|
gameState.locations["location_dorm"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { gameState.isNight = isNight; gameState.isDawn = isDawn; };
|
||||||
@@ -1482,6 +1483,7 @@ namespace ZL
|
|||||||
|
|
||||||
bool Game::startDarklandsTransition()
|
bool Game::startDarklandsTransition()
|
||||||
{
|
{
|
||||||
|
audioPlayer->playSoundAsync("audio/459618__n-lerche__blow.ogg");
|
||||||
if (!gameState.isNight)
|
if (!gameState.isNight)
|
||||||
{
|
{
|
||||||
currentLocation()->dialogueSystem.startDialogue("darklands_day_dialog001");
|
currentLocation()->dialogueSystem.startDialogue("darklands_day_dialog001");
|
||||||
|
|||||||
+4
-2
@@ -83,7 +83,7 @@ namespace ZL
|
|||||||
|
|
||||||
// ---- Setup ----
|
// ---- Setup ----
|
||||||
|
|
||||||
void Location::setup(const LocationSetup& params, Quest::QuestJournal* journal)
|
void Location::setup(const LocationSetup& params, Quest::QuestJournal* journal, AudioPlayerAsync* audioPlayer)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load static game objects
|
// Load static game objects
|
||||||
@@ -138,6 +138,7 @@ namespace ZL
|
|||||||
player->state.position = params.playerPosition;
|
player->state.position = params.playerPosition;
|
||||||
player->setTarget(params.playerPosition);
|
player->setTarget(params.playerPosition);
|
||||||
player->setupHitSparks(sparkTexture);
|
player->setupHitSparks(sparkTexture);
|
||||||
|
player->audioPlayer = audioPlayer;
|
||||||
std::cout << "Load resurces step 9" << std::endl;
|
std::cout << "Load resurces step 9" << std::endl;
|
||||||
|
|
||||||
// Load NPCs from JSON. Aggressive (canAttack) NPCs need a player target
|
// Load NPCs from JSON. Aggressive (canAttack) NPCs need a player target
|
||||||
@@ -149,6 +150,7 @@ namespace ZL
|
|||||||
npc->state.homePosition = Eigen::Vector3f(npc->state.position.x(), 0.f, npc->state.position.z());
|
npc->state.homePosition = Eigen::Vector3f(npc->state.position.x(), 0.f, npc->state.position.z());
|
||||||
if (npc->state.canAttack) {
|
if (npc->state.canAttack) {
|
||||||
npc->setupHitSparks(sparkTexture);
|
npc->setupHitSparks(sparkTexture);
|
||||||
|
npc->audioPlayer = audioPlayer;
|
||||||
npc->state.attackTargetIndex = CharacterState::kPlayerIndex;
|
npc->state.attackTargetIndex = CharacterState::kPlayerIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +181,7 @@ namespace ZL
|
|||||||
npcNameText.reset();
|
npcNameText.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptEngine.init(this, &inventory, params.scriptPath);
|
scriptEngine.init(this, &inventory, audioPlayer, params.scriptPath);
|
||||||
scriptEngine.setQuestJournal(journal);
|
scriptEngine.setQuestJournal(journal);
|
||||||
|
|
||||||
dialogueSystem.setOnCutsceneFinished([this](const std::string& cutsceneId) {
|
dialogueSystem.setOnCutsceneFinished([this](const std::string& cutsceneId) {
|
||||||
|
|||||||
+2
-1
@@ -133,7 +133,7 @@ namespace ZL
|
|||||||
bool playBattleMusic = false;
|
bool playBattleMusic = false;
|
||||||
|
|
||||||
|
|
||||||
void setup(const LocationSetup& params, Quest::QuestJournal* journal);
|
void setup(const LocationSetup& params, Quest::QuestJournal* journal, AudioPlayerAsync* audioPlayer);
|
||||||
void setupNavigation(const std::vector<std::string>& paths);
|
void setupNavigation(const std::vector<std::string>& paths);
|
||||||
bool switchNavigation(int index);
|
bool switchNavigation(int index);
|
||||||
InteractiveObject* raycastInteractiveObjects(const Eigen::Vector3f& rayOrigin, const Eigen::Vector3f& rayDir);
|
InteractiveObject* raycastInteractiveObjects(const Eigen::Vector3f& rayOrigin, const Eigen::Vector3f& rayDir);
|
||||||
@@ -170,6 +170,7 @@ namespace ZL
|
|||||||
friend class LocationEditor;
|
friend class LocationEditor;
|
||||||
Renderer& renderer;
|
Renderer& renderer;
|
||||||
Inventory& inventory;
|
Inventory& inventory;
|
||||||
|
AudioPlayerAsync* audioPlayer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ---- Pointer-to-index helpers ----
|
// ---- Pointer-to-index helpers ----
|
||||||
|
|||||||
+60
-1
@@ -331,25 +331,32 @@ namespace ZL {
|
|||||||
uiManager.replaceRoot(mainMenuRoot);
|
uiManager.replaceRoot(mainMenuRoot);
|
||||||
|
|
||||||
uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
enterGameplay();
|
enterGameplay();
|
||||||
|
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) {
|
||||||
showAboutScreen();
|
showAboutScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("menuSettingsButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuSettingsButton", [this](const std::string&) {
|
||||||
showSettingsScreen();
|
showSettingsScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("menuLanguageButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuLanguageButton", [this](const std::string&) {
|
||||||
showLanguageScreen();
|
showLanguageScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("menuLoadButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuLoadButton", [this](const std::string&) {
|
||||||
showLoadGameScreen();
|
showLoadGameScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef EMSCRIPTEN
|
#ifndef EMSCRIPTEN
|
||||||
uiManager.setTextButtonCallback("menuExitButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("menuExitButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
Environment::exitGameLoop = true;
|
Environment::exitGameLoop = true;
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
@@ -362,6 +369,7 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonCallback("aboutBackButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("aboutBackButton", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,6 +379,7 @@ namespace ZL {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set initial slider positions before registering callbacks so
|
// Set initial slider positions before registering callbacks so
|
||||||
@@ -456,6 +465,7 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonColor("musicToggleButton", on
|
uiManager.setTextButtonColor("musicToggleButton", on
|
||||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("soundToggleButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("soundToggleButton", [this](const std::string&) {
|
||||||
audioPlayer_.setSoundEnabled(!audioPlayer_.isSoundEnabled());
|
audioPlayer_.setSoundEnabled(!audioPlayer_.isSoundEnabled());
|
||||||
@@ -464,10 +474,12 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonColor("soundToggleButton", on
|
uiManager.setTextButtonColor("soundToggleButton", on
|
||||||
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
|
||||||
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("fullScreenToggleButton", [this, refreshFullscreenToggle](const std::string&) {
|
uiManager.setTextButtonCallback("fullScreenToggleButton", [this, refreshFullscreenToggle](const std::string&) {
|
||||||
Environment::setFullscreen(!Environment::isFullscreen);
|
Environment::setFullscreen(!Environment::isFullscreen);
|
||||||
refreshFullscreenToggle();
|
refreshFullscreenToggle();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,14 +489,17 @@ namespace ZL {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setTextButtonCallback("languageRussianButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("languageRussianButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
ZL::g_currentLanguage = ZL::Language::Russian;
|
ZL::g_currentLanguage = ZL::Language::Russian;
|
||||||
reloadLocalizedGameContent();
|
reloadLocalizedGameContent();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("languageEnglishButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("languageEnglishButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
ZL::g_currentLanguage = ZL::Language::English;
|
ZL::g_currentLanguage = ZL::Language::English;
|
||||||
reloadLocalizedGameContent();
|
reloadLocalizedGameContent();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@@ -528,6 +543,7 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonCallback("loadBackButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("loadBackButton", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
static const char* kSlotButtons[4] = {
|
static const char* kSlotButtons[4] = {
|
||||||
@@ -543,6 +559,7 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonText(kSlotButtons[i], label);
|
uiManager.setTextButtonText(kSlotButtons[i], label);
|
||||||
}
|
}
|
||||||
uiManager.setTextButtonCallback(kSlotButtons[i], [this, slot](const std::string&) {
|
uiManager.setTextButtonCallback(kSlotButtons[i], [this, slot](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
if (onLoadGame) onLoadGame(slot);
|
if (onLoadGame) onLoadGame(slot);
|
||||||
enterGameplay(true);
|
enterGameplay(true);
|
||||||
});
|
});
|
||||||
@@ -555,6 +572,7 @@ namespace ZL {
|
|||||||
uiManager.setTextButtonCallback("saveBackButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("saveBackButton", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
static const char* kSlotButtons[4] = {
|
static const char* kSlotButtons[4] = {
|
||||||
@@ -578,6 +596,7 @@ namespace ZL {
|
|||||||
? "Empty"
|
? "Empty"
|
||||||
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
|
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
|
||||||
uiManager.setTextButtonText(buttonName, label);
|
uiManager.setTextButtonText(buttonName, label);
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -607,6 +626,7 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
uiManager.setButtonCallback(btnName, [this, i](const std::string&) {
|
uiManager.setButtonCallback(btnName, [this, i](const std::string&) {
|
||||||
selectInventoryItem(i);
|
selectInventoryItem(i);
|
||||||
|
audioPlayer_.playSoundAsync("audio/sound_bag001.ogg");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uiManager.setNodeVisible(btnName, false);
|
uiManager.setNodeVisible(btnName, false);
|
||||||
@@ -617,6 +637,8 @@ namespace ZL {
|
|||||||
if (!portrait && !items.empty()) {
|
if (!portrait && !items.empty()) {
|
||||||
selectInventoryItem(0);
|
selectInventoryItem(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audioPlayer_.playSoundAsync("audio/sound_bag_open.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::selectInventoryItem(int index) {
|
void MenuManager::selectInventoryItem(int index) {
|
||||||
@@ -668,6 +690,7 @@ namespace ZL {
|
|||||||
for (int i = 0; i < inventoryMenuStackDepth_; ++i) uiManager.popMenu();
|
for (int i = 0; i < inventoryMenuStackDepth_; ++i) uiManager.popMenu();
|
||||||
inventoryMenuStackDepth_ = 0;
|
inventoryMenuStackDepth_ = 0;
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/sound_bag_close.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::openQuestJournal() {
|
void MenuManager::openQuestJournal() {
|
||||||
@@ -683,6 +706,7 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("journalExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("journalExitButton", [this](const std::string&) {
|
||||||
closeQuestJournal();
|
closeQuestJournal();
|
||||||
|
audioPlayer_.playSoundAsync("audio/656126__itsthegoodstuff__paging-through-book.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
static const char* kItemNames[9] = {
|
static const char* kItemNames[9] = {
|
||||||
@@ -693,6 +717,7 @@ namespace ZL {
|
|||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
uiManager.setTextButtonCallback(kItemNames[i], [this, i](const std::string&) {
|
uiManager.setTextButtonCallback(kItemNames[i], [this, i](const std::string&) {
|
||||||
selectQuestByIndex(i);
|
selectQuestByIndex(i);
|
||||||
|
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,6 +725,8 @@ namespace ZL {
|
|||||||
if (!portrait && !visibleQuestIds.empty()) {
|
if (!portrait && !visibleQuestIds.empty()) {
|
||||||
selectQuestByIndex(0);
|
selectQuestByIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::closeQuestJournal() {
|
void MenuManager::closeQuestJournal() {
|
||||||
@@ -750,19 +777,24 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setButtonCallback("phoneMessenger", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneMessenger", [this](const std::string&) {
|
||||||
openPhoneMessenger();
|
openPhoneMessenger();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneBank", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneBank", [this](const std::string&) {
|
||||||
openPhoneBank();
|
openPhoneBank();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneVideo", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneVideo", [this](const std::string&) {
|
||||||
openPhoneVideo();
|
openPhoneVideo();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneTaxi", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneTaxi", [this](const std::string&) {
|
||||||
openPhoneTaxi();
|
openPhoneTaxi();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (gameState_.isNight)
|
if (gameState_.isNight)
|
||||||
@@ -786,6 +818,8 @@ namespace ZL {
|
|||||||
uiManager.setNodeVisible("phoneTimeNight", false);
|
uiManager.setNodeVisible("phoneTimeNight", false);
|
||||||
uiManager.setNodeVisible("phoneTimeDawn", false);
|
uiManager.setNodeVisible("phoneTimeDawn", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::openPhoneMessenger() {
|
void MenuManager::openPhoneMessenger() {
|
||||||
@@ -803,19 +837,23 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
|
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
|
||||||
gameState_.chatUnread[0] = false;
|
gameState_.chatUnread[0] = false;
|
||||||
openPhoneChatFromList(0, isPortraitMode() ? verticalPhoneChat1Root : phoneChat1Root);
|
openPhoneChatFromList(0, isPortraitMode() ? verticalPhoneChat1Root : phoneChat1Root);
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("chat2button", [this](const std::string&) {
|
uiManager.setTextButtonCallback("chat2button", [this](const std::string&) {
|
||||||
gameState_.chatUnread[1] = false;
|
gameState_.chatUnread[1] = false;
|
||||||
openPhoneChatFromList(1, isPortraitMode() ? verticalPhoneChat2Root : phoneChat2Root);
|
openPhoneChatFromList(1, isPortraitMode() ? verticalPhoneChat2Root : phoneChat2Root);
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setTextButtonCallback("chat3button", [this](const std::string&) {
|
uiManager.setTextButtonCallback("chat3button", [this](const std::string&) {
|
||||||
gameState_.chatUnread[2] = false;
|
gameState_.chatUnread[2] = false;
|
||||||
openPhoneChatFromList(2, isPortraitMode() ? verticalPhoneChat3Root : phoneChat3Root);
|
openPhoneChatFromList(2, isPortraitMode() ? verticalPhoneChat3Root : phoneChat3Root);
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,11 +889,13 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,15 +905,16 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("videoSkip", [this](const std::string&) {
|
uiManager.setButtonCallback("videoSkip", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
|
||||||
if (gameState_.isNight)
|
if (gameState_.isNight)
|
||||||
{
|
{
|
||||||
startDialogueFunc("dialog_video002");
|
startDialogueFunc("dialog_video002");
|
||||||
@@ -887,6 +928,7 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
audioPlayer_.playSoundAsync("audio/78564__joedeshon__alarm_clock_ticking_02.ogg");
|
||||||
startNightTransitionFunc();
|
startNightTransitionFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -911,11 +953,13 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("mapGo", [this](const std::string&) {
|
uiManager.setButtonCallback("mapGo", [this](const std::string&) {
|
||||||
gameState_.tutorialNeedOpenTaxiScreen = false;
|
gameState_.tutorialNeedOpenTaxiScreen = false;
|
||||||
@@ -927,7 +971,10 @@ namespace ZL {
|
|||||||
gameState_.money -= 500;
|
gameState_.money -= 500;
|
||||||
closePhoneEntirely();
|
closePhoneEntirely();
|
||||||
if (startDialogueFunc) startDialogueFunc("dialog_taxi002");
|
if (startDialogueFunc) startDialogueFunc("dialog_taxi002");
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::openPhoneChatFromList(int chatIndex, std::shared_ptr<UiNode> chatRoot) {
|
void MenuManager::openPhoneChatFromList(int chatIndex, std::shared_ptr<UiNode> chatRoot) {
|
||||||
@@ -967,10 +1014,12 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
|
||||||
closePhoneScreenFromChat();
|
closePhoneScreenFromChat();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
|
||||||
uiManager.setTextButtonCallback("chatTitleButton", [this](const std::string&) {
|
uiManager.setTextButtonCallback("chatTitleButton", [this](const std::string&) {
|
||||||
returnToPhoneChatList();
|
returnToPhoneChatList();
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (chatOpenCallback) {
|
if (chatOpenCallback) {
|
||||||
@@ -1054,30 +1103,37 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::showModalMenuScreen() {
|
void MenuManager::showModalMenuScreen() {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
uiManager.pushMenuFromSavedRoot(modalMenuRoot);
|
uiManager.pushMenuFromSavedRoot(modalMenuRoot);
|
||||||
uiManager.setButtonCallback("modalExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("modalExitButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("menuCloseButton", [this](const std::string&) {
|
uiManager.setButtonCallback("menuCloseButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
uiManager.updateAllLayouts();
|
uiManager.updateAllLayouts();
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("menuSaveButton", [this](const std::string&) {
|
uiManager.setButtonCallback("menuSaveButton", [this](const std::string&) {
|
||||||
showSaveGameScreen();
|
showSaveGameScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("menuLoadButton", [this](const std::string&) {
|
uiManager.setButtonCallback("menuLoadButton", [this](const std::string&) {
|
||||||
showLoadGameScreen();
|
showLoadGameScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("menuSettingsButton", [this](const std::string&) {
|
uiManager.setButtonCallback("menuSettingsButton", [this](const std::string&) {
|
||||||
showSettingsScreen();
|
showSettingsScreen();
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("menuExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("menuExitButton", [this](const std::string&) {
|
||||||
|
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
|
||||||
uiManager.popMenu();
|
uiManager.popMenu();
|
||||||
showMainMenu();
|
showMainMenu();
|
||||||
});
|
});
|
||||||
@@ -1441,6 +1497,7 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) {
|
||||||
closePortraitInventoryItem();
|
closePortraitInventoryItem();
|
||||||
|
audioPlayer_.playSoundAsync("audio/sound_bag001.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto& item = items[index];
|
const auto& item = items[index];
|
||||||
@@ -1468,6 +1525,7 @@ namespace ZL {
|
|||||||
|
|
||||||
uiManager.setButtonCallback("journalItemExitButton", [this](const std::string&) {
|
uiManager.setButtonCallback("journalItemExitButton", [this](const std::string&) {
|
||||||
closePortraitJournalItem();
|
closePortraitJournalItem();
|
||||||
|
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
|
||||||
});
|
});
|
||||||
|
|
||||||
Quest::QuestState* quest = gameState_.questJournal.findQuest(visibleQuestIds[index]);
|
Quest::QuestState* quest = gameState_.questJournal.findQuest(visibleQuestIds[index]);
|
||||||
@@ -1656,6 +1714,7 @@ namespace ZL {
|
|||||||
recomputePhoneChatPositions();
|
recomputePhoneChatPositions();
|
||||||
}
|
}
|
||||||
chatUiManager.startPopIn(nodeName, 300.0f);
|
chatUiManager.startPopIn(nodeName, 300.0f);
|
||||||
|
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::setDarklandsMode(bool enabled)
|
void MenuManager::setDarklandsMode(bool enabled)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace ZL {
|
|||||||
ScriptEngine::ScriptEngine() = default;
|
ScriptEngine::ScriptEngine() = default;
|
||||||
ScriptEngine::~ScriptEngine() = default;
|
ScriptEngine::~ScriptEngine() = default;
|
||||||
|
|
||||||
void ScriptEngine::init(Location* loc, Inventory* inventory, const std::string& scriptPath) {
|
void ScriptEngine::init(Location* loc, Inventory* inventory, AudioPlayerAsync* audioPlayer, const std::string& scriptPath) {
|
||||||
impl = std::make_unique<Impl>();
|
impl = std::make_unique<Impl>();
|
||||||
sol::state& lua = impl->lua;
|
sol::state& lua = impl->lua;
|
||||||
|
|
||||||
@@ -773,6 +773,14 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.set_function("play_sound",
|
||||||
|
[audioPlayer](const std::string& soundPath) -> void {
|
||||||
|
if (audioPlayer)
|
||||||
|
{
|
||||||
|
audioPlayer->playSoundAsync(soundPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
lua.script_file(scriptPath);
|
lua.script_file(scriptPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -5,6 +5,7 @@
|
|||||||
#include "quest/QuestJournal.h"
|
#include "quest/QuestJournal.h"
|
||||||
#include "external/nlohmann/json.hpp"
|
#include "external/nlohmann/json.hpp"
|
||||||
#include "ISaveable.h"
|
#include "ISaveable.h"
|
||||||
|
#include "AudioPlayerAsync.h"
|
||||||
|
|
||||||
namespace ZL {
|
namespace ZL {
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ public:
|
|||||||
~ScriptEngine();
|
~ScriptEngine();
|
||||||
|
|
||||||
// Must be called once, after the Game's NPCs are ready.
|
// Must be called once, after the Game's NPCs are ready.
|
||||||
void init(Location* game, Inventory* inventory, const std::string& scriptPath);
|
void init(Location* game, Inventory* inventory, AudioPlayerAsync* audioPlayer, const std::string& scriptPath);
|
||||||
|
|
||||||
// Execute a Lua script file. Logs errors to stderr.
|
// Execute a Lua script file. Logs errors to stderr.
|
||||||
void runScript(const std::string& path);
|
void runScript(const std::string& path);
|
||||||
|
|||||||
Reference in new issue
Block a user