diff --git a/resources/config2/interactive_objects_uni_interior_x.json b/resources/config2/interactive_objects_uni_interior_x.json index 270a7e5..b03230f 100644 --- a/resources/config2/interactive_objects_uni_interior_x.json +++ b/resources/config2/interactive_objects_uni_interior_x.json @@ -98,7 +98,7 @@ { "name": "ReportCard001", "texturePath": "resources/w/interior/report_card_tex001.png", - "meshPath": "resources/w/interior/book001.txt.bin", + "meshPath": "resources/w/interior/report_card001_001.txt", "rotationX": 0.0, "rotationY": 0.0, "rotationZ": 0.0, diff --git a/resources/config2/npcs_dorm.json b/resources/config2/npcs_dorm.json index 02a2ef5..b788231 100644 --- a/resources/config2/npcs_dorm.json +++ b/resources/config2/npcs_dorm.json @@ -1,45 +1,5 @@ { "npcs": [ - { - "id": "npc_01_woman", - "name": "Бермет", - "animationIdlePath": "resources/w/girlfriend/girlfriend_idle003_small.anim", - "animationWalkPath": "resources/w/girlfriend/girlfriend_walk003_small.anim", - "meshTextures": { - "Girl_Low": "resources/w/girlfriend/Girl_Base_color.png" - }, - "positionX": 1.03298, - "positionY": 0.0, - "positionZ": -4.61801, - "facingAngle" : 180, - "walkSpeed": 1.8, - "rotationSpeed": 8.0, - "modelScale": 1.0, - "modelCorrectionRotX": -90.0, - "modelCorrectionRotY": 180.0, - "modelCorrectionRotZ": 0.0, - "interactionRadius": 2.0 - }, - { - "id": "npc_02_woman", - "name": "Алтынай", - "animationIdlePath": "resources/w/girl/girl_idle001_small.anim", - "animationWalkPath": "resources/w/girl/girl_walk010_small.anim", - "meshTextures": { - "polySurface1": "resources/w/girl/Chat_02_diff_1r006.png" - }, - "positionX": 1.47973, - "positionY": 0.0, - "positionZ": 0.410257, - "facingAngle" : 0, - "walkSpeed": 1.8, - "rotationSpeed": 8.0, - "modelScale": 0.016, - "modelCorrectionRotX": 0.0, - "modelCorrectionRotY": 180.0, - "modelCorrectionRotZ": 0.0, - "interactionRadius": 2.0 - }, { "id": "npc_alik", "name": "Алик", diff --git a/resources/config2/npcs_uni_interior.json b/resources/config2/npcs_uni_interior.json index 808c8ba..df6e78d 100644 --- a/resources/config2/npcs_uni_interior.json +++ b/resources/config2/npcs_uni_interior.json @@ -14,7 +14,7 @@ "walkSpeed": 1.3, "rotationSpeed": 8.0, "modelScale": 1.0, - "facingAngle" : 180, + "facingAngle" : 0, "modelCorrectionRotX": -90.0, "modelCorrectionRotY": 180.0, "modelCorrectionRotZ": 0.0, @@ -139,6 +139,26 @@ "modelCorrectionRotZ": 0.0, "hp": 35, "canAttack": true + }, + { + "id": "npc_02_woman", + "name": "Алтынай", + "animationIdlePath": "resources/w/girl/girl_idle001_small.anim", + "animationWalkPath": "resources/w/girl/girl_walk010_small.anim", + "meshTextures": { + "polySurface1": "resources/w/girl/Chat_02_diff_1r006.png" + }, + "positionX": 3.98998, + "positionY": 0.0, + "positionZ": 10.375, + "facingAngle" : 180, + "walkSpeed": 1.8, + "rotationSpeed": 8.0, + "modelScale": 0.016, + "modelCorrectionRotX": 0.0, + "modelCorrectionRotY": 180.0, + "modelCorrectionRotZ": 0.0, + "interactionRadius": 2.0 } ] } \ No newline at end of file diff --git a/resources/dialogue/choice_main.png b/resources/dialogue/choice_main.png deleted file mode 100644 index 77b51be..0000000 --- a/resources/dialogue/choice_main.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:426debd008e3787830cf904aa50f2cb82cc4ddb322d6e316125ecbd40932cbcd -size 518 diff --git a/resources/dialogue/choice_optional.png b/resources/dialogue/choice_optional.png deleted file mode 100644 index 4651f37..0000000 --- a/resources/dialogue/choice_optional.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:167c1b2c066ad417bd6fd2aaa37e8d058df3f05d2d1d11d5124743b384b92097 -size 524 diff --git a/resources/dialogue/choice_selected.png b/resources/dialogue/choice_selected.png deleted file mode 100644 index 714ae39..0000000 --- a/resources/dialogue/choice_selected.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e4b5c30574b544cc07569526e4562c6f6c7db22903b7c901f277ddf966e8d6d6 -size 519 diff --git a/resources/dialogue/cutscenes005.json b/resources/dialogue/cutscenes005.json index 63438f3..652f867 100644 --- a/resources/dialogue/cutscenes005.json +++ b/resources/dialogue/cutscenes005.json @@ -8,7 +8,7 @@ "fadeInMs": 500, "endFadeOutMs": 0, "endFadeInMs": 2000, - "onFadeInCallback": "", + "onFadeInCallback": "on_lection_cutscene_fadein_callback", "imageSegments": [ { "path": "resources/black.png", diff --git a/resources/dialogue/dorm_dialogues.json b/resources/dialogue/dorm_dialogues.json index 82db8c6..409823b 100644 --- a/resources/dialogue/dorm_dialogues.json +++ b/resources/dialogue/dorm_dialogues.json @@ -404,42 +404,6 @@ } ] }, - { - "id": "dialog_female_student001", - "start": "line_1", - "nodes": [ - { - "id": "line_1", - "type": "Line", - "speaker": "Бермет", - "portrait": "resources/dialogue/portrait_student_girl.png", - "text": "Бекзат отстань!", - "next": "end_1" - }, - { - "id": "end_1", - "type": "End" - } - ] - }, - { - "id": "dialog_female_student002", - "start": "line_1", - "nodes": [ - { - "id": "line_1", - "type": "Line", - "speaker": "Алтынай", - "portrait": "resources/dialogue/portrait_student_girl.png", - "text": "Бекзат ты почему на пары не ходишь?!", - "next": "end_1" - }, - { - "id": "end_1", - "type": "End" - } - ] - }, { "id": "dialog_alik001", "start": "line_1", @@ -478,6 +442,25 @@ "text": "Заходи!", "next": "end_1" }, + { + "id": "end_1", + "type": "End", + "luaCallback": "alik_door_open_callback" + } + ] + }, + { + "id": "door_alik_dialog002", + "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" diff --git a/resources/dialogue/uni_interior_dialogues_006.json b/resources/dialogue/uni_interior_dialogues_006.json index f7d1d65..f0ffad7 100644 --- a/resources/dialogue/uni_interior_dialogues_006.json +++ b/resources/dialogue/uni_interior_dialogues_006.json @@ -2280,7 +2280,24 @@ "type": "End" } ] - } - ], - "cutscenes": [] + }, + { + "id": "dialog_female_student002", + "start": "line_1", + "nodes": [ + { + "id": "line_1", + "type": "Line", + "speaker": "Алтынай", + "portrait": "resources/dialogue/portrait_student_girl.png", + "text": "Бекзат, отстань!", + "next": "end_1" + }, + { + "id": "end_1", + "type": "End" + } + ] + } + ] } \ No newline at end of file diff --git a/resources/start_dorm.lua b/resources/start_dorm.lua index 1537780..b988d47 100644 --- a/resources/start_dorm.lua +++ b/resources/start_dorm.lua @@ -7,24 +7,13 @@ player_door_opened = false alik_door_opened = false - -local function step2() - game_api.npc_walk_to(0, 1.03298, 0, -4.61801, step1) -end - -function step1() - game_api.npc_walk_to(0, -6.65295, 0, 4.15397, step2) -end - -step1() - game_api.start_dialogue("dialog_start001") phone_picked_up = false journal_picked_up = false function on_npc_interact(npc_index) - if npc_index == 2 then + if npc_index == 0 then local player_alik_aware = game_api.getIntValue("alik_aware") local player_container_aware = game_api.getIntValue("player_container_aware") if player_container_aware == 1 then @@ -36,12 +25,6 @@ function on_npc_interact(npc_index) game_api.start_dialogue("dialog_alik001") end end - if npc_index == 0 then - game_api.start_dialogue("dialog_female_student001") - end - if npc_index == 1 then - game_api.start_dialogue("dialog_female_student002") - end end function on_phone_pickup() @@ -60,25 +43,6 @@ function on_journal_pickup() game_api.quest_set_objective_completed("tutorial_take_items", "take_journal") end ---[[ -function pickup_phone_zone001_enter_callback() - print("pickup_phone_zone001_enter_callback--!") - if (not phone_picked_up) or (not journal_picked_up) then - game_api.start_dialogue("dialog_phone001") - game_api.switch_navigation(1) - end -end - -function pickup_phone_zone001_exit_callback() - print("pickup_phone_zone001_exit_callback--!") - game_api.switch_navigation(0) -end - -game_api.set_trigger_zone_callbacks("pickup_phone_zone001", - pickup_phone_zone001_enter_callback, - pickup_phone_zone001_exit_callback -)]] - function ladder_zone001_enter_callback() game_api.start_dialogue("dialog_second_floor001") end @@ -127,13 +91,22 @@ function on_sleep_cutscene() end function on_alik_door_click() + if (game_api.is_night()) then + game_api.start_dialogue("door_alik_dialog002") + else + if (alik_door_opened == false) then + game_api.start_dialogue("door_alik_dialog001") + end + end +end + +function alik_door_open_callback() if (alik_door_opened == false) then alik_door_opened = true - game_api.start_dialogue("door_alik_dialog001") - game_api.rotate_object("Door_Room_-1_-1_1_Leaf_001", -90, 0.5, nil) game_api.fade_object("Room_Cover_LivingRoom_W_S_2_001", 0, 0.5, function() game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_S_2_001") + game_api.set_npc_enabled(0, true) end) if (bathroom_door_opened) then @@ -144,6 +117,21 @@ function on_alik_door_click() end end +function closeAlikDoor() + if (alik_door_opened) then + alik_door_opened = false + game_api.activate_interactive_object("Room_Cover_LivingRoom_W_S_2_001") + game_api.set_object_alpha("Room_Cover_LivingRoom_W_S_2_001", 1) + game_api.set_object_rotation("Door_Room_-1_-1_1_Leaf_001", 0) + game_api.set_npc_enabled(0, false) + if (bathroom_door_opened) then + game_api.switch_navigation(3) -- closed only alik (a) + else + game_api.switch_navigation(2) --closed bathroom and alik (ba) + end + end +end + function on_player_bathroom_click() if (bathroom_door_opened == false) then bathroom_door_opened = true @@ -201,6 +189,7 @@ end game_api.set_enter_night_callback( function() game_api.start_dialogue("dialog_video001") + closeAlikDoor() end ) @@ -256,6 +245,9 @@ game_api.set_location_callbacks( local hp = game_api.getFloatValue("player_hp") game_api.set_player_hp(hp) game_api.set_teleport_active(0, false) + if (game_api.is_night()) then + closeAlikDoor() + end end, function() print("Exit location dorm") @@ -277,5 +269,6 @@ game_api.set_call_taxi_callback( ) +game_api.set_npc_enabled(0, false) game_api.switch_navigation(0) print("Lua script loaded successfully--!") diff --git a/resources/start_uni_interior.lua b/resources/start_uni_interior.lua index 581ea66..0a6c681 100644 --- a/resources/start_uni_interior.lua +++ b/resources/start_uni_interior.lua @@ -172,16 +172,6 @@ function on_npc_interact(npc_index) game_api.start_dialogue("knife_dialog001") end end ---[[ - if (day == 0) then - if (player_hold_key) then - game_api.start_dialogue("knife_dialog002") - else - game_api.start_dialogue("knife_dialog001") - end - else - game_api.start_dialogue("dialog_aiperi_morning001") - end]] end if npc_index == 0 then if (player_ghost_aware == 1) then @@ -213,6 +203,9 @@ function on_npc_interact(npc_index) game_api.start_dialogue("dialog_with_ghost001") end end + if npc_index == 6 then + game_api.start_dialogue("dialog_female_student002") + end end function on_quest_over() @@ -397,6 +390,7 @@ function on_hall_door_click() game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001") end) game_api.set_npc_enabled(0, true) + game_api.set_npc_enabled(6, true) end else if (game_api.is_night()) then @@ -445,10 +439,17 @@ end function on_teacher_arrived() print("Teacher arrived") + game_api.npc_rotate_to(0, 180) +end + +function on_student_arrived() + print("Student arrived") + game_api.npc_rotate_to(6, 270) end function on_teacher_arrived2() print("Teacher arrived2") + game_api.npc_rotate_to(0, 0) end function book_dialog_zone001_enter_callback() @@ -515,6 +516,7 @@ function on_sleep_cutscene() game_api.set_night() --game_api.set_trigger_zone_enabled(1, false) game_api.set_npc_enabled(0, false) + game_api.set_npc_enabled(6, false) game_api.switch_navigation(16) game_api.set_object_rotation("Room_N_2_Leaf001", 0) game_api.set_object_rotation("Hall_Leaf001", 0) @@ -539,16 +541,23 @@ function on_teacher_arrived_intermediate() game_api.deactivate_interactive_object("Room_Cover_North_3_001") end) game_api.switch_navigation(2) - game_api.npc_walk_to(0, 3.19574, 0, 6.45595, on_teacher_arrived) + game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived) teacher_arrived = true end +function on_lection_cutscene_fadein_callback() + print("Lection cutscene in progress!") + game_api.player_set_position(-2.41002, 0, 10.375) + game_api.player_set_rotation(180) +end + game_api.set_cutscene_callback("lection_cutscene001", function() print("Cutscene done!") game_api.setIntValue("lection_is_over", 1) game_api.set_npc_enabled(1, true) game_api.npc_walk_to(0, 0.758123, 0, 6.50063, on_teacher_arrived_intermediate) + game_api.npc_walk_to(6, 5.28998, 0, -5.525, on_student_arrived) local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware") @@ -601,6 +610,7 @@ game_api.set_darklands_callbacks( game_api.set_npc_enabled(0, false) game_api.set_npc_enabled(1, false) + game_api.set_npc_enabled(6, false) if (ghost_gone) then game_api.set_npc_enabled(2, false) @@ -632,6 +642,7 @@ game_api.set_darklands_callbacks( game_api.set_npc_enabled(3, false) game_api.set_npc_enabled(4, false) game_api.set_npc_enabled(5, false) + game_api.set_npc_enabled(6, false) --game_api.setIntValue("need_sleep", 1) --player_left_darklands = true @@ -642,16 +653,23 @@ game_api.set_darklands_callbacks( local px = game_api.get_player_x() local pz = game_api.get_player_z() + + print("darklands exit px = ") + print(px) + + print("darklands exit pz = ") + print(pz) + if (pz > 8.0) then game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001") morning_can_open_door_index = 6 - elseif (pz <= 8.0) and (pz > 0) and (px >= 1.5) then + elseif (pz <= 8.0) and (pz > 0) and (px >= 1.5 + 0.1) then game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.deactivate_interactive_object("Room_Cover_North_3_001") 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 - 0.1) then if (teacher_door_opened) then game_api.deactivate_interactive_object("Room_Cover_Corridor_001") else @@ -659,15 +677,15 @@ game_api.set_darklands_callbacks( end game_api.deactivate_interactive_object("Room_Cover_South_3_001") 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 + 0.1) then game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.deactivate_interactive_object("Room_Cover_North_2_001") morning_can_open_door_index = 4 - elseif (pz <= 0.0) and (pz > -8) and (px <= -1.5) then + elseif (pz <= 0.0) and (pz > -8) and (px <= -1.5 - 0.1) then game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.deactivate_interactive_object("Room_Cover_South_2_001") morning_can_open_door_index = 2 - elseif (pz <= -8.0) and (px <= -1.5) then + elseif (pz <= -8.0) and (px <= -1.5-0.1) then game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.deactivate_interactive_object("Room_Cover_South_1_001") morning_can_open_door_index = 1 @@ -677,6 +695,19 @@ game_api.set_darklands_callbacks( game_api.deactivate_interactive_object("Room_Cover_South_3_001") end morning_can_open_door_index = 0 + if (px >=1.4) and (px < 1.6) then + -- stick to 1.4 + print("Edge case with px = ") + print (px) + game_api.player_set_position(1.35, 0, pz) + end + + if (px <=-1.4) and (px > -1.6) then + -- stick to -1.48 + print("Edge case2 with px = ") + print (px) + game_api.player_set_position(-1.35, 0, pz) + end end @@ -720,6 +751,8 @@ function setDay0setup() game_api.set_npc_enabled(3, false) game_api.set_npc_enabled(4, false) game_api.set_npc_enabled(5, false) + game_api.set_npc_enabled(6, false) + end function setDay1setup() @@ -754,6 +787,7 @@ function setDay1setup() game_api.set_npc_enabled(3, false) game_api.set_npc_enabled(4, false) game_api.set_npc_enabled(5, false) + game_api.set_npc_enabled(6, true) game_api.npc_set_position(1, 0.98998, 0, -7.525) end @@ -798,6 +832,7 @@ function setDay1MorningSetup() game_api.set_npc_enabled(3, false) game_api.set_npc_enabled(4, false) game_api.set_npc_enabled(5, false) + game_api.set_npc_enabled(6, false) game_api.npc_set_position(1, 0.98998, 0, -7.525) @@ -892,6 +927,7 @@ function setDay1NightSetup() game_api.set_npc_enabled(3, false) game_api.set_npc_enabled(4, false) game_api.set_npc_enabled(5, false) + game_api.set_npc_enabled(6, false) local px = game_api.get_player_x() local pz = game_api.get_player_z() @@ -941,30 +977,6 @@ game_api.set_enter_night_callback( end ) ---[[ -game_api.set_chat_callbacks( - function() - if (game_api.is_night()) then - if (game_api.is_dawn()) then - if not (morning_can_open_door_index == 0) and not (morning_can_open_door_index == 3) then - game_api.start_dialogue("phone_morning_aiperi001") - else - --TODO: add aiperi that she already came to the uni - end - else - local asked_help_locked = game_api.getIntValue("asked_help_locked") - if not (asked_help_locked == 1) then - game_api.start_dialogue("phone_night_aiperi001") - end - end - end - end, - nil, - nil -) -]] - - game_api.set_chat_callbacks( function() if (game_api.is_night()) then @@ -1020,27 +1032,8 @@ game_api.set_chat_callbacks( end end end - end ---[[ - if aiperi_chat_opened == 0 then - game_api.setIntValue("aiperi_chat_opened", 1) - - if (player_hold_knife) and (aiperi_talked_after_knife == 0) then - game_api.start_dialogue("dialog_chat_aiperi003") - game_api.setIntValue("aiperi_talked_after_knife", 1) - else - if aiperi_knife_aware == 0 then - local lection_is_over = game_api.getIntValue("lection_is_over") - if (lection_is_over == 1) then - game_api.start_dialogue("dialog_chat_aiperi002") - else - game_api.start_dialogue("dialog_chat_aiperi001") - end - end - end - end]] end end, function() @@ -1243,35 +1236,6 @@ game_api.set_location_callbacks( end end - - --[[ - local day = game_api.getIntValue("day") - if (day == 0)then - was_state_when_player_left = 0 - elseif game_api.is_darklands() then - was_state_when_player_left = 1 - elseif game_api.is_dawn() then - was_state_when_player_left = 2 - elseif game_api.is_night() then - was_state_when_player_left = 3 - else - was_state_when_player_left = 4 - end - possible situation combinations: - left from darklands - left from morning - left from day - left from night - - arrive in darklands - arrive in morning - arrive in day - arrive in night - - ]] - - - if (day > 0) and (game_api.is_night() == false) then print("entered day setup") setDay1setup() diff --git a/src/Character.cpp b/src/Character.cpp index 64f7eb0..4b83b76 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -240,7 +240,7 @@ void Character::update(int64_t deltaMs) { lookTarget = attackTarget->position; } - targetFacingAngle = facingAngle; + //targetFacingAngle = facingAngle; if (currentState == AnimationState::WALK || currentState == AnimationState::STAND) { @@ -294,7 +294,7 @@ void Character::update(int64_t deltaMs) { } } else { - targetFacingAngle = facingAngle; + //targetFacingAngle = facingAngle; } } } @@ -355,6 +355,9 @@ void Character::update(int64_t deltaMs) { while (angleDiff > static_cast(M_PI)) angleDiff -= 2.f * static_cast(M_PI); while (angleDiff < -static_cast(M_PI)) angleDiff += 2.f * static_cast(M_PI); float rotStep = rotationSpeed * static_cast(deltaMs) / 1000.f; + //std::cout << this->npcName << " targetFacingAngle: " << targetFacingAngle << " radians, " << (targetFacingAngle * 180.f / static_cast(M_PI)) << " degrees\n"; + //std::cout << this->npcName << " facingAngle: " << facingAngle << " radians, " << (facingAngle * 180.f / static_cast(M_PI)) << " degrees\n"; + if (std::fabs(angleDiff) <= rotStep) { facingAngle = targetFacingAngle; // One-shot face-target: once aligned, stop tracking. Otherwise the NPC @@ -362,6 +365,8 @@ void Character::update(int64_t deltaMs) { // started, even as the player moved away. faceTarget = nullptr; } else { + //std::cout << this->npcName << " facingAngle difference: " << angleDiff << " radians, " << (angleDiff * 180.f / static_cast(M_PI)) << " degrees\n"; + facingAngle += (angleDiff > 0.f ? rotStep : -rotStep); } diff --git a/src/Game.cpp b/src/Game.cpp index 578f1a1..0281159 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -14,7 +14,6 @@ #include #endif - #ifdef EMSCRIPTEN #include #endif @@ -223,6 +222,14 @@ namespace ZL #endif + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_aiperi.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_ghost.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_hero_neutral.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_hero_think.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_phone.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_student_boy.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_student_girl.png", CONST_ZIP_FILE); + renderer.textureManager.LoadFromPng("resources/dialogue/portrait_teacher.png", CONST_ZIP_FILE); std::cout << "Load resurces step 4" << std::endl; @@ -380,12 +387,12 @@ namespace ZL "resources/navigation/dorm3_all_open.json", };*/ params_dorm.navigationJsonPaths = { - "resources/navigation/dorm3_bca.txt", - "resources/navigation/dorm3_ca.txt", + "resources/navigation/dorm3_bca.txt", //0 + "resources/navigation/dorm3_ca.txt", //1 "resources/navigation/dorm3_ba.txt", "resources/navigation/dorm3_a.txt", "resources/navigation/dorm3_b.txt", - "resources/navigation/dorm3_all_open.txt", + "resources/navigation/dorm3_all_open.txt", //5 }; params_dorm.teleportsJsonPath = "resources/config2/teleports_dorm.json"; diff --git a/src/ScriptEngine.cpp b/src/ScriptEngine.cpp index b471e1c..df60624 100644 --- a/src/ScriptEngine.cpp +++ b/src/ScriptEngine.cpp @@ -67,6 +67,21 @@ namespace ZL { npcs[index]->setTarget(Eigen::Vector3f(x, y, z), std::move(cb)); }); + + api.set_function("npc_rotate_to", + [loc](int index, float angle) { + auto& npcs = loc->npcs; + if (index < 0 || index >= static_cast(npcs.size())) { + std::cerr << "[script] npc_rotate_to: index " << index + << " out of range (0.." << npcs.size() - 1 << ")\n"; + return; + } + + const float rad = angle * static_cast(M_PI) / 180.f; + std::cout << "[script] npc_rotate_to: index " << index << " angle " << angle << " degrees (" << rad << " radians)" << std::endl; + npcs[index]->targetFacingAngle = rad; + }); + api.set_function("player_walk_to", [loc](float x, float y, float z, sol::object on_arrived) { @@ -502,6 +517,21 @@ namespace ZL { npcs[index]->battle_state = 0; }); + api.set_function("player_set_position", + [loc](float x, float y, float z) { + Eigen::Vector3f pos(x, y, z); + loc->player->position = pos; + loc->player->homePosition = pos; + loc->player->setTarget(pos); + }); + + api.set_function("player_set_rotation", + [loc](float angle) { + const float rad = angle * static_cast(M_PI) / 180.f; + loc->player->facingAngle = rad; + loc->player->targetFacingAngle = rad; + }); + // move_object(name, x, y, z, duration_sec [, on_complete]) api.set_function("move_object", [loc](const std::string& name, float x, float y, float z, diff --git a/src/cutscene/CutsceneOverlay.cpp b/src/cutscene/CutsceneOverlay.cpp index 1ee0a66..6f69ae9 100644 --- a/src/cutscene/CutsceneOverlay.cpp +++ b/src/cutscene/CutsceneOverlay.cpp @@ -12,8 +12,8 @@ bool CutsceneOverlay::init(Renderer& renderer, const std::string& zipFile) { rendererRef = &renderer; zipFilename = zipFile; - choiceMainTexture = renderer.textureManager.LoadFromPng("resources/dialogue/choice_main.png", zipFile); - choiceOptionalTexture = renderer.textureManager.LoadFromPng("resources/dialogue/choice_optional.png", zipFile); + //choiceMainTexture = renderer.textureManager.LoadFchoiceMainTextureromPng("resources/dialogue/choice_main.png", zipFile); + //choiceOptionalTexture = renderer.textureManager.LoadFromPng("resources/dialogue/choice_optional.png", zipFile); cutsceneSubtitleTexture = renderer.textureManager.LoadFromPng("resources/dialogue/cutscene_subtitle_bg.png", zipFile); nameRenderer = std::make_unique(); @@ -176,7 +176,7 @@ void CutsceneOverlay::draw(Renderer& renderer, const ZL::Dialogue::PresentationM } if (model.cutsceneSkippable && cutsceneSkipHintVisible) { - const UiRect hintBg{ W - 250.0f, H - 62.0f, 226.0f, 42.0f }; + /*const UiRect hintBg{W - 250.0f, H - 62.0f, 226.0f, 42.0f}; skipHintBgQuad.rebuild(hintBg); glBindTexture(GL_TEXTURE_2D, choiceOptionalTexture->getTexID()); renderer.DrawVertexRenderStruct(skipHintBgQuad.mesh); @@ -194,7 +194,7 @@ void CutsceneOverlay::draw(Renderer& renderer, const ZL::Dialogue::PresentationM skipProgressFillQuad.rebuild(progressFill); glBindTexture(GL_TEXTURE_2D, choiceMainTexture->getTexID()); renderer.DrawVertexRenderStruct(skipProgressFillQuad.mesh); - } + }*/ } renderer.PopMatrix(); diff --git a/src/cutscene/CutsceneOverlay.h b/src/cutscene/CutsceneOverlay.h index 937a50a..1b41168 100644 --- a/src/cutscene/CutsceneOverlay.h +++ b/src/cutscene/CutsceneOverlay.h @@ -28,8 +28,8 @@ private: Renderer* rendererRef = nullptr; std::string zipFilename; - std::shared_ptr choiceMainTexture; - std::shared_ptr choiceOptionalTexture; + //std::shared_ptr choiceMainTexture; + //std::shared_ptr choiceOptionalTexture; std::shared_ptr cutsceneSubtitleTexture; mutable UiRect lastCutsceneAdvanceRect{};