From 1e5f9d3078f236f306b5d868bcd52f4e47f7b512 Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Sun, 14 Jan 2018 12:12:06 +0100 Subject: BLADERUNNER: Added basic KIA interface Settings works Help works Clue database works Fixed code for inserting objects into scene Reorganization of few files Unification & code formatting of few older files --- engines/bladerunner/actor.cpp | 36 +- engines/bladerunner/actor.h | 34 +- engines/bladerunner/actor_clues.cpp | 123 ++- engines/bladerunner/actor_clues.h | 62 +- engines/bladerunner/actor_combat.h | 1 - engines/bladerunner/actor_dialogue_queue.cpp | 173 ++++ engines/bladerunner/actor_dialogue_queue.h | 70 ++ engines/bladerunner/actor_walk.cpp | 16 +- engines/bladerunner/actor_walk.h | 19 +- engines/bladerunner/adq.cpp | 173 ---- engines/bladerunner/adq.h | 73 -- engines/bladerunner/ambient_sounds.cpp | 67 +- engines/bladerunner/ambient_sounds.h | 16 +- engines/bladerunner/archive.h | 2 +- engines/bladerunner/aud_stream.cpp | 2 +- engines/bladerunner/aud_stream.h | 2 +- engines/bladerunner/audio_mixer.cpp | 8 +- engines/bladerunner/audio_mixer.h | 24 +- engines/bladerunner/audio_player.cpp | 38 +- engines/bladerunner/audio_player.h | 9 +- engines/bladerunner/audio_speech.cpp | 32 +- engines/bladerunner/audio_speech.h | 20 +- engines/bladerunner/bladerunner.cpp | 300 +++--- engines/bladerunner/bladerunner.h | 109 +- engines/bladerunner/boundingbox.cpp | 8 +- engines/bladerunner/boundingbox.h | 8 +- engines/bladerunner/chapters.h | 3 +- engines/bladerunner/combat.cpp | 20 +- engines/bladerunner/combat.h | 6 +- engines/bladerunner/crimes_database.cpp | 20 +- engines/bladerunner/crimes_database.h | 18 +- engines/bladerunner/dialogue_menu.cpp | 53 +- engines/bladerunner/dialogue_menu.h | 46 +- engines/bladerunner/elevator.cpp | 329 ------ engines/bladerunner/elevator.h | 72 -- engines/bladerunner/fog.cpp | 42 +- engines/bladerunner/fog.h | 10 +- engines/bladerunner/font.cpp | 36 +- engines/bladerunner/font.h | 26 +- engines/bladerunner/game_constants.h | 463 +++++++++ engines/bladerunner/game_flags.cpp | 74 ++ engines/bladerunner/game_flags.h | 47 + engines/bladerunner/game_info.cpp | 111 ++ engines/bladerunner/game_info.h | 88 ++ engines/bladerunner/gameflags.cpp | 68 -- engines/bladerunner/gameflags.h | 47 - engines/bladerunner/gameinfo.cpp | 111 -- engines/bladerunner/gameinfo.h | 88 -- engines/bladerunner/image.cpp | 6 +- engines/bladerunner/item.cpp | 11 +- engines/bladerunner/item.h | 12 +- engines/bladerunner/item_pickup.cpp | 7 +- engines/bladerunner/items.cpp | 18 +- engines/bladerunner/items.h | 8 +- engines/bladerunner/light.cpp | 118 +-- engines/bladerunner/light.h | 90 +- engines/bladerunner/lights.cpp | 12 +- engines/bladerunner/lights.h | 6 +- engines/bladerunner/module.mk | 25 +- engines/bladerunner/mouse.cpp | 9 +- engines/bladerunner/mouse.h | 8 +- engines/bladerunner/movement_track.cpp | 8 +- engines/bladerunner/movement_track.h | 35 +- engines/bladerunner/music.cpp | 31 +- engines/bladerunner/music.h | 8 +- engines/bladerunner/obstacles.cpp | 20 +- engines/bladerunner/obstacles.h | 40 +- engines/bladerunner/outtake.cpp | 4 +- engines/bladerunner/outtake.h | 4 +- engines/bladerunner/overlays.cpp | 7 +- engines/bladerunner/overlays.h | 23 +- engines/bladerunner/regions.cpp | 30 +- engines/bladerunner/regions.h | 24 +- engines/bladerunner/scene.cpp | 26 +- engines/bladerunner/scene.h | 6 +- engines/bladerunner/scene_objects.cpp | 139 ++- engines/bladerunner/scene_objects.h | 65 +- engines/bladerunner/screen_effects.cpp | 19 +- engines/bladerunner/screen_effects.h | 5 +- engines/bladerunner/script/ai.cpp | 42 +- engines/bladerunner/script/ai.h | 4 +- engines/bladerunner/script/esper.cpp | 6 +- engines/bladerunner/script/esper.h | 4 +- engines/bladerunner/script/kia.cpp | 13 +- engines/bladerunner/script/kia.h | 9 +- engines/bladerunner/script/scene/ct01.cpp | 2 +- engines/bladerunner/script/scene/ct06.cpp | 2 +- engines/bladerunner/script/scene/kp01.cpp | 2 +- engines/bladerunner/script/scene/ma02.cpp | 4 +- engines/bladerunner/script/scene/ma04.cpp | 10 +- engines/bladerunner/script/scene/ma05.cpp | 2 +- engines/bladerunner/script/scene/nr08.cpp | 2 +- engines/bladerunner/script/scene/rc01.cpp | 34 +- engines/bladerunner/script/scene/rc02.cpp | 2 +- engines/bladerunner/script/scene/rc03.cpp | 2 +- engines/bladerunner/script/scene/rc04.cpp | 2 +- engines/bladerunner/script/script.cpp | 106 +- engines/bladerunner/script/script.h | 449 +-------- engines/bladerunner/script/vk.cpp | 34 +- engines/bladerunner/script/vk.h | 4 +- engines/bladerunner/set.cpp | 102 +- engines/bladerunner/set.h | 54 +- engines/bladerunner/set_effects.cpp | 40 +- engines/bladerunner/set_effects.h | 16 +- engines/bladerunner/settings.cpp | 20 +- engines/bladerunner/settings.h | 11 + engines/bladerunner/shape.cpp | 11 +- engines/bladerunner/shape.h | 2 +- engines/bladerunner/slice_animations.cpp | 29 +- engines/bladerunner/slice_animations.h | 27 +- engines/bladerunner/slice_renderer.cpp | 14 +- engines/bladerunner/slice_renderer.h | 2 +- engines/bladerunner/spinner.cpp | 318 ------ engines/bladerunner/spinner.h | 75 -- engines/bladerunner/suspects_database.cpp | 72 +- engines/bladerunner/suspects_database.h | 47 +- engines/bladerunner/text_resource.cpp | 17 +- engines/bladerunner/text_resource.h | 7 +- engines/bladerunner/ui/elevator.cpp | 325 ++++++ engines/bladerunner/ui/elevator.h | 73 ++ engines/bladerunner/ui/kia.cpp | 1229 +++++++++++++++++++++++ engines/bladerunner/ui/kia.h | 155 +++ engines/bladerunner/ui/kia_log.cpp | 128 +++ engines/bladerunner/ui/kia_log.h | 65 ++ engines/bladerunner/ui/kia_section_base.cpp | 35 + engines/bladerunner/ui/kia_section_base.h | 67 ++ engines/bladerunner/ui/kia_section_clues.cpp | 422 ++++++++ engines/bladerunner/ui/kia_section_clues.h | 95 ++ engines/bladerunner/ui/kia_section_crimes.cpp | 37 + engines/bladerunner/ui/kia_section_crimes.h | 82 ++ engines/bladerunner/ui/kia_section_diagnostic.h | 39 + engines/bladerunner/ui/kia_section_help.cpp | 90 ++ engines/bladerunner/ui/kia_section_help.h | 54 + engines/bladerunner/ui/kia_section_load.h | 39 + engines/bladerunner/ui/kia_section_pogo.h | 39 + engines/bladerunner/ui/kia_section_save.h | 39 + engines/bladerunner/ui/kia_section_settings.cpp | 301 ++++++ engines/bladerunner/ui/kia_section_settings.h | 80 ++ engines/bladerunner/ui/kia_section_suspects.h | 41 + engines/bladerunner/ui/kia_shapes.cpp | 69 ++ engines/bladerunner/ui/kia_shapes.h | 54 + engines/bladerunner/ui/spinner.cpp | 303 ++++++ engines/bladerunner/ui/spinner.h | 84 ++ engines/bladerunner/ui/ui_check_box.cpp | 140 +++ engines/bladerunner/ui/ui_check_box.h | 64 ++ engines/bladerunner/ui/ui_component.h | 62 ++ engines/bladerunner/ui/ui_container.cpp | 67 ++ engines/bladerunner/ui/ui_container.h | 56 ++ engines/bladerunner/ui/ui_image_picker.cpp | 331 ++++++ engines/bladerunner/ui/ui_image_picker.h | 104 ++ engines/bladerunner/ui/ui_input_box.cpp | 115 +++ engines/bladerunner/ui/ui_input_box.h | 69 ++ engines/bladerunner/ui/ui_scroll_box.cpp | 662 ++++++++++++ engines/bladerunner/ui/ui_scroll_box.h | 137 +++ engines/bladerunner/ui/ui_slider.cpp | 153 +++ engines/bladerunner/ui/ui_slider.h | 63 ++ engines/bladerunner/ui_image_picker.cpp | 327 ------ engines/bladerunner/ui_image_picker.h | 104 -- engines/bladerunner/vqa_decoder.cpp | 19 +- engines/bladerunner/vqa_player.cpp | 4 +- engines/bladerunner/vqa_player.h | 4 +- engines/bladerunner/waypoints.cpp | 59 +- engines/bladerunner/waypoints.h | 32 +- engines/bladerunner/zbuffer.cpp | 15 +- engines/bladerunner/zbuffer.h | 6 +- 165 files changed, 8596 insertions(+), 3568 deletions(-) create mode 100644 engines/bladerunner/actor_dialogue_queue.cpp create mode 100644 engines/bladerunner/actor_dialogue_queue.h delete mode 100644 engines/bladerunner/adq.cpp delete mode 100644 engines/bladerunner/adq.h delete mode 100644 engines/bladerunner/elevator.cpp delete mode 100644 engines/bladerunner/elevator.h create mode 100644 engines/bladerunner/game_constants.h create mode 100644 engines/bladerunner/game_flags.cpp create mode 100644 engines/bladerunner/game_flags.h create mode 100644 engines/bladerunner/game_info.cpp create mode 100644 engines/bladerunner/game_info.h delete mode 100644 engines/bladerunner/gameflags.cpp delete mode 100644 engines/bladerunner/gameflags.h delete mode 100644 engines/bladerunner/gameinfo.cpp delete mode 100644 engines/bladerunner/gameinfo.h delete mode 100644 engines/bladerunner/spinner.cpp delete mode 100644 engines/bladerunner/spinner.h create mode 100644 engines/bladerunner/ui/elevator.cpp create mode 100644 engines/bladerunner/ui/elevator.h create mode 100644 engines/bladerunner/ui/kia.cpp create mode 100644 engines/bladerunner/ui/kia.h create mode 100644 engines/bladerunner/ui/kia_log.cpp create mode 100644 engines/bladerunner/ui/kia_log.h create mode 100644 engines/bladerunner/ui/kia_section_base.cpp create mode 100644 engines/bladerunner/ui/kia_section_base.h create mode 100644 engines/bladerunner/ui/kia_section_clues.cpp create mode 100644 engines/bladerunner/ui/kia_section_clues.h create mode 100644 engines/bladerunner/ui/kia_section_crimes.cpp create mode 100644 engines/bladerunner/ui/kia_section_crimes.h create mode 100644 engines/bladerunner/ui/kia_section_diagnostic.h create mode 100644 engines/bladerunner/ui/kia_section_help.cpp create mode 100644 engines/bladerunner/ui/kia_section_help.h create mode 100644 engines/bladerunner/ui/kia_section_load.h create mode 100644 engines/bladerunner/ui/kia_section_pogo.h create mode 100644 engines/bladerunner/ui/kia_section_save.h create mode 100644 engines/bladerunner/ui/kia_section_settings.cpp create mode 100644 engines/bladerunner/ui/kia_section_settings.h create mode 100644 engines/bladerunner/ui/kia_section_suspects.h create mode 100644 engines/bladerunner/ui/kia_shapes.cpp create mode 100644 engines/bladerunner/ui/kia_shapes.h create mode 100644 engines/bladerunner/ui/spinner.cpp create mode 100644 engines/bladerunner/ui/spinner.h create mode 100644 engines/bladerunner/ui/ui_check_box.cpp create mode 100644 engines/bladerunner/ui/ui_check_box.h create mode 100644 engines/bladerunner/ui/ui_component.h create mode 100644 engines/bladerunner/ui/ui_container.cpp create mode 100644 engines/bladerunner/ui/ui_container.h create mode 100644 engines/bladerunner/ui/ui_image_picker.cpp create mode 100644 engines/bladerunner/ui/ui_image_picker.h create mode 100644 engines/bladerunner/ui/ui_input_box.cpp create mode 100644 engines/bladerunner/ui/ui_input_box.h create mode 100644 engines/bladerunner/ui/ui_scroll_box.cpp create mode 100644 engines/bladerunner/ui/ui_scroll_box.h create mode 100644 engines/bladerunner/ui/ui_slider.cpp create mode 100644 engines/bladerunner/ui/ui_slider.h delete mode 100644 engines/bladerunner/ui_image_picker.cpp delete mode 100644 engines/bladerunner/ui_image_picker.h (limited to 'engines') diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index 3f66899d5d..8462de836f 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -28,7 +28,7 @@ #include "bladerunner/actor_walk.h" #include "bladerunner/audio_speech.h" #include "bladerunner/boundingbox.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/game_info.h" #include "bladerunner/items.h" #include "bladerunner/mouse.h" #include "bladerunner/movement_track.h" @@ -345,10 +345,10 @@ void Actor::setAtXYZ(const Vector3 &position, int facing, bool snapFacing, bool setBoundingBox(_position, retired); - _vm->_sceneObjects->remove(_id + SCENE_OBJECTS_ACTORS_OFFSET); + _vm->_sceneObjects->remove(_id + kSceneObjectOffsetActors); if (_vm->_scene->getSetId() == _setId) { - _vm->_sceneObjects->addActor(_id + SCENE_OBJECTS_ACTORS_OFFSET, _bbox, &_screenRectangle, 1, moving, _isTargetable, retired); + _vm->_sceneObjects->addActor(_id + kSceneObjectOffsetActors, _bbox, &_screenRectangle, 1, moving, _isTargetable, retired); } } @@ -650,7 +650,7 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) { 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 + SCENE_OBJECTS_ACTORS_OFFSET, this->_position.x, this->_position.z, false, false) == 1 && !this->_isImmuneToObstacles) { + if (_vm->_sceneObjects->existsOnXZ(this->_id + kSceneObjectOffsetActors, this->_position.x, this->_position.z, false, false) == 1 && !this->_isImmuneToObstacles) { this->_position.x = originalX; this->_position.y = originalY; this->_position.z = originalZ; @@ -691,13 +691,13 @@ bool Actor::draw(Common::Rect *screenRect) { // TODO: Handle SHORTY mode - _vm->_sliceRenderer->drawInWorld(_animationId, _animationFrame, drawPosition, drawAngle, drawScale, _vm->_surfaceGame, _vm->_zbuffer->getData()); + _vm->_sliceRenderer->drawInWorld(_animationId, _animationFrame, drawPosition, drawAngle, drawScale, _vm->_surfaceFront, _vm->_zbuffer->getData()); _vm->_sliceRenderer->getScreenRectangle(screenRect, _animationId, _animationFrame, drawPosition, drawAngle, drawScale); return !screenRect->isEmpty(); } -int Actor::getSetId() { +int Actor::getSetId() const { return _setId; } @@ -943,7 +943,7 @@ void Actor::setFlagDamageAnimIfMoving(bool value) { _damageAnimIfMoving = value; } -bool Actor::getFlagDamageAnimIfMoving() { +bool Actor::getFlagDamageAnimIfMoving() const { return _damageAnimIfMoving; } @@ -1009,29 +1009,29 @@ float Actor::distanceFromActor(int otherActorId) { return (_position - _vm->_actors[otherActorId]->_position).length(); } -float Actor::getX() { +float Actor::getX() const { return _position.x; } -float Actor::getY() { +float Actor::getY() const { return _position.y; } -float Actor::getZ() { +float Actor::getZ() const { return _position.z; } -void Actor::getXYZ(float *x, float *y, float *z) { +void Actor::getXYZ(float *x, float *y, float *z) const { *x = _position.x; *y = _position.y; *z = _position.z; } -int Actor::getFacing() { +int Actor::getFacing() const { return _facing; } -int Actor::getAnimationMode() { +int Actor::getAnimationMode() const { return _animationMode; } @@ -1046,7 +1046,7 @@ void Actor::setGoal(int goalNumber) { _vm->_sceneScript->ActorChangedGoal(_id, goalNumber, oldGoalNumber, _vm->_scene->getSetId() == _setId); } -int Actor::getGoal() { +int Actor::getGoal() const { return _goalNumber; } @@ -1055,7 +1055,7 @@ void Actor::speechPlay(int sentenceId, bool voiceOver) { sprintf(name, "%02d-%04d%s.AUD", _id, sentenceId, _vm->_languageCode); int balance; - if (voiceOver || _id == VOICEOVER_ACTOR) { + if (voiceOver || _id == BladeRunnerEngine::kActorVoiceOver) { balance = 0; } else { // Vector3 pos = _vm->_view->_frameViewMatrix * _position; @@ -1092,16 +1092,16 @@ void Actor::loseClue(int clueId) { _clues->lose(clueId); } -bool Actor::hasClue(int clueId) { +bool Actor::hasClue(int clueId) const { return _clues->isAcquired(clueId); } void Actor::copyClues(int actorId) { Actor *otherActor = _vm->_actors[actorId]; for (int i = 0; i < (int)_vm->_gameInfo->getClueCount(); i++) { - if (hasClue(i) && !_clues->isFlag4(i) && !otherActor->hasClue(i)) { + if (hasClue(i) && !_clues->isPrivate(i) && !otherActor->hasClue(i)) { int fromActorId = _id; - if (_id == VOICEOVER_ACTOR) { + if (_id == BladeRunnerEngine::kActorVoiceOver) { fromActorId = _clues->getFromActorId(i); } otherActor->acquireClue(i, false, fromActorId); diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h index 8c426bde68..5068143776 100644 --- a/engines/bladerunner/actor.h +++ b/engines/bladerunner/actor.h @@ -39,6 +39,7 @@ class View; class Actor { friend class ScriptBase; + friend class KIA; BladeRunnerEngine *_vm; @@ -80,9 +81,9 @@ private: // Movement bool _movementTrackPaused; - int _movementTrackNextWaypointId; - int _movementTrackNextDelay; // probably not used - int _movementTrackNextAngle; // probably not used + int _movementTrackNextWaypointId; + int _movementTrackNextDelay; // probably not used + int _movementTrackNextAngle; // probably not used bool _movementTrackNextRunning; int _movementTrackWalkingToWaypointId; @@ -119,14 +120,14 @@ public: void setAtXYZ(const Vector3 &pos, int facing, bool setFacing = true, bool moving = false, bool retired = false); void setAtWaypoint(int waypointId, int angle, int unknown, bool retired); - float getX(); - float getY(); - float getZ(); - void getXYZ(float* x, float* y, float* z); - int getFacing(); - int getAnimationMode(); + float getX() const; + float getY() const; + float getZ() const; + void getXYZ(float *x, float *y, float *z) const; + int getFacing() const; + int getAnimationMode() const; - Vector3 getPosition() { return _position; } + Vector3 getPosition() const { return _position; } void changeAnimationMode(int animationMode, bool force = false); void setFPS(int fps); @@ -153,12 +154,12 @@ public: bool tick(bool forceUpdate, Common::Rect *screenRect); bool draw(Common::Rect *screenRect); - int getSetId(); + int getSetId() const; void setSetId(int setId); BoundingBox *getBoundingBox() const { return _bbox; } Common::Rect *getScreenRectangle() { return &_screenRectangle; } int getWalkbox() const { return _walkboxId; } - bool isRetired()const { return _isRetired; } + bool isRetired() const { return _isRetired; } bool isTargetable() const { return _isTargetable; } void setTargetable(bool targetable); bool isImmuneToObstacles() const { return _isImmuneToObstacles; } @@ -192,7 +193,7 @@ public: void modifyIntelligence(signed int change); void modifyStability(signed int change); void setFlagDamageAnimIfMoving(bool value); - bool getFlagDamageAnimIfMoving(); + bool getFlagDamageAnimIfMoving() const; void setHealth(int hp, int maxHp); void retire(bool isRetired, int width, int height, int retiredByActorId); @@ -201,7 +202,7 @@ public: void combatModeOff(); void setGoal(int goalNumber); - int getGoal(); + int getGoal() const; float distanceFromActor(int otherActorId); @@ -212,15 +213,16 @@ public: void addClueToDatabase(int clueId, int unknown, bool clueAcquired, bool unknownFlag, int fromActorId); void acquireClue(int clueId, bool unknownFlag, int fromActorId); void loseClue(int clueId); - bool hasClue(int clueId); + bool hasClue(int clueId) const; void copyClues(int actorId); int soundVolume() const; int soundBalance() const; + private: void setFacing(int facing, bool halfOrSet = true); void setBoundingBox(const Vector3 &position, bool retired); - float distanceFromView(View* view) const; + float distanceFromView(View *view) const; bool loopWalk(const Vector3 &destination, int destinationOffset, bool a3, bool run, const Vector3 &start, float a6, float a7, bool a8, bool *isRunning, bool async); bool walkTo(bool run, const Vector3 &destination, bool a3); diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp index cd848f9fbf..fe4291d558 100644 --- a/engines/bladerunner/actor_clues.cpp +++ b/engines/bladerunner/actor_clues.cpp @@ -23,7 +23,7 @@ #include "bladerunner/actor_clues.h" #include "bladerunner/bladerunner.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/game_info.h" #include "bladerunner/crimes_database.h" #include "common/debug.h" @@ -34,7 +34,6 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) { _vm = vm; _count = 0; _maxCount = 0; - _clues = 0; switch (cluesType) { case 4: _maxCount = _vm->_gameInfo->getClueCount(); @@ -56,84 +55,97 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) { } if (_maxCount > 0) { - _clues = new ActorClue[_maxCount]; - } else { - _clues = nullptr; + _clues.resize(_maxCount); } - if (_clues) { - removeAll(); - } else { - _maxCount = 0; - } -} - -ActorClues::~ActorClues() { - delete[] _clues; - - _maxCount = 0; - _count = 0; + removeAll(); } void ActorClues::acquire(int clueId, bool flag2, int fromActorId) { int clueIndex = findClueIndex(clueId); - _clues[clueIndex]._flags |= 0x01; - _clues[clueIndex]._flags = (_clues[clueIndex]._flags & ~0x02) | ((flag2 << 1) & 0x02); - _clues[clueIndex]._fromActorId = fromActorId; + _clues[clueIndex].flags |= 0x01; + _clues[clueIndex].flags = (_clues[clueIndex].flags & ~0x02) | ((flag2 << 1) & 0x02); + _clues[clueIndex].fromActorId = fromActorId; debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId); } void ActorClues::lose(int clueId) { int clueIndex = findClueIndex(clueId); - _clues[clueIndex]._flags = 0; + _clues[clueIndex].flags = 0; } -bool ActorClues::isAcquired(int clueId) { +bool ActorClues::isAcquired(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { return false; } - return _clues[clueIndex]._flags & 0x01; + return _clues[clueIndex].flags & 0x01; } -int ActorClues::getFromActorId(int clueId) { +int ActorClues::getFromActorId(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { return -1; } - return _clues[clueIndex]._fromActorId; + return _clues[clueIndex].fromActorId; } -bool ActorClues::isFlag2(int clueId) { +bool ActorClues::isFlag2(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { return false; } - return (_clues[clueIndex]._flags & 0x02) >> 1; + return _clues[clueIndex].flags & 0x02; } -bool ActorClues::isViewed(int clueId) { +bool ActorClues::isViewed(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { return false; } - return (_clues[clueIndex]._flags & 0x04) >> 2; + return _clues[clueIndex].flags & 0x04; +} + +void ActorClues::setViewed(int clueId, bool viewed) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return; + } + + if (viewed) { + _clues[clueIndex].flags |= 0x04; + } else { + _clues[clueIndex].flags &= ~0x04; + } } -bool ActorClues::isFlag4(int clueId) { +bool ActorClues::isPrivate(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { return false; } - return (_clues[clueIndex]._flags & 0x08) >> 3; + return _clues[clueIndex].flags & 0x08; +} + +void ActorClues::setPrivate(int clueId, bool isPrivate) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return; + } + + if (isPrivate) { + _clues[clueIndex].flags |= 0x08; + } else { + _clues[clueIndex].flags &= ~0x08; + } } -int ActorClues::getField1(int clueId) { +int ActorClues::getField1(int clueId) const { if (!_count) { return 0; } @@ -143,10 +155,10 @@ int ActorClues::getField1(int clueId) { return 0; } - return _clues[clueIndex]._weight; + return _clues[clueIndex].weight; } -int ActorClues::getCount() { +int ActorClues::getCount() const { return _count; } @@ -157,9 +169,9 @@ void ActorClues::removeAll() { } } -int ActorClues::findClueIndex(int clueId) { +int ActorClues::findClueIndex(int clueId) const { for (int i = 0; i < _count; i++) { - if (clueId == _clues[i]._clueId) { + if (clueId == _clues[i].clueId) { return i; } } @@ -171,35 +183,36 @@ void ActorClues::add(int actorId, int clueId, int weight, bool acquired, bool un //debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_crimesDatabase->getClueText(clueId), fromActorId); - _clues[_count]._clueId = clueId; - _clues[_count]._weight = weight; + _clues[_count].clueId = clueId; + _clues[_count].weight = weight; - _clues[_count]._flags = 0; - _clues[_count]._flags = (_clues[_count]._flags & ~0x01) | (acquired & 0x01); - _clues[_count]._flags = (_clues[_count]._flags & ~0x02) | ((unknownFlag << 1) & 0x02); + _clues[_count].flags = 0; + _clues[_count].flags = (_clues[_count].flags & ~0x01) | (acquired & 0x01); + _clues[_count].flags = (_clues[_count].flags & ~0x02) | ((unknownFlag << 1) & 0x02); - _clues[_count]._fromActorId = fromActorId; + _clues[_count].fromActorId = fromActorId; ++_count; } void ActorClues::remove(int index) { - if (_vm->_crimesDatabase) - debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index]._clueId)); + if (_vm->_crimesDatabase) { + debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index].clueId)); + } - _clues[index]._clueId = -1; - _clues[index]._weight = 0; - _clues[index]._flags = 0; - _clues[index]._fromActorId = -1; + _clues[index].clueId = -1; + _clues[index].weight = 0; + _clues[index].flags = 0; + _clues[index].fromActorId = -1; - _clues[index]._field3 = -1; - _clues[index]._field4 = 0; - _clues[index]._field5 = -1; - _clues[index]._field6 = 0; - _clues[index]._field7 = -1; - _clues[index]._field8 = 0; + _clues[index].field3 = -1; + _clues[index].field4 = 0; + _clues[index].field5 = -1; + _clues[index].field6 = 0; + _clues[index].field7 = -1; + _clues[index].field8 = 0; } -bool ActorClues::exists(int clueId) { +bool ActorClues::exists(int clueId) const { return findClueIndex(clueId) != -1; } diff --git a/engines/bladerunner/actor_clues.h b/engines/bladerunner/actor_clues.h index d053ef532b..498986a77a 100644 --- a/engines/bladerunner/actor_clues.h +++ b/engines/bladerunner/actor_clues.h @@ -23,46 +23,54 @@ #ifndef BLADERUNNER_ACTOR_CLUES_H #define BLADERUNNER_ACTOR_CLUES_H +#include "common/array.h" + namespace BladeRunner { class BladeRunnerEngine; -struct ActorClue { - int _clueId; - int _weight; - int _fromActorId; - int _field3; - int _field4; - int _field5; - int _field6; - int _field7; - int _field8; - unsigned char _flags; -}; - class ActorClues { + struct Clue { + int clueId; + int weight; + int fromActorId; + int field3; + int field4; + int field5; + int field6; + int field7; + int field8; + unsigned char flags; + }; + BladeRunnerEngine *_vm; -private: - int _count; - int _maxCount; - ActorClue *_clues; + int _count; + int _maxCount; + Common::Array _clues; public: ActorClues(BladeRunnerEngine *_vm, int cluesType); - ~ActorClues(); void add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId); + void acquire(int clueId, bool flag2, int fromActorId); void lose(int clueId); - bool isAcquired(int clueId); - int getFromActorId(int clueId); - bool isFlag2(int clueId); - bool isViewed(int clueId); - bool isFlag4(int clueId); - int getField1(int clueId); + bool isAcquired(int clueId) const; + + int getFromActorId(int clueId) const; + + bool isFlag2(int clueId) const; + + bool isViewed(int clueId) const; + void setViewed(int clueId, bool viewed); + + bool isPrivate(int clueId) const; + void setPrivate(int clueId, bool isPrivate); + + int getField1(int clueId) const; - int getCount(); + int getCount() const; void removeAll(); @@ -70,8 +78,8 @@ public: //loadgame private: - bool exists(int clueId); - int findClueIndex(int clueId); + bool exists(int clueId) const; + int findClueIndex(int clueId) const; void remove(int clueIndex); }; diff --git a/engines/bladerunner/actor_combat.h b/engines/bladerunner/actor_combat.h index 3763f46be8..b7ec93533d 100644 --- a/engines/bladerunner/actor_combat.h +++ b/engines/bladerunner/actor_combat.h @@ -32,7 +32,6 @@ class BladeRunnerEngine; class ActorCombat { BladeRunnerEngine *_vm; -private: // int _actorId; // int _combatOn; // int _field2; diff --git a/engines/bladerunner/actor_dialogue_queue.cpp b/engines/bladerunner/actor_dialogue_queue.cpp new file mode 100644 index 0000000000..1dc7acc859 --- /dev/null +++ b/engines/bladerunner/actor_dialogue_queue.cpp @@ -0,0 +1,173 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "bladerunner/actor_dialogue_queue.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/audio_speech.h" +#include "bladerunner/scene.h" + +#include "bladerunner/script/scene.h" + +namespace BladeRunner { + +ActorDialogueQueue::Entry::Entry() { + isNotPause = false; + isPause = false; + actorId = -1; + delay = -1; + sentenceId = -1; + animationMode = -1; +} + +ActorDialogueQueue::ActorDialogueQueue(BladeRunnerEngine *vm) { + _vm = vm; + clear(); +} + +ActorDialogueQueue::~ActorDialogueQueue() { +} + +void ActorDialogueQueue::add(int actorId, int sentenceId, int animationMode) { + if (actorId == 0 || actorId == BladeRunnerEngine::kActorVoiceOver) { + animationMode = -1; + } + if (_entries.size() < 25) { + Entry entry; + entry.isNotPause = true; + entry.isPause = false; + entry.actorId = actorId; + entry.sentenceId = sentenceId; + entry.animationMode = animationMode; + entry.delay = -1; + + _entries.push_back(entry); + } +} + +void ActorDialogueQueue::addPause(int delay) { + if (_entries.size() < 25) { + Entry entry; + entry.isNotPause = false; + entry.isPause = true; + entry.actorId = -1; + entry.sentenceId = -1; + entry.animationMode = -1; + entry.delay = delay; + + _entries.push_back(entry); + } +} + +void ActorDialogueQueue::flush(int a1, bool callScript) { + if (_isNotPause && _vm->_audioSpeech->isPlaying()) { + _vm->_audioSpeech->stopSpeech(); + if (_animationModePrevious >= 0) { + _vm->_actors[_actorId]->changeAnimationMode(_animationModePrevious, false); + _animationModePrevious = -1; + } + _isNotPause = false; + _actorId = -1; + _sentenceId = -1; + _animationMode = -1; + } + if (_isPause) { + _isPause = false; + _delay = 0; + _timeLast = 0; + } + clear(); + if (callScript) { + _vm->_sceneScript->DialogueQueueFlushed(a1); + } +} + +void ActorDialogueQueue::tick() { + if (!_vm->_audioSpeech->isPlaying()) { + if (_isPause) { + int time = _vm->getTotalPlayTime(); + int timeDiff = time - _timeLast; + _timeLast = time; + _delay -= timeDiff; + if (_delay > 0) { + return; + } + _isPause = false; + _delay = 0; + _timeLast = 0; + if (_entries.empty()) { + flush(0, true); + } + } + if (_isNotPause) { + if (_animationModePrevious >= 0) { + _vm->_actors[_actorId]->changeAnimationMode(_animationModePrevious, false); + _animationModePrevious = -1; + } + _isNotPause = false; + _actorId = -1; + _sentenceId = -1; + _animationMode = -1; + if (_entries.empty()) { + flush(0, true); + } + } + if (!_entries.empty()) { + Entry firstEntry = _entries.remove_at(0); + if (firstEntry.isNotPause) { + _animationMode = firstEntry.animationMode; + if (_vm->_actors[firstEntry.actorId]->getSetId() != _vm->_scene->getSetId()) { + _animationMode = -1; + } + _vm->_actors[firstEntry.actorId]->speechPlay(firstEntry.sentenceId, false); + _isNotPause = true; + _actorId = firstEntry.actorId; + _sentenceId = firstEntry.sentenceId; + if (_animationMode >= 0) { + _animationModePrevious = _vm->_actors[firstEntry.actorId]->getAnimationMode(); + _vm->_actors[firstEntry.actorId]->changeAnimationMode(_animationMode, false); + } else { + _animationModePrevious = -1; + } + } else if (firstEntry.isPause) { + _isPause = true; + _delay = firstEntry.delay; + _timeLast = _vm->getTotalPlayTime(); + } + } + } +} + +void ActorDialogueQueue::clear() { + _entries.clear(); + _isNotPause = false; + _actorId = -1; + _sentenceId = -1; + _animationMode = -1; + _animationModePrevious = -1; + _isPause = false; + _delay = 0; + _timeLast = 0; +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/actor_dialogue_queue.h b/engines/bladerunner/actor_dialogue_queue.h new file mode 100644 index 0000000000..0a700217b9 --- /dev/null +++ b/engines/bladerunner/actor_dialogue_queue.h @@ -0,0 +1,70 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BLADERUNNER_ACTOR_DIALOGUE_QUEUE_H +#define BLADERUNNER_ACTOR_DIALOGUE_QUEUE_H +#include "common/array.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ActorDialogueQueue { + struct Entry { + bool isNotPause; + bool isPause; + int actorId; + int sentenceId; + int animationMode; + int delay; + + Entry(); + }; + + BladeRunnerEngine *_vm; + + Common::Array _entries; + bool _isNotPause; + int _actorId; + int _sentenceId; + int _animationMode; + int _animationModePrevious; + bool _isPause; + int _delay; + int _timeLast; + +public: + ActorDialogueQueue(BladeRunnerEngine *vm); + ~ActorDialogueQueue(); + + void add(int actorId, int speechId, int animationMode); + void addPause(int delay); + void flush(int a1, bool callScript); + void tick(); + +private: + void clear(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/actor_walk.cpp b/engines/bladerunner/actor_walk.cpp index ddf8b4c61b..70624221f5 100644 --- a/engines/bladerunner/actor_walk.cpp +++ b/engines/bladerunner/actor_walk.cpp @@ -25,7 +25,7 @@ #include "bladerunner/bladerunner.h" #include "bladerunner/actor.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/game_info.h" #include "bladerunner/obstacles.h" #include "bladerunner/scene.h" #include "bladerunner/scene_objects.h" @@ -71,7 +71,7 @@ bool ActorWalk::setup(int actorId, bool run, const Vector3 &from, const Vector3 } _nearActors.clear(); - _vm->_sceneObjects->setMoving(actorId + SCENE_OBJECTS_ACTORS_OFFSET, true); + _vm->_sceneObjects->setMoving(actorId + kSceneObjectOffsetActors, true); _vm->_actors[actorId]->setMoving(true); if (_running) { @@ -124,7 +124,7 @@ bool ActorWalk::tick(int actorId, float stepDistance, bool inWalkLoop) { bool nearActorExists = addNearActors(actorId); if (_nearActors.size() > 0) { nearActorExists = true; - if (_vm->_sceneObjects->existsOnXZ(actorId + SCENE_OBJECTS_ACTORS_OFFSET, _destination.x, _destination.z, true, true)) { + if (_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, _destination.x, _destination.z, true, true)) { if (actorId > 0) { if (_vm->_actors[actorId]->inWalkLoop()) { stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle); @@ -207,7 +207,7 @@ void ActorWalk::getCurrentPosition(int actorId, Vector3 *pos, int *facing) const } void ActorWalk::stop(int actorId, bool immediately, int combatAnimationMode, int animationMode) { - _vm->_sceneObjects->setMoving(actorId + SCENE_OBJECTS_ACTORS_OFFSET, false); + _vm->_sceneObjects->setMoving(actorId + kSceneObjectOffsetActors, false); _vm->_actors[actorId]->setMoving(false); if (_vm->_actors[actorId]->inCombat()) { @@ -234,7 +234,7 @@ bool ActorWalk::isXYZEmpty(float x, float y, float z, int actorId) const { if (_vm->_actors[actorId]->isImmuneToObstacles()) { return false; } - return _vm->_sceneObjects->existsOnXZ(actorId + SCENE_OBJECTS_ACTORS_OFFSET, x, z, false, false); + return _vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, x, z, false, false); } bool ActorWalk::findNearestEmptyPosition(int actorId, const Vector3 &destination, int dist, Vector3 &out) const { @@ -267,14 +267,14 @@ bool ActorWalk::findNearestEmptyPosition(int actorId, const Vector3 &destination x = destination.x + sin_1024(facingRight) * dist; z = destination.z - cos_1024(facingRight) * dist; - if (!_vm->_sceneObjects->existsOnXZ(actorId + SCENE_OBJECTS_ACTORS_OFFSET, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { + if (!_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { break; } x = destination.x + sin_1024(facingLeft) * dist; z = destination.z - cos_1024(facingLeft) * dist; - if (!_vm->_sceneObjects->existsOnXZ(actorId + SCENE_OBJECTS_ACTORS_OFFSET, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { + if (!_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { break; } @@ -361,7 +361,7 @@ int ActorWalk::nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, V if (_vm->_scene->_set->findWalkbox(to.x, to.z) == -1) { return 0; } - if (_vm->_sceneObjects->existsOnXZ(actorId + SCENE_OBJECTS_ACTORS_OFFSET, to.x, to.z, false, false)) { + if (_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, to.x, to.z, false, false)) { return 0; } Vector3 next1; diff --git a/engines/bladerunner/actor_walk.h b/engines/bladerunner/actor_walk.h index c6f2ed7478..07e383ac25 100644 --- a/engines/bladerunner/actor_walk.h +++ b/engines/bladerunner/actor_walk.h @@ -33,21 +33,20 @@ class BladeRunnerEngine; class ActorWalk { BladeRunnerEngine *_vm; -private: - int _walking; - int _running; - Vector3 _destination; - Vector3 _originalDestination; - Vector3 _current; - Vector3 _next; - int _facing; + int _walking; + int _running; + Vector3 _destination; + Vector3 _originalDestination; + Vector3 _current; + Vector3 _next; + int _facing; Common::HashMap _nearActors; - int _status; + int _status; public: ActorWalk(BladeRunnerEngine *vm); ~ActorWalk(); - + bool setup(int actorId, bool run, const Vector3 &from, const Vector3 &to, bool unk1, bool *arrived); void getCurrentPosition(int actorId, Vector3 *pos, int *facing) const; bool tick(int actorId, float stepDistance, bool flag); diff --git a/engines/bladerunner/adq.cpp b/engines/bladerunner/adq.cpp deleted file mode 100644 index 71315e8492..0000000000 --- a/engines/bladerunner/adq.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "bladerunner/adq.h" - -#include "bladerunner/bladerunner.h" - -#include "bladerunner/actor.h" -#include "bladerunner/audio_speech.h" -#include "bladerunner/scene.h" - -#include "bladerunner/script/scene.h" - -namespace BladeRunner { - -ADQEntry::ADQEntry() { - this->_isNotPause = false; - this->_isPause = false; - this->_actorId = -1; - this->_delay = -1; - this->_sentenceId = -1; - this->_animationMode = -1; -} - -ADQ::ADQ(BladeRunnerEngine *vm) { - _vm = vm; - clear(); -} - -ADQ::~ADQ() { -} - -void ADQ::add(int actorId, int sentenceId, int animationMode) { - if (actorId == 0 || actorId == VOICEOVER_ACTOR) { - animationMode = -1; - } - if (_entries.size() < 25) { - ADQEntry entry; - entry._isNotPause = true; - entry._isPause = false; - entry._actorId = actorId; - entry._sentenceId = sentenceId; - entry._animationMode = animationMode; - entry._delay = -1; - - _entries.push_back(entry); - } -} - -void ADQ::addPause(int delay) { - if (_entries.size() < 25) { - ADQEntry entry; - entry._isNotPause = false; - entry._isPause = true; - entry._actorId = -1; - entry._sentenceId = -1; - entry._animationMode = -1; - entry._delay = delay; - - _entries.push_back(entry); - } -} - -void ADQ::flush(int a1, bool callScript) { - if (_isNotPause && _vm->_audioSpeech->isPlaying()) { - _vm->_audioSpeech->stopSpeech(); - if (_animationModePrevious >= 0) { - _vm->_actors[_actorId]->changeAnimationMode(_animationModePrevious, false); - _animationModePrevious = -1; - } - _isNotPause = false; - _actorId = -1; - _sentenceId = -1; - _animationMode = -1; - } - if (_isPause) { - _isPause = false; - _delay = 0; - _timeLast = 0; - } - clear(); - if (callScript) { - _vm->_sceneScript->DialogueQueueFlushed(a1); - } -} - -void ADQ::tick() { - if (!_vm->_audioSpeech->isPlaying()) { - if (_isPause) { - int time = _vm->getTotalPlayTime(); - int timeDiff = time - _timeLast; - _timeLast = time; - _delay -= timeDiff; - if (_delay > 0) { - return; - } - _isPause = false; - _delay = 0; - _timeLast = 0; - if (_entries.empty()) { - flush(0, true); - } - } - if (_isNotPause) { - if (_animationModePrevious >= 0) { - _vm->_actors[_actorId]->changeAnimationMode(_animationModePrevious, false); - _animationModePrevious = -1; - } - _isNotPause = false; - _actorId = -1; - _sentenceId = -1; - _animationMode = -1; - if (_entries.empty()) { - flush(0, true); - } - } - if (!_entries.empty()) { - ADQEntry firstEntry = _entries.remove_at(0); - if (firstEntry._isNotPause) { - _animationMode = firstEntry._animationMode; - if (_vm->_actors[firstEntry._actorId]->getSetId() != _vm->_scene->getSetId()) { - _animationMode = -1; - } - _vm->_actors[firstEntry._actorId]->speechPlay(firstEntry._sentenceId, false); - _isNotPause = true; - _actorId = firstEntry._actorId; - _sentenceId = firstEntry._sentenceId; - if (_animationMode >= 0) { - _animationModePrevious = _vm->_actors[firstEntry._actorId]->getAnimationMode(); - _vm->_actors[firstEntry._actorId]->changeAnimationMode(_animationMode, false); - } else { - _animationModePrevious = -1; - } - } else if (firstEntry._isPause) { - _isPause = true; - _delay = firstEntry._delay; - _timeLast = _vm->getTotalPlayTime(); - } - } - } -} - -void ADQ::clear() { - _entries.clear(); - _isNotPause = false; - _actorId = -1; - _sentenceId = -1; - _animationMode = -1; - _animationModePrevious = -1; - _isPause = false; - _delay = 0; - _timeLast = 0; -} -} // End of namespace BladeRunner diff --git a/engines/bladerunner/adq.h b/engines/bladerunner/adq.h deleted file mode 100644 index f4e69df684..0000000000 --- a/engines/bladerunner/adq.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BLADERUNNER_ADQ_H -#define BLADERUNNER_ADQ_H -#include "common/array.h" - -namespace BladeRunner { - -class BladeRunnerEngine; - -struct ADQEntry { - bool _isNotPause; - bool _isPause; - int _actorId; - int _sentenceId; - int _animationMode; - int _delay; - - ADQEntry(); -}; - -// actor dialogue queue?? -class ADQ { - BladeRunnerEngine *_vm; - - Common::Array _entries; - - bool _isNotPause; - int _actorId; - int _sentenceId; - int _animationMode; - int _animationModePrevious; - bool _isPause; - int _delay; - int _timeLast; - - -public: - ADQ(BladeRunnerEngine *vm); - ~ADQ(); - - void add(int actorId, int speechId, int animationMode); - void addPause(int delay); - void flush(int a1, bool callScript); - void tick(); - -private: - void clear(); -}; - -} // End of namespace BladeRunner - -#endif diff --git a/engines/bladerunner/ambient_sounds.cpp b/engines/bladerunner/ambient_sounds.cpp index a8a42537d1..31683f01c1 100644 --- a/engines/bladerunner/ambient_sounds.cpp +++ b/engines/bladerunner/ambient_sounds.cpp @@ -24,27 +24,25 @@ #include "bladerunner/audio_player.h" #include "bladerunner/bladerunner.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/game_info.h" #include "common/debug.h" #include "common/system.h" namespace BladeRunner { -#define NON_LOOPING_SOUNDS 25 -#define LOOPING_SOUNDS 3 - -AmbientSounds::AmbientSounds(BladeRunnerEngine *vm) : _vm(vm) { - _nonLoopingSounds = new NonLoopingSound[NON_LOOPING_SOUNDS]; - _loopingSounds = new LoopingSound[LOOPING_SOUNDS]; +AmbientSounds::AmbientSounds(BladeRunnerEngine *vm) { + _vm = vm; + _nonLoopingSounds = new NonLoopingSound[kNonLoopingSounds]; + _loopingSounds = new LoopingSound[kLoopingSounds]; _ambientVolume = 65; - for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + for (int i = 0; i != kNonLoopingSounds; ++i) { NonLoopingSound &track = _nonLoopingSounds[i]; track.isActive = false; } - for (int i = 0; i != LOOPING_SOUNDS; ++i) { + for (int i = 0; i != kLoopingSounds; ++i) { LoopingSound &track = _loopingSounds[i]; track.isActive = false; } @@ -96,7 +94,7 @@ void AmbientSounds::removeNonLoopingSound(int sfxId, bool stopPlaying) { } void AmbientSounds::removeAllNonLoopingSounds(bool stopPlaying) { - for (int i = 0; i < NON_LOOPING_SOUNDS; i++) { + for (int i = 0; i < kNonLoopingSounds; i++) { removeNonLoopingSoundByIndex(i, stopPlaying); } } @@ -188,7 +186,7 @@ void AmbientSounds::removeLoopingSound(int sfxId, int delay) { } void AmbientSounds::removeAllLoopingSounds(int delay) { - for (int i = 0; i < LOOPING_SOUNDS; i++) { + for (int i = 0; i < kLoopingSounds; i++) { removeLoopingSoundByIndex(i, delay); } } @@ -196,7 +194,7 @@ void AmbientSounds::removeAllLoopingSounds(int delay) { void AmbientSounds::tick() { uint32 now = g_system->getMillis(); - for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + for (int i = 0; i != kNonLoopingSounds; ++i) { NonLoopingSound &track = _nonLoopingSounds[i]; if (!track.isActive || track.nextPlayTime > now) { @@ -226,8 +224,37 @@ void AmbientSounds::tick() { } } -int AmbientSounds::findAvailableNonLoopingTrack() { - for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { +void AmbientSounds::setVolume(int volume) { + if (_loopingSounds) { + for (int i = 0; i < kLoopingSounds; i++) { + if (_loopingSounds[i].isActive && _loopingSounds[i].audioPlayerTrack != -1) { + int newVolume = _loopingSounds[i].volume * volume / 100; + if (_vm->_audioPlayer->isActive(_loopingSounds[i].audioPlayerTrack)) { + _vm->_audioPlayer->adjustVolume(_loopingSounds[i].audioPlayerTrack, newVolume, 1, false); + } else { + _loopingSounds[i].audioPlayerTrack = _vm->_audioPlayer->playAud(_loopingSounds[i].name, 1, _loopingSounds[i].pan, _loopingSounds[i].pan, 99, AudioPlayer::LOOP | AudioPlayer::OVERRIDE_VOLUME); + if (_loopingSounds[i].audioPlayerTrack == -1) { + removeLoopingSound(i, 0); + } else { + _vm->_audioPlayer->adjustVolume(_loopingSounds[i].audioPlayerTrack, newVolume, 1, false); + } + } + } + } + } + _ambientVolume = volume; +} + +int AmbientSounds::getVolume() const { + return _ambientVolume; +} + +void AmbientSounds::playSample() { + playSound(66, 100, 0, 0, 0); +} + +int AmbientSounds::findAvailableNonLoopingTrack() const { + for (int i = 0; i != kNonLoopingSounds; ++i) { if (!_nonLoopingSounds[i].isActive) { return i; } @@ -236,8 +263,8 @@ int AmbientSounds::findAvailableNonLoopingTrack() { return -1; } -int AmbientSounds::findNonLoopingTrackByHash(int32 hash) { - for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { +int AmbientSounds::findNonLoopingTrackByHash(int32 hash) const { + for (int i = 0; i != kNonLoopingSounds; ++i) { NonLoopingSound &track = _nonLoopingSounds[i]; if (track.isActive && track.hash == hash) { @@ -248,8 +275,8 @@ int AmbientSounds::findNonLoopingTrackByHash(int32 hash) { return -1; } -int AmbientSounds::findAvailableLoopingTrack() { - for (int i = 0; i != LOOPING_SOUNDS; ++i) { +int AmbientSounds::findAvailableLoopingTrack() const { + for (int i = 0; i != kLoopingSounds; ++i) { if (!_loopingSounds[i].isActive) { return i; } @@ -258,8 +285,8 @@ int AmbientSounds::findAvailableLoopingTrack() { return -1; } -int AmbientSounds::findLoopingTrackByHash(int32 hash) { - for (int i = 0; i != LOOPING_SOUNDS; ++i) { +int AmbientSounds::findLoopingTrackByHash(int32 hash) const { + for (int i = 0; i != kLoopingSounds; ++i) { LoopingSound &track = _loopingSounds[i]; if (track.isActive && track.hash == hash) { diff --git a/engines/bladerunner/ambient_sounds.h b/engines/bladerunner/ambient_sounds.h index 292d8173f2..e06726b183 100644 --- a/engines/bladerunner/ambient_sounds.h +++ b/engines/bladerunner/ambient_sounds.h @@ -30,6 +30,9 @@ namespace BladeRunner { class BladeRunnerEngine; class AmbientSounds { + static const int kNonLoopingSounds = 25; + static const int kLoopingSounds = 3; + struct NonLoopingSound { bool isActive; char name[13]; @@ -96,15 +99,16 @@ public: void tick(); - // setVolume - // getVolume + void setVolume(int volume); + int getVolume() const; + void playSample(); private: - int findAvailableNonLoopingTrack(); - int findNonLoopingTrackByHash(int32 hash); + int findAvailableNonLoopingTrack() const; + int findNonLoopingTrackByHash(int32 hash) const; - int findAvailableLoopingTrack(); - int findLoopingTrackByHash(int32 hash); + int findAvailableLoopingTrack() const; + int findLoopingTrackByHash(int32 hash) const; // stopNonLoopingTrack // stopLoopingTrack diff --git a/engines/bladerunner/archive.h b/engines/bladerunner/archive.h index 03eda4ea7f..f2809deeac 100644 --- a/engines/bladerunner/archive.h +++ b/engines/bladerunner/archive.h @@ -38,7 +38,7 @@ public: void close(); bool isOpen() const; - Common::String getName() { return _fd.getName(); } + Common::String getName() const { return _fd.getName(); } Common::SeekableReadStream *createReadStreamForMember(const Common::String &name); diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp index 6e7152a848..f0ed05200b 100644 --- a/engines/bladerunner/aud_stream.cpp +++ b/engines/bladerunner/aud_stream.cpp @@ -118,7 +118,7 @@ bool AudStream::rewind() { return true; } -int AudStream::getLength() { +int AudStream::getLength() const { int bytesPerSecond = _frequency; if (_flags & 1) { // 16 bit bytesPerSecond *= 2; diff --git a/engines/bladerunner/aud_stream.h b/engines/bladerunner/aud_stream.h index f3117d7072..a13cdde84f 100644 --- a/engines/bladerunner/aud_stream.h +++ b/engines/bladerunner/aud_stream.h @@ -60,7 +60,7 @@ public: int getRate() const { return _frequency; }; bool endOfData() const { return _p == _end; } bool rewind(); - int getLength(); + int getLength() const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/audio_mixer.cpp b/engines/bladerunner/audio_mixer.cpp index d9d04e65d9..35e53e570d 100644 --- a/engines/bladerunner/audio_mixer.cpp +++ b/engines/bladerunner/audio_mixer.cpp @@ -47,7 +47,7 @@ AudioMixer::~AudioMixer() { _vm->getTimerManager()->removeTimerProc(timerCallback); } -int AudioMixer::play(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void (*endCallback)(int, void*), void *callbackData) { +int AudioMixer::play(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void (*endCallback)(int, void *), void *callbackData) { Common::StackLock lock(_mutex); int channel = -1; @@ -110,7 +110,7 @@ int AudioMixer::playInChannel(int channel, Audio::Mixer::SoundType type, Audio:: _channels[channel].endCallback = endCallback; _channels[channel].callbackData = callbackData; - Audio::AudioStream* audioStream = stream; + Audio::AudioStream *audioStream = stream; if (loop) { audioStream = new Audio::LoopingAudioStream(stream, 0, DisposeAfterUse::YES); @@ -127,14 +127,14 @@ int AudioMixer::playInChannel(int channel, Audio::Mixer::SoundType type, Audio:: return channel; } -bool AudioMixer::isActive(int channel) { +bool AudioMixer::isActive(int channel) const { Common::StackLock lock(_mutex); return _channels[channel].isPresent && _vm->_mixer->isSoundHandleActive(_channels[channel].handle); } void AudioMixer::timerCallback(void *self) { - ((AudioMixer*)self)->tick(); + ((AudioMixer *)self)->tick(); } void AudioMixer::adjustVolume(int channel, int newVolume, int time) diff --git a/engines/bladerunner/audio_mixer.h b/engines/bladerunner/audio_mixer.h index a221e681ec..ca4b4807d5 100644 --- a/engines/bladerunner/audio_mixer.h +++ b/engines/bladerunner/audio_mixer.h @@ -39,19 +39,19 @@ class AudioMixer { static const int kUpdatesPerSecond = 40; struct Channel { - bool isPresent; - int priority; - bool loop; + bool isPresent; + int priority; + bool loop; Audio::SoundHandle handle; Audio::AudioStream *stream; - float volume; - float volumeDelta; - float volumeTarget; - float pan; - float panDelta; - float panTarget; - void (*endCallback)(int channel, void *data); - void *callbackData; + float volume; + float volumeDelta; + float volumeTarget; + float pan; + float panDelta; + float panTarget; + void (*endCallback)(int channel, void *data); + void *callbackData; }; BladeRunnerEngine *_vm; @@ -76,7 +76,7 @@ public: private: int playInChannel(int channel, Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void(*endCallback)(int, void *), void *callbackData); - bool isActive(int channel); + bool isActive(int channel) const; void tick(); static void timerCallback(void *refCon); }; diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp index 1e459e9b86..7aeba9c188 100644 --- a/engines/bladerunner/audio_player.cpp +++ b/engines/bladerunner/audio_player.cpp @@ -22,14 +22,14 @@ #include "bladerunner/audio_player.h" -#include "bladerunner/bladerunner.h" - #include "bladerunner/archive.h" #include "bladerunner/aud_stream.h" #include "bladerunner/audio_mixer.h" +#include "bladerunner/bladerunner.h" #include "common/debug.h" #include "common/stream.h" +#include "common/random.h" namespace Common { class MemoryReadStream; @@ -43,7 +43,7 @@ AudioCache::~AudioCache() { } } -bool AudioCache::canAllocate(uint32 size) { +bool AudioCache::canAllocate(uint32 size) const { Common::StackLock lock(_mutex); return _maxSize - _totalSize >= size; @@ -84,7 +84,7 @@ void AudioCache::storeByHash(int32 hash, Common::SeekableReadStream *stream) { Common::StackLock lock(_mutex); uint32 size = stream->size(); - byte *data = (byte*)malloc(size); + byte *data = (byte *)malloc(size); stream->read(data, size); cacheItem item = { @@ -124,7 +124,8 @@ void AudioCache::decRef(int32 hash) { assert(false && "AudioCache::decRef: hash not found"); } -AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) : _vm(vm) { +AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) { + _vm = vm; _cache = new AudioCache(); for (int i = 0; i != 6; ++i) { @@ -177,6 +178,31 @@ void AudioPlayer::adjustPan(int track, int pan, int delay) { _vm->_audioMixer->adjustPan(_tracks[track].channel, pan, 60 * delay); } +void AudioPlayer::setVolume(int volume) { + _sfxVolume = volume; +} + +int AudioPlayer::getVolume() const { + return _sfxVolume; +} + +void AudioPlayer::playSample() { + Common::String name; + + int rnd = _vm->_rnd.getRandomNumber(3); + if (rnd == 0) { + name = "gunmiss1.aud"; + } else if (rnd == 1) { + name = "gunmiss2.aud"; + } else if (rnd == 2) { + name = "gunmiss3.aud"; + } else { + name = "gunmiss4.aud"; + } + + playAud(name, 100, 0, 0, 100, 0); +} + void AudioPlayer::remove(int channel) { Common::StackLock lock(_mutex); for (int i = 0; i != kTracks; ++i) { @@ -284,7 +310,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in return track; } -bool AudioPlayer::isActive(int track) { +bool AudioPlayer::isActive(int track) const { Common::StackLock lock(_mutex); if (track < 0 || track >= kTracks) { return false; diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h index 4934b43871..06949828ea 100644 --- a/engines/bladerunner/audio_player.h +++ b/engines/bladerunner/audio_player.h @@ -26,6 +26,7 @@ #include "common/array.h" #include "common/mutex.h" #include "common/str.h" + #include "audio/audiostream.h" namespace BladeRunner { @@ -60,7 +61,7 @@ public: } ~AudioCache(); - bool canAllocate(uint32 size); + bool canAllocate(uint32 size) const; bool dropOldest(); byte *findByHash(int32 hash); void storeByHash(int32 hash, Common::SeekableReadStream *stream); @@ -101,12 +102,16 @@ public: }; int playAud(const Common::String &name, int volume, int panStart, int panEnd, int priority, byte flags = 0); - bool isActive(int track); + bool isActive(int track) const; void stop(int track, bool immediately); void stopAll(); void adjustVolume(int track, int volume, int delay, bool overrideVolume); void adjustPan(int track, int pan, int delay); + void setVolume(int volume); + int getVolume() const; + void playSample(); + private: void remove(int channel); static void mixerChannelEnded(int channel, void *data); diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp index 90fc213f2d..1f3465c7eb 100644 --- a/engines/bladerunner/audio_speech.cpp +++ b/engines/bladerunner/audio_speech.cpp @@ -22,6 +22,7 @@ #include "bladerunner/audio_speech.h" +#include "bladerunner/actor.h" #include "bladerunner/aud_stream.h" #include "bladerunner/audio_mixer.h" #include "bladerunner/bladerunner.h" @@ -30,7 +31,7 @@ namespace BladeRunner { -#define BUFFER_SIZE 200000 +const int AudioSpeech::kSpeechSamples[] = { 65, 355, 490, 465, 480, 485, 505, 760, 7655, 7770, 7740, 8170, 2705, 7200, 6460, 5560, 4870, 4555, 3880, 3525, 3595, 3250, 3070 }; void AudioSpeech::ended() { //Common::StackLock lock(_mutex); @@ -39,14 +40,15 @@ void AudioSpeech::ended() { } void AudioSpeech::mixerChannelEnded(int channel, void *data) { - AudioSpeech *audioSpeech = (AudioSpeech*)data; + AudioSpeech *audioSpeech = (AudioSpeech *)data; audioSpeech->ended(); } -AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) : _vm(vm) { - _volume = 50; +AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) { + _vm = vm; + _speechVolume = 50; _isActive = false; - _data = new byte[BUFFER_SIZE]; + _data = new byte[kBufferSize]; _channel = -1; } @@ -63,8 +65,8 @@ bool AudioSpeech::playSpeech(const char *name, int pan) { return false; } - if (r->size() > BUFFER_SIZE) { - warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), BUFFER_SIZE); + if (r->size() > kBufferSize) { + warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), kBufferSize); return false; } @@ -87,7 +89,7 @@ bool AudioSpeech::playSpeech(const char *name, int pan) { audioStream, 100, false, - _volume, + _speechVolume, pan, mixerChannelEnded, this); @@ -104,11 +106,23 @@ void AudioSpeech::stopSpeech() { } } -bool AudioSpeech::isPlaying() { +bool AudioSpeech::isPlaying() const { if (_channel == -1) { return false; } return _isActive; } +void AudioSpeech::setVolume(int volume) { + _speechVolume = volume; +} + +int AudioSpeech::getVolume() const { + return _speechVolume; +} + +void AudioSpeech::playSample() { + _vm->_playerActor->speechPlay(kSpeechSamples[_vm->_rnd.getRandomNumber(22)], true); +} + } // End of namespace BladeRunner diff --git a/engines/bladerunner/audio_speech.h b/engines/bladerunner/audio_speech.h index f3e4395d5d..5b94bc96d2 100644 --- a/engines/bladerunner/audio_speech.h +++ b/engines/bladerunner/audio_speech.h @@ -30,12 +30,15 @@ namespace BladeRunner { class BladeRunnerEngine; class AudioSpeech { - BladeRunnerEngine *_vm; + static const int kBufferSize = 200000; + static const int kSpeechSamples[]; - int _volume; - bool _isActive; - int _channel; - byte *_data; + BladeRunnerEngine *_vm; + + int _speechVolume; + bool _isActive; + int _channel; + byte *_data; public: AudioSpeech(BladeRunnerEngine *vm); @@ -43,8 +46,11 @@ public: bool playSpeech(const char *name, int balance = 0); void stopSpeech(); - bool isPlaying(); - void setVolume(int volume) { _volume = volume; } + bool isPlaying() const; + + void setVolume(int volume); + int getVolume() const; + void playSample(); private: void ended(); diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 653f159bb3..6f015d7044 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -23,7 +23,7 @@ #include "bladerunner/bladerunner.h" #include "bladerunner/actor.h" -#include "bladerunner/adq.h" +#include "bladerunner/actor_dialogue_queue.h" #include "bladerunner/ambient_sounds.h" #include "bladerunner/audio_mixer.h" #include "bladerunner/audio_player.h" @@ -32,10 +32,10 @@ #include "bladerunner/combat.h" #include "bladerunner/crimes_database.h" #include "bladerunner/dialogue_menu.h" -#include "bladerunner/elevator.h" #include "bladerunner/font.h" -#include "bladerunner/gameflags.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/game_constants.h" +#include "bladerunner/game_flags.h" +#include "bladerunner/game_info.h" #include "bladerunner/image.h" #include "bladerunner/item_pickup.h" #include "bladerunner/items.h" @@ -49,16 +49,20 @@ #include "bladerunner/scene.h" #include "bladerunner/scene_objects.h" #include "bladerunner/screen_effects.h" +#include "bladerunner/set.h" +#include "bladerunner/script/ai.h" #include "bladerunner/script/init.h" +#include "bladerunner/script/kia.h" #include "bladerunner/script/scene.h" -#include "bladerunner/script/ai.h" #include "bladerunner/settings.h" #include "bladerunner/shape.h" #include "bladerunner/slice_animations.h" #include "bladerunner/slice_renderer.h" -#include "bladerunner/spinner.h" #include "bladerunner/suspects_database.h" #include "bladerunner/text_resource.h" +#include "bladerunner/ui/elevator.h" +#include "bladerunner/ui/kia.h" +#include "bladerunner/ui/spinner.h" #include "bladerunner/vqa_decoder.h" #include "bladerunner/waypoints.h" #include "bladerunner/zbuffer.h" @@ -78,22 +82,11 @@ namespace BladeRunner { BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *desc) : Engine(syst), _rnd("bladerunner") { + _windowIsActive = true; _gameIsRunning = true; _playerLosesControlCounter = 0; - //TODO(peterkohaut): move these to init - - _crimesDatabase = nullptr; - _sceneScript = new SceneScript(this); - _settings = new Settings(this); - _lights = new Lights(this); - _screenEffects = new ScreenEffects(this, 0x8000); - _combat = new Combat(this); - _adq = new ADQ(this); - _obstacles = new Obstacles(this); - _itemPickup = new ItemPickup(this); - _playerActorIdle = false; _playerDead = false; _speechSkipped = false; @@ -106,6 +99,8 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des _walkSoundVolume = 0; _walkSoundBalance = 0; + _crimesDatabase = nullptr; + switch (desc->language) { case Common::EN_ANY: this->_languageCode = "E"; @@ -131,30 +126,6 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des } BladeRunnerEngine::~BladeRunnerEngine() { - // delete _sliceRenderer; - // delete _sliceAnimations; - // delete _settings; - // delete _script; - // delete _scene; - // delete[] _gameVars; - // delete _gameFlags; - // delete _gameInfo; - // delete _clues; - // delete _chapters; - // delete _audioSpeech; - // delete _audioPlayer; - // delete _ambientSounds; - - delete _zbuffer; - - delete _itemPickup; - delete _obstacles; - delete _adq; - delete _combat; - delete _screenEffects; - delete _lights; - delete _settings; - delete _sceneScript; } bool BladeRunnerEngine::hasFeature(EngineFeature f) const { @@ -185,10 +156,42 @@ Common::Error BladeRunnerEngine::run() { } bool BladeRunnerEngine::startup(bool hasSavegames) { + // These are static objects in original game + + _screenEffects = new ScreenEffects(this, 0x8000); + + _combat = new Combat(this); + + // TODO: end credits + + _actorDialogueQueue = new ActorDialogueQueue(this); + + // TODO: esper script + + _settings = new Settings(this); + + _itemPickup = new ItemPickup(this); + + _lights = new Lights(this); + + // TODO: outtake player - but this is done bit differently + + // TODO: police maze + + _obstacles = new Obstacles(this); + + // TODO: slice renderer shadow + + // TODO: voight-kampf script + + _sceneScript = new SceneScript(this); + + // This is the original startup in the game + bool r; - _surfaceGame.create(640, 480, createRGB555()); - _surfaceInterface.create(640, 480, createRGB555()); + _surfaceFront.create(640, 480, createRGB555()); + _surfaceBack.create(640, 480, createRGB555()); _surface4.create(640, 480, createRGB555()); r = openArchive("STARTUP.MIX"); @@ -272,12 +275,12 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { _zbuffer->init(640, 480); int actorCount = (int)_gameInfo->getActorCount(); - assert(actorCount < ACTORS_COUNT); + assert(actorCount < kActorCount); for (int i = 0; i != actorCount; ++i) { _actors[i] = new Actor(this, i); _actors[i]->setup(i); } - _actors[VOICEOVER_ACTOR] = new Actor(this, VOICEOVER_ACTOR); + _actors[kActorVoiceOver] = new Actor(this, kActorVoiceOver); _playerActor = _actors[_gameInfo->getPlayerId()]; _playerActor->setFPS(15); @@ -296,8 +299,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { if (!_textCrimes->open("CRIMES")) return false; - _textCluetype = new TextResource(this); - if (!_textCluetype->open("CLUETYPE")) + _textClueTypes = new TextResource(this); + if (!_textClueTypes->open("CLUETYPE")) return false; _textKIA = new TextResource(this); @@ -320,9 +323,9 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { if (!_dialogueMenu->loadText("DLGMENU")) return false; - _suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectsDatabaseSize()); + _suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectCount()); - // TODO: KIA + _kia = new KIA(this); _spinner = new Spinner(this); @@ -446,8 +449,8 @@ void BladeRunnerEngine::shutdown() { delete _textCrimes; _textCrimes = nullptr; - delete _textCluetype; - _textCluetype = nullptr; + delete _textClueTypes; + _textClueTypes = nullptr; delete _textKIA; _textKIA = nullptr; @@ -535,7 +538,8 @@ void BladeRunnerEngine::shutdown() { delete _spinner; _spinner = nullptr; - // TODO: Delete KIA + delete _kia; + _kia = nullptr; delete _suspectsDatabase; _suspectsDatabase = nullptr; @@ -547,8 +551,8 @@ void BladeRunnerEngine::shutdown() { delete _actors[i]; _actors[i] = nullptr; } - delete _actors[VOICEOVER_ACTOR]; - _actors[VOICEOVER_ACTOR] = nullptr; + delete _actors[kActorVoiceOver]; + _actors[kActorVoiceOver] = nullptr; _playerActor = nullptr; @@ -560,8 +564,8 @@ void BladeRunnerEngine::shutdown() { // TODO: Delete graphics surfaces here _surface4.free(); - _surfaceInterface.free(); - _surfaceGame.free(); + _surfaceBack.free(); + _surfaceFront.free(); if (isArchiveOpen("STARTUP.MIX")) { closeArchive("STARTUP.MIX"); @@ -570,6 +574,37 @@ void BladeRunnerEngine::shutdown() { // TODO: Delete MIXArchives here // TODO: Delete Timer + + + + // These are static objects in original game + + delete _zbuffer; + _zbuffer = nullptr; + + delete _itemPickup; + _itemPickup = nullptr; + + delete _obstacles; + _obstacles = nullptr; + + delete _actorDialogueQueue; + _actorDialogueQueue = nullptr; + + delete _combat; + _combat = nullptr; + + delete _screenEffects; + _screenEffects = nullptr; + + delete _lights; + _lights = nullptr; + + delete _settings; + _settings = nullptr; + + delete _sceneScript; + _sceneScript = nullptr; } bool BladeRunnerEngine::loadSplash() { @@ -578,9 +613,9 @@ bool BladeRunnerEngine::loadSplash() { return false; } - img.copyToSurface(&_surfaceGame); + img.copyToSurface(&_surfaceFront); - blitToScreen(_surfaceGame); + blitToScreen(_surfaceFront); return true; } @@ -589,7 +624,7 @@ bool BladeRunnerEngine::init2() { return true; } -Common::Point BladeRunnerEngine::getMousePos() { +Common::Point BladeRunnerEngine::getMousePos() const { return _eventMan->getMousePos(); } @@ -601,7 +636,7 @@ void BladeRunnerEngine::gameLoop() { } while (_gameIsRunning); } -#if _DEBUG +#if BLADERUNNER_DEBUG_RENDERING void drawBBox(Vector3 start, Vector3 end, View *view, Graphics::Surface *surface, int color) { Vector3 bfl = view->calculateScreenPosition(Vector3(start.x, start.y, start.z)); @@ -645,7 +680,10 @@ void BladeRunnerEngine::gameTick() { //probably not needed, this version of tick is just loading data from buffer //_audioMixer->tick(); - // TODO: Kia + if (_kia->_currentSectionId) { + _kia->tick(); + return; + } if (_spinner->isOpen()) { _spinner->tick(); @@ -664,7 +702,7 @@ void BladeRunnerEngine::gameTick() { // TODO: Scores - _adq->tick(); + _actorDialogueQueue->tick(); if (_scene->didPlayerWalkIn()) { _sceneScript->PlayerWalkedIn(); } @@ -685,10 +723,10 @@ void BladeRunnerEngine::gameTick() { backgroundChanged = true; } (void)backgroundChanged; - blit(_surfaceInterface, _surfaceGame); + blit(_surfaceBack, _surfaceFront); // TODO: remove zbuffer draw - // _surfaceGame.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480); + // _surfaceFront.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480); _overlays->tick(); @@ -725,11 +763,11 @@ void BladeRunnerEngine::gameTick() { if (_dialogueMenu->isVisible()) { _dialogueMenu->tick(p.x, p.y); - _dialogueMenu->draw(_surfaceGame); + _dialogueMenu->draw(_surfaceFront); } _mouse->tick(p.x, p.y); - _mouse->draw(_surfaceGame, p.x, p.y); + _mouse->draw(_surfaceFront, p.x, p.y); // TODO: Process AUD @@ -739,69 +777,69 @@ void BladeRunnerEngine::gameTick() { _walkSoundId = -1; } -#if 0 +#if BLADERUNNER_DEBUG_RENDERING //draw scene objects int count = _sceneObjects->_count; if (count > 0) { for (int i = 0; i < count; i++) { - SceneObject *sceneObject = &_sceneObjects->_sceneObjects[_sceneObjects->_sceneObjectsSortedByDistance[i]]; + SceneObjects::SceneObject *sceneObject = &_sceneObjects->_sceneObjects[_sceneObjects->_sceneObjectsSortedByDistance[i]]; - BoundingBox *bbox = &sceneObject->_boundingBox; + BoundingBox *bbox = &sceneObject->boundingBox; Vector3 a, b; bbox->getXYZ(&a.x, &a.y, &a.z, &b.x, &b.y, &b.z); Vector3 pos = _view->calculateScreenPosition(0.5 * (a + b)); int color; - switch (sceneObject->_sceneObjectType) { - case SceneObjectTypeActor: + switch (sceneObject->sceneObjectType) { + case kSceneObjectTypeActor: color = 0b111110000000000; - drawBBox(a, b, _view, &_surfaceGame, color); - _mainFont->drawColor(_textActorNames->getText(sceneObject->_sceneObjectId - SCENE_OBJECTS_ACTORS_OFFSET), _surfaceGame, pos.x, pos.y, color); + drawBBox(a, b, _view, &_surfaceFront, color); + _mainFont->drawColor(_textActorNames->getText(sceneObject->sceneObjectId - kSceneObjectOffsetActors), _surfaceFront, pos.x, pos.y, color); break; - case SceneObjectTypeItem: + case kSceneObjectTypeItem: char itemText[40]; - drawBBox(a, b, _view, &_surfaceGame, color); - sprintf(itemText, "item %i", sceneObject->_sceneObjectId - SCENE_OBJECTS_ITEMS_OFFSET); - _mainFont->drawColor(itemText, _surfaceGame, pos.x, pos.y, color); + drawBBox(a, b, _view, &_surfaceFront, color); + sprintf(itemText, "item %i", sceneObject->sceneObjectId - kSceneObjectOffsetItems); + _mainFont->drawColor(itemText, _surfaceFront, pos.x, pos.y, color); break; - case SceneObjectTypeObject: + case kSceneObjectTypeObject: color = 0b011110111101111; //if (sceneObject->_isObstacle) // color += 0b100000000000000; - if (sceneObject->_isClickable) { + if (sceneObject->isClickable) { color = 0b000001111100000; } - drawBBox(a, b, _view, &_surfaceGame, color); - _mainFont->drawColor(_scene->objectGetName(sceneObject->_sceneObjectId - SCENE_OBJECTS_OBJECTS_OFFSET), _surfaceGame, pos.x, pos.y, color); + drawBBox(a, b, _view, &_surfaceFront, color); + _mainFont->drawColor(_scene->objectGetName(sceneObject->sceneObjectId - kSceneObjectOffsetObjects), _surfaceFront, pos.x, pos.y, color); break; } - _surfaceGame.frameRect(sceneObject->_screenRectangle, color); + _surfaceFront.frameRect(sceneObject->screenRectangle, color); } } //draw regions for (int i = 0; i < 10; i++) { - Region *region = &_scene->_regions->_regions[i]; - if (!region->_present) continue; - _surfaceGame.frameRect(region->_rectangle, 0b000000000011111); + Regions::Region *region = &_scene->_regions->_regions[i]; + if (!region->present) continue; + _surfaceFront.frameRect(region->rectangle, 0b000000000011111); } for (int i = 0; i < 10; i++) { - Region *region = &_scene->_exits->_regions[i]; - if (!region->_present) continue; - _surfaceGame.frameRect(region->_rectangle, 0b111111111111111); + Regions::Region *region = &_scene->_exits->_regions[i]; + if (!region->present) continue; + _surfaceFront.frameRect(region->rectangle, 0b111111111111111); } //draw walkboxes for (int i = 0; i < _scene->_set->_walkboxCount; i++) { - Walkbox *walkbox = &_scene->_set->_walkboxes[i]; + Set::Walkbox *walkbox = &_scene->_set->_walkboxes[i]; - for (int j = 0; j < walkbox->_vertexCount; j++) { - Vector3 start = _view->calculateScreenPosition(walkbox->_vertices[j]); - Vector3 end = _view->calculateScreenPosition(walkbox->_vertices[(j + 1) % walkbox->_vertexCount]); - _surfaceGame.drawLine(start.x, start.y, end.x, end.y, 0b111111111100000); + for (int j = 0; j < walkbox->vertexCount; j++) { + Vector3 start = _view->calculateScreenPosition(walkbox->vertices[j]); + Vector3 end = _view->calculateScreenPosition(walkbox->vertices[(j + 1) % walkbox->vertexCount]); + _surfaceFront.drawLine(start.x, start.y, end.x, end.y, 0b111111111100000); Vector3 pos = _view->calculateScreenPosition(0.5 * (start + end)); - _mainFont->drawColor(walkbox->_name, _surfaceGame, pos.x, pos.y, 0b111111111100000); + _mainFont->drawColor(walkbox->name, _surfaceFront, pos.x, pos.y, 0b111111111100000); } } @@ -827,30 +865,30 @@ void BladeRunnerEngine::gameTick() { int colorB = (light->_color.b * 31.0f); int color = (colorR << 10) + (colorG << 5) + colorB; - drawBBox(posOrigin - size, posOrigin + size, _view, &_surfaceGame, color); + drawBBox(posOrigin - size, posOrigin + size, _view, &_surfaceFront, color); Vector3 posOriginT = _view->calculateScreenPosition(posOrigin); Vector3 posTargetT = _view->calculateScreenPosition(posTarget); - _surfaceGame.drawLine(posOriginT.x, posOriginT.y, posTargetT.x, posTargetT.y, color); - _mainFont->drawColor(light->_name, _surfaceGame, posOriginT.x, posOriginT.y, color); + _surfaceFront.drawLine(posOriginT.x, posOriginT.y, posTargetT.x, posTargetT.y, color); + _mainFont->drawColor(light->_name, _surfaceFront, posOriginT.x, posOriginT.y, color); } //draw waypoints for(int i = 0; i < _waypoints->_count; i++) { - Waypoint *waypoint = &_waypoints->_waypoints[i]; - if(waypoint->_setId != _scene->getSetId()) + Waypoints::Waypoint *waypoint = &_waypoints->_waypoints[i]; + if(waypoint->setId != _scene->getSetId()) continue; - Vector3 pos = waypoint->_position; + Vector3 pos = waypoint->position; Vector3 size = Vector3(5.0f, 5.0f, 5.0f); int color = 0b111111111111111; - drawBBox(pos - size, pos + size, _view, &_surfaceGame, color); + drawBBox(pos - size, pos + size, _view, &_surfaceFront, color); Vector3 spos = _view->calculateScreenPosition(pos); char waypointText[40]; sprintf(waypointText, "waypoint %i", i); - _mainFont->drawColor(waypointText, _surfaceGame, spos.x, spos.y, color); + _mainFont->drawColor(waypointText, _surfaceFront, spos.x, spos.y, color); } #endif -#if 0 +#if BLADERUNNER_DEBUG_RENDERING //draw aesc for (uint i = 0; i < _screenEffects->_entries.size(); i++) { ScreenEffects::Entry &entry = _screenEffects->_entries[i]; @@ -868,13 +906,13 @@ void BladeRunnerEngine::gameTick() { CLIP(color.r * bladeToScummVmConstant, 0, 255), CLIP(color.g * bladeToScummVmConstant, 0, 255), CLIP(color.b * bladeToScummVmConstant, 0, 255)); - _surfaceGame.fillRect(r, color555); + _surfaceFront.fillRect(r, color555); } } } #endif - blitToScreen(_surfaceGame); + blitToScreen(_surfaceFront); _system->delayMillis(10); } } @@ -936,14 +974,48 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) { if (event.kbd.keycode == Common::KEYCODE_RETURN) { _speechSkipped = true; } + + // TODO(peterkohaut): + if (!playerHasControl() /*|| ActorInWalkingLoop*/) { + return; + } + + if (_kia->_currentSectionId) { + _kia->handleKeyUp(event.kbd); + return; + } + + if (event.kbd.keycode == Common::KEYCODE_TAB) { + _kia->openLastOpened(); + } else if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { + _kia->openOptions(); + } else if (event.kbd.keycode == Common::KEYCODE_SPACE) { + // TODO(peterkohaut): + // combat::switchCombatMode(&Combat); + } } void BladeRunnerEngine::handleKeyDown(Common::Event &event) { + // if ( PlayerHasControl <= 0 && ActorWalkingLoop != 1 && PlayingSpeechLine != 1 && VqaIsPlaying != 1 ) { + if (_kia->_currentSectionId) { + _kia->handleKeyDown(event.kbd); + } + // } } void BladeRunnerEngine::handleMouseAction(int x, int y, bool buttonLeft, bool buttonDown) { - if (!playerHasControl() || _mouse->isDisabled()) + if (!playerHasControl() || _mouse->isDisabled()) { return; + } + + if (_kia->_currentSectionId) { + if (buttonDown) { + _kia->handleMouseDown(x, y, buttonLeft); + } else { + _kia->handleMouseUp(x, y, buttonLeft); + } + return; + } if (_spinner->isOpen()) { if (buttonDown) { @@ -1086,14 +1158,16 @@ bool BladeRunnerEngine::openArchive(const Common::String &name) { // If archive is already open, return true for (i = 0; i != kArchiveCount; ++i) { - if (_archives[i].isOpen() && _archives[i].getName() == name) + if (_archives[i].isOpen() && _archives[i].getName() == name) { return true; + } } // Find first available slot for (i = 0; i != kArchiveCount; ++i) { - if (!_archives[i].isOpen()) + if (!_archives[i].isOpen()) { break; + } } if (i == kArchiveCount) { /* TODO: BLADE.EXE retires the least recently used @@ -1108,7 +1182,7 @@ bool BladeRunnerEngine::openArchive(const Common::String &name) { } bool BladeRunnerEngine::closeArchive(const Common::String &name) { - for (uint i = 0; i != 10; ++i) { + for (uint i = 0; i != kArchiveCount; ++i) { if (_archives[i].isOpen() && _archives[i].getName() == name) { _archives[i].close(); return true; @@ -1119,8 +1193,8 @@ bool BladeRunnerEngine::closeArchive(const Common::String &name) { return false; } -bool BladeRunnerEngine::isArchiveOpen(const Common::String &name) { - for (uint i = 0; i != 10; ++i) { +bool BladeRunnerEngine::isArchiveOpen(const Common::String &name) const { + for (uint i = 0; i != kArchiveCount; ++i) { if (_archives[i].isOpen() && _archives[i].getName() == name) return true; } @@ -1129,7 +1203,7 @@ bool BladeRunnerEngine::isArchiveOpen(const Common::String &name) { } Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::String &name) { - for (uint i = 0; i != 10; ++i) { + for (uint i = 0; i != kArchiveCount; ++i) { if (!_archives[i].isOpen()) { continue; } diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 208c245e25..01636e8949 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -33,6 +33,9 @@ #include "graphics/surface.h" +#define BLADERUNNER_DEBUG_RENDERING 0 +#define BLADERUNNER_DEBUG_CONSOLE 0 + namespace Common { struct Event; } @@ -58,7 +61,7 @@ enum SceneLoopMode { }; class Actor; -class ADQ; +class ActorDialogueQueue; class ScreenEffects; class AIScripts; class AmbientSounds; @@ -75,6 +78,7 @@ class GameFlags; class GameInfo; class ItemPickup; class Items; +class KIA; class Lights; class Mouse; class Music; @@ -90,72 +94,75 @@ class SliceRenderer; class Spinner; class SuspectsDatabase; class TextResource; +class KIAShapes; class Vector3; class View; class Waypoints; class ZBuffer; -#define ACTORS_COUNT 100 -#define VOICEOVER_ACTOR (ACTORS_COUNT - 1) - class BladeRunnerEngine : public Engine { public: + static const int kArchiveCount = 10; + static const int kActorCount = 100; + static const int kActorVoiceOver = kActorCount - 1; + bool _gameIsRunning; bool _windowIsActive; int _playerLosesControlCounter; const char *_languageCode; - ADQ *_adq; - ScreenEffects *_screenEffects; - AIScripts *_aiScripts; - AmbientSounds *_ambientSounds; - AudioMixer *_audioMixer; - AudioPlayer *_audioPlayer; - AudioSpeech *_audioSpeech; - Chapters *_chapters; - CrimesDatabase *_crimesDatabase; - Combat *_combat; - DialogueMenu *_dialogueMenu; - Elevator *_elevator; - GameFlags *_gameFlags; - GameInfo *_gameInfo; - ItemPickup *_itemPickup; - Items *_items; - Lights *_lights; - Font *_mainFont; - Mouse *_mouse; - Music *_music; - Obstacles *_obstacles; - Overlays *_overlays; - Scene *_scene; - SceneObjects *_sceneObjects; - SceneScript *_sceneScript; - Settings *_settings; - SliceAnimations *_sliceAnimations; - SliceRenderer *_sliceRenderer; - Spinner *_spinner; - SuspectsDatabase *_suspectsDatabase; - View *_view; - Waypoints *_waypoints; - int *_gameVars; - - TextResource *_textActorNames; - TextResource *_textCrimes; - TextResource *_textCluetype; - TextResource *_textKIA; - TextResource *_textSpinnerDestinations; - TextResource *_textVK; - TextResource *_textOptions; + ActorDialogueQueue *_actorDialogueQueue; + ScreenEffects *_screenEffects; + AIScripts *_aiScripts; + AmbientSounds *_ambientSounds; + AudioMixer *_audioMixer; + AudioPlayer *_audioPlayer; + AudioSpeech *_audioSpeech; + Chapters *_chapters; + CrimesDatabase *_crimesDatabase; + Combat *_combat; + DialogueMenu *_dialogueMenu; + Elevator *_elevator; + GameFlags *_gameFlags; + GameInfo *_gameInfo; + ItemPickup *_itemPickup; + Items *_items; + KIA *_kia; + Lights *_lights; + Font *_mainFont; + Mouse *_mouse; + Music *_music; + Obstacles *_obstacles; + Overlays *_overlays; + Scene *_scene; + SceneObjects *_sceneObjects; + SceneScript *_sceneScript; + Settings *_settings; + SliceAnimations *_sliceAnimations; + SliceRenderer *_sliceRenderer; + Spinner *_spinner; + SuspectsDatabase *_suspectsDatabase; + View *_view; + Waypoints *_waypoints; + int *_gameVars; + + TextResource *_textActorNames; + TextResource *_textCrimes; + TextResource *_textClueTypes; + TextResource *_textKIA; + TextResource *_textSpinnerDestinations; + TextResource *_textVK; + TextResource *_textOptions; Common::Array _shapes; - Actor *_actors[ACTORS_COUNT]; + Actor *_actors[kActorCount]; Actor *_playerActor; int in_script_counter; - Graphics::Surface _surfaceGame; - Graphics::Surface _surfaceInterface; + Graphics::Surface _surfaceFront; + Graphics::Surface _surfaceBack; Graphics::Surface _surface4; ZBuffer *_zbuffer; @@ -174,8 +181,8 @@ public: int _walkSoundVolume; int _walkSoundBalance; int _walkingActorId; + private: - static const uint kArchiveCount = 10; MIXArchive _archives[kArchiveCount]; public: @@ -193,7 +200,7 @@ public: bool loadSplash(); bool init2(); - Common::Point getMousePos(); + Common::Point getMousePos() const; void gameLoop(); void gameTick(); @@ -215,7 +222,7 @@ public: bool openArchive(const Common::String &name); bool closeArchive(const Common::String &name); - bool isArchiveOpen(const Common::String &name); + bool isArchiveOpen(const Common::String &name) const; Common::SeekableReadStream *getResourceStream(const Common::String &name); diff --git a/engines/bladerunner/boundingbox.cpp b/engines/bladerunner/boundingbox.cpp index 029442668f..f7e7eca190 100644 --- a/engines/bladerunner/boundingbox.cpp +++ b/engines/bladerunner/boundingbox.cpp @@ -44,7 +44,7 @@ void BoundingBox::expand(float x0, float y0, float z0, float x1, float y1, float _vertices[1].z += z1; } -bool BoundingBox::inside(float x, float y, float z) { +bool BoundingBox::inside(float x, float y, float z) const { return x >= _vertices[0].x && x <= _vertices[1].x && y >= _vertices[0].y && y <= _vertices[1].y && z >= _vertices[0].z && z <= _vertices[1].z; @@ -60,7 +60,7 @@ void BoundingBox::setXYZ(float x0, float y0, float z0, float x1, float y1, float _vertices[1].z = z1; } -void BoundingBox::getXYZ(float *x0, float *y0, float *z0, float *x1, float *y1, float *z1) { +void BoundingBox::getXYZ(float *x0, float *y0, float *z0, float *x1, float *y1, float *z1) const { *x0 = _vertices[0].x; *y0 = _vertices[0].y; *z0 = _vertices[0].z; @@ -70,11 +70,11 @@ void BoundingBox::getXYZ(float *x0, float *y0, float *z0, float *x1, float *y1, *z1 = _vertices[1].z; } -float BoundingBox::getZ0() { +float BoundingBox::getZ0() const { return _vertices[0].z; } -float BoundingBox::getZ1() { +float BoundingBox::getZ1() const { return _vertices[1].z; } diff --git a/engines/bladerunner/boundingbox.h b/engines/bladerunner/boundingbox.h index da91489f25..3f42318cde 100644 --- a/engines/bladerunner/boundingbox.h +++ b/engines/bladerunner/boundingbox.h @@ -35,13 +35,13 @@ public: BoundingBox(float x0, float y0, float z0, float x1, float y1, float z1); void expand(float x0, float y0, float z0, float x1, float y1, float z1); - bool inside(float x, float y, float z); + bool inside(float x, float y, float z) const; void setXYZ(float x0, float y0, float z0, float x1, float y1, float z1); - void getXYZ(float* x0, float *y0, float* z0, float *x1, float* y1, float* z1); + void getXYZ(float *x0, float *y0, float *z0, float *x1, float *y1, float *z1) const; - float getZ0(); - float getZ1(); + float getZ0() const; + float getZ1() const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/chapters.h b/engines/bladerunner/chapters.h index 5d4da5713d..96b2d48179 100644 --- a/engines/bladerunner/chapters.h +++ b/engines/bladerunner/chapters.h @@ -35,7 +35,8 @@ class Chapters { bool _hasOpenResources; public: - Chapters(BladeRunnerEngine *vm) : _vm(vm), _chapter(0) { + Chapters(BladeRunnerEngine *vm) { + _vm = vm; _chapter = 0; _resourceIds[0] = 1; diff --git a/engines/bladerunner/combat.cpp b/engines/bladerunner/combat.cpp index 79ea2ad7bf..79491e702a 100644 --- a/engines/bladerunner/combat.cpp +++ b/engines/bladerunner/combat.cpp @@ -22,14 +22,14 @@ #include "bladerunner/combat.h" -#include "bladerunner/bladerunner.h" #include "bladerunner/actor.h" +#include "bladerunner/bladerunner.h" #include "bladerunner/settings.h" namespace BladeRunner { -Combat::Combat(BladeRunnerEngine* vm) { +Combat::Combat(BladeRunnerEngine *vm) { _vm = vm; _active = false; @@ -74,12 +74,20 @@ void Combat::disable() { _enabled = false; } -void Combat::setHitSoundId(int row, int column, int soundId) { - _hitSoundId[row * 3 + column] = soundId; +void Combat::setHitSound(int ammoType, int column, int soundId) { + _hitSoundId[ammoType * 3 + column] = soundId; +} + +void Combat::setMissSound(int ammoType, int column, int soundId) { + _missSoundId[ammoType * 3 + column] = soundId; +} + +int Combat::getHitSound() { + return _hitSoundId[3 * _vm->_settings->getAmmoType() + _vm->_rnd.getRandomNumber(2)]; } -void Combat::setMissSoundId(int row, int column, int soundId) { - _missSoundId[row * 3 + column] = soundId; +int Combat::getMissSound() { + return _hitSoundId[3 * _vm->_settings->getAmmoType() + _vm->_rnd.getRandomNumber(2)]; } } // End of namespace BladeRunner diff --git a/engines/bladerunner/combat.h b/engines/bladerunner/combat.h index abb2a328ba..8f0119a854 100644 --- a/engines/bladerunner/combat.h +++ b/engines/bladerunner/combat.h @@ -51,8 +51,10 @@ public: void enable(); void disable(); - void setHitSoundId(int row, int column, int soundId); - void setMissSoundId(int row, int column, int soundId); + void setHitSound(int ammoType, int column, int soundId); + void setMissSound(int ammoType, int column, int soundId); + int getHitSound(); + int getMissSound(); }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/crimes_database.cpp b/engines/bladerunner/crimes_database.cpp index 0caa683665..c309005d28 100644 --- a/engines/bladerunner/crimes_database.cpp +++ b/engines/bladerunner/crimes_database.cpp @@ -28,32 +28,30 @@ namespace BladeRunner { -CrimesDatabase::CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount) : _crimesCount(crimesCount) { - // reset(); +CrimesDatabase::CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimeCount) { + _crimeCount = crimeCount; - _crimes = new int[_crimesCount]; - _assetTypes = new int[_crimesCount]; + _crimes.resize(_crimeCount); + _assetTypes.resize(_crimeCount); _cluesText = new TextResource(vm); _cluesText->open(cluesResource); - for (int i = 0; i != _crimesCount; ++i) { + for (int i = 0; i != _crimeCount; ++i) { _crimes[i] = -1; _assetTypes[i] = -1; } } CrimesDatabase::~CrimesDatabase() { - delete _cluesText; - delete[] _assetTypes; - delete[] _crimes; + delete _cluesText; } void CrimesDatabase::setCrime(int clueId, int crimeId) { _crimes[clueId] = crimeId; } -int CrimesDatabase::getCrime(int clueId) { +int CrimesDatabase::getCrime(int clueId) const { return _crimes[clueId]; } @@ -61,11 +59,11 @@ void CrimesDatabase::setAssetType(int clueId, int assetType) { _assetTypes[clueId] = assetType; } -int CrimesDatabase::getAssetType(int clueId) { +int CrimesDatabase::getAssetType(int clueId) const { return _assetTypes[clueId]; } -const char *CrimesDatabase::getClueText(int clueId) { +const char *CrimesDatabase::getClueText(int clueId) const { return _cluesText->getText(clueId); } diff --git a/engines/bladerunner/crimes_database.h b/engines/bladerunner/crimes_database.h index 830b58db67..40e46cb356 100644 --- a/engines/bladerunner/crimes_database.h +++ b/engines/bladerunner/crimes_database.h @@ -23,28 +23,30 @@ #ifndef BLADERUNNER_CRIMES_DATABASE_H #define BLADERUNNER_CRIMES_DATABASE_H +#include "common/array.h" + namespace BladeRunner { class BladeRunnerEngine; class TextResource; class CrimesDatabase { - int _crimesCount; - int *_crimes; - int *_assetTypes; - TextResource *_cluesText; + int _crimeCount; + Common::Array _crimes; + Common::Array _assetTypes; + TextResource *_cluesText; public: - CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount); + CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimeCount); ~CrimesDatabase(); void setCrime(int clueId, int crimeId); - int getCrime(int clueId); + int getCrime(int clueId) const; void setAssetType(int clueId, int assetType); - int getAssetType(int clueId); + int getAssetType(int clueId) const; - const char *getClueText(int clueId); + const char *getClueText(int clueId) const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp index e13e69cbd0..2d55deee3f 100644 --- a/engines/bladerunner/dialogue_menu.cpp +++ b/engines/bladerunner/dialogue_menu.cpp @@ -33,14 +33,10 @@ #include "common/rect.h" #include "common/util.h" -#define LINE_HEIGHT 9 -#define BORDER_SIZE 10 - namespace BladeRunner { -DialogueMenu::DialogueMenu(BladeRunnerEngine *vm) - : _vm(vm) -{ +DialogueMenu::DialogueMenu(BladeRunnerEngine *vm) { + _vm = vm; reset(); _textResource = new TextResource(_vm); _shapes.reserve(8); @@ -56,7 +52,7 @@ DialogueMenu::~DialogueMenu() { delete _textResource; } -bool DialogueMenu::loadText(const char *name) { +bool DialogueMenu::loadText(const Common::String &name) { bool r = _textResource->open(name); if (!r) { error("Failed to load dialogue menu text"); @@ -104,15 +100,15 @@ bool DialogueMenu::clearList() { } bool DialogueMenu::addToList(int answer, bool done, int priorityPolite, int priorityNormal, int prioritySurly) { - if (_listSize >= 10) { + if (_listSize >= kMaxItems) { return false; } if (getAnswerIndex(answer) != -1) { return false; } - const char *text = _textResource->getText(answer); - if (!text || strlen(text) >= 50) { + const Common::String &text = _textResource->getText(answer); + if (text.empty() || text.size() >= 50) { return false; } @@ -145,8 +141,9 @@ bool DialogueMenu::addToListNeverRepeatOnceSelected(int answer, int priorityPoli } int DialogueMenu::queryInput() { - if (!_isVisible || _listSize == 0) + if (!_isVisible || _listSize == 0) { return -1; + } int answer = -1; if (_listSize == 1) { @@ -230,15 +227,15 @@ int DialogueMenu::queryInput() { return answer; } -int DialogueMenu::listSize() { +int DialogueMenu::listSize() const { return _listSize; } -bool DialogueMenu::isVisible() { +bool DialogueMenu::isVisible() const { return _isVisible; } -bool DialogueMenu::isOpen() { +bool DialogueMenu::isOpen() const { return _isVisible || _waitingForInput; } @@ -247,7 +244,7 @@ void DialogueMenu::tick(int x, int y) { return; } - int line = (y - (_screenY + BORDER_SIZE)) / LINE_HEIGHT; + int line = (y - (_screenY + kBorderSize)) / kLineHeight; line = CLIP(line, 0, _listSize - 1); _selectedItemIndex = line; @@ -289,13 +286,13 @@ void DialogueMenu::draw(Graphics::Surface &s) { const int x1 = _screenX; const int y1 = _screenY; - const int x2 = _screenX + BORDER_SIZE + _maxItemWidth; - const int y2 = _screenY + BORDER_SIZE + _listSize * LINE_HEIGHT; + const int x2 = _screenX + kBorderSize + _maxItemWidth; + const int y2 = _screenY + kBorderSize + _listSize * kLineHeight; darkenRect(s, x1 + 8, y1 + 8, x2 + 2, y2 + 2); - int x = x1 + BORDER_SIZE; - int y = y1 + BORDER_SIZE; + int x = x1 + kBorderSize; + int y = y1 + kBorderSize; Common::Point mouse = _vm->getMousePos(); if (mouse.x >= x && mouse.x < x2) { @@ -315,7 +312,7 @@ void DialogueMenu::draw(Graphics::Surface &s) { _shapes[4].draw(s, x2, y); uint16 color = ((_items[i].colorIntensity >> 1) << 10) | ((_items[i].colorIntensity >> 1) << 6) | _items[i].colorIntensity; _vm->_mainFont->drawColor(_items[i].text, s, x, y, color); - y += LINE_HEIGHT; + y += kLineHeight; } for (; x != x2; ++x) { _shapes[6].draw(s, x, y1); @@ -323,7 +320,7 @@ void DialogueMenu::draw(Graphics::Surface &s) { } } -int DialogueMenu::getAnswerIndex(int answer) { +int DialogueMenu::getAnswerIndex(int answer) const { for (int i = 0; i != _listSize; ++i) { if (_items[i].answerValue == answer) { return i; @@ -333,7 +330,7 @@ int DialogueMenu::getAnswerIndex(int answer) { return -1; } -const char *DialogueMenu::getText(int id) { +const char *DialogueMenu::getText(int id) const { return _textResource->getText((uint32)id); } @@ -344,8 +341,8 @@ void DialogueMenu::calculatePosition(int unusedX, int unusedY) { } _maxItemWidth += 2; - int w = BORDER_SIZE + _shapes[4].getWidth() + _maxItemWidth; - int h = BORDER_SIZE + _shapes[7].getHeight() + LINE_HEIGHT * _listSize; + int w = kBorderSize + _shapes[4].getWidth() + _maxItemWidth; + int h = kBorderSize + _shapes[7].getHeight() + kLineHeight * _listSize; _screenX = _centerX - w / 2; _screenY = _centerY - h / 2; @@ -361,7 +358,7 @@ void DialogueMenu::mouseUp() { _waitingForInput = false; } -bool DialogueMenu::waitingForInput() { +bool DialogueMenu::waitingForInput() const { return _waitingForInput; } @@ -370,7 +367,7 @@ void DialogueMenu::clear() { _waitingForInput = false; _selectedItemIndex = 0; _listSize = 0; - for (int i = 0; i != 10; ++i) { + for (int i = 0; i != kMaxItems; ++i) { _items[i].text.clear(); _items[i].answerValue = -1; _items[i].isDone = 0; @@ -380,7 +377,7 @@ void DialogueMenu::clear() { _items[i].colorIntensity = 0; } _neverRepeatListSize = 0; - for (int i = 0; i != 100; ++i) { + for (int i = 0; i != kMaxRepeatHistory; ++i) { _neverRepeatValues[i] = -1; _neverRepeatWasSelected[i] = false; } @@ -402,7 +399,7 @@ void DialogueMenu::darkenRect(Graphics::Surface &s, int x1, int y1, int x2, int if (x1 < x2 && y1 < y2) { for (int y = y1; y != y2; ++y) { for (int x = x1; x != x2; ++x) { - uint16 *p = (uint16*)s.getBasePtr(x, y); + uint16 *p = (uint16 *)s.getBasePtr(x, y); *p = (*p & 0x739C) >> 1; // 0 11100 11100 11100 } } diff --git a/engines/bladerunner/dialogue_menu.h b/engines/bladerunner/dialogue_menu.h index 61ddcf1ae0..63e23d8ada 100644 --- a/engines/bladerunner/dialogue_menu.h +++ b/engines/bladerunner/dialogue_menu.h @@ -35,17 +35,22 @@ namespace BladeRunner { class BladeRunnerEngine; class TextResource; -struct DialogueItem { - Common::String text; - int answerValue; - int colorIntensity; - int priorityPolite; - int priorityNormal; - int prioritySurly; - int isDone; -}; - class DialogueMenu { + static const int kMaxItems = 10; + static const int kMaxRepeatHistory = 100; + static const int kLineHeight = 9; + static const int kBorderSize = 10; + + struct DialogueItem { + Common::String text; + int answerValue; + int colorIntensity; + int priorityPolite; + int priorityNormal; + int prioritySurly; + int isDone; + }; + BladeRunnerEngine *_vm; TextResource *_textResource; @@ -58,15 +63,15 @@ class DialogueMenu { // These track whether a dialogue option // has previously been selected int _neverRepeatListSize; - int _neverRepeatValues[100]; - bool _neverRepeatWasSelected[100]; + int _neverRepeatValues[kMaxRepeatHistory]; + bool _neverRepeatWasSelected[kMaxRepeatHistory]; int _centerX; int _centerY; int _screenX; int _screenY; int _maxItemWidth; - DialogueItem _items[10]; + DialogueItem _items[kMaxItems]; int _fadeInItemIndex; @@ -74,7 +79,7 @@ public: DialogueMenu(BladeRunnerEngine *vm); ~DialogueMenu(); - bool loadText(const char *name); + bool loadText(const Common::String &name); bool show(); bool hide(); @@ -82,22 +87,21 @@ public: bool addToListNeverRepeatOnceSelected(int answer, int priorityPolite, int priorityNormal, int prioritySurly); bool clearList(); int queryInput(); - int listSize(); - bool isVisible(); - bool isOpen(); + int listSize() const; + bool isVisible() const; + bool isOpen() const; void tick(int x, int y); void draw(Graphics::Surface &s); void mouseUp(); - bool waitingForInput(); + bool waitingForInput() const; private: bool showAt(int x, int y); - int getAnswerIndex(int answer); - const char *getText(int id); + int getAnswerIndex(int answer) const; + const char *getText(int id) const; void calculatePosition(int unusedX = 0, int unusedY = 0); - void clear(); void reset(); diff --git a/engines/bladerunner/elevator.cpp b/engines/bladerunner/elevator.cpp deleted file mode 100644 index 99f3160141..0000000000 --- a/engines/bladerunner/elevator.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "bladerunner/elevator.h" - -#include "bladerunner/bladerunner.h" - -#include "bladerunner/actor.h" -#include "bladerunner/audio_player.h" -#include "bladerunner/gameinfo.h" -#include "bladerunner/mouse.h" -#include "bladerunner/shape.h" -#include "bladerunner/script/script.h" -#include "bladerunner/ui_image_picker.h" -#include "bladerunner/vqa_player.h" - -#include "common/rect.h" -#include "common/str.h" -#include "common/system.h" - -namespace BladeRunner { - -Elevator::Elevator(BladeRunnerEngine *vm) : _vm(vm) { - reset(); - _imagePicker = new UIImagePicker(vm, 8); -} - -Elevator::~Elevator() { - delete _imagePicker; - reset(); -} - -void elevator_mouseInCallback(int, void*); -void elevator_mouseOutCallback(int, void*); -void elevator_mouseDownCallback(int, void*); -void elevator_mouseUpCallback(int, void*); - -int Elevator::activate(int elevatorId) { - const char *vqaName; - - if (elevatorId == 1) { - _buttonClicked = 3; - vqaName = "MA06ELEV.VQA"; - } else if (elevatorId == 2) { - _buttonClicked = 1; - vqaName = "PS02ELEV.VQA"; - } else { - error("Invalid elevator id"); - } - - if (!_vm->openArchive("MODE.MIX")) - return 0; - - _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceInterface); - if (!_vqaPlayer->open(vqaName)) { - return 0; - } - - _vqaPlayer->setLoop(1, -1, kLoopSetModeJustStart, nullptr, nullptr); - _vm->_mouse->setCursor(0); - - for (int i = 0; i != 16; ++i) { - _shapes.push_back(new Shape(_vm)); - _shapes[i]->readFromContainer("ELEVATOR.SHP", i); - } - - _imagePicker->resetImages(); - - if (elevatorId == 1) { - _imagePicker->defineImage( - 0, - Common::Rect(220, 298, 308, 392), - nullptr, - _shapes[11], - _shapes[14], - nullptr); - _imagePicker->defineImage( - 1, - Common::Rect(259, 259, 302, 292), - nullptr, - _shapes[10], - _shapes[13], - nullptr); - _imagePicker->defineImage( - 2, - Common::Rect(227, 398, 301, 434), - nullptr, - _shapes[12], - _shapes[15], - nullptr); - } else { - _imagePicker->defineImage( - 4, - Common::Rect(395, 131, 448, 164), - nullptr, - _shapes[0], - _shapes[5], - nullptr - ); - _imagePicker->defineImage( - 3, - Common::Rect(395, 165, 448, 198), - nullptr, - _shapes[1], - _shapes[6], - nullptr - ); - _imagePicker->defineImage( - 5, - Common::Rect(395, 199, 448, 232), - nullptr, - _shapes[2], - _shapes[7], - nullptr - ); - _imagePicker->defineImage( - 6, - Common::Rect(395, 233, 448, 264), - nullptr, - _shapes[3], - _shapes[8], - nullptr - ); - _imagePicker->defineImage( - 7, - Common::Rect(395, 265, 448, 295), - nullptr, - _shapes[4], - _shapes[9], - nullptr - ); - } - - _imagePicker->activate( - elevator_mouseInCallback, - elevator_mouseOutCallback, - elevator_mouseDownCallback, - elevator_mouseUpCallback, - this - ); - - open(); - - // TODO: time->lock(); - - _buttonClicked = -1; - do { - _vm->gameTick(); - } while (_buttonClicked == -1); - - _imagePicker->deactivate(); - - _vqaPlayer->close(); - delete _vqaPlayer; - - for (int i = 0; i != (int)_shapes.size(); ++i) { - delete _shapes[i]; - } - _shapes.clear(); - - _vm->closeArchive("MODE.MIX"); - - _isOpen = false; - - // TODO: time->unlock(); - - return _buttonClicked; -} - -void Elevator::open() { - resetDescription(); - _isOpen = true; -} - -bool Elevator::isOpen() const { - return _isOpen; -} - -int Elevator::handleMouseUp(int x, int y) { - _imagePicker->handleMouseAction(x, y, false, true, false); - return false; -} - -int Elevator::handleMouseDown(int x, int y) { - _imagePicker->handleMouseAction(x, y, true, false, false); - return false; -} - -void Elevator::tick() { - if (!_vm->_gameIsRunning) { - return; - } - - int frame = _vqaPlayer->update(); - assert(frame >= -1); - - // vqaPlayer renders to _surfaceInterface - blit(_vm->_surfaceInterface, _vm->_surfaceGame); - - Common::Point p = _vm->getMousePos(); - - // TODO(madmoose): BLADE.EXE has hasHoveredImage before handleMouseAction? - _imagePicker->handleMouseAction(p.x, p.y, false, false, false); - if (_imagePicker->hasHoveredImage()) { - _vm->_mouse->setCursor(1); - } else { - _vm->_mouse->setCursor(0); - } - - _imagePicker->draw(_vm->_surfaceGame); - _vm->_mouse->draw(_vm->_surfaceGame, p.x, p.y); - - _vm->blitToScreen(_vm->_surfaceGame); - tickDescription(); - _vm->_system->delayMillis(10); -} - -void Elevator::buttonClick(int buttonId) { - _buttonClicked = buttonId; -} - -void Elevator::reset() { - _isOpen = false; - _vqaPlayer = nullptr; - _imagePicker = nullptr; - _actorId = -1; - _sentenceId = -1; - _timeSpeakDescription = 0; -} - -void Elevator::buttonFocus(int buttonId) { - switch (buttonId) { - case 7: - setupDescription(kActorAnsweringMachine, 140); - break; - case 6: - setupDescription(kActorAnsweringMachine, 130); - break; - case 5: - setupDescription(kActorAnsweringMachine, 120); - break; - case 4: - setupDescription(kActorAnsweringMachine, 100); - break; - case 3: - setupDescription(kActorAnsweringMachine, 110); - break; - case 2: - setupDescription(kActorAnsweringMachine, 130); - break; - case 1: - setupDescription(kActorAnsweringMachine, 100); - break; - case 0: - setupDescription(kActorAnsweringMachine, 150); - break; - default: - resetDescription(); - break; - } -} - -void Elevator::setupDescription(int actorId, int sentenceId) { - _actorId = actorId; - _sentenceId = sentenceId; - - // TODO: Use proper timer - _timeSpeakDescription = _vm->getTotalPlayTime() + 600; -} - -void Elevator::resetDescription() { - _actorId = -1; - _sentenceId = -1; - _timeSpeakDescription = 0; -} - -void Elevator::tickDescription() { - int now = _vm->getTotalPlayTime(); - if (_actorId <= 0 || now < _timeSpeakDescription) { - return; - } - - _vm->_actors[_actorId]->speechPlay(_sentenceId, false); - _actorId = -1; - _sentenceId = -1; -} - -void Elevator::resume() { - // TODO -} - -void elevator_mouseInCallback(int buttonId, void *self) { - ((Elevator*)self)->buttonFocus(buttonId); -} - -void elevator_mouseOutCallback(int, void *self) { - ((Elevator*)self)->buttonFocus(-1); -} - -void elevator_mouseDownCallback(int, void *self) { - Elevator *elevator = ((Elevator*)self); - const char *name = elevator->_vm->_gameInfo->getSfxTrack(515); - elevator->_vm->_audioPlayer->playAud(name, 100, 0, 0, 50, 0); -} - -void elevator_mouseUpCallback(int buttonId, void *self) { - ((Elevator*)self)->buttonClick(buttonId); -} - -} // End of namespace BladeRunner diff --git a/engines/bladerunner/elevator.h b/engines/bladerunner/elevator.h deleted file mode 100644 index 0a5940a3b3..0000000000 --- a/engines/bladerunner/elevator.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BLADERUNNER_ELEVATOR_H -#define BLADERUNNER_ELEVATOR_H - -#include "common/array.h" - -namespace BladeRunner { - -class BladeRunnerEngine; -class Shape; -class VQAPlayer; -class UIImagePicker; - -class Elevator { - BladeRunnerEngine *_vm; - bool _isOpen; - VQAPlayer *_vqaPlayer; - int _buttonClicked; - Common::Array _shapes; - UIImagePicker *_imagePicker; - int _actorId; - int _sentenceId; - int _timeSpeakDescription; - - friend void elevator_mouseInCallback(int, void*); - friend void elevator_mouseOutCallback(int, void*); - friend void elevator_mouseDownCallback(int, void*); - friend void elevator_mouseUpCallback(int, void*); - -public: - Elevator(BladeRunnerEngine *vm); - ~Elevator(); - - int activate(int elevatorId); - void open(); - bool isOpen() const; - int handleMouseUp(int x, int y); - int handleMouseDown(int x, int y); - void tick(); - void buttonClick(int buttonId); - void reset(); - void buttonFocus(int buttonId); - void setupDescription(int actorId, int sentenceId); - void resetDescription(); - void tickDescription(); - void resume(); -}; - -} // End of namespace BladeRunner - -#endif diff --git a/engines/bladerunner/fog.cpp b/engines/bladerunner/fog.cpp index 73e802667f..06166bb30b 100644 --- a/engines/bladerunner/fog.cpp +++ b/engines/bladerunner/fog.cpp @@ -45,24 +45,24 @@ int Fog::readCommon(Common::ReadStream *stream) { void Fog::readAnimationData(Common::ReadStream *stream, int size) { _animatedParameters = stream->readUint32LE(); - int floatsCount = size / 4; - _animationData = new float[floatsCount]; - for (int i = 0; i < floatsCount; i++) { + int floatCount = size / 4; + _animationData = new float[floatCount]; + for (int i = 0; i < floatCount; i++) { _animationData[i] = stream->readFloatLE(); } _m11ptr = _animationData; - _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? _framesCount : 1); - _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? _framesCount : 1); - _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? _framesCount : 1); - _m21ptr = _m14ptr + (_animatedParameters & 0x08 ? _framesCount : 1); - _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? _framesCount : 1); - _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? _framesCount : 1); - _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? _framesCount : 1); - _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? _framesCount : 1); - _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? _framesCount : 1); - _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? _framesCount : 1); - _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? _framesCount : 1); + _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? _frameCount : 1); + _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? _frameCount : 1); + _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? _frameCount : 1); + _m21ptr = _m14ptr + (_animatedParameters & 0x08 ? _frameCount : 1); + _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? _frameCount : 1); + _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? _frameCount : 1); + _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? _frameCount : 1); + _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? _frameCount : 1); + _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? _frameCount : 1); + _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? _frameCount : 1); + _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? _frameCount : 1); setupFrame(0); } @@ -71,7 +71,7 @@ void Fog::reset() { } void Fog::setupFrame(int frame) { - int offset = frame % _framesCount; + int offset = frame % _frameCount; _matrix._m[0][0] = (_animatedParameters & 0x1 ? _m11ptr[offset] : *_m11ptr); _matrix._m[0][1] = (_animatedParameters & 0x2 ? _m12ptr[offset] : *_m12ptr); _matrix._m[0][2] = (_animatedParameters & 0x4 ? _m13ptr[offset] : *_m13ptr); @@ -87,8 +87,8 @@ void Fog::setupFrame(int frame) { _inverted = invertMatrix(_matrix); } -void FogCone::read(Common::ReadStream *stream, int framesCount) { - _framesCount = framesCount; +void FogCone::read(Common::ReadStream *stream, int frameCount) { + _frameCount = frameCount; int size = readCommon(stream); _parameter1 = stream->readFloatLE(); readAnimationData(stream, size - 52); @@ -133,8 +133,8 @@ void FogCone::calculateCoeficient(Vector3 position, Vector3 viewPosition, float } } -void FogSphere::read(Common::ReadStream *stream, int framesCount) { - _framesCount = framesCount; +void FogSphere::read(Common::ReadStream *stream, int frameCount) { + _frameCount = frameCount; int size = readCommon(stream); _parameter1 = stream->readFloatLE(); readAnimationData(stream, size - 52); @@ -261,8 +261,8 @@ void FogSphere::calculateCoeficient(Vector3 position, Vector3 viewPosition, floa } } -void FogBox::read(Common::ReadStream *stream, int framesCount) { - _framesCount = framesCount; +void FogBox::read(Common::ReadStream *stream, int frameCount) { + _frameCount = frameCount; int size = readCommon(stream); _parameter1 = stream->readFloatLE(); _parameter2 = stream->readFloatLE(); diff --git a/engines/bladerunner/fog.h b/engines/bladerunner/fog.h index 445308d540..95ac550fd1 100644 --- a/engines/bladerunner/fog.h +++ b/engines/bladerunner/fog.h @@ -39,7 +39,7 @@ class Fog { protected: char _name[20]; - int _framesCount; + int _frameCount; int _animatedParameters; Matrix4x3 _matrix; Matrix4x3 _inverted; @@ -69,7 +69,7 @@ public: Fog(); virtual ~Fog(); - virtual void read(Common::ReadStream *stream, int framesCount) = 0; + virtual void read(Common::ReadStream *stream, int frameCount) = 0; virtual void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) = 0; void reset(); @@ -82,17 +82,17 @@ protected: }; class FogCone : public Fog { - void read(Common::ReadStream *stream, int framesCount); + void read(Common::ReadStream *stream, int frameCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; class FogSphere : public Fog { - void read(Common::ReadStream *stream, int framesCount); + void read(Common::ReadStream *stream, int frameCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; class FogBox : public Fog { - void read(Common::ReadStream *stream, int framesCount); + void read(Common::ReadStream *stream, int frameCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp index 2f56b3f12d..3af8fc2f7f 100644 --- a/engines/bladerunner/font.cpp +++ b/engines/bladerunner/font.cpp @@ -28,7 +28,8 @@ namespace BladeRunner { -Font::Font(BladeRunnerEngine *vm) : _vm(vm) { +Font::Font(BladeRunnerEngine *vm) { + _vm = vm; reset(); } @@ -62,11 +63,11 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh } for (int i = 0; i < _characterCount; i++) { - _characters[i]._x = stream->readUint32LE(); - _characters[i]._y = stream->readUint32LE(); - _characters[i]._width = stream->readUint32LE(); - _characters[i]._height = stream->readUint32LE(); - _characters[i]._dataOffset = stream->readUint32LE(); + _characters[i].x = stream->readUint32LE(); + _characters[i].y = stream->readUint32LE(); + _characters[i].width = stream->readUint32LE(); + _characters[i].height = stream->readUint32LE(); + _characters[i].dataOffset = stream->readUint32LE(); } for (int i = 0; i < _dataSize; i++) { _data[i] = stream->readUint16LE(); @@ -95,7 +96,7 @@ void Font::setColor(uint16 color) { } } -void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, int y) { +void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, int y) const { if (!_data) { return; } @@ -106,7 +107,7 @@ void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, i const char *character = text.c_str(); while (*character != 0) { drawCharacter(*character, surface, x, y); - x += _spacing1 + _characters[*character + 1]._width; + x += _spacing1 + _characters[*character + 1].width; character++; } @@ -119,7 +120,7 @@ void Font::drawColor(const Common::String &text, Graphics::Surface &surface, int draw(text, surface, x, y); } -int Font::getTextWidth(const Common::String &text) { +int Font::getTextWidth(const Common::String &text) const { const char *character = text.c_str(); if (!_data) { @@ -130,13 +131,13 @@ int Font::getTextWidth(const Common::String &text) { return 0; } while (*character != 0) { - totalWidth += _spacing1 + _characters[*character + 1]._width; + totalWidth += _spacing1 + _characters[*character + 1].width; character++; } return totalWidth - _spacing1; } -int Font::getTextHeight(const Common::String &text) { +int Font::getTextHeight(const Common::String &text) const { return _maxHeight; } @@ -153,7 +154,7 @@ void Font::reset() { _color = 0x7FFF; _intersperse = 0; - memset(_characters, 0, 256 * sizeof(FontCharacter)); + memset(_characters, 0, 256 * sizeof(Character)); } void Font::replaceColor(uint16 oldColor, uint16 newColor) { @@ -167,16 +168,16 @@ void Font::replaceColor(uint16 oldColor, uint16 newColor) { } } -void Font::drawCharacter(const char character, Graphics::Surface &surface, int x, int y) { +void Font::drawCharacter(const char character, Graphics::Surface &surface, int x, int y) const { uint8 characterIndex = (uint8)character + 1; if (x < 0 || x >= _screenWidth || y < 0 || y >= _screenHeight || !_data || characterIndex >= _characterCount) { return; } - uint16 *dstPtr = (uint16*)surface.getBasePtr(x + _characters[characterIndex]._x, y + _characters[characterIndex]._y); - uint16 *srcPtr = &_data[_characters[characterIndex]._dataOffset]; - int width = _characters[characterIndex]._width; - int height = _characters[characterIndex]._height; + uint16 *dstPtr = (uint16 *)surface.getBasePtr(x + _characters[characterIndex].x, y + _characters[characterIndex].y); + uint16 *srcPtr = &_data[_characters[characterIndex].dataOffset]; + int width = _characters[characterIndex].width; + int height = _characters[characterIndex].height; if (_intersperse && y & 1) { dstPtr += surface.pitch / 2; } @@ -203,4 +204,5 @@ void Font::drawCharacter(const char character, Graphics::Surface &surface, int x currentY++; } } + } // End of namespace BladeRunner diff --git a/engines/bladerunner/font.h b/engines/bladerunner/font.h index 91a8184e4b..e51a3deb2d 100644 --- a/engines/bladerunner/font.h +++ b/engines/bladerunner/font.h @@ -33,21 +33,21 @@ namespace BladeRunner { class BladeRunnerEngine; -struct FontCharacter { - int _x; - int _y; - int _width; - int _height; - int _dataOffset; -}; - class Font { + struct Character { + int x; + int y; + int width; + int height; + int dataOffset; + }; + BladeRunnerEngine *_vm; int _characterCount; int _maxWidth; int _maxHeight; - FontCharacter _characters[256]; + Character _characters[256]; int _dataSize; uint16 *_data; int _screenWidth; @@ -67,17 +67,17 @@ public: void setSpacing(int spacing1, int spacing2); void setColor(uint16 color); - void draw(const Common::String &text, Graphics::Surface &surface, int x, int y); + void draw(const Common::String &text, Graphics::Surface &surface, int x, int y) const; void drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color); - int getTextWidth(const Common::String &text); - int getTextHeight(const Common::String &text); + int getTextWidth(const Common::String &text) const; + int getTextHeight(const Common::String &text) const; private: void reset(); void replaceColor(uint16 oldColor, uint16 newColor); - void drawCharacter(const char character, Graphics::Surface &surface, int x, int y); + void drawCharacter(const char character, Graphics::Surface &surface, int x, int y) const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h new file mode 100644 index 0000000000..043a07ff91 --- /dev/null +++ b/engines/bladerunner/game_constants.h @@ -0,0 +1,463 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BLADERUNNER_GAME_CONSTANTS_H +#define BLADERUNNER_GAME_CONSTANTS_H + +namespace BladeRunner { + +enum Actors { + kActorMcCoy = 0, + kActorSteele = 1, + kActorGordo = 2, + kActorDektora = 3, + kActorGuzza = 4, + kActorClovis = 5, + kActorLucy = 6, + kActorIzo = 7, + kActorSadik = 8, + kActorCrazylegs = 9, + kActorLuther = 10, + kActorGrigorian = 11, + kActorTransient = 12, + kActorLance = 13, + kActorBulletBob = 14, + kActorRunciter = 15, + kActorInsectDealer = 16, + kActorTyrellGuard = 17, + kActorEarlyQ = 18, + kActorZuben = 19, + kActorHasan = 20, + kActorMarcus = 21, + kActorMia = 22, + kActorOfficerLeary = 23, + kActorOfficerGrayford = 24, + kActorHanoi = 25, + kActorBaker = 26, + kActorDeskClerk = 27, + kActorHowieLee = 28, + kActorFishDealer = 29, + kActorKlein = 30, + kActorMurray = 31, + kActorHawkersBarkeep = 32, + kActorHolloway = 33, + kActorSergeantWalls = 34, + kActorMoraji = 35, + kActorTheBard = 36, + kActorPhotographer = 37, + kActorDispatcher = 38, + kActorAnsweringMachine = 39, + kActorRajif = 40, + kActorGovernorKolvig = 41, + kActorEarlyQBartender = 42, + kActorHawkersParrot = 43, + kActorTaffyPatron = 44, + kActorLockupGuard = 45, + kActorTeenager = 46, + kActorHysteriaPatron1 = 47, + kActorHysteriaPatron2 = 48, + kActorHysteriaPatron3 = 49, + kActorShoeshineMan = 50, + kActorTyrell = 51, + kActorChew = 52, + kActorGaff = 53, + kActorBryant = 54, + kActorTaffy = 55, + kActorSebastian = 56, + kActorRachael = 57, + kActorGeneralDoll = 58, + kActorIsabella = 59, + kActorBlimpGuy = 60, + kActorNewscaster = 61, + kActorLeon = 62, + kActorMaleAnnouncer = 63, + kActorFreeSlotA = 64, + kActorFreeSlotB = 65, + kActorMaggie = 66, + kActorGenwalkerA = 67, + kActorGenwalkerB = 68, + kActorGenwalkerC = 69, + kActorMutant1 = 70, + kActorMutant2 = 71, + kActorMutant3 = 72, + kActorVoiceOver = 99 +}; + +enum Clues { + kClueOfficersStatement = 0, + kClueDoorForced1 = 1, + kClueDoorForced2 = 2, + kClueLimpingFootprints = 3, + kClueGracefulFootprints = 4, + kClueShellCasings = 5, + kClueCandy = 6, + kClueToyDog = 7, + kClueChopstickWrapper = 8, + kClueSushiMenu = 9, + kClueLabCorpses = 10, + kClueLabShellCasings = 11, + kClueRuncitersVideo = 12, + kClueLucy = 13, + kClueDragonflyAnklet = 14, + kClueReferenceLetter = 15, + kClueCrowdInterviewA = 16, + kClueCrowdInterviewB = 17, + kClueZubenRunsAway = 18, + kClueZubenInterview = 19, + kClueZuben = 20, + kClueBigManLimping = 21, + kClueRunciterInterviewA = 22, + kClueRunciterInterviewB1 = 23, + kClueRunciterInterviewB2 = 24, + kClueHowieLeeInterview = 25, + kCluePaintTransfer = 26, + kClueChromeDebris = 27, + kClueRuncitersViewA = 28, + kClueRuncitersViewB = 29, + kClueCarColorAndMake = 30, + kCluePartialLicenseNumber = 31, + kClueBriefcase = 32, + kClueGaffsInformation = 33, + kClueCrystalVisitedRunciters = 34, + kClueCrystalVisitedChinatown = 35, + kClueWantedPoster = 36, + kClueLicensePlate = 37, + kClueLicensePlateMatch = 38, + kClueLabPaintTransfer = 39, + kClueDispatchHitAndRun = 40, + kClueInceptShotRoy = 41, + kClueInceptShotsLeon = 42, + kCluePhoneCallGuzza = 43, + kClueDragonflyEarring = 44, + kClueTyrellSecurity = 45, + kClueTyrellGuardInterview = 46, + kClueBombingSuspect = 47, + kClueSadiksGun = 48, + kClueDetonatorWire = 49, + kClueVictimInformation = 50, + kClueAttemptedFileAccess = 51, + kClueCrystalsCase = 52, + kClueKingstonKitchenBox1 = 53, + kClueTyrellSalesPamphlet1 = 54, + kClueTyrellSalesPamphlet2 = 55, + kCluePeruvianLadyInterview = 56, + kClueHasanInterview = 57, + kClueBobInterview1 = 58, + kClueBobInterview2 = 59, + kClueIzoInterview = 60, + kClueIzosWarning = 61, + kClueRadiationGoggles = 62, + kClueGogglesReplicantIssue = 63, + kClueFishLadyInterview = 64, + kClueDogCollar1 = 65, + kClueWeaponsCache = 66, + kClueChewInterview = 67, + kClueMorajiInterview = 68, + kClueGordoInterview1 = 69, + kClueGordoInterview2 = 70, + kClueAnsweringMachineMessage = 71, + kClueChessTable = 72, + kClueSightingSadikBradbury = 73, + kClueStaggeredbyPunches = 74, + kClueMaggieBracelet = 75, + kClueEnvelope = 76, + kClueIzosFriend = 77, + kClueChinaBarSecurityPhoto = 78, + kCluePurchasedScorpions = 79, + kClueWeaponsOrderForm = 80, + kClueShippingForm = 81, + kClueGuzzasCash = 82, + kCluePoliceIssueWeapons = 83, + kClueHysteriaToken = 84, + kClueRagDoll = 85, + kClueMoonbus1 = 86, + kClueCheese = 87, + kClueDektorasDressingRoom = 88, + kClueEarlyQsClub = 89, + kClueDragonflyCollection = 90, + kClueDragonflyBelt = 91, + kClueEarlyQInterview = 92, + kClueStrangeScale1 = 93, + kClueDektoraInterview1 = 94, + kClueSuspectDektora = 95, + kClueDektoraInterview2 = 96, + kClueDektoraInterview3 = 97, + kClueDektorasCard = 98, + kClueGrigoriansNote = 99, + kClueCollectionReceipt = 100, + kClueSpecialIngredient = 101, + kClueStolenCheese = 102, + kClueGordoInterview3 = 103, + kClueGordoConfession = 104, + kClueGordosLighter1 = 105, + kClueGordosLighter2 = 106, + kClueDektoraInterview4 = 107, + kClueHollowayInterview = 108, + kClueBakersBadge = 109, + kClueHoldensBadge = 110, + kClueCar = 111, + kClueCarIdentified = 112, + kClueCarRegistration1 = 113, + kClueCarRegistration2 = 114, + kClueCarRegistration3 = 115, + kClueCrazylegsInterview1 = 116, + kClueCrazylegsInterview2 = 117, + kClueLichenDogWrapper = 118, + kClueRequisitionForm = 119, + kClueScaryChair = 120, + kClueIzosStashRaided = 121, + kClueHomelessManInterview1 = 122, + kClueHomelessManInterview2 = 123, + kClueHomelessManKid = 124, + kClueFolder = 125, + kClueGuzzaFramedMcCoy = 126, + kClueOriginalShippingForm = 127, + kClueOriginalRequisitionForm = 128, + kClueCandyWrapper = 129, + kClueGordoBlabs = 130, + kClueFlaskOfAbsinthe = 131, + kClueGuzzaAgreesToMeet = 132, + kClueDektoraConfession = 133, + kClueRunciterConfession1 = 134, + kClueRunciterConfession2 = 135, + kClueLutherLanceInterview = 136, + kClueMoonbus2 = 137, + kClueMoonbusCloseup = 138, + kCluePhoneCallDektora1 = 139, + kCluePhoneCallDektora2 = 140, + kCluePhoneCallLucy1 = 141, + kCluePhoneCallLucy2 = 142, + kCluePhoneCallClovis = 143, + kCluePhoneCallCrystal = 144, + kCluePowerSource = 145, + kClueBomb = 146, + kClueDNATyrell = 147, + kClueDNASebastian = 148, + kClueDNAChew = 149, + kClueDNAMoraji = 150, + kClueDNALutherLance = 151, + kClueDNAMarcus = 152, + kClueGarterSnake = 153, + kClueSlug = 154, + kClueGoldfish = 155, + kClueZubenTalksAboutLucy1 = 156, + kClueZubenTalksAboutLucy2 = 157, + kClueZubensMotive = 158, + kClueSightingBulletBob = 159, + kClueSightingClovis = 160, + kClueSightingDektora = 161, + kClueVKDektoraReplicant = 162, + kClueVKDektoraHuman = 163, + kClueVKBobGorskyReplicant = 164, + kClueVKBobGorskyHuman = 165, + kClueVKLutherLanceReplicant = 166, + kClueVKLutherLanceHuman = 167, + kClueVKGrigorianReplicant = 168, + kClueVKGrigorianHuman = 169, + kClueVKIzoReplicant = 170, + kClueVKIzoHuman = 171, + kClueVKCrazylegsReplicant = 172, + kClueVKCrazylegsHuman = 173, + kClueVKRunciterReplicant = 174, + kClueVKRunciterHuman = 175, + kClueVKEarlyQReplicant = 176, + kClueVKEarlyQHuman = 177, + kClueCrimeSceneNotes = 178, + kClueGrigorianInterviewA = 179, + kClueGrigorianInterviewB1 = 180, + kClueGrigorianInterviewB2 = 181, + kClueLabAnalysisGoldChain = 182, + kClueSightingZuben = 183, + kClueCrystalRetiredZuben = 184, + kClueCrystalRetiredGordo = 185, + kClueSightingGordo = 186, + kClueCrystalRetiredIzo = 187, + kClueClovisIncept = 188, + kClueDektoraIncept = 189, + kClueLucyIncept = 190, + kClueGordoIncept = 191, + kClueIzoIncept = 192, + kClueSadikIncept = 193, + kClueZubenIncept = 194, + kClueMcCoyIncept = 195, + kClueWarRecordsGordoFrizz = 196, + kCluePoliceWeaponUsed = 197, + kClueMcCoysWeaponUsedonBob = 198, + kClueBobRobbed = 199, + kClueBobShotInSelfDefense = 200, + kClueBobShotInColdBlood = 201, + kClueMcCoyRecoveredHoldensBadge = 202, + kClueCrystalTestedBulletBob = 203, + kClueCrystalRetiredBob = 204, + kClueCrystalTestedCrazylegs = 205, + kClueCrystalRetiredCrazylegs = 206, + kClueCrystalArrestedCrazylegs = 207, + kClueCrystalTestedRunciter = 208, + kClueCrystalRetiredRunciter1 = 209, + kClueCrystalRetiredRunciter2 = 210, + kClueSightingMcCoyRuncitersShop = 211, + kClueMcCoyKilledRunciter1 = 212, + kClueMcCoysDescription = 213, + kClueMcCoyIsABladeRunner = 214, + kClueMcCoyLetZubenEscape = 215, + kClueMcCoyWarnedIzo = 216, + kClueMcCoyHelpedIzoIzoIsAReplicant = 217, + kClueMcCoyHelpedDektora = 218, + kClueMcCoyHelpedLucy = 219, + kClueMcCoyHelpedGordo = 220, + kClueMcCoyShotGuzza = 221, + kClueMcCoyRetiredZuben = 222, + kClueMcCoyRetiredLucy = 223, + kClueMcCoyRetiredDektora = 224, + kClueMcCoyRetiredGordo = 225, + kClueMcCoyRetiredSadik = 226, + kClueMcCoyShotZubenintheback = 227, + kClueMcCoyRetiredLutherLance = 228, + kClueMcCoyBetrayal = 229, + kClueMcCoyKilledRunciter2 = 230, + kClueClovisOrdersMcCoysDeath = 231, + kClueEarlyAttemptedToSeduceLucy = 232, + kClueCarWasStolen = 233, + kClueGrigoriansResponse1 = 234, + kClueGrigoriansResponse2 = 235, + kClueCrazysInvolvement = 236, + kClueGrigoriansResources = 237, + kClueMcCoyPulledAGun = 238, + kClueMcCoyIsStupid = 239, + kClueMcCoyIsAnnoying = 240, + kClueMcCoyIsKind = 241, + kClueMcCoyIsInsane = 242, + kClueAnimalMurderSuspect = 243, + kClueMilitaryBoots = 244, + kClueOuterDressingRoom = 245, + kCluePhotoOfMcCoy1 = 246, + kCluePhotoOfMcCoy2 = 247, + kClueEarlyQAndLucy = 248, + kClueClovisflowers = 249, + kClueLucyWithDektora = 250, + kClueWomanInAnimoidRow = 251, + kClueScorpions = 252, + kClueStrangeScale2 = 253, + kClueChinaBarSecurityCamera = 254, + kClueIzo = 255, + kClueGuzza = 256, + kClueChinaBarSecurityDisc = 257, + kClueScorpionbox = 258, + kClueTyrellSecurityPhoto = 259, + kClueChinaBar = 260, + kCluePlasticExplosive = 261, + kClueDogCollar2 = 262, + kClueKingstonKitchenBox2 = 263, + kClueCrystalsCigarette = 264, + kClueSpinnerKeys = 265, + kClueAct2Ended = 266, + kClueAct3Ended = 267, + kClueAct4Ended = 268, + kClueExpertBomber = 269, + kClueAmateurBomber = 270, + kClueVKLucyReplicant = 271, + kClueVKLucyHuman = 272, + kClueLucyInterview = 273, + kClueMoonbusReflection = 274, + kClueMcCoyAtMoonbus = 275, + kClueClovisAtMoonbus = 276, + kClueSadikAtMoonbus = 277, + kClueRachaelInterview = 278, + kClueTyrellInterview = 279, + kClueRuncitersConfession1 = 280, + kClueRuncitersConfession2 = 281, + kClueRuncitersConfession3 = 282, + kClueEarlyInterviewA = 283, + kClueEarlyInterviewB1 = 284, + kClueEarlyInterviewB2 = 285, + kClueCrazylegsInterview3 = 286, + kClueCrazylegGgrovels = 287 +}; + +enum ClueTypes { + kClueTypePhotograph = 0, + kClueTypeVideoClip = 1, + kClueTypeAudioRecording = 2, + kClueTypeObject = 3 +}; + +enum Crimes { + kCrimeAnimalMurder = 0, + kCrimeEisendullerMurder = 1, + kCrimeArmsDealing = 2, + kCrimeMorajiMurder = 3, + kCrimeBradburyAssault = 4, + kCrimeFactoryBombing = 5, + kCrimeBobMurder = 6, + kCrimeRunciterMurder = 7, + kCrimeMoonbusHijacking = 8 +}; + +enum SpinnerDestinations { + kSpinnerDestinationPoliceStation = 0, + kSpinnerDestinationMcCoysApartment = 1, + kSpinnerDestinationRuncitersAnimals = 2, + kSpinnerDestinationChinatown = 3, + kSpinnerDestinationAnimoidRow = 4, + kSpinnerDestinationTyrellBuilding = 5, + kSpinnerDestinationDNARow = 6, + kSpinnerDestinationBradburyBuilding = 7, + kSpinnerDestinationNightclubRow = 8, + kSpinnerDestinationHysteriaHall = 9 +}; + +enum Flags { + kFlagRC02toRC01 = 9, + kFlagIntroPlayed = 24, + kFlagMA02toMA06 = 33, + kFlagMA06ToMA02 = 34, + kFlagMA02ToMA04 = 35, + kFlagMA04ToMA02 = 36, + kFlagMA01toMA06 = 37, + kFlagMA06toMA01 = 38, + kFlagMA07toMA06 = 57, + kFlagMA06toMA07 = 58, + kFlagMA04toMA05 = 62, + kFlagMA05toMA04 = 63, + kFlagRC03toRC01 = 114, + kFlagRC01PoliceDone = 186, + kFlagMA01Locked = 250, + kFlagDirectorsCut = 378, + kFlagKIAPrivacyAddon = 487, + kFlagKIAPrivacyAddonIntro = 599 +}; + +enum Variables { + kVariableWalkLoopActor = 37, + kVariableWalkLoopRun = 38 +}; + +enum Outtakes { + kOuttakeIntro = 0, + kOuttakeWestwood = 28, + kOuttakeDescent = 33, + kOuttakeBladeRunner = 41 +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/game_flags.cpp b/engines/bladerunner/game_flags.cpp new file mode 100644 index 0000000000..81fe6a0a4f --- /dev/null +++ b/engines/bladerunner/game_flags.cpp @@ -0,0 +1,74 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "bladerunner/game_flags.h" + +#include "common/debug.h" + +namespace BladeRunner { + +GameFlags::GameFlags() + : _flags(nullptr), _flagCount(0) { +} + +GameFlags::~GameFlags() { + delete[] _flags; +} + +void GameFlags::setFlagCount(int count) { + assert(count > 0); + + _flagCount = count; + _flags = new uint32[count / 32 + 1]; + + for (int i = 0; i <= _flagCount; ++i) + reset(i); +} + +void GameFlags::set(int flag) { +#if BLADERUNNER_DEBUG_CONSOLE + debug("GameFlags::set(%d)", flag); +#endif + + assert(flag >= 0 && flag <= _flagCount); + + _flags[flag / 32] |= (1 << (flag % 32)); +} + +void GameFlags::reset(int flag) { +#if BLADERUNNER_DEBUG_CONSOLE + debug("GameFlags::reset(%d)", flag); +#endif + + assert(flag >= 0 && flag <= _flagCount); + + _flags[flag / 32] &= ~(1 << (flag % 32)); +} + +bool GameFlags::query(int flag) const { + //debug("GameFlags::query(%d): %d", flag, !!(flags[flag / 32] & (1 << (flag % 32)))); + assert(flag >= 0 && flag <= _flagCount); + + return !!(_flags[flag / 32] & (1 << (flag % 32))); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/game_flags.h b/engines/bladerunner/game_flags.h new file mode 100644 index 0000000000..83cbdbc086 --- /dev/null +++ b/engines/bladerunner/game_flags.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BLADERUNNER_GAME_FLAGS_H +#define BLADERUNNER_GAME_FLAGS_H + +#include "common/scummsys.h" + +namespace BladeRunner { + +class GameFlags { + uint32 *_flags; + int _flagCount; + +public: + GameFlags(); + ~GameFlags(); + + void setFlagCount(int count); + + void set(int flag); + void reset(int flag); + bool query(int flag) const; +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/game_info.cpp b/engines/bladerunner/game_info.cpp new file mode 100644 index 0000000000..baffb87428 --- /dev/null +++ b/engines/bladerunner/game_info.cpp @@ -0,0 +1,111 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "bladerunner/game_info.h" + +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" +#include "common/substream.h" + +namespace BladeRunner { + +GameInfo::GameInfo(BladeRunnerEngine *vm) { + _vm = vm; + _sceneNames = nullptr; + _sfxTracks = nullptr; + _musicTracks = nullptr; + _outtakes = nullptr; +} + +GameInfo::~GameInfo() { + delete[] _sceneNames; + delete[] _sfxTracks; + delete[] _musicTracks; + delete[] _outtakes; +} + +bool GameInfo::open(const Common::String &name) { + Common::SeekableReadStream *s = _vm->getResourceStream(name); + + if (!s) + return false; + + uint32 unk; + _actorCount = s->readUint32LE(); /* 00 */ + _playerId = s->readUint32LE(); /* 01 */ + _flagCount = s->readUint32LE(); /* 02 */ + _clueCount = s->readUint32LE(); /* 03 */ + _globalVarCount = s->readUint32LE(); /* 04 */ + _setNamesCount = s->readUint32LE(); /* 05 */ + _initialSceneId = s->readUint32LE(); /* 06 */ + unk = s->readUint32LE(); /* 07 */ + _initialSetId = s->readUint32LE(); /* 08 */ + unk = s->readUint32LE(); /* 09 */ + _waypointCount = s->readUint32LE(); /* 10 */ + _sfxTrackCount = s->readUint32LE(); /* 11 */ + _musicTrackCount = s->readUint32LE(); /* 12 */ + _outtakeCount = s->readUint32LE(); /* 13 */ + _crimeCount = s->readUint32LE(); /* 14 */ + _suspectCount = s->readUint32LE(); /* 15 */ + _coverWaypointCount = s->readUint32LE(); /* 16 */ + _fleeWaypointCount = s->readUint32LE(); /* 17 */ + + (void)unk; + + _sceneNames = new char[_setNamesCount][5]; + for (uint32 i = 0; i != _setNamesCount; ++i) + s->read(_sceneNames[i], 5); + + _sfxTracks = new char[_sfxTrackCount][13]; + for (uint32 i = 0; i != _sfxTrackCount; ++i) { + s->read(_sfxTracks[i], 9); + strcat(_sfxTracks[i], ".AUD"); + } + + _musicTracks = new char[_musicTrackCount][13]; + for (uint32 i = 0; i != _musicTrackCount; ++i) { + s->read(_musicTracks[i], 9); + strcat(_musicTracks[i], ".AUD"); + } + + _outtakes = new char[_outtakeCount][13]; + for (uint32 i = 0; i != _outtakeCount; ++i) + s->read(_outtakes[i], 9); + + if (false) { + for (uint32 i = 0; i != _setNamesCount; ++i) + debug("%3d: %s", i, _sceneNames[i]); + for (uint32 i = 0; i != _sfxTrackCount; ++i) + debug("%3d: %s", i, _sfxTracks[i]); + for (uint32 i = 0; i != _musicTrackCount; ++i) + debug("%s", _musicTracks[i]); + for (uint32 i = 0; i != _outtakeCount; ++i) + debug("%2d: %s.VQA", i, _outtakes[i]); + } + + bool err = s->err(); + delete s; + return !err; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/game_info.h b/engines/bladerunner/game_info.h new file mode 100644 index 0000000000..f0eec99409 --- /dev/null +++ b/engines/bladerunner/game_info.h @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BLADERUNNER_GAME_INFO_H +#define BLADERUNNER_GAME_INFO_H + +#include "common/str.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class GameInfo { + BladeRunnerEngine *_vm; + + uint32 _actorCount; + uint32 _playerId; + uint32 _flagCount; + uint32 _clueCount; + uint32 _globalVarCount; + uint32 _setNamesCount; + uint32 _initialSceneId; + uint32 _initialSetId; + uint32 _waypointCount; + uint32 _sfxTrackCount; + uint32 _musicTrackCount; + uint32 _outtakeCount; + uint32 _crimeCount; + uint32 _suspectCount; + uint32 _coverWaypointCount; + uint32 _fleeWaypointCount; + + char (*_sceneNames)[5]; + char (*_sfxTracks)[13]; + char (*_musicTracks)[13]; + char (*_outtakes)[13]; + +public: + GameInfo(BladeRunnerEngine *vm); + ~GameInfo(); + + bool open(const Common::String &name); + + uint32 getActorCount() const { return _actorCount; } + uint32 getPlayerId() const { return _playerId; } + uint32 getFlagCount() const { return _flagCount; } + uint32 getClueCount() const { return _clueCount; } + uint32 getGlobalVarCount() const { return _globalVarCount; } + uint32 getSetNamesCount() const { return _setNamesCount; } + uint32 getInitialSceneId() const { return _initialSceneId; } + uint32 getInitialSetId() const { return _initialSetId; } + uint32 getWaypointCount() const { return _waypointCount; } + uint32 getSfxTrackCount() const { return _sfxTrackCount; } + uint32 getMusicTrackCount() const { return _musicTrackCount; } + uint32 getOuttakeCount() const { return _outtakeCount; } + uint32 getCrimeCount() const { return _crimeCount; } + uint32 getSuspectCount() const { return _suspectCount; } + uint32 getCoverWaypointCount() const { return _coverWaypointCount; } + uint32 getFleeWaypointCount() const { return _fleeWaypointCount; } + + const char *getSceneName(int i) const { return _sceneNames[i]; } + const char *getSfxTrack(int i) const { return _sfxTracks[i]; } + const char *getMusicTrack(int i) const { return _musicTracks[i]; } + const char *getOuttake(int i) const { return _outtakes[i]; } +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/gameflags.cpp b/engines/bladerunner/gameflags.cpp deleted file mode 100644 index 261eff9547..0000000000 --- a/engines/bladerunner/gameflags.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "bladerunner/gameflags.h" - -#include "common/debug.h" - -namespace BladeRunner { - -GameFlags::GameFlags() - : flags(nullptr), flagCount(0) { -} - -GameFlags::~GameFlags() { - delete[] flags; -} - -void GameFlags::setFlagCount(int count) { - assert(count > 0); - - flagCount = count; - flags = new uint32[count / 32 + 1]; - - for (int i = 0; i <= flagCount; ++i) - reset(i); -} - -void GameFlags::set(int flag) { - debug("GameFlags::set(%d)", flag); - assert(flag >= 0 && flag <= flagCount); - - flags[flag / 32] |= (1 << (flag % 32)); -} - -void GameFlags::reset(int flag) { - debug("GameFlags::reset(%d)", flag); - assert(flag >= 0 && flag <= flagCount); - - flags[flag / 32] &= ~(1 << (flag % 32)); -} - -bool GameFlags::query(int flag) { - //debug("GameFlags::query(%d): %d", flag, !!(flags[flag / 32] & (1 << (flag % 32)))); - assert(flag >= 0 && flag <= flagCount); - - return !!(flags[flag / 32] & (1 << (flag % 32))); -} - -} // End of namespace BladeRunner diff --git a/engines/bladerunner/gameflags.h b/engines/bladerunner/gameflags.h deleted file mode 100644 index ea858191d1..0000000000 --- a/engines/bladerunner/gameflags.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BLADERUNNER_GAMEFLAGS_H -#define BLADERUNNER_GAMEFLAGS_H - -#include - -namespace BladeRunner { - -class GameFlags { - uint32 *flags; - int flagCount; - -public: - GameFlags(); - ~GameFlags(); - - void setFlagCount(int count); - - void set(int flag); - void reset(int flag); - bool query(int flag); -}; - -} // End of namespace BladeRunner - -#endif diff --git a/engines/bladerunner/gameinfo.cpp b/engines/bladerunner/gameinfo.cpp deleted file mode 100644 index 487c39d046..0000000000 --- a/engines/bladerunner/gameinfo.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "bladerunner/gameinfo.h" - -#include "bladerunner/bladerunner.h" - -#include "common/debug.h" -#include "common/substream.h" - -namespace BladeRunner { - -GameInfo::GameInfo(BladeRunnerEngine *vm) - : _vm(vm) { - _scene_names = nullptr; - _sfx_tracks = nullptr; - _music_tracks = nullptr; - _outtakes = nullptr; -} - -GameInfo::~GameInfo() { - delete[] _scene_names; - delete[] _sfx_tracks; - delete[] _music_tracks; - delete[] _outtakes; -} - -bool GameInfo::open(const Common::String &name) { - Common::SeekableReadStream *s = _vm->getResourceStream(name); - - if (!s) - return false; - - uint32 unk; - _actor_count = s->readUint32LE(); /* 00 */ - _player_id = s->readUint32LE(); /* 01 */ - _flag_count = s->readUint32LE(); /* 02 */ - _clue_count = s->readUint32LE(); /* 03 */ - _global_var_count = s->readUint32LE(); /* 04 */ - _set_names_count = s->readUint32LE(); /* 05 */ - _initial_scene_id = s->readUint32LE(); /* 06 */ - unk = s->readUint32LE(); /* 07 */ - _initial_set_id = s->readUint32LE(); /* 08 */ - unk = s->readUint32LE(); /* 09 */ - _waypoint_count = s->readUint32LE(); /* 10 */ - _sfx_track_count = s->readUint32LE(); /* 11 */ - _music_track_count = s->readUint32LE(); /* 12 */ - _outtake_count = s->readUint32LE(); /* 13 */ - unk = s->readUint32LE(); /* 14 */ - _suspectsDatabaseSize = s->readUint32LE(); /* 15 */ - _cover_waypoint_count = s->readUint32LE(); /* 16 */ - _flee_waypoint_count = s->readUint32LE(); /* 17 */ - - (void)unk; - - _scene_names = new char[_set_names_count][5]; - for (uint32 i = 0; i != _set_names_count; ++i) - s->read(_scene_names[i], 5); - - _sfx_tracks = new char[_sfx_track_count][13]; - for (uint32 i = 0; i != _sfx_track_count; ++i) { - s->read(_sfx_tracks[i], 9); - strcat(_sfx_tracks[i], ".AUD"); - } - - _music_tracks = new char[_music_track_count][13]; - for (uint32 i = 0; i != _music_track_count; ++i) { - s->read(_music_tracks[i], 9); - strcat(_music_tracks[i], ".AUD"); - } - - _outtakes = new char[_outtake_count][13]; - for (uint32 i = 0; i != _outtake_count; ++i) - s->read(_outtakes[i], 9); - - if (false) { - for (uint32 i = 0; i != _set_names_count; ++i) - debug("%3d: %s", i, _scene_names[i]); - for (uint32 i = 0; i != _sfx_track_count; ++i) - debug("%3d: %s", i, _sfx_tracks[i]); - for (uint32 i = 0; i != _music_track_count; ++i) - debug("%s", _music_tracks[i]); - for (uint32 i = 0; i != _outtake_count; ++i) - debug("%2d: %s.VQA", i, _outtakes[i]); - } - - bool err = s->err(); - delete s; - return !err; -} - -} // End of namespace BladeRunner diff --git a/engines/bladerunner/gameinfo.h b/engines/bladerunner/gameinfo.h deleted file mode 100644 index 6f9aab5c20..0000000000 --- a/engines/bladerunner/gameinfo.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BLADERUNNER_GAMEINFO_H -#define BLADERUNNER_GAMEINFO_H - -#include "common/str.h" - -#include "common/str.h" - -namespace BladeRunner { - -class BladeRunnerEngine; - -class GameInfo { - BladeRunnerEngine *_vm; - - uint32 _actor_count; - uint32 _player_id; - uint32 _flag_count; - uint32 _clue_count; - uint32 _global_var_count; - uint32 _set_names_count; - uint32 _initial_scene_id; - uint32 _initial_set_id; - uint32 _waypoint_count; - uint32 _sfx_track_count; - uint32 _music_track_count; - uint32 _outtake_count; - uint32 _suspectsDatabaseSize; - uint32 _cover_waypoint_count; - uint32 _flee_waypoint_count; - - char (*_scene_names)[5]; - char (*_sfx_tracks)[13]; - char (*_music_tracks)[13]; - char (*_outtakes)[13]; - -public: - GameInfo(BladeRunnerEngine *vm); - ~GameInfo(); - - bool open(const Common::String &name); - - uint32 getActorCount() { return _actor_count; } - uint32 getPlayerId() { return _player_id; } - uint32 getFlagCount() { return _flag_count; } - uint32 getClueCount() { return _clue_count; } - uint32 getGlobalVarCount() { return _global_var_count; } - uint32 getSetNamesCount() { return _set_names_count; } - uint32 getInitialSceneId() { return _initial_scene_id; } - uint32 getInitialSetId() { return _initial_set_id; } - uint32 getWaypointCount() { return _waypoint_count; } - uint32 getSfxTrackCount() { return _sfx_track_count; } - uint32 getMusicTrackCount() { return _music_track_count; } - uint32 getOuttakeCount() { return _outtake_count; } - uint32 getSuspectsDatabaseSize() { return _suspectsDatabaseSize; } - uint32 getCoverWaypointCount() { return _cover_waypoint_count; } - uint32 getFleeWaypointCount() { return _flee_waypoint_count; } - - const char *getSceneName(int i) { return _scene_names[i]; } - const char *getSfxTrack(int i) { return _sfx_tracks[i]; } - const char *getMusicTrack(int i) { return _music_tracks[i]; } - const char *getOuttake(int i) { return _outtakes[i]; } -}; - -} // End of namespace BladeRunner - -#endif diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp index 1a23823b31..cc11e5b956 100644 --- a/engines/bladerunner/image.cpp +++ b/engines/bladerunner/image.cpp @@ -30,8 +30,8 @@ namespace BladeRunner { -Image::Image(BladeRunnerEngine *vm) - : _vm(vm) { +Image::Image(BladeRunnerEngine *vm) { + _vm = vm; } Image::~Image() { @@ -64,7 +64,7 @@ bool Image::open(const Common::String &name) { if (strcmp(tag, "LZO") == 0) { debug("LZO"); } else if (strcmp(tag, "LCW") == 0) { - decompress_lcw(buf, bufSize, (uint8*)data, dataSize); + decompress_lcw(buf, bufSize, (uint8 *)data, dataSize); } const Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); diff --git a/engines/bladerunner/item.cpp b/engines/bladerunner/item.cpp index 0b84aae30c..eafc99c80f 100644 --- a/engines/bladerunner/item.cpp +++ b/engines/bladerunner/item.cpp @@ -58,21 +58,18 @@ Item::Item(BladeRunnerEngine *vm) { _screenRectangle.left = -1; } -Item::~Item() { -} - -void Item::getXYZ(float *x, float *y, float *z) { +void Item::getXYZ(float *x, float *y, float *z) const { *x = _position.x; *y = _position.y; *z = _position.z; } -void Item::getWidthHeight(int *width, int *height) { +void Item::getWidthHeight(int *width, int *height) const { *width = _width; *height = _height; } -bool Item::isTargetable() { +bool Item::isTargetable() const { return _isTargetable; } @@ -86,7 +83,7 @@ bool Item::tick(Common::Rect *screenRect, bool special) { Vector3 position(_position.x, -_position.z, _position.y); int animationId = _animationId + (special ? 1 : 0); - _vm->_sliceRenderer->drawInWorld(animationId, 0, position, M_PI - _angle, 1.0f, _vm->_surfaceGame, _vm->_zbuffer->getData()); + _vm->_sliceRenderer->drawInWorld(animationId, 0, position, M_PI - _angle, 1.0f, _vm->_surfaceFront, _vm->_zbuffer->getData()); _vm->_sliceRenderer->getScreenRectangle(&_screenRectangle, animationId, 0, position, M_PI - _angle, 1.0f); if (!_screenRectangle.isEmpty()) { diff --git a/engines/bladerunner/item.h b/engines/bladerunner/item.h index 76d49ac614..e14aaa5c4f 100644 --- a/engines/bladerunner/item.h +++ b/engines/bladerunner/item.h @@ -34,11 +34,10 @@ class BladeRunnerEngine; class Items; class Item { - BladeRunnerEngine *_vm; - friend class Items; -private: + BladeRunnerEngine *_vm; + int _itemId; int _setId; @@ -61,13 +60,12 @@ private: public: Item(BladeRunnerEngine *vm); - ~Item(); - void getXYZ(float *x, float *y, float *z); + void getXYZ(float *x, float *y, float *z) const; void setXYZ(Vector3 position); - void getWidthHeight(int *width, int *height); + void getWidthHeight(int *width, int *height) const; - bool isTargetable(); + bool isTargetable() const; bool tick(Common::Rect *screenRect, bool special); void setup(int itemId, int setId, int animationId, Vector3 position, int facing, int height, int width, bool isTargetableFlag, bool isVisibleFlag, bool isPoliceMazeEnemyFlag); diff --git a/engines/bladerunner/item_pickup.cpp b/engines/bladerunner/item_pickup.cpp index b1f557d344..ffaeb79f33 100644 --- a/engines/bladerunner/item_pickup.cpp +++ b/engines/bladerunner/item_pickup.cpp @@ -22,10 +22,9 @@ #include "bladerunner/item_pickup.h" -#include "bladerunner/bladerunner.h" - #include "bladerunner/audio_player.h" -#include "bladerunner/gameinfo.h" +#include "bladerunner/bladerunner.h" +#include "bladerunner/game_info.h" #include "bladerunner/slice_animations.h" #include "bladerunner/slice_renderer.h" #include "bladerunner/zbuffer.h" @@ -104,6 +103,6 @@ void ItemPickup::draw() { return; } - _vm->_sliceRenderer->drawOnScreen(_animationId, _animationFrame, _screenX, _screenY, _facing, _scale, _vm->_surfaceGame, _vm->_zbuffer->getData()); + _vm->_sliceRenderer->drawOnScreen(_animationId, _animationFrame, _screenX, _screenY, _facing, _scale, _vm->_surfaceFront); } } // End of namespace BladeRunner diff --git a/engines/bladerunner/items.cpp b/engines/bladerunner/items.cpp index dda284f67d..a5298ca8de 100644 --- a/engines/bladerunner/items.cpp +++ b/engines/bladerunner/items.cpp @@ -38,14 +38,14 @@ Items::~Items() { } } -void Items::getXYZ(int itemId, float *x, float *y, float *z) { +void Items::getXYZ(int itemId, float *x, float *y, float *z) const { int itemIndex = findItem(itemId); assert(itemIndex != -1); _items[itemIndex]->getXYZ(x, y, z); } -void Items::getWidthHeight(int itemId, int *width, int *height) { +void Items::getWidthHeight(int itemId, int *width, int *height) const { int itemIndex = findItem(itemId); assert(itemIndex != -1); @@ -80,20 +80,20 @@ bool Items::addToWorld(int itemId, int animationId, int setId, Vector3 position, _items.push_back(item); if (addToSetFlag && setId == _vm->_scene->getSetId()) { - return _vm->_sceneObjects->addItem(itemId + SCENE_OBJECTS_ITEMS_OFFSET, &item->_boundingBox, &item->_screenRectangle, isTargetableFlag, isVisibleFlag); + return _vm->_sceneObjects->addItem(itemId + kSceneObjectOffsetItems, &item->_boundingBox, &item->_screenRectangle, isTargetableFlag, isVisibleFlag); } return true; } bool Items::addToSet(int setId) { - int itemsCount = _vm->_items->_items.size(); - if (itemsCount == 0) { + int itemCount = _vm->_items->_items.size(); + if (itemCount == 0) { return true; } - for (int i = 0; i < itemsCount; i++) { + for (int i = 0; i < itemCount; i++) { Item *item = _vm->_items->_items[i]; if (item->_setId == setId) { - _vm->_sceneObjects->addItem(item->_itemId + SCENE_OBJECTS_ITEMS_OFFSET, &item->_boundingBox, &item->_screenRectangle, item->isTargetable(), item->_isVisible); + _vm->_sceneObjects->addItem(item->_itemId + kSceneObjectOffsetItems, &item->_boundingBox, &item->_screenRectangle, item->isTargetable(), item->_isVisible); } } return true; @@ -109,13 +109,13 @@ bool Items::remove(int itemId) { } if (_items[itemIndex]->_setId == _vm->_scene->getSetId()) { - _vm->_sceneObjects->remove(itemId + SCENE_OBJECTS_ITEMS_OFFSET); + _vm->_sceneObjects->remove(itemId + kSceneObjectOffsetItems); } _items.remove_at(itemIndex); return true; } -int Items::findItem(int itemId) { +int Items::findItem(int itemId) const { for (int i = 0; i < (int)_items.size(); i++) { if (_items[i]->_itemId == itemId) return i; diff --git a/engines/bladerunner/items.h b/engines/bladerunner/items.h index c288e93bae..c49231f30e 100644 --- a/engines/bladerunner/items.h +++ b/engines/bladerunner/items.h @@ -33,14 +33,14 @@ namespace BladeRunner { class Items { BladeRunnerEngine *_vm; - Common::Array _items; + Common::Array _items; public: Items(BladeRunnerEngine *vm); ~Items(); - void getXYZ(int itemId, float *x, float *y, float *z); - void getWidthHeight(int itemId, int *width, int *height); + void getXYZ(int itemId, float *x, float *y, float *z) const; + void getWidthHeight(int itemId, int *width, int *height) const; void tick(); bool addToWorld(int itemId, int animationId, int setId, Vector3 position, int facing, int height, int width, bool isTargetableFlag, bool isVisibleFlag, bool isPoliceMazeEnemyFlag, bool addToSetFlag); @@ -48,7 +48,7 @@ public: bool remove(int itemId); private: - int findItem(int itemId); + int findItem(int itemId) const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/light.cpp b/engines/bladerunner/light.cpp index c447920601..93481fe9aa 100644 --- a/engines/bladerunner/light.cpp +++ b/engines/bladerunner/light.cpp @@ -36,8 +36,8 @@ Light::~Light() { } } -void Light::read(Common::ReadStream *stream, int framesCount, int frame, int animated) { - _framesCount = framesCount; +void Light::read(Common::ReadStream *stream, int frameCount, int frame, int animated) { + _frameCount = frameCount; _animated = animated; int size = stream->readUint32LE(); @@ -50,37 +50,37 @@ void Light::read(Common::ReadStream *stream, int framesCount, int frame, int ani if (_animationData != nullptr) { delete[] _animationData; } - int floatsCount = size / 4; - _animationData = new float[floatsCount]; - for (int i = 0; i < floatsCount; i++) { + int floatCount = size / 4; + _animationData = new float[floatCount]; + for (int i = 0; i < floatCount; i++) { _animationData[i] = stream->readFloatLE(); } _m11ptr = _animationData; - _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? framesCount : 1); - _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? framesCount : 1); - _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? framesCount : 1); - _m21ptr = _m14ptr + (_animatedParameters & 0x8 ? framesCount : 1); - _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? framesCount : 1); - _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? framesCount : 1); - _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? framesCount : 1); - _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? framesCount : 1); - _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? framesCount : 1); - _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? framesCount : 1); - _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? framesCount : 1); - _colorRPtr = _m34ptr + (_animatedParameters & 0x800 ? framesCount : 1); - _colorGPtr = _colorRPtr + (_animatedParameters & 0x1000 ? framesCount : 1); - _colorBPtr = _colorGPtr + (_animatedParameters & 0x2000 ? framesCount : 1); - _falloffStartPtr = _colorBPtr + (_animatedParameters & 0x4000 ? framesCount : 1); - _falloffEndPtr = _falloffStartPtr + (_animatedParameters & 0x8000 ? framesCount : 1); - _angleStartPtr = _falloffEndPtr + (_animatedParameters & 0x10000 ? framesCount : 1); - _angleEndPtr = _angleStartPtr + (_animatedParameters & 0x20000 ? framesCount : 1); + _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? frameCount : 1); + _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? frameCount : 1); + _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? frameCount : 1); + _m21ptr = _m14ptr + (_animatedParameters & 0x8 ? frameCount : 1); + _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? frameCount : 1); + _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? frameCount : 1); + _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? frameCount : 1); + _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? frameCount : 1); + _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? frameCount : 1); + _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? frameCount : 1); + _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? frameCount : 1); + _colorRPtr = _m34ptr + (_animatedParameters & 0x800 ? frameCount : 1); + _colorGPtr = _colorRPtr + (_animatedParameters & 0x1000 ? frameCount : 1); + _colorBPtr = _colorGPtr + (_animatedParameters & 0x2000 ? frameCount : 1); + _falloffStartPtr = _colorBPtr + (_animatedParameters & 0x4000 ? frameCount : 1); + _falloffEndPtr = _falloffStartPtr + (_animatedParameters & 0x8000 ? frameCount : 1); + _angleStartPtr = _falloffEndPtr + (_animatedParameters & 0x10000 ? frameCount : 1); + _angleEndPtr = _angleStartPtr + (_animatedParameters & 0x20000 ? frameCount : 1); setupFrame(frame); } -void Light::readVqa(Common::ReadStream *stream, int framesCount, int frame, int animated) { - _framesCount = framesCount; +void Light::readVqa(Common::ReadStream *stream, int frameCount, int frame, int animated) { + _frameCount = frameCount; _animated = animated; _animatedParameters = stream->readUint32LE(); @@ -91,37 +91,37 @@ void Light::readVqa(Common::ReadStream *stream, int framesCount, int frame, int delete[] _animationData; } - int floatsCount = size / 4; - _animationData = new float[floatsCount]; - for (int i = 0; i < floatsCount; i++) { + int floatCount = size / 4; + _animationData = new float[floatCount]; + for (int i = 0; i < floatCount; i++) { _animationData[i] = stream->readFloatLE(); } _m11ptr = _animationData; - _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? framesCount : 1); - _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? framesCount : 1); - _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? framesCount : 1); - _m21ptr = _m14ptr + (_animatedParameters & 0x8 ? framesCount : 1); - _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? framesCount : 1); - _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? framesCount : 1); - _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? framesCount : 1); - _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? framesCount : 1); - _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? framesCount : 1); - _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? framesCount : 1); - _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? framesCount : 1); - _colorRPtr = _m34ptr + (_animatedParameters & 0x800 ? framesCount : 1); - _colorGPtr = _colorRPtr + (_animatedParameters & 0x1000 ? framesCount : 1); - _colorBPtr = _colorGPtr + (_animatedParameters & 0x2000 ? framesCount : 1); - _falloffStartPtr = _colorBPtr + (_animatedParameters & 0x4000 ? framesCount : 1); - _falloffEndPtr = _falloffStartPtr + (_animatedParameters & 0x8000 ? framesCount : 1); - _angleStartPtr = _falloffEndPtr + (_animatedParameters & 0x10000 ? framesCount : 1); - _angleEndPtr = _angleStartPtr + (_animatedParameters & 0x20000 ? framesCount : 1); + _m12ptr = _m11ptr + (_animatedParameters & 0x1 ? frameCount : 1); + _m13ptr = _m12ptr + (_animatedParameters & 0x2 ? frameCount : 1); + _m14ptr = _m13ptr + (_animatedParameters & 0x4 ? frameCount : 1); + _m21ptr = _m14ptr + (_animatedParameters & 0x8 ? frameCount : 1); + _m22ptr = _m21ptr + (_animatedParameters & 0x10 ? frameCount : 1); + _m23ptr = _m22ptr + (_animatedParameters & 0x20 ? frameCount : 1); + _m24ptr = _m23ptr + (_animatedParameters & 0x40 ? frameCount : 1); + _m31ptr = _m24ptr + (_animatedParameters & 0x80 ? frameCount : 1); + _m32ptr = _m31ptr + (_animatedParameters & 0x100 ? frameCount : 1); + _m33ptr = _m32ptr + (_animatedParameters & 0x200 ? frameCount : 1); + _m34ptr = _m33ptr + (_animatedParameters & 0x400 ? frameCount : 1); + _colorRPtr = _m34ptr + (_animatedParameters & 0x800 ? frameCount : 1); + _colorGPtr = _colorRPtr + (_animatedParameters & 0x1000 ? frameCount : 1); + _colorBPtr = _colorGPtr + (_animatedParameters & 0x2000 ? frameCount : 1); + _falloffStartPtr = _colorBPtr + (_animatedParameters & 0x4000 ? frameCount : 1); + _falloffEndPtr = _falloffStartPtr + (_animatedParameters & 0x8000 ? frameCount : 1); + _angleStartPtr = _falloffEndPtr + (_animatedParameters & 0x10000 ? frameCount : 1); + _angleEndPtr = _angleStartPtr + (_animatedParameters & 0x20000 ? frameCount : 1); setupFrame(frame); } void Light::setupFrame(int frame) { - int offset = frame % _framesCount; + int offset = frame % _frameCount; _matrix._m[0][0] = (_animatedParameters & 0x1 ? _m11ptr[offset] : *_m11ptr); _matrix._m[0][1] = (_animatedParameters & 0x2 ? _m12ptr[offset] : *_m12ptr); _matrix._m[0][2] = (_animatedParameters & 0x4 ? _m13ptr[offset] : *_m13ptr); @@ -143,11 +143,11 @@ void Light::setupFrame(int frame) { _angleEnd = (_animatedParameters & 0x40000 ? _angleEndPtr[offset] : *_angleEndPtr); } -float Light::calculate(Vector3 start, Vector3 end) { +float Light::calculate(Vector3 start, Vector3 end) const { return calculateFalloutCoefficient(_matrix * start, _matrix * end, _falloffStart, _falloffEnd); } -void Light::calculateColor(Color *outColor, Vector3 position) { +void Light::calculateColor(Color *outColor, Vector3 position) const { Vector3 positionT = _matrix * position; float att = attenuation(_falloffStart, _falloffEnd, positionT.length()); outColor->r = _color.r * att; @@ -155,7 +155,7 @@ void Light::calculateColor(Color *outColor, Vector3 position) { outColor->b = _color.b * att; } -float Light::calculateFalloutCoefficient(Vector3 start, Vector3 end, float falloffStart, float falloffEnd) { +float Light::calculateFalloutCoefficient(Vector3 start, Vector3 end, float falloffStart, float falloffEnd) const { if (falloffEnd == 0.0f) { return 1.0e30f; } @@ -177,7 +177,7 @@ float Light::calculateFalloutCoefficient(Vector3 start, Vector3 end, float fallo return 1.0e30f; } -float Light::attenuation(float min, float max, float distance) { +float Light::attenuation(float min, float max, float distance) const { if (max == 0.0f) { return 1.0f; } @@ -192,7 +192,7 @@ float Light::attenuation(float min, float max, float distance) { return 0.0f; } -float Light1::calculate(Vector3 start, Vector3 end) { +float Light1::calculate(Vector3 start, Vector3 end) const { start = _matrix * start; end = _matrix * end; @@ -217,7 +217,7 @@ float Light1::calculate(Vector3 start, Vector3 end) { } } -void Light1::calculateColor(Color *outColor, Vector3 position) { +void Light1::calculateColor(Color *outColor, Vector3 position) const { Vector3 positionT = _matrix * position; outColor->r = 0.0f; @@ -234,7 +234,7 @@ void Light1::calculateColor(Color *outColor, Vector3 position) { } } -float Light2::calculate(Vector3 start, Vector3 end) { +float Light2::calculate(Vector3 start, Vector3 end) const { start = _matrix * start; end = _matrix * end; @@ -261,7 +261,7 @@ float Light2::calculate(Vector3 start, Vector3 end) { } } -void Light2::calculateColor(Color *outColor, Vector3 position) { +void Light2::calculateColor(Color *outColor, Vector3 position) const { Vector3 positionT = _matrix * position; outColor->r = 0.0f; @@ -279,7 +279,7 @@ void Light2::calculateColor(Color *outColor, Vector3 position) { } } -void Light3::calculateColor(Color *outColor, Vector3 position) { +void Light3::calculateColor(Color *outColor, Vector3 position) const { Vector3 positionT = _matrix * position; outColor->r = 0.0f; @@ -296,7 +296,7 @@ void Light3::calculateColor(Color *outColor, Vector3 position) { } } -void Light4::calculateColor(Color *outColor, Vector3 position) { +void Light4::calculateColor(Color *outColor, Vector3 position) const { Vector3 positionT = _matrix * position; outColor->r = 0.0f; @@ -314,11 +314,11 @@ void Light4::calculateColor(Color *outColor, Vector3 position) { } } -float LightAmbient::calculate(Vector3 start, Vector3 end) { +float LightAmbient::calculate(Vector3 start, Vector3 end) const { return 1.0e30f; } -void LightAmbient::calculateColor(Color *outColor, Vector3 position) { +void LightAmbient::calculateColor(Color *outColor, Vector3 position) const { outColor->r = _color.r; outColor->g = _color.g; outColor->b = _color.b; diff --git a/engines/bladerunner/light.h b/engines/bladerunner/light.h index 7b05378be2..8ad86368ea 100644 --- a/engines/bladerunner/light.h +++ b/engines/bladerunner/light.h @@ -37,84 +37,84 @@ namespace BladeRunner { class Lights; class Light { -#if _DEBUG +#if BLADERUNNER_DEBUG_RENDERING friend class BladeRunnerEngine; #endif friend class Lights; friend class SliceRenderer; protected: - char _name[20]; - int _framesCount; - int _animated; - int _animatedParameters; + char _name[20]; + int _frameCount; + int _animated; + int _animatedParameters; Matrix4x3 _matrix; - Color _color; - float _falloffStart; - float _falloffEnd; - float _angleStart; - float _angleEnd; - float *_animationData; - float *_m11ptr; - float *_m12ptr; - float *_m13ptr; - float *_m14ptr; - float *_m21ptr; - float *_m22ptr; - float *_m23ptr; - float *_m24ptr; - float *_m31ptr; - float *_m32ptr; - float *_m33ptr; - float *_m34ptr; - float *_colorRPtr; - float *_colorGPtr; - float *_colorBPtr; - float *_falloffStartPtr; - float *_falloffEndPtr; - float *_angleStartPtr; - float *_angleEndPtr; -// Light *_next; + Color _color; + float _falloffStart; + float _falloffEnd; + float _angleStart; + float _angleEnd; + float *_animationData; + float *_m11ptr; + float *_m12ptr; + float *_m13ptr; + float *_m14ptr; + float *_m21ptr; + float *_m22ptr; + float *_m23ptr; + float *_m24ptr; + float *_m31ptr; + float *_m32ptr; + float *_m33ptr; + float *_m34ptr; + float *_colorRPtr; + float *_colorGPtr; + float *_colorBPtr; + float *_falloffStartPtr; + float *_falloffEndPtr; + float *_angleStartPtr; + float *_angleEndPtr; public: Light(); virtual ~Light(); - void read(Common::ReadStream *stream, int framesCount, int frame, int animated); - void readVqa(Common::ReadStream *stream, int framesCount, int frame, int animated); + void read(Common::ReadStream *stream, int frameCount, int frame, int animated); + void readVqa(Common::ReadStream *stream, int frameCount, int frame, int animated); void setupFrame(int frame); - virtual float calculate(Vector3 start, Vector3 end); - virtual void calculateColor(Color *outColor, Vector3 position); + virtual float calculate(Vector3 start, Vector3 end) const; + virtual void calculateColor(Color *outColor, Vector3 position) const; protected: - float calculateFalloutCoefficient(Vector3 start, Vector3 end, float a3, float a4); - float attenuation(float min, float max, float distance); + float calculateFalloutCoefficient(Vector3 start, Vector3 end, float a3, float a4) const; + float attenuation(float min, float max, float distance) const; }; class Light1 : public Light { - float calculate(Vector3 start, Vector3 end); - void calculateColor(Color *outColor, Vector3 position); + float calculate(Vector3 start, Vector3 end) const; + void calculateColor(Color *outColor, Vector3 position) const; }; class Light2 : public Light { - float calculate(Vector3 start, Vector3 end); - void calculateColor(Color *outColor, Vector3 position); + float calculate(Vector3 start, Vector3 end) const; + void calculateColor(Color *outColor, Vector3 position) const; }; class Light3 : public Light { - void calculateColor(Color *outColor, Vector3 position); + void calculateColor(Color *outColor, Vector3 position) const; }; class Light4 : public Light { - void calculateColor(Color *outColor, Vector3 position); + void calculateColor(Color *outColor, Vector3 position) const; }; class LightAmbient : public Light { - float calculate(Vector3 start, Vector3 end); - void calculateColor(Color *outColor, Vector3 position); + float calculate(Vector3 start, Vector3 end) const; + void calculateColor(Color *outColor, Vector3 position) const; }; } // End of namespace BladeRunner + #endif diff --git a/engines/bladerunner/lights.cpp b/engines/bladerunner/lights.cpp index 811d72f31f..ccb339c4a8 100644 --- a/engines/bladerunner/lights.cpp +++ b/engines/bladerunner/lights.cpp @@ -39,13 +39,13 @@ Lights::~Lights() { reset(); } -void Lights::read(Common::ReadStream *stream, int framesCount) { +void Lights::read(Common::ReadStream *stream, int frameCount) { _ambientLightColor.r = stream->readFloatLE(); _ambientLightColor.g = stream->readFloatLE(); _ambientLightColor.b = stream->readFloatLE(); - uint _lightsCount = stream->readUint32LE(); - for (uint i = 0; i < _lightsCount; i++) { + uint _lightCount = stream->readUint32LE(); + for (uint i = 0; i < _lightCount; i++) { Light *light; int type = stream->readUint32LE(); switch (type) { @@ -68,7 +68,7 @@ void Lights::read(Common::ReadStream *stream, int framesCount) { light = new Light(); } - light->read(stream, framesCount, _frame, 0); + light->read(stream, frameCount, _frame, 0); _lights.push_back(light); } } @@ -86,7 +86,7 @@ void Lights::readVqa(Common::ReadStream *stream) { if (stream->eos()) return; - int framesCount = stream->readUint32LE(); + int frameCount = stream->readUint32LE(); int count = stream->readUint32LE(); for (int i = 0; i < count; i++) { int lightType = stream->readUint32LE(); @@ -110,7 +110,7 @@ void Lights::readVqa(Common::ReadStream *stream) { default: light = new Light(); } - light->readVqa(stream, framesCount, _frame, 1); + light->readVqa(stream, frameCount, _frame, 1); _lights.push_back(light); } } diff --git a/engines/bladerunner/lights.h b/engines/bladerunner/lights.h index a6f2a728ce..904a96f425 100644 --- a/engines/bladerunner/lights.h +++ b/engines/bladerunner/lights.h @@ -32,7 +32,7 @@ namespace BladeRunner { class Lights { -#if _DEBUG +#if BLADERUNNER_DEBUG_RENDERING friend class BladeRunnerEngine; #endif friend class SliceRendererLights; @@ -42,18 +42,18 @@ class Lights { Color _ambientLightColor; Common::Array _lights; int _frame; - //char gap[28]; public: Lights(BladeRunnerEngine *vm); ~Lights(); - void read(Common::ReadStream *stream, int framesCount); + void read(Common::ReadStream *stream, int frameCount); void readVqa(Common::ReadStream *stream); void reset(); void setupFrame(int frame); + private: void removeAnimated(); }; diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk index 89419d41d0..6aadb972db 100644 --- a/engines/bladerunner/module.mk +++ b/engines/bladerunner/module.mk @@ -1,10 +1,10 @@ MODULE := engines/bladerunner MODULE_OBJS = \ - adq.o \ actor.o \ actor_clues.o \ actor_combat.o \ + actor_dialogue_queue.o \ actor_walk.o \ adpcm_decoder.o \ ambient_sounds.o \ @@ -22,11 +22,10 @@ MODULE_OBJS = \ decompress_lzo.o \ detection.o \ dialogue_menu.o \ - elevator.o \ fog.o \ font.o \ - gameflags.o \ - gameinfo.o \ + game_flags.o \ + game_info.o \ image.o \ item.o \ item_pickup.o \ @@ -174,10 +173,24 @@ MODULE_OBJS = \ shape.o \ slice_animations.o \ slice_renderer.o \ - spinner.o \ suspects_database.o \ text_resource.o \ - ui_image_picker.o \ + ui/elevator.o \ + ui/kia.o \ + ui/kia_log.o \ + ui/kia_section_base.o \ + ui/kia_section_clues.o \ + ui/kia_section_crimes.o \ + ui/kia_section_help.o \ + ui/kia_section_settings.o \ + ui/kia_shapes.o \ + ui/spinner.o \ + ui/ui_check_box.o \ + ui/ui_container.o \ + ui/ui_image_picker.o \ + ui/ui_input_box.o \ + ui/ui_scroll_box.o \ + ui/ui_slider.o \ view.o \ vqa_decoder.o \ vqa_player.o \ diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp index 8293cbc59c..35059f4e00 100644 --- a/engines/bladerunner/mouse.cpp +++ b/engines/bladerunner/mouse.cpp @@ -35,7 +35,8 @@ namespace BladeRunner { -Mouse::Mouse(BladeRunnerEngine *vm) : _vm(vm) { +Mouse::Mouse(BladeRunnerEngine *vm) { + _vm = vm; _cursor = 0; _frame = 3; _hotspotX = 0; @@ -149,7 +150,7 @@ void Mouse::setCursor(int cursor) { } } -void Mouse::getXY(int *x, int *y) { +void Mouse::getXY(int *x, int *y) const { *x = _x; *y = _y; } @@ -164,7 +165,7 @@ void Mouse::enable() { } } -bool Mouse::isDisabled() { +bool Mouse::isDisabled() const { return _disabledCounter > 0; } @@ -311,7 +312,7 @@ void Mouse::tick(int x, int y) { } // TEST: RC01 after intro: [290, 216] -> [-204.589249 51.450668 7.659241] -Vector3 Mouse::getXYZ(int x, int y) { +Vector3 Mouse::getXYZ(int x, int y) const { if (_vm->_scene->getSetId() == -1) return Vector3(); diff --git a/engines/bladerunner/mouse.h b/engines/bladerunner/mouse.h index 214089fed6..64b01992d0 100644 --- a/engines/bladerunner/mouse.h +++ b/engines/bladerunner/mouse.h @@ -26,7 +26,7 @@ #include "bladerunner/vector.h" namespace Graphics { - struct Surface; +struct Surface; } namespace BladeRunner { @@ -52,11 +52,11 @@ public: void setCursor(int cursor); - void getXY(int *x, int *y); + void getXY(int *x, int *y) const; void disable(); void enable(); - bool isDisabled(); + bool isDisabled() const; void draw(Graphics::Surface &surface, int x, int y); void updateCursorFrame(); @@ -64,7 +64,7 @@ public: void tick(int x, int y); // private: - Vector3 getXYZ(int x, int y); + Vector3 getXYZ(int x, int y) const; }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/movement_track.cpp b/engines/bladerunner/movement_track.cpp index 702a1187f1..13b60d1d93 100644 --- a/engines/bladerunner/movement_track.cpp +++ b/engines/bladerunner/movement_track.cpp @@ -37,7 +37,7 @@ void MovementTrack::reset() { _lastIndex = 0; _hasNext = false; _paused = false; - for (int i = 0; i < 100; i++) { + for (int i = 0; i < kSize; i++) { _entries[i].waypointId = -1; _entries[i].delay = -1; _entries[i].angle = -1; @@ -50,7 +50,7 @@ int MovementTrack::append(int waypointId, int delay, int running) { } int MovementTrack::append(int waypointId, int delay, int angle, int running) { - if (_lastIndex >= 100) { + if (_lastIndex >= kSize) { return 0; } @@ -82,11 +82,11 @@ void MovementTrack::unpause() { _paused = false; } -bool MovementTrack::isPaused() { +bool MovementTrack::isPaused() const { return _paused; } -bool MovementTrack::hasNext() { +bool MovementTrack::hasNext() const { return _hasNext; } diff --git a/engines/bladerunner/movement_track.h b/engines/bladerunner/movement_track.h index bffac4855a..174b222b1e 100644 --- a/engines/bladerunner/movement_track.h +++ b/engines/bladerunner/movement_track.h @@ -30,23 +30,21 @@ namespace BladeRunner { class BladeRunnerEngine; class BoundingBox; -struct MovementTrackEntry { - int waypointId; - int delay; - int angle; - int running; -}; - class MovementTrack { -// BladeRunnerEngine *_vm; + static const int kSize = 100; -private: - int _currentIndex; - int _lastIndex; - bool _hasNext; - bool _paused; - MovementTrackEntry _entries[100]; - void reset(); + struct Entry { + int waypointId; + int delay; + int angle; + int running; + }; + + int _currentIndex; + int _lastIndex; + bool _hasNext; + bool _paused; + Entry _entries[kSize]; public: MovementTrack(); @@ -57,11 +55,14 @@ public: void repeat(); void pause(); void unpause(); - bool isPaused(); - bool hasNext(); + bool isPaused() const; + bool hasNext() const; bool next(int *waypointId, int *delay, int *angle, int *running); //int saveGame(); + +private: + void reset(); }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/music.cpp b/engines/bladerunner/music.cpp index 6b7a733338..88fb3e0b55 100644 --- a/engines/bladerunner/music.cpp +++ b/engines/bladerunner/music.cpp @@ -25,15 +25,16 @@ #include "bladerunner/audio_mixer.h" #include "bladerunner/aud_stream.h" #include "bladerunner/bladerunner.h" +#include "bladerunner/game_info.h" #include "common/timer.h" namespace BladeRunner { -Music::Music(BladeRunnerEngine *vm) - : _vm(vm) { +Music::Music(BladeRunnerEngine *vm) { + _vm = vm; _channel = -1; - _volume = 65; + _musicVolume = 65; _isPlaying = false; _isPaused = false; _current.loop = false; @@ -52,14 +53,14 @@ Music::~Music() { _vm->getTimerManager()->removeTimerProc(timerCallbackNext); } -bool Music::play(const char *trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) { +bool Music::play(const Common::String &trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) { //Common::StackLock lock(_mutex); - if (_volume <= 0) { + if (_musicVolume <= 0) { return false; } - int volumeAdjusted = volume * _volume / 100; + int volumeAdjusted = volume * _musicVolume / 100; int volumeStart = volumeAdjusted; if (timeFadeIn > 0) { volumeStart = 1; @@ -134,7 +135,7 @@ void Music::stop(int delay) { void Music::adjust(int volume, int pan, int delay) { if (volume != -1) { - adjustVolume(_volume * volume/ 100, delay); + adjustVolume(_musicVolume * volume/ 100, delay); } if (pan != -101) { adjustPan(pan, delay); @@ -146,11 +147,21 @@ bool Music::isPlaying() { } void Music::setVolume(int volume) { - _volume = volume; + _musicVolume = volume; if (volume <= 0) { stop(2); } else if (isPlaying()) { - _vm->_audioMixer->adjustVolume(_channel, _volume * _current.volume / 100, 120); + _vm->_audioMixer->adjustVolume(_channel, _musicVolume * _current.volume / 100, 120); + } +} + +int Music::getVolume() { + return _musicVolume; +} + +void Music::playSample() { + if (!isPlaying()) { + play(_vm->_gameInfo->getSfxTrack(512), 100, 0, 2, -1, 0, 3); } } @@ -214,7 +225,7 @@ void Music::timerCallbackNext(void *refCon) { ((Music *)refCon)->next(); } -byte *Music::getData(const char *name) { +byte *Music::getData(const Common::String &name) { // NOTE: This is not part original game, loading data is done in the mixer and its using buffering to limit memory usage Common::SeekableReadStream *stream = _vm->getResourceStream(name); if (stream == nullptr) { diff --git a/engines/bladerunner/music.h b/engines/bladerunner/music.h index 3dcf969a8a..de19942a20 100644 --- a/engines/bladerunner/music.h +++ b/engines/bladerunner/music.h @@ -45,7 +45,7 @@ class Music { BladeRunnerEngine *_vm; Common::Mutex _mutex; - int _volume; + int _musicVolume; int _channel; int _isNextPresent; int _isPlaying; @@ -59,12 +59,14 @@ public: Music(BladeRunnerEngine *vm); ~Music(); - bool play(const char *trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut); + bool play(const Common::String &trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut); void stop(int delay); void adjust(int volume, int pan, int delay); bool isPlaying(); void setVolume(int volume); + int getVolume(); + void playSample(); private: void adjustVolume(int volume, int delay); @@ -78,7 +80,7 @@ private: static void timerCallbackFadeOut(void *refCon); static void timerCallbackNext(void *refCon); - byte *getData(const char* name); + byte *getData(const Common::String &name); }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/obstacles.cpp b/engines/bladerunner/obstacles.cpp index 9fbdc0ad5e..8061e782f2 100644 --- a/engines/bladerunner/obstacles.cpp +++ b/engines/bladerunner/obstacles.cpp @@ -28,28 +28,24 @@ namespace BladeRunner { Obstacles::Obstacles(BladeRunnerEngine *vm) { _vm = vm; - _polygons = new ObstaclesPolygon[50]; - _polygonsBackup = new ObstaclesPolygon[50]; _vertices = new Vector2[150]; clear(); } Obstacles::~Obstacles() { delete[] _vertices; - delete[] _polygonsBackup; - delete[] _polygons; } void Obstacles::clear() { - for (int i = 0; i < 50; i++) { - _polygons[i]._isPresent = false; - _polygons[i]._verticesCount = 0; - for (int j = 0; j < 160; j++) { - _polygons[i]._vertices[j].x = 0.0f; - _polygons[i]._vertices[j].y = 0.0f; + for (int i = 0; i < kPolygonCount; i++) { + _polygons[i].isPresent = false; + _polygons[i].verticeCount = 0; + for (int j = 0; j < kVertexCount; j++) { + _polygons[i].vertices[j].x = 0.0f; + _polygons[i].vertices[j].y = 0.0f; } } - _verticesCount = 0; + _verticeCount = 0; _backup = false; _count = 0; } @@ -57,7 +53,7 @@ void Obstacles::clear() { void Obstacles::add(float x0, float z0, float x1, float z1) { } -bool Obstacles::find(const Vector3 &from, const Vector3 &to, Vector3 *next) { +bool Obstacles::find(const Vector3 &from, const Vector3 &to, Vector3 *next) const { //TODO *next = to; return true; diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h index f9641bfe6b..c2c84c3bfa 100644 --- a/engines/bladerunner/obstacles.h +++ b/engines/bladerunner/obstacles.h @@ -27,29 +27,31 @@ namespace BladeRunner { -struct ObstaclesPolygon { - bool _isPresent; - int _verticesCount; - float _left; - float _bottom; - float _right; - float _top; - Vector2 _vertices[160]; - int _vertexType[160]; -}; - class BladeRunnerEngine; class Obstacles { + static const int kPolygonCount = 50; + static const int kVertexCount = 160; + + struct Polygon { + bool isPresent; + int verticeCount; + float left; + float bottom; + float right; + float top; + Vector2 vertices[kVertexCount]; + int vertexType[kVertexCount]; + }; + BladeRunnerEngine *_vm; -private: - ObstaclesPolygon *_polygons; - ObstaclesPolygon *_polygonsBackup; - Vector2 *_vertices; - int _verticesCount; - int _count; - bool _backup; + Polygon _polygons[kPolygonCount]; + Polygon _polygonsBackup[kPolygonCount]; + Vector2 *_vertices; + int _verticeCount; + int _count; + bool _backup; public: Obstacles(BladeRunnerEngine *vm); @@ -57,7 +59,7 @@ public: void clear(); void add(float x0, float z0, float x1, float z1); - bool find(const Vector3 &from, const Vector3 &to, Vector3 *next); + bool find(const Vector3 &from, const Vector3 &to, Vector3 *next) const; void backup(); void restore(); }; diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp index 4791259e32..6d76162dd9 100644 --- a/engines/bladerunner/outtake.cpp +++ b/engines/bladerunner/outtake.cpp @@ -44,7 +44,7 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co resName = resName + ".VQA"; - VQAPlayer vqa_player(_vm, &_vm->_surfaceGame); + VQAPlayer vqa_player(_vm, &_vm->_surfaceFront); vqa_player.open(resName); @@ -60,7 +60,7 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co break; if (frame >= 0) { - _vm->blitToScreen(_vm->_surfaceGame); + _vm->blitToScreen(_vm->_surfaceFront); } _vm->_system->delayMillis(10); diff --git a/engines/bladerunner/outtake.h b/engines/bladerunner/outtake.h index acbd00f6a6..8386965fdf 100644 --- a/engines/bladerunner/outtake.h +++ b/engines/bladerunner/outtake.h @@ -35,7 +35,9 @@ class OuttakePlayer { BladeRunnerEngine *_vm; public: - OuttakePlayer(BladeRunnerEngine *vm) : _vm(vm) {} + OuttakePlayer(BladeRunnerEngine *vm) { + _vm = vm; + } void play(const Common::String &name, bool noLocalization, int container); }; diff --git a/engines/bladerunner/overlays.cpp b/engines/bladerunner/overlays.cpp index 6e94b291e5..cd6afe8454 100644 --- a/engines/bladerunner/overlays.cpp +++ b/engines/bladerunner/overlays.cpp @@ -31,9 +31,8 @@ namespace BladeRunner { -Overlays::Overlays(BladeRunnerEngine *vm) - : _vm(vm) -{ +Overlays::Overlays(BladeRunnerEngine *vm) { + _vm = vm; } bool Overlays::init() { @@ -65,7 +64,7 @@ int Overlays::play(const Common::String &name, int loopId, int loopForever, int return index; } _videos[index].id = id; - _videos[index].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceGame); + _videos[index].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront); // repeat forever _videos[index].vqaPlayer->setBeginAndEndFrame(0, 0, -1, kLoopSetModeJustStart, nullptr, nullptr); diff --git a/engines/bladerunner/overlays.h b/engines/bladerunner/overlays.h index f547253269..5054051d87 100644 --- a/engines/bladerunner/overlays.h +++ b/engines/bladerunner/overlays.h @@ -27,7 +27,7 @@ #include "common/str.h" namespace Graphics { - struct Surface; +struct Surface; } namespace BladeRunner { @@ -35,21 +35,22 @@ namespace BladeRunner { class BladeRunnerEngine; class VQAPlayer; -struct OverlayVideo { - bool loaded; - VQAPlayer *vqaPlayer; - // char name[13]; - int32 id; - int field0; - int field1; - int field2; -}; class Overlays { static const int kOverlayVideos = 5; + struct Video { + bool loaded; + VQAPlayer *vqaPlayer; + // char name[13]; + int32 id; + int field0; + int field1; + int field2; + }; + BladeRunnerEngine *_vm; - Common::Array _videos; + Common::Array