diff options
author | Peter Kohaut | 2017-08-24 23:43:47 +0200 |
---|---|---|
committer | Peter Kohaut | 2017-08-24 23:43:47 +0200 |
commit | 0da18320af79b6ca8a47248442d106674b5ab860 (patch) | |
tree | 504d769edcf92fc4cbceddfbcdda038ecc040ced /engines/bladerunner/actor.cpp | |
parent | c9b4089ccb0b60389446e07f7f9421e3a7180129 (diff) | |
download | scummvm-rg350-0da18320af79b6ca8a47248442d106674b5ab860.tar.gz scummvm-rg350-0da18320af79b6ca8a47248442d106674b5ab860.tar.bz2 scummvm-rg350-0da18320af79b6ca8a47248442d106674b5ab860.zip |
BLADERUNNER: Added audio mixer & various fixes
Audio mixer is supporting fading and pan animation
Added support for skipping speech by pressing Return
Added proper support for ambient sounds
Added more code to the dialogue menu
Added tooltips to the Spinner
Fixed calculation of volume and pan of walk steps
Code cleanup & formatting
Diffstat (limited to 'engines/bladerunner/actor.cpp')
-rw-r--r-- | engines/bladerunner/actor.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index 85c5d89240..c29956ca8b 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -23,7 +23,6 @@ #include "bladerunner/actor.h" #include "bladerunner/bladerunner.h" - #include "bladerunner/actor_clues.h" #include "bladerunner/actor_combat.h" #include "bladerunner/actor_walk.h" @@ -37,6 +36,7 @@ #include "bladerunner/scene_objects.h" #include "bladerunner/script/scene.h" #include "bladerunner/script/ai.h" +#include "bladerunner/set.h" #include "bladerunner/slice_animations.h" #include "bladerunner/slice_renderer.h" #include "bladerunner/waypoints.h" @@ -767,7 +767,7 @@ void Actor::setBoundingBox(const Vector3 &position, bool retired) { float Actor::distanceFromView(View *view) const{ float xDist = this->_position.x - view->_cameraPosition.x; - float zDist = this->_position.z - view->_cameraPosition.z; + float zDist = this->_position.z + view->_cameraPosition.z; return sqrt(xDist * xDist + zDist * zDist); } @@ -863,7 +863,7 @@ void Actor::faceHeading(int heading, bool animate) { } void Actor::modifyFriendlinessToOther(int otherActorId, signed int change) { - _friendlinessToOther[otherActorId] = MIN(MAX(_friendlinessToOther[otherActorId] + change, 0), 100); + _friendlinessToOther[otherActorId] = CLIP(_friendlinessToOther[otherActorId] + change, 0, 100); } void Actor::setFriendlinessToOther(int otherActorId, int friendliness) { @@ -895,29 +895,29 @@ void Actor::setImmunityToObstacles(bool isImmune) { } void Actor::modifyCurrentHP(signed int change) { - _currentHP = MIN(MAX(_currentHP + change, 0), 100); + _currentHP = CLIP(_currentHP + change, 0, 100); if (_currentHP > 0) retire(false, 0, 0, -1); } void Actor::modifyMaxHP(signed int change) { - _maxHP = MIN(MAX(_maxHP + change, 0), 100); + _maxHP = CLIP(_maxHP + change, 0, 100); } void Actor::modifyCombatAggressiveness(signed int change) { - _combatAggressiveness = MIN(MAX(_combatAggressiveness + change, 0), 100); + _combatAggressiveness = CLIP(_combatAggressiveness + change, 0, 100); } void Actor::modifyHonesty(signed int change) { - _honesty = MIN(MAX(_honesty + change, 0), 100); + _honesty = CLIP(_honesty + change, 0, 100); } void Actor::modifyIntelligence(signed int change) { - _intelligence = MIN(MAX(_intelligence + change, 0), 100); + _intelligence = CLIP(_intelligence + change, 0, 100); } void Actor::modifyStability(signed int change) { - _stability = MIN(MAX(_stability + change, 0), 100); + _stability = CLIP(_stability + change, 0, 100); } void Actor::setFlagDamageAnimIfMoving(bool value) { @@ -1043,7 +1043,7 @@ void Actor::speechPlay(int sentenceId, bool voiceOver) { int screenX = 320; //, screenY = 0; //TODO: transform to screen space using fov; balance = 127 * (2 * screenX - 640) / 640; - balance = MIN(127, MAX(-127, balance)); + balance = CLIP<int>(balance, -127, 127); } _vm->_audioSpeech->playSpeech(name, balance); @@ -1092,12 +1092,12 @@ void Actor::copyClues(int actorId) { int Actor::soundVolume() const { float dist = distanceFromView(_vm->_view); - return 255.0f * MAX(MIN(dist / 1200.0f, 1.0f), 0.0f); + return 35.0f * CLIP(1.0f - (dist / 1200.0f), 0.0f, 1.0f); } int Actor::soundBalance() const { Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position); - return 127.0f * (MAX(MIN(screenPosition.x / 640.0f, 1.0f), 0.0f) * 2.0f - 1.0f); + return 35.0f * (CLIP(screenPosition.x / 640.0f, 0.0f, 1.0f) * 2.0f - 1.0f); } bool Actor::walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *newDestination) { |