diff options
author | Peter Kohaut | 2017-04-01 08:56:30 +0200 |
---|---|---|
committer | Peter Kohaut | 2017-04-01 08:57:57 +0200 |
commit | 1740c490d710ec01d41c0b248eb43b782f383705 (patch) | |
tree | 5ebdd10e3ad59751889ca92d0cd630e097857d0a /engines/bladerunner/set.cpp | |
parent | 25fcb52d7017b49d4f17542aa99be9504fd04db2 (diff) | |
download | scummvm-rg350-1740c490d710ec01d41c0b248eb43b782f383705.tar.gz scummvm-rg350-1740c490d710ec01d41c0b248eb43b782f383705.tar.bz2 scummvm-rg350-1740c490d710ec01d41c0b248eb43b782f383705.zip |
BLADERUNNER: improvements to the walking code
path finding is still missing
video player has audio preloading
small fixes
Diffstat (limited to 'engines/bladerunner/set.cpp')
-rw-r--r-- | engines/bladerunner/set.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/engines/bladerunner/set.cpp b/engines/bladerunner/set.cpp index f8a480c181..5501f27a2c 100644 --- a/engines/bladerunner/set.cpp +++ b/engines/bladerunner/set.cpp @@ -126,7 +126,7 @@ bool Set::open(const Common::String &name) { return true; } -void Set::addObjectsToScene(SceneObjects *sceneObjects) { +void Set::addObjectsToScene(SceneObjects *sceneObjects) const { for (int i = 0; i < _objectCount; i++) { sceneObjects->addObject(i + SCENE_OBJECTS_OBJECTS_OFFSET, &_objects[i]._bbox, _objects[i]._isClickable, _objects[i]._isObstacle, _objects[i]._unknown1, _objects[i]._isTarget); } @@ -172,17 +172,17 @@ static bool isXZInWalkbox(float x, float z, const Walkbox &walkbox) { return found & 1; } -float Set::getAltitudeAtXZ(float x, float z, bool *inWalkbox) { +float Set::getAltitudeAtXZ(float x, float z, bool *inWalkbox) const { float altitude = _walkboxes[0]._altitude; *inWalkbox = false; for (int i = 0; i < _walkboxCount; ++i) { - const Walkbox &w = _walkboxes[i]; + const Walkbox &walkbox = _walkboxes[i]; - if (isXZInWalkbox(x, z, w)) { - *inWalkbox = true; - if (w._altitude > altitude) { - altitude = w._altitude; + if (isXZInWalkbox(x, z, walkbox)) { + if (!*inWalkbox || altitude < walkbox._altitude) { + altitude = walkbox._altitude; + *inWalkbox = true; } } } @@ -190,7 +190,7 @@ float Set::getAltitudeAtXZ(float x, float z, bool *inWalkbox) { return altitude; } -int Set::findWalkbox(float x, float z) { +int Set::findWalkbox(float x, float z) const { int result = -1; for (int i = 0; i < _walkboxCount; ++i) { @@ -206,7 +206,7 @@ int Set::findWalkbox(float x, float z) { return result; } -int Set::findObject(const char *objectName) { +int Set::findObject(const char *objectName) const { int i; for (i = 0; i < (int)_objectCount; i++) { if (scumm_stricmp(objectName, _objects[i]._name) == 0) { @@ -219,7 +219,7 @@ int Set::findObject(const char *objectName) { return -1; } -bool Set::objectSetHotMouse(int objectId) { +bool Set::objectSetHotMouse(int objectId) const { if (!_objects || objectId < 0 || objectId >= (int)_objectCount) { return false; } @@ -228,7 +228,7 @@ bool Set::objectSetHotMouse(int objectId) { return true; } -bool Set::objectGetBoundingBox(int objectId, BoundingBox *boundingBox) { +bool Set::objectGetBoundingBox(int objectId, BoundingBox *boundingBox) const { assert(boundingBox); if (!_objects || objectId < 0 || objectId >= (int)_objectCount) { @@ -243,19 +243,19 @@ bool Set::objectGetBoundingBox(int objectId, BoundingBox *boundingBox) { return true; } -void Set::objectSetIsClickable(int objectId, bool isClickable) { +void Set::objectSetIsClickable(int objectId, bool isClickable) const { _objects[objectId]._isClickable = isClickable; } -void Set::objectSetIsObstacle(int objectId, bool isObstacle) { +void Set::objectSetIsObstacle(int objectId, bool isObstacle) const { _objects[objectId]._isObstacle = isObstacle; } -void Set::objectSetIsTarget(int objectId, bool isTarget) { +void Set::objectSetIsTarget(int objectId, bool isTarget) const { _objects[objectId]._isTarget = isTarget; } -const char *Set::objectGetName(int objectId) { +const char *Set::objectGetName(int objectId) const { return _objects[objectId]._name; } |