diff --git a/resources/dialogue/sample_dialogues.json b/resources/dialogue/sample_dialogues.json index 82df86a..5f512a3 100644 --- a/resources/dialogue/sample_dialogues.json +++ b/resources/dialogue/sample_dialogues.json @@ -369,7 +369,7 @@ "text": "У нас бензин кончается.", "next": "line_2" }, - { + { "id": "line_2", "type": "Line", "speaker": "Hero", @@ -652,7 +652,7 @@ "portrait": "resources/hero.png", "text": ".. Счастливого пути!", "next": "end_1" - } + }, { "id": "end_1", "type": "End" diff --git a/resources/hero.png b/resources/hero.png index 963e132..78e6b92 100644 --- a/resources/hero.png +++ b/resources/hero.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3e6fcd692f1217cbab79f0dfbbfa67b9c88fd03ae5875c74eebee8428e1428cf -size 74667 +oid sha256:50e72de3a8a096c82897cf23f302f8b8b9c6c135ae066c9022238d4ad59ff519 +size 56920 diff --git a/resources/phone.png b/resources/phone.png new file mode 100644 index 0000000..527d142 --- /dev/null +++ b/resources/phone.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:023000b7f6c4aff4106305692ddf0a6a6b6621cbe24b4ee0f0c2f3e338c5eee5 +size 2562 diff --git a/src/Location.cpp b/src/Location.cpp index fd18f20..ba7bb55 100644 --- a/src/Location.cpp +++ b/src/Location.cpp @@ -165,15 +165,16 @@ void Location::setup() police->position = Vector3f{ 1000, -0, 10 }; police->setTarget(police->position); + std::cout << "[LOCATION] Setting up FOREST location (custom models only)" << std::endl; - carPosition ={ 7, 0, -7 + 200 }; + carPosition ={ 7, 0, -7 + 300 }; npcCar.position = Vector3f(9, 0, -335) + Vector3f(1000,0,0); - girlfriend->position = Vector3f{ 5, 0, 0.9 + 200 }; + girlfriend->position = Vector3f{ 5, 0, 0.9 + 300 }; girlfriend->setTarget(girlfriend->position); - player->position = { 9.5, 0, 0.95 + 200 }; + player->position = { 9.5, 0, 0.95 + 300 }; player->setTarget(player->position); Vector3f azsShift = { -17,0,0 }; @@ -1327,7 +1328,9 @@ void Location::setup() if (girlfriendInCar) { if (!dialoguePlayedDrivingGas1 && !dialogueSystem.isActive()) { - if (dialogueSystem.startDialogue("driving_dialogue_gas1")) { + if (dialogueSystem.startDialogue("driving_dialogue_gas1", [this]() { + dialogueDrivingGas1Finished = true; + })) { dialoguePlayedDrivingGas1 = true; } } @@ -1456,6 +1459,35 @@ void Location::setup() if (locationId == "forest") { + // Loop the player back in Z until the driving-gas dialogue has been + // completed. Mirrors the village-intro loop in the "default" location, + // but inverted: spawn is at positive Z and the player drives toward Z-. + if (!dialogueDrivingGas1Finished) { + constexpr float tileSize = 100.0f; + constexpr float loopStartZ = -7.0f + 300.0f; + constexpr float loopForwardThreshold = loopStartZ - tileSize; + + const Eigen::Vector3f anchor = inCar + ? carPosition + : (player ? player->position : Eigen::Vector3f::Zero()); + + if (anchor.z() < loopForwardThreshold) { + const Eigen::Vector3f shift(0.f, 0.f, tileSize); + if (inCar) { + carPosition += shift; + if (player) player->position = carPosition; + } + else if (player) { + player->position += shift; + player->setTarget(player->position); + player->clearPath(); + } + if (npcCar.mode == NpcCar::Mode::FOLLOW_PLAYER || npcCar.mode == NpcCar::Mode::NONE_STAY) { + npcCar.position += shift; + } + } + } + // After the gas-station sale, once the player has walked away from the // salesperson, the girlfriend chimes in — fires once. if (!dialoguePlayedGirlfriend1 && dialoguePlayedGas1 && salesperson && player && !dialogueSystem.isActive()) { @@ -1552,9 +1584,41 @@ void Location::setup() if (locationId == "default") { + // Loop the player back in Z until the village-intro dialogue has been + // completed. Mirrors the generic tile-wrap teleport above, but constrained + // to the stretch near the car's spawn point so the player can't reach the + // village center prematurely. + if (!dialogueVillageIntro1Finished) { + constexpr float tileSize = 100.0f; + constexpr float loopStartZ = -30.7197f - 300.0f; + constexpr float loopForwardThreshold = loopStartZ + tileSize; + + const Eigen::Vector3f anchor = inCar + ? carPosition + : (player ? player->position : Eigen::Vector3f::Zero()); + + if (anchor.z() > loopForwardThreshold) { + const Eigen::Vector3f shift(0.f, 0.f, -tileSize); + if (inCar) { + carPosition += shift; + if (player) player->position = carPosition; + } + else if (player) { + player->position += shift; + player->setTarget(player->position); + player->clearPath(); + } + if (npcCar.mode == NpcCar::Mode::FOLLOW_PLAYER || npcCar.mode == NpcCar::Mode::NONE_STAY) { + npcCar.position += shift; + } + } + } + if (player && !dialoguePlayedVillageIntro1 && !dialogueSystem.isActive()) { if (player->position.z() > -36.f - 300) { - if (dialogueSystem.startDialogue("dialogue_village_intro1")) { + if (dialogueSystem.startDialogue("dialogue_village_intro1", [this]() { + dialogueVillageIntro1Finished = true; + })) { dialoguePlayedVillageIntro1 = true; } } @@ -1586,7 +1650,7 @@ void Location::setup() if (bandit && player && !dialoguePlayedBanditCaught1) { Eigen::Vector3f toBandit = bandit->position - player->position; toBandit.y() = 0.f; - if (toBandit.norm() < 12.0f && !dialogueSystem.isActive()) { + if (toBandit.norm() < 10.0f && !dialogueSystem.isActive()) { if (dialogueSystem.startDialogue("dialogue_village_caught1_car")) { dialoguePlayedBanditCaught1 = true; banditFollowingPlayer = true; @@ -1834,7 +1898,7 @@ void Location::setup() if (!bandit || !player || !banditFollowingPlayer) return; constexpr float retargetThreshold = 0.1f; - constexpr float stopDistance = 4.0f; + constexpr float stopDistance = 2.0f; const Eigen::Vector3f targetPos = inCar ? carPosition : player->position; diff --git a/src/Location.h b/src/Location.h index f8e6d41..bf297b5 100644 --- a/src/Location.h +++ b/src/Location.h @@ -113,6 +113,7 @@ namespace ZL bool dialoguePlayedOffroad = false; bool dialoguePlayedCrash = false; bool dialoguePlayedDrivingGas1 = false; + bool dialogueDrivingGas1Finished = false; bool dialoguePlayedGas1 = false; bool dialoguePlayedGirlfriend1 = false; bool dialoguePlayedPhone1 = false; @@ -145,6 +146,7 @@ namespace ZL bool dialoguePlayedVillageRescue1 = false; bool dialoguePlayedVillageIntro1 = false; + bool dialogueVillageIntro1Finished = false; bool dialoguePlayedVillageIntro2 = false; bool dialoguePlayedVillageFinal1 = false; bool dialoguePlayedVillageFinal2 = false;