Working on taxi car

This commit is contained in:
Vladislav Khorev committed 2026-07-14 14:07:53 +03:00
1 parent 38e45d67b8
commit 35a2a91178
21 files changed
+26446 -45

No files matched your search

+115 -16
View File
@@ -230,8 +230,20 @@ namespace ZL
// so it stays a single synchronous function rather than being split into
// per-location queue steps; it's queued here as one coarse step.
loadSteps.push([this]() {
createLocations();
createLocationsStep1();
});
loadSteps.push([this]() {
createLocationsStep2();
});
loadSteps.push([this]() {
createLocationsStep3();
});
loadSteps.push([this]() {
createLocationsStep4();
});
loadSteps.push([this]() {
createLocationsStep5();
});
loadSteps.push([this]() {
// Wire inventory callbacks: tutorial tracking + toast notifications.
@@ -392,7 +404,11 @@ namespace ZL
}
gameState.inventory.clear();
gameState.questJournal.loadFromFile(localizedConfigPath("resources/config/quests.json", g_currentLanguage), CONST_ZIP_FILE);
createLocations();
createLocationsStep1();
createLocationsStep2();
createLocationsStep3();
createLocationsStep4();
createLocationsStep5();
// Developer workflow: uncomment to (re)generate resources/config/start_state.json
// from this freshly-rebuilt state after changing gameplay/content JSON or Lua.
@@ -432,25 +448,30 @@ namespace ZL
void Game::saveInitialState() {
nlohmann::json root;
gameState.save(root);
const std::string path = "resources/config/start_state.json";
/*
const std::string path = "start_state.json";
std::cout << "[reset] saveInitialState called, to " << path << std::endl;
std::ofstream file(path);
if (file.is_open()) {
file << root.dump(2);
std::cout << "[reset] Saved initial state snapshot to " << path << std::endl;
} else {
std::cerr << "[reset] Could not open " << path << " for writing" << std::endl;
}*/
}
saveJsonToFile(root, path);
}
void Game::createLocations()
void Game::createLocationsStep1()
{
gameState.locations.clear();
gameState.globalFloats["player_hp"] = 200;
}
void Game::createLocationsStep2()
{
LocationSetup uniInteriorParams;
uniInteriorParams.gameObjectsJsonPath = "resources/config/gameobjects_uni_interior_x.json";
uniInteriorParams.npcsJsonPath = "resources/config/npcs_uni_interior.json";
@@ -553,17 +574,33 @@ namespace ZL
gameState.locations["uni_interior"]->requestDarklandsPlayNormalMusic = [this]() {
audioPlayer->crossFadeMusicFromPositionAsync("audio/bishkek fight calm.ogg");
};
}
void Game::createLocationsStep3()
{
LocationSetup uniInteriorParams;
LocationSetup uniExteriorParams = uniInteriorParams;
uniExteriorParams.gameObjectsJsonPath = "resources/config/gameobjects_uni_exterior_x.json";
uniExteriorParams.interactiveObjectsJsonPath = "resources/config/interactive_objects_uni_exterior_x.json";
//uniExteriorParams.navigationJsonPaths = {"resources/navigation/uni_exterior3_all.json"};
/*
uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_trees_car.json",
"resources/navigation/uni_exterior3_trees.json",
"resources/navigation/uni_exterior0.json",
"resources/navigation/uni_exterior0.json"
};*/
//uni_exterior0
/*uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_all.json",
"resources/navigation/uni_exterior3_all.json"
};*/
/*
uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_trees_car.json",
"resources/navigation/uni_exterior3_trees.json",
};*/
uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_trees_car.txt",
"resources/navigation/uni_exterior3_trees.txt",
@@ -585,7 +622,7 @@ namespace ZL
gameState.locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) {
gameState.isNight = isNight;
gameState.isDawn = isDawn;
};
};
gameState.locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
gameState.locations["uni_exterior"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); };
gameState.locations["uni_exterior"]->requestReturnToMainMenu = [this]() { menuManager.showMainMenu(); };
@@ -595,6 +632,34 @@ namespace ZL
if (gameState.locations["uni_exterior"]->player)
gameState.locations["uni_exterior"]->player->state.onDeathAnimComplete = [this]() { startDarklandsTransition(); };
//Exterior set up taxi:
gameState.locations["uni_exterior"]->state.taxiCarTriggerPosition = Eigen::Vector3f(-17.6, 0.05, -45);
gameState.locations["uni_exterior"]->state.taxiCarWaypoints = {
Vector3f(-17.6, 0.05, -90.0),
Vector3f(-17.6, 0.05, -75.0),
Vector3f(-17.6, 0.05, -55.0)
};
gameState.locations["uni_exterior"]->state.taxiCarInitialState.position = /*Vector3f(-17.6, 0.05, -40);*/ Vector3f(-17.6, 0.05, -100);
gameState.locations["uni_exterior"]->state.taxiCarInitialState.rotation = 180.f;
gameState.locations["uni_exterior"]->state.taxiCarInitialState.mode = NpcCar::Mode::NONE;
gameState.locations["uni_exterior"]->state.taxiCarInitialState.velocity = 0.f;
gameState.locations["uni_exterior"]->state.taxiCarInitialState.steeringAngle = 0.f;
gameState.locations["uni_exterior"]->state.taxiCarInitialState.waypointReachRadius = 5.f;
gameState.locations["uni_exterior"]->state.taxiCar = gameState.locations["uni_exterior"]->state.taxiCarInitialState;
//Exterior set up taxi end
}
void Game::createLocationsStep4()
{
LocationSetup params_dorm;
//params_dorm.gameObjectsJsonPath = "resources/config/gameobjects_dorm.json";
//params_dorm.gameObjectsJsonPath = "resources/config/gameobjects_dorm_trees001.json";
@@ -621,7 +686,7 @@ namespace ZL
"resources/navigation/dorm3_b.txt",
"resources/navigation/dorm3_all_open.txt", //5
};
/*
params_dorm.navigationJsonPaths = {
"resources/navigation/dorm0_large.json",
@@ -654,6 +719,35 @@ namespace ZL
gameState.locations["location_dorm"]->state.tutorialInteractiveObjectsLocked = true;
//Dorm set up taxi:
gameState.locations["location_dorm"]->state.taxiCarTriggerPosition = Eigen::Vector3f(-19.0, 0, 0);
gameState.locations["location_dorm"]->state.taxiCarWaypoints = {
Vector3f(-20.85, 0, 30.0),
Vector3f(-19.35, 0, 24.0),
Vector3f(-19.35, 0, 14.0)
};
gameState.locations["location_dorm"]->state.taxiCarInitialState.position = Vector3f(-20.85, 0, 64);
gameState.locations["location_dorm"]->state.taxiCarInitialState.rotation = 0.f;
gameState.locations["location_dorm"]->state.taxiCarInitialState.mode = NpcCar::Mode::NONE;
gameState.locations["location_dorm"]->state.taxiCarInitialState.velocity = 0.f;
gameState.locations["location_dorm"]->state.taxiCarInitialState.steeringAngle = 0.f;
gameState.locations["location_dorm"]->state.taxiCarInitialState.waypointReachRadius = 5.f;
gameState.locations["location_dorm"]->state.taxiCar = gameState.locations["location_dorm"]->state.taxiCarInitialState;
//Dorm set up taxi end
}
void Game::createLocationsStep5()
{
rearmDormOneShotCallbacks();
menuManager.callTaxiFunc = [this]()
@@ -665,7 +759,7 @@ namespace ZL
if (currentLocation())
{
currentLocation()->scriptEngine.callCallTaxiCallback();
currentLocation()->onTaxiCalled();
}
};
@@ -697,6 +791,11 @@ namespace ZL
loc->state.isDawn = gameState.isDawn;
loc->scriptEngine.callLocationEnterCallback();
//Reset taxi
loc->state.taxiCar = loc->state.taxiCarInitialState;
loc->state.taxiArrivedCallbackCalled = false;
gameState.taxiIsCalled = false;
menuManager.onLocationChanged(destName);
};
@@ -1251,7 +1350,7 @@ namespace ZL
break;
case SDLK_o:
x = x + 1;
x = x + 0.05;
std::cout << "current x: " << x << std::endl;
//y = y + 0.002;
//currentLocation->player->hp = 200;
@@ -1260,7 +1359,7 @@ namespace ZL
break;
case SDLK_k:
x = x - 1;
x = x - 0.05;
std::cout << "current x: " << x << std::endl;
std::cout << "Player pos: " << currentLocation()->player->state.position.transpose() << std::endl;
std::cout << "Player rotation: " << currentLocation()->player->state.facingAngle*180.0/M_PI << std::endl;