diff options
author | Peter Kohaut | 2016-09-20 00:33:06 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-29 22:33:41 +0200 |
commit | cfc8ffed8af71714cc6378b412557d5fc03781d4 (patch) | |
tree | c6b1d8c1f2d8f6c8dc3702d706baf60eba34ae7d /engines/bladerunner/actor.cpp | |
parent | 7e7cf4e748172f956fddb7c6f21f34bfef058242 (diff) | |
download | scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.tar.gz scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.tar.bz2 scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.zip |
BLADERUNNER: fixed exit selection, added footstep sounds, added some debugging display (scene objects, regions, exits, walkboxes, lights?)
Diffstat (limited to 'engines/bladerunner/actor.cpp')
-rw-r--r-- | engines/bladerunner/actor.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index c112c722b6..c0c042e47f 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -365,7 +365,7 @@ bool Actor::tick(bool forceDraw) { float originalZ = this->_position.z; this->_position.x = this->_position.x + positionChange.x * cosx - positionChange.y * sinx; - this->_position.z = this->_position.z - positionChange.x * sinx - positionChange.y * cosx; //why minus? + this->_position.z = this->_position.z + positionChange.x * sinx + positionChange.y * cosx; this->_position.y = this->_position.y + positionChange.z; if (_vm->_sceneObjects->existsOnXZ(this->_id, this->_position.x, this->_position.z, false, false) == 1 && !this->_isImmuneToObstacles) { @@ -494,6 +494,12 @@ void Actor::setBoundingBox(Vector3 position, bool retired) { } } +float Actor::distanceFromView(View *view) { + float xDist = this->_position.x - view->_cameraPosition.x; + float zDist = this->_position.z - view->_cameraPosition.z; + return sqrt(xDist * xDist + zDist * zDist); +} + bool Actor::isWalking() { return _walkInfo->isWalking(); } @@ -803,6 +809,16 @@ void Actor::copyClues(int actorId) { } } +int Actor::soundVolume() { + float dist = distanceFromView(_vm->_view); + return 255.0f * MAX(MIN(dist / 1200.0f, 1.0f), 0.0f); +} + +int Actor::soundBalance() { + Vector2 screenPosition = _vm->_view->calculateScreenPosition(_position); + return 127.0f * (MAX(MIN(screenPosition.x / 640.0f, 1.0f), 0.0f) * 2.0f - 1.0f); +} + void Actor::countdownTimerStart(int timerId, int interval) { assert(timerId >= 0 && timerId < 7); _timersRemain[timerId] = interval; |