From 4c0d51e17203dfff4337219e3f09c0d01fe7fbde Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Mon, 14 Dec 2020 22:42:10 +0700 Subject: [PATCH] refactor: Rename heading to facing to match nwscript.nss --- src/game/actionexecutor.cpp | 4 ++-- src/game/camera/camera.cpp | 4 ++-- src/game/camera/camera.h | 4 ++-- src/game/camera/firstperson.cpp | 30 ++++++++++++------------ src/game/camera/firstperson.h | 2 +- src/game/camera/thirdperson.cpp | 12 +++++----- src/game/camera/thirdperson.h | 2 +- src/game/game.cpp | 2 +- src/game/gui/partyselect.cpp | 2 +- src/game/map.cpp | 12 +++++----- src/game/object/area.cpp | 20 ++++++++-------- src/game/object/area.h | 6 ++--- src/game/object/creature.cpp | 2 +- src/game/object/door.cpp | 2 +- src/game/object/module.cpp | 18 +++++++------- src/game/object/module.h | 4 ++-- src/game/object/placeable.cpp | 2 +- src/game/object/spatial.cpp | 14 +++++------ src/game/object/spatial.h | 6 ++--- src/game/object/waypoint.cpp | 2 +- src/game/player.cpp | 14 +++++------ src/game/script/routines.h | 2 +- src/game/script/routines_enginetypes.cpp | 2 +- src/game/script/routines_kotor.cpp | 1 - src/game/script/routines_objects.cpp | 2 +- src/game/script/routines_tsl.cpp | 1 - 26 files changed, 85 insertions(+), 87 deletions(-) diff --git a/src/game/actionexecutor.cpp b/src/game/actionexecutor.cpp index f2b0e834..e6acf6fa 100644 --- a/src/game/actionexecutor.cpp +++ b/src/game/actionexecutor.cpp @@ -327,7 +327,7 @@ void ActionExecutor::executeJumpToObject(const shared_ptr &actor, Object auto spatialActor = static_pointer_cast(actor); spatialActor->setPosition(spatialObject->position()); - spatialActor->setHeading(spatialObject->heading()); + spatialActor->setFacing(spatialObject->facing()); action.complete(); } @@ -335,7 +335,7 @@ void ActionExecutor::executeJumpToObject(const shared_ptr &actor, Object void ActionExecutor::executeJumpToLocation(const shared_ptr &actor, LocationAction &action, float dt) { auto spatialActor = static_pointer_cast(actor); spatialActor->setPosition(action.location()->position()); - spatialActor->setHeading(action.location()->facing()); + spatialActor->setFacing(action.location()->facing()); action.complete(); } diff --git a/src/game/camera/camera.cpp b/src/game/camera/camera.cpp index 92d1685e..d99cb333 100644 --- a/src/game/camera/camera.cpp +++ b/src/game/camera/camera.cpp @@ -35,8 +35,8 @@ void Camera::update(float dt) { void Camera::stopMovement() { } -float Camera::heading() const { - return _heading; +float Camera::facing() const { + return _facing; } shared_ptr Camera::sceneNode() const { diff --git a/src/game/camera/camera.h b/src/game/camera/camera.h index 64cab633..6365eb27 100644 --- a/src/game/camera/camera.h +++ b/src/game/camera/camera.h @@ -36,11 +36,11 @@ public: virtual void stopMovement(); - float heading() const; + float facing() const; std::shared_ptr sceneNode() const; protected: - float _heading { 0.0f }; + float _facing { 0.0f }; std::shared_ptr _sceneNode; Camera() = default; diff --git a/src/game/camera/firstperson.cpp b/src/game/camera/firstperson.cpp index 5a2a9c06..43e83e33 100644 --- a/src/game/camera/firstperson.cpp +++ b/src/game/camera/firstperson.cpp @@ -49,8 +49,8 @@ bool FirstPersonCamera::handle(const SDL_Event &event) { } bool FirstPersonCamera::handleMouseMotion(const SDL_MouseMotionEvent &event) { - _heading = glm::mod( - _heading - event.xrel * kMouseMultiplier, + _facing = glm::mod( + _facing - event.xrel * kMouseMultiplier, glm::two_pi()); _pitch = glm::clamp( @@ -65,7 +65,7 @@ bool FirstPersonCamera::handleMouseMotion(const SDL_MouseMotionEvent &event) { void FirstPersonCamera::updateSceneNode() { glm::quat orientation(glm::vec3(glm::half_pi(), 0.0f, 0.0f)); - orientation *= glm::quat(glm::vec3(_pitch, _heading, 0.0f)); + orientation *= glm::quat(glm::vec3(_pitch, _facing, 0.0f)); glm::mat4 transform(1.0f); transform = glm::translate(transform, _position); @@ -121,31 +121,31 @@ bool FirstPersonCamera::handleKeyUp(const SDL_KeyboardEvent &event) { } void FirstPersonCamera::update(float dt) { - float headingSin = glm::sin(_heading) * kMovementSpeed * dt; - float headingCos = glm::cos(_heading) * kMovementSpeed * dt; + float facingSin = glm::sin(_facing) * kMovementSpeed * dt; + float facingCos = glm::cos(_facing) * kMovementSpeed * dt; float pitchSin = glm::sin(_pitch) * kMovementSpeed * dt; bool positionChanged = false; if (_moveForward) { - _position.x -= headingSin; - _position.y += headingCos; + _position.x -= facingSin; + _position.y += facingCos; _position.z += pitchSin; positionChanged = true; } if (_moveLeft) { - _position.x -= headingCos; - _position.y -= headingSin; + _position.x -= facingCos; + _position.y -= facingSin; positionChanged = true; } if (_moveBackward) { - _position.x += headingSin; - _position.y -= headingCos; + _position.x += facingSin; + _position.y -= facingCos; _position.z -= pitchSin; positionChanged = true; } if (_moveRight) { - _position.x += headingCos; - _position.y += headingSin; + _position.x += facingCos; + _position.y += facingSin; positionChanged = true; } if (positionChanged) { @@ -165,8 +165,8 @@ void FirstPersonCamera::setPosition(const glm::vec3 &pos) { updateSceneNode(); } -void FirstPersonCamera::setHeading(float heading) { - _heading = heading; +void FirstPersonCamera::setFacing(float facing) { + _facing = facing; updateSceneNode(); } diff --git a/src/game/camera/firstperson.h b/src/game/camera/firstperson.h index c75655e5..6bd5fa92 100644 --- a/src/game/camera/firstperson.h +++ b/src/game/camera/firstperson.h @@ -32,7 +32,7 @@ public: void stopMovement() override; void setPosition(const glm::vec3 &position); - void setHeading(float heading); + void setFacing(float facing); private: glm::vec3 _position { 0.0f }; diff --git a/src/game/camera/thirdperson.cpp b/src/game/camera/thirdperson.cpp index 22e8680c..e74fba4d 100644 --- a/src/game/camera/thirdperson.cpp +++ b/src/game/camera/thirdperson.cpp @@ -94,16 +94,16 @@ void ThirdPersonCamera::update(float dt) { if (_rotationSpeed > kMaxRotationSpeed) { _rotationSpeed = kMaxRotationSpeed; } - _heading += (_rotateCCW ? 1.0f : -1.0f) * _rotationSpeed * dt; - _heading = glm::mod(_heading, glm::two_pi()); + _facing += (_rotateCCW ? 1.0f : -1.0f) * _rotationSpeed * dt; + _facing = glm::mod(_facing, glm::two_pi()); updateSceneNode(); } void ThirdPersonCamera::updateSceneNode() { glm::vec3 position(_targetPosition); - position.x += _style.distance * glm::sin(_heading); - position.y -= _style.distance * glm::cos(_heading); + position.x += _style.distance * glm::sin(_facing); + position.y -= _style.distance * glm::cos(_facing); position.z += _style.height; if (_findObstacle) { @@ -132,8 +132,8 @@ void ThirdPersonCamera::setTargetPosition(const glm::vec3 &position) { updateSceneNode(); } -void ThirdPersonCamera::setHeading(float heading) { - _heading = heading; +void ThirdPersonCamera::setFacing(float facing) { + _facing = facing; updateSceneNode(); } diff --git a/src/game/camera/thirdperson.h b/src/game/camera/thirdperson.h index a45360b9..917e394f 100644 --- a/src/game/camera/thirdperson.h +++ b/src/game/camera/thirdperson.h @@ -36,7 +36,7 @@ public: void stopMovement() override; void setTargetPosition(const glm::vec3 &position); - void setHeading(float heading); + void setFacing(float facing); void setFindObstacle(const std::function &fn); void setStyle(const CameraStyle& style); diff --git a/src/game/game.cpp b/src/game/game.cpp index 871144ff..c7380d8a 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -283,7 +283,7 @@ void Game::toggleInGameCameraType() { FirstPersonCamera &firstPerson = static_cast(area->getCamera(CameraType::FirstPerson)); ThirdPersonCamera &thirdPerson = static_cast(area->getCamera(CameraType::ThirdPerson)); firstPerson.setPosition(thirdPerson.sceneNode()->absoluteTransform()[3]); - firstPerson.setHeading(thirdPerson.heading()); + firstPerson.setFacing(thirdPerson.facing()); _cameraType = CameraType::FirstPerson; break; } diff --git a/src/game/gui/partyselect.cpp b/src/game/gui/partyselect.cpp index 31288077..2229db64 100644 --- a/src/game/gui/partyselect.cpp +++ b/src/game/gui/partyselect.cpp @@ -231,7 +231,7 @@ void PartySelection::changeParty() { party.addMember(creature); } - area->loadParty(player->position(), player->heading()); + area->loadParty(player->position(), player->facing()); area->fill(_game->sceneGraph()); } diff --git a/src/game/map.cpp b/src/game/map.cpp index bc9ca822..a207401c 100644 --- a/src/game/map.cpp +++ b/src/game/map.cpp @@ -161,24 +161,24 @@ void Map::drawPartyLeader(Mode mode, const glm::vec4 &bounds) const { arrowPos.y = bounds[1] + 0.5f * bounds[3]; } - float heading; + float facing; switch (_northAxis) { case 0: - heading = -partyLeader->heading(); + facing = -partyLeader->facing(); break; case 1: - heading = glm::pi() - partyLeader->heading(); + facing = glm::pi() - partyLeader->facing(); break; case 2: - heading = glm::three_over_two_pi() - partyLeader->heading(); + facing = glm::three_over_two_pi() - partyLeader->facing(); break; default: - heading = glm::half_pi() - partyLeader->heading(); + facing = glm::half_pi() - partyLeader->facing(); break; } glm::mat4 transform(1.0f); transform = glm::translate(transform, arrowPos); - transform = glm::rotate(transform, heading, glm::vec3(0.0f, 0.0f, 1.0f)); + transform = glm::rotate(transform, facing, glm::vec3(0.0f, 0.0f, 1.0f)); transform = glm::translate(transform, glm::vec3(-0.5f * kArrowSize, -0.5f * kArrowSize, 0.0f)); transform = glm::scale(transform, glm::vec3(kArrowSize, kArrowSize, 1.0f)); diff --git a/src/game/object/area.cpp b/src/game/object/area.cpp index 0d3eeb96..6dbb6d22 100644 --- a/src/game/object/area.cpp +++ b/src/game/object/area.cpp @@ -258,7 +258,7 @@ void Area::loadCameras(const GffStruct &git) { } } -void Area::initCameras(const glm::vec3 &entryPosition, float entryHeading) { +void Area::initCameras(const glm::vec3 &entryPosition, float entryFacing) { glm::vec3 position(entryPosition); position.z += 1.7f; @@ -266,12 +266,12 @@ void Area::initCameras(const glm::vec3 &entryPosition, float entryHeading) { _firstPersonCamera = make_unique(sceneGraph, _cameraAspect, glm::radians(kDefaultFieldOfView)); _firstPersonCamera->setPosition(position); - _firstPersonCamera->setHeading(entryHeading); + _firstPersonCamera->setFacing(entryFacing); _thirdPersonCamera = make_unique(sceneGraph, _cameraAspect, _cameraStyle); _thirdPersonCamera->setFindObstacle(bind(&Area::findCameraObstacle, this, _1, _2, _3)); _thirdPersonCamera->setTargetPosition(position); - _thirdPersonCamera->setHeading(entryHeading); + _thirdPersonCamera->setFacing(entryFacing); _dialogCamera = make_unique(sceneGraph, _cameraStyle, _cameraAspect); _dialogCamera->setFindObstacle(bind(&Area::findCameraObstacle, this, _1, _2, _3)); @@ -417,7 +417,7 @@ ObjectList &Area::getObjectsByType(ObjectType type) { void Area::landObject(SpatialObject &object) { glm::vec3 position(object.position()); - float heading = object.heading(); + float facing = object.facing(); Room *room = nullptr; if (getElevationAt(position, &object, room, position.z)) { @@ -435,13 +435,13 @@ void Area::landObject(SpatialObject &object) { } } -void Area::loadParty(const glm::vec3 &position, float heading) { +void Area::loadParty(const glm::vec3 &position, float facing) { Party &party = _game->party(); for (int i = 0; i < party.size(); ++i) { shared_ptr member(party.getMember(i)); member->setPosition(position); - member->setHeading(heading); + member->setFacing(facing); landObject(*member); add(member); @@ -560,8 +560,8 @@ bool Area::moveCreatureTowards(const shared_ptr &creature, const glm:: glm::vec2 delta(dest - glm::vec2(position)); glm::vec2 dir(glm::normalize(delta)); - float heading = -glm::atan(dir.x, dir.y); - creature->setHeading(heading); + float facing = -glm::atan(dir.x, dir.y); + creature->setFacing(facing); float speed = run ? creature->runSpeed() : creature->walkSpeed(); float speedDt = speed * dt; @@ -660,11 +660,11 @@ glm::vec3 Area::getSelectableScreenCoords(const shared_ptr &objec return glm::project(position, view, projection, viewport); } -void Area::update3rdPersonCameraHeading() { +void Area::update3rdPersonCameraFacing() { shared_ptr partyLeader(_game->party().leader()); if (!partyLeader) return; - _thirdPersonCamera->setHeading(partyLeader->heading()); + _thirdPersonCamera->setFacing(partyLeader->facing()); } void Area::startDialog(const shared_ptr &object, const string &resRef) { diff --git a/src/game/object/area.h b/src/game/object/area.h index 19988532..c08c7344 100644 --- a/src/game/object/area.h +++ b/src/game/object/area.h @@ -72,11 +72,11 @@ public: void destroyObject(const SpatialObject &object); void fill(scene::SceneGraph &sceneGraph); - void initCameras(const glm::vec3 &entryPosition, float entryHeading); + void initCameras(const glm::vec3 &entryPosition, float entryFacing); bool moveCreatureTowards(const std::shared_ptr &creature, const glm::vec2 &dest, bool run, float dt); void onPartyLeaderMoved(); void startDialog(const std::shared_ptr &object, const std::string &resRef); - void update3rdPersonCameraHeading(); + void update3rdPersonCameraFacing(); void update3rdPersonCameraTarget(); std::shared_ptr getObjectAt(int x, int y) const; @@ -113,7 +113,7 @@ public: // Party - void loadParty(const glm::vec3 &position, float heading); + void loadParty(const glm::vec3 &position, float facing); void unloadParty(); // END Party diff --git a/src/game/object/creature.cpp b/src/game/object/creature.cpp index 19ca6954..9aa832f0 100644 --- a/src/game/object/creature.cpp +++ b/src/game/object/creature.cpp @@ -86,7 +86,7 @@ void Creature::loadTransform(const GffStruct &gffs) { float dirX = gffs.getFloat("XOrientation"); float dirY = gffs.getFloat("YOrientation"); - _heading = -glm::atan(dirX, dirY); + _facing = -glm::atan(dirX, dirY); updateTransform(); } diff --git a/src/game/object/door.cpp b/src/game/object/door.cpp index 46c1d599..c1cfef6b 100644 --- a/src/game/object/door.cpp +++ b/src/game/object/door.cpp @@ -53,7 +53,7 @@ void Door::load(const GffStruct &gffs) { _position[1] = gffs.getFloat("Y"); _position[2] = gffs.getFloat("Z"); - _heading = gffs.getFloat("Bearing"); + _facing = gffs.getFloat("Bearing"); _linkedToModule = boost::to_lower_copy(gffs.getString("LinkedToModule")); _linkedTo = boost::to_lower_copy(gffs.getString("LinkedTo")); diff --git a/src/game/object/module.cpp b/src/game/object/module.cpp index 6a3cc079..8792a575 100644 --- a/src/game/object/module.cpp +++ b/src/game/object/module.cpp @@ -51,7 +51,7 @@ void Module::load(const string &name, const GffStruct &ifo) { loadInfo(ifo); loadArea(ifo); - _area->initCameras(_info.entryPosition, _info.entryHeading); + _area->initCameras(_info.entryPosition, _info.entryFacing); _area->runSpawnScripts(); loadPlayer(); @@ -64,7 +64,7 @@ void Module::loadInfo(const GffStruct &ifo) { float dirX = ifo.getFloat("Mod_Entry_Dir_X"); float dirY = ifo.getFloat("Mod_Entry_Dir_Y"); - _info.entryHeading = -glm::atan(dirX, dirY); + _info.entryFacing = -glm::atan(dirX, dirY); _info.entryArea = ifo.getString("Mod_Entry_Area"); } @@ -86,24 +86,24 @@ void Module::loadPlayer() { void Module::loadParty(const string &entry) { glm::vec3 position(0.0f); - float heading = 0.0f; - getEntryPoint(entry, position, heading); + float facing = 0.0f; + getEntryPoint(entry, position, facing); - _area->loadParty(position, heading); + _area->loadParty(position, facing); _area->onPartyLeaderMoved(); - _area->update3rdPersonCameraHeading(); + _area->update3rdPersonCameraFacing(); _area->runOnEnterScript(); } -void Module::getEntryPoint(const string &waypoint, glm::vec3 &position, float &heading) const { +void Module::getEntryPoint(const string &waypoint, glm::vec3 &position, float &facing) const { position = _info.entryPosition; - heading = _info.entryHeading; + facing = _info.entryFacing; if (!waypoint.empty()) { shared_ptr object(_area->find(waypoint)); if (object) { position = object->position(); - heading = object->heading(); + facing = object->facing(); } } } diff --git a/src/game/object/module.h b/src/game/object/module.h index 994d450d..7b2c47a9 100644 --- a/src/game/object/module.h +++ b/src/game/object/module.h @@ -45,7 +45,7 @@ namespace game { struct ModuleInfo { std::string entryArea; glm::vec3 entryPosition { 0.0f }; - float entryHeading { 0.0f }; + float entryFacing { 0.0f }; }; class Door; @@ -82,7 +82,7 @@ private: void onObjectClick(const std::shared_ptr &object); void onPlaceableClick(const std::shared_ptr &placeable); - void getEntryPoint(const std::string &waypoint, glm::vec3 &position, float &heading) const; + void getEntryPoint(const std::string &waypoint, glm::vec3 &position, float &facing) const; // Loading diff --git a/src/game/object/placeable.cpp b/src/game/object/placeable.cpp index 0f1e7d7d..18ada1fd 100644 --- a/src/game/object/placeable.cpp +++ b/src/game/object/placeable.cpp @@ -56,7 +56,7 @@ void Placeable::load(const GffStruct &gffs) { _position[1] = gffs.getFloat("Y"); _position[2] = gffs.getFloat("Z"); - _heading = gffs.getFloat("Bearing"); + _facing = gffs.getFloat("Bearing"); updateTransform(); } diff --git a/src/game/object/spatial.cpp b/src/game/object/spatial.cpp index 7d4a4c9d..3728471f 100644 --- a/src/game/object/spatial.cpp +++ b/src/game/object/spatial.cpp @@ -100,7 +100,7 @@ void SpatialObject::face(const SpatialObject &other) { if (_id == other._id) return; glm::vec2 dir(glm::normalize(other._position - _position)); - _heading = -glm::atan(dir.x, dir.y); + _facing = -glm::atan(dir.x, dir.y); updateTransform(); } @@ -156,8 +156,8 @@ const glm::vec3 &SpatialObject::position() const { return _position; } -float SpatialObject::heading() const { - return _heading; +float SpatialObject::facing() const { + return _facing; } const glm::mat4 &SpatialObject::transform() const { @@ -208,16 +208,16 @@ void SpatialObject::updateTransform() { _transform = glm::translate(glm::mat4(1.0f), _position); _transform *= glm::mat4_cast(_orientation); - if (_heading != 0.0f) { - _transform *= glm::eulerAngleZ(_heading); + if (_facing != 0.0f) { + _transform *= glm::eulerAngleZ(_facing); } if (_model) { _model->setLocalTransform(_transform); } } -void SpatialObject::setHeading(float heading) { - _heading = heading; +void SpatialObject::setFacing(float facing) { + _facing = facing; updateTransform(); } diff --git a/src/game/object/spatial.h b/src/game/object/spatial.h index 050a9193..dc4f6b5e 100644 --- a/src/game/object/spatial.h +++ b/src/game/object/spatial.h @@ -64,7 +64,7 @@ public: scene::SceneGraph &sceneGraph(); Room *room() const; const glm::vec3 &position() const; - float heading() const; + float facing() const; const glm::mat4 &transform() const; bool visible() const; std::shared_ptr model() const; @@ -73,7 +73,7 @@ public: void setRoom(Room *room); void setPosition(const glm::vec3 &position); - void setHeading(float heading); + void setFacing(float facing); void setVisible(bool visible); // Inventory @@ -95,7 +95,7 @@ protected: scene::SceneGraph *_sceneGraph { nullptr }; glm::vec3 _position { 0.0f }; glm::quat _orientation { 1.0f, 0.0f, 0.0f, 0.0f }; - float _heading { 0.0f }; + float _facing { 0.0f }; glm::mat4 _transform { 1.0f }; bool _visible { true }; std::shared_ptr _model; diff --git a/src/game/object/waypoint.cpp b/src/game/object/waypoint.cpp index 64ab56e6..7ad6f189 100644 --- a/src/game/object/waypoint.cpp +++ b/src/game/object/waypoint.cpp @@ -43,7 +43,7 @@ void Waypoint::load(const GffStruct &gffs) { float dirX = gffs.getFloat("XOrientation"); float dirY = gffs.getFloat("YOrientation"); - _heading = -glm::atan(dirX, dirY); + _facing = -glm::atan(dirX, dirY); updateTransform(); } diff --git a/src/game/player.cpp b/src/game/player.cpp index 0d7ec110..1e06f969 100644 --- a/src/game/player.cpp +++ b/src/game/player.cpp @@ -112,17 +112,17 @@ void Player::update(float dt) { shared_ptr partyLeader(_party->leader()); if (!partyLeader || partyLeader->isMovementRestricted()) return; - float heading = 0.0f; + float facing = 0.0f; bool movement = true; if (_moveForward) { - heading = _camera->heading(); + facing = _camera->facing(); } else if (_moveBackward) { - heading = _camera->heading() + glm::pi(); + facing = _camera->facing() + glm::pi(); } else if (_moveLeft) { - heading = _camera->heading() + glm::half_pi(); + facing = _camera->facing() + glm::half_pi(); } else if (_moveRight) { - heading = _camera->heading() - glm::half_pi(); + facing = _camera->facing() - glm::half_pi(); } else { movement = false; } @@ -133,8 +133,8 @@ void Player::update(float dt) { actions.clear(); glm::vec2 dest(partyLeader->position()); - dest.x -= 100.0f * glm::sin(heading); - dest.y += 100.0f * glm::cos(heading); + dest.x -= 100.0f * glm::sin(facing); + dest.y += 100.0f * glm::cos(facing); if (_area->moveCreatureTowards(partyLeader, dest, true, dt)) { partyLeader->setMovementType(Creature::MovementType::Run); diff --git a/src/game/script/routines.h b/src/game/script/routines.h index b29a6a9f..7b612736 100644 --- a/src/game/script/routines.h +++ b/src/game/script/routines.h @@ -71,7 +71,7 @@ private: const VariableTypesList &argTypes, const T &fn) { - _routines.emplace_back(name, retType, argTypes, std::bind(fn, this, _1, _2)); + _routines.emplace_back(name, retType, argTypes, std::bind(fn, this, std::placeholders::_1, std::placeholders::_2)); } void addKotorRoutines(); diff --git a/src/game/script/routines_enginetypes.cpp b/src/game/script/routines_enginetypes.cpp index 37bba3d0..87a12d80 100644 --- a/src/game/script/routines_enginetypes.cpp +++ b/src/game/script/routines_enginetypes.cpp @@ -46,7 +46,7 @@ Variable Routines::getLocation(const VariablesList &args, ExecutionContext &ctx) auto object = getSpatialObject(args, 0); if (object) { glm::vec3 position(object->position()); - float facing = object->heading(); + float facing = object->facing(); result.engineType = make_shared(move(position), facing); } else { warn("Routines: getLocation: object is invalid"); diff --git a/src/game/script/routines_kotor.cpp b/src/game/script/routines_kotor.cpp index 419f4567..96e92c16 100644 --- a/src/game/script/routines_kotor.cpp +++ b/src/game/script/routines_kotor.cpp @@ -18,7 +18,6 @@ #include "routines.h" using namespace std; -using namespace std::placeholders; using namespace reone::script; diff --git a/src/game/script/routines_objects.cpp b/src/game/script/routines_objects.cpp index a4dd29b9..da9b009b 100644 --- a/src/game/script/routines_objects.cpp +++ b/src/game/script/routines_objects.cpp @@ -188,7 +188,7 @@ Variable Routines::getFacing(const VariablesList &args, ExecutionContext &ctx) { warn("Routines: getFacing: target is invalid"); return -1.0f; } - return glm::degrees(target->heading()); + return glm::degrees(target->facing()); } Variable Routines::getPosition(const VariablesList &args, ExecutionContext &ctx) { diff --git a/src/game/script/routines_tsl.cpp b/src/game/script/routines_tsl.cpp index 4aa40b2e..53c78f37 100644 --- a/src/game/script/routines_tsl.cpp +++ b/src/game/script/routines_tsl.cpp @@ -18,7 +18,6 @@ #include "routines.h" using namespace std; -using namespace std::placeholders; using namespace reone::script;