little cleanup
This commit is contained in:
1 parent
13ef92160d
commit
72e05cdc28
15 files changed
+323
-197
No files matched your search
+31
-36
@@ -158,38 +158,32 @@ namespace ZL
|
||||
|
||||
std::cout << "Load resurces step 4" << std::endl;
|
||||
|
||||
LocationSetup params1;
|
||||
params1.roomMeshPath = "resources/w/room003.txt";
|
||||
params1.roomTexturePath = "resources/w/room005.png";
|
||||
params1.gameObjectsJsonPath = "resources/config2/gameobjects.json";
|
||||
params1.npcsJsonPath = "resources/config2/npcs.json";
|
||||
params1.dialoguesJsonPath = "resources/dialogue/sample_dialogues.json";
|
||||
params1.navigationJsonPaths = {"resources/config2/navigation.json"};
|
||||
params1.teleportsJsonPath = "resources/config2/teleports.json";
|
||||
params1.triggerZonesJsonPath = "resources/config2/trigger_zones.json";
|
||||
params1.scriptPath = "resources/start.lua";
|
||||
params1.playerPosition = Eigen::Vector3f(0.942694, 0, -9.63104);
|
||||
LocationSetup uniInteriorParams;
|
||||
uniInteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects.json";
|
||||
uniInteriorParams.npcsJsonPath = "resources/config2/npcs_uni_interior.json";
|
||||
uniInteriorParams.dialoguesJsonPath = "resources/dialogue/uni_interior_dialogues.json";
|
||||
uniInteriorParams.navigationJsonPaths = {"resources/config2/navigation.json"};
|
||||
uniInteriorParams.teleportsJsonPath = "resources/config2/teleports.json";
|
||||
uniInteriorParams.triggerZonesJsonPath = "resources/config2/trigger_zones_uni_interior.json";
|
||||
uniInteriorParams.scriptPath = "resources/start_uni_interior.lua";
|
||||
uniInteriorParams.playerPosition = Eigen::Vector3f(0.942694, 0, -9.63104);
|
||||
|
||||
locations["location1"] = std::make_shared<Location>(renderer, inventory);
|
||||
locations["location1"]->setup(params1);
|
||||
locations["uni_interior"] = std::make_shared<Location>(renderer, inventory);
|
||||
locations["uni_interior"]->setup(uniInteriorParams);
|
||||
|
||||
LocationSetup params2 = params1;
|
||||
params2.roomMeshPath = "resources/w/exterior/Segmented_Plane002.txt";
|
||||
params2.roomTexturePath = "resources/w/exterior/Segmented_Plane002.png";
|
||||
params2.gameObjectsJsonPath = "resources/config2/gameobjects2.json";
|
||||
params2.navigationJsonPaths = {"resources/config2/navigation2.json"};
|
||||
params2.teleportsJsonPath = "resources/config2/teleports2.json";
|
||||
params2.triggerZonesJsonPath = "resources/config2/trigger_zones2.json";
|
||||
params2.scriptPath = "resources/start2.lua";
|
||||
params2.playerPosition = Eigen::Vector3f(5, 0, -18.4);
|
||||
params2.npcsJsonPath = "resources/config2/npcs2.json";
|
||||
LocationSetup uniExteriorParams = uniInteriorParams;
|
||||
uniExteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects2.json";
|
||||
uniExteriorParams.navigationJsonPaths = {"resources/config2/navigation2.json"};
|
||||
uniExteriorParams.teleportsJsonPath = "resources/config2/teleports2.json";
|
||||
uniExteriorParams.triggerZonesJsonPath = "resources/config2/trigger_zones2.json";
|
||||
uniExteriorParams.scriptPath = "resources/start2.lua";
|
||||
uniExteriorParams.playerPosition = Eigen::Vector3f(5, 0, -18.4);
|
||||
uniExteriorParams.npcsJsonPath = "resources/config2/npcs2.json";
|
||||
locations["uni_exterior"] = std::make_shared<Location>(renderer, inventory);
|
||||
locations["uni_exterior"]->setup(uniExteriorParams);
|
||||
|
||||
locations["location2"] = std::make_shared<Location>(renderer, inventory);
|
||||
locations["location2"]->setup(params2);
|
||||
|
||||
LocationSetup params_dorm;
|
||||
params_dorm.roomMeshPath = "";
|
||||
params_dorm.roomTexturePath = "";
|
||||
params_dorm.gameObjectsJsonPath = "resources/config2/gameobjects_dorm.json";
|
||||
params_dorm.npcsJsonPath = "resources/config2/npcs_dorm.json";
|
||||
params_dorm.dialoguesJsonPath = "resources/dialogue/dorm_dialogues.json";
|
||||
@@ -203,9 +197,8 @@ namespace ZL
|
||||
locations["location_dorm"]->setup(params_dorm);
|
||||
|
||||
// Teleport callbacks: destination name and position come from the teleport zone data.
|
||||
auto makeTeleportCallback = [this](const std::string& sourceName) {
|
||||
return [this, sourceName](const std::string& destName, const Eigen::Vector3f& destPos, float destRotY) {
|
||||
std::cout << "[TELEPORT] " << sourceName << " -> " << destName << std::endl;
|
||||
auto teleportCallback = [this](const std::string& destName, const Eigen::Vector3f& destPos, float destRotY) {
|
||||
std::cout << "[TELEPORT] " << " -> " << destName << std::endl;
|
||||
auto it = locations.find(destName);
|
||||
if (it == locations.end()) {
|
||||
std::cerr << "[TELEPORT] Unknown destination location: " << destName << std::endl;
|
||||
@@ -219,12 +212,12 @@ namespace ZL
|
||||
currentLocation->player->targetFacingAngle = destRotY;
|
||||
}
|
||||
currentLocation->cameraAzimuth = destRotY;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
locations["location1"]->onTeleport = makeTeleportCallback("location1");
|
||||
locations["location2"]->onTeleport = makeTeleportCallback("location2");
|
||||
locations["location_dorm"]->onTeleport = makeTeleportCallback("location_dorm");
|
||||
locations["uni_exterior"]->onTeleport = teleportCallback;
|
||||
locations["uni_interior"]->onTeleport = teleportCallback;
|
||||
locations["location_dorm"]->onTeleport = teleportCallback;
|
||||
|
||||
currentLocation = locations["location_dorm"];
|
||||
|
||||
@@ -548,8 +541,10 @@ namespace ZL
|
||||
break;
|
||||
|
||||
case SDLK_p:
|
||||
currentLocation = (currentLocation == locations["location1"]) ? locations["location2"] : locations["location1"];
|
||||
std::cout << "Switched to location " << ((currentLocation == locations["location1"]) ? "1" : "2") << std::endl;
|
||||
currentLocation = locations["uni_interior"];
|
||||
currentLocation->player->position = Eigen::Vector3f(-0.0189243, 0, -13.4314);
|
||||
currentLocation->player->setTarget(currentLocation->player->position);
|
||||
//std::cout << "Switched to location " << ((currentLocation == locations["location1"]) ? "1" : "2") << std::endl;
|
||||
break;
|
||||
|
||||
case SDLK_l:
|
||||
|
||||
Reference in new issue
Block a user