diff options
229 files changed, 54159 insertions, 0 deletions
diff --git a/common/stream.h b/common/stream.h index c6c300fa97..e0ffc47d7f 100644 --- a/common/stream.h +++ b/common/stream.h @@ -402,6 +402,22 @@ public: #endif /** + * Read a 32-bit floating point value stored in little endian (LSB first) + * order from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occurred (for which client code can check by + * calling err() and eos() ). + */ + FORCEINLINE float readFloatLE() { + uint32 n = readUint32LE(); + float f; + + memcpy(&f, &n, 4); + + return f; + } + + /** * Read the specified amount of data into a malloc'ed buffer * which then is wrapped into a MemoryReadStream. * The returned stream might contain less data than requested, diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp new file mode 100644 index 0000000000..7509bb9575 --- /dev/null +++ b/engines/bladerunner/actor.cpp @@ -0,0 +1,1054 @@ +/* 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.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor_clues.h" +#include "bladerunner/actor_combat.h" +#include "bladerunner/actor_walk.h" +#include "bladerunner/audio_speech.h" +#include "bladerunner/boundingbox.h" +#include "bladerunner/gameinfo.h" +#include "bladerunner/items.h" +#include "bladerunner/mouse.h" +#include "bladerunner/movement_track.h" +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/script/script.h" +#include "bladerunner/slice_animations.h" +#include "bladerunner/slice_renderer.h" +#include "bladerunner/waypoints.h" + +namespace BladeRunner { + +Actor::Actor(BladeRunnerEngine *vm, int actorId) { + _vm = vm; + _id = actorId; + + _walkInfo = new ActorWalk(vm); + _movementTrack = new MovementTrack(); + _clues = new ActorClues(vm, (actorId && actorId != 99) ? 2 : 4); + _bbox = new BoundingBox(); + _combatInfo = new ActorCombat(vm); + + _friendlinessToOther = new int[_vm->_gameInfo->getActorCount()]; +} + +Actor::~Actor() { + delete[] _friendlinessToOther; + delete _combatInfo; + delete _bbox; + delete _clues; + delete _movementTrack; + delete _walkInfo; +} + +void Actor::setup(int actorId) { + _id = actorId; + _setId = -1; + + _position = Vector3(0.0, 0.0, 0.0); + _facing = 512; + _targetFacing = -1; + _walkboxId = -1; + + _animationId = 0; + _animationFrame = 0; + _fps = 15; + _frame_ms = 1000 / _fps; + + _isTargetable = false; + _isInvisible = false; + _isImmuneToObstacles = false; + + _isRetired = false; + + _width = 0; + _height = 0; + _retiredWidth = 0; + _retiredHeight = 0; + + for (int i = 0; i != 7; ++i) { + _timersRemain[i] = 0; + _timersStart[i] = _vm->getTotalPlayTime(); + } + + _scale = 1.0; + + _honesty = 50; + _intelligence = 50; + _combatAggressiveness = 50; + _stability = 50; + + _currentHP = 50; + _maxHP = 50; + _goalNumber = -1; + + _timersRemain[4] = 60000; + _animationMode = -1; + _screenRectangle = Common::Rect(-1, -1, -1, -1); + + _combatAnimationMode = 4; + _unknown1 = 7; + _unknown2 = 8; + + int actorCount = (int)_vm->_gameInfo->getActorCount(); + for (int i = 0; i != actorCount; ++i) + _friendlinessToOther[i] = 50; + + _combatInfo->setup(); + _clues->removeAll(); + _movementTrack->flush(); + + _actorSpeed = Vector3(); +} + +void Actor::changeAnimationMode(int animationMode, bool force) { + if (force) + _animationMode = -1; + + if (animationMode != _animationMode) { + _vm->_aiScripts->ChangeAnimationMode(_id, animationMode); + _animationMode = animationMode; + } +} + +void Actor::setFPS(int fps) { + _fps = fps; + + if (fps == 0) { + _frame_ms = 0; + } else if (fps == -1) { + _frame_ms = -1000; + } else if (fps == -2) { + _fps = _vm->_sliceAnimations->getFPS(_animationId); + _frame_ms = 1000 / _fps; + } else { + _frame_ms = 1000 / fps; + } +} + +void Actor::processMovement() { + /*if (movementTrack::is_paused(this->movementTrack) != 1 && this->id) + { + if (this->walkingWaypointId >= 0 && this->timeoutWalkingWaypoint >= 0) + { + worldWaypoints::get_sceneId(WorldWaypoints, this->walkingWaypointId); + if (!this->timeoutWalkingWaypoint) + { + this->timeoutWalkingWaypoint = 1; + } + if (actorScript::call_ReachedMovementTrackWaypoint(ActorScript, this->id, this->walkingWaypointId) == 1) + { + seconds = this->timeoutWalkingWaypoint; + if (seconds > 1) + { + actor::changeAnimationMode(this, 0, 0); + seconds = this->timeoutWalkingWaypoint; + } + actor::startTimer(this, 3, seconds); + } + } + this->walkingWaypointId = -1; + this->timeoutWalkingWaypoint = 0; + }*/ +} + +bool Actor::loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning) { + return loopWalk(_vm->_actors[otherActorId]->_position, destinationOffset, a3, run, _position, 24.0f, 24.0f, a5, isRunning, false); +} + +bool Actor::loopWalkToItem(int itemId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning) { + float x, y, z; + int width, height; + _vm->_items->getXYZ(itemId, &x, &y, &z); + _vm->_items->getWidthHeight(itemId, &width, &height); + Vector3 itemPosition(x, y, z); + + return loopWalk(itemPosition, destinationOffset, a3, run, _position, width, 24.0f, a5, isRunning, false); +} + +void Actor::setAtXYZ(const Vector3 &position, int facing, bool snapFacing, bool moving, bool retired) { + _position = position; + setFacing(facing, snapFacing); + + if (_vm->_scene->_setId == _setId) { + _walkboxId = _vm->_scene->_set->findWalkbox(_position.x, _position.y); + } else { + _walkboxId = -1; + } + + setBoundingBox(_position, retired); + + _vm->_sceneObjects->remove(_id); + + if (_vm->_scene->getSetId() == _setId) { + _vm->_sceneObjects->addActor(_id, _bbox, &_screenRectangle, 1, moving, _isTargetable, retired); + } +} + +void Actor::setAtWaypoint(int waypointId, int angle, int moving, bool retired) { + Vector3 waypointPosition; + _vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z); + setAtXYZ(waypointPosition, angle, true, moving, retired); +} + +bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool a3, bool run, const Vector3 &start, float targetWidth, float targetSize, bool a8, bool *isRunning, bool async) { + if (true) { // simple walking + *isRunning = false; + bool stopped; + _walkInfo->setup(_id, false, _position, destination, false, &stopped); + + for (;;) { + _vm->gameTick(); + if (!_walkInfo->isWalking() && !_walkInfo->isRunning()) + break; + if (!_vm->_gameIsRunning) + break; + } + return false; + } else { + //TODO: + // original code, not yet working + *isRunning = false; + + if (destinationOffset > 0) { + float dist = distance(_position, destination); + if (dist - targetSize <= destinationOffset) { + return false; + } + } + + if (a8 && !async && _id && destinationOffset <= 24) { + if (distance(_vm->_playerActor->_position, destination) <= 24.0f) { + _vm->_playerActor->walkToU(destination, 48.0f); + } + } + + if (_id) { + a3 = false; + } + + Vector3 destinationX(destination); + + if (destinationOffset > 0) { + walkFindU2(&destinationX, targetWidth, destinationOffset, targetSize, _position, destination); + } + + bool walking = walkTo(run, destinationX, a8); + + if (async) { + return false; + } + + if (!walking && destinationOffset > 0) { + walking = walkTo(run, destination, a8); + } + + if (!walking) { + return false; + } + + if (async) { + return false; + } + if (_id) { + _vm->_mouse->disable(); + } + if (a3) { + // TODO: + // dword_482990 = 1; + // dword_482994 = 0; + } else { + _vm->playerLosesControl(); + } + + if (a8) { + _inWalkLoop = true; + } + + bool v46 = false; + while (_walkInfo->isWalking() && _vm->_gameIsRunning) { + if (_walkInfo->isRunning()) { + *isRunning = true; + } + _vm->gameTick(); + if (_id == 0 && a3 /*&& dword_482994*/) { + stopWalking(false); + v46 = true; + } + } + if (a8) { + _inWalkLoop = false; + } + if (a3) { + // dword_482990 = 1; + } else { + _vm->playerGainsControl(); + } + if (!v46 && destinationOffset == 0 /* && !PlayerActorIdle*/) { + setAtXYZ(destination, _facing, true, false, false); + } + if (_id) { + _vm->_mouse->enable(); + } + return v46; + } +} + +bool Actor::walkTo(bool run, const Vector3 &destination, bool a3) { + bool isRunning; + + return _walkInfo->setup(_id, run, _position, destination, a3, &isRunning); +} + +bool Actor::loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool a3, bool run, bool a5, bool *isRunning) { + return loopWalk(destination, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, isRunning, false); +} + +bool Actor::loopWalkToSceneObject(const char *objectName, int destinationOffset, bool a3, bool run, bool a5, bool *isRunning) { + int sceneObject = _vm->_scene->_set->findObject(objectName); + if (sceneObject < 0) { + return true; + } + + BoundingBox bbox; + if (!_vm->_scene->_set->objectGetBoundingBox(sceneObject, &bbox)) { + return true; + } + + float x0, y0, z0, x1, y1, z1; + bbox.getXYZ(&x0, &y0, &z0, &x1, &y1, &z1); + + float closestDistance = distance(_position.x, _position.z, x0, z0); + float closestX = x0; + float closestZ = z0; + + float d = distance(_position.x, _position.z, x1, z0); + if (d < closestDistance) { + closestX = x1; + closestZ = z0; + closestDistance = d; + } + + d = distance(_position.x, _position.z, x1, z1); + if (d < closestDistance) { + closestX = x1; + closestZ = z1; + closestDistance = d; + } + + d = distance(_position.x, _position.z, x0, z1); + if (d < closestDistance) { + closestX = x0; + closestZ = z1; + closestDistance = d; + } + bool inWalkbox; + float y = _vm->_scene->_set->getAltitudeAtXZ(closestX, closestZ, &inWalkbox); + Vector3 destination(closestX, y, closestZ); + + return loopWalk(destination, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, isRunning, false); +} + +bool Actor::loopWalkToWaypoint(int waypointId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning) { + float x, y, z; + _vm->_waypoints->getXYZ(waypointId, &x, &y, &z); + Vector3 waypointPosition(x, y, z); + + return loopWalk(waypointPosition, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, isRunning, false); +} + +bool Actor::tick(bool forceDraw) { + int remain = 0; + bool needsUpdate = false; + if (_fps > 0) { + countdownTimerUpdate(5); + remain = countdownTimerGetRemainingTime(5); + needsUpdate = remain <= 0; + } else if (forceDraw) { + needsUpdate = true; + remain = 0; + } + + if (needsUpdate) { + int newAnimation = 0, newFrame = 0; + _vm->_aiScripts->UpdateAnimation(_id, &newAnimation, &newFrame); + + if (_animationId != newAnimation) { + if (_fps != 0 && _fps != -1) { + _animationId = newAnimation; + setFPS(-2); + } + } + _animationId = newAnimation; + _animationFrame = newFrame; + + Vector3 positionChange = _vm->_sliceAnimations->getPositionChange(_animationId); + float angleChange = _vm->_sliceAnimations->getFacingChange(_animationId); + + if (_id == 47) { + positionChange.x = 0.0f; + positionChange.y = 0.0f; + positionChange.z = 0.0f; + } + + if (isWalking()) { + if (0.0f <= positionChange.y) { + positionChange.y = -4.0f; + } + + this->_targetFacing = -1; + + bool walked = _walkInfo->tick(_id, -positionChange.y, false); + Vector3 pos; + int facing; + _walkInfo->getCurrentPosition(_id, &pos, &facing); + + setAtXYZ(pos, facing, false, this->_isMoving, false); + if (walked) { + _vm->_actors[_id]->changeAnimationMode(0); + + this->processMovement(); + if (this->inCombat()) { + this->changeAnimationMode(this->_combatAnimationMode, false); + } else { + this->changeAnimationMode(0, false); + } + } + } else { + if (angleChange != 0.0f) { + int facingChange = angleChange * (512.0f / M_PI); + if (facingChange != 0) { + this->_facing = this->_facing - facingChange; + if (this->_facing < 0) { + this->_facing += 1024; + } + + if (this->_facing >= 1024) { + this->_facing = this->_facing - 1024; + } + } + } + + if (0.0f != positionChange.x || 0.0f != positionChange.y || 0.0f != positionChange.z) { + if (this->_actorSpeed.x != 0.0f) { + positionChange.x = positionChange.x * this->_actorSpeed.x; + } + if (this->_actorSpeed.y != 0.0f) { + positionChange.y = positionChange.y * this->_actorSpeed.y; + } + if (this->_actorSpeed.z != 0.0f) { + positionChange.z = positionChange.z * this->_actorSpeed.z; + } + + float angle = _facing * (M_PI / 512.0f); + float sinx = sin(angle); + float cosx = cos(angle); + + float originalX = this->_position.x; + float originalY = this->_position.y; + float originalZ = this->_position.z; + + this->_position.x = this->_position.x + positionChange.x * cosx - positionChange.y * sinx; + this->_position.z = this->_position.z + positionChange.x * sinx + positionChange.y * cosx; + this->_position.y = this->_position.y + positionChange.z; + + if (_vm->_sceneObjects->existsOnXZ(this->_id, this->_position.x, this->_position.z, false, false) == 1 && !this->_isImmuneToObstacles) { + this->_position.x = originalX; + this->_position.y = originalY; + this->_position.z = originalZ; + } + setAtXYZ(this->_position, this->_facing, true, this->_isMoving, this->_isRetired); + } + } + } + + draw(); + + if (needsUpdate) { + int nextFrameTime = remain + _frame_ms; + if (nextFrameTime <= 0) + nextFrameTime = 1; + countdownTimerStart(5, nextFrameTime); + } + if (this->_targetFacing >= 0) { + if (this->_targetFacing == this->_facing) { + this->_targetFacing = -1; + } else { + this->setFacing(this->_targetFacing, false); + } + } + return false; +} + +void Actor::draw() { + Vector3 drawPosition(_position.x, -_position.z, _position.y + 2.0); + float drawAngle = M_PI - _facing * (M_PI / 512.0f); + float drawScale = _scale; + + // TODO: Handle SHORTY mode + + _vm->_sliceRenderer->drawInWorld(_animationId, _animationFrame, drawPosition, drawAngle, drawScale, _vm->_surface2, _vm->_zBuffer2); + _vm->_sliceRenderer->getScreenRectangle(&_screenRectangle, _animationId, _animationFrame, drawPosition, drawAngle, drawScale); +} + +int Actor::getSetId() { + return _setId; +} + +void Actor::setSetId(int setId) { + if (_setId == setId) { + return; + } + + int i; + + if (_setId > 0) { + for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) { + if (_vm->_actors[i]->_id != _id && _vm->_actors[i]->_setId == _setId) { + // TODO: _vm->_aiScripts->OtherAgentExitedThisScene( i, _id); + } + } + } + _setId = setId; + // TODO: _vm->_aiScripts->EnteredScene(_id, set); + if (_setId > 0) { + for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) { + if (_vm->_actors[i]->_id != _id && _vm->_actors[i]->_setId == _setId) { + // TODO: _vm->_aiScripts->OtherAgentEnteredThisScene(i, _id); + } + } + } +} + +void Actor::setFacing(int facing, bool halfOrSet) { + if (facing < 0 || facing >= 1024) { + return; + } + + if (halfOrSet) { + _facing = facing; + return; + } + + int cw; + int ccw; + int offset; + + if (facing > _facing) { + cw = facing - _facing; + ccw = _facing + 1024 - facing; + } else { + ccw = _facing - facing; + cw = facing + 1024 - _facing; + } + if (cw < ccw) { + if (cw <= 32) { + offset = cw; + } else { + offset = cw / 2; + } + } else { + if (ccw <= 32) { + offset = -ccw; + } else { + offset = -ccw / 2; + } + } + + _facing = (_facing + offset) % 1024; +} + +void Actor::setBoundingBox(const Vector3 &position, bool retired) { + if (retired) { + _bbox->setXYZ(position.x - (_retiredWidth / 2.0f), + position.y, + position.z - (_retiredWidth / 2.0f), + + position.x + (_retiredWidth / 2.0f), + position.y + _retiredHeight, + position.z + (_retiredWidth / 2.0f)); + } else { + _bbox->setXYZ(position.x - 12.0f, + position.y + 6.0f, + position.z - 12.0f, + + position.x + 12.0f, + position.y + 72.0f, + position.z + 12.0f); + } +} + +float Actor::distanceFromView(View *view) { + float xDist = this->_position.x - view->_cameraPosition.x; + float zDist = this->_position.z - view->_cameraPosition.z; + return sqrt(xDist * xDist + zDist * zDist); +} + +bool Actor::isWalking() { + return _walkInfo->isWalking(); +} + +void Actor::stopWalking(bool value) { + if (value && _id == 0) { + _vm->_playerActorIdle = true; + } + + if (isWalking()) { + _walkInfo->stop(_id, true, _combatAnimationMode, 0); + } else if (inCombat()) { + changeAnimationMode(_combatAnimationMode, false); + } else { + changeAnimationMode(0, false); + } +} + +void Actor::faceActor(int otherActorId, bool animate) { + if (_setId != _vm->_scene->_setId) { + return; + } + + Actor *otherActor = _vm->_actors[otherActorId]; + + if (_setId != otherActor->_setId) { + return; + } + + faceXYZ(otherActor->_position.x, otherActor->_position.y, otherActor->_position.z, animate); +} + +void Actor::faceObject(const char *objectName, bool animate) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) { + return; + } + + BoundingBox boundingBox; + _vm->_scene->objectGetBoundingBox(objectId, &boundingBox); + + float x0, y0, z0, x1, y1, z1; + boundingBox.getXYZ(&x0, &y0, &z0, &x1, &y1, &z1); + + float x = (x1 + x0) / 2.0f; + float z = (z1 + z0) / 2.0f; + faceXYZ(x, y0, z, animate); +} + +void Actor::faceItem(int itemId, bool animate) { + float x, y, z; + _vm->_items->getXYZ(itemId, &x, &y, &z); + faceXYZ(x, y, z, animate); +} + +void Actor::faceWaypoint(int waypointId, bool animate) { + float x, y, z; + _vm->_waypoints->getXYZ(waypointId, &x, &y, &z); + faceXYZ(x, y, z, animate); +} + +void Actor::faceXYZ(float x, float y, float z, bool animate) { + if (isWalking()) { + stopWalking(false); + } + if (x == _position.x && z == _position.z) { + return; + } + + int heading = angle_1024(_position.x, _position.z, x, z); + faceHeading(heading, animate); +} + +void Actor::faceCurrentCamera(bool animate) { + faceXYZ(_vm->_view->_cameraPosition.x, _vm->_view->_cameraPosition.y, -_vm->_view->_cameraPosition.z, animate); +} + +void Actor::faceHeading(int heading, bool animate) { + if (heading != _facing) { + if (animate) { + _targetFacing = heading; + } else { + setFacing(heading, true); + } + } +} + +void Actor::modifyFriendlinessToOther(int otherActorId, signed int change) { + _friendlinessToOther[otherActorId] = MIN(MAX(_friendlinessToOther[otherActorId] + change, 0), 100); +} + +void Actor::setFriendlinessToOther(int otherActorId, int friendliness) { + _friendlinessToOther[otherActorId] = friendliness; +} + +void Actor::setHonesty(int honesty) { + _honesty = honesty; +} + +void Actor::setIntelligence(int intelligence) { + _intelligence = intelligence; +} + +void Actor::setStability(int stability) { + _stability = stability; +} + +void Actor::setCombatAggressiveness(int combatAggressiveness) { + _combatAggressiveness = combatAggressiveness; +} + +void Actor::setInvisible(bool isInvisible) { + _isInvisible = isInvisible; +} + +void Actor::setImmunityToObstacles(bool isImmune) { + _isImmuneToObstacles = isImmune; +} + +void Actor::modifyCurrentHP(signed int change) { + _currentHP = MIN(MAX(_currentHP + change, 0), 100); + if (_currentHP > 0) + retire(false, 0, 0, -1); +} + +void Actor::modifyMaxHP(signed int change) { + _maxHP = MIN(MAX(_maxHP + change, 0), 100); +} + +void Actor::modifyCombatAggressiveness(signed int change) { + _combatAggressiveness = MIN(MAX(_combatAggressiveness + change, 0), 100); +} + +void Actor::modifyHonesty(signed int change) { + _honesty = MIN(MAX(_honesty + change, 0), 100); +} + +void Actor::modifyIntelligence(signed int change) { + _intelligence = MIN(MAX(_intelligence + change, 0), 100); +} + +void Actor::modifyStability(signed int change) { + _stability = MIN(MAX(_stability + change, 0), 100); +} + +void Actor::setFlagDamageAnimIfMoving(bool value) { + _damageAnimIfMoving = value; +} + +bool Actor::getFlagDamageAnimIfMoving() { + return _damageAnimIfMoving; +} + +void Actor::retire(bool retired, int width, int height, int retiredByActorId) { + _isRetired = retired; + _retiredWidth = MAX(width, 0); + _retiredHeight = MAX(height, 0); + if (_id == 0 && _isRetired) { + _vm->playerLosesControl(); + _vm->_playerDead = true; + } + if (_isRetired) { + //TODO: _vm->actorScript->Retired(_id, retiredByActorId); + } +} + +void Actor::setTargetable(bool targetable) { + _isTargetable = targetable; +} + +void Actor::setHealth(int hp, int maxHp) { + _currentHP = hp; + _maxHP = maxHp; + if (hp > 0) { + retire(false, 0, 0, -1); + } +} + +void Actor::combatModeOn(int a2, int a3, int otherActorId, int a5, int combatAnimationMode, int a7, int a8, int a9, int a10, int a11, int ammoDamage, int a13, int a14) { + _combatAnimationMode = combatAnimationMode; + _unknown1 = a7; + _unknown2 = a8; + _inCombat = true; + if (_id > 0) + _combatInfo->combatOn(_id, a2, a3, otherActorId, a5, a9, a10, a11, ammoDamage, a13, a14); + stopWalking(false); + changeAnimationMode(_combatAnimationMode, false); + int i; + for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) { + Actor *otherActor = _vm->_actors[i]; + if (i != _id && otherActor->_setId == _setId && !otherActor->_isRetired) { + //TODO: _vm->actorScript->OtherAgentEnteredCombatMode(i, _id, 1); + } + } +} + +void Actor::combatModeOff() { + if (_id > 0) + _combatInfo->combatOff(); + _inCombat = false; + stopWalking(false); + changeAnimationMode(0, false); + int i; + for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) { + Actor *otherActor = _vm->_actors[i]; + if (i != _id && otherActor->_setId == _setId && !otherActor->_isRetired) { + //TODO: _vm->actorScript->OtherAgentEnteredCombatMode(i, _id, 0); + } + } +} + +float Actor::distanceFromActor(int otherActorId) { + return (_position - _vm->_actors[otherActorId]->_position).length(); +} + +float Actor::getX() { + return _position.x; +} + +float Actor::getY() { + return _position.y; +} + +float Actor::getZ() { + return _position.z; +} + +void Actor::getXYZ(float *x, float *y, float *z) { + *x = _position.x; + *y = _position.y; + *z = _position.z; +} + +int Actor::getFacing() { + return _facing; +} + +int Actor::getAnimationMode() { + return _animationMode; +} + +void Actor::setGoal(int goalNumber) { + if (goalNumber == _goalNumber) + return; + + //TODO: _vm->actorScript->GoalChanged(_id, _goalNumber, goalNumber); + + _vm->_script->ActorChangedGoal(_id, goalNumber, _goalNumber, _vm->_scene->getSetId() == _setId); +} + +int Actor::getGoal() { + return _goalNumber; +} + +void Actor::speechPlay(int sentenceId, bool voiceOver) { + char name[13]; + sprintf(name, "%02d-%04d.AUD", _id, sentenceId); //TODO somewhere here should be also language code + int balance; + + if (voiceOver || _id == 99) { + balance = 0; + } else { + // Vector3 pos = _vm->_view->_frameViewMatrix * _position; + int screenX = 320; //, screenY = 0; + //TODO: transform to screen space using fov; + balance = 127 * (2 * screenX - 640) / 640; + balance = MIN(127, MAX(-127, balance)); + } + + _vm->_audioSpeech->playSpeech(name, balance); +} + +void Actor::speechStop() { + _vm->_audioSpeech->stopSpeech(); +} + +bool Actor::isSpeeching() { + return _vm->_audioSpeech->isPlaying(); +} + +void Actor::addClueToDatabase(int clueId, int unknown, bool clueAcquired, bool unknownFlag, int fromActorId) { + _clues->add(_id, clueId, unknown, clueAcquired, unknownFlag, fromActorId); +} + +void Actor::acquireClue(int clueId, byte unknownFlag, int fromActorId) { + _clues->acquire(clueId, unknownFlag, fromActorId); +} + +void Actor::loseClue(int clueId) { + _clues->lose(clueId); +} + +bool Actor::hasClue(int clueId) { + 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)) { + int fromActorId = _id; + if (_id == 99) + fromActorId = _clues->getFromActorId(i); + otherActor->acquireClue(i, 0, fromActorId); + } + } +} + +int Actor::soundVolume() { + float dist = distanceFromView(_vm->_view); + return 255.0f * MAX(MIN(dist / 1200.0f, 1.0f), 0.0f); +} + +int Actor::soundBalance() { + Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position); + return 127.0f * (MAX(MIN(screenPosition.x / 640.0f, 1.0f), 0.0f) * 2.0f - 1.0f); +} + +void Actor::countdownTimerStart(int timerId, int interval) { + assert(timerId >= 0 && timerId < 7); + _timersRemain[timerId] = interval; + _timersStart[timerId] = _vm->getTotalPlayTime(); +} + +void Actor::countdownTimerReset(int timerId) { + assert(timerId >= 0 && timerId < 7); + _timersRemain[timerId] = 0; +} + +int Actor::countdownTimerGetRemainingTime(int timerId) { + assert(timerId >= 0 && timerId < 7); + return _timersRemain[timerId]; +} + +void Actor::countdownTimerUpdate(int timerId) { + if (_timersRemain[timerId] == 0) + return; + + uint32 now = _vm->getTotalPlayTime(); + int tickInterval = now - _timersStart[timerId]; + _timersStart[timerId] = now; + + // warning("tickInterval: %d", tickInterval); + _timersRemain[timerId] -= tickInterval; + + if (_timersRemain[timerId] <= 0) { + switch (timerId) { + case 0: + case 1: + case 2: + // AI timers, call AI dll + break; + case 3: + // Movement track timer + break; + case 4: + // Something timer + break; + case 5: + // Actor animation frame timer + break; + case 6: + // Slow down actor run timer? + break; + } + } +} + +bool Actor::walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float size, Vector3 *newDestination) { + newDestination->x = 0.0f; + newDestination->y = 0.0f; + newDestination->z = 0.0f; + int facing = angle_1024(targetPosition, startPosition); + int facing1 = 0; + + int facing2 = facing; + int facing3 = 0; + while (true) { + float rotatedX = size * sin_1024(facing) + targetPosition.x; + float rotatedZ = size * cos_1024(facing) + targetPosition.z; + + if (!_walkInfo->isXYZEmpty(rotatedX, targetPosition.y, rotatedZ, _id)) { + if (_vm->_scene->_set->findWalkbox(rotatedX, rotatedZ) >= 0) { + newDestination->x = rotatedX; + newDestination->y = targetPosition.y; + newDestination->z = rotatedZ; + return true; + } + } else { + facing += 20; + if (facing > 1024) { + facing -= 1024; + } + facing3 += 20; + } + + rotatedX = size * sin_1024(facing2) + targetPosition.x; + rotatedZ = size * cos_1024(facing2) + targetPosition.z; + + if (!_walkInfo->isXYZEmpty(rotatedX, targetPosition.y, rotatedZ, _id)) { + if (_vm->_scene->_set->findWalkbox(rotatedX, rotatedZ) >= 0) { + newDestination->x = rotatedX; + newDestination->y = targetPosition.y; + newDestination->z = rotatedZ; + return true; + } + } else { + facing2 -= 20; + if (facing2 < 0) { + facing2 += 1024; + } + facing1 += 20; + } + + if (facing3 > 1024 && facing1 > 1024) { + return false; + } + } +} + +bool Actor::walkFindU2(Vector3 *newDestination, float targetWidth, int destinationOffset, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition) { + newDestination->x = 0.0f; + newDestination->y = 0.0f; + newDestination->z = 0.0f; + float size = destinationOffset + targetSize * 0.5f + targetWidth * 0.5f; + float distance = (startPosition - targetPosition).length() - targetWidth * 0.5f - targetSize * 0.5f; + if (size < distance) { + return walkFindU1(startPosition, targetPosition, size, newDestination); + } else { + *newDestination = targetPosition; + return true; + } +} + +bool Actor::walkToU(const Vector3 &destination, float distance) { + Vector3 out; + bool isRunning; + if (_walkInfo->findU1(_id, destination, distance, &out)) { + loopWalk(out, 0, false, false, _position, 0.0f, 24.0f, false, &isRunning, false); + return true; + } + return false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h new file mode 100644 index 0000000000..b2b52c623d --- /dev/null +++ b/engines/bladerunner/actor.h @@ -0,0 +1,219 @@ +/* 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_H +#define BLADERUNNER_ACTOR_H + +#include "bladerunner/vector.h" + +#include "common/rect.h" + +namespace BladeRunner { + +class ActorClues; +class ActorCombat; +class ActorWalk; +class BladeRunnerEngine; +class BoundingBox; +class MovementTrack; +class View; + +class Actor { + friend class ScriptBase; + + BladeRunnerEngine *_vm; + +private: + BoundingBox *_bbox; + Common::Rect _screenRectangle; + MovementTrack *_movementTrack; + ActorWalk *_walkInfo; + ActorCombat *_combatInfo; + + int _honesty; + int _intelligence; + int _stability; + int _combatAggressiveness; + int _goalNumber; + int *_friendlinessToOther; + + int _currentHP; + int _maxHP; + + ActorClues *_clues; + + int _id; + int _setId; + Vector3 _position; + int _facing; // [0, 1024) + int _targetFacing; + int _walkboxId; + + // Flags + bool _isTargetable; + bool _isInvisible; + bool _isImmuneToObstacles; + bool _inWalkLoop; + bool _isRetired; + bool _inCombat; + bool _isMoving; + bool _damageAnimIfMoving; + + // Animation + int _width; + int _height; + int _animationMode; + int _combatAnimationMode; + int _fps; + int _frame_ms; + int _animationId; + int _animationFrame; + + int _retiredWidth; + int _retiredHeight; + + int _timersRemain[7]; + int _timersStart[7]; + + float _scale; + + int _unknown1; + int _unknown2; + + Vector3 _actorSpeed; + +public: + Actor(BladeRunnerEngine *_vm, int actorId); + ~Actor(); + + void setup(int actorId); + + 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(); + + Vector3 getPosition() { return _position; } + + void changeAnimationMode(int animationMode, bool force = false); + void setFPS(int fps); + + void processMovement(); + + bool loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning); + bool loopWalkToItem(int itemId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning); + bool loopWalkToSceneObject(const char *objectName, int destinationOffset, bool a3, bool run, bool a5, bool *isRunning); + bool loopWalkToWaypoint(int waypointId, int destinationOffset, int a3, bool run, bool a5, bool *isRunning); + bool loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool a3, bool run, bool a5, bool *isRunning); + + bool tick(bool forceUpdate); + void draw(); + + void countdownTimerStart(int timerId, int interval); + void countdownTimerReset(int timerId); + int countdownTimerGetRemainingTime(int timerId); + void countdownTimerUpdate(int timerId); + + int getSetId(); + void setSetId(int setId); + BoundingBox *getBoundingBox() { return _bbox; } + Common::Rect *getScreenRectangle() { return &_screenRectangle; } + int getWalkbox() { return _walkboxId; } + bool isRetired() { return _isRetired; } + bool isTargetable() { return _isTargetable; } + void setTargetable(bool targetable); + bool isImmuneToObstacles() { return _isImmuneToObstacles; } + bool inCombat() { return _inCombat; } + bool isMoving() { return _isMoving; } + void setMoving(bool value) { _isMoving = value; } + bool isWalking(); + void stopWalking(bool value); + + void faceActor(int otherActorId, bool animate); + void faceObject(const char *objectName, bool animate); + void faceItem(int itemId, bool animate); + void faceWaypoint(int waypointId, bool animate); + void faceXYZ(float x, float y, float z, bool animate); + void faceCurrentCamera(bool animate); + void faceHeading(int heading, bool animate); + void modifyFriendlinessToOther(int otherActorId, signed int change); + void setFriendlinessToOther(int otherActorId, int friendliness); + void setHonesty(int honesty); + void setIntelligence(int intelligence); + void setStability(int stability); + void setCombatAggressiveness(int combatAggressiveness); + void setInvisible(bool isInvisible); + void setImmunityToObstacles(bool isImmune); + void modifyCurrentHP(signed int change); + void modifyMaxHP(signed int change); + void modifyCombatAggressiveness(signed int change); + void modifyHonesty(signed int change); + void modifyIntelligence(signed int change); + void modifyStability(signed int change); + void setFlagDamageAnimIfMoving(bool value); + bool getFlagDamageAnimIfMoving(); + void setHealth(int hp, int maxHp); + + void retire(bool isRetired, int width, int height, int retiredByActorId); + + void combatModeOn(int a2, int a3, int a4, int a5, int combatAnimationMode, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14); + void combatModeOff(); + + void setGoal(int goalNumber); + int getGoal(); + + float distanceFromActor(int otherActorId); + + void speechPlay(int sentenceId, bool voiceOver); + void speechStop(); + bool isSpeeching(); + + void addClueToDatabase(int clueId, int unknown, bool clueAcquired, bool unknownFlag, int fromActorId); + void acquireClue(int clueId, byte unknownFlag, int fromActorId); + void loseClue(int clueId); + bool hasClue(int clueId); + void copyClues(int actorId); + + int soundVolume(); + int soundBalance(); +private: + void setFacing(int facing, bool halfOrSet = true); + void setBoundingBox(const Vector3 &position, bool retired); + float distanceFromView(View* view); + + 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); + + bool walkFindU1(const Vector3 &startPosition, const Vector3 &targetPosition, float a3, Vector3 *newDestination); + bool walkFindU2(Vector3 *newDestination, float targetWidth, int destinationOffset, float targetSize, const Vector3 &startPosition, const Vector3 &targetPosition); + bool walkToU(const Vector3 &destination, float distance); + //bool walkFindU3(int actorId, Vector3 from, int distance, Vector3 *out); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp new file mode 100644 index 0000000000..a84d54906b --- /dev/null +++ b/engines/bladerunner/actor_clues.cpp @@ -0,0 +1,207 @@ +/* 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_clues.h" + +#include "bladerunner/crimes_database.h" + +#include "common/debug.h" + +namespace BladeRunner { + +ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) { + _vm = vm; + _count = 0; + _maxCount = 0; + _clues = 0; + switch (cluesType) { + case 4: + _maxCount = _vm->_gameInfo->getClueCount(); + break; + case 3: + _maxCount = 100; + break; + case 2: + _maxCount = 50; + break; + case 1: + _maxCount = 25; + break; + case 0: + _maxCount = 0; + break; + default: + return; + } + + if (_maxCount > 0) { + _clues = new ActorClue[_maxCount]; + } else { + _clues = nullptr; + } + + if (_clues) { + removeAll(); + } else { + _maxCount = 0; + } +} + +ActorClues::~ActorClues() { + if (_clues) { + delete[] _clues; + } + + _maxCount = 0; + _count = 0; +} + +void ActorClues::acquire(int clueId, char flag2, int fromActorId) { + int clueIndex = findClueIndex(clueId); + _clues[clueIndex]._flags |= 0x01; + _clues[_count]._flags = (_clues[_count]._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; +} + +bool ActorClues::isAcquired(int clueId) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return false; + } + + return _clues[clueIndex]._flags & 0x01; +} + +int ActorClues::getFromActorId(int clueId) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return -1; + } + + return _clues[clueIndex]._fromActorId; +} + +bool ActorClues::isFlag2(int clueId) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return false; + } + + return (_clues[clueIndex]._flags & 0x02) >> 1; +} + +bool ActorClues::isFlag3(int clueId) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return false; + } + + return (_clues[clueIndex]._flags & 0x04) >> 2; +} + +bool ActorClues::isFlag4(int clueId) { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return false; + } + + return (_clues[clueIndex]._flags & 0x08) >> 3; +} + +int ActorClues::getField1(int clueId) { + if (!_count) { + return 0; + } + + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return 0; + } + + return _clues[clueIndex]._field1; +} + +int ActorClues::getCount() { + return _count; +} + +void ActorClues::removeAll() { + _count = 0; + for (int i = 0; i < _maxCount; ++i) { + remove(i); + } +} + +int ActorClues::findClueIndex(int clueId) { + for (int i = 0; i < _count; i++) { + if (clueId == _clues[i]._clueId) { + return i; + } + } + return -1; +} + +void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId) { + assert(_count < _maxCount); + + debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_crimesDatabase->getClueText(clueId), fromActorId); + + _clues[_count]._clueId = clueId; + _clues[_count]._field1 = unknown; + + _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; + ++_count; +} + +void ActorClues::remove(int index) { + if (_vm->_crimesDatabase) + debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index]._clueId)); + + _clues[index]._clueId = -1; + _clues[index]._field1 = 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; +} + +bool ActorClues::exists(int clueId) { + return findClueIndex(clueId) != -1; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/actor_clues.h b/engines/bladerunner/actor_clues.h new file mode 100644 index 0000000000..26510ecd33 --- /dev/null +++ b/engines/bladerunner/actor_clues.h @@ -0,0 +1,82 @@ +/* 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_CLUES_H +#define BLADERUNNER_ACTOR_CLUES_H + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/gameinfo.h" + +namespace BladeRunner { + +struct ActorClue { + int _clueId; + int _field1; + int _fromActorId; + int _field3; + int _field4; + int _field5; + int _field6; + int _field7; + int _field8; + unsigned char _flags; +}; + +class ActorClues { + BladeRunnerEngine *_vm; + +private: + int _count; + int _maxCount; + ActorClue *_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, char flag2, int fromActorId); + void lose(int clueId); + bool isAcquired(int clueId); + int getFromActorId(int clueId); + bool isFlag2(int clueId); + bool isFlag3(int clueId); + bool isFlag4(int clueId); + int getField1(int clueId); + + int getCount(); + + void removeAll(); + + //savegame + //loadgame + +private: + bool exists(int clueId); + int findClueIndex(int clueId); + void remove(int clueIndex); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/actor_combat.cpp b/engines/bladerunner/actor_combat.cpp new file mode 100644 index 0000000000..4bd8d17c67 --- /dev/null +++ b/engines/bladerunner/actor_combat.cpp @@ -0,0 +1,46 @@ +/* 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_combat.h" + +namespace BladeRunner { + +ActorCombat::ActorCombat(BladeRunnerEngine *vm) { + _vm = vm; +} + +ActorCombat::~ActorCombat() { +} + +void ActorCombat::hitAttempt() { +} + +void ActorCombat::combatOn(int actorId, int a3, int a4, int otherActorId, int a6, int a7, int a8, int a9, int ammoDamage, int a11, int a12) { +} + +void ActorCombat::combatOff() { +} + +void ActorCombat::setup() { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/actor_combat.h b/engines/bladerunner/actor_combat.h new file mode 100644 index 0000000000..ee29bf4f0e --- /dev/null +++ b/engines/bladerunner/actor_combat.h @@ -0,0 +1,72 @@ +/* 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_COMBAT_H +#define BLADERUNNER_ACTOR_COMBAT_H + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/vector.h" + +namespace BladeRunner { + +class ActorCombat { + BladeRunnerEngine *_vm; + +private: +// int _actorId; +// int _combatOn; +// int _field2; +// int _field3; +// int _otherActorId; +// int _field5; +// int _field6; +// int _field7; +// int _field8; +// int _field9; +// int _field10; +// int _field11; +// int _field12; +// int _actorHp; +// int _field14; +// int _field15; + Vector3 actorPosition; + Vector3 otherActorPosition; +// int _availableCoversCount; +// int _availableFleeWaypointsCount; +// int _field24; + +public: + ActorCombat(BladeRunnerEngine *vm); + ~ActorCombat(); + + void setup(); + + void hitAttempt(); + + void combatOn(int actorId, int a3, int a4, int otherActorId, int a6, int a7, int a8, int a9, int a10, int a11, int a12); + void combatOff(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/actor_walk.cpp b/engines/bladerunner/actor_walk.cpp new file mode 100644 index 0000000000..556f7b9afa --- /dev/null +++ b/engines/bladerunner/actor_walk.cpp @@ -0,0 +1,269 @@ +/* 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_walk.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/obstacles.h" +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/set.h" + + +namespace BladeRunner { + +ActorWalk::ActorWalk(BladeRunnerEngine *vm) { + _vm = vm; + + _walking = 0; + _running = 0; + _facing = -1; + _status = 0; + + _entries.clear(); +} + +ActorWalk::~ActorWalk() { +} + +bool ActorWalk::setup(int actorId, bool run, const Vector3 &from, const Vector3 &to, bool unk1, bool *stopped) { + Vector3 next; + + *stopped = false; + int r = nextOnPath(actorId, from, to, &next); + + if (r == 0) { + if (actorId != 0) { + _current = from; + _destination = to; + stop(actorId, false, 4, 0); + } else { + stop(actorId, true, 4, 0); + } + return false; + } + if (r == -1) { + stop(actorId, true, 4, 0); + *stopped = true; + return false; + } + + resetList(); + _vm->_sceneObjects->setMoving(actorId + SCENE_OBJECTS_ACTORS_OFFSET, true); + _vm->_actors[actorId]->setMoving(true); + + if (_running) { + run = true; + } + + int animationMode; + if (_vm->_actors[actorId]->inCombat()) { + animationMode = run ? 8 : 7; + } else { + animationMode = run ? 2 : 1; + } + + _vm->_actors[actorId]->changeAnimationMode(animationMode); + + _destination = to; + _current = from; + _next = next; + + if (next.x != _current.x || next.z != _current.z) { + _facing = angle_1024(_current, next); + _walking = true; + _running = run; + _status = 2; + + return true; + } + + stop(actorId, true, 4, 0); + return false; +} + +bool ActorWalk::tick(int actorId, float stepDistance, bool flag) { + if (_status == 5) { + if (flag) { + stop(actorId, true, 4, 0); + return true; + } + + if (actorId != 0 && _vm->_rnd.getRandomNumberRng(1, 15) != 1) { + return false; + } + _status = 3; + } + // TODO: Handle collisions? + + if (stepDistance > distance(_current, _destination)) { + stop(actorId, true, 4, 0); + _current = _destination; + // TODO: Update y from walkbox + return true; + } + + float angle_rad = _facing / 512.0 * M_PI; + + _current = Vector3( + _current.x + stepDistance * sinf(angle_rad), + _current.y, // TODO: Update from walkbox + _current.z - stepDistance * cosf(angle_rad) + ); + + return false; +} + +void ActorWalk::getCurrentPosition(int actorId, Vector3 *pos, int *facing) { + *pos = _current; + *facing = _facing; +} + +void ActorWalk::setRunning() { + _running = true; + // TODO: Set animation mode +} + +void ActorWalk::stop(int actorId, bool unknown, int combatAnimationMode, int animationMode) { + _vm->_sceneObjects->setMoving(actorId, false); + _vm->_actors[actorId]->setMoving(false); + + if (_vm->_actors[actorId]->inCombat()) { + _vm->_actors[actorId]->changeAnimationMode(combatAnimationMode, false); + } else { + _vm->_actors[actorId]->changeAnimationMode(animationMode, false); + } + + if (unknown) { + _walking = false; + _running = false; + _status = 0; + } else { + _walking = true; + _running = false; + _status = 5; + } +} + +bool ActorWalk::isXYZEmpty(float x, float y, float z, int actorId) { + if (_vm->_scene->_set->findWalkbox(x, z) == -1) { + return true; + } + if (_vm->_actors[actorId]->isImmuneToObstacles()) { + return false; + } + return _vm->_sceneObjects->existsOnXZ(actorId, x, z, false, false); +} + +int ActorWalk::findU1(int actorId, const Vector3 &to, int dist, Vector3 *out) { + bool inWalkbox; + + int facingFound = -1; + float distFound = -1.0f; + float x = 0.0f; + float z = 0.0f; + + out->x = 0.0f; + out->y = 0.0f; + out->z = 0.0f; + + for (int facing = 0; facing < 1024; facing += 128) { + x = to.x + sin_1024(facing) * dist; + z = to.z + cos_1024(facing) * dist; + float dist2 = distance(x, z, _vm->_actors[actorId]->getX(), _vm->_actors[actorId]->getZ()); + + if (distFound == -1.0f || distFound > dist2) { + distFound = dist2; + facingFound = facing; + } + } + + int v23 = facingFound; + int v24 = facingFound; + int v25 = -1024; + while (v25 < 0) { + x = to.x + sin_1024(v24) * dist; + z = to.z + cos_1024(v24) * dist; + + if (!_vm->_sceneObjects->existsOnXZ(actorId, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { + break; + } + + x = to.x + sin_1024(v23) * dist; + z = to.z + cos_1024(v23) * dist; + + if (!_vm->_sceneObjects->existsOnXZ(actorId, x, z, true, true) && _vm->_scene->_set->findWalkbox(x, z) >= 0) { + break; + } + + v24 -= 64; + if (v24 < 0) { + v24 += 1024; + } + v23 += 64; + if (v23 >= 1024) { + v23 -= 1024; + } + v25 += 64; + } + + float y = _vm->_scene->_set->getAltitudeAtXZ(x, z, &inWalkbox); + if (inWalkbox) { + out->x = x; + out->y = y; + out->z = z; + return true; + } + return false; +} + +int ActorWalk::nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, Vector3 *next) { + *next = from; + + if (distance(from, to) < 6.0) { + return -1; + } + + if (_vm->_actors[actorId]->isImmuneToObstacles()) { + *next = to; + return 1; + } + if (_vm->_scene->_set->findWalkbox(to.x, to.z) == -1) { + return 0; + } + if (_vm->_sceneObjects->existsOnXZ(actorId, to.x, to.z, false, false)) { + return 0; + } + Vector3 next1; + if (_vm->_obstacles->find(from, to, &next1)) { + *next = next1; + return 1; + } + return 0; +} + +void ActorWalk::resetList() { + _entries.clear(); +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/actor_walk.h b/engines/bladerunner/actor_walk.h new file mode 100644 index 0000000000..e0558a69be --- /dev/null +++ b/engines/bladerunner/actor_walk.h @@ -0,0 +1,79 @@ +/* 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_WALK_H +#define BLADERUNNER_ACTOR_WALK_H + +#include "bladerunner/vector.h" +#include "common/array.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +struct ActorWalkEntry { + int _actorId; + int _present; +}; + +class ActorWalk { + BladeRunnerEngine *_vm; + +private: + int _walking; + int _running; + Vector3 _destination; + Vector3 _unknown; + Vector3 _current; + Vector3 _next; + int _facing; + Common::Array<ActorWalk> _entries; +// int _field15; + int _status; + +public: + ActorWalk(BladeRunnerEngine *vm); + ~ActorWalk(); + + + bool setup(int actorId, bool run, const Vector3 &from, const Vector3 &to, bool unk1, bool *stopped); + void getCurrentPosition(int actorId, Vector3 *pos, int *facing); + bool tick(int actorId, float stepDistance, bool flag); + + bool isWalking() { return _walking; } + bool isRunning() { return _running; } + void setRunning(); + + void stop(int actorId, bool unknown, int combatAnimationMode, int animationMode); + // void setWalkingMode(int actorId, int active, int unk2 = 4, int unk3 = 0); + + int nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, Vector3 *next); + + void resetList(); + + bool isXYZEmpty(float x, float y, float z, int actorId); + int findU1(int actorId, const Vector3 &to, int distance, Vector3 *out); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/adpcm_decoder.cpp b/engines/bladerunner/adpcm_decoder.cpp new file mode 100644 index 0000000000..c93d4eb2c1 --- /dev/null +++ b/engines/bladerunner/adpcm_decoder.cpp @@ -0,0 +1,163 @@ +/* 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/adpcm_decoder.h" + +#include "common/util.h" + +namespace BladeRunner { + +static const +int16 imaIndexTable[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; + +static const +uint16 imaStepTable[712] = { + 0x0000,0x0001,0x0003,0x0004,0x0007,0x0008,0x000a,0x000b, + 0x0001,0x0003,0x0005,0x0007,0x0009,0x000b,0x000d,0x000f, + 0x0001,0x0003,0x0005,0x0007,0x000a,0x000c,0x000e,0x0010, + 0x0001,0x0003,0x0006,0x0008,0x000b,0x000d,0x0010,0x0012, + 0x0001,0x0003,0x0006,0x0008,0x000c,0x000e,0x0011,0x0013, + 0x0001,0x0004,0x0007,0x000a,0x000d,0x0010,0x0013,0x0016, + 0x0001,0x0004,0x0007,0x000a,0x000e,0x0011,0x0014,0x0017, + 0x0001,0x0004,0x0008,0x000b,0x000f,0x0012,0x0016,0x0019, + 0x0002,0x0006,0x000a,0x000e,0x0012,0x0016,0x001a,0x001e, + 0x0002,0x0006,0x000a,0x000e,0x0013,0x0017,0x001b,0x001f, + 0x0002,0x0006,0x000b,0x000f,0x0015,0x0019,0x001e,0x0022, + 0x0002,0x0007,0x000c,0x0011,0x0017,0x001c,0x0021,0x0026, + 0x0002,0x0007,0x000d,0x0012,0x0019,0x001e,0x0024,0x0029, + 0x0003,0x0009,0x000f,0x0015,0x001c,0x0022,0x0028,0x002e, + 0x0003,0x000a,0x0011,0x0018,0x001f,0x0026,0x002d,0x0034, + 0x0003,0x000a,0x0012,0x0019,0x0022,0x0029,0x0031,0x0038, + 0x0004,0x000c,0x0015,0x001d,0x0026,0x002e,0x0037,0x003f, + 0x0004,0x000d,0x0016,0x001f,0x0029,0x0032,0x003b,0x0044, + 0x0005,0x000f,0x0019,0x0023,0x002e,0x0038,0x0042,0x004c, + 0x0005,0x0010,0x001b,0x0026,0x0032,0x003d,0x0048,0x0053, + 0x0006,0x0012,0x001f,0x002b,0x0038,0x0044,0x0051,0x005d, + 0x0006,0x0013,0x0021,0x002e,0x003d,0x004a,0x0058,0x0065, + 0x0007,0x0016,0x0025,0x0034,0x0043,0x0052,0x0061,0x0070, + 0x0008,0x0018,0x0029,0x0039,0x004a,0x005a,0x006b,0x007b, + 0x0009,0x001b,0x002d,0x003f,0x0052,0x0064,0x0076,0x0088, + 0x000a,0x001e,0x0032,0x0046,0x005a,0x006e,0x0082,0x0096, + 0x000b,0x0021,0x0037,0x004d,0x0063,0x0079,0x008f,0x00a5, + 0x000c,0x0024,0x003c,0x0054,0x006d,0x0085,0x009d,0x00b5, + 0x000d,0x0027,0x0042,0x005c,0x0078,0x0092,0x00ad,0x00c7, + 0x000e,0x002b,0x0049,0x0066,0x0084,0x00a1,0x00bf,0x00dc, + 0x0010,0x0030,0x0051,0x0071,0x0092,0x00b2,0x00d3,0x00f3, + 0x0011,0x0034,0x0058,0x007b,0x00a0,0x00c3,0x00e7,0x010a, + 0x0013,0x003a,0x0061,0x0088,0x00b0,0x00d7,0x00fe,0x0125, + 0x0015,0x0040,0x006b,0x0096,0x00c2,0x00ed,0x0118,0x0143, + 0x0017,0x0046,0x0076,0x00a5,0x00d5,0x0104,0x0134,0x0163, + 0x001a,0x004e,0x0082,0x00b6,0x00eb,0x011f,0x0153,0x0187, + 0x001c,0x0055,0x008f,0x00c8,0x0102,0x013b,0x0175,0x01ae, + 0x001f,0x005e,0x009d,0x00dc,0x011c,0x015b,0x019a,0x01d9, + 0x0022,0x0067,0x00ad,0x00f2,0x0139,0x017e,0x01c4,0x0209, + 0x0026,0x0072,0x00bf,0x010b,0x0159,0x01a5,0x01f2,0x023e, + 0x002a,0x007e,0x00d2,0x0126,0x017b,0x01cf,0x0223,0x0277, + 0x002e,0x008a,0x00e7,0x0143,0x01a1,0x01fd,0x025a,0x02b6, + 0x0033,0x0099,0x00ff,0x0165,0x01cb,0x0231,0x0297,0x02fd, + 0x0038,0x00a8,0x0118,0x0188,0x01f9,0x0269,0x02d9,0x0349, + 0x003d,0x00b8,0x0134,0x01af,0x022b,0x02a6,0x0322,0x039d, + 0x0044,0x00cc,0x0154,0x01dc,0x0264,0x02ec,0x0374,0x03fc, + 0x004a,0x00df,0x0175,0x020a,0x02a0,0x0335,0x03cb,0x0460, + 0x0052,0x00f6,0x019b,0x023f,0x02e4,0x0388,0x042d,0x04d1, + 0x005a,0x010f,0x01c4,0x0279,0x032e,0x03e3,0x0498,0x054d, + 0x0063,0x012a,0x01f1,0x02b8,0x037f,0x0446,0x050d,0x05d4, + 0x006d,0x0148,0x0223,0x02fe,0x03d9,0x04b4,0x058f,0x066a, + 0x0078,0x0168,0x0259,0x0349,0x043b,0x052b,0x061c,0x070c, + 0x0084,0x018d,0x0296,0x039f,0x04a8,0x05b1,0x06ba,0x07c3, + 0x0091,0x01b4,0x02d8,0x03fb,0x051f,0x0642,0x0766,0x0889, + 0x00a0,0x01e0,0x0321,0x0461,0x05a2,0x06e2,0x0823,0x0963, + 0x00b0,0x0210,0x0371,0x04d1,0x0633,0x0793,0x08f4,0x0a54, + 0x00c2,0x0246,0x03ca,0x054e,0x06d2,0x0856,0x09da,0x0b5e, + 0x00d5,0x027f,0x042a,0x05d4,0x0780,0x092a,0x0ad5,0x0c7f, + 0x00ea,0x02bf,0x0495,0x066a,0x0840,0x0a15,0x0beb,0x0dc0, + 0x0102,0x0306,0x050b,0x070f,0x0914,0x0b18,0x0d1d,0x0f21, + 0x011c,0x0354,0x058c,0x07c4,0x09fc,0x0c34,0x0e6c,0x10a4, + 0x0138,0x03a8,0x0619,0x0889,0x0afb,0x0d6b,0x0fdc,0x124c, + 0x0157,0x0406,0x06b5,0x0964,0x0c14,0x0ec3,0x1172,0x1421, + 0x017a,0x046e,0x0762,0x0a56,0x0d4a,0x103e,0x1332,0x1626, + 0x019f,0x04de,0x081e,0x0b5d,0x0e9e,0x11dd,0x151d,0x185c, + 0x01c9,0x055c,0x08ef,0x0c82,0x1015,0x13a8,0x173b,0x1ace, + 0x01f7,0x05e5,0x09d4,0x0dc2,0x11b1,0x159f,0x198e,0x1d7c, + 0x0229,0x067c,0x0acf,0x0f22,0x1375,0x17c8,0x1c1b,0x206e, + 0x0260,0x0721,0x0be3,0x10a4,0x1567,0x1a28,0x1eea,0x23ab, + 0x029d,0x07d8,0x0d14,0x124f,0x178b,0x1cc6,0x2202,0x273d, + 0x02e0,0x08a1,0x0e63,0x1424,0x19e6,0x1fa7,0x2569,0x2b2a, + 0x032a,0x097f,0x0fd4,0x1629,0x1c7e,0x22d3,0x2928,0x2f7d, + 0x037b,0x0a72,0x1169,0x1860,0x1f57,0x264e,0x2d45,0x343c, + 0x03d4,0x0b7d,0x1326,0x1acf,0x2279,0x2a22,0x31cb,0x3974, + 0x0436,0x0ca3,0x1511,0x1d7e,0x25ec,0x2e59,0x36c7,0x3f34, + 0x04a2,0x0de7,0x172c,0x2071,0x29b7,0x32fc,0x3c41,0x4586, + 0x0519,0x0f4b,0x197e,0x23b0,0x2de3,0x3815,0x4248,0x4c7a, + 0x059b,0x10d2,0x1c0a,0x2741,0x327a,0x3db1,0x48e9,0x5420, + 0x062b,0x1281,0x1ed8,0x2b2e,0x3786,0x43dc,0x5033,0x5c89, + 0x06c9,0x145b,0x21ee,0x2f80,0x3d14,0x4aa6,0x5839,0x65cb, + 0x0777,0x1665,0x2553,0x3441,0x4330,0x521e,0x610c,0x6ffa, + 0x0836,0x18a2,0x290f,0x397b,0x49e8,0x5a54,0x6ac1,0x7b2d, + 0x0908,0x1b19,0x2d2a,0x3f3b,0x514c,0x635d,0x756e,0x877f, + 0x09ef,0x1dce,0x31ae,0x458d,0x596d,0x6d4c,0x812c,0x950b, + 0x0aee,0x20ca,0x36a6,0x4c82,0x625f,0x783b,0x8e17,0xa3f3, + 0x0c05,0x2410,0x3c1c,0x5427,0x6c34,0x843f,0x9c4b,0xb456, + 0x0d39,0x27ac,0x4220,0x5c93,0x7707,0x917a,0xabee,0xc661, + 0x0e8c,0x2ba4,0x48bd,0x65d5,0x82ee,0xa006,0xbd1f,0xda37, + 0x0fff,0x2ffe,0x4ffe,0x6ffd,0x8ffe,0xaffd,0xcffd,0xeffc +}; + +void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out) { + uint8 *end = in + size; + + int16 stepIndex = _stepIndex; + int32 predictor = _predictor; + + while (in != end) { + uint16 bl = *in++; + + for (int n = 0; n != 2; ++n) { + uint8 nibble = (bl >> (4 * n)) & 0x0f; + uint8 code = nibble & 0x07; + uint8 sign = nibble & 0x08; + + int diff = imaStepTable[(stepIndex << 3) | code]; + + // Westwood's IMA ADPCM differs from the below standard implementation + // in the LSB in a couple of places. + //int diff = imaStepTable_std[stepIndex] * code / 4 + imaStepTable_std[stepIndex] / 8; + + if (sign) + predictor -= diff; + else + predictor += diff; + + predictor = CLIP<int32>(predictor, -32768, 32767); + + *out++ = (int16)predictor; + + stepIndex = imaIndexTable[code] + stepIndex; + stepIndex = CLIP<int16>(stepIndex, 0, 88); + } + } + + _stepIndex = stepIndex; + _predictor = predictor; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/adpcm_decoder.h b/engines/bladerunner/adpcm_decoder.h new file mode 100644 index 0000000000..8f7a2285a2 --- /dev/null +++ b/engines/bladerunner/adpcm_decoder.h @@ -0,0 +1,49 @@ +/* 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_ADPCM_DECODER_H +#define BLADERUNNER_ADPCM_DECODER_H + +#include "common/types.h" + +namespace BladeRunner { + +class ADPCMWestwoodDecoder { + int16 _stepIndex; + int32 _predictor; + +public: + ADPCMWestwoodDecoder() + : _stepIndex(0), _predictor(0) { + } + + void setParameters(int16 stepIndex, int32 predictor) { + _stepIndex = stepIndex; + _predictor = predictor; + } + + void decode(uint8 *in, size_t size, int16 *out); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/adq.cpp b/engines/bladerunner/adq.cpp new file mode 100644 index 0000000000..ca72497b99 --- /dev/null +++ b/engines/bladerunner/adq.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/adq.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/audio_speech.h" +#include "bladerunner/scene.h" + +#include "script/script.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 == 99) { + 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->_script->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 new file mode 100644 index 0000000000..f4e69df684 --- /dev/null +++ b/engines/bladerunner/adq.h @@ -0,0 +1,73 @@ +/* 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<ADQEntry> _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 new file mode 100644 index 0000000000..c33deefb80 --- /dev/null +++ b/engines/bladerunner/ambient_sounds.cpp @@ -0,0 +1,212 @@ +/* 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/ambient_sounds.h" + +#include "bladerunner/audio_player.h" +#include "bladerunner/bladerunner.h" +#include "bladerunner/gameinfo.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]; + _ambientVolume = 65; + + for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + NonLoopingSound &track = _nonLoopingSounds[i]; + track.isActive = false; + } + + for (int i = 0; i != LOOPING_SOUNDS; ++i) { + LoopingSound &track = _loopingSounds[i]; + track.isActive = false; + } +} + +AmbientSounds::~AmbientSounds() { + delete[] _nonLoopingSounds; + delete[] _loopingSounds; +} + +static inline void sort(int &a, int &b) { + if (a > b) { + int t = a; + a = b; + b = t; + } +} + +void AmbientSounds::addSound( + int id, + int timeRangeBegin, int timeRangeEnd, + int volumeRangeBegin, int volumeRangeEnd, + int unk1RangeBegin, int unk1RangeEnd, + int unk2RangeBegin, int unk2RangeEnd, + int priority, int unk3) { + const char *name = _vm->_gameInfo->getSfxTrack(id); + + sort(volumeRangeBegin, volumeRangeEnd); + sort(unk1RangeBegin, unk1RangeEnd); + sort(unk2RangeBegin, unk2RangeEnd); + + addSoundByName( + name, + timeRangeBegin, timeRangeEnd, + volumeRangeBegin, volumeRangeEnd, + unk1RangeBegin, unk1RangeEnd, + unk2RangeBegin, unk2RangeEnd, + priority, unk3 + ); +} + +void AmbientSounds::addLoopingSound(int sfx_id, int volume, int unk, int fadeInTime) { + const char *name = _vm->_gameInfo->getSfxTrack(sfx_id); + + int32 hash = mix_id(name); + + if (findLoopingTrackByHash(hash) >= 0) + return; + + int i = findAvailableLoopingTrack(); + if (i == -1) + return; + + int actualVolume = volume * _ambientVolume / 100; + + int balance = 0; + + _vm->_audioPlayer->playAud(name, actualVolume, balance, balance, 100, AudioPlayer::LOOP | AudioPlayer::OVERRIDE_VOLUME); +} + +void AmbientSounds::tick() { + uint32 now = g_system->getMillis(); + + for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + NonLoopingSound &track = _nonLoopingSounds[i]; + + if (!track.isActive || track.nextPlayTime > now) + continue; + + int pan1, pan2; + + pan1 = _vm->_rnd.getRandomNumberRng(track.pan1begin, track.pan1end); + if (track.pan2begin == -101) { + pan2 = pan1; + } else { + pan2 = _vm->_rnd.getRandomNumberRng(track.pan2begin, track.pan2end); + } + + track.volume = _vm->_rnd.getRandomNumberRng(track.volume1, track.volume2); + + track.audio_player_track = _vm->_audioPlayer->playAud( + track.name, + track.volume * _ambientVolume / 100, + pan1, pan2, + track.priority, + AudioPlayer::OVERRIDE_VOLUME + ); + + track.nextPlayTime = now + _vm->_rnd.getRandomNumberRng(track.time1, track.time2); + + } +} + +int AmbientSounds::findAvailableNonLoopingTrack() { + for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + if (!_nonLoopingSounds[i].isActive) + return i; + } + + return -1; +} + +int AmbientSounds::findNonLoopingTrackByHash(int32 hash) { + for (int i = 0; i != NON_LOOPING_SOUNDS; ++i) { + NonLoopingSound &track = _nonLoopingSounds[i]; + + if (track.isActive && track.hash == hash) + return i; + } + + return -1; +} + +int AmbientSounds::findAvailableLoopingTrack() { + for (int i = 0; i != LOOPING_SOUNDS; ++i) { + if (!_loopingSounds[i].isActive) + return i; + } + + return -1; +} + +int AmbientSounds::findLoopingTrackByHash(int32 hash) { + for (int i = 0; i != LOOPING_SOUNDS; ++i) { + LoopingSound &track = _loopingSounds[i]; + + if (track.isActive && track.hash == hash) + return i; + } + + return -1; +} + +void AmbientSounds::addSoundByName( + const char *name, + int timeRangeBegin, int timeRangeEnd, + int volumeRangeBegin, int volumeRangeEnd, + int pan1begin, int pan1end, + int pan2begin, int pan2end, + int priority, int unk3) { + int i = findAvailableNonLoopingTrack(); + if (i < 0) + return; + + NonLoopingSound &track = _nonLoopingSounds[i]; + + uint32 now = g_system->getMillis(); + + track.isActive = true; + strcpy(track.name, name); + track.hash = mix_id(name); + track.time1 = 1000 * timeRangeBegin; + track.time2 = 1000 * timeRangeEnd; + track.nextPlayTime = now + _vm->_rnd.getRandomNumberRng(track.time1, track.time2); + track.volume1 = volumeRangeBegin; + track.volume2 = volumeRangeEnd; + track.volume = 0; + track.pan1begin = pan1begin; + track.pan1end = pan1end; + track.pan2begin = pan2begin; + track.pan2end = pan2end; + track.priority = priority; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/ambient_sounds.h b/engines/bladerunner/ambient_sounds.h new file mode 100644 index 0000000000..e5428e9f80 --- /dev/null +++ b/engines/bladerunner/ambient_sounds.h @@ -0,0 +1,120 @@ +/* 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_AMBIENT_SOUNDS_H +#define BLADERUNNER_AMBIENT_SOUNDS_H + +#include "audio/audiostream.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class AmbientSounds { + BladeRunnerEngine *_vm; + + struct NonLoopingSound { + bool isActive; + char name[13]; + int32 hash; + int32 audio_player_track; + int32 time1; + int32 time2; + uint32 nextPlayTime; + int32 volume1; + int32 volume2; + int32 volume; + int32 pan1begin; + int32 pan1end; + int32 pan2begin; + int32 pan2end; + int32 priority; + }; + + struct LoopingSound { + bool isActive; + char name[13]; + int32 hash; + int32 volume; + }; + + NonLoopingSound *_nonLoopingSounds; + LoopingSound *_loopingSounds; + int _ambientVolume; + +public: + AmbientSounds(BladeRunnerEngine *vm); + ~AmbientSounds(); + + void addSound( + int id, + int timeRangeBegin, int timeRangeEnd, + int volumeRangeBegin, int volumeRangeEnd, + int pan1begin, int pan1end, + int pan2begin, int pan2end, + int priority, int unk3 + ); + // removeSound + // addSpeechSound + // removeSpeechSound + // playSound + // playSpeech + // removeAllNonLoopingSounds + + // addLoopingSound + void addLoopingSound(int sfx_id, int volume, int unk, int fadeInTime); + // adjustLoopingSound + // removeLoopingSound + // removeAllLoopingSounds + + void tick(); + + // setVolume + // getVolume + +private: + int findAvailableNonLoopingTrack(); + int findNonLoopingTrackByHash(int32 hash); + + int findAvailableLoopingTrack(); + int findLoopingTrackByHash(int32 hash); + + // stopNonLoopingTrack + // stopLoopingTrack + + // saveToSaveGame + // initFromSaveGame + // addSoundByName + // playVolumeAdjustSound + + void addSoundByName( + const char *name, + int timeRangeBegin, int timeRangeEnd, + int volumeRangeBegin, int volumeRangeEnd, + int unk1RangeBegin, int unk1RangeEnd, + int unk2RangeBegin, int unk2RangeEnd, + int priority, int unk3); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/archive.cpp b/engines/bladerunner/archive.cpp new file mode 100644 index 0000000000..005145599d --- /dev/null +++ b/engines/bladerunner/archive.cpp @@ -0,0 +1,156 @@ +/* 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/archive.h" + +#include "common/debug.h" + +namespace BladeRunner { + +MIXArchive::MIXArchive() { +} + +MIXArchive::~MIXArchive() { + if (_fd.isOpen()) + debug("~MIXArchive: fd not closed: %s", _fd.getName()); +} + +bool MIXArchive::open(const Common::String &filename) { + if (!_fd.open(filename)) { + debug("MIXArchive::open(): Could not open %s", filename.c_str()); + return false; + } + + _isTLK = filename.hasSuffix(".TLK"); + + _entry_count = _fd.readUint16LE(); + _size = _fd.readUint32LE(); + + _entries.resize(_entry_count); + for (uint16 i = 0; i != _entry_count; ++i) { + _entries[i].id = _fd.readSint32LE(); + _entries[i].offset = _fd.readUint32LE(); + _entries[i].length = _fd.readUint32LE(); + + if (false) + debug("%08x %-12d %-12d", _entries[i].id, _entries[i].offset, _entries[i].length); + + // Verify that the entries are sorted by id. Note that id is signed. + if (i > 0) + assert(_entries[i].id > _entries[i - 1].id); + } + + if (_fd.err()) { + error("MIXArchive::open(): Error reading entries in %s", filename.c_str()); + _fd.close(); + return false; + } + + // debug("MIXArchive::open: Opened archive %s", filename.c_str()); + + return true; +} + +void MIXArchive::close() { + return _fd.close(); +} + +bool MIXArchive::isOpen() const { + return _fd.isOpen(); +} + +#define ROL(n) ((n << 1) | ((n >> 31) & 1)) + +int32 mix_id(const Common::String &name) { + char buffer[12] = { 0 }; + + for (uint i = 0; i != name.size() && i < 12u; ++i) + buffer[i] = (char)toupper(name[i]); + + uint32 id = 0; + for (int i = 0; i < 12 && buffer[i]; i += 4) + { + uint32 t = (uint32)buffer[i + 3] << 24 + | (uint32)buffer[i + 2] << 16 + | (uint32)buffer[i + 1] << 8 + | (uint32)buffer[i + 0]; + + id = ROL(id) + t; + } + + return reinterpret_cast<int32&>(id); +} + +static +int32 tlk_id(const Common::String &name) { + char buffer[12] = { 0 }; + + for (uint i = 0; i != name.size() && i < 12u; ++i) + buffer[i] = (char)toupper(name[i]); + + int actor_id = 10 * (buffer[0] - '0') + + (buffer[1] - '0'); + + int speech_id = 1000 * (buffer[3] - '0') + + 100 * (buffer[4] - '0') + + 10 * (buffer[5] - '0') + + (buffer[6] - '0'); + + return 10000 * actor_id + speech_id; +} + +uint32 MIXArchive::indexForId(int32 id) const { + uint32 lo = 0, hi = _entry_count; + + while (lo < hi) { + uint32 mid = lo + (hi - lo) / 2; + + if (id > _entries[mid].id) + lo = mid + 1; + else if (id < _entries[mid].id) + hi = mid; + else + return mid; + } + return _entry_count; +} + +Common::SeekableReadStream *MIXArchive::createReadStreamForMember(const Common::String &name) { + int32 id; + + if (_isTLK) + id = tlk_id(name); + else + id = mix_id(name); + + uint32 i = indexForId(id); + + if (i == _entry_count) + return NULL; + + uint32 start = _entries[i].offset + 6 + 12 * _entry_count; + uint32 end = _entries[i].length + start; + + return new Common::SafeSeekableSubReadStream(&_fd, start, end, DisposeAfterUse::NO); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/archive.h b/engines/bladerunner/archive.h new file mode 100644 index 0000000000..03eda4ea7f --- /dev/null +++ b/engines/bladerunner/archive.h @@ -0,0 +1,67 @@ +/* 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_ARCHIVE_H +#define BLADERUNNER_ARCHIVE_H + +#include "common/array.h" +#include "common/file.h" +#include "common/substream.h" + +namespace BladeRunner { + +class MIXArchive { +public: + MIXArchive(); + ~MIXArchive(); + + bool open(const Common::String &filename); + void close(); + bool isOpen() const; + + Common::String getName() { return _fd.getName(); } + + Common::SeekableReadStream *createReadStreamForMember(const Common::String &name); + +private: + Common::File _fd; + bool _isTLK; + + uint16 _entry_count; + uint32 _size; + + struct ArchiveEntry { + int32 id; + uint32 offset; + uint32 length; + }; + + Common::Array<ArchiveEntry> _entries; + + uint32 indexForId(int32 id) const; +}; + +int32 mix_id(const Common::String &name); + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp new file mode 100644 index 0000000000..b583531ecd --- /dev/null +++ b/engines/bladerunner/aud_stream.cpp @@ -0,0 +1,109 @@ +/* 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/aud_stream.h" + +#include "bladerunner/audio_player.h" + +#include "common/util.h" + +namespace BladeRunner { + +AudStream::AudStream(byte *data) : _cache(nullptr) { + init(data); +} + +AudStream::AudStream(AudioCache *cache, int32 hash) + : _cache(cache), _hash(hash) { + _cache->incRef(_hash); + + init(_cache->findByHash(_hash)); +} + +void AudStream::init(byte *data) { + _data = data; + _end = _data + READ_LE_UINT32(_data + 2) + 12; + assert(_end - _data >= 12); + + _compressionType = *(_data + 11); + + _deafBlockRemain = 0; + _p = _data + 12; +} + +AudStream::~AudStream() { + if (_cache) + _cache->decRef(_hash); +} + +int AudStream::readBuffer(int16 *buffer, const int numSamples) { + int samplesRead = 0; + + if (_compressionType == 99) { + assert(numSamples % 2 == 0); + + while (samplesRead < numSamples) { + if (_deafBlockRemain == 0) { + if (_end - _p == 0) + break; + + assert(_end - _p >= 6); + + uint16 blockSize = READ_LE_UINT16(_p); + uint16 blockOutSize = READ_LE_UINT16(_p + 2); + uint32 sig = READ_LE_UINT32(_p + 4); + _p += 8; + + assert(sig == 0xdeaf); + assert(_end - _p >= blockSize); + assert(blockOutSize = 4 * blockSize); + + _deafBlockRemain = blockSize; + } + + assert(_end - _p >= _deafBlockRemain); + + int bytesConsumed = MIN<int>(_deafBlockRemain, (numSamples - samplesRead) / 2); + + _decoder.decode(_p, bytesConsumed, buffer + samplesRead); + _p += bytesConsumed; + _deafBlockRemain -= bytesConsumed; + + samplesRead += 2 * bytesConsumed; + } + } else { + samplesRead = MIN(numSamples, (int)(_end - _p) / 2); + for (int i = 0; i < samplesRead; i++, _p += 2) { + buffer[i] = READ_LE_UINT16(_p); + } + } + + return samplesRead; +} + +bool AudStream::rewind() { + _p = _data + 12; + _decoder.setParameters(0, 0); + return true; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/aud_stream.h b/engines/bladerunner/aud_stream.h new file mode 100644 index 0000000000..3279bdada3 --- /dev/null +++ b/engines/bladerunner/aud_stream.h @@ -0,0 +1,63 @@ +/* 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_AUD_STREAM_H +#define BLADERUNNER_AUD_STREAM_H + +#include "bladerunner/adpcm_decoder.h" + +#include "audio/audiostream.h" +#include "common/endian.h" +#include "common/types.h" + +namespace BladeRunner { + +class AudioCache; + +class AudStream : public Audio::RewindableAudioStream { + byte *_data; + byte *_p; + byte *_end; + AudioCache *_cache; + int32 _hash; + byte _compressionType; + uint16 _deafBlockRemain; + + ADPCMWestwoodDecoder _decoder; + + void init(byte *data); + +public: + AudStream(byte *data); + AudStream(AudioCache *cache, int32 hash); + ~AudStream(); + + int readBuffer(int16 *buffer, const int numSamples); + bool isStereo() const { return false; } + int getRate() const { return READ_LE_UINT16(_data); }; + bool endOfData() const { return _p == _end; } + bool rewind(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp new file mode 100644 index 0000000000..0c2b747c32 --- /dev/null +++ b/engines/bladerunner/audio_player.cpp @@ -0,0 +1,240 @@ +/* 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 "audio_player.h" + +#include "bladerunner/archive.h" +#include "bladerunner/aud_stream.h" + +#include "bladerunner/bladerunner.h" + +#include "audio/audiostream.h" +#include "audio/mixer.h" + +#include "common/debug.h" +#include "common/stream.h" + +namespace Common { + class MemoryReadStream; +} + +namespace BladeRunner { + +AudioCache::~AudioCache() { + for (uint i = 0; i != _cacheItems.size(); ++i) { + free(_cacheItems[i].data); + } +} + +bool AudioCache::canAllocate(uint32 size) { + Common::StackLock lock(_mutex); + + return _maxSize - _totalSize >= size; +} + +bool AudioCache::dropOldest() { + Common::StackLock lock(_mutex); + + if (_cacheItems.size() == 0) + return false; + + uint oldest = 0; + for (uint i = 1; i != _cacheItems.size(); ++i) { + if (_cacheItems[i].refs == 0 && _cacheItems[i].lastAccess < _cacheItems[oldest].lastAccess) + oldest = i; + } + + free(_cacheItems[oldest].data); + _totalSize -= _cacheItems[oldest].size; + _cacheItems.remove_at(oldest); + return true; +} + +byte *AudioCache::findByHash(int32 hash) { + Common::StackLock lock(_mutex); + + for (uint i = 0; i != _cacheItems.size(); ++i) { + if (_cacheItems[i].hash == hash) { + _cacheItems[i].lastAccess = _accessCounter++; + return _cacheItems[i].data; + } + } + + return NULL; +} + +void AudioCache::storeByHash(int32 hash, Common::SeekableReadStream *stream) { + Common::StackLock lock(_mutex); + + uint32 size = stream->size(); + byte *data = (byte*)malloc(size); + stream->read(data, size); + + cacheItem item = { + hash, + 0, + _accessCounter++, + data, + size + }; + + _cacheItems.push_back(item); + _totalSize += size; +} + +void AudioCache::incRef(int32 hash) { + Common::StackLock lock(_mutex); + + for (uint i = 0; i != _cacheItems.size(); ++i) { + if (_cacheItems[i].hash == hash) { + _cacheItems[i].refs++; + return; + } + } + assert(0 && "AudioCache::incRef: hash not found"); +} + +void AudioCache::decRef(int32 hash) { + Common::StackLock lock(_mutex); + + for (uint i = 0; i != _cacheItems.size(); ++i) { + if (_cacheItems[i].hash == hash) { + assert(_cacheItems[i].refs > 0); + _cacheItems[i].refs--; + return; + } + } + assert(0 && "AudioCache::decRef: hash not found"); +} + +AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) : _vm(vm) { + _cache = new AudioCache(); + + for (int i = 0; i != 6; ++i) { + _tracks[i].hash = 0; + _tracks[i].priority = 0; + } +} + +AudioPlayer::~AudioPlayer() { + delete _cache; +} + +bool AudioPlayer::isTrackActive(Track *track) { + if (!track->isMaybeActive) + return false; + + return track->isMaybeActive = _vm->_mixer->isSoundHandleActive(track->soundHandle); +} + +void AudioPlayer::stopAll() { + for (int i = 0; i != TRACKS; ++i) { + _vm->_mixer->stopHandle(_tracks[i].soundHandle); + } +} + +void AudioPlayer::fadeAndStopTrack(Track *track, int time) { + (void)time; + + _vm->_mixer->stopHandle(track->soundHandle); +} + +int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, int panTo, int priority, byte flags) { + /* Find first available track or, alternatively, the lowest priority playing track */ + Track *track = NULL; + int lowestPriority = 1000000; + Track *lowestPriorityTrack = NULL; + + for (int i = 0; i != 6; ++i) { + Track *ti = &_tracks[i]; + if (!isTrackActive(ti)) { + track = ti; + break; + } + + if (lowestPriorityTrack == NULL || ti->priority < lowestPriority) { + lowestPriority = ti->priority; + lowestPriorityTrack = ti; + } + } + + /* If there's no available track, stop the lowest priority track if it's lower than + * the new priority + */ + if (track == NULL && lowestPriority < priority) { + fadeAndStopTrack(lowestPriorityTrack, 1); + track = lowestPriorityTrack; + } + + /* If there's still no available track, give up */ + if (track == NULL) + return -1; + + /* Load audio resource and store in cache. Playback will happen directly from there. */ + int32 hash = mix_id(name); + if (!_cache->findByHash(hash)) { + Common::SeekableReadStream *r = _vm->getResourceStream(name); + if (!r) + return -1; + + int32 size = r->size(); + while (!_cache->canAllocate(size)) { + if (!_cache->dropOldest()) { + delete r; + return -1; + } + } + _cache->storeByHash(hash, r); + delete r; + } + + AudStream *audStream = new AudStream(_cache, hash); + + Audio::AudioStream *audioStream = audStream; + if (flags & LOOP) { + audioStream = new Audio::LoopingAudioStream(audStream, 0, DisposeAfterUse::YES); + } + + Audio::SoundHandle soundHandle; + + // debug("PlayStream: %s", name.c_str()); + + int balance = panFrom; + + _vm->_mixer->playStream( + Audio::Mixer::kPlainSoundType, + &soundHandle, + audioStream, + -1, + volume * 255 / 100, + balance); + + track->isMaybeActive = true; + track->soundHandle = soundHandle; + track->priority = priority; + track->hash = hash; + track->volume = volume; + + return track - &_tracks[0]; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h new file mode 100644 index 0000000000..4260a7b32b --- /dev/null +++ b/engines/bladerunner/audio_player.h @@ -0,0 +1,109 @@ +/* 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_AUDIO_H +#define BLADERUNNER_AUDIO_H + +#include "audio/mixer.h" +#include "common/array.h" +#include "common/mutex.h" +#include "common/str.h" +#include "common/types.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class AudioCache; + +#define TRACKS 6 + +/* + * This is a poor imitation of Bladerunner's resource cache + */ +class AudioCache { + struct cacheItem { + int32 hash; + int refs; + uint lastAccess; + byte *data; + uint32 size; + }; + + Common::Mutex _mutex; + Common::Array<cacheItem> _cacheItems; + + uint32 _totalSize; + uint32 _maxSize; + uint32 _accessCounter; +public: + AudioCache() : + _totalSize(0), + _maxSize(2457600), + _accessCounter(0) { + } + ~AudioCache(); + + bool canAllocate(uint32 size); + bool dropOldest(); + byte *findByHash(int32 hash); + void storeByHash(int32 hash, Common::SeekableReadStream *stream); + + void incRef(int32 hash); + void decRef(int32 hash); +}; + +class AudioPlayer { + BladeRunnerEngine *_vm; + AudioCache *_cache; + + struct Track { + bool isMaybeActive; + Audio::SoundHandle soundHandle; + int priority; + int32 hash; + int volume; + + Track() : isMaybeActive(false) {} + }; + + Track _tracks[TRACKS]; + + bool isTrackActive(Track *track); + void fadeAndStopTrack(Track *track, int time); + +public: + AudioPlayer(BladeRunnerEngine *vm); + ~AudioPlayer(); + + enum { + LOOP = 1, + OVERRIDE_VOLUME = 2 + }; + + int playAud(const Common::String &name, int volume, int panFrom, int panTo, int priority, byte flags = 0); + + void stopAll(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp new file mode 100644 index 0000000000..2d06025892 --- /dev/null +++ b/engines/bladerunner/audio_speech.cpp @@ -0,0 +1,94 @@ +/* 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/audio_speech.h" + +#include "bladerunner/aud_stream.h" +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" + +namespace BladeRunner { + +#define BUFFER_SIZE 200000 + +AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) : _vm(vm) { + _volume = 50; + _isMaybeActive = false; + _data = new byte[BUFFER_SIZE]; +} + +AudioSpeech::~AudioSpeech() { + delete[] _data; +} + +bool AudioSpeech::playSpeech(const char *name, int balance) { + // debug("AudioSpeech::playSpeech(\"%s\")", name); + Common::ScopedPtr<Common::SeekableReadStream> r(_vm->getResourceStream(name)); + + if (!r) { + warning("AudioSpeech::playSpeech: AUD resource \"%s\" not found", name); + return false; + } + + if (r->size() > BUFFER_SIZE) { + warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), BUFFER_SIZE); + return false; + } + + if (isPlaying()) { + stopSpeech(); + } + + r->read(_data, r->size()); + if (r->err()) { + warning("AudioSpeech::playSpeech: Error reading resource \"%s\"", name); + return false; + } + + AudStream *audioStream = new AudStream(_data); + + _vm->_mixer->playStream( + Audio::Mixer::kPlainSoundType, + &_soundHandle, + audioStream, + -1, + _volume * 255 / 100, + balance); + + _isMaybeActive = true; + + return true; +} + +void AudioSpeech::stopSpeech() { + _vm->_mixer->stopHandle(_soundHandle); +} + +bool AudioSpeech::isPlaying() { + if (!_isMaybeActive) + return false; + + return _isMaybeActive = _vm->_mixer->isSoundHandleActive(_soundHandle); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/audio_speech.h b/engines/bladerunner/audio_speech.h new file mode 100644 index 0000000000..ae7065865b --- /dev/null +++ b/engines/bladerunner/audio_speech.h @@ -0,0 +1,52 @@ +/* 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_AUDIO_SPEECH_H +#define BLADERUNNER_AUDIO_SPEECH_H + +#include "audio/mixer.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class AudioSpeech { +private: + BladeRunnerEngine *_vm; + int _volume; + bool _isMaybeActive; + Audio::SoundHandle _soundHandle; + byte *_data; + +public: + AudioSpeech(BladeRunnerEngine *vm); + ~AudioSpeech(); + + bool playSpeech(const char *name, int balance = 0); + void stopSpeech(); + bool isPlaying(); + void setVolume(int volume) { _volume = volume; } +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp new file mode 100644 index 0000000000..9cd0e0ddc2 --- /dev/null +++ b/engines/bladerunner/bladerunner.cpp @@ -0,0 +1,942 @@ +/* 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/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/adq.h" +#include "bladerunner/ambient_sounds.h" +#include "bladerunner/audio_player.h" +#include "bladerunner/audio_speech.h" +#include "bladerunner/chapters.h" +#include "bladerunner/combat.h" +#include "bladerunner/crimes_database.h" +#include "bladerunner/font.h" +#include "bladerunner/gameflags.h" +#include "bladerunner/gameinfo.h" +#include "bladerunner/image.h" +#include "bladerunner/item_pickup.h" +#include "bladerunner/items.h" +#include "bladerunner/lights.h" +#include "bladerunner/mouse.h" +#include "bladerunner/outtake.h" +#include "bladerunner/obstacles.h" +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/script/init.h" +#include "bladerunner/script/script.h" +#include "bladerunner/settings.h" +#include "bladerunner/shape.h" +#include "bladerunner/slice_animations.h" +#include "bladerunner/slice_renderer.h" +#include "bladerunner/text_resource.h" +#include "bladerunner/vqa_decoder.h" +#include "bladerunner/waypoints.h" + +#include "common/array.h" +#include "common/error.h" +#include "common/events.h" +#include "common/system.h" + +#include "engines/util.h" + +#include "graphics/pixelformat.h" +#include "suspects_database.h" + +namespace BladeRunner { + +BladeRunnerEngine::BladeRunnerEngine(OSystem *syst) + : Engine(syst), + _rnd("bladerunner") { + _windowIsActive = true; + _gameIsRunning = true; + _playerLosesControlCounter = 0; + + _crimesDatabase = nullptr; + _script = new Script(this); + _settings = new Settings(this); + _lights = new Lights(this); + _combat = new Combat(this); + _adq = new ADQ(this); + _obstacles = new Obstacles(this); + _itemPickup = new ItemPickup(this); + + _walkSoundId = -1; + _walkSoundVolume = 0; + _walkSoundBalance = 0; +} + +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; + + // _surface1.free(); + // _surface2.free(); + + // delete[] _zBuffer1; + // delete[] _zBuffer2; + + delete _itemPickup; + delete _obstacles; + delete _adq; + delete _combat; + delete _lights; + delete _settings; + delete _script; +} + +bool BladeRunnerEngine::hasFeature(EngineFeature f) const { + return f == kSupportsRTL; +} + +Common::Error BladeRunnerEngine::run() { + Graphics::PixelFormat format = createRGB555(); + initGraphics(640, 480, true, &format); + + _system->showMouse(true); + + if (!startup()) { + shutdown(); + return Common::Error(Common::kUnknownError, "Failed to initialize resources"); + } + + if (warnUserAboutUnsupportedGame()) { + init2(); + + /* TODO: Check for save games and enter KIA */ + gameLoop(); + } + + shutdown(); + + return Common::kNoError; +} + +bool BladeRunnerEngine::startup(bool hasSavegames) { + bool r; + + _surface1.create(640, 480, createRGB555()); + + r = openArchive("STARTUP.MIX"); + if (!r) + return false; + + // TODO: Timer + + _gameInfo = new GameInfo(this); + if (!_gameInfo) + return false; + + r = _gameInfo->open("GAMEINFO.DAT"); + if (!r) + return false; + + // TODO: Create datetime - not used + + // TODO: Create graphics surfaces 1-4 + + // TODO: Allocate audio cache + + if (hasSavegames) { + if (!loadSplash()) { + return false; + } + } + + _waypoints = new Waypoints(this, _gameInfo->getWaypointCount()); + + // TODO: Cover waypoints + + // TODO: Flee waypoints + + _gameVars = new int[_gameInfo->getGlobalVarCount()]; + + // TODO: Actor AI DLL init + + // Seed rand + + // TODO: Sine and cosine lookup tables for intervals of 1.0, 4.0, and 12.0 + + _view = new View(); + + _sceneObjects = new SceneObjects(this, _view); + + _gameFlags = new GameFlags(); + _gameFlags->setFlagCount(_gameInfo->getFlagCount()); + + _items = new Items(this); + + // Setup sound output + + _audioPlayer = new AudioPlayer(this); + + // TODO: Audio: Music + + _audioSpeech = new AudioSpeech(this); + + _ambientSounds = new AmbientSounds(this); + + // TODO: Read BLADE.INI + + _chapters = new Chapters(this); + if (!_chapters) + return false; + + if (!openArchive("MUSIC.MIX")) + return false; + + if (!openArchive("SFX.MIX")) + return false; + + if (!openArchive("SPCHSFX.TLK")) + return false; + + // TODO: Video overlays + + // TODO: Proper ZBuf class + _zBuffer1 = new uint16[640 * 480]; + _zBuffer2 = new uint16[640 * 480]; + + int actorCount = (int)_gameInfo->getActorCount(); + assert(actorCount < 99); + for (int i = 0; i != actorCount; ++i) { + _actors[i] = new Actor(this, i); + _actors[i]->setup(i); + } + _voiceoverActor = new Actor(this, 99); + _playerActor = _actors[_gameInfo->getPlayerId()]; + + _playerActor->setFPS(15); + + // TODO: set _playerActor countdown timer 6 + + // TODO: Set actor ids (redundant?) + + // TODO: Police Maze + + _textActorNames = new TextResource(this); + if (!_textActorNames->open("ACTORS")) + return false; + + _textCrimes = new TextResource(this); + if (!_textCrimes->open("CRIMES")) + return false; + + _textCluetype = new TextResource(this); + if (!_textCluetype->open("CLUETYPE")) + return false; + + _textKIA = new TextResource(this); + if (!_textKIA->open("KIA")) + return false; + + _textSpindest = new TextResource(this); + if (!_textSpindest->open("SPINDEST")) + return false; + + _textVK = new TextResource(this); + if (!_textVK->open("VK")) + return false; + + _textOptions = new TextResource(this); + if (!_textOptions->open("OPTIONS")) + return false; + + // TODO: Dialogue Menu (DLGMENU.TRE) + + _suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectsDatabaseSize()); + + // TODO: KIA + + // TODO: Spinner Interface + + // TODO: Elevators + + // TODO: Scores + + _mainFont = new Font(this); + _mainFont->open("KIA6PT.FON", 640, 480, -1, 0, 0x252D); + _mainFont->setSpacing(1, 0); + + for (int i = 0; i != 43; ++i) { + Shape *shape = new Shape(this); + shape->readFromContainer("SHAPES.SHP", i); + _shapes.push_back(shape); + } + + // TODO: Esper + + // TODO: VK + + _mouse = new Mouse(this); + // _mouse->setCursorPosition(320, 240); + _mouse->setCursor(0); + + _sliceAnimations = new SliceAnimations(this); + r = _sliceAnimations->open("INDEX.DAT"); + if (!r) + return false; + + // TODO: Support cdframes + + r = _sliceAnimations->openHDFrames(); + if (!r) + return false; + + r = _sliceAnimations->openCoreAnim(); + if (!r) + return false; + + _sliceRenderer = new SliceRenderer(this); + + _crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount()); + + // TODO: Scene + _scene = new Scene(this); + + // Load INIT.DLL + ScriptInit initScript(this); + initScript.SCRIPT_Initialize_Game(); + + // TODO: Load AI-ACT1.DLL + _aiScripts = new AIScripts(this); + + initChapterAndScene(); + + return true; +} + +void BladeRunnerEngine::initChapterAndScene() { + // TODO: Init actors... + for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) + _aiScripts->Initialize(i); + + for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) + _actors[i]->changeAnimationMode(i); + + _settings->setChapter(1); + _settings->setNewSetAndScene(_gameInfo->getInitialSetId(), _gameInfo->getInitialSceneId()); +} + +void BladeRunnerEngine::shutdown() { + _mixer->stopAll(); + + // TODO: Write BLADE.INI + + // TODO: Shutdown VK + + // TODO: Shutdown Esper + + delete _mouse; + _mouse = nullptr; + + for (uint i = 0; i != _shapes.size(); ++i) { + delete _shapes[i]; + } + _shapes.clear(); + + // TODO: Shutdown Scene + delete _scene; + + if (_chapters) { + if (_chapters->hasOpenResources()) + _chapters->closeResources(); + delete _chapters; + _chapters = nullptr; + } + + delete _crimesDatabase; + _crimesDatabase = nullptr; + + delete _sliceRenderer; + _sliceRenderer = nullptr; + + delete _sliceAnimations; + _sliceAnimations = nullptr; + + delete _textActorNames; + _textActorNames = nullptr; + + delete _textCrimes; + _textCrimes = nullptr; + + delete _textCluetype; + _textCluetype = nullptr; + + delete _textKIA; + _textKIA = nullptr; + + delete _textSpindest; + _textSpindest = nullptr; + + delete _textVK; + _textVK = nullptr; + + delete _textOptions; + _textOptions = nullptr; + + // TODO: Delete dialogue menu + + delete _ambientSounds; + + // TODO: Delete overlays + + delete _audioSpeech; + + // TODO: Delete Audio: Music + + delete _audioPlayer; + + // Shutdown sound output + + if (isArchiveOpen("MUSIC.MIX")) + closeArchive("MUSIC.MIX"); + + if (isArchiveOpen("SFX.MIX")) + closeArchive("SFX.MIX"); + + if (isArchiveOpen("SPCHSFX.TLK")) + closeArchive("SPCHSFX.TLK"); + + if (_mainFont) { + _mainFont->close(); + delete _mainFont; + _mainFont = nullptr; + } + + delete _items; + _items = nullptr; + + delete _gameFlags; + _gameFlags = nullptr; + + delete _view; + _view = nullptr; + + delete _sceneObjects; + _sceneObjects = nullptr; + + // TODO: Delete sine and cosine lookup tables + + // TODO: Unload AI dll + + delete[] _gameVars; + _gameVars = nullptr; + + delete _waypoints; + _waypoints = nullptr; + + // TODO: Delete Cover waypoints + + // TODO: Delete Flee waypoints + + // TODO: Delete Scores + + // TODO: Delete Elevators + + // TODO: Delete Spinner Interface + + // TODO: Delete KIA + + delete _suspectsDatabase; + _suspectsDatabase = nullptr; + + // TODO: Delete datetime - not used + + // TODO: Delete actors + + // TODO: Delete proper ZBuf class + delete[] _zBuffer1; + _zBuffer1 = nullptr; + + delete[] _zBuffer2; + _zBuffer2 = nullptr; + + delete _gameInfo; + _gameInfo = nullptr; + + // TODO: Delete graphics surfaces here + _surface1.free(); + _surface2.free(); + + if (isArchiveOpen("STARTUP.MIX")) + closeArchive("STARTUP.MIX"); + + // TODO: Delete MIXArchives here + + // TODO: Delete Timer +} + +bool BladeRunnerEngine::loadSplash() { + Image img(this); + if (!img.open("SPLASH.IMG")) + return false; + + img.copyToSurface(&_surface1); + + _system->copyRectToScreen(_surface1.getPixels(), _surface1.pitch, 0, 0, _surface1.w, _surface1.h); + _system->updateScreen(); + + return false; +} + +bool BladeRunnerEngine::init2() { + return true; +} + +void BladeRunnerEngine::gameLoop() { + _gameIsRunning = true; + do { + /* TODO: check player death */ + gameTick(); + } while (_gameIsRunning); +} + +#if _DEBUG + +void drawBBox(Vector3 start, Vector3 end, View *view, Graphics::Surface *surface, int color) { + Vector3 bfl = view->calculateScreenPosition(Vector3(start.x, start.y, start.z)); + Vector3 bfr = view->calculateScreenPosition(Vector3(start.x, end.y, start.z)); + Vector3 bbr = view->calculateScreenPosition(Vector3(end.x, end.y, start.z)); + Vector3 bbl = view->calculateScreenPosition(Vector3(end.x, start.y, start.z)); + + Vector3 tfl = view->calculateScreenPosition(Vector3(start.x, start.y, end.z)); + Vector3 tfr = view->calculateScreenPosition(Vector3(start.x, end.y, end.z)); + Vector3 tbr = view->calculateScreenPosition(Vector3(end.x, end.y, end.z)); + Vector3 tbl = view->calculateScreenPosition(Vector3(end.x, start.y, end.z)); + + surface->drawLine(bfl.x, bfl.y, bfr.x, bfr.y, color); + surface->drawLine(bfr.x, bfr.y, bbr.x, bbr.y, color); + surface->drawLine(bbr.x, bbr.y, bbl.x, bbl.y, color); + surface->drawLine(bbl.x, bbl.y, bfl.x, bfl.y, color); + + surface->drawLine(tfl.x, tfl.y, tfr.x, tfr.y, color); + surface->drawLine(tfr.x, tfr.y, tbr.x, tbr.y, color); + surface->drawLine(tbr.x, tbr.y, tbl.x, tbl.y, color); + surface->drawLine(tbl.x, tbl.y, tfl.x, tfl.y, color); + + surface->drawLine(bfl.x, bfl.y, tfl.x, tfl.y, color); + surface->drawLine(bfr.x, bfr.y, tfr.x, tfr.y, color); + surface->drawLine(bbr.x, bbr.y, tbr.x, tbr.y, color); + surface->drawLine(bbl.x, bbl.y, tbl.x, tbl.y, color); +} +#endif + +void BladeRunnerEngine::gameTick() { + handleEvents(); + + if (_gameIsRunning && _windowIsActive) { + // TODO: Only run if not in Kia, script, nor AI + _settings->openNewScene(); + + // TODO: Autosave + // TODO: Kia + // TODO: Spinner + // TODO: Esper + // TODO: VK + // TODO: Elevators + // TODO: Scores + + _adq->tick(); + if (_scene->didPlayerWalkIn()) { + _script->PlayerWalkedIn(); + } + // TODO: Gun range announcements + // TODO: ZBUF repair dirty rects + + _ambientSounds->tick(); + + bool backgroundChanged = false; + int frame = _scene->advanceFrame(_surface1, _zBuffer1); + if (frame >= 0) { + _script->SceneFrameAdvanced(frame); + backgroundChanged = true; + } + (void)backgroundChanged; + _surface2.copyFrom(_surface1); + memcpy(_zBuffer2, _zBuffer1, 640 * 480 * 2); + +#if 0 + { + for (int y = 0; y != 480; ++y) { + for (int x = 0; x != 640; ++x) { + if (_scene->_regions->getRegionAtXY(x, y) >= 0) { + uint16 *p = (uint16*)_surface2.getBasePtr(x, y); + *p = 0x7C00; + } + if (_scene->_exits->getRegionAtXY(x, y) >= 0) { + uint16 *p = (uint16*)_surface2.getBasePtr(x, y); + *p = 0x7C08; + } + } + } + } +#endif + + // TODO: Render overlays + // TODO: Tick Actor AI and Timers + + if (_settings->getNewScene() == -1 || _script->_inScriptCounter /* || in_ai */) { + _sliceRenderer->setView(*_view); + + // Tick and draw all actors in current set + //int setId = _scene->_setId; + for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) { + //if (_actors[i]->getSetId() == setId) { + if (i == 0 || i == 23) { // Currently limited to McCoy and Officer Leroy + _actors[i]->tick(backgroundChanged); + } + } + + _items->tick(); + + _itemPickup->tick(); + _itemPickup->draw(); + + // TODO: Draw dialogue menu + + Common::Point p = _eventMan->getMousePos(); + _mouse->tick(p.x, p.y); + _mouse->draw(_surface2, p.x, p.y); + + // TODO: Process AUD + // TODO: Footstep sound + + if (_walkSoundId >= 0) { + const char *name = _gameInfo->getSfxTrack(_walkSoundId); + _audioPlayer->playAud(name, _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0); + _walkSoundId = -1; + } + +#if 0 + //draw scene objects + int count = _sceneObjects->_count; + if (count > 0) { + for (int i = 0; i < count; i++) { + SceneObject *sceneObject = &_sceneObjects->_sceneObjects[_sceneObjects->_sceneObjectsSortedByDistance[i]]; + + BoundingBox *bbox = &sceneObject->_boundingBox; + Vector3 a, b; + bbox->getXYZ(&a.x, &a.y, &a.z, &b.x, &b.y, &b.z); + + int color = 0b111111111111111; + if (sceneObject->_sceneObjectType == SceneObjectTypeActor) { + color = 0b111110000000000; + } + if (sceneObject->_sceneObjectType == SceneObjectTypeObject) { + color = 0b011110111101111; + //if (sceneObject->_isObstacle) + // color += 0b100000000000000; + if (sceneObject->_isClickable) + color = 0b000001111100000; + //if (sceneObject->_isTarget) + // color += 0b000000000010000; + } + + drawBBox(a, b, _view, &_surface2, color); + + //_surface2.frameRect(sceneObject->_screenRectangle, color); + + Vector3 pos = _view->calculateScreenPosition(0.5 * (a + b)); + switch (sceneObject->_sceneObjectType) { + case SceneObjectTypeActor: + _mainFont->drawColor(_textActorNames->getText(sceneObject->_sceneObjectId - SCENE_OBJECTS_ACTORS_OFFSET), _surface2, pos.x, pos.y, color); + break; + case SceneObjectTypeItem: + _mainFont->drawColor("item", _surface2, pos.x, pos.y, color); + break; + case SceneObjectTypeObject: + _mainFont->drawColor(_scene->objectGetName(sceneObject->_sceneObjectId - SCENE_OBJECTS_OBJECTS_OFFSET), _surface2, pos.x, pos.y, color); + break; + } + } + } + + //draw regions + for (int i = 0; i < 10; i++) { + Region *region = &_scene->_regions->_regions[i]; + if (!region->_present) continue; + _surface2.frameRect(region->_rectangle, 0b000000000011111); + } + + for (int i = 0; i < 10; i++) { + Region *region = &_scene->_exits->_regions[i]; + if (!region->_present) continue; + _surface2.frameRect(region->_rectangle, 0b111111111111111); + } + + for (int i = 0; i < _scene->_set->_walkboxCount; i++) { + 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]); + //debug("walkbox[%i][%i] = x=%f y=%f x=%f y=%f", i, j, start.x, start.y, end.x, end.y); + _surface2.drawLine(start.x, start.y, end.x, end.y, 0b111111111100000); + Vector3 pos = _view->calculateScreenPosition(0.5 * (start + end)); + _mainFont->drawColor(walkbox->_name, _surface2, pos.x, pos.y, 0b111111111100000); + } + + } + + for (int i = 0; i < (int)_lights->_lights.size(); i++) { + Light *light = _lights->_lights[i]; + Matrix4x3 m = light->_matrix; + Vector3 pos = Vector3(m(0, 3), m(1, 3), m(2, 3)); + Vector3 size = Vector3(5.0f, 5.0f, 5.0f); + int colorR = (light->_color.r * 31.0f); + int colorG = (light->_color.g * 31.0f); + int colorB = (light->_color.b * 31.0f); + int color = (colorR << 10) + (colorG << 5) + colorB; + drawBBox(pos - size, pos + size, _view, &_surface2, color); + + } +#endif + + _system->copyRectToScreen((const byte *)_surface2.getBasePtr(0, 0), _surface2.pitch, 0, 0, 640, 480); + _system->updateScreen(); + _system->delayMillis(10); + } + } +} + +void BladeRunnerEngine::handleEvents() { + if (shouldQuit()) { + _gameIsRunning = false; + return; + } + + Common::Event event; + Common::EventManager *eventMan = _system->getEventManager(); + while (eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + handleMouseClick(event.mouse.x, event.mouse.y); + default: + ; + } + } +} + +void BladeRunnerEngine::handleMouseClick(int x, int y) { + if (!playerHasControl() || _mouse->isDisabled()) + return; + + Vector3 mousePosition = _mouse->getXYZ(x, y); + + int isClickable; + int isObstacle; + int isTarget; + + int sceneObjectId = _sceneObjects->findByXYZ(&isClickable, &isObstacle, &isTarget, mousePosition.x, mousePosition.y, mousePosition.z, 1, 0, 1); + int exitIndex = _scene->_exits->getRegionAtXY(x, y); + + debug("%d %d", sceneObjectId, exitIndex); + + if ((sceneObjectId < 0 || sceneObjectId > 73) && exitIndex >= 0) { + handleMouseClickExit(x, y, exitIndex); + return; + } + + int regionIndex = _scene->_regions->getRegionAtXY(x, y); + if (regionIndex >= 0) { + handleMouseClickRegion(x, y, regionIndex); + return; + } + + if (sceneObjectId == -1) { + bool isRunning; + _playerActor->loopWalkToXYZ(mousePosition, 0, false, false, false, &isRunning); + debug("Clicked on nothing %f, %f, %f", mousePosition.x, mousePosition.y, mousePosition.z); + return; + } else if (sceneObjectId >= 0 && sceneObjectId <= 73) { + handleMouseClickActor(x, y, sceneObjectId); + return; + } else if (sceneObjectId >= 74 && sceneObjectId <= 197) { + handleMouseClickItem(x, y, sceneObjectId - 74); + return; + } else if (sceneObjectId >= 198 && sceneObjectId <= 293) { + handleMouseClick3DObject(x, y, sceneObjectId - 198, isClickable, isTarget); + return; + } +} + +void BladeRunnerEngine::handleMouseClickExit(int x, int y, int exitIndex) { + // clickedOnExit(exitType, x, y); + debug("clicked on exit %d %d %d", exitIndex, x, y); + _script->ClickedOnExit(exitIndex); +} + +void BladeRunnerEngine::handleMouseClickRegion(int x, int y, int regionIndex) { + debug("clicked on region %d %d %d", regionIndex, x, y); + _script->ClickedOn2DRegion(regionIndex); +} + +void BladeRunnerEngine::handleMouseClick3DObject(int x, int y, int objectId, bool isClickable, bool isTarget) { + const char *objectName = _scene->objectGetName(objectId); + debug("Clicked on object %s", objectName); + _script->ClickedOn3DObject(objectName, false); +} + +void BladeRunnerEngine::handleMouseClickItem(int x, int y, int itemId) { + debug("Clicked on item %d", itemId); + _script->ClickedOnItem(itemId, false); +} + +void BladeRunnerEngine::handleMouseClickActor(int x, int y, int actorId) { + debug("Clicked on actor %d", actorId); + _script->ClickedOnActor(actorId); +} + +void BladeRunnerEngine::gameWaitForActive() { + while (!_windowIsActive) { + handleEvents(); + } +} + +void BladeRunnerEngine::loopActorSpeaking() { + if (!_audioSpeech->isPlaying()) + return; + + playerLosesControl(); + + do { + gameTick(); + } while (_gameIsRunning && _audioSpeech->isPlaying()); + + playerGainsControl(); +} + +void BladeRunnerEngine::outtakePlay(int id, bool noLocalization, int container) { + Common::String name = _gameInfo->getOuttake(id); + + OuttakePlayer player(this); + + player.play(name, noLocalization, container); +} + +bool BladeRunnerEngine::openArchive(const Common::String &name) { + uint i; + + // If archive is already open, return true + for (i = 0; i != kArchiveCount; ++i) { + if (_archives[i].isOpen() && _archives[i].getName() == name) + return true; + } + + // Find first available slot + for (i = 0; i != kArchiveCount; ++i) { + if (!_archives[i].isOpen()) + break; + } + if (i == kArchiveCount) { + /* TODO: BLADE.EXE retires the least recently used + * archive when it runs out of slots. */ + + error("openArchive: No more archive slots"); + return false; + } + + _archives[i].open(name); + return _archives[i].isOpen(); +} + +bool BladeRunnerEngine::closeArchive(const Common::String &name) { + for (uint i = 0; i != 10; ++i) { + if (_archives[i].isOpen() && _archives[i].getName() == name) { + _archives[i].close(); + return true; + } + } + + debug("closeArchive: Archive %s not open.", name.c_str()); + return false; +} + +bool BladeRunnerEngine::isArchiveOpen(const Common::String &name) { + for (uint i = 0; i != 10; ++i) { + if (_archives[i].isOpen() && _archives[i].getName() == name) + return true; + } + + return false; +} + +Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::String &name) { + for (uint i = 0; i != 10; ++i) { + if (!_archives[i].isOpen()) + continue; + + if (false) + debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str()); + Common::SeekableReadStream *stream = _archives[i].createReadStreamForMember(name); + if (stream) + return stream; + } + + debug("getResource: Resource %s not found.", name.c_str()); + return 0; +} + +bool BladeRunnerEngine::playerHasControl() { + return _playerLosesControlCounter == 0; +} + +void BladeRunnerEngine::playerLosesControl() { + if (++_playerLosesControlCounter == 1) { + _mouse->disable(); + } + // debug("Player Lost Control (%d)", _playerLosesControlCounter); +} + +void BladeRunnerEngine::playerGainsControl() { + if (_playerLosesControlCounter == 0) { + warning("Unbalanced call to BladeRunnerEngine::playerGainsControl"); + } + + if (_playerLosesControlCounter > 0) + --_playerLosesControlCounter; + + // debug("Player Gained Control (%d)", _playerLosesControlCounter); + + if (_playerLosesControlCounter == 0) { + _mouse->enable(); + } +} + +void BladeRunnerEngine::ISez(const char *str) { + debug("\t%s", str); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h new file mode 100644 index 0000000000..bbef17820d --- /dev/null +++ b/engines/bladerunner/bladerunner.h @@ -0,0 +1,187 @@ +/* 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_BLADERUNNER_H +#define BLADERUNNER_BLADERUNNER_H + +#include "bladerunner/archive.h" + +#include "common/array.h" +#include "common/random.h" +#include "common/stream.h" + +#include "engines/engine.h" + +#include "graphics/surface.h" +#include "suspects_database.h" + +namespace BladeRunner { + +class Actor; +class ADQ; +class AIScripts; +class AmbientSounds; +class AudioPlayer; +class AudioSpeech; +class Chapters; +class CrimesDatabase; +class Combat; +class Font; +class GameFlags; +class GameInfo; +class ItemPickup; +class Items; +class Lights; +class Mouse; +class Obstacles; +class Scene; +class SceneObjects; +class Script; +class Settings; +class Shape; +class SliceAnimations; +class SliceRenderer; +class TextResource; +class View; +class Waypoints; + +class BladeRunnerEngine : public Engine { +public: + bool _gameIsRunning; + bool _windowIsActive; + int _playerLosesControlCounter; + + ADQ *_adq; + AIScripts *_aiScripts; + AmbientSounds *_ambientSounds; + AudioPlayer *_audioPlayer; + AudioSpeech *_audioSpeech; + Chapters *_chapters; + CrimesDatabase *_crimesDatabase; + Combat *_combat; + GameFlags *_gameFlags; + GameInfo *_gameInfo; + ItemPickup *_itemPickup; + Items *_items; + Lights *_lights; + Font *_mainFont; + Mouse *_mouse; + Obstacles *_obstacles; + Scene *_scene; + SceneObjects *_sceneObjects; + Script *_script; + Settings *_settings; + SliceAnimations *_sliceAnimations; + SliceRenderer *_sliceRenderer; + SuspectsDatabase *_suspectsDatabase; + View *_view; + Waypoints *_waypoints; + int *_gameVars; + + TextResource *_textActorNames; + TextResource *_textCrimes; + TextResource *_textCluetype; + TextResource *_textKIA; + TextResource *_textSpindest; + TextResource *_textVK; + TextResource *_textOptions; + + Common::Array<Shape*> _shapes; + + Actor *_actors[99]; + Actor *_voiceoverActor; + Actor *_playerActor; + + int in_script_counter; + + Graphics::Surface _surface1; + Graphics::Surface _surface2; + uint16 *_zBuffer1; + uint16 *_zBuffer2; + + Common::RandomSource _rnd; + + bool _playerActorIdle; + bool _playerDead; + bool _speechSkipped; + bool _gameOver; + int _gameAutoSave; + bool _gameIsLoading; + bool _sceneIsLoading; + + int _walkSoundId; + int _walkSoundVolume; + int _walkSoundBalance; + int _walkingActorId; +private: + static const int kArchiveCount = 10; + MIXArchive _archives[kArchiveCount]; + +public: + BladeRunnerEngine(OSystem *syst); + ~BladeRunnerEngine(); + + bool hasFeature(EngineFeature f) const; + + Common::Error run(); + + bool startup(bool hasSavegames = false); + void initChapterAndScene(); + void shutdown(); + + bool loadSplash(); + bool init2(); + + void gameLoop(); + void gameTick(); + void handleEvents(); + void handleMouseClick(int x, int y); + void handleMouseClickExit(int x, int y, int exitIndex); + void handleMouseClickRegion(int x, int y, int regionIndex); + void handleMouseClickItem(int x, int y, int itemId); + void handleMouseClickActor(int x, int y, int actorId); + void handleMouseClick3DObject(int x, int y, int objectId, bool isClickable, bool isTarget); + void gameWaitForActive(); + void loopActorSpeaking(); + + void outtakePlay(int id, bool no_localization, int container = -1); + + bool openArchive(const Common::String &name); + bool closeArchive(const Common::String &name); + bool isArchiveOpen(const Common::String &name); + + Common::SeekableReadStream *getResourceStream(const Common::String &name); + + bool playerHasControl(); + void playerLosesControl(); + void playerGainsControl(); + + void ISez(const char *str); +}; + +static inline const Graphics::PixelFormat createRGB555() { + return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); +} + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/boundingbox.cpp b/engines/bladerunner/boundingbox.cpp new file mode 100644 index 0000000000..029442668f --- /dev/null +++ b/engines/bladerunner/boundingbox.cpp @@ -0,0 +1,81 @@ +/* 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/boundingbox.h" + +namespace BladeRunner { + +BoundingBox::BoundingBox(float x0, float y0, float z0, float x1, float y1, float z1) { + _vertices[0].x = x0; + _vertices[0].y = y0; + _vertices[0].z = z0; + + _vertices[1].x = x1; + _vertices[1].y = y1; + _vertices[1].z = z1; +} + +void BoundingBox::expand(float x0, float y0, float z0, float x1, float y1, float z1) { + _vertices[0].x += x0; + _vertices[0].y += y0; + _vertices[0].z += z0; + + _vertices[1].x += x1; + _vertices[1].y += y1; + _vertices[1].z += z1; +} + +bool BoundingBox::inside(float x, float y, float z) { + 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; +} + +void BoundingBox::setXYZ(float x0, float y0, float z0, float x1, float y1, float z1) { + _vertices[0].x = x0; + _vertices[0].y = y0; + _vertices[0].z = z0; + + _vertices[1].x = x1; + _vertices[1].y = y1; + _vertices[1].z = z1; +} + +void BoundingBox::getXYZ(float *x0, float *y0, float *z0, float *x1, float *y1, float *z1) { + *x0 = _vertices[0].x; + *y0 = _vertices[0].y; + *z0 = _vertices[0].z; + + *x1 = _vertices[1].x; + *y1 = _vertices[1].y; + *z1 = _vertices[1].z; +} + +float BoundingBox::getZ0() { + return _vertices[0].z; +} + +float BoundingBox::getZ1() { + return _vertices[1].z; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/boundingbox.h b/engines/bladerunner/boundingbox.h new file mode 100644 index 0000000000..da91489f25 --- /dev/null +++ b/engines/bladerunner/boundingbox.h @@ -0,0 +1,49 @@ +/* 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_BOUNDING_BOX_H +#define BLADERUNNER_BOUNDING_BOX_H + +#include "bladerunner/vector.h" + +namespace BladeRunner { + +class BoundingBox { + Vector3 _vertices[2]; + +public: + BoundingBox() {} + 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); + + 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); + + float getZ0(); + float getZ1(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/chapters.cpp b/engines/bladerunner/chapters.cpp new file mode 100644 index 0000000000..a573ffffa3 --- /dev/null +++ b/engines/bladerunner/chapters.cpp @@ -0,0 +1,59 @@ +/* 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/chapters.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +bool Chapters::enterChapter(int chapter) { + int id = _resourceIds[chapter]; + + if (!_vm->openArchive("A.TLK")) + return false; + + if (!_vm->openArchive(Common::String::format("VQA%d.MIX", MIN(id, 3)))) + return false; + + if (!_vm->openArchive(Common::String::format("%d.TLK", MIN(id, 3)))) + return false; + + if (!_vm->openArchive(Common::String::format("OUTTAKE%d.MIX", id))) + return false; + + _chapter = chapter; + _hasOpenResources = true; + return true; +} + +void Chapters::closeResources() { + int id = _resourceIds[_chapter]; + + _vm->closeArchive("A.TLK"); + _vm->closeArchive(Common::String::format("VQA%d.MIX", MIN(id, 3))); + _vm->closeArchive(Common::String::format("%d.TLK", MIN(id, 3))); + _vm->closeArchive(Common::String::format("OUTTAKE%d.MIX", id)); + _hasOpenResources = false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/chapters.h b/engines/bladerunner/chapters.h new file mode 100644 index 0000000000..5d4da5713d --- /dev/null +++ b/engines/bladerunner/chapters.h @@ -0,0 +1,60 @@ +/* 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_CHAPTERS_H +#define BLADERUNNER_CHAPTERS_H + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Chapters { + BladeRunnerEngine *_vm; + + int _chapter; + int _resourceIds[6]; + bool _hasOpenResources; + +public: + Chapters(BladeRunnerEngine *vm) : _vm(vm), _chapter(0) { + _chapter = 0; + + _resourceIds[0] = 1; + _resourceIds[1] = 1; + _resourceIds[2] = 2; + _resourceIds[3] = 2; + _resourceIds[4] = 3; + _resourceIds[5] = 4; + + _hasOpenResources = false; + } + + bool enterChapter(int chapter); + void closeResources(); + + bool hasOpenResources() { return _hasOpenResources; } + int currentResourceId() { return _chapter ? _resourceIds[_chapter] : -1; } +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/color.h b/engines/bladerunner/color.h new file mode 100644 index 0000000000..a93d79b34a --- /dev/null +++ b/engines/bladerunner/color.h @@ -0,0 +1,51 @@ +/* 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_COLOR_H +#define BLADERUNNER_COLOR_H + +#include "common/system.h" + +namespace BladeRunner { + +struct Color { + float r; + float g; + float b; + + + Color() { + } + + Color(float r_, float g_, float b_) : r(r_), g(g_), b(b_) { + } +}; + +struct Color256 { + uint8 r; + uint8 g; + uint8 b; +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/combat.cpp b/engines/bladerunner/combat.cpp new file mode 100644 index 0000000000..7564faa23d --- /dev/null +++ b/engines/bladerunner/combat.cpp @@ -0,0 +1,85 @@ +/* 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/combat.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/settings.h" + +namespace BladeRunner { + +Combat::Combat(BladeRunnerEngine* vm) { + _vm = vm; + + _active = false; + _enabled = true; + + _ammoDamage[0] = 10; + _ammoDamage[1] = 20; + _ammoDamage[2] = 30; + + for (int i = 0; i < 9; i++) { + _hitSoundId[i] = -1; + _missSoundId[i] = -1; + } +} + +Combat::~Combat() { +} + +void Combat::activate() { + if(_enabled) { + _vm->_playerActor->combatModeOn(-1, -1, -1, -1, 4, 7, 8, -1, -1, -1, _vm->_combat->_ammoDamage[_vm->_settings->getAmmoType()], 0, 0); + _active = true; + } +} + +void Combat::deactivate() { + if (_enabled) { + _vm->_playerActor->combatModeOff(); + _active = false; + } +} + +bool Combat::isActive() { + return _active; +} + +void Combat::enable() { + _enabled = true; +} + +void Combat::disable() { + _enabled = false; +} + +void Combat::setHitSoundId(int row, int column, int soundId) { + _hitSoundId[row * 3 + column] = soundId; +} + +void Combat::setMissSoundId(int row, int column, int soundId) { + _missSoundId[row * 3 + column] = soundId; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/combat.h b/engines/bladerunner/combat.h new file mode 100644 index 0000000000..abb2a328ba --- /dev/null +++ b/engines/bladerunner/combat.h @@ -0,0 +1,60 @@ +/* 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_COMBAT_H +#define BLADERUNNER_COMBAT_H + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Combat { + BladeRunnerEngine *_vm; + + bool _active; + bool _enabled; + int _hitSoundId[9]; + int _missSoundId[9]; +// int _random1; +// int _random2; + +public: + int _ammoDamage[3]; + +public: + Combat(BladeRunnerEngine *vm); + ~Combat(); + + void activate(); + void deactivate(); + bool isActive(); + + void enable(); + void disable(); + + void setHitSoundId(int row, int column, int soundId); + void setMissSoundId(int row, int column, int soundId); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/configure.engine b/engines/bladerunner/configure.engine new file mode 100644 index 0000000000..611309f523 --- /dev/null +++ b/engines/bladerunner/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine bladerunner "Blade Runner" no "" "" "16bit" diff --git a/engines/bladerunner/crimes_database.cpp b/engines/bladerunner/crimes_database.cpp new file mode 100644 index 0000000000..c142a05318 --- /dev/null +++ b/engines/bladerunner/crimes_database.cpp @@ -0,0 +1,72 @@ +/* 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/crimes_database.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/text_resource.h" + +namespace BladeRunner { + +CrimesDatabase::CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount) : _crimesCount(crimesCount) { + // reset(); + + _crimes = new int[_crimesCount]; + _assetTypes = new int[_crimesCount]; + + _cluesText = new TextResource(vm); + _cluesText->open(cluesResource); + + for (int i = 0; i != _crimesCount; ++i) { + _crimes[i] = -1; + _assetTypes[i] = -1; + } +} + +CrimesDatabase::~CrimesDatabase() { + delete _cluesText; + delete[] _assetTypes; + delete[] _crimes; +} + +void CrimesDatabase::setCrime(int crimeId, int value) { + _crimes[crimeId] = value; +} + +int CrimesDatabase::getCrime(int crimeId) { + return _crimes[crimeId]; +} + +void CrimesDatabase::setAssetType(int assetId, int assetType) { + _assetTypes[assetId] = assetType; +} + +int CrimesDatabase::getAssetType(int assetId) { + return _assetTypes[assetId]; +} + +const char *CrimesDatabase::getClueText(int id) { + return _cluesText->getText(id); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/crimes_database.h b/engines/bladerunner/crimes_database.h new file mode 100644 index 0000000000..fc82bf2075 --- /dev/null +++ b/engines/bladerunner/crimes_database.h @@ -0,0 +1,52 @@ +/* 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_CRIMES_DATABASE_H +#define BLADERUNNER_CRIMES_DATABASE_H + +namespace BladeRunner { + +class BladeRunnerEngine; +class TextResource; + +class CrimesDatabase { + int _crimesCount; + int *_crimes; + int *_assetTypes; + TextResource *_cluesText; + +public: + CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount); + ~CrimesDatabase(); + + void setCrime(int crimeId, int value); + int getCrime(int crimeId); + + void setAssetType(int assetId, int assetType); + int getAssetType(int assetId); + + const char *getClueText(int id); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/decompress_lcw.cpp b/engines/bladerunner/decompress_lcw.cpp new file mode 100644 index 0000000000..9fc4640d1b --- /dev/null +++ b/engines/bladerunner/decompress_lcw.cpp @@ -0,0 +1,134 @@ +/* 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/decompress_lcw.h" + +#include "common/util.h" + +namespace BladeRunner { + +uint32 decompress_lcw(uint8 *inBuf, uint32 inLen, uint8 *outBuf, uint32 outLen) { + int version = 1; + int count, i, color, pos, relpos, out_remain; + + uint8 *src = inBuf; + uint8 *dst = outBuf; + uint8 *outEnd = dst + outLen; + + if (src[0] == 0) { + version = 2; + ++src; + } + + while (src < inBuf + inLen && dst < outEnd && src[0] != 0x80) { + out_remain = (int)(outEnd - dst); + + if (src[0] == 0xff) { // 0b11111111 + count = src[1] | (src[2] << 8); + pos = src[3] | (src[4] << 8); + src += 5; + count = MIN(count, out_remain); + + if (version == 1) { + for (i = 0; i < count; i++) + dst[i] = outBuf[i + pos]; + } else { + for (i = 0; i < count; i++) + dst[i] = *(dst + i - pos); + } + } else if (src[0] == 0xfe) { // 0b11111110 + count = src[1] | (src[2] << 8); + color = src[3]; + src += 4; + count = MIN(count, out_remain); + + memset(dst, color, count); + } else if (src[0] >= 0xc0) { // 0b11?????? + count = (src[0] & 0x3f) + 3; + pos = src[1] | (src[2] << 8); + src += 3; + count = MIN(count, out_remain); + + if (version == 1) { + for (i = 0; i < count; i++) + dst[i] = outBuf[i + pos]; + } else { + for (i = 0; i < count; i++) + dst[i] = *(dst + i - pos); + } + } else if (src[0] >= 0x80) { // 0b10?????? + count = src[0] & 0x3f; + ++src; + count = MIN(count, out_remain); + + memcpy(dst, src, count); + src += count; + } else { // 0b0??????? + count = ((src[0] & 0x70) >> 4) + 3; + relpos = ((src[0] & 0x0f) << 8) | src[1]; + src += 2; + count = MIN(count, out_remain); + + for (i = 0; i < count; i++) { + dst[i] = *(dst + i - relpos); + } + } + + dst += count; + } + + return uint32(dst - outBuf); +} + +uint32 decompress_lcw_output_size(uint8 *inBuf, uint32 inLen) { + int count; + uint8 *src = inBuf; + uint32 outsize = 0; + + if (src[0] == 0) + ++src; + + while (src[0] != 0x80 && src < inBuf + inLen) { + if (src[0] == 0xff) { // 0b11111111 + count = src[1] | (src[2] << 8); + src += 5; + } else if (src[0] == 0xfe) { // 0b11111110 + count = src[1] | (src[2] << 8); + src += 4; + } else if (src[0] >= 0xc0) { // 0b11?????? + count = (src[0] & 0x3f) + 3; + src += 3; + } else if (src[0] & 0x80) { // 0b10?????? + count = src[0] & 0x3f; + src += count + 1; + } else { // 0b0??????? + count = ((src[0] & 0x70) >> 4) + 3; + src += 2; + } + + outsize += count; + } + + return outsize; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/decompress_lcw.h b/engines/bladerunner/decompress_lcw.h new file mode 100644 index 0000000000..dbb0e04939 --- /dev/null +++ b/engines/bladerunner/decompress_lcw.h @@ -0,0 +1,35 @@ +/* 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_DECOMPRESS_LCW_H +#define BLADERUNNER_DECOMPRESS_LCW_H + +#include "common/types.h" + +namespace BladeRunner { + +uint32 decompress_lcw(uint8 *inBuf, uint32 inLen, uint8 *outBuf, uint32 outLen); +uint32 decompress_lcw_output_size(void *inBuf, uint32 inLen); + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/decompress_lzo.cpp b/engines/bladerunner/decompress_lzo.cpp new file mode 100644 index 0000000000..c2c9712e8b --- /dev/null +++ b/engines/bladerunner/decompress_lzo.cpp @@ -0,0 +1,134 @@ +/* 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/decompress_lzo.h" + +namespace BladeRunner { + +static inline uint32 decode_count(const uint8 **pp) { + uint32 v = 0; + for (; !**pp; (*pp)++) + v += 255; + + v += **pp; + (*pp)++; + + return v; +} + +static inline void copy(uint8 **dst, const uint8 **src, int count) { + assert(count > 0); + + uint8 *d = *dst; + const uint8 *s = *src; + + *dst += count; + *src += count; + + do { *d++ = *s++; } while (--count); +} + +int decompress_lzo1x(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen) { + uint32 t; + uint8 *op; + const uint8 *ip, *m_pos; + const uint8 * const ip_end = in + inLen; + + *outLen = 0; + + op = out; + ip = in; + + if (*ip > 17) { + t = *ip++ - 17; + if (t < 4) + goto match_next; + copy(&op, &ip, t); + goto first_literal_run; + } + + for (;;) { + t = *ip++; + if (t >= 16) + goto match; + + if (t == 0) + t = 15 + decode_count(&ip); + copy(&op, &ip, t + 3); + +first_literal_run: + t = *ip++; + if (t >= 16) + goto match; + m_pos = op - 0x0801 - (t >> 2) - (*ip++ << 2); + copy(&op, &m_pos, 3); + goto match_done; + + for (;;) { +match: + if (t >= 64) { + m_pos = op - 1 - ((t >> 2) & 7) - (*ip++ << 3); + t = (t >> 5) - 1; + goto copy_match; + } else if (t >= 32) { + t &= 31; + if (t == 0) + t = 31 + decode_count(&ip); + m_pos = op - 1 - (ip[0] >> 2) - (ip[1] << 6); + ip += 2; + } else if (t >= 16) { + m_pos = op - ((t & 8) << 11); + t &= 7; + if (t == 0) + t = 7 + decode_count(&ip); + m_pos -= (ip[0] >> 2) + (ip[1] << 6); + ip += 2; + if (m_pos == op) + goto eof_found; + m_pos -= 0x4000; + } else { + m_pos = op - 1 - (t >> 2) - (*ip++ << 2); + copy(&op, &m_pos, 2); + goto match_done; + } + +copy_match: + copy(&op, &m_pos, t + 2); + +match_done: + t = ip[-2] & 3; + if (t == 0) + break; + +match_next: + assert(t > 0 && t <= 3); + copy(&op, &ip, t); + t = *ip++; + } + } + +eof_found: + *outLen = op - out; + return ip != ip_end; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/decompress_lzo.h b/engines/bladerunner/decompress_lzo.h new file mode 100644 index 0000000000..e6404c654c --- /dev/null +++ b/engines/bladerunner/decompress_lzo.h @@ -0,0 +1,34 @@ +/* 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_DECOMPRESS_LZO_H +#define BLADERUNNER_DECOMPRESS_LZO_H + +#include "common/types.h" + +namespace BladeRunner { + +int decompress_lzo1x(const uint8 *in, size_t inLen, uint8 *out, size_t *outLen); + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp new file mode 100644 index 0000000000..1e40f3d363 --- /dev/null +++ b/engines/bladerunner/detection.cpp @@ -0,0 +1,66 @@ +/* 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 "base/plugins.h" + +#include "engines/advancedDetector.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/detection_tables.h" + +namespace BladeRunner { + +static const PlainGameDescriptor bladeRunnerGames[] = { + {"bladerunner", "Blade Runner"}, + {0, 0} +}; + +} // End of namespace BladeRunner + +class BladeRunnerMetaEngine : public AdvancedMetaEngine { +public: + BladeRunnerMetaEngine() : AdvancedMetaEngine(BladeRunner::gameDescriptions, sizeof(BladeRunner::gameDescriptions[0]), BladeRunner::bladeRunnerGames) { + } + + virtual const char *getName() const { + return "Blade Runner Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "Blade Runner (C) Westwood Studios."; + } + + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; +}; + +bool BladeRunnerMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const +{ + *engine = new BladeRunner::BladeRunnerEngine(syst); + + return true; +} + +#if PLUGIN_ENABLED_DYNAMIC(BLADERUNNER) + REGISTER_PLUGIN_DYNAMIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine); +#else + REGISTER_PLUGIN_STATIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine); +#endif diff --git a/engines/bladerunner/detection_tables.h b/engines/bladerunner/detection_tables.h new file mode 100644 index 0000000000..940c854ce6 --- /dev/null +++ b/engines/bladerunner/detection_tables.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_DETECTION_TABLES_H +#define BLADERUNNER_DETECTION_TABLES_H + +namespace BladeRunner { + +static const ADGameDescription gameDescriptions[] = { + // BladeRunner + { + "bladerunner", + 0, + { + {"STARTUP.MIX", 0, "5643b53306ca7764cf1ec7b79c9630a3", 2312374}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO0() + }, + AD_TABLE_END_MARKER +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/fog.cpp b/engines/bladerunner/fog.cpp new file mode 100644 index 0000000000..73e802667f --- /dev/null +++ b/engines/bladerunner/fog.cpp @@ -0,0 +1,374 @@ +/* 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/fog.h" + +#include "common/stream.h" + +namespace BladeRunner { + +Fog::Fog() { +} + +Fog::~Fog() { +} + +int Fog::readCommon(Common::ReadStream *stream) { + int offset = stream->readUint32LE(); + stream->read(_name, 20); + _fogColor.r = stream->readFloatLE(); + _fogColor.g = stream->readFloatLE(); + _fogColor.b = stream->readFloatLE(); + _fogDensity = stream->readFloatLE(); + return offset; +} + +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++) { + _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); + + setupFrame(0); +} + +void Fog::reset() { +} + +void Fog::setupFrame(int frame) { + int offset = frame % _framesCount; + _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); + _matrix._m[0][3] = (_animatedParameters & 0x8 ? _m14ptr[offset] : *_m14ptr); + _matrix._m[1][0] = (_animatedParameters & 0x10 ? _m21ptr[offset] : *_m21ptr); + _matrix._m[1][1] = (_animatedParameters & 0x20 ? _m22ptr[offset] : *_m22ptr); + _matrix._m[1][2] = (_animatedParameters & 0x40 ? _m23ptr[offset] : *_m23ptr); + _matrix._m[1][3] = (_animatedParameters & 0x80 ? _m24ptr[offset] : *_m24ptr); + _matrix._m[2][0] = (_animatedParameters & 0x100 ? _m31ptr[offset] : *_m31ptr); + _matrix._m[2][1] = (_animatedParameters & 0x200 ? _m32ptr[offset] : *_m32ptr); + _matrix._m[2][2] = (_animatedParameters & 0x400 ? _m33ptr[offset] : *_m33ptr); + _matrix._m[2][3] = (_animatedParameters & 0x800 ? _m34ptr[offset] : *_m34ptr); + _inverted = invertMatrix(_matrix); +} + +void FogCone::read(Common::ReadStream *stream, int framesCount) { + _framesCount = framesCount; + int size = readCommon(stream); + _parameter1 = stream->readFloatLE(); + readAnimationData(stream, size - 52); +} + +void FogCone::calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) { + *coeficient = 0.0f; + + Vector3 positionT = this->_matrix * position; + Vector3 viewPositionT = this->_matrix * viewPosition; + + Vector3 vectorT = (viewPositionT - positionT).normalize(); + + float v67 = - positionT.x * vectorT.x - positionT.y * vectorT.y - positionT.z * vectorT.z; + float v66 = - (positionT.z * positionT.z) - (positionT.y * positionT.y) - (positionT.x * positionT.x) + (v67 * v67) + (this->_parameter1 * this->_parameter1); + + if (v66 >= 0.0f) { + float v24 = sqrt(v66); + + Vector3 v29 = positionT + (v67 - v24) * vectorT; + Vector3 v36 = positionT + (v67 + v24) * vectorT; + + Vector3 v39 = this->_inverted * v29; + Vector3 v42 = this->_inverted * v36; + + float v74 = (v39 - position).length(); + float v76 = (v42 - position).length(); + + Vector3 vector = viewPosition - position; + + float vectorLength = vector.length(); + + if (v74 < 0.0f) { + v74 = 0.0f; + } + if (v76 > vectorLength) { + v76 = vectorLength; + } + if (v76 >= v74) { + *coeficient = v76 - v74; + } + } +} + +void FogSphere::read(Common::ReadStream *stream, int framesCount) { + _framesCount = framesCount; + int size = readCommon(stream); + _parameter1 = stream->readFloatLE(); + readAnimationData(stream, size - 52); +} + +void FogSphere::calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) { + *coeficient = 0.0f; + + Vector3 positionT = this->_matrix * position; + Vector3 viewPositionT = this->_matrix * viewPosition; + + Vector3 v158 = Vector3::cross(positionT, viewPositionT); + + if (v158.x != 0.0f || v158.y != 0.0f || v158.z != 0.0f) { + Vector3 v167 = v158.normalize(); + if (v167.z < 0.0f) { + v167 = -1.0f * v167; + } + + float v173 = sqrt(1.0f - v167.z * v167.z); + if (v173 > cos(this->_parameter1)) { + Vector3 v37 = Vector3(v167.y, -v167.x, 0.0f).normalize(); + + float v41 = 1.0f / v173 / v173 - 1.0f; + float v42 = sqrt(v41); + float v43 = tan(this->_parameter1); + float v44 = sqrt(v43 * v43 - v41); + + Vector3 v45 = v44 * v37; + + Vector3 v48 = Vector3( + -v37.y * v42, + v37.x * v42, + 0.0f * v42); + + Vector3 v51 = v48 + Vector3(0.0f, 0.0f, -1.0f); + + Vector3 v186 = v51 - v45; + Vector3 v183 = v51 + v45; + + Vector3 vector = viewPositionT - positionT; + + Vector3 v177 = -1.0f * positionT; + Vector3 v174 = Vector3::cross(v186, vector); + + float v189, v191; + if (fabs(v174.x) <= fabs(v174.y)) { + if (fabs(v174.y) <= fabs(v174.z)) { + v191 = v177.x * v186.y - v177.y * v186.x; + v189 = v186.y * vector.x - v186.x * vector.y; + } else { + v191 = v177.z * v186.x - v186.z * v177.x; + v189 = v186.x * vector.z - v186.z * vector.x; + } + } else { + if (fabs(v174.x) <= fabs(v174.z)) { + v191 = v177.x * v186.y - v177.y * v186.x; + v189 = v186.y * vector.x - v186.x * vector.y; + } else { + v191 = v186.z * v177.y - v186.y * v177.z; + v189 = v186.z * vector.y - v186.y * vector.z; + } + } + + float v88; + if (v189 == 0.0f) { + v88 = 0.0f; + } else { + v88 = v191 / v189; + } + + Vector3 v196 = -1.0f * positionT; + Vector3 v193 = Vector3::cross(v183, vector); + + float v190, v192; + if (fabs(v193.x) <= fabs(v193.y)) { + if (fabs(v193.y) <= fabs(v193.z)) { + v192 = v196.x * v183.y - v196.y * v183.x; + v190 = v183.y * vector.x - v183.x * vector.y; + } else { + v192 = v196.z * v183.x - v183.z * v196.x; + v190 = v183.x * vector.z - v183.z * vector.x; + } + } else { + if (fabs(v193.x) <= fabs(v193.z)) { + v192 = v196.x * v183.y - v196.y * v183.x; + v190 = v183.y * vector.x - v183.x * vector.y; + } else { + v192 = v183.z * v196.y - v183.y * v196.z; + v190 = v183.z * vector.y - v183.y * vector.z; + } + } + + float v114; + if (v190 == 0.0f) { + v114 = 0.0f; + } else { + v114 = v192 / v190; + } + + if (v114 < v88) { + float temp = v88; + v88 = v114; + v114 = temp; + } + + if (v88 <= 1.0f && v114 >= 0.0f) { + if (v88 < 0.0f) { + v88 = 0.0; + } + if (v114 > 1.0f) { + v114 = 1.0; + } + + Vector3 v139 = positionT + (v88 * vector); + Vector3 v142 = this->_inverted * v139; + + Vector3 v148 = positionT + (v114 * vector); + Vector3 v151 = this->_inverted * v148; + + *coeficient = (v151 - v142).length(); + } + } + } +} + +void FogBox::read(Common::ReadStream *stream, int framesCount) { + _framesCount = framesCount; + int size = readCommon(stream); + _parameter1 = stream->readFloatLE(); + _parameter2 = stream->readFloatLE(); + _parameter3 = stream->readFloatLE(); + readAnimationData(stream, size - 60); +} + +void FogBox::calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) { + Vector3 v159 = this->_matrix * position; + Vector3 v146 = v159; + Vector3 v156 = this->_matrix * viewPosition; + Vector3 v153 = v156; + Vector3 v150 = v156 - v159; + + float v149 = this->_parameter1 * 0.5f; + if (v159.x < -v149) { + if (v156.x < -v149) { + return; + } + float v28 = (-v159.x - v149) / v150.x; + Vector3 v29 = v28 * v150; + v146 = v159 + v29; + } else { + if (v156.x < -v149) { + float v19 = (-v156.x - v149) / v150.x; + Vector3 v20 = v19 * v150; + v153 = v156 + v20; + } + } + if (v149 < v146.x) { + if (v149 < v153.x) { + return; + } + float v48 = (v149 - v146.x) / v150.x; + Vector3 v49 = v48 * v150; + v146 = v146 + v49; + } else { + if (v149 < v153.x) { + float v40 = (v149 - v153.x) / v150.x; + Vector3 v41 = v40 * v150; + v153 = v153 + v41; + } + } + float v162 = this->_parameter2 * 0.5f; + if (v146.y < -v162) { + if (v153.y < -v162) { + return; + } + float v71 = (-v146.y - v162) / v150.y; + Vector3 v72 = v71 * v150; + v146 = v146 + v72; + } else { + if (v153.y < -v162) { + float v62 = (-v153.y - v162) / v150.y; + Vector3 v63 = v62 * v150; + v153 = v153 + v63; + } + } + if (v162 < v146.y) { + if (v162 < v153.y) { + return; + } + float v91 = (v162 - v146.y) / v150.y; + Vector3 v92 = v91 * v150; + v146 = v146 + v92; + } else { + if (v162 < v153.y) { + float v83 = (v162 - v153.y) / v150.y; + Vector3 v84 = v83 * v150; + v153 = v153 + v84; + } + } + + if (0.0f <= v146.z) { + if (0.0f > v153.z) { + float v103 = -v153.z / v150.z; + Vector3 v104 = v103 * v150; + v153 = v153 + v104; + } + } else { + if (0.0f > v153.z) { + return; + } + float v111 = -v146.z / v150.z; + Vector3 v112 = v111 * v150; + v146 = v146 + v112; + } + + if (v146.z <= this->_parameter3) { + if (v153.z > this->_parameter3) { + float v124 = (this->_parameter3 - v153.z) / v150.z; + Vector3 v125 = v124 * v150; + v153 = v153 + v125; + } + } else { + if (v153.z <= this->_parameter3) { + float v132 = (this->_parameter3 - v146.z) / v150.z; + Vector3 v133 = v132 * v150; + v146 = v146 + v133; + } + } + + Vector3 v137 = this->_inverted * v146; + Vector3 v140 = this->_inverted * v153; + Vector3 v143 = v140 - v137; + + *coeficient = v143.length(); +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/fog.h b/engines/bladerunner/fog.h new file mode 100644 index 0000000000..445308d540 --- /dev/null +++ b/engines/bladerunner/fog.h @@ -0,0 +1,101 @@ +/* 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_FOG_H +#define BLADERUNNER_FOG_H + +#include "bladerunner/color.h" +#include "bladerunner/matrix.h" + +namespace Common { + class ReadStream; +} + +namespace BladeRunner { + +class SetEffects; + +class Fog { + friend class SetEffects; + +protected: + char _name[20]; + int _framesCount; + int _animatedParameters; + Matrix4x3 _matrix; + Matrix4x3 _inverted; + Color _fogColor; + float _fogDensity; + 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 _parameter1; + float _parameter2; + float _parameter3; + + Fog *_next; + +public: + Fog(); + virtual ~Fog(); + + virtual void read(Common::ReadStream *stream, int framesCount) = 0; + virtual void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient) = 0; + void reset(); + + void setupFrame(int frame); + +protected: + int readCommon(Common::ReadStream *stream); + void readAnimationData(Common::ReadStream *stream, int count); + +}; + +class FogCone : public Fog { + void read(Common::ReadStream *stream, int framesCount); + void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); +}; + +class FogSphere : public Fog { + void read(Common::ReadStream *stream, int framesCount); + void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); +}; + +class FogBox : public Fog { + void read(Common::ReadStream *stream, int framesCount); + void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp new file mode 100644 index 0000000000..fd8b9f204d --- /dev/null +++ b/engines/bladerunner/font.cpp @@ -0,0 +1,202 @@ +/* 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/font.h" + +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" + +namespace BladeRunner { + +Font::Font(BladeRunnerEngine *vm) : _vm(vm) { + reset(); +} + +Font::~Font() { + close(); +} + +bool Font::open(const Common::String &fileName, int screenWidth, int screenHeight, int spacing1, int spacing2, uint16 color) { + reset(); + + _screenWidth = screenWidth; + _screenHeight = screenHeight; + _spacing1 = spacing1; + _spacing2 = spacing2; + _color = color; + + Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->getResourceStream(fileName)); + if (!stream) { + debug("Font::open failed to open '%s'", fileName.c_str()); + return false; + } + + _characterCount = stream->readUint32LE(); + _maxWidth = stream->readUint32LE(); + _maxHeight = stream->readUint32LE(); + _dataSize = stream->readUint32LE(); + _data = new uint16[_dataSize]; + if (!_data) { + debug("Font::open failed to allocate font buffer"); + return false; + } + + 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(); + } + for (int i = 0; i < _dataSize; i++) { + _data[i] = stream->readUint16LE(); + } + return true; +} + +void Font::close() { + if (_data != nullptr) { + delete[] _data; + } + reset(); +} + +void Font::setSpacing(int spacing1, int spacing2) { + if (_data) { + _spacing1 = spacing1; + _spacing2 = spacing2; + } +} + +void Font::setColor(uint16 color) { + if (_data && _color != color) { + replaceColor(_color, color); + _color = color; + } +} + +void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, int y) { + if (!_data) { + return; + } + + x = CLIP(x, 0, _screenWidth - getTextWidth(text) + 1); + y = CLIP(y, 0, _screenHeight - _maxHeight); + + const char *character = text.c_str(); + while (*character != 0) { + drawCharacter(*character, surface, x, y); + x += _spacing1 + _characters[*character + 1]._width; + character++; + } + +} + +void Font::drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color) { + if (_color != color) { + setColor(color); + } + draw(text, surface, x, y); +} + +int Font::getTextWidth(const Common::String &text) { + const char *character = text.c_str(); + + if (!_data) { + return 0; + } + int totalWidth = 0; + if (*character == 0) { + return 0; + } + while (*character != 0) { + totalWidth = _spacing1 + _characters[*character + 1]._width; + character++; + } + return totalWidth - _spacing1; +} + +void Font::reset() { + _maxWidth = 0; + _maxHeight = 0; + _characterCount = 0; + _data = nullptr; + _dataSize = 0; + _screenWidth = 0; + _screenHeight = 0; + _spacing1 = 0; + _spacing2 = 0; + _color = 0x7FFF; + _intersperse = 0; + + memset(_characters, 0, 256 * sizeof(FontCharacter)); +} + +void Font::replaceColor(uint16 oldColor, uint16 newColor) { + if (!_data || !_dataSize) { + return; + } + for (int i = 0; i < _dataSize; i++) { + if (_data[i] == oldColor) { + _data[i] = newColor; + } + } +} + +void Font::drawCharacter(const char character, Graphics::Surface &surface, int x, int y) { + 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; + if (_intersperse && y & 1) { + dstPtr += surface.pitch / 2; + } + + int endY = height + y - 1; + int currentY = y; + while (currentY <= endY && currentY < _screenHeight) { + int currentX = x; + int endX = width + x - 1; + while (currentX <= endX && currentX < _screenWidth) { + if ((*srcPtr & 0x8000) == 0) { + *dstPtr = *srcPtr; + } + dstPtr++; + srcPtr++; + currentX++; + } + dstPtr += surface.pitch / 2 - width; + if (_intersperse) { + srcPtr += width; + dstPtr += surface.pitch / 2; + currentY++; + } + currentY++; + } +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/font.h b/engines/bladerunner/font.h new file mode 100644 index 0000000000..de790b0244 --- /dev/null +++ b/engines/bladerunner/font.h @@ -0,0 +1,84 @@ +/* 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_FONT_H +#define BLADERUNNER_FONT_H + +#include "common/str.h" + +namespace Graphics { +struct Surface; +} + +namespace BladeRunner { + +class BladeRunnerEngine; + +struct FontCharacter { + int _x; + int _y; + int _width; + int _height; + int _dataOffset; +}; + +class Font { + BladeRunnerEngine *_vm; + + int _characterCount; + int _maxWidth; + int _maxHeight; + FontCharacter _characters[256]; + int _dataSize; + uint16 *_data; + int _screenWidth; + int _screenHeight; + int _spacing1; + int _spacing2; + uint16 _color; + int _intersperse; + +public: + Font(BladeRunnerEngine *vm); + ~Font(); + + bool open(const Common::String &fileName, int screenWidth, int screenHeight, int spacing1, int spacing2, uint16 color); + void close(); + + void setSpacing(int spacing1, int spacing2); + void setColor(uint16 color); + + void draw(const Common::String &text, Graphics::Surface &surface, int x, int y); + void drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color); + + int getTextWidth(const Common::String &text); + +private: + void reset(); + void replaceColor(uint16 oldColor, uint16 newColor); + + void drawCharacter(const char character, Graphics::Surface &surface, int x, int y); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/gameflags.cpp b/engines/bladerunner/gameflags.cpp new file mode 100644 index 0000000000..db4271d9d5 --- /dev/null +++ b/engines/bladerunner/gameflags.cpp @@ -0,0 +1,68 @@ +/* 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(NULL), 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 new file mode 100644 index 0000000000..ea858191d1 --- /dev/null +++ b/engines/bladerunner/gameflags.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_GAMEFLAGS_H +#define BLADERUNNER_GAMEFLAGS_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); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/gameinfo.cpp b/engines/bladerunner/gameinfo.cpp new file mode 100644 index 0000000000..487c39d046 --- /dev/null +++ b/engines/bladerunner/gameinfo.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/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 new file mode 100644 index 0000000000..6f9aab5c20 --- /dev/null +++ b/engines/bladerunner/gameinfo.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_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 new file mode 100644 index 0000000000..1a23823b31 --- /dev/null +++ b/engines/bladerunner/image.cpp @@ -0,0 +1,83 @@ +/* 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/image.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/decompress_lcw.h" + +#include "common/rect.h" + +namespace BladeRunner { + +Image::Image(BladeRunnerEngine *vm) + : _vm(vm) { +} + +Image::~Image() { + _surface.free(); +} + +bool Image::open(const Common::String &name) { + Common::SeekableReadStream *stream = _vm->getResourceStream(name); + if (!stream) { + debug("Image::open failed to open '%s'\n", name.c_str()); + return false; + } + + char tag[4] = { 0 }; + stream->read(tag, 3); + uint32 width = stream->readUint32LE(); + uint32 height = stream->readUint32LE(); + + // Enforce a reasonable limit + assert(width < 8000 && height < 8000); + + uint32 bufSize = stream->size(); + uint8 *buf = new uint8[bufSize]; + stream->read(buf, bufSize); + + uint32 dataSize = 2 * width * height; + void *data = malloc(dataSize); + assert(data); + + if (strcmp(tag, "LZO") == 0) { + debug("LZO"); + } else if (strcmp(tag, "LCW") == 0) { + decompress_lcw(buf, bufSize, (uint8*)data, dataSize); + } + + const Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + _surface.init(width, height, 2*width, data, pixelFormat); + + delete[] buf; + delete stream; + + return true; +} + +void Image::copyToSurface(Graphics::Surface *dst) const { + dst->copyRectToSurface(_surface, 0, 0, Common::Rect(_surface.w, _surface.h)); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/image.h b/engines/bladerunner/image.h new file mode 100644 index 0000000000..4e44ae9a80 --- /dev/null +++ b/engines/bladerunner/image.h @@ -0,0 +1,50 @@ +/* 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_IMAGE_H +#define BLADERUNNER_IMAGE_H + +#include "graphics/surface.h" + +namespace Common { + class String; +} + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Image { + BladeRunnerEngine *_vm; + Graphics::Surface _surface; + +public: + Image(BladeRunnerEngine *vm); + ~Image(); + + bool open(const Common::String &name); + void copyToSurface(Graphics::Surface *surface) const; +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/item.cpp b/engines/bladerunner/item.cpp new file mode 100644 index 0000000000..6200668e14 --- /dev/null +++ b/engines/bladerunner/item.cpp @@ -0,0 +1,143 @@ +/* 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/item.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/slice_renderer.h" + +namespace BladeRunner { + +Item::Item(BladeRunnerEngine *vm) { + _vm = vm; + + _itemId = -1; + _setId = -1; + + _animationId = -1; + _position.x = 0; + _position.y = 0; + _position.z = 0; + _facing = 0; + _angle = 0.0f; + _width = 0; + _height = 0; + _boundingBox.setXYZ(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + _screenX = 0; + _screenY = 0; + _depth = 0.0f; + _isTargetable = false; + _isSpinning = false; + _facingChange = 0; + _isVisible = true; + _isPoliceMazeEnemy = true; + _screenRectangle.bottom = -1; + _screenRectangle.right = -1; + _screenRectangle.top = -1; + _screenRectangle.left = -1; +} + +Item::~Item() { +} + +void Item::getXYZ(float *x, float *y, float *z) { + *x = _position.x; + *y = _position.y; + *z = _position.z; +} + +void Item::getWidthHeight(int *width, int *height) { + *width = _width; + *height = _height; +} + +bool Item::isTargetable() { + return _isTargetable; +} + +void Item::tick(bool special) { + if (_isVisible) { + Vector3 postition(_position.x, -_position.z, _position.y); + int animationId = _animationId + (special ? 1 : 0); + _vm->_sliceRenderer->drawInWorld(animationId, 0, postition, M_PI - _angle, 1.0f, _vm->_surface2, _vm->_zBuffer2); + _vm->_sliceRenderer->getScreenRectangle(&_screenRectangle, animationId, 0, postition, M_PI - _angle, 1.0f); + + if (_isSpinning) { + _facing += _facingChange; + + if (_facing >= 1024) { + _facing -= 1024; + } else if (_facing < 0) { + _facing += 1024; + } + _angle = _facing * (M_PI / 512.0f); + + if (_facingChange > 0) { + _facingChange = _facingChange - 20; + if (_facingChange < 0) { + _facingChange = 0; + _isSpinning = false; + } + } else if (_facingChange < 0) { + _facingChange = _facingChange + 20; + if (_facingChange > 0) { + _facingChange = 0; + _isSpinning = false; + } + } else { + _isSpinning = false; + } + } + } +} + +void Item::setXYZ(Vector3 position) { + _position = position; + int halfWidth = _width / 2; + _boundingBox.setXYZ(_position.x - halfWidth, _position.y, _position.z - halfWidth, + _position.x + halfWidth, _position.y + _height, _position.z + halfWidth); + Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position); + _screenX = screenPosition.x; + _screenY = screenPosition.y; + _depth = screenPosition.z * 25.5f; +} + +void Item::setup(int itemId, int setId, int animationId, Vector3 position, int facing, int height, int width, bool isTargetable, bool isVisible, bool isPoliceMazeEnemy) { + _itemId = itemId; + _setId = setId; + _animationId = animationId; + _facing = facing; + _angle = facing * (M_PI / 512.0f); + _width = width; + _height = height; + _isTargetable = isTargetable; + _isVisible = isVisible; + _isPoliceMazeEnemy = isPoliceMazeEnemy; + setXYZ(position); + _screenRectangle.bottom = -1; + _screenRectangle.right = -1; + _screenRectangle.top = -1; + _screenRectangle.left = -1; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/item.h b/engines/bladerunner/item.h new file mode 100644 index 0000000000..3f12a6ad3a --- /dev/null +++ b/engines/bladerunner/item.h @@ -0,0 +1,78 @@ +/* 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_ITEM_H +#define BLADERUNNER_ITEM_H + +#include "bladerunner/boundingbox.h" +#include "bladerunner/vector.h" + +#include "common/rect.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class Items; + +class Item { + BladeRunnerEngine *_vm; + + friend class Items; + +private: + int _itemId; + int _setId; + + BoundingBox _boundingBox; + Common::Rect _screenRectangle; + int _animationId; + Vector3 _position; + int _facing; + float _angle; + int _width; + int _height; + int _screenX; + int _screenY; + float _depth; + bool _isTargetable; + bool _isSpinning; + int _facingChange; + bool _isVisible; + bool _isPoliceMazeEnemy; + +public: + Item(BladeRunnerEngine *vm); + ~Item(); + + void getXYZ(float *x, float *y, float *z); + void setXYZ(Vector3 position); + void getWidthHeight(int *width, int *height); + + bool isTargetable(); + void tick(bool special); + + void setup(int itemId, int setId, int animationId, Vector3 position, int facing, int height, int width, bool isTargetable, bool isVisible, bool isPoliceMazeEnemy); +}; + +} + +#endif diff --git a/engines/bladerunner/item_pickup.cpp b/engines/bladerunner/item_pickup.cpp new file mode 100644 index 0000000000..aa293c2b9b --- /dev/null +++ b/engines/bladerunner/item_pickup.cpp @@ -0,0 +1,108 @@ +/* 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/item_pickup.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/audio_player.h" +#include "bladerunner/gameinfo.h" +#include "slice_animations.h" +#include "slice_renderer.h" + +namespace BladeRunner { + +ItemPickup::ItemPickup(BladeRunnerEngine *vm) { + _vm = vm; + _facingStep = float(2.0f / 3000.0f * (2.0f * M_PI)); + reset(); +} + +ItemPickup::~ItemPickup() { +} + +void ItemPickup::setup(int animationId, int screenX, int screenY) { + _animationId = animationId; + _animationFrame = 0; + _facing = 0.0; + _timeLeft = 3000; + _scale = 0; + _screenX = CLIP(screenX, 40, 600); + _screenY = CLIP(screenY, 40, 440); + _screenRect.left = _screenX - 40; + _screenRect.right = _screenX + 40; + _screenRect.top = _screenY - 40; + _screenRect.bottom = _screenY + 40; + + int pan = (150 * _screenX - 48000) / 640; + _vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(335), 80, pan, pan, 50, 0); + + _timeLast = _vm->getTotalPlayTime(); +} + +void ItemPickup::reset() { + _animationId = -1; + _screenX = 0; + _screenY = 0; + _facing = 0.0f; + _scale = 1.0f; + _animationFrame = 0; + _timeLeft = 0; + _timeLast = 0; +} + +void ItemPickup::tick() { + if (_timeLeft == 0) { + return; + } + + int timeNow = _vm->getTotalPlayTime(); + int timeDiff = timeNow - _timeLast; + _timeLast = timeNow; + timeDiff = MIN(MIN(timeDiff, 67), _timeLeft); + _timeLeft -= timeDiff; + + if (_timeLeft >= 2000) { + _scale = 1.0f - (((2000.0f - _timeLeft) / 1000.0f) * ((2000.0f - _timeLeft) / 1000.0f)); + } else if (_timeLeft < 1000) { + _scale = 1.0f - (((1000.0f - _timeLeft) / 1000.0f) * ((1000.0f - _timeLeft) / 1000.0f)); + } else { + _scale = 1.0f; + } + _scale *= 75.0f; + + _facing += _facingStep * timeDiff; + if (_facing > float(2.0f * M_PI)) { + _facing -= float(2.0f * M_PI); + } + + _animationFrame = (_animationFrame + 1) % _vm->_sliceAnimations->getFrameCount(_animationId); +} + +void ItemPickup::draw() { + if (_timeLeft == 0) { + return; + } + + _vm->_sliceRenderer->drawOnScreen(_animationId, _animationFrame, _screenX, _screenY, _facing, _scale, _vm->_surface2, _vm->_zBuffer2); +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/item_pickup.h b/engines/bladerunner/item_pickup.h new file mode 100644 index 0000000000..97d98ead36 --- /dev/null +++ b/engines/bladerunner/item_pickup.h @@ -0,0 +1,60 @@ +/* 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_ITEMPICKUP_H +#define BLADERUNNER_ITEMPICKUP_H + +#include "common/rect.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ItemPickup { + BladeRunnerEngine *_vm; + + float _facingStep; + + int _animationId; + int _screenX; + int _screenY; + float _facing; + float _scale; + int _animationFrame; + int _timeLeft; + int _timeLast; + Common::Rect _screenRect; + +public: + ItemPickup(BladeRunnerEngine *vm); + ~ItemPickup(); + + void setup(int animationId, int screenX, int screenY); + void reset(); + + void tick(); + void draw(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/items.cpp b/engines/bladerunner/items.cpp new file mode 100644 index 0000000000..2bc06e0a72 --- /dev/null +++ b/engines/bladerunner/items.cpp @@ -0,0 +1,122 @@ +/* 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/items.h" + +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" + +namespace BladeRunner { + +Items::Items(BladeRunnerEngine *vm) { + _vm = vm; +} + +Items::~Items() { + for (int i = _items.size() - 1; i >= 0; i--) { + delete _items.remove_at(i); + } +} + +void Items::getXYZ(int itemId, float *x, float *y, float *z) { + int itemIndex = findItem(itemId); + assert(itemIndex != -1); + + _items[itemIndex]->getXYZ(x, y, z); +} + +void Items::getWidthHeight(int itemId, int *width, int *height) { + int itemIndex = findItem(itemId); + assert(itemIndex != -1); + + _items[itemIndex]->getWidthHeight(width, height); +} + +void Items::tick() { + int setId = _vm->_scene->getSetId(); + for (int i = 0; i < (int)_items.size(); i++) { + if (_items[i]->_setId != setId) { + continue; + } + bool set14NotTarget = setId == 14 && !_items[i]->isTargetable(); + _items[i]->tick(set14NotTarget); + } +} + +bool Items::addToWorld(int itemId, int animationId, int setId, Vector3 position, int facing, int height, int width, bool isTargetable, bool isVisible, bool isPoliceMazeEnemy, bool addToSet) { + if (_items.size() >= 100) { + return false; + } + int itemIndex = findItem(itemId); + if (itemIndex == -1) { + itemIndex = _items.size(); + } + + Item *item = new Item(_vm); + item->setup(itemId, setId, animationId, position, facing, height, width, isTargetable, isVisible, isPoliceMazeEnemy); + _items.push_back(item); + + if (addToSet && setId == _vm->_scene->getSetId()) { + return _vm->_sceneObjects->addItem(itemId + SCENE_OBJECTS_ITEMS_OFFSET, &item->_boundingBox, &item->_screenRectangle, isTargetable, isVisible); + } + return true; +} + +bool Items::addToSet(int setId) { + int itemsCount = _vm->_items->_items.size(); + if (itemsCount == 0) { + return true; + } + for (int i = 0; i < itemsCount; 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); + } + } + return true; +} + +bool Items::remove(int itemId) { + if (_items.size() == 0) { + return false; + } + int itemIndex = findItem(itemId); + if (itemIndex == -1) { + return false; + } + + if (_items[itemIndex]->_setId == _vm->_scene->getSetId()) { + _vm->_sceneObjects->remove(itemId + SCENE_OBJECTS_ITEMS_OFFSET); + } + _items.remove_at(itemIndex); + return true; +} + +int Items::findItem(int itemId) { + for (int i = 0; i < (int)_items.size(); i++) { + if (_items[i]->_itemId == itemId) + return i; + } + return -1; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/items.h b/engines/bladerunner/items.h new file mode 100644 index 0000000000..667117fba2 --- /dev/null +++ b/engines/bladerunner/items.h @@ -0,0 +1,56 @@ +/* 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_ITEMS_H +#define BLADERUNNER_ITEMS_H + +#include "bladerunner/bladerunner.h" +#include "bladerunner/item.h" + +#include "common/array.h" + +namespace BladeRunner { + +class Items { + BladeRunnerEngine *_vm; + + Common::Array<Item*> _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 tick(); + bool addToWorld(int itemId, int animationId, int setId, Vector3 position, int facing, int height, int width, bool isTargetable, bool isVisible, bool isPoliceMazeEnemy, bool b); + bool addToSet(int itemId); + bool remove(int itemId); + +private: + int findItem(int itemId); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/light.cpp b/engines/bladerunner/light.cpp new file mode 100644 index 0000000000..08eb8ab5be --- /dev/null +++ b/engines/bladerunner/light.cpp @@ -0,0 +1,316 @@ +/* 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/light.h" +#include "common/util.h" +#include "common/debug.h" + +namespace BladeRunner { + +Light::Light() { +} + +Light::~Light() { +} + +void Light::read(Common::ReadStream *stream, int framesCount, int frame, int animated) { + _framesCount = framesCount; + _animated = animated; + + int size = stream->readUint32LE(); + size = size - 32; + + stream->read(_name, 20); + + _animatedParameters = stream->readUint32LE(); + + int floatsCount = size / 4; + _animationData = new float[floatsCount]; + for (int i = 0; i < floatsCount; 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); + + setupFrame(frame); +} + +void Light::readVqa(Common::ReadStream *stream, int framesCount, int frame, int animated) { + _framesCount = framesCount; + _animated = animated; + + _animatedParameters = stream->readUint32LE(); + + int size = stream->readUint32LE(); + + int floatsCount = size / 4; + _animationData = new float[floatsCount]; + for (int i = 0; i < floatsCount; 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); + + setupFrame(frame); +} + +void Light::setupFrame(int frame) { + int offset = frame % _framesCount; + _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); + _matrix._m[0][3] = (_animatedParameters & 0x8 ? _m14ptr[offset] : *_m14ptr); + _matrix._m[1][0] = (_animatedParameters & 0x10 ? _m21ptr[offset] : *_m21ptr); + _matrix._m[1][1] = (_animatedParameters & 0x20 ? _m22ptr[offset] : *_m22ptr); + _matrix._m[1][2] = (_animatedParameters & 0x40 ? _m23ptr[offset] : *_m23ptr); + _matrix._m[1][3] = (_animatedParameters & 0x80 ? _m24ptr[offset] : *_m24ptr); + _matrix._m[2][0] = (_animatedParameters & 0x100 ? _m31ptr[offset] : *_m31ptr); + _matrix._m[2][1] = (_animatedParameters & 0x200 ? _m32ptr[offset] : *_m32ptr); + _matrix._m[2][2] = (_animatedParameters & 0x400 ? _m33ptr[offset] : *_m33ptr); + _matrix._m[2][3] = (_animatedParameters & 0x800 ? _m34ptr[offset] : *_m34ptr); + _color.r = (_animatedParameters & 0x1000 ? _colorRPtr[offset] : *_colorRPtr); + _color.g = (_animatedParameters & 0x2000 ? _colorGPtr[offset] : *_colorGPtr); + _color.b = (_animatedParameters & 0x4000 ? _colorBPtr[offset] : *_colorBPtr); + _falloffStart = (_animatedParameters & 0x8000 ? _falloffStartPtr[offset] : *_falloffStartPtr); + _falloffEnd = (_animatedParameters & 0x10000 ? _falloffEndPtr[offset] : *_falloffEndPtr); + _angleStart = (_animatedParameters & 0x20000 ? _angleStartPtr[offset] : *_angleStartPtr); + _angleEnd = (_animatedParameters & 0x40000 ? _angleEndPtr[offset] : *_angleEndPtr); +} + +float Light::calculate(Vector3 start, Vector3 end) { + return calculateCoefficient(_matrix * start, _matrix * end, _falloffStart, _falloffEnd); +} + +void Light::calculateColor(Color *outColor, Vector3 position) { + Vector3 positionT = _matrix * position; + float att = attenuation(_falloffStart, _falloffEnd, positionT.length()); + outColor->r = _color.r * att; + outColor->g = _color.g * att; + outColor->b = _color.b * att; +} + +float Light::calculateCoefficient(Vector3 start, Vector3 end, float falloffStart, float falloffEnd) { + if (falloffEnd == 0.0f) { + return 1.0e30f; + } + + if (falloffStart >= start.length() && falloffStart >= end.length()) { + return 1.0e30f; + } + + float v40 = (end - start).length(); + float v31 = 0.0f; + if (v40 != 0.0f) { + Vector3 v27 = Vector3::cross(start, (end - start)); + v31 = v27.length() / v40; + } + + if (v31 < falloffEnd) { + return 1.0f / (1.0f - (v31 / falloffEnd)); + } + return 1.0e30f; +} + +float Light::attenuation(float min, float max, float distance) { + if (max == 0.0f) { + return 1.0f; + } + if (min < max) { + distance = CLIP(distance, min, max); + float x = (max - distance) / (max - min); + return x * x * (3.0f - 2.0f * x); + } + if (distance < min) { + return 1.0f; + } + return 0.0f; +} + +float Light1::calculate(Vector3 start, Vector3 end) { + start = _matrix * start; + end = _matrix * end; + + float v40 = 0.0f; + if (_falloffEnd != 0.0f) { + v40 = calculateCoefficient(start, end, _falloffStart, _falloffEnd); + } + + float v41 = atan2(start.length(), -start.z); + float v42 = atan2(end.length(), -end.z); + + float v43; + if ((_angleStart >= v41 && _angleStart >= v42) || (_angleEnd <= v41 && _angleEnd <= v42)) { + v43 = 1.0e30f; + } else { + v43 = 2.0; + } + if (v43 < v40) { + return v40; + } else { + return v43; + } +} + +void Light1::calculateColor(Color *outColor, Vector3 position) { + Vector3 positionT = _matrix * position; + + outColor->r = 0.0f; + outColor->g = 0.0f; + outColor->b = 0.0f; + + if (positionT.z < 0.0f) { + float v12 = attenuation(_angleStart, _angleEnd, atan2(sqrt(positionT.x * positionT.x + positionT.y * positionT.y), -positionT.z)); + float v13 = attenuation(_falloffStart, _falloffEnd, positionT.length()); + + outColor->r = v12 * v13 * _color.r; + outColor->g = v12 * v13 * _color.g; + outColor->b = v12 * v13 * _color.b; + } +} + +float Light2::calculate(Vector3 start, Vector3 end) { + start = _matrix * start; + end = _matrix * end; + + float v54 = 0.0f; + if (_falloffEnd != 0.0f) { + v54 = calculateCoefficient(start, end, _falloffStart, _falloffEnd); + } + + float v55 = atan2(fabs(start.x), -start.z); + float v58 = atan2(fabs(start.y), -start.z); + float v57 = atan2(fabs(end.x), -end.z); + float v56 = atan2(fabs(end.y), -end.z); + + float v59; + if ((_angleStart >= v55 && _angleStart >= v57 && _angleStart >= v58 && _angleStart >= v56) || (_angleEnd <= v55 && _angleEnd <= v57 && _angleEnd <= v58 && _angleEnd <= v56)) { + v59 = 1.0e30f; + } else { + v59 = 2.0f; + } + if (v59 < v54) { + return v54; + } else { + return v59; + } +} + +void Light2::calculateColor(Color *outColor, Vector3 position) { + Vector3 positionT = _matrix * position; + + outColor->r = 0.0f; + outColor->g = 0.0f; + outColor->b = 0.0f; + + if (positionT.z < 0.0f) { + float v11 = attenuation(_angleStart, _angleEnd, atan2(fabs(positionT.y), -positionT.z)); + float v12 = attenuation(_angleStart, _angleEnd, atan2(fabs(positionT.x), -positionT.z)); + float v13 = attenuation(_falloffStart, _falloffEnd, positionT.length()); + + outColor->r = v11 * v12 * v13 * _color.r; + outColor->g = v11 * v12 * v13 * _color.g; + outColor->b = v11 * v12 * v13 * _color.b; + } +} + +void Light3::calculateColor(Color *outColor, Vector3 position) { + Vector3 positionT = _matrix * position; + + outColor->r = 0.0f; + outColor->g = 0.0f; + outColor->b = 0.0f; + + if (positionT.z < 0.0f) { + float v12 = attenuation(_angleStart, _angleEnd, sqrt(positionT.x * positionT.x + positionT.y * positionT.y)); + float v13 = attenuation(_falloffStart, _falloffEnd, positionT.length()); + + outColor->r = v12 * v13 * _color.r; + outColor->g = v12 * v13 * _color.g; + outColor->b = v12 * v13 * _color.b; + } +} + +void Light4::calculateColor(Color *outColor, Vector3 position) { + Vector3 positionT = _matrix * position; + + outColor->r = 0.0f; + outColor->g = 0.0f; + outColor->b = 0.0f; + + if (positionT.z < 0.0f) { + float v11 = attenuation(_angleStart, _angleEnd, fabs(positionT.y)); + float v12 = attenuation(_angleStart, _angleEnd, fabs(positionT.x)); + float v13 = attenuation(_falloffStart, _falloffEnd, positionT.length()); + + outColor->r = v11 * v12 * v13 * _color.r; + outColor->g = v11 * v12 * v13 * _color.g; + outColor->b = v11 * v12 * v13 * _color.b; + } +} + +float LightAmbient::calculate(Vector3 start, Vector3 end) { + return 1.0e30f; +} + +void LightAmbient::calculateColor(Color *outColor, Vector3 position) { + outColor->r = _color.r; + outColor->g = _color.g; + outColor->b = _color.b; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/light.h b/engines/bladerunner/light.h new file mode 100644 index 0000000000..ce54171de2 --- /dev/null +++ b/engines/bladerunner/light.h @@ -0,0 +1,120 @@ +/* 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_LIGHT_H +#define BLADERUNNER_LIGHT_H + +#include "bladerunner/matrix.h" +#include "bladerunner/color.h" + +#include "common/stream.h" + +namespace Common{ + class ReadStream; +} + +namespace BladeRunner { + +class Lights; + +class Light { +#if _DEBUG + friend class BladeRunnerEngine; +#endif + friend class Lights; + friend class SliceRenderer; + +protected: + char _name[20]; + int _framesCount; + 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; + +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 setupFrame(int frame); + + virtual float calculate(Vector3 start, Vector3 end); + virtual void calculateColor(Color *outColor, Vector3 position); + +protected: + float calculateCoefficient(Vector3 start, Vector3 end, float a3, float a4); + float attenuation(float min, float max, float distance); +}; + +class Light1 : public Light { + float calculate(Vector3 start, Vector3 end); + void calculateColor(Color *outColor, Vector3 position); +}; + +class Light2 : public Light { + float calculate(Vector3 start, Vector3 end); + void calculateColor(Color *outColor, Vector3 position); +}; + +class Light3 : public Light { + void calculateColor(Color *outColor, Vector3 position); +}; + +class Light4 : public Light { + void calculateColor(Color *outColor, Vector3 position); +}; + +class LightAmbient : public Light { + float calculate(Vector3 start, Vector3 end); + void calculateColor(Color *outColor, Vector3 position); +}; + +} // End of namespace BladeRunner +#endif diff --git a/engines/bladerunner/lights.cpp b/engines/bladerunner/lights.cpp new file mode 100644 index 0000000000..811d72f31f --- /dev/null +++ b/engines/bladerunner/lights.cpp @@ -0,0 +1,135 @@ +/* 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/lights.h" + +namespace BladeRunner { + +Lights::Lights(BladeRunnerEngine *vm) { + _vm = vm; + + _ambientLightColor.r = 1.0; + _ambientLightColor.g = 0.0; + _ambientLightColor.b = 0.0; + + _lights.clear(); + _frame = 0; +} + +Lights::~Lights() { + reset(); +} + +void Lights::read(Common::ReadStream *stream, int framesCount) { + _ambientLightColor.r = stream->readFloatLE(); + _ambientLightColor.g = stream->readFloatLE(); + _ambientLightColor.b = stream->readFloatLE(); + + uint _lightsCount = stream->readUint32LE(); + for (uint i = 0; i < _lightsCount; i++) { + Light *light; + int type = stream->readUint32LE(); + switch (type) { + case 1: + light = new Light1(); + break; + case 2: + light = new Light2(); + break; + case 3: + light = new Light3(); + break; + case 4: + light = new Light4(); + break; + case 5: + light = new LightAmbient(); + break; + default: + light = new Light(); + } + + light->read(stream, framesCount, _frame, 0); + _lights.push_back(light); + } +} + +void Lights::removeAnimated() { + for (int i = (int)(_lights.size() - 1); i >= 0; i--) { + if (_lights[i]->_animated) { + delete _lights.remove_at(i); + } + } +} + +void Lights::readVqa(Common::ReadStream *stream) { + removeAnimated(); + if (stream->eos()) + return; + + int framesCount = stream->readUint32LE(); + int count = stream->readUint32LE(); + for (int i = 0; i < count; i++) { + int lightType = stream->readUint32LE(); + Light *light; + switch (lightType) { + case 5: + light = new LightAmbient(); + break; + case 4: + light = new Light4(); + break; + case 3: + light = new Light3(); + break; + case 2: + light = new Light2(); + break; + case 1: + light = new Light1(); + break; + default: + light = new Light(); + } + light->readVqa(stream, framesCount, _frame, 1); + _lights.push_back(light); + } +} + +void Lights::setupFrame(int frame) { + if (frame == _frame) { + return; + } + + for (uint i = 0; i < _lights.size(); i++) { + _lights[i]->setupFrame(frame); + } +} + +void Lights::reset() { + for (int i = (int)(_lights.size() - 1); i >= 0; i--) { + delete _lights.remove_at(i); + } + _lights.clear(); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/lights.h b/engines/bladerunner/lights.h new file mode 100644 index 0000000000..ed8edb5f1f --- /dev/null +++ b/engines/bladerunner/lights.h @@ -0,0 +1,63 @@ +/* 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_LIGHTS_H +#define BLADERUNNER_LIGHTS_H + +#include "bladerunner/bladerunner.h" +#include "bladerunner/color.h" +#include "bladerunner/light.h" + +#include "common/stream.h" + +namespace BladeRunner { + +class Lights { +#if _DEBUG + friend class BladeRunnerEngine; +#endif + friend class SliceRenderer; + + BladeRunnerEngine *_vm; + + Color _ambientLightColor; + Common::Array<Light*> _lights; + int _frame; + //char gap[28]; + +public: + Lights(BladeRunnerEngine *vm); + ~Lights(); + + void read(Common::ReadStream *stream, int framesCount); + void readVqa(Common::ReadStream *stream); + + void reset(); + + void setupFrame(int frame); +private: + void removeAnimated(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/matrix.cpp b/engines/bladerunner/matrix.cpp new file mode 100644 index 0000000000..42e3f68e9e --- /dev/null +++ b/engines/bladerunner/matrix.cpp @@ -0,0 +1,169 @@ +/* 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/matrix.h" + +#include "common/scummsys.h" + +namespace BladeRunner { + +Matrix3x2::Matrix3x2() { + for (int r = 0; r != 2; ++r) + for (int c = 0; c != 3; ++c) + _m[r][c] = (r == c) ? 1.0f : 0.0f; +} + +Matrix3x2::Matrix3x2(float d[6]) { + for (int r = 0; r != 2; ++r) + for (int c = 0; c != 3; ++c) + _m[r][c] = d[r*3+c]; +} + +Matrix3x2::Matrix3x2( + float m00, float m01, float m02, + float m10, float m11, float m12) { + _m[0][0] = m00; + _m[0][1] = m01; + _m[0][2] = m02; + _m[1][0] = m10; + _m[1][1] = m11; + _m[1][2] = m12; +} + +Matrix4x3::Matrix4x3() { + for (int r = 0; r != 3; ++r) + for (int c = 0; c != 4; ++c) + _m[r][c] = (r == c) ? 1.0f : 0.0f; +} + +Matrix4x3::Matrix4x3(float d[12]) { + for (int r = 0; r != 3; ++r) + for (int c = 0; c != 4; ++c) + _m[r][c] = d[r*4+c]; +} + +Matrix4x3::Matrix4x3( + float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23) { + _m[0][0] = m00; + _m[0][1] = m01; + _m[0][2] = m02; + _m[0][3] = m03; + _m[1][0] = m10; + _m[1][1] = m11; + _m[1][2] = m12; + _m[1][3] = m13; + _m[2][0] = m20; + _m[2][1] = m21; + _m[2][2] = m22; + _m[2][3] = m23; +} + +Matrix4x3 rotationMatrixX(float angle) { + float ca = cos(angle); + float sa = sin(angle); + + return Matrix4x3( 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, ca, sa, 0.0f, + 0.0f, -sa, ca, 0.0f ); +} + +static inline void swapRows(double *r1, double *r2) { + for (int c = 0; c != 8; ++c) { + double t = r1[c]; + r1[c] = r2[c]; + r2[c] = t; + } +} + +static inline void subtractRow(double *r1, double factor, double *r2) { + for (int c = 0; c != 8; ++c) + r1[c] -= factor * r2[c]; +} + +static inline void divideRow(double *r1, double d) { + for (int c = 0; c != 8; ++c) + r1[c] /= d; +} + +Matrix4x3 invertMatrix(const Matrix4x3 &m) { + double w[3][8]; + + for (int r = 0; r != 3; ++r) { + for (int c = 0; c != 4; ++c) { + w[r][c] = m(r, c); + w[r][c+4] = (r == c) ? 1.0 : 0.0; + } + } + + if (w[0][0] == 0.0) { + if (w[1][0] != 0.0) + swapRows(w[0], w[1]); + else + swapRows(w[0], w[2]); + } + divideRow(w[0], w[0][0]); + subtractRow(w[1], w[1][0], w[0]); + subtractRow(w[2], w[2][0], w[0]); + + if (w[1][1] == 0.0) + swapRows(w[1], w[2]); + + divideRow(w[1], w[1][1]); + subtractRow(w[0], w[0][1], w[1]); + subtractRow(w[2], w[2][1], w[1]); + + divideRow(w[2], w[2][2]); + subtractRow(w[0], w[0][2], w[2]); + subtractRow(w[1], w[1][2], w[2]); + + for (int r = 0; r != 3; ++r) { + w[r][7] = -w[r][3]; + w[r][3] = 0.0; + } + + Matrix4x3 result; + + for (int r = 0; r != 3; ++r) + for (int c = 0; c != 4; ++c) + result(r, c) = float(w[r][c+4]); + + return result; +} + +void Matrix4x3::unknown() { + Matrix4x3 t; + + // Transpose the 3x3 top left submatrix + for (int r = 0; r != 3; ++r) + for (int c = 0; c != 3; ++c) + t(r, c) = _m[c][r]; + + t(0,3) = -(_m[0][3] * _m[0][0] + _m[1][3] * _m[1][0] + _m[2][3] * _m[2][0]); + t(1,3) = -(_m[0][3] * _m[0][1] + _m[1][3] * _m[1][1] + _m[2][3] * _m[2][1]); + t(2,3) = -(_m[0][3] * _m[0][2] + _m[1][3] * _m[1][2] + _m[2][3] * _m[2][2]); + + *this = t; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/matrix.h b/engines/bladerunner/matrix.h new file mode 100644 index 0000000000..5fe7fc2a01 --- /dev/null +++ b/engines/bladerunner/matrix.h @@ -0,0 +1,121 @@ +/* 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_MATRIX_H +#define BLADERUNNER_MATRIX_H + +#include "bladerunner/vector.h" + +namespace BladeRunner { + +class Matrix3x2 { +public: + float _m[2][3]; + + Matrix3x2(); + Matrix3x2(float d[6]); + Matrix3x2( + float m00, float m01, float m02, + float m10, float m11, float m12); + + float &operator()(int r, int c) { assert(r >= 0 && r < 2); assert(c >= 0 && c < 3); return _m[r][c]; } + const float &operator()(int r, int c) const { assert(r >= 0 && r < 2); assert(c >= 0 && c < 3); return _m[r][c]; } +}; + +inline Matrix3x2 operator*(const Matrix3x2 &a, const Matrix3x2 &b) { + Matrix3x2 t; + + t(0,0) = a(0,0)*b(0,0) + a(0,1)*b(1,0); + t(0,1) = a(0,0)*b(0,1) + a(0,1)*b(1,1); + t(0,2) = a(0,0)*b(0,2) + a(0,1)*b(1,2) + a(0,2); + t(1,0) = a(1,0)*b(0,0) + a(1,1)*b(1,0); + t(1,1) = a(1,0)*b(0,1) + a(1,1)*b(1,1); + t(1,2) = a(1,0)*b(0,2) + a(1,1)*b(1,2) + a(1,2); + + return t; +} + +inline Matrix3x2 operator+(const Matrix3x2 &a, Vector2 b) { + Matrix3x2 t(a); + + t(0,2) += b.x; + t(1,2) += b.y; + + return t; +} + +inline Vector2 operator*(const Matrix3x2 &a, Vector2 b) { + Vector2 t; + + t.x = a(0,0) * b.x + a(0,1) * b.y + a(0,2); + t.y = a(1,0) * b.x + a(1,1) * b.y + a(1,2); + + return t; +} + +class Matrix4x3 { +public: + float _m[3][4]; + + Matrix4x3(); + Matrix4x3(float d[12]); + Matrix4x3( + float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23); + + float &operator()(int r, int c) { assert(r >= 0 && r < 3); assert(c >= 0 && c < 4); return _m[r][c]; } + const float &operator()(int r, int c) const { assert(r >= 0 && r < 3); assert(c >= 0 && c < 4); return _m[r][c]; } + + void unknown(); +}; + +Matrix4x3 invertMatrix(const Matrix4x3 &m); +Matrix4x3 rotationMatrixX(float angle); + +inline Matrix4x3 operator*(const Matrix4x3 &a, const Matrix4x3 &b) { + Matrix4x3 t; + + for (int i = 0; i !=3; ++i) { + // printf("t(%d,0) = %7.2f*%7.2f + %7.2f*%7.2f + %7.2f*%7.2f\n", i, a(i,0), b(0,0), a(i,0), b(1,0), a(i,0), b(2,0)); + t(i,0) = a(i,0)*b(0,0) + a(i,1)*b(1,0) + a(i,2)*b(2,0); + t(i,1) = a(i,0)*b(0,1) + a(i,1)*b(1,1) + a(i,2)*b(2,1); + t(i,2) = a(i,0)*b(0,2) + a(i,1)*b(1,2) + a(i,2)*b(2,2); + t(i,3) = a(i,0)*b(0,3) + a(i,1)*b(1,3) + a(i,2)*b(2,3) + a(i,3); + } + + return t; +} + +inline Vector3 operator*(const Matrix4x3 &m, const Vector3 &v) { + Vector3 r; + + r.x = m(0, 0) * v.x + m(0, 1) * v.y + m(0, 2) * v.z + m(0, 3); + r.y = m(1, 0) * v.x + m(1, 1) * v.y + m(1, 2) * v.z + m(1, 3); + r.z = m(2, 0) * v.x + m(2, 1) * v.y + m(2, 2) * v.z + m(2, 3); + + return r; +} + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk new file mode 100644 index 0000000000..fb656efac1 --- /dev/null +++ b/engines/bladerunner/module.mk @@ -0,0 +1,178 @@ +MODULE := engines/bladerunner + +MODULE_OBJS = \ + adq.o \ + actor.o \ + actor_clues.o \ + actor_combat.o \ + actor_walk.o \ + adpcm_decoder.o \ + ambient_sounds.o \ + archive.o \ + aud_stream.o \ + audio_player.o \ + audio_speech.o \ + bladerunner.o \ + boundingbox.o \ + chapters.o \ + combat.o \ + crimes_database.o \ + decompress_lcw.o \ + decompress_lzo.o \ + detection.o \ + fog.o \ + font.o \ + gameflags.o \ + gameinfo.o \ + image.o \ + item.o \ + item_pickup.o \ + items.o \ + light.o \ + lights.o \ + matrix.o \ + mouse.o \ + movement_track.o \ + obstacles.o \ + outtake.o \ + regions.o \ + scene.o \ + scene_objects.o \ + script/ai_00_mccoy.o \ + script/aiscript_officer_leroy.o \ + script/init.o \ + script/kia.o \ + script/vk.o \ + script/esper.o \ + script/ar01.o \ + script/ar02.o \ + script/bb01.o \ + script/bb02.o \ + script/bb03.o \ + script/bb04.o \ + script/bb05.o \ + script/bb06.o \ + script/bb07.o \ + script/bb08.o \ + script/bb09.o \ + script/bb10.o \ + script/bb11.o \ + script/bb12.o \ + script/bb51.o \ + script/ct01.o \ + script/ct02.o \ + script/ct03.o \ + script/ct04.o \ + script/ct05.o \ + script/ct06.o \ + script/ct07.o \ + script/ct08.o \ + script/ct09.o \ + script/ct10.o \ + script/ct11.o \ + script/ct12.o \ + script/ct51.o \ + script/dr01.o \ + script/dr02.o \ + script/dr03.o \ + script/dr04.o \ + script/dr05.o \ + script/dr06.o \ + script/hc01.o \ + script/hc02.o \ + script/hc03.o \ + script/hc04.o \ + script/hf01.o \ + script/hf02.o \ + script/hf03.o \ + script/hf04.o \ + script/hf05.o \ + script/hf06.o \ + script/kp01.o \ + script/kp02.o \ + script/kp03.o \ + script/kp04.o \ + script/kp05.o \ + script/kp06.o \ + script/kp07.o \ + script/ma01.o \ + script/ma02.o \ + script/ma04.o \ + script/ma05.o \ + script/ma06.o \ + script/ma07.o \ + script/ma08.o \ + script/nr01.o \ + script/nr02.o \ + script/nr03.o \ + script/nr04.o \ + script/nr05.o \ + script/nr06.o \ + script/nr07.o \ + script/nr08.o \ + script/nr09.o \ + script/nr10.o \ + script/nr11.o \ + script/ps01.o \ + script/ps02.o \ + script/ps03.o \ + script/ps04.o \ + script/ps05.o \ + script/ps06.o \ + script/ps07.o \ + script/ps09.o \ + script/ps10.o \ + script/ps11.o \ + script/ps12.o \ + script/ps13.o \ + script/ps14.o \ + script/ps15.o \ + script/rc01.o \ + script/rc02.o \ + script/rc03.o \ + script/rc04.o \ + script/rc51.o \ + script/tb02.o \ + script/tb03.o \ + script/tb05.o \ + script/tb06.o \ + script/tb07.o \ + script/ug01.o \ + script/ug02.o \ + script/ug03.o \ + script/ug04.o \ + script/ug05.o \ + script/ug06.o \ + script/ug07.o \ + script/ug08.o \ + script/ug09.o \ + script/ug10.o \ + script/ug12.o \ + script/ug13.o \ + script/ug14.o \ + script/ug15.o \ + script/ug16.o \ + script/ug17.o \ + script/ug18.o \ + script/ug19.o \ + script/script.o \ + set.o \ + settings.o \ + set_effects.o \ + shape.o \ + slice_animations.o \ + slice_renderer.o \ + suspects_database.o \ + text_resource.o \ + view.o \ + vqa_decoder.o \ + vqa_player.o \ + waypoints.o + +# This module can be built as a plugin +ifeq ($(ENABLE_BLADERUNNER), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp new file mode 100644 index 0000000000..675e20c0fd --- /dev/null +++ b/engines/bladerunner/mouse.cpp @@ -0,0 +1,325 @@ +/* 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/mouse.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/shape.h" + +#include "graphics/surface.h" + +namespace BladeRunner { + +Mouse::Mouse(BladeRunnerEngine *vm) : _vm(vm) { + _cursor = 0; + _frame = 3; + _hotspotX = 0; + _hotspotY = 0; + _x = 0; + _y = 0; + _disabledCounter = 0; + _lastFrameTime = 0; +} + +Mouse::~Mouse() { +} + +void Mouse::setCursor(int cursor) { + assert(cursor >= 0 && cursor <= 16); + if (cursor == _cursor) { + return; + } + + _cursor = cursor; + + switch (_cursor) { + case 0: + _frame = 3; + _hotspotX = 0; + _hotspotY = 0; + break; + case 1: + _frame = 4; + _hotspotX = 0; + _hotspotY = 0; + break; + case 2: + _frame = 12; + _hotspotX = 12; + _hotspotY = 0; + break; + case 3: + _frame = 15; + _hotspotX = 23; + _hotspotY = 12; + break; + case 4: + _frame = 13; + _hotspotX = 12; + _hotspotY = 23; + break; + case 5: + _frame = 14; + _hotspotX = 0; + _hotspotY = 12; + break; + case 6: + _frame = 16; + _hotspotX = 19; + _hotspotY = 19; + break; + case 7: + _frame = 17; + _hotspotX = 19; + _hotspotY = 19; + break; + case 8: + _frame = 25; + _hotspotX = 19; + _hotspotY = 19; + break; + case 9: + _frame = 26; + _hotspotX = 19; + _hotspotY = 19; + break; + case 10: + _frame = 34; + _hotspotX = 19; + _hotspotY = 19; + break; + case 11: + _frame = 35; + _hotspotX = 19; + _hotspotY = 19; + break; + case 12: + _frame = 12; + _hotspotX = 12; + _hotspotY = 0; + _animCounter = 0; + break; + case 13: + _frame = 15; + _hotspotX = 23; + _hotspotY = 12; + _animCounter = 0; + break; + case 14: + _frame = 13; + _hotspotX = 12; + _hotspotY = 23; + _animCounter = 0; + break; + case 15: + _frame = 14; + _hotspotX = 0; + _hotspotY = 12; + _animCounter = 0; + break; + case 16: + _frame = 0; + _hotspotX = 11; + _hotspotY = 11; + } +} + +void Mouse::disable() { + ++_disabledCounter; +} + +void Mouse::enable() { + if (--_disabledCounter <= 0) { + _disabledCounter = 0; + } +} + +bool Mouse::isDisabled() { + return _disabledCounter > 0; +} + +void Mouse::draw(Graphics::Surface &surface, int x, int y) { + if (_disabledCounter) { + return; + } + + _x = CLIP(x, 0, surface.w - 1); + _y = CLIP(y, 0, surface.h - 1); + + if (_cursor < 0 || (uint)_cursor >= _vm->_shapes.size()) { + return; + } + + Shape *cursorShape = _vm->_shapes[_frame]; + + cursorShape->draw(surface, _x - _hotspotX, _y - _hotspotY); + + updateCursorFrame(); +} + +void Mouse::updateCursorFrame() { + uint32 now = _vm->getTotalPlayTime(); + const int offset[4] = { 0, 6, 12, 6 }; + + if (now - _lastFrameTime < 66) { + return; + } + _lastFrameTime = now; + + switch (_cursor) { + case 0: + break; + case 1: + if (++_frame > 11) + _frame = 4; + break; + case 2: + case 3: + case 4: + case 5: + case 6: + break; + case 7: + if (++_frame > 24) + _frame = 17; + break; + case 8: + break; + case 9: + if (++_frame > 33) + _frame = 26; + break; + case 10: + break; + case 11: + if (++_frame > 42) + _frame = 35; + break; + case 12: + if (++_animCounter >= 4) { + _animCounter = 0; + } + _hotspotY = -offset[_animCounter]; + break; + case 13: + if (++_animCounter >= 4) { + _animCounter = 0; + } + _hotspotX = 23 + offset[_animCounter]; + break; + case 14: + if (++_animCounter >= 4) { + _animCounter = 0; + } + _hotspotY = 23 + offset[_animCounter]; + break; + case 15: + if (++_animCounter >= 4) { + _animCounter = 0; + } + _hotspotX = -offset[_animCounter]; + break; + case 16: + if (++_frame > 2) + _frame = 0; + } +} + +void Mouse::tick(int x, int y) { + if (!_vm->playerHasControl() || isDisabled()) + return; + + Vector3 mousePosition = getXYZ(x, y); + int cursorId = 0; + + int isClickable = 0; + int isObstacle = 0; + int isTarget = 0; + + int sceneObjectId = _vm->_sceneObjects->findByXYZ(&isClickable, &isObstacle, &isTarget, mousePosition.x, mousePosition.y, mousePosition.z, 1, 0, 1); + int exitType = _vm->_scene->_exits->getTypeAtXY(x, y); + + if (sceneObjectId >= 0 && sceneObjectId <= 74) { + exitType = -1; + } + + if (exitType != -1) { + switch (exitType) { + case 1: + cursorId = 13; + break; + case 2: + cursorId = 14; + break; + case 3: + cursorId = 15; + break; + default: + cursorId = 12; + } + setCursor(cursorId); + return; + } + + if (true /* not in combat */) { + if (sceneObjectId == 0 + || (sceneObjectId >= 0 && isClickable) + || _vm->_scene->_regions->getRegionAtXY(x, y) >= 0) { + cursorId = 1; + } + setCursor(cursorId); + return; + } + + setCursor(cursorId); +} + +// TEST: RC01 after intro: [290, 216] -> [-204.589249 51.450668 7.659241] +Vector3 Mouse::getXYZ(int x, int y) { + if (_vm->_scene->getSetId() == -1) + return Vector3(); + + int screenRight = 640 - x; + int screenDown = 480 - y; + + float zcoef = 1.0f / tan(_vm->_view->_fovX / 2.0f); + + float x3d = (2.0f / 640.0f * screenRight - 1.0f); + float y3d = (2.0f / 480.0f * screenDown - 1.0f) * 0.75f; + + uint16 zbufval = _vm->_zBuffer1[x + y * 640]; + + Vector3 pos; + pos.z = zbufval / 25.5f; + pos.x = pos.z / zcoef * x3d; + pos.y = pos.z / zcoef * y3d; + + Matrix4x3 matrix = _vm->_view->_frameViewMatrix; + + matrix.unknown(); + + return matrix * pos; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/mouse.h b/engines/bladerunner/mouse.h new file mode 100644 index 0000000000..8fb5f324a2 --- /dev/null +++ b/engines/bladerunner/mouse.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_MOUSE_H +#define BLADERUNNER_MOUSE_H + +#include "bladerunner/vector.h" + +namespace Graphics { + struct Surface; +} + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Mouse { + BladeRunnerEngine *_vm; + + int _cursor; + int _frame; + int _hotspotX; + int _hotspotY; + int _x; + int _y; + int _disabledCounter; + int _lastFrameTime; + int _animCounter; + +public: + Mouse(BladeRunnerEngine *vm); + ~Mouse(); + + void setCursor(int cursor); + + void disable(); + void enable(); + bool isDisabled(); + + void draw(Graphics::Surface &surface, int x, int y); + void updateCursorFrame(); + + void tick(int x, int y); + +// private: + Vector3 getXYZ(int x, int y); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/movement_track.cpp b/engines/bladerunner/movement_track.cpp new file mode 100644 index 0000000000..60a190a9a2 --- /dev/null +++ b/engines/bladerunner/movement_track.cpp @@ -0,0 +1,112 @@ +/* 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/movement_track.h" + +namespace BladeRunner { + +MovementTrack::MovementTrack() { + reset(); +} + +MovementTrack::~MovementTrack() { + reset(); +} + +void MovementTrack::reset() { + _currentIndex = -1; + _lastIndex = -1; + _hasNext = 0; + _paused = 0; + for (int i = 0; i < 100; i++) { + _entries[i].waypointId = -1; + _entries[i].delay = -1; + _entries[i].angle = -1; + _entries[i].running = 0; + } +} + +int MovementTrack::append(int waypointId, int delay, int running) { + return append(waypointId, delay, -1, running); +} + +int MovementTrack::append(int waypointId, int delay, int angle, int running) { + if (_lastIndex > ARRAYSIZE(_entries)) + return 0; + + _entries[_lastIndex].waypointId = waypointId; + _entries[_lastIndex].delay = delay; + _entries[_lastIndex].angle = angle; + _entries[_lastIndex].running = running; + + _lastIndex++; + _hasNext = 1; + _currentIndex = 0; + return 1; +} + +void MovementTrack::flush() { + reset(); +} + +void MovementTrack::repeat() { + _currentIndex = 0; + _hasNext = 1; +} + +int MovementTrack::pause() { + _paused = 1; + return 1; +} + +int MovementTrack::unpause() { + _paused = 0; + return 1; +} + +int MovementTrack::isPaused() { + return _paused; +} + +int MovementTrack::hasNext() { + return _hasNext; +} + +int MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) { + if (_currentIndex < _lastIndex && this->_hasNext) + { + *waypointId = _entries[_currentIndex].waypointId; + *delay = _entries[_currentIndex].delay; + *angle = _entries[_currentIndex].angle; + *running = _entries[_currentIndex++].running; + return 1; + } else { + *waypointId = -1; + *delay = -1; + *angle = -1; + *running = 0; + _hasNext = 0; + return 0; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/movement_track.h b/engines/bladerunner/movement_track.h new file mode 100644 index 0000000000..450592210a --- /dev/null +++ b/engines/bladerunner/movement_track.h @@ -0,0 +1,69 @@ +/* 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_MOVEMENT_TRACK_H +#define BLADERUNNER_MOVEMENT_TRACK_H + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class BoundingBox; + +struct MovementTrackEntry { + int waypointId; + int delay; + int angle; + int running; +}; + +class MovementTrack { +// BladeRunnerEngine *_vm; + +private: + int _currentIndex; + int _lastIndex; + int _hasNext; + int _paused; + MovementTrackEntry _entries[100]; + void reset(); + +public: + MovementTrack(); + ~MovementTrack(); + int append(int waypointId, int delay, int running); + int append(int waypointId, int delay, int angle, int running); + void flush(); + void repeat(); + int pause(); + int unpause(); + int isPaused(); + int hasNext(); + int next(int *waypointId, int *delay, int *angle, int *running); + + //int saveGame(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/obstacles.cpp b/engines/bladerunner/obstacles.cpp new file mode 100644 index 0000000000..9e701a9341 --- /dev/null +++ b/engines/bladerunner/obstacles.cpp @@ -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. + * + */ + +#include "bladerunner/obstacles.h" + +#include "bladerunner/bladerunner.h" + +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; + } + } + _verticesCount = 0; + _backup = false; + _count = 0; +} + +void Obstacles::add(float x0, float z0, float x1, float z1) { +} + +bool Obstacles::find(const Vector3 &from, const Vector3 &to, Vector3 *next) { + //TODO + *next = to; + return true; +} + +void Obstacles::backup() { +} + + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h new file mode 100644 index 0000000000..f9641bfe6b --- /dev/null +++ b/engines/bladerunner/obstacles.h @@ -0,0 +1,67 @@ +/* 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_OBSTACLES_H +#define BLADERUNNER_OBSTACLES_H + +#include "bladerunner/vector.h" + +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 { + BladeRunnerEngine *_vm; + +private: + ObstaclesPolygon *_polygons; + ObstaclesPolygon *_polygonsBackup; + Vector2 *_vertices; + int _verticesCount; + int _count; + bool _backup; + +public: + Obstacles(BladeRunnerEngine *vm); + ~Obstacles(); + + void clear(); + void add(float x0, float z0, float x1, float z1); + bool find(const Vector3 &from, const Vector3 &to, Vector3 *next); + void backup(); + void restore(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp new file mode 100644 index 0000000000..b81b212f52 --- /dev/null +++ b/engines/bladerunner/outtake.cpp @@ -0,0 +1,71 @@ +/* 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/outtake.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/vqa_player.h" + +#include "common/debug.h" +#include "common/events.h" +#include "common/system.h" + +namespace BladeRunner { + +void OuttakePlayer::play(const Common::String &name, bool noLocalization, int container) { + if (container > 0) { + debug("OuttakePlayer::play TODO"); + return; + } + + Common::String resName; + if (noLocalization) + resName = name + ".VQA"; + else + resName = name + "_E.VQA"; + + VQAPlayer vqa_player(_vm); + + vqa_player.open(resName); + + _vm->_mixer->stopAll(); + while (!_vm->shouldQuit()) { + Common::Event event; + while (_vm->_system->getEventManager()->pollEvent(event)) + if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) + return; + + int frame = vqa_player.update(); + if (frame == -3) + break; + + if (frame >= 0) { + const Graphics::Surface *surface = vqa_player.getSurface(); + _vm->_system->copyRectToScreen((const byte *)surface->getBasePtr(0, 0), surface->pitch, 0, 0, 640, 480); + _vm->_system->updateScreen(); + } + + _vm->_system->delayMillis(10); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/outtake.h b/engines/bladerunner/outtake.h new file mode 100644 index 0000000000..acbd00f6a6 --- /dev/null +++ b/engines/bladerunner/outtake.h @@ -0,0 +1,45 @@ +/* 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_OUTTAKE_H +#define BLADERUNNER_OUTTAKE_H + +#include "common/str.h" + +#include "graphics/surface.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class OuttakePlayer { + BladeRunnerEngine *_vm; + +public: + OuttakePlayer(BladeRunnerEngine *vm) : _vm(vm) {} + + void play(const Common::String &name, bool noLocalization, int container); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/regions.cpp b/engines/bladerunner/regions.cpp new file mode 100644 index 0000000000..55a1aa14aa --- /dev/null +++ b/engines/bladerunner/regions.cpp @@ -0,0 +1,106 @@ +/* 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/regions.h" + +namespace BladeRunner { + +Regions::Regions() { + _enabled = true; + _regions = new Region[10]; + clear(); +} + +Regions::~Regions() { + delete[] _regions; +} + +void BladeRunner::Regions::clear() { + for (int i = 0; i < 10; ++i) + remove(i); +} + +bool Regions::add(int index, Common::Rect rect, int type) { + if (index < 0 || index >= 10) + return false; + + if (_regions[index]._present) + return false; + + _regions[index]._rectangle = rect; + _regions[index]._type = type; + _regions[index]._present = 1; + + return true; +} + +bool Regions::remove(int index) { + if (index < 0 || index >= 10) + return false; + + _regions[index]._rectangle = Common::Rect(-1, -1, -1, -1); + _regions[index]._type = -1; + _regions[index]._present = 0; + + return true; +} + +int Regions::getTypeAtXY(int x, int y) { + int index = getRegionAtXY(x, y); + + if (index == -1) + return -1; + + return _regions[index]._type; +} + +int Regions::getRegionAtXY(int x, int y) { + if (!_enabled) + return -1; + + for (int i = 0; i != 10; ++i) { + if (!_regions[i]._present) + continue; + + // Common::Rect::contains is exclusive of right and bottom but + // Blade Runner wants inclusive, so we adjust the edges. + // TODO: Roll our own rect class? + Common::Rect r = _regions[i]._rectangle; + r.right++; + r.bottom++; + + if (r.contains(x, y)) + return i; + } + + return -1; +} + +void Regions::setEnabled(bool enabled) { + _enabled = enabled; +} + +void Regions::enable() { + _enabled = true; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/regions.h b/engines/bladerunner/regions.h new file mode 100644 index 0000000000..2dd6808a25 --- /dev/null +++ b/engines/bladerunner/regions.h @@ -0,0 +1,63 @@ +/* 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_REGIONS_H +#define BLADERUNNER_REGIONS_H + +#include "bladerunner/bladerunner.h" + +#include "common/rect.h" + +namespace BladeRunner { + +struct Region { + Common::Rect _rectangle; + int _type; + int _present; +}; + +class Regions { +#ifdef _DEBUG + friend class BladeRunnerEngine; +#endif + +private: + Region* _regions; + bool _enabled; +public: + Regions(); + ~Regions(); + + void clear(); + bool add(int index, Common::Rect rect, int type); + bool remove(int index); + + int getTypeAtXY(int x, int y); + int getRegionAtXY(int x, int y); + + void setEnabled(bool enabled); + void enable(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp new file mode 100644 index 0000000000..a629b4263b --- /dev/null +++ b/engines/bladerunner/scene.cpp @@ -0,0 +1,268 @@ +/* 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/scene.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/adq.h" +#include "bladerunner/chapters.h" +#include "bladerunner/gameinfo.h" +#include "bladerunner/items.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/script/script.h" +#include "bladerunner/slice_renderer.h" + +#include "common/str.h" + +namespace BladeRunner { + +bool Scene::open(int setId, int sceneId, bool isLoadingGame) { + if (!isLoadingGame) { + _vm->_adq->flush(1, false); + } + + _setId = setId; + _sceneId = sceneId; + + const Common::String setName = _vm->_gameInfo->getSceneName(_sceneId); + + if (isLoadingGame) { + // TODO: Set up overlays + } else { + _regions->clear(); + _exits->clear(); + // TODO: Reset aesc + // TODO: Clear regions + // TODO: Destroy all overlays + _defaultLoop = 0; + _defaultLoopSet = 0; + _field_20_loop_stuff = 0; + _specialLoopMode = -1; + _specialLoop = -1; + _frame = -1; + } + + Common::String vqaName; + int currentResourceId = _vm->_chapters->currentResourceId(); + if (currentResourceId == 1) { + vqaName = Common::String::format("%s.VQA", setName.c_str()); + } else { + vqaName = Common::String::format("%s_%d.VQA", setName.c_str(), MIN(currentResourceId, 3)); + } + + if (_vqaPlayer != nullptr) + delete _vqaPlayer; + + _vqaPlayer = new VQAPlayer(_vm); + + if (!_vqaPlayer->open(vqaName)) + return false; + + Common::String sceneName = _vm->_gameInfo->getSceneName(sceneId); + if (!_vm->_script->open(sceneName)) + return false; + + if (!isLoadingGame) + _vm->_script->InitializeScene(); + + Common::String setResourceName = Common::String::format("%s-MIN.SET", sceneName.c_str()); + if (!_set->open(setResourceName)) + return false; + + _vm->_sliceRenderer->setView(*_vm->_view); + + if (isLoadingGame) { + // TODO: Advance VQA frame + if (sceneId >= 73 && sceneId <= 76) + _vm->_script->SceneLoaded(); + return true; + } + + // TODO: set VQADecoder parameters + //_vm->_scene->advanceFrame(0, 0); + + _vm->_playerActor->setAtXYZ(_actorStartPosition, _actorStartFacing); + //_vm->_playerActor->setSetId(setId); + + _vm->_script->SceneLoaded(); + + _vm->_sceneObjects->clear(); + + // Init click map + int actorCount = _vm->_gameInfo->getActorCount(); + for (int i = 0; i != actorCount; ++i) { + Actor *actor = _vm->_actors[i]; + if (actor->getSetId() == setId) { + _vm->_sceneObjects->addActor( + i, + actor->getBoundingBox(), + actor->getScreenRectangle(), + 1, + 0, + actor->isTargetable(), + actor->isRetired()); + } + } + + _set->addObjectsToScene(_vm->_sceneObjects); + _vm->_items->addToSet(setId); + _vm->_sceneObjects->updateObstacles(); + // TODO: add all items to scene + // TODO: calculate walking obstacles?? + + if (_specialLoopMode) { + _vm->_script->PlayerWalkedIn(); + } + + return true; +} + +bool Scene::close(bool isLoadingGame) { + bool result = true; + if (getSetId() == -1) { + return true; + } + + //_vm->_policeMaze->clear(!isLoadingGame); + if (isLoadingGame) { + _vm->_script->PlayerWalkedOut(); + } + // if (SceneScript_isLoaded() && !SceneScript_unload()) { + // result = false; + // } + if (_vqaPlayer != nullptr) { + //_vqaPlayer->stop(); + delete _vqaPlayer; + _vqaPlayer = nullptr; + } + _sceneId = -1; + _setId = -1; + + return result; +} + +int Scene::advanceFrame(Graphics::Surface &surface, uint16 *&zBuffer) { + int frame = _vqaPlayer->update(); + if (frame >= 0) { + surface.copyFrom(*_vqaPlayer->getSurface()); + memcpy(zBuffer, _vqaPlayer->getZBuffer(), 640 * 480 * 2); + _vqaPlayer->updateView(_vm->_view); + _vqaPlayer->updateLights(_vm->_lights); + } + + if (frame < 0) { + return frame; + } + _frame = frame; + + if (_specialLoopMode == 0 && frame == _vqaPlayer->getLoopEndFrame(_specialLoop)) { + _playerWalkedIn = true; + _specialLoopMode = -1; + } + if (_specialLoopMode == 0 && !_defaultLoopSet) { + _vqaPlayer->setLoop(_defaultLoop + 1); + _defaultLoopSet = true; + } + + return frame; +} + +void Scene::setActorStart(Vector3 position, int facing) { + _actorStartPosition = position; + _actorStartFacing = facing; +} + +void Scene::loopSetDefault(int a) { + // warning("\t\t\tScene::loopSetDefault(%d)", a); + _defaultLoop = a; +} + +void Scene::loopStartSpecial(int a, int b, int c) { + // warning("\t\t\tScene::loopStartSpecial(%d, %d, %d)", a, b, c); + _specialLoopMode = a; + _specialLoop = b; + + if (_specialLoop == 1) { + // a1->on_loop_end_switch_to_set_id = sub_42BE08_options_get_set_enter_arg_1(&unk_48E910_options); + // a1->on_loop_end_switch_to_scene_id = sub_42BE00_options_get_set_enter_arg_2(&unk_48E910_options); + } + + if (c) { + // _field_20_loop_stuff = 1; + // v6 = a1->_field_28_loop_special_loop_number; + // sub_453434_scene_method_loop(a1); + } +} + +int Scene::findObject(const char *objectName) { + return _set->findObject(objectName); +} + +bool Scene::objectSetHotMouse(int objectId) { + return _set->objectSetHotMouse(objectId); +} + +bool Scene::objectGetBoundingBox(int objectId, BoundingBox *boundingBox) { + return _set->objectGetBoundingBox(objectId, boundingBox); +} + +void Scene::objectSetIsClickable(int objectId, bool isClickable, bool sceneLoaded) { + _set->objectSetIsClickable(objectId, isClickable); + if (sceneLoaded) { + _vm->_sceneObjects->setIsClickable(objectId + 198, isClickable); + } +} + +void Scene::objectSetIsObstacle(int objectId, bool isObstacle, bool sceneLoaded, bool updateWalkpath) { + _set->objectSetIsObstacle(objectId, isObstacle); + if (sceneLoaded) { + _vm->_sceneObjects->setIsObstacle(objectId + 198, isObstacle); + if (updateWalkpath) { + _vm->_sceneObjects->updateObstacles(); + } + } +} + +void Scene::objectSetIsObstacleAll(bool isObstacle, bool sceneLoaded) { + int i; + for (i = 0; i < (int)_set->getObjectCount(); i++) { + _set->objectSetIsObstacle(i, isObstacle); + if (sceneLoaded) { + _vm->_sceneObjects->setIsObstacle(i + 198, isObstacle); + } + } +} + +void Scene::objectSetIsTarget(int objectId, bool isTarget, bool sceneLoaded) { + _set->objectSetIsTarget(objectId, isTarget); + if (sceneLoaded) { + _vm->_sceneObjects->setIsTarget(objectId + 198, isTarget); + } +} + +const char *Scene::objectGetName(int objectId) { + return _set->objectGetName(objectId); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h new file mode 100644 index 0000000000..6a34fcd249 --- /dev/null +++ b/engines/bladerunner/scene.h @@ -0,0 +1,116 @@ +/* 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_SCENE_H +#define BLADERUNNER_SCENE_H + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/regions.h" +#include "bladerunner/set.h" +#include "bladerunner/view.h" +#include "bladerunner/vqa_player.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Scene { + BladeRunnerEngine *_vm; + +public: + Set *_set; + int _setId; + int _sceneId; + VQAPlayer *_vqaPlayer; + + int _defaultLoop; + int _defaultLoopSet; + int _field_20_loop_stuff; + int _specialLoopMode; + int _specialLoop; + int _introFinished; + int _nextSetId; + int _nextSceneId; + int _frame; + + Vector3 _actorStartPosition; + int _actorStartFacing; + bool _playerWalkedIn; + + Regions* _regions; + Regions* _exits; + + // _default_loop_id = 0; + // _scene_vqa_frame_number = -1; + +public: + Scene(BladeRunnerEngine *vm) + : _vm(vm), + _set(new Set(vm)), + _setId(-1), + _sceneId(-1), + _vqaPlayer(nullptr), + _defaultLoop(0), + _nextSetId(-1), + _nextSceneId(-1), + _playerWalkedIn(false), + _introFinished(false), + _regions(new Regions()), + _exits(new Regions()) + {} + + ~Scene() { + delete _set; + delete _regions; + delete _exits; + if (_vqaPlayer != nullptr) { + delete _vqaPlayer; + } + } + + bool open(int setId, int sceneId, bool isLoadingGame); + bool close(bool isLoadingGame); + int advanceFrame(Graphics::Surface &surface, uint16 *&zBuffer); + void setActorStart(Vector3 position, int facing); + + void loopSetDefault(int a); + void loopStartSpecial(int a, int b, int c); + + int getSetId() { return _setId; } + int getSceneId() { return _sceneId; } + + bool didPlayerWalkIn() { bool r = _playerWalkedIn; _playerWalkedIn = false; return r; } + + int findObject(const char *objectName); + bool objectSetHotMouse(int objectId); + bool objectGetBoundingBox(int objectId, BoundingBox *boundingBox); + void objectSetIsClickable(int objectId, bool isClickable, bool sceneLoaded); + void objectSetIsObstacle(int objectId, bool isObstacle, bool sceneLoaded, bool updateWalkpath); + void objectSetIsObstacleAll(bool isObstacle, bool sceneLoaded); + void objectSetIsTarget(int objectId, bool isTarget, bool sceneLoaded); + const char *objectGetName(int objectId); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/scene_objects.cpp b/engines/bladerunner/scene_objects.cpp new file mode 100644 index 0000000000..6d10edd83f --- /dev/null +++ b/engines/bladerunner/scene_objects.cpp @@ -0,0 +1,301 @@ +/* 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/scene_objects.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/obstacles.h" +#include "bladerunner/view.h" + + +namespace BladeRunner { + +SceneObjects::SceneObjects(BladeRunnerEngine *vm, View *view) { + _vm = vm; + _view = view; + + _count = 0; + _sceneObjects = new SceneObject[SCENE_OBJECTS_COUNT]; + _sceneObjectsSortedByDistance = new int[SCENE_OBJECTS_COUNT]; + + for (int i = 0; i < SCENE_OBJECTS_COUNT; ++i) { + _sceneObjectsSortedByDistance[i] = -1; + } +} + +SceneObjects::~SceneObjects() { + _vm = nullptr; + _view = nullptr; + _count = 0; + + delete[] _sceneObjectsSortedByDistance; + delete[] _sceneObjects; +} + +void SceneObjects::clear() { + for (int i = 0; i < SCENE_OBJECTS_COUNT; ++i) { + _sceneObjects[i]._sceneObjectId = -1; + _sceneObjects[i]._sceneObjectType = SceneObjectTypeUnknown; + _sceneObjects[i]._distanceToCamera = 0; + _sceneObjects[i]._present = 0; + _sceneObjects[i]._isClickable = 0; + _sceneObjects[i]._isObstacle = 0; + _sceneObjects[i]._unknown1 = 0; + _sceneObjects[i]._isTarget = 0; + _sceneObjects[i]._isMoving = 0; + _sceneObjects[i]._isRetired = 0; + } +} + +bool SceneObjects::addActor(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 isMoving, uint8 isTarget, uint8 isRetired) { + return addSceneObject(sceneObjectId, SceneObjectTypeActor, boundingBox, screenRectangle, isClickable, 0, 0, isTarget, isMoving, isRetired); +} + +bool SceneObjects::addObject(int sceneObjectId, BoundingBox *boundingBox, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget) { + Common::Rect rect(-1, -1, -1, -1); + return addSceneObject(sceneObjectId, SceneObjectTypeObject, boundingBox, &rect, isClickable, isObstacle, unknown1, isTarget, 0, 0); +} + +bool SceneObjects::addItem(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isTarget, uint8 isObstacle) { + return addSceneObject(sceneObjectId, SceneObjectTypeItem, boundingBox, screenRectangle, isObstacle, 0, 0, isTarget, 0, 0); +} + +bool SceneObjects::remove(int sceneObjectId) { + int i = findById(sceneObjectId); + if (i == -1) { + return false; + } + + int j; + for (j = 0; j < _count; ++j) { + if (_sceneObjectsSortedByDistance[j] == i) { + break; + } + } + for (int k = j; k < _count - 1; ++k) { + _sceneObjectsSortedByDistance[k] = _sceneObjectsSortedByDistance[k + 1]; + } + + --_count; + return true; +} + +int SceneObjects::findByXYZ(int *isClickable, int *isObstacle, int *isTarget, float x, float y, float z, int findClickables, int findObstacles, int findTargets) { + *isClickable = 0; + *isObstacle = 0; + *isTarget = 0; + + for (int i = 0; i < _count; ++i) { + assert(_sceneObjectsSortedByDistance[i] < _count); + + SceneObject &sceneObject = _sceneObjects[_sceneObjectsSortedByDistance[i]]; + + if ((findClickables && sceneObject._isClickable) || + (findObstacles && sceneObject._isObstacle) || + (findTargets && sceneObject._isTarget)) { + BoundingBox boundingBox = sceneObject._boundingBox; + + if (sceneObject._sceneObjectType == SceneObjectTypeObject || sceneObject._sceneObjectType == SceneObjectTypeItem) { + boundingBox.expand(-4.0, 0.0, -4.0, 4.0, 0.0, 4.0); + } + + if (boundingBox.inside(x, y, z)) { + *isClickable = sceneObject._isClickable; + *isObstacle = sceneObject._isObstacle; + *isTarget = sceneObject._isTarget; + + return sceneObject._sceneObjectId; + } + } + } + + return -1; +} + +bool SceneObjects::existsOnXZ(int exceptSceneObjectId, float x, float z, bool a5, bool a6) { + float xMin = x - 12.5f; + float xMax = x + 12.5f; + float zMin = z - 12.5f; + float zMax = z + 12.5f; + + int count = this->_count; + + if (count > 0) { + for (int i = 0; i < count; i++) { + SceneObject *sceneObject = &this->_sceneObjects[this->_sceneObjectsSortedByDistance[i]]; + bool v13 = false; + if (sceneObject->_sceneObjectType == SceneObjectTypeActor) { + if (sceneObject->_isRetired) { + v13 = false; + } else if (sceneObject->_isMoving) { + v13 = a5 != 0; + } else { + v13 = a6 != 0; + } + } else { + v13 = sceneObject->_isObstacle; + } + + if (v13 && sceneObject->_sceneObjectId != exceptSceneObjectId) { + float x1, y1, z1, x2, y2, z2; + sceneObject->_boundingBox.getXYZ(&x1, &y1, &z1, &x2, &y2, &z2); + if (z1 <= zMax && z2 >= zMin && x1 <= xMax && x2 >= xMin) { + return true; + } + } + } + } + return false; +} + +int SceneObjects::findById(int sceneObjectId) { + for (int i = 0; i < _count; ++i) { + if (_sceneObjects[i]._present && _sceneObjects[i]._sceneObjectId == sceneObjectId) { + return i; + } + } + return -1; +} + +bool SceneObjects::addSceneObject(int sceneObjectId, SceneObjectType sceneObjectType, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget, uint isMoving, uint isRetired) { + int index = findEmpty(); + if (index == -1) { + return false; + } + + _sceneObjects[index]._sceneObjectId = sceneObjectId; + _sceneObjects[index]._sceneObjectType = sceneObjectType; + _sceneObjects[index]._present = 1; + _sceneObjects[index]._boundingBox = *boundingBox; + _sceneObjects[index]._screenRectangle = *screenRectangle; + _sceneObjects[index]._isClickable = isClickable; + _sceneObjects[index]._isObstacle = isObstacle; + _sceneObjects[index]._unknown1 = unknown1; + _sceneObjects[index]._isTarget = isTarget; + _sceneObjects[index]._isMoving = isMoving; + _sceneObjects[index]._isRetired = isRetired; + + float centerZ = (_sceneObjects[index]._boundingBox.getZ0() + _sceneObjects[index]._boundingBox.getZ1()) / 2.0; + + float distanceToCamera = fabs(_view->_cameraPosition.z - centerZ); + _sceneObjects[index]._distanceToCamera = distanceToCamera; + + // insert according to distance from camera + int i; + for (i = 0; i < _count; ++i) { + if (distanceToCamera < _sceneObjects[_sceneObjectsSortedByDistance[i]]._distanceToCamera) { + break; + } + } + for (int j = _count - 1; j >= i; --j) { + _sceneObjectsSortedByDistance[j + 1] = _sceneObjectsSortedByDistance[j]; + } + + _sceneObjectsSortedByDistance[i] = index; + ++_count; + return true; +} + +int SceneObjects::findEmpty() { + for (int i = 0; i < SCENE_OBJECTS_COUNT; ++i) { + if (!_sceneObjects[i]._present) + return i; + } + return -1; +} + +void SceneObjects::setMoving(int sceneObjectId, bool isMoving) { + int i = findById(sceneObjectId); + if (i == -1) { + return; + } + _sceneObjects[i]._isMoving = isMoving; +} + +void SceneObjects::setRetired(int sceneObjectId, bool isRetired) { + int i = findById(sceneObjectId); + if (i == -1) { + return; + } + _sceneObjects[i]._isRetired = isRetired; +} + +bool SceneObjects::isBetweenTwoXZ(int sceneObjectId, float x1, float z1, float x2, float z2) { + int i = findById(sceneObjectId); + if (i == -1) { + return false; + } + + float objectX1, objectY1, objectZ1, objectX2, objectY2, objectZ2; + _sceneObjects[i]._boundingBox.getXYZ(&objectX1, &objectY1, &objectZ1, &objectX2, &objectY2, &objectZ2); + + //TODO + // if (!lineIntersectection(sourceX, sourceZ, targetX, targetZ, objectX1, objectZ1, objectX2, objectZ1, &intersectionX, &intersectionY, &v18) + // && !lineIntersectection(sourceX, sourceZ, targetX, targetZ, objectX2, objectZ1, objectX2, objectZ2, &intersectionX, &intersectionY, &v18) + // && !lineIntersectection(sourceX, sourceZ, targetX, targetZ, objectX2, objectZ2, objectX1, objectZ2, &intersectionX, &intersectionY, &v18) + // && !lineIntersectection(sourceX, sourceZ, targetX, targetZ, objectX1, objectZ2, objectX1, objectZ1, &intersectionX, &intersectionY, &v18)) + // return false; + return true; +} + + +void SceneObjects::setIsClickable(int sceneObjectId, bool isClickable) { + int i = findById(sceneObjectId); + if (i == -1) { + return; + } + _sceneObjects[i]._isClickable = isClickable; +} + +void SceneObjects::setIsObstacle(int sceneObjectId, bool isObstacle) { + int i = findById(sceneObjectId); + if (i == -1) { + return; + } + _sceneObjects[i]._isObstacle = isObstacle; +} + +void SceneObjects::setIsTarget(int sceneObjectId, bool isTarget) { + int i = findById(sceneObjectId); + if (i == -1) { + return; + } + _sceneObjects[i]._isTarget = isTarget; +} + + +void SceneObjects::updateObstacles() { + _vm->_obstacles->clear(); + for(int i = 0; i < _count; i++) { + int index = _sceneObjectsSortedByDistance[i]; + SceneObject sceneObject = _sceneObjects[index]; + if(sceneObject._isObstacle) { + float x0, y0, z0, x1, y1, z1; + sceneObject._boundingBox.getXYZ(&x0, &y0, &z0, &x1, &y1, &z1); + _vm->_obstacles->add(x0, z0, x1, z1); + } + } + _vm->_obstacles->backup(); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/scene_objects.h b/engines/bladerunner/scene_objects.h new file mode 100644 index 0000000000..010dc43532 --- /dev/null +++ b/engines/bladerunner/scene_objects.h @@ -0,0 +1,100 @@ +/* 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_SCENE_OBJECTS_H +#define BLADERUNNER_SCENE_OBJECTS_H + +#include "bladerunner/boundingbox.h" + +#include "common/rect.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class View; + +enum SceneObjectType { + SceneObjectTypeUnknown = -1, + SceneObjectTypeActor = 0, + SceneObjectTypeObject = 1, + SceneObjectTypeItem = 2 +}; + +#define SCENE_OBJECTS_COUNT 115 +#define SCENE_OBJECTS_ACTORS_OFFSET 0 +#define SCENE_OBJECTS_ITEMS_OFFSET 74 +#define SCENE_OBJECTS_OBJECTS_OFFSET 198 + +struct SceneObject { + int _sceneObjectId; + SceneObjectType _sceneObjectType; + BoundingBox _boundingBox; + Common::Rect _screenRectangle; + float _distanceToCamera; + int _present; + int _isClickable; + int _isObstacle; + int _unknown1; + int _isTarget; + int _isMoving; + int _isRetired; +}; + +class SceneObjects { +#if _DEBUG + friend class BladeRunnerEngine; +#endif + BladeRunnerEngine *_vm; + +private: + View *_view; + int _count; + SceneObject *_sceneObjects; + int *_sceneObjectsSortedByDistance; + +public: + SceneObjects(BladeRunnerEngine *vm, View *view); + ~SceneObjects(); + bool addActor(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 unknown1, uint8 isTarget, uint8 isRetired); + bool addObject(int sceneObjectId, BoundingBox *boundingBox, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget); + bool addItem(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isTarget, uint8 isObstacle); + bool remove(int sceneObjectId); + void clear(); + int findByXYZ(int *isClickable, int *isObstacle, int *isTarget, float x, float y, float z, int findClickables, int findObstacles, int findTargets); + bool existsOnXZ(int exceptSceneObjectId, float x, float z, bool a5, bool a6); + void setMoving(int sceneObjectId, bool isMoving); + void setRetired(int sceneObjectId, bool isRetired); + bool isBetweenTwoXZ(int sceneObjectId, float x1, float z1, float x2, float z2); + void setIsClickable(int sceneObjectId, bool isClickable); + void setIsObstacle(int sceneObjectId, bool isObstacle); + void setIsTarget(int sceneObjectId, bool isTarget); + void updateObstacles(); + +private: + int findById(int sceneObjectId); + bool addSceneObject(int sceneObjectId, SceneObjectType sceneObjectType, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget, uint unknown2, uint isRetired); + int findEmpty(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/script/ai_00_mccoy.cpp b/engines/bladerunner/script/ai_00_mccoy.cpp new file mode 100644 index 0000000000..fa37efb63e --- /dev/null +++ b/engines/bladerunner/script/ai_00_mccoy.cpp @@ -0,0 +1,1852 @@ +/* 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/script/ai_00_mccoy.h" + +namespace BladeRunner { + +AIScript_McCoy::AIScript_McCoy(BladeRunnerEngine *vm) + : AIScriptBase(vm) { +} + +void AIScript_McCoy::Initialize() { + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + dword_45A0D8 = 0; + dword_45A0DC = 30; + dword_45A0E0 = 1; + dword_45A0E4 = 0; + off_45A0EC = 0; + dword_45A0E8 = 3; + dword_45A0F0 = 3; + dword_45A0F4 = 20; + dword_45A0F8 = -1; + dword_45A0FC = 0; + off_45A100 = 0; + Actor_Set_Goal_Number(0, 0); +} + +bool AIScript_McCoy::Update() { + if (dword_45A0F8 != -1) { + Sound_Play(dword_45A0F8, 100, 0, 0, 50); + dword_45A0F8 = -1; + } + switch (Actor_Query_Goal_Number(0)) { + case 101: + Actor_Set_Goal_Number(0, 102); + return true; + case 102: + if (Actor_Query_Inch_Distance_From_Waypoint(0, 316) < 36 && !Game_Flag_Query(375)) { + Actor_Change_Animation_Mode(0, 21); + Game_Flag_Set(375); + } + if (Actor_Query_Inch_Distance_From_Waypoint(0, 316) < 4) { + Actor_Set_Goal_Number(0, 103); + } + return true; + case 201: + Actor_Set_Goal_Number(0, 0); + if (Player_Query_Current_Set() == 55) { + Loop_Actor_Walk_To_XYZ(0, -166.0f, -70.19f, -501.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 300, false); + } else { + Loop_Actor_Walk_To_XYZ(0, -461.0f, 0.0f, -373.0f, 0, 0, false, 0); + } + Player_Gains_Control(); + return true; + case 212: + if (Global_Variable_Query(47) >= 13) { + Global_Variable_Set(47, 500); + } else if (Global_Variable_Query(47) > 0) { + Global_Variable_Decrement(47, 1); + } + break; + case 221: + Actor_Set_Goal_Number(0, 0); + Actor_Set_Goal_Number(18, 212); + return true; + case 309: + sub_4053E0(); + break; + case 391: + Actor_Retired_Here(0, 12, 48, 1, -1); + Actor_Set_Goal_Number(0, 599); + break; + case 231: + sub_4053E0(); + break; + } + return false; +} + +void AIScript_McCoy::TimerExpired(int timer) { +} + +void AIScript_McCoy::CompletedMovementTrack() { +} + +void AIScript_McCoy::ReceivedClue(int clueId, int fromActorId) { + switch (clueId) { + case 8: + case 9: + Spinner_Set_Selectable_Destination_Flag(3, 1); + break; + case 44: + case 47: + Spinner_Set_Selectable_Destination_Flag(4, 1); + break; + case 53: + case 263: + if (Query_Difficulty_Level() == 0) { + Spinner_Set_Selectable_Destination_Flag(4, 1); + } + break; + case 90: + Spinner_Set_Selectable_Destination_Flag(8, 1); + break; + case 84: + case 113: + case 114: + case 115: + case 118: + Spinner_Set_Selectable_Destination_Flag(9, 1); + Spinner_Set_Selectable_Destination_Flag(8, 1); + break; + case 66: + case 80: + case 82: + case 83: + Global_Variable_Increment(49, 1); + break; + case 125: + Global_Variable_Increment(49, 5); + break; + case 124: + case 128: + Global_Variable_Increment(49, 3); + break; + case 120: + case 121: + Global_Variable_Increment(49, 2); + break; + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + Global_Variable_Increment(48, 1); + break; + } + if (Global_Variable_Query(49) > 6 && Global_Variable_Query(1) > 3 && !Actor_Clue_Query(0, 126)) { + Delay(500); + Actor_Voice_Over(3320, 99); + switch (clueId) { + case 66: + case 80: + case 82: + case 83: + case 121: + case 128: + Actor_Voice_Over(3340, 99); + Actor_Voice_Over(3350, 99); + Actor_Voice_Over(3360, 99); + Actor_Voice_Over(3370, 99); + Actor_Voice_Over(3380, 99); + break; + case 124: + Actor_Voice_Over(3330, 99); + break; + case 120: + Actor_Voice_Over(3390, 99); + Actor_Voice_Over(3400, 99); + Actor_Voice_Over(3420, 99); + break; + } + Actor_Clue_Acquire(0, 126, 1, -1); + if (clueId == 125) { + Actor_Voice_Over(2780, 99); + Actor_Voice_Over(2800, 99); + Actor_Voice_Over(2810, 99); + } else if (Actor_Clue_Query(0, 125)) { + Actor_Voice_Over(3430, 99); + Actor_Voice_Over(3440, 99); + Actor_Voice_Over(3450, 99); + Actor_Voice_Over(3460, 99); + Actor_Voice_Over(3470, 99); + Actor_Voice_Over(3480, 99); + Actor_Voice_Over(3490, 99); + Actor_Voice_Over(3500, 99); + } else { + Actor_Voice_Over(3510, 99); + Actor_Voice_Over(3520, 99); + Actor_Voice_Over(3530, 99); + Actor_Voice_Over(3540, 99); + } + } +} + +void AIScript_McCoy::ClickedByPlayer() { +} + +void AIScript_McCoy::EnteredScene(int sceneId) { +} + +void AIScript_McCoy::OtherAgentEnteredThisScene() { +} + +void AIScript_McCoy::OtherAgentExitedThisScene() { +} + +void AIScript_McCoy::OtherAgentEnteredCombatMode() { +} + +void AIScript_McCoy::ShotAtAndMissed() { +} + +void AIScript_McCoy::ShotAtAndHit() { +} + +void AIScript_McCoy::Retired(int byActorId) { + if (byActorId == 1 && Actor_Query_In_Set(1, 42)) { + if (Actor_Query_In_Set(3, 42) && Actor_Query_Goal_Number(3) != 599) { + Non_Player_Actor_Combat_Mode_On(1, 3, 1, 3, 15, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } else if (Actor_Query_In_Set(6, 42) && Actor_Query_Goal_Number(6) != 599) { + Non_Player_Actor_Combat_Mode_On(1, 3, 1, 6, 15, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } + } + if (Actor_Query_In_Set(0, 41) && Actor_Query_In_Set(23, 41) && Actor_Query_In_Set(3, 41) && Actor_Query_Goal_Number(3) != 599) { + Non_Player_Actor_Combat_Mode_On(23, 3, 1, 3, 4, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } + if (Actor_Query_In_Set(0, 41) && Actor_Query_In_Set(24, 41) && Actor_Query_In_Set(3, 41) && Actor_Query_Goal_Number(3) != 599) { + Non_Player_Actor_Combat_Mode_On(24, 3, 1, 3, 4, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } + if (Actor_Query_In_Set(0, 41) && Actor_Query_In_Set(23, 41) && Actor_Query_In_Set(6, 41) && Actor_Query_Goal_Number(6) != 599) { + Non_Player_Actor_Combat_Mode_On(23, 3, 1, 6, 4, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } + if (Actor_Query_In_Set(0, 41) && Actor_Query_In_Set(24, 41) && Actor_Query_In_Set(6, 41) && Actor_Query_Goal_Number(6) != 599) { + Non_Player_Actor_Combat_Mode_On(24, 3, 1, 6, 4, 4, 7, 8, 0, 0, 100, 25, 300, 0); + } +} + +void AIScript_McCoy::GetFriendlinessModifierIfGetsClue() { +} + +bool AIScript_McCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) { + unsigned int v5; + unsigned int v7; + + switch (newGoalNumber) { + case 0: + return true; + case 1: + sub_4058B0(); + return true; + case 2: + sub_405920(); + return true; + case 100: + Actor_Set_At_Waypoint(0, 315, 263); + dword_45A0D0_animation_state = 53; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + Actor_Set_Invisible(0, false); + return true; + case 102: + Async_Actor_Walk_To_Waypoint(0, 316, 0, 1); + return true; + case 103: + Actor_Face_Actor(0, 8, true); + return true; + case 231: + Player_Set_Combat_Mode(false); + Preload(18); + Set_Enter(59, 63); + Player_Loses_Control(); + Actor_Force_Stop_Walking(0); + Actor_Put_In_Set(0, 59); + Actor_Set_At_XYZ(0, 14.0f, 110.84f, -300.0f, 926); + Actor_Change_Animation_Mode(0, 48); + dword_45A0D0_animation_state = 27; + dword_45A0D4_animation_frame = 0; + flt_462714 = 2.84f; + flt_462710 = 110.84f; + off_45A100 = -6.0f; + return true; + case 230: + dword_45A0FC = Actor_Query_Goal_Number(1) == 215; + Actor_Change_Animation_Mode(0, 6); + return true; + case 220: + Actor_Change_Animation_Mode(0, 75); + return true; + case 212: + Global_Variable_Set(47, 0); + Player_Set_Combat_Mode_Access(false); + Player_Gains_Control(); + Scene_Exits_Disable(); + dword_45A0D0_animation_state = 68; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + return true; + case 211: + Actor_Face_Heading(0, 512, false); + Actor_Face_Heading(0, 768, true); + if (Random_Query(0, 1)) { + Actor_Change_Animation_Mode(0, 18); + } else { + Actor_Change_Animation_Mode(0, 16); + } + Delay(150); + Actor_Change_Animation_Mode(0, 0); + Actor_Set_Goal_Number(0, 0); + Player_Gains_Control(); + return true; + case 210: + Actor_Put_In_Set(0, 54); + Actor_Set_At_XYZ(0, -204.0, 24.0, -817.0, 256); + Actor_Set_Invisible(0, false); + if (Game_Flag_Query(627)) { + Actor_Set_Goal_Number(0, 212); + } else { + dword_45A0D0_animation_state = 53; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + Actor_Set_Invisible(0, false); + } + return true; + case 200: + Player_Loses_Control(); + Actor_Change_Animation_Mode(0, 0); + return true; + case 301: + dword_45A0D0_animation_state = 62; + dword_45A0D4_animation_frame = 0; + return true; + case 302: + dword_45A0D0_animation_state = 64; + dword_45A0D4_animation_frame = 0; + return true; + case 303: + dword_45A0D0_animation_state = 65; + dword_45A0D4_animation_frame = 0; + return true; + case 350: + Sound_Play(123, 50, 0, 0, 50); + Delay(1000); + Sound_Play(403, 30, 0, 0, 50); + Delay(1000); + Sound_Play(123, 50, 0, 0, 50); + Actor_Says(4, 1380, 3); + Actor_Says(0, 6610, 13); + Actor_Says(4, 1390, 3); + Actor_Says(0, 6615, 18); + Actor_Says(4, 1420, 3); + Actor_Says(0, 6625, 11); + Actor_Says(4, 1430, 3); + Actor_Says(0, 6630, 12); + Actor_Says(0, 6635, 17); + Actor_Says(0, 6640, 13); + Actor_Says(0, 6645, 19); + Actor_Says(0, 6650, 18); + Actor_Says(0, 6655, 11); + Actor_Says(4, 1440, 3); + Actor_Says(0, 6660, 17); + Actor_Says(0, 6665, 13); + Delay(1000); + Actor_Says(4, 1450, 3); + Actor_Says(0, 6670, 14); + Actor_Says(0, 6675, 11); + Actor_Says(4, 1460, 3); + Actor_Says(0, 6680, 12); + Actor_Says(4, 1470, 3); + Actor_Says(0, 6685, 13); + Delay(500); + Actor_Says(0, 6695, 16); + Actor_Says(0, 6700, 17); + Actor_Says(4, 1480, 3); + Actor_Says(0, 6705, 11); + Sound_Play(123, 50, 0, 0, 50); + return true; + case 390: + Actor_Force_Stop_Walking(0); + Player_Loses_Control(); + flt_462710 = 48.07f; + off_45A100 = -4.0f; + flt_462714 = -20.0f; + if (dword_45A0D0_animation_state != 27 && dword_45A0D0_animation_state != 50) { + dword_45A0D0_animation_state = 50; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + } + return true; + case 400: + Actor_Set_Health(0, 50, 50); + Game_Flag_Set(373); + v5 = Global_Variable_Query(45); + if (v5 == 1) { + Actor_Modify_Friendliness_To_Other(1, 0, 3); + } else if (v5 == 2) { + Actor_Modify_Friendliness_To_Other(1, 0, -5); + Actor_Modify_Friendliness_To_Other(5, 0, 3); + } else if (v5 == 3) { + Actor_Modify_Friendliness_To_Other(1, 0, -5); + Actor_Modify_Friendliness_To_Other(5, 0, 5); + } + if (Game_Flag_Query(666)) { + Actor_Modify_Friendliness_To_Other(1, 0, 3); + } + if (Actor_Query_Friendliness_To_Other(1, 0) < Actor_Query_Friendliness_To_Other(5, 0)) { + Game_Flag_Set(653); + } + v7 = Global_Variable_Query(45); + if (v7 == 1) { + if (Game_Flag_Query(653)) { + Global_Variable_Set(45, 0); + } + } else if (v7 == 2 || v7 == 3) { + if (!Game_Flag_Query(653)) { + Global_Variable_Set(45, 0); + } + } + if (!Game_Flag_Query(653)) { + Game_Flag_Set(461); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Global_Variable_Set(1, 5); + Outtake_Play(10, 0, -1); + if (Game_Flag_Query(666)) { + Chapter_Enter(5, 53, 53); + } else { + Game_Flag_Set(34); + Chapter_Enter(5, 10, 49); + } + return true; + case 500: + Music_Stop(3); + Player_Set_Combat_Mode(false); + Actor_Change_Animation_Mode(0, 0); + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + Game_Flag_Set(465); + Set_Enter(67, 72); + return true; + } + return false; +} + +bool AIScript_McCoy::UpdateAnimation(int *animation, int *frame) { + int v7, v18, v19, v46; + switch (dword_45A0D0_animation_state) { + case 71: + *animation = 52; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(52)) { + Actor_Change_Animation_Mode(0, 0); + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + Player_Gains_Control(); + } + break; + case 70: + *animation = 51; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(51)) { + dword_45A0D4_animation_frame = 0; + } + break; + case 69: + *animation = 50; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(50)) { + Actor_Change_Animation_Mode(0, 53); + *animation = 51; + } + break; + case 68: + *animation = 18; + v7 = Slice_Animation_Query_Number_Of_Frames(*animation) - 1 - Global_Variable_Query(47); + if (dword_45A0D4_animation_frame < v7) { + dword_45A0D4_animation_frame++; + } else if (dword_45A0D4_animation_frame > v7) { + dword_45A0D4_animation_frame--; + } + if (dword_45A0D4_animation_frame <= 0) { + Actor_Change_Animation_Mode(0, 0); + *animation = 19; + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + Game_Flag_Reset(627); + Scene_Exits_Enable(); + Player_Set_Combat_Mode_Access(true); + Actor_Set_Goal_Number(0, 0); + } + break; + case 67: + *animation = 53; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(53)) { + Actor_Change_Animation_Mode(0, 0); + *animation = 19; + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + if (Actor_Query_Goal_Number(0) == 220) { + Actor_Change_Animation_Mode(0, 48); + } + } + break; + case 66: + *animation = 40; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(40)) { + Actor_Change_Animation_Mode(0, 0); + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + } + break; + case 65: + *animation = 45; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(45)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 14; + *animation = 0; + Actor_Set_Goal_Number(0, 0); + } + break; + case 64: + *animation = 44; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(44)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 63; + *animation = 43; + } + break; + case 63: + *animation = 43; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(43)) { + dword_45A0D4_animation_frame = 0; + } + break; + case 62: + *animation = 42; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(42)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 63; + *animation = 43; + } + break; + case 61: + *animation = 41; + dword_45A0D4_animation_frame--; + if (dword_45A0D4_animation_frame <= 0) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + if (Actor_Query_Goal_Number(0) == 200) { + Actor_Set_Goal_Number(0, 201); + } + } + break; + case 60: + *animation = 41; + if (dword_45A0D4_animation_frame < Slice_Animation_Query_Number_Of_Frames(41) - 1) { + dword_45A0D4_animation_frame++; + } + return true; + case 59: + *animation = 48; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(48)) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0DC = 0; + dword_45A0D0_animation_state = 0; + Player_Gains_Control(); + Item_Add_To_World(109, 982, 6, -110.0, 0.0, -192.0, 0, 48, 32, false, true, false, false); + } + break; + case 58: + *animation = 47; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame == 6) { + v18 = Random_Query(0, 2); + v19 = 0; + if (v18 == 0) { + v19 = 595; + } else if (v18 == 1) { + v19 = 594; + } else if (v18 == 2) { + v19 = 593; + } + Ambient_Sounds_Play_Sound(v19, 39, 0, 0, 99); + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) { //why -1? + dword_45A0D4_animation_frame = 0; + } + break; + case 57: + *animation = 46; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(46)) { + dword_45A0D4_animation_frame = 0; + } + if (!Game_Flag_Query(550)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 59; + *animation = 48; + } + break; + case 56: + *animation = 49; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(49)) { + dword_45A0D4_animation_frame = 0; + if (Actor_Query_Which_Set_In(0) == 87) { + dword_45A0D0_animation_state = 27; + } else { + *animation = 19; + dword_45A0D0_animation_state = 0; + Actor_Change_Animation_Mode(0, 0); + } + } + break; + case 55: + *animation = 32; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame == 7) { + Actor_Change_Animation_Mode(66, 52); + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { + *animation = 19; + dword_45A0D0_animation_state = 0; + } + break; + case 53: + *animation = 18; + dword_45A0D4_animation_frame--; + if (dword_45A0D4_animation_frame <= 0) { + Actor_Change_Animation_Mode(0, 0); + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + if (Actor_Query_Goal_Number(0) == 100) { + Actor_Set_Goal_Number(0, 101); + } + if (Actor_Query_Goal_Number(0) == 210) { + Actor_Set_Goal_Number(0, 211); + } + } + break; + case 52: + *animation = 31; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(31)) { + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(31) - 1; + dword_45A0D0_animation_state = 50; + } + break; + case 51: + *animation = 28; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(28)) { + Player_Set_Combat_Mode(true); + sub_405800(); + Actor_Set_Goal_Number(0, 0); + dword_45A0D4_animation_frame = 0; + Player_Gains_Control(); + } + break; + case 50: + *animation = 18; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + break; + case 49: + *animation = 34; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(34)) { + Actor_Set_Goal_Number(0, 0); + *animation = 19; + dword_45A0D4_animation_frame = 0; + sub_405660(); + } + break; + case 48: + *animation = 33; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(33)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 49; + *animation = 34; + } + break; + case 47: + *animation = 29; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(29)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 48; + *animation = 33; + } + break; + case 46: + Actor_Set_Invisible(0, false); + *animation = 36; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(36)) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + Player_Gains_Control(); + sub_405660(); + Actor_Face_Heading(0, (Actor_Query_Facing_1024(0) + 512) & 1023, false); + } + break; + case 45: + *animation = 35; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(35)) { + Actor_Set_Invisible(0, true); + *animation = 19; + dword_45A0D4_animation_frame = 0; + sub_405660(); + } + break; + case 44: + *animation = 30; + if (dword_45A0D4_animation_frame++ == 127) { + Game_Flag_Set(325); + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(30)) { + *animation = 19; + sub_405660(); + Actor_Set_At_XYZ(0, -203.41f, -621.3f, 724.57f, 538); + Player_Gains_Control(); + } + break; + case 43: + *animation = 38; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(38) - 1) { //why -1? + dword_45A0D4_animation_frame = 0; + } + switch (dword_45A0D4_animation_frame) { + case 9: + Sound_Left_Footstep_Walk(0); + break; + case 4: + Sound_Right_Footstep_Walk(0); + break; + case 1: + Sound_Right_Footstep_Walk(0); + break; + } + break; + case 42: + *animation = 37; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(37) - 1) { //why -1? + dword_45A0D4_animation_frame = 0; + } + switch (dword_45A0D4_animation_frame) { + case 9: + Sound_Left_Footstep_Walk(0); + break; + case 4: + Sound_Right_Footstep_Walk(0); + break; + case 1: + Sound_Right_Footstep_Walk(0); + break; + } + break; + case 41: + *animation = 7; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(7)) { + dword_45A0D4_animation_frame = 0; + ++off_45A0EC; + } + if (dword_45A0D4_animation_frame == 9) { + Sound_Left_Footstep_Walk(0); + } else if (dword_45A0D4_animation_frame == 4) { + Sound_Right_Footstep_Walk(0); + } + if (Game_Flag_Query(359)) { + sub_4059D0(-0.2f); + } + break; + case 40: + *animation = 6; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(6)) { + dword_45A0D4_animation_frame = 0; + ++off_45A0EC; + } + if (dword_45A0D4_animation_frame == 8) { + Sound_Left_Footstep_Walk(0); + } else if (dword_45A0D4_animation_frame == 3) { + Sound_Right_Footstep_Walk(0); + } + if (Game_Flag_Query(358)) { + sub_405940(0.5f); + } + break; + case 39: + *animation = 16; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(16)) { + dword_45A0D4_animation_frame = 0; + ++off_45A0EC; + } + if (dword_45A0D4_animation_frame == 8) { + Sound_Left_Footstep_Walk(0); + } else if (dword_45A0D4_animation_frame == 3) { + Sound_Right_Footstep_Walk(0); + } + if (Game_Flag_Query(359)) { + sub_4059D0(-0.2f); + } + break; + case 38: + *animation = 15; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(15)) { + dword_45A0D4_animation_frame = 0; + ++off_45A0EC; + } + if (dword_45A0D4_animation_frame == 9) { + Sound_Left_Footstep_Walk(0); + } else if (dword_45A0D4_animation_frame == 4) { + Sound_Right_Footstep_Walk(0); + } + if (Game_Flag_Query(358)) { + sub_405940(0.5f); + } + break; + case 37: + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(4)) { + dword_45A0D4_animation_frame = 0; + } + *animation = 4; + if (dword_45A0D4_animation_frame == 6) { + Sound_Left_Footstep_Run(0); + } + if (dword_45A0D4_animation_frame == 0) { + Sound_Right_Footstep_Run(0); + } + break; + case 36: + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(3)) { + dword_45A0D4_animation_frame = 0; + } + *animation = 3; + if (dword_45A0D4_animation_frame == 15) { + Sound_Left_Footstep_Walk(0); + } + if (dword_45A0D4_animation_frame == 6) { + Sound_Right_Footstep_Walk(0); + } + break; + case 32: + dword_45A0D4_animation_frame = 1; + dword_45A0D0_animation_state = 30; + *animation = 13; + break; + case 31: + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(14)) { + dword_45A0D4_animation_frame = 0; + } + *animation = 14; + if (dword_45A0D4_animation_frame == 5) { + Sound_Left_Footstep_Run(0); + } else if (dword_45A0D4_animation_frame == 12) { + Sound_Right_Footstep_Run(0); + } + break; + case 30: + *animation = 13; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(13)) { + dword_45A0D4_animation_frame = 0; + } + if (dword_45A0D4_animation_frame == 2) { + Sound_Right_Footstep_Walk(0); + } else if (dword_45A0D4_animation_frame == 10) { + Sound_Left_Footstep_Walk(0); + } + break; + case 29: + v46 = dword_45A0D4_animation_frame + dword_45A0E0; + *animation = 18; + dword_45A0D4_animation_frame = v46; + if (v46 < 14) { + dword_45A0E0 = 1; + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { + Actor_Change_Animation_Mode(0, 48); + *animation = 18; + dword_45A0D0_animation_state = 27; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + } + break; + case 28: + *animation = 5; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(5)) { + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; + dword_45A0D0_animation_state = 50; + sub_4054F0(); + } + break; + case 27: + *animation = 18; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(18)) { + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; + dword_45A0D0_animation_state = 50; + sub_4054F0(); + if (Actor_Query_Goal_Number(0) == 220) { + Actor_Set_Goal_Number(0, 221); + } + } + break; + case 26: + *animation = 17; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(17)) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + Actor_Change_Animation_Mode(0, 0); + } + break; + case 25: + *animation = 17; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(17)) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + Actor_Change_Animation_Mode(0, 0); + } + break; + case 24: + *animation = 1; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(1)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 14; + *animation = 0; + Actor_Change_Animation_Mode(0, 4); + } + break; + case 23: + *animation = 1; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(1)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 14; + *animation = 0; + Actor_Change_Animation_Mode(0, 4); + } + break; + case 22: + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 17; + *animation = 12; + break; + case 21: + *animation = 12; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame == 1 && Actor_Query_Goal_Number(0) == 230 && dword_45A0FC == 1) { + dword_45A0F8 = 27; + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(12)) { + dword_45A0D0_animation_state = 17; + dword_45A0D4_animation_frame = 0; + *animation = 12; + if (Actor_Query_Goal_Number(0) == 230) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 21; + dword_45A0FC = 1; + *animation = 12; + } + } + break; + case 19: + *animation = 11; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= 12) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 14; + *animation = 0; + } + break; + case 18: + *animation = 10; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(10)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 17; + *animation = 12; + } + break; + case 17: + *animation = 12; + dword_45A0D4_animation_frame = 0; + // weird, but thats in game code + if (Slice_Animation_Query_Number_Of_Frames(12) <= 0) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 17; + } + break; + case 16: + *animation = 9; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(9)) { + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + } + break; + case 15: + *animation = 8; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(8)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 14; + *animation = 0; + } + break; + case 14: + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(0)) { + dword_45A0D0_animation_state = 14; + dword_45A0D4_animation_frame = 0; + } + *animation = 0; + break; + case 13: + *animation = 19; + if (dword_45A0D4_animation_frame < Slice_Animation_Query_Number_Of_Frames(19) / 2) { + dword_45A0D4_animation_frame -= 3; + if (dword_45A0D4_animation_frame <= 0) { + dword_45A0D4_animation_frame = 0; + *animation = dword_46271C; + dword_45A0D0_animation_state = dword_462718; + } + } else { + dword_45A0D4_animation_frame += 3; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(19)) { + dword_45A0D4_animation_frame = 0; + *animation = dword_46271C; + dword_45A0D0_animation_state = dword_462718; + } + } + break; + case 12: + *animation = 27; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(27)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 11: + *animation = 26; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(26)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 10: + *animation = 25; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(25)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 9: + *animation = 24; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(24)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 8: + *animation = 23; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(23)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 7: + *animation = 22; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(22)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 6: + *animation = 27; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(27)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 5: + *animation = 21; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(21)) { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 3; + *animation = 20; + } + break; + case 3: + case 4: + if (dword_45A0D4_animation_frame == 0 && !Game_Flag_Query(236)) { + dword_45A0D4_animation_frame = 1; + dword_45A0D0_animation_state = dword_45A0F0; + *animation = dword_45A0F4; + dword_45A0F0 = 4; + dword_45A0F4 = 20; + } else if (dword_45A0D4_animation_frame <= 4 && Game_Flag_Query(236)) { + Game_Flag_Reset(236); + *animation = 19; + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 0; + } else { + *animation = 20; + dword_45A0D4_animation_frame++; + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(20)) { + dword_45A0D4_animation_frame = 0; + } + } + break; + case 0: + *animation = 19; + if (dword_45A0D8 < dword_45A0DC) { + //*frame = dword_45A0E8; + dword_45A0D4_animation_frame += dword_45A0E0; + if (dword_45A0D4_animation_frame > dword_45A0E8) { + dword_45A0D4_animation_frame = dword_45A0E8; + dword_45A0E0 = -1; + } else if (dword_45A0D4_animation_frame < dword_45A0E4) { + dword_45A0D4_animation_frame = dword_45A0E4; + dword_45A0E0 = 1; + } + dword_45A0D8++; + } else { + dword_45A0D4_animation_frame += dword_45A0E0; + dword_45A0DC = 0; + if (dword_45A0D4_animation_frame == 18 && Random_Query(0, 2)) { + dword_45A0E0 = -1; + dword_45A0D8 = 0; + dword_45A0E4 = 14; + dword_45A0E8 = 18; + dword_45A0DC = Random_Query(0, 30); + } + if (dword_45A0D4_animation_frame == 26) { + if (Random_Query(0, 2)) { + dword_45A0E0 = -1; + dword_45A0D8 = 0; + dword_45A0E4 = 23; + dword_45A0E8 = 26; + dword_45A0DC = Random_Query(0, 30); + } + } + if (dword_45A0D4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(19)) { + dword_45A0D4_animation_frame = 0; + if (Random_Query(0, 2)) { + dword_45A0D8 = 0; + dword_45A0E4 = 0; + dword_45A0E8 = 3; + dword_45A0DC = Random_Query(0, 45); + } + } + if (dword_45A0D4_animation_frame < 0) { + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(19) - 1; + } + } + break; + } + *frame = dword_45A0D4_animation_frame; + return true; +} + +bool AIScript_McCoy::ChangeAnimationMode(int mode) { + int v2; + switch (mode) { + case 85: + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 69; + return true; + case 75: + dword_45A0D0_animation_state = 67; + dword_45A0D4_animation_frame = 0; + return true; + case 68: + dword_45A0D0_animation_state = 29; + dword_45A0D4_animation_frame = Slice_Animation_Query_Number_Of_Frames(18) - 1; + dword_45A0E0 = -1; + return true; + case 65: + case 67: + dword_45A0D0_animation_state = 43; + dword_45A0D4_animation_frame = 0; + return true; + case 64: + case 66: + dword_45A0D0_animation_state = 42; + dword_45A0D4_animation_frame = 0; + return true; + case 53: + if (dword_45A0D0_animation_state != 60 && (Player_Query_Current_Set() == 55 || Player_Query_Current_Set() == 13)) { + dword_45A0D0_animation_state = 60; + dword_45A0D4_animation_frame = 0; + } else { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 70; + } + return true; + case 52: + dword_45A0D0_animation_state = 55; + dword_45A0D4_animation_frame = 0; + return true; + case 51: + dword_45A0D0_animation_state = 27; + dword_45A0D4_animation_frame = 0; + return true; + case 49: + dword_45A0D0_animation_state = 28; + dword_45A0D4_animation_frame = 0; + return true; + case 48: + switch (dword_45A0D0_animation_state) { + case 14: + dword_45A0D0_animation_state = 28; + dword_45A0D4_animation_frame = 0; + break; + case 13: + dword_45A0D0_animation_state = 22; + dword_45A0D4_animation_frame = 0; + return true; + case 10: + dword_45A0D0_animation_state = 18; + dword_45A0D4_animation_frame = 8 * (13 - dword_45A0D4_animation_frame) / 13; + return true; + case 8: + case 9: + case 12: + return true; + case 11: + dword_45A0D0_animation_state = 18; + dword_45A0D4_animation_frame = 0; + break; + case 7: + dword_45A0D0_animation_state = 14; + dword_45A0D4_animation_frame = 0; + break; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + dword_45A0D0_animation_state = 15; + dword_45A0D4_animation_frame = 0; + break; + default: + if (dword_45A0D0_animation_state != 50) { + dword_45A0D0_animation_state = 27; + dword_45A0D4_animation_frame = 0; + } + break; + } + return true; + case 47: + dword_45A0D0_animation_state = 41; + dword_45A0D4_animation_frame = 0; + return true; + case 46: + dword_45A0D0_animation_state = 40; + dword_45A0D4_animation_frame = 0; + return true; + case 45: + dword_45A0D0_animation_state = 39; + dword_45A0D4_animation_frame = 0; + return true; + case 44: + dword_45A0D0_animation_state = 38; + dword_45A0D4_animation_frame = 0; + return true; + case 42: + dword_45A0D0_animation_state = 46; + dword_45A0D4_animation_frame = 0; + Player_Loses_Control(); + return true; + case 41: + dword_45A0D0_animation_state = 45; + dword_45A0D4_animation_frame = 0; + return true; + case 40: + dword_45A0D0_animation_state = 44; + dword_45A0D4_animation_frame = 0; + return true; + case 39: + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 52; + if (Player_Query_Current_Set() == 27) { + dword_45A0D4_animation_frame = 23; + } + return true; + case 38: + dword_45A0D0_animation_state = 47; + dword_45A0D4_animation_frame = 0; + return true; + case 29: + Player_Loses_Control(); + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 71; + return true; + case 23: + dword_45A0D0_animation_state = 66; + dword_45A0D4_animation_frame = 0; + return true; + case 22: + if (Random_Query(0, 1)) { + dword_45A0D0_animation_state = 23; + } else { + dword_45A0D0_animation_state = 24; + } + dword_45A0D4_animation_frame = 0; + return true; + case 21: + switch (dword_45A0D0_animation_state) { + case 0: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + dword_45A0D0_animation_state = 28; + dword_45A0D4_animation_frame = 0; + break; + case 1: + case 8: + dword_45A0D0_animation_state = 27; + dword_45A0D4_animation_frame = 0; + break; + default: + + if (Random_Query(0, 1)) { + dword_45A0D0_animation_state = 26; + } else { + dword_45A0D0_animation_state = 25; + } + dword_45A0D4_animation_frame = 0; + break; + } + return true; + case 20: + v2 = Actor_Query_Which_Set_In(0); + if (v2 == 27) { + dword_45A0D0_animation_state = 51; + dword_45A0D4_animation_frame = 0; + Player_Loses_Control(); + Game_Flag_Set(210); + } else if (v2 == 70 || v2 == 87) { + dword_45A0D0_animation_state = 56; + dword_45A0D4_animation_frame = 0; + } + return true; + case 19: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 12; + dword_46271C = 27; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 12; + dword_45A0F4 = 27; + } + return true; + case 18: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 11; + dword_46271C = 26; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 11; + dword_45A0F4 = 26; + } + return true; + case 17: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 10; + dword_46271C = 25; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 10; + dword_45A0F4 = 25; + } + return true; + case 16: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 9; + dword_46271C = 24; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 9; + dword_45A0F4 = 24; + } + return true; + case 15: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 8; + dword_46271C = 23; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 8; + dword_45A0F4 = 23; + } + return true; + case 11: + case 14: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 7; + dword_46271C = 22; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 7; + dword_45A0F4 = 22; + } + return true; + case 10: + case 13: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 6; + dword_46271C = 27; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 6; + dword_45A0F4 = 27; + } + return true; + case 9: + case 12: + if (dword_45A0D0_animation_state < 3 || dword_45A0D0_animation_state > 12) { + dword_45A0D0_animation_state = 13; + dword_462718 = 5; + dword_46271C = 21; + } else { + Game_Flag_Reset(236); + dword_45A0F0 = 5; + dword_45A0F4 = 21; + } + return true; + case 8: + if (dword_45A0D0_animation_state != 27 && dword_45A0D0_animation_state != 50) { + dword_45A0D0_animation_state = 37; + dword_45A0D4_animation_frame = 0; + } + return true; + case 7: + if (dword_45A0D0_animation_state != 27 && dword_45A0D0_animation_state != 50) { + dword_45A0D0_animation_state = 36; + dword_45A0D4_animation_frame = 0; + } + return true; + case 6: + dword_45A0D0_animation_state = 21; + dword_45A0D4_animation_frame = 0; + return true; + case 5: + switch (dword_45A0D0_animation_state) { + case 1: + case 2: + case 5: + dword_45A0D0_animation_state = 14; + dword_45A0D4_animation_frame = 0; + break; + case 0: + case 3: + case 4: + dword_45A0D0_animation_state = 15; + dword_45A0D4_animation_frame = 0; + break; + default: + dword_45A0D0_animation_state = 18; + dword_45A0D4_animation_frame = 0; + break; + } + return true; + case 4: + switch (dword_45A0D0_animation_state) { + case 22: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 41; + break; + case 18: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 13 * ((8 - dword_45A0D4_animation_frame) / 8); + break; + case 17: + case 20: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 0; + break; + case 16: + dword_45A0D0_animation_state = 15; + dword_45A0D4_animation_frame = 12 - 12 * dword_45A0D4_animation_frame / 16; + break; + case 14: + case 15: + case 19: + case 21: + case 2: + case 3: + return true; + default: + dword_45A0D0_animation_state = 15; + dword_45A0D4_animation_frame = 0; + break; + case 13: + dword_45A0D0_animation_state = 16; + dword_45A0D4_animation_frame = 0; + break; + case 0: + case 1: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + dword_45A0DC = 0; + break; + } + return true; + case 3: + if (dword_45A0D0_animation_state >= 3 && dword_45A0D0_animation_state <= 12) { + Game_Flag_Reset(236); + dword_45A0F0 = 4; + dword_45A0F4 = 20; + } else { + dword_45A0D0_animation_state = 13; + dword_462718 = 3; + dword_46271C = 20; + } + return true; + case 2: + if (dword_45A0D0_animation_state == 27 || dword_45A0D0_animation_state == 50) { + return true; + } + if (!Game_Flag_Query(550)) { + dword_45A0D0_animation_state = 31; + dword_45A0D4_animation_frame = 0; + return true; + } + dword_45A0D0_animation_state = 58; + dword_45A0D4_animation_frame = 4; + return true; + case 1: + if (dword_45A0D0_animation_state == 27 || dword_45A0D0_animation_state == 50) { + return true; + } + if (!Game_Flag_Query(550)) { + dword_45A0D0_animation_state = 32; + dword_45A0D4_animation_frame = 0; + return true; + } + dword_45A0D0_animation_state = 58; + dword_45A0D4_animation_frame = 0; + return true; + case 0: + if (Game_Flag_Query(550)) { + if (dword_45A0D4_animation_frame > 6) { + dword_45A0D0_animation_state = 57; + dword_45A0D4_animation_frame = 0; + return true; + } + int v3 = Random_Query(0, 2); + int v4 = 0; + if (v3 == 0) { + v4 = 595; + } else if (v3 == 1) { + v4 = 594; + } else if (v3 == 2) { + v4 = 593; + } + Ambient_Sounds_Play_Sound(v4, 39, 0, 0, 99); + dword_45A0D0_animation_state = 57; + dword_45A0D4_animation_frame = 0; + return true; + } + if (dword_45A0D0_animation_state == 60) { + dword_45A0D0_animation_state = 61; + return true; + } + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + dword_45A0DC = 0; + return true; + } + return true; +} + +void AIScript_McCoy::QueryAnimationState(int *animationState, int *a2, int *a3, int *a4) { + *animationState = dword_45A0D0_animation_state; + *a2 = dword_45A0D4_animation_frame; + *a3 = dword_462718; + *a4 = dword_46271C; +} + +void AIScript_McCoy::SetAnimationState(int animationState, int a2, int a3, int a4) { + dword_45A0D0_animation_state = animationState; + dword_45A0D4_animation_frame = a2; + dword_462718 = a3; + dword_46271C = a4; +} + +bool AIScript_McCoy::ReachedMovementTrackWaypoint() { + return true; +} + +void AIScript_McCoy::sub_4053E0() { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + flt_462710 = flt_462710 + off_45A100; + if (flt_462714 < flt_462710) { + off_45A100 = off_45A100 - 0.2f; + } else { + flt_462710 = flt_462714; + Actor_Set_Goal_Number(0, 0); + Actor_Retired_Here(0, 12, 48, 1, -1); + } + return Actor_Set_At_XYZ(0, x, flt_462710, z, Actor_Query_Facing_1024(0)); +} + +void AIScript_McCoy::sub_4054F0() { + if (Actor_Query_Which_Set_In(0) == 87 && Actor_Query_Goal_Number(0) != 390 && !Game_Flag_Query(682)) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if ((z < 220.0f) && (-210.0f < x) && (-70.0f > x)) { + Game_Flag_Set(682); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Actor_Set_Goal_Number(0, 390); + Actor_Query_XYZ(64, &x, &y, &z); + if (-200.0 < x && -62.0f > x) { + Actor_Set_Goal_Number(64, 309); + } + } else { + Actor_Set_Goal_Number(0, 391); + } + } +} + +void AIScript_McCoy::sub_405660() { + if (Game_Flag_Query(550)) { + if (dword_45A0D4_animation_frame <= 6) { + int v1 = Random_Query(0, 2); + int v2 = 0; + if (v1 == 0) { + v2 = 595; + } else if (v1 == 1) { + v2 = 594; + } else if (v1 == 2) { + v2 = 593; + } + Ambient_Sounds_Play_Sound(v2, 39, 0, 0, 99); + } + dword_45A0D0_animation_state = 57; + dword_45A0D4_animation_frame = 0; + return; + } + switch (dword_45A0D0_animation_state) { + case 17: + case 20: + case 21: + case 36: + dword_45A0D0_animation_state = 16; + dword_45A0D4_animation_frame = 0; + break; + case 16: + case 25: + case 26: + break; + case 15: + dword_45A0D0_animation_state = 16; + dword_45A0D4_animation_frame = 16 - 16 * dword_45A0D4_animation_frame / 12; + break; + case 14: + dword_45A0D0_animation_state = 16; + dword_45A0D4_animation_frame = 0; + break; + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + Game_Flag_Set(236); + dword_45A0D8 = 0; + dword_45A0DC = 30; + dword_45A0E4 = 0; + dword_45A0E0 = 1; + dword_45A0E8 = 3; + break; + case 60: + dword_45A0D0_animation_state = 61; + break; + default: + dword_45A0D0_animation_state = 0; + dword_45A0D4_animation_frame = 0; + dword_45A0DC = 0; + } +} + +void AIScript_McCoy::sub_405800() { + switch (dword_45A0D0_animation_state) { + case 36: + case 37: + case 40: + case 41: + case 51: + dword_45A0D0_animation_state = 14; + dword_45A0D4_animation_frame = 0; + break; + case 22: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 41; + break; + case 18: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 13 * ((8 - dword_45A0D4_animation_frame) / 8); + break; + case 17: + case 20: + dword_45A0D0_animation_state = 19; + dword_45A0D4_animation_frame = 0; + break; + case 16: + dword_45A0D4_animation_frame = 12 - 12 * dword_45A0D4_animation_frame / 16; + dword_45A0D0_animation_state = 15; + break; + case 14: + case 15: + case 19: + case 21: + break; + default: + dword_45A0D0_animation_state = 15; + dword_45A0D4_animation_frame = 0; + break; + } +} + +void AIScript_McCoy::sub_4058B0() { + int v0 = Actor_Query_Which_Set_In(0); + if (v0 == 27) { + dword_45A0D0_animation_state = 51; + dword_45A0D4_animation_frame = 0; + Player_Loses_Control(); + Game_Flag_Set(210); + } else if (v0 == 70 || v0 == 87) { + dword_45A0D0_animation_state = 56; + dword_45A0D4_animation_frame = 0; + } +} + +void AIScript_McCoy::sub_405920() { + dword_45A0D4_animation_frame = 0; + dword_45A0D0_animation_state = 47; +} + +void AIScript_McCoy::sub_405940(float a1) { + float x, y, z; + int currentAngle = Actor_Query_Facing_1024(0); + Actor_Query_XYZ(0, &x, &y, &z); + int angle = currentAngle - 12; + y = y + a1; + if (angle < 0) { + angle = currentAngle + 1012; + } + if (angle > 1023) { + angle -= 1024; + } + Actor_Set_At_XYZ(0, x, y, z, angle); +} + +void AIScript_McCoy::sub_4059D0(float a1) { + float x, y, z; + int currentAngle = Actor_Query_Facing_1024(0); + Actor_Query_XYZ(0, &x, &y, &z); + int angle = currentAngle + 15; + y = y + a1; + if (angle < 0) { + angle = currentAngle + 1039; + } + if (angle > 1023) { + angle -= 1024; + } + return Actor_Set_At_XYZ(0, x, y, z, angle); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ai_00_mccoy.h b/engines/bladerunner/script/ai_00_mccoy.h new file mode 100644 index 0000000000..eedae2f99b --- /dev/null +++ b/engines/bladerunner/script/ai_00_mccoy.h @@ -0,0 +1,82 @@ +/* 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/script/script.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { +class AIScript_McCoy : public AIScriptBase { + int dword_45A0D0_animation_state; + int dword_45A0D4_animation_frame; + int dword_45A0D8; + int dword_45A0DC; + int dword_45A0E0; + int dword_45A0E4; + float off_45A0EC; + int dword_45A0E8; + int dword_45A0F0; + int dword_45A0F4; + int dword_45A0F8; + int dword_45A0FC; + int dword_462718; + int dword_46271C; + float off_45A100; + float flt_462710; + float flt_462714; + +public: + AIScript_McCoy(BladeRunnerEngine *vm); + + void Initialize(); + bool Update(); + void TimerExpired(int timer); + void CompletedMovementTrack(); + void ReceivedClue(int clueId, int fromActorId); + void ClickedByPlayer(); + void EnteredScene(int sceneId); + void OtherAgentEnteredThisScene(); + void OtherAgentExitedThisScene(); + void OtherAgentEnteredCombatMode(); + void ShotAtAndMissed(); + void ShotAtAndHit(); + void Retired(int byActorId); + void GetFriendlinessModifierIfGetsClue(); + bool GoalChanged(int currentGoalNumber, int newGoalNumber); + bool UpdateAnimation(int *animation, int *frame); + bool ChangeAnimationMode(int mode); + void QueryAnimationState(int *animationState, int *a2, int *a3, int *a4); + void SetAnimationState(int animationState, int a2, int a3, int a4); + bool ReachedMovementTrackWaypoint(); + +private: + void sub_4053E0(); + void sub_4054F0(); + void sub_405660(); + void sub_405800(); + void sub_4058B0(); + void sub_405920(); + void sub_405940(float a1); + void sub_4059D0(float a1); + +}; +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/aiscript_officer_leroy.cpp b/engines/bladerunner/script/aiscript_officer_leroy.cpp new file mode 100644 index 0000000000..7881984154 --- /dev/null +++ b/engines/bladerunner/script/aiscript_officer_leroy.cpp @@ -0,0 +1,134 @@ +/* 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/script/aiscript_officer_leroy.h" + +namespace BladeRunner { + +AIScript_Officer_Leroy::AIScript_Officer_Leroy(BladeRunnerEngine *vm) + : AIScriptBase(vm) { +} + +void AIScript_Officer_Leroy::Initialize() { + var_45D5B0_animation_state = 0; + var_45D5B4_frame = 0; + var_45D5B8 = 0; + + Actor_Put_In_Set(23, 69); + Actor_Set_At_XYZ(23, -261.80f, 6.00f, 79.58f, 512); + // Actor_Set_Goal_Number(23, 0); + // Actor_Set_Frame_Rate_FPS(23, 8); +} + +bool AIScript_Officer_Leroy::Update() { + return false; +} + +void AIScript_Officer_Leroy::TimerExpired(int timer) { +} + +void AIScript_Officer_Leroy::CompletedMovementTrack() { +} + +void AIScript_Officer_Leroy::ReceivedClue(int clueId, int fromActorId) { +} + +void AIScript_Officer_Leroy::ClickedByPlayer() { +} + +void AIScript_Officer_Leroy::EnteredScene(int sceneId) { +} + +void AIScript_Officer_Leroy::OtherAgentEnteredThisScene() { +} + +void AIScript_Officer_Leroy::OtherAgentExitedThisScene() { +} + +void AIScript_Officer_Leroy::OtherAgentEnteredCombatMode() { +} + +void AIScript_Officer_Leroy::ShotAtAndMissed() { +} + +void AIScript_Officer_Leroy::ShotAtAndHit() { +} + +void AIScript_Officer_Leroy::Retired(int byActorId) { +} + +void AIScript_Officer_Leroy::GetFriendlinessModifierIfGetsClue() { +} + +bool AIScript_Officer_Leroy::GoalChanged(int currentGoalNumber, int newGoalNumber) { + return false; +} + +bool AIScript_Officer_Leroy::UpdateAnimation(int *animation, int *frame) { + if (var_45D5B8 == 0) { + *animation = 589; + var_45D5B4_frame++; + + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(589)) { + var_45D5B4_frame = 0; + var_45D5B8 = Random_Query(0, 2); + } + } else if (var_45D5B8 == 1) { + *animation = 590; + var_45D5B4_frame++; + + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(590)) { + var_45D5B4_frame = 0; + var_45D5B8 = Random_Query(0, 2); + } + } else if (var_45D5B8 == 2) { + *animation = 591; + var_45D5B4_frame++; + + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(591)) { + var_45D5B4_frame = 0; + var_45D5B8 = Random_Query(0, 2); + } + } + *frame = var_45D5B4_frame; + return true; +} + +bool AIScript_Officer_Leroy::ChangeAnimationMode(int mode) { + switch (mode) { + case 1: + var_45D5B0_animation_state = 32; + break; + } + return true; +} + +void AIScript_Officer_Leroy::QueryAnimationState(int *animationState, int *a2, int *a3, int *a4) { +} + +void AIScript_Officer_Leroy::SetAnimationState(int animationState, int a2, int a3, int a4) { +} + +bool AIScript_Officer_Leroy::ReachedMovementTrackWaypoint() { + return false; +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/aiscript_officer_leroy.h b/engines/bladerunner/script/aiscript_officer_leroy.h new file mode 100644 index 0000000000..152ba83463 --- /dev/null +++ b/engines/bladerunner/script/aiscript_officer_leroy.h @@ -0,0 +1,58 @@ +/* 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/script/script.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +class AIScript_Officer_Leroy : public AIScriptBase { + int var_45D5B0_animation_state; + int var_45D5B4_frame; + int var_45D5B8; +public: + AIScript_Officer_Leroy(BladeRunnerEngine *vm); + + void Initialize(); + bool Update(); + void TimerExpired(int timer); + void CompletedMovementTrack(); + void ReceivedClue(int clueId, int fromActorId); + void ClickedByPlayer(); + void EnteredScene(int sceneId); + void OtherAgentEnteredThisScene(); + void OtherAgentExitedThisScene(); + void OtherAgentEnteredCombatMode(); + void ShotAtAndMissed(); + void ShotAtAndHit(); + void Retired(int byActorId); + void GetFriendlinessModifierIfGetsClue(); + bool GoalChanged(int currentGoalNumber, int newGoalNumber); + bool UpdateAnimation(int *animation, int *frame); + bool ChangeAnimationMode(int mode); + void QueryAnimationState(int *animationState, int *a2, int *a3, int *a4); + void SetAnimationState(int animationState, int a2, int a3, int a4); + bool ReachedMovementTrackWaypoint(); +}; + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ar01.cpp b/engines/bladerunner/script/ar01.cpp new file mode 100644 index 0000000000..dda8a8c3b9 --- /dev/null +++ b/engines/bladerunner/script/ar01.cpp @@ -0,0 +1,361 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptAR01::InitializeScene() { + Music_Play(0, 25, 0, 2, -1, 1, 2); + if (Game_Flag_Query(323)) { + Setup_Scene_Information(-477.0f, 0.0f, -149.0f, 333); + } else if (Game_Flag_Query(321) == 1) { + Setup_Scene_Information(-182.0f, 0.0f, -551.0f, 518); + } else { + Setup_Scene_Information(-152.0f, 0.0f, 332.0f, 545); + } + Scene_Exit_Add_2D_Exit(0, 134, 165, 177, 290, 3); + Scene_Exit_Add_2D_Exit(1, 319, 0, 639, 207, 0); + if (Game_Flag_Query(252)) { + Scene_Exit_Add_2D_Exit(2, 0, 404, 99, 479, 2); + } + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); + Ambient_Sounds_Add_Looping_Sound(241, 50, 1, 1); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(242, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(243, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(244, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(245, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(246, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(247, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(248, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(249, 3, 30, 11, 11, 50, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(252) && !Game_Flag_Query(321) && !Game_Flag_Query(323)) { + Actor_Set_Invisible(0, true); + Game_Flag_Set(273); + Scene_Loop_Start_Special(0, 1, 0); + Scene_Loop_Set_Default(2); + } else if (Game_Flag_Query(252) && Game_Flag_Query(321)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(2); + Game_Flag_Reset(321); + } else if (!Game_Flag_Query(252) && Game_Flag_Query(321)) { + Scene_Loop_Start_Special(0, 6, 0); + Scene_Loop_Set_Default(7); + Game_Flag_Reset(321); + } else if (Game_Flag_Query(252) && Game_Flag_Query(323)) { + Scene_Loop_Set_Default(2); + } else if (!Game_Flag_Query(252) && Game_Flag_Query(323)) { + Scene_Loop_Set_Default(7); + } else { + Scene_Loop_Set_Default(7); + } +} + +void ScriptAR01::SceneLoaded() { + Obstacle_Object("DF_BOOTH", true); + Unobstacle_Object("SPINNER BODY", true); +} + +bool ScriptAR01::MouseClick(int x, int y) { + return false; +} + +bool ScriptAR01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptAR01::ClickedOnActor(int actorId) { + if (actorId == 16 || actorId == 20) { + Actor_Face_Actor(0, actorId, true); + Actor_Says(0, 8910, 14); + return true; + } + if (actorId == 29) { + Actor_Set_Goal_Number(29, 2); + if (!Loop_Actor_Walk_To_XYZ(0, -120.73f, 0.0f, 219.17f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 29, true); + Actor_Face_Actor(29, 0, true); + if (Game_Flag_Query(328)) { + if (Actor_Clue_Query(0, 93) && !Actor_Clue_Query(0, 64)) { + Actor_Says(0, 40, 11); + Actor_Says(29, 120, 14); + Actor_Says(0, 45, 17); + Actor_Says(29, 130, 14); + Actor_Says(29, 140, 14); + Actor_Says(0, 50, 13); + Actor_Says(29, 150, 14); + Actor_Clue_Acquire(0, 64, 1, 0); + } else { + if (Random_Query(1, 2) == 1) { + Actor_Says(0, 30, 17); + Actor_Says(29, 100, 14); + Actor_Says(29, 110, 14); + Actor_Says(0, 35, 13); + } else { + Actor_Says(0, 30, 17); + Actor_Says(29, 220, 14); + } + } + Actor_Set_Goal_Number(29, 1); + } else { + Actor_Says(0, 0, 18); + Actor_Says(29, 0, 14); + Actor_Says(29, 10, 14); + Actor_Says(29, 20, 14); + Actor_Says(29, 30, 14); + Actor_Says(0, 5, 17); + Actor_Says(29, 40, 14); + Actor_Says(0, 10, 13); + Actor_Says(29, 50, 14); + Actor_Says(0, 15, 17); + Actor_Says(29, 60, 14); + Actor_Says(29, 70, 14); + Actor_Says(29, 80, 14); + Actor_Says(29, 90, 14); + Actor_Says(0, 25, 13); + Game_Flag_Set(328); + Actor_Set_Goal_Number(29, 1); + } + return true; + } + } + return false; +} + +bool ScriptAR01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptAR01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -358.0, 0.0, -149.0, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -477.0, 0.0, -149.0, 0, 0, false, 0); + Game_Flag_Set(322); + Game_Flag_Set(464); + Game_Flag_Reset(180); + Game_Flag_Set(479); + Set_Enter(8, 31); + Actor_Set_Goal_Number(29, 3); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -182.0, 0.0, -551.0, 0, 1, false, 0)) { + Game_Flag_Set(320); + Async_Actor_Walk_To_XYZ(0, -222.0, 0.0, -690.0, 0, false); + Set_Enter(0, 1); + Actor_Set_Goal_Number(29, 3); + } + return true; + } + if (exitId == 2) { + if (Game_Flag_Query(486) == 1) { + Spinner_Set_Selectable_Destination_Flag(6, 1); + } + int v1 = Loop_Actor_Walk_To_XYZ(0, -164.0f, 0.0f, 332.0f, 0, 1, false, 0); + Actor_Face_Heading(0, 545, false); + if (Actor_Query_Goal_Number(7) >= 2 && Actor_Query_Goal_Number(7) <= 103) { + Player_Loses_Control(); + Actor_Put_In_Set(7, 0); + Actor_Set_At_XYZ(7, -448.0, 0.0, 130.0, 0); + Loop_Actor_Walk_To_XYZ(7, -323.0f, 0.64f, 101.74f, 48, 0, true, 0); + Loop_Actor_Walk_To_Actor(7, 0, 48, 0, true); + Actor_Face_Actor(7, 0, true); + Actor_Change_Animation_Mode(7, 6); + Actor_Says(0, 1800, 21); + Actor_Change_Animation_Mode(0, 48); + Player_Gains_Control(); + Actor_Retired_Here(0, 12, 48, 1, 7); + } else if (!v1) { + if (Game_Flag_Query(486) && !Game_Flag_Query(660)) { + Actor_Voice_Over(4310, 99); + Actor_Voice_Over(4320, 99); + Actor_Voice_Over(4330, 99); + Actor_Voice_Over(4340, 99); + Actor_Voice_Over(4350, 99); + Game_Flag_Set(660); + } + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + Game_Flag_Reset(257); + Game_Flag_Reset(180); + + int spinnerDest = Spinner_Interface_Choose_Dest(4, 0); + Actor_Face_Heading(0, 545, 0); + + switch (spinnerDest) { + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(252); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(252); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(252); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(252); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(252); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(252); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(252); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(252); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(252); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 5, 1); + break; + default: + Game_Flag_Set(180); + Actor_Set_Invisible(0, 0); + break; + } + } + return true; + } + return false; +} + +bool ScriptAR01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptAR01::SceneFrameAdvanced(int frame) { + if (frame == 16) { + Ambient_Sounds_Play_Sound(118, 40, 0, 0, 99); + } + if (frame == 78 || frame == 199) { + Ambient_Sounds_Play_Sound(116, 100, -50, -50, 99); + } + if (frame == 122 || frame == 242) { + Ambient_Sounds_Play_Sound(119, 100, -50, -50, 99); + } + if (frame == 256) { + Ambient_Sounds_Play_Sound(117, 40, -50, 80, 99); + } + if ((frame == 75 || frame == 196) && Game_Flag_Query(273)) { + Actor_Face_Heading(0, 545, false); + Actor_Change_Animation_Mode(0, 42); + Game_Flag_Reset(273); + } else if (frame == 196 && !Game_Flag_Query(273)) { + Actor_Change_Animation_Mode(0, 41); + } +} + +void ScriptAR01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptAR01::PlayerWalkedIn() { + if (!Game_Flag_Query(710)) { + Game_Flag_Set(710); + } + if (Game_Flag_Query(323) == 1) { + Loop_Actor_Walk_To_XYZ(0, -358.0f, 0.0f, -149.0f, 0, 1, false, 0); + Game_Flag_Reset(323); + } + if (Actor_Query_Goal_Number(37) < 199) { + Actor_Set_Goal_Number(37, 199); + } +} + +void ScriptAR01::PlayerWalkedOut() { + Actor_Set_Invisible(0, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(479)) { + Music_Stop(2); + } + if (!Game_Flag_Query(322) && !Game_Flag_Query(320)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(38, 1, -1); + } +} + +void ScriptAR01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ar02.cpp b/engines/bladerunner/script/ar02.cpp new file mode 100644 index 0000000000..220402794e --- /dev/null +++ b/engines/bladerunner/script/ar02.cpp @@ -0,0 +1,388 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptAR02::InitializeScene() { + Music_Play(0, 22, 0, 2, -1, 1, 2); + if (Game_Flag_Query(116)) { + Setup_Scene_Information(-560.0f, 0.0f, -799.0f, 333); + } else { + Setup_Scene_Information(-182.0f, 0.0f, -551.0f, 973); + } + Scene_Exit_Add_2D_Exit(0, 0, 439, 212, 479, 2); + Scene_Exit_Add_2D_Exit(1, 81, 202, 215, 406, 3); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); + Ambient_Sounds_Add_Looping_Sound(241, 50, 1, 1); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(242, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(243, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(244, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(245, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(246, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(247, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(248, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(249, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(252) && Game_Flag_Query(320)) { + Scene_Loop_Start_Special(0, 1, 0); + Scene_Loop_Set_Default(2); + Game_Flag_Reset(320); + } else if (!Game_Flag_Query(252) && Game_Flag_Query(320)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(2); + Game_Flag_Reset(320); + } else { + Scene_Loop_Set_Default(2); + } +} + +void ScriptAR02::SceneLoaded() { + Obstacle_Object("DF_BOOTH", true); + if (!Game_Flag_Query(374)) { + Item_Add_To_World(106, 976, 0, -442.84f, 36.77f, -1144.51f, 360, 36, 36, false, true, false, true); + } + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(374)) { + Game_Flag_Set(0); + Item_Remove_From_World(106); + } +} + +bool ScriptAR02::MouseClick(int x, int y) { + return Region_Check(250, 215, 325, 260); +} + +bool ScriptAR02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptAR02::ClickedOnActor(int actorId) { + if (actorId == 16) { + if (!Loop_Actor_Walk_To_XYZ(0, -386.96f, 0.0f, -1078.45f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 16, true); + Actor_Face_Actor(16, 0, true); + if (Global_Variable_Query(1) == 2) { + if (Game_Flag_Query(329) && !Game_Flag_Query(366)) { + Game_Flag_Set(366); + Player_Loses_Control(); + ADQ_Flush(); + ADQ_Add(16, 210, 14); + Loop_Actor_Walk_To_XYZ(0, -350.66f, 0.0f, -1117.19f, 0, 0, false, 0); + Actor_Face_Actor(0, 16,true); + Actor_Says(0, 110, 18); + Actor_Says(16, 230, 14); + Actor_Says(0, 115, 18); + Actor_Says(16, 240, 14); + Item_Pickup_Spin_Effect(956, 288, 257); + Actor_Says(16, 250, 14); + Player_Gains_Control(); + sub_402AE0(); + } else if (Game_Flag_Query(329)) { + Actor_Says(0, 75, 18); + Actor_Says(16, 60, 12); + Actor_Says(16, 70, 14); + } else { + sub_402694(); + } + } else if (Global_Variable_Query(1) > 2) { + if (Actor_Clue_Query(0, 56) && !Actor_Clue_Query(0, 90)) { + Actor_Says(0, 205, 16); + Actor_Says(16, 290, 12); + Actor_Says(16, 300, 13); + Actor_Says(0, 210, 15); + Actor_Says(16, 310, 12); + Actor_Says(0, 215, 13); + if (Game_Flag_Query(374)) { + Actor_Says(0, 220, 14); + Actor_Says(16, 320, 12); + Actor_Says(0, 225, 13); + Actor_Says(16, 330, 14); + Actor_Says(0, 230, 19); + Actor_Says(16, 340, 13); + Actor_Says(16, 350, 12); + Actor_Says(0, 235, 16); + Actor_Clue_Acquire(0, 79, 0, 16); + } + Actor_Clue_Acquire(0, 90, 0, 16); + } else { + Actor_Says(0, 240, 17); + Actor_Says(16, 360, 13); + Actor_Says(16, 370, 14); + Actor_Says(0, 245, 13); + } + } + return true; + } + } + if (actorId == 20 && Global_Variable_Query(1) == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -240.79f, 0.0f, -1328.89f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 20, true); + Actor_Face_Actor(20, 0, true); + if (Game_Flag_Query(330)) { + sub_402CE4(); + return false; + } + Actor_Says(20, 0, 14); + Actor_Says(0, 140, 18); + Game_Flag_Set(330); + return true; + } + } + return false; +} + +bool ScriptAR02::ClickedOnItem(int itemId, bool a2) { + if (itemId == 106) { + if (!Loop_Actor_Walk_To_XYZ(0, -386.96f, 0.0f, -1078.45f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 16, true); + if (!Game_Flag_Query(331)) { + Actor_Says(16, 0, 14); + Actor_Says(0, 55, 18); + Actor_Says(16, 10, 14); + Actor_Says(0, 60, 18); + Actor_Says(16, 20, 14); + Game_Flag_Set(331); + } else if (Game_Flag_Query(331) && !Game_Flag_Query(367)) { + Actor_Says(0, 65, 21); + Actor_Says(16, 30, 14); + Actor_Says(16, 40, 14); + Actor_Says(0, 70, 18); + Actor_Says(16, 50, 14); + Game_Flag_Set(367); + } else { + Actor_Says(0, 8527, 14); + } + return true; + } + } + return false; +} + +bool ScriptAR02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -182.0f, 0.0f, -551.0f, 0, 1, false, 0)) { + Game_Flag_Set(321); + Async_Actor_Walk_To_XYZ(0, -182.0f, 0.0f, -407.0f, 0, false); + Set_Enter(0, 0); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -465.0f, 0.0f, -799.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -560.0f, 0.0f, -799.0f, 0, 0, false, 0); + Game_Flag_Set(117); + Game_Flag_Reset(180); + Game_Flag_Set(182); + Music_Stop(3); + Set_Enter(70, 80); + } + return true; + } + return false; +} + +bool ScriptAR02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptAR02::SceneFrameAdvanced(int frame) { +} + +void ScriptAR02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptAR02::PlayerWalkedIn() { + if (Game_Flag_Query(116) == 1) { + Loop_Actor_Walk_To_XYZ(0, -465.0f, 0.0f, -799.0f, 0, 0, false, 0); + Game_Flag_Reset(116); + } + Game_Flag_Set(726); +} + +void ScriptAR02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptAR02::DialogueQueueFlushed(int a1) { +} + +void ScriptAR02::sub_402694() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 44) || Actor_Clue_Query(0, 47)) { + DM_Add_To_List_Never_Repeat_Once_Selected(490, 3, 5, 5); + } + if (Actor_Clue_Query(0, 14) && !Actor_Clue_Query(0, 44) && !Actor_Clue_Query(0, 47)) { + DM_Add_To_List_Never_Repeat_Once_Selected(500, 3, 5, 5); + } + DM_Add_To_List_Never_Repeat_Once_Selected(510, 8, 3, -1); + Dialogue_Menu_Add_DONE_To_List(520); + Dialogue_Menu_Appear(320, 240); + int answerValue = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answerValue) { + case 490: + case 500: + if (answerValue == 490) { + Actor_Says(0, 145, 15); + } else { + Actor_Says(0, 150, 15); + } + Actor_Says(16, 80, 14); + Actor_Says(0, 80, 16); + Actor_Says(16, 90, 12); + Actor_Says(0, 85, 17); + Actor_Says(16, 100, 14); + Actor_Says(16, 110, 12); + Actor_Says(16, 120, 12); + Actor_Says(0, 90, 13); + Actor_Says(16, 130, 12); + Actor_Says(16, 140, 14); + Actor_Says(0, 95, 15); + Actor_Says(16, 150, 12); + Actor_Says(16, 160, 13); + Actor_Says(16, 170, 14); + Actor_Says(0, 100, 16); + Actor_Says(16, 180, 13); + Game_Flag_Set(329); + Actor_Clue_Acquire(0, 56, 1, 16); + break; + case 510: + Actor_Says(0, 8475, 12); + Actor_Says(16, 190, 12); + Actor_Says(0, 105, 15); + Actor_Says(16, 200, 14); + break; + case 520: + Actor_Says(0, 215, 16); + break; + } +} + +void ScriptAR02::sub_402AE0() { + Dialogue_Menu_Clear_List(); + if (Global_Variable_Query(2) >= 15 || Query_Difficulty_Level() == 0) { + DM_Add_To_List_Never_Repeat_Once_Selected(530, 7, 5, 3); + } + DM_Add_To_List_Never_Repeat_Once_Selected(540, 3, 5, 7); + Dialogue_Menu_Appear(320, 240); + int answerValue = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answerValue == 530) { + Actor_Says(0, 120, 12); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 15); + } + Actor_Clue_Acquire(0, 75, 1, 16); + Actor_Modify_Friendliness_To_Other(16, 0, 5); + } else if (answerValue == 540) { + Actor_Says(0, 125, 13); + Actor_Says(16, 260, 3); + Actor_Says(0, 130, 15); + Actor_Says(16, 270, 3); + Actor_Says(16, 280, 3); + Actor_Says(0, 135, 11); + Actor_Modify_Friendliness_To_Other(16, 0, -5); + } +} + +void ScriptAR02::sub_402CE4() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 93)) { + DM_Add_To_List_Never_Repeat_Once_Selected(550, 8, 5, 2); + } + if (Actor_Clue_Query(0, 44)) { + DM_Add_To_List_Never_Repeat_Once_Selected(560, 6, 5, 7); + } + Dialogue_Menu_Add_DONE_To_List(570); + Dialogue_Menu_Appear(320, 240); + int answerValue = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answerValue) { + case 550: + Actor_Says(0, 145, 11); + Actor_Says(20, 30, 11); + Actor_Says(0, 160, 11); + Actor_Says(20, 40, 11); + Actor_Says(0, 165, 11); + Actor_Says(20, 50, 11); + Actor_Says(0, 170, 11); + Actor_Says(20, 60, 11); + Actor_Says(0, 175, 11); + Game_Flag_Set(370); + break; + case 560: + Actor_Says(0, 150, 11); + Actor_Says(20, 140, 11); + Actor_Says(0, 185, 11); + Actor_Says(20, 150, 11); + Actor_Says(20, 160, 11); + Actor_Says(0, 190, 11); + Actor_Says(20, 170, 11); + Actor_Says(0, 195, 11); + Actor_Says(20, 180, 11); + Actor_Says(20, 190, 11); + Actor_Says(20, 200, 11); + Actor_Says(0, 200, 11); + Actor_Says(20, 210, 11); + Actor_Says(20, 220, 11); + Actor_Says(20, 230, 11); + Game_Flag_Set(370); + break; + case 570: + if (Actor_Clue_Query(0, 57)) { + Actor_Says(0, 1315, 11); + } else { + Actor_Says(0, 940, 13); + Actor_Says(20, 70, 12); + Actor_Says(20, 90, 12); + Actor_Says(0, 180, 15); + Actor_Says(20, 100, 14); + Actor_Says(20, 110, 12); + Actor_Says(20, 120, 13); + Actor_Modify_Friendliness_To_Other(20, 0, -1); + Actor_Clue_Acquire(0, 57, 0, 20); + } + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb01.cpp b/engines/bladerunner/script/bb01.cpp new file mode 100644 index 0000000000..6024a42b09 --- /dev/null +++ b/engines/bladerunner/script/bb01.cpp @@ -0,0 +1,231 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB01::InitializeScene() { + if (Game_Flag_Query(265)) { + Setup_Scene_Information(-253.0f, 9.0f, 715.0f, 266); + } else if (Game_Flag_Query(263)) { + Setup_Scene_Information(-128.0f, 9.0f, 342.0f, 266); + } else { + Setup_Scene_Information(43.0f, 0.0f, 1058.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 72, 299, 3); + Scene_Exit_Add_2D_Exit(1, 151, 218, 322, 290, 3); + if (Game_Flag_Query(254)) { + Scene_Exit_Add_2D_Exit(2, 0, 311, 312, 479, 2); + } + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(105, 25, -100, 0); + Ambient_Sounds_Add_Sound(82, 5, 60, 40, 60, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(83, 5, 60, 40, 65, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(84, 5, 60, 40, 60, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(67, 5, 80, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(66, 5, 80, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(378, 5, 120, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 5, 120, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 5, 120, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + if (Game_Flag_Query(254) && !Game_Flag_Query(265) && !Game_Flag_Query(263)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(254) && Game_Flag_Query(265)) { + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(254) && Game_Flag_Query(263)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(5); + } +} + +void ScriptBB01::SceneLoaded() { + Obstacle_Object("COLUME", true); +} + +bool ScriptBB01::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB01::ClickedOnExit(int exitId) { + if (exitId == 0) { + Loop_Actor_Walk_To_XYZ(0, -140.0f, 9.0f, 818.0f, 0, 1, false, 0); + if (!Loop_Actor_Walk_To_XYZ(0, -233.0f, 9.0f, 846.0f, 0, 1, false, 0)) { + Game_Flag_Set(264); + Game_Flag_Reset(258); + Game_Flag_Set(177); + Set_Enter(7, 26); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -125.39f, 9.0f, 372.45f, 0, 1, false, 0)) { + Game_Flag_Set(262); + Set_Enter(1, 3); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 43.0f, 0.0f, 1062.0f, 0, 1, false, 0)) { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + int spinnerDest = Spinner_Interface_Choose_Dest(3, 0); + switch (spinnerDest) { + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(254); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(254); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(254); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(254); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(254); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(254); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(254); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(254); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(254); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 4, 1); + break; + default: + Game_Flag_Set(258); + Scene_Loop_Start_Special(2, 3, 1); + break; + } + } + return true; + } + return false; +} + +bool ScriptBB01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB01::SceneFrameAdvanced(int frame) { + if (frame == 193) { + Sound_Play(118, 40, 0, 0, 50); + } + if (frame == 241 || frame == 363) { + Sound_Play(116, 100, -50, -50, 50); + } + if (frame == 286 || frame == 407) { + Sound_Play(119, 100, -50, -50, 50); + } + if (frame == 433) { + Sound_Play(117, 40, -50, 80, 50); + } + if (frame == 120) { + Sound_Play(286, Random_Query(33, 33), 100, -100, 50); + } +} + +void ScriptBB01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB01::PlayerWalkedIn() { + Spinner_Set_Selectable_Destination_Flag(7, 1); + if (Game_Flag_Query(265)) { + Game_Flag_Reset(265); + } else if (Game_Flag_Query(263)) { + Game_Flag_Reset(263); + } else { + Loop_Actor_Walk_To_XYZ(0, 43.0f, 0.0f, 954.0f, 0, 0, false, 0); + } +} + +void ScriptBB01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptBB01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb02.cpp b/engines/bladerunner/script/bb02.cpp new file mode 100644 index 0000000000..0fa6b0c237 --- /dev/null +++ b/engines/bladerunner/script/bb02.cpp @@ -0,0 +1,159 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB02::InitializeScene() { + if (Game_Flag_Query(281)) { + Setup_Scene_Information(179.0f, -415.06f, 274.0f, 904); + } else if (Game_Flag_Query(333)) { + Setup_Scene_Information(-12.0f, -415.06f, -27.0f, 264); + Scene_Loop_Start_Special(0, 0, 0); + } else { + Setup_Scene_Information(98.0f, -415.06f, -593.0f, 530); + Game_Flag_Reset(262); + } + Scene_Exit_Add_2D_Exit(0, 313, 137, 353, 173, 0); + Scene_Exit_Add_2D_Exit(1, 207, 291, 275, 443, 3); + Scene_Exit_Add_2D_Exit(2, 303, 422, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(54, 20, 0, 1); + Ambient_Sounds_Add_Looping_Sound(103, 40, 0, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(82, 5, 60, 20, 40, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(83, 5, 60, 20, 45, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(84, 5, 60, 20, 40, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(90, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(72, 5, 80, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 80, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 80, 14, 16, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(494)) { + Game_Flag_Set(493); + Game_Flag_Set(494); + } + if (Game_Flag_Query(493)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(4); + } +} + +void ScriptBB02::SceneLoaded() { + Obstacle_Object("ELEVATOR01", true); + Obstacle_Object("U2 DOOR", true); +} + +bool ScriptBB02::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 98.0f, -415.06f, -593.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(263); + Set_Enter(20, 2); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -12.0f, -415.06f, -27.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + if (!Game_Flag_Query(493)) { + Scene_Loop_Start_Special(2, 0, 1); + } + Game_Flag_Set(332); + Game_Flag_Reset(493); + Set_Enter(1, 5); + Scene_Loop_Start_Special(1, 3, 0); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 86.0f, -415.06f, 174.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 179.0f, -415.06f, 274.0f, 0, 0, false, 0); + Game_Flag_Set(282); + Game_Flag_Reset(493); + Set_Enter(21, 4); + } + return true; + } + return false; +} + +bool ScriptBB02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB02::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Ambient_Sounds_Play_Sound(434, 40, -50, -50, 0); + } + if (frame == 124) { + Ambient_Sounds_Play_Sound(434, 40, -50, -50, 0); + } +} + +void ScriptBB02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB02::PlayerWalkedIn() { + if (Game_Flag_Query(281)) { + Loop_Actor_Walk_To_XYZ(0, 86.0f, -415.06f, 174.0f, 0, 0, false, 0); + Game_Flag_Reset(281); + } else if (Game_Flag_Query(333)) { + Loop_Actor_Walk_To_XYZ(0, 35.0f, -415.06f, -27.0f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(333); + } +} + +void ScriptBB02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptBB02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb03.cpp b/engines/bladerunner/script/bb03.cpp new file mode 100644 index 0000000000..7307c5c3a1 --- /dev/null +++ b/engines/bladerunner/script/bb03.cpp @@ -0,0 +1,161 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB03::InitializeScene() { + Setup_Scene_Information(20.0f, 60.16f, 0.0f, 0); + Game_Flag_Reset(282); + if (Game_Flag_Query(284)) { + Setup_Scene_Information(176.0f, 60.16f, 0.0f, 900); + } + if (Game_Flag_Query(286)) { + Setup_Scene_Information(204.0f, 60.16f, -164.0f, 740); + } + Scene_Exit_Add_2D_Exit(0, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 167, 372, 439, 479, 2); + Scene_Exit_Add_2D_Exit(2, 451, 115, 547, 320, 1); + Ambient_Sounds_Add_Looping_Sound(54, 20, 0, 1); + Ambient_Sounds_Add_Looping_Sound(103, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(105, 34, 100, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(90, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(72, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); +} + +void ScriptBB03::SceneLoaded() { + Obstacle_Object("BACKWALL", true); + Unobstacle_Object("BOX08", true); +} + +bool ScriptBB03::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 176.0f, 60.16f, -64.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 176.0f, 60.16f, 0.0f, 0, 0, false, 0); + Game_Flag_Set(283); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(1, 5); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 20.0f, 60.16f, 0.0f, 0, 1, false, 0)) { + Game_Flag_Set(281); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(1, 3); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 204.0f, 60.16f, -164.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) < 4) { + if (Actor_Query_Goal_Number(56) == 200) { + Actor_Says(56, 70, 3); + Actor_Says(0, 7010, 13); + Actor_Says(56, 80, 3); + Actor_Says(0, 7015, 12); + Actor_Says(56, 90, 3); + Actor_Says(0, 7020, 14); + Actor_Says(56, 100, 3); + Actor_Says(0, 7025, 15); + Actor_Says(56, 110, 3); + Actor_Set_Targetable(54, false); + Actor_Set_Targetable(58, false); + } + Game_Flag_Set(285); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(22, 6); + } else { + Actor_Says(0, 8522, 3); + } + } + return true; + } + return false; +} + +bool ScriptBB03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB03::SceneFrameAdvanced(int frame) { +} + +void ScriptBB03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB03::PlayerWalkedIn() { + if (Game_Flag_Query(286)) { + Loop_Actor_Walk_To_XYZ(0, 164.0f, 60.16f, -164.0f, 0, 0, false, 0); + Game_Flag_Reset(286); + } + if (Game_Flag_Query(284)) { + Loop_Actor_Walk_To_XYZ(0, 176.0f, 60.16f, -64.0f, 0, 0, false, 0); + Game_Flag_Reset(284); + } +} + +void ScriptBB03::PlayerWalkedOut() { +} + +void ScriptBB03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb04.cpp b/engines/bladerunner/script/bb04.cpp new file mode 100644 index 0000000000..b99ea5004d --- /dev/null +++ b/engines/bladerunner/script/bb04.cpp @@ -0,0 +1,130 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB04::InitializeScene() { + if (Game_Flag_Query(283)) { + Setup_Scene_Information(-107.0f, -26.6f, 397.0f, 29); + Game_Flag_Reset(283); + } else { + Setup_Scene_Information(-15.0f, -25.17f, 45.0f, 691); + } + Scene_Exit_Add_2D_Exit(0, 218, 102, 360, 254, 1); + Scene_Exit_Add_2D_Exit(1, 0, 334, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(54, 20, 0, 1); + Ambient_Sounds_Add_Looping_Sound(103, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(105, 44, -100, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(90, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(72, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 80, 20, 20, -100, 100, -101, -101, 0, 0); +} + +void ScriptBB04::SceneLoaded() { + Obstacle_Object("DH TRASH", true); +} + +bool ScriptBB04::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB04::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -92.0f, -26.6f, 45.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -15.0f, -25.17f, 45.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(333); + Game_Flag_Set(493); + Set_Enter(1, 3); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -107.0f, -26.6f, 397.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(284); + Set_Enter(21, 4); + } + return true; + } + return false; +} + +bool ScriptBB04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB04::SceneFrameAdvanced(int frame) { +} + +void ScriptBB04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB04::PlayerWalkedIn() { + if (Game_Flag_Query(332)) { + Loop_Actor_Walk_To_XYZ(0, -92.0f, -26.6f, 45.0f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(332); + } +} + +void ScriptBB04::PlayerWalkedOut() { +} + +void ScriptBB04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb05.cpp b/engines/bladerunner/script/bb05.cpp new file mode 100644 index 0000000000..aff2f7bdc6 --- /dev/null +++ b/engines/bladerunner/script/bb05.cpp @@ -0,0 +1,213 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB05::InitializeScene() { + if (Game_Flag_Query(298)) { + Setup_Scene_Information(95.0f, -60.31f, 331.0f, 0); + } else if (Game_Flag_Query(302)) { + Setup_Scene_Information(87.0f, -60.34f, -96.0f, 0); + } else if (Game_Flag_Query(300)) { + Setup_Scene_Information(271.0f, -60.31f, 203.0f, 0); + } else { + Setup_Scene_Information(-212.0f, -60.31f, 131.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 92, 125, 187, 317, 3); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(2, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(3, 481, 113, 573, 307, 0); + Ambient_Sounds_Add_Looping_Sound(54, 12, 0, 1); + Ambient_Sounds_Add_Looping_Sound(103, 28, 0, 1); + Ambient_Sounds_Add_Looping_Sound(105, 14, 0, 1); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(90, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 50, 17, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(72, 5, 80, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 80, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 80, 14, 14, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(495)) { + Overlay_Play("BB05OVER", 0, 0, 0, 0); + Game_Flag_Set(495); + } +} + +void ScriptBB05::SceneLoaded() { + Obstacle_Object("PINHEAD", true); + Obstacle_Object("X2WALLS&MOLDNG05", true); + Obstacle_Object("QUADPATCH04", true); + Unobstacle_Object("BOX16", true); + Clickable_Object("PINHEAD"); + Clickable_Object("BOX06"); + Unclickable_Object("BOX06"); + Unclickable_Object("BOX14"); + if (Actor_Query_Goal_Number(56) == 200) { + Actor_Set_Goal_Number(58, 299); + Actor_Put_In_Set(58, 97); + Actor_Set_At_Waypoint(58, 39, 0); + } +} + +bool ScriptBB05::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB05::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -212.0f, -60.31f, 131.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(286); + Set_Enter(21, 4); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 95.0f, -60.31f, 331.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(297); + Set_Enter(2, 7); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 271.0f, -60.31f, 203.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(299); + Set_Enter(3, 8); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, 151.0f, -60.34f, -108.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(301); + Set_Enter(102, 120); + } + return true; + } + return false; +} + +bool ScriptBB05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB05::SceneFrameAdvanced(int frame) { +} + +void ScriptBB05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB05::PlayerWalkedIn() { + if (Game_Flag_Query(298)) { + Loop_Actor_Walk_To_XYZ(0, 95.0f, -60.31f, 303.0f, 0, 0, false, 0); + Game_Flag_Reset(298); + } else if (Game_Flag_Query(300)) { + Loop_Actor_Walk_To_XYZ(0, 231.0f, -60.31f, 203.0f, 0, 0, false, 0); + Game_Flag_Reset(300); + } else if (Game_Flag_Query(302)) { + Loop_Actor_Walk_To_XYZ(0, 111.0f, -60.31f, -24.0f, 0, 0, false, 0); + Game_Flag_Reset(302); + } else { + Loop_Actor_Walk_To_XYZ(0, -76.0f, -60.31f, 131.0f, 0, 0, false, 0); + Game_Flag_Reset(285); + } + if (Actor_Query_Goal_Number(56) == 200) { + Actor_Face_Actor(56, 0, true); + Actor_Face_Actor(0, 56, true); + Actor_Says(56, 120, 13); + Actor_Says(0, 7030, 15); + Actor_Says(56, 130, 17); + Actor_Says(56, 140, 16); + Actor_Says(56, 150, 14); + Actor_Says(56, 160, 15); + Actor_Says(0, 7035, 14); + Actor_Says(56, 170, 12); + Actor_Says(0, 7040, 14); + Actor_Says(56, 180, 16); + Actor_Says(0, 7045, 14); + if (Game_Flag_Query(399)) { + Actor_Says(56, 190, 15); + Actor_Says(0, 7050, 17); + Actor_Says(56, 200, 16); + Actor_Says_With_Pause(56, 210, 1.5f, 14); + Actor_Says(0, 7055, 15); + } else { + Actor_Put_In_Set(58, 22); + Actor_Set_At_Waypoint(58, 134, 0); + Loop_Actor_Walk_To_Waypoint(58, 135, 0, 0, false); + Actor_Says(58, 0, 3); + Actor_Face_Actor(0, 58, true); + Actor_Face_Actor(56, 58, true); + Actor_Says(56, 220, 13); + Loop_Actor_Walk_To_Waypoint(58, 134, 0, 0, false); + Actor_Face_Actor(56, 0, true); + Actor_Face_Actor(0, 56, true); + Actor_Says(56, 230, 15); + Actor_Says(0, 7060, 17); + Actor_Says(56, 240, 12); + } + Actor_Says(0, 7065, 16); + Actor_Says(56, 250, 16); + Actor_Says(0, 7070, 18); + Actor_Set_Goal_Number(56, 205); + Actor_Set_Goal_Number(58, 201); + Actor_Set_Goal_Number(54, 101); + Actor_Set_Goal_Number(58, 200); + } +} + +void ScriptBB05::PlayerWalkedOut() { +} + +void ScriptBB05::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb06.cpp b/engines/bladerunner/script/bb06.cpp new file mode 100644 index 0000000000..66c9a85d3c --- /dev/null +++ b/engines/bladerunner/script/bb06.cpp @@ -0,0 +1,177 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB06::InitializeScene() { + if (Game_Flag_Query(394)) { + Setup_Scene_Information(76.0f, 0.0f, 79.0f, 622); + } else if (Game_Flag_Query(395)) { + Setup_Scene_Information(55.0f, 0.0f, -96.0f, 761); + } else if (Game_Flag_Query(362)) { + Setup_Scene_Information(-115.0f, 0.0f, -103.0f, 375); + Game_Flag_Reset(362); + } else { + Setup_Scene_Information(-37.0f, 0.0f, 178.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 0, 43, 14, 478, 3); + Scene_Exit_Add_2D_Exit(1, 425, 0, 639, 361, 0); + Scene_Exit_Add_2D_Exit(3, 195, 164, 239, 280, 3); + Ambient_Sounds_Add_Looping_Sound(103, 28, 0, 1); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(394) || Game_Flag_Query(395)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(394); + Game_Flag_Reset(395); + } else { + Scene_Loop_Set_Default(1); + } + if (Game_Flag_Query(410)) { + Overlay_Play("BB06OVER", 1, 1, 0, 0); + } +} + +void ScriptBB06::SceneLoaded() { + Obstacle_Object("V2CHESSTBL01", true); + Clickable_Object("BOX31"); + Item_Add_To_World(77, 931, 2, -127.0f, 68.42f, 57.0f, 0, 8, 8, true, true, false, true); +} + +bool ScriptBB06::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB06::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BOX31", objectName)) { + if (!Loop_Actor_Walk_To_Scene_Object(0, "BOX31", 24, 1, false)) { + Actor_Face_Object(0, "BOX31", true); + if (Game_Flag_Query(410)) { + Actor_Voice_Over(60, 99); + Actor_Voice_Over(70, 99); + } else { + Actor_Voice_Over(50, 99); + } + } + } + return false; +} + +bool ScriptBB06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB06::ClickedOnItem(int itemId, bool a2) { + if (itemId == 77) { + if (Player_Query_Combat_Mode()) { + Overlay_Play("BB06OVER", 1, 1, 1, 0); + Game_Flag_Set(410); + Item_Remove_From_World(77); + return true; + } + } + return false; +} + +bool ScriptBB06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -37.0f, 0.0f, 178.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(298); + Set_Enter(22, 6); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 101.0f, 0.0f, -25.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(393); + Set_Enter(1, 104); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, -115.0f, 0.0f, -103.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(363); + Set_Enter(2, 8); + } + return true; + } + return false; +} + +bool ScriptBB06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB06::SceneFrameAdvanced(int frame) { + if (frame == 34) { + Ambient_Sounds_Play_Sound(447, 40, -50, -50, 10); + } + if (frame == 16) { + Ambient_Sounds_Play_Sound(448, 20, -50, -50, 10); + } + if (frame == 20) { + Ambient_Sounds_Play_Sound(448, 20, -50, -50, 10); + } + if (frame == 25) { + Ambient_Sounds_Play_Sound(448, 20, -50, -50, 10); + } + if (frame == 29) { + Ambient_Sounds_Play_Sound(448, 20, -50, -50, 10); + } +} + +void ScriptBB06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB06::PlayerWalkedIn() { + if (Game_Flag_Query(297)) { + Loop_Actor_Walk_To_XYZ(0, -36.0f, 0.0f, 145.0f, 0, 0, false, 0); + Game_Flag_Reset(297); + } +} + +void ScriptBB06::PlayerWalkedOut() { +} + +void ScriptBB06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb07.cpp b/engines/bladerunner/script/bb07.cpp new file mode 100644 index 0000000000..7b9b4aea1f --- /dev/null +++ b/engines/bladerunner/script/bb07.cpp @@ -0,0 +1,184 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB07::InitializeScene() { + if (Game_Flag_Query(365)) { + Setup_Scene_Information(-655.0f, 252.59f, -1136.0f, 323); + } else if (Game_Flag_Query(363)) { + Setup_Scene_Information(-551.0f, 252.59f, -1004.0f, 29); + Game_Flag_Reset(363); + } else { + Setup_Scene_Information(-652.0f, 252.59f, -1018.0f, 268); + } + Scene_Exit_Add_2D_Exit(0, 0, 16, 51, 426, 3); + Scene_Exit_Add_2D_Exit(1, 124, 101, 172, 305, 3); + Scene_Exit_Add_2D_Exit(2, 282, 408, 476, 479, 2); + Scene_2D_Region_Add(0, 308, 283, 354, 308); + Ambient_Sounds_Add_Looping_Sound(332, 44, 0, 1); + Ambient_Sounds_Add_Looping_Sound(331, 24, 0, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Overlay_Play("BB07OVER", 0, 1, 0, 0); +} + +void ScriptBB07::SceneLoaded() { + Obstacle_Object("COUCH", true); + Unobstacle_Object("X2MAINWALLLEFT01", true); + Clickable_Object("PRINTER"); +} + +bool ScriptBB07::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB07::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("PRINTER", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -472.63f, 252.59f, -1086.81f, 0, 0, false, 0)) { + Actor_Face_Object(0, "PRINTER", true); + if (Game_Flag_Query(396) && !Game_Flag_Query(398)) { + Actor_Voice_Over(130, 99); + Item_Pickup_Spin_Effect(941, 439, 242); + Actor_Voice_Over(140, 99); + Game_Flag_Set(398); + Actor_Clue_Acquire(0, 148, 1, -1); + } else if (Game_Flag_Query(396) && Game_Flag_Query(398)) { + Actor_Face_Object(0, "PRINTER", true); + Actor_Says(0, 8570, 13); + } else { + Actor_Face_Object(0, "PRINTER", true); + Actor_Says(0, 8575, 13); + } + } + } + return false; +} + +bool ScriptBB07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB07::ClickedOnItem(int itemId, bool a2) { + if (itemId == 83) { + if (!Loop_Actor_Walk_To_Item(0, 83, 36, 1, false)) { + Actor_Face_Item(0, 83, true); + if (Game_Flag_Query(396) == 1) { + Actor_Voice_Over(150, 99); + Actor_Voice_Over(160, 99); + Actor_Voice_Over(170, 99); + } + } + } + return false; +} + +bool ScriptBB07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -615.0f, 252.59f, -1018.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Overlay_Remove("BB07OVER"); + Game_Flag_Set(300); + Set_Enter(22, 6); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -619.0f, 252.59f, -1136.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Overlay_Remove("BB07OVER"); + Game_Flag_Set(364); + Set_Enter(102, 120); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -551.0f, 252.59f, -1004.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Overlay_Remove("BB07OVER"); + Game_Flag_Set(362); + Set_Enter(2, 7); + } + return true; + } + return false; +} + +bool ScriptBB07::ClickedOn2DRegion(int region) { + if (region == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -568.63f, 252.59f, -1114.81f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 229, false); + if (Game_Flag_Query(396)) { + Actor_Says(0, 8585, 15); + } else { + Ambient_Sounds_Play_Sound(592, 40, 20, 20, 99); + Overlay_Play("BB07OVER", 1, 0, 1, 0); + Overlay_Play("BB07OVER", 2, 1, 0, 0); + Game_Flag_Set(396); + if (!Game_Flag_Query(398)) { + Actor_Says(39, 0, 3); + } + } + } + } + return false; +} + +void ScriptBB07::SceneFrameAdvanced(int frame) { +} + +void ScriptBB07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB07::PlayerWalkedIn() { + if (Game_Flag_Query(299)) { + Loop_Actor_Walk_To_XYZ(0, -594.0f, 252.59f, -1018.0f, 6, 0, false, 0); + Game_Flag_Reset(299); + } + if (Game_Flag_Query(365)) { + Loop_Actor_Walk_To_XYZ(0, -602.0f, 252.59f, -1124.0f, 6, 0, false, 0); + Game_Flag_Reset(365); + } +} + +void ScriptBB07::PlayerWalkedOut() { +} + +void ScriptBB07::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb08.cpp b/engines/bladerunner/script/bb08.cpp new file mode 100644 index 0000000000..5464aabc28 --- /dev/null +++ b/engines/bladerunner/script/bb08.cpp @@ -0,0 +1,136 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB08::InitializeScene() { + if (Game_Flag_Query(219)) { + Setup_Scene_Information(204.0f, 0.0f, 92.0f, 875); + } else { + Setup_Scene_Information(247.0f, 0.0f, 27.0f, 790); + } + Scene_Exit_Add_2D_Exit(0, 307, 0, 361, 238, 0); + Scene_Exit_Add_2D_Exit(1, 117, 38, 214, 245, 0); + Ambient_Sounds_Add_Looping_Sound(105, 44, 0, 1); + Ambient_Sounds_Add_Sound(291, 1, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 1, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 1, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 1, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 1, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(496)) { + Overlay_Play("BB08OVER", 0, 0, 0, 0); + Game_Flag_Set(496); + } +} + +void ScriptBB08::SceneLoaded() { + Obstacle_Object("BATHTUB", true); + Unobstacle_Object("DOORWAY", true); + Unclickable_Object("BATHTUB"); +} + +bool ScriptBB08::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB08::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB08::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB08::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB08::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 204.0f, 0.1f, 94.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 256, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Ladder(0, 8, 1, 0); + Footstep_Sound_Override_Off(); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(218); + Set_Enter(24, 10); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 247.0f, 0.1f, 27.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(506); + Set_Enter(102, 120); + } + return true; + } + return false; +} + +bool ScriptBB08::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB08::SceneFrameAdvanced(int frame) { +} + +void ScriptBB08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB08::PlayerWalkedIn() { + if (Game_Flag_Query(219)) { + Actor_Set_At_XYZ(0, 204.0f, 96.1f, 94.0f, 256); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Ladder(0, 8, 0, 0); + Footstep_Sound_Override_Off(); + Actor_Face_Heading(0, 768, false); + Game_Flag_Reset(219); + } else { + Loop_Actor_Walk_To_XYZ(0, 188.0f, 0.1f, 28.0f, 0, 0, false, 0); + } +} + +void ScriptBB08::PlayerWalkedOut() { +} + +void ScriptBB08::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb09.cpp b/engines/bladerunner/script/bb09.cpp new file mode 100644 index 0000000000..0d672612ae --- /dev/null +++ b/engines/bladerunner/script/bb09.cpp @@ -0,0 +1,124 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB09::InitializeScene() { + Setup_Scene_Information(111.2f, -8.96f, 134.65f, 0); + if (Game_Flag_Query(221)) { + Game_Flag_Reset(221); + Setup_Scene_Information(115.45f, -8.96f, 134.0f, 628); + } else if (Game_Flag_Query(218)) { + Game_Flag_Reset(218); + Setup_Scene_Information(107.45f, -9.14f, 166.0f, 244); + } + Scene_Exit_Add_2D_Exit(0, 224, 213, 286, 353, 1); + Scene_Exit_Add_2D_Exit(1, 75, 450, 480, 479, 2); + Ambient_Sounds_Add_Looping_Sound(54, 20, 100, 1); + Ambient_Sounds_Add_Looping_Sound(103, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(105, 50, 55, 1); + Ambient_Sounds_Add_Sound(297, 5, 20, 20, 25, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(298, 5, 20, 20, 25, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(299, 5, 20, 20, 25, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Actor_Set_Targetable(8, true); +} + +void ScriptBB09::SceneLoaded() { + Obstacle_Object("WICKER CHAIR ", true); + Unobstacle_Object("ROOM03 RIGHT WALL", true); + Unclickable_Object("WICKER CHAIR "); +} + +bool ScriptBB09::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB09::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB09::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB09::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB09::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 454.56f, -9.0f, 190.31f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 450.56f, -9.0f, 250.31f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(216); + Game_Flag_Set(220); + Set_Enter(25, 11); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 71.0f, -9.0f, 136.0f, 72, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(219); + Set_Enter(23, 9); + } + return true; + } + return false; +} + +bool ScriptBB09::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB09::SceneFrameAdvanced(int frame) { +} + +void ScriptBB09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB09::PlayerWalkedIn() { +} + +void ScriptBB09::PlayerWalkedOut() { +} + +void ScriptBB09::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb10.cpp b/engines/bladerunner/script/bb10.cpp new file mode 100644 index 0000000000..3a28ebb104 --- /dev/null +++ b/engines/bladerunner/script/bb10.cpp @@ -0,0 +1,205 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB10::InitializeScene() { + if (Game_Flag_Query(223)) { + Setup_Scene_Information(255.29f, 90.24f, -103.0f, 830); + } else if (Game_Flag_Query(220)) { + Game_Flag_Reset(220); + Setup_Scene_Information(151.67f, 66.84f, -313.06f, 0); + } else { + Setup_Scene_Information(199.67f, 67.4f, -169.06f, 628); + } + if (Global_Variable_Query(36) > 2) { + Scene_Exit_Add_2D_Exit(0, 281, 0, 531, 115, 0); + } + Scene_Exit_Add_2D_Exit(1, 58, 91, 193, 401, 3); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Add_Looping_Sound(382, 76, 0, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(466)) { + Scene_2D_Region_Add(0, 458, 99, 522, 133); + Overlay_Play("BB10OVR1", 0, 1, 0, 0); + } + if (!Game_Flag_Query(467)) { + Scene_2D_Region_Add(1, 459, 164, 522, 193); + Overlay_Play("BB10OVR2", 0, 1, 0, 0); + } + if (!Game_Flag_Query(468)) { + Scene_2D_Region_Add(2, 458, 194, 522, 223); + Overlay_Play("BB10OVR3", 0, 1, 0, 0); + } + if (!Game_Flag_Query(469)) { + Scene_2D_Region_Add(3, 458, 255, 522, 278); + Overlay_Play("BB10OVR4", 0, 1, 0, 0); + } + if (!Game_Flag_Query(470)) { + Scene_2D_Region_Add(4, 458, 316, 522, 335); + Overlay_Play("BB10OVR5", 0, 1, 0, 0); + } +} + +void ScriptBB10::SceneLoaded() { + Obstacle_Object("BARB NIGHT", true); + Unclickable_Object("BARB NIGHT"); + Unobstacle_Object("Box-Floor Hole01", true); + Unobstacle_Object("Box-Floor Hole02", true); + Unobstacle_Object("Box-Floor Hole03", true); +} + +bool ScriptBB10::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB10::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB10::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB10::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB10::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 225.58f, 67.2f, -102.1f, 0, 1, false, 0)) { + Player_Set_Combat_Mode(false); + Actor_Face_Heading(0, 274, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 2, 1, 0); + Footstep_Sound_Override_Off(); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Ladder(0, 3, 1, 0); + Footstep_Sound_Override_Off(); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(222); + Set_Enter(26, 12); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 206.01f, 66.84f, -261.62f, 0, 1, false, 0) && !Loop_Actor_Walk_To_XYZ(0, 151.67f, 66.84f, -313.06f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Reset(216); + Game_Flag_Set(221); + Set_Enter(24, 10); + } + return true; + } + return false; +} + +bool ScriptBB10::ClickedOn2DRegion(int region) { + if (!Loop_Actor_Walk_To_XYZ(0, 225.58f, 67.2f, -102.1f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 274, false); + Sound_Play(Random_Query(289, 290), 40, 70, 70, 50); + switch (region) { + case 4: + Overlay_Remove("BB10OVR5"); + Game_Flag_Set(470); + Scene_2D_Region_Remove(4); + break; + case 3: + Overlay_Remove("BB10OVR4"); + Game_Flag_Set(469); + Scene_2D_Region_Remove(3); + break; + case 2: + Overlay_Remove("BB10OVR3"); + Game_Flag_Set(468); + Scene_2D_Region_Remove(2); + break; + case 1: + Overlay_Remove("BB10OVR2"); + Game_Flag_Set(467); + Scene_2D_Region_Remove(1); + break; + case 0: + Overlay_Remove("BB10OVR1"); + Game_Flag_Set(466); + Scene_2D_Region_Remove(0); + break; + default: + break; + } + Global_Variable_Increment(36, 1); + if (Global_Variable_Query(36) > 4) { + Scene_Exit_Add_2D_Exit(0, 281, 0, 531, 115, 0); + } + return false; + } + return true; +} + +void ScriptBB10::SceneFrameAdvanced(int frame) { +} + +void ScriptBB10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB10::PlayerWalkedIn() { + if (Game_Flag_Query(216)) { + Player_Loses_Control(); + Actor_Set_At_XYZ(0, 214.01f, 66.84f, -349.62f, 462); + Loop_Actor_Walk_To_XYZ(0, 206.01f, 66.84f, -261.62f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(216); + } else if (Game_Flag_Query(223)) { + Actor_Set_At_XYZ(0, 249.58f, 127.2f, -102.1f, 256); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Ladder(0, 3, 0, 0); + Footstep_Sound_Override_Off(); + Actor_Face_Heading(0, 768, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 3, 0, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Reset(223); + } +} + +void ScriptBB10::PlayerWalkedOut() { +} + +void ScriptBB10::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb11.cpp b/engines/bladerunner/script/bb11.cpp new file mode 100644 index 0000000000..686172d965 --- /dev/null +++ b/engines/bladerunner/script/bb11.cpp @@ -0,0 +1,132 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB11::InitializeScene() { + Setup_Scene_Information(43.39f, -10.27f, -20.52f, 200); + if (!Game_Flag_Query(509)) { + Scene_Exit_Add_2D_Exit(0, 280, 154, 388, 247, 2); + } + Ambient_Sounds_Add_Looping_Sound(101, 90, 0, 1); + Ambient_Sounds_Add_Looping_Sound(99, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(100, 76, 0, 1); + Ambient_Sounds_Add_Sound(68, 5, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 5, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(509)) { + Preload(19); + Preload(220); + Preload(227); + Preload(328); + Preload(343); + Preload(344); + Preload(17); + Preload(14); + Preload(324); + Preload(323); + Preload(18); + Preload(345); + } +} + +void ScriptBB11::SceneLoaded() { + Obstacle_Object("X2AIRCON01", true); + Unclickable_Object("X2AIRCON01"); + if (Game_Flag_Query(509)) { + Unobstacle_Object("X2PIPES01", true); + Unobstacle_Object("X2PIPES02", true); + Unobstacle_Object("X2PIPES03", true); + Unobstacle_Object("X2_VENTS05", true); + Unobstacle_Object("X2_VENTSCYL05", true); + } +} + +bool ScriptBB11::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB11::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB11::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB11::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB11::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 43.39f, -10.27f, -68.52f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(223); + Set_Enter(25, 11); + } + return true; + } + return false; +} + +bool ScriptBB11::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB11::SceneFrameAdvanced(int frame) { + if (Actor_Query_Goal_Number(8) == 105 && !Game_Flag_Query(375)) { + Actor_Change_Animation_Mode(0, 48); + Game_Flag_Set(375); + } else { + if (frame == 1) { + Sound_Play(74, 10, -100, 100, 50); + } + } +} + +void ScriptBB11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB11::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(8) == 102 && Global_Variable_Query(1) == 2) { + Actor_Set_Invisible(0, true); + Actor_Set_Goal_Number(8, 103); + Music_Play(11, 61, 0, 1, -1, 0, 0); + Player_Loses_Control(); + } +} + +void ScriptBB11::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptBB11::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb12.cpp b/engines/bladerunner/script/bb12.cpp new file mode 100644 index 0000000000..336b0592cb --- /dev/null +++ b/engines/bladerunner/script/bb12.cpp @@ -0,0 +1,144 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB12::InitializeScene() { + if (Game_Flag_Query(364)) { + Setup_Scene_Information(138.0f, 0.0f, 104.0f, 760); + } else if (Game_Flag_Query(506)) { + Setup_Scene_Information(-129.0f, 0.0f, 64.0f, 307); + } else { + Setup_Scene_Information(54.0f, 0.0f, 200.0f, 0); + Game_Flag_Reset(301); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(2, 377, 374, 533, 479, 2); + Ambient_Sounds_Add_Looping_Sound(103, 28, 0, 1); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 27, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 25, 25, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(497)) { + Overlay_Play("BB12OVER", 0, 0, 0, 0); + Game_Flag_Set(497); + } +} + +void ScriptBB12::SceneLoaded() { + Obstacle_Object("BALLS", true); + Unclickable_Object("BALLS"); +} + +bool ScriptBB12::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB12::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptBB12::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB12::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB12::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -129.0f, 0.0f, 64.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(507); + Set_Enter(23, 9); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 138.0f, 0.0f, 104.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(365); + Set_Enter(3, 8); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 54.0f, 0.0f, 200.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(302); + Set_Enter(22, 6); + } + return true; + } + return false; +} + +bool ScriptBB12::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB12::SceneFrameAdvanced(int frame) { + if (frame == 10 || frame == 22 || frame == 33 || frame == 41) { + Sound_Play(311, 17, -30, -30, 50); + } + if (frame == 3) { + Sound_Play(313, 16, -30, -30, 50); + } +} + +void ScriptBB12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB12::PlayerWalkedIn() { + if (Game_Flag_Query(364)) { + Loop_Actor_Walk_To_XYZ(0, 114.0f, 0.0f, 104.0f, 0, 0, false, 0); + Game_Flag_Reset(364); + } else if (Game_Flag_Query(506)) { + Loop_Actor_Walk_To_XYZ(0, -101.0f, 0.0f, 64.0f, 0, 0, false, 0); + Game_Flag_Reset(506); + } +} + +void ScriptBB12::PlayerWalkedOut() { +} + +void ScriptBB12::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb51.cpp b/engines/bladerunner/script/bb51.cpp new file mode 100644 index 0000000000..38079fa5be --- /dev/null +++ b/engines/bladerunner/script/bb51.cpp @@ -0,0 +1,123 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptBB51::InitializeScene() { + Setup_Scene_Information(101.0f, 0.0f, -25.0f, 152); + Game_Flag_Reset(393); + Scene_Exit_Add_2D_Exit(0, 615, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 0, 323, 241, 479, 2); + Ambient_Sounds_Add_Looping_Sound(103, 28, 0, 1); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 180, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(309, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(310, 5, 50, 17, 27, -100, 100, -101, -101, 0, 0); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptBB51::SceneLoaded() { + Obstacle_Object("V2CHESSTBL01", true); + Clickable_Object("V2CHESSTBL01"); + Clickable_Object("TOP02"); +} + +bool ScriptBB51::MouseClick(int x, int y) { + return false; +} + +bool ScriptBB51::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("V2CHESSTBL01", objectName)) { + Actor_Face_Object(0, "V2CHESSTBL01", true); + Actor_Voice_Over(80, 99); + Actor_Voice_Over(90, 99); + } + if (Object_Query_Click("TOP02", objectName)) { + Actor_Face_Object(0, "TOP02", true); + Actor_Voice_Over(100, 99); + Actor_Voice_Over(110, 99); + Actor_Voice_Over(120, 99); + } + return false; +} + +bool ScriptBB51::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptBB51::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptBB51::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 76.0f, 0.0f, 79.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(394); + Set_Enter(1, 7); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 55.0f, 0.0f, -96.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(395); + Set_Enter(1, 7); + } + return true; + } + return false; +} + +bool ScriptBB51::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptBB51::SceneFrameAdvanced(int frame) { +} + +void ScriptBB51::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptBB51::PlayerWalkedIn() { +} + +void ScriptBB51::PlayerWalkedOut() { +} + +void ScriptBB51::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct01.cpp b/engines/bladerunner/script/ct01.cpp new file mode 100644 index 0000000000..001c70245d --- /dev/null +++ b/engines/bladerunner/script/ct01.cpp @@ -0,0 +1,515 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT01::InitializeScene() { + Music_Play(3, 28, 0, 2, -1, 1, 0); + Game_Flag_Reset(247); + if (Game_Flag_Query(68)) { + Game_Flag_Reset(68); + Setup_Scene_Information(-35.2f, -6.5f, 352.28f, 603); + } else if (Game_Flag_Query(71)) { + Game_Flag_Reset(71); + Setup_Scene_Information(-311.0f, -6.5f, 710.0f, 878); + } else if (Game_Flag_Query(88)) { + Game_Flag_Reset(88); + Setup_Scene_Information(-419.0f, -6.5f, 696.0f, 28); + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + if (Game_Flag_Query(248)) { + Scene_Loop_Start_Special(0, 0, 0); + } else { + Scene_Loop_Start_Special(0, 6, 0); + } + } + } else if (Game_Flag_Query(248)) { + Setup_Scene_Information(-530.0f, -6.5f, 241.0f, 506); + Game_Flag_Set(247); + } else { + Setup_Scene_Information(-397.0f, -6.5f, 471.0f, 250); + } + Scene_Exit_Add_2D_Exit(0, 290, 256, 360, 304, 1); + if (Actor_Clue_Query(0, 18)) { + Scene_Exit_Add_2D_Exit(1, 571, 233, 639, 367, 1); + } + if (Game_Flag_Query(94)) { + Scene_Exit_Add_2D_Exit(2, 506, 400, 639, 479, 2); + } + if (Game_Flag_Query(248)) { + Scene_Exit_Add_2D_Exit(3, 0, 286, 158, 350, 2); + } + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(55, 40, -100, 1); + Ambient_Sounds_Add_Looping_Sound(56, 40, 100, 1); + Ambient_Sounds_Add_Sound(61, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(62, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(63, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(64, 10, 30, 16, 20, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 20, 40, 33, 50, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(248)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(7); + } +} + +void ScriptCT01::SceneLoaded() { + Obstacle_Object("HYDRANT02", true); + Obstacle_Object("HOWWALLRT", true); + Obstacle_Object("HOW-CHAIR1", true); + Obstacle_Object("HOWWALLLFT", true); + Obstacle_Object("HOWDOOR01", true); + Unobstacle_Object("SPINNER BODY", true); + Unobstacle_Object("HOWFLOOR", true); + Unobstacle_Object("PAPER11", true); + Unobstacle_Object("PAPER16", true); + Unclickable_Object("HYDRANT02"); + Unclickable_Object("TURBINE"); + Unclickable_Object("SPINNER BODY"); + Unclickable_Object("OBJECT04"); +} + +bool ScriptCT01::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT01::ClickedOn3DObject(const char *objectName, bool a2) { +// if ("ASIANSITTINGANDEATI" == objectName) { //bug? + if (Object_Query_Click("ASIANSITTINGANDEATI", objectName)) { + Actor_Face_Object(0, "ASIANSITTINGANDEATI", true); + Actor_Says(0, 365, 13); + Actor_Says(28, 160, 13); + return true; + } + return false; +} + +bool ScriptCT01::ClickedOnActor(int actorId) { + if (actorId == 28) { + Actor_Set_Goal_Number(28, 50); + if (!Loop_Actor_Walk_To_XYZ(0, -335.23f, -6.5f, 578.97f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 28, true); + Actor_Face_Actor(28, 0, true); + if (!Game_Flag_Query(26)) { + Actor_Says(0, 260, 18); + Actor_Says(28, 0, 14); + Game_Flag_Set(26); + Actor_Set_Goal_Number(28, 0); + } else if (!Game_Flag_Query(30) && Actor_Query_Friendliness_To_Other(28, 0) >= 40) { + sub_40269C(); + Actor_Set_Goal_Number(28, 0); + } else { + if (Game_Flag_Query(31)) { + Actor_Says(0, 330, 17); + Actor_Says(28, 130, 13); + Actor_Says(28, 140, 14); + } else if (Actor_Query_Friendliness_To_Other(28, 0) < 50) { + Actor_Says(0, 330, 13); + Actor_Says(28, 160, 15); + } else { + Actor_Says(0, 310, 11); + Actor_Says(28, 10, 16); + } + Actor_Set_Goal_Number(28, 0); + } + return true; + } + } + if (actorId == 19) { + if (!Loop_Actor_Walk_To_XYZ(0, -335.23f, -6.5f, 578.97f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 19, true); + Actor_Says(0, 355, 18); + if (!Actor_Query_Goal_Number(19)) { + Actor_Says(19, 10, 16); + Actor_Face_Actor(28, 0, true); + Actor_Says(28, 150, 3); + Actor_Face_Actor(0, 28, true); + Actor_Says(0, 360, 13); + Actor_Modify_Friendliness_To_Other(28, 0, -5); + Actor_Modify_Friendliness_To_Other(19, 0, -4); + } + return true; + } + } + if (actorId == 2) { + //todo: some weird code in assembly EBP is used but may not be initialized, loc_401C78 + if (!Actor_Query_Goal_Number(2)) { + if (Loop_Actor_Walk_To_XYZ(0, -338.1f, -6.5f, 419.65f, 6, 1, false, 0)) { + return false; + } + } + + Actor_Face_Actor(0, 2, true); + if (!Game_Flag_Query(32)) { + Actor_Says(0, 335, 18); + Actor_Says(2, 20, 30); + Game_Flag_Set(32); + Actor_Clue_Acquire(2, 213, 1, 0); + Actor_Clue_Acquire(0, 214, 1, 0); + Actor_Modify_Friendliness_To_Other(2, 0, -1); + } else if (Actor_Query_Goal_Number(2)) { + Actor_Says(0, 365, 14); + } else { + Actor_Says(0, 340, 13); + Actor_Says(0, 345, 11); + Actor_Says(2, 30, 30); + Actor_Says(0, 350, 13); + Actor_Says(2, 40, 30); + Actor_Modify_Friendliness_To_Other(2, 0, -5); + Player_Loses_Control(); + } + if (Actor_Query_Is_In_Current_Set(19)) { + Actor_Modify_Friendliness_To_Other(19, 0, -2); + } + return true; + } + return false; +} + +bool ScriptCT01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -327.5f, -6.5f, 352.28f, 0, 1, false, 0)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_Waypoint(0, 106, 0, 0, false); + Player_Gains_Control(); + Game_Flag_Reset(247); + Set_Enter(27, 14); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -259.0f, -6.5f, 710.0f, 0, 1, false, 0)) { + Game_Flag_Reset(247); + Set_Enter(5, 15); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -419.0f, -6.5f, 696.0f, 0, 1, false, 0)) { + Game_Flag_Set(123); + Game_Flag_Reset(247); + Set_Enter(4, 24); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, -314.0f, -6.5f, 326.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -330.0f, -6.5f, 221.0f, 0, 0, true, 0); + Loop_Actor_Walk_To_XYZ(0, -530.0f, -6.5f, 241.0f, 0, 0, true, 0); + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(180); + Game_Flag_Reset(261); + Game_Flag_Reset(177); + Game_Flag_Reset(258); + int spinnerDest = Spinner_Interface_Choose_Dest(-1, 0); + + switch (spinnerDest) { + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(248); + Game_Flag_Reset(247); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 5, 1); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(247); + Game_Flag_Reset(248); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 5, 1); + break; + default: + Game_Flag_Set(176); + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -530.0f, -6.5f, 241.0f, 0, 0, true, 0); + Loop_Actor_Walk_To_XYZ(0, -330.0f, -6.5f, 221.0f, 0, 0, true, 0); + Loop_Actor_Walk_To_XYZ(0, -314.0f, -6.5f, 326.0f, 0, 0, false, 0); + Player_Gains_Control(); + break; + } + } + return true; + } + return false; +} + +bool ScriptCT01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT01::SceneFrameAdvanced(int frame) { + if ((frame < 316 || frame > 435) && !((frame - 1) % 10)) { + /*int v1; + int v2 = Random_Query(0, 1); + if (v2 <= 1) { + if (v2) { + v1 = 60; + } else { + v1 = 59; + } + }*/ + Ambient_Sounds_Play_Sound(/*v1*/Random_Query(59, 60), 25, 30, 30, 0); + } + if (frame == 23) { + Ambient_Sounds_Play_Sound(118, 40, 99, 0, 0); + } + if (frame == 316) { + Ambient_Sounds_Play_Sound(373, 50, -50, 100, 99); + } + if (frame == 196 || frame == 452) { + int v3 = Random_Query(0, 6); + if (v3 == 0) { + Overlay_Play("ct01spnr", 0, 0, 1, 0); + if (Random_Query(0, 1)) { + Ambient_Sounds_Play_Sound(68, Random_Query(33, 50), 0, 0, 0); + } else { + Ambient_Sounds_Play_Sound(67, Random_Query(33, 50), 0, 0, 0); + } + } else if (v3 == 1) { + Overlay_Play("ct01spnr", 1, 0, 1, 0); + if (Random_Query(0, 1)) { + Ambient_Sounds_Play_Sound(69, Random_Query(33, 50), 0, 0, 0); + } else { + Ambient_Sounds_Play_Sound(66, Random_Query(33, 50), 0, 0, 0); + } + + } + } +} + +void ScriptCT01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT01::PlayerWalkedIn() { + if (Game_Flag_Query(234)) { + Loop_Actor_Walk_To_XYZ(0, -327.2f, -6.5f, 352.28f, 0, 0, false, 0); + Game_Flag_Reset(234); + } else { + if (!Game_Flag_Query(247)) { + Game_Flag_Reset(247); + } + Loop_Actor_Walk_To_XYZ(0, -330.0f, -6.5f, 221.0f, 0, 0, false, 0); + Loop_Actor_Walk_To_XYZ(0, -314.0f, -6.5f, 326.0f, 0, 0, false, 0); + if (!Game_Flag_Query(25)) { + Game_Flag_Set(25); + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(200, 99); + Actor_Voice_Over(210, 99); + Actor_Voice_Over(220, 99); + } + } + } +} + +void ScriptCT01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + if (Game_Flag_Query(123)) { + Ambient_Sounds_Remove_Looping_Sound(55, true); + Ambient_Sounds_Remove_Looping_Sound(56, true); + } else { + Ambient_Sounds_Remove_All_Looping_Sounds(1); + } + Music_Stop(5); + if (!Game_Flag_Query(176) && Global_Variable_Query(1)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(38, 1, -1); + } +} + +void ScriptCT01::DialogueQueueFlushed(int a1) { +} + +void ScriptCT01::sub_40269C() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 13)) { + DM_Add_To_List_Never_Repeat_Once_Selected(40, 4, 5, 6); + } + if ((Actor_Clue_Query(0, 8) || Actor_Clue_Query(0, 9)) && !Game_Flag_Query(27)) { + DM_Add_To_List_Never_Repeat_Once_Selected(50, 5, 5, 4); + } + if (Actor_Clue_Query(0, 8) && Actor_Clue_Query(0, 9) && Game_Flag_Query(27) && !Game_Flag_Query(28)) { + DM_Add_To_List_Never_Repeat_Once_Selected(60, 3, 5, 5); + } + if (Game_Flag_Query(293)) { + DM_Add_To_List_Never_Repeat_Once_Selected(80, 9, 9, 9); + } else if (Game_Flag_Query(29)) { + DM_Add_To_List_Never_Repeat_Once_Selected(80, 3, 4, 8); + } + if (Actor_Clue_Query(0, 30) && Actor_Clue_Query(0, 40) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(90, 5, 4, 5); + } + DM_Add_To_List_Never_Repeat_Once_Selected(70, 7, 3, -1); + Dialogue_Menu_Add_DONE_To_List(100); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 40: + Actor_Says(0, 265, 11); + Actor_Says(28, 20, 14); + if (Actor_Query_Is_In_Current_Set(19)) { + if (!Actor_Query_Goal_Number(19)) { + Actor_Face_Actor(28, 19, true); + Actor_Says(28, 120, 14); + Actor_Face_Actor(19, 28, true); + Actor_Says(19, 40, 18); + Actor_Face_Heading(19, 103, false); + Actor_Face_Actor(28, 0, true); + Actor_Modify_Friendliness_To_Other(19, 0, -2); + if (Actor_Query_Is_In_Current_Set(2)) { + Actor_Modify_Friendliness_To_Other(2, 0, -3); + Actor_Clue_Acquire(2, 213, 1, 0); + } + } + } + break; + case 50: + if (Actor_Clue_Query(0, 8) == 1) { + Actor_Says(0, 270, 11); + Actor_Says(28, 30, 16); + } else { + Actor_Says(0, 280, 11); + Actor_Says(28, 40, 14); + } + Game_Flag_Set(27); + break; + case 60: + if (Actor_Clue_Query(0, 9) == 1) { + Actor_Says(0, 270, 11); + Actor_Says(28, 40, 15); + } else { + Actor_Says(0, 270, 11); + Actor_Says(28, 30, 14); + } + Actor_Modify_Friendliness_To_Other(28, 0, 5); + Game_Flag_Set(28); + break; + case 70: + Actor_Says(0, 290, 13); + if (Actor_Query_Friendliness_To_Other(28, 0) > 49 && (Global_Variable_Query(2) > 10 || Query_Difficulty_Level() == 0)) { + Actor_Says(28, 50, 3); + Actor_Says(28, 60, 3); + Actor_Face_Actor(28, 0, true); + Actor_Says(28, 70, 16); + Actor_Says(0, 325, 13); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 10); + } + Game_Flag_Set(192); + } else { + Actor_Says(28, 130, 15); + } + break; + case 80: + Actor_Says(0, 295, 11); + Actor_Says(28, 90, 14); + Actor_Says(28, 100, 13); + Actor_Clue_Acquire(0, 25, 1, 28); + Actor_Modify_Friendliness_To_Other(28, 0, -3); + break; + case 90: + Actor_Says(0, 300, 13); + Actor_Says(28, 110, 16); + break; + case 100: + Actor_Says(0, 305, 18); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct02.cpp b/engines/bladerunner/script/ct02.cpp new file mode 100644 index 0000000000..aecf29139a --- /dev/null +++ b/engines/bladerunner/script/ct02.cpp @@ -0,0 +1,294 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT02::InitializeScene() { + if (Game_Flag_Query(70)) { + Game_Flag_Reset(70); + Setup_Scene_Information(-154.83f, -145.11f, 9.39f, 516); + } else if (Game_Flag_Query(720)) { + Setup_Scene_Information(-213.82f, -145.11f, 214.43f, 82); + } else { + Setup_Scene_Information(-119.02f, -145.11f, 240.99f, 768); + } + Scene_Exit_Add_2D_Exit(0, 590, 0, 639, 479, 1); + if (Actor_Clue_Query(0, 18)) { + Scene_Exit_Add_2D_Exit(1, 332, 163, 404, 297, 0); + } else { + Overlay_Play("ct02over", 0, 1, 0, 0); + } + Ambient_Sounds_Add_Looping_Sound(96, 25, 0, 1); + Ambient_Sounds_Add_Looping_Sound(56, 38, 100, 1); + Ambient_Sounds_Add_Looping_Sound(95, 32, 0, 1); + Ambient_Sounds_Add_Sound(61, 10, 30, 8, 8, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(62, 10, 30, 7, 7, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(63, 10, 30, 8, 8, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(64, 10, 30, 7, 7, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 19, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 19, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 19, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 19, 100, 100, -101, -101, 1, 1); + if (Game_Flag_Query(293)) { + Scene_Loop_Set_Default(3); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptCT02::SceneLoaded() { + Obstacle_Object("STOVE-1", true); + Unobstacle_Object("BACK-DOOR", true); + Unclickable_Object("STOVE-1"); + Unclickable_Object("STOVE-2"); + Unclickable_Object("STOVE-3"); + Unclickable_Object("STOVE-4"); + Unclickable_Object("BIGPOT"); + Unclickable_Object("SOUP-BOWL"); + Unclickable_Object("HOWCOUNTRM"); + Unclickable_Object("LFTSTOVE-1"); + Unclickable_Object("FRIDGE-1"); + Unclickable_Object("LEFTWALL"); + Unclickable_Object("RIGHTWALL"); + Unclickable_Object("BACKWALL"); + Unclickable_Object("TABLE-1"); + Unclickable_Object("COUNTER-2"); + Unclickable_Object("COFFEJUG IN FOREGRO"); + Unclickable_Object("BACK-DOOR"); + if (!Game_Flag_Query(293)) { + Preload(0); + Preload(3); + Preload(3); + Preload(28); + Preload(400); + Preload(419); + Preload(420); + } + if (Game_Flag_Query(720)) { + Game_Flag_Reset(720); + Actor_Change_Animation_Mode(0, 0); + Player_Set_Combat_Mode(true); + Player_Gains_Control(); + } +} + +bool ScriptCT02::MouseClick(int x, int y) { + if (Actor_Query_Goal_Number(19) == 8) { + Actor_Set_Goal_Number(0, 1); + return true; + } + return false; +} + +bool ScriptCT02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +void ScriptCT02::sub_401ACC() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 13)) { + DM_Add_To_List_Never_Repeat_Once_Selected(270, 8, 5, 3); + } + if (Actor_Clue_Query(0, 22) && !Actor_Clue_Query(0, 13)) { + DM_Add_To_List_Never_Repeat_Once_Selected(280, 8, 5, 3); + } + int v0 = 0; + if (Actor_Clue_Query(0, 2)) { + v0 = 1; + } + if (Actor_Clue_Query(0, 10)) { + ++v0; + } + if (Actor_Clue_Query(0, 3)) { + ++v0; + } + if (Actor_Clue_Query(0, 16)) { + ++v0; + } + if (Actor_Clue_Query(0, 25)) { + ++v0; + } + if (v0 > 3) { + DM_Add_To_List_Never_Repeat_Once_Selected(290, -1, 4, 8); + } + Dialogue_Menu_Add_DONE_To_List(300); + Dialogue_Menu_Appear(320, 240); + int answerValue = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answerValue) { + case 270: + Actor_Says(0, 380, 11); + Actor_Says(19, 30, 17); + Actor_Says(19, 40, 15); + Actor_Says(0, 410, 9); + Actor_Says(19, 50, 18); + Actor_Says(0, 415, 10); + Actor_Clue_Acquire(0, 19, 0, -1); + Actor_Modify_Friendliness_To_Other(19, 0, -5); + if (Actor_Query_Friendliness_To_Other(19, 0) < 44) { + Scene_Exits_Disable(); + Actor_Clue_Acquire(0, 18, 1, -1); + Actor_Set_Goal_Number(19, 8); + Game_Flag_Set(293); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + } + break; + case 280: + Actor_Says(0, 385, 9); + Actor_Says(19, 40, 19); + Actor_Modify_Friendliness_To_Other(19, 0, -2); + if (Actor_Query_Friendliness_To_Other(19, 0) < 44) { + Scene_Exits_Disable(); + Actor_Clue_Acquire(0, 18, 1, -1); + Actor_Set_Goal_Number(19, 8); + Game_Flag_Set(293); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + } + break; + case 290: + Actor_Says(0, 395, 9); + Actor_Says(0, 400, 9); + Actor_Says(19, 70, 17); + Actor_Says(0, 420, 10); + Actor_Says(19, 80, 14); + Actor_Modify_Friendliness_To_Other(19, 0, -10); + if (Actor_Query_Friendliness_To_Other(19, 0) < 44) { + Scene_Exits_Disable(); + Actor_Clue_Acquire(0, 18, 1, -1); + Actor_Set_Goal_Number(19, 8); + Game_Flag_Set(293); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + } + break; + case 300: + Actor_Says(0, 405, 11); + if (Actor_Query_Friendliness_To_Other(19, 0) < 44) { + Scene_Exits_Disable(); + Actor_Clue_Acquire(0, 18, 1, -1); + Actor_Set_Goal_Number(19, 8); + Game_Flag_Set(293); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + } + break; + } +} + +bool ScriptCT02::ClickedOnActor(int actorId) { + if (actorId == 19 && Actor_Query_Goal_Number(19) == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -255.02f, -145.11f, 212.42f, 0, 1, false, 0)) { + Actor_Face_Actor(0, 19, true); + Actor_Face_Actor(19, 0, true); + if (!Game_Flag_Query(59)) { + Actor_Says(0, 370, 10); + Actor_Says(19, 20, 19); + Actor_Says(0, 375, 9); + Game_Flag_Set(59); + } + sub_401ACC(); + return true; + } + } + return false; +} + +bool ScriptCT02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -111.2f, -145.11f, 243.28f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(234); + Game_Flag_Set(68); + Set_Enter(4, 13); + } + return true; + } + if (exitId == 1) { + bool v1; + if (Player_Query_Combat_Mode()) { + v1 = Loop_Actor_Walk_To_XYZ(0, -154.83f, -145.11f, -82.61f, 0, 1, true, 0); + } else { + v1 = Loop_Actor_Walk_To_XYZ(0, -154.83f, -145.11f, -82.61f, 0, 1, false, 0); + } + if (!v1) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(69); + Set_Enter(5, 15); + } + return true; + } + return false; +} + +bool ScriptCT02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT02::SceneFrameAdvanced(int frame) { + if (frame == 6 || frame == 12 || frame == 19 || frame == 25 || frame == 46 || frame == 59) { + Sound_Play(97, Random_Query(25, 33), -70, -70, 50); + } + if (frame == 72) { + Sound_Play(200, 50, 0, 0, 50); + } + if (frame == 71) { + Sound_Play(204, 40, 0, 0, 50); + } + if (frame == 72) { + Sound_Play(203, 60, -20, 40, 50); + } + if (frame == 61) { + Music_Play(1, 50, 0, 2, -1, 0, 0); + } + if (frame == 81) { + Scene_Exit_Add_2D_Exit(1, 332, 163, 404, 297, 0); + Scene_Exits_Enable(); + } +} + +void ScriptCT02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT02::PlayerWalkedIn() { +} + +void ScriptCT02::PlayerWalkedOut() { + if (Actor_Clue_Query(0, 18)) { + return; + } + Overlay_Remove("ct02over"); +} + +void ScriptCT02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct03.cpp b/engines/bladerunner/script/ct03.cpp new file mode 100644 index 0000000000..b7dcdd4e46 --- /dev/null +++ b/engines/bladerunner/script/ct03.cpp @@ -0,0 +1,132 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT03::InitializeScene() { + if (Game_Flag_Query(719)) { + Setup_Scene_Information(-852.58f, -621.3f, 285.6f, 0); + } else if (Game_Flag_Query(69)) { + Game_Flag_Reset(69); + Setup_Scene_Information(-557.1f, -616.31f, 224.29f, 249); + } else if (Game_Flag_Query(73)) { + Game_Flag_Reset(73); + Setup_Scene_Information(-173.99f, -619.19f, 347.54f, 808); + } else { + Setup_Scene_Information(-708.58f, -619.19f, 277.6f, 239); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 40, 40, 134, 302, 3); + Scene_Exit_Add_2D_Exit(2, 390, 0, 539, 230, 1); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(56, 22, -100, 1); + Ambient_Sounds_Add_Looping_Sound(105, 34, -100, 1); + Ambient_Sounds_Add_Sound(68, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(61, 3, 30, 8, 10, -100, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(62, 3, 30, 8, 10, -100, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(63, 3, 30, 8, 10, -100, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(64, 3, 30, 8, 10, -100, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(376, 10, 60, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 60, 33, 50, -100, 100, -101, -101, 0, 0); +} + +void ScriptCT03::SceneLoaded() { + Obstacle_Object("TRASH CAN", true); + Unclickable_Object("TRASH CAN"); + Footstep_Sounds_Set(0, 0); + Footstep_Sounds_Set(1, 1); +} + +bool ScriptCT03::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -745.09f, -619.09f, 293.36f, 0, 1, false, 0)) { + Game_Flag_Set(71); + Set_Enter(4, 13); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -604.38f, -616.15f, 221.6f, 0, 1, false, 0)) { + Game_Flag_Set(70); + Set_Enter(27, 14); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -150.0f, -621.3f, 357.0f, 0, 1, false, 0)) { + Game_Flag_Set(72); + Async_Actor_Walk_To_XYZ(0, -67.0f, -621.3f, 477.0f, 0, false); + Set_Enter(5, 16); + } + return true; + } + return false; +} + +bool ScriptCT03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT03::SceneFrameAdvanced(int frame) { +} + +void ScriptCT03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT03::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(19) == 2) { + Actor_Set_Goal_Number(19, 13); + } +} + +void ScriptCT03::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptCT03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct04.cpp b/engines/bladerunner/script/ct04.cpp new file mode 100644 index 0000000000..cad32dfdd2 --- /dev/null +++ b/engines/bladerunner/script/ct04.cpp @@ -0,0 +1,237 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT04::InitializeScene() { + if (Game_Flag_Query(72)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Setup_Scene_Information(-150.0f, -621.3f, 357.0f, 533); + } else { + Scene_Loop_Set_Default(1); + Setup_Scene_Information(-82.86f, -621.3f, 769.03f, 1020); + } + Scene_Exit_Add_2D_Exit(0, 590, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 194, 84, 320, 274, 0); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(56, 15, -100, 1); + Ambient_Sounds_Add_Looping_Sound(105, 34, 100, 1); + Ambient_Sounds_Add_Sound(68, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 40, 33, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(376, 10, 60, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 60, 33, 50, -100, 100, -101, -101, 0, 0); +} + +void ScriptCT04::SceneLoaded() { + Obstacle_Object("DUMPSTER", true); + Obstacle_Object("RIGHTWALL01", true); + Obstacle_Object("BACK-BLDNG", true); + Clickable_Object("DUMPSTER"); + Footstep_Sounds_Set(0, 1); + if (Game_Flag_Query(72)) { + Game_Flag_Reset(72); + } + if (!Actor_Query_Goal_Number(12)) { + Actor_Change_Animation_Mode(12, 38); + } +} + +bool ScriptCT04::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT04::ClickedOn3DObject(const char *objectName, bool a2) { + if (objectName) { + if (!Game_Flag_Query(137) && !Game_Flag_Query(169) && !Actor_Query_Goal_Number(12)) { + Game_Flag_Set(137); + Actor_Set_Goal_Number(12, 2); + } + if (Game_Flag_Query(169) && !Game_Flag_Query(170) && !Game_Flag_Query(171) && !Game_Flag_Query(172) && Global_Variable_Query(1) == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -147.41f, -621.3f, 724.57f, 0, 1, false, 0)) { + Player_Loses_Control(); + Actor_Face_Heading(0, 792, false); + Actor_Put_In_Set(12, 99); + Actor_Set_At_XYZ(12, 0, 0, 0, 0); + Actor_Change_Animation_Mode(0, 40); + Actor_Voice_Over(320, 99); + Actor_Voice_Over(330, 99); + Actor_Voice_Over(340, 99); + Game_Flag_Set(170); + Game_Flag_Set(173); + } + return false; + } + if (Game_Flag_Query(170)) { + if (Game_Flag_Query(172)) { + Actor_Voice_Over(270, 99); + Actor_Voice_Over(280, 99); + } else if (Game_Flag_Query(171)) { + Actor_Voice_Over(250, 99); + Actor_Voice_Over(260, 99); + } else { + Actor_Voice_Over(230, 99); + Actor_Voice_Over(240, 99); + Game_Flag_Reset(173); + } + return true; + } + if (Game_Flag_Query(174)) { + if (!Loop_Actor_Walk_To_Waypoint(0, 75, 0, 1, false)) { + Actor_Face_Heading(0, 707, false); + Actor_Change_Animation_Mode(0, 38); + Ambient_Sounds_Play_Sound(553, 45, 30, 30, 0); + Actor_Voice_Over(1810, 99); + Actor_Voice_Over(1820, 99); + return true; + } + return false; + } + if (!Loop_Actor_Walk_To_Waypoint(0, 75, 0, 1, false)) { + Actor_Face_Heading(0, 707, false); + Actor_Change_Animation_Mode(0, 38); + Actor_Clue_Acquire(0, 37, 1, -1); + Item_Pickup_Spin_Effect(952, 392, 225); + Game_Flag_Set(174); + return true; + } + } + return false; +} + +void ScriptCT04::sub_401D4C() { + Dialogue_Menu_Clear_List(); + if (Global_Variable_Query(2) > 10 || Query_Difficulty_Level() == 0) { + DM_Add_To_List_Never_Repeat_Once_Selected(410, 8, 4, -1); + } + DM_Add_To_List_Never_Repeat_Once_Selected(420, 2, 6, 8); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 410) { + Actor_Says(12, 10, 14); + Actor_Says(12, 20, 14); + Actor_Modify_Friendliness_To_Other(12, 0, 5); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 10); + } + } else if (answer == 420) { + Actor_Says(0, 430, 3); + Actor_Says(12, 30, 14); + Actor_Modify_Friendliness_To_Other(12, 0, -5); + } +} + +bool ScriptCT04::ClickedOnActor(int actorId) { + if (actorId == 12) { + if (Game_Flag_Query(169)) { + if (!Loop_Actor_Walk_To_Actor(0, 12, 36, 1, false)) { + Actor_Voice_Over(290, 99); + Actor_Voice_Over(300, 99); + Actor_Voice_Over(310, 99); + } + } else { + Actor_Set_Targetable(12, false); + if (!Loop_Actor_Walk_To_Actor(0, 12, 36, 1, false)) { + Actor_Face_Actor(0, 12, true); + if (!Game_Flag_Query(137)) { + if (Game_Flag_Query(40)) { + Actor_Says(0, 435, 3); + Actor_Set_Goal_Number(12, 2); + } else { + Music_Stop(3); + Actor_Says(0, 425, 3); + Actor_Says(12, 0, 13); + sub_401D4C(); + Actor_Set_Goal_Number(12, 2); + } + Game_Flag_Set(137); + } else { + Actor_Face_Actor(0, 12, true); + Actor_Says(0, 435, 3); + } + } + } + return true; + } + return false; +} + +bool ScriptCT04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT04::ClickedOnExit(int exitId) { + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -82.86f, -621.3f, 769.03f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Actor_Query_Goal_Number(12)) { + Actor_Set_Goal_Number(12, 2); + } + Game_Flag_Set(74); + Set_Enter(28, 17); + } + return true; + } + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -187.0f, -621.3f, 437.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(73); + Set_Enter(5, 15); + } + return true; + } + return false; +} + +bool ScriptCT04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT04::SceneFrameAdvanced(int frame) { + if (Game_Flag_Query(325)) { + Game_Flag_Reset(325); + Sound_Play(180, 100, 80, 80, 50); + } +} + +void ScriptCT04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT04::PlayerWalkedIn() { +} + +void ScriptCT04::PlayerWalkedOut() { +} + +void ScriptCT04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct05.cpp b/engines/bladerunner/script/ct05.cpp new file mode 100644 index 0000000000..0249110653 --- /dev/null +++ b/engines/bladerunner/script/ct05.cpp @@ -0,0 +1,241 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT05::InitializeScene() { + if (Game_Flag_Query(90)) { + Game_Flag_Reset(90); + Setup_Scene_Information(-128.42f, -109.91f, 112.83f, 516); + } else if (Game_Flag_Query(78)) { + Setup_Scene_Information(192.35f, 43.09f, 128.97f, 768); + } else { + Setup_Scene_Information(-375.0f, -109.91f, 750.0f, 600); + } + if (Game_Flag_Query(94)) { + Scene_Exit_Add_2D_Exit(0, 228, 205, 293, 300, 0); + } + Scene_Exit_Add_2D_Exit(1, 320, 458, 639, 479, 2); + Scene_Exit_Add_2D_Exit(2, 380, 110, 542, 300, 0); + Ambient_Sounds_Add_Looping_Sound(106, 15, -100, 1); + Ambient_Sounds_Add_Looping_Sound(107, 15, 100, 1); + Ambient_Sounds_Add_Looping_Sound(56, 13, -100, 1); + Ambient_Sounds_Add_Sound(90, 5, 20, 8, 10, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 20, 8, 10, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(205, 5, 30, 18, 30, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(94)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } + if (Actor_Query_Goal_Number(53) == 1) { + Overlay_Play("ct05over", 0, 1, 0, 0); + } +} + +void ScriptCT05::SceneLoaded() { + Obstacle_Object("STAIR 1", true); + Obstacle_Object("STAIR 2", true); + Obstacle_Object("GRGDOOR", true); + Obstacle_Object("GRGDOOR2", true); + Obstacle_Object("TURBINE", true); + Obstacle_Object("BARREL", true); + Obstacle_Object("GRNDPIPE", true); + Clickable_Object("TURBINE"); + Clickable_Object("LFTDOOR"); + Clickable_Object("BARREL"); + Clickable_Object("GRNDPIPE"); + Unclickable_Object("GDFRAME"); + Unclickable_Object("GDFRAME2"); + Unclickable_Object("WINFRAME1"); + Unclickable_Object("WINFRAME2"); + Unclickable_Object("STAIR 1"); + Unclickable_Object("STAIR 2"); + Unclickable_Object("LFTDOOR"); + Unclickable_Object("LFTDOORFRM"); +} + +bool ScriptCT05::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT05::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("STAIR1", objectName)) { + Actor_Face_Object(0, objectName, true); + return true; + } + if (Object_Query_Click("STAIR2", objectName)) { + Actor_Face_Object(0, objectName, true); + return true; + } + if (Object_Query_Click("GRGDOOR", objectName)) { + Loop_Actor_Walk_To_Scene_Object(0, "GRGDOOR", 24, 1, false); + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8522, 12); + return true; + } + if (Object_Query_Click("GRGDOOR2", objectName)) { + Loop_Actor_Walk_To_Scene_Object(0, "GRGDOOR2", 24, 1, false); + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8522, 12); + return true; + } + if (Object_Query_Click("TURBINE", objectName)) { + Loop_Actor_Walk_To_Scene_Object(0, "TURBINE", 36, 1, false); + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8528, 12); + return true; + } + if (Object_Query_Click("LFTDOOR", objectName)) { + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8522, 12); + return true; + } + if (Object_Query_Click("BARREL", objectName)) { + Loop_Actor_Walk_To_Scene_Object(0, "BARREL", 36, 1, false); + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8529, 12); + return true; + } + if (Object_Query_Click("GRNDPIPE", objectName)) { + Loop_Actor_Walk_To_Scene_Object(0, "GRNDPIPE", 24, 1, false); + Actor_Face_Object(0, objectName, true); + Actor_Says(0, 8528, 12); + return true; + } + return false; +} + +bool ScriptCT05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -128.42f, -109.91f, 112.83f, 0, 1, false, 0)) { + Game_Flag_Set(76); + if (Actor_Query_Goal_Number(53) == 1) { + Overlay_Remove("ct05over"); + } + Set_Enter(4, 24); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -308.18f, -109.91f, 674.77f, 0, 1, false, 0)) { + Game_Flag_Set(75); + if (Actor_Query_Goal_Number(53) == 1) { + Overlay_Remove("ct05over"); + Actor_Set_Goal_Number(53, 5); + Game_Flag_Set(409); + } + Set_Enter(5, 16); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 71.99f, -109.91f, 288.79f, 0, 1, false, 0)) { + Footstep_Sound_Override_On(2); + Actor_Face_Object(0, "STAIR 2", true); + Loop_Actor_Travel_Stairs(0, 9, 1, 0); + Actor_Set_At_XYZ(0, 99.73f, -19.91f, 134.97f, 256); + Loop_Actor_Travel_Stairs(0, 5, 1, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Set(77); + if (Actor_Query_Goal_Number(53) == 1) { + Overlay_Remove("ct05over"); + } + Set_Enter(29, 18); + } + return true; + } + return false; +} + +bool ScriptCT05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT05::SceneFrameAdvanced(int frame) { + if (frame == 7 || frame == 15 || frame == 29) { + switch (Random_Query(0, 4)) { + case 4: + Sound_Play(40, Random_Query(25, 50), -70, -70, 50); + break; + case 3: + Sound_Play(44, Random_Query(25, 50), -70, -70, 50); + break; + case 2: + Sound_Play(43, Random_Query(25, 50), -70, -70, 50); + break; + case 1: + Sound_Play(42, Random_Query(25, 50), -70, -70, 50); + break; + case 0: + Sound_Play(41, Random_Query(25, 50), -70, -70, 50); + break; + } + } +} + +void ScriptCT05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT05::PlayerWalkedIn() { + if (Game_Flag_Query(74)) { + Player_Loses_Control(); + Game_Flag_Reset(74); + if (Player_Query_Combat_Mode()) { + Loop_Actor_Walk_To_XYZ(0, -308.18f, -109.91f, 674.77f, 0, 0, true, 0); + } else { + Loop_Actor_Walk_To_XYZ(0, -308.18f, -109.91f, 674.77f, 0, 0, false, 0); + } + Player_Gains_Control(); + } + if (Game_Flag_Query(78)) { + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 7, 0, 0); + Actor_Set_At_XYZ(0, 90.73f, -19.91f, 164.97f, 520); + Loop_Actor_Travel_Stairs(0, 10, 0, 0); + Game_Flag_Reset(78); + Footstep_Sound_Override_Off(); + if (Actor_Query_Goal_Number(2) == 2 && Game_Flag_Query(145)) { + Actor_Set_Goal_Number(2, 3); + } + } +} + +void ScriptCT05::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptCT05::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct06.cpp b/engines/bladerunner/script/ct06.cpp new file mode 100644 index 0000000000..30dfd19bd3 --- /dev/null +++ b/engines/bladerunner/script/ct06.cpp @@ -0,0 +1,180 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT06::InitializeScene() { + if (Game_Flag_Query(77)) { + Setup_Scene_Information(20.41f, -58.23f, 2.17f, 247); + Game_Flag_Reset(77); + } else if (Game_Flag_Query(144)) { + Setup_Scene_Information(203.91f, -58.02f, 0.47f, 768); + } else { + Setup_Scene_Information(175.91f, -58.23f, 24.47f, 768); + } + Scene_Exit_Add_2D_Exit(0, 0, 440, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 401, 162, 536, 317, 0); + if (Game_Flag_Query(40) && Actor_Query_In_Set(19, 30)) { + Actor_Put_In_Set(19, 29); + Actor_Set_At_XYZ(19, 58.41f, -58.23f, -24.97f, 240); + Actor_Retired_Here(19, 72, 36, 1, 0); + } + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Looping_Sound(205, 20, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(67, 80, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 50, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 70, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Actor_Query_Goal_Number(19) == 13) { + Ambient_Sounds_Add_Sound(196, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(197, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(198, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(199, 1, 5, 25, 25, -100, 100, -101, -101, 0, 0); + } +} + +void ScriptCT06::SceneLoaded() { + Obstacle_Object("BOX02", true); + Obstacle_Object("CB BOX01", true); + Obstacle_Object("CB BOX02", true); + Obstacle_Object("CB BOX03", true); + Unobstacle_Object("INSULPIP01", true); + Unobstacle_Object("CB BOX04", true); + Unclickable_Object("DOOR"); + if (Actor_Query_Goal_Number(19) == 13) { + Preload(3); + Preload(4); + Preload(389); + Preload(390); + Preload(398); + Preload(421); + Preload(421); + } +} + +bool ScriptCT06::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT06::ClickedOnActor(int actorId) { + if (actorId == 19) { + Loop_Actor_Walk_To_Actor(0, 19, 24, 1, false); + Actor_Face_Actor(0, 19, true); + if (Game_Flag_Query(145)) { + Actor_Says(0, 8570, 13); + return false; + } + Actor_Clue_Acquire(0, 20, 1, -1); + Item_Pickup_Spin_Effect(984, 340, 369); + Actor_Voice_Over(350, 99); + Actor_Voice_Over(360, 99); + Actor_Voice_Over(370, 99); + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(380, 99); + Actor_Voice_Over(390, 99); + Actor_Voice_Over(400, 99); + Actor_Voice_Over(410, 99); + } + Game_Flag_Set(145); + return true; + } + return false; +} + +bool ScriptCT06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 20.41f, -58.23f, -2.17f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(78); + Set_Enter(28, 17); + Game_Flag_Reset(212); + } + return true; + } + if (exitId == 1) { + if (Actor_Query_Goal_Number(19) == 13) { + if (!Loop_Actor_Walk_To_XYZ(0, 203.91f, -58.02f, 0.47f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_Sound(196, true); + Ambient_Sounds_Remove_Sound(197, true); + Ambient_Sounds_Remove_Sound(198, true); + Ambient_Sounds_Remove_Sound(199, true); + Player_Loses_Control(); + Actor_Set_Goal_Number(19, 11); + Game_Flag_Reset(212); + } + return true; + } + if (!Loop_Actor_Walk_To_XYZ(0, 203.91f, -58.02f, 0.47f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) < 3) { + Actor_Face_Object(0, "DOOR", true); + Actor_Says(0, 8522, 12); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(79); + Set_Enter(6, 20); + Game_Flag_Reset(212); + } + } + } + return false; +} + +bool ScriptCT06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT06::SceneFrameAdvanced(int frame) { +} + +void ScriptCT06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT06::PlayerWalkedIn() { + if (Game_Flag_Query(144) == 1) { + Game_Flag_Reset(144); + } +} + +void ScriptCT06::PlayerWalkedOut() { +} + +void ScriptCT06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct07.cpp b/engines/bladerunner/script/ct07.cpp new file mode 100644 index 0000000000..771d4be676 --- /dev/null +++ b/engines/bladerunner/script/ct07.cpp @@ -0,0 +1,104 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT07::InitializeScene() { + Setup_Scene_Information(202.32f, -58.23f, -12.86f, 225); + Actor_Put_In_Set(19, 30); + Actor_Set_At_XYZ(19, -9.68f, -58.23f, 11.14f, 250); + Ambient_Sounds_Add_Looping_Sound(54, 30, 90, 1); + Ambient_Sounds_Add_Looping_Sound(205, 20, 1, 1); + Ambient_Sounds_Add_Looping_Sound(56, 40, 100, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(67, 80, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 50, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 10, 60, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 6, 50, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(61, 10, 30, 12, 14, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(62, 10, 30, 12, 14, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(63, 10, 30, 12, 14, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(64, 10, 30, 12, 14, 100, 100, -101, -101, 0, 0); +} + +void ScriptCT07::SceneLoaded() { + Obstacle_Object("BOX01", true); + Obstacle_Object("BOX02", true); + Obstacle_Object("BOX03", true); + Obstacle_Object("BOX04", true); + Unclickable_Object("BOX01"); + Unclickable_Object("BOX02"); + Unclickable_Object("BOX03"); + Unclickable_Object("BOX04"); +} + +bool ScriptCT07::MouseClick(int x, int y) { + return true; +} + +bool ScriptCT07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT07::ClickedOnExit(int exitId) { + return false; +} + +bool ScriptCT07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT07::SceneFrameAdvanced(int frame) { +} + +void ScriptCT07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT07::PlayerWalkedIn() { + Player_Gains_Control(); + Non_Player_Actor_Combat_Mode_On(19, 0, 0, 0, 2, 4, 7, 8, 0, 0, 100, 15, 300, 0); + Game_Flag_Set(516); + Actor_Face_Actor(0, 19, true); +} + +void ScriptCT07::PlayerWalkedOut() { + Music_Stop(2); +} + +void ScriptCT07::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct08.cpp b/engines/bladerunner/script/ct08.cpp new file mode 100644 index 0000000000..42b924e498 --- /dev/null +++ b/engines/bladerunner/script/ct08.cpp @@ -0,0 +1,196 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT08::InitializeScene() { + if (Game_Flag_Query(679)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(2, 0, -1); + if (Game_Flag_Query(46)) { + Outtake_Play(3, 0, -1); + } else if (Game_Flag_Query(47)) { + Outtake_Play(4, 0, -1); + } else { + Outtake_Play(5, 0, -1); + } + Outtake_Play(6, 0, -1); + Game_Flag_Reset(679); + } + Actor_Force_Stop_Walking(0); + if (Game_Flag_Query(380)) { + Setup_Scene_Information(-11.0f, 0.0f, -156.0f, 769); + } else if (Game_Flag_Query(79)) { + Setup_Scene_Information(-143.0f, 0.0f, -92.0f, 420); + } else { + Setup_Scene_Information(-183.0f, 0.0f, 128.0f, 205); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 389, 0, 639, 303, 0); + Scene_Exit_Add_2D_Exit(2, 115, 87, 137, 267, 3); + if (Game_Flag_Query(550)) { + Scene_2D_Region_Add(0, 185, 185, 230, 230); + } + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Looping_Sound(205, 20, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(67, 80, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 50, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(380)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptCT08::SceneLoaded() { + Obstacle_Object("ASHTRAY", 1); + Unobstacle_Object("BLANKET03", 1); + if (!Actor_Clue_Query(0, 85)) { + Item_Add_To_World(85, 943, 6, 44.0f, 0.0f, -95.0f, 540, 12, 12, 0, 1, 0, 1); + } + if (!Actor_Clue_Query(0, 87)) { + Item_Add_To_World(81, 936, 6, -102.0f, 2.0f, 41.0f, 432, 6, 6, 0, 1, 0, 1); + } +} + +bool ScriptCT08::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT08::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT08::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT08::ClickedOnItem(int itemId, bool a2) { + if (itemId == 81) { + if (!Loop_Actor_Walk_To_Item(0, 81, 36, 1, 0) && !Game_Flag_Query(550)) { + Actor_Clue_Acquire(0, 87, 1, -1); + Item_Pickup_Spin_Effect(936, 266, 328); + Item_Remove_From_World(81); + Actor_Voice_Over(480, 99); + Actor_Voice_Over(490, 99); + Actor_Voice_Over(500, 99); + } + return true; + } + return false; +} + +bool ScriptCT08::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -183.0f, 0.0f, 128.0f, 0, 1, 0, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(81); + Set_Enter(31, 21); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -11.0f, 0.0f, -156.0f, 0, 1, 0, 0)) { + Loop_Actor_Walk_To_XYZ(0, 0.0f, 0.0f, -102.0f, 0, 0, 0, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(379); + Set_Enter(6, 105); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -143.0f, 0.0f, -92.0f, 0, 1, 0, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(80); + Set_Enter(29, 18); + } + return true; + } + return false; +} + +bool ScriptCT08::ClickedOn2DRegion(int region) { + if (region == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -108.0f, 0.0f, -178.0f, 0, 1, 0, 0)) { + Actor_Face_Heading(0, 512, 0); + Game_Flag_Reset(550); + Player_Set_Combat_Mode_Access(1); + Scene_Exits_Enable(); + Ambient_Sounds_Play_Sound(564, 40, 99, 0, 0); + Scene_2D_Region_Remove(0); + Player_Loses_Control(); + } + return true; + } + return false; +} + +void ScriptCT08::SceneFrameAdvanced(int frame) { +} + +void ScriptCT08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT08::PlayerWalkedIn() { + if (Game_Flag_Query(550)) { + Actor_Change_Animation_Mode(0, 3); + Actor_Change_Animation_Mode(0, 0); + Actor_Set_At_XYZ(0, -148.0f, 0.0f, 4.0f, 256); + Player_Set_Combat_Mode_Access(0); + Scene_Exits_Disable(); + Game_Flag_Reset(380); + Game_Flag_Reset(79); + Autosave_Game(1); + } else if (Game_Flag_Query(380)) { + Game_Flag_Reset(380); + } else if (Game_Flag_Query(79)) { + Game_Flag_Reset(79); + } else { + Loop_Actor_Walk_To_XYZ(0, -156.0f, 0.0f, 128.0f, 0, 0, 0, 0); + Game_Flag_Reset(84); + } +} + +void ScriptCT08::PlayerWalkedOut() { + if (!Actor_Clue_Query(0, 85)) { + Item_Remove_From_World(85); + } +} + +void ScriptCT08::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct09.cpp b/engines/bladerunner/script/ct09.cpp new file mode 100644 index 0000000000..0cc9910b19 --- /dev/null +++ b/engines/bladerunner/script/ct09.cpp @@ -0,0 +1,214 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT09::InitializeScene() { + if (Game_Flag_Query(85)) { + Setup_Scene_Information(160.0f, 349.0f, 587.0f, 490); + } else if (Game_Flag_Query(81)) { + Setup_Scene_Information(235.0f, 3348.52f, 599.0f, 800); + } else { + Setup_Scene_Information(107.0f, 348.52f, 927.0f, 200); + } + Scene_Exit_Add_2D_Exit(0, 321, 164, 345, 309, 1); + Scene_Exit_Add_2D_Exit(1, 0, 0, 15, 479, 3); + Scene_Exit_Add_2D_Exit(2, 198, 177, 263, 311, 0); + Ambient_Sounds_Add_Looping_Sound(336, 28, 0, 1); + Ambient_Sounds_Add_Sound(375, 6, 180, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0); +} + +void ScriptCT09::SceneLoaded() { + Obstacle_Object("PHONE01", true); + Unobstacle_Object("MAINBEAM01", true); + Unobstacle_Object("MIDDLE WALL", true); + Clickable_Object("BELL"); +} + +bool ScriptCT09::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT09::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BELL", objectName)) { + if (Actor_Query_Which_Set_In(62) != 31) { + if (!Loop_Actor_Walk_To_XYZ(0, 229.0f, 348.52f, 851.0f, 36, 1, false, 0)) { + Actor_Face_Object(0, "BELL", true); + Sound_Play(337, 100, 0, 0, 50); + if (!Actor_Query_Goal_Number(27)) { + Actor_Says(27, 160, 3); + } + } + } + return true; + } + return false; +} + +bool ScriptCT09::ClickedOnActor(int actorId) { + if (actorId == 27) { + if (!Actor_Query_Goal_Number(27) && Actor_Query_Which_Set_In(62) != 31) { + if (!Loop_Actor_Walk_To_XYZ(0, 270.0f, 348.52f, 846.0f, 12, 1, false, 0)) { + Player_Loses_Control(); + Actor_Face_Actor(0, 27, true); + if (Global_Variable_Query(1) < 3) { + Actor_Says(0, 650, 3); + Actor_Says(27, 250, 12); + Actor_Says(0, 665, 18); + } else if (Game_Flag_Query(540)) { + Actor_Says(0, 650, 18); + Actor_Says(27, 220, 15); + } else { + Game_Flag_Set(540); + Actor_Says(27, 170, 13); + Actor_Says(0, 630, 12); + Actor_Says(27, 180, 14); + Actor_Says(0, 635, 3); + Actor_Says(27, 190, 15); + Actor_Says(0, 640, 12); + Actor_Says(0, 645, 3); + Actor_Says(27, 200, 13); + Actor_Says(27, 210, 14); + } + Player_Gains_Control(); + } + } + return true; + } + return false; +} + +bool ScriptCT09::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT09::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 206.0f, 348.52f, 599.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 235.0f, 348.52f, 599.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(84); + Set_Enter(6, 20); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 107.0f, 348.52f, 927.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(83); + Set_Enter(33, 23); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 159.0f, 349.0f, 570.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(82); + Set_Enter(32, 22); + } + return true; + } + return false;; +} + +bool ScriptCT09::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT09::SceneFrameAdvanced(int frame) { + if (frame == 6 || frame == 12 || frame == 19 || frame == 25 || frame == 46 || frame == 59) { + Sound_Play(97, Random_Query(47, 47), 70, 70, 50); + } +} + +void ScriptCT09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT09::PlayerWalkedIn() { + bool v0 = false; + if (Global_Variable_Query(1) == 3 && !Game_Flag_Query(538)) { + Game_Flag_Set(538); + Actor_Set_Goal_Number(62, 1); + v0 = true; + } + if (Game_Flag_Query(85)) { + Game_Flag_Reset(85); + } else if (Game_Flag_Query(81)) { + if (v0) { + Async_Actor_Walk_To_XYZ(0, 206.0f, 348.52f, 599.0f, 0, false); + } else { + Loop_Actor_Walk_To_XYZ(0, 206.0f, 348.52f, 599.0f, 0, 0, false, 0); + } + Game_Flag_Reset(81); + } else { + if (v0) { + Async_Actor_Walk_To_XYZ(0, 124.0f, 348.52f, 886.0f, 0, false); + } else { + Loop_Actor_Walk_To_XYZ(0, 124.0f, 348.52f, 886.0f, 0, 0, false, 0); + } + Game_Flag_Reset(304); + } + if (Actor_Query_Goal_Number(27) == 2) { + if (Game_Flag_Query(539)) { + Actor_Says(27, 70, 13); + Actor_Face_Actor(0, 27, true); + Actor_Says(0, 600, 17); + Actor_Says(27, 80, 14); + Actor_Says(0, 605, 13); + Actor_Says(27, 90, 15); + } else { + Actor_Says(27, 20, 12); + Actor_Face_Actor(0, 27, true); + Actor_Says(0, 585, 18); + Actor_Says(27, 40, 15); + Actor_Says(0, 590, 16); + Actor_Says(27, 50, 14); + Actor_Says(0, 595, 14); + Actor_Says(27, 60, 13); + Actor_Modify_Friendliness_To_Other(27, 0, -1); + } + Actor_Set_Goal_Number(27, 0); + } +} + +void ScriptCT09::PlayerWalkedOut() { +} + +void ScriptCT09::DialogueQueueFlushed(int a1) { + Actor_Force_Stop_Walking(0); + if (Actor_Query_Goal_Number(62) == 1 && !Game_Flag_Query(539)) { + Player_Loses_Control(); + Actor_Set_Goal_Number(62, 2); + //return true; + } else { + //return false; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct10.cpp b/engines/bladerunner/script/ct10.cpp new file mode 100644 index 0000000000..1781394c57 --- /dev/null +++ b/engines/bladerunner/script/ct10.cpp @@ -0,0 +1,160 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT10::InitializeScene() { + Setup_Scene_Information(-121.0f, 0.0f, -78.0f, 446); + Game_Flag_Reset(84); + Scene_Exit_Add_2D_Exit(0, 135, 74, 238, 340, 0); + Ambient_Sounds_Add_Looping_Sound(336, 28, 0, 1); + Ambient_Sounds_Add_Sound(375, 6, 180, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0); +} + +void ScriptCT10::SceneLoaded() { + Obstacle_Object("BED", true); + Unobstacle_Object("WINDOW", true); + Unobstacle_Object("LOFT01", true); + Unobstacle_Object("LOFT02", true); + Unobstacle_Object("LOFT03", true); + Unobstacle_Object("LOFT04", true); + Unobstacle_Object("LOFT05", true); + Unobstacle_Object("LOFT06", true); + Unobstacle_Object("LOFT10", true); + Unobstacle_Object("LOFT11", true); + Unobstacle_Object("LOFT12", true); + Unobstacle_Object("LINE02", true); + Unobstacle_Object("CABINETFRONT", true); + Unobstacle_Object("CABINTESIDE", true); + Unobstacle_Object("BUSTEDTAPE2", true); + Unobstacle_Object("BOX CLOSET 1", true); + Clickable_Object("BED"); + Clickable_Object("CABINETFRONT"); + Clickable_Object("CABINETTOP"); + Clickable_Object("TUB"); + Scene_2D_Region_Add(0, 379, 229, 454, 375); +} + +bool ScriptCT10::MouseClick(int x, int y) { + return false; +} + +void ScriptCT10::sub_401844() { + if (!Loop_Actor_Walk_To_XYZ(0, 10.6f, 0.0f, -50.5f, 0, 1, false, 0)) { + Player_Loses_Control(); + Actor_Face_Heading(0, 0, false); + Sound_Play(339, 100, 0, 0, 50); + Delay(1000); + if (Actor_Clue_Query(0, 110)) { + Actor_Voice_Over(3700, 99); + } else { + Item_Pickup_Spin_Effect(931, 435, 258); + Actor_Clue_Acquire(0, 110, 1, -1); + } + Player_Gains_Control(); + } +} + +bool ScriptCT10::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("TUB", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -41.0f, 0.0f, -106.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + Actor_Face_Heading(0, 850, false); + Actor_Change_Animation_Mode(0, 38); + Delay(1000); + Sound_Play(338, 33, 0, 0, 50); + Delay(3000); + if (Actor_Clue_Query(0, 93)) { + Actor_Voice_Over(3700, 99); + } else { + Actor_Clue_Acquire(0, 93, 1, -1); + Item_Pickup_Spin_Effect(969, 364, 214); + } + Delay(1000); + Loop_Actor_Walk_To_XYZ(0, -41.0f, 0.0f, -82.0f, 0, 0, false, 1); + Player_Gains_Control(); + } + return true; + } + if (Object_Query_Click("CABINETTOP", objectName) || Object_Query_Click("CABINETFRONT", objectName)) { + sub_401844(); + return true; + } + return false; +} + +bool ScriptCT10::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT10::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT10::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -93.0f, 0.0f, -38.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -121.0f, 0.0f, -78.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(85); + Set_Enter(31, 21); + } + } + return false; +} + +bool ScriptCT10::ClickedOn2DRegion(int region) { + if (region == 0) { + sub_401844(); + } + return false; +} + +void ScriptCT10::SceneFrameAdvanced(int frame) { +} + +void ScriptCT10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT10::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, -93.0f, 0.0f, -38.0f, 0, 0, false, 0); + Loop_Actor_Walk_To_XYZ(0, -49.0f, 0.0f, -38.0f, 0, 0, false, 0); + if (!Game_Flag_Query(525)) { + Actor_Voice_Over(450, 99); + Actor_Voice_Over(460, 99); + Actor_Voice_Over(470, 99); + Game_Flag_Set(525); + } +} + +void ScriptCT10::PlayerWalkedOut() { +} + +void ScriptCT10::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct11.cpp b/engines/bladerunner/script/ct11.cpp new file mode 100644 index 0000000000..3ef0bec48d --- /dev/null +++ b/engines/bladerunner/script/ct11.cpp @@ -0,0 +1,213 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT11::InitializeScene() { + if (Game_Flag_Query(91)) { + Setup_Scene_Information(-378.0f, 9.68f, -55.0f, 440); + } else if (Game_Flag_Query(558)) { + Setup_Scene_Information(315.0f, 0.0f, 628.0f, 0); + } else { + Setup_Scene_Information(152.0f, 9.68f, -8.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 257, 240, 364, 330, 1); + Scene_Exit_Add_2D_Exit(1, 97, 0, 155, 324, 0); + Scene_Exit_Add_2D_Exit(2, 0, 0, 20, 479, 3); + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Sound(67, 5, 80, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(66, 5, 80, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(378, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + if (Global_Variable_Query(1) <= 3) { + Scene_Loop_Set_Default(0); + } else { + Scene_Loop_Set_Default(2); + } +} + +void ScriptCT11::SceneLoaded() { + Obstacle_Object("TRASH CAN", true); + Unobstacle_Object("BOX NORTHWEST 1", true); + Unobstacle_Object("BOX SOUTH 1", true); + if (Global_Variable_Query(1) < 4) { + if (!Game_Flag_Query(645)) { + Item_Add_To_World(115, 951, 33, 640.21002f, 30.0f, 470.0f, 512, 12, 12, false, true, false, true); + Scene_2D_Region_Add(0, 505, 316, 513, 321); + Game_Flag_Set(725); + } + if (!Actor_Clue_Query(0, 111)) { + Scene_2D_Region_Add(1, 412, 258, 552, 358); + } + } else { + if (Game_Flag_Query(725)) { + Item_Remove_From_World(115); + Game_Flag_Reset(725); + Game_Flag_Set(645); + } + Unobstacle_Object("BRIDGE SUPPORT", true); + Unobstacle_Object("BODY", true); + Unobstacle_Object("HEADLIGHTS", true); + Unobstacle_Object("LICENSE PLATE-FRONT", true); + Unobstacle_Object("LICENSE PLATE-REAR", true); + Unobstacle_Object("BRAKE DISC RF", true); + Unobstacle_Object("TIRE RF", true); + Unobstacle_Object("RIM RF", true); + Unobstacle_Object("DOOR RIGHT", true); + Unobstacle_Object("BUMPER REAR", true); + } + Unclickable_Object("TRASH CAN"); +} + +bool ScriptCT11::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT11::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT11::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT11::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT11::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 121.0f, 9.6800003f, -42.0f, 0, 1, false, 0)) { + Game_Flag_Set(304); + Set_Enter(31, 21); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -300.0f, 9.6800003f, 66.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -400.0f, 9.6800003f, -70.0f, 0, 1, false, 0); + Game_Flag_Set(86); + Set_Enter(4, 24); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 290.0f, 0.0f, 635.0f, 0, 1, false, 0)) { + Game_Flag_Set(531); + Game_Flag_Reset(176); + Game_Flag_Set(177); + Set_Enter(7, 25); + } + return true; + } + return false; +} + +bool ScriptCT11::ClickedOn2DRegion(int region) { + if (region == 0 && Game_Flag_Query(725)) { + if (!Loop_Actor_Walk_To_XYZ(0, 686.0f, 0.0f, 658.0f, 12, 1, false, 0)) { + Actor_Face_Heading(0, 47, false); + Item_Remove_From_World(115); + Actor_Clue_Acquire(0, 118, 0, -1); + Item_Pickup_Spin_Effect(951, 510, 319); + Game_Flag_Reset(725); + Game_Flag_Set(645); + Actor_Voice_Over(550, 99); + Actor_Voice_Over(560, 99); + Actor_Voice_Over(570, 99); + Actor_Voice_Over(580, 99); + } + return true; + } + if (region == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 686.0f, 0.0f, 658.0f, 12, 1, false, 0)) { + Actor_Face_Heading(0, 47, false); + int temp = 0; + if (Actor_Clue_Query(0, 17)) { + temp = 1; + } + if (Actor_Clue_Query(0, 26)) { + ++temp; + } + if (Actor_Clue_Query(0, 39)) { + ++temp; + } + if (Actor_Clue_Query(0, 37)) { + temp += 2; + } + if (Actor_Clue_Query(0, 30)) { + temp += 2; + } + if (Actor_Clue_Query(0, 31)) { + temp += 2; + } + if (temp <= 2 || Actor_Clue_Query(0, 111)) { + Actor_Says(0, 8525, 12); + } else { + Actor_Voice_Over(510, 99); + Actor_Voice_Over(520, 99); + Actor_Voice_Over(530, 99); + Actor_Voice_Over(540, 99); + Actor_Clue_Acquire(0, 111, 0, -1); + Scene_2D_Region_Remove(1); + } + } + return true; + } + return false; +} + +void ScriptCT11::SceneFrameAdvanced(int frame) { +} + +void ScriptCT11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT11::PlayerWalkedIn() { + if (Game_Flag_Query(91)) { + Loop_Actor_Walk_To_XYZ(0, -358.0f, 9.68f, 32.0f, 0, 0, false, 0); + Game_Flag_Reset(91); + } else if (Game_Flag_Query(558)) { + Loop_Actor_Walk_To_XYZ(0, 329.0f, 0.0f, 617.0f, 0, 0, false, 0); + Game_Flag_Reset(558); + } else { + Player_Loses_Control(); + Actor_Set_Immunity_To_Obstacles(0, true); + Loop_Actor_Walk_To_XYZ(0, 125.0f, 9.68f, 74.0f, 0, 0, false, 0); + Actor_Set_Immunity_To_Obstacles(0, false); + Player_Gains_Control(); + Game_Flag_Reset(83); + } +} + +void ScriptCT11::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptCT11::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct12.cpp b/engines/bladerunner/script/ct12.cpp new file mode 100644 index 0000000000..eabd25b76c --- /dev/null +++ b/engines/bladerunner/script/ct12.cpp @@ -0,0 +1,284 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT12::InitializeScene() { + if (Game_Flag_Query(123)) { + Setup_Scene_Information(-419.0f, -6.5f, 696.0f, 616); + } else if (Game_Flag_Query(432)) { + Setup_Scene_Information(-292.0f, -6.5f, 990.0f, 827); + if (!Game_Flag_Query(150)) { + Game_Flag_Set(150); + } + Game_Flag_Reset(432); + } else if (Game_Flag_Query(86)) { + Setup_Scene_Information(-493.0f, -6.5f, 1174.0f, 990); + } else { + Setup_Scene_Information(-386.13f, -6.5f, 1132.72f, 783); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 40, 479, 3); + Scene_Exit_Add_2D_Exit(1, 78, 224, 162, 330, 0); + Scene_Exit_Add_2D_Exit(2, 500, 180, 619, 346, 0); + if (Global_Variable_Query(1) > 2) { + Scene_Exit_Add_2D_Exit(3, 620, 0, 639, 479, 1); + } + if (Global_Variable_Query(1) > 3) { + Scene_Exit_Add_2D_Exit(4, 324, 150, 435, 340, 0); + } + Ambient_Sounds_Add_Looping_Sound(54, 33, 1, 1); + Ambient_Sounds_Add_Looping_Sound(55, 20, -100, 1); + Ambient_Sounds_Add_Looping_Sound(56, 20, -100, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 20, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Global_Variable_Query(1) < 2 && Actor_Query_Goal_Number(53) == 1) { + Actor_Put_In_Set(53, 4); + Actor_Set_At_XYZ(53, -534.0f, -6.5f, 952.0f, 367); + Game_Flag_Set(294); + } + if (Game_Flag_Query(123) && Game_Flag_Query(248)) { + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Scene_Loop_Start_Special(0, 1, 0); + } + Scene_Loop_Set_Default(2); + Game_Flag_Reset(123); + } else if (Game_Flag_Query(123) && !Game_Flag_Query(248)) { + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Scene_Loop_Start_Special(0, 0, 0); + } + Scene_Loop_Set_Default(2); + Game_Flag_Reset(123); + } else if (Game_Flag_Query(76) && Game_Flag_Query(294)) { + Game_Flag_Reset(76); + Scene_Loop_Set_Default(4); + } else if (Game_Flag_Query(76) && !Game_Flag_Query(294)) { + Game_Flag_Reset(76); + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(2); + + } +} + +void ScriptCT12::SceneLoaded() { + Obstacle_Object("BOX18", true); + Unobstacle_Object("SPINNER BODY", true); + Unobstacle_Object("HOWFLOOR", true); + Unclickable_Object("TURBINE"); +} + +bool ScriptCT12::MouseClick(int x, int y) { + return false; +} + +bool ScriptCT12::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptCT12::ClickedOnActor(int actorId) { + if (actorId == 28) { + Actor_Face_Actor(0, 28, true); + Actor_Says(0, 8910, 16); + } + if (actorId == 24 && Global_Variable_Query(1) == 4 && Game_Flag_Query(671) && Game_Flag_Query(703)) { + Actor_Face_Actor(24, 0, true); + Actor_Face_Actor(0, 24, true); + Actor_Says(0, 710, 3); + Actor_Says(24, 20, 3); + Actor_Says(0, 715, 3); + Actor_Says(24, 30, 3); + Actor_Says(0, 720, 3); + Actor_Says(24, 40, 3); + Actor_Says(24, 50, 3); + Actor_Says(24, 60, 3); + Actor_Says(0, 725, 3); + Actor_Says(24, 70, 3); + Actor_Says(24, 80, 3); + Actor_Says(24, 90, 3); + Actor_Says(24, 100, 3); + Actor_Says(24, 110, 3); + Game_Flag_Set(629); + Game_Flag_Set(666); + Actor_Set_Goal_Number(0, 400); + } + return false; +} + +bool ScriptCT12::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptCT12::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -419.14999f, -6.5f, 696.94f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Game_Flag_Set(88); + Set_Enter(4, 13); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -182.69f, -6.5f, 696.94f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(89); + Set_Enter(5, 15); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -386.13f, -6.5f, 1132.72f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(90); + Set_Enter(28, 17); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, -493.0f, -6.5f, 1174.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(91); + Set_Enter(33, 23); + } + return true; + } + if (exitId == 4) { + if (!Loop_Actor_Walk_To_XYZ(0, -292.0f, -6.5f, 990.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) == 4) { + Game_Flag_Set(629); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(433); + Set_Enter(82, 94); + } + return true; + } + return false; +} + +bool ScriptCT12::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT12::SceneFrameAdvanced(int frame) { + if (!((frame - 1) % 10)) { + /*int v2 = Random_Query(0, 1); + if (v2 <= 1) + { + if (v2) + { + v1 = 60; + } + else + { + v1 = 59; + } + }*/ + Sound_Play(/*v1*/Random_Query(59, 60), 10, -80, -80, 50); + } + if (frame == 160) { + Actor_Change_Animation_Mode(53, 41); + } + if (frame == 152) { + Sound_Play(116, 100, 40, 0, 50); + } + if (frame == 203) { + Sound_Play(119, 100, 40, 0, 50); + } + if (frame == 212) { + Sound_Play(117, 40, 0, 0, 50); + } + if (frame == 269) { + Player_Gains_Control(); + Player_Set_Combat_Mode(false); + Actor_Set_Invisible(53, false); + } +} + +void ScriptCT12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT12::PlayerWalkedIn() { + if (Global_Variable_Query(1) < 2 && !Game_Flag_Query(64) && Actor_Query_Goal_Number(53) == 1) { + Player_Loses_Control(); + Loop_Actor_Walk_To_Actor(53, 0, 48, 0, false); + Actor_Face_Actor(53, 0, true); + Actor_Face_Actor(0, 53, true); + Actor_Says(53, 0, 3); + Actor_Says(0, 670, 3); + Actor_Says(53, 10, 3); + Actor_Says(0, 675, 3); + Actor_Says(53, 20, 3); + Actor_Says(0, 680, 3); + Actor_Says(53, 30, 3); + Actor_Says(0, 685, 3); + Actor_Says(53, 40, 3); + Actor_Says(0, 690, 3); + Actor_Clue_Acquire(0, 33, 1, 53); + Game_Flag_Set(64); + CDB_Set_Crime(20, 8); + if (Game_Flag_Query(64) && Game_Flag_Query(40)) { + Actor_Says(53, 50, 3); + Actor_Says(0, 695, 3); + Actor_Says(53, 60, 3); + Actor_Says(0, 700, 3); + Actor_Says(53, 70, 3); + Actor_Clue_Acquire(53, 222, 1, -1); + } else if (Game_Flag_Query(64) && Game_Flag_Query(41)) { + Actor_Says(53, 80, 3); + Actor_Says(53, 90, 3); + Actor_Says(0, 705, 3); + Actor_Says(53, 100, 3); + Actor_Clue_Acquire(53, 215, 1, -1); + } + Actor_Set_Goal_Number(53, 2); + } + if (Game_Flag_Query(86)) { + Loop_Actor_Walk_To_XYZ(0, -520.0f, -6.5f, 1103.0f, 0, 0, false, 0); + Game_Flag_Reset(86); + } +} + +void ScriptCT12::PlayerWalkedOut() { + Game_Flag_Reset(443); + if (Game_Flag_Query(433)) { + Game_Flag_Reset(176); + Game_Flag_Set(259); + } +} + +void ScriptCT12::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ct51.cpp b/engines/bladerunner/script/ct51.cpp new file mode 100644 index 0000000000..bc47dddb21 --- /dev/null +++ b/engines/bladerunner/script/ct51.cpp @@ -0,0 +1,129 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptCT51::InitializeScene() { + Setup_Scene_Information(0.0f, 0.0f, -102.0f, 470); + Game_Flag_Reset(379); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptCT51::SceneLoaded() { + Unobstacle_Object("BLANKET03", true); + Clickable_Object("BED02"); + if (!Actor_Clue_Query(0, 85)) { + Item_Add_To_World(85, 943, 6, 44.0f, 0.0f, -95.0f, 540, 24, 24, false, true, false, true); + } + if (!Actor_Clue_Query(0, 86)) { + Item_Add_To_World(120, 984, 6, 44.0f, 0.0f, -22.0f, 0, 12, 12, false, true, false, true); + } +} + +bool ScriptCT51::MouseClick(int x, int y) { + return true; +} + +bool ScriptCT51::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BED02", objectName)) { + if (Actor_Clue_Query(0, 84)) { + Actor_Says(0, 8580, 12); + return false; + } + Item_Pickup_Spin_Effect(970, 203, 200); + Actor_Clue_Acquire(0, 84, 1, -1); + Actor_Voice_Over(420, 99); + return true; + } + return false; +} + +bool ScriptCT51::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptCT51::ClickedOnItem(int itemId, bool a2) { + if (itemId == 85) { + Actor_Clue_Acquire(0, 85, 1, -1); + Item_Pickup_Spin_Effect(943, 260, 200); + Ambient_Sounds_Play_Sound(563, 40, 99, 0, 0); + Item_Remove_From_World(85); + return true; + } + if (itemId == 120) { + Actor_Clue_Acquire(0, 86, 1, -1); + Item_Pickup_Spin_Effect(984, 490, 307); + Item_Remove_From_World(120); + Actor_Says(0, 8527, 3); + return true; + } + return false; +} + +bool ScriptCT51::ClickedOnExit(int exitId) { + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 0.0f, 0.0f, -102.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -11.0f, 0.0f, -156.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(380); + Set_Enter(6, 20); + } + return true; + } + return false; + +} + +bool ScriptCT51::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptCT51::SceneFrameAdvanced(int frame) { +} + +void ScriptCT51::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptCT51::PlayerWalkedIn() { +} + +void ScriptCT51::PlayerWalkedOut() { + if (!Actor_Clue_Query(0, 85)) { + Item_Remove_From_World(85); + } +} + +void ScriptCT51::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr01.cpp b/engines/bladerunner/script/dr01.cpp new file mode 100644 index 0000000000..e8d89a27fe --- /dev/null +++ b/engines/bladerunner/script/dr01.cpp @@ -0,0 +1,262 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR01::InitializeScene() { + if (Game_Flag_Query(225)) { + Setup_Scene_Information(-835.0f, -0.04f, -118.0f, 664); + } else if (Game_Flag_Query(11)) { + Setup_Scene_Information(-711.0f, -0.04f, 70.0f, 307); + } else if (Game_Flag_Query(531)) { + Setup_Scene_Information(-1765.28f, -0.04f, -23.82f, 269); + } else { + Setup_Scene_Information(-386.0f, -0.04f, -82.0f, 792); + } + Scene_Exit_Add_2D_Exit(0, 240, 60, 450, 250, 0); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + if (Game_Flag_Query(253) && Global_Variable_Query(1) < 4) { + Scene_Exit_Add_2D_Exit(2, 610, 0, 639, 479, 1); + } + if (Global_Variable_Query(1) >= 3) { + Scene_Exit_Add_2D_Exit(3, 0, 45, 142, 201, 0); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(219, 12, 85, 1); + Ambient_Sounds_Add_Looping_Sound(98, 14, 85, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(67, 5, 80, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(66, 5, 80, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(378, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 5, 80, 50, 100, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(272) && Game_Flag_Query(11)) { + Scene_Loop_Start_Special(0, 3, 0); + Scene_Loop_Set_Default(4); + } else if (!Game_Flag_Query(272) && Game_Flag_Query(11)) { + Scene_Loop_Start_Special(0, 2, 0); + Scene_Loop_Set_Default(4); + } else if (Game_Flag_Query(225)) { + Scene_Loop_Start_Special(0, 1, 0); + Scene_Loop_Set_Default(4); + } else if (Game_Flag_Query(531) == 1) { + Scene_Loop_Set_Default(4); + } else { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(4); + } +} + +void ScriptDR01::SceneLoaded() { + Obstacle_Object("TRASH CAN WITH FIRE", true); + Obstacle_Object("V2PYLON02", true); + Obstacle_Object("V2PYLON04", true); + Obstacle_Object("U2 CHEWDOOR", true); + Obstacle_Object("MMTRASHCAN", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("TRANSFORMER 01", true); + Obstacle_Object("TRANSFORMER 02", true); + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("Z2TRSHCAN", true); + Obstacle_Object("Z2ENTRYDR", true); + Obstacle_Object("Z2DR2", true); + Unobstacle_Object("V2 BUILD01", true); +} + +bool ScriptDR01::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptDR01::ClickedOnActor(int actorId) { + return actorId == 50; +} + +bool ScriptDR01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptDR01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -835.0f, -0.04f, -118.0f, 0, 1, false, 0)) { + Async_Actor_Walk_To_XYZ(0, -911.0f, -0.04f, -118.0f, 0, false); + Ambient_Sounds_Adjust_Looping_Sound(112, 10, -100, 1); + Game_Flag_Set(224); + Set_Enter(7, 26); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -711.0f, -0.04f, 70.0f, 0, 1, false, 0)) { + Async_Actor_Walk_To_XYZ(0, -796.0f, -0.04f, 166.0f, 0, false); + Game_Flag_Set(10); + Set_Enter(7, 28); + } + return true; + } + if (exitId == 2) { + if (Loop_Actor_Walk_To_XYZ(0, -372.0f, -0.04f, -82.0f, 0, 1, false, 0)) { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(180); + Game_Flag_Reset(261); + Game_Flag_Reset(177); + Game_Flag_Reset(258); + int spinnerDest = Spinner_Interface_Choose_Dest(-1, 0); + switch (spinnerDest) { + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(253); + Game_Flag_Set(249); + Set_Enter(69, 78); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(253); + Game_Flag_Set(248); + Set_Enter(4, 13); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(253); + Game_Flag_Set(250); + Set_Enter(49, 48); + break; + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(253); + Game_Flag_Set(251); + Set_Enter(61, 65); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(253); + Game_Flag_Set(307); + Set_Enter(17, 82); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(253); + Game_Flag_Set(252); + Set_Enter(0, 0); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(253); + Game_Flag_Set(254); + Set_Enter(20, 2); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(253); + Game_Flag_Set(255); + Set_Enter(54, 54); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(253); + Game_Flag_Set(256); + Set_Enter(37, 34); + break; + default: + Player_Loses_Control(); + Game_Flag_Set(177); + Loop_Actor_Walk_To_XYZ(0, -447.39f, 0.16f, -92.38f, 0, 0, true, 0); + Player_Gains_Control(); + break; + } + } + return true; + } + + if (exitId == 3) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + bool v7 = false; + if (-1200 < x) { + v7 = Loop_Actor_Walk_To_XYZ(0, -1236.4f, -0.04f, -13.91f, 0, 1, false, 0); + } + if (!v7) { + Game_Flag_Set(558); + Game_Flag_Set(176); + Game_Flag_Reset(177); + Set_Enter(33, 23); + } + return true; + } + return false; +} + +bool ScriptDR01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptDR01::SceneFrameAdvanced(int frame) { + if (frame < 75) { + Actor_Set_Invisible(0, true); + } else { + Actor_Set_Invisible(0, false); + } + if (frame == 2) { + Ambient_Sounds_Play_Sound(487, 40, -40, 100, 99); + } +} + +void ScriptDR01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR01::PlayerWalkedIn() { + if (Game_Flag_Query(531)) { + Async_Actor_Walk_To_XYZ(0, -757.15f, -0.04f, 24.64f, 0, false); + } else if (!Game_Flag_Query(225) && !Game_Flag_Query(11)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -447.39f, 0.16f, -92.38f, 0, 0, false, 0); + Player_Gains_Control(); + } + Game_Flag_Reset(225); + Game_Flag_Reset(11); + Game_Flag_Reset(531); +} + +void ScriptDR01::PlayerWalkedOut() { + if (!Game_Flag_Query(10) && !Game_Flag_Query(224) && !Game_Flag_Query(558)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(35, 1, -1); + } +} + +void ScriptDR01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr02.cpp b/engines/bladerunner/script/dr02.cpp new file mode 100644 index 0000000000..c075d808f5 --- /dev/null +++ b/engines/bladerunner/script/dr02.cpp @@ -0,0 +1,183 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR02::InitializeScene() { + if (Game_Flag_Query(227)) { + Setup_Scene_Information(-1162.0f, 7.18f, -322.0f, 552); + } else if (Game_Flag_Query(224)) { + Setup_Scene_Information(-835.0f, -0.04f, -118.0f, 193); + } else if (Game_Flag_Query(264)) { + Setup_Scene_Information(-1258.0f, 7.18f, -314.0f, 400); + } else { + Setup_Scene_Information(168.78f, 0.16f, -775.71997f, 193); + } + Scene_Exit_Add_2D_Exit(0, 605, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 222, 176, 279, 314, 0); + if (Game_Flag_Query(326)) { + Scene_Exit_Add_2D_Exit(2, 95, 0, 148, 292, 0); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Remove_All_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(219, 27, 85, 1); + Ambient_Sounds_Add_Looping_Sound(98, 38, 85, 1); + Ambient_Sounds_Add_Sound(378, 2, 50, 33, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 2, 50, 33, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 2, 50, 33, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(67, 5, 100, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(66, 5, 100, 16, 25, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(224)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptDR02::SceneLoaded() { + Obstacle_Object("TRASH CAN WITH FIRE", true); + Obstacle_Object("V2PYLON02", true); + Obstacle_Object("V2PYLON04", true); + Obstacle_Object("U2 CHEWDOOR", true); + Obstacle_Object("MMTRASHCAN", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("TRANSFORMER 01", true); + Obstacle_Object("TRANSFORMER 02", true); + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("Z2ENTRYDR", true); + Obstacle_Object("Z2DR2", true); + Clickable_Object("TRASH CAN WITH FIRE"); + Clickable_Object("U2 CHEWDOOR"); + Clickable_Object("MMTRASHCAN"); + Clickable_Object("U2 EYE"); + Clickable_Object("U2 E"); + Clickable_Object("MMNEWSP01"); + Clickable_Object("MMNEWSP01"); + Clickable_Object("MMNEWSP04"); + Clickable_Object("MMNEWSP05"); + Clickable_Object("MMNEWSP07"); + Clickable_Object("PARKMETR02"); + Clickable_Object("TRANSFORMER 01"); + Clickable_Object("TRANSFORMER 02"); + Clickable_Object("V2CANPIPE02"); + Unclickable_Object("TRASH CAN WITH FIRE"); + Unclickable_Object("U2 CHEWDOOR"); + Unclickable_Object("MMTRASHCAN"); + Unclickable_Object("U2 EYE"); + Unclickable_Object("U2 E"); + Unclickable_Object("MMNEWSP01"); + Unclickable_Object("MMNEWSP02"); + Unclickable_Object("MMNEWSP04"); + Unclickable_Object("MMNEWSP06"); + Unclickable_Object("MMNEWSP07"); + Unclickable_Object("PARKMETR02"); + Unclickable_Object("TRANSFORMER 01"); + Unclickable_Object("TRANSFORMER 02"); + Unclickable_Object("V2CANPIPE02"); +} + +bool ScriptDR02::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptDR02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptDR02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptDR02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -835.0f, -0.04f, -118.0f, 0, 1, false, 0)) { + Async_Actor_Walk_To_XYZ(0, -727.0f, -0.04f, -118.0f, 0, false); + Game_Flag_Set(225); + Set_Enter(7, 25); + } + Ambient_Sounds_Adjust_Looping_Sound(219, 12, -101, 1); + Ambient_Sounds_Adjust_Looping_Sound(98, 14, -101, 1); + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -1162.0f, 7.18f, -322.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) > 2) { + Actor_Says(0, 8522, 15); + } else { + Game_Flag_Set(226); + Set_Enter(34, 27); + } + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -1258.0f, 7.18f, -314.0f, 0, 1, false, 0)) { + Game_Flag_Set(265); + Game_Flag_Reset(177); + Game_Flag_Set(258); + Set_Enter(20, 2); + } + return true; + } + return false; +} + +bool ScriptDR02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptDR02::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Sound_Play(1, 10, 85, 85, 50); + } +} + +void ScriptDR02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR02::PlayerWalkedIn() { + if (Game_Flag_Query(227)) { + Game_Flag_Reset(227); + } + if (Game_Flag_Query(224)) { + Game_Flag_Reset(224); + } + if (Game_Flag_Query(264)) { + Game_Flag_Reset(264); + } +} + +void ScriptDR02::PlayerWalkedOut() { +} + +void ScriptDR02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr03.cpp b/engines/bladerunner/script/dr03.cpp new file mode 100644 index 0000000000..cea23b7ec3 --- /dev/null +++ b/engines/bladerunner/script/dr03.cpp @@ -0,0 +1,288 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR03::InitializeScene() { + if (Game_Flag_Query(226)) { + Game_Flag_Reset(226); + Setup_Scene_Information(330.31f, 4.27f, -910.91f, 297); + } + Setup_Scene_Information(330.31f, 4.27f, -910.91f, 297); + Scene_Exit_Add_2D_Exit(0, 377, 122, 445, 266, 0); + if (Global_Variable_Query(1) == 3) { + Actor_Put_In_Set(52, 34); + Actor_Set_At_XYZ(52, 431.21f, 4.27f, -776.26f, 0); + } else { + Actor_Put_In_Set(52, 34); + Actor_Set_At_XYZ(52, 360.77f, 4.4f, -806.67f, 126); + } + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Ambient_Sounds_Add_Looping_Sound(110, 7, 0, 1); + Ambient_Sounds_Add_Looping_Sound(109, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(95, 20, 70, 1); +} + +void ScriptDR03::SceneLoaded() { + Obstacle_Object("W2-CENTCASE02", 1); + Obstacle_Object("W2-CARTTOP", 1); + Obstacle_Object("W2-TANKAFLUID01", 1); +} + +bool ScriptDR03::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptDR03::ClickedOnActor(int actorId) { + if (actorId == 52) { + Actor_Face_Actor(0, 52, 1); + Actor_Face_Actor(52, 0, 1); + if (!Game_Flag_Query(267)) { + Actor_Says(0, 755, 18); + Actor_Says(52, 10, 14); + Actor_Says(0, 760, 18); + Actor_Says(52, 20, 14); + Actor_Says(0, 765, 18); + Actor_Says(52, 30, 14); + Game_Flag_Set(267); + return true; + } + if (Actor_Clue_Query(0, 67)) { + if (Game_Flag_Query(266) && Game_Flag_Query(267)) { + Actor_Says(0, 815, 18); + Actor_Says(52, 60, 14); + Actor_Says(52, 70, 14); + Actor_Says(52, 80, 14); + Actor_Says(0, 820, 18); + Actor_Says(52, 90, 14); + Actor_Says(0, 825, 18); + Actor_Says(52, 100, 14); + Game_Flag_Reset(266); + Game_Flag_Set(505); + return true; + } + if ((Actor_Clue_Query(0, 147) || Actor_Clue_Query(0, 71) || Actor_Clue_Query(0, 76) || Actor_Clue_Query(0, 67)) + && Game_Flag_Query(505)) { + sub_401B18(); + } else { + Actor_Says(0, 810, 18); + Actor_Says(52, 40, 14); + Actor_Says(52, 50, 14); + } + return true; + } + Actor_Says(0, 770, 12); + Actor_Says(52, 110, 12); + Actor_Says(52, 120, 13); + Actor_Says(0, 835, 13); + Actor_Says(52, 130, 14); + Actor_Says(0, 840, 16); + Actor_Says(52, 140, 15); + if (!Game_Flag_Query(505)) { + Actor_Says(52, 150, 13); + Actor_Says(0, 845, 17); + Actor_Says(52, 170, 18); + Actor_Says(52, 180, 16); + Actor_Says(0, 850, 15); + Actor_Says(52, 190, 14); + Actor_Says(52, 200, 13); + Actor_Says(0, 855, 18); + Actor_Says(52, 210, 12); + } + Actor_Clue_Acquire(0, 67, 1, 52); + return true; + } + return false; +} + +bool ScriptDR03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptDR03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 330.31f, 4.27f, -910.91f, 24, 1, 0, 0)) { + Game_Flag_Set(227); + Set_Enter(7, 26); + } + return true; + } + return false; +} + +bool ScriptDR03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptDR03::SceneFrameAdvanced(int frame) { + if (frame == 1 || frame == 4 || frame == 8 || frame == 10 || frame == 19 || frame == 21 || frame == 22 || frame == 23 || frame == 30 || frame == 31 || frame == 32 || frame == 33 || frame == 46 || frame == 49) { + if (Random_Query(0, 1)) { + Sound_Play(97, Random_Query(20, 33), 80, 80, 50); + } else { + Sound_Play(59, Random_Query(5, 6), 80, 80, 50); + } + } +} + +void ScriptDR03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR03::PlayerWalkedIn() { + if (!Game_Flag_Query(226)) { + if (Random_Query(1, 2) == 1) { + Actor_Says(52, 660, 14); + Actor_Says(52, 680, 14); + } else if (Random_Query(1, 2) == 2) { + Actor_Says(52, 670, 14); + Actor_Says(52, 620, 14); + } else { + Actor_Says(52, 690, 14); + Actor_Says(52, 710, 14); + } + } +} + +void ScriptDR03::PlayerWalkedOut() { +} + +void ScriptDR03::DialogueQueueFlushed(int a1) { +} + +void ScriptDR03::sub_401B18() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 67) || Actor_Clue_Query(0, 71) || Actor_Clue_Query(0, 68)) { + DM_Add_To_List_Never_Repeat_Once_Selected(650, 5, 5, 5); + } + if (Actor_Clue_Query(0, 67)) { + DM_Add_To_List_Never_Repeat_Once_Selected(660, 5, 5, 5); + } + if (Actor_Clue_Query(0, 279)) { + DM_Add_To_List_Never_Repeat_Once_Selected(670, 6, 5, 2); + } + if (Game_Flag_Query(505)) { + if (Actor_Clue_Query(0, 71)) { + DM_Add_To_List_Never_Repeat_Once_Selected(680, 8, 8, 8); + } + if (Actor_Clue_Query(0, 76)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1270, 2, 5, 7); + } + } + Dialogue_Menu_Add_DONE_To_List(690); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 640: + Actor_Says(0, 770, 12); + Actor_Says(52, 110, 12); + Actor_Says(52, 120, 13); + Actor_Says(0, 835, 13); + Actor_Says(52, 130, 14); + Actor_Says(0, 840, 16); + Actor_Says(52, 140, 15); + if (!Game_Flag_Query(505)) { + Actor_Says(52, 150, 13); + Actor_Says(0, 845, 17); + Actor_Says(52, 170, 18); + Actor_Says(52, 180, 16); + Actor_Says(0, 850, 15); + Actor_Says(52, 190, 14); + Actor_Says(52, 200, 13); + Actor_Says(0, 855, 18); + Actor_Says(52, 210, 12); + } + Actor_Clue_Acquire(0, 67, 1, 52); + break; + case 650: + Actor_Says(0, 775, 11); + Actor_Says(52, 220, 14); + Actor_Says(0, 860, 11); + Actor_Says(52, 230, 14); + Actor_Says(0, 865, 11); + Actor_Says(52, 240, 14); + Actor_Says(52, 250, 14); + break; + case 660: + Actor_Says(0, 780, 13); + if (Game_Flag_Query(505)) { + Actor_Says(52, 260, 14); + Actor_Says(52, 270, 13); + Actor_Says(52, 280, 12); + } else { + Actor_Says(52, 260, 14); + Actor_Says(52, 270, 13); + Actor_Says(52, 280, 12); + Actor_Says(0, 870, 18); + Actor_Says(52, 290, 15); + if (!Game_Flag_Query(266)) { + Actor_Says(52, 300, 12); + } + } + Actor_Clue_Acquire(0, 67, 1, 52); + break; + case 670: + Actor_Says(0, 765, 12); + Actor_Says(0, 790, 13); + Actor_Says(52, 310, 12); + Actor_Says(52, 320, 3); + break; + case 680: + Actor_Says(0, 795, 3); + if (Game_Flag_Query(505) == 1) { + Actor_Says(52, 330, 12); + Actor_Says(52, 340, 15); + Actor_Says(0, 875, 16); + Actor_Says(52, 350, 12); + Actor_Says(52, 360, 15); + Game_Flag_Set(326); + } else { + Actor_Says(52, 320, 13); + Actor_Says(52, 150, 14); + Game_Flag_Set(326); + } + break; + case 1270: + Actor_Says(0, 800, 16); + Actor_Says(52, 370, 3); + Actor_Says(0, 880, 15); + Actor_Says(52, 380, 13); + Actor_Says(52, 390, 12); + Actor_Says(0, 885, 14); + Actor_Says(52, 400, 13); + Actor_Says(52, 410, 15); + Actor_Says(0, 890, 18); + Actor_Says(52, 420, 13); + Actor_Says(52, 430, 12); + break; + case 690: + Actor_Says(0, 805, 3); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr04.cpp b/engines/bladerunner/script/dr04.cpp new file mode 100644 index 0000000000..1cef91b967 --- /dev/null +++ b/engines/bladerunner/script/dr04.cpp @@ -0,0 +1,269 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR04::InitializeScene() { + if (Game_Flag_Query(515)) { + Setup_Scene_Information(0.0f, 0.0f, 0.0f, 0); + } else if (Game_Flag_Query(10)) { + Setup_Scene_Information(-711.0f, -0.04f, 70.0f, 472); + } else if (Game_Flag_Query(229)) { + Setup_Scene_Information(-1067.0f, 7.18f, 421.0f, 125); + } else if (Game_Flag_Query(231)) { + Setup_Scene_Information(-897.75f, 134.45f, 569.75f, 512); + } else { + Setup_Scene_Information(-810.0f, -0.04f, 242.0f, 125); + } + Scene_Exit_Add_2D_Exit(0, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 443, 264, 488, 353, 0); + Scene_Exit_Add_2D_Exit(2, 222, 110, 269, 207, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(288, 55, -100, 1); + Ambient_Sounds_Add_Looping_Sound(217, 28, -100, 100); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(67, 40, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(66, 40, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(378, 5, 80, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(379, 5, 80, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(380, 5, 80, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(272)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(4); + } + if (Game_Flag_Query(10)) { + if (Game_Flag_Query(272)) { + Scene_Loop_Start_Special(0, 0, 0); + } else { + Scene_Loop_Start_Special(0, 3, 0); + } + } +} + +void ScriptDR04::SceneLoaded() { + Obstacle_Object("TRASH CAN WITH FIRE", true); + Obstacle_Object("V2PYLON02", true); + Obstacle_Object("V2PYLON04", true); + Obstacle_Object("U2 CHEWDOOR", true); + Obstacle_Object("MMTRASHCAN", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("TRANSFORMER 01", true); + Obstacle_Object("TRANSFORMER 02", true); + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("Z2ENTRYDR", true); + Obstacle_Object("Z2DR2", true); + Unclickable_Object("PARKMETR01"); + Unclickable_Object("Z2ENTRYDR"); + Unclickable_Object("Z2DR2"); +} + +bool ScriptDR04::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptDR04::ClickedOnActor(int actorId) { + if (actorId == 35 && !Player_Query_Combat_Mode()) { + if (Actor_Query_Goal_Number(35) != 21) { + if (Actor_Query_Goal_Number(35) == 23) { + if (!Loop_Actor_Walk_To_Actor(0, 35, 36, 1, false)) { + Actor_Set_Goal_Number(24, 106); + return true; + } + } + return false; + } + if (!Loop_Actor_Walk_To_Waypoint(0, 109, 0, 1, true)) { + Actor_Face_Actor(0, 35, true); + Actor_Says(0, 945, 13); + Actor_Says(35, 0, 3); + Actor_Says(35, 10, 3); + Actor_Says(0, 950, 13); + Actor_Says(35, 20, 3); + Actor_Says(35, 30, 3); + Actor_Says(0, 955, 13); + Actor_Says_With_Pause(35, 40, 0, 3); + Actor_Says(35, 50, 3); + Actor_Clue_Acquire(0, 68, 1, 35); + Actor_Set_Goal_Number(35, 22); + Actor_Set_Goal_Number(24, 101); + return true; + } + return false; + } + return false; +} + +bool ScriptDR04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptDR04::ClickedOnExit(int exitId) { + if (Actor_Query_Goal_Number(35) == 21) { + Actor_Force_Stop_Walking(0); + Actor_Set_Goal_Number(35, 22); + Actor_Set_Goal_Number(24, 101); + return true; + } + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -761.0f, -0.04f, 97.0f, 0, 1, false, 0)) { + Async_Actor_Walk_To_XYZ(0, -683.0f, -0.04f, 43.0f, 0, false); + Game_Flag_Set(11); + Set_Enter(7, 25); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -1067.0f, 7.18f, 421.0f, 0, 1, false, 0)) { + Game_Flag_Set(232); + Game_Flag_Set(228); + Set_Enter(35, 29); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -851.0f, 6.98f, 560.0f, 0, 1, false, 0)) { + Footstep_Sound_Override_On(3); + Actor_Set_Immunity_To_Obstacles(0, true); + Actor_Face_Heading(0, 512, false); + Loop_Actor_Travel_Stairs(0, 7, 1, 0); + Loop_Actor_Walk_To_XYZ(0, -899.0f, 71.64f, 647.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 0, false); + Loop_Actor_Travel_Stairs(0, 7, 1, 0); + Actor_Set_Immunity_To_Obstacles(0, false); + Footstep_Sound_Override_Off(); + Game_Flag_Set(230); + Set_Enter(36, 30); + } + return true; + } + return true; //bug? +} + +bool ScriptDR04::ClickedOn2DRegion(int region) { + return false; +} + +bool ScriptDR04::sub_401160() { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + return (x + 1089.94f) * (x + 1089.94f) + (z - 443.49f) * (z - 443.49f) >= (360.0f * 360.0f); +} + +void ScriptDR04::SceneFrameAdvanced(int frame) { + if (Game_Flag_Query(515)) { + Game_Flag_Reset(515); + Game_Flag_Reset(271); + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 6, 1); + Music_Stop(4); + Actor_Set_Goal_Number(35, 99); + } else { + if (Game_Flag_Query(271)) { + Game_Flag_Reset(271); + Game_Flag_Set(272); + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 6, 1); + Item_Remove_From_World(78); + } + switch (frame) { + case 193: + Sound_Play(301, 100, 0, 100, 50); + Actor_Set_Goal_Number(35, 30); + Player_Loses_Control(); + Actor_Force_Stop_Walking(0); + if (sub_401160()) { + if (Player_Query_Combat_Mode()) { + Actor_Change_Animation_Mode(0, 22); + } else { + Actor_Change_Animation_Mode(0, 21); + } + } else { + Sound_Play_Speech_Line(0, 9905, 100, 0, 99); + Actor_Change_Animation_Mode(0, 48); + Actor_Retired_Here(0, 6, 6, 1, -1); + } + Player_Gains_Control(); + break; + case 235: + if (Actor_Query_Goal_Number(35) != 20 && Actor_Query_Goal_Number(35) != 21 && Actor_Query_Goal_Number(35) != 99) { + Actor_Set_Goal_Number(24, 101); + } + Scene_Exits_Enable(); + break; + case 237: + Overlay_Play("DR04OVER", 0, 1, 1, 0); + break; + } + } +} + +void ScriptDR04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR04::PlayerWalkedIn() { + if (Game_Flag_Query(515)) { + Player_Loses_Control(); + Delay(4000); + Actor_Retired_Here(0, 6, 6, 1, -1); + } else { + if (Game_Flag_Query(269) && !Game_Flag_Query(272)) { + Scene_Exits_Disable(); + } + if (Game_Flag_Query(231)) { + Footstep_Sound_Override_On(3); + Actor_Set_Immunity_To_Obstacles(0, true); + Actor_Face_Heading(0, 512, false); + Loop_Actor_Travel_Stairs(0, 7, 0, 0); + Loop_Actor_Walk_To_XYZ(0, -851.0f, 71.64f, 647.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 0, false); + Loop_Actor_Travel_Stairs(0, 7, 0, 0); + Loop_Actor_Walk_To_XYZ(0, -774.85f, 7.18f, 386.67001f, 0, 0, false, 0); + Actor_Set_Immunity_To_Obstacles(0, false); + Footstep_Sound_Override_Off(); + } + } + Game_Flag_Reset(10); + Game_Flag_Reset(229); + Game_Flag_Reset(231); +} + +void ScriptDR04::PlayerWalkedOut() { + Music_Stop(2); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptDR04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr05.cpp b/engines/bladerunner/script/dr05.cpp new file mode 100644 index 0000000000..c7beafe6ba --- /dev/null +++ b/engines/bladerunner/script/dr05.cpp @@ -0,0 +1,189 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR05::InitializeScene() { + Setup_Scene_Information(-22.0f, 0.3f, 221.0f, 0); + Game_Flag_Reset(228); + Scene_Exit_Add_2D_Exit(0, 0, 38, 80, 467, 3); + Ambient_Sounds_Add_Looping_Sound(383, 25, 0, 1); + if (!Game_Flag_Query(272)) { + Overlay_Play("DR05OVER", 0, 1, 0, 0); + } + if (Game_Flag_Query(272)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptDR05::SceneLoaded() { + Obstacle_Object("MAN PROPHI", true); + Unobstacle_Object("BOX06", true); + Unobstacle_Object("BOX183", true); + Clickable_Object("T2 DOORWAY"); + if (!Game_Flag_Query(272)) { + Item_Add_To_World(78, 932, 35, -1.57f, 31.33f, 75.21f, 540, 16, 16, true, true, false, true); + if (!Actor_Query_Goal_Number(35)) { + Item_Add_To_World(122, 931, 35, 37.35f, 1.59f, 46.72f, 0, 20, 20, true, true, false, true); + } + } +} + +bool ScriptDR05::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR05::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("T2 DOORWAY", objectName)) { + if (Game_Flag_Query(276) || Actor_Query_Goal_Number(35)) { + if (!Loop_Actor_Walk_To_XYZ(0, 57.61f, 0.3f, 69.27f, 0, 1, false, 0)) { + Actor_Face_Object(0, "T2 DOORWAY", true); + Actor_Says(0, 8522, 13); + Actor_Says(0, 8521, 14); + } + } else { + Actor_Face_Object(0, "T2 DOORWAY", true); + Actor_Says(0, 1020, 14); + Actor_Says(35, 90, 13); + } + return true; + } + return false; +} + +bool ScriptDR05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptDR05::ClickedOnItem(int itemId, bool a2) { + if (itemId == 78) { + if (Player_Query_Combat_Mode()) { + Game_Flag_Set(271); + Actor_Set_Goal_Number(35, 30); + } else if (!Game_Flag_Query(272) && !Loop_Actor_Walk_To_Item(0, 78, 24, 1, true) && Actor_Query_Goal_Number(35) != 11) { + if (!Actor_Query_Goal_Number(35)) { + Actor_Says_With_Pause(0, 1015, 0.1f, 12); + Actor_Says(35, 70, 13); + } + Actor_Set_Goal_Number(35, 30); + } + //return true; //bug? + } + if (itemId == 122 && Player_Query_Combat_Mode() && !Actor_Query_Goal_Number(35)) { + Overlay_Play("DR05OVER", 1, 0, 1, 0); + Item_Remove_From_World(122); + Game_Flag_Set(270); + Actor_Set_Goal_Number(35, 10); + Music_Play(18, 71, 0, 0, -1, 0, 2); + return true; + } + return false; +} + +bool ScriptDR05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -22.0f, 0.3f, 221.0f, 0, 1, false, 0)) { + Game_Flag_Reset(232); + Game_Flag_Set(229); + Set_Enter(7, 28); + } + return true; + } + return false; +} + +bool ScriptDR05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptDR05::SceneFrameAdvanced(int frame) { + if (frame == 49) { + Sound_Play(148, Random_Query(50, 50), 80, 80, 50); + } + if (Game_Flag_Query(271)) { + Item_Remove_From_World(78); + Game_Flag_Reset(271); + Game_Flag_Set(272); + Actor_Set_Goal_Number(35, 30); + } +} + +void ScriptDR05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR05::PlayerWalkedIn() { + if (!Game_Flag_Query(511) && !Game_Flag_Query(270) && Game_Flag_Query(272)) { + Item_Remove_From_World(122); + } + if (Game_Flag_Query(272)) { + Loop_Actor_Walk_To_XYZ(0, -10.0f, 0.3f, 133.0f, 0, 0, false, 0); + if (!Game_Flag_Query(511)) { + Game_Flag_Set(511); + if (Game_Flag_Query(48)) { + Actor_Voice_Over(730, 99); + Actor_Voice_Over(740, 99); + Actor_Voice_Over(750, 99); + Actor_Voice_Over(760, 99); + Actor_Clue_Acquire(0, 269, 1, -1); + } else { + Actor_Voice_Over(670, 99); + Actor_Voice_Over(680, 99); + Actor_Voice_Over(700, 99); + Actor_Voice_Over(710, 99); + Actor_Voice_Over(720, 99); + Actor_Clue_Acquire(0, 270, 1, -1); + } + } + } else { + Loop_Actor_Walk_To_XYZ(0, -10.0f, 0.3f, 133.0f, 0, 0, true, 0); + } + if (!Game_Flag_Query(274) && !Actor_Query_Goal_Number(35)) { + Actor_Face_Actor(0, 35, true); + Actor_Says(0, 1010, 13); + Actor_Face_Item(0, 78, true); + Player_Set_Combat_Mode(true); + Actor_Says(35, 60, 12); + Actor_Change_Animation_Mode(0, 0); + Game_Flag_Set(274); + //return true; + } + //return false; +} + +void ScriptDR05::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (Actor_Query_Goal_Number(35) == 10 || Actor_Query_Goal_Number(35) == 18 || Actor_Query_Goal_Number(35) == 19) { + Actor_Set_Goal_Number(35, 11); + //return true; + } + //return false; +} + +void ScriptDR05::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/dr06.cpp b/engines/bladerunner/script/dr06.cpp new file mode 100644 index 0000000000..f744d21a13 --- /dev/null +++ b/engines/bladerunner/script/dr06.cpp @@ -0,0 +1,224 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptDR06::InitializeScene() { + if (Game_Flag_Query(230)) { + Setup_Scene_Information(-733.57001f, 136.60001f, -968.64001f, 0); + } else { + Setup_Scene_Information(-707.57001f, 136.60001f, -1132.64f, 472); + } + Scene_Exit_Add_2D_Exit(0, 601, 11, 639, 479, 1); + if (Global_Variable_Query(1) > 3 && Game_Flag_Query(715)) { + Scene_Exit_Add_2D_Exit(1, 0, 272, 46, 477, 2); + } + Ambient_Sounds_Add_Looping_Sound(383, 25, 0, 1); + Ambient_Sounds_Add_Sound(73, 5, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 60, 20, 20, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(268)) { + Overlay_Play("DR06over", 1, 1, 0, 0); + Ambient_Sounds_Add_Looping_Sound(300, 47, -75, 0); + } else { + Overlay_Play("DR06over", 0, 1, 0, 0); + } + if (Game_Flag_Query(548)) { + Overlay_Play("DR06ovr2", 0, 1, 0, 0); + } +} + +void ScriptDR06::SceneLoaded() { + Obstacle_Object("X2_ASHTRAY", true); + Clickable_Object("X2_ASHTRAY"); + Clickable_Object("X2KEYBRD02"); + Clickable_Object("X2_MON01D01"); + Clickable_Object("X2_MON01A04"); + Clickable_Object("X2_TORSO04HIRES"); + Clickable_Object("BOX16"); + if (Actor_Clue_Query(0, 76)) { + Unclickable_Object("X2_TORSO04HIRES"); + } +} + +bool ScriptDR06::MouseClick(int x, int y) { + return false; +} + +bool ScriptDR06::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BOX16", objectName)) { + Loop_Actor_Walk_To_XYZ(0, -743.0f, 136.6f, -1091.0f, 0, 1, false, 0); + Actor_Face_Object(0, "BOX16", true); + if (!Game_Flag_Query(268)) { + Overlay_Play("DR06over", 1, 1, 1, 0); + Ambient_Sounds_Add_Looping_Sound(300, 47, -75, 0); + Game_Flag_Set(268); + return true; + } + Overlay_Play("DR06over", 0, 1, 1, 0); + Ambient_Sounds_Remove_Looping_Sound(300, false); + Game_Flag_Reset(268); + return true; + } + if (Object_Query_Click("X2_MON01A04", objectName)) { + if (Actor_Clue_Query(0, 71)) { + Actor_Face_Object(0, "X2_MON01A04", true); + Actor_Says(0, 8570, 13); + } else if (!Loop_Actor_Walk_To_XYZ(0, -684.94f, 136.6f, -1136.12f, 0, 1, false, 0)) { + Actor_Face_Object(0, "X2_MON01A04", true); + Actor_Says(39, 10, 3); + Actor_Says(39, 20, 3); + Actor_Says(39, 30, 3); + Actor_Says(0, 1025, 13); + Actor_Says(56, 0, 3); + Actor_Says(56, 10, 3); + Actor_Says(56, 20, 3); + Actor_Says(56, 30, 3); + Actor_Says(56, 40, 3); + Actor_Says(56, 50, 3); + Actor_Says(39, 40, 3); + Actor_Says(0, 1030, 13); + Actor_Says(39, 50, 3); + Actor_Clue_Acquire(0, 71, 1, 39); + } + return true; + } + if (Object_Query_Click("X2_MON01D01", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -645.34f, 136.6f, -1047.37f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 329, false); + if (Actor_Clue_Query(0, 125) && Actor_Clue_Query(0, 126) && !Game_Flag_Query(670)) { + Actor_Set_Goal_Number(0, 350); + Game_Flag_Set(670); + } else if (Game_Flag_Query(280)) { + Actor_Says(0, 8570, 13); + } else { + Actor_Voice_Over(770, 99); + Actor_Voice_Over(780, 99); + Actor_Voice_Over(790, 99); + Actor_Voice_Over(800, 99); + Game_Flag_Set(280); + } + } + return true; + } + if (Object_Query_Click("X2_KEYBRD02", objectName) && !Game_Flag_Query(278)) { + Loop_Actor_Walk_To_XYZ(0, -655.57f, 136.6f, -1092.64f, 0, 1, false, 0); + Actor_Face_Object(0, "X2_KEYBRD02", true); + Actor_Voice_Over(830, 99); + Actor_Voice_Over(840, 99); + Game_Flag_Set(278); + return true; + } + if (Object_Query_Click("X2_TORSO04HIRES", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -700.0f, 136.6f, -1133.0f, 4, 1, false, 0)) { + Actor_Face_Object(0, "x2_TORSO04HIRES", true); + if (Global_Variable_Query(39) > 12) { + return true; + } + if (Game_Flag_Query(548)) { + Overlay_Remove("DR06ovr2"); + Game_Flag_Reset(548); + Sound_Play(161, 100, 0, 0, 50); + } else { + Overlay_Play("DR06ovr2", 0, 1, 0, 0); + Game_Flag_Set(548); + Sound_Play(160, 100, 0, 0, 50); + if (!Actor_Clue_Query(0, 76)) { + Actor_Voice_Over(850, 99); + Item_Pickup_Spin_Effect(944, 171, 280); + Actor_Voice_Over(860, 99); + Actor_Voice_Over(870, 99); + Actor_Voice_Over(880, 99); + Actor_Clue_Acquire(0, 76, 1, 13); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Increment(2, 200); + } + } + } + Global_Variable_Increment(39, 1); + if (Global_Variable_Query(39) > 12) { + Sound_Play(204, 100, 0, 0, 50); + Unclickable_Object("X2_TORSO04HIRES"); + } + } + return true; + } + Actor_Face_Object(0, "X2_MON01D01", true); + Actor_Says(0, 8525, 13); + return true; +} + +bool ScriptDR06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptDR06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptDR06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -733.0f, 136.6f, -980.0f, 0, 1, false, 0)) { + Game_Flag_Set(231); + Set_Enter(7, 28); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -707.57f, 136.6f, -1132.64f, 0, 1, false, 0)) { + Game_Flag_Set(552); + Set_Enter(19, 100); + } + return true; + } + return false; +} + +bool ScriptDR06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptDR06::SceneFrameAdvanced(int frame) { +} + +void ScriptDR06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptDR06::PlayerWalkedIn() { + if (Game_Flag_Query(230)) { + Loop_Actor_Walk_To_XYZ(0, -729.57f, 136.6f, -1016.0f, 0, 0, false, 0); + } + Game_Flag_Reset(230); + Game_Flag_Reset(551); +} + +void ScriptDR06::PlayerWalkedOut() { + Overlay_Remove("DR06over"); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptDR06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/esper.cpp b/engines/bladerunner/script/esper.cpp new file mode 100644 index 0000000000..778542f6c9 --- /dev/null +++ b/engines/bladerunner/script/esper.cpp @@ -0,0 +1,385 @@ +/* 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/script/esper.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +void ScriptESPER::SCRIPT_ESPER_DLL_Initialize() { + int v0 = 0; + if (Actor_Clue_Query(0, 12)) { + if (!Actor_Clue_Query(0, 28)) { + Actor_Says(39, 160, 3); + Actor_Says(39, 180, 3); + Actor_Clue_Acquire(0, 28, 1, 15); + v0 = 1; + } + ESPER_Add_Photo("RC02_FA.IMG", 0, 0); + if (!Actor_Clue_Query(0, 29)) { + Actor_Clue_Acquire(0, 29, 1, 15); + } + ESPER_Add_Photo("RC02_FA.IMG", 1, 1); + } + if (Actor_Clue_Query(0, 89)) { + if (!Actor_Clue_Query(0, 245)) { + Actor_Says(39, 160, 3); + Actor_Says(39, 170, 3); + Actor_Clue_Acquire(0, 245, 1, -1); + v0 = 1; + } + ESPER_Add_Photo("NR060000.IMG", 2, 2); + } + if (Actor_Clue_Query(0, 88)) { + ESPER_Add_Photo("NR070000.IMG", 3, 3); + } + if (Actor_Clue_Query(0, 246)) { + ESPER_Add_Photo("HC01AR11.IMG", 4, 4); + } + if (Actor_Clue_Query(0, 247)) { + ESPER_Add_Photo("HC01AR12.IMG", 5, 5); + } + if (Actor_Clue_Query(0, 260)) { + ESPER_Add_Photo("HC02CB1.IMG", 6, 6); + } + if (Actor_Clue_Query(0, 257)) { + if (!Actor_Clue_Query(0, 78)) { + Actor_Says(39, 160, 3); + Actor_Says(39, 170, 3); + Actor_Clue_Acquire(0, 78, 1, 32); + v0 = 1; + } + ESPER_Add_Photo("HC02CB2.IMG", 7, 7); + } + if (Actor_Clue_Query(0, 45)) { + if (!Actor_Clue_Query(0, 259)) { + Actor_Says(39, 160, 3); + Actor_Says(39, 170, 3); + Actor_Clue_Acquire(0, 259, 1, 17); + v0 = 1; + } + ESPER_Add_Photo("TB060000.IMG", 8, 8); + } + if (Actor_Clue_Query(0, 86)) { + ESPER_Add_Photo("KP06.IMG", 9, 9); + } + if (v0) { + Actor_Says(39, 200, 3); + } +} + +void ScriptESPER::SCRIPT_ESPER_DLL_Photo_Selected(int photo) { + switch (photo) { + case 9: + Actor_Says(39, 270, 3); + ESPER_Define_Special_Region(22, 1208, 330, 1218, 340, 1050, 160, 1279, 550, 956, 203, 1278, 497, "KP06ESP1"); + ESPER_Define_Special_Region(23, 854, 371, 858, 375, 790, 320, 940, 560, 722, 220, 1000, 505, "KP06ESP2"); + ESPER_Define_Special_Region(24, 615, 325, 648, 365, 440, 220, 820, 959, 326, 140, 948, 474, "KP06ESP3"); + ESPER_Define_Special_Region(25, 373, 417, 382, 426, 310, 370, 480, 560, 228, 323, 493, 509, "KP06ESP4"); + break; + case 8: + Actor_Says(39, 230, 3); + ESPER_Define_Special_Region(18, 166, 623, 177, 632, 38, 528, 320, 770, 26, 530, 313, 771, "TB06ESP1"); + ESPER_Define_Special_Region(19, 156, 356, 164, 360, 60, 280, 250, 460, 14, 251, 257, 459, "TB06ESP2"); + ESPER_Define_Special_Region(20, 395, 158, 410, 185, 270, 70, 760, 640, 125, 0, 560, 307, "TB06ESP3"); + ESPER_Define_Special_Region(21, 343, 269, 352, 276, 290, 200, 410, 340, 157, 118, 565, 405, "TB06ESP4"); + break; + case 7: + Actor_Says(39, 250, 3); + ESPER_Define_Special_Region(16, 1171, 457, 1184, 466, 1060, 370, 1279, 730, 910, 300, 1279, 678, "HC02ESP3"); + ESPER_Define_Special_Region(17, 328, 398, 340, 413, 250, 350, 460, 640, 100, 236, 530, 612, "HC02ESP4"); + break; + case 6: + Actor_Says(39, 250, 3); + ESPER_Define_Special_Region(14, 879, 221, 882, 225, 640, 0, 1000, 512, 265, 146, 1014, 813, "HC02ESP5"); + ESPER_Define_Special_Region(15, 660, 550, 678, 572, 560, 480, 850, 910, 265, 146, 1014, 813, "HC02ESP2"); + break; + case 5: + Actor_Says(39, 240, 3); + ESPER_Define_Special_Region(13, 720, 485, 728, 491, 640, 390, 780, 630, 257, 94, 1013, 804, "HC01ESP3"); + break; + case 4: + Actor_Says(39, 240, 3); + ESPER_Define_Special_Region(11, 420, 436, 434, 450, 350, 380, 520, 680, 257, 94, 1013, 804, "HC01ESP1"); + ESPER_Define_Special_Region(12, 407, 489, 410, 509, 370, 450, 500, 560, 257, 94, 1013, 804, "HC01ESP2"); + break; + case 3: + Actor_Says(39, 260, 3); + ESPER_Define_Special_Region(10, 893, 298, 901, 306, 770, 230, 980, 500, 340, 216, 942, 747, "NR07ESP1"); + ESPER_Define_Special_Region(9, 479, 381, 482, 385, 430, 320, 520, 470, 265, 200, 815, 720, "NR07ESP2"); + break; + case 2: + Actor_Says(39, 260, 3); + ESPER_Define_Special_Region(7, 102, 809, 108, 861, 20, 720, 200, 930, 191, 95, 1085, 870, "NR06ESP1"); + ESPER_Define_Special_Region(8, 661, 437, 664, 443, 530, 320, 720, 600, 330, 200, 945, 750, "NR06ESP2"); + break; + case 1: + Actor_Says(39, 220, 3); + ESPER_Define_Special_Region(3, 560, 210, 580, 220, 450, 130, 680, 540, 0, 0, 1279, 959, "RC02ESP4"); + ESPER_Define_Special_Region(4, 584, 482, 595, 493, 460, 400, 660, 540, 0, 0, 1279, 959, "RC02ESP5"); + ESPER_Define_Special_Region(5, 669, 322, 675, 329, 620, 230, 740, 390, 0, 0, 1279, 959, "RC02ESP6"); + ESPER_Define_Special_Region(6, 698, 236, 748, 274, 600, 160, 850, 420, 160, 0, 1279, 750, "RC02ESP7"); + break; + case 0: + Actor_Says(39, 220, 3); + ESPER_Define_Special_Region(0, 490, 511, 496, 517, 400, 440, 580, 580, 380, 260, 900, 710, "RC02ESP1"); + ESPER_Define_Special_Region(1, 473, 342, 479, 349, 400, 300, 580, 580, 350, 250, 900, 710, "RC02ESP2"); + ESPER_Define_Special_Region(2, 444, 215, 461, 223, 380, 120, 570, 340, 354, 160, 577, 354, "RC02ESP3"); + break; + default: + return; + } +} + +bool ScriptESPER::SCRIPT_ESPER_DLL_Special_Region_Selected(int photo, int region) { + switch (photo) { + case 9: + switch (region) { + case 22: + Actor_Says(0, 8705, 3); + if (!Actor_Clue_Query(0, 274)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 274, 1, -1); + } + break; + case 23: + Actor_Voice_Over(4240, 99); + if (!Actor_Clue_Query(0, 275)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 275, 1, -1); + } + break; + case 24: + Actor_Voice_Over(4220, 99); + if (!Actor_Clue_Query(0, 276)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 276, 1, -1); + } + break; + case 25: + if (!Actor_Clue_Query(0, 277)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 277, 1, -1); + } + break; + } + return false; + case 8: + switch (region) { + case 18: + Actor_Says(0, 8775, 3); + if (!Actor_Clue_Query(0, 263)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 263, 1, -1); + } + break; + case 19: + Actor_Voice_Over(4160, 99); + if (!Actor_Clue_Query(0, 262)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 262, 1, -1); + } + break; + case 20: + Actor_Voice_Over(2140, 99); + Actor_Voice_Over(2150, 99); + Actor_Voice_Over(2160, 99); + if (!Actor_Clue_Query(0, 47)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 47, 1, -1); + } + break; + case 21: + Actor_Says(0, 8890, 3); + if (!Actor_Clue_Query(0, 261)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 261, 1, -1); + } + break; + } + return false; + case 7: + if (region == 16) { + Actor_Voice_Over(4080, 99); + if (!Actor_Clue_Query(0, 255)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 255, 1, -1); + } + } else if (region == 17) { + Actor_Voice_Over(4210, 99); + if (!Actor_Clue_Query(0, 256)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 256, 1, -1); + } + } + return false; + case 6: + if (region == 14) { + Actor_Says(0, 6975, 3); + if (!Actor_Clue_Query(0, 254)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 254, 1, -1); + } + } else if (region == 15) { + Actor_Voice_Over(4220, 99); + if (!Actor_Clue_Query(0, 77)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 77, 1, -1); + } + } + return false; + case 5: + if (region == 13) { + Actor_Says(0, 8830, 3); + if (!Actor_Clue_Query(0, 253)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 253, 1, -1); + } + } + return false; + case 4: + if (region == 11) { + Actor_Voice_Over(4090, 99); + if (!Actor_Clue_Query(0, 251)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 251, 1, -1); + } + } else if (region == 12) { + Actor_Voice_Over(4180, 99); + if (!Actor_Clue_Query(0, 252)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 252, 1, -1); + } + } + return false; + case 3: + if (region == 9) { + Actor_Voice_Over(4230, 99); + if (!Actor_Clue_Query(0, 249)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 249, 1, -1); + } + return true; + } else if (region == 10) { + Actor_Voice_Over(4040, 99); + if (!Actor_Clue_Query(0, 250)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 250, 1, -1); + } + return true; + } + return false; + case 2: + if (region == 8) { + Actor_Voice_Over(4260, 99); + if (!Actor_Clue_Query(0, 248)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 248, 1, -1); + } + } else if (region == 7) { + Actor_Voice_Over(4190, 99); + if (!Actor_Clue_Query(0, 258)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 258, 1, -1); + } + } + return true; + case 1: + if (region == 3) { + Actor_Voice_Over(4080, 99); + if (!Actor_Clue_Query(0, 243)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 243, 1, -1); + } + } else if (region == 4) { + Actor_Voice_Over(4110, 99); + if (!Actor_Clue_Query(0, 244)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 244, 1, -1); + } + } else if (region == 5) { + Actor_Voice_Over(4120, 99); + if (!Actor_Clue_Query(0, 31)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 31, 1, -1); + } + } else if (region == 6) { + Actor_Voice_Over(4070, 99); + if (!Actor_Clue_Query(0, 30)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 30, 1, -1); + } + } + return true; + case 0: + if (region == 0) { + Actor_Voice_Over(4050, 99); + if (!Actor_Clue_Query(0, 14)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 14, 1, -1); + } + } else if (region == 1) { + Actor_Voice_Over(4040, 99); + if (!Actor_Clue_Query(0, 13)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 13, 1, -1); + } + } else if (region == 2) { + Actor_Voice_Over(4060, 99); + if (!Actor_Clue_Query(0, 9)) { + Actor_Says(0, 6945, 3); + Sound_Play(417, 50, 0, 0, 50); + Actor_Clue_Acquire(0, 9, 1, -1); + } + } + return true; + } + return false; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/esper.h b/engines/bladerunner/script/esper.h new file mode 100644 index 0000000000..9532e11b79 --- /dev/null +++ b/engines/bladerunner/script/esper.h @@ -0,0 +1,45 @@ +/* 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_SCRIPT_ESPER_H +#define BLADERUNNER_SCRIPT_ESPER_H + +#include "bladerunner/script/script.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ScriptESPER : ScriptBase { +public: + ScriptESPER(BladeRunnerEngine *vm) + : ScriptBase(vm) { + } + + void SCRIPT_ESPER_DLL_Initialize(); + void SCRIPT_ESPER_DLL_Photo_Selected(int photo); + bool SCRIPT_ESPER_DLL_Special_Region_Selected(int photo, int region); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/script/hc01.cpp b/engines/bladerunner/script/hc01.cpp new file mode 100644 index 0000000000..c59eab6ed5 --- /dev/null +++ b/engines/bladerunner/script/hc01.cpp @@ -0,0 +1,433 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHC01::InitializeScene() { + Music_Play(0, 31, 0, 2, -1, 1, 2); + if (Game_Flag_Query(385)) { + Setup_Scene_Information(64.0f, 0.14f, 83.0f, 266); + } else if (Game_Flag_Query(387)) { + Setup_Scene_Information(607.0f, 0.14f, 9.0f, 530); + } else { + Setup_Scene_Information(780.0f, 0.14f, 153.0f, 815); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + if (Game_Flag_Query(402)) { + Scene_Exit_Add_2D_Exit(1, 394, 229, 485, 371, 1); + } + Scene_Exit_Add_2D_Exit(2, 117, 0, 286, 319, 0); + Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); + Ambient_Sounds_Add_Looping_Sound(241, 50, 50, 0); + Ambient_Sounds_Add_Sound(242, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(243, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(244, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(245, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(246, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(247, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(248, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(249, 3, 30, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Scene_Loop_Set_Default(0); +} + +void ScriptHC01::SceneLoaded() { + Obstacle_Object("PILLAR", true); + if (Game_Flag_Query(322)) { + Preload(19); + Preload(426); + Preload(430); + Preload(437); + Preload(427); + Preload(431); + Preload(433); + Preload(424); + Preload(428); + Preload(436); + Preload(429); + Preload(425); + Preload(432); + } +} + +bool ScriptHC01::MouseClick(int x, int y) { + return false; +} + +bool ScriptHC01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHC01::ClickedOnActor(int actorId) { + if (actorId == 7 && (Actor_Query_Goal_Number(7) == 150 || Actor_Query_Goal_Number(7) == 0)) { + AI_Movement_Track_Pause(7); + if (!Loop_Actor_Walk_To_XYZ(0, 624.43f, 0.14f, 83.0f, 0, 1, false, 0)) { + if (Game_Flag_Query(400)) { + Actor_Face_Actor(0, 7, true); + Actor_Face_Actor(7, 0, true); + sub_402384(); + } else { + Actor_Face_Actor(7, 0, true); + Actor_Says_With_Pause(7, 10, 0.2f, 13); + Actor_Face_Actor(0, 7, true); + Actor_Says(7, 20, 17); + Actor_Says(0, 1035, 18); + Actor_Says_With_Pause(7, 30, 0.2f, 17); + Actor_Says_With_Pause(7, 40, 0.0f, 13); + Actor_Says(7, 50, 12); + Actor_Says_With_Pause(0, 1040, 1.2f, 13); + Actor_Says(7, 60, 16); + Actor_Says_With_Pause(7, 70, 1.0f, 13); + Actor_Says_With_Pause(0, 1045, 0.6f, 14); + Actor_Says(7, 80, 18); + Game_Flag_Set(400); + } + } + AI_Movement_Track_Unpause(7); + } + return false; +} + +bool ScriptHC01::ClickedOnItem(int itemId, bool a2) { + if (itemId == 107) { + Item_Remove_From_World(107); + Item_Pickup_Spin_Effect(977, 361, 381); + Delay(1500); + Item_Pickup_Spin_Effect(984, 377, 397); + Delay(1500); + Item_Pickup_Spin_Effect(984, 330, 384); + if (Game_Flag_Query(374)) { + Actor_Clue_Acquire(0, 246, 1, 7); + } else { + Actor_Clue_Acquire(0, 247, 1, 7); + } + Actor_Clue_Acquire(0, 260, 1, 7); + return true; + } + return false; +} + +bool ScriptHC01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 814.0f, 0.14f, 153.0f, 0, 1, false, 0)) { + Music_Adjust(12, 0, 2); + Game_Flag_Set(323); + Set_Enter(0, 0); + Game_Flag_Reset(479); + Game_Flag_Set(180); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 607.0f, 0.14f, 9.0f, 0, 1, false, 0)) { + Game_Flag_Set(386); + Set_Enter(8, 33); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 105.0f, 0.14f, 103.0f, 0, 1, false, 0)) { + Game_Flag_Set(384); + Async_Actor_Walk_To_XYZ(0, -57.0f, 0.14f, 83.0f, 0, false); + Set_Enter(8, 32); + } + return true; + } + return false; +} + +bool ScriptHC01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHC01::SceneFrameAdvanced(int frame) { + Set_Fade_Color(1.0f, 1.0f, 1.0f); + if (frame >= 61 && frame < 65) { + Set_Fade_Density((frame - 61) / 4.0f); + } else if (frame >= 65 && frame < 93) { + Set_Fade_Density(1.0f); + } else if (frame >= 93 && frame < 106) { + Set_Fade_Density((105 - frame) / 13.0f); + } else { + Set_Fade_Density(0.0f); + } + if (frame == 61) { + Ambient_Sounds_Play_Sound(312, 90, 0, 0, 0); + } + if (frame == 65) { + Ambient_Sounds_Play_Sound(315, 50, 0, 100, 0); + } + if (frame == 80) { + Ambient_Sounds_Play_Sound(316, 40, 100, 100, 0); + Item_Add_To_World(121, 931, 8, 582.0f, 27.0f, -41.0f, 0, 8, 8, true, true, false, true); + } +} + +void ScriptHC01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHC01::PlayerWalkedIn() { + if (Game_Flag_Query(385)) { + Loop_Actor_Walk_To_XYZ(0, 105.0f, 0.14f, 103.0f, 0, 0, false, 0); + Game_Flag_Reset(385); + } + if (Game_Flag_Query(387)) { + Game_Flag_Reset(387); + } + if (Game_Flag_Query(322)) { + Game_Flag_Reset(322); + } +} + +void ScriptHC01::PlayerWalkedOut() { + Set_Fade_Density(0.0f); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptHC01::DialogueQueueFlushed(int a1) { +} + +void ScriptHC01::sub_402384() { + if (!Game_Flag_Query(401)) { + Actor_Says(0, 1055, 13); + Actor_Says(7, 130, 13); + Actor_Says_With_Pause(0, 1060, 0.2f, 13); + Actor_Says(7, 140, 13); + Game_Flag_Set(401); + } + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 56) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1020, 6, 7, 3); + } else if (Actor_Clue_Query(0, 44) || Actor_Clue_Query(0, 47) || Actor_Clue_Query(0, 14)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1010, 6, 7, 3); + } + if (Actor_Clue_Query(0, 58) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1030, 1, 5, 7); + } else if (Actor_Clue_Query(0, 5) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1040, 4, 4, 6); + } + if (Actor_Clue_Query(0, 181) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1050, -1, 3, 8); + } else if (Actor_Clue_Query(0, 180) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1060, -1, 3, 8); + } + if (!Dialogue_Menu_Query_List_Size()) { + Actor_Says_With_Pause(0, 1105, 1.2f, 13); + if (Actor_Query_Friendliness_To_Other(7, 0) < 50) { + Actor_Says(7, 550, 15); + } else { + Actor_Says(7, 250, 13); + Actor_Modify_Friendliness_To_Other(7, 0, -1); + if (Actor_Query_Friendliness_To_Other(7, 0) < 47 && Query_Difficulty_Level() == 0) { + sub_40346C(); + } + } + return; + } + Dialogue_Menu_Add_DONE_To_List(100); + bool end = false; + do { + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 1020) { + Dialogue_Menu_Remove_From_List(1020); + Actor_Says(0, 1065, 15); + Actor_Says(7, 160, 3); + Actor_Says(0, 1110, 16); + Actor_Says(7, 170, 3); + Actor_Says(7, 180, 3); + Actor_Says(7, 190, 12); + if (Query_Difficulty_Level() < 2) { + Actor_Modify_Friendliness_To_Other(7, 0, -2); + } + } + if (answer == 1010) { + Dialogue_Menu_Remove_From_List(1010); + Actor_Clue_Acquire(0, 60, 0, 7); + Actor_Says(0, 1070, 13); + Actor_Says(7, 200, 17); + Actor_Says(7, 210, 12); + Actor_Says(0, 1115, 12); + Actor_Says(7, 220, 16); + Actor_Says(7, 230, 3); + Actor_Says(7, 240, 15); + if (Query_Difficulty_Level() < 2) { + Actor_Modify_Friendliness_To_Other(7, 0, -1); + } + } + if (answer == 1010 || answer == 1020) { + Actor_Says_With_Pause(0, 1120, 0.9f, 17); + Actor_Says(7, 250, 13); + Actor_Says(0, 1125, 14); + if (Actor_Query_Friendliness_To_Other(7, 0) < 47) { + Actor_Set_Goal_Number(7, 1); + Player_Loses_Control(); + Actor_Says(7, 90, 3); + Actor_Face_Actor(7, 0, true); + Actor_Says(7, 100, 3); + Actor_Says(7, 110, 3); + Actor_Says_With_Pause(0, 1050, 0.2f, 3); + Actor_Says(7, 120, 3); + Actor_Set_Goal_Number(7, 2); + } + end = true; + } + if (answer == 1030) { + Dialogue_Menu_Remove_From_List(1030); + Actor_Says(0, 1075, 18); + Actor_Says(7, 260, 12); + Actor_Says(7, 270, 16); + Actor_Says(0, 1130, 14); + Actor_Says(7, 280, 17); + Actor_Says(0, 1135, 15); + Actor_Says(7, 290, 15); + Actor_Says(7, 300, 12); + Actor_Says(7, 310, 17); + Actor_Says(0, 1140, 3); + if (Query_Difficulty_Level() < 2) { + Actor_Modify_Friendliness_To_Other(7, 0, -2); + } + if (Actor_Query_Friendliness_To_Other(7, 0) < 47) { + Actor_Set_Goal_Number(7, 1); + Player_Loses_Control(); + Actor_Says(7, 90, 3); + Actor_Face_Actor(7, 0, true); + Actor_Says(7, 100, 3); + Actor_Says(7, 110, 3); + Actor_Says_With_Pause(0, 1050, 0.2f, 3); + Actor_Says(7, 120, 3); + Actor_Set_Goal_Number(7, 2); + } + end = true; + } + if (answer == 1040) { + Dialogue_Menu_Remove_From_List(1040); + Actor_Says(0, 1080, 15); + Actor_Says(0, 1085, 17); + Actor_Says(7, 320, 17); + Actor_Says(0, 1145, 13); + Actor_Says(7, 330, 17); + Actor_Says(7, 340, 13); + Actor_Says(7, 350, 12); + end = true; + } + if (answer == 1050) { + Dialogue_Menu_Remove_From_List(1050); + Actor_Says(0, 1090, 18); + Actor_Says(7, 360, 14); + Actor_Says(0, 1150, 17); + Actor_Says(7, 370, 13); + Actor_Says(0, 1155, 15); + Actor_Says(7, 380, 12); + Actor_Says(0, 1160, 14); + Actor_Says(0, 1165, 18); + Actor_Says(7, 390, 16); + Actor_Says(0, 1170, 12); + Actor_Says(7, 400, 13); + Actor_Says(0, 1180, 14); + Actor_Says(7, 410, 12); + Actor_Says(7, 420, 16); + Actor_Says(7, 430, 17); + Actor_Says(7, 440, 13); + Actor_Modify_Friendliness_To_Other(7, 0, -4); + if (Actor_Query_Friendliness_To_Other(7, 0) < 47) { + Actor_Set_Goal_Number(7, 1); + Player_Loses_Control(); + Actor_Says(7, 90, 3); + Actor_Face_Actor(7, 0, true); + Actor_Says(7, 100, 3); + Actor_Says(7, 110, 3); + Actor_Says_With_Pause(0, 1050, 0.2f, 3); + Actor_Says(7, 120, 3); + Actor_Set_Goal_Number(7, 2); + } + end = true; + } + if (answer == 1060) { + Dialogue_Menu_Remove_From_List(1060); + Actor_Says(0, 1095, 15); + Actor_Says_With_Pause(0, 1100, 1.2f, 18); + Actor_Says(7, 450, 12); + Actor_Says(7, 460, 13); + Actor_Says(0, 1185, 18); + Actor_Says(7, 470, 14); + Actor_Says(0, 1190, 14); + Actor_Says(7, 480, 13); + Actor_Says(0, 1195, 16); + Actor_Says(0, 1200, 18); + Actor_Says(7, 490, 12); + Actor_Says(0, 1205, 14); + Actor_Says(7, 500, 14); + Actor_Says(7, 510, 17); + Actor_Says(7, 520, 16); + Actor_Says(7, 530, 15); + Actor_Says(0, 1210, 16); + Actor_Modify_Friendliness_To_Other(7, 0, -4); + if (Actor_Query_Friendliness_To_Other(7, 0) < 47) { + Actor_Set_Goal_Number(7, 1); + Player_Loses_Control(); + Actor_Says(7, 90, 3); + Actor_Face_Actor(7, 0, true); + Actor_Says(7, 100, 3); + Actor_Says(7, 110, 3); + Actor_Says_With_Pause(0, 1050, 0.2f, 3); + Actor_Says(7, 120, 3); + Actor_Set_Goal_Number(7, 2); + } + end = true; + } + if (answer == 100) { + end = true; + } + } while (!end); +} + +void ScriptHC01::sub_40346C() { + Actor_Set_Goal_Number(7, 1); + Player_Loses_Control(); + Actor_Says(7, 90, 3); + Actor_Face_Actor(7, 0, true); + Actor_Says(7, 100, 3); + Actor_Says(7, 110, 3); + Actor_Says_With_Pause(0, 1050, 0.2f, 3); + Actor_Says(7, 120, 3); + Actor_Set_Goal_Number(7, 2); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hc02.cpp b/engines/bladerunner/script/hc02.cpp new file mode 100644 index 0000000000..c676938410 --- /dev/null +++ b/engines/bladerunner/script/hc02.cpp @@ -0,0 +1,216 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHC02::InitializeScene() { + Music_Play(4, 45, -60, 1, -1, 1, 3); + if (Game_Flag_Query(109)) { + Setup_Scene_Information(-88.0f, 0.14f, -463.0f, 540); + } else { + Setup_Scene_Information(-57.0f, 0.14f, 83.0f, 746); + } + Scene_Exit_Add_2D_Exit(0, 589, 255, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 505, 0, 639, 170, 0); + Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); + Ambient_Sounds_Add_Looping_Sound(280, 50, 50, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 33, 33, -60, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 33, 33, -100, 20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(242, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(243, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(244, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(245, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(246, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(247, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(248, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(249, 3, 30, 14, 14, 30, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(238, 3, 50, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(240, 3, 50, 25, 25, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(384)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(384); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptHC02::SceneLoaded() { + Obstacle_Object("BARSTOOL01", true); +} + +bool ScriptHC02::MouseClick(int x, int y) { + return false; +} + +bool ScriptHC02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHC02::ClickedOnActor(int actorId) { + if (actorId == 32) { + if (!Loop_Actor_Walk_To_XYZ(0, -150.51f, 0.14f, 62.74f, 0, 1, false, 0)) { + Actor_Face_Actor(0, 32, true); + if (!Game_Flag_Query(404)) { + Actor_Says(0, 1225, 13); + Actor_Says_With_Pause(32, 0, 0.0f, 13); + Actor_Says(32, 10, 16); + Actor_Set_Goal_Number(32, 1); + Actor_Change_Animation_Mode(0, 23); + Delay(1500); + Actor_Change_Animation_Mode(0, 75); + Delay(1500); + Global_Variable_Increment(42, 1); + Game_Flag_Set(404); + } else if (Actor_Clue_Query(0, 254) && !Actor_Clue_Query(0, 257)) { + Actor_Says(0, 4545, 11); + Actor_Says(32, 120, 12); + Actor_Says(32, 180, 13); + Actor_Clue_Acquire(0, 257, 1, 32); + Item_Pickup_Spin_Effect(975, 229, 215); + } else if (Actor_Clue_Query(0, 122) && !Actor_Clue_Query(0, 131) && (Global_Variable_Query(2) > 20 || Query_Difficulty_Level() == 0)) { + Actor_Clue_Acquire(0, 131, 1, 32); + Actor_Says(0, 1230, 13); + Actor_Says(32, 20, 12); + Actor_Says(0, 1235, 13); + Actor_Says(32, 30, 15); + Actor_Says(0, 1240, 13); + Actor_Says(32, 40, 14); + Item_Pickup_Spin_Effect(945, 229, 215); + Actor_Set_Goal_Number(32, 2); + Actor_Change_Animation_Mode(0, 23); + Delay(1500); + Actor_Says_With_Pause(32, 50, 1.6f, 17); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 20); + } + Actor_Says(0, 1245, 13); + } else { + if (Actor_Clue_Query(0, 75) && !Game_Flag_Query(405)) { + Actor_Says(32, 80, 16); + Actor_Says(0, 1265, 13); + Actor_Says(32, 90, 13); + Game_Flag_Set(405); + } + if (Global_Variable_Query(2) > 5 || Query_Difficulty_Level() == 0) { + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 5); + } + Global_Variable_Increment(42, 1); + Actor_Says(0, 1250, 13); + Actor_Says_With_Pause(32, 60, 0.8f, 14); + Actor_Says(0, 1255, 13); + Actor_Set_Goal_Number(32, 1); + Actor_Change_Animation_Mode(0, 23); + Delay(1500); + Actor_Change_Animation_Mode(0, 75); + Delay(1500); + } else { + Actor_Says_With_Pause(0, 1260, 0.3f, 13); + Actor_Says(32, 70, 14); + } + } + } + return true; + } + return false; +} + +bool ScriptHC02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHC02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 7.0f, 0.14f, 79.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(385); + Set_Enter(8, 31); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -76.0f, 0.14f, -339.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(110); + Async_Actor_Walk_To_XYZ(0, -88.0f, 0.14f, -463.0f, 0, false); + Set_Enter(8, 106); + } + return true; + } + return false; +} + +bool ScriptHC02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHC02::SceneFrameAdvanced(int frame) { + if (frame == 70) { + Sound_Play(73, 11, 50, -90, 50); + } + if (frame == 58) { + Sound_Play(73, 11, 50, -90, 50); + } + if (frame == 69 || frame == 77 || frame == 86 || frame == 95 || frame == 104 || frame == 113 || frame == 119) { + Sound_Play(60, Random_Query(6, 7), -20, 20, 50); + } +} + +void ScriptHC02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHC02::PlayerWalkedIn() { + if (Game_Flag_Query(109)) { + Loop_Actor_Walk_To_XYZ(0, -76.0f, 0.14f, -339.0f, 0, 0, false, 0); + Game_Flag_Reset(109); + } +} + +void ScriptHC02::PlayerWalkedOut() { +} + +void ScriptHC02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hc03.cpp b/engines/bladerunner/script/hc03.cpp new file mode 100644 index 0000000000..58a822c982 --- /dev/null +++ b/engines/bladerunner/script/hc03.cpp @@ -0,0 +1,188 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHC03::InitializeScene() { + if (Game_Flag_Query(318)) { + Setup_Scene_Information(656.0f, 1.61f, -95.0f, 497); + Game_Flag_Set(388); + Game_Flag_Reset(318); + } else { + Setup_Scene_Information(607.0f, 0.14f, 13.0f, 57); + Game_Flag_Reset(386); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + if (Game_Flag_Query(403) || Global_Variable_Query(1) > 3) { + Item_Remove_From_World(121); + Game_Flag_Set(403); + Scene_Exit_Add_2D_Exit(1, 400, 275, 515, 375, 2); + } + Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); + Ambient_Sounds_Add_Looping_Sound(241, 50, 50, 0); + Ambient_Sounds_Add_Sound(242, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(243, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(244, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(245, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(246, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(247, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(248, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(249, 3, 30, 16, 16, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(238, 3, 50, 25, 25, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(240, 3, 50, 33, 33, -100, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(388)) { + Scene_Loop_Set_Default(6); + } else if (Game_Flag_Query(403) || Global_Variable_Query(1) > 3) { + Scene_Loop_Set_Default(3); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptHC03::SceneLoaded() { + Obstacle_Object("GUITAR01", true); + if (Game_Flag_Query(403) || Game_Flag_Query(388) || Global_Variable_Query(1) > 3) { + Unobstacle_Object("GPscisGate", true); + } else { + Obstacle_Object("GPscisGate", true); + } + Unclickable_Object("GUITAR01"); +} + +bool ScriptHC03::MouseClick(int x, int y) { + return false; +} + +bool ScriptHC03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHC03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptHC03::ClickedOnItem(int itemId, bool a2) { + if (itemId == 121) { + if (a2) { + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Game_Flag_Set(403); + Item_Remove_From_World(121); + Unobstacle_Object("GPscisGate", true); + } else { + Actor_Says(0, 8522, 12); + } + return true; + } + if (itemId == 107) { + Item_Remove_From_World(107); + Item_Pickup_Spin_Effect(977, 68, 435); + Delay(1500); + Item_Pickup_Spin_Effect(984, 78, 435); + Delay(1500); + Item_Pickup_Spin_Effect(984, 58, 435); + if (Game_Flag_Query(374)) { + Actor_Clue_Acquire(0, 246, 1, 7); + } else { + Actor_Clue_Acquire(0, 247, 1, 7); + } + Actor_Clue_Acquire(0, 260, 1, 7); + return true; + } + return false; +} + +bool ScriptHC03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 607.0f, 0.14f, 9.0f, 0, 1, false, 0)) { + Game_Flag_Set(387); + Set_Enter(8, 31); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 628.0f, 2.04f, -123.0f, 0, 1, false, 0)) { + if (Game_Flag_Query(388)) { + Game_Flag_Set(319); + Game_Flag_Reset(479); + Game_Flag_Set(259); + Game_Flag_Set(388); + Music_Stop(2); + Set_Enter(75, 87); + } else { + Scene_Loop_Set_Default(6); + Scene_Loop_Start_Special(2, 5, 1); + Game_Flag_Set(388); + } + } + return true; + } + return false; +} + +bool ScriptHC03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHC03::SceneFrameAdvanced(int frame) { + if (frame == 10 || frame == 19 || frame == 29 || frame == 39 || frame == 49 || frame == 59 || frame == 71 || frame == 82 || frame == 91 || frame == 101 || frame == 111 || frame == 121 || frame == 131) { + Sound_Play(281, Random_Query(33, 50), 50, 50, 50); + } + if (!Game_Flag_Query(521) && frame == 66) { + Ambient_Sounds_Play_Sound(328, 90, 0, -40, 99); + Sound_Play(201, Random_Query(47, 47), 0, -40, 50); + Scene_Exit_Add_2D_Exit(1, 400, 275, 515, 375, 2); + Game_Flag_Set(521); + } +} + +void ScriptHC03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHC03::PlayerWalkedIn() { +} + +void ScriptHC03::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptHC03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hc04.cpp b/engines/bladerunner/script/hc04.cpp new file mode 100644 index 0000000000..5582a212b5 --- /dev/null +++ b/engines/bladerunner/script/hc04.cpp @@ -0,0 +1,242 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHC04::InitializeScene() { + if (Game_Flag_Query(108)) { + Setup_Scene_Information(-112.0f, 0.14f, -655.0f, 460); + Game_Flag_Reset(108); + } else { + Setup_Scene_Information(-88.0f, 0.14f, -463.0f, 1013); + } + Music_Play(4, 14, -90, 1, -1, 1, 2); + Actor_Put_In_Set(59, 8); + Actor_Set_At_XYZ(59, -210.0f, 0.0f, -445.0f, 250); + Scene_Exit_Add_2D_Exit(0, 539, 51, 639, 309, 0); + Scene_Exit_Add_2D_Exit(1, 0, 456, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(103, 50, 50, 0); + Ambient_Sounds_Add_Looping_Sound(329, 16, 16, 0); + Ambient_Sounds_Add_Looping_Sound(330, 40, 40, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 16, 16, -100, -100, -101, -101, 0, 0); + if (Game_Flag_Query(110)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(110); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptHC04::SceneLoaded() { + Obstacle_Object("CAN FIRE", true); + Unobstacle_Object("ASIANMALE01", true); + Clickable_Object("CAN FIRE"); +} + +bool ScriptHC04::MouseClick(int x, int y) { + return false; +} + +bool ScriptHC04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHC04::ClickedOnActor(int actorId) { + if (actorId == 59) { + if (!Loop_Actor_Walk_To_XYZ(0, -155.0f, 0.0f, -475.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 59, true); + Actor_Face_Actor(59, 0, true); + if (Game_Flag_Query(106)) { + sub_401B90(); + return true; + } else { + Actor_Says(59, 0, 3); + Actor_Says(0, 1280, 3); + Actor_Says(59, 20, 3); + Game_Flag_Set(106); + return true; + } + } + } + return false; +} + +bool ScriptHC04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHC04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -108.0f, 0.14f, -639.0f, 0, 1, false, 0)) { + Music_Stop(2); + Game_Flag_Set(107); + Game_Flag_Reset(479); + Game_Flag_Set(182); + Set_Enter(70, 80); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -72.0f, 0.14f, -399.0f, 0, 1, false, 0)) { + Game_Flag_Set(109); + Set_Enter(8, 32); + } + return true; + } + return false; +} + +bool ScriptHC04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHC04::SceneFrameAdvanced(int frame) { +} + +void ScriptHC04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHC04::PlayerWalkedIn() { +} + +void ScriptHC04::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptHC04::DialogueQueueFlushed(int a1) { +} + +void ScriptHC04::sub_401B90() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 263) || Actor_Clue_Query(0, 53)) { + if (Actor_Clue_Query(0, 47)) { + DM_Add_To_List_Never_Repeat_Once_Selected(340, 5, 6, 5); + } else if (Actor_Clue_Query(0, 259)) { + DM_Add_To_List_Never_Repeat_Once_Selected(350, 5, 6, 5); + } + DM_Add_To_List_Never_Repeat_Once_Selected(360, 6, 4, 3); + } + if (Actor_Clue_Query(0, 87) && !Actor_Clue_Query(0, 101)) { + DM_Add_To_List_Never_Repeat_Once_Selected(370, 3, 4, 7); + } + if (Actor_Clue_Query(0, 101)) { + DM_Add_To_List_Never_Repeat_Once_Selected(380, -1, 5, 8); + } + DM_Add_To_List_Never_Repeat_Once_Selected(390, 7, 5, -1); + Dialogue_Menu_Add_DONE_To_List(400); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 340: + Actor_Says(0, 1285, 3); + Actor_Says(59, 50, 3); + Actor_Says(0, 1330, 3); + Actor_Says(59, 60, 3); + break; + case 350: + Actor_Says(0, 1290, 3); + Actor_Says(59, 70, 3); + Actor_Says(0, 1335, 3); + Actor_Says(59, 80, 3); + Actor_Says(0, 1340, 3); + Actor_Says(59, 90, 3); + Actor_Says(0, 1345, 3); + break; + case 360: + Actor_Says(0, 1295, 3); + Actor_Says(59, 100, 3); + Actor_Says(0, 1350, 3); + Actor_Says(59, 110, 3); + Actor_Says(0, 1355, 3); + Actor_Says(59, 130, 3); + Actor_Says(0, 1360, 3); + break; + case 370: + Actor_Says(0, 1300, 3); + Actor_Says(59, 140, 3); + Actor_Says(0, 1365, 3); + Actor_Says(59, 150, 3); + break; + case 380: + Actor_Says(0, 1305, 3); + Actor_Modify_Friendliness_To_Other(59, 0, -2); + Actor_Says(59, 160, 3); + Actor_Says(0, 1370, 3); + Actor_Says(59, 170, 3); + Actor_Says(0, 1375, 3); + Actor_Says(59, 180, 3); + Actor_Says(0, 1380, 3); + Actor_Says(59, 190, 3); + Actor_Says(59, 210, 3); + Actor_Says(59, 240, 3); + Actor_Says(0, 1385, 3); + Actor_Says(59, 260, 3); + Actor_Says(0, 1390, 3); + Actor_Says(59, 300, 3); + Actor_Says(59, 310, 3); + Actor_Says(59, 320, 3); + Actor_Says(0, 1395, 3); + Actor_Says(59, 330, 3); + Actor_Clue_Acquire(0, 102, 0, 59); + break; + case 390: + Actor_Says(0, 1310, 3); + Actor_Modify_Friendliness_To_Other(59, 0, 2); + Actor_Says(59, 340, 3); + break; + case 400: + Actor_Says(0, 1315, 3); + break; + default: + Actor_Says(0, 1320, 3); + Actor_Says(59, 30, 3); + Actor_Says(0, 1325, 3); + Actor_Says(0, 1345, 3); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf01.cpp b/engines/bladerunner/script/hf01.cpp new file mode 100644 index 0000000000..509f472d74 --- /dev/null +++ b/engines/bladerunner/script/hf01.cpp @@ -0,0 +1,475 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF01::InitializeScene() { + if (Game_Flag_Query(617)) { + Setup_Scene_Information(243.94f, 8.0f, -341.9f, 342); + } else if (Game_Flag_Query(313)) { + Setup_Scene_Information(-202.0f, 0.0f, -619.0f, 407); + } else if (Game_Flag_Query(311)) { + Setup_Scene_Information(124.0f, 8.0f, -880.0f, 455); + } else if (Game_Flag_Query(309)) { + Setup_Scene_Information(406.0f, 8.0f, -813.0f, 455); + } else { + Setup_Scene_Information(100.0f, 0.0f, -260.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 81, 226, 169, 321, 0); + if (!Game_Flag_Query(663)) { + Scene_Exit_Add_2D_Exit(1, 304, 239, 492, 339, 0); + Scene_Exit_Add_2D_Exit(2, 560, 231, 639, 360, 0); + if (Game_Flag_Query(256)) { + Scene_Exit_Add_2D_Exit(3, 0, 311, 66, 417, 2); + } + } + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(340, 25, 0, 1); + Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(256)) { + if (!Game_Flag_Query(309) && !Game_Flag_Query(311) && !Game_Flag_Query(313)) { + Scene_Loop_Start_Special(0, 0, 0); + } + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(663)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(5); + } +} + +void ScriptHF01::SceneLoaded() { + Obstacle_Object("LOFT41", true); + if (!Game_Flag_Query(256)) { + Unobstacle_Object("OBSTACLE BOX15", true); + } +} + +bool ScriptHF01::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHF01::ClickedOnActor(int actorId) { + int v1; + if (Global_Variable_Query(45) == 2) { + v1 = 3; + } else if (Global_Variable_Query(45) == 3) { + v1 = 6; + } else { + v1 = -1; + } + if (actorId == 22 || actorId == 31) { + if (!Loop_Actor_Walk_To_XYZ(0, 504.04f, 8.0f, -242.17f, 12, 1, false, 0)) { + ADQ_Flush(); + Actor_Face_Actor(0, 31, true); + if (Game_Flag_Query(382)) { + sub_4026B4(); + } else { + Actor_Says(0, 1455, 15); + Actor_Says(31, 40, 13); + Actor_Says(0, 1460, 13); + Actor_Says(31, 50, 12); + Item_Pickup_Spin_Effect(951, 396, 359); + Actor_Face_Heading(31, 271, false); + Actor_Says(31, 60, 12); + Actor_Says(0, 1465, 15); + Actor_Face_Actor(31, 0, true); + Actor_Says(31, 70, 13); + Actor_Says(0, 1470, 14); + Actor_Says(22, 30, 3); + Actor_Says(31, 80, 15); + Actor_Says(22, 50, 3); + Actor_Says(31, 110, 14); + Game_Flag_Set(382); + } + return true; + } + return false; + } + if (actorId == v1) { + if (!Loop_Actor_Walk_To_Actor(0, actorId, 28, 1, false)) { + if (Actor_Query_Goal_Number(v1) == 599) { + Actor_Says(0, 8630, 13); + return true; + } + if (Global_Variable_Query(1) == 5 && (Actor_Clue_Query(0, 139) || Actor_Clue_Query(0, 141)) && !Game_Flag_Query(165) && Actor_Query_Goal_Number(9) != 2 && Game_Flag_Query(653) && !Game_Flag_Query(662)) { + Game_Flag_Set(662); + Actor_Face_Actor(0, v1, true); + Actor_Face_Actor(v1, 0, true); + if (v1 == 3) { + sub_4032DC(); + } else if (v1 == 6) { + sub_403484(); + } + Async_Actor_Walk_To_XYZ(v1, -175.0f, 8.0f, -617.0f, 0, false); + Loop_Actor_Walk_To_XYZ(0, -137.0f, 8.0f, -577.0f, 0, 0, false, 1); + Game_Flag_Set(312); + Set_Enter(41, 38); + } + } + } + return false; +} + +bool ScriptHF01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -202.0f, 8.0f, -619.0f, 0, 1, false, 0)) { + Game_Flag_Set(312); + Set_Enter(41, 38); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 124.0f, 8.0f, -724.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 124.0f, 8.0f, -880.0f, 0, 0, false, 0); + Game_Flag_Set(310); + Set_Enter(39, 36); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 406.0f, 8.0f, -717.0f, 0, 1, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, 406.0f, 8.0f, -813.0f, 0, 0, false, 0); + Game_Flag_Set(308); + Set_Enter(38, 35); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, 100.0f, 0.0f, -260.0f, 0, 1, false, 0)) { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + Game_Flag_Reset(257); + int spinnerDest = Spinner_Interface_Choose_Dest(3, 0); + switch (spinnerDest) { + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(256); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(256); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(256); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(256); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(256); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(256); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(256); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(256); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(256); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 4, 1); + break; + default: + Game_Flag_Set(257); + Loop_Actor_Walk_To_XYZ(0, 100.0f, 0.0f, -300.0f, 0, 1, false, 0); + break; + } + } + return true; + } + return false; +} + +bool ScriptHF01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF01::SceneFrameAdvanced(int frame) { + if (frame == 10) { + Sound_Play(118, 40, 0, 0, 50); + } + if (frame == 72 || frame == 193) { + Sound_Play(116, 100, -50, -50, 50); + } + if (frame == 88 || frame == 214) { + Sound_Play(119, 100, -50, -50, 50); + } + if (frame == 242) { + Sound_Play(117, 40, -50, 80, 50); + } + if (Actor_Query_Goal_Number(31) == 1) { + Actor_Set_Goal_Number(31, 0); + } +} + +void ScriptHF01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHF01::PlayerWalkedIn() { + if (Game_Flag_Query(663)) { + ADQ_Flush(); + ADQ_Add(24, 280, 3); + Actor_Put_In_Set(23, 37); + Actor_Set_At_XYZ(23, 8.2f, 8.0f, -346.67f, 1021); + Actor_Put_In_Set(24, 37); + Actor_Set_At_XYZ(24, 51.21f, 8.0f, -540.78f, 796); + Non_Player_Actor_Combat_Mode_On(23, 3, 1, 0, 4, 4, 7, 8, 0, 0, 0, 100, 300, 0); + Non_Player_Actor_Combat_Mode_On(24, 3, 1, 0, 4, 4, 7, 8, 0, 0, 0, 100, 300, 0); + } + if (!Game_Flag_Query(165) && Actor_Query_Goal_Number(9) != 2) { + if (Actor_Clue_Query(0, 141) && Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(6) != 599) { + Actor_Put_In_Set(6, 37); + Actor_Set_At_XYZ(6, -5.0f, 8.0f, -622.0f, 419); + Actor_Set_Targetable(6, true); + } else if (Actor_Clue_Query(0, 139) && Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(3) != 599) { + Actor_Put_In_Set(3, 37); + Actor_Set_At_XYZ(3, -5.0f, 8.0f, -622.0f, 419); + Actor_Set_Targetable(3, true); + } + } + if (Game_Flag_Query(617)) { + Actor_Set_Goal_Number(1, 280); + Game_Flag_Reset(617); + //return true; + return; + } + if (Game_Flag_Query(652)) { + Game_Flag_Reset(652); + Actor_Voice_Over(950, 99); + Actor_Voice_Over(960, 99); + Actor_Voice_Over(970, 99); + Actor_Voice_Over(980, 99); + } else if (!Game_Flag_Query(377) && Global_Variable_Query(1) < 4) { + ADQ_Flush(); + ADQ_Add(31, 0, 14); + ADQ_Add(31, 10, 3); + ADQ_Add(22, 0, 3); + Actor_Face_Actor(31, 22, true); + ADQ_Add(31, 20, 13); + ADQ_Add(22, 10, 3); + ADQ_Add(31, 30, 3); + ADQ_Add(22, 20, 3); + Actor_Face_Heading(31, 271, false); + Game_Flag_Set(377); + } + if (Game_Flag_Query(311)) { + Loop_Actor_Walk_To_XYZ(0, 124.0f, 8.0f, -724.0f, 0, 1, false, 0); + } else if (Game_Flag_Query(309)) { + Loop_Actor_Walk_To_XYZ(0, 406.0f, 8.0f, -717.0f, 0, 1, false, 0); + } else if (!Game_Flag_Query(313)) { + Loop_Actor_Walk_To_XYZ(0, 100.0f, 0.0f, -300.0f, 0, 1, false, 0); + } + Game_Flag_Reset(311); + Game_Flag_Reset(309); + Game_Flag_Reset(313); + //return false; +} + +void ScriptHF01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(312) && !Game_Flag_Query(308) && !Game_Flag_Query(310) && !Game_Flag_Query(722)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(35, 1, -1); + Outtake_Play(38, 1, -1); + } + Game_Flag_Reset(722); + if (Actor_Query_Goal_Number(6) == 450) { + Actor_Put_In_Set(6, 97); + Actor_Set_At_Waypoint(6, 39, 0); + Actor_Set_Goal_Number(6, 599); + } + if (Actor_Query_Goal_Number(3) == 450) { + Actor_Put_In_Set(3, 97); + Actor_Set_At_Waypoint(3, 39, 0); + Actor_Set_Goal_Number(3, 599); + } +} + +void ScriptHF01::DialogueQueueFlushed(int a1) { +} + +void ScriptHF01::sub_4026B4() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 13) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(440, 8, 6, 3); + } + if (!Actor_Clue_Query(0, 13) && Actor_Clue_Query(0, 22) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(450, 7, 6, 3); + } + if (Actor_Clue_Query(0, 87) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(460, 3, 5, 6); + } + if (Actor_Clue_Query(0, 118) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(470, -1, 3, 8); + } + Dialogue_Menu_Add_DONE_To_List(480); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 440: + Actor_Says(0, 1480, 15); + Actor_Says(22, 70, 3); + Actor_Says(31, 120, 3); + Actor_Says(0, 1505, 14); + Actor_Says(22, 80, 3); + Actor_Says(31, 130, 3); + Actor_Says(22, 90, 3); + Actor_Says(0, 1510, 12); + break; + case 450: + Actor_Says(0, 1485, 16); + Actor_Says(22, 100, 3); + Actor_Says(31, 140, 12); + Actor_Says(22, 110, 3); + Actor_Says(22, 120, 3); + Actor_Says(31, 150, 14); + break; + case 460: + Actor_Says(0, 1490, 13); + Actor_Says(31, 160, 15); + Actor_Says(22, 130, 13); + Actor_Says(31, 170, 12); + Actor_Says(31, 180, 13); + Actor_Says(31, 190, 14); + Actor_Says(0, 1515, 15); + Actor_Says(31, 200, 3); + Actor_Says(0, 1520, 15); + Actor_Says(31, 210, 13); + Actor_Says(31, 220, 13); + Actor_Says(22, 140, 12); + Actor_Says(31, 230, 13); + Actor_Clue_Acquire(0, 101, 0, 31); + break; + case 470: + Actor_Says(0, 1495, 14); + Actor_Face_Actor(31, 0, true); + Actor_Says(31, 240, 13); + Actor_Face_Actor(31, 22, true); + break; + case 480: + Actor_Says(0, 1500, 16); + break; + } +} + +void ScriptHF01::sub_4032DC() { + Actor_Says(3, 0, 3); + Actor_Says(0, 1400, 3); + Actor_Says(3, 10, 3); + Actor_Says(0, 1405, 3); + Actor_Says(3, 20, 3); + Actor_Says(0, 1410, 3); + Actor_Says(3, 30, 3); + Actor_Says(0, 1415, 3); + Actor_Says(3, 40, 3); + Actor_Says(3, 50, 3); + Actor_Says(3, 60, 3); + Actor_Says(3, 70, 3); + Actor_Says(0, 1420, 3); + Actor_Says(3, 80, 3); +} + +void ScriptHF01::sub_403484() { + Actor_Says(6, 0, 3); + Actor_Says(0, 1425, 3); + Actor_Says(6, 10, 3); + Actor_Says(6, 20, 3); + Actor_Says(0, 1430, 3); + Actor_Says(6, 30, 3); + Actor_Says(0, 1435, 3); + Actor_Says(6, 40, 3); + Actor_Says(6, 50, 3); + Actor_Says(0, 1440, 3); + Actor_Says(6, 60, 3); + Actor_Says(6, 70, 3); + Actor_Says(0, 1445, 3); + Actor_Says(6, 80, 3); + Actor_Says(6, 3030, 3); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf02.cpp b/engines/bladerunner/script/hf02.cpp new file mode 100644 index 0000000000..575e3f8604 --- /dev/null +++ b/engines/bladerunner/script/hf02.cpp @@ -0,0 +1,144 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF02::InitializeScene() { + if (Game_Flag_Query(567)) { + Setup_Scene_Information(874.0f, 47.76f, -252.0f, 775); + Game_Flag_Reset(567); + } else if (Game_Flag_Query(528)) { + Setup_Scene_Information(470.0f, 47.76f, -500.0f, 560); + } else { + Setup_Scene_Information(-18.0f, 47.76f, -288.0f, 275); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 207, 66, 272, 207, 3); + Ambient_Sounds_Add_Looping_Sound(340, 28, -100, 1); + Ambient_Sounds_Add_Looping_Sound(341, 33, 0, 1); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); +} + +void ScriptHF02::SceneLoaded() { + Obstacle_Object("BARD_NEON", true); + Unclickable_Object("BARD_NEON"); + if (Actor_Query_Goal_Number(1) == 234) { + if (Game_Flag_Query(593)) { + Actor_Set_Goal_Number(1, 243); + } else { + Actor_Set_Goal_Number(1, 240); + } + } +} + +bool ScriptHF02::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF02::ClickedOn3DObject(const char *objectName, bool a2) { + Sound_Play(342, 47, -80, 0, 50); + return false; +} + +bool ScriptHF02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptHF02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 42.0f, 47.76f, -296.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(309); + Set_Enter(37, 34); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 470.0f, 47.76f, -444.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(527); + Set_Enter(39, 36); + } + return true; + } + return false; +} + +bool ScriptHF02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF02::SceneFrameAdvanced(int frame) { + +} + +void ScriptHF02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHF02::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(1) == 240) { + Actor_Set_Goal_Number(1, 241); + } + if (Game_Flag_Query(528)) { + Loop_Actor_Walk_To_XYZ(0, 470.0f, 47.76f, -444.0f, 0, 0, false, 0); + Game_Flag_Reset(528); + } else if (Game_Flag_Query(308)) { + Loop_Actor_Walk_To_XYZ(0, 42.0f, 47.76f, -296.0f, 0, 0, false, 0); + Game_Flag_Reset(308); + } + if (Actor_Query_Goal_Number(1) == 243) { + if (Actor_Query_Goal_Number(6) == 599) { + Actor_Set_Goal_Number(1, 244); + } else { + Actor_Set_Goal_Number(1, 245); + } + } +} + +void ScriptHF02::PlayerWalkedOut() { +} + +void ScriptHF02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf03.cpp b/engines/bladerunner/script/hf03.cpp new file mode 100644 index 0000000000..f146b08752 --- /dev/null +++ b/engines/bladerunner/script/hf03.cpp @@ -0,0 +1,254 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF03::InitializeScene() { + if (Game_Flag_Query(527)) { + Setup_Scene_Information(479.0f, 47.76f, -496.0f, 600); + } else { + Setup_Scene_Information(185.62f, 47.76f, -867.42f, 300); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(2, 323, 110, 380, 166, 0); + Ambient_Sounds_Add_Looping_Sound(340, 50, 0, 1); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); +} + +void ScriptHF03::SceneLoaded() { + Obstacle_Object("MAIN", true); + Unclickable_Object("MAIN"); +} + +bool ScriptHF03::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF03::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click(objectName, "MAIN")) { + Actor_Says(0, Random_Query(0, 3) + 8525, 18); + } + return false; +} + +void ScriptHF03::sub_401C80() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(840, -1, 3, 8); + DM_Add_To_List_Never_Repeat_Once_Selected(850, 6, 5, 2); + DM_Add_To_List_Never_Repeat_Once_Selected(860, 8, -1, -1); + DM_Add_To_List_Never_Repeat_Once_Selected(870, 2, 8, 6); + Dialogue_Menu_Add_DONE_To_List(880); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 840: + Actor_Says(0, 1630, 15); + if (Global_Variable_Query(40) == 3) { + Actor_Set_Goal_Number(6, 214); + } else if (Game_Flag_Query(46)) { + Actor_Set_Goal_Number(6, 212); + } else { + Actor_Set_Goal_Number(6, 210); + Game_Flag_Set(593); + } + break; + case 850: + Actor_Says(0, 1635, 15); + Actor_Says(6, 200, 13); + Actor_Modify_Friendliness_To_Other(6, 0, 3); + break; + case 860: + Actor_Says(0, 1640, 12); + if (Global_Variable_Query(40) == 3) { + Actor_Set_Goal_Number(6, 214); + } else { + Actor_Says(6, 210, 13); + Actor_Says(0, 1655, 15); + Actor_Modify_Friendliness_To_Other(6, 0, Random_Query(9, 10)); + if (Actor_Query_Friendliness_To_Other(6, 0) > 59 && !Global_Variable_Query(45)) { + Global_Variable_Set(45, 3); + Actor_Says(6, 940, 14); + Actor_Says(0, 6780, 11); + Actor_Says(6, 950, 12); + Actor_Says(6, 960, 13); + Actor_Says(0, 6785, 15); + Actor_Says(6, 970, 16); + Actor_Says(6, 980, 17); + if (Game_Flag_Query(47)) { + Actor_Says(6, 990, 17); + } + Actor_Says(0, 6790, 15); + Actor_Says(6, 1000, 13); + Actor_Says(6, 1010, 17); + Actor_Says(6, 1020, 18); + Actor_Says(0, 6795, 14); + Actor_Says(6, 1030, 17); + Actor_Says(0, 6800, 14); + } + Actor_Says(6, 220, 13); + Actor_Says(0, 1660, 15); + Actor_Says(6, 230, 14); + Actor_Clue_Acquire(6, 219, 1, 0); + if (Game_Flag_Query(46)) { + Actor_Set_Goal_Number(6, 212); + } else { + Actor_Set_Goal_Number(6, 210); + } + } + break; + case 870: + Actor_Says(0, 1645, 18); + Actor_Says(6, 240, 14); + Actor_Says(6, 250, 12); + Actor_Says(6, 260, 13); + Actor_Says(6, 270, 19); + Actor_Says(0, 1665, 18); + Actor_Says(6, 280, 13); + Actor_Says(0, 1670, 12); + Actor_Says(6, 290, 14); + Actor_Says(6, 300, 16); + Actor_Says(0, 1675, 12); + Actor_Says(6, 310, 13); + Actor_Clue_Acquire(0, 273, 0, 6); + break; + case 880: + Actor_Says(0, 1650, 14); + break; + } +} + +bool ScriptHF03::ClickedOnActor(int actorId) { + if (actorId == 6 && Actor_Query_Goal_Number(6) == 205) { + if (Game_Flag_Query(46) ? !Loop_Actor_Walk_To_Waypoint(0, 377, 0, 1, false) : !Loop_Actor_Walk_To_Waypoint(0, 378, 0, 1, false)) { + Actor_Face_Actor(0, 6, true); + if (!Game_Flag_Query(613)) { + Game_Flag_Set(613); + if (Game_Flag_Query(46)) { + Actor_Says(0, 1605, 15); + Actor_Says(6, 100, 12); + Actor_Says(0, 1610, 14); + } else { + Actor_Says(0, 1615, 16); + Actor_Says(6, 110, 13); + } + Actor_Says(6, 120, 13); + Actor_Says(0, 1620, 14); + Actor_Says(6, 130, 17); + Actor_Says(0, 1625, 15); + if (Game_Flag_Query(46)) { + Actor_Says(6, 140, 12); + Actor_Says(6, 150, 13); + Actor_Says(6, 160, 15); + } else { + Actor_Says(6, 170, 12); + Actor_Says(6, 180, 13); + Actor_Says(6, 190, 15); + } + } + sub_401C80(); + } + } + return false; +} + +bool ScriptHF03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 179.0f, 46.76f, -824.0f, 0, 1, false, 0)) { + Game_Flag_Set(311); + Set_Enter(37, 34); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 479.0f, 47.76f, -524.0f, 0, 1, false, 0)) { + Game_Flag_Set(528); + Set_Enter(38, 35); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 942.0f, 47.76f, -847.0f, 0, 1, false, 0)) { + Game_Flag_Set(566); + Set_Enter(40, 37); + } + return true; + } + return false; +} + +bool ScriptHF03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF03::SceneFrameAdvanced(int frame) { +} + +void ScriptHF03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHF03::PlayerWalkedIn() { + if (Game_Flag_Query(527)) { + Loop_Actor_Walk_To_XYZ(0, 479.0f, 47.76f, -524.0f, 0, 0, false, 0); + Game_Flag_Reset(527); + } else { + Loop_Actor_Walk_To_XYZ(0, 179.0f, 47.76f, -824.0f, 0, 0, false, 0); + Game_Flag_Reset(310); + } + if (Actor_Query_Goal_Number(6) == 250) { + Actor_Set_Goal_Number(6, 212); + Actor_Says(1, 210, 13); + Actor_Face_Actor(0, 1, true); + Actor_Says(0, 1680, 15); + Actor_Says(1, 220, 14); + Actor_Says(0, 1685, 13); + Actor_Says(1, 230, 16); + Actor_Says(0, 1690, 12); + Actor_Says(1, 240, 13); + Actor_Set_Goal_Number(1, 234); + } +} + +void ScriptHF03::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptHF03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf04.cpp b/engines/bladerunner/script/hf04.cpp new file mode 100644 index 0000000000..afeda9fdc3 --- /dev/null +++ b/engines/bladerunner/script/hf04.cpp @@ -0,0 +1,167 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF04::InitializeScene() { + Setup_Scene_Information(-33.85f, -0.31f, 395.0f, 0); + Game_Flag_Reset(566); + Scene_Exit_Add_2D_Exit(0, 602, 104, 639, 177, 1); + Ambient_Sounds_Add_Looping_Sound(70, 35, 0, 1); + Ambient_Sounds_Add_Looping_Sound(109, 40, 0, 1); + Ambient_Sounds_Add_Sound(72, 6, 70, 14, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 3, 70, 14, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 70, 14, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 70, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 70, 33, 50, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 70, 33, 50, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(584)) { + Scene_Loop_Set_Default(3); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptHF04::SceneLoaded() { + if (Game_Flag_Query(584)) { + Unobstacle_Object("PIVOT_WALL#1", true); + Unobstacle_Object("PIVOT_WALL#02", true); + Unobstacle_Object("PIVOT_WALL#03", true); + } else { + Unobstacle_Object("HIDE_WALL_A", true); + Unobstacle_Object("HIDE_WALL_B", true); + } + if (Actor_Query_Goal_Number(6) == 213) { + if (Actor_Clue_Query(6, 219) && Global_Variable_Query(40) != 3) { + Game_Flag_Set(593); + } else { + Actor_Set_Goal_Number(6, 230); + Game_Flag_Reset(584); + } + } +} + +bool ScriptHF04::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHF04::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptHF04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 1132.27f, -0.31f, -113.46f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(567); + Set_Enter(38, 35); + } + return true; + } + return false; +} + +bool ScriptHF04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF04::SceneFrameAdvanced(int frame) { + if (frame == 62) { + Sound_Play(359, Random_Query(43, 43), 0, 0, 50); + } + if (frame == 154) { + Sound_Play(360, Random_Query(43, 43), 0, 0, 50); + } + if (frame == 179 && Actor_Query_Goal_Number(6) == 235) { + Actor_Set_Goal_Number(6, 236); + } + if (Game_Flag_Query(585)) { + Game_Flag_Reset(585); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + //return true; + return; + } + if (Game_Flag_Query(586)) { + Game_Flag_Reset(586); + Scene_Loop_Set_Default(0); + Scene_Loop_Start_Special(2, 5, 1); + //return true; + return; + } + if (frame == 89) { + Game_Flag_Set(584); + Obstacle_Object("HIDE_WALL_A", false); + Obstacle_Object("HIDE_WALL_B", false); + Unobstacle_Object("PIVOT_WALL#1", false); + Unobstacle_Object("PIVOT_WALL#02", false); + Unobstacle_Object("PIVOT_WALL#03", true); + //return true; + return; + } + if (frame == 180) { + Unobstacle_Object("HIDE_WALL_A", false); + Unobstacle_Object("HIDE_WALL_B", false); + Obstacle_Object("PIVOT_WALL#1", false); + Obstacle_Object("PIVOT_WALL#02", false); + Obstacle_Object("PIVOT_WALL#03", true); + Game_Flag_Reset(584); + if (Actor_Query_Goal_Number(6) == 234) { + Actor_Set_Goal_Number(6, 235); + } + //return true; + return; + } + //return false; +} + +void ScriptHF04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHF04::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(6) == 230 || Actor_Query_Goal_Number(6) == 233) { + Player_Set_Combat_Mode(true); + Music_Play(1, 60, 0, 2, -1, 0, 0); + } + Loop_Actor_Walk_To_XYZ(0, -45.0f, -0.31f, 307.0f, 0, 0, true, 0); + Delay(2500); +} + +void ScriptHF04::PlayerWalkedOut() { + Music_Stop(5); +} + +void ScriptHF04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf05.cpp b/engines/bladerunner/script/hf05.cpp new file mode 100644 index 0000000000..f569f48b7d --- /dev/null +++ b/engines/bladerunner/script/hf05.cpp @@ -0,0 +1,673 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF05::InitializeScene() { + if (Game_Flag_Query(530)) { + Setup_Scene_Information(257.0f, 40.63f, 402.0f, 1000); + } else if (Game_Flag_Query(358)) { + Setup_Scene_Information(330.0f, 40.63f, -107.0f, 603); + } else { + Setup_Scene_Information(483.0f, 40.63f, -189.0f, 600); + } + Scene_Exit_Add_2D_Exit(0, 443, 270, 515, 350, 0); + if (Global_Variable_Query(1) > 3) { + Scene_Exit_Add_2D_Exit(1, 367, 298, 399, 349, 2); + } + Scene_Exit_Add_2D_Exit(2, 589, 0, 639, 479, 1); + Ambient_Sounds_Add_Looping_Sound(103, 40, 1, 1); + if (Game_Flag_Query(369)) { + Scene_Loop_Set_Default(5); + sub_404474(); + } else if (Game_Flag_Query(559)) { + Scene_Loop_Set_Default(2); + sub_404474(); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptHF05::SceneLoaded() { + Obstacle_Object("MAINBASE", true); + Unobstacle_Object("BTIRES02", true); + Unobstacle_Object("LFTIRE02", true); + if (Game_Flag_Query(369)) { + Unobstacle_Object("MONTE CARLO DRY", true); + } else { + Unobstacle_Object("OBSTACLE_HOLE", true); + } + Clickable_Object("TOP CON"); +} + +bool ScriptHF05::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF05::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("TOP CON", objectName) == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 95.0f, 40.63f, 308.0f, 0, 1, false, 0)) { + Actor_Face_Object(0, "TOP CON", true); + if (Actor_Query_In_Set(9, 41) && Actor_Query_Goal_Number(9) != 1 && Actor_Query_Goal_Number(9) != 2) { + Actor_Face_Actor(9, 0, true); + Actor_Says(9, 480, 13); + } else if (!Game_Flag_Query(662) || Game_Flag_Query(369)) { + Actor_Change_Animation_Mode(0, 23); + Sound_Play(412, 100, 0, 0, 50); + } else { + Player_Loses_Control(); + Actor_Set_Goal_Number(23, 425); + Game_Flag_Set(369); + Game_Flag_Set(368); + Obstacle_Object("OBSTACLE_HOLE", true); + Unobstacle_Object("MONTE CARLO DRY", true); + if (sub_4048C0()) { + Loop_Actor_Walk_To_XYZ(sub_4048C0(), 181.54f, 40.63f, 388.09f, 0, 0, true, 0); + Actor_Face_Actor(0, sub_4048C0(), true); + Actor_Face_Actor(sub_4048C0(), 0, true); + Actor_Says(0, 1785, 3); + Actor_Says(0, 1790, 3); + } + Actor_Face_Heading(0, 0, false); + Actor_Change_Animation_Mode(0, 23); + Scene_Loop_Set_Default(5); + Scene_Loop_Start_Special(2, 4, 1); + if (sub_4048C0()) { + if (sub_4048C0() == 3) { + Actor_Face_Heading(3, 0, false); + Ambient_Sounds_Play_Sound(147, 50, 99, 0, 0); + Delay(3000); + Actor_Face_Heading(3, 0, false); + Actor_Change_Animation_Mode(3, 23); + } else { + Actor_Face_Heading(6, 0, false); + Ambient_Sounds_Play_Sound(147, 50, 99, 0, 0); + Delay(3000); + Actor_Face_Heading(6, 0, false); + Actor_Change_Animation_Mode(6, 13); + } + Actor_Face_Actor(0, sub_4048C0(), true); + Actor_Says(0, 1805, 3); + } else { + ADQ_Flush(); + ADQ_Add(99, 940, -1); + Ambient_Sounds_Play_Sound(147, 50, 99, 0, 0); + Delay(1500); + Loop_Actor_Walk_To_XYZ(0, 181.53999f, 40.630001f, 388.09f, 0, 0, true, 0); + Actor_Face_Heading(0, 0, false); + Actor_Change_Animation_Mode(0, 23); + Actor_Clue_Lose(0, 146); + } + Player_Gains_Control(); + } + } + return true; + } + return false; +} + +bool ScriptHF05::ClickedOnActor(int actorId) { + if (actorId == 9) { + if (!Loop_Actor_Walk_To_Actor(0, 9, 60, 1, false)) { + Actor_Face_Actor(0, 9, true); + Actor_Face_Actor(9, 0, true); + sub_402AE4(); + } + } + return false; +} + +bool ScriptHF05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 483.0f, 40.63f, -189.0f, 0, 1, false, 0) && !Game_Flag_Query(684)) { + Game_Flag_Set(313); + Set_Enter(37, 34); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 330.0f, 40.63f, -85.0f, 0, 1, false, 0) && !Game_Flag_Query(684)) { + int v2 = sub_404858(); + if (Game_Flag_Query(663) && Game_Flag_Query(368) && v2 != -1) { + Actor_Face_Actor(0, v2, true); + Actor_Says(0, 1810, 16); + } + Game_Flag_Set(359); + Set_Enter(43, 40); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 277.0f, 40.631f, 410.0f, 0, 1, false, 0) && !Game_Flag_Query(684)) { + Game_Flag_Set(529); + Set_Enter(42, 39); + } + return true; + } + return false; +} + +bool ScriptHF05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF05::SceneFrameAdvanced(int frame) { + switch (frame) { + case 126: + Sound_Play(352, 90, -20, 70, 50); + break; + case 152: + Sound_Play(346, 90, 0, 0, 50); + break; + case 156: + Sound_Play(348, 47, 100, 100, 50); + break; + case 161: + Sound_Play(345, 90, 0, 0, 50); + break; + case 176: + Sound_Play(350, 32, 100, 100, 50); + break; + case 178: + Sound_Play(355, 47, 100, 100, 50); + break; + case 179: + Sound_Play(490, 90, 0, 0, 50); + Music_Play(1, 50, 0, 2, -1, 0, 0); + break; + case 186: + Sound_Play(343, 32, 100, 100, 50); + break; + case 209: + Sound_Play(353, 90, 100, -20, 50); + break; + case 243: + Sound_Play(349, 40, -20, -20, 50); + break; + case 261: + Sound_Play(344, 47, -20, -20, 50); + break; + case 268: + Sound_Play(351, 58, -20, -20, 50); + break; + case 269: + Sound_Play(354, 43, -20, -20, 50); + break; + } + //return true; +} + +void ScriptHF05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 23 && newGoal == 430) { + Game_Flag_Set(684); + sub_4042E4(); + } + //return false; +} + +void ScriptHF05::PlayerWalkedIn() { + if (Game_Flag_Query(662)) { + int v0 = sub_404858(); + if (Game_Flag_Query(662) && v0 != -1) { + Actor_Put_In_Set(v0, 41); + Actor_Force_Stop_Walking(v0); + if (Game_Flag_Query(312)) { + Actor_Set_At_XYZ(v0, 506.81f, 40.63f, -140.92f, 0); + Async_Actor_Walk_To_Waypoint(v0, 437, 36, 0); + } else if (Game_Flag_Query(530)) { + Actor_Set_At_XYZ(v0, 288.0f, 40.63f, 410.0f, 909); + } else if (Game_Flag_Query(358)) { + Actor_Set_At_XYZ(v0, 298.0f, 40.63f, -107.0f, 512); + } else { + Actor_Set_At_XYZ(v0, 284.0f, 40.63f, 286.0f, 0); + } + } + if (Game_Flag_Query(684)) { + sub_4042E4(); + } else if (Actor_Clue_Query(0, 265) || Game_Flag_Query(559)) { + if (Game_Flag_Query(559) && !Game_Flag_Query(663)) { + Game_Flag_Set(663); + Music_Play(1, 40, 0, 2, -1, 0, 0); + Actor_Says(24, 200, 3); + Actor_Says(24, 210, 3); + Actor_Set_Goal_Number(23, 420); + if (sub_4048C0() == 3) { + sub_403F0C(); + } else if (sub_4048C0() == 6) { + sub_40410C(); + } + } + } else { + sub_403A34(v0); + } + } else if (Game_Flag_Query(312) == 1) { + Loop_Actor_Walk_To_XYZ(0, 399.0f, 40.63f, -85.0f, 0, 0, false, 0); + } else if (Game_Flag_Query(358)) { + Actor_Set_At_XYZ(0, 346.0f, 4.63f, -151.0f, 603); + Loop_Actor_Travel_Stairs(0, 4, 1, 0); + } + if (Actor_Query_In_Set(9, 41)) { + if (Game_Flag_Query(562)) { + if (!Game_Flag_Query(563) && Global_Variable_Query(1) == 3) { + sub_402970(); + Game_Flag_Set(563); + } + } else { + sub_402370(); + Game_Flag_Set(562); + } + } + Game_Flag_Reset(312); + Game_Flag_Reset(530); + Game_Flag_Reset(358); + + //return false; +} + +void ScriptHF05::PlayerWalkedOut() { + if (Actor_Query_Goal_Number(9) == 210) { + Actor_Set_Goal_Number(9, 2); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptHF05::DialogueQueueFlushed(int a1) { +} + +void ScriptHF05::sub_402970() { + Loop_Actor_Walk_To_Actor(9, 0, 72, 0, false); + Actor_Face_Actor(9, 0, true); + Actor_Face_Actor(0, 9, true); + Actor_Says(9, 370, 3); + Actor_Says(0, 1855, 3); + Actor_Says(9, 380, 12); + Actor_Says(9, 390, 14); + Actor_Says(9, 400, 15); + Actor_Says(9, 410, 16); + Actor_Says(0, 1860, 3); + Actor_Says(9, 420, 3); + Actor_Says(0, 1865, 3); +} + +void ScriptHF05::sub_402AE4() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 99) == 1 && Global_Variable_Query(1) == 3) { + DM_Add_To_List_Never_Repeat_Once_Selected(1180, 3, 6, 7); + } + if (Actor_Clue_Query(0, 116) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1190, 2, 7, 4); + } + if (Actor_Clue_Query(0, 88) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1200, 5, 5, 3); + } + if (Actor_Clue_Query(0, 13) == 1 && Actor_Query_Goal_Number(6) != 599) { + DM_Add_To_List_Never_Repeat_Once_Selected(1210, 4, 6, 2); + } + if (Actor_Clue_Query(0, 237) == 1 || (Actor_Clue_Query(0, 99) == 1 && Global_Variable_Query(1) == 3)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1220, -1, 2, 8); + } + if (Actor_Clue_Query(0, 113) == 1 || Actor_Clue_Query(0, 115) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(1230, 4, 7, -1); + } + if (!Dialogue_Menu_Query_List_Size()) { + Actor_Says(0, 1880, 15); + Actor_Says(9, 490, 3); + Actor_Says(0, 1885, 3); + Actor_Says(9, 500, 16); + return; + } + Dialogue_Menu_Add_DONE_To_List(1240); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 1180: + Actor_Says(0, 1890, 23); + Actor_Says(9, 510, 3); + Actor_Says(0, 1920, 23); + Actor_Says(0, 1925, 3); + Actor_Says(9, 530, 12); + Actor_Says(0, 1930, 18); + Actor_Says(9, 540, 14); + Actor_Says(0, 1935, 14); + Actor_Says(9, 550, 16); + Actor_Says(0, 1940, 15); + Actor_Says(0, 1945, -1); + Actor_Says(9, 560, 15); + Actor_Says(9, 570, 16); + Actor_Says(0, 1950, 17); + sub_403738(); + break; + case 1190: + Actor_Says(0, 1895, 0); + Actor_Says(9, 620, 3); + Actor_Says(9, 630, 12); + Actor_Says(0, 2000, 13); + Actor_Says(9, 640, 14); + Actor_Says(9, 650, 15); + Actor_Says(9, 660, 16); + Actor_Says(0, 2005, 0); + Actor_Says(0, 2010, 3); + Actor_Says(9, 670, 3); + Actor_Says(9, 680, 12); + Actor_Says(9, 690, 14); + Actor_Says(0, 2015, 14); + Actor_Says(9, 700, 15); + Actor_Says(0, 2020, 18); + break; + case 1200: + Actor_Says(0, 1900, 23); + Actor_Says(9, 710, 16); + Actor_Says(0, 2025, 0); + Actor_Says(9, 720, 3); + Actor_Says(9, 730, 12); + break; + case 1210: + Actor_Says(0, 1905, 23); + Actor_Says(9, 740, 14); + Actor_Says(0, 2030, 13); + Actor_Says(9, 750, 15); + Actor_Says(0, 2035, 18); + Actor_Says(9, 760, 16); + Actor_Says(9, 770, 3); + Actor_Says(0, 2040, 0); + break; + case 1220: + Actor_Says(0, 1910, 3); + Actor_Says(9, 780, 12); + Actor_Says(0, 2045, 17); + Actor_Says(0, 2050, 3); + Actor_Says(9, 790, 14); + Actor_Says(0, 2055, 19); + Actor_Says(0, 2060, -1); + Actor_Says(9, 800, 15); + Actor_Says(0, 2065, 18); + Actor_Says(0, 2070, 14); + Actor_Says(9, 810, 16); + sub_403738(); + break; + case 1230: + Actor_Says(0, 1915, 12); + if (Actor_Clue_Query(0, 113)) { + Actor_Says(9, 820, 3); + Actor_Says(0, 2075, 13); + Actor_Says(9, 830, 12); + Actor_Says(9, 840, 14); + Actor_Says(9, 850, 15); + Actor_Says(0, 2080, 3); + Actor_Says(9, 860, 16); + Actor_Says(9, 870, 3); + } else if (Actor_Clue_Query(0, 115)) { + Actor_Says(9, 880, 12); + Actor_Says(9, 890, 14); + Actor_Says(0, 2085, 3); + Actor_Says(9, 900, 15); + Actor_Says(0, 2090, 19); + Actor_Says(9, 910, 16); + Actor_Says(0, 2095, 14); + Actor_Says(9, 920, 3); + Actor_Says(0, 2100, 15); + Actor_Says(9, 930, 12); + Actor_Says(9, 940, 14); + Actor_Says(0, 2105, 3); + Actor_Says(9, 950, 15); + Actor_Says(0, 2110, 0); + Actor_Says(9, 960, 16); + } + break; + } +} + +void ScriptHF05::sub_403738() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(1250, -1, -1, 10); + DM_Add_To_List_Never_Repeat_Once_Selected(1260, 10, 5, -1); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 1250) { + Actor_Says(0, 1955, 17); + Actor_Says(0, 1960, 23); + Item_Pickup_Spin_Effect(986, 315, 327); + Delay(2000); + Actor_Says(0, 1980, 23); + Actor_Says(0, 1985, 3); + Actor_Says(9, 580, 3); + Actor_Says(9, 590, 15); + Actor_Says(0, 1990, 17); + Actor_Says(9, 600, 16); + Actor_Says(0, 1995, 3); + Game_Flag_Set(165); + Actor_Put_In_Set(9, 67); + Actor_Set_At_XYZ(9, -315.15f, 0.0f, 241.06f, 583); + Actor_Set_Goal_Number(9, 699); + Game_Flag_Set(652); + if (Game_Flag_Query(255)) { + Set_Enter(54, 54); + } else { + Game_Flag_Set(313); + Set_Enter(37, 34); + } + } else if (answer == 1260) { + Actor_Says(0, 1965, 12); + Actor_Says(0, 1970, 3); + Actor_Says(0, 1975, 3); + Actor_Says(9, 610, 16); + } +} + +int ScriptHF05::sub_404858() { + if (Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(3) != 599) { + return 3; + } + if (Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(6) != 599) { + return 6; + } + return -1; +} + +void ScriptHF05::sub_4042E4() { + Actor_Force_Stop_Walking(0); + Actor_Put_In_Set(23, 41); + Actor_Set_At_XYZ(23, 430.39999f, 40.630001f, -258.17999f, 300); + Actor_Put_In_Set(24, 41); + Actor_Set_At_XYZ(24, 526.40002f, 37.18f, -138.17999f, 300); + ADQ_Flush(); + ADQ_Add(24, 260, -1); + Player_Loses_Control(); + Non_Player_Actor_Combat_Mode_On(23, 3, 1, 0, 4, 4, 7, 8, 0, 0, 100, 100, 1200, 1); + return Non_Player_Actor_Combat_Mode_On(24, 3, 1, 0, 4, 4, 7, 8, 0, 0, 100, 100, 300, 1); +} + +void ScriptHF05::sub_403F0C() { + Actor_Face_Actor(0, 3, true); + Actor_Face_Actor(3, 0, true); + Actor_Says(3, 2660, 12); + Actor_Says(0, 8990, 3); + Actor_Says(3, 2670, 13); + Actor_Says(3, 2680, 17); + Actor_Says(0, 8995, 14); + Actor_Says(3, 2690, 15); + Actor_Says_With_Pause(0, 9000, 1.0f, 16); + Actor_Says_With_Pause(0, 9005, 1.0f, 19); + Actor_Says(0, 1765, 17); + Actor_Says(3, 160, 12); + Actor_Says(0, 1770, 15); + Actor_Says(0, 1775, 3); + Actor_Says(3, 170, 3); + Actor_Says_With_Pause(0, 1780, 1.0f, 18); +} + +void ScriptHF05::sub_40410C() { + Actor_Face_Actor(0, 6, true); + Actor_Face_Actor(6, 0, true); + Actor_Says(6, 400, 16); + Actor_Says(0, 1750, 14); + Actor_Says(6, 410, 12); + Actor_Says(6, 420, 14); + Actor_Says(0, 1755, 16); + Actor_Says(6, 430, 18); + Actor_Says_With_Pause(0, 1760, 1.0f, 15); + Actor_Says(0, 1765, 17); + Actor_Says(6, 440, 3); + Actor_Says(0, 1770, 15); + Actor_Says(0, 1775, 3); + Actor_Says(6, 450, 17); + Actor_Says_With_Pause(0, 1780, 1.0f, 18); +} + +void ScriptHF05::sub_403A34(int actorId) { + if (actorId != -1 && Actor_Query_In_Set(9, 41)) { + Async_Actor_Walk_To_Waypoint(actorId, 437, 36, 0); + Loop_Actor_Walk_To_Waypoint(0, 437, 0, 0, false); + Actor_Face_Actor(9, 0, true); + Actor_Face_Actor(0, 9, true); + Actor_Face_Actor(actorId, 9, true); + Actor_Says(9, 0, 3); + Actor_Says(9, 10, 12); + Actor_Says(0, 1715, 19); + Actor_Says(0, 1720, -1); + Actor_Says(9, 20, 14); + Actor_Says(9, 30, 15); + Actor_Says(0, 1725, 3); + Actor_Says(9, 40, 16); + Actor_Says(9, 50, 3); + Actor_Says(9, 60, 12); + Actor_Says(9, 70, 13); + Actor_Says(0, 1730, 3); + Loop_Actor_Walk_To_Actor(9, 0, 28, 0, false); + Item_Pickup_Spin_Effect(986, 315, 327); + Actor_Says(9, 80, 23); + Actor_Clue_Acquire(0, 265, 1, 9); + Actor_Says(9, 90, 15); + Actor_Says(0, 1735, 17); + Actor_Says(9, 100, 16); + Actor_Says(9, 110, 3); + Actor_Face_Actor(actorId, 0, true); + if (actorId == 3) { + Actor_Says(3, 90, 3); + } else { + Actor_Says(6, 380, 3); + } + Actor_Says(0, 1740, 14); + Actor_Says(9, 120, 12); + Actor_Set_Goal_Number(9, 2); + if (actorId == 3) { + Actor_Says(3, 100, 3); + } else { + Actor_Says(6, 390, 3); + } + Actor_Face_Actor(0, actorId, true); + Actor_Says(0, 1745, 3); + Async_Actor_Walk_To_XYZ(actorId, 309.0f, 40.63f, 402.0f, 0, false); + Loop_Actor_Walk_To_XYZ(0, 277.0f, 40.63f, 410.0f, 0, 0, false, 0); + Game_Flag_Set(529); + Set_Enter(42, 39); + } +} + +void ScriptHF05::sub_402370() { + Player_Loses_Control(); + if (Global_Variable_Query(1) == 3) { + ADQ_Flush(); + ADQ_Add(9, 130, 18); + ADQ_Add(9, 140, 18); + ADQ_Add(9, 150, 18); + ADQ_Add(9, 160, 17); + } + Loop_Actor_Walk_To_XYZ(0, 307.0f, 40.63f, 184.0f, 0, 0, false, 0); + Loop_Actor_Walk_To_Actor(9, 0, 72, 0, false); + Ambient_Sounds_Play_Sound(149, 99, 99, 0, 0); + Actor_Face_Actor(9, 0, true); + Actor_Face_Actor(0, 9, true); + Actor_Says(9, 170, 3); + Actor_Says(9, 180, 12); + Actor_Says(9, 190, 14); + Actor_Says(9, 200, 15); + Actor_Says(0, 1815, 12); + Actor_Says(9, 210, 16); + Actor_Says(0, 1820, -1); + Actor_Says(9, 220, 3); + Actor_Says(9, 230, 12); + Actor_Says(9, 240, 14); + Actor_Says(0, 1825, 0); + Actor_Says(9, 250, 15); + Actor_Face_Object(9, "MONTE CARLO DRY", true); + Actor_Says(9, 260, 16); + Actor_Face_Object(0, "MONTE CARLO DRY", true); + Actor_Says(0, 1830, 0); + Actor_Face_Actor(9, 0, true); + Actor_Face_Actor(0, 9, true); + Actor_Says(9, 270, 3); + Actor_Says(9, 280, 12); + Async_Actor_Walk_To_XYZ(9, 276.0f, 40.63f, 182.0f, 12, false); + Loop_Actor_Walk_To_XYZ(0, 335.0f, 40.63f, 131.0f, 12, 0, false, 0); + Actor_Face_Object(9, "MONTE CARLO DRY", true); + Actor_Face_Object(0, "MONTE CARLO DRY", true); + Actor_Says(9, 290, 14); + Actor_Says(9, 300, 15); + Actor_Says(9, 310, 16); + Actor_Says(0, 1835, 12); + Actor_Face_Actor(9, 0, true); + Actor_Says(9, 320, 3); + Actor_Face_Actor(0, 9, true); + Actor_Says(9, 330, 12); + Actor_Says(0, 1840, 3); + Actor_Says(9, 340, 14); + Actor_Says(0, 1845, 3); + Actor_Says(9, 350, 15); + Actor_Says(9, 360, 16); + Actor_Says(0, 1850, 3); + Player_Gains_Control(); +} + +void ScriptHF05::sub_404474() { + Ambient_Sounds_Add_Sound(87, 20, 80, 20, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(23, 250, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 330, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 340, 5, 90, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 360, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 380, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 510, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 80, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 160, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 280, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); +} + +int ScriptHF05::sub_4048C0() { + if (Actor_Query_In_Set(3, 41) == 1 && Actor_Query_Goal_Number(3) != 599) { + return 3; + } + if (Actor_Query_In_Set(6, 41) == 1 && Actor_Query_Goal_Number(6) != 599) { + return 6; + } + return 0; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf06.cpp b/engines/bladerunner/script/hf06.cpp new file mode 100644 index 0000000000..d9a5b3a2fe --- /dev/null +++ b/engines/bladerunner/script/hf06.cpp @@ -0,0 +1,286 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF06::InitializeScene() { + Setup_Scene_Information(150.0f, 349.93f, 502.0f, 229); + Game_Flag_Reset(529); + Scene_Exit_Add_2D_Exit(0, 195, 197, 271, 237, 2); + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(99, 40, -100, 1); + Ambient_Sounds_Add_Looping_Sound(100, 40, 100, 1); + Ambient_Sounds_Add_Sound(68, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(559)) { + Scene_Loop_Set_Default(3); + sub_4023E0(); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptHF06::SceneLoaded() { + Unobstacle_Object("BOX22", true); + Unobstacle_Object("BOX34", true); + Clickable_Object("BOX19"); + Clickable_Object("BOX21"); + Clickable_Object("BOX23"); + Clickable_Object("HOOD BOX"); + Clickable_Object("BOX28"); + Clickable_Object("BOX29"); + Clickable_Object("BOX30"); +} + +bool ScriptHF06::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF06::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BOX28", objectName) || Object_Query_Click("BOX29", objectName) || Object_Query_Click("BOX30", objectName) || Object_Query_Click("HOOD BOX", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, 14.33f, 367.93f, 399.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 486, true); + if (Actor_Query_In_Set(3, 42) && Actor_Query_Goal_Number(3) != 599) { + Actor_Face_Actor(3, 0, true); + Actor_Says(3, 210, 12); + Actor_Says(0, 2125, 12); + } else if (Actor_Query_In_Set(6, 42) && Actor_Query_Goal_Number(6) != 599) { + Actor_Face_Actor(6, 0, true); + Actor_Says(6, 490, 18); + Actor_Says(0, 2125, 12); + } else { + Actor_Says(0, 8635, 12); + } + } + return false; + } + if (Object_Query_Click("BOX19", objectName) || Object_Query_Click("BOX21", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, 290.0f, 367.93f, 318.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 85, true); + Actor_Says(0, 8522, 0); + } + return false; + } + if (Object_Query_Click("BOX13", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, 63.0f, 367.93f, 120.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 568, true); + Actor_Says(0, 8522, 0); + } + return false; + } + return false; +} + +bool ScriptHF06::ClickedOnActor(int actorId) { + if (actorId == 6 && Actor_Query_Goal_Number(6) != 599) { + Actor_Face_Actor(6, 0, true); + Actor_Face_Actor(0, 6, true); + if (Game_Flag_Query(559)) { + Actor_Says(6, 390, 18); + Actor_Says(0, 2115, 17); + } + } else if (actorId == 3 && Actor_Query_Goal_Number(3) != 599) { + Actor_Face_Actor(3, 0, true); + Actor_Face_Actor(0, 3, true); + if (Game_Flag_Query(559)) { + Actor_Says(3, 100, 3); + Actor_Says(0, 2115, 17); + } + } + return false; +} + +bool ScriptHF06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 170.0f, 367.93f, 497.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 730, false); + Loop_Actor_Travel_Stairs(0, 2, 0, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(530); + Set_Enter(41, 38); + } + return true; + } + return false; +} + +bool ScriptHF06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF06::SceneFrameAdvanced(int frame) { +} + +void ScriptHF06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 1 && oldGoal != 599 && newGoal == 599) { + Loop_Actor_Walk_To_Actor(0, 1, 24, 0, false); + Actor_Says(1, 250, -1); + Actor_Says(0, 2120, 4); + Actor_Says(1, 260, -1); + Actor_Says(1, 270, -1); + int otherActorId = -1; + if (Actor_Query_In_Set(3, 42) && Actor_Query_Goal_Number(3) == 599) { + otherActorId = 3; + } else if (Actor_Query_In_Set(6, 42) && Actor_Query_Goal_Number(6) == 599) { + otherActorId = 6; + } + if (otherActorId != -1) { + Music_Play(21, 35, 0, 3, -1, 0, 0); + Player_Set_Combat_Mode(false); + Delay(1000); + Actor_Voice_Over(990, 99); + Actor_Voice_Over(1000, 99); + Actor_Voice_Over(1010, 99); + Loop_Actor_Walk_To_Actor(0, otherActorId, 24, 0, false); + Item_Pickup_Spin_Effect(932, 355, 200); + Actor_Voice_Over(1020, 99); + Actor_Voice_Over(1030, 99); + Actor_Voice_Over(1040, 99); + Actor_Voice_Over(1050, 99); + Actor_Clue_Acquire(0, 146, 1, -1); + } + if (Actor_Query_In_Set(3, 42)) { + Actor_Set_Targetable(3, false); + } + if (Actor_Query_In_Set(6, 42)) { + Actor_Set_Targetable(6, false); + } + Scene_Exits_Enable(); + } +} + +void ScriptHF06::PlayerWalkedIn() { + if (Game_Flag_Query(662)) { + int actor_id; + if (Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(6) != 599) { + actor_id = 6; + } else { + actor_id = Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(3) != 599 ? 3 : -1; + } + if (actor_id != -1) { + Actor_Put_In_Set(actor_id, 42); + if (Game_Flag_Query(559)) { + Actor_Set_At_XYZ(actor_id, 173.67f, 367.93f, 446.04001f, 229); + Async_Actor_Walk_To_XYZ(actor_id, 173.67f, 367.93f, 394.04001f, 0, false); + } else { + Actor_Set_At_XYZ(actor_id, 97.67f, 367.93f, 534.04f, 725); + Async_Actor_Walk_To_XYZ(actor_id, 24.2f, 367.93f, 537.71f, 0, false); + } + } + } + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 2, 1, 0); + Footstep_Sound_Override_Off(); + if (Game_Flag_Query(662) && !Game_Flag_Query(559)) { + sub_401EF4(); + } +} + +void ScriptHF06::PlayerWalkedOut() { + Music_Stop(2); +} + +void ScriptHF06::DialogueQueueFlushed(int a1) { +} + +void ScriptHF06::sub_401EF4() { + int actorId; + + if (Actor_Query_In_Set(3, 42)) { + actorId = 3; + } else { + if (!Actor_Query_In_Set(6, 42)) { + return; + } + actorId = 6; + } + Actor_Set_Targetable(actorId, true); + Loop_Actor_Walk_To_XYZ(0, 14.33f, 367.93f, 399.0f, 0, 0, true, 0); + Actor_Face_Heading(0, 486, true); + sub_4023E0(); + Actor_Put_In_Set(1, 42); + Actor_Set_At_XYZ(1, 92.0f, 367.93f, 19.0f, 0); + Actor_Set_Targetable(1, true); + Actor_Face_Actor(actorId, 1, true); + if (actorId == 3) { + Actor_Says(3, 90, 13); + } else if (actorId == 6) { + Actor_Says(6, 380, 13); + } + Actor_Says(0, 6230, 0); + Actor_Says(1, 280, 58); + Actor_Face_Actor(0, 1, true); + Player_Set_Combat_Mode(true); + Actor_Change_Animation_Mode(0, 5); + Actor_Change_Animation_Mode(1, 7); + Loop_Actor_Walk_To_XYZ(1, 92.0f, 367.93f, 107.0f, 0, 0, false, 0); + Actor_Face_Actor(1, 0, true); + Actor_Change_Animation_Mode(1, 4); + Actor_Says(1, 290, 58); + Actor_Says(0, 2130, -1); + Actor_Says(1, 300, 59); + Actor_Says(0, 2135, -1); + Actor_Says(1, 310, 60); + Actor_Says(0, 2140, -1); + Actor_Says(1, 320, 59); + Actor_Says(0, 2145, -1); + Actor_Says(1, 330, 58); + Actor_Says(1, 340, 58); + Actor_Says(1, 350, 58); + Actor_Change_Animation_Mode(1, 4); + Game_Flag_Set(644); + Actor_Set_Goal_Number(1, 402); + Actor_Face_Actor(1, actorId, true); + Actor_Change_Animation_Mode(1, 6); + Delay(500); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Sound_Play(562, 50, 0, 0, 50); + Game_Flag_Set(559); + Scene_Exits_Disable(); + Non_Player_Actor_Combat_Mode_On(1, 3, 1, actorId, 15, 4, 7, 8, 0, 0, 100, 10, 300, 0); +} + +void ScriptHF06::sub_4023E0() { + Ambient_Sounds_Add_Sound(87, 20, 80, 20, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(23, 250, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 330, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 340, 5, 90, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 360, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 380, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 510, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 80, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 160, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 280, 5, 70, 7, 10, -50, 50, -101, -101, 1, 1); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/hf07.cpp b/engines/bladerunner/script/hf07.cpp new file mode 100644 index 0000000000..aa096004b3 --- /dev/null +++ b/engines/bladerunner/script/hf07.cpp @@ -0,0 +1,154 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptHF07::InitializeScene() { + if (Game_Flag_Query(361) ) { + Setup_Scene_Information(-84.0f, 58.43f, -105.0f, 524); + } else { + Setup_Scene_Information(298.0f, 58.43f, -71.0f, 700); + } + Scene_Exit_Add_2D_Exit(0, 289, 136, 344, 305, 0); + Scene_Exit_Add_2D_Exit(1, 69, 264, 132, 303, 2); + Ambient_Sounds_Add_Looping_Sound(108, 100, 0, 1); + Ambient_Sounds_Add_Looping_Sound(112, 32, 0, 1); + Ambient_Sounds_Add_Sound(303, 5, 40, 20, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 40, 20, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 40, 20, 33, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(368) ) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptHF07::SceneLoaded() { + Obstacle_Object("BRIMS02", true); + Unobstacle_Object("BOX50", true); + Unobstacle_Object("BOX60", true); +} + +bool ScriptHF07::MouseClick(int x, int y) { + return false; +} + +bool ScriptHF07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptHF07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptHF07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptHF07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (Actor_Query_In_Set(3, 43)) { + Async_Actor_Walk_To_XYZ(3, 235.0f, 58.43f, -100.0f, 0, false); + } else if (Actor_Query_In_Set(6, 43)) { + Async_Actor_Walk_To_XYZ(6, 235.0f, 58.43f, -100.0f, 0, false); + } + if (!Loop_Actor_Walk_To_XYZ(0, 318.0f, 71.43f, -102.0f, 0, 1, false, 0)) { + Game_Flag_Set(358); + if (!Game_Flag_Query(662)) { + Actor_Face_Heading(0, 0, false); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 30, 1, 0); + Footstep_Sound_Override_Off(); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(41, 38); + } + return true; + } + if (exitId == 1) { + if (Actor_Query_In_Set(3, 43)) { + Async_Actor_Walk_To_XYZ(3, -73.0f, 58.43f, -7.0f, 0, false); + } else if (Actor_Query_In_Set(6, 43)) { + Async_Actor_Walk_To_XYZ(6, -73.0f, 58.43f, -7.0f, 0, false); + } + if (!Loop_Actor_Walk_To_XYZ(0, -84.0f, 58.43f, -105.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(360); + Set_Enter(78, 90); + } + return true; + } + return false; +} + +bool ScriptHF07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptHF07::SceneFrameAdvanced(int frame) { +} + +void ScriptHF07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptHF07::PlayerWalkedIn() { + if (Game_Flag_Query(662)) { + int actorId = sub_401864(); + if (Game_Flag_Query(662) && actorId != -1) { + Actor_Put_In_Set(actorId, 43); + if (Game_Flag_Query(361)) { + Actor_Set_At_XYZ(actorId, -73.0f, 58.43f, -7.0f, 224); + } else { + Actor_Set_At_XYZ(actorId, 235.0f, 58.43f, -100.0f, 512); + } + } + } else if (Game_Flag_Query(359)) { + Actor_Set_At_XYZ(0, 267.72f, 329.43f, -86.75f, 940); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 30, 0, 0); + Footstep_Sound_Override_Off(); + } + Game_Flag_Reset(359); + Game_Flag_Reset(361); +} + +void ScriptHF07::PlayerWalkedOut() { +} + +void ScriptHF07::DialogueQueueFlushed(int a1) { +} + +int ScriptHF07::sub_401864() { + if (Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(3) != 599) { + return 3; + } + if (Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(6) != 599) { + return 6; + } + return -1; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/init.cpp b/engines/bladerunner/script/init.cpp new file mode 100644 index 0000000000..64136baed0 --- /dev/null +++ b/engines/bladerunner/script/init.cpp @@ -0,0 +1,2728 @@ +/* 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/script/init.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +void ScriptInit::SCRIPT_Initialize_Game() { + Assign_Player_Gun_Hit_Sounds(0, 517, 518, 519); + Assign_Player_Gun_Hit_Sounds(1, 520, 521, 522); + Assign_Player_Gun_Hit_Sounds(2, 523, 524, 525); + + Assign_Player_Gun_Miss_Sounds(0, 526, 527, 528); + Assign_Player_Gun_Miss_Sounds(1, 529, 530, 531); + Assign_Player_Gun_Miss_Sounds(2, 532, 533, 534); + + Init_Globals(); + Init_Game_Flags(); + Init_Clues(); + Init_Clues2(); + Init_World_Waypoints(); + Init_SDB(); + Init_CDB(); + Init_Spinner(); + Init_Actor_Friendliness(); + Init_Actor_Combat_Aggressiveness(); + Init_Actor_Honesty(); + Init_Actor_Intelligence(); + Init_Actor_Stability(); + Init_Actor_Health(); + Init_Combat_Cover_Waypoints(); + Init_Combat_Flee_Waypoints(); + Init_Shadows(); +} + +void ScriptInit::Init_Globals() { + for (int i = 0; i != 55; ++i) + Global_Variable_Set(i, 0); + + Global_Variable_Set(35, 2); + Global_Variable_Set(1, 1); + Global_Variable_Set(2, 100); + + Set_Score(0, 0); + Set_Score(1, 64); + Set_Score(2, 10); + Set_Score(3, 47); + Set_Score(4, 35); + Set_Score(5, 23); + Set_Score(6, 28); +} + +void ScriptInit::Init_Game_Flags() { + for (int i = 0; i != 730; ++i) + Game_Flag_Reset(i); + + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(44); + } + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(45); + } + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(46); + } + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(47); + } + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(48); + } + if (Random_Query(1, 2) == 1) { + Game_Flag_Set(560); + } + if (!Game_Flag_Query(45) && !Game_Flag_Query(46) && !Game_Flag_Query(47)) { + Game_Flag_Set(47); + } + + if (Game_Flag_Query(47)) { + Global_Variable_Set(40, 1); + } else if (Game_Flag_Query(45) && !Game_Flag_Query(46)) { + Global_Variable_Set(40, 2); + } else if (!Game_Flag_Query(45) && Game_Flag_Query(46)) { + Global_Variable_Set(40, 3); + } else if (Random_Query(1, 2) == 1) { + Global_Variable_Set(40, 2); + } else { + Global_Variable_Set(40, 3); + } + + Game_Flag_Set(182); + Game_Flag_Set(249); +} + +void ScriptInit::Init_Clues() { + for (int i = 0; i != 288; ++i) { + Actor_Clue_Add_To_Database(0, i, 0, false, false, -1); + } +} + +struct clue_weigth { + int clue; + int weight; +}; + +static clue_weigth clues_actor_1[44] = { + {222, 100}, {227, 100}, {223, 100}, {224, 100}, {226, 100}, {228, 100}, {231, 100}, {162, 100}, + {164, 100}, {166, 100}, {168, 100}, {170, 100}, {172, 100}, {174, 100}, {176, 100}, {239, 90}, + {241, 90}, {242, 90}, {179, 90}, {180, 90}, {181, 90}, {8, 85}, {240, 85}, {216, 85}, + {217, 85}, {178, 80}, {5, 65}, {9, 65}, {215, 65}, {218, 65}, {219, 65}, {220, 65}, + {229, 65}, {211, 65}, {80, 65}, {108, 65}, {134, 65}, {135, 65}, {212, 55}, {221, 55}, + {230, 55}, {6, 30}, {7, 30}, {65, 30} +}; + +static clue_weigth clues_actor_2[28] = { + {227, 70}, {240, 65}, {241, 70}, {242, 95}, {212, 70}, {213, 70}, {214, 70}, {215, 70}, + {216, 95}, {217, 70}, {218, 70}, {219, 70}, {220, 70}, {221, 65}, {222, 70}, {223, 70}, + {224, 70}, {226, 70}, {228, 70}, {229, 70}, {230, 70}, {231, 70}, {232, 70}, {116, 65}, + {117, 65}, {145, 70}, {207, 55}, {211, 65} +}; + +static clue_weigth clues_actor_3[46] = { + {227, 70}, {240, 45}, {241, 70}, {242, 65}, {212, 70}, {213, 70}, {214, 70}, {215, 70}, + {216, 65}, {217, 70}, {220, 70}, {219, 70}, {218, 70}, {221, 45}, {222, 70}, {223, 70}, + {224, 70}, {225, 70}, {226, 70}, {228, 70}, {229, 70}, {230, 70}, {231, 70}, {95, 70}, + {232, 70}, {239, 65}, {19, 65}, {25, 55}, {60, 60}, {69, 60}, {70, 60}, {92, 70}, + {103, 65}, {121, 65}, {130, 70}, {147, 70}, {148, 65}, {149, 65}, {150, 65}, {151, 65}, + {152, 65}, {116, 65}, {117, 65}, {145, 70}, {207, 55}, {211, 65} +}; + +static clue_weigth clues_actor_4[23] = { + {241, 90}, {242, 90}, {240, 70}, {214, 75}, {216, 75}, {218, 75}, {219, 75}, {220, 75}, + {215, 70}, {217, 70}, {222, 70}, {223, 70}, {224, 70}, {226, 70}, {228, 70}, {230, 70}, + {73, 65}, {211, 65}, {80, 65}, {108, 65}, {134, 65}, {135, 65}, {212, 55} +}; + +static clue_weigth clues_actor_5[46] = { + {227, 70}, {241, 70}, {212, 70}, {213, 70}, {214, 70}, {215, 70}, {217, 70}, {220, 70}, + {219, 70}, {218, 70}, {222, 70}, {223, 70}, {224, 70}, {226, 70}, {228, 70}, {229, 70}, + {230, 70}, {232, 70}, {130, 70}, {147, 70}, {145, 70}, {242, 65}, {216, 65}, {239, 65}, + {19, 65}, {95, 65}, {103, 65}, {107, 65}, {121, 65}, {148, 65}, {149, 65}, {150, 65}, + {151, 65}, {152, 65}, {116, 65}, {117, 65}, {211, 65}, {60, 60}, {69, 60}, {70, 60}, + {92, 60}, {25, 55}, {133, 55}, {207, 55}, {240, 45}, {221, 45} +}; + +static clue_weigth clues_actor_6[47] = { + {227, 70}, {240, 45}, {241, 70}, {242, 65}, {212, 70}, {213, 70}, {214, 70}, {215, 70}, + {216, 65}, {217, 70}, {220, 70}, {219, 70}, {218, 70}, {221, 45}, {222, 70}, {223, 70}, + {224, 70}, {226, 70}, {228, 70}, {229, 70}, {230, 70}, {231, 70}, {232, 70}, {239, 65}, + {19, 65}, {25, 55}, {60, 60}, {69, 60}, {70, 60}, {92, 60}, {95, 65}, {103, 65}, + {107, 65}, {121, 55}, {130, 70}, {133, 70}, {147, 70}, {148, 65}, {149, 65}, {150, 65}, + {151, 65}, {152, 65}, {116, 65}, {117, 65}, {145, 70}, {207, 55}, {211, 65} +}; + +static clue_weigth clues_actor_7_and_8[47] = { + {227, 70}, {240, 45}, {241, 70}, {242, 65}, {212, 70}, {213, 70}, {214, 70}, {215, 70}, + {216, 65}, {217, 70}, {220, 70}, {219, 70}, {218, 70}, {221, 45}, {222, 70}, {223, 70}, + {224, 70}, {226, 70}, {228, 70}, {229, 70}, {230, 70}, {231, 70}, {232, 70}, {239, 65}, + {19, 45}, {25, 45}, {60, 45}, {69, 45}, {70, 45}, {92, 45}, {95, 45}, {103, 45}, + {107, 45}, {121, 45}, {130, 45}, {133, 45}, {147, 70}, {148, 70}, {149, 70}, {150, 70}, + {151, 70}, {152, 70}, {116, 65}, {117, 65}, {145, 70}, {207, 55}, {211, 65} +}; + +static clue_weigth clues_actor_9[49] = { + {241, 70}, {212, 70}, {214, 70}, {217, 70}, {220, 70}, {219, 70}, {218, 70}, {222, 70}, + {223, 70}, {224, 70}, {226, 70}, {228, 70}, {229, 70}, {230, 70}, {231, 70}, {130, 70}, + {133, 70}, {147, 70}, {148, 70}, {149, 70}, {150, 70}, {151, 70}, {152, 70}, {145, 70}, + {227, 65}, {240, 65}, {242, 65}, {213, 65}, {215, 65}, {216, 65}, {221, 65}, {239, 65}, + {95, 65}, {103, 65}, {107, 65}, {121, 65}, {116, 65}, {117, 65}, {211, 65}, {99, 65}, + {236, 65}, {60, 60}, {69, 60}, {70, 60}, {232, 55}, {92, 55}, {207, 55}, {19, 50}, + {25, 40} +}; + +static clue_weigth clues_actor_10[44] = { + {241, 70}, {130, 70}, {147, 70}, {145, 70}, {240, 65}, {216, 65}, {217, 65}, {219, 65}, + {218, 65}, {221, 65}, {223, 65}, {224, 65}, {226, 65}, {229, 65}, {239, 65}, {95, 65}, + {121, 65}, {148, 65}, {149, 65}, {150, 65}, {152, 65}, {116, 65}, {117, 65}, {214, 60}, + {215, 60}, {69, 60}, {70, 60}, {211, 60}, {242, 55}, {213, 55}, {220, 55}, {222, 55}, + {60, 55}, {107, 55}, {133, 55}, {103, 50}, {92, 45}, {207, 45}, {227, 35}, {212, 35}, + {230, 35}, {232, 35}, {19, 30}, {25, 30} +}; + +void ScriptInit::Init_Clues2() { + for (int i = 0; i != 288; ++i) { + Actor_Clue_Add_To_Database(99, i, 100, false, false, -1); + } + +#define IMPORT_CLUE_TABLE(a, arr) \ + for (int i = 0; i != ARRAYSIZE(arr); ++i) {\ + Actor_Clue_Add_To_Database( a, arr[i].clue, arr[i].weight, 0, 0, -1);\ + } + + IMPORT_CLUE_TABLE( 1, clues_actor_1); + IMPORT_CLUE_TABLE( 2, clues_actor_2); + IMPORT_CLUE_TABLE( 3, clues_actor_3); + IMPORT_CLUE_TABLE( 4, clues_actor_4); + IMPORT_CLUE_TABLE( 5, clues_actor_5); + IMPORT_CLUE_TABLE( 6, clues_actor_6); + IMPORT_CLUE_TABLE( 7, clues_actor_7_and_8); + IMPORT_CLUE_TABLE( 9, clues_actor_9); + IMPORT_CLUE_TABLE(10, clues_actor_10); + +#undef IMPORT_CLUE_TABLE + + Actor_Clue_Add_To_Database(11, 201, 85, false, false, -1); + Actor_Clue_Add_To_Database(11, 213, 65, false, false, -1); + Actor_Clue_Add_To_Database(11, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 212, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 218, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 219, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(11, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 225, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 229, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 230, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 232, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 116, 65, false, false, -1); + Actor_Clue_Add_To_Database(11, 117, 65, false, false, -1); + Actor_Clue_Add_To_Database(11, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(11, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(11, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(12, 213, 65, false, false, -1); + Actor_Clue_Add_To_Database(12, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(12, 219, 75, false, false, -1); + Actor_Clue_Add_To_Database(12, 222, 75, false, false, -1); + Actor_Clue_Add_To_Database(12, 223, 75, false, false, -1); + Actor_Clue_Add_To_Database(12, 228, 75, false, false, -1); + Actor_Clue_Add_To_Database(12, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(12, 124, 70, false, false, -1); + Actor_Clue_Add_To_Database(12, 131, 100, false, false, -1); + Actor_Clue_Add_To_Database(13, 227, 35, false, false, -1); + Actor_Clue_Add_To_Database(13, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(13, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(13, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 214, 60, false, false, -1); + Actor_Clue_Add_To_Database(13, 215, 60, false, false, -1); + Actor_Clue_Add_To_Database(13, 216, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 217, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 220, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 222, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 224, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 226, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(13, 232, 35, false, false, -1); + Actor_Clue_Add_To_Database(13, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 25, 30, false, false, -1); + Actor_Clue_Add_To_Database(13, 60, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 69, 60, false, false, -1); + Actor_Clue_Add_To_Database(13, 70, 60, false, false, -1); + Actor_Clue_Add_To_Database(13, 92, 45, false, false, -1); + Actor_Clue_Add_To_Database(13, 95, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 19, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 103, 50, false, false, -1); + Actor_Clue_Add_To_Database(13, 107, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 121, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 130, 70, false, false, -1); + Actor_Clue_Add_To_Database(13, 133, 55, false, false, -1); + Actor_Clue_Add_To_Database(13, 147, 70, false, false, -1); + Actor_Clue_Add_To_Database(13, 148, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 149, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 150, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 152, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 116, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 117, 65, false, false, -1); + Actor_Clue_Add_To_Database(13, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(13, 207, 45, false, false, -1); + Actor_Clue_Add_To_Database(13, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(14, 5, 55, false, false, -1); + Actor_Clue_Add_To_Database(14, 239, 45, false, false, -1); + Actor_Clue_Add_To_Database(14, 240, 45, false, false, -1); + Actor_Clue_Add_To_Database(14, 241, 35, false, false, -1); + Actor_Clue_Add_To_Database(14, 242, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 212, 40, false, false, -1); + Actor_Clue_Add_To_Database(14, 215, 55, false, false, -1); + Actor_Clue_Add_To_Database(14, 216, 55, false, false, -1); + Actor_Clue_Add_To_Database(14, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(14, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(14, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(14, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(14, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 230, 45, false, false, -1); + Actor_Clue_Add_To_Database(14, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 0, 55, false, false, -1); + Actor_Clue_Add_To_Database(14, 73, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 211, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(14, 108, 45, false, false, -1); + Actor_Clue_Add_To_Database(14, 134, 35, false, false, -1); + Actor_Clue_Add_To_Database(14, 135, 35, false, false, -1); + Actor_Clue_Add_To_Database(14, 66, 35, false, false, -1); + Actor_Clue_Add_To_Database(14, 109, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 110, 70, false, false, -1); + Actor_Clue_Add_To_Database(14, 111, 65, false, false, -1); + Actor_Clue_Add_To_Database(14, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(15, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(15, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(15, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(15, 232, 70, false, false, -1); + Actor_Clue_Add_To_Database(16, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(16, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(16, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(16, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(16, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(16, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(16, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(16, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(16, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(16, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(16, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(16, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(16, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(16, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(16, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(17, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 222, 60, false, false, -1); + Actor_Clue_Add_To_Database(17, 218, 55, false, false, -1); + Actor_Clue_Add_To_Database(17, 219, 55, false, false, -1); + Actor_Clue_Add_To_Database(17, 220, 55, false, false, -1); + Actor_Clue_Add_To_Database(17, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 223, 55, false, false, -1); + Actor_Clue_Add_To_Database(17, 224, 55, false, false, -1); + Actor_Clue_Add_To_Database(17, 226, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 228, 65, false, false, -1); + Actor_Clue_Add_To_Database(17, 230, 45, false, false, -1); + Actor_Clue_Add_To_Database(17, 231, 60, false, false, -1); + Actor_Clue_Add_To_Database(17, 73, 60, false, false, -1); + Actor_Clue_Add_To_Database(17, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(18, 239, 90, false, false, -1); + Actor_Clue_Add_To_Database(18, 240, 85, false, false, -1); + Actor_Clue_Add_To_Database(18, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(18, 242, 90, false, false, -1); + Actor_Clue_Add_To_Database(18, 222, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 227, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(18, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 216, 85, false, false, -1); + Actor_Clue_Add_To_Database(18, 217, 85, false, false, -1); + Actor_Clue_Add_To_Database(18, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(18, 223, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 224, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 228, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(18, 231, 100, false, false, -1); + Actor_Clue_Add_To_Database(18, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(18, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(18, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(18, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(18, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(18, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(19, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(19, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(19, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(19, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(19, 219, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(19, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(19, 213, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 229, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 232, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 116, 65, false, false, -1); + Actor_Clue_Add_To_Database(19, 117, 65, false, false, -1); + Actor_Clue_Add_To_Database(19, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(19, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(19, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(20, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(20, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(20, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(20, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(20, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(20, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(20, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(20, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(20, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(20, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(20, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(20, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(20, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(20, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(20, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(21, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(21, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(21, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(21, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(21, 214, 45, false, false, -1); + Actor_Clue_Add_To_Database(21, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(21, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 223, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(21, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(21, 25, 30, false, false, -1); + Actor_Clue_Add_To_Database(21, 147, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 148, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 150, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 152, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 117, 60, false, false, -1); + Actor_Clue_Add_To_Database(21, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(21, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(22, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(22, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(22, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(22, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(22, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(22, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(22, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(22, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(22, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(22, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(22, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(22, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(22, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(22, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(22, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(23, 27, 20, false, false, -1); + Actor_Clue_Add_To_Database(23, 16, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 17, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 26, 25, false, false, -1); + Actor_Clue_Add_To_Database(23, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(23, 227, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(23, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(23, 219, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(23, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(23, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(23, 239, 95, false, false, -1); + Actor_Clue_Add_To_Database(1, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(23, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(24, 227, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(24, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(24, 219, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(24, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(24, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(24, 239, 95, false, false, -1); + Actor_Clue_Add_To_Database(24, 17, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 16, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 27, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 26, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(24, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(25, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(25, 213, 70, false, false, -1); + Actor_Clue_Add_To_Database(25, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 0, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 5, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 8, 85, false, false, -1); + Actor_Clue_Add_To_Database(26, 9, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 239, 90, false, false, -1); + Actor_Clue_Add_To_Database(26, 240, 85, false, false, -1); + Actor_Clue_Add_To_Database(26, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(26, 242, 90, false, false, -1); + Actor_Clue_Add_To_Database(26, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(26, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 216, 85, false, false, -1); + Actor_Clue_Add_To_Database(26, 217, 85, false, false, -1); + Actor_Clue_Add_To_Database(26, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(26, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(26, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(26, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(26, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 227, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 241, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(27, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 215, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 216, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 217, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 220, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 219, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 218, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 222, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 223, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 224, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 226, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 228, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 230, 70, false, false, -1); + Actor_Clue_Add_To_Database(27, 232, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 25, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 60, 40, false, false, -1); + Actor_Clue_Add_To_Database(27, 69, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 70, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 92, 60, false, false, -1); + Actor_Clue_Add_To_Database(27, 95, 35, false, false, -1); + Actor_Clue_Add_To_Database(27, 19, 35, false, false, -1); + Actor_Clue_Add_To_Database(27, 103, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 107, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 121, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 130, 70, false, false, -1); + Actor_Clue_Add_To_Database(27, 133, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 147, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 148, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 149, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 150, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 151, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 152, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 116, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 117, 65, false, false, -1); + Actor_Clue_Add_To_Database(27, 145, 55, false, false, -1); + Actor_Clue_Add_To_Database(27, 207, 45, false, false, -1); + Actor_Clue_Add_To_Database(27, 211, 55, false, false, -1); + Actor_Clue_Add_To_Database(28, 25, 85, false, false, -1); + Actor_Clue_Add_To_Database(28, 64, 65, false, false, -1); + Actor_Clue_Add_To_Database(28, 69, 85, false, false, -1); + Actor_Clue_Add_To_Database(28, 111, 70, false, false, -1); + Actor_Clue_Add_To_Database(28, 124, 85, false, false, -1); + Actor_Clue_Add_To_Database(28, 219, 75, false, false, -1); + Actor_Clue_Add_To_Database(28, 241, 85, false, false, -1); + Actor_Clue_Add_To_Database(28, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(28, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(28, 217, 25, false, false, -1); + Actor_Clue_Add_To_Database(28, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(28, 221, 65, false, false, -1); + Actor_Clue_Add_To_Database(28, 223, 75, false, false, -1); + Actor_Clue_Add_To_Database(28, 225, 90, false, false, -1); + Actor_Clue_Add_To_Database(28, 222, 90, false, false, -1); + Actor_Clue_Add_To_Database(28, 232, 70, false, false, -1); + Actor_Clue_Add_To_Database(29, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(29, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(29, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(29, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(29, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(29, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(29, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(29, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(29, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(29, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(29, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(29, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(29, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(29, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(29, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(30, 126, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 195, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 197, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 198, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 202, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(30, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(30, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(30, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 225, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(30, 222, 90, false, false, -1); + Actor_Clue_Add_To_Database(30, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(30, 239, 95, false, false, -1); + Actor_Clue_Add_To_Database(30, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(30, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(31, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(31, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(31, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(31, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(31, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(31, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(31, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(31, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(31, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(31, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(31, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(31, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(31, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(31, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(31, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(32, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(32, 240, 60, false, false, -1); + Actor_Clue_Add_To_Database(32, 241, 55, false, false, -1); + Actor_Clue_Add_To_Database(32, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(32, 212, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 213, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 214, 60, false, false, -1); + Actor_Clue_Add_To_Database(32, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 221, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 223, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 229, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 230, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 231, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 232, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 239, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 25, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 60, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 69, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 70, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 92, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 19, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 103, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 121, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 207, 50, false, false, -1); + Actor_Clue_Add_To_Database(32, 211, 50, false, false, -1); + Actor_Clue_Add_To_Database(33, 5, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 8, 85, false, false, -1); + Actor_Clue_Add_To_Database(33, 9, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 239, 90, false, false, -1); + Actor_Clue_Add_To_Database(33, 240, 85, false, false, -1); + Actor_Clue_Add_To_Database(33, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(33, 242, 90, false, false, -1); + Actor_Clue_Add_To_Database(33, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(33, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 216, 85, false, false, -1); + Actor_Clue_Add_To_Database(33, 217, 85, false, false, -1); + Actor_Clue_Add_To_Database(33, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(33, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(33, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(33, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(33, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 126, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 195, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 197, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 198, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 202, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 219, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(34, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(34, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(34, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 225, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(34, 222, 90, false, false, -1); + Actor_Clue_Add_To_Database(34, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(34, 239, 95, false, false, -1); + Actor_Clue_Add_To_Database(34, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 80, 55, false, false, -1); + Actor_Clue_Add_To_Database(34, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(34, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(35, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(35, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(35, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(35, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(35, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(35, 214, 45, false, false, -1); + Actor_Clue_Add_To_Database(35, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(35, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 223, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(35, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(35, 25, 30, false, false, -1); + Actor_Clue_Add_To_Database(35, 147, 60, false, false, -1); + Actor_Clue_Add_To_Database(35, 148, 60, false, false, -1); + Actor_Clue_Add_To_Database(35, 150, 60, false, false, -1); + Actor_Clue_Add_To_Database(35, 152, 60, false, false, -1); + Actor_Clue_Add_To_Database(35, 117, 60, false, false, -1); + Actor_Clue_Add_To_Database(35, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(35, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(37, 0, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 5, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 8, 85, false, false, -1); + Actor_Clue_Add_To_Database(37, 9, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 239, 90, false, false, -1); + Actor_Clue_Add_To_Database(37, 240, 85, false, false, -1); + Actor_Clue_Add_To_Database(37, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(37, 242, 90, false, false, -1); + Actor_Clue_Add_To_Database(37, 222, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(37, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 216, 85, false, false, -1); + Actor_Clue_Add_To_Database(37, 217, 85, false, false, -1); + Actor_Clue_Add_To_Database(37, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(37, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(37, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(37, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(37, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 227, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 212, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 221, 50, false, false, -1); + Actor_Clue_Add_To_Database(42, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 224, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 228, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(42, 231, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(42, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(42, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(42, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(42, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(42, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 212, 50, false, false, -1); + Actor_Clue_Add_To_Database(44, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(44, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(44, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(51, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 227, 40, false, false, -1); + Actor_Clue_Add_To_Database(51, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(51, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 216, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 217, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 221, 70, false, false, -1); + Actor_Clue_Add_To_Database(51, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 224, 60, false, false, -1); + Actor_Clue_Add_To_Database(51, 226, 60, false, false, -1); + Actor_Clue_Add_To_Database(51, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(51, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(51, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(51, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(51, 214, 60, false, false, -1); + Actor_Clue_Add_To_Database(51, 229, 60, false, false, -1); + Actor_Clue_Add_To_Database(51, 232, 40, false, false, -1); + Actor_Clue_Add_To_Database(51, 145, 60, false, false, -1); + Actor_Clue_Add_To_Database(51, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(52, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(52, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(52, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(52, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(52, 214, 45, false, false, -1); + Actor_Clue_Add_To_Database(52, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(52, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 223, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(52, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(52, 25, 30, false, false, -1); + Actor_Clue_Add_To_Database(52, 147, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 148, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 150, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 152, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 117, 60, false, false, -1); + Actor_Clue_Add_To_Database(52, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(52, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(53, 126, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 162, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 164, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 166, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 168, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 170, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 172, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 176, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 195, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 197, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 198, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 202, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 111, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 219, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 241, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 212, 55, false, false, -1); + Actor_Clue_Add_To_Database(53, 230, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 215, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 216, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 218, 95, false, false, -1); + Actor_Clue_Add_To_Database(53, 220, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 221, 55, false, false, -1); + Actor_Clue_Add_To_Database(53, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 225, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 222, 90, false, false, -1); + Actor_Clue_Add_To_Database(53, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(53, 242, 95, false, false, -1); + Actor_Clue_Add_To_Database(53, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(53, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 227, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 212, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 219, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 221, 50, false, false, -1); + Actor_Clue_Add_To_Database(55, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 224, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 228, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 229, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 230, 55, false, false, -1); + Actor_Clue_Add_To_Database(55, 231, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 80, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 108, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 134, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 135, 65, false, false, -1); + Actor_Clue_Add_To_Database(55, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(55, 214, 70, false, false, -1); + Actor_Clue_Add_To_Database(55, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(55, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(55, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 222, 60, false, false, -1); + Actor_Clue_Add_To_Database(56, 227, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 240, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 212, 40, false, false, -1); + Actor_Clue_Add_To_Database(56, 213, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 216, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 223, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 224, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 229, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 230, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 231, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 232, 50, false, false, -1); + Actor_Clue_Add_To_Database(56, 239, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 25, 30, false, false, -1); + Actor_Clue_Add_To_Database(56, 60, 35, false, false, -1); + Actor_Clue_Add_To_Database(56, 69, 35, false, false, -1); + Actor_Clue_Add_To_Database(56, 70, 35, false, false, -1); + Actor_Clue_Add_To_Database(56, 92, 25, false, false, -1); + Actor_Clue_Add_To_Database(56, 95, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 19, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 103, 45, false, false, -1); + Actor_Clue_Add_To_Database(56, 107, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 121, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 130, 60, false, false, -1); + Actor_Clue_Add_To_Database(56, 133, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 147, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 149, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 150, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 151, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 152, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 116, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 117, 65, false, false, -1); + Actor_Clue_Add_To_Database(56, 145, 70, false, false, -1); + Actor_Clue_Add_To_Database(56, 207, 55, false, false, -1); + Actor_Clue_Add_To_Database(56, 211, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 241, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 227, 40, false, false, -1); + Actor_Clue_Add_To_Database(57, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 216, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 217, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 221, 70, false, false, -1); + Actor_Clue_Add_To_Database(57, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 224, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 226, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 228, 70, false, false, -1); + Actor_Clue_Add_To_Database(57, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(57, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(57, 214, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 229, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 232, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 145, 60, false, false, -1); + Actor_Clue_Add_To_Database(57, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(58, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(58, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(58, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(58, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(58, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(59, 227, 55, false, false, -1); + Actor_Clue_Add_To_Database(59, 240, 55, false, false, -1); + Actor_Clue_Add_To_Database(59, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(59, 242, 55, false, false, -1); + Actor_Clue_Add_To_Database(59, 212, 35, false, false, -1); + Actor_Clue_Add_To_Database(59, 213, 60, false, false, -1); + Actor_Clue_Add_To_Database(59, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(59, 215, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 216, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 217, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 220, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 219, 60, false, false, -1); + Actor_Clue_Add_To_Database(59, 218, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 221, 45, false, false, -1); + Actor_Clue_Add_To_Database(59, 222, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(59, 224, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 226, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 228, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 230, 35, false, false, -1); + Actor_Clue_Add_To_Database(59, 95, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 232, 65, false, false, -1); + Actor_Clue_Add_To_Database(59, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(59, 130, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 147, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 148, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 149, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 150, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 151, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 152, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 116, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 117, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 145, 50, false, false, -1); + Actor_Clue_Add_To_Database(59, 211, 60, false, false, -1); + Actor_Clue_Add_To_Database(62, 239, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 241, 55, false, false, -1); + Actor_Clue_Add_To_Database(62, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 222, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 227, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 212, 40, false, false, -1); + Actor_Clue_Add_To_Database(62, 215, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 216, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 217, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 218, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 219, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 220, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 221, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 223, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 224, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 226, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 228, 55, false, false, -1); + Actor_Clue_Add_To_Database(62, 229, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 230, 45, false, false, -1); + Actor_Clue_Add_To_Database(62, 231, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 162, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 164, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 166, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 168, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 170, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 172, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 174, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 176, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 0, 40, false, false, -1); + Actor_Clue_Add_To_Database(62, 73, 65, false, false, -1); + Actor_Clue_Add_To_Database(62, 211, 70, false, false, -1); + Actor_Clue_Add_To_Database(62, 80, 40, false, false, -1); + Actor_Clue_Add_To_Database(62, 108, 55, false, false, -1); + Actor_Clue_Add_To_Database(62, 134, 40, false, false, -1); + Actor_Clue_Add_To_Database(62, 135, 40, false, false, -1); + Actor_Clue_Add_To_Database(66, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(66, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(66, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(66, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(66, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(67, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(67, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(67, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(67, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(67, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(68, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(68, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(68, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(68, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(68, 214, 65, false, false, -1); + Actor_Clue_Add_To_Database(69, 240, 65, false, false, -1); + Actor_Clue_Add_To_Database(69, 241, 70, false, false, -1); + Actor_Clue_Add_To_Database(69, 242, 65, false, false, -1); + Actor_Clue_Add_To_Database(69, 239, 65, false, false, -1); + Actor_Clue_Add_To_Database(69, 214, 65, false, false, -1); +} + +void ScriptInit::Init_World_Waypoints() { + World_Waypoint_Set(0, 7, -676.0f, -0.04f, -94.0f); + World_Waypoint_Set(1, 7, -807.0f, -0.04f, 109.0f); + World_Waypoint_Set(2, 15, 541.8f, 0.38f, -435.68f); + World_Waypoint_Set(3, 66, 561.01f, 0.34f, -606.67f); + World_Waypoint_Set(4, 14, -404.09f, -9.23f, 251.95f); + World_Waypoint_Set(5, 14, -99.0f, -9.23f, 690.0f); + World_Waypoint_Set(6, 14, -374.14f, -8.97f, 240.18f); + World_Waypoint_Set(7, 14, -766.02f, -8.82f, 271.44f); + World_Waypoint_Set(8, 14, -546.19f, -9.06f, 351.38f); + World_Waypoint_Set(9, 14, -522.66f, -8.6f, 1409.29f); + World_Waypoint_Set(10, 14, -324.21f, -9.01f, 1428.74f); + World_Waypoint_Set(11, 14, 23.72f, -8.87f, 1335.19f); + World_Waypoint_Set(12, 69, -132.0f, 6.09f, 91.0f); + World_Waypoint_Set(13, 7, 21.4f, 0.22f, -201.68f); + World_Waypoint_Set(14, 7, 164.44f, 0.29f, -265.69f); + World_Waypoint_Set(15, 7, 279.7f, 7.23f, -888.43f); + World_Waypoint_Set(16, 14, 41.35f, -8.98f, 556.2f); + World_Waypoint_Set(17, 14, -697.86f, -0.73f, 21.89f); + World_Waypoint_Set(18, 14, -678.17f, -0.77f, 1043.62f); + World_Waypoint_Set(19, 14, 116.89f, -0.74f, 1581.12f); + World_Waypoint_Set(20, 7, -312.92f, 0.17f, -345.2f); + World_Waypoint_Set(21, 7, -290.04f, 0.23f, -513.79f); + World_Waypoint_Set(22, 7, 6.97f, 0.54f, -759.56f); + World_Waypoint_Set(23, 7, 280.48f, 11.58f, -941.15f); + World_Waypoint_Set(24, 7, 231.14f, 7.14f, -688.96f); + World_Waypoint_Set(25, 7, 54.92f, 0.2f, -171.75f); + World_Waypoint_Set(26, 7, -56.77f, 0.18f, -166.99f); + World_Waypoint_Set(27, 7, -78.12f, 0.34f, -449.92f); + World_Waypoint_Set(28, 69, -30.0f, -625.51f, 366.15f); + World_Waypoint_Set(29, 69, -51.81f, -622.47f, 286.93f); + World_Waypoint_Set(30, 69, -320.58f, -625.53f, 301.58f); + World_Waypoint_Set(31, 66, 421.01f, 0.22f, -566.67f); + World_Waypoint_Set(32, 66, 336.0f, 0.22f, -520.0f); + World_Waypoint_Set(33, 91, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(34, 92, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(35, 93, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(36, 94, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(37, 95, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(38, 96, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(39, 97, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(40, 98, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(41, 99, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(42, 100, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(43, 4, -427.0f, -6.5f, 1188.0f); + World_Waypoint_Set(44, 4, -255.2f, -6.5f, 455.2f); + World_Waypoint_Set(45, 27, -247.02f, -145.11f, 32.99f); + World_Waypoint_Set(46, 27, -154.83f, -145.11f, 9.39f); + World_Waypoint_Set(47, 5, -619.36f, -616.15f, 220.91f); + World_Waypoint_Set(48, 5, -82.86f, -621.3f, 769.03f); + World_Waypoint_Set(49, 29, -7.31f, -58.23f, 22.44f); + World_Waypoint_Set(50, 29, 132.16f, -58.23f, 767.0f); + World_Waypoint_Set(51, 5, -335.05f, -618.82f, 312.9f); + World_Waypoint_Set(52, 30, 189.7f, -58.23f, -4.72f); + World_Waypoint_Set(53, 4, -450.32f, -6.5f, 230.39f); + World_Waypoint_Set(54, 4, -70.04f, -6.5f, 150.17f); + World_Waypoint_Set(55, 66, 491.0f, 0.0f, -571.0f); + World_Waypoint_Set(56, 4, -221.68f, -6.5f, 150.15f); + World_Waypoint_Set(57, 69, -291.43f, -0.3f, 277.92f); + World_Waypoint_Set(58, 69, -272.91f, -0.3f, 369.1f); + World_Waypoint_Set(59, 7, -118.65f, 0.15f, -130.15f); + World_Waypoint_Set(60, 7, 22.27f, 0.15f, -69.81f); + World_Waypoint_Set(61, 16, -39.0f, -1238.0f, 108284.0f); + World_Waypoint_Set(62, 62, -11.0f, -40.0f, -45.0f); + World_Waypoint_Set(63, 5, -133.0f, -621.0f, 686.0f); + World_Waypoint_Set(64, 4, -360.0f, -6.13f, 380.0f); + World_Waypoint_Set(65, 15, 688.0f, 0.37f, -518.0f); + World_Waypoint_Set(66, 5, -83.0f, -621.0f, 627.0f); + World_Waypoint_Set(67, 4, -212.65f, -2.08f, 513.47f); + World_Waypoint_Set(68, 4, -219.43f, -2.08f, 584.8f); + World_Waypoint_Set(69, 4, -215.0f, -2.08f, 548.0f); + World_Waypoint_Set(71, 69, 210.0f, 5.55f, 146.19f); + World_Waypoint_Set(72, 69, -55.27f, 5.55f, 108.34f); + World_Waypoint_Set(73, 66, 338.75f, 0.22f, -612.0f); + World_Waypoint_Set(74, 66, 338.75f, 0.22f, -560.0f); + World_Waypoint_Set(75, 5, -138.45f, -621.3f, 778.52f); + World_Waypoint_Set(76, 63, -499.23f, -354.62f, -51.3f); + World_Waypoint_Set(77, 63, -903.0f, -354.62f, 676.0f); + World_Waypoint_Set(78, 63, -723.0f, -354.62f, -1272.0f); + World_Waypoint_Set(79, 67, 207.36f, 0.67f, -96.42f); + World_Waypoint_Set(80, 67, -134.43f, 0.43f, -180.46f); + World_Waypoint_Set(81, 67, -559.0f, 0.15f, -100.0f); + World_Waypoint_Set(82, 63, -1250.07f, -354.0f, -1186.9f); + World_Waypoint_Set(83, 16, -55.11f, -1238.89f, 107995.87f); + World_Waypoint_Set(84, 27, -161.62f, -145.11f, -53.73f); + World_Waypoint_Set(85, 27, -201.62f, -145.11f, -85.73f); + World_Waypoint_Set(86, 4, -171.55f, -2.08f, 361.01f); + World_Waypoint_Set(87, 4, -523.51f, -9.23f, 1384.76f); + World_Waypoint_Set(88, 4, -102.01f, -9.23f, 1375.38f); + World_Waypoint_Set(89, 16, 14.54f, -1238.89f, 108280.85f); + World_Waypoint_Set(91, 16, 9.68f, -1238.89f, 108427.73f); + World_Waypoint_Set(92, 16, -153.29f, -1238.89f, 108473.52f); + World_Waypoint_Set(93, 16, -104.0f, -1238.89f, 108413.0f); + World_Waypoint_Set(90, 16, 37.59f, -1238.89f, 108449.29f); + World_Waypoint_Set(94, 30, 302.32f, -58.23f, 35.14f); + World_Waypoint_Set(95, 35, 62.0f, 0.3f, 129.0f); + World_Waypoint_Set(96, 35, -134.63f, -0.3f, 171.41f); + World_Waypoint_Set(97, 7, -1135.0f, 6.98f, 441.0f); + World_Waypoint_Set(98, 7, -1015.0f, 7.18f, 354.75f); + World_Waypoint_Set(99, 7, -975.0f, -0.04f, 316.0f); + World_Waypoint_Set(100, 4, -334.46f, -6.5f, 500.64f); + World_Waypoint_Set(101, 7, -334.46f, -6.5f, 500.64f); + World_Waypoint_Set(102, 16, 27.89f, -1238.89f, 108288.73f); + World_Waypoint_Set(103, 71, 48.31f, 0.15f, 17.11f); + World_Waypoint_Set(104, 71, 4.31f, 0.15f, -39.0f); + World_Waypoint_Set(105, 5, -764.58f, -616.31f, 229.6f); + World_Waypoint_Set(106, 4, -25.0f, -6.5f, 352.28f); + World_Waypoint_Set(107, 71, -3.6f, -621.79f, 164.09f); + World_Waypoint_Set(108, 71, 86.03f, -622.47f, 73.21f); + World_Waypoint_Set(109, 7, -793.0f, -0.04f, 164.0f); + World_Waypoint_Set(110, 7, -665.0f, -0.04f, 304.0f); + World_Waypoint_Set(111, 7, -765.0f, -0.04f, 232.0f); + World_Waypoint_Set(112, 7, -817.0f, -0.04f, 300.0f); + World_Waypoint_Set(113, 7, -907.0f, -0.04f, 304.0f); + World_Waypoint_Set(114, 20, -4.0f, 0.0f, 880.0f); + World_Waypoint_Set(115, 20, 174.0f, 0.0f, 890.15f); + World_Waypoint_Set(116, 20, 69.0f, 0.0f, 695.0f); + World_Waypoint_Set(117, 20, 0.0f, 0.0f, 0.0f); + World_Waypoint_Set(118, 28, -376.35f, -109.91f, 604.4f); + World_Waypoint_Set(119, 28, -375.0f, -109.91f, 750.0f); + World_Waypoint_Set(120, 0, -50.81f, 2.5f, 233.0f); + World_Waypoint_Set(121, 0, -50.81f, 2.5f, 31.03f); + World_Waypoint_Set(122, 0, 28.12f, 2.5f, 100.64f); + World_Waypoint_Set(123, 4, -474.28f, -6.5f, 979.59f); + World_Waypoint_Set(124, 49, 8.74f, 0.0f, -282.81f); + World_Waypoint_Set(125, 49, 978.98f, 0.0f, 145.64f); + World_Waypoint_Set(126, 49, 477.18f, 0.0f, -287.21f); + World_Waypoint_Set(127, 26, 31.39f, -10.27f, -64.52f); + World_Waypoint_Set(128, 26, 7.39f, -10.27f, -136.52f); + World_Waypoint_Set(129, 26, -136.61f, -10.27f, -136.52f); + World_Waypoint_Set(130, 26, -36.61f, -10.27f, -136.52f); + World_Waypoint_Set(131, 24, 435.45f, -9.0f, 166.0f); + World_Waypoint_Set(132, 24, 619.45f, -9.0f, 234.0f); + World_Waypoint_Set(133, 24, 619.45f, -9.0f, 270.0f); + World_Waypoint_Set(134, 22, -80.59f, -60.31f, 256.35f); + World_Waypoint_Set(135, 22, -48.0f, -60.31f, 183.0f);; + World_Waypoint_Set(136, 22, -24.59f, -60.31f, 64.35f); + World_Waypoint_Set(137, 22, 99.41f, -60.31f, 4.35f); + World_Waypoint_Set(138, 22, 99.41f, -60.34f, -115.65f); + World_Waypoint_Set(139, 22, 147.41f, -60.34f, -115.65f); + World_Waypoint_Set(144, 3, -654.56f, 252.59f, -1110.88f); + World_Waypoint_Set(145, 3, -578.56f, 252.59f, -1010.88f); + World_Waypoint_Set(146, 3, -470.56f, 252.59f, -1070.88f); + World_Waypoint_Set(147, 3, -510.56f, 252.59f, -1006.88f); + World_Waypoint_Set(148, 3, -646.56f, 252.59f, -1006.88f); + World_Waypoint_Set(140, 2, -43.88f, -0.04f, 172.95f); + World_Waypoint_Set(141, 2, 78.36f, -0.04f, 80.79f); + World_Waypoint_Set(142, 2, 81.74f, -0.04f, -94.0f); + World_Waypoint_Set(143, 2, -118.26f, -0.04f, -94.04f); + World_Waypoint_Set(149, 8, 647.0f, 1.6f, -81.87f); + World_Waypoint_Set(150, 75, -269.0f, 120.16f, -88.0f); + World_Waypoint_Set(151, 75, -181.0f, 120.16f, -96.0f); + World_Waypoint_Set(152, 75, -133.0f, 84.13f, -108.0f); + World_Waypoint_Set(153, 75, -95.0f, 74.87f, -503.0f); + World_Waypoint_Set(154, 70, -172.6f, 1.72f, 87.62f); + World_Waypoint_Set(155, 0, -284.0f, 0.0f, 296.0f); + World_Waypoint_Set(156, 0, -680.0f, 0.0f, -156.0f); + World_Waypoint_Set(157, 0, -702.0f, 0.0f, -919.0f); + World_Waypoint_Set(158, 0, 140.0f, 0.0f, -1233.0f); + World_Waypoint_Set(159, 0, -228.0f, 0.0f, -92.0f); + World_Waypoint_Set(160, 0, -274.0f, 0.0f, -627.0f); + World_Waypoint_Set(161, 0, -329.27f, 0.0f, -1115.14f); + World_Waypoint_Set(162, 8, 815.34f, 0.14f, 165.21f); + World_Waypoint_Set(163, 8, -35.0f, 0.14f, 39.0f); + World_Waypoint_Set(164, 8, -24.0f, 0.14f, -631.0f); + World_Waypoint_Set(165, 8, -125.0f, 0.14f, -221.0f); + World_Waypoint_Set(166, 8, 456.82f, 0.14f, 69.0f); + World_Waypoint_Set(167, 70, -815.0f, -4.01f, 96.0f); + World_Waypoint_Set(168, 70, -235.0f, 1.72f, 92.0f); + World_Waypoint_Set(169, 70, 5.0f, 1.72f, 92.0f); + World_Waypoint_Set(170, 70, 265.0f, 1.72f, 36.0f); + World_Waypoint_Set(171, 70, -639.0f, 1.72f, -124.0f); + World_Waypoint_Set(172, 8, -225.0f, 1.0f, 39.0f); + World_Waypoint_Set(172, 8, -217.0f, 1.0f, 127.0f); + World_Waypoint_Set(174, 70, 326.96f, -4.01f, 383.16f); + World_Waypoint_Set(175, 70, 264.43f, -4.01f, 313.73f); + World_Waypoint_Set(176, 79, -78.43f, 0.0f, 269.98f); + World_Waypoint_Set(177, 79, 19.0f, 0.0f, 269.98f); + World_Waypoint_Set(178, 79, 91.0f, 0.0f, 137.6f); + World_Waypoint_Set(185, 82, 115.0f, 156.94f, -310.0f); + World_Waypoint_Set(186, 82, 153.0f, 156.94f, -294.0f); + World_Waypoint_Set(179, 79, 40.14f, 0.0f, 276.62f); + World_Waypoint_Set(180, 79, -71.86f, 0.0f, 276.62f); + World_Waypoint_Set(181, 79, -112.56f, 0.0f, 228.03f); + World_Waypoint_Set(189, 86, 229.0f, 186.04f, -24.0f); + World_Waypoint_Set(190, 86, 157.0f, 186.04f, -24.0f); + World_Waypoint_Set(191, 86, 157.0f, 128.92f, -148.0f); + World_Waypoint_Set(182, 74, 143.45f, -50.13f, -12.22f); + World_Waypoint_Set(183, 74, 199.45f, -50.13f, -1400.22f); + World_Waypoint_Set(184, 74, -112.55f, -50.13f, -2360.22f); + World_Waypoint_Set(187, 86, -295.0f, 12.97f, -148.0f); + World_Waypoint_Set(188, 86, 157.0f, 129.0f, -504.0f); + World_Waypoint_Set(192, 17, -136.19f, 0.0f, 1580.03f); + World_Waypoint_Set(193, 17, -308.0f, -81.46f, 1466.0f); + World_Waypoint_Set(194, 21, 82.26f, 60.16f, -124.35f); + World_Waypoint_Set(195, 21, 226.1f, 60.16f, -139.84f); + World_Waypoint_Set(196, 22, 39.41f, -60.31f, 308.35f); + World_Waypoint_Set(197, 22, 99.41f, -60.31f, 220.35f); + World_Waypoint_Set(198, 22, 267.41f, -60.31f, 180.35f); + World_Waypoint_Set(200, 2, -44.46f, -0.04f, 177.4f); + World_Waypoint_Set(201, 2, 137.0f, -0.04f, 17.0f); + World_Waypoint_Set(202, 70, -610.0f, -4.01f, 237.11f); + World_Waypoint_Set(203, 70, -368.96f, -4.01f, 237.11f); + World_Waypoint_Set(204, 8, 19.0f, 0.14f, 83.0f); + World_Waypoint_Set(205, 8, -58.36f, 0.14f, 4.4f); + World_Waypoint_Set(206, 8, -18.11f, 0.14f, -669.45f); + World_Waypoint_Set(207, 8, -18.11f, 0.14f, -669.45f); + World_Waypoint_Set(208, 8, -162.25f, 0.14f, -511.93f); + World_Waypoint_Set(209, 8, -128.25f, 0.14f, -322.0f); + World_Waypoint_Set(210, 8, 714.48f, 0.14f, 14.92f); + World_Waypoint_Set(211, 8, 23.0f, 0.14f, -1.0f); + World_Waypoint_Set(212, 8, 28.47f, 0.14f, 3.8f); + World_Waypoint_Set(213, 8, 36.47f, 0.14f, 55.89f); + World_Waypoint_Set(214, 8, 155.75f, 0.14f, 54.0f); + World_Waypoint_Set(215, 0, -70.0f, 0.0f, -647.0f); + World_Waypoint_Set(216, 0, -270.01f, 0.0f, -441.68f); + World_Waypoint_Set(217, 0, -209.98f, 0.0f, -483.05f); + World_Waypoint_Set(218, 0, -428.08f, 0.0f, -110.16f); + World_Waypoint_Set(219, 0, 256.0f, 0.0f, -298.08f); + World_Waypoint_Set(220, 0, -187.18f, 0.0f, -298.08f); + World_Waypoint_Set(221, 0, -428.08f, 0.0f, -110.16f); + World_Waypoint_Set(222, 0, -466.0f, 0.0f, -635.0f); + World_Waypoint_Set(223, 0, -382.0f, 0.0f, -1099.0f); + World_Waypoint_Set(224, 0, -227.0f, 0.0f, -1333.0f); + World_Waypoint_Set(225, 0, 140.88f, 0.0f, -1362.34f); + World_Waypoint_Set(226, 0, -448.18f, 0.0f, -626.38f); + World_Waypoint_Set(227, 0, -444.18f, 0.0f, -730.38f); + World_Waypoint_Set(228, 20, -198.02f, 9.04f, 487.7f); + World_Waypoint_Set(229, 20, -147.4f, 9.04f, 918.08f); + World_Waypoint_Set(230, 20, -201.67f, 9.04f, 829.09f); + World_Waypoint_Set(231, 20, -177.67f, 9.04f, 829.09f); + World_Waypoint_Set(232, 4, -92.52f, -6.5f, 714.44f); + World_Waypoint_Set(233, 4, -352.52f, -6.5f, 714.44f); + World_Waypoint_Set(234, 4, -352.52f, -6.5f, 666.44f); + World_Waypoint_Set(235, 4, -136.41f, -6.5f, 735.26f); + World_Waypoint_Set(236, 4, -248.41f, -6.5f, 747.26f); + World_Waypoint_Set(237, 4, -352.52f, -6.5f, 252.0f); + World_Waypoint_Set(238, 4, -190.25f, -6.5f, 274.58f); + World_Waypoint_Set(239, 33, -371.87f, 0.0f, 275.89f); + World_Waypoint_Set(240, 33, -371.87f, 0.0f, -60.11f); + World_Waypoint_Set(241, 33, 588.5f, 0.0f, 254.19f); + World_Waypoint_Set(242, 33, 560.5f, 0.0f, 254.19f); + World_Waypoint_Set(243, 7, -153.77f, -0.01f, -1037.98f); + World_Waypoint_Set(244, 7, 398.23f, 6.98f, -1037.98f); + World_Waypoint_Set(245, 7, 40.78f, 7.22f, -943.72f); + World_Waypoint_Set(246, 7, 68.78f, -0.01f, -943.72f); + World_Waypoint_Set(247, 7, 96.78f, -0.01f, -973.72f); + World_Waypoint_Set(248, 63, -897.38f, -354.62f, 704.77f); + World_Waypoint_Set(249, 63, -914.76f, -354.62f, -312.43f); + World_Waypoint_Set(250, 63, -457.54f, -354.62f, -820.15f); + World_Waypoint_Set(251, 15, 556.72f, 0.37f, -141.26f); + World_Waypoint_Set(252, 15, 635.66f, 0.37f, -594.11f); + World_Waypoint_Set(253, 67, 130.42f, 0.0f, -79.98f); + World_Waypoint_Set(254, 67, -311.15f, 0.0f, -161.06f); + World_Waypoint_Set(255, 67, -403.15f, 0.0f, -161.06f); + World_Waypoint_Set(256, 67, -487.15f, 0.0f, -137.11f); + World_Waypoint_Set(257, 67, -611.15f, 0.0f, -73.06f); + World_Waypoint_Set(258, 8, 37.64f, 0.14f, -48.02f); + World_Waypoint_Set(259, 8, 109.64f, 0.14f, 91.98f); + World_Waypoint_Set(260, 8, -149.0f, 0.14f, 79.0f); + World_Waypoint_Set(261, 8, -129.0f, 0.14f, -237.0f); + World_Waypoint_Set(262, 8, -1.0f, 0.14f, -671.0f); + World_Waypoint_Set(263, 64, -728.0f, -354.0f, 1090.0f); + World_Waypoint_Set(264, 10, -8.41f, -144.0f, 343.0f); + World_Waypoint_Set(265, 10, -20.81f, -144.0f, 450.0f); + World_Waypoint_Set(266, 10, -200.0f, -144.0f, 206.0f); + World_Waypoint_Set(267, 10, -17.0f, -144.0f, 178.0f); + World_Waypoint_Set(268, 50, -7207.0f, 955.5f, 1852.75f); + World_Waypoint_Set(269, 50, -7191.0f, 955.5f, 1700.75f); + World_Waypoint_Set(270, 50, 7116.0f, 955.5f, 1871.0f); + World_Waypoint_Set(271, 7, -1139.89f, -0.04f, 67.89f); + World_Waypoint_Set(272, 7, -690.5f, -0.04f, -210.48f); + World_Waypoint_Set(273, 7, -495.89f, -0.04f, -204.11f); + World_Waypoint_Set(274, 69, -511.75f, 5.55f, 55.63f); + World_Waypoint_Set(275, 69, 296.21f, 5.55f, 59.63f); + World_Waypoint_Set(276, 73, -34.57f, 149.42f, -502.83f); + World_Waypoint_Set(277, 73, 51.0f, 149.42f, -487.27f); + World_Waypoint_Set(278, 73, 82.0f, 149.42f, -519.0f); + World_Waypoint_Set(279, 73, 95.97f, 149.42f, -549.51f); + World_Waypoint_Set(280, 73, -34.0f, 149.42f, -551.0f); + World_Waypoint_Set(281, 7, -2060.99f, -0.04f, -234.8f); + World_Waypoint_Set(282, 54, -346.69f, 31.55f, -1476.41f); + World_Waypoint_Set(283, 54, -298.69f, 31.55f, -1476.41f); + World_Waypoint_Set(284, 54, -298.69f, 31.55f, -1260.41f); + World_Waypoint_Set(285, 54, -418.69f, 31.55f, -1260.41f); + World_Waypoint_Set(286, 12, -104.24f, 0.0f, 183.16f); + World_Waypoint_Set(287, 57, -254.0f, -73.5f, -41.0f); + World_Waypoint_Set(288, 6, -125.14f, 0.02f, -176.76f); + World_Waypoint_Set(289, 0, -871.15f, 0.0f, -1081.93f); + World_Waypoint_Set(290, 0, -411.15f, 0.0f, -1117.93f); + World_Waypoint_Set(291, 54, 225.31f, 31.665f, -572.41f); + World_Waypoint_Set(292, 12, -127.0f, 0.0f, 178.0f); + World_Waypoint_Set(293, 12, 5.0f, 0.0f, 342.0f); + World_Waypoint_Set(294, 12, 173.0f, 0.0f, 226.0f); + World_Waypoint_Set(295, 12, 13.0f, 0.0f, -50.0f); + World_Waypoint_Set(354, 12, 57.0f, 0.0f, 18.0f); + World_Waypoint_Set(355, 12, 161.0f, 0.0f, 410.0f); + World_Waypoint_Set(358, 12, 33.0f, 0.0f, 198.0f); + World_Waypoint_Set(359, 12, 62.92f, 0.16f, 309.72f); + World_Waypoint_Set(549, 12, -15.0f, 0.0f, 338.0f); + World_Waypoint_Set(445, 12, 129.0f, 0.0f, 418.0f); + World_Waypoint_Set(546, 12, 13.0f, 0.0f, 206.0f); + World_Waypoint_Set(296, 77, 168.0f, 11.87f, -987.0f); + World_Waypoint_Set(297, 77, -178.5f, 23.73f, -2176.05f); + World_Waypoint_Set(298, 82, -145.0f, 156.94f, -370.0f); + World_Waypoint_Set(299, 82, -37.0f, 156.94f, -506.0f); + World_Waypoint_Set(300, 82, 75.0f, 156.94f, -506.0f); + World_Waypoint_Set(301, 83, 60.3f, 81.33f, -647.7f); + World_Waypoint_Set(302, 83, -271.0f, 81.33f, -647.7f); + World_Waypoint_Set(303, 83, -11.7f, 81.33f, -647.7f); + World_Waypoint_Set(304, 83, 10.94f, 115.0f, 59.67f); + World_Waypoint_Set(305, 83, 0.3f, 115.0f, 404.3f); + World_Waypoint_Set(306, 83, -329.38f, 115.0f, -385.84f); + World_Waypoint_Set(307, 84, 131.0f, -126.21f, -224.0f); + World_Waypoint_Set(308, 84, 103.0f, -126.21f, 152.0f); + World_Waypoint_Set(309, 84, 19.0f, -126.21f, 152.0f); + World_Waypoint_Set(310, 84, 459.0f, -126.21f, 152.0f); + World_Waypoint_Set(311, 84, -29.0f, -126.21f, 556.0f); + World_Waypoint_Set(312, 86, -311.0f, 129.0f, -488.0f); + World_Waypoint_Set(322, 12, 121.0f, 0.0f, -82.0f); + World_Waypoint_Set(323, 8, 600.58f, 0.14f, 32.82f); + World_Waypoint_Set(127, 26, 102.98f, -30.89f, -121.02f); + World_Waypoint_Set(128, 26, -20.0f, -30.89f, -121.02f); + World_Waypoint_Set(313, 26, 102.98f, -31.0f, -149.0f); + World_Waypoint_Set(314, 26, 20.0f, -31.0f, -109.0f); + World_Waypoint_Set(315, 26, -60.6f, -31.0f, -109.0f); + World_Waypoint_Set(316, 26, 87.35f, -31.0f, 74.0f); + World_Waypoint_Set(317, 26, 74.0f, -31.0f, 42.0f); + World_Waypoint_Set(318, 26, 74.0f, -31.0f, 98.0f); + World_Waypoint_Set(319, 26, 115.35f, -31.0f, 302.36f); + World_Waypoint_Set(320, 26, 104.38f, -31.0f, 260.0f); + World_Waypoint_Set(321, 26, 120.0f, -31.0f, 115.0f); + World_Waypoint_Set(336, 57, -110.0f, -73.5f, -169.0f); + World_Waypoint_Set(337, 57, -161.0f, -73.5f, -105.0f); + World_Waypoint_Set(338, 57, -193.0f, -73.5f, -105.0f); + World_Waypoint_Set(350, 54, -416.0f, -31.93f, -841.0f); + World_Waypoint_Set(339, 80, 106.0f, -12.21f, -94.0f); + World_Waypoint_Set(340, 80, 98.02f, -12.21f, -126.0f); + World_Waypoint_Set(341, 80, 106.0f, -21.47f, -278.0f); + World_Waypoint_Set(342, 80, 82.0f, -12.19f, -278.0f); + World_Waypoint_Set(343, 7, -1847.0f, -0.04f, 82.0f); + World_Waypoint_Set(344, 7, -1847.0f, -0.04f, -222.0f); + World_Waypoint_Set(345, 7, -1147.0f, -0.04f, -198.0f); + World_Waypoint_Set(346, 7, -667.0f, -0.04f, -125.0f); + World_Waypoint_Set(347, 7, -471.0f, -0.04f, -110.0f); + World_Waypoint_Set(348, 7, -403.0f, -0.04f, -110.0f); + World_Waypoint_Set(351, 31, 105.0f, 348.52f, 948.0f); + World_Waypoint_Set(352, 33, -426.0f, 9.68f, -33.0f); + World_Waypoint_Set(353, 33, -439.0f, 9.68f, -101.0f); + World_Waypoint_Set(356, 11, 19.01f, -24.0f, 20.21f); + World_Waypoint_Set(357, 11, 22.26f, 12.0f, -31.01f); + World_Waypoint_Set(366, 11, -94.21f, 12.0f, -26.15f); + World_Waypoint_Set(367, 11, -286.21f, -24.0f, 37.85f); + World_Waypoint_Set(368, 19, 176.91f, -40.67f, 225.92f); + World_Waypoint_Set(369, 54, -220.0f, 23.88f, -1437.0f); + World_Waypoint_Set(370, 54, -392.0f, 31.55f, -1757.0f); + World_Waypoint_Set(371, 39, 441.0f, 47.76f, -798.98f); + World_Waypoint_Set(372, 39, 185.62f, 47.76f, -867.42f); + World_Waypoint_Set(373, 39, 947.0f, 47.76f, -696.0f); + World_Waypoint_Set(374, 89, -339.22f, 0.22f, -11.33f); + World_Waypoint_Set(375, 11, -299.0f, -24.0f, 322.0f); + World_Waypoint_Set(376, 11, -215.0f, -24.0f, 322.0f); + World_Waypoint_Set(377, 39, 397.6f, 47.76f, -823.23f); + World_Waypoint_Set(378, 39, 461.56f, 47.76f, -757.78f); + World_Waypoint_Set(379, 18, -260.15f, 12.0f, -19.16f); + World_Waypoint_Set(361, 55, -185.0f, -70.19f, -1046.0f); + World_Waypoint_Set(362, 55, -121.0f, -70.19f, -778.0f); + World_Waypoint_Set(363, 55, -166.0f, -70.19f, -579.0f); + World_Waypoint_Set(364, 55, -160.0f, -70.19f, -164.0f); + World_Waypoint_Set(365, 55, 3.0f, -70.19f, -986.0f); + World_Waypoint_Set(380, 38, 456.43f, 47.76f, -276.05f); + World_Waypoint_Set(381, 70, -160.0f, -4.01f, 496.0f); + World_Waypoint_Set(382, 70, 0.0f, 1.72f, 60.0f); + World_Waypoint_Set(383, 70, 0.0f, 1.72f, -192.0f); + World_Waypoint_Set(384, 70, 260.0f, 1.72f, 52.0f); + World_Waypoint_Set(385, 33, 489.0f, 9.68f, 74.0f); + World_Waypoint_Set(386, 33, -375.0f, 9.68f, 54.0f); + World_Waypoint_Set(387, 33, -359.0f, 0.0f, 302.0f); + World_Waypoint_Set(388, 20, 215.0f, 0.0f, -122.0f); + World_Waypoint_Set(389, 20, -133.0f, 9.04f, 910.0f); + World_Waypoint_Set(390, 7, -655.0f, 6.98f, -364.0f); + World_Waypoint_Set(391, 7, -795.0f, 6.98f, -352.0f); + World_Waypoint_Set(392, 7, -1103.0f, 6.98f, -384.0f); + World_Waypoint_Set(393, 7, -1759.0f, -0.04f, 75.0f); + World_Waypoint_Set(394, 53, 476.0f, -162.0f, 196.0f); + World_Waypoint_Set(395, 53, 120.0f, -162.0f, 148.0f); + World_Waypoint_Set(396, 53, 120.0f, -161.0f, -160.0f); + World_Waypoint_Set(397, 53, 148.0f, -161.0f, -160.0f); + World_Waypoint_Set(398, 54, 324.0f, 31.0f, -1316.0f); + World_Waypoint_Set(399, 54, 236.0f, 31.0f, -1316.0f); + World_Waypoint_Set(400, 54, 248.0f, 31.0f, -540.0f); + World_Waypoint_Set(401, 54, -287.0f, 31.0f, -480.0f); + World_Waypoint_Set(402, 54, -331.0f, 31.0f, -620.0f); + World_Waypoint_Set(403, 54, -239.0f, 31.0f, -1436.0f); + World_Waypoint_Set(404, 54, -411.0f, 31.0f, -1436.0f); + World_Waypoint_Set(405, 74, 90.0f, -50.0f, -42.0f); + World_Waypoint_Set(406, 74, -106.0f, -50.0f, -2358.0f); + World_Waypoint_Set(407, 83, 0.0f, 81.02f, -512.0f); + World_Waypoint_Set(408, 83, 0.0f, 1.15f, 400.0f); + World_Waypoint_Set(409, 77, -48.0f, -1.74f, -983.0f); + World_Waypoint_Set(411, 78, 80.0f, -16.72f, -4.0f); + World_Waypoint_Set(412, 78, -48.0f, -11.0f, -352.0f); + World_Waypoint_Set(413, 79, -109.0f, 0.0f, 285.0f); + World_Waypoint_Set(414, 79, -109.0f, 0.0f, 125.0f); + World_Waypoint_Set(415, 80, 198.0f, -12.0f, -282.0f); + World_Waypoint_Set(416, 80, 90.0f, -12.0f, -274.0f); + World_Waypoint_Set(417, 80, 10.0f, -12.0f, -282.0f); + World_Waypoint_Set(418, 80, -106.0f, -12.0f, -746.0f); + World_Waypoint_Set(419, 80, -59.0f, -12.0f, -614.0f); + World_Waypoint_Set(420, 81, -496.0f, 0.0f, -168.0f); + World_Waypoint_Set(421, 81, -341.0f, 0.0f, 248.0f); + World_Waypoint_Set(422, 81, -348.0f, 0.0f, -36.0f); + World_Waypoint_Set(423, 85, 60.0f, 52.0f, -544.0f); + World_Waypoint_Set(424, 85, -552.0f, 141.0f, -1008.0f); + World_Waypoint_Set(425, 86, 245.0f, 186.0f, -24.0f); + World_Waypoint_Set(426, 86, -287.0f, 12.0f, -148.0f); + World_Waypoint_Set(427, 89, -9.0f, 0.0f, 588.0f); + World_Waypoint_Set(428, 89, -669.0f, 0.0f, 37.0f); + World_Waypoint_Set(429, 13, -796.08f, 0.0f, -184.09f); + World_Waypoint_Set(430, 53, -328.0f, -1.62f, 148.0f); + World_Waypoint_Set(431, 79, 75.0f, 0.0f, -71.0f); + World_Waypoint_Set(432, 79, 63.0f, 153.0f, -467.0f); + World_Waypoint_Set(433, 82, 115.0f, 156.0f, -310.0f); + World_Waypoint_Set(434, 82, -57.0f, 156.0f, -306.0f); + World_Waypoint_Set(435, 82, -121.0f, 156.0f, -426.0f); + World_Waypoint_Set(436, 89, -274.74f, 0.0f, 464.75f); + World_Waypoint_Set(437, 41, 271.97f, 40.63f, 18.4f); + World_Waypoint_Set(438, 41, 203.97f, 40.63f, 18.4f); + World_Waypoint_Set(516, 41, -79.01f, 40.63f, 91.01f); + World_Waypoint_Set(439, 13, -1273.27f, 0.32f, 126.92f); + World_Waypoint_Set(440, 4, -453.0f, -6.5f, 1176.0f); + World_Waypoint_Set(441, 4, -497.0f, -6.5f, 1080.0f); + World_Waypoint_Set(442, 4, -623.0f, -6.5f, 787.0f); + World_Waypoint_Set(443, 4, -436.0f, -6.5f, 765.0f); + World_Waypoint_Set(446, 77, 176.0f, 19.31f, -283.0f); + World_Waypoint_Set(447, 77, 40.0f, -1.74f, -247.0f); + World_Waypoint_Set(448, 77, 24.0f, -6.71f, -179.0f); + World_Waypoint_Set(449, 77, 44.0f, -1.74f, 57.0f); + World_Waypoint_Set(450, 74, -74.61f, -50.13f, -802.42f); + World_Waypoint_Set(451, 74, 141.39f, -50.13f, -802.92f); + World_Waypoint_Set(452, 42, -91.5f, 367.93f, 277.84f); + World_Waypoint_Set(453, 42, 32.5f, 367.93f, 277.84f); + World_Waypoint_Set(454, 42, 216.5f, 367.93f, 265.84f); + World_Waypoint_Set(455, 42, 216.5f, 367.93f, 389.84f); + World_Waypoint_Set(456, 60, -100.0f, 0.33f, -272.0f); + World_Waypoint_Set(462, 60, -119.0f, 0.33f, 77.0f); + World_Waypoint_Set(457, 78, 129.65f, 16.72f, -78.36f); + World_Waypoint_Set(458, 78, 44.2f, -11.64f, -390.86f); + World_Waypoint_Set(459, 78, 103.36f, -16.72f, -484.49f); + World_Waypoint_Set(460, 79, 103.0f, 0.0f, 413.0f); + World_Waypoint_Set(461, 79, 103.0f, 0.0f, 349.0f); + World_Waypoint_Set(467, 13, -585.67f, 0.0f, 380.58f); + World_Waypoint_Set(468, 53, -312.0f, -162.8f, 156.0f); + World_Waypoint_Set(469, 53, 68.0f, -162.8f, 144.0f); + World_Waypoint_Set(470, 53, 100.0f, -162.8f, -100.0f); + World_Waypoint_Set(471, 53, 208.0f, -162.8f, -100.0f); + World_Waypoint_Set(472, 53, -16.0f, -162.8f, -100.0f); + World_Waypoint_Set(473, 7, -667.39f, -0.04f, -28.38f); + World_Waypoint_Set(474, 7, -659.0f, 7.18f, -334.0f); + World_Waypoint_Set(475, 7, -659.0f, -0.04f, 242.0f); + World_Waypoint_Set(476, 7, -2327.0f, -0.04f, 142.0f); + World_Waypoint_Set(477, 75, -97.24f, 84.13f, -69.94f); + World_Waypoint_Set(478, 75, -97.24f, 74.87f, -509.94f); + World_Waypoint_Set(479, 74, -134.0f, -50.13f, -250.41f); + World_Waypoint_Set(480, 74, 17.01f, -50.13f, -2355.41f); + World_Waypoint_Set(481, 83, -193.5f, 1.15f, 29.0f); + World_Waypoint_Set(482, 83, -329.5f, 1.15f, 29.0f); + World_Waypoint_Set(483, 83, -329.5f, 1.15f, -379.0f); + World_Waypoint_Set(488, 74, 22.0f, -50.13f, -650.0f); + World_Waypoint_Set(489, 74, -14.0f, -50.13f, -2354.0f); + World_Waypoint_Set(490, 54, -360.0f, 31.55f, -1457.0f); + World_Waypoint_Set(491, 54, 308.0f, 31.66f, -1457.0f); + World_Waypoint_Set(492, 54, -72.0f, 23.88f, -1445.0f); + World_Waypoint_Set(493, 54, 76.0f, 23.88f, -1333.0f); + World_Waypoint_Set(494, 54, -236.0f, 31.55f, -337.0f); + World_Waypoint_Set(495, 11, -275.0f, -24.0f, 42.0f); + World_Waypoint_Set(496, 11, 185.0f, -24.0f, 42.0f); + World_Waypoint_Set(497, 55, -250.0f, -70.19f, -639.0f); + World_Waypoint_Set(498, 55, 454.0f, -70.19f, -667.0f); + World_Waypoint_Set(499, 13, -573.43f, 0.0f, -635.5f); + World_Waypoint_Set(500, 13, -625.43f, 0.0f, -635.5f); + World_Waypoint_Set(501, 56, -215.08f, -71.88f, 150.86f); + World_Waypoint_Set(502, 56, 60.92f, -71.88f, -29.14f); + World_Waypoint_Set(503, 13, -1417.36f, 0.32f, 149.18f); + World_Waypoint_Set(504, 13, -1512.0f, 0.32f, 323.0f); + World_Waypoint_Set(505, 13, -1813.36f, 0.32f, 325.18f); + World_Waypoint_Set(506, 59, -24.78f, 2.84f, -182.43f); + World_Waypoint_Set(507, 59, -200.78f, 2.84f, -282.43f); + World_Waypoint_Set(508, 37, 579.54f, -0.01f, -380.98f); + World_Waypoint_Set(509, 37, 307.54f, 8.0f, -752.98f); + World_Waypoint_Set(510, 37, 124.0f, 8.0f, -888.0f); + World_Waypoint_Set(511, 37, 124.0f, 8.0f, -244.0f); + World_Waypoint_Set(512, 38, -25.54f, 47.76f, -321.98f); + World_Waypoint_Set(513, 38, 446.46f, 47.76f, -509.98f); + World_Waypoint_Set(514, 39, 567.0f, 47.76f, -884.0f); + World_Waypoint_Set(515, 39, 203.0f, 47.76f, -880.0f); + World_Waypoint_Set(517, 40, 1246.62f, -0.31f, -171.02f); + World_Waypoint_Set(518, 40, -72.89f, -0.31f, -154.77f); + World_Waypoint_Set(519, 40, 285.88f, -0.31f, -134.49f); + World_Waypoint_Set(520, 40, 231.31f, -0.31f, 266.36f); + World_Waypoint_Set(521, 40, 482.02f, -0.31f, -661.24f); + World_Waypoint_Set(522, 40, 1183.98f, -0.31f, -176.25f); + World_Waypoint_Set(523, 40, -45.0f, -0.34f, -351.0f); + World_Waypoint_Set(530, 44, 36.79f, -12.2f, -534.54f); + World_Waypoint_Set(531, 44, -279.21f, -12.2f, -594.54f); + World_Waypoint_Set(532, 86, -76.51f, 129.0f, -748.49f); + World_Waypoint_Set(533, 86, -48.51f, 129.0f, -676.49f); + World_Waypoint_Set(534, 86, -176.51f, 129.0f, -504.49f); + World_Waypoint_Set(535, 86, 111.49f, 129.0f, -504.49f); + World_Waypoint_Set(536, 86, -296.51f, 12.97f, -300.49f); + World_Waypoint_Set(537, 86, -220.51f, 12.97f, -184.49f); + World_Waypoint_Set(538, 86, -40.51f, 12.97f, -148.49f); + World_Waypoint_Set(539, 80, 190.0f, 12.0f, -282.0f); + World_Waypoint_Set(540, 9, -934.24f, 0.0f, 807.77f); + World_Waypoint_Set(541, 9, -1147.2f, 0.0f, 893.18f); + World_Waypoint_Set(542, 9, -1098.4f, 8.26f, -312.12f); + World_Waypoint_Set(543, 9, -1046.4f, 8.26f, -312.12f); + World_Waypoint_Set(544, 74, 111.72f, -50.13f, -490.46f); + World_Waypoint_Set(545, 74, -143.86f, 490.46f, -300.38f); + World_Waypoint_Set(550, 9, -785.31f, 0.0f, -237.05f); + World_Waypoint_Set(551, 9, -737.31f, 0.0f, -145.05f); + World_Waypoint_Set(324, 22, 267.0f, -60.3f, 203.0f); + World_Waypoint_Set(325, 22, 84.0f, -60.3f, 337.0f); + World_Waypoint_Set(326, 2, -36.0f, 0.0f, 185.0f); + World_Waypoint_Set(327, 2, -166.0f, 0.0f, -103.0f); + World_Waypoint_Set(328, 3, -556.0f, 252.59f, -1018.11f); + World_Waypoint_Set(329, 3, -655.0f, 252.6f, -1012.0f); + World_Waypoint_Set(330, 3, -657.0f, 253.0f, -1127.0f); + World_Waypoint_Set(331, 102, 163.8f, 0.0f, 67.0f); + World_Waypoint_Set(332, 2, -39.0f, 0.0f, 11.5f); + World_Waypoint_Set(333, 102, -34.0f, 0.0f, 33.0f); + World_Waypoint_Set(334, 22, 3.0f, -60.3f, -144.0f); + World_Waypoint_Set(335, 102, -50.0f, 0.0f, 212.0f); +} + +void ScriptInit::Init_SDB() { + SDB_Set_Actor(0, 8); + SDB_Set_Sex(0, 1); + SDB_Add_MO_Clue(0, 52); + SDB_Add_MO_Clue(0, 49); + SDB_Add_MO_Clue(0, 48); + SDB_Add_MO_Clue(0, 261); + SDB_Add_Whereabouts_Clue(0, 45); + SDB_Add_Whereabouts_Clue(0, 53); + SDB_Add_Whereabouts_Clue(0, 44); + SDB_Add_Whereabouts_Clue(0, 67); + SDB_Add_Whereabouts_Clue(0, 122); + SDB_Add_Replicant_Clue(0, 49); + SDB_Add_Replicant_Clue(0, 52); + SDB_Add_Replicant_Clue(0, 68); + SDB_Add_Replicant_Clue(0, 51); + SDB_Add_Replicant_Clue(0, 269); + SDB_Add_Replicant_Clue(0, 278); + SDB_Add_Replicant_Clue(0, 52); + SDB_Add_Non_Replicant_Clue(0, 74); + SDB_Add_Non_Replicant_Clue(0, 61); + SDB_Add_Non_Replicant_Clue(0, 270); + SDB_Add_Other_Clue(0, 180); + SDB_Add_Other_Clue(0, 181); + SDB_Add_Other_Clue(0, 266); + SDB_Add_Other_Clue(0, 47); + SDB_Add_Other_Clue(0, 277); + SDB_Add_Identity_Clue(0, 266); + SDB_Add_Photo_Clue(0, 47, 31); + SDB_Add_Photo_Clue(0, 277, 38); + SDB_Set_Actor(1, 5); + SDB_Set_Sex(1, 1); + SDB_Add_MO_Clue(1, 5); + SDB_Add_MO_Clue(1, 11); + SDB_Add_Whereabouts_Clue(1, 40); + SDB_Add_Whereabouts_Clue(1, 29); + SDB_Add_Whereabouts_Clue(1, 67); + SDB_Add_Replicant_Clue(1, 0); + SDB_Add_Replicant_Clue(1, 2); + SDB_Add_Replicant_Clue(1, 68); + SDB_Add_Replicant_Clue(1, 156); + SDB_Add_Replicant_Clue(1, 157); + SDB_Add_Replicant_Clue(1, 107); + SDB_Add_Other_Clue(1, 243); + SDB_Add_Other_Clue(1, 4); + SDB_Add_Other_Clue(1, 61); + SDB_Add_Other_Clue(1, 266); + SDB_Add_Other_Clue(1, 276); + SDB_Add_Other_Clue(1, 243); + SDB_Add_Other_Clue(1, 77); + SDB_Add_Other_Clue(1, 244); + SDB_Add_Identity_Clue(1, 61); + SDB_Add_Identity_Clue(1, 266); + SDB_Add_Identity_Clue(1, 107); + SDB_Add_Photo_Clue(1, 276, 37); + SDB_Add_Photo_Clue(1, 243, 7); + SDB_Add_Photo_Clue(1, 77, 25); + SDB_Add_Photo_Clue(1, 244, 8); + SDB_Set_Actor(2, 19); + SDB_Set_Sex(2, 1); + SDB_Add_MO_Clue(2, 0); + SDB_Add_MO_Clue(2, 10); + SDB_Add_Whereabouts_Clue(2, 40); + SDB_Add_Whereabouts_Clue(2, 29); + SDB_Add_Replicant_Clue(2, 0); + SDB_Add_Replicant_Clue(2, 2); + SDB_Add_Replicant_Clue(2, 25); + SDB_Add_Replicant_Clue(2, 18); + SDB_Add_Replicant_Clue(2, 20); + SDB_Add_Replicant_Clue(2, 156); + SDB_Add_Replicant_Clue(2, 157); + SDB_Add_Non_Replicant_Clue(2, 3); + SDB_Add_Non_Replicant_Clue(2, 21); + SDB_Add_Non_Replicant_Clue(2, 158); + SDB_Add_Other_Clue(2, 16); + SDB_Add_Other_Clue(2, 19); + SDB_Add_Other_Clue(2, 273); + SDB_Add_Identity_Clue(2, 25); + SDB_Add_Identity_Clue(2, 18); + SDB_Add_Identity_Clue(2, 19); + SDB_Add_Identity_Clue(2, 273); + SDB_Add_Photo_Clue(2, 20, 33); + SDB_Set_Actor(3, 6); + SDB_Set_Sex(3, 0); + SDB_Add_Whereabouts_Clue(3, 8); + SDB_Add_Whereabouts_Clue(3, 9); + SDB_Add_Whereabouts_Clue(3, 15); + SDB_Add_Whereabouts_Clue(3, 28); + SDB_Add_Whereabouts_Clue(3, 84); + SDB_Add_Whereabouts_Clue(3, 19); + SDB_Add_Replicant_Clue(3, 22); + SDB_Add_Replicant_Clue(3, 23); + SDB_Add_Replicant_Clue(3, 271); + SDB_Add_Replicant_Clue(3, 156); + SDB_Add_Replicant_Clue(3, 107); + SDB_Add_Replicant_Clue(3, 280); + SDB_Add_Non_Replicant_Clue(3, 7); + SDB_Add_Non_Replicant_Clue(3, 85); + SDB_Add_Non_Replicant_Clue(3, 6); + SDB_Add_Non_Replicant_Clue(3, 272); + SDB_Add_Non_Replicant_Clue(3, 157); + SDB_Add_Other_Clue(3, 13); + SDB_Add_Other_Clue(3, 16); + SDB_Add_Identity_Clue(3, 22); + SDB_Add_Identity_Clue(3, 107); + SDB_Add_Photo_Clue(3, 13, 5); + SDB_Set_Actor(4, 3); + SDB_Add_MO_Clue(4, 252); + SDB_Add_Replicant_Clue(4, 162); + SDB_Add_Replicant_Clue(4, 92); + SDB_Add_Replicant_Clue(4, 91); + SDB_Add_Replicant_Clue(4, 107); + SDB_Add_Non_Replicant_Clue(4, 163); + SDB_Add_Non_Replicant_Clue(4, 96); + SDB_Add_Non_Replicant_Clue(4, 97); + SDB_Add_Non_Replicant_Clue(4, 98); + SDB_Add_Non_Replicant_Clue(4, 94); + SDB_Add_Other_Clue(4, 91); + SDB_Add_Other_Clue(4, 251); + SDB_Add_Other_Clue(4, 260); + SDB_Add_Other_Clue(4, 113); + SDB_Add_Identity_Clue(4, 96); + SDB_Add_Identity_Clue(4, 97); + SDB_Add_Identity_Clue(4, 92); + SDB_Add_Photo_Clue(4, 251, 21); + SDB_Add_Photo_Clue(4, 260, 19); + SDB_Set_Actor(5, 2); + SDB_Set_Sex(5, 1); + SDB_Add_Whereabouts_Clue(5, 102); + SDB_Add_Identity_Clue(5, 69); + SDB_Add_Identity_Clue(5, 70); + SDB_Set_Actor(6, 7); + SDB_Set_Sex(6, 1); + SDB_Add_Whereabouts_Clue(6, 58); + SDB_Add_Whereabouts_Clue(6, 59); + SDB_Add_Whereabouts_Clue(6, 181); + SDB_Add_Whereabouts_Clue(6, 122); + SDB_Add_Replicant_Clue(6, 63); + SDB_Add_Other_Clue(6, 180); + SDB_Add_Other_Clue(6, 66); + SDB_Add_Other_Clue(6, 125); + SDB_Add_Other_Clue(6, 121); + SDB_Add_Other_Clue(6, 255); + SDB_Add_Other_Clue(6, 246); + SDB_Add_Other_Clue(6, 247); + SDB_Add_Other_Clue(6, 62); + SDB_Add_Other_Clue(6, 60); + SDB_Add_Identity_Clue(6, 181); + SDB_Add_Identity_Clue(6, 58); + SDB_Add_Identity_Clue(6, 59); + SDB_Add_Identity_Clue(6, 246); + SDB_Add_Identity_Clue(6, 247); + SDB_Add_Identity_Clue(6, 62); + SDB_Add_Identity_Clue(6, 60); + SDB_Add_Photo_Clue(6, 255, 26); + SDB_Set_Actor(7, 0); + SDB_Add_Replicant_Clue(7, 275); + SDB_Add_Other_Clue(7, 246); + SDB_Add_Other_Clue(7, 247); + SDB_Add_Identity_Clue(7, 275); + SDB_Add_Photo_Clue(7, 275, 36); + SDB_Add_Photo_Clue(7, 246, 17); + SDB_Add_Photo_Clue(7, 247, 18); + SDB_Set_Actor(8, 4); + SDB_Add_Other_Clue(8, 256); + SDB_Add_Other_Clue(8, 125); + SDB_Add_Other_Clue(8, 126); + SDB_Add_Identity_Clue(8, 256); + SDB_Add_Identity_Clue(8, 126); + SDB_Add_Identity_Clue(8, 125); + SDB_Add_Photo_Clue(8, 256, 27); +} + +void ScriptInit::Init_CDB() { + CDB_Set_Crime(0, 0); + CDB_Set_Crime(1, 0); + CDB_Set_Crime(2, 0); + CDB_Set_Crime(3, 0); + CDB_Set_Crime(4, 0); + CDB_Set_Crime(5, 0); + CDB_Set_Crime(6, 0); + CDB_Set_Crime(7, 0); + CDB_Set_Crime(8, 0); + CDB_Set_Crime(9, 0); + CDB_Set_Crime(10, 0); + CDB_Set_Crime(11, 0); + CDB_Set_Crime(12, 0); + CDB_Set_Crime(15, 0); + CDB_Set_Crime(16, 0); + CDB_Set_Crime(17, 0); + CDB_Set_Crime(22, 0); + CDB_Set_Crime(23, 0); + CDB_Set_Crime(24, 0); + CDB_Set_Crime(26, 0); + CDB_Set_Crime(27, 0); + CDB_Set_Crime(28, 0); + CDB_Set_Crime(29, 0); + CDB_Set_Crime(30, 0); + CDB_Set_Crime(37, 0); + CDB_Set_Crime(31, 0); + CDB_Set_Crime(39, 0); + CDB_Set_Crime(243, 0); + CDB_Set_Crime(244, 0); + CDB_Set_Crime(273, 0); + CDB_Set_Crime(113, 0); + CDB_Set_Crime(114, 0); + CDB_Set_Crime(115, 0); + CDB_Set_Crime(19, 0); + CDB_Set_Crime(13, 0); + CDB_Set_Crime(14, 0); + CDB_Set_Crime(20, 0); + CDB_Set_Crime(43, 1); + CDB_Set_Crime(44, 1); + CDB_Set_Crime(45, 1); + CDB_Set_Crime(46, 1); + CDB_Set_Crime(49, 1); + CDB_Set_Crime(50, 1); + CDB_Set_Crime(51, 1); + CDB_Set_Crime(53, 1); + CDB_Set_Crime(54, 1); + CDB_Set_Crime(55, 1); + CDB_Set_Crime(65, 1); + CDB_Set_Crime(278, 1); + CDB_Set_Crime(279, 1); + CDB_Set_Crime(47, 1); + CDB_Set_Crime(262, 1); + CDB_Set_Crime(263, 1); + CDB_Set_Crime(261, 1); + CDB_Set_Crime(259, 1); + CDB_Set_Crime(33, 8); + CDB_Set_Crime(86, 8); + CDB_Set_Crime(275, 8); + CDB_Set_Crime(276, 8); + CDB_Set_Crime(277, 8); + CDB_Set_Crime(271, 8); + CDB_Set_Crime(52, 8); + CDB_Set_Crime(144, 8); + CDB_Set_Crime(178, 5); + CDB_Set_Crime(179, 5); + CDB_Set_Crime(180, 5); + CDB_Set_Crime(181, 5); + CDB_Set_Crime(68, 3); + CDB_Set_Crime(269, 3); + CDB_Set_Crime(270, 3); + CDB_Set_Crime(66, 2); + CDB_Set_Crime(125, 2); + CDB_Set_Crime(121, 2); + CDB_Set_Crime(122, 2); + CDB_Set_Crime(123, 2); + CDB_Set_Crime(124, 2); + CDB_Set_Crime(128, 2); + CDB_Set_Crime(83, 2); + CDB_Set_Crime(125, 2); + CDB_Set_Crime(126, 2); + CDB_Set_Crime(74, 4); + CDB_Set_Crime(266, 4); + int i = 0; + do { + CDB_Set_Clue_Asset_Type(i++, -1); + } while (i < 288); + CDB_Set_Clue_Asset_Type(0, 2); + CDB_Set_Clue_Asset_Type(2, 2); + CDB_Set_Clue_Asset_Type(3, 2); + CDB_Set_Clue_Asset_Type(4, 2); + CDB_Set_Clue_Asset_Type(5, 3); + CDB_Set_Clue_Asset_Type(6, 3); + CDB_Set_Clue_Asset_Type(7, 3); + CDB_Set_Clue_Asset_Type(8, 3); + CDB_Set_Clue_Asset_Type(9, 0); + CDB_Set_Clue_Asset_Type(10, 2); + CDB_Set_Clue_Asset_Type(11, 2); + CDB_Set_Clue_Asset_Type(12, 1); + CDB_Set_Clue_Asset_Type(13, 0); + CDB_Set_Clue_Asset_Type(14, 0); + CDB_Set_Clue_Asset_Type(15, 3); + CDB_Set_Clue_Asset_Type(16, 2); + CDB_Set_Clue_Asset_Type(17, 2); + CDB_Set_Clue_Asset_Type(19, 2); + CDB_Set_Clue_Asset_Type(20, 0); + CDB_Set_Clue_Asset_Type(21, 2); + CDB_Set_Clue_Asset_Type(22, 2); + CDB_Set_Clue_Asset_Type(23, 2); + CDB_Set_Clue_Asset_Type(24, 2); + CDB_Set_Clue_Asset_Type(25, 2); + CDB_Set_Clue_Asset_Type(26, 2); + CDB_Set_Clue_Asset_Type(27, 3); + CDB_Set_Clue_Asset_Type(28, 0); + CDB_Set_Clue_Asset_Type(29, 0); + CDB_Set_Clue_Asset_Type(30, 0); + CDB_Set_Clue_Asset_Type(31, 0); + CDB_Set_Clue_Asset_Type(32, 3); + CDB_Set_Clue_Asset_Type(33, 2); + CDB_Set_Clue_Asset_Type(34, -1); + CDB_Set_Clue_Asset_Type(35, -1); + CDB_Set_Clue_Asset_Type(36, 0); + CDB_Set_Clue_Asset_Type(37, 3); + CDB_Set_Clue_Asset_Type(39, 2); + CDB_Set_Clue_Asset_Type(40, 2); + CDB_Set_Clue_Asset_Type(41, 0); + CDB_Set_Clue_Asset_Type(43, 2); + CDB_Set_Clue_Asset_Type(44, 3); + CDB_Set_Clue_Asset_Type(45, 1); + CDB_Set_Clue_Asset_Type(46, 2); + CDB_Set_Clue_Asset_Type(47, 0); + CDB_Set_Clue_Asset_Type(48, 0); + CDB_Set_Clue_Asset_Type(49, 3); + CDB_Set_Clue_Asset_Type(50, 2); + CDB_Set_Clue_Asset_Type(51, 2); + CDB_Set_Clue_Asset_Type(52, 2); + CDB_Set_Clue_Asset_Type(53, 3); + CDB_Set_Clue_Asset_Type(54, 3); + CDB_Set_Clue_Asset_Type(55, 3); + CDB_Set_Clue_Asset_Type(56, 2); + CDB_Set_Clue_Asset_Type(57, 2); + CDB_Set_Clue_Asset_Type(58, 2); + CDB_Set_Clue_Asset_Type(59, 2); + CDB_Set_Clue_Asset_Type(60, 2); + CDB_Set_Clue_Asset_Type(61, 2); + CDB_Set_Clue_Asset_Type(62, 3); + CDB_Set_Clue_Asset_Type(63, 2); + CDB_Set_Clue_Asset_Type(64, 2); + CDB_Set_Clue_Asset_Type(65, 3); + CDB_Set_Clue_Asset_Type(66, 2); + CDB_Set_Clue_Asset_Type(67, 2); + CDB_Set_Clue_Asset_Type(68, 2); + CDB_Set_Clue_Asset_Type(69, 2); + CDB_Set_Clue_Asset_Type(70, 2); + CDB_Set_Clue_Asset_Type(71, 2); + CDB_Set_Clue_Asset_Type(72, 2); + CDB_Set_Clue_Asset_Type(74, 2); + CDB_Set_Clue_Asset_Type(75, 3); + CDB_Set_Clue_Asset_Type(76, 3); + CDB_Set_Clue_Asset_Type(77, 0); + CDB_Set_Clue_Asset_Type(78, 0); + CDB_Set_Clue_Asset_Type(79, 2); + CDB_Set_Clue_Asset_Type(80, 3); + CDB_Set_Clue_Asset_Type(81, 3); + CDB_Set_Clue_Asset_Type(84, 3); + CDB_Set_Clue_Asset_Type(85, 3); + CDB_Set_Clue_Asset_Type(86, 0); + CDB_Set_Clue_Asset_Type(87, 3); + CDB_Set_Clue_Asset_Type(88, 0); + CDB_Set_Clue_Asset_Type(89, 1); + CDB_Set_Clue_Asset_Type(93, 3); + CDB_Set_Clue_Asset_Type(94, 2); + CDB_Set_Clue_Asset_Type(96, 2); + CDB_Set_Clue_Asset_Type(97, 2); + CDB_Set_Clue_Asset_Type(98, 3); + CDB_Set_Clue_Asset_Type(99, 3); + CDB_Set_Clue_Asset_Type(100, 3); + CDB_Set_Clue_Asset_Type(101, 2); + CDB_Set_Clue_Asset_Type(102, 2); + CDB_Set_Clue_Asset_Type(103, 2); + CDB_Set_Clue_Asset_Type(104, 2); + CDB_Set_Clue_Asset_Type(105, 3); + CDB_Set_Clue_Asset_Type(106, 3); + CDB_Set_Clue_Asset_Type(107, 2); + CDB_Set_Clue_Asset_Type(108, 2); + CDB_Set_Clue_Asset_Type(109, 3); + CDB_Set_Clue_Asset_Type(110, 3); + CDB_Set_Clue_Asset_Type(112, 2); + CDB_Set_Clue_Asset_Type(113, 2); + CDB_Set_Clue_Asset_Type(114, 2); + CDB_Set_Clue_Asset_Type(115, 2); + CDB_Set_Clue_Asset_Type(116, 2); + CDB_Set_Clue_Asset_Type(117, 2); + CDB_Set_Clue_Asset_Type(118, 3); + CDB_Set_Clue_Asset_Type(119, 3); + CDB_Set_Clue_Asset_Type(120, 2); + CDB_Set_Clue_Asset_Type(121, 2); + CDB_Set_Clue_Asset_Type(122, 2); + CDB_Set_Clue_Asset_Type(123, 2); + CDB_Set_Clue_Asset_Type(124, 2); + CDB_Set_Clue_Asset_Type(126, 2); + CDB_Set_Clue_Asset_Type(127, 3); + CDB_Set_Clue_Asset_Type(128, 3); + CDB_Set_Clue_Asset_Type(129, 3); + CDB_Set_Clue_Asset_Type(131, 3); + CDB_Set_Clue_Asset_Type(133, 2); + CDB_Set_Clue_Asset_Type(134, 2); + CDB_Set_Clue_Asset_Type(135, 2); + CDB_Set_Clue_Asset_Type(136, 2); + CDB_Set_Clue_Asset_Type(137, 0); + CDB_Set_Clue_Asset_Type(138, 0); + CDB_Set_Clue_Asset_Type(139, 2); + CDB_Set_Clue_Asset_Type(140, 2); + CDB_Set_Clue_Asset_Type(141, 2); + CDB_Set_Clue_Asset_Type(142, 2); + CDB_Set_Clue_Asset_Type(143, 2); + CDB_Set_Clue_Asset_Type(144, 2); + CDB_Set_Clue_Asset_Type(145, 3); + CDB_Set_Clue_Asset_Type(146, 3); + CDB_Set_Clue_Asset_Type(178, 2); + CDB_Set_Clue_Asset_Type(179, 2); + CDB_Set_Clue_Asset_Type(180, 2); + CDB_Set_Clue_Asset_Type(181, 2); + CDB_Set_Clue_Asset_Type(147, 3); + CDB_Set_Clue_Asset_Type(148, 3); + CDB_Set_Clue_Asset_Type(149, 3); + CDB_Set_Clue_Asset_Type(150, 3); + CDB_Set_Clue_Asset_Type(151, 3); + CDB_Set_Clue_Asset_Type(152, 3); + CDB_Set_Clue_Asset_Type(243, 0); + CDB_Set_Clue_Asset_Type(244, 0); + CDB_Set_Clue_Asset_Type(245, 0); + CDB_Set_Clue_Asset_Type(246, 0); + CDB_Set_Clue_Asset_Type(247, 0); + CDB_Set_Clue_Asset_Type(248, 0); + CDB_Set_Clue_Asset_Type(249, 0); + CDB_Set_Clue_Asset_Type(250, 0); + CDB_Set_Clue_Asset_Type(251, 0); + CDB_Set_Clue_Asset_Type(252, 0); + CDB_Set_Clue_Asset_Type(253, 0); + CDB_Set_Clue_Asset_Type(254, 0); + CDB_Set_Clue_Asset_Type(255, 0); + CDB_Set_Clue_Asset_Type(256, 0); + CDB_Set_Clue_Asset_Type(257, 1); + CDB_Set_Clue_Asset_Type(258, 0); + CDB_Set_Clue_Asset_Type(259, 0); + CDB_Set_Clue_Asset_Type(260, 0); + CDB_Set_Clue_Asset_Type(261, 0); + CDB_Set_Clue_Asset_Type(262, 0); + CDB_Set_Clue_Asset_Type(263, 0); + CDB_Set_Clue_Asset_Type(264, 3); + CDB_Set_Clue_Asset_Type(265, 3); + CDB_Set_Clue_Asset_Type(269, 2); + CDB_Set_Clue_Asset_Type(270, 2); + CDB_Set_Clue_Asset_Type(271, 2); + CDB_Set_Clue_Asset_Type(272, 2); + CDB_Set_Clue_Asset_Type(162, 2); + CDB_Set_Clue_Asset_Type(163, 2); + CDB_Set_Clue_Asset_Type(164, 2); + CDB_Set_Clue_Asset_Type(165, 2); + CDB_Set_Clue_Asset_Type(168, 2); + CDB_Set_Clue_Asset_Type(169, 2); + CDB_Set_Clue_Asset_Type(174, 2); + CDB_Set_Clue_Asset_Type(175, 2); + CDB_Set_Clue_Asset_Type(273, 2); + CDB_Set_Clue_Asset_Type(274, 0); + CDB_Set_Clue_Asset_Type(275, 0); + CDB_Set_Clue_Asset_Type(276, 0); + CDB_Set_Clue_Asset_Type(277, 0); + CDB_Set_Clue_Asset_Type(156, 2); + CDB_Set_Clue_Asset_Type(157, 2); + CDB_Set_Clue_Asset_Type(158, 2); + CDB_Set_Clue_Asset_Type(278, 2); + CDB_Set_Clue_Asset_Type(279, 2); + CDB_Set_Clue_Asset_Type(280, 2); + CDB_Set_Clue_Asset_Type(283, 2); + CDB_Set_Clue_Asset_Type(284, 2); + CDB_Set_Clue_Asset_Type(285, 2); + CDB_Set_Clue_Asset_Type(286, 2); + CDB_Set_Clue_Asset_Type(287, 2); + CDB_Set_Clue_Asset_Type(125, 3); +} + +void ScriptInit::Init_Spinner() { + Spinner_Set_Selectable_Destination_Flag(0, 1); + Spinner_Set_Selectable_Destination_Flag(1, 1); + Spinner_Set_Selectable_Destination_Flag(2, 1); + Spinner_Set_Selectable_Destination_Flag(3, 0); + Spinner_Set_Selectable_Destination_Flag(4, 0); + Spinner_Set_Selectable_Destination_Flag(5, 0); + Spinner_Set_Selectable_Destination_Flag(6, 0); + Spinner_Set_Selectable_Destination_Flag(7, 0); + Spinner_Set_Selectable_Destination_Flag(8, 0); + Spinner_Set_Selectable_Destination_Flag(9, 0); +} + +void ScriptInit::Init_Actor_Friendliness() { + Actor_Set_Friendliness_To_Other(1, 0, 65); + Actor_Set_Friendliness_To_Other(1, 4, 60); + Actor_Set_Friendliness_To_Other(1, 11, 30); + Actor_Set_Friendliness_To_Other(1, 15, 35); + Actor_Set_Friendliness_To_Other(1, 23, 65); + Actor_Set_Friendliness_To_Other(1, 24, 65); + Actor_Set_Friendliness_To_Other(1, 28, 70); + Actor_Set_Friendliness_To_Other(1, 30, 65); + Actor_Set_Friendliness_To_Other(1, 34, 80); + Actor_Set_Friendliness_To_Other(1, 53, 65); + Actor_Set_Friendliness_To_Other(2, 1, 45); + Actor_Set_Friendliness_To_Other(2, 4, 65); + Actor_Set_Friendliness_To_Other(2, 11, 70); + Actor_Set_Friendliness_To_Other(2, 12, 75); + Actor_Set_Friendliness_To_Other(2, 15, 30); + Actor_Set_Friendliness_To_Other(2, 19, 80); + Actor_Set_Friendliness_To_Other(2, 23, 40); + Actor_Set_Friendliness_To_Other(2, 24, 40); + Actor_Set_Friendliness_To_Other(2, 28, 70); + Actor_Set_Friendliness_To_Other(2, 53, 40); + Actor_Set_Friendliness_To_Other(4, 1, 75); + Actor_Set_Friendliness_To_Other(4, 2, 70); + Actor_Set_Friendliness_To_Other(4, 11, 40); + Actor_Set_Friendliness_To_Other(4, 12, 55); + Actor_Set_Friendliness_To_Other(4, 15, 40); + Actor_Set_Friendliness_To_Other(4, 19, 45); + Actor_Set_Friendliness_To_Other(4, 23, 55); + Actor_Set_Friendliness_To_Other(4, 24, 55); + Actor_Set_Friendliness_To_Other(4, 28, 60); + Actor_Set_Friendliness_To_Other(4, 30, 60); + Actor_Set_Friendliness_To_Other(4, 34, 60); + Actor_Set_Friendliness_To_Other(4, 53, 65); + Actor_Set_Friendliness_To_Other(5, 0, 63); + Actor_Set_Friendliness_To_Other(6, 0, 50); + Actor_Set_Friendliness_To_Other(11, 1, 30); + Actor_Set_Friendliness_To_Other(11, 2, 70); + Actor_Set_Friendliness_To_Other(11, 4, 30); + Actor_Set_Friendliness_To_Other(11, 12, 55); + Actor_Set_Friendliness_To_Other(11, 15, 60); + Actor_Set_Friendliness_To_Other(11, 19, 70); + Actor_Set_Friendliness_To_Other(11, 23, 30); + Actor_Set_Friendliness_To_Other(11, 24, 30); + Actor_Set_Friendliness_To_Other(11, 28, 65); + Actor_Set_Friendliness_To_Other(11, 53, 30); + Actor_Set_Friendliness_To_Other(12, 2, 75); + Actor_Set_Friendliness_To_Other(12, 4, 40); + Actor_Set_Friendliness_To_Other(12, 11, 35); + Actor_Set_Friendliness_To_Other(12, 15, 40); + Actor_Set_Friendliness_To_Other(12, 19, 65); + Actor_Set_Friendliness_To_Other(12, 23, 40); + Actor_Set_Friendliness_To_Other(12, 24, 40); + Actor_Set_Friendliness_To_Other(12, 28, 70); + Actor_Set_Friendliness_To_Other(12, 53, 45); + Actor_Set_Friendliness_To_Other(15, 1, 55); + Actor_Set_Friendliness_To_Other(15, 2, 40); + Actor_Set_Friendliness_To_Other(15, 4, 40); + Actor_Set_Friendliness_To_Other(15, 11, 35); + Actor_Set_Friendliness_To_Other(15, 12, 40); + Actor_Set_Friendliness_To_Other(15, 19, 40); + Actor_Set_Friendliness_To_Other(15, 23, 60); + Actor_Set_Friendliness_To_Other(15, 24, 60); + Actor_Set_Friendliness_To_Other(15, 28, 65); + Actor_Set_Friendliness_To_Other(15, 53, 65); + Actor_Set_Friendliness_To_Other(19, 1, 45); + Actor_Set_Friendliness_To_Other(19, 2, 90); + Actor_Set_Friendliness_To_Other(19, 4, 55); + Actor_Set_Friendliness_To_Other(19, 11, 65); + Actor_Set_Friendliness_To_Other(19, 12, 60); + Actor_Set_Friendliness_To_Other(19, 15, 35); + Actor_Set_Friendliness_To_Other(19, 23, 35); + Actor_Set_Friendliness_To_Other(19, 24, 35); + Actor_Set_Friendliness_To_Other(19, 28, 60); + Actor_Set_Friendliness_To_Other(19, 53, 35); + Actor_Set_Friendliness_To_Other(23, 1, 75); + Actor_Set_Friendliness_To_Other(23, 4, 75); + Actor_Set_Friendliness_To_Other(23, 11, 35); + Actor_Set_Friendliness_To_Other(23, 12, 45); + Actor_Set_Friendliness_To_Other(23, 15, 40); + Actor_Set_Friendliness_To_Other(23, 24, 80); + Actor_Set_Friendliness_To_Other(23, 28, 70); + Actor_Set_Friendliness_To_Other(23, 30, 85); + Actor_Set_Friendliness_To_Other(23, 34, 85); + Actor_Set_Friendliness_To_Other(23, 53, 85); + Actor_Set_Friendliness_To_Other(24, 1, 75); + Actor_Set_Friendliness_To_Other(24, 4, 75); + Actor_Set_Friendliness_To_Other(24, 11, 35); + Actor_Set_Friendliness_To_Other(24, 12, 45); + Actor_Set_Friendliness_To_Other(24, 15, 40); + Actor_Set_Friendliness_To_Other(24, 23, 80); + Actor_Set_Friendliness_To_Other(24, 28, 65); + Actor_Set_Friendliness_To_Other(24, 30, 80); + Actor_Set_Friendliness_To_Other(24, 34, 85); + Actor_Set_Friendliness_To_Other(24, 53, 85); + Actor_Set_Friendliness_To_Other(28, 0, 60); + Actor_Set_Friendliness_To_Other(28, 1, 60); + Actor_Set_Friendliness_To_Other(28, 2, 65); + Actor_Set_Friendliness_To_Other(28, 4, 65); + Actor_Set_Friendliness_To_Other(28, 12, 65); + Actor_Set_Friendliness_To_Other(28, 15, 40); + Actor_Set_Friendliness_To_Other(28, 19, 65); + Actor_Set_Friendliness_To_Other(28, 23, 70); + Actor_Set_Friendliness_To_Other(28, 24, 70); + Actor_Set_Friendliness_To_Other(28, 53, 70); + Actor_Set_Friendliness_To_Other(30, 1, 70); + Actor_Set_Friendliness_To_Other(30, 4, 75); + Actor_Set_Friendliness_To_Other(30, 11, 35); + Actor_Set_Friendliness_To_Other(30, 23, 70); + Actor_Set_Friendliness_To_Other(30, 24, 70); + Actor_Set_Friendliness_To_Other(30, 34, 65); + Actor_Set_Friendliness_To_Other(30, 53, 70); + Actor_Set_Friendliness_To_Other(34, 0, 70); + Actor_Set_Friendliness_To_Other(34, 1, 70); + Actor_Set_Friendliness_To_Other(34, 4, 80); + Actor_Set_Friendliness_To_Other(34, 11, 35); + Actor_Set_Friendliness_To_Other(34, 23, 70); + Actor_Set_Friendliness_To_Other(34, 24, 70); + Actor_Set_Friendliness_To_Other(34, 30, 65); + Actor_Set_Friendliness_To_Other(34, 53, 70); + Actor_Set_Friendliness_To_Other(53, 1, 70); + Actor_Set_Friendliness_To_Other(53, 4, 65); + Actor_Set_Friendliness_To_Other(53, 11, 35); + Actor_Set_Friendliness_To_Other(53, 15, 35); + Actor_Set_Friendliness_To_Other(53, 23, 70); + Actor_Set_Friendliness_To_Other(53, 24, 65); + Actor_Set_Friendliness_To_Other(53, 28, 80); + Actor_Set_Friendliness_To_Other(53, 30, 70); + Actor_Set_Friendliness_To_Other(53, 34, 70); +} + +void ScriptInit::Init_Actor_Combat_Aggressiveness() { + Actor_Set_Combat_Aggressiveness(4, 50); + Actor_Set_Combat_Aggressiveness(14, 50); + Actor_Set_Combat_Aggressiveness(17, 50); + Actor_Set_Combat_Aggressiveness(19, 90); + Actor_Set_Combat_Aggressiveness(2, 50); + Actor_Set_Combat_Aggressiveness(6, 0); + Actor_Set_Combat_Aggressiveness(7, 70); + Actor_Set_Combat_Aggressiveness(3, 60); + Actor_Set_Combat_Aggressiveness(1, 70); + Actor_Set_Combat_Aggressiveness(8, 80); + Actor_Set_Combat_Aggressiveness(5, 75); + Actor_Set_Combat_Aggressiveness(23, 70); + Actor_Set_Combat_Aggressiveness(24, 60); + Actor_Set_Combat_Aggressiveness(70, 40); + Actor_Set_Combat_Aggressiveness(71, 30); + Actor_Set_Combat_Aggressiveness(72, 30); + Actor_Set_Combat_Aggressiveness(64, 100); +} + +void ScriptInit::Init_Actor_Honesty() { + Actor_Set_Honesty(19, 90); +} + +void ScriptInit::Init_Actor_Intelligence() { + Actor_Set_Intelligence(19, 20); + Actor_Set_Intelligence(2, 70); + Actor_Set_Intelligence(6, 60); + Actor_Set_Intelligence(7, 75); + Actor_Set_Intelligence(3, 80); + Actor_Set_Intelligence(1, 80); + Actor_Set_Intelligence(8, 80); + Actor_Set_Intelligence(5, 100); + Actor_Set_Intelligence(23, 50); + Actor_Set_Intelligence(24, 40); + Actor_Set_Intelligence(70, 40); + Actor_Set_Intelligence(71, 20); + Actor_Set_Intelligence(72, 30); + Actor_Set_Intelligence(64, 10); +} + +void ScriptInit::Init_Actor_Stability() { + Actor_Set_Stability(19, 35); +} + +void ScriptInit::Init_Actor_Health() { + Actor_Set_Health(0, 50, 50); + Actor_Set_Health(1, 50, 50); + Actor_Set_Health(2, 50, 50); + Actor_Set_Health(3, 50, 50); + Actor_Set_Health(4, 50, 50); + Actor_Set_Health(5, 50, 50); + Actor_Set_Health(6, 50, 50); + Actor_Set_Health(7, 50, 50); + Actor_Set_Health(8, 50, 50); + Actor_Set_Health(9, 50, 50); + Actor_Set_Health(10, 50, 50); + Actor_Set_Health(11, 50, 50); + Actor_Set_Health(12, 50, 50); + Actor_Set_Health(13, 50, 50); + Actor_Set_Health(14, 50, 50); + Actor_Set_Health(15, 50, 50); + Actor_Set_Health(16, 50, 50); + Actor_Set_Health(17, 50, 50); + Actor_Set_Health(18, 50, 50); + Actor_Set_Health(19, 50, 50); + Actor_Set_Health(20, 50, 50); + Actor_Set_Health(21, 50, 50); + Actor_Set_Health(22, 50, 50); + Actor_Set_Health(23, 50, 50); + Actor_Set_Health(24, 50, 50); + Actor_Set_Health(25, 50, 50); + Actor_Set_Health(26, 50, 50); + Actor_Set_Health(27, 50, 50); + Actor_Set_Health(28, 50, 50); + Actor_Set_Health(29, 50, 50); + Actor_Set_Health(30, 50, 50); + Actor_Set_Health(31, 50, 50); + Actor_Set_Health(32, 50, 50); + Actor_Set_Health(33, 50, 50); + Actor_Set_Health(34, 50, 50); + Actor_Set_Health(35, 50, 50); + Actor_Set_Health(36, 50, 50); + Actor_Set_Health(37, 50, 50); + Actor_Set_Health(38, 50, 50); + Actor_Set_Health(40, 50, 50); + Actor_Set_Health(41, 50, 50); + Actor_Set_Health(42, 50, 50); + Actor_Set_Health(43, 50, 50); + Actor_Set_Health(44, 50, 50); + Actor_Set_Health(45, 50, 50); + Actor_Set_Health(46, 50, 50); + Actor_Set_Health(47, 50, 50); + Actor_Set_Health(48, 50, 50); + Actor_Set_Health(49, 50, 50); + Actor_Set_Health(50, 50, 50); + Actor_Set_Health(51, 50, 50); + Actor_Set_Health(52, 50, 50); + Actor_Set_Health(53, 50, 50); + Actor_Set_Health(54, 50, 50); + Actor_Set_Health(55, 50, 50); + Actor_Set_Health(56, 50, 50); + Actor_Set_Health(57, 50, 50); + Actor_Set_Health(58, 50, 50); + Actor_Set_Health(59, 50, 50); + Actor_Set_Health(62, 50, 50); + Actor_Set_Health(66, 50, 50); + Actor_Set_Health(67, 50, 50); + Actor_Set_Health(68, 50, 50); + Actor_Set_Health(69, 50, 50); + Actor_Set_Health(19, 80, 80); + Actor_Set_Health(2, 40, 40); + Actor_Set_Health(6, 20, 20); + Actor_Set_Health(7, 50, 50); + Actor_Set_Health(3, 60, 60); + Actor_Set_Health(1, 60, 60); + Actor_Set_Health(8, 60, 60); + Actor_Set_Health(5, 90, 90); + Actor_Set_Health(23, 40, 40); + Actor_Set_Health(24, 50, 50); + Actor_Set_Health(70, 30, 30); + Actor_Set_Health(71, 50, 50); + Actor_Set_Health(72, 20, 20); + Actor_Set_Health(64, 20, 20); + Actor_Set_Health(65, 20, 20); + if (Game_Flag_Query(45) == 1) { + Actor_Set_Health(2, 60, 60); + } + if (Game_Flag_Query(46) == 1) { + Actor_Set_Health(6, 40, 40); + } + if (Game_Flag_Query(44) == 1) { + Actor_Set_Health(7, 65, 65); + } + if (Game_Flag_Query(47) == 1) { + Actor_Set_Health(3, 70, 70); + } + if (Game_Flag_Query(48) == 1) { + Actor_Set_Health(8, 80, 80); + } +} + +void ScriptInit::Init_Combat_Cover_Waypoints() { + Combat_Cover_Waypoint_Set_Data(0, 0, 7, 25, -603.0f, 0.0f, 32.0f); + Combat_Cover_Waypoint_Set_Data(1, 0, 7, 25, -670.0f, 0.0f, -24.0f); + Combat_Cover_Waypoint_Set_Data(2, 0, 7, 25, -604.0f, 0.0f, -96.0f); + Combat_Cover_Waypoint_Set_Data(3, 0, 7, 25, -490.0f, 0.0f, -20.0f); + Combat_Cover_Waypoint_Set_Data(4, 0, 7, 25, -667.0f, 0.0f, -164.0f); + Combat_Cover_Waypoint_Set_Data(5, 0, 7, 25, -606.0f, 0.0f, -222.0f); + Combat_Cover_Waypoint_Set_Data(6, 0, 7, 25, -534.0f, 0.0f, -170.0f); + Combat_Cover_Waypoint_Set_Data(7, 3, 54, 54, 76.06f, 23.83f, -1058.49f); + Combat_Cover_Waypoint_Set_Data(8, 3, 54, 54, -335.94f, 31.55f, -1406.49f); + Combat_Cover_Waypoint_Set_Data(9, 15, 42, 39, 286.0f, 367.93f, 330.0f); + Combat_Cover_Waypoint_Set_Data(10, 15, 42, 39, -58.0f, 367.93f, 294.0f); + Combat_Cover_Waypoint_Set_Data(11, 4, 37, 34, -30.0f, 8.0f, -759.0f); + Combat_Cover_Waypoint_Set_Data(12, 4, 37, 34, -93.0f, 8.0f, -693.0f); + Combat_Cover_Waypoint_Set_Data(13, 4, 37, 34, -6.0f, 8.0f, -607.0f); + Combat_Cover_Waypoint_Set_Data(14, 4, 37, 34, 78.0f, 8.0f, -687.0f); + Combat_Cover_Waypoint_Set_Data(15, 4, 37, 34, 262.0f, 8.0f, -683.0f); + Combat_Cover_Waypoint_Set_Data(16, 4, 37, 34, 334.0f, 8.0f, -607.0f); + Combat_Cover_Waypoint_Set_Data(17, 4, 37, 34, 426.0f, 8.0f, -679.0f); + Combat_Cover_Waypoint_Set_Data(18, 5, 4, 24, -318.0f, -6.5f, 1117.0f); + Combat_Cover_Waypoint_Set_Data(19, 5, 4, 24, -330.0f, -6.5f, 981.0f); + Combat_Cover_Waypoint_Set_Data(20, 5, 4, 24, -294.0f, -6.5f, 725.0f); + Combat_Cover_Waypoint_Set_Data(21, 16, 84, 96, 380.0f, -126.21f, 198.0f); + Combat_Cover_Waypoint_Set_Data(22, 16, 84, 96, 364.0f, -126.21f, -66.0f); + Combat_Cover_Waypoint_Set_Data(23, 18, 70, 80, 8.0f, 1.72f, 8.0f); + Combat_Cover_Waypoint_Set_Data(24, 18, 70, 80, 188.0f, 1.72f, 92.0f); + Combat_Cover_Waypoint_Set_Data(25, 18, 70, 80, 216.0f, -4.01f, 196.0f); + Combat_Cover_Waypoint_Set_Data(26, 18, 70, 80, -420.0f, 1.72f, 100.0f); + Combat_Cover_Waypoint_Set_Data(27, 18, 70, 80, -672.0f, 1.72f, -44.0f); + Combat_Cover_Waypoint_Set_Data(28, 10, 78, 90, -128.77f, -5.21f, -435.0f); + Combat_Cover_Waypoint_Set_Data(29, 10, 78, 90, -20.77f, 0.81f, -199.0f); + Combat_Cover_Waypoint_Set_Data(30, 10, 77, 89, -216.0f, 39.15f, -819.0f); + Combat_Cover_Waypoint_Set_Data(31, 10, 77, 89, 144.0f, -1.74f, -1015.0f); + Combat_Cover_Waypoint_Set_Data(32, 10, 77, 89, 152.0f, 4.14f, -811.0f); + Combat_Cover_Waypoint_Set_Data(33, 10, 79, 91, -121.0f, 0.0f, -39.0f); + Combat_Cover_Waypoint_Set_Data(34, 10, 80, 92, 86.0f, -12.21f, -278.0f); + Combat_Cover_Waypoint_Set_Data(35, 20, 41, 38, 407.82f, 40.63f, 95.25f); + Combat_Cover_Waypoint_Set_Data(36, 20, 41, 38, 357.81f, 40.63f, 387.9f); +} + +void ScriptInit::Init_Combat_Flee_Waypoints() { + Combat_Flee_Waypoint_Set_Data(0, 4, 37, 34, 187.0f, 8.0f, -197.0f, -1); + Combat_Flee_Waypoint_Set_Data(1, 4, 37, 34, 454.0f, 8.0f, -717.0f, -1); + Combat_Flee_Waypoint_Set_Data(2, 4, 38, 35, -10.87f, 47.76f, -141.32f, -1); + Combat_Flee_Waypoint_Set_Data(3, 4, 38, 35, 466.0f, 47.76f, -532.0f, -1); + Combat_Flee_Waypoint_Set_Data(4, 4, 39, 36, 199.0f, 47.76f, -880.0f, -1); + Combat_Flee_Waypoint_Set_Data(5, 4, 39, 36, 594.0f, 47.76f, -1141.0f, -1); + Combat_Flee_Waypoint_Set_Data(6, 4, 39, 36, 912.0f, 47.76f, -447.0f, -1); + Combat_Flee_Waypoint_Set_Data(7, 4, 39, 36, 492.0f, 47.76f, -459.0f, -1); + Combat_Flee_Waypoint_Set_Data(8, 1, 20, 2, 271.0f, 0.0f, 1038.0f, -1); + Combat_Flee_Waypoint_Set_Data(9, 1, 20, 2, -175.0f, 9.04f, 8.59f, -1); + Combat_Flee_Waypoint_Set_Data(10, 1, 20, 2, -343.05f, 9.04f, 260.0f, -1); + Combat_Flee_Waypoint_Set_Data(11, 0, 7, 25, -443.0f, -0.04f, -180.0f, -1); + Combat_Flee_Waypoint_Set_Data(12, 0, 7, 26, -1485.0f, 6.98f, -393.0f, -1); + Combat_Flee_Waypoint_Set_Data(13, 0, 7, 28, -652.0f, 7.18f, 354.0f, -1); + Combat_Flee_Waypoint_Set_Data(14, 6, 49, 48, 25.0f, 0.0f, -314.0f, -1); + Combat_Flee_Waypoint_Set_Data(15, 6, 49, 48, 980.0f, 0.0f, 189.0f, -1); + Combat_Flee_Waypoint_Set_Data(16, 6, 49, 48, 601.0f, 0.0f, -1641.0f, -1); + Combat_Flee_Waypoint_Set_Data(17, 12, 80, 92, 218.0f, -12.21f, -290.0f, -1); + Combat_Flee_Waypoint_Set_Data(18, 12, 80, 92, -150.0f, -12.21f, -962.0f, -1); + Combat_Flee_Waypoint_Set_Data(19, 13, 81, 93, -524.0f, 0.0f, -172.0f, -1); + Combat_Flee_Waypoint_Set_Data(20, 13, 81, 93, -427.0f, 0.0f, 199.0f, -1); + Combat_Flee_Waypoint_Set_Data(21, 13, 81, 93, -121.0f, 0.0f, -145.0f, -1); + Combat_Flee_Waypoint_Set_Data(22, 14, 83, 95, 2.0f, 1.15f, 412.0f, -1); + Combat_Flee_Waypoint_Set_Data(23, 14, 83, 95, -327.0f, 1.15f, -384.0f, -1); + Combat_Flee_Waypoint_Set_Data(24, 14, 83, 95, -253.0f, 81.33f, -620.0f, -1); + Combat_Flee_Waypoint_Set_Data(25, 5, 28, 17, -518.52f, -109.91f, 312.0f, -1); + Combat_Flee_Waypoint_Set_Data(26, 5, 28, 17, 141.0f, -109.91f, 452.0f, -1); + Combat_Flee_Waypoint_Set_Data(27, 5, 33, 23, 516.0f, 0.56f, 779.0f, -1); + Combat_Flee_Waypoint_Set_Data(28, 5, 33, 23, 388.0f, 9.68f, 190.0f, -1); + Combat_Flee_Waypoint_Set_Data(29, 5, 33, 23, -429.0f, 9.68f, -115.0f, -1); + Combat_Flee_Waypoint_Set_Data(30, 7, 68, 77, -997.0f, 508.14f, -630.84f, -1); + Combat_Flee_Waypoint_Set_Data(31, 7, 68, 77, -416.27f, 508.14f, -574.84f, -1); + Combat_Flee_Waypoint_Set_Data(32, 7, 68, 77, -416.0f, 508.14f, -906.84f, -1); + Combat_Flee_Waypoint_Set_Data(33, 7, 68, 77, -1168.0f, 508.14f, -1666.84f, -1); + Combat_Flee_Waypoint_Set_Data(34, 10, 79, 91, 75.0f, 153.0f, -485.0f, -1); + Combat_Flee_Waypoint_Set_Data(35, 10, 79, 91, -18.0f, 0.0f, 321.0f, -1); + Combat_Flee_Waypoint_Set_Data(36, 11, 74, 86, -190.0f, -50.13f, -298.0f, -1); + Combat_Flee_Waypoint_Set_Data(37, 11, 74, 86, 126.0f, -50.13f, -150.0f, -1); + Combat_Flee_Waypoint_Set_Data(38, 11, 74, 86, 187.78f, -50.13f, -1262.0f, -1); + Combat_Flee_Waypoint_Set_Data(39, 11, 74, 86, -20.22f, -30.13f, -2338.3f, -1); + Combat_Flee_Waypoint_Set_Data(40, 3, 54, 54, -416.0f, 31.55f, -829.0f, -1); + Combat_Flee_Waypoint_Set_Data(41, 3, 54, 54, -412.0f, 31.55f, -1357.0f, -1); + Combat_Flee_Waypoint_Set_Data(42, 3, 54, 54, -208.0f, 23.0f, -1693.0f, -1); + Combat_Flee_Waypoint_Set_Data(43, 3, 54, 54, -64.0f, 23.83f, -2097.0f, -1); + Combat_Flee_Waypoint_Set_Data(44, 3, 54, 54, 320.0f, 23.83f, -1058.49f, -1); + Combat_Flee_Waypoint_Set_Data(45, 3, 54, 54, 252.0f, 31.65f, -674.49f, -1); + Combat_Flee_Waypoint_Set_Data(46, 8, 45, 42, -803.0f, -615.49f, 2619.0f, -1); + Combat_Flee_Waypoint_Set_Data(47, 8, 45, 42, -1027.0f, -614.49f, 3151.24f, -1); + Combat_Flee_Waypoint_Set_Data(48, 9, 9, 45, -1190.0f, 0.0f, 876.0f, -1); + Combat_Flee_Waypoint_Set_Data(49, 9, 9, 45, -687.0f, 0.0f, 910.0f, -1); + Combat_Flee_Waypoint_Set_Data(50, 9, 9, 46, -455.0f, 8.26f, -453.26f, -1); + Combat_Flee_Waypoint_Set_Data(51, 9, 9, 46, -1127.0f, 8.26f, -705.26f, -1); + Combat_Flee_Waypoint_Set_Data(52, 9, 9, 46, -1143.0f, 8.26f, -261.26f, -1); + Combat_Flee_Waypoint_Set_Data(53, 9, 9, 46, -703.0f, 8.26f, -157.26f, -1); + Combat_Flee_Waypoint_Set_Data(54, 10, 77, 89, 166.0f, 11.87f, -250.8f, -1); + Combat_Flee_Waypoint_Set_Data(55, 10, 77, 89, 158.0f, 4.14f, -10.8f, -1); + Combat_Flee_Waypoint_Set_Data(56, 10, 77, 89, -310.0f, 39.15f, -822.0f, -1); + Combat_Flee_Waypoint_Set_Data(57, 10, 77, 89, -302.0f, -1.74f, -5847.0f, -1); + Combat_Flee_Waypoint_Set_Data(58, 10, 78, 90, 4.0f, 1.37f, -3684.0f, -1); + Combat_Flee_Waypoint_Set_Data(59, 10, 78, 90, 146.28f, -6.05f, -135.93f, -1); + Combat_Flee_Waypoint_Set_Data(60, 7, 53, 53, 212.0f, -162.8f, -108.0f, -1); + Combat_Flee_Waypoint_Set_Data(61, 7, 53, 53, -28.0f, -162.8f, -104.0f, -1); + Combat_Flee_Waypoint_Set_Data(62, 7, 53, 53, 504.0f, -162.8f, 224.0f, -1); + Combat_Flee_Waypoint_Set_Data(63, 7, 53, 53, -301.0f, -162.8f, 275.0f, -1); + Combat_Flee_Waypoint_Set_Data(64, 15, 42, 39, 98.0f, 367.93f, -10.0f, -1); + Combat_Flee_Waypoint_Set_Data(65, 15, 42, 39, -206.0f, 367.69f, 386.0f, -1); + Combat_Flee_Waypoint_Set_Data(66, 5, 4, 24, -190.0f, -6.5f, 789.0f, -1); + Combat_Flee_Waypoint_Set_Data(67, 5, 4, 24, 123.0f, -6.5f, 1002.0f, -1); + Combat_Flee_Waypoint_Set_Data(68, 5, 4, 24, -573.0f, -6.5f, 1202.0f, -1); + Combat_Flee_Waypoint_Set_Data(69, 16, 84, 96, 120.0f, -126.21f, -350.0f, -1); + Combat_Flee_Waypoint_Set_Data(70, 16, 84, 96, 524.0f, -126.21f, 158.0f, -1); + Combat_Flee_Waypoint_Set_Data(71, 16, 84, 96, 276.0f, -126.21f, 537.0f, -1); + Combat_Flee_Waypoint_Set_Data(72, 17, 86, 98, -334.7f, 12.97f, -332.0f, -1); + Combat_Flee_Waypoint_Set_Data(73, 18, 70, 80, -672.0f, 1.72f, -96.0f, -1); + Combat_Flee_Waypoint_Set_Data(74, 18, 70, 80, -552.0f, -4.01f, 268.0f, -1); + Combat_Flee_Waypoint_Set_Data(75, 18, 70, 80, 293.06f, 1.72f, 112.25f, -1); + Combat_Flee_Waypoint_Set_Data(76, 20, 41, 38, 435.13f, 37.18f, -292.34f, -1); +} + +void ScriptInit::Init_Shadows() { + int list[] = {440, 37, 38, 83, 874}; + Disable_Shadows(list, 5); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/init.h b/engines/bladerunner/script/init.h new file mode 100644 index 0000000000..7b95008abb --- /dev/null +++ b/engines/bladerunner/script/init.h @@ -0,0 +1,62 @@ +/* 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_SCRIPT_INIT_H +#define BLADERUNNER_SCRIPT_INIT_H + +#include "bladerunner/script/script.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ScriptInit : ScriptBase { +public: + ScriptInit(BladeRunnerEngine *vm) + : ScriptBase(vm) { + } + + void SCRIPT_Initialize_Game(); + +private: + void Init_Globals(); + void Init_Game_Flags(); + void Init_Clues(); + void Init_Clues2(); + void Init_World_Waypoints(); + void Init_SDB(); + void Init_CDB(); + void Init_Spinner(); + void Init_Actor_Friendliness(); + void Init_Actor_Combat_Aggressiveness(); + void Init_Actor_Honesty(); + void Init_Actor_Intelligence(); + void Init_Actor_Stability(); + void Init_Actor_Health(); + void Init_Combat_Cover_Waypoints(); + void Init_Combat_Flee_Waypoints(); + void Init_Shadows(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/script/kia.cpp b/engines/bladerunner/script/kia.cpp new file mode 100644 index 0000000000..587e25d940 --- /dev/null +++ b/engines/bladerunner/script/kia.cpp @@ -0,0 +1,951 @@ +/* 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/script/kia.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +void ScriptKIA::SCRIPT_KIA_DLL_Play_Clue_Asset_Script(int a1, int clueId) { + int v1; + switch (clueId) { + case 0: + KIA_Play_Actor_Dialogue(23, 40); + break; + case 2: + KIA_Play_Actor_Dialogue(23, 0); + break; + case 3: + KIA_Play_Actor_Dialogue(99, 1970); + KIA_Play_Actor_Dialogue(99, 1980); + KIA_Play_Actor_Dialogue(99, 1990); + break; + case 4: + KIA_Play_Actor_Dialogue(99, 1970); + KIA_Play_Actor_Dialogue(99, 1980); + KIA_Play_Actor_Dialogue(99, 1990); + break; + case 5: + KIA_Play_Slice_Model(966); + KIA_Play_Actor_Dialogue(99, 1960); + break; + case 6: + KIA_Play_Slice_Model(933); + break; + case 7: + KIA_Play_Slice_Model(971); + break; + case 8: + KIA_Play_Slice_Model(937); + KIA_Play_Actor_Dialogue(99, 2010); + break; + case 9: + KIA_Play_Photograph(6); + KIA_Play_Actor_Dialogue(99, 2020); + KIA_Play_Actor_Dialogue(99, 2030); + KIA_Play_Actor_Dialogue(99, 2040); + break; + case 10: + KIA_Play_Actor_Dialogue(30, 140); + break; + case 11: + KIA_Play_Actor_Dialogue(30, 50); + KIA_Play_Actor_Dialogue(30, 60); + KIA_Play_Actor_Dialogue(30, 70); + KIA_Play_Actor_Dialogue(30, 80); + KIA_Play_Actor_Dialogue(30, 90); + break; + case 12: + KIA_Play_Slice_Model(975); + break; + case 13: + KIA_Play_Photograph(5); + break; + case 14: + KIA_Play_Photograph(4); + KIA_Play_Actor_Dialogue(99, 4050); + break; + case 15: + KIA_Play_Slice_Model(964); + KIA_Play_Actor_Dialogue(15, 280); + KIA_Play_Actor_Dialogue(15, 290); + break; + case 16: + KIA_Play_Actor_Dialogue(23, 100); + break; + case 17: + KIA_Play_Actor_Dialogue(23, 120); + KIA_Play_Actor_Dialogue(23, 130); + break; + case 19: + KIA_Play_Actor_Dialogue(0, 380); + KIA_Play_Actor_Dialogue(19, 30); + KIA_Play_Actor_Dialogue(19, 40); + KIA_Play_Actor_Dialogue(0, 410); + KIA_Play_Actor_Dialogue(19, 50); + break; + case 20: + KIA_Play_Photograph(33); + KIA_Play_Actor_Dialogue(99, 350); + break; + case 21: + KIA_Play_Actor_Dialogue(12, 10); + break; + case 22: + KIA_Play_Actor_Dialogue(15, 40); + KIA_Play_Actor_Dialogue(15, 50); + KIA_Play_Actor_Dialogue(0, 4565); + KIA_Play_Actor_Dialogue(15, 60); + break; + case 23: + KIA_Play_Actor_Dialogue(15, 250); + KIA_Play_Actor_Dialogue(15, 270); + break; + case 24: + KIA_Play_Actor_Dialogue(15, 260); + KIA_Play_Actor_Dialogue(15, 270); + break; + case 25: + KIA_Play_Actor_Dialogue(0, 295); + KIA_Play_Actor_Dialogue(28, 90); + KIA_Play_Actor_Dialogue(28, 100); + break; + case 26: + KIA_Play_Actor_Dialogue(99, 1880); + KIA_Play_Actor_Dialogue(99, 1890); + break; + case 27: + KIA_Play_Slice_Model(938); + break; + case 28: + KIA_Play_Photograph(11); + break; + case 29: + KIA_Play_Photograph(12); + break; + case 30: + KIA_Play_Photograph(10); + break; + case 31: + KIA_Play_Photograph(9); + break; + case 32: + KIA_Play_Slice_Model(987); + KIA_Play_Actor_Dialogue(0, 5870); + KIA_Play_Actor_Dialogue(4, 810); + KIA_Play_Actor_Dialogue(4, 820); + break; + case 33: + KIA_Play_Actor_Dialogue(53, 20); + KIA_Play_Actor_Dialogue(0, 680); + KIA_Play_Actor_Dialogue(53, 30); + break; + case 37: + KIA_Play_Slice_Model(952); + break; + case 39: + KIA_Play_Actor_Dialogue(30, 170); + KIA_Play_Actor_Dialogue(30, 180); + KIA_Play_Actor_Dialogue(30, 190); + KIA_Play_Actor_Dialogue(30, 200); + break; + case 40: + KIA_Play_Actor_Dialogue(38, 90); + KIA_Play_Actor_Dialogue(38, 100); + KIA_Play_Actor_Dialogue(38, 110); + KIA_Play_Actor_Dialogue(38, 120); + KIA_Play_Actor_Dialogue(38, 130); + KIA_Play_Actor_Dialogue(38, 140); + KIA_Play_Actor_Dialogue(38, 150); + break; + case 43: + KIA_Play_Actor_Dialogue(4, 30); + KIA_Play_Actor_Dialogue(4, 50); + KIA_Play_Actor_Dialogue(4, 70); + break; + case 44: + KIA_Play_Slice_Model(940); + KIA_Play_Actor_Dialogue(99, 2140); + KIA_Play_Actor_Dialogue(99, 2150); + KIA_Play_Actor_Dialogue(99, 2160); + break; + case 45: + KIA_Play_Slice_Model(975); + break; + case 46: + KIA_Play_Actor_Dialogue(0, 5140); + KIA_Play_Actor_Dialogue(17, 30); + KIA_Play_Actor_Dialogue(17, 40); + break; + case 47: + KIA_Play_Photograph(31); + KIA_Play_Actor_Dialogue(99, 2140); + KIA_Play_Actor_Dialogue(99, 2150); + KIA_Play_Actor_Dialogue(99, 2160); + break; + case 49: + KIA_Play_Slice_Model(974); + KIA_Play_Actor_Dialogue(99, 2320); + if (Game_Flag_Query(48)) { + KIA_Play_Actor_Dialogue(99, 2330); + KIA_Play_Actor_Dialogue(99, 2340); + } + KIA_Play_Actor_Dialogue(99, 2350); + break; + case 50: + KIA_Play_Actor_Dialogue(17, 100); + KIA_Play_Actor_Dialogue(17, 110); + KIA_Play_Actor_Dialogue(17, 120); + KIA_Play_Actor_Dialogue(17, 130); + break; + case 51: + KIA_Play_Actor_Dialogue(99, 2170); + KIA_Play_Actor_Dialogue(99, 2180); + KIA_Play_Actor_Dialogue(99, 2190); + KIA_Play_Actor_Dialogue(99, 2200); + break; + case 52: + KIA_Play_Actor_Dialogue(1, 2230); + KIA_Play_Actor_Dialogue(1, 2260); + KIA_Play_Actor_Dialogue(1, 2270); + KIA_Play_Actor_Dialogue(1, 2280); + break; + case 53: + KIA_Play_Slice_Model(955); + if (Query_Difficulty_Level() == 0) { + KIA_Play_Actor_Dialogue(99, 4140); + } else { + KIA_Play_Actor_Dialogue(99, 4150); + } + break; + case 54: + KIA_Play_Slice_Model(973); + KIA_Play_Actor_Dialogue(99, 4280); + KIA_Play_Actor_Dialogue(99, 4290); + break; + case 55: + KIA_Play_Slice_Model(973); + KIA_Play_Actor_Dialogue(99, 4280); + KIA_Play_Actor_Dialogue(99, 4300); + break; + case 56: + KIA_Play_Actor_Dialogue(16, 90); + KIA_Play_Actor_Dialogue(16, 100); + KIA_Play_Actor_Dialogue(16, 110); + KIA_Play_Actor_Dialogue(16, 120); + KIA_Play_Actor_Dialogue(16, 130); + break; + case 57: + KIA_Play_Actor_Dialogue(20, 90); + KIA_Play_Actor_Dialogue(20, 100); + break; + case 58: + KIA_Play_Actor_Dialogue(14, 320); + KIA_Play_Actor_Dialogue(14, 330); + KIA_Play_Actor_Dialogue(14, 340); + KIA_Play_Actor_Dialogue(14, 380); + KIA_Play_Actor_Dialogue(14, 390); + KIA_Play_Actor_Dialogue(14, 400); + break; + case 59: + KIA_Play_Actor_Dialogue(14, 320); + KIA_Play_Actor_Dialogue(14, 330); + KIA_Play_Actor_Dialogue(14, 410); + KIA_Play_Actor_Dialogue(14, 420); + KIA_Play_Actor_Dialogue(14, 440); + KIA_Play_Actor_Dialogue(14, 450); + break; + case 60: + KIA_Play_Actor_Dialogue(7, 210); + KIA_Play_Actor_Dialogue(7, 220); + KIA_Play_Actor_Dialogue(7, 240); + KIA_Play_Actor_Dialogue(7, 250); + break; + case 61: + KIA_Play_Actor_Dialogue(7, 750); + KIA_Play_Actor_Dialogue(7, 760); + KIA_Play_Actor_Dialogue(0, 5500); + KIA_Play_Actor_Dialogue(7, 780); + KIA_Play_Actor_Dialogue(7, 790); + break; + case 62: + KIA_Play_Slice_Model(963); + break; + case 63: + KIA_Play_Actor_Dialogue(14, 560); + KIA_Play_Actor_Dialogue(14, 570); + KIA_Play_Actor_Dialogue(14, 580); + break; + case 64: + KIA_Play_Actor_Dialogue(29, 120); + KIA_Play_Actor_Dialogue(29, 130); + break; + case 65: + KIA_Play_Slice_Model(942); + KIA_Play_Actor_Dialogue(99, 4160); + break; + case 66: + KIA_Play_Actor_Dialogue(99, 2430); + KIA_Play_Actor_Dialogue(99, 2440); + KIA_Play_Actor_Dialogue(99, 2450); + break; + case 67: + KIA_Play_Actor_Dialogue(52, 140); + KIA_Play_Actor_Dialogue(52, 150); + KIA_Play_Actor_Dialogue(52, 170); + KIA_Play_Actor_Dialogue(52, 180); + KIA_Play_Actor_Dialogue(52, 190); + break; + case 68: + KIA_Play_Actor_Dialogue(35, 20); + KIA_Play_Actor_Dialogue(35, 30); + KIA_Play_Actor_Dialogue(35, 40); + KIA_Play_Actor_Dialogue(35, 50); + break; + case 69: + KIA_Play_Actor_Dialogue(2, 1010); + KIA_Play_Actor_Dialogue(0, 6495); + KIA_Play_Actor_Dialogue(2, 1020); + KIA_Play_Actor_Dialogue(0, 6500); + KIA_Play_Actor_Dialogue(2, 1030); + break; + case 70: + KIA_Play_Actor_Dialogue(2, 1040); + KIA_Play_Actor_Dialogue(2, 1050); + KIA_Play_Actor_Dialogue(0, 6505); + KIA_Play_Actor_Dialogue(2, 1060); + KIA_Play_Actor_Dialogue(2, 1070); + KIA_Play_Actor_Dialogue(0, 6510); + KIA_Play_Actor_Dialogue(2, 1080); + break; + case 71: + KIA_Play_Actor_Dialogue(56, 0); + KIA_Play_Actor_Dialogue(56, 10); + KIA_Play_Actor_Dialogue(56, 20); + KIA_Play_Actor_Dialogue(56, 30); + KIA_Play_Actor_Dialogue(56, 40); + KIA_Play_Actor_Dialogue(56, 50); + break; + case 72: + KIA_Play_Actor_Dialogue(99, 80); + KIA_Play_Actor_Dialogue(99, 90); + break; + case 74: + KIA_Play_Actor_Dialogue(99, 4370); + KIA_Play_Actor_Dialogue(99, 4380); + KIA_Play_Actor_Dialogue(99, 4390); + KIA_Play_Actor_Dialogue(99, 4400); + break; + case 75: + KIA_Play_Slice_Model(956); + break; + case 76: + KIA_Play_Slice_Model(944); + KIA_Play_Actor_Dialogue(99, 850); + KIA_Play_Actor_Dialogue(99, 860); + KIA_Play_Actor_Dialogue(99, 870); + KIA_Play_Actor_Dialogue(99, 880); + break; + case 77: + KIA_Play_Photograph(25); + break; + case 78: + KIA_Play_Photograph(20); + break; + case 79: + KIA_Play_Actor_Dialogue(0, 220); + KIA_Play_Actor_Dialogue(16, 320); + KIA_Play_Actor_Dialogue(0, 225); + KIA_Play_Actor_Dialogue(16, 330); + KIA_Play_Actor_Dialogue(0, 230); + KIA_Play_Actor_Dialogue(16, 340); + break; + case 80: + KIA_Play_Slice_Model(965); + break; + case 81: + KIA_Play_Slice_Model(965); + break; + case 82: + KIA_Play_Actor_Dialogue(4, 520); + KIA_Play_Actor_Dialogue(4, 530); + KIA_Play_Actor_Dialogue(4, 540); + KIA_Play_Actor_Dialogue(4, 550); + break; + case 84: + KIA_Play_Slice_Model(970); + break; + case 85: + KIA_Play_Slice_Model(943); + break; + case 86: + KIA_Play_Photograph(34); + break; + case 87: + KIA_Play_Slice_Model(936); + break; + case 88: + KIA_Play_Photograph(16); + break; + case 89: + KIA_Play_Slice_Model(975); + break; + case 90: + KIA_Play_Actor_Dialogue(16, 290); + KIA_Play_Actor_Dialogue(16, 300); + break; + case 91: + KIA_Play_Slice_Model(939); + KIA_Play_Actor_Dialogue(99, 4050); + break; + case 92: + KIA_Play_Actor_Dialogue(18, 140); + KIA_Play_Actor_Dialogue(18, 150); + break; + case 93: + KIA_Play_Slice_Model(969); + break; + case 94: + KIA_Play_Actor_Dialogue(3, 650); + KIA_Play_Actor_Dialogue(3, 660); + KIA_Play_Actor_Dialogue(0, 3665); + KIA_Play_Actor_Dialogue(3, 670); + KIA_Play_Actor_Dialogue(3, 680); + KIA_Play_Actor_Dialogue(3, 690); + break; + case 96: + KIA_Play_Actor_Dialogue(3, 580); + break; + case 97: + KIA_Play_Actor_Dialogue(0, 3600); + KIA_Play_Actor_Dialogue(3, 550); + break; + case 98: + KIA_Play_Slice_Model(935); + break; + case 99: + KIA_Play_Slice_Model(957); + break; + case 100: + KIA_Play_Slice_Model(961); + break; + case 101: + KIA_Play_Actor_Dialogue(31, 210); + KIA_Play_Actor_Dialogue(31, 220); + KIA_Play_Actor_Dialogue(22, 140); + KIA_Play_Actor_Dialogue(31, 230); + break; + case 102: + KIA_Play_Actor_Dialogue(59, 210); + KIA_Play_Actor_Dialogue(59, 260); + KIA_Play_Actor_Dialogue(0, 1390); + KIA_Play_Actor_Dialogue(59, 300); + break; + case 103: + KIA_Play_Actor_Dialogue(2, 450); + KIA_Play_Actor_Dialogue(0, 3280); + break; + case 104: + KIA_Play_Actor_Dialogue(0, 3250); + KIA_Play_Actor_Dialogue(2, 540); + KIA_Play_Actor_Dialogue(2, 550); + break; + case 105: + KIA_Play_Slice_Model(953); + KIA_Play_Actor_Dialogue(99, 350); + break; + case 106: + KIA_Play_Slice_Model(954); + break; + case 107: + KIA_Play_Actor_Dialogue(0, 3860); + KIA_Play_Actor_Dialogue(3, 1030); + KIA_Play_Actor_Dialogue(3, 1040); + KIA_Play_Actor_Dialogue(0, 3865); + KIA_Play_Actor_Dialogue(3, 1050); + KIA_Play_Actor_Dialogue(3, 1060); + break; + case 108: + KIA_Play_Actor_Dialogue(33, 0); + KIA_Play_Actor_Dialogue(33, 10); + break; + case 109: + KIA_Play_Slice_Model(931); + break; + case 110: + KIA_Play_Slice_Model(931); + KIA_Play_Actor_Dialogue(99, 4420); + break; + case 112: + KIA_Play_Actor_Dialogue(99, 3780); + KIA_Play_Actor_Dialogue(99, 3790); + break; + case 113: + KIA_Play_Actor_Dialogue(99, 3800); + KIA_Play_Actor_Dialogue(99, 3810); + KIA_Play_Actor_Dialogue(99, 3820); + KIA_Play_Actor_Dialogue(99, 3830); + break; + case 114: + KIA_Play_Actor_Dialogue(99, 3840); + KIA_Play_Actor_Dialogue(99, 3850); + KIA_Play_Actor_Dialogue(99, 3860); + KIA_Play_Actor_Dialogue(99, 3870); + break; + case 115: + KIA_Play_Actor_Dialogue(99, 3880); + KIA_Play_Actor_Dialogue(99, 3890); + KIA_Play_Actor_Dialogue(99, 3900); + break; + case 116: + KIA_Play_Actor_Dialogue(9, 830); + KIA_Play_Actor_Dialogue(9, 840); + KIA_Play_Actor_Dialogue(9, 850); + break; + case 118: + KIA_Play_Slice_Model(951); + break; + case 119: + KIA_Play_Slice_Model(962); + KIA_Play_Actor_Dialogue(99, 3930); + KIA_Play_Actor_Dialogue(99, 3940); + break; + case 120: + KIA_Play_Actor_Dialogue(99, 2550); + KIA_Play_Actor_Dialogue(99, 2560); + KIA_Play_Actor_Dialogue(99, 2570); + KIA_Play_Actor_Dialogue(99, 2580); + KIA_Play_Actor_Dialogue(99, 2590); + break; + case 121: + KIA_Play_Actor_Dialogue(99, 2470); + KIA_Play_Actor_Dialogue(99, 2480); + KIA_Play_Actor_Dialogue(99, 2490); + KIA_Play_Actor_Dialogue(99, 2500); + break; + case 122: + KIA_Play_Actor_Dialogue(0, 5615); + KIA_Play_Actor_Dialogue(12, 170); + KIA_Play_Actor_Dialogue(0, 5625); + KIA_Play_Actor_Dialogue(12, 180); + KIA_Play_Actor_Dialogue(0, 5630); + KIA_Play_Actor_Dialogue(12, 190); + KIA_Play_Actor_Dialogue(0, 5635); + KIA_Play_Actor_Dialogue(12, 200); + break; + case 123: + KIA_Play_Actor_Dialogue(0, 5640); + KIA_Play_Actor_Dialogue(12, 230); + KIA_Play_Actor_Dialogue(0, 5645); + KIA_Play_Actor_Dialogue(12, 240); + KIA_Play_Actor_Dialogue(12, 250); + KIA_Play_Actor_Dialogue(0, 5650); + KIA_Play_Actor_Dialogue(12, 260); + break; + case 124: + KIA_Play_Actor_Dialogue(12, 340); + KIA_Play_Actor_Dialogue(12, 350); + KIA_Play_Actor_Dialogue(12, 360); + KIA_Play_Actor_Dialogue(99, 2710); + KIA_Play_Actor_Dialogue(99, 2730); + break; + case 125: + KIA_Play_Slice_Model(946); + KIA_Play_Actor_Dialogue(99, 2740); + KIA_Play_Actor_Dialogue(99, 2750); + KIA_Play_Actor_Dialogue(99, 2760); + KIA_Play_Actor_Dialogue(99, 2770); + break; + case 126: + KIA_Play_Actor_Dialogue(99, 3320); + break; + case 127: + KIA_Play_Slice_Model(959); + break; + case 128: + KIA_Play_Slice_Model(958); + break; + case 129: + KIA_Play_Slice_Model(934); + break; + case 131: + KIA_Play_Slice_Model(945); + break; + case 136: + KIA_Play_Actor_Dialogue(10, 240); + KIA_Play_Actor_Dialogue(13, 200); + KIA_Play_Actor_Dialogue(13, 210); + KIA_Play_Actor_Dialogue(10, 260); + KIA_Play_Actor_Dialogue(10, 270); + break; + case 139: + KIA_Play_Actor_Dialogue(3, 360); + KIA_Play_Actor_Dialogue(3, 380); + break; + case 140: + KIA_Play_Actor_Dialogue(0, 2505); + KIA_Play_Actor_Dialogue(3, 430); + KIA_Play_Actor_Dialogue(3, 440); + KIA_Play_Actor_Dialogue(0, 2530); + KIA_Play_Actor_Dialogue(3, 450); + KIA_Play_Actor_Dialogue(0, 2535); + KIA_Play_Actor_Dialogue(3, 460); + KIA_Play_Actor_Dialogue(3, 470); + break; + case 141: + KIA_Play_Actor_Dialogue(6, 590); + KIA_Play_Actor_Dialogue(6, 630); + break; + case 142: + KIA_Play_Actor_Dialogue(6, 540); + KIA_Play_Actor_Dialogue(6, 550); + KIA_Play_Actor_Dialogue(0, 2550); + KIA_Play_Actor_Dialogue(6, 560); + break; + case 143: + KIA_Play_Actor_Dialogue(5, 530); + KIA_Play_Actor_Dialogue(5, 540); + break; + case 144: + KIA_Play_Actor_Dialogue(1, 700); + KIA_Play_Actor_Dialogue(1, 750); + KIA_Play_Actor_Dialogue(1, 760); + break; + case 145: + KIA_Play_Slice_Model(960); + break; + case 146: + KIA_Play_Slice_Model(932); + break; + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + v1 = Global_Variable_Query(48) - 1; + if (v1 == 1) { + KIA_Play_Slice_Model(988); + } else if (v1 == 2) { + KIA_Play_Slice_Model(990); + } else if (v1 == 3) { + KIA_Play_Slice_Model(991); + } else if (v1 == 4) { + KIA_Play_Slice_Model(993); + } + break; + case 153: + KIA_Play_Slice_Model(950); + break; + case 154: + KIA_Play_Slice_Model(967); + break; + case 155: + KIA_Play_Slice_Model(947); + break; + case 156: + KIA_Play_Actor_Dialogue(19, 230); + KIA_Play_Actor_Dialogue(19, 240); + break; + case 157: + KIA_Play_Actor_Dialogue(19, 250); + KIA_Play_Actor_Dialogue(19, 260); + break; + case 158: + KIA_Play_Actor_Dialogue(19, 280); + KIA_Play_Actor_Dialogue(0, 7350); + KIA_Play_Actor_Dialogue(19, 290); + KIA_Play_Actor_Dialogue(19, 300); + KIA_Play_Actor_Dialogue(19, 310); + break; + case 162: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 163: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 164: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 165: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 166: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 167: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 168: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 169: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 170: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 171: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 172: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 173: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 174: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 175: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 176: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 177: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 178: + KIA_Play_Actor_Dialogue(1, 3310); + KIA_Play_Actor_Dialogue(1, 3320); + KIA_Play_Actor_Dialogue(1, 3330); + KIA_Play_Actor_Dialogue(1, 3350); + KIA_Play_Actor_Dialogue(1, 3360); + KIA_Play_Actor_Dialogue(1, 3370); + KIA_Play_Actor_Dialogue(1, 3380); + break; + case 179: + KIA_Play_Actor_Dialogue(1, 3390); + KIA_Play_Actor_Dialogue(1, 3400); + KIA_Play_Actor_Dialogue(1, 3410); + KIA_Play_Actor_Dialogue(11, 1260); + KIA_Play_Actor_Dialogue(1, 3420); + KIA_Play_Actor_Dialogue(1, 3430); + KIA_Play_Actor_Dialogue(1, 3440); + KIA_Play_Actor_Dialogue(11, 1270); + KIA_Play_Actor_Dialogue(1, 3450); + KIA_Play_Actor_Dialogue(1, 3460); + KIA_Play_Actor_Dialogue(11, 1280); + KIA_Play_Actor_Dialogue(1, 3470); + KIA_Play_Actor_Dialogue(11, 1300); + KIA_Play_Actor_Dialogue(11, 1310); + KIA_Play_Actor_Dialogue(1, 3480); + KIA_Play_Actor_Dialogue(1, 3500); + KIA_Play_Actor_Dialogue(11, 1320); + KIA_Play_Actor_Dialogue(11, 1330); + KIA_Play_Actor_Dialogue(1, 3510); + KIA_Play_Actor_Dialogue(11, 1340); + KIA_Play_Actor_Dialogue(1, 3520); + KIA_Play_Actor_Dialogue(11, 1350); + KIA_Play_Actor_Dialogue(1, 3530); + KIA_Play_Actor_Dialogue(1, 3540); + break; + case 180: + KIA_Play_Actor_Dialogue(1, 3550); + KIA_Play_Actor_Dialogue(11, 1360); + KIA_Play_Actor_Dialogue(11, 1370); + KIA_Play_Actor_Dialogue(1, 3560); + KIA_Play_Actor_Dialogue(1, 3570); + break; + case 181: + KIA_Play_Actor_Dialogue(1, 3580); + KIA_Play_Actor_Dialogue(11, 1400); + KIA_Play_Actor_Dialogue(1, 3590); + KIA_Play_Actor_Dialogue(11, 1410); + KIA_Play_Actor_Dialogue(1, 3600); + KIA_Play_Actor_Dialogue(11, 1420); + KIA_Play_Actor_Dialogue(11, 1430); + KIA_Play_Actor_Dialogue(1, 3610); + KIA_Play_Actor_Dialogue(11, 1440); + KIA_Play_Actor_Dialogue(1, 3620); + KIA_Play_Actor_Dialogue(1, 3630); + KIA_Play_Actor_Dialogue(11, 1450); + KIA_Play_Actor_Dialogue(1, 3640); + KIA_Play_Actor_Dialogue(11, 1460); + KIA_Play_Actor_Dialogue(1, 3650); + break; + case 243: + KIA_Play_Photograph(7); + break; + case 244: + KIA_Play_Photograph(8); + KIA_Play_Actor_Dialogue(99, 4110); + break; + case 245: + KIA_Play_Photograph(15); + break; + case 246: + KIA_Play_Photograph(17); + break; + case 247: + KIA_Play_Photograph(18); + break; + case 248: + KIA_Play_Photograph(1); + KIA_Play_Actor_Dialogue(99, 4260); + break; + case 249: + KIA_Play_Photograph(3); + KIA_Play_Actor_Dialogue(99, 4230); + break; + case 250: + KIA_Play_Photograph(2); + KIA_Play_Actor_Dialogue(99, 4040); + break; + case 251: + KIA_Play_Photograph(21); + break; + case 252: + KIA_Play_Photograph(22); + KIA_Play_Actor_Dialogue(99, 4180); + break; + case 253: + KIA_Play_Photograph(23); + break; + case 254: + KIA_Play_Photograph(24); + break; + case 255: + KIA_Play_Photograph(26); + break; + case 256: + KIA_Play_Photograph(27); + break; + case 257: + KIA_Play_Slice_Model(975); + break; + case 258: + KIA_Play_Photograph(0); + break; + case 259: + KIA_Play_Photograph(28); + break; + case 260: + KIA_Play_Photograph(19); + break; + case 261: + KIA_Play_Photograph(32); + break; + case 262: + KIA_Play_Photograph(30); + KIA_Play_Actor_Dialogue(99, 4160); + break; + case 263: + KIA_Play_Photograph(29); + if (Query_Difficulty_Level() == 0) { + KIA_Play_Actor_Dialogue(99, 4140); + } else { + KIA_Play_Actor_Dialogue(99, 4150); + } + break; + case 264: + KIA_Play_Slice_Model(985); + KIA_Play_Actor_Dialogue(99, 1770); + KIA_Play_Actor_Dialogue(99, 1150); + KIA_Play_Actor_Dialogue(99, 1180); + KIA_Play_Actor_Dialogue(99, 1190); + break; + case 265: + KIA_Play_Slice_Model(986); + break; + case 269: + KIA_Play_Actor_Dialogue(99, 730); + KIA_Play_Actor_Dialogue(99, 740); + KIA_Play_Actor_Dialogue(99, 750); + KIA_Play_Actor_Dialogue(99, 760); + break; + case 270: + KIA_Play_Actor_Dialogue(99, 670); + KIA_Play_Actor_Dialogue(99, 680); + KIA_Play_Actor_Dialogue(99, 700); + KIA_Play_Actor_Dialogue(99, 710); + KIA_Play_Actor_Dialogue(99, 720); + break; + case 271: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 430); + break; + case 272: + KIA_Play_Actor_Dialogue(39, 420); + KIA_Play_Actor_Dialogue(39, 440); + break; + case 273: + KIA_Play_Actor_Dialogue(0, 1645); + KIA_Play_Actor_Dialogue(6, 240); + KIA_Play_Actor_Dialogue(6, 250); + KIA_Play_Actor_Dialogue(0, 1675); + KIA_Play_Actor_Dialogue(6, 260); + KIA_Play_Actor_Dialogue(6, 270); + break; + case 274: + KIA_Play_Photograph(35); + break; + case 275: + KIA_Play_Photograph(36); + KIA_Play_Actor_Dialogue(99, 4240); + break; + case 276: + KIA_Play_Photograph(37); + KIA_Play_Actor_Dialogue(99, 4220); + break; + case 277: + KIA_Play_Photograph(38); + break; + case 278: + KIA_Play_Actor_Dialogue(0, 5365); + KIA_Play_Actor_Dialogue(57, 600); + KIA_Play_Actor_Dialogue(0, 5370); + KIA_Play_Actor_Dialogue(57, 610); + break; + case 279: + KIA_Play_Actor_Dialogue(51, 0); + KIA_Play_Actor_Dialogue(51, 10); + KIA_Play_Actor_Dialogue(51, 20); + KIA_Play_Actor_Dialogue(51, 30); + break; + case 280: + KIA_Play_Actor_Dialogue(15, 630); + KIA_Play_Actor_Dialogue(15, 640); + KIA_Play_Actor_Dialogue(15, 650); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kia.h b/engines/bladerunner/script/kia.h new file mode 100644 index 0000000000..d7b5836e8d --- /dev/null +++ b/engines/bladerunner/script/kia.h @@ -0,0 +1,45 @@ +/* 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_SCRIPT_KIA_H +#define BLADERUNNER_SCRIPT_KIA_H + +#include "bladerunner/script/script.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ScriptKIA : ScriptBase { +public: + ScriptKIA(BladeRunnerEngine *vm) + : ScriptBase(vm) { + } + + void SCRIPT_KIA_DLL_Play_Clue_Asset_Script(int a1, int clueId); + +private: +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/script/kp01.cpp b/engines/bladerunner/script/kp01.cpp new file mode 100644 index 0000000000..b4a91e79cf --- /dev/null +++ b/engines/bladerunner/script/kp01.cpp @@ -0,0 +1,171 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP01::InitializeScene() { + if (Game_Flag_Query(416)) { + Setup_Scene_Information(-125.0f, -12.2f, -61.0f, 400); + } else if (Game_Flag_Query(418)) { + Setup_Scene_Information(-284.0f, -12.2f, -789.0f, 445); + } else { + Setup_Scene_Information(239.0f, -12.2f, -146.0f, 820); + Game_Flag_Reset(413); + if (!Game_Flag_Query(674) && !Game_Flag_Query(653)) { + Game_Flag_Set(674); + Actor_Set_Goal_Number(1, 420); + } + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 150, 0, 200, 276, 0); + Scene_Exit_Add_2D_Exit(2, 589, 0, 639, 479, 1); + Ambient_Sounds_Add_Looping_Sound(464, 34, 1, 1); + Ambient_Sounds_Add_Looping_Sound(383, 27, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 90, 1, 1); + Ambient_Sounds_Add_Sound(440, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(441, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(442, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); +} + +void ScriptKP01::SceneLoaded() { + Unobstacle_Object("TRAINCAR-1", true); + Unobstacle_Object("FORE-JUNK-02", true); + Obstacle_Object("OBSTACLE1", true); + Obstacle_Object("TUBE1", true); + Unclickable_Object("OBSTACLE1"); +} + +bool ScriptKP01::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptKP01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -125.0f, -12.2f, -61.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(415); + Set_Enter(47, 44); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -284.0f, -12.2f, -789.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(417); + Set_Enter(46, 43); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 239.0f, 12.2f, -146.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(414); + Set_Enter(45, 42); + } + return true; + } + return false; +} + + +bool ScriptKP01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP01::SceneFrameAdvanced(int frame) { +} + +void ScriptKP01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 1) { + if (newGoal == 422) { + if (Game_Flag_Query(378) == 1) { + Delay(500); + Actor_Change_Animation_Mode(0, 75); + Delay(4500); + Actor_Face_Current_Camera(0, true); + Actor_Says(0, 510, 3); + } else { + Delay(3000); + } + Async_Actor_Walk_To_XYZ(0, 76.56f, -12.2f, -405.48f, 0, false); + //return true; + } else if (newGoal == 423) { + Player_Gains_Control(); + Actor_Force_Stop_Walking(0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(417); + Set_Enter(46, 43); + //return true; + } + } + //return false; +} + +void ScriptKP01::PlayerWalkedIn() { + if (Game_Flag_Query(416)) { + Loop_Actor_Walk_To_XYZ(0, -93.0f, -12.2f, -61.0f, 0, 0, false, 0); + Game_Flag_Reset(416); + } else if (Game_Flag_Query(418)) { + Loop_Actor_Walk_To_XYZ(0, -240.0f, -12.2f, -789.0f, 0, 0, false, 0); + Game_Flag_Reset(418); + } else { + Loop_Actor_Walk_To_XYZ(0, 211.0f, -12.2f, -146.0f, 0, 0, false, 0); + if (!Game_Flag_Query(653) + && !Game_Flag_Query(714) + && Actor_Query_Goal_Number(1) == 420 + && Actor_Query_Goal_Number(1) != 599) { + Player_Loses_Control(); + Actor_Set_Goal_Number(1, 421); + } + } +} + +void ScriptKP01::PlayerWalkedOut() { +} + +void ScriptKP01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp02.cpp b/engines/bladerunner/script/kp02.cpp new file mode 100644 index 0000000000..08a2b835ac --- /dev/null +++ b/engines/bladerunner/script/kp02.cpp @@ -0,0 +1,147 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP02::InitializeScene() { + if (Game_Flag_Query(414)) { + Setup_Scene_Information(-884.0f, -615.49f, 3065.0f, 20); + } else { + Setup_Scene_Information(-1040.0f, -615.49f, 2903.0f, 339); + Game_Flag_Reset(412); + } + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + Ambient_Sounds_Add_Looping_Sound(464, 34, 1, 1); + Ambient_Sounds_Add_Looping_Sound(383, 27, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 90, 1, 1); + Ambient_Sounds_Add_Sound(440, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(441, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(442, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); +} + +void ScriptKP02::SceneLoaded() { + Obstacle_Object("VAN GRATE", true); + Clickable_Object("VAN GRATE"); + Unobstacle_Object("VAN GRATE", true); + Unobstacle_Object("BOX05", true); + Unobstacle_Object("BOX08", true); + Unobstacle_Object("BOX09", true); + Unobstacle_Object("BOX01", true); + Unclickable_Object("VAN GRATE"); +} + +bool ScriptKP02::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptKP02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -1040.0f, -615.49f, 2903.0f, 0, 1, false, 0)) { + if (Actor_Query_Goal_Number(65) == 406 || Actor_Query_Goal_Number(64) == 406) { + Non_Player_Actor_Combat_Mode_Off(65); + Non_Player_Actor_Combat_Mode_Off(64); + Actor_Set_Goal_Number(65, 400); + Actor_Set_Goal_Number(64, 400); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(411); + Set_Enter(84, 96); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(411); + Set_Enter(84, 96); + } + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -884.0f, -615.49f, 3065.0f, 0, 1, false, 0)) { + if (Actor_Query_Goal_Number(65) == 406 || Actor_Query_Goal_Number(64) == 406) { + Non_Player_Actor_Combat_Mode_Off(65); + Non_Player_Actor_Combat_Mode_Off(64); + Actor_Set_Goal_Number(65, 400); + Actor_Set_Goal_Number(64, 400); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(413); + Set_Enter(44, 41); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(413); + Set_Enter(44, 41); + } + } + return true; + } + return false; +} + +bool ScriptKP02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP02::SceneFrameAdvanced(int frame) { +} + +void ScriptKP02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP02::PlayerWalkedIn() { + if (Game_Flag_Query(414)) { + Loop_Actor_Walk_To_XYZ(0, -884.0f, -615.49f, 3035.0f, 0, 0, false, 0); + Game_Flag_Reset(414); + } + if (Game_Flag_Query(653) && Actor_Query_Goal_Number(1) != 599) { + Actor_Set_Goal_Number(1, 450); + } + //return false; +} + +void ScriptKP02::PlayerWalkedOut() { +} + +void ScriptKP02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp03.cpp b/engines/bladerunner/script/kp03.cpp new file mode 100644 index 0000000000..57a1eb521b --- /dev/null +++ b/engines/bladerunner/script/kp03.cpp @@ -0,0 +1,262 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP03::InitializeScene() { + if (Game_Flag_Query(420)) { + Setup_Scene_Information(1.0f, -36.55f, 111.0f, 200); + } else { + Setup_Scene_Information(-321.0f, -36.55f, 26.0f, 350); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 287, 104, 367, 255, 0); + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(422)) { + Scene_Loop_Set_Default(5); + } else if (Game_Flag_Query(484)) { + Scene_Loop_Set_Default(7); + } else { + Scene_Loop_Set_Default(2); + Game_Flag_Set(421); + } + if ((Actor_Query_Goal_Number(1) != 599 && !Game_Flag_Query(422) && !Game_Flag_Query(484)) && ((Game_Flag_Query(653) && Game_Flag_Query(420)) || (!Game_Flag_Query(653) && Game_Flag_Query(417)))) { + Actor_Put_In_Set(1, 46); + Actor_Set_At_XYZ(1, -300.0f, -36.55f, 26.0f, 350); + } +} + +void ScriptKP03::SceneLoaded() { + Obstacle_Object("BRACK MID", true); + Unobstacle_Object("OBSTACLE_REMOVE", true); + Unobstacle_Object("BOX11", true); + Unobstacle_Object("OBSTACLE05", true); + Clickable_Object("BRACK MID"); +} + +bool ScriptKP03::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP03::ClickedOn3DObject(const char *objectName, bool a2) { + Actor_Face_Object(1, "BRACK MID", true); + if (Object_Query_Click("BRACK MID", objectName) && !Game_Flag_Query(422)) { + if (a2) { + Scene_Loop_Set_Default(5); + Scene_Loop_Start_Special(2, 4, 1); + Actor_Change_Animation_Mode(0, 39); + Actor_Retired_Here(0, 72, 18, 1, -1); + Game_Flag_Set(422); + Game_Flag_Reset(421); + return false; + } + if (Actor_Query_Goal_Number(1) == 411) { + Scene_Exits_Enable(); + sub_401E54(); + } else { + if (Game_Flag_Query(417)) { + Loop_Actor_Walk_To_XYZ(0, -137.0f, -36.55f, 26.0f, 0, 0, true, 0); + } else if (Game_Flag_Query(420)) { + Loop_Actor_Walk_To_XYZ(0, -50.0f, -36.55f, 78.0f, 0, 0, true, 0); + } + if (Game_Flag_Query(421)) { + Actor_Face_Object(0, "BRACK MID", true); + Game_Flag_Set(484); + Game_Flag_Reset(421); + Scene_Loop_Set_Default(7); + Scene_Loop_Start_Special(2, 0, 0); + Actor_Voice_Over(1110, 99); + Actor_Voice_Over(1120, 99); + } else { + Actor_Face_Object(0, "BRACK MID", true); + Actor_Says(0, 8580, 13); + } + } + return true; + } + return false; +} + +bool ScriptKP03::ClickedOnActor(int actorId) { + if (actorId == 1 && Actor_Query_Goal_Number(1) == 411) { + Actor_Face_Object(1, "BRACK MID", true); + sub_401E54(); + } + return false; +} + +bool ScriptKP03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP03::ClickedOnExit(int exitId) { + if (Actor_Query_Goal_Number(1) == 410) { + Actor_Set_Goal_Number(1, 418); + } else { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 1.0f, -36.55f, 111.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Music_Stop(2); + Game_Flag_Reset(417); + Game_Flag_Reset(420); + Game_Flag_Set(419); + Set_Enter(9, 45); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -321.0f, -36.55f, 26.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Music_Stop(2); + Game_Flag_Reset(417); + Game_Flag_Reset(420); + Game_Flag_Set(418); + Set_Enter(44, 41); + } + return true; + } + } + return false; +} + +bool ScriptKP03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP03::SceneFrameAdvanced(int frame) { + int v1; + float x, y, z; + + if (frame == 123) { + Ambient_Sounds_Play_Sound(491, 99, -60, 100, 99); + } + if (Game_Flag_Query(421) && !Game_Flag_Query(484)) { + v1 = -1; + if (!Game_Flag_Query(422)) { + Actor_Query_XYZ(0, &x, &y, &z); + if ((Game_Flag_Query(417) && -130.0f < x) || (Game_Flag_Query(420) && -130.0f > x)) { + v1 = 0; + } + } + if (!Game_Flag_Query(422)) { //todo ? same condition as before + Actor_Query_XYZ(1, &x, &y, &z); + if (Game_Flag_Query(653) && Actor_Query_Which_Set_In(1) == 46) { + if ((Game_Flag_Query(417) && -130.0f > x) || (Game_Flag_Query(420) && -130.0f < x)) { + v1 = 1; + } + } else if ((Game_Flag_Query(417) && -130.0f < x) || (Game_Flag_Query(420) && -130.0f > x)) { + v1 = 1; + } + } + if (v1 != -1) { + Scene_Loop_Set_Default(5); + Scene_Loop_Start_Special(2, 4, 1); + Game_Flag_Set(422); + Game_Flag_Reset(421); + Unclickable_Object("BRACK MID"); + Scene_Exits_Enable(); + if (v1 == 1) { + Actor_Set_Goal_Number(1, 415); + Music_Play(12, 25, 0, 1, -1, 0, 0); + if (Actor_Query_Inch_Distance_From_Actor(0, 1) <= 120) { + v1 = 0; + } + } + if (v1) { + Actor_Change_Animation_Mode(0, 21); + } else { + Actor_Force_Stop_Walking(0); + Actor_Change_Animation_Mode(0, 48); + Actor_Retired_Here(0, 72, 18, 1, -1); + } + } + } +} + +void ScriptKP03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP03::PlayerWalkedIn() { + if (Game_Flag_Query(420)) { + Loop_Actor_Walk_To_XYZ(0, 1.0f, -36.55f, 87.0f, 0, 0, false, 0); + } + if (Actor_Query_Is_In_Current_Set(1) && Actor_Query_Goal_Number(1) != 419) { + if (Game_Flag_Query(653)) { + if (Game_Flag_Query(420)) { + Actor_Set_Goal_Number(1, 410); + } + } else if (!Game_Flag_Query(422) && !Game_Flag_Query(484) && Game_Flag_Query(417)) { + Scene_Exits_Disable(); + Delay(1000); + Actor_Set_Goal_Number(1, 411); + } + } +} + +void ScriptKP03::PlayerWalkedOut() { +} + +void ScriptKP03::DialogueQueueFlushed(int a1) { +} + +void ScriptKP03::sub_401E54() { + Player_Loses_Control(); + Actor_Says(0, 2180, 14); + Actor_Set_Goal_Number(1, 412); + Actor_Says(1, 480, 60); + Actor_Face_Object(0, "BRACK MID", true); + Actor_Says(0, 2185, 14); + Loop_Actor_Walk_To_XYZ(1, -137.0f, -36.55f, 26.0f, 0, 0, false, 0); + Actor_Face_Object(1, "BRACK MID", true); + Actor_Says(1, 490, 58); + Actor_Says(0, 2190, 14); + Actor_Says(1, 500, 58); + Actor_Says(1, 510, 59); + Actor_Says(1, 520, 60); + Game_Flag_Set(484); + Game_Flag_Reset(421); + Scene_Loop_Set_Default(7); + Scene_Loop_Start_Special(2, 7, 0); + Actor_Set_Goal_Number(1, 413); + Actor_Says(0, 2195, 14); + Ambient_Sounds_Play_Sound(151, 40, -60, -60, 0); + Loop_Actor_Walk_To_XYZ(0, 1.0f, -36.55f, 111.0f, 0, 0, false, 0); + Actor_Set_Goal_Number(1, 430); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Reset(417); + Game_Flag_Reset(420); + Game_Flag_Set(419); + Set_Enter(9, 45); + Player_Gains_Control(); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp04.cpp b/engines/bladerunner/script/kp04.cpp new file mode 100644 index 0000000000..cc2ed3fe71 --- /dev/null +++ b/engines/bladerunner/script/kp04.cpp @@ -0,0 +1,118 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP04::InitializeScene() { + if (Game_Flag_Query(575)) { + Setup_Scene_Information(-544.0f, 94.89f, 288.0f, 700); + } else { + Setup_Scene_Information(-905.0f, 94.89f, 1357.0f, 970); + } + Scene_Exit_Add_2D_Exit(0, 0, 455, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 475, 247, 514, 416, 1); + Ambient_Sounds_Add_Looping_Sound(464, 34, 1, 1); + Ambient_Sounds_Add_Looping_Sound(383, 27, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 90, 1, 1); + Ambient_Sounds_Add_Sound(440, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(441, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(442, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); +} + +void ScriptKP04::SceneLoaded() { + Obstacle_Object("BUILDING04", true); + Unobstacle_Object("BOX06", true); + Unclickable_Object("BUILDING04"); +} + +bool ScriptKP04::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP04::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptKP04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -905.0f, 94.89f, 1357.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(416); + Set_Enter(44, 41); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -544.0f, 94.89f, 288.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(574); + Set_Enter(9, 45); + } + return true; + } + return false; +} + +bool ScriptKP04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP04::SceneFrameAdvanced(int frame) { +} + +void ScriptKP04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP04::PlayerWalkedIn() { + if (Game_Flag_Query(575)) { + Loop_Actor_Walk_To_XYZ(0, -584.0f, 94.89f, 288.0f, 0, 0, false, 0); + Game_Flag_Reset(575); + } else { + Game_Flag_Reset(415); + } +} + +void ScriptKP04::PlayerWalkedOut() { +} + +void ScriptKP04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp05.cpp b/engines/bladerunner/script/kp05.cpp new file mode 100644 index 0000000000..2e1de932d4 --- /dev/null +++ b/engines/bladerunner/script/kp05.cpp @@ -0,0 +1,171 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP05::InitializeScene() { + if (Game_Flag_Query(577)) { + Setup_Scene_Information(-868.0f, 0.0f, -68.0f, 520); + } else if (Game_Flag_Query(574)) { + Setup_Scene_Information(-1142.0f, 0.0f, 932.0f, 276); + } else { + Setup_Scene_Information(-802.0f, 0.0f, 972.0f, 800); + } + Scene_Exit_Add_2D_Exit(0, 589, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(2, 0, 0, 257, 204, 0); + Ambient_Sounds_Add_Looping_Sound(464, 34, 1, 1); + Ambient_Sounds_Add_Looping_Sound(383, 27, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 90, 1, 1); + Ambient_Sounds_Add_Sound(440, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(441, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(442, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); +} + +void ScriptKP05::SceneLoaded() { + Unobstacle_Object("OBSTACLEBOX20", true); + Clickable_Object("BRIDGE02"); + Unclickable_Object("BRIDGE02"); + if (!Actor_Clue_Query(0, 145) && Game_Flag_Query(653)) { + Item_Add_To_World(118, 960, 9, -1095.0f, 0.0f, 770.0f, 256, 24, 24, false, true, false, true); + } +} + +bool ScriptKP05::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP05::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptKP05::ClickedOnItem(int itemId, bool a2) { + if (itemId == 118) { + if (!Loop_Actor_Walk_To_XYZ(0, -1058.0f, 0.0f, 852.0f, 0, 1, false, 0)) { + Actor_Face_Item(0, 118, true); + Actor_Clue_Acquire(0, 145, 1, -1); + Item_Remove_From_World(118); + Item_Pickup_Spin_Effect(960, 58, 321); + } + } + return false; +} + +bool ScriptKP05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -802.0f, 0.0f, 972.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(420); + Set_Enter(46, 43); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -1142.0f, 0.0f, 932.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(575); + Set_Enter(47, 44); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -868.0f, 0.0f, -68.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(576); + Async_Actor_Walk_To_XYZ(0, -868.0f, 0.0f, -216.0f, 0, false); + Set_Enter(9, 46); + } + return true; + } + return false; +} + +bool ScriptKP05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP05::SceneFrameAdvanced(int frame) { +} + +void ScriptKP05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP05::PlayerWalkedIn() { + if (Game_Flag_Query(577)) { + Game_Flag_Reset(577); + } else if (Game_Flag_Query(574)) { + Loop_Actor_Walk_To_XYZ(0, -1110.0f, 0.0f, 932.0f, 0, 0, false, 0); + Game_Flag_Reset(574); + } else { + Loop_Actor_Walk_To_XYZ(0, -846.0f, 0.0f, 972.0f, 0, 0, false, 0); + Game_Flag_Query(419); + } + if (Actor_Query_Goal_Number(66) == 411) { + Actor_Set_Goal_Number(66, 412); + } + if (Actor_Query_Goal_Number(1) == 450) { + Scene_Exits_Disable(); + Actor_Face_Actor(1, 0, true); + Actor_Says(1, 530, 15); + Actor_Says(1, 540, 16); + Actor_Face_Actor(0, 1, true); + Player_Set_Combat_Mode(true); + Actor_Says(0, 2200, 3); + Actor_Says(1, 550, 17); + Actor_Says(0, 2205, 3); + Actor_Says(1, 560, 15); + Actor_Says(1, 570, 16); + Actor_Says(1, 580, 13); + Actor_Says(0, 2210, 3); + Actor_Says(1, 590, 13); + Actor_Says(0, 2215, 3); + Actor_Says(1, 600, 16); + Actor_Says(1, 610, 15); + Actor_Says(0, 2220, 3); + Actor_Says(1, 620, 15); + Actor_Says(1, 630, 17); + Non_Player_Actor_Combat_Mode_On(1, 0, 1, 0, 9, 4, 7, 8, 0, -1, -1, 20, 240, 0); + } +} + +void ScriptKP05::PlayerWalkedOut() { +} + +void ScriptKP05::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp06.cpp b/engines/bladerunner/script/kp06.cpp new file mode 100644 index 0000000000..094cc257c9 --- /dev/null +++ b/engines/bladerunner/script/kp06.cpp @@ -0,0 +1,237 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP06::InitializeScene() { + if (Game_Flag_Query(579) ) { + Setup_Scene_Information(-755.0f, 8.26f, -665.0f, 640); + } else { + Setup_Scene_Information(-868.0f, 8.26f, -8.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 270, 445, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 320, 158, 352, 220, 0); + Ambient_Sounds_Add_Looping_Sound(464, 34, 1, 1); + Ambient_Sounds_Add_Looping_Sound(383, 27, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 90, 1, 1); + Ambient_Sounds_Add_Sound(440, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(441, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(442, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 5, 180, 50, 100, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 25, 33, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(576) ) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(576); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptKP06::SceneLoaded() { + Obstacle_Object("TRASH CAN WITH FIRE", true); + Obstacle_Object("MOONBUS", true); + Obstacle_Object("STAIR 1", true); + Obstacle_Object("COCKPIT FRONT", true); + Unobstacle_Object("OBSTACLEBOX28", true); + Unobstacle_Object("OBSTACLEBOX32", true); + Unclickable_Object("TRASH CAN WITH FIRE"); +} + +bool ScriptKP06::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP06::ClickedOnActor(int actorId) { + if (actorId == 8 && !Game_Flag_Query(714)) { + if (Actor_Clue_Query(8, 145)) { + Actor_Face_Actor(0, 8, true); + Actor_Says(0, 8610, 15); + Actor_Says(8, 290, 3); + } else if (Actor_Clue_Query(0, 145) ) { + Actor_Says(8, 280, 3); + Actor_Says(8, 290, 3); + Actor_Clue_Acquire(8, 145, 1, 0); + } else { + Actor_Says(0, 2320, 3); + Actor_Says(0, 2325, 3); + Actor_Says(8, 300, 3); + Actor_Says(8, 310, 3); + } + } + return false; +} + +bool ScriptKP06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -868.0f, 8.26f, -68.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(577); + Set_Enter(9, 45); + } + return true; + } + if (exitId == 1) { + if (Actor_Clue_Query(8, 145) || Actor_Query_Goal_Number(8) != 416) { + if (!Loop_Actor_Walk_To_XYZ(0, -731.0f, 8.26f, -657.0f, 0, 1, false, 0)) { + if (Game_Flag_Query(653)) { + if (!Game_Flag_Query(714)) { + Player_Set_Combat_Mode(false); + } + } else if (Actor_Query_Goal_Number(1) == 433) { + Actor_Set_Goal_Number(1, 499); + } else { + Actor_Set_Goal_Number(53, 499); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(578); + Set_Enter(48, 47); + } + } else if (Actor_Clue_Query(0, 145) ) { + Actor_Says(8, 280, 3); + Actor_Says(8, 290, 3); + Actor_Clue_Acquire(8, 145, 1, 0); + Loop_Actor_Walk_To_XYZ(0, -731.0f, 8.26f, -657.0f, 0, 0, true, 0); + Player_Set_Combat_Mode(false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(578); + Set_Enter(48, 47); + } else { + Actor_Set_Goal_Number(8, 417); + } + return true; + } + return false; +} + +bool ScriptKP06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP06::SceneFrameAdvanced(int frame) { +} + +void ScriptKP06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP06::PlayerWalkedIn() { + if (!Game_Flag_Query(653) && Game_Flag_Query(579)) { + Game_Flag_Reset(579); + if (Actor_Query_Goal_Number(1) == 499) { + Actor_Face_Actor(1, 0, true); + Actor_Says(1, 2530, 13); + Actor_Face_Actor(0, 1, true); + Actor_Says(0, 6200, 11); + Actor_Says(1, 2540, 15); + Actor_Says(1, 2550, 12); + Actor_Says(0, 6205, 14); + if (Actor_Query_Friendliness_To_Other(1, 0) < 50) { + Actor_Says(1, 2560, 12); + Actor_Says(0, 6210, 14); + Actor_Says(1, 2570, 13); + Actor_Says(0, 6215, 14); + Actor_Says(1, 2580, 15); + Actor_Says(1, 2590, 12); + } + Async_Actor_Walk_To_Waypoint(0, 551, 0, 0); + Delay(1000); + Actor_Says(0, 6220, -1); + Delay(3000); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(25, 0, -1); + Game_Over(); + //return true; + return; + } else { + Actor_Set_Goal_Number(53, 499); + Actor_Face_Actor(53, 0, true); + Actor_Says(53, 220, 13); + Actor_Face_Actor(0, 53, true); + Actor_Says(0, 6245, 11); + Actor_Says(53, 230, 14); + if (Game_Flag_Query(714)) { + Actor_Says(0, 6250, 15); + Actor_Says(53, 240, 13); + Delay(1000); + Actor_Says(0, 6255, 17); + Actor_Says(53, 250, 14); + Delay(1000); + } + Actor_Says(53, 260, 12); + Actor_Says(0, 6260, 15); + Actor_Says(53, 270, 13); + Actor_Says(53, 280, 15); + Actor_Says(0, 6265, 14); + Actor_Says(53, 290, 14); + Actor_Says(53, 300, 15); + Actor_Says(0, 6270, 11); + Async_Actor_Walk_To_Waypoint(0, 550, 0, 0); + Async_Actor_Walk_To_Waypoint(53, 551, 0, 0); + Actor_Says(53, 310, -1); + Delay(3000); + Outtake_Play(26, 0, -1); + Game_Over(); + //return true; + return; + } + } else { + if (Actor_Query_Goal_Number(8) == 414) { + Loop_Actor_Walk_To_XYZ(0, -809.0f, 8.26f, -619.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 8, true); + Actor_Set_Goal_Number(8, 415); + } + if (Actor_Query_Goal_Number(1) == 431) { + Actor_Set_Goal_Number(1, 432); + } + //return false; + return; + } +} + +void ScriptKP06::PlayerWalkedOut() { + if (Game_Flag_Query(578) && Actor_Query_Goal_Number(1) == 433) { + Actor_Set_Goal_Number(1, 499); + } +} + +void ScriptKP06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/kp07.cpp b/engines/bladerunner/script/kp07.cpp new file mode 100644 index 0000000000..1c9f6a7b3f --- /dev/null +++ b/engines/bladerunner/script/kp07.cpp @@ -0,0 +1,178 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptKP07::InitializeScene() { + Setup_Scene_Information(-12.0f, -41.58f, 72.0f, 0); + Game_Flag_Reset(578); + Scene_Exit_Add_2D_Exit(0, 315, 185, 381, 285, 0); + if (Game_Flag_Query(653)) { + if (Game_Flag_Query(47) && Actor_Query_Goal_Number(3) < 599) { + Actor_Set_Targetable(3, true); + Global_Variable_Increment(51, 1); + Actor_Put_In_Set(3, 48); + Actor_Set_At_XYZ(3, -52.0f, -41.52f, -5.0f, 289); + } + if (Actor_Query_Goal_Number(19) < 599) { + Global_Variable_Increment(51, 1); + Actor_Set_Targetable(19, true); + Actor_Put_In_Set(19, 48); + Actor_Set_At_XYZ(19, -26.0f, -41.52f, -135.0f, 0); + } + if (Game_Flag_Query(44) && Actor_Query_Goal_Number(7) < 599) { + Global_Variable_Increment(51, 1); + Actor_Set_Targetable(7, true); + Actor_Put_In_Set(7, 48); + Actor_Set_At_XYZ(7, -38.0f, -41.52f, -175.0f, 500); + } + if (Game_Flag_Query(45) && Actor_Query_Goal_Number(2) < 599) { + Global_Variable_Increment(51, 1); + Actor_Set_Targetable(2, true); + Actor_Put_In_Set(2, 48); + Actor_Set_At_XYZ(2, 61.0f, -41.52f, -3.0f, 921); + } + if (Game_Flag_Query(46) && Actor_Query_Goal_Number(6) < 599) { + Global_Variable_Increment(51, 1); + Actor_Put_In_Set(6, 48); + Actor_Set_At_XYZ(6, 78.0f, -41.52f, -119.0f, 659); + } + if (Actor_Query_Goal_Number(10) < 599) { + Global_Variable_Increment(51, 1); + Actor_Put_In_Set(10, 48); + Actor_Set_At_XYZ(10, -47.0f, 0.0f, 151.0f, 531); + } + } + Ambient_Sounds_Add_Looping_Sound(585, 7, 1, 1); + Ambient_Sounds_Add_Looping_Sound(586, 52, 1, 1); + Ambient_Sounds_Add_Looping_Sound(109, 38, 1, 1); + if (Game_Flag_Query(582)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptKP07::SceneLoaded() { + if (!Game_Flag_Query(653)) { + Music_Play(19, 25, 0, 0, -1, 1, 0); + } + Obstacle_Object("BUNK_TRAY01", true); + Unobstacle_Object("BUNK_TRAY01", true); + if (Game_Flag_Query(653)) { + Player_Set_Combat_Mode(false); + Scene_Exits_Disable(); + } +} + +bool ScriptKP07::MouseClick(int x, int y) { + return false; +} + +bool ScriptKP07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptKP07::ClickedOnActor(int actorId) { + if (actorId == 5) { + if (Game_Flag_Query(697) || actorId != 5 || Actor_Query_Goal_Number(5) == 599 || Actor_Query_Goal_Number(5) == 515) { + return false; + } + if (Game_Flag_Query(653)) { + Actor_Set_Goal_Number(5, 516); + } else { + Music_Play(20, 31, 0, 0, -1, 1, 0); + Actor_Set_Goal_Number(5, 514); + } + } else { + Actor_Face_Actor(0, actorId, true); + Actor_Says(0, 8590, 14); + } + return true; +} + +bool ScriptKP07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptKP07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -12.0f, -41.58f, 72.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(579); + Set_Enter(9, 46); + } + return true; + } + return false; +} + +bool ScriptKP07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptKP07::SceneFrameAdvanced(int frame) { +} + +void ScriptKP07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptKP07::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, 9.0f, -41.88f, -81.0f, 0, 0, false, 0); + if (!Game_Flag_Query(658)) { + if (Game_Flag_Query(653)) { + Actor_Face_Actor(0, 5, true); + Actor_Says(5, 1240, 3); + Actor_Says(0, 8500, 3); + Actor_Says(5, 1250, 3); + if (Actor_Query_Goal_Number(8) == 416) { + Actor_Put_In_Set(8, 48); + Global_Variable_Increment(51, 1); + Actor_Set_At_XYZ(8, -12.0f, -41.58f, 72.0f, 0); + Actor_Face_Actor(8, 5, true); + } + } else { + Actor_Face_Actor(0, 5, true); + Actor_Says(5, 160, 3); + Actor_Retired_Here(5, 72, 60, 0, -1); + } + Game_Flag_Set(658); + } +} + +void ScriptKP07::PlayerWalkedOut() { + Music_Stop(3); +} + +void ScriptKP07::DialogueQueueFlushed(int a1) { + if (Actor_Query_Goal_Number(5) == 515) { + Actor_Set_Targetable(5, false); + Actor_Change_Animation_Mode(5, 21); + Actor_Retired_Here(5, 12, 48, 1, -1); + Actor_Set_Goal_Number(5, 599); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma01.cpp b/engines/bladerunner/script/ma01.cpp new file mode 100644 index 0000000000..482c31ede9 --- /dev/null +++ b/engines/bladerunner/script/ma01.cpp @@ -0,0 +1,257 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA01::InitializeScene() { + Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992); + if (Game_Flag_Query(250)) { + Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992); + } + if (Game_Flag_Query(38)) { + Setup_Scene_Information(1446.0f, 0.0f, -725.0f, 660); + } + Scene_Exit_Add_2D_Exit(0, 328, 132, 426, 190, 0); + if (Game_Flag_Query(250)) { + Scene_Exit_Add_2D_Exit(1, 234, 240, 398, 328, 2); + } + Ambient_Sounds_Add_Looping_Sound(101, 90, 0, 1); + Ambient_Sounds_Add_Looping_Sound(99, 40, -100, 1); + Ambient_Sounds_Add_Looping_Sound(100, 40, 100, 1); + Ambient_Sounds_Add_Sound(68, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(38)) { + Scene_Loop_Set_Default(1); + Game_Flag_Reset(38); + } else { + Actor_Set_Invisible(0, true); + Game_Flag_Set(273); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } + if (Game_Flag_Query(409)) { + Actor_Set_Goal_Number(53, 3); + Game_Flag_Reset(409); + } +} + +void ScriptMA01::SceneLoaded() { + Obstacle_Object("WRENCH", true); + Unobstacle_Object("OBSTICLEBOX01", true); + Clickable_Object("WRENCH"); + Unclickable_Object("Y2 PADRIM 01"); + Unclickable_Object("Y2 PADRIM 02"); + Unclickable_Object("NGON01"); +} + +bool ScriptMA01::MouseClick(int x, int y) { + return Region_Check(286, 326, 348, 384); +} + +bool ScriptMA01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptMA01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA01::ClickedOnExit(int exitId) { + if (Actor_Query_Goal_Number(19) == 21) { + return true; + } + if (exitId == 0) { + if (Actor_Query_Goal_Number(19) == 20) { + if (!Loop_Actor_Walk_To_XYZ(0, 1446.0f, 0.0f, -725.0f, 72, 1, false, 0)) { + Actor_Set_Goal_Number(19, 21); + Scene_Exits_Disable(); + } + } else if (!Loop_Actor_Walk_To_XYZ(0, 1446.0f, 0.0f, -725.0f, 12, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(37); + Set_Enter(52, 52); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 381.0f, 0.0f, 54.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + Actor_Face_Heading(0, 736, false); + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(180); + Game_Flag_Reset(261); + Game_Flag_Reset(177); + Game_Flag_Reset(258); + Game_Flag_Reset(178); + int spinnerDest = Spinner_Interface_Choose_Dest(3, 0); + + switch (spinnerDest) { + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(250); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(250); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(250); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(250); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(250); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(250); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(250); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(250); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(250); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 4, 1); + break; + default: + Actor_Set_Invisible(0, false); + Actor_Face_Heading(0, 736, false); + Game_Flag_Set(179); + break; + } + } + return true; + } + return false; +} + +bool ScriptMA01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA01::SceneFrameAdvanced(int frame) { + if (frame == 15) { + Ambient_Sounds_Play_Sound(102, 70, -100, 100, 0); + } + if (frame == 61 || frame == 183) { + Ambient_Sounds_Play_Sound(116, 100, 40, 0, 99); + } + if (frame == 107 || frame == 227) { + Ambient_Sounds_Play_Sound(119, 100, 40, 0, 99); + } + if (frame == 1) { + Ambient_Sounds_Play_Sound(118, 40, -60, 20, 99); + } + if (frame == 241) { + Ambient_Sounds_Play_Sound(117, 40, 0, 0, 99); + } + if (frame == 58) { + Sound_Play(122, 17, 20, 20, 50); + } + if ((frame == 75 || frame == 196) && Game_Flag_Query(273)) { + Actor_Face_Heading(0, 736, false); + Actor_Change_Animation_Mode(0, 42); + Game_Flag_Reset(273); + } else { + if (frame == 196 && !Game_Flag_Query(273)) { + Actor_Change_Animation_Mode(0, 41); + //return true; + return; + } + if (frame == 240) { + Player_Gains_Control(); + } + } + //return true; +} + +void ScriptMA01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA01::PlayerWalkedIn() { +} + +void ScriptMA01::PlayerWalkedOut() { + Actor_Set_Invisible(0, false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(37) && Global_Variable_Query(1) == 1) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(37, 1, -1); + Outtake_Play(34, 1, -1); + Outtake_Play(36, 1, -1); + } +} + +void ScriptMA01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma02.cpp b/engines/bladerunner/script/ma02.cpp new file mode 100644 index 0000000000..6448b93caa --- /dev/null +++ b/engines/bladerunner/script/ma02.cpp @@ -0,0 +1,267 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA02::InitializeScene() { + if (Game_Flag_Query(36)) { + Setup_Scene_Information(-172.0f, -144.13f, 6.27f, 500); + } else { + Setup_Scene_Information(23.19f, -144.12f, 378.27f, 750); + if (Global_Variable_Query(1) == 4) { + Actor_Set_Goal_Number(40, 300); + } + Game_Flag_Reset(711); + } + Scene_Exit_Add_2D_Exit(0, 538, 84, 639, 327, 1); + Scene_Exit_Add_2D_Exit(1, 56, 98, 150, 260, 0); + if (Global_Variable_Query(1) >= 4 && Global_Variable_Query(1) == 5 && Game_Flag_Query(653)) { + Actor_Set_Goal_Number(66, 599); + Actor_Change_Animation_Mode(66, 88); + Actor_Put_In_Set(66, 10); + Actor_Set_At_XYZ(66, -35.51f, -144.12f, 428.0f, 0); + Actor_Retired_Here(66, 24, 24, 1, -1); + } + Ambient_Sounds_Add_Looping_Sound(104, 12, 0, 1); + Ambient_Sounds_Add_Looping_Sound(71, 25, 0, 1); + Ambient_Sounds_Add_Sound(72, 5, 30, 5, 5, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 30, 5, 5, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 30, 5, 5, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 60, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 60, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(87, 10, 60, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 60, 180, 14, 14, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 14, 14, 0, 0, -101, -101, 0, 0); + if (sub_401F7C()) { + Ambient_Sounds_Add_Sound(403, 3, 3, 27, 27, -100, -100, -100, -100, 99, 0); + } + if (Global_Variable_Query(1) == 5 && Game_Flag_Query(653) && !Actor_Clue_Query(0, 264)) { + Overlay_Play("MA02OVER", 0, 1, 0, 0); + } +} + +void ScriptMA02::SceneLoaded() { + Obstacle_Object("COUCH1", true); + Unobstacle_Object("COUCH1", true); + Clickable_Object("BAR-MAIN"); + Clickable_Object("E-ESPER"); +} + +bool ScriptMA02::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA02::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("E-ESPER", objectName)) { + Actor_Face_Object(0, "E-ESPER", true); + Delay(1000); + ESPER_Flag_To_Activate(); + return true; + } + if (Object_Query_Click("BAR-MAIN", objectName) && !Loop_Actor_Walk_To_XYZ(0, -29.0f, -140.4f, 298.0f, 36, 1, false, 0)) { + Actor_Face_Object(0, "BAR-MAIN", true); + if (Global_Variable_Query(1) < 4) { + Actor_Set_Goal_Number(66, 3); + } else if (Global_Variable_Query(1) == 5 && Game_Flag_Query(653) && !Actor_Clue_Query(0, 264)) { + Overlay_Remove("MA02OVER"); + Item_Pickup_Spin_Effect(985, 480, 240); + Actor_Voice_Over(1150, 99); + Actor_Voice_Over(1160, 99); + Actor_Voice_Over(1170, 99); + Actor_Voice_Over(1180, 99); + Actor_Voice_Over(1190, 99); + Actor_Voice_Over(1200, 99); + Actor_Clue_Acquire(0, 264, 1, -1); + } else { + Actor_Says(0, 8526, 0); + } + return true; + } + return false; +} + +bool ScriptMA02::ClickedOnActor(int actorId) { + if (actorId == 66 && Actor_Query_Goal_Number(66) == 599) { + if (!Loop_Actor_Walk_To_Actor(0, 66, 30, 1, false)) { + Actor_Face_Actor(0, 66, true); + Actor_Voice_Over(1140, 99); + } + } + return false; +} + +bool ScriptMA02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 23.19f, -144.12f, 378.27f, 0, 1, false, 0)) { + Music_Stop(10); + Game_Flag_Set(33); + Set_Enter(52, 52); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -168.0f, -144.13f, 10.27f, 0, 1, false, 0)) { + Game_Flag_Set(35); + Set_Enter(50, 50); + } + return true; + } + return false; +} + +bool ScriptMA02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA02::SceneFrameAdvanced(int frame) { +} + +void ScriptMA02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA02::PlayerWalkedIn() { + if (Game_Flag_Query(34)) { + sub_402044(); + } + if (Game_Flag_Query(36)) { + Loop_Actor_Walk_To_XYZ(0, -148.12f, -144.13f, 34.27f, 0, 1, false, 0); + } + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(655)) { + Game_Flag_Set(623); + Game_Flag_Set(655); + sub_401E4C(); + Loop_Actor_Walk_To_XYZ(0, 23.19f, -144.12f, 378.27f, 0, 0, false, 0); + Game_Flag_Set(33); + Set_Enter(52, 52); + // return true; + return; + } + if (Global_Variable_Query(1) == 5 && !Game_Flag_Query(654)) { + if (Game_Flag_Query(653)) { + Actor_Says(0, 2390, 0); + Music_Play(2, 25, 0, 3, -1, 0, 0); + } else { + Actor_Says(0, 2385, 3); + } + Game_Flag_Set(654); + Autosave_Game(3); + } + if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(36) && Actor_Query_Goal_Number(66) != 2) { + Actor_Set_Goal_Number(66, 1); + if (!Game_Flag_Query(60)) { + Game_Flag_Set(60); + Actor_Face_Actor(0, 66, true); + Actor_Voice_Over(1210, 99); + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(1220, 99); + } + Actor_Voice_Over(1230, 99); + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(1240, 99); + Actor_Voice_Over(1250, 99); + } + } + } + Game_Flag_Reset(36); + Game_Flag_Reset(34); + //return false; + return; +} + +void ScriptMA02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptMA02::DialogueQueueFlushed(int a1) { +} + +void ScriptMA02::sub_401E4C() { + Actor_Says(0, 2365, 13); + Actor_Says(40, 0, 13); + Actor_Says(0, 2370, 13); + Actor_Says(40, 10, 13); + Actor_Says(0, 2375, 13); + Actor_Says(40, 20, 13); + Actor_Says(0, 2380, 13); + Sound_Play(492, 100, 0, 100, 50); + Actor_Says(40, 40, 13); + Delay(3000); +} + +bool ScriptMA02::sub_401F7C() { + return Global_Variable_Query(1) == 5 + && !Actor_Clue_Query(0, 143) + && !Actor_Clue_Query(0, 144) + && !Actor_Clue_Query(0, 139) + && !Actor_Clue_Query(0, 140) + && !Actor_Clue_Query(0, 141) + && !Actor_Clue_Query(0, 142); +} + +void ScriptMA02::sub_402044() { + // int v0; + // int v1; + // int v3[7]; + + // v0 = 0; + + int i = 0; + int arr[7]; + if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) { + // v0 = 1; + // v3[0] = 0; + arr[i++] = 0; + } + + // v1 = v0 + 1; + // v3[v0] = 1; + arr[i++] = 1; + if (Global_Variable_Query(1) >= 3) { + // v3[v1] = 2; + // v1 = v0 + 2; + arr[i++] = 2; + } + if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) { + // v3[v1++] = 3; + arr[i++] = 3; + } + if (Game_Flag_Query(171) && Game_Flag_Query(170)) { + // v3[v1++] = 4; + arr[i++] = 4; + } + //if (v1 <= 0) { + if (i == 0) { + Global_Variable_Set(52, -1); + } else { + // Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]); + Global_Variable_Set(52, arr[Random_Query(0, i - 1)]); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma04.cpp b/engines/bladerunner/script/ma04.cpp new file mode 100644 index 0000000000..f31c73275d --- /dev/null +++ b/engines/bladerunner/script/ma04.cpp @@ -0,0 +1,565 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA04::InitializeScene() { + if (Game_Flag_Query(63)) { + Setup_Scene_Information(-7199.0f, 953.97f, 1579.0f, 502); + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Scene_Loop_Start_Special(0, 0, 0); + } + } else if (Game_Flag_Query(35)) { + Setup_Scene_Information(-7099.0f, 954.0f, 1866.0f, 502); + } else if (Game_Flag_Query(647)) { + Setup_Scene_Information(-7107.0f, 954.0f, 1742.0f, 502); + Scene_Loop_Start_Special(0, 4, 0); + } else { + Setup_Scene_Information(-7143.0f, 954.0f, 1868.0f, 733); + } + Scene_Exit_Add_2D_Exit(0, 496, 0, 639, 354, 1); + Scene_Exit_Add_2D_Exit(1, 33, 63, 113, 258, 0); + Scene_Exit_Add_2D_Exit(2, 248, 98, 314, 284, 1); + Scene_2D_Region_Add(0, 343, 97, 353, 190); + Scene_2D_Region_Add(1, 0, 340, 116, 479); + Ambient_Sounds_Add_Looping_Sound(408, 30, 0, 1); + Ambient_Sounds_Add_Looping_Sound(103, 30, -80, 1); + Ambient_Sounds_Add_Looping_Sound(104, 12, 0, 1); + Ambient_Sounds_Add_Sound(72, 5, 30, 11, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 30, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 30, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 60, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 60, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(87, 10, 60, 16, 16, -100, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + if (sub_402758()) { + Ambient_Sounds_Add_Sound(403, 3, 3, 100, 100, 0, 0, 0, 0, 99, 0); + } + Scene_Loop_Set_Default(1); +} + +void ScriptMA04::SceneLoaded() { + Obstacle_Object("BED-DOG DISH", true); + Unobstacle_Object("BEDDog BONE", true); + Unobstacle_Object("BED-BOOK1", true); + Clickable_Object("BED-SHEETS"); + if (Game_Flag_Query(711)) { + Unclickable_Object("BED-TV-1"); + Unclickable_Object("BED-TV-2"); + } else { + Clickable_Object("BED-TV-1"); + Clickable_Object("BED-TV-2"); + } +} + +bool ScriptMA04::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA04::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BED-SHEETS", objectName)) { + sub_403DA8(); + return false; + } + if (Object_Query_Click("BED-TV-1", objectName) || Object_Query_Click("BED-TV-2", objectName)) { + if (!Loop_Actor_Walk_To_Scene_Object(0, "BED-TV-2", 24, 1, false)) { + Game_Flag_Set(711); + Unclickable_Object("BED-TV-1"); + Unclickable_Object("BED-TV-2"); + Sound_Play(132, 100, 0, 0, 50); + sub_403864(); + return false; + } + return true; + } + return false; +} + +bool ScriptMA04::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -7099.0f, 954.0f, 1866.0f, 0, 1, false, 0)) { + Game_Flag_Set(36); + Set_Enter(10, 49); + } + return true; + } + if (exitId == 1) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if (z <= 1677.0f || !Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1675.0f, 0, 1, false, 0)) { + if (sub_402888()) { + Overlay_Remove("MA04OVER"); + } + Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1675.0f, 0, 0, false, 1); + Game_Flag_Set(62); + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Async_Actor_Walk_To_XYZ(0, -7199.0f, 956.17f, 1568.0f, 0, false); + } + Set_Enter(51, 51); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -7115.0f, 954.0f, 1742.0f, 0, 1, false, 0)) { + int sounds[] = {252, 405, 404, 407, 406}; + Ambient_Sounds_Play_Sound(sounds[Random_Query(0, 4)], 50, 0, 0, 0); + Delay(3000); + Loop_Actor_Walk_To_XYZ(0, -7139.0f, 954.0f, 1746.0f, 0, 1, false, 1); + } + } + return false; +} + +bool ScriptMA04::ClickedOn2DRegion(int region) { + if (Player_Query_Combat_Mode()) { + return false; + } + if (region == 1) { + sub_403DA8(); + return true; + } + if (region == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -7176.0f, 954.0f, 1806.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 256, false); + if (sub_402758()) { + Actor_Says(0, 2680, 0); + Ambient_Sounds_Remove_Sound(403, true); + Sound_Play(123, 100, 0, 0, 50); + Overlay_Remove("MA04OVER"); + Delay(500); + if (Game_Flag_Query(653)) { + if (Global_Variable_Query(45) == 2) { + sub_4028A8(); + } else if (Global_Variable_Query(45) == 3) { + sub_402F2C(); + } else { + sub_4034D8(); + } + } else { + sub_4032A0(); + } + Music_Play(2, 52, 0, 3, -1, 0, 0); + return false; + } + if (Actor_Clue_Query(5, 222) && !Game_Flag_Query(649)) { + Sound_Play(123, 100, 0, 0, 50); + Overlay_Remove("MA04OVER"); + Delay(500); + Actor_Says(5, 310, 3); + Actor_Says(5, 320, 3); + if (!Game_Flag_Query(378) && Global_Variable_Query(1) < 3) { + Actor_Voice_Over(1300, 99); + Actor_Voice_Over(1310, 99); + Actor_Voice_Over(1320, 99); + } + Actor_Says(0, 2445, 13); + Sound_Play(123, 100, 0, 0, 50); + Game_Flag_Set(649); + return true; + } + if (Actor_Clue_Query(6, 215) && !Game_Flag_Query(650)) { + Sound_Play(123, 100, 0, 0, 50); + Overlay_Remove("MA04OVER"); + Delay(500); + Actor_Says(6, 500, 3); + Actor_Says(6, 510, 3); + if (!Game_Flag_Query(378) && Global_Variable_Query(1) < 3) { + Actor_Voice_Over(1330, 99); + Actor_Voice_Over(1340, 99); + Actor_Voice_Over(1350, 99); + } + Actor_Says(0, 2445, 13); + Sound_Play(123, 100, 0, 0, 50); + Game_Flag_Set(650); + return true; + } + Actor_Says(0, 2670, 13); + if (!Game_Flag_Query(378)) { + Actor_Says(0, 2675, 17); + } + } + return true; + } + return false; +} + +void ScriptMA04::SceneFrameAdvanced(int frame) { + Set_Fade_Color(0, 0, 0); + if (frame >= 91 && frame < 121) { + Set_Fade_Density((frame - 91) / 30.0f); + } else if (frame >= 121 && frame < 151) { + Set_Fade_Density((151 - frame) / 30.0f); + } else { + Set_Fade_Density(0.0f); + } + if (frame == 121 && (Game_Flag_Query(40) == 1 || Game_Flag_Query(41) == 1) && !Game_Flag_Query(159)) { + Sound_Play(403, 50, 0, 0, 50); + } +} + +void ScriptMA04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA04::PlayerWalkedIn() { + if (Game_Flag_Query(647)) { + Player_Gains_Control(); + } + if (sub_402820() || sub_402758()) { + Overlay_Play("MA04OVER", 0, 1, 0, 0); + } + if (Game_Flag_Query(647)) { + Loop_Actor_Walk_To_XYZ(0, -7139.0f, 954.0f, 1746.0f, 0, 1, false, 0); + } else if (Game_Flag_Query(35)) { + Loop_Actor_Walk_To_XYZ(0, -7143.0f, 954.0f, 1868.0f, 0, 1, false, 0); + } + Game_Flag_Reset(35); + Game_Flag_Reset(63); + Game_Flag_Reset(647); + if (Game_Flag_Query(61)) { + if (Global_Variable_Query(1) == 2 && !Actor_Clue_Query(0, 43)) { + Sound_Play(403, 100, 0, 0, 50); + Loop_Actor_Walk_To_XYZ(0, -7176.0f, 954.0f, 1806.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 256, true); + Actor_Says(0, 2680, 0); + Sound_Play(123, 100, 0, 0, 50); + Delay(500); + Actor_Says(4, 0, 3); + Actor_Says(0, 2685, 13); + Actor_Says(4, 10, 3); + Actor_Says(0, 2690, 17); + Actor_Says(4, 30, 3); + Actor_Says(0, 2695, 12); + Actor_Says(4, 40, 3); + Actor_Says(4, 50, 3); + Actor_Says(0, 2700, 3); + Actor_Says(4, 60, 3); + Actor_Says(4, 70, 3); + Sound_Play(123, 100, 0, 0, 50); + Actor_Clue_Acquire(0, 43, 1, 4); + Spinner_Set_Selectable_Destination_Flag(5, 1); + Game_Flag_Set(186); + if (!Game_Flag_Query(163)) { + Game_Flag_Set(163); + Item_Remove_From_World(66); + } + Actor_Set_Goal_Number(23, 99); + Actor_Put_In_Set(23, 93); + Actor_Set_At_Waypoint(23, 35, 0); + Autosave_Game(0); + } + //return false; + return; + } + if ((Game_Flag_Query(40) || Game_Flag_Query(41)) && !Game_Flag_Query(146)) { + Music_Play(2, 52, 0, 2, -1, 0, 0); + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1677.0f, 0, 1, false, 0); + if (sub_402820() || sub_402758()) { + Overlay_Remove("MA04OVER"); + } + Loop_Actor_Walk_To_XYZ(0, -7199.0f, 955.0f, 1675.0f, 0, 1, false, 0); + Game_Flag_Set(146); + Async_Actor_Walk_To_XYZ(0, -7204.0f, 956.17f, 1568.0f, 0, false); + Set_Enter(51, 51); + } +} + +void ScriptMA04::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (Game_Flag_Query(678)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(1, 0, -1); + Game_Flag_Reset(678); + } +} + +void ScriptMA04::DialogueQueueFlushed(int a1) { + Overlay_Remove("MA04OVR2"); +} + +bool ScriptMA04::sub_402758() { + return Global_Variable_Query(1) == 5 && !Actor_Clue_Query(0, 143) && !Actor_Clue_Query(0, 144) && !Actor_Clue_Query(0, 139) && !Actor_Clue_Query(0, 140) && !Actor_Clue_Query(0, 141) && !Actor_Clue_Query(0, 142); +} + +bool ScriptMA04::sub_402820() { + return (Actor_Clue_Query(5, 222) && !Game_Flag_Query(649)) || (Actor_Clue_Query(6, 215) && !Game_Flag_Query(650)); +} + +bool ScriptMA04::sub_402888() { + return sub_402820() || sub_402758(); +} + +void ScriptMA04::sub_4028A8() { + int answer; + Actor_Says(3, 220, 3); + Actor_Says(0, 2460, 0); + Actor_Says(3, 230, 3); + Actor_Says(3, 240, 3); + Actor_Says(0, 2465, 0); + Actor_Says(3, 250, 3); + Actor_Says_With_Pause(0, 2470, 1.5f, 17); + Actor_Says(3, 260, 3); + Actor_Says(0, 2475, 15); + Actor_Says(3, 270, 3); + Actor_Says(0, 2480, 0); + Actor_Says(3, 280, 3); + Actor_Says(3, 290, 3); + Actor_Says(0, 2485, 19); + Actor_Says(3, 300, 3); + Actor_Says(3, 310, 3); + Actor_Says(0, 2490, 0); + Actor_Says(3, 330, 3); + Actor_Says(0, 2495, 0); + Actor_Says(3, 340, 3); + Actor_Says(3, 350, 3); + if (Game_Flag_Query(165) || Actor_Query_Goal_Number(9) == 2) { + answer = 1170; + } else { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(1160, 1, 1, 2); + DM_Add_To_List_Never_Repeat_Once_Selected(1170, 2, 1, 1); + Dialogue_Menu_Appear(320, 240); + answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + } + if (answer == 1160) { + Actor_Says(0, 2500, 19); + Actor_Says(3, 360, 3); + Actor_Says(0, 2510, 0); + Actor_Says(3, 370, 3); + Actor_Says(3, 380, 3); + Actor_Says(0, 2515, 12); + Actor_Says(3, 390, 3); + Actor_Says(0, 2520, 13); + Actor_Says(3, 400, 3); + Actor_Says(3, 410, 3); + Actor_Says(0, 2525, 15); + Actor_Says(3, 420, 3); + Sound_Play(123, 100, 0, 0, 50); + Actor_Clue_Acquire(0, 139, 1, -1); + } else { + Actor_Says_With_Pause(0, 2505, 0.5f, 19); + Actor_Says(3, 430, 3); + Actor_Says(3, 440, 3); + Actor_Says(0, 2530, 0); + Actor_Says(3, 450, 3); + Actor_Says(0, 2535, 12); + Actor_Says(3, 460, 3); + Actor_Says_With_Pause(3, 470, 1.0f, 3); + Actor_Says(3, 480, 3); + Actor_Says(3, 490, 3); + Sound_Play(123, 100, 0, 0, 50); + Actor_Says(0, 2540, 15); + Actor_Clue_Acquire(0, 140, 1, -1); + } +} + +void ScriptMA04::sub_402F2C() { + Actor_Says(6, 530, 3); + Actor_Says(0, 2545, 19); + Actor_Says(6, 540, 3); + Actor_Says(6, 550, 3); + Actor_Says(0, 2550, 13); + Actor_Says(6, 560, 3); + Actor_Says(0, 2555, 19); + Actor_Says(6, 570, 3); + Actor_Says(0, 2560, 17); + Actor_Says(6, 580, 3); + if (Game_Flag_Query(165) || Actor_Query_Goal_Number(9) == 2) { + Actor_Says(6, 630, 3); + Actor_Says_With_Pause(0, 2575, 0.0f, 15); + if (!Game_Flag_Query(378)) { + Actor_Says(6, 640, 3); + } + Actor_Clue_Acquire(0, 142, 1, -1); + } else { + Actor_Says(6, 590, 3); + Actor_Says(0, 2565, 12); + Actor_Says(6, 600, 3); + Actor_Says(6, 610, 3); + Actor_Says(6, 620, 3); + Actor_Says(0, 2570, 13); + Actor_Says_With_Pause(6, 630, 0.0f, 3); + Actor_Says_With_Pause(0, 2575, 0.0f, 15); + if (!Game_Flag_Query(378)) { + Actor_Says(6, 640, 3); + } + Actor_Clue_Acquire(0, 141, 1, -1); + } + Sound_Play(123, 100, 0, 0, 50); +} + +void ScriptMA04::sub_4032A0() { + Actor_Says(1, 680, 3); + Actor_Says(0, 2630, 17); + Actor_Says(1, 690, 3); + Actor_Says(0, 2635, 18); + Actor_Says(1, 700, 3); + Actor_Says(0, 2640, 14); + Actor_Says(1, 710, 3); + Actor_Says(1, 720, 3); + Actor_Says(0, 2645, 13); + Actor_Says(1, 740, 3); + Actor_Says(1, 750, 3); + Actor_Says(0, 2650, 12); + Actor_Says(1, 760, 3); + Actor_Says(0, 2665, 13); + Actor_Says(1, 810, 3); + Actor_Says(1, 820, 3); + Sound_Play(123, 100, 0, 0, 50); + Actor_Clue_Acquire(0, 144, 1, -1); +} + +void ScriptMA04::sub_4034D8() { + Actor_Says(5, 330, 3); + Actor_Says(0, 2580, 14); + Actor_Says(5, 340, 3); + Actor_Says(0, 2585, 19); + Actor_Says(5, 350, 3); + Actor_Says(5, 360, 3); + Actor_Says(0, 2590, 18); + Actor_Says(5, 370, 3); + Actor_Says(0, 2595, 15); + Actor_Says(5, 390, 3); + Actor_Says(5, 400, 3); + Actor_Says(5, 410, 3); + Actor_Says(0, 2600, 15); + Actor_Says_With_Pause(5, 420, 1.5f, 3); + Actor_Says(0, 2605, 17); + Actor_Says(5, 430, 3); + Actor_Says(5, 440, 3); + Actor_Says(0, 2610, 3); + Actor_Says(5, 450, 3); + Actor_Says(5, 460, 3); + Actor_Says(5, 470, 3); + Actor_Says(5, 480, 3); + Actor_Says(5, 490, 3); + Actor_Says(0, 2615, 17); + Actor_Says(5, 500, 3); + Actor_Says(5, 530, 3); + Actor_Says(5, 540, 3); + Sound_Play(123, 100, 0, 0, 50); + Actor_Clue_Acquire(0, 143, 1, -1); +} + +void ScriptMA04::sub_403864() { + Overlay_Play("MA04OVR2", 0, 1, 0, 0); + switch (Global_Variable_Query(52)) { + case 4: + ADQ_Add(61, 230, 3); + ADQ_Add(61, 240, 3); + break; + case 3: + ADQ_Add(61, 170, 3); + ADQ_Add(61, 180, 3); + ADQ_Add(61, 190, 3); + ADQ_Add(61, 200, 3); + ADQ_Add(61, 210, 3); + ADQ_Add(61, 220, 3); + ADQ_Add(41, 80, 3); + ADQ_Add(41, 90, 3); + ADQ_Add(41, 100, 3); + ADQ_Add(41, 110, 3); + ADQ_Add(41, 120, 3); + ADQ_Add(41, 130, 3); + break; + case 2: + if (Actor_Query_Friendliness_To_Other(5, 0) <= Actor_Query_Friendliness_To_Other(1, 0)) { + ADQ_Add(61, 90, 3); + ADQ_Add(61, 100, 3); + ADQ_Add(61, 110, 3); + ADQ_Add(4, 1540, 3); + ADQ_Add(4, 1550, 3); + ADQ_Add(4, 1560, 3); + } else { + ADQ_Add(61, 120, 3); + ADQ_Add(61, 130, 3); + ADQ_Add(61, 140, 3); + ADQ_Add(61, 150, 3); + ADQ_Add(4, 1570, 3); + ADQ_Add(4, 1580, 3); + ADQ_Add(4, 1590, 3); + } + break; + case 1: + ADQ_Add(61, 40, 3); + ADQ_Add(61, 50, 3); + ADQ_Add(61, 60, 3); + ADQ_Add(61, 70, 3); + ADQ_Add(61, 80, 3); + break; + case 0: + ADQ_Add(61, 0, 3); + ADQ_Add(61, 10, 3); + ADQ_Add(61, 20, 3); + ADQ_Add(61, 30, 3); + ADQ_Add(51, 430, 3); + ADQ_Add(51, 440, 3); + ADQ_Add(51, 450, 3); + ADQ_Add(51, 460, 3); + break; + } +} + +void ScriptMA04::sub_403DA8() { + if (!Loop_Actor_Walk_To_Scene_Object(0, "BED-SHEETS", 12, 1, false)) { + Actor_Says(0, 8530, 12); + Music_Stop(4); + if (sub_402820() || sub_402758()) { + Overlay_Remove("MA04OVER"); + } + Player_Loses_Control(); + Game_Flag_Set(647); + if ((Game_Flag_Query(40) || Game_Flag_Query(41)) && Global_Variable_Query(1) == 1) { + if (Actor_Query_Goal_Number(19) == 599) { + Actor_Put_In_Set(19, 91); + Actor_Set_At_Waypoint(19, 33, 0); + } + Game_Flag_Set(678); + Global_Variable_Set(1, 2); + Chapter_Enter(2, 10, 50); + if (Query_Difficulty_Level() != 0) { + if (!Game_Flag_Query(723)) { + Global_Variable_Increment(2, 200); + } + } + } else { + Set_Enter(10, 50); + } + Scene_Loop_Start_Special(1, 3, 0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma05.cpp b/engines/bladerunner/script/ma05.cpp new file mode 100644 index 0000000000..839d91388e --- /dev/null +++ b/engines/bladerunner/script/ma05.cpp @@ -0,0 +1,142 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA05::InitializeScene() { + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Setup_Scene_Information(-7204.0f, 953.97f, 1651.0f, 0); + } else { + Setup_Scene_Information(-7207.0f, 956.17f, 1564.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 432, 21, 471, 226, 1); + Ambient_Sounds_Add_Looping_Sound(101, 90, 0, 1); + Ambient_Sounds_Add_Looping_Sound(99, 40, -100, 1); + Ambient_Sounds_Add_Looping_Sound(103, 50, 60, 1); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 27, 47, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 100, 25, 50, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(87, 10, 70, 25, 25, -100, 0, -101, -101, 0, 0); + if (sub_401990()) { + Ambient_Sounds_Add_Sound(403, 3, 3, 32, 32, 100, 100, -101, -101, 0, 0); + } + if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) { + Scene_Loop_Start_Special(0, 0, 0); + } + Scene_Loop_Set_Default(1); +} + +void ScriptMA05::SceneLoaded() { + Obstacle_Object("Z-BOX-RAIL03", true); + Footstep_Sounds_Set(0, 0); + Footstep_Sounds_Set(1, 3); +} + +bool ScriptMA05::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA05::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptMA05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0)) { + Loop_Actor_Walk_To_XYZ(0, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0); + Game_Flag_Set(63); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Async_Actor_Walk_To_XYZ(0, -7199.0f, 953.97f, 1685.0f, 0, false); + Set_Enter(50, 50); + } + return true; + } + return false; +} + +bool ScriptMA05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA05::SceneFrameAdvanced(int frame) { + if (frame == 20) { + Sound_Play(102, 70, -100, 100, 50); + } + //return true; +} + +void ScriptMA05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA05::PlayerWalkedIn() { + Music_Play(2, 52, 0, 2, -1, 0, 0); + if ((Random_Query(0, 4) == 1 || (Game_Flag_Query(146) == 1 && !Game_Flag_Query(61))) && Global_Variable_Query(1) == 1) { + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 3, 1); + Sound_Play(69, 100, 0, 0, 50); + } + if (Game_Flag_Query(146) && !Game_Flag_Query(61)) { + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(1260, 99); + Actor_Voice_Over(1270, 99); + Actor_Voice_Over(1280, 99); + Actor_Voice_Over(1290, 99); + } + Game_Flag_Set(61); + Player_Gains_Control(); + } + //return false; +} + +void ScriptMA05::PlayerWalkedOut() { +} + +void ScriptMA05::DialogueQueueFlushed(int a1) { +} + +bool ScriptMA05::sub_401990() { + return Global_Variable_Query(1) == 5 + && !Actor_Clue_Query(0, 143) + && !Actor_Clue_Query(0, 144) + && !Actor_Clue_Query(0, 139) + && !Actor_Clue_Query(0, 140) + && !Actor_Clue_Query(0, 141) + && !Actor_Clue_Query(0, 142); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma06.cpp b/engines/bladerunner/script/ma06.cpp new file mode 100644 index 0000000000..caea6cd293 --- /dev/null +++ b/engines/bladerunner/script/ma06.cpp @@ -0,0 +1,154 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA06::InitializeScene() { + Setup_Scene_Information(40.0f, 1.0f, -20.0f, 400); + Ambient_Sounds_Add_Looping_Sound(210, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(408, 33, 0, 1); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Sound_Play(209, 100, 50, 50, 100); +} + +void ScriptMA06::SceneLoaded() { + Obstacle_Object("PANEL", true); + Clickable_Object("PANEL"); + Player_Loses_Control(); +} + +bool ScriptMA06::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptMA06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA06::ClickedOnExit(int exitId) { + return false; +} + +bool ScriptMA06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA06::SceneFrameAdvanced(int frame) { +} + +void ScriptMA06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA06::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, 40.0f, 1.35f, 0.0f, 0, 0, false, 0); + Actor_Face_Object(0, "panel", true); + Delay(500); + sub_4014E4(); + if (sub_4012C0()) { + Sound_Play(114, 25, 0, 0, 50); + Delay(4000); + } + Game_Flag_Reset(37); + Game_Flag_Reset(33); + Game_Flag_Reset(57); + if (Game_Flag_Query(38)) { + Set_Enter(49, 48); + } else if (Game_Flag_Query(34)) { + Set_Enter(10, 49); + } else { + Set_Enter(53, 53); + } + Scene_Loop_Start_Special(1, 3, 1); + Sound_Play(208, 100, 50, 50, 50); + //return true; +} + +void ScriptMA06::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Player_Gains_Control(); +} + +void ScriptMA06::DialogueQueueFlushed(int a1) { +} + +bool ScriptMA06::sub_4012C0() { + return (Game_Flag_Query(37) && !Game_Flag_Query(38)) || (Game_Flag_Query(33) && !Game_Flag_Query(34)) || (Game_Flag_Query(57) && !Game_Flag_Query(58)); +} + +void ScriptMA06::sub_4014E4() { + Game_Flag_Reset(38); + Game_Flag_Reset(34); + Game_Flag_Reset(58); + while (true) { + if (Game_Flag_Query(34)) { + break; + } + if (Game_Flag_Query(38)) { + break; + } + if (Game_Flag_Query(58)) { + break; + } + Actor_Says(39, 80, 3); + Player_Gains_Control(); + int v1 = Elevator_Activate(1); + Player_Loses_Control(); + Scene_Loop_Start_Special(2, 1, 1); + if (v1 > 1) { + Game_Flag_Set(58); + } else if (v1 == 1) { + if (Game_Flag_Query(250)) { + Game_Flag_Set(38); + } else { + Sound_Play(412, 100, 0, 0, 50); + Delay(500); + Actor_Says(39, 610, 3); + } + } else { + Actor_Says(0, 2940, 18); + if (Global_Variable_Query(1) == 4 && Game_Flag_Query(655)) { + Sound_Play(412, 100, 0, 0, 50); + Delay(500); + Actor_Says(39, 610, 3); + Delay(500); + Actor_Says(0, 8527, 3); + } else { + Game_Flag_Set(34); + Actor_Says(39, 90, 3); + } + } + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma07.cpp b/engines/bladerunner/script/ma07.cpp new file mode 100644 index 0000000000..4222453302 --- /dev/null +++ b/engines/bladerunner/script/ma07.cpp @@ -0,0 +1,159 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA07::InitializeScene() { + if (Game_Flag_Query(356)) { + Setup_Scene_Information(6.75f, -172.43f, 356.0f, 997); + Game_Flag_Reset(356); + Game_Flag_Set(665); + } else if (Game_Flag_Query(673)) { + Setup_Scene_Information(-312.0f, -162.8f, 180.0f, 0); + } else { + Setup_Scene_Information(104.0f, -162.16f, 56.0f, 519); + } + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(374, 100, 300, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Global_Variable_Query(1) > 1) { + Scene_Exit_Add_2D_Exit(1, 0, 200, 50, 479, 3); + } + if (Game_Flag_Query(665)) { + Scene_Exit_Add_2D_Exit(2, 176, 386, 230, 426, 2); + } + Scene_Exit_Add_2D_Exit(0, 270, 216, 382, 306, 0); +} + +void ScriptMA07::SceneLoaded() { + Obstacle_Object("BARRICADE", true); +} + +bool ScriptMA07::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptMA07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 104.0f, -162.0f, 56.0f, 12, 1, false, 0)) { + if (Global_Variable_Query(1) == 4 && Game_Flag_Query(671)) { + Actor_Set_Goal_Number(0, 400); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(57); + Set_Enter(52, 52); + } + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -400.0f, -162.8f, 185.08f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(672); + Game_Flag_Reset(179); + Game_Flag_Set(178); + Set_Enter(68, 77); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 8.0f, -172.43f, 356.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(357); + Set_Enter(90, 103); + } + return true; + } + return false; +} + +bool ScriptMA07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA07::SceneFrameAdvanced(int frame) { +} + +void ScriptMA07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 53 && newGoal == 302) { + Scene_Exits_Enable(); + } +} + +void ScriptMA07::PlayerWalkedIn() { + if (Game_Flag_Query(673)) { + Loop_Actor_Walk_To_XYZ(0, -268.0f, -162.8f, 188.0f, 0, 0, false, 0); + Game_Flag_Reset(673); + } + if (Actor_Query_Goal_Number(57) == 300) { + Actor_Set_Goal_Number(57, 305); + } + if (Game_Flag_Query(58)) { + Game_Flag_Reset(58); + } + if (!Game_Flag_Query(648) && Game_Flag_Query(671) && Global_Variable_Query(1) == 4) { + Scene_Exits_Disable(); + Actor_Set_Goal_Number(53, 300); + } + if (Game_Flag_Query(666)) { + Actor_Voice_Over(1360, 99); + Actor_Voice_Over(1370, 99); + Actor_Voice_Over(1380, 99); + Actor_Voice_Over(1390, 99); + Actor_Voice_Over(1400, 99); + Delay(1000); + Game_Flag_Reset(666); + Game_Flag_Set(34); + Set_Enter(10, 49); + } + //return false; + +} + +void ScriptMA07::PlayerWalkedOut() { +} + +void ScriptMA07::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ma08.cpp b/engines/bladerunner/script/ma08.cpp new file mode 100644 index 0000000000..d2f105af9a --- /dev/null +++ b/engines/bladerunner/script/ma08.cpp @@ -0,0 +1,81 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptMA08::InitializeScene() { + Setup_Scene_Information(0, 0, 0, 0); + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); +} + +void ScriptMA08::SceneLoaded() { + Obstacle_Object("(undefined)", true); + Clickable_Object("(undefined)"); +} + +bool ScriptMA08::MouseClick(int x, int y) { + return false; +} + +bool ScriptMA08::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptMA08::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptMA08::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptMA08::ClickedOnExit(int exitId) { + return false; +} + +bool ScriptMA08::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptMA08::SceneFrameAdvanced(int frame) { +} + +void ScriptMA08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptMA08::PlayerWalkedIn() { +} + +void ScriptMA08::PlayerWalkedOut() { +} + +void ScriptMA08::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr01.cpp b/engines/bladerunner/script/nr01.cpp new file mode 100644 index 0000000000..a7ff7b2e3e --- /dev/null +++ b/engines/bladerunner/script/nr01.cpp @@ -0,0 +1,436 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR01::InitializeScene() { + if (Game_Flag_Query(617)) { + Setup_Scene_Information(-153.86f, 23.88f, -570.21f, 402); + } else if (Game_Flag_Query(632)) { + Setup_Scene_Information(-416.0f, 31.93f, -841.0f, 200); + Actor_Set_Invisible(0, true); + Preload(167); + } else if (Game_Flag_Query(534)) { + Setup_Scene_Information(-416.0f, 31.93f, -841.0f, 200); + } else if (Game_Flag_Query(342)) { + Setup_Scene_Information(-270.0f, 4.93f, -1096.0f, 500); + } else if (Game_Flag_Query(533)) { + Setup_Scene_Information(312.0f, 31.66f, -901.0f, 700); + } else if (Game_Flag_Query(545)) { + Setup_Scene_Information(-170.0f, 24.0f, -574.0f, 768); + } else { + Setup_Scene_Information(76.0f, 23.88f, -109.0f, 966); + } + Scene_Exit_Add_2D_Exit(0, 31, 270, 97, 373, 3); + if (Global_Variable_Query(1) > 3) { + Scene_Exit_Add_2D_Exit(1, 201, 320, 276, 357, 2); + } + Scene_Exit_Add_2D_Exit(2, 583, 262, 639, 365, 1); + if (Game_Flag_Query(255)) { + Scene_Exit_Add_2D_Exit(3, 320, 445, 639, 479, 2); + } + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(362, 22, 55, 1); + Ambient_Sounds_Add_Sound(361, 10, 10, 20, 20, -70, -70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 10, 80, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 10, 80, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 10, 80, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 10, 80, 33, 33, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 10, 80, 33, 33, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(643) && Actor_Query_Goal_Number(1) == 230) { + Game_Flag_Reset(255); + Game_Flag_Reset(256); + } + if (Game_Flag_Query(255) && !Game_Flag_Query(247)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Set(247); + } else if (Game_Flag_Query(255) && Game_Flag_Query(247)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(4); + } +} + +void ScriptNR01::SceneLoaded() { + Obstacle_Object("LAMPBASE01", true); + Unclickable_Object("LAMPBASE01"); +} + +bool ScriptNR01::MouseClick(int x, int y) { + if (Actor_Query_Goal_Number(0) == 212) { + Global_Variable_Increment(47, 4); + return true; + } + return false; +} + +bool ScriptNR01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptNR01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -380.0f, 31.93f, -841.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) > 3) { + Actor_Says(0, 8522, 12); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(535); + Set_Enter(55, 56); + } + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -281.0f, 31.93f, -1061.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 45, false); + Loop_Actor_Travel_Stairs(0, 3, 0, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(343); + Set_Enter(79, 91); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 312.0f, 31.66f, -901.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(532); + Set_Enter(11, 55); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, 108.0f, 23.88f, -93.0f, 0, 1, false, 0)) { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + Game_Flag_Reset(257); + Game_Flag_Reset(261); + Game_Flag_Reset(181); + switch (Spinner_Interface_Choose_Dest(-1, 1)) { + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(255); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 3, 1); + break; + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(255); + Game_Flag_Reset(247); + Game_Flag_Set(251); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 3, 1); + break; + default: + Player_Loses_Control(); + Game_Flag_Set(181); + Game_Flag_Set(247); + Player_Gains_Control(); + break; + } + } + return true; + } + return false; +} + +bool ScriptNR01::ClickedOn2DRegion(int region) { + if (region == 0 && Player_Query_Combat_Mode()) { + Sound_Play(517, 100, 0, 0, 50); + Actor_Set_Goal_Number(1, 260); + Scene_2D_Region_Remove(0); + } + if (region == 1 && Player_Query_Combat_Mode()) { + Sound_Play(517, 100, 0, 0, 50); + Actor_Set_Goal_Number(2, 299); + Actor_Set_Goal_Number(1, 258); + Scene_2D_Region_Remove(1); + return true; + } + return false; + +} + +void ScriptNR01::SceneFrameAdvanced(int frame) { + if (frame == 61) { + Sound_Play(118, 40, 0, 0, 50); + } + if (frame == 184) { + Sound_Play(117, 40, 80, 80, 50); + } + //return 0; +} + +void ScriptNR01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR01::PlayerWalkedIn() { + if (Game_Flag_Query(617)) { + Actor_Set_Goal_Number(1, 280); + Game_Flag_Reset(617); + //return true; + return; + } + if (Actor_Query_Goal_Number(1) == 250) { + Scene_Exits_Disable(); + ADQ_Flush(); + Actor_Set_Goal_Number(1, 251); + Scene_2D_Region_Add(0, 450, 316, 464, 333); + Scene_2D_Region_Add(1, 233, 321, 240, 362); + ADQ_Add(2, 70, 81); + ADQ_Add(1, 990, 3); + ADQ_Add(2, 80, 82); + ADQ_Add(2, 90, 81); + ADQ_Add(1, 1010, 3); + ADQ_Add(2, 100, 81); + ADQ_Add(1, 1020, 3); + ADQ_Add(2, 110, 82); + ADQ_Add(1, 1030, 3); + ADQ_Add(1, 1040, 3); + ADQ_Add(2, 120, 82); + } + if (Game_Flag_Query(604)) { + if (Game_Flag_Query(622)) { + ADQ_Add(25, 150, 3); + Game_Flag_Reset(622); + } + Game_Flag_Reset(604); + Player_Gains_Control(); + //return true; + return; + } + if (Game_Flag_Query(632)) { + Delay(3500); + Set_Enter(60, 64); + //return true; + return; + } + if (Game_Flag_Query(534)) { + Loop_Actor_Walk_To_XYZ(0, -380.0f, 31.73f, -841.0f, 0, 0, false, 0); + Game_Flag_Reset(534); + } else { + if (Game_Flag_Query(342)) { + Loop_Actor_Travel_Stairs(0, 3, 1, 0); + Game_Flag_Reset(342); + if (Actor_Query_Goal_Number(1) == 230) { + Actor_Face_Actor(1, 0, true); + Actor_Says(1, 1440, 13); + Loop_Actor_Walk_To_Actor(0, 1, 48, 0, true); + Actor_Says(0, 3145, 13); + if (Global_Variable_Query(40) != 3) { + Actor_Says(1, 1450, 12); + Actor_Says(1, 1460, 13); + } + Actor_Says(0, 3150, 14); + Actor_Says(1, 1470, 12); + Actor_Says(1, 1480, 13); + Actor_Says(0, 3155, 15); + Actor_Says(1, 1500, 16); + Actor_Says(0, 3160, 12); + if (Game_Flag_Query(643)) { + Actor_Says(1, 1330, 12); + Actor_Says(1, 1340, 12); + Actor_Says(1, 1350, 12); + Actor_Says(0, 3120, 15); + Actor_Says(1, 1360, 12); + Actor_Says(1, 1370, 12); + Actor_Says(0, 3125, 15); + Actor_Says(1, 1380, 12); + Actor_Says(0, 3130, 15); + Actor_Says(1, 1390, 12); + Actor_Says(1, 1400, 12); + Actor_Says(1, 1410, 12); + Actor_Says(0, 3135, 15); + Actor_Says(1, 1420, 12); + Actor_Says(0, 3140, 15); + Actor_Says(1, 1430, 12); + Actor_Set_Goal_Number(1, 285); + } else { + int v0 = Global_Variable_Query(40) - 1; + if (!v0) { + Actor_Says(1, 1510, 15); + Actor_Says(1, 1520, 14); + Actor_Says(1, 1530, 13); + Actor_Says(0, 3170, 13); + Actor_Set_Goal_Number(1, 231); + } else if (v0 == 1) { + Actor_Says(1, 1590, 15); + Actor_Says(0, 3195, 14); + Actor_Says(1, 1600, 16); + Actor_Says(0, 3200, 13); + Actor_Says(1, 1610, 17); + Actor_Says(1, 1620, 15); + Actor_Says(1, 1630, 14); + Actor_Says(0, 3205, 12); + Actor_Set_Goal_Number(1, 232); + } else if (v0 == 2) { + Actor_Says(1, 1540, 15); + Actor_Says(0, 3175, 13); + Actor_Says(1, 1550, 13); + Actor_Says(1, 1560, 16); + Actor_Says(0, 3180, 15); + Actor_Says(1, 1570, 12); + Actor_Says(1, 1580, 14); + Actor_Says(0, 3190, 12); + Actor_Set_Goal_Number(1, 233); + } + } + } + } else if (Game_Flag_Query(533)) { + Loop_Actor_Walk_To_XYZ(0, 239.0f, 31.66f, -901.0f, 0, 0, false, 0); + Game_Flag_Reset(533); + if (Actor_Query_Goal_Number(2) == 230) { + Scene_Exits_Disable(); + Actor_Set_Goal_Number(2, 231); + Non_Player_Actor_Combat_Mode_On(2, 0, 1, 0, 3, 4, 7, 8, -1, -1, -1, 20, 300, 0); + } + } else if (Game_Flag_Query(545)) { + Game_Flag_Reset(545); + Actor_Put_In_Set(25, 54); + Actor_Set_At_XYZ(25, -202.0f, 24.0f, -574.0f, 0); + Actor_Face_Heading(25, 256, false); + Actor_Set_Goal_Number(25, 204); + Player_Gains_Control(); + } else { + Loop_Actor_Walk_To_XYZ(0, 48.0f, 23.88f, -189.0f, 0, 0, false, 0); + } + } + if (Game_Flag_Query(652)) { + Game_Flag_Reset(652); + Actor_Voice_Over(950, 99); + Actor_Voice_Over(960, 99); + Actor_Voice_Over(970, 99); + Actor_Voice_Over(980, 99); + } + if (Actor_Query_Goal_Number(2) == 240) { + Scene_Exits_Disable(); + Actor_Set_Goal_Number(2, 241); + if (!Player_Query_Combat_Mode()) { + Player_Set_Combat_Mode(true); + } + } + //return false; + return; +} + +void ScriptNR01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(343) && !Game_Flag_Query(532) && !Game_Flag_Query(535) && !Game_Flag_Query(632) && !Game_Flag_Query(722)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(30, 1, -1); + Outtake_Play(35, 1, -1); + } + Game_Flag_Reset(722); +} + +void ScriptNR01::DialogueQueueFlushed(int a1) { + if (Actor_Query_Goal_Number(1) == 251 && Actor_Query_Goal_Number(2) != 299 && Actor_Query_Goal_Number(2) != 254 && Actor_Query_Goal_Number(2) != 255) { + Actor_Set_Goal_Number(1, 252); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr02.cpp b/engines/bladerunner/script/nr02.cpp new file mode 100644 index 0000000000..72903906a7 --- /dev/null +++ b/engines/bladerunner/script/nr02.cpp @@ -0,0 +1,215 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR02::InitializeScene() { + sub_402134(); + Setup_Scene_Information(-283.0f, -24.0f, 326.0f, 200); + Game_Flag_Reset(532); + Scene_Exit_Add_2D_Exit(0, 0, 105, 75, 291, 3); + Ambient_Sounds_Add_Looping_Sound(280, 50, 38, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); +} + +void ScriptNR02::SceneLoaded() { + Obstacle_Object("VID PHONE 01", true); + Unobstacle_Object("VICTORIAN CHAIR", true); + Unobstacle_Object("WALL CANDLES", true); + Unobstacle_Object("STAIRS", true); + Unobstacle_Object("BOX30", true); + Unobstacle_Object("VID CAM COVER", true); + Unobstacle_Object("VID CAM COVER01", true); + Unobstacle_Object("VID OUTER GLASS", true); + Unobstacle_Object("VID OUTER GLASS01", true); + Unobstacle_Object("VID MAIN MONITOR", true); + Unobstacle_Object("VID MAIN MONITOR01", true); + Clickable_Object("VID PHONE 01"); + Clickable_Object("VID PHONE 02"); +} + +bool ScriptNR02::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR02::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("VID PHONE 01", objectName) || Object_Query_Click("VID PHONE 02", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -191.9f, -24.0f, 62.15f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 13, false); + if (Actor_Clue_Query(0, 125) && Actor_Clue_Query(0, 126) && !Game_Flag_Query(670)) { + Actor_Set_Goal_Number(0, 350); + Game_Flag_Set(670); + } else { + Sound_Play(123, 50, 0, 0, 50); + Delay(1000); + Sound_Play(403, 30, 0, 0, 50); + Delay(1500); + Sound_Play(403, 30, 0, 0, 50); + Delay(1500); + Sound_Play(403, 30, 0, 0, 50); + Delay(1500); + Sound_Play(123, 50, 0, 0, 50); + Delay(1000); + Actor_Says(0, 170, 14); + } + } + } + return false; +} + +bool ScriptNR02::ClickedOnActor(int actorId) { + if (actorId == 2 && Actor_Query_Goal_Number(2) == 201 && !Loop_Actor_Walk_To_XYZ(0, 67.37f, -24.0f, 389.32f, 0, 1, false, 0)) { + Actor_Set_Goal_Number(2, 215); + } + return false; +} + +bool ScriptNR02::ClickedOnItem(int itemId, bool a2) { + if ((itemId == 89 || itemId == 90) && !Loop_Actor_Walk_To_XYZ(0, 109.38f, -24.0f, 420.5f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 423, false); + if (itemId == 89) { + Item_Remove_From_World(89); + Item_Pickup_Spin_Effect(953, 214, 380); + Actor_Clue_Acquire(0, 105, 1, -1); + } + if (itemId == 90) { + Item_Remove_From_World(90); + Item_Pickup_Spin_Effect(954, 214, 380); + Actor_Clue_Acquire(0, 106, 1, -1); + } + } + return false; +} + +bool ScriptNR02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -283.0f, -24.0f, 326.0f, 0, 1, false, 0)) { + if (Actor_Query_Goal_Number(2) < 230 || Actor_Query_Goal_Number(2) > 250) { + Music_Stop(2); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(533); + Set_Enter(54, 54); + } + return true; + } + return false; +} + +bool ScriptNR02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR02::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing() && (Actor_Query_Goal_Number(2) < 210 || Actor_Query_Goal_Number(2) > 222)) { + sub_402134(); + } + //return false; +} + +void ScriptNR02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR02::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(2) == 211) { + Actor_Set_Goal_Number(2, 220); + } + if (Actor_Query_Goal_Number(2) == 204) { + Actor_Set_Goal_Number(2, 205); + } + if (Actor_Query_Goal_Number(2) == 206) { + Actor_Set_Goal_Number(2, 205); + } + Loop_Actor_Walk_To_XYZ(0, -203.0f, -24.0f, 334.0f, 0, 0, false, 0); + //return false; +} + +void ScriptNR02::PlayerWalkedOut() { + Music_Stop(2); + if (Actor_Query_Goal_Number(2) < 210 && Actor_Query_Goal_Number(2) >= 205) { + Actor_Set_Goal_Number(2, 204); + } +} + +void ScriptNR02::DialogueQueueFlushed(int a1) { + if (Player_Query_Current_Scene() == 55 && Actor_Query_Goal_Number(2) == 206) { + Sound_Play(575, 50, 0, 0, 50); + Sound_Play(321, 50, 0, 0, 50); + } + if (Player_Query_Current_Scene() == 55 && Actor_Query_Goal_Number(2) == 207) { + Sound_Play(576, 50, 0, 0, 50); + Sound_Play(323, 50, 0, 0, 50); + } + if (Player_Query_Current_Scene() == 55 && Actor_Query_Goal_Number(2) == 208) { + Sound_Play(579, 50, 0, 0, 50); + Sound_Play(324, 50, 0, 0, 50); + } + if (Player_Query_Current_Scene() == 55 && Actor_Query_Goal_Number(2) > 205 && Actor_Query_Goal_Number(2) < 210) { + Actor_Set_Goal_Number(2, 205); + //return true; + return; + } else if (Actor_Query_Goal_Number(2) > 205 && Actor_Query_Goal_Number(2) < 210) { + Actor_Set_Goal_Number(2, 204); + //return true; + return; + } + //return false; +} + +void ScriptNR02::sub_402134() { + int v0 = Global_Variable_Query(50); + if (v0 == 0) { + Music_Play(8, 41, 0, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(9, 41, 0, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(10, 41, 0, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(50, v0); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr03.cpp b/engines/bladerunner/script/nr03.cpp new file mode 100644 index 0000000000..a4afdd36ec --- /dev/null +++ b/engines/bladerunner/script/nr03.cpp @@ -0,0 +1,351 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR03::InitializeScene() { + if (Game_Flag_Query(537)) { + Setup_Scene_Information(-301.98f, -70.19f, -348.58f, 0); + } else if (Game_Flag_Query(437)) { + Setup_Scene_Information(-161.0f, -70.19f, -1139.0f, 500); + Game_Flag_Reset(437); + } else { + Setup_Scene_Information(410.0f, -70.19f, -715.0f, 690); + } + Scene_Exit_Add_2D_Exit(0, 561, 0, 639, 216, 1); + Scene_Exit_Add_2D_Exit(1, 210, 85, 240, 145, 0); + Scene_Exit_Add_2D_Exit(2, 0, 135, 85, 295, 3); + Scene_2D_Region_Add(0, 331, 73, 375, 114); + Ambient_Sounds_Add_Looping_Sound(280, 50, 38, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 25, 25, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 20, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(573)) { + if (Game_Flag_Query(537)) { + Scene_Loop_Start_Special(0, 2, 0); + Scene_Loop_Set_Default(0); + Game_Flag_Reset(537); + } else { + Scene_Loop_Set_Default(0); + } + } else { + Actor_Set_Goal_Number(4, 201); + Scene_Loop_Start_Special(0, 2, 0); + Scene_Loop_Set_Default(0); + } + if (Actor_Query_Goal_Number(25) > 209 && Actor_Query_Goal_Number(25) < 215) { + Actor_Set_Goal_Number(25, 215); + } +} + +void ScriptNR03::SceneLoaded() { + Obstacle_Object("PG3", true); + Obstacle_Object("X2BACKBARBOTTOM01", true); + Obstacle_Object("X2BACKSTAGETOP", true); + Unclickable_Object("PG3"); + Unobstacle_Object("X2BACKBARBOTTOM02", true); + Unobstacle_Object("NM2", true); + Unobstacle_Object("MAN5", true); + Unobstacle_Object("MAN7", true); + Unobstacle_Object("X2BACKSTAGETOP", true); +} + +bool ScriptNR03::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR03::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("PG3", objectName)) { + Actor_Face_Object(0, "PG3", true); + Actor_Voice_Over(3770, 99); + return true; + } + return false; +} + +bool ScriptNR03::ClickedOnActor(int actorId) { + if (actorId == 25 && !Loop_Actor_Walk_To_Actor(0, 25, 48, 1, false)) { + AI_Movement_Track_Pause(25); + Actor_Face_Actor(0, 25, true); + if (Game_Flag_Query(611)) { + Actor_Says(0, 3350, 16); + Actor_Says(25, 50, 17); + } else { + Game_Flag_Set(611); + Actor_Says(0, 3340, 3); + Actor_Face_Actor(25, 0, true); + Actor_Says(25, 30, 13); + Actor_Says(0, 3345, 14); + Actor_Says(25, 40, 14); + } + AI_Movement_Track_Unpause(25); + return true; + } + return false; +} + +bool ScriptNR03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 410.0f, -70.19f, -715.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(534); + Set_Enter(54, 54); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -161.0f, -70.19f, -1139.0f, 0, 1, false, 0)) { + if (Actor_Query_Which_Set_In(25) == 55) { + AI_Movement_Track_Pause(25); + Actor_Face_Actor(25, 0, true); + Actor_Face_Actor(0, 25, true); + int v3 = Global_Variable_Query(44); + if (v3 == 0) { + Actor_Says(25, 50, 13); + AI_Movement_Track_Unpause(25); + } else if (v3 == 1) { + Actor_Says(25, 210, 15); + AI_Movement_Track_Unpause(25); + } else if (v3 == 2) { + Actor_Set_Goal_Number(25, 220); + } + } + Global_Variable_Increment(44, 1); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(438); + Set_Enter(12, 57); + } + + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -151.0f, -70.19f, -476.0f, 12, 1, false, 0)) { + if (Actor_Query_Goal_Number(25) == 213 || Actor_Query_Which_Set_In(25) != 55) { + Player_Loses_Control(); + Player_Set_Combat_Mode(false); + Loop_Actor_Walk_To_XYZ(0, -229.0f, -70.19f, -469.0f, 0, 0, false, 1); + Actor_Face_Heading(0, 656, false); + Actor_Change_Animation_Mode(0, 53); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(536); + Set_Enter(13, 58); + Scene_Loop_Start_Special(1, 2, 0); + return true; + } + Actor_Face_Heading(0, 680, false); + Actor_Change_Animation_Mode(0, 12); + Delay(150); + Actor_Change_Animation_Mode(0, 0); + AI_Movement_Track_Pause(25); + Actor_Face_Actor(25, 0, true); + + int v1 = Global_Variable_Query(43); + if (v1 == 0) { + Actor_Says(25, 0, 15); + Actor_Face_Actor(0, 25, true); + Actor_Says(0, 3335, 13); + Actor_Says(25, 10, 16); + AI_Movement_Track_Unpause(25); + } else if (v1 == 1) { + Actor_Face_Actor(0, 25, true); + Actor_Says(25, 210, 12); + AI_Movement_Track_Unpause(25); + } else if (v1 == 2) { + Actor_Set_Goal_Number(25, 220); + } + Global_Variable_Increment(43, 1); + } + return true; + } + return false; +} + +bool ScriptNR03::ClickedOn2DRegion(int region) { + if (region == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 79.2f, -70.19f, -984.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 47, true); + int v1 = Random_Query(0, 4); + if (v1 == 0) { + Actor_Says(0, 1055, 3); + } else if (v1 == 1) { + Actor_Says(0, 8590, 3); + } else if (v1 == 2) { + Actor_Says(0, 8930, 3); + } else if (v1 == 3) { + Actor_Says(0, 7465, 3); + } + } + return true; + } + return false; +} + +void ScriptNR03::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_402994(); + } + if (frame == 72) { + Sound_Play(345, 83, -70, -70, 50); + } + if (frame == 76) { + Sound_Play(353, 62, -70, -70, 50); + } + if (frame > 70 && frame < 110) { + sub_40259C(frame); + } else { + if (frame != 110) { + //return false; + return; + } + if (Actor_Query_Goal_Number(4) == 201) { + Actor_Set_Goal_Number(4, 200); + } else if (!Game_Flag_Query(536)) { + Actor_Set_Goal_Number(0, 200); + Player_Gains_Control(); + } + } + //return true; + return; +} + +void ScriptNR03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR03::PlayerWalkedIn() { + Player_Set_Combat_Mode(false); + if (Game_Flag_Query(573)) { + if (Game_Flag_Query(535) ) { + Loop_Actor_Walk_To_XYZ(0, 302.0f, -70.19f, -715.0f, 0, 0, false, 0); + Game_Flag_Reset(535); + } + } else { + Game_Flag_Set(573); + Async_Actor_Walk_To_XYZ(0, 206.0f, -70.19f, -643.0f, 0, false); + Game_Flag_Reset(535); + Actor_Voice_Over(1490, 99); + Actor_Voice_Over(1510, 99); + Actor_Voice_Over(1520, 99); + } + if (Player_Query_Combat_Mode()) { + Actor_Set_Goal_Number(25, 220); + } + //return false; +} + +void ScriptNR03::PlayerWalkedOut() { + if (!Game_Flag_Query(438)) { + Music_Stop(2); + } + if (Game_Flag_Query(536)) { + Player_Gains_Control(); + } +} + +void ScriptNR03::DialogueQueueFlushed(int a1) { +} + +void ScriptNR03::sub_40259C(int frame) { + int facing; + float angle, invertedAngle; + + angle = cos((frame - 70) * (M_PI / 40.0f)) * M_PI_2; + invertedAngle = M_PI - angle; + if (!Game_Flag_Query(536) && Actor_Query_Goal_Number(4) != 201) { + angle = angle + M_PI; + invertedAngle = invertedAngle + M_PI; + } + float c = cos(invertedAngle); + float s = sin(invertedAngle); + float x = 36.49f * s - -60.21f * c + -265.49f; + float z = -60.21f * s + 36.49f * c + -408.79f; + + if (Actor_Query_Goal_Number(4) == 201) { + facing = angle * (512.0f / M_PI); + facing = facing + 144; + if (facing < 0) { + facing = facing + 1168; + } + if (facing > 1023) { + facing -= 1024; + } + Actor_Set_At_XYZ(4, x, -70.19f, z, facing); + } else { + facing = angle * (512.0f / M_PI); + facing = facing + 400; + if (facing < 0) { + facing = facing + 1424; + } + if (facing > 1023) { + facing -= 1024; + } + + Actor_Set_At_XYZ(0, x, -70.19f, z, facing); + } +} + +void ScriptNR03::sub_402994() { + if (Music_Is_Playing()) { + Music_Adjust(51, 0, 2); + } else { + int v0 = Global_Variable_Query(53); + if (v0 == 0) { + Music_Play(14, 51, 0, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(13, 51, 0, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(5, 51, 0, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(53, v0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr04.cpp b/engines/bladerunner/script/nr04.cpp new file mode 100644 index 0000000000..3af425762d --- /dev/null +++ b/engines/bladerunner/script/nr04.cpp @@ -0,0 +1,358 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR04::InitializeScene() { + Music_Adjust(30, 80, 2); + Setup_Scene_Information(53.0f, 0.0f, -110.0f, 569); + Scene_Exit_Add_2D_Exit(0, 498, 126, 560, 238, 0); + Scene_2D_Region_Add(0, 0, 259, 61, 479); + Scene_2D_Region_Add(1, 62, 327, 92, 479); + Scene_2D_Region_Add(2, 93, 343, 239, 479); + Ambient_Sounds_Add_Looping_Sound(408, 16, 0, 1); + Ambient_Sounds_Add_Looping_Sound(384, 16, 0, 1); + Ambient_Sounds_Add_Sound(259, 3, 60, 9, 9, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 9, 9, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 9, 9, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 9, 9, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Scene_Loop_Set_Default(0); +} + +void ScriptNR04::SceneLoaded() { + Clickable_Object("B.TV01"); + Clickable_Object("B.TV02"); + Clickable_Object("B.TV03"); + Clickable_Object("B.TV05"); + Clickable_Object("DESK"); + if (!Game_Flag_Query(605)) { + Clickable_Object("TORUS01"); + } + Clickable_Object("BOX12"); +} + +bool ScriptNR04::MouseClick(int x, int y) { + if (Actor_Query_Animation_Mode(0) == 85 || Actor_Query_Animation_Mode(0) == 29) { + return true; + } + if (Actor_Query_Animation_Mode(0) == 53) { + Actor_Change_Animation_Mode(0, 29); + return true; + } + return false; +} + +bool ScriptNR04::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("B.TV01", objectName) || Object_Query_Click("B.TV02", objectName) || Object_Query_Click("B.TV03", objectName) || Object_Query_Click("B.TV05", objectName) || Object_Query_Click("DESK", objectName)) { + if (!Loop_Actor_Walk_To_Waypoint(0, 546, 0, 1, false)) { + if (!Object_Query_Click("DESK", objectName)) { + Actor_Face_Object(0, "B.TV01", true); + Actor_Voice_Over(1530, 99); + Actor_Voice_Over(1540, 99); + Actor_Voice_Over(1550, 99); + } else { + Actor_Face_Object(0, "DESK", true); + if (!Actor_Clue_Query(0, 56)) { + Actor_Voice_Over(1600, 99); + Actor_Voice_Over(1610, 99); + } else if (Actor_Clue_Query(0, 100)) { + Actor_Says(0, 8580, 3); + } else { + Actor_Clue_Acquire(0, 100, 0, -1); + Item_Pickup_Spin_Effect(961, 247, 141); + Actor_Voice_Over(1560, 99); + Actor_Voice_Over(1570, 99); + Actor_Voice_Over(1580, 99); + Actor_Voice_Over(1590, 99); + } + + } + } + } else if (Object_Query_Click("TORUS01", objectName) + && !Loop_Actor_Walk_To_XYZ(0, 18.56f, 0.0f, 38.86f, 0, 1, false, 0) + && !Game_Flag_Query(605)) { + Unclickable_Object("TORUS01"); + Scene_Exits_Disable(); + Player_Loses_Control(); + Game_Flag_Set(605); + Actor_Face_Object(0, "TORUS01", true); + Item_Pickup_Spin_Effect(975, 358, 160); + Actor_Voice_Over(1620, 99); + Actor_Voice_Over(1630, 99); + Actor_Clue_Acquire(0, 89, 0, -1); + Actor_Set_Goal_Number(18, 201); + } + return false; +} + +bool ScriptNR04::ClickedOnActor(int actorId) { + if (actorId == 18 && Game_Flag_Query(606)) { + Actor_Voice_Over(1640, 99); + Actor_Voice_Over(1650, 99); + Actor_Voice_Over(1660, 99); + Actor_Voice_Over(1670, 99); + Actor_Voice_Over(1680, 99); + return true; + } + return false; +} + +bool ScriptNR04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 45.0f, 0.0f, -106.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(437); + Set_Enter(55, 56); + } + return true; + } + return false; +} + +bool ScriptNR04::ClickedOn2DRegion(int region) { + if ((region == 0 || region == 1 || region == 2) && Actor_Query_Which_Set_In(18) != 12 && Actor_Query_Animation_Mode(0) != 53 && !Loop_Actor_Walk_To_Waypoint(0, 445, 0, 1, false)) { + Actor_Face_Heading(0, 49, false); + Actor_Change_Animation_Mode(0, 85); + Delay(2500); + if (Game_Flag_Query(606) == 1) { + return true; + } + if (Game_Flag_Query(374)) { + Player_Loses_Control(); + Actor_Voice_Over(4180, 99); + Actor_Change_Animation_Mode(0, 48); + Ambient_Sounds_Play_Sound(555, 90, 99, 0, 0); + Delay(350); + Actor_Set_At_XYZ(0, 109.0f, 0.0f, 374.0f, 0); + Actor_Retired_Here(0, 12, 12, 1, -1); + } + return true; + } + return false; +} + +void ScriptNR04::SceneFrameAdvanced(int frame) { + if (frame == 1 && !Music_Is_Playing()) { + sub_402960(); + } + if (frame > 60 && frame < 120) { + sub_402860(frame); + } else if (frame == 120) { + Set_Fade_Color(1.0f, 1.0f, 1.0f); + Set_Fade_Density(0.0f); + } + //return false; +} + +void ScriptNR04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 18) { + switch (newGoal) { + case 214: + Actor_Change_Animation_Mode(18, 29); + Delay(2500); + Actor_Says(18, 290, 3); + sub_401DB0(); + //return true; + break; + case 213: + Actor_Clue_Acquire(0, 88, 0, 18); + Item_Pickup_Spin_Effect(984, 200, 160); + Actor_Says(18, 200, 30); + Actor_Says(18, 210, 30); + Actor_Says(18, 220, 30); + Actor_Says_With_Pause(0, 3425, 1.5f, 23); + Actor_Says(0, 3430, 3); + Actor_Says(18, 240, 30); + Actor_Says(0, 3435, 3); + Actor_Says(18, 250, 30); + Actor_Says(0, 3440, 3); + Actor_Says(18, 280, 30); + Actor_Says(0, 3445, 3); + Actor_Set_Goal_Number(18, 214); + //return true; + break; + case 209: + Actor_Face_Actor(0, 18, true); + Delay(3000); + Actor_Says(18, 170, 30); + Actor_Says(0, 3415, 3); + Actor_Says(18, 180, 30); + Actor_Says_With_Pause(0, 3420, 1.5f, 3); + Actor_Says(18, 190, 30); + Actor_Set_Goal_Number(18, 211); + //return true; + break; + case 207: + Loop_Actor_Walk_To_Waypoint(18, 445, 0, 1, false); + Actor_Face_Heading(18, 49, false); + Actor_Change_Animation_Mode(18, 85); + Actor_Face_Actor(0, 18, true); + Actor_Set_Goal_Number(18, 208); + Actor_Clue_Acquire(0, 92, 0, 18); + //return true; + break; + case 204: + Actor_Face_Actor(0, 18, true); + Actor_Says(18, 90, 73); + Actor_Says(0, 3390, 3); + Actor_Face_Actor(18, 0, true); + Actor_Says(18, 110, 74); + Actor_Says(0, 3385, 3); + Actor_Says(18, 120, 74); + Actor_Face_Actor(18, 0, true); + Actor_Set_Goal_Number(18, 205); + //return true; + break; + case 202: + Actor_Face_Actor(18, 0, true); + Actor_Face_Actor(0, 18, true); + Actor_Says(18, 30, 3); + Actor_Says(0, 3375, 3); + Actor_Says_With_Pause(18, 50, 1.5f, 3); + Actor_Says(18, 60, 3); + Actor_Says_With_Pause(0, 3380, 1.0f, 3); + Actor_Says(18, 70, 3); + Actor_Says(0, 3415, 3); + Actor_Says(18, 80, 3); + Player_Gains_Control(); + Actor_Set_Goal_Number(18, 203); + //return true; + break; + } + } + //return false; +} + +void ScriptNR04::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, 53.0f, 0.0f, -26.0f, 0, 0, false, 0); + if (Game_Flag_Query(374)) { + Overlay_Play("nr04over", 0, 1, 0, 0); + Delay(4000); + Overlay_Remove("nr04over"); + } + //return false; +} + +void ScriptNR04::PlayerWalkedOut() { +} + +void ScriptNR04::DialogueQueueFlushed(int a1) { +} + +void ScriptNR04::sub_401DB0() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List(1530, 10, 5, 3); + DM_Add_To_List(1540, 3, 5, 10); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 1530) { + Loop_Actor_Walk_To_Actor(18, 0, 36, 0, false); + Actor_Change_Animation_Mode(0, 23); + Actor_Change_Animation_Mode(18, 23); + Delay(1500); + Actor_Says(18, 300, 3); + Actor_Change_Animation_Mode(0, 0); + Actor_Change_Animation_Mode(18, 0); + Actor_Says(18, 310, 3); + ADQ_Add(0, 3450, 3); + Actor_Set_Targetable(18, false); + Actor_Set_Goal_Number(18, 217); + Actor_Clue_Lose(0, 89); + Scene_Exits_Enable(); + } else if (answer == 1540) { + Actor_Says(0, 8512, 15); + Actor_Says(18, 320, 12); + Actor_Says(0, 3455, 13); + Actor_Says(18, 330, 15); + Actor_Says(0, 3460, 12); + Actor_Says(18, 340, 12); + Actor_Says(0, 3465, 12); + Actor_Says(18, 350, 16); + Actor_Set_Targetable(18, false); + Actor_Set_Goal_Number(18, 217); + Scene_Exits_Enable(); + } +} + +void ScriptNR04::sub_402860(int frame) { + float colorMap[] = { + 1.0f, 1.0f, 1.0f, + 1.0f, 0.0f, 0.0f, + 0.8f, 0.4f, 0.0f, + 0.7f, 0.7f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + 0.5f, 0.0f, 0.8f}; + + float v3 = (frame - 60) / 10; + float v4 = (frame % 10) * 0.1f; + float coef = 1.0f; + if (frame > 100) { + coef = 1.0f - (frame - 100) / 20.0f; + } + int index = 3 * v3; + int nextIndex = 3 * v3 + 3; + float r = ((colorMap[nextIndex + 0] - colorMap[index + 0]) * v4 + colorMap[index + 0]) * coef; + float g = ((colorMap[nextIndex + 1] - colorMap[index + 1]) * v4 + colorMap[index + 1]) * coef; + float b = ((colorMap[nextIndex + 2] - colorMap[index + 2]) * v4 + colorMap[index + 2]) * coef; + Set_Fade_Color(r, g, b); + if (frame >= 90) { + Set_Fade_Density(0.75f); + } else { + Set_Fade_Density((frame - 60) / 45.0f); + } +} + +void ScriptNR04::sub_402960() { + int v0 = Global_Variable_Query(53); + if (!v0) { + Music_Play(14, 11, 80, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(13, 11, 80, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(5, 11, 80, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(53, v0); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr05.cpp b/engines/bladerunner/script/nr05.cpp new file mode 100644 index 0000000000..d686bce374 --- /dev/null +++ b/engines/bladerunner/script/nr05.cpp @@ -0,0 +1,369 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR05::InitializeScene() { + if (Game_Flag_Query(547)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Setup_Scene_Information(-777.56f, 0.0f, -166.86f, 0); + } else if (Game_Flag_Query(536)) { + Setup_Scene_Information(-456.0f, 0.0f, -611.0f, 0); + } else { + Setup_Scene_Information(-527.0f, 1.57f, -406.0f, 649); + } + Scene_Exit_Add_2D_Exit(0, 459, 147, 639, 290, 1); + if (Game_Flag_Query(620)) { + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + } + Ambient_Sounds_Add_Looping_Sound(280, 50, 38, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 20, 20, -30, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 25, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(570, 5, 70, 11, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(571, 5, 70, 11, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(572, 5, 70, 11, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(573, 5, 70, 11, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(547)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(536)) { + Scene_Loop_Start_Special(0, 3, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(536); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptNR05::SceneLoaded() { + Obstacle_Object("NM1-1+", true); + Clickable_Object("NM1-1+"); + Unclickable_Object("NM1-1+"); +} + +bool ScriptNR05::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR05::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptNR05::ClickedOnActor(int actorId) { + if (actorId == 42) { + if (!Loop_Actor_Walk_To_Actor(0, 42, 120, 1, false)) { + sub_4020B4(); + } + return true; + } + if (actorId == 18) { + Actor_Set_Goal_Number(18, 229); + if (!Loop_Actor_Walk_To_Actor(0, 18, 36, 1, false)) { + sub_4022DC(); + } + Actor_Set_Goal_Number(18, 221); + return true; + } + return false; +} + +bool ScriptNR05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -444.0f, 0.0f, -451.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + Music_Stop(2); + Player_Set_Combat_Mode(false); + Actor_Face_Heading(0, 1021, false); + Actor_Change_Animation_Mode(0, 53); + Game_Flag_Set(537); + Set_Enter(55, 56); + Scene_Loop_Start_Special(1, 3, 0); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -777.56f, 0.0f, -166.86f, 0, 1, false, 0)) { + Game_Flag_Set(546); + Set_Enter(13, 61); + } + return true; + } + return false; +} + +bool ScriptNR05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR05::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_402B9C(); + } + if (frame == 78) { + Sound_Play(345, 83, 70, 70, 50); + } + if (frame == 86) { + Sound_Play(353, 62, 70, 70, 50); + } + sub_402A48(48); + sub_402A48(0); + if (Actor_Query_Goal_Number(18) == 224) { + Actor_Set_Goal_Number(18, 225); + if (Player_Query_Current_Scene() == 58) { + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + } + } + if (frame > 77 && frame <= 134) { + sub_401F74(frame - 13); + if (frame == 134 && !Game_Flag_Query(537)) { + Actor_Set_Goal_Number(0, 200); + } + //return true; + return; + } else { + //return false; + return; + } + +} + +void ScriptNR05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR05::PlayerWalkedIn() { + if (Game_Flag_Query(547)) { + Music_Stop(2); + Loop_Actor_Walk_To_XYZ(0, -697.56f, 0.0f, -174.86f, 0, 1, false, 0); + Game_Flag_Reset(547); + } + // return false; +} + +void ScriptNR05::PlayerWalkedOut() { + if (Game_Flag_Query(537)) { + Music_Stop(2); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptNR05::DialogueQueueFlushed(int a1) { +} + +void ScriptNR05::sub_401F74(int frame) { + float angle = cos((frame - 65) * (M_PI / 57.0f)) * M_PI_2; + float invertedAngle = M_PI - angle; + if (!Game_Flag_Query(537)) { + angle = angle + M_PI; + invertedAngle = invertedAngle + M_PI; + } + float c = cos(invertedAngle); + float s = sin(invertedAngle); + float x = 6.0f * s - 80.0f * c + -450.0f; + float z = 80.0f * s + 6.0f * c + -531.0f; + + int facing = angle * (512.0f / M_PI); + facing = facing + 765; + if (facing < 0) { + facing = facing + 1789; + } + if (facing > 1023) { + facing -= 1024; + } + Actor_Set_At_XYZ(0, x, 0.0f, z, facing); +} + +void ScriptNR05::sub_4020B4() { + Actor_Face_Actor(0, 42, true); + Actor_Face_Actor(42, 0, true); + if (Game_Flag_Query(588)) { + if (Game_Flag_Query(589)) { + Actor_Says(0, 3480, 19); + Actor_Says(42, 30, 12); + Actor_Says(0, 3485, 3); + Actor_Says(42, 40, 13); + Actor_Change_Animation_Mode(42, 23); + Actor_Change_Animation_Mode(0, 75); + Global_Variable_Increment(42, 1); + } else { + Actor_Says(0, 3475, 17); + Actor_Says(42, 20, 23); + Game_Flag_Set(589); + Actor_Change_Animation_Mode(0, 75); + Global_Variable_Increment(42, 1); + } + } else { + Actor_Says(42, 0, 13); + Actor_Says(0, 3470, 3); + Actor_Says(42, 10, 23); + Game_Flag_Set(588); + Actor_Change_Animation_Mode(0, 75); + Global_Variable_Increment(42, 1); + } +} + +void ScriptNR05::sub_4022DC() { + if (Actor_Query_Goal_Number(18) == 220) { + Actor_Set_Goal_Number(18, 221); + } + Actor_Face_Actor(0, 18, true); + Actor_Face_Actor(18, 0, true); + if (!Game_Flag_Query(590)) { + Actor_Says(0, 8513, 3); + Actor_Says(18, 360, 3); + Actor_Says(0, 3495, 11); + Actor_Says(18, 370, 15); + Actor_Says(0, 3500, 17); + Actor_Says(18, 380, 13); + Game_Flag_Set(590); + return; + } + Dialogue_Menu_Clear_List(); + if (Actor_Query_Friendliness_To_Other(18, 0) >= 48) { + if (Actor_Clue_Query(0, 90) || Actor_Clue_Query(0, 100)) { + DM_Add_To_List_Never_Repeat_Once_Selected(890, -1, 4, 8); + } + if (Actor_Clue_Query(0, 13)) { + DM_Add_To_List_Never_Repeat_Once_Selected(900, 5, 6, 5); + } + if (Actor_Clue_Query(0, 88)) { + DM_Add_To_List_Never_Repeat_Once_Selected(910, 5, 5, 5); + } + } + if (!Dialogue_Menu_Query_List_Size()) { + Actor_Says(0, 3520, 3); + Actor_Says(18, 730, 3); + Actor_Face_Heading(18, 849, false); + return; + } + Dialogue_Menu_Add_DONE_To_List(100); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 890) { + Actor_Says(0, 3505, 3); + Actor_Modify_Friendliness_To_Other(18, 0, -1); + Actor_Says(18, 420, 12); + Actor_Says(18, 430, 13); + Actor_Says(0, 3530, 15); + Actor_Says(18, 440, 15); + Actor_Says(0, 3535, 13); + Actor_Says(18, 460, 16); + Actor_Says(0, 3540, 15); + Actor_Says(18, 490, 16); + Actor_Says(18, 500, 13); + Actor_Says(0, 3545, 15); + Actor_Says(18, 520, 12); + Actor_Face_Heading(18, 849, false); + } else if (answer == 900) { + Actor_Says(0, 3510, 15); + Actor_Modify_Friendliness_To_Other(18, 0, -1); + Actor_Says_With_Pause(18, 530, 1.2f, 3); + Actor_Says(18, 540, 15); + Actor_Says(0, 3550, 13); + Actor_Says(18, 560, 14); + Actor_Says(18, 570, 13); + Actor_Says(0, 3555, 12); + Actor_Face_Heading(18, 849, false); + } else if (answer == 910) { + Actor_Says(0, 3515, 14); + Actor_Modify_Friendliness_To_Other(18, 0, -1); + if (Actor_Clue_Query(0, 99)) { + Actor_Says(18, 580, 12); + Actor_Says(0, 3560, 13); + Actor_Says(18, 590, 16); + Actor_Says(0, 3565, 16); + Actor_Says(18, 600, 13); + Actor_Says(0, 3570, 14); + Actor_Says(18, 620, 15); + Actor_Says(0, 3575, 13); + } else { + Actor_Says(18, 640, 13); + Actor_Says(0, 3580, 15); + Actor_Says(18, 660, 12); + } + Actor_Face_Heading(18, 849, false); + } +} + +void ScriptNR05::sub_402A48(int actorId) { + int animationMode = Actor_Query_Animation_Mode(actorId); + if (animationMode == 1 || animationMode == 2 || animationMode == 7 || animationMode == 8) { + return; + } + float x, y, z; + Actor_Query_XYZ(actorId, &x, &y, &z); + if ((x - -542.0f) * (x - -542.0f) + (z - -195.0f) * (z - -195.0f) < 8464.0f) { + float s = sin(M_PI / 128.0f); + float c = cos(M_PI / 128.0f); + float newX = x * c - z * s + -542.0f; + float newZ = x * s + z * c + -195.0f; + int newFacing = (Actor_Query_Facing_1024(actorId) + 4) % 1024; + Actor_Set_At_XYZ(actorId, newX, y, newZ, newFacing); + } +} + +void ScriptNR05::sub_402B9C() { + if (Music_Is_Playing()) { + Music_Adjust(51, 0, 2); + } else { + int v0 = Global_Variable_Query(54); + if (v0 == 0) { + Music_Play(16, 61, -80, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(15, 41, -80, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(7, 41, -80, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(54, v0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr06.cpp b/engines/bladerunner/script/nr06.cpp new file mode 100644 index 0000000000..e21bb49bbc --- /dev/null +++ b/engines/bladerunner/script/nr06.cpp @@ -0,0 +1,162 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR06::InitializeScene() { + sub_401BAC(); + if (Game_Flag_Query(442)) { + Setup_Scene_Information(48.0f, -71.88f, -26.0f, 782); + } else { + Setup_Scene_Information(-36.0f, 0.37f, -373.0f, 592); + } + Scene_Exit_Add_2D_Exit(0, 533, 234, 592, 414, 1); + Scene_Exit_Add_2D_Exit(1, 238, 137, 337, 322, 0); + Ambient_Sounds_Add_Looping_Sound(111, 25, 0, 1); + Ambient_Sounds_Add_Sound(252, 3, 60, 8, 12, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 8, 8, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 8, 8, -100, 100, -101, -101, 0, 0); +} + +void ScriptNR06::SceneLoaded() { + Obstacle_Object("CHAIR01", true); + Unobstacle_Object("LOFT04", true); + Unobstacle_Object("LINE02", true); + Unobstacle_Object("WALL01", true); + Unclickable_Object("CHAIR01"); +} + +bool ScriptNR06::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptNR06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 48.0f, -71.88f, -26.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Game_Flag_Set(441); + Set_Enter(57, 60); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -137.0f, -71.88f, -243.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 95, false); + Loop_Actor_Travel_Stairs(0, 8, 1, 0); + Loop_Actor_Walk_To_XYZ(0, -36.0f, 0.37f, -373.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(439); + Set_Enter(13, 61); + } + return true; + } + return false; +} + +bool ScriptNR06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR06::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_401BAC(); + } + //return false; +} + +void ScriptNR06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR06::PlayerWalkedIn() { + if (Game_Flag_Query(442)) { + Loop_Actor_Walk_To_XYZ(0, -3.0f, -71.88f, -26.0f, 0, 0, false, 0); + Game_Flag_Reset(442); + } else { + Loop_Actor_Walk_To_XYZ(0, -81.72f, 0.12f, -323.49f, 0, 0, false, 0); + Actor_Face_Heading(0, 600, false); + Loop_Actor_Travel_Stairs(0, 8, 0, 0); + Game_Flag_Reset(440); + } + //return false; +} + +void ScriptNR06::PlayerWalkedOut() { + if (Game_Flag_Query(441)) { + Music_Stop(2); + } +} + +void ScriptNR06::DialogueQueueFlushed(int a1) { +} + +void ScriptNR06::sub_401BAC() { + if (Music_Is_Playing()) { + Music_Adjust(31, 80, 2); + } else { + int v0 = Global_Variable_Query(54); + if (v0 == 0) { + Music_Play(16, 61, -80, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(15, 41, -80, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(7, 41, -80, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(54, v0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr07.cpp b/engines/bladerunner/script/nr07.cpp new file mode 100644 index 0000000000..99b7aff2b1 --- /dev/null +++ b/engines/bladerunner/script/nr07.cpp @@ -0,0 +1,379 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR07::InitializeScene() { + Setup_Scene_Information(-110.0f, -73.5f, -193.0f, 554); + Scene_Exit_Add_2D_Exit(0, 429, 137, 506, 251, 0); + Ambient_Sounds_Add_Looping_Sound(111, 25, 0, 1); +} + +void ScriptNR07::SceneLoaded() { + Obstacle_Object("VANITY", true); + Clickable_Object("VASE"); +} + +bool ScriptNR07::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR07::ClickedOn3DObject(const char *objectName, bool a2) { + Actor_Set_Goal_Number(25, 201); + if (Object_Query_Click("VASE", objectName)) { + sub_401C60(); + } + Actor_Set_Goal_Number(25, 200); + return false; +} + +bool ScriptNR07::ClickedOnActor(int actorId) { + if (actorId == 3) { + if (Actor_Query_Goal_Number(33) <= 239) { + Actor_Set_Goal_Number(25, 201); + Actor_Face_Actor(0, 3, true); + Dialogue_Menu_Clear_List(); + if (Game_Flag_Query(638)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1100, -1, 3, 8); + DM_Add_To_List_Never_Repeat_Once_Selected(1110, 8, -1, -1); + if (Actor_Clue_Query(0, 95)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1120, 3, 6, 7); + } + if (Actor_Clue_Query(0, 113)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1130, 3, 5, 7); + } + if (Game_Flag_Query(510)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1140, 1, 4, 7); + } + } else { + DM_Add_To_List_Never_Repeat_Once_Selected(1080, 3, 5, 7); + DM_Add_To_List_Never_Repeat_Once_Selected(1090, 7, 5, 4); + } + Dialogue_Menu_Add_DONE_To_List(1150); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 1140: + sub_4028FC(); + break; + case 1130: + sub_402738(); + break; + case 1120: + sub_402614(); + break; + case 1110: + sub_402510(); + break; + case 1100: + sub_402284(); + break; + case 1090: + Actor_Says(0, 3650, 13); + Actor_Says(3, 630, 30); + Actor_Says(0, 3655, 16); + Actor_Says(3, 640, 31); + break; + case 1080: + sub_401EF4(); + break; + default: + break; + } + Actor_Set_Goal_Number(25, 200); + return false;; + } + return true; + } + return false; +} + +bool ScriptNR07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -102.0f, -73.5f, -233.0f, 0, 1, false, 0)) { + Actor_Set_Goal_Number(25, 201); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(442); + Set_Enter(56, 59); + } + return true; + } + return false; +} + +bool ScriptNR07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR07::SceneFrameAdvanced(int frame) { +} + +void ScriptNR07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR07::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, -110.0f, -73.5f, -169.0f, 0, 0, false, 0); + if (Actor_Query_In_Set(3, 57)) { + if (Game_Flag_Query(508)) { + Actor_Modify_Friendliness_To_Other(3, 0, -2); + Actor_Says(3, 530, 31); + } else { + Game_Flag_Set(508); + if (!Actor_Clue_Query(3, 214)) { + Actor_Modify_Friendliness_To_Other(3, 0, 5); + } else if (Actor_Clue_Query(0, 216) || Actor_Clue_Query(0, 217)) { + Actor_Modify_Friendliness_To_Other(3, 0, 10); + } + Actor_Says(3, 500, 30); + Actor_Says(0, 3585, 14); + Actor_Says(3, 510, 30); + Actor_Start_Speech_Sample(0, 3590); + Loop_Actor_Walk_To_XYZ(0, -112.0f, -73.0f, -89.0f, 525, 0, false, 0); + Actor_Says(3, 520, 53); + } + Actor_Set_Goal_Number(25, 200); + } + //return false; +} + +void ScriptNR07::PlayerWalkedOut() { + +} + +void ScriptNR07::DialogueQueueFlushed(int a1) { +} + +void ScriptNR07::sub_4018D4() { + Actor_Set_Goal_Number(25, 201); + Player_Loses_Control(); + Actor_Set_At_XYZ(3, -136.0f, -73.0f, -18.0f, 300); + Actor_Change_Animation_Mode(3, 71); + Actor_Change_Animation_Mode(0, 21); + Loop_Actor_Walk_To_XYZ(3, -102.0f, -73.5f, -233.0f, 0, 0, true, 0); + if (Game_Flag_Query(47)) { + Actor_Set_Goal_Number(3, 245); + } else { + Actor_Set_Goal_Number(3, 295); + Game_Flag_Set(591); + Actor_Put_In_Set(3, 91); + Actor_Set_At_Waypoint(3, 33, 0); + } + Player_Gains_Control(); +} + +void ScriptNR07::sub_401A10() { + Scene_Exits_Disable(); + Actor_Set_Goal_Number(25, 201); + Actor_Says_With_Pause(3, 930, 1.0f, 30); + Actor_Says_With_Pause(3, 910, 1.0f, 30); + Actor_Face_Object(3, "VANITY", true); + Actor_Says(3, 940, 31); + Actor_Says(0, 3770, 19); + Async_Actor_Walk_To_XYZ(0, -193.0f, -73.5f, -13.0f, 0, false); + Actor_Says(3, 950, 31); + Actor_Face_Actor(3, 0, true); + Actor_Change_Animation_Mode(3, 4); + Actor_Face_Actor(0, 3, true); + Actor_Says(0, 3760, 19); + Actor_Says(3, 960, 53); + Actor_Says(3, 920, 53); + Actor_Says(0, 3780, 0); + Actor_Says(3, 970, 53); + Actor_Voice_Over(1710, 99); + Actor_Voice_Over(1720, 99); + Actor_Voice_Over(1730, 99); + Actor_Set_Goal_Number(33, 240); +} + +void ScriptNR07::sub_401C60() { + Loop_Actor_Walk_To_XYZ(0, -109.0f, -73.0f, -89.0f, 0, 0, false, 0); + Actor_Face_Object(0, "VASE", true); + if (Actor_Query_Is_In_Current_Set(3)) { + if (!Actor_Clue_Query(0, 97)) { + Actor_Clue_Acquire(0, 97, 1, -1); + int v0 = Actor_Query_Friendliness_To_Other(3, 0); + if (v0 > 50) { + Actor_Modify_Friendliness_To_Other(3, 0, 2); + } else if (v0 <= 50) { + Actor_Modify_Friendliness_To_Other(3, 0, -2); + } + Actor_Says(0, 3600, 19); + Actor_Says(3, 550, 30); + Actor_Says(0, 3605, 19); + Actor_Says(3, 560, 31); + Actor_Says(0, 3610, 19); + } + } else if (Actor_Clue_Query(0, 98)) { + Actor_Says(0, 8585, 14); + } else { + Actor_Clue_Acquire(0, 98, 1, -1); + Loop_Actor_Walk_To_Scene_Object(0, "VASE", 100, 1, false); + Actor_Change_Animation_Mode(0, 23); + Item_Pickup_Spin_Effect(935, 526, 268); + Actor_Voice_Over(1690, 99); + Actor_Voice_Over(1700, 99); + } +} + +void ScriptNR07::sub_401EF4() { + Actor_Clue_Acquire(0, 96, 1, -1); + Actor_Says(0, 3625, 19); + Actor_Says(3, 570, 30); + Actor_Says_With_Pause(3, 580, 1.0f, 31); + Actor_Says(0, 3630, 13); + Actor_Says_With_Pause(3, 590, 1.0f, 30); + Actor_Says(3, 600, 30); + Actor_Start_Speech_Sample(0, 3640); + Loop_Actor_Walk_To_XYZ(0, -109.0f, -73.0f, -89.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 3, true); + Actor_Face_Actor(3, 0, true); + Game_Flag_Set(638); + Actor_Clue_Acquire(0, 91, 1, 3); + int v0 = Actor_Query_Friendliness_To_Other(3, 0); + if (!Game_Flag_Query(47) && v0 < 40) { + sub_4018D4(); + return; + } + if (v0 < 36) { + sub_401A10(); + return; + } + sub_4020F0(); +} + +void ScriptNR07::sub_4020F0() { + if (Actor_Clue_Query(3, 213) && Actor_Clue_Query(3, 214)) { + Actor_Modify_Friendliness_To_Other(3, 0, -1); + } + Actor_Says(3, 610, 31); + Actor_Says(0, 3645, 12); + Actor_Says(3, 620, 30); + int v0 = Actor_Query_Friendliness_To_Other(3, 0); + if (!Game_Flag_Query(47) && v0 < 40) { + sub_4018D4(); + return; + } + if (v0 < 36) { + sub_401A10(); + return; + } + Actor_Face_Object(3, "VANITY", true); +} + +void ScriptNR07::sub_402284() { + Actor_Clue_Acquire(0, 94, 1, -1); + Actor_Start_Speech_Sample(0, 3660); + Loop_Actor_Walk_To_XYZ(0, -109.0f, -73.0f, -89.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 3, true); + Actor_Says(3, 650, 30); + Actor_Says(3, 660, 31); + Actor_Says(0, 3665, 18); + Actor_Face_Actor(3, 0, true); + Actor_Says(3, 670, 31); + Actor_Says(3, 680, 30); + Actor_Says(3, 690, 31); + Actor_Says(0, 3670, 17); + Actor_Says(3, 700, 30); + Actor_Says(0, 3675, 19); + Actor_Says(3, 710, 30); + Actor_Says(0, 3680, 19); + Actor_Says(3, 720, 30); + Actor_Says(3, 730, 30); + Actor_Says(0, 3685, 13); + Voight_Kampff_Activate(3, 40); + if (Game_Flag_Query(47)) { + sub_401A10(); + } else { + sub_4018D4(); + } +} + +void ScriptNR07::sub_402510() { + Actor_Says(0, 3690, 14); + Actor_Start_Speech_Sample(3, 750); + Loop_Actor_Walk_To_XYZ(0, -109.0f, -73.0f, -89.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 3, true); + Actor_Face_Actor(3, 0, true); + Actor_Says(0, 3695, 15); + Actor_Modify_Friendliness_To_Other(3, 0, 5); + if (Game_Flag_Query(47)) { + sub_401A10(); + } else { + sub_4018D4(); + } +} + +void ScriptNR07::sub_402614() { + Actor_Says(0, 3705, 19); + Actor_Says(3, 760, 53); + if (Game_Flag_Query(47)) { + Actor_Modify_Friendliness_To_Other(3, 0, -5); + Actor_Says(0, 3710, 18); + sub_401A10(); + } else { + Actor_Modify_Friendliness_To_Other(3, 0, -3); + Actor_Start_Speech_Sample(0, 3710); + Loop_Actor_Walk_To_XYZ(0, -109.0f, -73.0f, -89.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 3, true); + sub_4018D4(); + } +} + +void ScriptNR07::sub_402738() { + Actor_Modify_Friendliness_To_Other(3, 0, -3); + Actor_Says(0, 3615, 16); + Actor_Says(3, 770, 30); + Actor_Says(0, 3720, 15); + Actor_Says_With_Pause(3, 780, 2.0f, 30); + Actor_Says(3, 790, 31); + Actor_Says(0, 3725, 18); + Actor_Says(3, 800, 30); + Actor_Says_With_Pause(0, 3730, 2.0f, 13); + Actor_Says_With_Pause(3, 810, 1.0f, 53); + Actor_Says(3, 820, 30); + Actor_Says(0, 3735, 14); + Actor_Says(3, 830, 31); + Actor_Says(0, 3740, 19); +} + +void ScriptNR07::sub_4028FC() { + Actor_Says(0, 3620, 19); + Actor_Says(3, 840, 30); + Actor_Says(0, 3745, 9); + Actor_Says_With_Pause(3, 850, 1.0f, 30); + Actor_Says(3, 860, 30); + Actor_Says(3, 870, 53); + Actor_Says(0, 3750, 11); + Actor_Says(3, 880, 30); + Actor_Says(0, 3755, 16); + Actor_Says(3, 890, 31); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr08.cpp b/engines/bladerunner/script/nr08.cpp new file mode 100644 index 0000000000..62bf3c7bfd --- /dev/null +++ b/engines/bladerunner/script/nr08.cpp @@ -0,0 +1,242 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR08::InitializeScene() { + if (Actor_Query_Goal_Number(1) == 231) { + Setup_Scene_Information(-1174.1f, 0.32f, 303.9f, 435); + } else if (Game_Flag_Query(546)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Setup_Scene_Information(-1102.88f, 0.0f, 107.43f, 0); + if (Actor_Query_Goal_Number(3) == 210) { + Music_Stop(1); + } + } else if (Game_Flag_Query(439)) { + Setup_Scene_Information(-724.7f, 0.0f, 384.24f, 1000); + Game_Flag_Reset(439); + } else if (Game_Flag_Query(615)) { + Setup_Scene_Information(-1663.33f, 0.65f, 342.84f, 330); + Game_Flag_Reset(615); + } + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + if (Actor_Query_Goal_Number(3) != 210) { + Scene_Exit_Add_2D_Exit(1, 0, 309, 30, 398, 3); + Scene_Exit_Add_2D_Exit(2, 520, 330, 556, 386, 0); + } + Ambient_Sounds_Add_Looping_Sound(280, 50, 38, 0); + Ambient_Sounds_Add_Sound(252, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(254, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(255, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(256, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(257, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(258, 3, 60, 14, 14, 60, 90, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(259, 3, 60, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(260, 3, 60, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(261, 3, 60, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(262, 3, 60, 16, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptNR08::SceneLoaded() { + Obstacle_Object("BOX283", true); + Unobstacle_Object("BOX283", true); + if (Actor_Query_Goal_Number(3) == 210) { + Actor_Change_Animation_Mode(3, 79); + } +} + +bool ScriptNR08::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR08::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptNR08::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR08::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR08::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -1102.88f, 0.0f, 107.43f, 0, 1, false, 0)) { + Game_Flag_Set(547); + Set_Enter(13, 58); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -724.7f, 0.0f, 384.24f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 505, false); + Loop_Actor_Travel_Stairs(0, 4, 1, 0); + Game_Flag_Set(440); + Set_Enter(56, 59); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -1663.33f, 0.65f, 342.84f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 831, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 6, 1, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Set(614); + Set_Enter(58, 62); + } + } + return false; +} + +bool ScriptNR08::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR08::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_4021B4(); + } + Set_Fade_Color(0, 0, 0); + if (frame >= 76 && frame < 91) { + Set_Fade_Density((frame - 76) / 14.0f); + Music_Stop(3); + Ambient_Sounds_Play_Sound(566, 27, 0, 99, 0); + } else if (frame >= 91 && frame < 120) { + Actor_Set_Invisible(0, true); + Set_Fade_Density(1.0f); + } else if (frame >= 120 && frame < 135) { + Set_Fade_Density((134 - frame) / 14.0f); + Music_Play(7, 61, 0, 1, -1, 0, 0); + } else { + Actor_Set_Invisible(0, false); + Set_Fade_Density(0.0f); + } + if (Game_Flag_Query(651) && !Game_Flag_Query(636)) { + Game_Flag_Set(636); + Scene_Exits_Disable(); + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 3, 1); + } + if (frame == 95) { + Actor_Put_In_Set(3, 91); + Actor_Set_At_Waypoint(3, 33, 0); + Actor_Change_Animation_Mode(3, 0); + Actor_Set_Goal_Number(3, 200); + Scene_Exit_Add_2D_Exit(1, 0, 309, 30, 398, 3); + Scene_Exit_Add_2D_Exit(2, 520, 330, 556, 386, 0); + } + if (frame == 130) { + Scene_Exits_Enable(); + } + //return false; +} + +void ScriptNR08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR08::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(3) != 210 || Game_Flag_Query(729)) { + Music_Adjust(51, 0, 2); + } else { + Game_Flag_Set(729); + Ambient_Sounds_Play_Sound(566, 27, 0, 99, 0); + Outtake_Play(40, 1, -1); + } + if (Actor_Query_Goal_Number(3) == 245) { + Actor_Face_Heading(3, 790, false); + Loop_Actor_Travel_Stairs(3, 8, 1, 0); + Actor_Set_Goal_Number(3, 246); + } + if (Actor_Query_Goal_Number(1) == 231) { + Actor_Says(1, 1640, 12); + if (!Game_Flag_Query(378)) { + Actor_Says(0, 3790, 13); + Actor_Says(1, 1650, 14); + } + Actor_Says(1, 1660, 12); + Actor_Says(0, 3795, 16); + Actor_Says(1, 1670, 13); + Actor_Says(1, 1680, 14); + Actor_Says(1, 1690, 15); + Actor_Set_Goal_Number(1, 235); + //return true; + return; + } else { + if (Game_Flag_Query(546)) { + Loop_Actor_Walk_To_XYZ(0, -1090.88f, 0.0f, 147.43f, 0, 1, false, 0); + Game_Flag_Reset(546); + } + //return false; + return; + } +} + +void ScriptNR08::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(547)) { + Music_Stop(2); + } +} + +void ScriptNR08::DialogueQueueFlushed(int a1) { +} + +void ScriptNR08::sub_4021B4() { + if (Music_Is_Playing()) { + Music_Adjust(51, 0, 2); + } else if (Actor_Query_Goal_Number(3) == 210) { + Music_Play(6, 61, 0, 1, -1, 0, 0); + } else { + int v0 = Global_Variable_Query(54); + if (v0 == 0) { + Music_Play(16, 61, -80, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(15, 41, -80, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(7, 41, -80, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(54, v0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr09.cpp b/engines/bladerunner/script/nr09.cpp new file mode 100644 index 0000000000..8453fa3420 --- /dev/null +++ b/engines/bladerunner/script/nr09.cpp @@ -0,0 +1,145 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR09::InitializeScene() { + if (Game_Flag_Query(476)) { + if (!Game_Flag_Query(640)) { + Ambient_Sounds_Adjust_Looping_Sound(452, 22, 100, 2); + } + Game_Flag_Reset(476); + Setup_Scene_Information(-556.07f, 0.35f, 399.04f, 440); + } else { + if (!Game_Flag_Query(640)) { + Ambient_Sounds_Add_Looping_Sound(452, 22, 100, 1); + } + Setup_Scene_Information(-704.07f, 0.35f, 663.04f, 0); + } + Scene_Exit_Add_2D_Exit(0, 400, 100, 440, 280, 1); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + Ambient_Sounds_Add_Looping_Sound(205, 22, 0, 1); + Ambient_Sounds_Add_Looping_Sound(71, 33, 0, 1); + Ambient_Sounds_Add_Sound(303, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); +} + +void ScriptNR09::SceneLoaded() { + Obstacle_Object("X2NEWSPAPER", true); + Unobstacle_Object("X2NEWSPAPER", true); + Unclickable_Object("X2NEWSPAPER"); +} + +bool ScriptNR09::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR09::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptNR09::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR09::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR09::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -564.07f, 0.35f, 399.04f, 0, 1, false, 0)) { + Game_Flag_Set(475); + Set_Enter(59, 63); + return true; + } + } + if (exitId == 1) { + int v1 = Loop_Actor_Walk_To_XYZ(0, -704.07f, 0.35f, 663.04f, 0, 1, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!v1) { + Game_Flag_Set(615); + Set_Enter(13, 61); + return true; + } + } + return false; +} + +bool ScriptNR09::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR09::SceneFrameAdvanced(int frame) { + if (!Music_Is_Playing()) { + sub_40172C(); + } +} + +void ScriptNR09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR09::PlayerWalkedIn() { + if (Game_Flag_Query(614)) { + Loop_Actor_Walk_To_XYZ(0, -704.07001f, 0.35f, 623.04f, 0, 0, false, 0); + Game_Flag_Reset(614); + } + //return false; +} + +void ScriptNR09::PlayerWalkedOut() { + if (Game_Flag_Query(475)) { + Music_Stop(2); + } +} + +void ScriptNR09::DialogueQueueFlushed(int a1) { +} + +void ScriptNR09::sub_40172C() { + if (Music_Is_Playing()) { + Music_Adjust(31, -80, 2); + } else { + int v0 = Global_Variable_Query(54); + if (v0 == 0) { + Music_Play(16, 61, -80, 2, -1, 0, 0); + } else if (v0 == 1) { + Music_Play(15, 41, -80, 2, -1, 0, 0); + } else if (v0 == 2) { + Music_Play(7, 41, -80, 2, -1, 0, 0); + } + v0++; + if (v0 > 2) { + v0 = 0; + } + Global_Variable_Set(54, v0); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr10.cpp b/engines/bladerunner/script/nr10.cpp new file mode 100644 index 0000000000..f52d80889d --- /dev/null +++ b/engines/bladerunner/script/nr10.cpp @@ -0,0 +1,164 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR10::InitializeScene() { + if (Game_Flag_Query(475)) { + Game_Flag_Reset(475); + Setup_Scene_Information(-136.78f, 2.84f, -234.43f, 320); + } else { + Game_Flag_Reset(477); + Setup_Scene_Information(19.22f, 2.84f, -250.43f, 540); + } + Scene_Exit_Add_2D_Exit(0, 144, 163, 194, 318, 3); + Scene_Exit_Add_2D_Exit(1, 475, 95, 568, 230, 0); + Ambient_Sounds_Add_Looping_Sound(205, 22, 0, 1); + Ambient_Sounds_Add_Looping_Sound(71, 33, 0, 1); + Ambient_Sounds_Add_Sound(303, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(640)) { + Scene_Loop_Set_Default(0); + } else { + Ambient_Sounds_Adjust_Looping_Sound(452, 31, 0, 1); + Scene_Loop_Set_Default(2); + } +} + +void ScriptNR10::SceneLoaded() { + Obstacle_Object("HOOK 01", true); + Unobstacle_Object("BOX21", true); + Unobstacle_Object("BOX23", true); + Unclickable_Object("BOX18"); +} + +bool ScriptNR10::MouseClick(int x, int y) { + return Game_Flag_Query(642); +} + +bool ScriptNR10::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BOX18", objectName) && a2 && Game_Flag_Query(642)) { + Actor_Set_Goal_Number(3, 250); + Game_Flag_Set(640); + Game_Flag_Reset(642); + Actor_Set_Invisible(0, false); + Actor_Set_Invisible(3, false); + Ambient_Sounds_Remove_Looping_Sound(452, true); + Sound_Play(453, 52, 0, 0, 50); + Scene_Loop_Set_Default(0); + Scene_Loop_Start_Special(2, 0, 1); + Un_Combat_Target_Object("BOX18"); + Scene_Exits_Enable(); + return true; + } + return false; +} + +bool ScriptNR10::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR10::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR10::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -152.78f, 2.84f, -238.43f, 0, 1, false, 0)) { + Game_Flag_Set(476); + Set_Enter(58, 62); + return true; + } + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 11.5f, 2.84f, -304.46f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 55, false); + Loop_Actor_Travel_Ladder(0, 8, 1, 0); + Game_Flag_Set(641); + Set_Enter(60, 64); + return true; + } + } + return false; +} + +bool ScriptNR10::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR10::SceneFrameAdvanced(int frame) { + if (frame == 122) { + Game_Flag_Set(642); + Actor_Set_Invisible(0, true); + Actor_Set_Invisible(3, true); + Combat_Target_Object("BOX18"); + //return true; + return; + } + if (frame == 61 && Game_Flag_Query(642)) { + Game_Flag_Reset(642); + Player_Set_Combat_Mode(false); + Actor_Set_Invisible(0, false); + Actor_Set_Goal_Number(3, 247); + //return true; + return; + } + //return false; +} + +void ScriptNR10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR10::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(3) == 246) { + Player_Set_Combat_Mode(true); + //return true; + return; + } + if (Actor_Query_Goal_Number(1) == 236) { + Actor_Face_Actor(1, 0, true); + Actor_Says(1, 150, 13); + Actor_Face_Actor(0, 1, true); + Actor_Says(0, 1580, 14); + Actor_Says(1, 160, 15); + Actor_Says(0, 1585, 16); + Actor_Says(1, 1160, 16); + Delay(1000); + Actor_Says(1, 1290, 14); + Actor_Set_Goal_Number(1, 275); + } + // return false; +} + +void ScriptNR10::PlayerWalkedOut() { +} + +void ScriptNR10::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/nr11.cpp b/engines/bladerunner/script/nr11.cpp new file mode 100644 index 0000000000..40d7478d2e --- /dev/null +++ b/engines/bladerunner/script/nr11.cpp @@ -0,0 +1,382 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptNR11::InitializeScene() { + Setup_Scene_Information(100.0f, 1.75f, -4.0f, 0); + Scene_Exit_Add_2D_Exit(0, 450, 305, 565, 345, 2); + if (!Game_Flag_Query(640)) { + Ambient_Sounds_Adjust_Looping_Sound(452, 22, 0, 1); + } + Ambient_Sounds_Add_Looping_Sound(205, 22, 0, 1); + Ambient_Sounds_Add_Looping_Sound(71, 33, 0, 1); + Ambient_Sounds_Add_Sound(303, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 2, 50, 7, 17, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(632)) { + Scene_Loop_Set_Default(3); + Ambient_Sounds_Add_Looping_Sound(381, 83, 0, 1); + } else if (Game_Flag_Query(634)) { + Scene_Loop_Set_Default(5); + Ambient_Sounds_Add_Looping_Sound(381, 83, 0, 1); + } else { + Scene_Loop_Set_Default(0); + Overlay_Play("NR11OVER", 0, 1, 0, 0); + } +} + +void ScriptNR11::SceneLoaded() { + Obstacle_Object("COATRACK", true); + Unobstacle_Object("BOX13", true); + Clickable_Object("LOFT04"); + Unclickable_Object("LOFT04"); + if (Actor_Query_Goal_Number(3) == 250) { + Clickable_Object("CLOTHING02"); + Clickable_Object("BOX27"); + Clickable_Object("BOX39"); + Clickable_Object("BOX44"); + Clickable_Object("DRESS"); + Clickable_Object("COATRACK"); + Clickable_Object("COLUMN3 DETS"); + Clickable_Object("COLUMN PIPE01"); + Clickable_Object("RECTANGLE02"); + Clickable_Object("COLUMN04"); + Clickable_Object("COATRACK01"); + Clickable_Object("SHIRT"); + Clickable_Object("SKIRT 02"); + Clickable_Object("CLOTHING B 03"); + Clickable_Object("BUST BUST"); + Combat_Target_Object("CLOTHING02"); + Combat_Target_Object("BOX27"); + Combat_Target_Object("BOX39"); + Combat_Target_Object("BOX44"); + Combat_Target_Object("DRESS"); + Combat_Target_Object("COATRACK"); + Combat_Target_Object("COLUMN3 DETS"); + Combat_Target_Object("COLUMN PIPE01"); + Combat_Target_Object("RECTANGLE02"); + Combat_Target_Object("COLUMN04"); + Combat_Target_Object("COATRACK01"); + Combat_Target_Object("SHIRT"); + Combat_Target_Object("SKIRT 02"); + Combat_Target_Object("CLOTHING B 03"); + Combat_Target_Object("BUST BUST"); + } else { + Unclickable_Object("CLOTHING02"); + Unclickable_Object("BOX27"); + Unclickable_Object("BOX39"); + Unclickable_Object("BOX44"); + Unclickable_Object("DRESS"); + Unclickable_Object("COATRACK"); + Unclickable_Object("COLUMN3 DETS"); + Unclickable_Object("COLUMN PIPE01"); + Unclickable_Object("RECTANGLE02"); + Unclickable_Object("COLUMN04"); + Unclickable_Object("COATRACK01"); + Unclickable_Object("SHIRT"); + Unclickable_Object("SKIRT 02"); + Unclickable_Object("CLOTHING B 03"); + Unclickable_Object("BUST BUST"); + } +} + +bool ScriptNR11::MouseClick(int x, int y) { + return false; +} + +bool ScriptNR11::ClickedOn3DObject(const char *objectName, bool a2) { + + if (Object_Query_Click("CLOTHING02", objectName) || Object_Query_Click("BOX27", objectName) || Object_Query_Click("BOX39", objectName) || Object_Query_Click("BOX44", objectName) || Object_Query_Click("DRESS", objectName) || Object_Query_Click("COATRACK", objectName) || Object_Query_Click("COLUMN3 DETS", objectName) || Object_Query_Click("COLUMN PIPE01", objectName) || Object_Query_Click("RECTANGLE02", objectName) || Object_Query_Click("COLUMN04", objectName) || Object_Query_Click("COATRACK01", objectName) || Object_Query_Click("SHIRT", objectName) || Object_Query_Click("SKIRT 02", objectName) || Object_Query_Click("CLOTHING B 03", objectName) || Object_Query_Click("BUST BUST", objectName)) { + if (a2) { + Actor_Set_Goal_Number(1, 211); + Scene_Exits_Disable(); + sub_4028EC(); + Player_Loses_Control(); + if (!Player_Query_Combat_Mode()) { + Player_Set_Combat_Mode(true); + } + Actor_Set_Goal_Number(0, 230); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + } else if (Actor_Query_Goal_Number(3) == 250) { + if (!Loop_Actor_Walk_To_XYZ(0, 24.0f, 0.33f, 0.0f, 0, 1, false, 0)) { + Actor_Face_XYZ(0, -180.0f, 0.0f, -170.0f, true); + sub_4028EC(); + Actor_Set_Goal_Number(1, 211); + if (Actor_Query_Friendliness_To_Other(3, 0) < 30) { + Actor_Set_At_XYZ(3, 0.5f, 0.33f, -162.0f, 0); + Loop_Actor_Walk_To_XYZ(3, -24.0f, 0.33f, -35.4f, 0, 0, true, 0); + Actor_Face_Actor(0, 3, true); + Actor_Change_Animation_Mode(3, 71); + Delay(500); + Actor_Change_Animation_Mode(0, 48); + Delay(2000); + Actor_Set_Goal_Number(0, 231); + } else { + Actor_Says(0, 3840, 18); + Delay(1000); + if (Actor_Query_Friendliness_To_Other(3, 0) > 59 && !Global_Variable_Query(45)) { + Music_Play(21, 35, 0, 3, -1, 0, 0); + } + Loop_Actor_Walk_To_XYZ(3, -135.0f, 0.33000001f, -267.0f, 0, 0, false, 0); + Actor_Face_Actor(3, 0, true); + Actor_Face_Actor(0, 3, true); + Actor_Clue_Acquire(0, 107, 1, 3); + Actor_Says(3, 990, 13); + Actor_Says(3, 1000, 14); + Loop_Actor_Walk_To_Actor(3, 0, 108, 0, false); + Actor_Says(0, 3845, 13); + Actor_Says(0, 3850, 15); + Actor_Says(3, 1010, 14); + Actor_Says(0, 3855, 13); + Actor_Says(3, 1020, 12); + Actor_Says(0, 3860, 12); + Actor_Says_With_Pause(3, 1030, 1.0f, 14); + Actor_Says(3, 1040, 13); + Actor_Says(0, 3865, 15); + Actor_Says_With_Pause(3, 1050, 0.80000001f, 14); + Actor_Says(3, 1060, 13); + Actor_Says(0, 3870, 3); + Actor_Says(3, 1070, 14); + Actor_Modify_Friendliness_To_Other(3, 0, 5); + if (Actor_Query_Friendliness_To_Other(3, 0) > 55 && !Global_Variable_Query(45)) { + Global_Variable_Set(45, 2); + Actor_Says(3, 1130, 17); + Actor_Says(0, 6365, 12); + Actor_Says(3, 1140, 14); + Actor_Says(0, 6370, 14); + Actor_Says(3, 1150, 12); + Actor_Says(3, 1160, 16); + } + Actor_Says(3, 1080, 13); + Actor_Says(0, 3875, 14); + Actor_Says(3, 1090, 17); + Music_Stop(4); + Actor_Set_Goal_Number(3, 260); + if (Global_Variable_Query(40) == 1) { + Actor_Set_Goal_Number(1, 236); + } + Game_Flag_Set(591); + } + } else { + if (Random_Query(1, 2) == 1) { + Actor_Says(0, 8575, 14); + } else { + Actor_Says(0, 8580, 14); + } + } + } + return true; + } + return false; +} + +bool ScriptNR11::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptNR11::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptNR11::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 100.0f, 1.75f, -8.0f, 0, 1, false, 0)) { + Game_Flag_Set(477); + Set_Enter(59, 63); + return true; + } + } + return false; +} + +bool ScriptNR11::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptNR11::SceneFrameAdvanced(int frame) { + if (frame == 62) { + Ambient_Sounds_Play_Sound(449, 40, 100, 100, 10); + } + if (frame == 67) { + Ambient_Sounds_Play_Sound(449, 30, 90, 90, 10); + } + if (frame == 74) { + Ambient_Sounds_Play_Sound(450, 50, 83, 83, 10); + } + if (frame == 80) { + Ambient_Sounds_Play_Sound(449, 60, 65, 65, 10); + } + if (frame == 92) { + Ambient_Sounds_Play_Sound(450, 30, 50, 50, 10); + } + if (frame == 97) { + Ambient_Sounds_Play_Sound(449, 50, -40, -40, 10); + } + if (frame == 103) { + Ambient_Sounds_Play_Sound(450, 40, -27, -27, 10); + } + if (frame == 109) { + Ambient_Sounds_Play_Sound(449, 60, -20, -20, 10); + } + if (frame == 62) { + Ambient_Sounds_Play_Sound(122, 80, 100, 100, 15); + } + if (Game_Flag_Query(659)) { + Game_Flag_Reset(659); + Overlay_Remove("NR11OVER"); + Overlay_Play("NR11OVER", 1, 0, 1, 0); + } + if (Game_Flag_Query(635)) { + sub_4028EC(); + Player_Loses_Control(); + if (!Player_Query_Combat_Mode()) { + Player_Set_Combat_Mode(true); + } + Actor_Set_Goal_Number(0, 230); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Game_Flag_Reset(635); + } else { + if (frame < 61 || frame > 120) { + //return false; + return; + } + sub_4027D0(0, frame); + if (Actor_Query_Goal_Number(1) == 215) { + sub_4027D0(1, frame); + } + if (frame == 120) { + Actor_Set_Goal_Number(0, 0); + Player_Gains_Control(); + if (Actor_Query_Goal_Number(1) == 215) { + Actor_Set_Goal_Number(1, 216); + } + Actor_Set_Goal_Number(3, 269); + } + } + //return true; +} + +void ScriptNR11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptNR11::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(3) == 250) { + Player_Set_Combat_Mode(true); + if (Game_Flag_Query(47)) { + Actor_Set_Goal_Number(1, 210); + } + } + if (Game_Flag_Query(632)) { + Game_Flag_Reset(632); + Game_Flag_Set(634); + Actor_Put_In_Set(3, 99); + Actor_Set_At_Waypoint(3, 41, 0); + Actor_Set_Invisible(0, false); + Player_Set_Combat_Mode(false); + Player_Gains_Control(); + if (Game_Flag_Query(47)) { + if (Actor_Query_Goal_Number(1) == 211) { + Actor_Set_At_XYZ(0, -37.41f, 0.33f, -86.0f, 26); + Delay(500); + Actor_Face_Current_Camera(0, true); + Delay(750); + Actor_Says(0, 5290, 12); + Delay(1000); + Actor_Set_Goal_Number(1, 212); + Actor_Face_Actor(0, 1, true); + } else { + Actor_Set_At_XYZ(0, -15.53f, 0.33f, 73.49f, 954); + Actor_Modify_Friendliness_To_Other(1, 0, 3); + Delay(1500); + Actor_Says(0, 3805, 12); + Actor_Face_Actor(0, 1, true); + Actor_Face_Actor(1, 0, true); + Actor_Says_With_Pause(1, 1720, 0.3f, 16); + Actor_Says(0, 3810, 16); + Actor_Says_With_Pause(1, 1730, 0.2f, 14); + Actor_Says(1, 1740, 15); + Actor_Set_Goal_Number(3, 599); + Actor_Put_In_Set(3, 99); + Actor_Set_At_Waypoint(3, 41, 0); + Actor_Set_Goal_Number(1, 275); + } + } else { + Actor_Set_Goal_Number(0, 500); + } + } + // return true; +} + +void ScriptNR11::PlayerWalkedOut() { + +} + +void ScriptNR11::DialogueQueueFlushed(int a1) { +} + +void ScriptNR11::sub_4027D0(int actorId, signed int frame) { + float x; + float y; + float z; + float coef; + + if (frame < 80) { + coef = (frame - 60) / 20.0f; + x = -106.66f * coef + 126.0f; + y = 57.79f * coef + 0.85f; + z = 42.0f * coef + -151.0f; + } else { + coef = (frame - 80) / 40.0f; + x = -97.87f * coef + -150.0f; + y = -10.8f * coef + 52.0f; + z = 57.0f * coef + -232.0f; + } + Actor_Face_XYZ(actorId, x, y, z, true); +} + +void ScriptNR11::sub_4028EC() { + Un_Combat_Target_Object("CLOTHING02"); + Un_Combat_Target_Object("BOX27"); + Un_Combat_Target_Object("BOX39"); + Un_Combat_Target_Object("BOX44"); + Un_Combat_Target_Object("DRESS"); + Un_Combat_Target_Object("COATRACK"); + Un_Combat_Target_Object("COLUMN3 DETS"); + Un_Combat_Target_Object("COLUMN PIPE01"); + Un_Combat_Target_Object("RECTANGLE02"); + Un_Combat_Target_Object("COLUMN04"); + Un_Combat_Target_Object("COATRACK01"); + Un_Combat_Target_Object("SHIRT"); + Un_Combat_Target_Object("SKIRT 02"); + Un_Combat_Target_Object("CLOTHING B 03"); + Un_Combat_Target_Object("BUST BUST"); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps01.cpp b/engines/bladerunner/script/ps01.cpp new file mode 100644 index 0000000000..1af1b93ed7 --- /dev/null +++ b/engines/bladerunner/script/ps01.cpp @@ -0,0 +1,277 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS01::InitializeScene() { + Setup_Scene_Information(1872.0f, 16592.0f, -2975.0f, 200); + Scene_Exit_Add_2D_Exit(0, 36, 194, 138, 326, 0); + if (Game_Flag_Query(251)) { + Scene_Exit_Add_2D_Exit(1, 344, 288, 584, 384, 2); + } + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + if (Game_Flag_Query(130)) { + if (Game_Flag_Query(251)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(5); + } + } else { + Actor_Set_Invisible(0, true); + Game_Flag_Set(273); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Player_Loses_Control(); + } +} + +void ScriptPS01::SceneLoaded() { + Obstacle_Object("TUBE81", true); + if (Game_Flag_Query(251)) { + Unobstacle_Object("Barrier Obstacle", true); + } + Unobstacle_Object("BOX38", true); + Unobstacle_Object("TUBE81", true); +} + +bool ScriptPS01::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS01::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 1920.0f, 16581.0f, -2653.0f, 12, 1, false, 0)) { + Game_Flag_Set(718); + Set_Enter(62, 66); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 1877.9f, 16592.0f, -2975.0f, 0, 1, false, 0)) { + Actor_Set_At_XYZ(0, 1872.0f, 16592.0f, -2975.0f, 870); + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(180); + Game_Flag_Reset(261); + Game_Flag_Reset(177); + Game_Flag_Reset(258); + int spinnerDest = Spinner_Interface_Choose_Dest(3, 1); + switch (spinnerDest) { + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(251); + Game_Flag_Set(249); + Set_Enter(69, 78); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(251); + Game_Flag_Set(250); + Set_Enter(49, 48); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(251); + Game_Flag_Set(248); + Set_Enter(4, 13); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(251); + Game_Flag_Set(307); + Set_Enter(17, 82); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(251); + Game_Flag_Set(252); + Set_Enter(0, 0); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(251); + Game_Flag_Set(253); + Set_Enter(7, 25); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(251); + Game_Flag_Set(254); + Set_Enter(20, 2); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(251); + Game_Flag_Set(255); + Set_Enter(54, 54); + Scene_Loop_Start_Special(1, 4, 1); + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(251); + Game_Flag_Set(256); + Set_Enter(37, 34); + Scene_Loop_Start_Special(1, 4, 1); + break; + default: + Actor_Face_Heading(0, 870, false); + Game_Flag_Set(178); + Game_Flag_Set(273); + Player_Loses_Control(); + Scene_Loop_Start_Special(2, 3, 1); + break; + } + } + return true; + } + return false; +} + +bool ScriptPS01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS01::SceneFrameAdvanced(int frame) { + if (frame == 71 || frame == 188) { + Sound_Play(116, 100, 40, 0, 50); + } + if (frame == 108 || frame == 228) { + Sound_Play(119, 100, 40, 0, 50); + } + if (frame == 1) { + Sound_Play(118, 40, 0, 0, 50); + } + if (frame == 76) { + Sound_Play(121, 50, 0, 0, 50); + } + if (frame == 192) { + Sound_Play(120, 50, 0, 0, 50); + } + if (frame == 59) { + Sound_Play(122, 15, 0, 0, 50); + } + if (frame == 275) { + Sound_Play(117, 40, 0, 0, 50); + } + if (!Game_Flag_Query(273)) { + switch (frame) { + case 196: + Actor_Face_Heading(0, 870, false); + Actor_Set_Frame_Rate_FPS(0, -1); + Actor_Change_Animation_Mode(0, 41); + break; + case 220: + Actor_Set_Frame_Rate_FPS(0, 0); + break; + case 240: + Actor_Set_Frame_Rate_FPS(0, -2); + break; + } + //return true; + return; + } + if (frame == 75) { + Actor_Face_Heading(0, 870, false); + Actor_Change_Animation_Mode(0, 42); + //return true; + return; + } + if (frame == 119) { + Game_Flag_Reset(273); + Player_Gains_Control(); + //return true; + return; + } + if (frame > 195) { + if (frame == 239) { + Game_Flag_Reset(273); + Player_Gains_Control(); + } + //return true; + return; + } + if (frame == 181) { + Actor_Face_Heading(0, 870, false); + Actor_Change_Animation_Mode(0, 42); + } else if (frame == 182) { + Actor_Set_Frame_Rate_FPS(0, 0); + } else if (frame == 195) { + Actor_Set_Frame_Rate_FPS(0, -2); + } + //return true; + return; +} + +void ScriptPS01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS01::PlayerWalkedIn() { + if (Game_Flag_Query(130)) { + Actor_Set_At_XYZ(0, 1920.0f, 16581.0f, -2653.0f, 150); + Game_Flag_Reset(130); + } + //return false; +} + +void ScriptPS01::PlayerWalkedOut() { + Actor_Set_Invisible(0, false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(718) && Global_Variable_Query(1) == 1) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(38, 1, -1); + } +} + +void ScriptPS01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps02.cpp b/engines/bladerunner/script/ps02.cpp new file mode 100644 index 0000000000..3ca56e1550 --- /dev/null +++ b/engines/bladerunner/script/ps02.cpp @@ -0,0 +1,177 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS02::InitializeScene() { + Player_Loses_Control(); + Setup_Scene_Information(-13.31f, -40.28f, -48.12f, 30); + Scene_Exit_Add_2D_Exit(0, 0, 0, 240, 479, 3); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(386, 20, 1, 1); + Ambient_Sounds_Add_Looping_Sound(210, 20, 1, 1); + Ambient_Sounds_Add_Sound(0, 3, 20, 12, 16, 0, 0, -101, -101, 0, 0); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptPS02::SceneLoaded() { + Obstacle_Object("E.DOOR01", true); + Obstacle_Object("E.DOOR02", true); + Clickable_Object("E.DOOR01"); + Clickable_Object("E.DOOR02"); +} + +bool ScriptPS02::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS02::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("E.DOOR01", objectName) || Object_Query_Click("E.D00R02", objectName)) { + if (Game_Flag_Query(130) ) { + if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 3, 1); + } + } else if (Game_Flag_Query(22) ) { + if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(15, 69); + Scene_Loop_Start_Special(1, 3, 1); + } + } else if (Game_Flag_Query(131) ) { + if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(66, 71); + Scene_Loop_Start_Special(1, 3, 1); + } + } else if (Game_Flag_Query(132) ) { + if (!Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(63, 67); + Scene_Loop_Start_Special(1, 3, 1); + } + } else if (Game_Flag_Query(133) && !Loop_Actor_Walk_To_XYZ(0, -5.0f, -40.0f, -15.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(67, 72); + Scene_Loop_Start_Special(1, 3, 1); + } + } + return false; +} + +bool ScriptPS02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS02::ClickedOnExit(int exitId) { + return false; +} + +bool ScriptPS02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS02::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Ambient_Sounds_Play_Sound(208, 45, 0, 0, 0); + } + if (frame == 91) { + Ambient_Sounds_Play_Sound(209, 45, 0, 0, 0); + } + //return true; +} + +void ScriptPS02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS02::PlayerWalkedIn() { + Game_Flag_Reset(718); + Actor_Face_XYZ(0, 0, 0, 450.0f, true); + Player_Gains_Control(); + sub_4018BC(); + Player_Loses_Control(); + if (Game_Flag_Query(130) ) { + Set_Enter(61, 65); + Scene_Loop_Start_Special(1, 3, 1); + } else if (Game_Flag_Query(22) ) { + Set_Enter(15, 69); + Scene_Loop_Start_Special(1, 3, 1); + } else if (Game_Flag_Query(131) ) { + Set_Enter(66, 71); + Scene_Loop_Start_Special(1, 3, 1); + } else if (Game_Flag_Query(132) ) { + Set_Enter(63, 67); + Scene_Loop_Start_Special(1, 3, 1); + } else if (Game_Flag_Query(133) ) { + Set_Enter(67, 72); + Scene_Loop_Start_Special(1, 3, 1); + } + //return true; +} + +void ScriptPS02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Player_Gains_Control(); +} + +void ScriptPS02::DialogueQueueFlushed(int a1) { +} + +void ScriptPS02::sub_4018BC() { + Scene_Exits_Disable(); + switch (Elevator_Activate(2)) { + case 7: + Game_Flag_Set(133); + break; + case 6: + Game_Flag_Set(132); + break; + case 5: + Game_Flag_Set(22); + break; + case 4: + Game_Flag_Set(130); + break; + case 3: + Game_Flag_Set(131); + break; + default: + break; + } + Scene_Exits_Enable(); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps03.cpp b/engines/bladerunner/script/ps03.cpp new file mode 100644 index 0000000000..e3835d04db --- /dev/null +++ b/engines/bladerunner/script/ps03.cpp @@ -0,0 +1,134 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS03::InitializeScene() { + if (Game_Flag_Query(39)) { + Actor_Set_At_XYZ(0, -674.0f, -354.0f, 550.0f, 900); + Setup_Scene_Information(-674.0f, -354.62f, 550.0f, 900); + Game_Flag_Reset(39); + } else if (Game_Flag_Query(135)) { + Setup_Scene_Information(-875.0f, -354.62f, -1241.0f, 450); + Game_Flag_Reset(135); + } else { + Setup_Scene_Information(-569.54f, -354.62f, -1076.15f, 475); + Game_Flag_Reset(132); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 449, 273, 508, 329, 0); + if (Global_Variable_Query(1) > 1) { + Scene_Exit_Add_2D_Exit(2, 358, 245, 411, 288, 0); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(45, 35, 0, 1); + Ambient_Sounds_Add_Sound(90, 5, 50, 7, 7, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(91, 5, 50, 7, 7, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(92, 5, 60, 33, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(93, 5, 60, 33, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(94, 5, 60, 33, 33, -100, 100, -101, -101, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptPS03::SceneLoaded() { + Obstacle_Object("TABLE05", true); + Unclickable_Object("COP1PS03"); + Unclickable_Object("COP2PS03"); +} + +bool ScriptPS03::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -674.0f, -354.0f, 550.0f, 0, 1, false, 0)) { + Game_Flag_Set(42); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(64, 68); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -569.54f, -354.62f, -1076.15f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(62, 66); + Game_Flag_Reset(478); + if (Global_Variable_Query(1) < 4) { + Actor_Set_Goal_Number(4, 100); + } + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -875.0f, -354.0f, -1241.0f, 0, 1, false, 0)) { + Game_Flag_Set(134); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(68, 77); + } + return true; + } + return false; +} + +bool ScriptPS03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS03::SceneFrameAdvanced(int frame) { +} + +void ScriptPS03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS03::PlayerWalkedIn() { + if (!Game_Flag_Query(478)) { + Game_Flag_Set(478); + //return true; + } + //return false; +} + +void ScriptPS03::PlayerWalkedOut() { +} + +void ScriptPS03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps04.cpp b/engines/bladerunner/script/ps04.cpp new file mode 100644 index 0000000000..3718c6d513 --- /dev/null +++ b/engines/bladerunner/script/ps04.cpp @@ -0,0 +1,304 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS04::InitializeScene() { + AI_Movement_Track_Pause(4); + if (Game_Flag_Query(42)) { + Game_Flag_Reset(42); + } + Setup_Scene_Information(-668.0f, -354.0f, 974.0f, 475); + if (Global_Variable_Query(1) == 1) { + Actor_Put_In_Set(4, 64); + Actor_Set_At_XYZ(4, -728.0f, -354.0f, 1090.0f, 150); + Actor_Change_Animation_Mode(4, 53); + } + Scene_Exit_Add_2D_Exit(0, 347, 113, 469, 302, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(45, 16, 1, 1); + Ambient_Sounds_Add_Looping_Sound(46, 50, 1, 1); + Ambient_Sounds_Add_Sound(47, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(48, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(49, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(50, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(51, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(52, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(53, 9, 40, 20, 20, 0, 0, -101, -101, 0, 0); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptPS04::SceneLoaded() { + Obstacle_Object("CHAIR07", true); + Unobstacle_Object("GOOD B.WALL", true); + Unobstacle_Object("B.DOOR", true); + Unobstacle_Object("B.CHAIR01", true); + Unclickable_Object("CHAIR07"); + if (Global_Variable_Query(1) == 2 && !Actor_Clue_Query(0, 80) && !Game_Flag_Query(727)) { + Item_Add_To_World(111, 958, 64, -643.5f, -318.82f, 1148.87f, 525, 16, 12, false, true, false, true); + Game_Flag_Set(727); + } + if (Actor_Query_Is_In_Current_Set(4)) { + Actor_Change_Animation_Mode(4, 53); + } +} + +bool ScriptPS04::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS04::ClickedOnActor(int actorId) { + if (actorId == 4) { + if (!Loop_Actor_Walk_To_Actor(0, 4, 36, 1, false)) { + Actor_Face_Actor(0, 4, true); + Actor_Face_Actor(4, 0, true); + sub_4017E4(); + return true; + } + } + return false; +} + +bool ScriptPS04::ClickedOnItem(int itemId, bool a2) { + if (itemId == 111 && Actor_Query_Is_In_Current_Set(4)) { + Actor_Says(4, 560, 30); + } else if (!Actor_Clue_Query(0, 80)) { + Item_Remove_From_World(111); + Item_Pickup_Spin_Effect(958, 464, 362); + Actor_Says(0, 4485, 3); + Actor_Clue_Acquire(0, 80, 1, 0); + } + return false; +} + +bool ScriptPS04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -668.0f, -350.85f, 962.0f, 0, 1, false, 0)) { + Game_Flag_Set(39); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(63, 67); + } + return true; + } + return false; +} + +bool ScriptPS04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS04::SceneFrameAdvanced(int frame) { +} + +void ScriptPS04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS04::PlayerWalkedIn() { + if (Actor_Query_Which_Set_In(4) == 64) { + Actor_Face_Actor(0, 4, true); + } + //return false; +} + +void ScriptPS04::PlayerWalkedOut() { + AI_Movement_Track_Unpause(4); +} + +void ScriptPS04::DialogueQueueFlushed(int a1) { +} + +void ScriptPS04::sub_4017E4() { + Dialogue_Menu_Clear_List(); + if (Global_Variable_Query(1) > 1) { + if (Actor_Clue_Query(0, 51)) { + DM_Add_To_List_Never_Repeat_Once_Selected(110, 5, 7, 4); + } + DM_Add_To_List_Never_Repeat_Once_Selected(120, 1, -1, -1); + if (Actor_Clue_Query(0, 110)) { + DM_Add_To_List_Never_Repeat_Once_Selected(150, 7, 6, 5); + } + } + if (Game_Flag_Query(169) == 1) { + DM_Add_To_List_Never_Repeat_Once_Selected(140, 3, -1, -1); + } + DM_Add_To_List(130, 1, 1, 1); + Dialogue_Menu_Add_DONE_To_List(160); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 130: + if (Game_Flag_Query(40) && !Game_Flag_Query(159)) { + Actor_Says(0, 3920, 13); + Actor_Says(4, 140, 30); + Actor_Face_Current_Camera(4, true); + Actor_Says(4, 150, 31); + Actor_Says(4, 160, 32); + Actor_Says(0, 3925, 18); + Actor_Face_Actor(4, 0, true); + Actor_Says(4, 170, 33); + Loop_Actor_Walk_To_XYZ(0, -716.0f, -354.85f, 1042.0f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 3930, 13); + Actor_Face_Actor(4, 0, true); + Actor_Says(4, 180, 34); + Actor_Says(0, 3935, 13); + Actor_Says(4, 190, 30); + Actor_Says(0, 3940, 16); + Actor_Says(4, 200, 31); + Actor_Says(4, 210, 33); + Actor_Says(4, 220, 34); + Actor_Says(0, 3945, 17); + Actor_Says(4, 230, 32); + Actor_Says(4, 240, 31); + Actor_Says(0, 3950, 13); + Actor_Says(4, 250, 34); + Actor_Says(4, 260, 33); + Actor_Says(4, 270, 32); + Game_Flag_Set(159); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Increment(2, 200); + } + Game_Flag_Set(723); + } else if (Game_Flag_Query(41) && !Game_Flag_Query(160)) { + Actor_Says(0, 3955, 13); + Actor_Says(4, 280, 30); + Actor_Says(0, 3960, 18); + Actor_Says(4, 290, 32); + Actor_Says(4, 300, 31); + Actor_Says(0, 3965, 13); + Actor_Says(4, 310, 33); + Actor_Says(4, 320, 34); + Game_Flag_Set(160); + } else if ((Actor_Clue_Query(0, 8) || Actor_Clue_Query(0, 9)) && Actor_Clue_Query(0, 22) && Actor_Query_Friendliness_To_Other(4, 0) < 50 && !Game_Flag_Query(161)) { + Actor_Says(0, 3970, 18); + Actor_Says(4, 330, 30); + Actor_Says(4, 340, 32); + Actor_Says(0, 3975, 13); + Actor_Says(4, 350, 31); + Actor_Says(4, 360, 34); + Actor_Says(0, 3980, 13); + Actor_Says(4, 370, 33); + Actor_Says(4, 380, 32); + Actor_Says(4, 390, 31); + Actor_Says(0, 3985, 18); + Actor_Says(4, 400, 34); + Actor_Says(4, 410, 31); + Game_Flag_Set(161); + } else if ((Actor_Clue_Query(0, 8) || Actor_Clue_Query(0, 9)) + && Actor_Clue_Query(0, 22) + && !Game_Flag_Query(162)) { + Actor_Says(0, 3920, 13); + Actor_Says(4, 570, 32); + Actor_Says(0, 4070, 13); + Game_Flag_Set(162); + } else if (Actor_Query_Friendliness_To_Other(4, 0) >= 50) { + Actor_Says(0, 4020, 13); + Actor_Says(4, 580, 34); + Actor_Says(0, 4075, 16); + Actor_Says(4, 590, 33); + } else { + Actor_Says(0, 4020, 18); + Actor_Says(4, 130, 30); + Actor_Face_Current_Camera(4, true); + Actor_Says(0, 3915, 13); + } + break; + case 110: + Actor_Says(0, 3990, 19); + Actor_Says(0, 3995, 17); + Actor_Says(4, 440, 31); + Actor_Says(0, 4035, 13); + Actor_Says(4, 450, 34); + Actor_Says(4, 460, 33); + Actor_Says(0, 4040, 17); + Game_Flag_Set(625); + break; + case 120: + Actor_Says(0, 4000, 18); + Actor_Clue_Acquire(0, 82, 1, 4); + Actor_Says(4, 520, 33); + Actor_Says(0, 4055, 13); + Actor_Says(4, 530, 31); + Actor_Says(0, 4060, 13); + Actor_Says(4, 540, 31); + Actor_Says(4, 550, 32); + Actor_Says(0, 4065, 18); + Actor_Says(4, 560, 34); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Increment(2, 100); + } + break; + case 140: + Actor_Says(0, 4010, 12); + Actor_Says(4, 600, 31); + Actor_Says(0, 4080, 18); + Actor_Says(4, 610, 33); + Actor_Face_Heading(4, 400, false); + Actor_Says(4, 620, 32); + Actor_Face_Actor(4, 0, true); + Actor_Says(4, 700, 34); + Actor_Says(0, 4100, 13); + Actor_Says(4, 710, 31); + Actor_Says(4, 720, 34); + Actor_Says(0, 4105, 18); + Loop_Actor_Walk_To_XYZ(0, -668.0f, -350.85f, 962.0f, 0, 0, false, 0); + Actor_Says(4, 730, 32); + Actor_Face_Actor(0, 4, true); + Loop_Actor_Walk_To_XYZ(0, -716.0f, -354.85f, 1042.0f, 0, 0, false, 0); + Actor_Face_Actor(4, 0, true); + Actor_Says(4, 740, 31); + Actor_Says(4, 750, 32); + Actor_Says(4, 760, 33); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 4110, 13); + Actor_Says(4, 770, 32); + Actor_Says(4, 780, 31); + break; + case 150: + Actor_Says(0, 4015, 16); + Actor_Says(4, 630, 34); + Actor_Says(0, 4085, 19); + Actor_Says(0, 4090, 18); + Actor_Says(4, 640, 31); + Actor_Says(4, 650, 32); + Actor_Says(4, 670, 34); + Actor_Says(0, 4095, 17); + Actor_Says(4, 680, 32); + Actor_Says(4, 690, 31); + break; + default: + //TODO: what is this for? + //answer != 160; + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps05.cpp b/engines/bladerunner/script/ps05.cpp new file mode 100644 index 0000000000..0636daf163 --- /dev/null +++ b/engines/bladerunner/script/ps05.cpp @@ -0,0 +1,273 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS05::InitializeScene() { + if (Game_Flag_Query(21)) { + Setup_Scene_Information(547.59f, 0.18f, -216.84f, 334); + } else if (Game_Flag_Query(22)) { + Setup_Scene_Information(635.0f, 0.0f, -598.0f, 475); + } else { + Setup_Scene_Information(630.72f, 0.38f, -469.26f, 400); + } + Scene_Exit_Add_2D_Exit(0, 218, 98, 280, 246, 3); + Scene_Exit_Add_2D_Exit(1, 330, 90, 436, 198, 0); + Scene_Exit_Add_2D_Exit(2, 476, 96, 524, 240, 1); + Scene_2D_Region_Add(0, 519, 107, 537, 122); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(384, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(141, 80, 0, 1); + Ambient_Sounds_Add_Sound(385, 5, 50, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(156, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(157, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(158, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 20, 5, 9, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 20, 5, 9, -70, 70, -101, -101, 0, 0); +} + +void ScriptPS05::SceneLoaded() { + Obstacle_Object("WATER FOUNTAIN", true); + Clickable_Object("WATER FOUNTAIN"); + Clickable_Object("ASHTRAY"); + Clickable_Object("FIRE EXTINGISHER"); + Clickable_Object("CUP"); + Clickable_Object("WIRE BASKET"); + Clickable_Object("WANTED POSTERS"); + Unclickable_Object("WATER FOUNTAIN"); + Unclickable_Object("CUP"); +} + +bool ScriptPS05::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS05::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("WATER FOUNTAIN", objectName) && !Loop_Actor_Walk_To_Scene_Object(0, "WATER FOUNTAIN", 12, 1, false)) { + Actor_Face_Object(0, "WATER FOUNTAIN", true); + Actor_Says(0, 3490, 18); + } + if (Object_Query_Click("ASHTRAY", objectName) && !Loop_Actor_Walk_To_XYZ(0, 662.0f, 0.37f, -180.0f, 0, 1, false, 0)) { + Actor_Face_Object(0, "ASHTRAY", true); + Actor_Voice_Over(1770, 99); + Actor_Voice_Over(1780, 99); + Actor_Voice_Over(1790, 99); + } + if (Object_Query_Click("WIRE BASKET", objectName) && !Loop_Actor_Walk_To_Scene_Object(0, "WIRE BASKET", 12, 1, false)) { + Actor_Face_Object(0, "WIRE BASKET", true); + Actor_Voice_Over(1810, 99); + Actor_Voice_Over(1820, 99); + } + if (Object_Query_Click("WANTED POSTERS", objectName) && !Loop_Actor_Walk_To_Scene_Object(0, "WANTED POSTERS", 12, 1, false)) { + Actor_Face_Object(0, "WANTED POSTERS", true); + Actor_Voice_Over(1800, 99); + } + return false; +} + +bool ScriptPS05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS05::ClickedOnItem(int itemId, bool a2) { + if (Game_Flag_Query(23)) { + Actor_Set_At_XYZ(0, 718.72f, 0.37f, -461.26f, 600); + } else if (Game_Flag_Query(22)) { + sub_401B34(); + sub_401C30(); + } + Game_Flag_Reset(22); + Game_Flag_Reset(23); + Game_Flag_Reset(21); + Game_Flag_Reset(204); + return false; +} + +bool ScriptPS05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_Waypoint(0, 2, 24, 1, false)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(101, 119); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 635.0f, 0.0f, -598.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(62, 66); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 742.52002f, 0.37f, -457.69f, 0, 1, false, 0)) { + Game_Flag_Set(136); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(65, 70); + } + return true; + } + return false; +} + +bool ScriptPS05::ClickedOn2DRegion(int region) { + if (region == 0 && !Loop_Actor_Walk_To_XYZ(0, 694.78f, 0.37f, -321.05f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 130, false); + View_Score_Board(); + } + return false; +} + +void ScriptPS05::SceneFrameAdvanced(int frame) { + if (frame == 1 || frame == 16 || frame == 31 || frame == 46) { + Sound_Play(149, Random_Query(10, 10), 70, 70, 50); + } + //return true; +} + +void ScriptPS05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS05::PlayerWalkedIn() { +} + +void ScriptPS05::PlayerWalkedOut() { +} + +void ScriptPS05::DialogueQueueFlushed(int a1) { + Overlay_Remove("PS05OVER"); +} + +void ScriptPS05::sub_401B34() { + int v0; + int v1; + int v3[7]; + + v0 = 0; + if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) { + v0 = 1; + v3[0] = 0; + } + v1 = v0 + 1; + v3[v0] = 1; + if (Global_Variable_Query(1) >= 3) { + v3[v1] = 2; + v1 = v0 + 2; + } + if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) { + v3[v1++] = 3; + } + if (Game_Flag_Query(171) && Game_Flag_Query(170)) { + v3[v1++] = 4; + } + if (v1 <= 0) { + Global_Variable_Set(52, -1); + } else { + Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]); + } +} + +void ScriptPS05::sub_401C30() { + switch (Global_Variable_Query(52)) { + case 4: + if (!Game_Flag_Query(692)) { + Overlay_Play("PS05OVER", 0, 1, 0, 0); + ADQ_Add(61, 230, 3); + ADQ_Add(61, 240, 3); + Game_Flag_Set(692); + } + break; + case 3: + if (!Game_Flag_Query(691)) { + Overlay_Play("PS05OVER", 0, 1, 0, 0); + ADQ_Add(61, 170, 3); + ADQ_Add(61, 180, 3); + ADQ_Add(61, 190, 3); + ADQ_Add(61, 200, 3); + ADQ_Add(61, 210, 3); + ADQ_Add(61, 220, 3); + ADQ_Add(41, 80, 3); + ADQ_Add(41, 90, 3); + ADQ_Add(41, 100, 3); + ADQ_Add(41, 110, 3); + ADQ_Add(41, 120, 3); + ADQ_Add(41, 130, 3); + Game_Flag_Set(691); + } + break; + case 2: + if (!Game_Flag_Query(690)) { + Overlay_Play("PS05OVER", 0, 1, 0, 0); + if (Actor_Query_Friendliness_To_Other(5, 0) > Actor_Query_Friendliness_To_Other(1, 0)) { + ADQ_Add(61, 120, 3); + ADQ_Add(61, 130, 3); + ADQ_Add(61, 140, 3); + ADQ_Add(61, 150, 3); + ADQ_Add(4, 1570, 3); + ADQ_Add(4, 1580, 3); + ADQ_Add(4, 1590, 3); + } else { + ADQ_Add(61, 90, 3); + ADQ_Add(61, 100, 3); + ADQ_Add(61, 110, 3); + ADQ_Add(4, 1540, 3); + ADQ_Add(4, 1550, 3); + ADQ_Add(4, 1560, 3); + } + Game_Flag_Set(690); + } + break; + case 1: + if (!Game_Flag_Query(689)) { + Overlay_Play("PS05OVER", 0, 1, 0, 0); + ADQ_Add(61, 40, 3); + ADQ_Add(61, 50, 3); + ADQ_Add(61, 60, 3); + ADQ_Add(61, 70, 3); + ADQ_Add(61, 80, 3); + Game_Flag_Set(689); + } + break; + case 0: + if (!Game_Flag_Query(688)) { + Overlay_Play("PS05OVER", 0, 1, 0, 0); + ADQ_Add(61, 0, 3); + ADQ_Add(61, 10, 3); + ADQ_Add(61, 20, 3); + ADQ_Add(61, 30, 3); + ADQ_Add(51, 430, 3); + ADQ_Add(51, 440, 3); + ADQ_Add(51, 450, 3); + ADQ_Add(51, 460, 3); + Game_Flag_Set(688); + } + break; + default: + return; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps06.cpp b/engines/bladerunner/script/ps06.cpp new file mode 100644 index 0000000000..a3a1bdfc0a --- /dev/null +++ b/engines/bladerunner/script/ps06.cpp @@ -0,0 +1,137 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS06::InitializeScene() { + Setup_Scene_Information(11257.26f, 707.3f, -4778.31f, 120); + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(388, 50, 1, 1); + +} + +void ScriptPS06::SceneLoaded() { + Obstacle_Object("E.SCREEN02", true); + Clickable_Object("E.SCREEN02"); + Clickable_Object("E.MONITOR1"); + Clickable_Object("E.SCREEN03"); + Clickable_Object("E.MONITOR3"); +} + +bool ScriptPS06::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS06::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("E.MONITOR1", objectName)) { + ESPER_Flag_To_Activate(); + return true; + } + if (Object_Query_Click("E.SCREEN03", objectName) || Object_Query_Click("E.MONITOR3", objectName)) { + Actor_Says(39, 330, 3); + if (!Actor_Clue_Query(0, 111) || Actor_Clue_Query(0, 113) || Actor_Clue_Query(0, 114) || Actor_Clue_Query(0, 115)) { + Actor_Clues_Transfer_New_To_Mainframe(0); + Ambient_Sounds_Play_Sound(587, 50, 0, 0, 99); + Delay(2000); + Actor_Says(39, 340, 3); + Actor_Clues_Transfer_New_From_Mainframe(0); + Ambient_Sounds_Play_Sound(587, 50, 0, 0, 99); + Delay(2000); + Ambient_Sounds_Play_Sound(588, 80, 0, 0, 99); + Actor_Says(39, 350, 3); + return true; + } else { + Delay(2000); + Actor_Voice_Over(3780, 99); + Actor_Voice_Over(3790, 99); + if (Game_Flag_Query(47)) { + Actor_Voice_Over(3800, 99); + Actor_Voice_Over(3810, 99); + Actor_Voice_Over(3820, 99); + Actor_Voice_Over(3830, 99); + Actor_Clue_Acquire(0, 113, 1, -1); + } else if (Game_Flag_Query(45)) { + Actor_Voice_Over(3840, 99); + Actor_Voice_Over(3850, 99); + Actor_Voice_Over(3860, 99); + Actor_Voice_Over(3870, 99); + Actor_Clue_Acquire(0, 114, 1, -1); + } else { + Actor_Voice_Over(3880, 99); + Actor_Voice_Over(3890, 99); + Actor_Voice_Over(3900, 99); + Actor_Voice_Over(3910, 99); + Actor_Clue_Acquire(0, 115, 1, -1); + } + Actor_Clues_Transfer_New_To_Mainframe(0); + Actor_Clues_Transfer_New_From_Mainframe(0); + return true; + } + } + return false; +} + +bool ScriptPS06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS06::ClickedOnExit(int exitId) { + if (exitId == 0) { + Game_Flag_Set(23); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(15, 69); + return true; + } + return false; +} + +bool ScriptPS06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS06::SceneFrameAdvanced(int frame) { +} + +void ScriptPS06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS06::PlayerWalkedIn() { + if (Game_Flag_Query(136)) { + Game_Flag_Reset(136); + } +} + +void ScriptPS06::PlayerWalkedOut() { +} + +void ScriptPS06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps07.cpp b/engines/bladerunner/script/ps07.cpp new file mode 100644 index 0000000000..8d8ade5d78 --- /dev/null +++ b/engines/bladerunner/script/ps07.cpp @@ -0,0 +1,189 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS07::InitializeScene() { + Setup_Scene_Information(609.07f, 0.22f, -598.67f, 768); + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(141, 80, 0, 1); + Ambient_Sounds_Add_Sound(142, 5, 20, 5, 10, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(146, 5, 30, 5, 10, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(147, 2, 20, 5, 10, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(148, 2, 10, 10, 20, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(149, 2, 10, 10, 20, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(150, 2, 10, 10, 20, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(151, 2, 10, 10, 20, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(152, 2, 30, 10, 15, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(153, 2, 20, 10, 15, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(154, 5, 20, 10, 15, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(145, 5, 30, 5, 8, -100, 100, -101, -101, 0, 0); +} + +void ScriptPS07::SceneLoaded() { + Obstacle_Object("RICE BOX01", true); + Unobstacle_Object("RICE BOX01", true); +} + +bool ScriptPS07::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS07::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("L.MOUSE", objectName)) { + Sound_Play(155, 70, 0, 0, 50); + if (Actor_Query_Goal_Number(30) < 4 && Actor_Query_Goal_Number(30) > 0) { + Actor_Face_Actor(0, 30, true); + Actor_Set_Goal_Number(30, 3); + Actor_Modify_Friendliness_To_Other(30, 0, -3); + } + return true; + } + return false; +} + +bool ScriptPS07::ClickedOnActor(int actorId) { + if (actorId == 30) { + Actor_Face_Actor(0, 30, true); + Actor_Set_Goal_Number(30, 3); + if (!Game_Flag_Query(111)) { + Actor_Says(0, 4115, 13); + } + if (!Game_Flag_Query(111) && (Game_Flag_Query(125) || Game_Flag_Query(126) || Game_Flag_Query(127) || Game_Flag_Query(128))) { + Actor_Face_Actor(30, 0, true); + Actor_Says(30, 30, 12); + Game_Flag_Set(111); + } else { + if (Game_Flag_Query(111)) { + Actor_Says(0, 4130, 18); + } + } + if (Game_Flag_Query(125) && !Game_Flag_Query(12)) { + Game_Flag_Set(12); + Actor_Clue_Acquire(0, 11, 0, 30); + Actor_Says(30, 50, 16); + Actor_Says(0, 4135, 13); + Actor_Says(30, 60, 15); + Actor_Says(30, 70, 12); + Actor_Says(0, 4140, 18); + Actor_Says(30, 80, 14); + Actor_Says(30, 90, 14); + Actor_Set_Goal_Number(30, 1); + return true; + } + if (Game_Flag_Query(126) && !Game_Flag_Query(13)) { + Game_Flag_Set(13); + Actor_Clue_Acquire(0, 10, 0, 30); + sub_401D60(); + Actor_Set_Goal_Number(30, 1); + return true; + } + if (Game_Flag_Query(127) && !Game_Flag_Query(104)) { + Game_Flag_Set(104); + Actor_Clue_Acquire(0, 39, 0, 30); + Actor_Says(30, 170, 14); + Actor_Says(0, 4180, 13); + Actor_Says(30, 180, 12); + Actor_Says(30, 190, 13); + Actor_Says(30, 200, 16); + Actor_Says(0, 4185, 18); + Actor_Says(30, 210, 12); + Actor_Modify_Friendliness_To_Other(30, 0, -12); + Actor_Set_Goal_Number(30, 1); + return true; + } + if (Game_Flag_Query(128) && !Game_Flag_Query(105)) { + Game_Flag_Set(105); + Actor_Says(30, 220, 12); + Actor_Says(0, 4190, 13); + Actor_Says(30, 230, 14); + Actor_Set_Goal_Number(30, 1); + return true; + } + Actor_Says(30, 0, 13); + Actor_Set_Goal_Number(30, 1); + return true; + } + return false; + +} + +bool ScriptPS07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 609.07f, 0.22f, -598.67f, 0, 0, false, 0)) { + Set_Enter(62, 66); + } + return true; + } + return false; +} + +bool ScriptPS07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS07::SceneFrameAdvanced(int frame) { +} + +void ScriptPS07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS07::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, 561.07f, 0.34f, -606.67f, 6, 0, false, 0); + Game_Flag_Reset(131); + //return false; +} + +void ScriptPS07::PlayerWalkedOut() { + if (!Game_Flag_Query(138) && Global_Variable_Query(1) == 1) { + Actor_Set_Goal_Number(30, 0); + } +} + +void ScriptPS07::DialogueQueueFlushed(int a1) { +} + +void ScriptPS07::sub_401D60() { + Actor_Says(30, 100, 13); + Actor_Says(0, 4145, 13); + Actor_Says(30, 110, 12); + Actor_Says(0, 4150, 13); + Actor_Says(30, 120, 14); + Actor_Says(0, 4155, 17); + Actor_Says(30, 130, 15); + Actor_Says(0, 4160, 13); + Actor_Says(30, 140, 16); + Actor_Says(0, 4165, 18); + Actor_Says(30, 160, 13); + Actor_Says(0, 4170, 19); + Actor_Says(0, 4175, 19); + Actor_Modify_Friendliness_To_Other(30, 0, 3); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps09.cpp b/engines/bladerunner/script/ps09.cpp new file mode 100644 index 0000000000..4977056a54 --- /dev/null +++ b/engines/bladerunner/script/ps09.cpp @@ -0,0 +1,354 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS09::InitializeScene() { + if (Game_Flag_Query(465)) { + Setup_Scene_Information(-410.0f, 0.26f, -200.0f, 512); + } else { + Setup_Scene_Information(-559.0f, 0.0f, -85.06f, 250); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(138, 50, 0, 0); + Ambient_Sounds_Add_Looping_Sound(137, 30, 0, 0); + Ambient_Sounds_Add_Looping_Sound(124, 30, 0, 0); + Ambient_Sounds_Add_Sound(125, 15, 60, 7, 10, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(126, 25, 60, 7, 10, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(127, 25, 60, 7, 10, 100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(55)) { + Actor_Put_In_Set(11, 67); + Actor_Set_At_XYZ(11, -417.88f, 0.0f, -200.74f, 512); + Game_Flag_Set(55); + } + if (Game_Flag_Query(465)) { + Actor_Put_In_Set(11, 94); + Actor_Set_At_XYZ(11, 0.0f, 0.0f, 0.0f, 512); + } + if (Game_Flag_Query(164) ) { + Actor_Put_In_Set(7, 67); + Actor_Set_At_XYZ(7, -476.0f, 0.2f, -225.0f, 518); + } + if (Game_Flag_Query(165) ) { + Actor_Put_In_Set(9, 67); + Actor_Set_At_XYZ(9, -290.0f, 0.33f, -235.0f, 207); + } +} + +void ScriptPS09::SceneLoaded() { + Obstacle_Object("OFFICE DOOR", true); + Unobstacle_Object("OFFICE DOOR", true); + Unclickable_Object("OFFICE DOOR"); +} + +bool ScriptPS09::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS09::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS09::ClickedOnActor(int actorId) { + if (actorId == 11 && !Loop_Actor_Walk_To_XYZ(0, -381.11f, 0.0f, -135.55f, 0, 1, false, 0)) { + Actor_Face_Actor(0, 11, true); + Actor_Face_Actor(11, 0, true); + if (!Game_Flag_Query(49)) { + Actor_Says(11, 0, 12); + Actor_Says(0, 4235, 18); + Actor_Says(11, 10, 13); + Game_Flag_Set(49); + return true; + } + if (Game_Flag_Query(49) && !Game_Flag_Query(54) && !Actor_Clue_Query(0, 179) && !Actor_Clue_Query(0, 180) && !Actor_Clue_Query(0, 181)) { + Actor_Says(0, 4245, 14); + Actor_Says(11, 20, 14); + Game_Flag_Set(54); + return true; + } + if ((!Game_Flag_Query(53) && Game_Flag_Query(49) && Actor_Clue_Query(0, 179) ) || Actor_Clue_Query(0, 180) || Actor_Clue_Query(0, 181) || Actor_Clue_Query(0, 99) ) { + Game_Flag_Set(53); + Actor_Says(0, 4240, 13); + Actor_Says(11, 550, 15); + Actor_Says(11, 480, 16); + sub_402090(); + return true; + } + if (Game_Flag_Query(51) ) { + Actor_Says(0, 4270, 18); + Actor_Says(11, 30, 14); + Actor_Says(11, 40, 13); + return true; + } + if (Game_Flag_Query(53) && Game_Flag_Query(49) && (Actor_Clue_Query(0, 179) || Actor_Clue_Query(0, 180) || Actor_Clue_Query(0, 99) )) { + sub_402090(); + return true; + } + Actor_Says(0, 4270, 18); + Actor_Says(11, 30, 14); + Actor_Says(11, 40, 13); + return true; + } + if (actorId == 7 && !Loop_Actor_Walk_To_XYZ(0, -473.0f, 0.2f, -133.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 7, true); + Actor_Face_Actor(7, 0, true); + if (!Game_Flag_Query(167)) { + Actor_Says(0, 4200, 14); + Actor_Says(7, 570, 3); + Actor_Says(0, 4205, 18); + Game_Flag_Set(167); + return true; + } + if (Game_Flag_Query(167) && !Game_Flag_Query(168)) { + Actor_Says(0, 4210, 18); + Actor_Says(7, 580, 3); + Actor_Says(0, 4215, 14); + Actor_Says(7, 590, 3); + Actor_Says(7, 600, 3); + Actor_Says(0, 4220, 18); + Actor_Says(7, 610, 3); + Actor_Says(0, 4225, 19); + Actor_Says(7, 620, 3); + Actor_Says(0, 4230, 14); + Game_Flag_Set(168); + return true; + } + Actor_Says(0, 4200, 13); + } + if (actorId == 9 && !Loop_Actor_Walk_To_XYZ(0, -295.0f, 0.34f, -193.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 9, true); + Actor_Face_Actor(9, 0, true); + //TODO: cleanup + if (Game_Flag_Query(166) || (Actor_Says(0, 4415, 18) , Actor_Says(9, 1090, 3) , Actor_Says(0, 4420, 18) , Game_Flag_Set(166) , Game_Flag_Query(166) != 1) || Game_Flag_Query(55) != 1 || Game_Flag_Query(56)) { + if (!Game_Flag_Query(166) || Game_Flag_Query(55) || Game_Flag_Query(175)) { + Actor_Says(0, 4425, 18); + Actor_Says(9, 1160, 3); + return true; + } else { + Actor_Says(0, 4425, 18); + Actor_Says(9, 1100, 3); + Actor_Says(0, 4430, 19); + Actor_Says(9, 1110, 3); + Game_Flag_Set(175); + return true; + } + } else { + Actor_Face_Actor(11, 9, true); + Actor_Says(11, 420, 14); + Actor_Face_Actor(9, 11, true); + Actor_Says(9, 1120, 3); + Actor_Face_Actor(0, 11, true); + Actor_Says(0, 4435, 14); + Actor_Says(11, 430, 16); + Actor_Says(9, 1130, 3); + Game_Flag_Set(56); + return true; + } + } + return false; +} + +bool ScriptPS09::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS09::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -559.15f, 0.0f, -85.06f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(62, 66); + Game_Flag_Reset(211); + } + return true; + } + return false; +} + +bool ScriptPS09::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS09::SceneFrameAdvanced(int frame) { + if (frame == 1 || frame == 15 || frame == 20 || frame == 31 || frame == 33 || frame == 35 || frame == 52 || frame == 54) { + Sound_Play(97, Random_Query(50, 33), 10, 10, 50); + } + //return true; +} + +void ScriptPS09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS09::PlayerWalkedIn() { + if (Game_Flag_Query(465)) { + Player_Loses_Control(); + Delay(2000); + Actor_Retired_Here(0, 6, 6, 1, -1); + //return true; + return; + } + if (!Game_Flag_Query(211)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -491.15f, 0.0f, -73.06f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Set(211); + } + if (Game_Flag_Query(133) ) { + Game_Flag_Reset(133); + //return true; + return; + } + //return false; +} + +void ScriptPS09::PlayerWalkedOut() { +} + +void ScriptPS09::DialogueQueueFlushed(int a1) { +} + +void ScriptPS09::sub_402090() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 179) || Actor_Clue_Query(0, 180) || Actor_Clue_Query(0, 181) ) { + DM_Add_To_List_Never_Repeat_Once_Selected(170, 5, 5, 3); + DM_Add_To_List_Never_Repeat_Once_Selected(180, -1, 5, 5); + DM_Add_To_List_Never_Repeat_Once_Selected(200, -1, 3, 6); + } + if (Actor_Clue_Query(0, 99) && (Actor_Clue_Query(0, 179) || Actor_Clue_Query(0, 180) || Actor_Clue_Query(0, 181) )) { + DM_Add_To_List_Never_Repeat_Once_Selected(190, 5, 6, -1); + } + Dialogue_Menu_Add_To_List(210); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 170: + Actor_Says(0, 4270, 13); + Actor_Says(0, 4250, 18); + Actor_Says(11, 50, 13); + Actor_Says(0, 4275, 18); + Actor_Says(0, 4280, 19); + if (Game_Flag_Query(44) ) { + Actor_Says(11, 60, 14); + Actor_Says(0, 4285, 13); + Actor_Says(11, 70, 12); + Actor_Says(0, 4290, 13); + Actor_Says(11, 80, 13); + Actor_Says(11, 90, 13); + Actor_Says(0, 4295, 18); + Actor_Says(11, 110, 14); + Actor_Says(0, 4300, 17); + return; + } + if (!Game_Flag_Query(44)) { + Actor_Says(11, 130, 15); + Actor_Says(11, 140, 13); + Actor_Says(0, 4305, 13); + Actor_Says(11, 150, 14); + Actor_Says(11, 160, 12); + Actor_Says(0, 4310, 13); + Actor_Says(11, 170, 15); + Actor_Says(11, 180, 16); + Actor_Says(0, 4315, 18); + Actor_Says(11, 200, 13); + return; + } + break; + case 180: + Actor_Says(0, 4270, 18); + Actor_Says(0, 4255, 3); + Actor_Says(11, 210, 12); + Actor_Says(11, 220, 13); + Actor_Says(11, 230, 14); + Actor_Says(0, 4320, 14); + Actor_Says(11, 240, 16); + Actor_Says(11, 250, 15); + Actor_Says(0, 4330, 13); + Actor_Says(11, 260, 13); + Actor_Says(11, 270, 12); + Actor_Says(0, 4335, 18); + Actor_Says(11, 290, 15); + Actor_Says(0, 4340, 13); + Actor_Modify_Friendliness_To_Other(11, 0, -5); + if (Game_Flag_Query(165)) { + Actor_Says(11, 300, 12); + Actor_Face_Actor(9, 11, true); + Actor_Says(9, 1010, 3); + Actor_Face_Actor(11, 9, true); + Actor_Says(11, 310, 16); + Actor_Face_Actor(0, 9, true); + Actor_Says(0, 4345, 14); + Actor_Face_Actor(9, 0, true); + Actor_Says(9, 1020, 3); + Actor_Says(0, 4350, 18); + Actor_Says(9, 1030, 3); + Actor_Says(0, 4355, 19); + Actor_Says(9, 1040, 3); + Actor_Says(0, 4360, 16); + Actor_Says(0, 4365, 14); + Actor_Says(9, 1050, 3); + Actor_Says(9, 1060, 3); + Actor_Says(0, 4370, 14); + Actor_Says(9, 1070, 3); + Actor_Says(9, 1080, 3); + } + else { + Actor_Says(11, 320, 13); + Actor_Says(11, 340, 14); + Actor_Says(11, 350, 12); + Actor_Says(0, 4375, 18); + } + break; + case 190: + Actor_Says(0, 4270, 18); + Actor_Says(0, 4260, 3); + Actor_Says(11, 360, 16); + Actor_Says(0, 4380, 19); + Actor_Says(0, 4385, 19); + Actor_Says(11, 370, 13); + Actor_Says(0, 4390, 19); + Actor_Says(0, 4395, 18); + Actor_Says(11, 380, 14); + Actor_Says(11, 390, 12); + Actor_Modify_Friendliness_To_Other(11, 0, -5); + break; + case 200: + Actor_Says(0, 4265, 14); + Actor_Says(11, 400, 13); + Actor_Says(0, 4400, 13); + Actor_Says(11, 410, 16); + Actor_Says(0, 4405, 14); + Actor_Says(0, 4410, 15); + Voight_Kampff_Activate(11, 20); + Actor_Modify_Friendliness_To_Other(11, 0, -10); + break; + case 210: + Actor_Says(0, 8600, 18); + Actor_Says(11, 20, 15); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps10.cpp b/engines/bladerunner/script/ps10.cpp new file mode 100644 index 0000000000..0135bffade --- /dev/null +++ b/engines/bladerunner/script/ps10.cpp @@ -0,0 +1,248 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS10::InitializeScene() { + Police_Maze_Set_Pause_State(1); + if (Game_Flag_Query(15)) { + float x = World_Waypoint_Query_X(4); + float y = World_Waypoint_Query_Y(4); + float z = World_Waypoint_Query_Z(4); + Setup_Scene_Information(x, y, z, 280); + } else { + Setup_Scene_Information(-87.08f, -9.23f, 941.9f, 0); + } + Scene_Exit_Add_2D_Exit(1, 0, 0, 20, 479, 3); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(387, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Sound(1, 10, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(389, 5, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(390, 6, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); +} + +static int track_data_0[] = {-26, 10, 20, -18, 10, 20, -9, 0, -9, 1,-5, 989, -1, 0, -15, 0, 1, -15, 1, 1,-23, 0, -7, 3000, 5000, -8, 0, -10, 159, 100,-2, 14, -3, 1000, -6, 740, 80, -22, 0, -3,0, -6, 488, 80, -3, 1000, -24, 27, 33, -3, 0, -6, 740, 80, -11, 1, -9, 0, -8, 1, -12, 0, -1, 0, -4}; +static int track_data_1[] = {-5, 740, -1, 0, -22, 1, -2, 69, -3, 500, -9, 1, -11, 4, -12, 1, -1, 0, -4}; +static int track_data_2[] = {-26, 10, 20, -18, 10, 20, -9, 2, -5, 993, -1, 0, -7, 3000, 5000, -8, 2, -10, 159, 100, -15, 2, 1, -23, 2, -2, 5, -3, 1000, -22, 2, -6, 233, 80, -3, 0, -6, 491, 80, -3, 500, -24, 27, 33, -3, 500, -6, 233, 80, -3, 0, -6, 993, 80, -10, 34, 33, -2, 0, -9, 2, -4}; +static int track_data_3[] = {-26, 10, 20, -18, 10, 20, -9, 3, -5, 993, -1, 0, -7, 3000, 6000, -8, 3, -10, 159, 100, -15, 3, 1, -23, 3, -2, 34, -3, 500, -6, 491, 80, -2, 0, -25, -9, 3, -11, 7, -12, 3, -4}; +static int track_data_4[] = {-26, 10, 20, -18, 10, 20, -9, 4, -5, 0, -1, 0, -7, 4000, 6000, -8, 4, -10, 159, 100, -15, 4, 1, -23, 4, -2, 5, -3, 1000, -6, 512, 100, -3, 2000, -6, 0, -100, -10, 34, 33, -2, 0, -25, -9, 4, -11, 0, -12, 4, -4}; +static int track_data_5[] = {-26, 10, 20, -18, 10, 20, -9, 5, -5, 999, -1, 0, -7, 4000, 6000, -8, 5, -10, 159, 100, -15, 5, 1, -23, 5, -2, 7, -3, 500, -22, 5, -6, 750, 80, -3, 0, -6, 500, 80, -3, 1000, -24, 27, 33, -3, 0, -6, 750, 80, -3, 0, -6, 999, 80, -10, 34, 33, -2, 0, -9, 5, -11, 6, -11, 8, -12, 5, -4}; +static int track_data_6[] = {-26, 10, 20, -18, 10, 20, -9, 6, -5, 264, -1, 0, -7, 3000, 6000, -15, 6, 1, -23, 6, -8, 6, -2, 89, -7, 4000, 8000, -5, 776, -2, 0, -25, -9, 6, -12, 6, -4}; +static int track_data_7[] = {-26, 10, 20, -18, 10, 20, -9, 7, -5, 993, -1, 0, -7, 4000, 6000, -8, 7, -10, 159, 100, -15, 7, 1, -23, 7, -2, 34, -3, 500, -22, 7, -6, 491, 80, -2, 20, -3, 0, -24, 27, 33, -2, 0, -9, 7, -11, 3, -12, 7, -4}; +static int track_data_8[] = {-26, 10, 20, -18, 10, 20, -9, 8, -5, 738, -1, 0, -7, 2000, 5000, -15, 8, 1, -22, 8, -8, 8, -10, 0, 33, -2, 23, -10, 0, 33, -3, 200, -10, 32, 33, -6, 498, 100, -10, 0, 33, -3, 100, -24, 27, 33, -10, 32, 33, -2, 35, -10, 32, 33, -3, 100, -24, 27, 33, -10, 0, 33, -2, 23, -10, 32, 33, -3, 100, -24, 27, 33, -10, 32, 33, -6, 758, 100, -10, 32, 33, -2, 89, -10, 0, 33, -7, 4000, 6000, -15, 8, 1, -22, 8, -5, 216, -10, 32, 33, -2, 69, -3, 100, -10, 32, 33, -6, 498, 100, -3, 100, -24, 27, 33, -10, 0, 33, -6, 216, 100, -10, 32, 33, -2, 0, -9, 8, -12, 8, -4}; + +void ScriptPS10::SceneLoaded() { + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("PARKMETR03", true); + Obstacle_Object("PARKMETR07", true); + Obstacle_Object("PARKMETR08", true); + Obstacle_Object("PARKMETR10", true); + Obstacle_Object("PARKMETR11", true); + Obstacle_Object("PARKMETR15", true); + Obstacle_Object("PARKMETR16", true); + Obstacle_Object("TUBE14", true); + Unclickable_Object("PARKMETR01"); + Unclickable_Object("PARKMETR02"); + Unclickable_Object("PARKMETR03"); + Unclickable_Object("PARKMETR07"); + Unclickable_Object("PARKMETR08"); + Unclickable_Object("PARKMETR10"); + Unclickable_Object("PARKMETR11"); + Unclickable_Object("PARKMETR15"); + Unclickable_Object("PARKMETR16"); + Unobstacle_Object("E.SM.WIRE01", true); + if (!Query_System_Currently_Loading_Game()) { + Item_Add_To_World(0, 443, 14, -240.0f, -80.74f, 145.0f, 989, 72, 36, true, false, false, true); + Item_Add_To_World(1, 443, 14, -240.0f, -8.74f, 145.0f, 740, 72, 36, true, false, false, true); + Item_Add_To_World(2, 445, 14, -165.0f, 111.53f, -10.0f, 993, 72, 36, true, false, false, true); + Item_Add_To_World(3, 447, 14, -125.0f, 160.0f, -10.0f, 993, 72, 36, true, false, false, true); + Item_Add_To_World(4, 441, 14, -246.71f, 205.51f, -20.0f, 0, 72, 36, true, false, false, true); + Item_Add_To_World(5, 445, 14, -27.69f, -86.92f, 434.0f, 999, 72, 36, true, false, false, true); + Item_Add_To_World(6, 441, 14, -347.15f, 7.68f, -20.0f, 264, 72, 36, true, false, false, true); + Item_Add_To_World(7, 449, 14, -51.0f, 160.0f, -10.0f, 993, 72, 36, true, false, false, true); + Item_Add_To_World(8, 445, 14, 39.0f, 9.16f, -20.0f, 738, 72, 36, true, false, false, true); + } + + Police_Maze_Target_Track_Add(0, -240.0f, -80.74f, 145.0f, -240.0f, -8.74f, 145.0f, 15, track_data_0, false); + Police_Maze_Target_Track_Add(1, -240.0f, -8.74f, 145.0f, -450.0f, -8.74f, 145.0f, 70, track_data_1, false); + Police_Maze_Target_Track_Add(2, -165.0f, 111.53f, -10.0f, -165.0f, 167.53f, -10.0f, 6, track_data_2, true); + Police_Maze_Target_Track_Add(3, -125.0f, 160.0f, -10.0f, -51.0f, 160.0f, -10.0f, 35, track_data_3, false); + Police_Maze_Target_Track_Add(4, -246.71f, 205.51f, -20.0f, -246.71f, 241.51f, -20.0f, 6, track_data_4, true); + Police_Maze_Target_Track_Add(5, -27.69f, -86.92f, 434.0f, -27.69f, -18.92f, 434.0f, 8, track_data_5, true); + Police_Maze_Target_Track_Add(6, -347.15f, 7.68f, -20.0f, 39.0f, 9.16f, -20.0f, 90, track_data_6, false); + Police_Maze_Target_Track_Add(7, -51.0f, 160.0f, -10.0f, -125.0f, 160.0f, -10.0f, 35, track_data_7, true); + Police_Maze_Target_Track_Add(8, 39.0f, 9.16f, -20.0f, -347.15f, 7.68f, -20.0f, 90, track_data_8, false); + Preload(441); + Preload(442); + Preload(443); + Preload(444); + Preload(445); + Preload(446); + Preload(447); + Preload(448); + Preload(449); + Preload(450); +} + +bool ScriptPS10::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS10::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS10::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS10::ClickedOnItem(int itemId, bool a2) { + if (Player_Query_Combat_Mode()) { + switch (itemId) { + case 3: + Sound_Play(4, 50, 0, 0, 50); + break; + case 4: + Sound_Play(555, 50, 0, 0, 50); + break; + case 6: + Sound_Play(555, 50, 0, 0, 50); + break; + default: + Sound_Play(2, 12, 0, 0, 50); + break; + } + Item_Spin_In_World(itemId); + if (itemId == 0) { + Item_Flag_As_Non_Target(0); + Item_Flag_As_Non_Target(1); + } + if (itemId == 1) { + Item_Flag_As_Non_Target(0); + Item_Flag_As_Non_Target(1); + } + if (itemId == 2) { + Item_Flag_As_Non_Target(2); + } + if (itemId == 3) { + Item_Flag_As_Non_Target(3); + } + if (itemId == 4) { + Item_Flag_As_Non_Target(4); + } + if (itemId == 5) { + Item_Flag_As_Non_Target(5); + } + if (itemId == 6) { + Item_Flag_As_Non_Target(6); + } + if (itemId == 7) { + Item_Flag_As_Non_Target(7); + } + if (itemId == 8) { + Item_Flag_As_Non_Target(8); + } else { + Item_Flag_As_Non_Target(itemId); + } + return true; + } + + return false; +} + +bool ScriptPS10::ClickedOnExit(int exitId) { + if (exitId == 1) { + if (!Loop_Actor_Walk_To_Waypoint(0, 6, 12, 1, false)) { + Game_Flag_Set(14); + sub_402238(); + Global_Variable_Decrement(9, 20 - Global_Variable_Query(10)); + Global_Variable_Set(10, 20); + Set_Enter(14, 74); + } + return true; + } + + return false; +} + +bool ScriptPS10::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS10::SceneFrameAdvanced(int frame) { +} + +void ScriptPS10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS10::PlayerWalkedIn() { + if (Game_Flag_Query(15)) { + Loop_Actor_Walk_To_XYZ(0, -352.09f, -9.23f, 267.95f, 0, 0, true, 0); + Police_Maze_Set_Pause_State(0); + Game_Flag_Reset(15); + //return true; + return; + } else { + Player_Set_Combat_Mode(true); + Loop_Actor_Walk_To_Waypoint(0, 5, 0, 0, true); + Actor_Says(39, 280, 3); + Actor_Says(39, 290, 3); + Actor_Says(39, 300, 3); + Police_Maze_Set_Pause_State(0); + //return true; + return; + } +} + +void ScriptPS10::PlayerWalkedOut() { +} + +void ScriptPS10::DialogueQueueFlushed(int a1) { +} + +void ScriptPS10::sub_402238() { + Item_Remove_From_World(0); + Item_Remove_From_World(1); + Item_Remove_From_World(2); + Item_Remove_From_World(3); + Item_Remove_From_World(4); + Item_Remove_From_World(5); + Item_Remove_From_World(6); + Item_Remove_From_World(7); + Item_Remove_From_World(8); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps11.cpp b/engines/bladerunner/script/ps11.cpp new file mode 100644 index 0000000000..d979619480 --- /dev/null +++ b/engines/bladerunner/script/ps11.cpp @@ -0,0 +1,285 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS11::InitializeScene() { + if (Game_Flag_Query(14)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(14); + Setup_Scene_Information(World_Waypoint_Query_X(6), World_Waypoint_Query_Y(6), World_Waypoint_Query_Z(6), 840); + } else { + Scene_Loop_Set_Default(1); + Setup_Scene_Information(World_Waypoint_Query_X(7), World_Waypoint_Query_Y(7), World_Waypoint_Query_Z(7), 132); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 0, 0, 20, 479, 3); +} + +static int track_data_9[] = {-26, 11, 20, -18, 11, 20, -9, 9, -5, 50, -1, 0, -7, 5000, 5000, -8, 9, -10, 31, 33, -15, 9, 1, -22, 9, -2, 7, -3, 1000, -24, 27, 33, -10, 34, 33, -2, 0, -3, 500, -9, 9, -13, 15, 10, -12, 9, -4}; +static int track_data_10[] = {-26, 11, 20, -18, 11, 20, -9, 10, -9, 11, -15, 10, 1, -15, 11, 1, -5, 860, -1, 0, -7, 3000, 6000, -23, 10, -8, 10, -10, 33, 33, -2, 14, -3, 500, -11, 11, -9, 10, -8, 11, -12, 10, -1, 0, -4}; +static int track_data_11[] = {-5, 860, -1, 0, -23, 11, -8, 11, -2, 25, -3, 500, -22, 11, -10, 32, 33, -6, 644, 80, -3, 0, -6, 388, 80, -3, 1000, -24, 12, 33, -2, 79, -9, 11, -13, 15, 9, -12, 11, -1, 0, -5, 860, -4}; +static int track_data_12[] = {-26, 11, 20, -18, 11, 20, -9, 12, -5, 725, -1, 0, -3, 2000, -15, 12, 1, -23, 12, -8, 12, -2, 82, -25, -3, 1000, -6, 570, 80, -3, 0, -6, 462, 80, -3, 0, -6, 213, 80, -3, 1000, -2, 0, -6, 725, 80, -2, 99, -9, 12, -11, 27, -12, 12, -1, 0, -4}; +static int track_data_13[] = {-26, 11, 20, -18, 11, 20, -9, 13, -5, 340, -1, 0, -7, 4000, 8000, -8, 13, -10, 33, 33, -15, 13, 1, -22, 13, -2, 4, -3, 0, -6, 435, 80, -3, 0, -6, 530, 80, -3, 100, -6, 435, 80, -3, 0, -6, 340, 80, -3, 0, -6, 260, 80, -3, 0, -6, 180, 80, -3, 100, -6, 260, 80, -3, 0, -6, 340, 80, -3, 200, -24, 27, 33, -10, 34, 33, -2, 0, -9, 13, -13, 14, 18, -12, 13, -4}; +static int track_data_14[] = {-26, 11, 20, -18, 11, 20, -9, 14, -15, 14, 1, -23, 14, -5, 900, -1, 0, -7, 3000, 6000, -8, 14, -10, 33, 33, -2, 5, -3, 500, -22, 14, -6, 644, 80, -3, 0, -6, 388, 80, -3, 1000, -24, 27, 33, -10, 34, 33, -2, 0, -9, 14, -13, 18, 13, -12, 14, -4}; +static int track_data_15[] = {-26, 11, 20, -18, 11, 20, -9, 15, -9, 16, -15, 15, 1, -15, 16, 1, -5, 860, -1, 0, -7, 3000, 7000, -8, 15, -10, 29, 33, -23, 15, -2, 14, -25, -3, 1000, -11, 16, -9, 15, -8, 16, -12, 15, -1, 0, -4}; +static int track_data_16[] = {-5, 860, -1, 0, -8, 16, -23, 16, -2, 25, -3, 500, -10, 32, 33, -6, 644, 100, -3, 0, -6, 388, 200, -3, 500, -2, 79, -25, -9, 16, -13, 10, 9, -12, 16, -1, 0, -5, 860, -4}; +static int track_data_17[] = {-26, 11, 20, -18, 11, 20, -5, 310, -1, 0, -8, 17, -15, 17, 1, -22, 17, -7, 4000, 8000, -10, 32, 33, -2, 10, -3, 0, -24, 27, 33, -2, 0, -15, 17, 1, -22, 17, -2, 24, -15, 17, 1, -22, 17, -2, 10, -3, 0, -24, 27, 33, -2, 24, -3, 1000, -9, 17, -13, 23, 22, -12, 17, -1, 0, -4}; +static int track_data_18[] = {-26, 11, 20, -18, 11, 20, -9, 18, -9, 19, -5, 900, -1, 0, -15, 18, 1, -15, 19, 1, -23, 18, -7, 4000, 6000, -8, 18, -2, 5, -10, 19, 33, -10, 3, 33, -3, 1000, -25, -6, 700, 80, -22, 18, -3, 0, -6, 512, 200, -3, 1000, -24, 12, 33, -11, 19, -9, 18, -8, 19, -12, 18, -1, 0, -4}; +static int track_data_19[] = {-5, 512, -1, 0, -22, 19, -2, 8, -3, 4000, -15, 19, 1, -22, 19, -2, 2, -10, 32, 33, -3, 1000, -24, 12, 33, -2, 19, -3, 500, -9, 19, -13, 13, 14, -12, 19, -1, 0, -4}; +static int track_data_20[] = {-26, 11, 20, -18, 11, 20, -9, 20, -5, 280, -1, 0, -7, 5000, 7000, -15, 20, 1, -22, 20, -8, 20, -2, 9, -10, 32, 33, -3, 1000, -24, 27, 33, -2, 0, -9, 20, -13, 21, 12, -12, 20, -1, 0, -4}; +static int track_data_21[] = {-26, 11, 20, -18, 11, 20, -9, 21, -5, 280, -1, 0, -7, 5000, 8000, -15, 21, 1, -23, 21, -8, 21, -2, 5, -25, -3, 1000, -2, 0, -9, 21, -13, 20, 12, -12, 21, -1, 0, -4}; +static int track_data_22[] = {-26, 11, 20, -18, 11, 20, -9, 22, -5, 255, -1, 0, -15, 22, 1, -22, 22, -7, 5000, 5000, -8, 22, -2, 7, -10, 32, 33, -3, 1000, -24, 12, 33, -2, 0, -9, 22, -13, 23, 17, -12, 22, -1, 0, -4}; +static int track_data_23[] = {-26, 11, 20, -18, 11, 20, -9, 23, -5, 310, -1, 0, -7, 3000, 6000, -15, 23, 1, -23, 23, -8, 23, -3, 1000, -2, 24, -3, 1000, -2, 0, -25, -9, 23, -13, 22, 17, -12, 23, -1, 0, -4}; +static int track_data_27[] = {-26, 11, 20, -18, 11, 20, -9, 27, -5, 346, -1, 0, -3, 0, -15, 27, 1, -22, 27, -8, 27, -2, 14, -3, 1000, -24, 12, 33, -2, 0, -9, 27, -13, 21, 20, -12, 27, -1, 0, -4}; + +void ScriptPS11::SceneLoaded() { + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("PARKMETR03", true); + Obstacle_Object("PARKMETR07", true); + Obstacle_Object("PARKMETR08", true); + Obstacle_Object("PARKMETR10", true); + Obstacle_Object("PARKMETR11", true); + Obstacle_Object("PARKMETR15", true); + Obstacle_Object("PARKMETR16", true); + Unclickable_Object("PARKMETR01"); + Unclickable_Object("PARKMETR02"); + Unclickable_Object("PARKMETR03"); + Unclickable_Object("PARKMETR07"); + Unclickable_Object("PARKMETR08"); + Unclickable_Object("PARKMETR10"); + Unclickable_Object("PARKMETR11"); + Unclickable_Object("PARKMETR15"); + Unclickable_Object("PARKMETR16"); + if (!Query_System_Currently_Loading_Game()) { + Item_Add_To_World(9, 449, 14, -450.0f, -7.5f, 335.0f, 50, 72, 36, true, false, false, true); + Item_Add_To_World(10, 449, 14, -740.0f, 27.0f, -30.0f, 860, 72, 36, true, false, false, true); + Item_Add_To_World(11, 449, 14, -740.0f, 99.0f, -30.0f, 860, 72, 36, true, false, false, true); + Item_Add_To_World(12, 441, 14, -400.0f, -9.23f, -75.0f, 725, 72, 36, true, false, false, true); + Item_Add_To_World(13, 443, 14, -803.72f, -72.7f, 60.22f, 340, 72, 36, true, false, false, true); + Item_Add_To_World(14, 443, 14, -853.0f, -70.0f, 195.0f, 900, 72, 36, true, false, false, true); + Item_Add_To_World(15, 447, 14, -740.0f, 27.0f, -30.0f, 860, 72, 36, true, false, false, true); + Item_Add_To_World(16, 447, 14, -740.0f, 99.0f, -30.0f, 860, 72, 36, true, false, false, true); + Item_Add_To_World(17, 445, 14, -888.0f, 155.0f, 100.0f, 310, 72, 36, true, false, false, true); + Item_Add_To_World(18, 443, 14, -430.0f, 164.0f, 11.0f, 900, 72, 36, true, false, false, true); + Item_Add_To_World(19, 443, 14, -430.0f, -0.86f, 11.0f, 512, 72, 36, true, false, false, true); + Item_Add_To_World(20, 443, 14, -891.0f, 3.1f, 90.0f, 280, 72, 36, true, false, false, true); + Item_Add_To_World(21, 447, 14, -891.0f, 3.1f, 90.0f, 280, 72, 36, true, false, false, true); + Item_Add_To_World(22, 445, 14, -891.0f, 171.0f, 190.0f, 255, 72, 36, true, false, false, true); + Item_Add_To_World(23, 441, 14, -888.0f, 155.0f, 30.0f, 310, 72, 36, true, false, false, true); + Item_Add_To_World(27, 445, 14, -800.0f, -9.23f, -75.0f, 346, 72, 36, true, false, false, true); + } + + Police_Maze_Target_Track_Add(9, -450.0f, -7.5f, 335.0f, -450.0f, -7.5f, 295.0f, 8, track_data_9, true); + Police_Maze_Target_Track_Add(10, -740.0f, 27.0f, -30.0f, -740.0f, 99.0f, -30.0f, 15, track_data_10, false); + Police_Maze_Target_Track_Add(11, -740.0f, 99.0f, -30.0f, -200.0f, 99.0f, -30.0f, 80, track_data_11, false); + Police_Maze_Target_Track_Add(12, -400.0f, -9.23f, -75.0f, -800.0f, -9.23f, -75.0f, 100, track_data_12, false); + Police_Maze_Target_Track_Add(13, -803.72f, -72.7f, 60.22f, -803.72f, -0.7f, 60.22f, 6, track_data_13, true); + Police_Maze_Target_Track_Add(14, -853.0f, -70.0f, 195.0f, -853.0f, 2.0f, 195.0f, 6, track_data_14, false); + Police_Maze_Target_Track_Add(15, -740.0f, 27.0f, -30.0f, -740.0f, 99.0f, -30.0f, 15, track_data_15, false); + Police_Maze_Target_Track_Add(16, -740.0f, 99.0f, -30.0f, -200.0f, 99.0f, -30.0f, 80, track_data_16, false); + Police_Maze_Target_Track_Add(17, -888.0f, 155.0f, 100.0f, -888.0f, 155.0f, 30.0f, 25, track_data_17, false); + Police_Maze_Target_Track_Add(18, -430.0f, 164.0f, 11.0f, -430.0f, -0.86f, 11.0f, 6, track_data_18, false); + Police_Maze_Target_Track_Add(19, -430.0f, -0.86f, 11.0f, -300.0f, -0.86f, -80.0f, 20, track_data_19, false); + Police_Maze_Target_Track_Add(20, -891.0f, 3.1f, 90.0f, -891.0f, 3.1f, 105.0f, 10, track_data_20, true); + Police_Maze_Target_Track_Add(21, -891.0f, 3.1f, 90.0f, -891.0f, 3.1f, 105.0f, 6, track_data_21, false); + Police_Maze_Target_Track_Add(22, -891.0f, 171.0f, 190.0f, -891.0f, 171.0f, 147.0f, 8, track_data_22, false); + Police_Maze_Target_Track_Add(23, -888.0f, 155.0f, 30.0f, -888.0f, 155.0f, 100.0f, 25, track_data_23, true); + Police_Maze_Target_Track_Add(27, -800.0f, -9.23f, -75.0f, -740.0f, -9.23f, -75.0f, 15, track_data_27, false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(387, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Sound(1, 10, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(389, 5, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(390, 6, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); +} + +bool ScriptPS11::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS11::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS11::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS11::ClickedOnItem(int itemId, bool a2) { + if (Player_Query_Combat_Mode()) { + switch (itemId) { + case 15: + Sound_Play(4, 50, 0, 0, 50); + break; + case 16: + Sound_Play(4, 50, 0, 0, 50); + break; + case 21: + Sound_Play(4, 50, 0, 0, 50); + break; + case 23: + Sound_Play(555, 50, 0, 0, 50); + break; + case 12: + Sound_Play(555, 50, 0, 0, 50); + break; + default: + Sound_Play(2, 12, 0, 0, 50); + break; + } + Item_Spin_In_World(itemId); + if (itemId == 9) { + Item_Flag_As_Non_Target(9); + } + if (itemId == 10) { + Item_Flag_As_Non_Target(10); + Item_Flag_As_Non_Target(11); + } + if (itemId == 11) { + Item_Flag_As_Non_Target(10); + Item_Flag_As_Non_Target(11); + } + if (itemId == 12) { + Item_Flag_As_Non_Target(12); + } + if (itemId == 13) { + Item_Flag_As_Non_Target(13); + } + if (itemId == 14) { + Item_Flag_As_Non_Target(14); + } + if (itemId == 15) { + Item_Flag_As_Non_Target(15); + Item_Flag_As_Non_Target(16); + } + if (itemId == 16) { + Item_Flag_As_Non_Target(15); + Item_Flag_As_Non_Target(16); + } + if (itemId == 17) { + Item_Flag_As_Non_Target(17); + } + if (itemId == 18) { + Item_Flag_As_Non_Target(18); + Item_Flag_As_Non_Target(19); + } + if (itemId == 19) { + Item_Flag_As_Non_Target(18); + Item_Flag_As_Non_Target(19); + } + if (itemId == 20) { + Item_Flag_As_Non_Target(20); + } + if (itemId == 21) { + Item_Flag_As_Non_Target(21); + } + if (itemId == 22) { + Item_Flag_As_Non_Target(22); + } + if (itemId == 23) { + Item_Flag_As_Non_Target(23); + } + if (itemId == 27) { + Item_Flag_As_Non_Target(27); + } + return true; + } + return false; +} + +bool ScriptPS11::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_Waypoint(0, 6, 12, 1, false)) { + Game_Flag_Set(15); + sub_402744(); + Set_Enter(14, 73); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_Waypoint(0, 8, 12, 1, false)) { + Game_Flag_Set(16); + sub_402744(); + Global_Variable_Decrement(9, 20 - Global_Variable_Query(11)); + Global_Variable_Set(11, 20); + Set_Enter(14, 75); + } + return true; + } + return false; +} + +bool ScriptPS11::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS11::SceneFrameAdvanced(int frame) { +} + +void ScriptPS11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS11::PlayerWalkedIn() { + Police_Maze_Set_Pause_State(0); +} + +void ScriptPS11::PlayerWalkedOut() { +} + +void ScriptPS11::DialogueQueueFlushed(int a1) { +} + +void ScriptPS11::sub_402744() { + Item_Remove_From_World(9); + Item_Remove_From_World(10); + Item_Remove_From_World(11); + Item_Remove_From_World(12); + Item_Remove_From_World(13); + Item_Remove_From_World(14); + Item_Remove_From_World(15); + Item_Remove_From_World(16); + Item_Remove_From_World(17); + Item_Remove_From_World(18); + Item_Remove_From_World(19); + Item_Remove_From_World(20); + Item_Remove_From_World(21); + Item_Remove_From_World(22); + Item_Remove_From_World(23); + Item_Remove_From_World(27); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps12.cpp b/engines/bladerunner/script/ps12.cpp new file mode 100644 index 0000000000..b99eafd2fc --- /dev/null +++ b/engines/bladerunner/script/ps12.cpp @@ -0,0 +1,302 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS12::InitializeScene() { + Police_Maze_Set_Pause_State(1); + if (Game_Flag_Query(16)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Setup_Scene_Information(World_Waypoint_Query_X(8), World_Waypoint_Query_Y(8), World_Waypoint_Query_Z(8), 512); + } else { + Scene_Loop_Set_Default(1); + Setup_Scene_Information(World_Waypoint_Query_X(9), World_Waypoint_Query_Y(9), World_Waypoint_Query_Z(9), 0); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 0, 5, 110, 196, 3); +} + +static int track_data_29[] = {-26, 12, 20, -18, 12, 20, -9, 29, -5, 200, -1, 0, -7, 4000, 10000, -8, 29, -10, 33, 33, -15, 29, 1, -22, 29, -2, 5, -3, 500, -24, 27, 33, -10, 34, 33, -2, 0, -9, 29, -13, 44, 42, -12, 29, -4}; +static int track_data_30[] = {-26, 12, 20, -18, 12, 20, -9, 30, -5, 67, -1, 0, -7, 3000, 9000, -8, 30, -10, 33, 33, -15, 30, 1, -22, 30, -2, 5, -3, 500, -24, 27, 33, -10, 34, 33, -2, 0, -9, 30, -13, 41, 39, -12, 30, -15, 30, 0, -4}; +static int track_data_31[] = {-26, 12, 20, -18, 12, 20, -15, 31, 1, -23, 31, -9, 31, -5, 480, -1, 0, -7, 3000, 10000, -8, 31, -2, 5, -10, 29, 33, -3, 1000, -6, 968, 100, -10, 29, 33, -3, 500, -2, 0, -10, 29, 33, -25, -9, 31, -14, 40, 32, 33, -12, 31, -4}; +static int track_data_32[] = {-26, 12, 20, -18, 12, 20, -9, 32, -5, 1010, -1, 0, -7, 3000, 10000, -8, 32, -10, 33, 33, -15, 32, 1, -22, 32, -2, 5, -3, 500, -24, 27, 33, -6, 498, 80, -10, 29, 33, -3, 500, -2, 0, -9, 32, -14, 33, 31, 40, -12, 32, -4}; +static int track_data_33[] = {-26, 12, 20, -18, 12, 20, -9, 33, -5, 540, -1, 0, -7, 4000, 10000, -8, 33, -15, 33, 1, -23, 33, -2, 5, -10, 29, 33, -3, 1000, -6, 284, 80, -3, 0, -6, 28, 80, -10, 29, 33, -3, 1000, -2, 0, -25, -9, 33, -14, 40, 31, 32, -12, 33, -4}; +static int track_data_34[] = {-26, 12, 20, -18, 12, 20, -9, 34, -9, 35, -9, 36, -5, 469, -1, 0, -15, 34, 1, -15, 35, 1, -15, 36, 1, -7, 3000, 10000, -8, 34, -22, 34, -22, 35, -22, 36, -2, 5, -10, 29, 33, -3, 1000, -6, 376, 80, -3, 0, -6, 168, 80, -10, 29, 33, -2, 9, -6, 33, 80, -3, 0, -6, 15, 80, -10, 29, 33, -3, 500, -24, 27, 33, -2, 5, -10, 29, 33, -6, 168, 80, -3, 0, -6, 376, 80, -3, 0, -6, 469, 80, -10, 29, 33, -3, 500, -15, 34, 1, -15, 35, 1, -15, 36, 1, -22, 34, -22, 35, -22, 36, -6, 376, 80, -3, 0, -6, 168, 80, -2, 9, -6, 33, 80, -3, 0, -6, 15, 80, -10, 29, 33, -3, 500, -24, 27, 33, -2, 5, -10, 29, 33, -3, 0, -6, 469, 80, -3, 500, -6, 198, 80, -10, 29, 33, -3, 0, -2, 19, -10, 29,33, -3, 0, -9, 34, -11, 35, -12, 34, -1, 0, -4}; +static int track_data_35[] = {-8, 35, -5, 198, -1, 0, -6, 469, 80, -2, 9, -3, 0, -9, 35, -11, 36, -12, 35, -5, 198, -8, 35, -1, 0, -4}; +static int track_data_36[] = {-8, 36, -5, 469, -1, 0, -8, 36, -2, 9, -10, 29, 33, -3, 1000, -9, 34, -9, 35, -9, 36, -11, 37, -12, 36, -5, 469, -8, 36, -1, 0, -4}; +static int track_data_37[] = {-26, 12, 20, -18, 12, 20, -9, 37, -7, 3000, 6000, -11, 38, -5, 1010, -1, 0, -3, 2000, -8, 37, -10, 33, 33, -15, 37, 1, -23, 37, -2, 9, -3, 3000, -10, 34, 33, -2, 0, -25, -9, 37, -12, 37, -1, 0, -4}; +static int track_data_38[] = {-9, 38, -5, 990, -1, 0, -3, 3000, -8, 38, -10, 33, 33, -15, 38, 1, -22, 38, -2, 9, -3, 1000, -24, 12, 33, -10, 34, 33, -2, 0, -9, 38, -11, 34, -12, 38, -1, 0, -4}; +static int track_data_39[] = {-26, 12, 20, -18, 12, 20, -9, 39, -5, 513, -1, 0, -7, 5000, 5000, -8, 39, -10, 33, 33, -15, 39, 1, -2, 5, -3, 1000, -22, 39, -6, 1010, 80, -10, 29, 33, -3, 500, -24, 27, 33, -10, 34, 33, -2, 0, -9, 39, -13, 41, 30, -12, 39, -4}; +static int track_data_40[] = {-26, 12, 20, -18, 12, 20, -9, 40, -5, 480, -1, 0, -7, 4000, 8000, -8, 40, -10, 29, 33, -15, 40, 1, -2, 5, -10, 29, 33, -3, 500, -22, 40, -6, 968, 80, -10, 29, 33, -3, 1000, -24, 27, 33, -2, 0, -9, 40, -14, 31, 32, 33, -12, 40, -4}; +static int track_data_41[] = {-26, 12, 20, -18, 12, 20, -9, 41, -5, 513, -1, 0, -7, 4000, 6000, -8, 41, -10, 33, 33, -15, 41, 1, -23, 41, -2, 5, -3, 500, -6, 1010, 80, -10, 29, 33, -3, 1000, -2, 0, -10, 34, 33, -25, -9, 41, -13, 39, 30, -12, 41, -4}; +static int track_data_42[] = {-9, 42, -5, 109, -1, 0, -7, 2000, 5000, -8, 42, -10, 29, 33, -15, 42, 1, -22, 42, -2, 5, -10, 29, 33, -3, 1000, -24, 27, 33, -2, 0, -9, 42, -13, 44, 29, -12, 42, -4}; +static int track_data_43[] = {-26, 12, 20, -18, 12, 20, -9, 43, -5, 540, -1, 0, -7, 5000, 7000, -8, 43, -10, 33, 33, -15, 43, 1, -23, 43, -2, 9, -3, 2000, -6, 284, 80, -3, 0, -6, 28, 80, -10, 29, 33, -3, 2000, -10, 34, 33, -2, 0, -25, -9, 43, -11, 45, -12, 43, -4}; +static int track_data_44[] = {-26, 12, 20, -18, 12, 20, -9, 44, -5, 109, -1, 0, -7, 5000, 5000, -8, 44, -10, 29, 33, -15, 44, 1, -23, 44, -2, 5, -7, 2000, 2000, -10, 29, 33, -2, 0, -25, -9, 44, -13, 42, 29, -12, 44, -4}; +static int track_data_45[] = {-26, 12, 20, -18, 12, 20, -9, 45, -5, 540, -1, 0, -7, 3000, 10000, -8, 45, -10, 33, 33, -15, 45, 1, -2, 9, -3, 1000, -22, 45, -6, 284, 80, -3, 0, -6, 28, 80, -3, 1000, -24, 27, 33, -10, 34, 33, -2, 0, -9, 45, -11, 43, -12, 45, -4}; + +void ScriptPS12::SceneLoaded() { + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("PARKMETR03", true); + Obstacle_Object("PARKMETR07", true); + Obstacle_Object("PARKMETR08", true); + Obstacle_Object("PARKMETR10", true); + Obstacle_Object("PARKMETR11", true); + Obstacle_Object("PARKMETR15", true); + Obstacle_Object("PARKMETR16", true); + Unclickable_Object("PARKMETR01"); + Unclickable_Object("PARKMETR02"); + Unclickable_Object("PARKMETR03"); + Unclickable_Object("PARKMETR07"); + Unclickable_Object("PARKMETR08"); + Unclickable_Object("PARKMETR10"); + Unclickable_Object("PARKMETR11"); + Unclickable_Object("PARKMETR15"); + Unclickable_Object("PARKMETR16"); + if (!Query_System_Currently_Loading_Game()) { + Item_Add_To_World(29, 449, 14, -691.8f, -9.06f, 587.67f, 200, 72, 36, true, false, false, true); + Item_Add_To_World(30, 445, 14, -679.6f, -45.4f, 721.05f, 67, 72, 36, true, false, false, true); + Item_Add_To_World(31, 447, 14, -414.04f, -8.98f, 711.91f, 480, 72, 36, true, false, false, true); + Item_Add_To_World(32, 443, 14, -440.0f, -8.97f, 1137.0f, 1010, 72, 36, true, false, false, true); + Item_Add_To_World(33, 441, 14, -764.92f, -0.84f, 950.22f, 540, 72, 36, true, false, false, true); + Item_Add_To_World(34, 449, 14, -696.0f, -5.7f, 1185.0f, 469, 72, 36, true, false, false, true); + Item_Add_To_World(35, 449, 14, -635.0f, -5.7f, 1165.0f, 198, 72, 36, true, false, false, true); + Item_Add_To_World(36, 449, 14, -620.0f, -8.63f, 1366.0f, 469, 72, 36, true, false, false, true); + Item_Add_To_World(37, 447, 14, -584.0f, -79.4f, 775.0f, 1010, 72, 36, true, false, false, true); + Item_Add_To_World(38, 445, 14, -578.0f, -79.4f, 810.0f, 990, 72, 36, true, false, false, true); + Item_Add_To_World(39, 443, 14, -400.0f, -12.0f, 1110.0f, 513, 72, 36, true, false, false, true); + Item_Add_To_World(40, 449, 14, -414.04f, -8.98f, 711.91f, 480, 72, 36, true, false, false, true); + Item_Add_To_World(41, 447, 14, -400.0f, -12.0f, 1110.0f, 513, 72, 36, true, false, false, true); + Item_Add_To_World(42, 449, 14, -731.0f, 93.66f, 788.0f, 109, 72, 36, true, false, false, true); + Item_Add_To_World(43, 441, 14, -580.0f, -80.0f, 925.0f, 540, 72, 36, true, false, false, true); + Item_Add_To_World(44, 441, 14, -731.0f, 93.66f, 788.0f, 109, 72, 36, true, false, false, true); + Item_Add_To_World(45, 443, 14, -580.0f, -80.0f, 925.0f, 540, 72, 36, true, false, false, true); + } + Police_Maze_Target_Track_Add(29, -691.8f, -9.06f, 587.67f, -649.11f, -9.06f, 587.71f, 6, track_data_29, true); + Police_Maze_Target_Track_Add(30, -679.6f, -45.4f, 721.05f, -679.6f, -1.4f, 721.05f, 6, track_data_30, true); + Police_Maze_Target_Track_Add(31, -414.04f, -8.98f, 711.917f, -459.54f, -8.99f, 707.81f, 6, track_data_31, false); + Police_Maze_Target_Track_Add(32, -440.0f, -8.97f, 1137.0f, -430.0f, -8.97f, 921.0f, 6, track_data_32, false); + Police_Maze_Target_Track_Add(33, -764.92f, -0.84f, 950.21997f, -722.92f, -0.84f, 950.22f, 6, track_data_33, false); + Police_Maze_Target_Track_Add(34, -696.0f, -5.7f, 1185.0f, -635.0f, -5.7f, 1185.0f, 20, track_data_34, false); + Police_Maze_Target_Track_Add(35, -635.0f, -5.7f, 1165.0f, -620.0f, -8.63f, 1366.0f, 10, track_data_35, false); + Police_Maze_Target_Track_Add(36, -620.0f, -8.63f, 1366.0f, -595.0f, -8.63f, 1366.0f, 10, track_data_36, false); + Police_Maze_Target_Track_Add(37, -584.0f, -79.4f, 775.0f, -584.0f, -27.4f, 775.0f, 10, track_data_37, true); + Police_Maze_Target_Track_Add(38, -578.0f, -79.4f, 810.0f, -578.0f, -27.4f, 810.0f, 10, track_data_38, false); + Police_Maze_Target_Track_Add(39, -400.0f, -12.0f, 1110.0f, -400.0f, 60.0f, 1110.0f, 6, track_data_39, false); + Police_Maze_Target_Track_Add(40, -414.04f, -8.98f, 711.91f, -459.54f, -8.99f, 707.81f, 6, track_data_40, true); + Police_Maze_Target_Track_Add(41, -400.0f, -12.0f, 1110.0f, -400.0f, 60.0f, 1110.0f, 6, track_data_41, false); + Police_Maze_Target_Track_Add(42, -731.0f, 93.66f, 788.0f, -702.0f, 93.66f, 788.0f, 6, track_data_42, false); + Police_Maze_Target_Track_Add(43, -580.0f, -80.0f, 925.0f, -580.0f, -8.0f, 925.0f, 10, track_data_43, true); + Police_Maze_Target_Track_Add(44, -731.0f, 93.66f, 788.0f, -702.0f, 93.66f, 788.0f, 6, track_data_44, false); + Police_Maze_Target_Track_Add(45, -580.0f, -80.0f, 925.0f, -580.0f, -8.0f, 925.0f, 10, track_data_45, false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(387, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Sound(1, 10, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(389, 5, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(390, 6, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); +} + +bool ScriptPS12::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS12::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS12::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS12::ClickedOnItem(int itemId, bool a2) { + if (Player_Query_Combat_Mode()) { + switch (itemId) { + case 31: + Sound_Play(4, 50, 0, 0, 50); + break; + case 37: + Sound_Play(4, 50, 0, 0, 50); + break; + case 41: + Sound_Play(4, 50, 0, 0, 50); + break; + case 33: + Sound_Play(555, 50, 0, 0, 50); + break; + case 43: + Sound_Play(555, 50, 0, 0, 50); + break; + case 44: + Sound_Play(555, 50, 0, 0, 50); + break; + default: + Sound_Play(2, 12, 0, 0, 50); + break; + } + Item_Spin_In_World(itemId); + Item_Flag_As_Non_Target(itemId); + if (itemId == 29) { + Item_Flag_As_Non_Target(29); + } + if (itemId == 30) { + Item_Flag_As_Non_Target(30); + } + if (itemId == 31) { + Item_Flag_As_Non_Target(31); + } + if (itemId == 32) { + Item_Flag_As_Non_Target(32); + } + if (itemId == 33) { + Item_Flag_As_Non_Target(33); + } + if (itemId == 34) { + Item_Flag_As_Non_Target(34); + Item_Flag_As_Non_Target(35); + Item_Flag_As_Non_Target(36); + } + if (itemId == 35) { + Item_Flag_As_Non_Target(34); + Item_Flag_As_Non_Target(35); + Item_Flag_As_Non_Target(36); + } + if (itemId == 36) { + Item_Flag_As_Non_Target(34); + Item_Flag_As_Non_Target(35); + Item_Flag_As_Non_Target(36); + } + if (itemId == 37) { + Item_Flag_As_Non_Target(37); + } + if (itemId == 38) { + Item_Flag_As_Non_Target(38); + } + if (itemId == 39) { + Item_Flag_As_Non_Target(39); + } + if (itemId == 40) { + Item_Flag_As_Non_Target(40); + } + if (itemId == 41) { + Item_Flag_As_Non_Target(41); + } + if (itemId == 42) { + Item_Flag_As_Non_Target(42); + } + if (itemId == 43) { + Item_Flag_As_Non_Target(43); + } + if (itemId == 44) { + Item_Flag_As_Non_Target(44); + } + if (itemId == 45) { + Item_Flag_As_Non_Target(45); + } + return true; + } + return false; +} + +bool ScriptPS12::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_Waypoint(0, 8, 12, 1, false)) { + Game_Flag_Set(17); + sub_4028C4(); + Set_Enter(14, 74); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_Waypoint(0, 9, 12, 1, false)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_Waypoint(0, 10, 12, 0, false); + Player_Gains_Control(); + Game_Flag_Set(18); + sub_4028C4(); + Global_Variable_Decrement(9, 20 - Global_Variable_Query(12)); + Global_Variable_Set(12, 20); + Set_Enter(14, 76); + } + return true; + } + return false; +} + +bool ScriptPS12::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS12::SceneFrameAdvanced(int frame) { +} + +void ScriptPS12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS12::PlayerWalkedIn() { + if (Game_Flag_Query(16)) { + Loop_Actor_Walk_To_XYZ(0, -546.0f, -9.06f, 570.0f, 0, 1, false, 0); + Game_Flag_Reset(16); + } + Police_Maze_Set_Pause_State(0); +} + +void ScriptPS12::PlayerWalkedOut() { +} + +void ScriptPS12::DialogueQueueFlushed(int a1) { +} + +void ScriptPS12::sub_4028C4() { + Item_Remove_From_World(29); + Item_Remove_From_World(30); + Item_Remove_From_World(31); + Item_Remove_From_World(32); + Item_Remove_From_World(33); + Item_Remove_From_World(34); + Item_Remove_From_World(35); + Item_Remove_From_World(36); + Item_Remove_From_World(37); + Item_Remove_From_World(38); + Item_Remove_From_World(39); + Item_Remove_From_World(40); + Item_Remove_From_World(41); + Item_Remove_From_World(42); + Item_Remove_From_World(43); + Item_Remove_From_World(44); + Item_Remove_From_World(45); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps13.cpp b/engines/bladerunner/script/ps13.cpp new file mode 100644 index 0000000000..5b5ac20eb8 --- /dev/null +++ b/engines/bladerunner/script/ps13.cpp @@ -0,0 +1,285 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS13::InitializeScene() { + Police_Maze_Set_Pause_State(1); + if (Game_Flag_Query(18)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Reset(18); + Setup_Scene_Information(World_Waypoint_Query_X(10), World_Waypoint_Query_Y(10), World_Waypoint_Query_Z(10), 200); + } else { + Scene_Loop_Set_Default(1); + Setup_Scene_Information(World_Waypoint_Query_X(11), World_Waypoint_Query_Y(11), World_Waypoint_Query_Z(11), 840); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Exit_Add_2D_Exit(1, 0, 0, 20, 479, 3); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(387, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(54, 50, 1, 1); + Ambient_Sounds_Add_Sound(1, 10, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(389, 5, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(390, 6, 50, 16, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(443, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(444, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(445, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(446, 2, 100, 14, 16, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 100, 17, 27, -100, 100, -101, -101, 0, 0); +} + +static int track_data_46[] = {-26, 13, 20, -18, 13, 20, -9, 46, -5, 960, -1, 0, -3, 2000, -8, 46, -10, 33, 33, -15, 46, 1, -22, 46, -3, 1000, -2, 5, -3, 500, -24, 27, 33, -3, 500, -2, 0, -9, 46, -13, 62, 63, -12, 46, -4}; +static int track_data_47[] = {-26, 13, 20, -18, 13, 20, -9, 47, -5, 823, -1, 0, -7, 5000, 5000, -8, 47, -10, 33, 33, -15, 47, 1, -22, 47, -2, 9, -3, 2000, -24, 27, 33, -2, 0, -9, 47, -13, 50, 52, -12, 47, -4}; +static int track_data_48[] = {-26, 13, 20, -18, 13, 20, -9, 48, -5, 823, -1, 0, -7, 2000, 2000, -8, 48, -10, 33, 33, -15, 48, 1, -23, 48, -2, 9, -3, 2000, -25, -2, 0, -9, 48, -13, 53, 51, -12, 48, -4}; +static int track_data_49[] = {-26, 13, 20, -18, 13, 20, -9, 49, -5, 922, -1, 0, -7, 3000, 3000, -8, 49, -10, 33, 33, -15, 49, 1, -22, 49, -2, 9, -3, 1000, -24, 27, 33, -2, 0, -9, 49, -13, 54, 55, -12, 49, -1, 0, -4}; +static int track_data_50[] = {-26, 13, 20, -18, 13, 20, -9, 50, -5, 823, -1, 0, -7, 3000, 5000, -8, 50, -10, 33, 33, -15, 50, 1, -23, 50, -2, 9, -3, 2000, -2, 0, -25, -9, 50, -13, 47, 52, -12, 50, -4}; +static int track_data_51[] = {-26, 13, 20, -18, 13, 20, -9, 51, -5, 823, -1, 0, -7, 2000, 2000, -8, 51, -10, 33, 33, -15, 51, 1, -22, 51, -2, 9, -3, 1000, -24, 27, 33, -3, 500, -2, 0, -9, 51, -13, 53, 48, -12, 51, -4}; +static int track_data_52[] = {-26, 13, 20, -18, 13, 20, -9, 52, -5, 305, -1, 0, -7, 5000, 10000, -8, 52, -10, 33, 33, -15, 52, 1, -23, 52, -2, 9, -3, 500, -22, 52, -6, 555, 80, -3, 0, -6, 833, 80, -3, 1000, -24, 27, 33, -2, 0, -9, 52, -13, 47, 50, -12, 52, -4}; +static int track_data_53[] = {-26, 13, 20, -18, 13, 20, -9, 53, -5, 356, -1, 0, -7, 3000, 3000, -8, 53, -10, 33, 33, -15, 53, 1, -23, 53, -2, 5, -22, 53, -6, 868, 200, -3, 1000, -24, 27, 33, -6, 356, 60, -3, 1000, -2, 0, -9, 53, -13, 48, 51, -12, 53, -4}; +static int track_data_54[] = {-26, 13, 20, -18, 13, 20, -9, 54, -5, 512, -1, 0, -7, 10000, 20000, -8, 54, -10, 33, 33, -15, 54, 1, -23, 54, -2, 3, -3, 500, -22, 54, -6, 768, 80, -3, 1000, -24, 27, 33, -2, 0, -9, 54, -13, 58, 55, -12, 54, -4}; +static int track_data_55[] = {-26, 13, 20, -18, 13, 20, -9, 55, -9, 56, -9, 57, -15, 55, 1, -15, 56, 1, -15, 57, 1, -5, 327, -1, 0, -7, 1000, 1000, -10, 33, 33, -23, 55, -8, 55, -2, 14, -3, 1000, -11, 56, -9, 55, -8, 56, -12, 55, -1, 0, -4}; +static int track_data_56[] = {-5, 327, -1, 0, -8, 56, -23, 56, -2, 14, -3, 1000, -11, 57, -9, 56, -8, 57, -12, 56, -1, 0, -4}; +static int track_data_57[] = {-22, 57, -5, 327, -1, 0, -8, 57, -6, 516, 80, -3, 0, -6, 843, 80, -3, 1000, -24, 27, 33, -3, 500, -2, 14, -9, 57, -13, 58, 54, -12, 57, -1, 0, -4}; +static int track_data_58[] = {-26, 13, 20, -18, 13, 20, -9, 58, -5, 922, -1, 0, -7, 3000, 3000, -8, 58, -10, 33, 33, -15, 58, 1, -23, 58, -2, 9, -3, 200, -2, 0, -25, -15, 58, 1, -23, 58, -3, 200, -2, 9, -3, 200, -2, 0, -25, -9, 58, -11, 49, -12, 58, -1, 0, -4}; +static int track_data_62[] = {-26, 13, 20, -18, 13, 20, -9, 62, -5, 465, -1, 0, -7, 3000, 3000, -8, 62, -10, 33, 33, -15, 62, 1, -23, 62, -2, 14, -3, 1000, -22, 62, -6, 650, 80, -3, 0, -6, 937, 80, -3, 1000, -24, 27, 33, -3, 500, -6, 650, 80, -3, 0, -6, 465, 80, -2, 0, -9, 62, -13, 46, 63, -12, 62, -4}; +static int track_data_63[] = {-26, 13, 20, -18, 13, 20, -9, 63, -5, 465, -1, 0, -3, 3000, -8, 63, -10, 33, 33, -15, 63, 1, -23, 63, -2, 9, -3, 1000, -22, 63, -6, 710, 80, -3, 0, -6, 960, 80, -3, 1000, -24, 27, 33, -3, 500, -6, 710, 80, -3, 0, -6, 460, 80, -2, 0, -9, 63, -13, 46, 62, -12, 63, -4}; + +void ScriptPS13::SceneLoaded() { + Obstacle_Object("PARKMETR01", true); + Obstacle_Object("PARKMETR02", true); + Obstacle_Object("PARKMETR03", true); + Obstacle_Object("PARKMETR07", true); + Obstacle_Object("PARKMETR08", true); + Obstacle_Object("PARKMETR10", true); + Obstacle_Object("PARKMETR11", true); + Obstacle_Object("PARKMETR15", true); + Obstacle_Object("PARKMETR16", true); + Unclickable_Object("PARKMETR01"); + Unclickable_Object("PARKMETR02"); + Unclickable_Object("PARKMETR03"); + Unclickable_Object("PARKMETR07"); + Unclickable_Object("PARKMETR08"); + Unclickable_Object("PARKMETR10"); + Unclickable_Object("PARKMETR11"); + Unclickable_Object("PARKMETR15"); + Unclickable_Object("PARKMETR16"); + if (!Query_System_Currently_Loading_Game()) { + Item_Add_To_World(46, 443, 14, -372.0f, -9.0f, 1509.0f, 960, 72, 36, true, false, false, true); + Item_Add_To_World(47, 443, 14, 291.61f, -0.66f, 1610.3f, 823, 72, 36, true, false, false, true); + Item_Add_To_World(48, 447, 14, -25.0f, 102.0f, 1625.0f, 823, 72, 36, true, false, false, true); + Item_Add_To_World(49, 449, 14, -45.51f, -8.8f, 1676.0f, 922, 72, 36, true, false, false, true); + Item_Add_To_World(50, 447, 14, 291.61f, -0.66f, 1610.3f, 823, 72, 36, true, false, false, true); + Item_Add_To_World(51, 443, 14, -24.0f, 102.0f, 1625.0f, 823, 72, 36, true, false, false, true); + Item_Add_To_World(52, 449, 14, 180.0f, -72.7f, 1605.0f, 305, 72, 36, true, false, false, true); + Item_Add_To_World(53, 443, 14, 127.79f, 14.56f, 1703.03f, 356, 72, 36, true, false, false, true); + Item_Add_To_World(54, 443, 14, 136.37f, -6.84f, 1425.4301f, 512, 72, 36, true, false, false, true); + Item_Add_To_World(55, 441, 14, 77.83f, -79.8f, 1520.5f, 327, 72, 36, true, false, false, true); + Item_Add_To_World(56, 441, 14, 77.83f, -7.8f, 1520.5f, 327, 72, 36, true, false, false, true); + Item_Add_To_World(57, 443, 14, -88.0f, -8.8f, 1520.5f, 327, 72, 36, true, false, false, true); + Item_Add_To_World(58, 447, 14, -45.51f, -8.8f, 1676.0f, 922, 72, 36, true, false, false, true); + Item_Add_To_World(62, 445, 14, -300.0f, -79.75f, 1543.0f, 465, 72, 36, true, false, false, true); + Item_Add_To_World(63, 449, 14, -325.0f, -7.75f, 1543.0f, 465, 72, 36, true, false, false, true); + } + Police_Maze_Target_Track_Add(46, -372.0f, -9.0f, 1509.0f, -345.0f, -9.0f, 1509.0f, 6, track_data_46, true); + Police_Maze_Target_Track_Add(47, 291.61f, -0.66f, 1610.3f, 238.83f, 1.03f, 1557.03f, 10, track_data_47, true); + Police_Maze_Target_Track_Add(48, -25.0f, 102.0f, 1625.0f, -25.0f, 138.0f, 1625.0f, 10, track_data_48, true); + Police_Maze_Target_Track_Add(49, -45.51f, -8.8f, 1676.0f, 15.51f, -8.8f, 1679.0f, 10, track_data_49, false); + Police_Maze_Target_Track_Add(50, 291.61f, -0.66f, 1610.3f, 238.83f, 1.03f, 1557.03f, 10, track_data_50, false); + Police_Maze_Target_Track_Add(51, -24.0f, 102.0f, 1625.0f, -24.0f, 138.0f, 1625.0f, 10, track_data_51, false); + Police_Maze_Target_Track_Add(52, 180.0f, -72.7f, 1605.0f, 180.0f, -0.7f, 1605.0f, 10, track_data_52, false); + Police_Maze_Target_Track_Add(53, 127.79f, 14.56f, 1703.03f, -56.07f, 1.89f, 1589.04f, 6, track_data_53, false); + Police_Maze_Target_Track_Add(54, 136.37f, -6.84f, 1425.4301f, 117.55f, -6.84f, 1442.09f, 4, track_data_54, false); + Police_Maze_Target_Track_Add(55, 77.83f, -79.8f, 1520.5f, 77.83f, -7.8f, 1520.5f, 15, track_data_55, false); + Police_Maze_Target_Track_Add(56, 77.83f, -7.8f, 1520.5f, -88.0f, -8.8f, 1520.5f, 15, track_data_56, false); + Police_Maze_Target_Track_Add(57, -88.0f, -8.8f, 1520.5f, -88.0f, -80.8f, 1520.5f, 15, track_data_57, false); + Police_Maze_Target_Track_Add(58, -45.51f, -8.8f, 1676.0f, 15.51f, -8.8f, 1679.0f, 10, track_data_58, true); + Police_Maze_Target_Track_Add(62, -300.0f, -79.75f, 1543.0f, -300.0f, -14.75f, 1543.0f, 15, track_data_62, false); + Police_Maze_Target_Track_Add(63, -325.0f, -7.75f, 1543.0f, -300.0f, -7.75f, 1543.0f, 10, track_data_63, false); +} + +bool ScriptPS13::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS13::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS13::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS13::ClickedOnItem(int itemId, bool a2) { + if (Player_Query_Combat_Mode()) { + switch (itemId) { + case 48: + Sound_Play(4, 50, 0, 0, 50); + break; + case 50: + Sound_Play(4, 50, 0, 0, 50); + break; + case 55: + Sound_Play(555, 50, 0, 0, 50); + break; + case 56: + Sound_Play(555, 50, 0, 0, 50); + break; + default: + Sound_Play(2, 12, 0, 0, 50); + break; + } + Item_Spin_In_World(itemId); + Item_Flag_As_Non_Target(itemId); + if (itemId == 46) { + Item_Flag_As_Non_Target(46); + } + if (itemId == 47) { + Item_Flag_As_Non_Target(47); + } + if (itemId == 48) { + Item_Flag_As_Non_Target(48); + } + if (itemId == 49) { + Item_Flag_As_Non_Target(49); + } + if (itemId == 50) { + Item_Flag_As_Non_Target(50); + } + if (itemId == 51) { + Item_Flag_As_Non_Target(51); + } + if (itemId == 52) { + Item_Flag_As_Non_Target(52); + } + if (itemId == 53) { + Item_Flag_As_Non_Target(53); + } + if (itemId == 54) { + Item_Flag_As_Non_Target(54); + } + if (itemId == 55) { + Item_Flag_As_Non_Target(55); + Item_Flag_As_Non_Target(56); + Item_Flag_As_Non_Target(57); + } + if (itemId == 56) { + Item_Flag_As_Non_Target(55); + Item_Flag_As_Non_Target(56); + Item_Flag_As_Non_Target(57); + } + if (itemId == 57) { + Item_Flag_As_Non_Target(55); + Item_Flag_As_Non_Target(56); + Item_Flag_As_Non_Target(57); + } + if (itemId == 58) { + Item_Flag_As_Non_Target(58); + } + if (itemId == 62) { + Item_Flag_As_Non_Target(62); + } + if (itemId == 63) { + Item_Flag_As_Non_Target(63); + } + return true; + } + return false; + +} + +bool ScriptPS13::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_Waypoint(0, 10, 12, 1, false)) { + Game_Flag_Set(19); + sub_40267C(); + Set_Enter(14, 75); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_Waypoint(0, 11, 12, 1, false)) { + Game_Flag_Set(21); + Player_Set_Combat_Mode(false); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + sub_40267C(); + Global_Variable_Decrement(9, 20 - Global_Variable_Query(13)); + Set_Score(0, Global_Variable_Query(9)); + Global_Variable_Reset(10); + Global_Variable_Reset(11); + Global_Variable_Reset(12); + Global_Variable_Reset(13); + Global_Variable_Reset(9); + Set_Enter(15, 69); + } + return true; + } + return false; +} + +bool ScriptPS13::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS13::SceneFrameAdvanced(int frame) { +} + +void ScriptPS13::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS13::PlayerWalkedIn() { + Police_Maze_Set_Pause_State(0); +} + +void ScriptPS13::PlayerWalkedOut() { +} + +void ScriptPS13::DialogueQueueFlushed(int a1) { +} + +void ScriptPS13::sub_40267C() { + Item_Remove_From_World(46); + Item_Remove_From_World(47); + Item_Remove_From_World(48); + Item_Remove_From_World(49); + Item_Remove_From_World(50); + Item_Remove_From_World(51); + Item_Remove_From_World(52); + Item_Remove_From_World(53); + Item_Remove_From_World(54); + Item_Remove_From_World(55); + Item_Remove_From_World(56); + Item_Remove_From_World(57); + Item_Remove_From_World(58); + Item_Remove_From_World(62); + Item_Remove_From_World(63); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps14.cpp b/engines/bladerunner/script/ps14.cpp new file mode 100644 index 0000000000..e68460252f --- /dev/null +++ b/engines/bladerunner/script/ps14.cpp @@ -0,0 +1,127 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptPS14::InitializeScene() { + if (Game_Flag_Query(134)) { + Setup_Scene_Information(-1119.61f, 508.14f, -1208.22f, 315); + Game_Flag_Reset(134); + } else { + Setup_Scene_Information(-785.45f, 508.14f, -1652.0f, 315); + } + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 46, 51, 125, 192, 0); + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(374, 100, 300, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); +} + +void ScriptPS14::SceneLoaded() { + Obstacle_Object("CABLES UPPER RIGHT", true); + Unobstacle_Object("CYLINDER63", true); + Clickable_Object("CABLES UPPER RIGHT"); + Unclickable_Object("CABLES UPPER RIGHT"); +} + +bool ScriptPS14::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS14::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS14::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptPS14::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptPS14::ClickedOnExit(int exitId) { + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -2101.0f, 508.14f, -1361.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 819, false); + Loop_Actor_Travel_Stairs(0, 3, 1, 0); + if (Global_Variable_Query(1) == 4 && Game_Flag_Query(671)) { + if (Actor_Clue_Query(0, 32)) { + Game_Flag_Set(666); + Actor_Set_Goal_Number(0, 400); + } else { + Actor_Set_Goal_Number(0, 500); + } + } else if (Global_Variable_Query(1) > 3) { + Actor_Says(0, 8522, 12); + Actor_Face_Heading(0, 307, false); + Loop_Actor_Travel_Stairs(0, 3, 0, 0); + } else { + Game_Flag_Set(135); + Set_Enter(63, 67); + } + } + return true; + } + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -785.45f, 508.14f, -1652.0f, 0, 1, false, 0)) { + Game_Flag_Set(673); + Game_Flag_Reset(178); + Game_Flag_Set(179); + Set_Enter(53, 53); + } + return true; + } + return false; +} + +bool ScriptPS14::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS14::SceneFrameAdvanced(int frame) { +} + +void ScriptPS14::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS14::PlayerWalkedIn() { + if (Game_Flag_Query(672)) { + Loop_Actor_Walk_To_XYZ(0, -801.45f, 508.14f, -1596.68f, 0, 0, false, 0); + Game_Flag_Reset(672); + } + //return false; +} + +void ScriptPS14::PlayerWalkedOut() { +} + +void ScriptPS14::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ps15.cpp b/engines/bladerunner/script/ps15.cpp new file mode 100644 index 0000000000..5200d89f7c --- /dev/null +++ b/engines/bladerunner/script/ps15.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/script/script.h" + +namespace BladeRunner { + +void ScriptPS15::InitializeScene() { + Setup_Scene_Information(-360.0f, -113.43f, 50.0f, 0); + Scene_Exit_Add_2D_Exit(0, 0, 0, 20, 479, 3); + Scene_Exit_Add_2D_Exit(1, 620, 0, 639, 479, 1); + Ambient_Sounds_Add_Looping_Sound(384, 20, 1, 1); + Ambient_Sounds_Add_Looping_Sound(141, 80, 0, 1); + Ambient_Sounds_Add_Sound(385, 5, 50, 8, 8, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(156, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(157, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(158, 5, 20, 30, 30, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 20, 5, 9, -70, 70, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 20, 5, 9, -70, 70, -101, -101, 0, 0); + Actor_Put_In_Set(34, 101); + Actor_Set_At_XYZ(34, -265.4f, -113.43f, -31.29f, 623); +} + +void ScriptPS15::SceneLoaded() { + Obstacle_Object("E.ARCH", true); + if (Global_Variable_Query(1) == 2) { + Item_Add_To_World(110, 983, 101, -208.0f, -113.43f, 30.28f, 750, 16, 12, false, true, false, true); + } +} + +bool ScriptPS15::MouseClick(int x, int y) { + return false; +} + +bool ScriptPS15::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptPS15::ClickedOnActor(int actorId) { + if (actorId == 34) { + if ((Actor_Clue_Query(0, 80) || Actor_Clue_Query(0, 83)) && !Actor_Clue_Query(0, 81)) { + if (!Loop_Actor_Walk_To_XYZ(0, -256.0f, -113.43f, 43.51f, 0, 1, false, 0)) { + Actor_Face_Actor(0, 34, true); + Actor_Face_Actor(34, 0, true); + Actor_Says(0, 4470, 17); + Actor_Says(34, 130, 12); + Actor_Says(0, 4475, 18); + Actor_Says(0, 4480, 13); + Actor_Says(34, 140, 16); + Item_Pickup_Spin_Effect(965, 211, 239); + Actor_Says(34, 150, 14); + Actor_Clue_Acquire(0, 81, 1, 34); + if (!Game_Flag_Query(727)) { + Item_Remove_From_World(111); + } + } + } else { + Actor_Face_Actor(0, 34, true); + Actor_Says(0, 8600, 15); + Actor_Says(34, 190, 12); + } + return true; + } + return false; +} + +bool ScriptPS15::ClickedOnItem(int itemId, bool a2) { + if (itemId == 110) { + if (Actor_Clue_Query(0, 80) && Actor_Clue_Query(0, 83)) { + Actor_Says(0, 8570, 14); + } else { + Actor_Face_Actor(0, 34, true); + Actor_Face_Actor(34, 0, true); + Actor_Says(0, 4485, 17); + Actor_Says(34, 160, 14); + Actor_Says(0, 4490, 12); + Actor_Says(34, 170, 13); + Actor_Clue_Acquire(0, 80, 1, 0); + Actor_Clue_Acquire(0, 83, 1, 0); + } + return true; + } + return false; +} + +bool ScriptPS15::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -360.0f, -113.43f, 50.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(204); + Set_Enter(15, 69); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -183.58f, -113.43f, 91.7f, 0, 1, false, 0)) { + Actor_Says(0, 4440, 18); + Actor_Says(34, 150, 17); + Sound_Play(155, 90, 0, 0, 50); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(14, 73); + } + return true; + } + return false; +} + +bool ScriptPS15::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptPS15::SceneFrameAdvanced(int frame) { +} + +void ScriptPS15::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptPS15::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, -326.93f, -113.43f, 101.42f, 0, 0, false, 0); + if (!Game_Flag_Query(43)) { + Actor_Face_Actor(0, 34, true); + Actor_Face_Actor(34, 0, true); + Actor_Says(34, 0, 12); + Actor_Says(0, 4445, 18); + Actor_Says(34, 10, 12); + Actor_Says(0, 4450, 18); + Actor_Says(34, 60, 13); + Actor_Says(34, 70, 12); + Actor_Says(0, 4460, 15); + Actor_Says(34, 80, 13); + Actor_Says(0, 4465, 16); + Actor_Says(34, 90, 13); + Actor_Says(34, 100, 14); + Actor_Says(34, 110, 15); + Actor_Says(34, 120, 15); + Actor_Says(0, 4555, 14); + Game_Flag_Set(43); + //return true; + return; + } else { + //return false; + return; + } +} + +void ScriptPS15::PlayerWalkedOut() { +} + +void ScriptPS15::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/rc01.cpp b/engines/bladerunner/script/rc01.cpp new file mode 100644 index 0000000000..d94f104403 --- /dev/null +++ b/engines/bladerunner/script/rc01.cpp @@ -0,0 +1,623 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptRC01::InitializeScene() { +#if _DEBUG + //TODO: not part of game, remove + Game_Flag_Set(24); // force skip intro + // Game_Flag_Set(9); // Force flag 9 so McCoy will be in view + + Footstep_Sound_Override_On(0); +#endif + + if (!Game_Flag_Query(24)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(28, 1, -1); // WSTLGO_E.VQA + Outtake_Play(41, 1, -1); // BRLOGO_E.VQA + Outtake_Play(0, 0, -1); // INTRO_E.VQA + Outtake_Play(33, 1, -1); // DSCENT_E.VQA + } + if (Game_Flag_Query(9)) { + Setup_Scene_Information(-171.16f, 5.55f, 27.28f, 616); + } else if (Game_Flag_Query(114)) { + Setup_Scene_Information(-471.98f, -0.30f, 258.15f, 616); + } else { + Setup_Scene_Information(-10.98f, -0.30f, 318.15f, 616); + } + Scene_Exit_Add_2D_Exit(0, 314, 145, 340, 255, 0); + if (Game_Flag_Query(249)) { + Scene_Exit_Add_2D_Exit(1, 482, 226, 639, 280, 2); + } + if (Global_Variable_Query(1) > 1 && Game_Flag_Query(710)) { + Scene_Exit_Add_2D_Exit(2, 0, 0, 10, 479, 3); + } + if (!Game_Flag_Query(186)) { + Scene_2D_Region_Add(0, 0, 294, 296, 479); + } + + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(54, 30, 0, 1); // CTRAIN1.AUD + + if (!Game_Flag_Query(186)) { + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0470R.AUD + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0480R.AUD + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0500R.AUD + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0540R.AUD + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0560R.AUD + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0870R.AUD + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0900R.AUD + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0940R.AUD + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0960R.AUD + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1070R.AUD + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1080R.AUD + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1100R.AUD + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1140R.AUD + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1160R.AUD + } + + Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); // RCAMBR1.AUD + Ambient_Sounds_Add_Sound(82, 5, 30, 30, 50, -100, 100, -101, -101, 0, 0); // RCCARBY1.AUD + Ambient_Sounds_Add_Sound(83, 5, 30, 30, 55, -100, 100, -101, -101, 0, 0); // RCCARBY2.AUD + Ambient_Sounds_Add_Sound(84, 5, 30, 30, 50, -100, 100, -101, -101, 0, 0); // RCCARBY3.AUD + Ambient_Sounds_Add_Sound(67, 10, 50, 30, 50, -100, 100, -101, -101, 0, 0); // SPIN2A.AUD + Ambient_Sounds_Add_Sound(87, 20, 80, 20, 40, -100, 100, -101, -101, 0, 0); // SIREN2.AUD + + if (Game_Flag_Query(186)) { + if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) { + Scene_Loop_Start_Special(0, 5, 0); + } + if (Game_Flag_Query(249)) { + Scene_Loop_Set_Default(6); + } else { + Scene_Loop_Set_Default(10); + } + } else { + if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) { + Scene_Loop_Start_Special(0, 0, 0); + } + Scene_Loop_Set_Default(1); + } + + I_Sez("Blade Runner"); + I_Sez(""); + I_Sez("From the dark recesses of David Leary's imagination comes a game unlike any"); + I_Sez("other. Blade Runner immerses you in the underbelly of future Los Angeles. Right"); + I_Sez("from the start, the story pulls you in with graphic descriptions of a"); + I_Sez("grandmother doing the shimmy in her underwear, child molestation, brutal"); + I_Sez("cold-blooded slaying of innocent animals, vomiting on desks, staring at a"); + I_Sez("woman's ass, the list goes on. And when the game starts, the real fun begins -"); + I_Sez("shoot down-on-their-luck homeless people and toss them into a dumpster. Watch"); + I_Sez("with sadistic glee as a dog gets blown into chunky, bloody, bits by an"); + I_Sez("explosive, and even murder a shy little girl who loves you. If you think David"); + I_Sez("Leary is sick, and you like sick, this is THE game for you."); + I_Sez(""); + I_Sez("JW: Don't forget the wasting of helpless mutated cripples in the underground."); + I_Sez("It's such a beautiful thing!"); + I_Sez(""); + I_Sez("DL: Go ahead. Just keep beating that snarling pit bull...ignore the foam"); + I_Sez("around his jaws. There's room on the top shelf of my fridge for at least one"); + I_Sez("more head... - Psychotic Dave"); + I_Sez(""); +} + +void ScriptRC01::SceneLoaded() { + Obstacle_Object("HYDRANT02", true); + Obstacle_Object("PARKING METER 04", true); + Obstacle_Object("CHEVY PROP", true); + Obstacle_Object("PARKING METER 01", true); + Obstacle_Object("T-CAN01", true); + Obstacle_Object("BARICADE01", true); + Obstacle_Object("BARICADE02", true); + Obstacle_Object("DOOR LEFT", true); + Unobstacle_Object("BOX06", true); + Clickable_Object("DOORWAY01"); + Clickable_Object("DOOR LEFT"); + Clickable_Object("HYDRANT02"); + Clickable_Object("T-CAN01"); + Clickable_Object("BARICADE01"); + Clickable_Object("70_1"); + Clickable_Object("70_2"); + Clickable_Object("70_3"); + Clickable_Object("70_5"); + Clickable_Object("70_6"); + Unclickable_Object("BARICADE02"); + Unclickable_Object("BARICADE05"); + Unclickable_Object("SPINNER BODY"); + Unclickable_Object("HORSE01"); + Unclickable_Object("DOORWAY01"); + Unobstacle_Object("DOORWAY01", true); + + if (Game_Flag_Query(186)) { + Unclickable_Object("70_1"); + Unclickable_Object("70_2"); + Unclickable_Object("70_3"); + Unclickable_Object("70_5"); + Unclickable_Object("70_6"); + Unclickable_Object("BARICADE01"); + Unclickable_Object("BARICADE03"); + Unclickable_Object("BARICADE04"); + Unobstacle_Object("70_1", true); + Unobstacle_Object("70_2", true); + Unobstacle_Object("70_3", true); + Unobstacle_Object("70_5", true); + Unobstacle_Object("70_6", true); + Unobstacle_Object("BARICADE01", true); + Unobstacle_Object("BARICADE02", true); + Unobstacle_Object("BARICADE03", true); + Unobstacle_Object("BARICADE04", true); + Unobstacle_Object("BARICADE05", true); + } + + if (!Game_Flag_Query(186)) { + Preload(13); + Preload(14); + Preload(19); + Preload(582); + Preload(589); + } + + if (!Game_Flag_Query(163)) { + Item_Add_To_World(66, 938, 69, -148.60f, -0.30f, 225.15f, 256, 24, 24, false, true, false, true); + } + + if (!Game_Flag_Query(24)) { + ADQ_Flush(); + Actor_Voice_Over(1830, 99); + Actor_Voice_Over(1850, 99); + if (!Game_Flag_Query(378)) { + Actor_Voice_Over(1860, 99); + I_Sez("MG: Is David Leary a self-respecting human or is he powered by rechargeable"); + I_Sez("batteries?\n"); + } + Game_Flag_Set(24); + } +} + +bool ScriptRC01::MouseClick(int x, int y) { + return y >= 430; +} + +bool ScriptRC01::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("BARICADE01", objectName) + || Object_Query_Click("BARICADE03", objectName) + || Object_Query_Click("BARICADE04", objectName) + || Object_Query_Click("70_1", objectName) + || Object_Query_Click("70_2", objectName) + || Object_Query_Click("70_3", objectName) + || Object_Query_Click("70_5", objectName) + || Object_Query_Click("70_6", objectName)) { + sub_403850(); + return true; + } + + if (Object_Query_Click("HYDRANT02", objectName)) { + if (!Loop_Actor_Walk_To_Scene_Object(0, "HYDRANT02", 60, true, false)) { + if (Actor_Clue_Query(0, 26)) { + Actor_Says(0, 6975, 3); + } else { + Actor_Face_Object(0, "HYDRANT02", true); + Actor_Voice_Over(1880, 99); + Actor_Voice_Over(1890, 99); + I_Sez("JM: That McCoy--he's one funny guy! Jet-black fire truck, hehehehe..."); + Actor_Clue_Acquire(0, 26, 1, -1); + } + } + return true; + } + + if (Object_Query_Click("DOOR LEFT", objectName)) { + if (!Loop_Actor_Walk_To_Scene_Object(0, "DOOR LEFT", 48, true, false)) { + Actor_Face_Object(0, "DOOR LEFT", true); + if (!Actor_Clue_Query(0, 2) && Actor_Query_In_Set(23, 69) && Global_Variable_Query(1)) { + Actor_Set_Goal_Number(23, 0); + Actor_Face_Actor(23, 0, true); + Actor_Says(23, 0, 12); + Actor_Says(0, 4495, 13); + Actor_Clue_Acquire(0, 2, 1, 23); + } else { + Actor_Says(0, 8570, 14); + } + Actor_Clue_Acquire(0, 1, 1, -1); + } + return true; + } + + if (Object_Query_Click("T-CAN01", objectName)) { + if (!Loop_Actor_Walk_To_Scene_Object(0, "T-CAN01", 24, true, false)) { + Actor_Face_Object(0, "T-CAN01", true); + Actor_Voice_Over(1810, 99); + Actor_Voice_Over(1820, 99); + } + return true; + } + + return false; +} + +bool ScriptRC01::ClickedOnActor(int actorId) { + if (actorId == 23 && Global_Variable_Query(1) == 1) { + if (!Loop_Actor_Walk_To_Actor(0, 23, 36, 1, false)) { + Actor_Face_Actor(0, 23, true); + Actor_Face_Actor(23, 0, true); + if (Actor_Query_Goal_Number(23) == 1) { + Actor_Set_Goal_Number(23, 0); + } + if (Game_Flag_Query(3)) { + Actor_Says(0, 4535, 13); + Game_Flag_Set(392); + if (Actor_Clue_Query(23, 16) && !Actor_Clue_Query(0, 16)) { + Actor_Face_Object(23, "70_1", true); + Actor_Says(23, 100, 15); + Actor_Face_Actor(23, 0, true); + Actor_Clue_Acquire(0, 16, 1, 23); + Game_Flag_Reset(392); + } else if (Actor_Clue_Query(23, 17) && !Actor_Clue_Query(0, 17)) { + Actor_Face_Object(23, "70_5", true); + Actor_Says(23, 120, 19); + Actor_Face_Actor(23, 0, true); + Actor_Says(23, 130, 14); + I_Sez("JM: Did it have a huge, ugly piece of chrome on it?"); + Actor_Clue_Acquire(0, 17, 1, 23); + Game_Flag_Reset(392); + } else { + Actor_Says(23, 90, 16); + I_Sez("JM: This officer has a talent for vivid metaphors."); + if (!Game_Flag_Query(397)) { + I_Sez("DL: What is that supposed to mean? I didn't write this line..."); + Actor_Says(0, 4540, 16); + Game_Flag_Set(397); + } + Game_Flag_Reset(392); + } + } else { + I_Sez("MG: Hey, leave that officer alone.Can't you see he's busy?"); + I_Sez("JM: (...mmm, donuts..."); + Game_Flag_Set(3); + Actor_Clue_Acquire(0, 0, 1, 23); + Actor_Says(0, 4515, 13); + Game_Flag_Set(392); + Actor_Says(23, 40, 13); + if (!Game_Flag_Query(1)) { + Actor_Says(23, 50, 14); + Actor_Says(23, 60, 15); + I_Sez("MG: It's all fun and games until someone loses a tiger cub"); + Actor_Says(0, 4520, 18); + Actor_Says(23, 70, 16); + Actor_Says(0, 4525, 14); + Actor_Says(23, 80, 18); + Actor_Says(0, 4530, 15); + } + Game_Flag_Reset(392); + } + } + return true; + } + return false; +} + +bool ScriptRC01::ClickedOnItem(int itemId, bool a2) { + if (itemId == 66) { + Actor_Set_Goal_Number(23, 0); + if (!Loop_Actor_Walk_To_Item(0, 66, 36, 1, false)) { + Actor_Face_Item(0, 66, true); + Actor_Clue_Acquire(0, 27, 1, -1); + Actor_Face_Actor(23, 0, true); + Actor_Says(23, 20, 12); + Game_Flag_Set(163); + Item_Remove_From_World(66); + Item_Pickup_Spin_Effect(938, 426, 316); + I_Sez("JM: Chrome...is that what that is?"); + Actor_Says(0, 4505, 13); + ADQ_Flush(); + ADQ_Add(23, 30, -1); + ADQ_Add(0, 4510, 13); + I_Sez("JM: It's hard to imagine that thing on either a car or a horse."); + I_Sez("MG: McCoy! What a witty chap..."); + I_Sez("JM: He keeps me chuckling non-stop!\n"); + Loop_Actor_Walk_To_Actor(23, 0, 36, 0, false); + } + return true; + } + return false; + +} + +void ScriptRC01::sub_4037AC() { + Player_Loses_Control(); + Game_Flag_Set(182); + Actor_Set_Immunity_To_Obstacles(0, true); + Loop_Actor_Walk_To_XYZ(0, -151.98f, -0.3f, 318.15f, 0, 0, false, 0); + Actor_Set_Immunity_To_Obstacles(0, false); + Player_Gains_Control(); +} + +bool ScriptRC01::ClickedOnExit(int exitId) { + + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -174.77f, 5.55f, 25.95f, 12, 1, false, 0)) { + if (Game_Flag_Query(705)) { + Actor_Says(0, 8522, 14); + } else { + switch (Global_Variable_Query(1)) { + case 1: + case 4: + Game_Flag_Set(8); + Set_Enter(16, 79); + break; + case 2: + case 3: + case 5: + Actor_Says(0, 8522, 12); + break; + default: + return true; + } + } + } + return true; + } + if (exitId == 1) { + if (Game_Flag_Query(486)) { + Spinner_Set_Selectable_Destination_Flag(6, 1); + } + I_Sez("MG: Leaving already? The fun is just beginning!"); + if (!Loop_Actor_Walk_To_XYZ(0, -151.98f, -0.3f, 318.15f, 0, 1, false, 0)) { + Player_Loses_Control(); + Actor_Set_Immunity_To_Obstacles(0, true); + Loop_Actor_Walk_To_XYZ(0, -151.98f, -0.3f, 318.15f, 0, 0, false, 0); + if (Game_Flag_Query(486) && !Game_Flag_Query(660)) { + Actor_Voice_Over(4310, 99); + Actor_Voice_Over(4320, 99); + Actor_Voice_Over(4330, 99); + Actor_Voice_Over(4340, 99); + Actor_Voice_Over(4350, 99); + Game_Flag_Set(660); + } + Actor_Set_Immunity_To_Obstacles(0, false); + Player_Gains_Control(); + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + int spinnerDest; + if (Game_Flag_Query(186)) { + spinnerDest = Spinner_Interface_Choose_Dest(8, 1); + } else { + spinnerDest = Spinner_Interface_Choose_Dest(3, 1); + } + if (spinnerDest) { + switch (spinnerDest) { + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(249); + Game_Flag_Set(250); + Set_Enter(49, 48); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(249); + Game_Flag_Set(248); + Set_Enter(4, 13); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 5: + Game_Flag_Set(261); + Game_Flag_Reset(249); + Game_Flag_Set(307); + Set_Enter(17, 82); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(249); + Game_Flag_Set(252); + Set_Enter(0, 0); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(249); + Game_Flag_Set(253); + Set_Enter(7, 25); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(249); + Game_Flag_Set(254); + Set_Enter(20, 2); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(249); + Game_Flag_Set(255); + Set_Enter(54, 54); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(249); + Game_Flag_Set(256); + Set_Enter(37, 34); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + break; + default: + sub_4037AC(); + break; + } + } else { + Game_Flag_Set(178); + Game_Flag_Reset(249); + Game_Flag_Set(251); + Set_Enter(61, 65); + if (Game_Flag_Query(186)) { + Scene_Loop_Start_Special(1, 9, 1); + } else { + Scene_Loop_Start_Special(1, 4, 1); + } + } + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -471.98f, -0.3f, 258.15f, 4, 1, false, 0)) { + Game_Flag_Set(115); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Set_Enter(70, 80); + } + return true; + } + return false; +} + +void ScriptRC01::sub_403850() { + if (!Game_Flag_Query(186) && !Loop_Actor_Walk_To_Scene_Object(0, "BARICADE03", 36, true, false)) { + Actor_Set_Goal_Number(23, 0); + Actor_Face_Object(0, "BARICADE03", true); + Loop_Actor_Walk_To_Actor(23, 0, 36, 1, false); + Actor_Face_Actor(23, 0, true); + Actor_Says(0, 4500, 14); + I_Sez("MG: We don't want any of that abstract art oozing out onto the street."); + Actor_Says(23, 10, 14); + Actor_Set_Goal_Number(23, 1); + } +} + +bool ScriptRC01::ClickedOn2DRegion(int region) { + if (region == 0) { + sub_403850(); + return true; + } + return false; +} + +void ScriptRC01::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Sound_Play(118, 40, 0, 0, 50); // CARDOWN3.AUD + } + if (frame == 61 || frame == 362) { + Sound_Play(116, 100, 80, 80, 50); // SPINOPN4.AUD + } + if (frame == 108 || frame == 409) { + Sound_Play(119, 100, 80, 80, 50); // SPINCLS1.AUD + } + if (frame == 183 || frame == 484) { + Sound_Play(116, 100, 80, 80, 50); // SPINOPN4.AUD + } + if (frame == 228 || frame == 523) { + Sound_Play(119, 100, 80, 80, 50); // SPINCLS1.AUD + } + if (frame == 243 || frame == 545) { + Sound_Play(117, 40, 80, 80, 50); // CARUP3.AUD + } + if (frame == 315) { + Sound_Play(118, 40, 80, 80, 50); // CARDOWN3.AUD + } +} + +void ScriptRC01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptRC01::PlayerWalkedIn() { + if (Game_Flag_Query(249) && !Game_Flag_Query(9) && !Game_Flag_Query(114)) { + sub_4037AC(); + } + + if (Game_Flag_Query(114)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -415.98f, -0.30f, 262.15f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(114); + } + + if (Game_Flag_Query(9)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -203.45f, 5.55f, 85.05f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(9); + + if (Game_Flag_Query(1) && !Game_Flag_Query(4)) { + Actor_Voice_Over(1910, 99); + Actor_Voice_Over(1920, 99); + Actor_Voice_Over(1930, 99); + Game_Flag_Set(4); + } + //return true; + } + //return false; +} + +void ScriptRC01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (!Game_Flag_Query(8) && !Game_Flag_Query(115) && Global_Variable_Query(1)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(31, 1, -1); + } + // return 1; +} + +void ScriptRC01::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/rc02.cpp b/engines/bladerunner/script/rc02.cpp new file mode 100644 index 0000000000..7a387c2583 --- /dev/null +++ b/engines/bladerunner/script/rc02.cpp @@ -0,0 +1,392 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptRC02::InitializeScene() { + if (Game_Flag_Query(8)) { + Setup_Scene_Information(-103.0f, -1238.89f, 108603.04f, 1007); + } else { + Setup_Scene_Information(-20.2f, -1238.89f, 108100.73f, 539); + } + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + if (Game_Flag_Query(141)) { + Scene_Exit_Add_2D_Exit(1, 265, 58, 346, 154, 0); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(0); + Ambient_Sounds_Add_Looping_Sound(71, 50, 1, 1); + Ambient_Sounds_Add_Looping_Sound(75, 75, 1, 1); + Ambient_Sounds_Add_Looping_Sound(105, 30, 100, 1); + Ambient_Sounds_Add_Sound(73, 5, 20, 10, 10, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 20, 10, 10, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(76, 5, 40, 6, 6, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(77, 5, 40, 6, 6, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(78, 5, 40, 6, 6, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(79, 5, 40, 6, 6, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(23, 250, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(23, 330, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 380, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(24, 510, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 80, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(38, 160, 10, 60, 5, 5, 100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(87, 20, 80, 10, 20, 100, 100, -101, -101, 0, 0); +} + +void ScriptRC02::SceneLoaded() { + Obstacle_Object("TABLETOP", true); + Obstacle_Object("DRAPE01", true); + Obstacle_Object("DRAPE03", true); + Obstacle_Object("DRAPE04", true); + Obstacle_Object("DRAPE05", true); + Obstacle_Object("DRAPE06", true); + Obstacle_Object("DRAPE07", true); + Obstacle_Object("OUTR_DESK", true); + Obstacle_Object("CAGE_BASE", true); + Obstacle_Object("POLE_ROP01", true); + Unobstacle_Object("LEGS", true); + Unobstacle_Object("SLATS01", true); + Unobstacle_Object("DRAPE07", true); + Clickable_Object("SCRTY CA03"); + Unclickable_Object("GRL_DSKLEG"); + Unclickable_Object("CURTAIN"); + Unclickable_Object("DRAPE01"); + Unclickable_Object("DRAPE02"); + Unclickable_Object("DRAPE03"); + Unclickable_Object("DRAPE05"); + Unclickable_Object("DRAPE06"); + Unclickable_Object("DRAPE07"); + if (Actor_Clue_Query(0, 12) || Global_Variable_Query(1) > 1) { + Unclickable_Object("SCRTY CA03"); + } + if (!Game_Flag_Query(190)) { + Item_Add_To_World(100, 966, 16, -52.88f, -1238.89f, 108467.74f, 256, 6, 6, false, true, false, true); + Item_Add_To_World(101, 966, 16, -37.16f, -1238.89f, 108456.59f, 512, 6, 6, false, true, false, true); + Item_Add_To_World(102, 966, 16, -62.86f, -1238.89f, 108437.52f, 625, 6, 6, false, true, false, true); + } +} + +bool ScriptRC02::MouseClick(int x, int y) { + return false; +} + +bool ScriptRC02::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("SCRTY CA03", objectName) && !Actor_Clue_Query(0, 12)) { + if (Actor_Clue_Query(0, 22) && Actor_Query_Is_In_Current_Set(15)) { + AI_Movement_Track_Pause(15); + Actor_Face_Actor(0, 15, true); + Actor_Says(0, 4545, 14); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 0, 14); + Actor_Says(15, 10, 16); + Actor_Says(0, 4550, 13); + Actor_Says(15, 20, 13); + Loop_Actor_Walk_To_Waypoint(15, 89, 0, 0, false); + Actor_Face_Actor(0, 15, true); + Loop_Actor_Walk_To_Waypoint(15, 102, 0, 0, false); + Actor_Face_Actor(0, 15, true); + Actor_Face_Heading(15, 539, false); + Delay(2000); + Loop_Actor_Walk_To_Waypoint(15, 89, 0, 0, false); + Loop_Actor_Walk_To_Actor(15, 0, 24, 0, false); + Item_Pickup_Spin_Effect(975, 357, 228); + Actor_Face_Actor(0, 15, true); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 30, 23); + Actor_Says(0, 4555, 18); + Actor_Clue_Acquire(0, 12, 1, 15); + Unclickable_Object("SCRTY CA03"); + AI_Movement_Track_Unpause(15); + return true; + } else { + Actor_Face_Object(0, "SCRTY CA03", true); + Actor_Voice_Over(2000, 99); + return true; + } + } + return false; +} + +void ScriptRC02::sub_402A7C() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(0, 5, 6, 2); + DM_Add_To_List_Never_Repeat_Once_Selected(10, 5, 4, 8); + if (Actor_Clue_Query(0, 23) || (Actor_Clue_Query(0, 24))) { + DM_Add_To_List_Never_Repeat_Once_Selected(20, 6, 4, 5); + } + Dialogue_Menu_Add_DONE_To_List(30); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer) { + switch (answer) { + case 10: + Actor_Says(0, 4585, 13); + Actor_Face_Actor(15, 0, true); + if (Game_Flag_Query(46)) { + Actor_Says(15, 250, 13); + Actor_Says(15, 270, 13); + Actor_Clue_Acquire(0, 23, 1, 15); + } else { + Actor_Says(15, 260, 14); + Actor_Says(15, 270, 13); + Actor_Clue_Acquire(0, 24, 1, 15); + } + Actor_Says(0, 4645, 13); + Actor_Says(15, 280, 13); + Actor_Says(15, 290, 13); + Actor_Says(0, 4650, 18); + Actor_Says(15, 320, 13); + Actor_Says(0, 4665, 13); + Actor_Face_Object(15, "CURTAIN", true); + Actor_Says(15, 350, 13); + Actor_Face_Actor(15, 0, true); + Scene_Exit_Add_2D_Exit(1, 265, 58, 346, 154, 0); + Game_Flag_Set(141); + break; + case 20: + Actor_Says(0, 4590, 19); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 360, 13); + Loop_Actor_Walk_To_Waypoint(15, 89, 0, 0, false); + Loop_Actor_Walk_To_Waypoint(15, 102, 0, 0, false); + Actor_Face_Actor(0, 15, true); + Actor_Face_Heading(15, 539, false); + Delay(2000); + Loop_Actor_Walk_To_Waypoint(15, 89, 0, 0, false); + Actor_Face_Actor(0, 15, true); + Loop_Actor_Walk_To_Actor(15, 0, 24, 0, false); + Actor_Face_Actor(15, 0, true); + Actor_Face_Actor(0, 15, true); + Item_Pickup_Spin_Effect(964, 357, 228); + Actor_Says(15, 1700, 13); + Actor_Clue_Acquire(0, 15, 1, 15); + break; + case 30: + Actor_Says(0, 4595, 14); + break; + } + } else { + Actor_Says(0, 4580, 13); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 110, 18); + Actor_Says(15, 120, 17); + Actor_Says(15, 130, 19); + Actor_Says(0, 4605, 13); + Actor_Says(15, 140, 16); + Game_Flag_Set(187); + } +} + +bool ScriptRC02::ClickedOnActor(int actorId) { + if (actorId != 15) { + return false; + } + + if (Global_Variable_Query(1) == 4) { + Actor_Face_Actor(0, 15, true); + if (Actor_Query_Goal_Number(15) == 599) { + if (Random_Query(1, 2) == 1) { + Actor_Says(0, 8715, 17); + } else { + Actor_Says(0, 8720, 17); + } + } else if (Game_Flag_Query(705) || Game_Flag_Query(706)) { + Actor_Says(0, 4805, 11); + Actor_Face_Actor(15, 0, true); + if (Game_Flag_Query(706)) { + Actor_Says(15, 720, 15); + } else { + Actor_Says(15, 730, 14); + } + Actor_Face_Heading(15, 1007, false); + } else { + Actor_Says(0, 4690, 11); + Actor_Says(0, 4695, 13); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 1610, 14); + if (Actor_Clue_Query(0, 76)) { + Actor_Says(0, 4700, 12); + Actor_Says(0, 4705, 13); + Actor_Says(15, 1620, 12); + Actor_Says(0, 4710, 15); + Actor_Says(0, 4715, 11); + Delay(2000); + Actor_Says(0, 4720, 16); + Actor_Says(0, 4725, 17); + Actor_Says(15, 430, 16); + Actor_Face_Heading(15, 1007, false); + } + Game_Flag_Set(706); + } + return true; + } + AI_Movement_Track_Pause(15); + Loop_Actor_Walk_To_Actor(0, 15, 48, 1, false); + Actor_Face_Actor(0, 15, true); + if (!Game_Flag_Query(6)) { + Actor_Says(0, 4560, 13); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 40, 16); + Actor_Says(15, 50, 15); + Actor_Says(0, 4565, 13); + Actor_Says(15, 60, 14); + Actor_Says(0, 4570, 18); + Actor_Says(15, 70, 13); + Game_Flag_Set(6); + Actor_Clue_Acquire(0, 22, 1, 15); + AI_Movement_Track_Unpause(15); + return true; + } + if (Game_Flag_Query(187)) { + if (Player_Query_Agenda() == 0) { + Game_Flag_Reset(0); + sub_402A7C(); + AI_Movement_Track_Unpause(15); + return true; + } + + Actor_Says(0, 4610, 19); + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 150, 15); + Actor_Says(0, 4615, 13); + Actor_Says(15, 160, 14); + Actor_Says(15, 170, 15); + Actor_Says(15, 180, 13); + + if (Player_Query_Agenda() == 2) { + Actor_Says(0, 4620, 19); + Actor_Says(15, 190, 14); + Actor_Says(0, 4625, 13); + Actor_Says(15, 210, 13); + Actor_Says(0, 4630, 18); + Actor_Says(15, 220, 14); + Actor_Says(15, 230, 13); + Actor_Says(0, 4635, 19); + Actor_Says(15, 240, 16); + Actor_Says(0, 4640, 17); + } + Game_Flag_Reset(187); + AI_Movement_Track_Unpause(15); + return true; + } + sub_402A7C(); + AI_Movement_Track_Unpause(15); + return true; +} + +bool ScriptRC02::ClickedOnItem(int itemId, bool a2) { + if (itemId == 100 || itemId == 101 || itemId == 102) { + if (!Loop_Actor_Walk_To_Item(0, 100, 24, 1, false)) { + Actor_Face_Item(0, 100, true); + Actor_Clue_Acquire(0, 5, 1, -1); + Game_Flag_Set(190); + Item_Remove_From_World(100); + Item_Remove_From_World(101); + Item_Remove_From_World(102); + Item_Pickup_Spin_Effect(966, 395, 352); + Actor_Voice_Over(1960, 99); + } + return true; + } + return false; +} + +bool ScriptRC02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -71.51f, -1238.89f, 108587.15f, 0, 1, false, 0)) { + Game_Flag_Set(9); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_Looping_Sound(71, true); + Ambient_Sounds_Remove_Looping_Sound(75, true); + Ambient_Sounds_Adjust_Looping_Sound(85, 100, -101, 1); + Actor_Set_Goal_Number(15, 0); + Set_Enter(69, 78); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -20.2f, -1238.73f, 108152.73f, 0, 1, false, 0)) { + Async_Actor_Walk_To_XYZ(0, -8.87f, -1238.89f, 108076.27f, 0, false); + Set_Enter(16, 107); + } + return true; + } + return false; +} + +bool ScriptRC02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptRC02::SceneFrameAdvanced(int frame) { +} + +void ScriptRC02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptRC02::PlayerWalkedIn() { + Player_Set_Combat_Mode(false); + if (Game_Flag_Query(8)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -72.2f, -1238.89f, 108496.73f, 0, 0, false, 0); + Player_Gains_Control(); + Game_Flag_Reset(8); + if (!Game_Flag_Query(1)) { + Actor_Voice_Over(1970, 99); + Actor_Voice_Over(1980, 99); + Actor_Voice_Over(1990, 99); + Actor_Clue_Acquire(0, 3, 1, -1); + Actor_Clue_Acquire(0, 4, 1, -1); + Game_Flag_Set(1); + } + if (Actor_Query_Which_Set_In(15) == 16 && Actor_Query_Goal_Number(15) < 300) { + Actor_Set_Goal_Number(15, 1); + } + if (Actor_Query_Goal_Number(15) == 300 && !Game_Flag_Query(704)) { + Actor_Face_Actor(15, 0, true); + Actor_Says(15, 370, 12); + Actor_Says(15, 380, 14); + Actor_Face_Actor(0, 15, true); + Actor_Says(0, 4670, 15); + Actor_Says(15, 390, 13); + Actor_Says(0, 4675, 14); + Actor_Face_Heading(15, 1007, false); + Actor_Says(15, 400, 13); + Actor_Says(15, 410, 12); + Game_Flag_Set(704); + } + } else { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, -20.2f, -1238.89f, 108152.73f, 0, 0, false, 0); + Player_Gains_Control(); + } +} + +void ScriptRC02::PlayerWalkedOut() { +} + +void ScriptRC02::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/rc03.cpp b/engines/bladerunner/script/rc03.cpp new file mode 100644 index 0000000000..92074a8af9 --- /dev/null +++ b/engines/bladerunner/script/rc03.cpp @@ -0,0 +1,301 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptRC03::InitializeScene() { + if (Game_Flag_Query(115) ) { + Setup_Scene_Information(298.0f, -4.0f, 405.0f, 800); + Game_Flag_Reset(115); + } else if (Game_Flag_Query(117) ) { + Setup_Scene_Information(-469.0f, -4.0f, 279.0f, 250); + } else if (Game_Flag_Query(119) ) { + Setup_Scene_Information(147.51f, -4.0f, 166.48f, 500); + if (!Game_Flag_Query(151)) { + Game_Flag_Set(151); + } + } else if (Game_Flag_Query(107) ) { + Setup_Scene_Information(-487.0f, 1.0f, 116.0f, 400); + } else if (Game_Flag_Query(121) ) { + Setup_Scene_Information(-22.0f, 1.0f, -63.0f, 400); + } else { + Setup_Scene_Information(0.0f, 0.0f, 0.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3); + if (Game_Flag_Query(151) ) { + Scene_Exit_Add_2D_Exit(2, 524, 350, 573, 359, 2); + } + Scene_Exit_Add_2D_Exit(3, 85, 255, 112, 315, 0); + Scene_Exit_Add_2D_Exit(4, 428, 260, 453, 324, 0); + Ambient_Sounds_Add_Looping_Sound(54, 50, 0, 1); + Ambient_Sounds_Add_Sound(82, 5, 30, 40, 70, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(83, 5, 30, 40, 75, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(84, 5, 30, 40, 70, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Speech_Sound(60, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Speech_Sound(60, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1); + Ambient_Sounds_Add_Sound(68, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(69, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(375, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(376, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(377, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(107) && Actor_Query_Goal_Number(7) != 102) { + Scene_Loop_Start_Special(0, 0, 0); + } + Scene_Loop_Set_Default(1); +} + +void ScriptRC03::SceneLoaded() { + Obstacle_Object("Box-Streetlight01", true); + Obstacle_Object("Box-Streetlight02", true); + Obstacle_Object("Parking Meter 01", true); + Obstacle_Object("Parking Meter 02", true); + Obstacle_Object("Parking Meter 03", true); + Obstacle_Object("Trash can with fire", true); + Obstacle_Object("Baricade01", true); + Obstacle_Object("Foreground Junk01", true); + Obstacle_Object("Steam01", true); + Obstacle_Object("Steam02", true); + Obstacle_Object("Box-BBcolumn01", true); + Obstacle_Object("Box-BBcolumn02", true); + Obstacle_Object("Box-BBcolumn03", true); + Obstacle_Object("Box-BBcolumn04", true); + Obstacle_Object("Box-BBbuilding01", true); + Obstacle_Object("Box-BBbuilding02", true); + Obstacle_Object("Box-BBbuilding03", true); + Obstacle_Object("Box-BBbuilding04", true); + Unclickable_Object("BOX-BBBUILDING01"); + Unclickable_Object("BOX-BBBUILDING02"); + Unclickable_Object("BOX-BBBUILDING03"); + Unclickable_Object("BOX-BBBUILDING04"); + Unclickable_Object("BOX-STREETLIGHT01"); + Unclickable_Object("BOX-STREETLIGHT02"); + Unclickable_Object("BOX-BBCOLUMN01"); + Unclickable_Object("BOX-BBCOLUMN02"); + Unclickable_Object("BOX-BBCOLUMN03"); + Unclickable_Object("BOX-BBCOLUMN04"); + Unclickable_Object("PARKING METER 02"); + Unclickable_Object("PARKING METER 03"); + Unclickable_Object("TRASH CAN WITH FIRE"); + Unclickable_Object("BARICADE01"); + Unclickable_Object("FOREGROUND JUNK01"); +} + +bool ScriptRC03::MouseClick(int x, int y) { + return false; +} + +bool ScriptRC03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptRC03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptRC03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptRC03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 298.0f, -4.0f, 405.0f, 0, 1, false, 0)) { + if (Game_Flag_Query(289)) { + Game_Flag_Set(702); + } + Game_Flag_Set(114); + Set_Enter(69, 78); + Actor_Set_Goal_Number(3, 100); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -469.0f, -4.0f, 279.0f, 0, 1, false, 0)) { + if (Game_Flag_Query(289)) { + Game_Flag_Set(702); + } + Game_Flag_Set(116); + Game_Flag_Reset(182); + Game_Flag_Set(180); + Set_Enter(0, 1); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 147.51f, -4.0f, 166.48f, 0, 1, false, 0)) { + Game_Flag_Set(118); + Game_Flag_Reset(182); + Game_Flag_Set(259); + if (Game_Flag_Query(289)) { + Game_Flag_Set(702); + } + Set_Enter(74, 86); + Actor_Set_Goal_Number(3, 100); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, -487.0f, 1.0f, 116.0f, 0, 1, false, 0)) { + Game_Flag_Set(108); + Game_Flag_Reset(182); + Game_Flag_Set(479); + if (Game_Flag_Query(289)) { + Game_Flag_Set(702); + } + Set_Enter(8, 106); + Actor_Set_Goal_Number(3, 100); + } + return true; + } + if (exitId == 4) { + if (!Loop_Actor_Walk_To_XYZ(0, -22.0f, 1.0f, -63.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) == 3 || Global_Variable_Query(1) == 5 || Game_Flag_Query(702)) { + Actor_Says(0, 8522, 14); + } else { + Game_Flag_Set(120); + Set_Enter(71, 81); + } + } + return true; + } + return false; +} + +bool ScriptRC03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptRC03::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Sound_Play(286, Random_Query(33, 33), 100, -100, 50); + } + if (frame == 15) { + Sound_Play(287, Random_Query(50, 50), -100, 100, 50); + } +} + +void ScriptRC03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptRC03::sub_402834() { + Actor_Face_Actor(1, 0, true); + Actor_Says(1, 1820, 3); + Actor_Face_Actor(0, 1, true); + Actor_Says(0, 4815, 14); + Actor_Says(1, 1830, 3); + Actor_Says(1, 1840, 3); + Actor_Says(0, 4820, 12); + Actor_Says(1, 1850, 3); + Actor_Says(1, 1950, 3); + Actor_Says(0, 4835, 14); + Actor_Says(1, 1960, 3); + Actor_Says(1, 1980, 3); + Actor_Says(0, 4840, 15); + Actor_Says(1, 1990, 3); + Actor_Says(1, 2000, 3); +} + +void ScriptRC03::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(7) == 102) { + Scene_Exits_Disable(); + if (Game_Flag_Query(119) ) { + Player_Set_Combat_Mode(false); + Player_Loses_Control(); + Actor_Set_At_XYZ(0, 147.51f, -4.0f, 166.48f, 500); + Actor_Put_In_Set(7, 70); + Actor_Set_At_XYZ(7, 196.0f, -4.0f, 184.0f, 775); + Actor_Face_Actor(7, 0, true); + Actor_Face_Actor(0, 7, true); + Actor_Change_Animation_Mode(7, 4); + Actor_Says_With_Pause(7, 630, 0, -1); + Actor_Says_With_Pause(7, 640, 0, -1); + Actor_Says_With_Pause(7, 650, 0, -1); + if (Game_Flag_Query(44) ) { + Actor_Set_Goal_Number(1, 100); + } + Actor_Change_Animation_Mode(0, 20); + Loop_Actor_Walk_To_XYZ(7, 180.0f, -4.0f, 184.0f, 0, 0, false, 0); + Actor_Change_Animation_Mode(7, 6); + if (!Game_Flag_Query(44)) { + Actor_Set_Goal_Number(1, 100); + } + Player_Gains_Control(); + } else { + Actor_Put_In_Set(7, 70); + Actor_Set_At_XYZ(7, -226.0f, 1.72f, 86.0f, 0); + Actor_Set_Targetable(7, true); + Actor_Set_Goal_Number(7, 110); + } + } + if (Actor_Query_Goal_Number(7) == 103) { + Player_Loses_Control(); + Actor_Set_Goal_Number(1, 200); + Actor_Put_In_Set(1, 70); + if (Game_Flag_Query(119) || Game_Flag_Query(121) ) { + Actor_Set_At_Waypoint(1, 175, 0); + } else { + Actor_Set_At_Waypoint(1, 203, 0); + } + sub_402834(); + Async_Actor_Walk_To_Waypoint(1, 174, 0, 0); + Actor_Set_Goal_Number(7, 200); + Player_Gains_Control(); + } + Game_Flag_Reset(119); + Game_Flag_Reset(117); + Game_Flag_Reset(107); + Game_Flag_Reset(121); + if (Global_Variable_Query(1) == 1 || Global_Variable_Query(1) == 2) { + Actor_Set_Goal_Number(3, 103); + } +} + +void ScriptRC03::PlayerWalkedOut() { + if (Actor_Query_Goal_Number(7) == 199) { + Actor_Set_Goal_Number(7, 198); + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptRC03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/rc04.cpp b/engines/bladerunner/script/rc04.cpp new file mode 100644 index 0000000000..830b7f5893 --- /dev/null +++ b/engines/bladerunner/script/rc04.cpp @@ -0,0 +1,420 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptRC04::InitializeScene() { + Setup_Scene_Information(45.0f, 0.15f, 68.0f, 1018); + Game_Flag_Reset(120); + Scene_Exit_Add_2D_Exit(0, 225, 47, 359, 248, 0); + if (!Game_Flag_Query(289)) { + Actor_Put_In_Set(14, 71); + Actor_Set_At_XYZ(14, -60.0f, -11.0f, 62.0f, 12); + } + if (Game_Flag_Query(289)) { + Actor_Change_Animation_Mode(14, 88); + } + Ambient_Sounds_Add_Looping_Sound(381, 100, 1, 1); + Ambient_Sounds_Add_Sound(82, 5, 30, 10, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(83, 5, 30, 10, 20, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(84, 5, 30, 10, 20, -100, 100, -101, -101, 0, 0); +} + +void ScriptRC04::SceneLoaded() { + Obstacle_Object("Door New 01", true); + Obstacle_Object("GRNDNEON05", true); + Obstacle_Object("GRNDNEON06", true); + Obstacle_Object("GRNDNEON07", true); + Unobstacle_Object("DisplayTrim", true); + Unobstacle_Object("Display01", true); + Actor_Set_Goal_Number(67, 200); +} + +bool ScriptRC04::MouseClick(int x, int y) { + return false; +} + +bool ScriptRC04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +void ScriptRC04::sub_401DF4() { + Dialogue_Menu_Clear_List(); + if (Actor_Clue_Query(0, 11) && !Actor_Clue_Query(0, 62)) { + DM_Add_To_List_Never_Repeat_Once_Selected(580, -1, 4, 9); + } + if (Actor_Clue_Query(0, 5) && !Actor_Clue_Query(0, 11) && !Actor_Clue_Query(0, 62)) { + DM_Add_To_List_Never_Repeat_Once_Selected(590, 6, 5, 3); + } + if (Actor_Clue_Query(0, 57)) { + DM_Add_To_List_Never_Repeat_Once_Selected(600, -1, 3, 7); + DM_Add_To_List_Never_Repeat_Once_Selected(1310, -1, 2, 8); + } + if (Actor_Clue_Query(0, 62) && !Actor_Clue_Query(0, 63)) { + DM_Add_To_List_Never_Repeat_Once_Selected(610, 4, 5, 6); + } + if (!Game_Flag_Query(305)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1280, 1, 2, 3); + } + if (Actor_Clue_Query(0, 110) && !Actor_Clue_Query(14, 110)) { + DM_Add_To_List_Never_Repeat_Once_Selected(620, 1, -1, -1); + } + Dialogue_Menu_Add_DONE_To_List(630); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + + switch (answer) { + case 580: + Actor_Says(0, 4955, 30); + Actor_Says(14, 210, 37); + Actor_Says(14, 220, 37); + Actor_Says(14, 230, 37); + Actor_Says(14, 240, 37); + Actor_Says(0, 4990, 16); + Actor_Says(0, 4995, 11); + Actor_Says(14, 270, 31); + Actor_Says(0, 5005, 16); + Actor_Says(14, 280, 32); + Actor_Says(14, 290, 30); + Actor_Says(14, 300, 33); + Actor_Says(14, 310, 31); + Actor_Says(0, 5010, 11); + Actor_Says(14, 320, 30); + Actor_Says(14, 330, 33); + Actor_Says(14, 340, 37); + Actor_Says(0, 5015, 11); + if (Game_Flag_Query(44)) { + Actor_Says(14, 350, 32); + Actor_Says(14, 360, 33); + Actor_Says(14, 370, 30); + Actor_Says(0, 5020, 16); + Actor_Says(14, 380, 37); + Actor_Says(14, 390, 11); + Actor_Says(14, 400, 37); + Actor_Clue_Acquire(0, 58, 1, 0); + } else { + Actor_Says(14, 410, 11); + Actor_Says(14, 420, 37); + Actor_Says(0, 5025, 16); + Actor_Says(14, 430, 30); + Actor_Says(14, 440, 31); + Actor_Says(14, 450, 32); + Actor_Says(0, 5030, 16); + Actor_Says(14, 460, 37); + Actor_Clue_Acquire(0, 59, 1, 0); + } + return; + case 590: + Actor_Says(0, 4960, 13); + Actor_Says(14, 250, 30); + Actor_Says(14, 260, 33); + Actor_Says(0, 4995, 15); + Actor_Says(14, 270, 32); + Actor_Says(0, 5005, 11); + Actor_Says(14, 280, 33); + Actor_Says(14, 290, 30); + Actor_Says(14, 300, 32); + Actor_Says(14, 310, 37); + Actor_Says(0, 5010, 13); + Actor_Says(14, 320, 37); + Actor_Says(14, 330, 33); + Actor_Says(14, 340, 11); + Actor_Says(0, 5015, 16); + Actor_Modify_Friendliness_To_Other(14, 0, 3); + if (Game_Flag_Query(44)) { + Actor_Says(14, 350, 32); + Actor_Says(14, 360, 30); + Actor_Says(14, 370, 33); + Actor_Says(0, 5020, 15); + Actor_Says(14, 380, 33); + Actor_Says(14, 390, 37); + Actor_Says(14, 400, 32); + Actor_Clue_Acquire(0, 58, 1, 0); + } else { + Actor_Says(14, 410, 32); + Actor_Says(14, 420, 30); + Actor_Says(0, 5025, 13); + Actor_Says(14, 430, 33); + Actor_Says(14, 440, 32); + Actor_Says(14, 450, 37); + Actor_Says(0, 5030, 16); + Actor_Says(14, 460, 30); + Actor_Clue_Acquire(0, 59, 1, 0); + } + break; + case 600: + Actor_Says(0, 4965, 11); + Actor_Says(14, 470, 11); + Actor_Says(0, 5035, 15); + Actor_Says(14, 480, 30); + Actor_Says(14, 490, 31); + Actor_Says(14, 500, 32); + Actor_Says(14, 510, 33); + Actor_Says(14, 520, 34); + Actor_Says(14, 530, 35); + Actor_Says(14, 540, 36); + Actor_Says(0, 5040, 16); + Actor_Says(14, 550, 11); + Actor_Modify_Friendliness_To_Other(14, 0, -6); + break; + case 610: + Actor_Says(0, 4970, 16); + if (Actor_Query_Friendliness_To_Other(14, 0) < 50) { + Actor_Says(14, 700, 11); + Actor_Says(0, 5070, 11); + Actor_Says(14, 710, 11); + Actor_Says(0, 5075, 15); + Actor_Says(14, 720, 30); + Actor_Says(0, 5080, 11); + Actor_Says(14, 730, 37); + Actor_Clue_Acquire(0, 58, 1, 0); + } else { + Actor_Says(14, 560, 37); + Actor_Says(0, 5070, 13); + Actor_Says(14, 570, 36); + Actor_Says(14, 580, 37); + Actor_Says(14, 590, 31); + Actor_Says(14, 600, 32); + Actor_Says(14, 610, 30); + Actor_Says(0, 5050, 16); + Actor_Says(14, 620, 35); + Actor_Says(14, 630, 35); + Actor_Says(0, 5055, 11); + Actor_Says(14, 640, 36); + Actor_Says(14, 650, 35); + Actor_Says(14, 660, 30); + Actor_Says(0, 5060, 13); + Actor_Clue_Acquire(0, 63, 1, 0); + } + break; + case 1280: + Actor_Says(0, 9040, 16); + if (!Game_Flag_Query(305)) { + Actor_Says(14, 2080, 30); + Actor_Says(14, 2090, 37); + Actor_Says(0, 9045, 14); + Actor_Says(14, 2100, 32); + Actor_Says(14, 2110, 37); + Game_Flag_Set(305); + } + Actor_Says(14, 2120, 31); + if (Global_Variable_Query(2) > 40 || Query_Difficulty_Level() == 0) { + Actor_Says(0, 4940, 13); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 40); + } + Item_Pickup_Spin_Effect(995, 405, 192); + Give_McCoy_Ammo(1, 24); + } else { + Actor_Says(0, 125, 13); + Actor_Modify_Friendliness_To_Other(14, 0, -2); + } + break; + case 1310: + Actor_Says(0, 4980, 11); + if (Actor_Query_Friendliness_To_Other(14, 0) > 49) { + Actor_Says(14, 740, 37); + Actor_Says(0, 5085, 16); + Actor_Says(14, 750, 37); + Actor_Says(14, 760, 37); + Voight_Kampff_Activate(14, 50); + Actor_Modify_Friendliness_To_Other(14, 0, 3); + Actor_Says(14, 810, 37); + Actor_Says(0, 5025, 13); + Actor_Says(14, 820, 32); + Actor_Says(0, 5100, 11); + Actor_Says(14, 830, 31); + Actor_Says(14, 840, 35); + } else { + Actor_Says(14, 770, 36); + Actor_Says(14, 780, 36); + Actor_Says(0, 5090, 16); + Actor_Says(14, 790, 36); + Actor_Says(14, 800, 35); + Voight_Kampff_Activate(14, 50); + Actor_Says(14, 810, 30); + Actor_Says(0, 5025, 13); + Actor_Says(14, 820, 31); + Actor_Says(0, 5100, 15); + Actor_Says(14, 830, 34); + Actor_Says(14, 840, 34); + } + break; + case 620: + Actor_Says(0, 4985, 11); + Actor_Says(14, 850, 35); + Actor_Says(0, 5105, 13); + Actor_Says(0, 5110, 11); + Actor_Says(14, 860, 30); + Actor_Says(0, 5115, 16); + Actor_Says(14, 870, 31); + Actor_Says(0, 5120, 15); + Actor_Says(14, 880, 34); + Actor_Clue_Acquire(14, 110, 1, 0); + Actor_Modify_Friendliness_To_Other(14, 0, 8); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Increment(2, 60); + } + break; + case 630: + Actor_Says(0, 1315, 12); + break; + } +} + +bool ScriptRC04::ClickedOnActor(int actorId) { + if (Player_Query_Combat_Mode()) { + return false; + } + if (actorId == 14 && Global_Variable_Query(1) == 2 && !Game_Flag_Query(289)) { + Loop_Actor_Walk_To_Waypoint(0, 104, 0, 0, false); + Actor_Face_Actor(0, 14, true); + if (Game_Flag_Query(287) && !Game_Flag_Query(292) && Actor_Query_Friendliness_To_Other(14, 0) > 45) { + Actor_Says(14, 30, 30); + Actor_Says(0, 4875, 13); + Actor_Says(14, 80, 31); + Actor_Says(0, 4900, 15); + Actor_Says(14, 90, 33); + Actor_Says(14, 100, 34); + Actor_Says(0, 4905, 15); + Game_Flag_Set(292); + } else if (Game_Flag_Query(287) && !Game_Flag_Query(290) && Actor_Query_Friendliness_To_Other(14, 0) < 45) { + Actor_Says(14, 40, 30); + Actor_Says(0, 4880, 13); + Actor_Says(14, 50, 35); + Actor_Says(0, 4875, 16); + Actor_Says(14, 60, 36); + Actor_Says(0, 4890, 13); + Actor_Says(14, 70, 33); + Actor_Says(0, 4895, 16); + Actor_Modify_Friendliness_To_Other(14, 0, -5); + Game_Flag_Set(290); + } else if (Actor_Query_Friendliness_To_Other(14, 0) > 51 && !Game_Flag_Query(717)) { + Actor_Says(14, 1870, 30); + Actor_Says(14, 1880, 30); + Actor_Says(0, 8960, 13); + Actor_Says(14, 1890, 36); + Actor_Says(14, 1900, 35); + Actor_Says(0, 8965, 16); + Actor_Says(14, 1920, 36); + Actor_Says(14, 1930, 33); + Actor_Says(14, 1940, 36); + Actor_Says(14, 1950, 30); + Actor_Says(0, 8970, 13); + Actor_Says(14, 1960, 33); + Actor_Says(14, 1970, 30); + Actor_Says(14, 1980, 36); + Delay(1000); + Actor_Says(14, 2010, 35); + if (Global_Variable_Query(2) > 50 || Query_Difficulty_Level() == 0) { + Actor_Says(0, 8975, 16); + if (Query_Difficulty_Level() != 0) { + Global_Variable_Decrement(2, 50); + } + Delay(3000); + Item_Pickup_Spin_Effect(941, 405, 192); + Actor_Says(14, 2030, 30); + Game_Flag_Set(487); + } else { + Actor_Says(0, 8980, 16); + Actor_Says(14, 2040, 30); + Actor_Says(0, 8985, 15); + Actor_Says(14, 2050, 33); + } + Game_Flag_Set(717); + } else if (Actor_Clue_Query(0, 11) || Actor_Clue_Query(0, 5) || Actor_Clue_Query(0, 62) || Actor_Clue_Query(0, 110) || Actor_Clue_Query(0, 57) || !Game_Flag_Query(305)) { + sub_401DF4(); + } else { + Actor_Says(14, 1820, 30); + } + return true; + } + if (actorId == 14 && Game_Flag_Query(289)) { + Actor_Face_Actor(0, 14, true); + if (Actor_Clue_Query(0, 164)) { + Actor_Says(0, 8590, -1); + } else { + Actor_Voice_Over(2100, 99); + Actor_Voice_Over(2110, 99); + } + return true; + } + return false; +} + +bool ScriptRC04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptRC04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 45.0f, 0.15f, 68.0f, 0, 1, false, 0)) { + Game_Flag_Set(121); + Set_Enter(70, 80); + } + return true; + } + return false; +} + +bool ScriptRC04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptRC04::SceneFrameAdvanced(int frame) { +} + +void ScriptRC04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptRC04::PlayerWalkedIn() { + Loop_Actor_Walk_To_Waypoint(0, 103, 0, 0, false); + if (Global_Variable_Query(1) != 2 || Game_Flag_Query(287) || Player_Query_Combat_Mode()) { + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(289) && !Game_Flag_Query(306)) { + Actor_Says(38, 40, 3); + Actor_Says(14, 890, 37); + Actor_Set_Goal_Number(14, 2); + } + Game_Flag_Set(287); + } else { + Actor_Says(14, 0, 31); + Loop_Actor_Walk_To_Waypoint(0, 104, 0, 0, false); + Actor_Face_Actor(0, 14, true); + Actor_Says(0, 4865, 13); + Actor_Says(14, 10, 32); + Actor_Says(0, 4870, 16); + Actor_Says(14, 20, 31); + Game_Flag_Set(287); + } +} + +void ScriptRC04::PlayerWalkedOut() { + Game_Flag_Reset(303); +} + +void ScriptRC04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/rc51.cpp b/engines/bladerunner/script/rc51.cpp new file mode 100644 index 0000000000..907ffd8ba3 --- /dev/null +++ b/engines/bladerunner/script/rc51.cpp @@ -0,0 +1,130 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptRC51::InitializeScene() { + Setup_Scene_Information(-8.87f, -1238.89f, 108164.27f, 66); + Scene_Exit_Add_2D_Exit(0, 0, 460, 639, 479, 2); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptRC51::SceneLoaded() { + Obstacle_Object("POSTER_2", true); + Obstacle_Object("CURTAIN", true); + Clickable_Object("POSTER_2"); + Unclickable_Object("GRL_DSK"); + Unclickable_Object("GRL_DSKLEG"); + Unclickable_Object("CURTAIN"); + if (!Game_Flag_Query(147)) { + Item_Add_To_World(82, 937, 16, 47.56f, -1238.89f, 108048.61f, 0, 6, 18, false, true, false, true); + } + if (!Game_Flag_Query(148)) { + Item_Add_To_World(79, 933, 16, 67.28f, -1193.38f, 108011.27f, 0, 6, 6, false, true, false, true); + } + if (!Game_Flag_Query(149)) { + Item_Add_To_World(98, 971, 16, -69.65f, -1238.89f, 107995.24f, 256, 18, 18, false, true, false, true); + } +} + +bool ScriptRC51::MouseClick(int x, int y) { + return false; +} + +bool ScriptRC51::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("POSTER_2", objectName)) { + Actor_Face_Object(0, "POSTER_2", true); + Actor_Says(0, 8620, 3); + return true; + } + return false; +} + +bool ScriptRC51::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptRC51::ClickedOnItem(int itemId, bool a2) { + if (itemId == 82 && !Loop_Actor_Walk_To_XYZ(0, 17.97f, -1238.89f, 108053.5f, 0, 1, false, 0)) { + Actor_Face_Item(0, 82, true); + Actor_Clue_Acquire(0, 8, 1, -1); + Item_Remove_From_World(82); + Item_Pickup_Spin_Effect(937, 437, 407); + Actor_Voice_Over(2010, 99); + Game_Flag_Set(147); + return true; + } + if (itemId == 79 && !Loop_Actor_Walk_To_Item(0, 79, 36, 1, false)) { + Actor_Face_Item(0, 79, true); + Actor_Clue_Acquire(0, 6, 1, -1); + Item_Remove_From_World(79); + Item_Pickup_Spin_Effect(933, 445, 230); + Actor_Says(0, 8735, 3); + Actor_Says(0, 8529, 3); + Game_Flag_Set(148); + return true; + } + if (itemId == 98 && !Loop_Actor_Walk_To_Item(0, 98, 36, 1, false)) { + Actor_Face_Item(0, 98, true); + Actor_Clue_Acquire(0, 7, 1, -1); + Item_Remove_From_World(98); + Item_Pickup_Spin_Effect(971, 55, 376); + Actor_Says(0, 8525, 3); + Actor_Says(0, 8740, 3); + Game_Flag_Set(149); + return true; + } + return false; +} + +bool ScriptRC51::ClickedOnExit(int exitId) { + if (exitId == 0 && !Loop_Actor_Walk_To_XYZ(0, -8.87f, -1238.89f, 108173.27f, 0, 1, false, 0)) { + Set_Enter(16, 79); + return true; + } + return false; +} + +bool ScriptRC51::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptRC51::SceneFrameAdvanced(int frame) { +} + +void ScriptRC51::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptRC51::PlayerWalkedIn() { + Game_Flag_Set(709); +} + +void ScriptRC51::PlayerWalkedOut() { +} + +void ScriptRC51::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp new file mode 100644 index 0000000000..cf607a4b47 --- /dev/null +++ b/engines/bladerunner/script/script.cpp @@ -0,0 +1,1433 @@ +/* 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/script/script.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/actor.h" +#include "bladerunner/actor_combat.h" +#include "bladerunner/adq.h" +#include "bladerunner/ambient_sounds.h" +#include "bladerunner/audio_player.h" +#include "bladerunner/audio_speech.h" +#include "bladerunner/crimes_database.h" +#include "bladerunner/combat.h" +#include "bladerunner/gameflags.h" +#include "bladerunner/gameinfo.h" +#include "bladerunner/items.h" +#include "bladerunner/item_pickup.h" +#include "bladerunner/movement_track.h" +#include "bladerunner/settings.h" +#include "bladerunner/set_effects.h" +#include "bladerunner/scene.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/slice_animations.h" +#include "bladerunner/slice_renderer.h" +#include "bladerunner/text_resource.h" +#include "bladerunner/vector.h" +#include "bladerunner/waypoints.h" + +#include "bladerunner/script/ai_00_mccoy.h" +#include "bladerunner/script/aiscript_officer_leroy.h" + +namespace BladeRunner { + +bool Script::open(const Common::String &name) { + delete _currentScript; + + + if (name == "RC01") { _currentScript = new ScriptRC01(_vm); return true; } + if (name == "RC02") { _currentScript = new ScriptRC02(_vm); return true; } + if (name == "RC03") { _currentScript = new ScriptRC03(_vm); return true; } + if (name == "RC04") { _currentScript = new ScriptRC04(_vm); return true; } + if (name == "RC51") { _currentScript = new ScriptRC51(_vm); return true; } + + + return false; +} + +Script::~Script() { + delete _currentScript; +} + +void Script::InitializeScene() { + _inScriptCounter++; + _currentScript->InitializeScene(); + _inScriptCounter--; +} + +void Script::SceneLoaded() { + _inScriptCounter++; + _currentScript->SceneLoaded(); + _inScriptCounter--; +} + +bool Script::MouseClick(int x, int y) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + //MouseX = x; + //MouseY = y; + bool result = _currentScript->MouseClick(x, y); + //SelectedEntity = -1; + _inScriptCounter--; + //MouseX = -1; + //MouseY = -1; + return result; +} + +bool Script::ClickedOn3DObject(const char *objectName, bool a2) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + bool result = _currentScript->ClickedOn3DObject(objectName, a2); + _inScriptCounter--; + return result; +} + +bool Script::ClickedOnActor(int actorId) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + bool result = _currentScript->ClickedOnActor(actorId); + _inScriptCounter--; + return result; +} + +bool Script::ClickedOnItem(int itemId, bool a2) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + bool result = _currentScript->ClickedOnItem(itemId, a2); + _inScriptCounter--; + return result; +} + +bool Script::ClickedOnExit(int exitId) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + bool result = _currentScript->ClickedOnExit(exitId); + _inScriptCounter--; + return result; +} + +bool Script::ClickedOn2DRegion(int region) { + if (_inScriptCounter > 0) + return true; + + _inScriptCounter++; + bool result = _currentScript->ClickedOn2DRegion(region); + _inScriptCounter--; + return result; +} + +void Script::SceneFrameAdvanced(int frame) { + _inScriptCounter++; + _currentScript->SceneFrameAdvanced(frame); + _inScriptCounter--; +} + +void Script::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + _inScriptCounter++; + //TODO remove this check + if(_currentScript) + _currentScript->ActorChangedGoal(actorId, newGoal, oldGoal, currentSet); + _inScriptCounter--; +} + +void Script::PlayerWalkedIn() { + _inScriptCounter++; + _currentScript->PlayerWalkedIn(); + _inScriptCounter--; +} + +void Script::PlayerWalkedOut() { + _inScriptCounter++; + _currentScript->PlayerWalkedOut(); + _inScriptCounter--; +} + +void Script::DialogueQueueFlushed(int a1) { + _inScriptCounter++; + _currentScript->DialogueQueueFlushed(a1); + _inScriptCounter--; +} + +void ScriptBase::Preload(int animationId) { + _vm->_sliceRenderer->preload(animationId); +} + +void ScriptBase::Actor_Put_In_Set(int actorId, int setId) { + _vm->_actors[actorId]->setSetId(setId); +} + +void ScriptBase::Actor_Set_At_XYZ(int actorId, float x, float y, float z, int direction) { + _vm->_actors[actorId]->setAtXYZ(Vector3(x, y, z), direction); +} + +void ScriptBase::Actor_Set_At_Waypoint(int actorId, int waypointId, int angle) { + _vm->_actors[actorId]->setAtWaypoint(waypointId, angle, 0, 0); +} + +bool ScriptBase::Region_Check(int left, int top, int right, int down) { + //TODO: return _vm->_mouse.x >= left && _vm->_mouse.y >= top && _vm->_mouse.x <= right && _vm->_mouse.y <= down; + warning("Region_Check(%d, %d, %d, %d)", left, top, right, down); + return false; +} + +bool ScriptBase::Object_Query_Click(const char *objectName1, const char *objectName2) { + return strcmp(objectName1, objectName2) == 0; +} + +void ScriptBase::Object_Do_Ground_Click() { + //This is not implemented in game + return; +} + +bool ScriptBase::Object_Mark_For_Hot_Mouse(const char *objectName) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return false; + return _vm->_scene->objectSetHotMouse(objectId); +} + +void ScriptBase::Actor_Face_Actor(int actorId, int otherActorId, bool animate) { + _vm->_actors[actorId]->faceActor(otherActorId, animate); +} + +void ScriptBase::Actor_Face_Object(int actorId, const char *objectName, bool animate) { + _vm->_actors[actorId]->faceObject(objectName, animate); +} + +void ScriptBase::Actor_Face_Item(int actorId, int itemId, bool animate) { + _vm->_actors[actorId]->faceItem(itemId, animate); +} + +void ScriptBase::Actor_Face_Waypoint(int actorId, int waypointId, bool animate) { + _vm->_actors[actorId]->faceWaypoint(waypointId, animate); +} + +void ScriptBase::Actor_Face_XYZ(int actorId, float x, float y, float z, bool animate) { + _vm->_actors[actorId]->faceXYZ(x, y, z, animate); +} + +void ScriptBase::Actor_Face_Current_Camera(int actorId, bool animate) { + _vm->_actors[actorId]->faceCurrentCamera(animate); +} + +void ScriptBase::Actor_Face_Heading(int actorId, int heading, bool animate) { + _vm->_actors[actorId]->faceHeading(heading, true); +} + +int ScriptBase::Actor_Query_Friendliness_To_Other(int actorId, int otherActorId) { + return _vm->_actors[actorId]->_friendlinessToOther[otherActorId]; +} + +void ScriptBase::Actor_Modify_Friendliness_To_Other(int actorId, int otherActorId, signed int change) { + _vm->_actors[actorId]->modifyFriendlinessToOther(otherActorId, change); +} + +void ScriptBase::Actor_Set_Friendliness_To_Other(int actorId, int otherActorId, int friendliness) { + _vm->_actors[actorId]->setFriendlinessToOther(otherActorId, friendliness); +} + +void ScriptBase::Actor_Set_Honesty(int actorId, int honesty) { + _vm->_actors[actorId]->setHonesty(honesty); +} + +void ScriptBase::Actor_Set_Intelligence(int actorId, int intelligence) { + _vm->_actors[actorId]->setIntelligence(intelligence); +} + +void ScriptBase::Actor_Set_Stability(int actorId, int stability) { + _vm->_actors[actorId]->setStability(stability); +} + +void ScriptBase::Actor_Set_Combat_Aggressiveness(int actorId, int combatAggressiveness) { + _vm->_actors[actorId]->setCombatAggressiveness(combatAggressiveness); +} + +int ScriptBase::Actor_Query_Current_HP(int actorId) { + return _vm->_actors[actorId]->_currentHP; +} + +int ScriptBase::Actor_Query_Max_HP(int actorId) { + return _vm->_actors[actorId]->_maxHP; +} + +int ScriptBase::Actor_Query_Combat_Aggressiveness(int actorId) { + return _vm->_actors[actorId]->_combatAggressiveness; +} + +int ScriptBase::Actor_Query_Honesty(int actorId) { + return _vm->_actors[actorId]->_honesty; +} + +int ScriptBase::Actor_Query_Intelligence(int actorId) { + return _vm->_actors[actorId]->_intelligence; +} + +int ScriptBase::Actor_Query_Stability(int actorId) { + return _vm->_actors[actorId]->_stability; +} + +void ScriptBase::Actor_Modify_Current_HP(int actorId, signed int change) { + _vm->_actors[actorId]->modifyCurrentHP(change); +} + +void ScriptBase::Actor_Modify_Max_HP(int actorId, signed int change) { + _vm->_actors[actorId]->modifyMaxHP(change); +} + +void ScriptBase::Actor_Modify_Combat_Aggressiveness(int actorId, signed int change) { + _vm->_actors[actorId]->modifyCombatAggressiveness(change); +} + +void ScriptBase::Actor_Modify_Honesty(int actorId, signed int change) { + _vm->_actors[actorId]->modifyHonesty(change); +} + +void ScriptBase::Actor_Modify_Intelligence(int actorId, signed int change) { + _vm->_actors[actorId]->modifyIntelligence(change); +} + +void ScriptBase::Actor_Modify_Stability(int actorId, signed int change) { + _vm->_actors[actorId]->modifyStability(change); +} + +void ScriptBase::Actor_Set_Flag_Damage_Anim_If_Moving(int actorId, bool value) { + _vm->_actors[actorId]->setFlagDamageAnimIfMoving(value); +} + +bool ScriptBase::Actor_Query_Flag_Damage_Anim_If_Moving(int actorId) { + return _vm->_actors[actorId]->getFlagDamageAnimIfMoving(); +} + +void ScriptBase::Actor_Combat_AI_Hit_Attempt(int actorId) { + if (_vm->_actors[actorId]->inCombat()) + _vm->_actors[actorId]->_combatInfo->hitAttempt(); +} + +void ScriptBase::Non_Player_Actor_Combat_Mode_On(int actorId, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14) { + _vm->_actors[actorId]->combatModeOn(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); +} + +void ScriptBase::Non_Player_Actor_Combat_Mode_Off(int actorId) { + _vm->_actors[actorId]->combatModeOff(); +} + +void ScriptBase::Actor_Set_Health(int actorId, int hp, int maxHp) { + _vm->_actors[actorId]->setHealth(hp, maxHp); +} + +void ScriptBase::Actor_Set_Targetable(int actorId, bool targetable) { + _vm->_actors[actorId]->setTargetable(targetable); + +} + +void ScriptBase::Actor_Says(int actorId, int sentenceId, int animationMode){ + _vm->loopActorSpeaking(); + _vm->_adq->flush(1, true); + Actor_Says_With_Pause(actorId, sentenceId, 0.5f, animationMode); +} + +void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause, int animationMode) { + _vm->gameWaitForActive(); + _vm->loopActorSpeaking(); + _vm->_adq->flush(1, true); + + Actor *actor = _vm->_actors[actorId]; + + if(animationMode != -1) { + actor->stopWalking(false); + } + + actor->speechPlay(sentenceId, false); + bool animationModeChanged = false; + if(animationMode >= 0) { + if (actorId != 0) { + actor->changeAnimationMode(animationMode, false); + animationModeChanged = true; + } else if(_vm->_combat->isActive()) { + actor->changeAnimationMode(animationMode, false); + animationModeChanged = true; + } + } + Player_Loses_Control(); + while (_vm->_gameIsRunning) { + _vm->_speechSkipped = false; + _vm->gameTick(); + if (_vm->_speechSkipped || !actor->isSpeeching()) { + actor->speechStop(); + break; + } + } + if (animationModeChanged) { + actor->changeAnimationMode(0, false); + } + + //TODO: sitcom + //if (_vm->isSitcom) + //{ + // int rnd = _vm->random(1, 100); + // if (rnd <= actor::get_unknown3(actor)) + // { + // int soundId = _vm->random(319, 327); + // _vm->_audioPlayer->play(soundId, 40, 0, 0, 50); + // } + //} + if(pause > 0.0f && !_vm->_speechSkipped) { + Delay(pause * 1000); + } + Player_Gains_Control(); +} + +#if 0 +void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { + // Wait for any existing speech to end + _vm->loopActorSpeaking(); + + // TODO: Hack - This needs to go through the actor class + char name[13]; + sprintf(name, "%02d-%04d.AUD", actorId, sentenceId); + _vm->_audioSpeech->playSpeech(name); + + // warning("start voice over loop"); + while (true) + { + _vm->gameTick(); + if (_vm->shouldQuit()) + break; + if (!_vm->_audioSpeech->isPlaying()) + break; + } + // warning("end voice over loop"); +} +#endif + +void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { + _vm->gameWaitForActive(); + _vm->loopActorSpeaking(); + _vm->_adq->flush(1, true); + + Actor *actor = _vm->_actors[actorId]; + + actor->speechPlay(sentenceId, true); + Player_Loses_Control(); + while(_vm->_gameIsRunning) { + _vm->_speechSkipped = false; + _vm->gameTick(); + if(_vm->_speechSkipped || !actor->isSpeeching()) { + actor->speechStop(); + break; + } + } + Player_Gains_Control(); +} + +void ScriptBase::Actor_Start_Speech_Sample(int actorId, int sentenceId) { + _vm->loopActorSpeaking(); + _vm->_actors[actorId]->speechPlay(sentenceId, false); +} + +void ScriptBase::Actor_Start_Voice_Over_Sample(int sentenceId) { + _vm->loopActorSpeaking(); + _vm->_voiceoverActor->speechPlay(sentenceId, true); +} + +int ScriptBase::Actor_Query_Which_Set_In(int actorId) { + return _vm->_actors[actorId]->getSetId(); +} + +bool ScriptBase::Actor_Query_Is_In_Current_Set(int actorId) { + int actorSetId = _vm->_actors[actorId]->getSetId(); + return actorSetId >= 0 && _vm->_scene->getSetId(); +} + +bool ScriptBase::Actor_Query_In_Set(int actorId, int setId) { + return _vm->_actors[actorId]->getSetId() == setId; +} + +int ScriptBase::Actor_Query_Inch_Distance_From_Actor(int actorId, int otherActorId) { + if (_vm->_actors[actorId]->getSetId() != _vm->_actors[otherActorId]->getSetId()) + return 0.0f; + return _vm->_actors[actorId]->distanceFromActor(otherActorId); +} + +int ScriptBase::Actor_Query_Inch_Distance_From_Waypoint(int actorId, int waypointId) { + if (_vm->_actors[actorId]->getSetId() != _vm->_waypoints->getSetId(waypointId)) + return 0; + + float actorX = _vm->_actors[actorId]->getX(); + float actorZ = _vm->_actors[actorId]->getZ(); + float waypointX = _vm->_waypoints->getX(waypointId); + float waypointZ = _vm->_waypoints->getZ(waypointId); + + float distX = actorX - waypointX; + float distZ = actorZ - waypointZ; + + return sqrtf(distX * distX + distZ * distZ); +} + +bool ScriptBase::Actor_Query_In_Between_Two_Actors(int actorId, int otherActor1Id, int otherActor2Id) { + float x1 = _vm->_actors[otherActor1Id]->getX(); + float z1 = _vm->_actors[otherActor1Id]->getZ(); + float x2 = _vm->_actors[otherActor2Id]->getX(); + float z2 = _vm->_actors[otherActor2Id]->getZ(); + return _vm->_sceneObjects->isBetweenTwoXZ(actorId, x1, z1, x2, z1) + || _vm->_sceneObjects->isBetweenTwoXZ(actorId, x1 - 12.0f, z1 - 12.0f, x2 - 12.0f, z2 - 12.0f) + || _vm->_sceneObjects->isBetweenTwoXZ(actorId, x1 + 12.0f, z1 - 12.0f, x2 + 12.0f, z2 - 12.0f) + || _vm->_sceneObjects->isBetweenTwoXZ(actorId, x1 + 12.0f, z1 + 12.0f, x2 + 12.0f, z2 + 12.0f) + || _vm->_sceneObjects->isBetweenTwoXZ(actorId, x1 - 12.0f, z1 + 12.0f, x2 - 12.0f, z2 + 12.0f); +} + +void ScriptBase::Actor_Set_Goal_Number(int actorId, int goalNumber) { + _vm->_actors[actorId]->setGoal(goalNumber); +} + +int ScriptBase::Actor_Query_Goal_Number(int actorId) { + return _vm->_actors[actorId]->getGoal(); +} + +void ScriptBase::Actor_Query_XYZ(int actorId, float *x, float *y, float *z) { + *x = _vm->_actors[actorId]->getX(); + *y = _vm->_actors[actorId]->getY(); + *z = _vm->_actors[actorId]->getZ(); +} + +int ScriptBase::Actor_Query_Facing_1024(int actorId) { + return _vm->_actors[actorId]->getFacing(); +} + +void ScriptBase::Actor_Set_Frame_Rate_FPS(int actorId, int fps) { + _vm->_actors[actorId]->setFPS(fps); +} + +int ScriptBase::Slice_Animation_Query_Number_Of_Frames(int animation) { + return _vm->_sliceAnimations->getFrameCount(animation); +} + +void ScriptBase::Actor_Change_Animation_Mode(int actorId, int animationMode) { + _vm->_actors[actorId]->changeAnimationMode(animationMode, 0); +} + +int ScriptBase::Actor_Query_Animation_Mode(int actorId) { + return _vm->_actors[actorId]->getAnimationMode(); +} + +bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int a3, int a4, bool run) { + //TODO + warning("Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, a3, a4, run); + return false; +} + +bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool run) { + //TODO + warning("Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, a3, a4, run); + return false; +} + +bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int destinationOffset, bool a4, bool run) { + _vm->gameWaitForActive(); + + if(_vm->_walkingActorId == actorId) { + run = true; + } + bool isRunning; + bool result = _vm->_actors[actorId]->loopWalkToSceneObject(objectName, destinationOffset, a4, run, true, &isRunning); + if(isRunning == 1) { + _vm->_walkingActorId = actorId; + } + Global_Variable_Set(37, actorId); + Global_Variable_Set(38, isRunning); + return result; +} + +bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int a4, bool run) { + //TODO + warning("Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, a4, run); + return false; +} + +bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, int a5, bool run, int a7) { + _vm->gameWaitForActive(); + + if(_vm->_walkingActorId == actorId) { + if(a7) { + _vm->_walkingActorId = -1; + } else { + run = true; + } + } + //TODO: + //PlayerActorIdle = 0; + bool isRunning; + bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), destinationOffset, a5, run, 1, &isRunning); + +// if (PlayerActorIdle == 1) { +// result = 1; +// PlayerActorIdle = 0; +// } + if(isRunning) { + _vm->_walkingActorId = actorId; + } + Global_Variable_Set(37, actorId); + Global_Variable_Set(38, isRunning); + return result; +} + +void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int run) { + //TODO + warning("Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run); +} + +void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) { + //TODO + warning("Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run); +} + +void ScriptBase::Actor_Force_Stop_Walking(int actorId) { + //TODO + warning("Loop_Actor_Travel_Stairs(%d)", actorId); +} + +bool ScriptBase::Loop_Actor_Travel_Stairs(int actorId, int a2, int a3, int a4) { + //TODO + warning("Loop_Actor_Travel_Stairs(%d, %d, %d, %d)", actorId, a2, a3, a4); + return false; +} + +bool ScriptBase::Loop_Actor_Travel_Ladder(int actorId, int a2, int a3, int a4) { + //TODO + warning("Loop_Actor_Travel_Ladder(%d, %d, %d, %d)", actorId,a2,a3,a4); + return false; +} + +void ScriptBase::Actor_Clue_Add_To_Database(int actorId, int clueId, int unknown, bool clueAcquired, bool unknownFlag, int fromActorId) { + _vm->_actors[actorId]->addClueToDatabase(clueId, unknown, clueAcquired, unknownFlag, fromActorId); +} + +void ScriptBase::Actor_Clue_Acquire(int actorId, int clueId, byte unknownFlag, int fromActorId) { + _vm->_actors[actorId]->acquireClue(clueId, unknownFlag, fromActorId); +} + +void ScriptBase::Actor_Clue_Lose(int actorId, int clueId) { + _vm->_actors[actorId]->loseClue(clueId); +} + +bool ScriptBase::Actor_Clue_Query(int actorId, int clueId) { + return _vm->_actors[actorId]->hasClue(clueId); +} + +void ScriptBase::Actor_Clues_Transfer_New_To_Mainframe(int actorId) { + _vm->_actors[actorId]->copyClues(99); +} + +void ScriptBase::Actor_Clues_Transfer_New_From_Mainframe(int actorId) { + _vm->_voiceoverActor->copyClues(actorId); +} + +void ScriptBase::Actor_Set_Invisible(int actorId, bool isInvisible) { + _vm->_actors[actorId]->setInvisible(isInvisible); +} + +void ScriptBase::Actor_Set_Immunity_To_Obstacles(int actorId, bool isImmune) { + _vm->_actors[actorId]->setImmunityToObstacles(isImmune); +} + +void ScriptBase::Item_Add_To_World(int itemId, int animationId, int setId, float x, float y, float z, signed int facing, int height, int width, bool isTargetable, bool isObstacle, bool isPoliceMazeEnemy, bool updateOnly) { + _vm->_items->addToWorld(itemId, animationId, setId, Vector3(x, y, z), facing, height, width, isTargetable, isObstacle, isPoliceMazeEnemy, updateOnly == 0); +} + +void ScriptBase::Item_Remove_From_World(int itemId) { + _vm->_items->remove(itemId); +} + +void ScriptBase::Item_Spin_In_World(int itemId) { + warning("Item_Spin_In_World(%d)", itemId); +} + +void ScriptBase::Item_Flag_As_Target(int itemId) { + warning("Item_Flag_As_Target(%d)", itemId); +} + +void ScriptBase::Item_Flag_As_Non_Target(int itemId) { + warning("Item_Flag_As_Non_Target(%d)", itemId); +} + +void ScriptBase::Item_Pickup_Spin_Effect(int animationId, int x, int y) { + _vm->_itemPickup->setup(animationId, x, y); +} + +int ScriptBase::Animation_Open() { + //This is not implemented in game + return -1; +} + +int ScriptBase::Animation_Close() { + //This is not implemented in game + return 0; +} + +int ScriptBase::Animation_Start() { + //This is not implemented in game + return 0; +} + +int ScriptBase::Animation_Stop() { + //This is not implemented in game + return 0; +} + +int ScriptBase::Animation_Skip_To_Frame() { + //This is not implemented in game + return 0; +} + +void ScriptBase::Delay(int miliseconds) { + Player_Loses_Control(); + int endTime = _vm->getTotalPlayTime() + miliseconds; + while ((int)_vm->getTotalPlayTime() < endTime) + _vm->gameTick(); + Player_Gains_Control(); +} + +void ScriptBase::Player_Loses_Control() { + _vm->playerLosesControl(); +} + +void ScriptBase::Player_Gains_Control() { + _vm->playerGainsControl(); +} + +void ScriptBase::Player_Set_Combat_Mode(bool activate) { + if (!_vm->_combat->isActive() || activate) { + if (_vm->_combat->isActive() && activate) { + _vm->_combat->activate(); + } + } else { + _vm->_combat->deactivate(); + } +} + +bool ScriptBase::Player_Query_Combat_Mode() { + return _vm->_combat->isActive(); +} + +void ScriptBase::Player_Set_Combat_Mode_Access(bool enable) { + if (enable) { + _vm->_combat->enable(); + } else { + _vm->_combat->disable(); + } +} + +int ScriptBase::Player_Query_Current_Set() { + return _vm->_scene->getSetId(); +} + +int ScriptBase::Player_Query_Current_Scene() { + return _vm->_scene->getSceneId(); +} + +int ScriptBase::Player_Query_Agenda() { + return _vm->_settings->getPlayerAgenda(); +} + +void ScriptBase::Player_Set_Agenda(int agenda) { + _vm->_settings->setPlayerAgenda(agenda); +} + +int ScriptBase::Query_Difficulty_Level() { + return _vm->_settings->getDifficulty(); +} + + +void ScriptBase::Game_Flag_Set(int flag) { + _vm->_gameFlags->set(flag); +} + +void ScriptBase::Game_Flag_Reset(int flag) { + _vm->_gameFlags->reset(flag); +} + +bool ScriptBase::Game_Flag_Query(int flag) { + return _vm->_gameFlags->query(flag); +} + +void ScriptBase::Set_Enter(int setId, int sceneId) { + _vm->_settings->setNewSetAndScene(setId, sceneId); +} + +void ScriptBase::Chapter_Enter(int chapter, int setId, int sceneId) { + _vm->_settings->setChapter(chapter); + Set_Enter(setId, sceneId); +} + +int ScriptBase::Global_Variable_Set(int var, int value) { + return _vm->_gameVars[var] = value; +} + +int ScriptBase::Global_Variable_Reset(int var) { + return _vm->_gameVars[var] = 0; +} + +int ScriptBase::Global_Variable_Query(int var) { + return _vm->_gameVars[var]; +} + +int ScriptBase::Global_Variable_Increment(int var, int inc) { + return _vm->_gameVars[var] += inc; +} + +int ScriptBase::Global_Variable_Decrement(int var, int dec) { + return _vm->_gameVars[var] -= dec; +} + +int ScriptBase::Random_Query(int min, int max) { + return _vm->_rnd.getRandomNumberRng(min, max); +} + +void ScriptBase::Sound_Play(int id, int volume, int panFrom, int panTo, int priority) { + const char *name = _vm->_gameInfo->getSfxTrack(id); + _vm->_audioPlayer->playAud(name, volume, panFrom, panTo, priority); +} + +void ScriptBase::Sound_Play_Speech_Line(int actorId, int speechId, int a3, int a4, int a5) { + //TODO + warning("Sound_Play_Speech_Line(%d, %d, %d, %d, %d)", actorId, speechId, a3, a4, a5); +} + +void ScriptBase::Sound_Left_Footstep_Walk(int actorId) { + int walkboxId = _vm->_actors[actorId]->getWalkbox(); + if (walkboxId < 0) { + walkboxId = 0; + } + + _vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundWalkLeft(walkboxId); + _vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume(); + _vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance(); +} + +void ScriptBase::Sound_Right_Footstep_Walk(int actorId) { + int walkboxId = _vm->_actors[actorId]->getWalkbox(); + if (walkboxId < 0) { + walkboxId = 0; + } + + _vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundWalkRight(walkboxId); + _vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume(); + _vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance(); +} + +void ScriptBase::Sound_Left_Footstep_Run(int actorId) { + int walkboxId = _vm->_actors[actorId]->getWalkbox(); + if (walkboxId < 0) { + walkboxId = 0; + } + + _vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundRunLeft(walkboxId); + _vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume(); + _vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance(); +} + +void ScriptBase::Sound_Right_Footstep_Run(int actorId) { + int walkboxId = _vm->_actors[actorId]->getWalkbox(); + if (walkboxId < 0) { + walkboxId = 0; + } + + _vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundRunRight(walkboxId); + _vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume(); + _vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance(); +} + +// ScriptBase::Sound_Walk_Shuffle_Stop + +void ScriptBase::Footstep_Sounds_Set(int walkboxId, int stepSound) { + _vm->_scene->_set->setWalkboxStepSound(walkboxId, stepSound); +} + +void ScriptBase::Footstep_Sound_Override_On(int footstepSoundOverride) { + _vm->_scene->_set->setFoodstepSoundOverride(footstepSoundOverride); +} + +void ScriptBase::Footstep_Sound_Override_Off() { + _vm->_scene->_set->resetFoodstepSoundOverride(); +} + +bool ScriptBase::Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { + //TODO + warning("Music_Play(%d, %d, %d, %d, %d, %d, %d)", a1, a2, a3, a4, a5, a6, a7); + return false; +} + +void ScriptBase::Music_Adjust(int a1, int a2, int a3) { + //TODO + warning("Music_Adjust(%d, %d, %d)", a1, a2, a3); +} + +void ScriptBase::Music_Stop(int a1) { + //TODO + warning("Music_Stop(%d)", a1); +} + +bool ScriptBase::Music_Is_Playing() { + //TODO + warning("Music_Is_Playing()"); + return false; +} + +void ScriptBase::Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5) { + //TODO + warning("Overlay_Play(%s, %d, %d, %d, %d)", overlay, a2, a3, a4, a5); +} + +void ScriptBase::Overlay_Remove(const char *overlay) { + //TODO + warning("Overlay_Remove(%s)", overlay); +} + +void ScriptBase::Scene_Loop_Set_Default(int a) { + // debug("Scene_Loop_Set_Default(%d)", a); + + _vm->_scene->loopSetDefault(a); + // _vm->_scene->_defaultLoop = a; +} + +void ScriptBase::Scene_Loop_Start_Special(int a, int b, int c) { + // debug("Scene_Loop_Start_Special(%d, %d, %d)", a, b, c); + + _vm->_scene->loopStartSpecial(a, b, c); + // _vm->_scene->_field_24_loop_start_special_param_1 = a; +} + +void ScriptBase::Outtake_Play(int id, int noLocalization, int container) { + _vm->outtakePlay(id, noLocalization, container); +} + +void ScriptBase::Ambient_Sounds_Add_Sound(int id, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk) { + _vm->_ambientSounds->addSound(id, time1, time2, volume1, volume2, pan1begin, pan1end, pan2begin, pan2end, priority, unk); +} + +void ScriptBase::Ambient_Sounds_Remove_Sound(int id, bool a2) { + //TODO + warning("Ambient_Sounds_Remove_Sound(%d, %d)", id, a2); +} + +void ScriptBase::Ambient_Sounds_Add_Speech_Sound(int id, int unk1, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk2){ + //TODO + warning("Ambient_Sounds_Add_Speech_Sound(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", id, unk1, time1, time2, volume1, volume2, pan1begin, pan1end, pan2begin, pan2end, priority, unk2); +} + +// ScriptBase::Ambient_Sounds_Remove_Speech_Sound + +int ScriptBase::Ambient_Sounds_Play_Sound(int a1, int a2, int a3, int a4, int a5) { + //TODO + warning("Ambient_Sounds_Remove_Sound(%d, %d, %d, %d, %d)", a1, a2, a3, a4, a5); + return -1; +} + +// ScriptBase::Ambient_Sounds_Play_Speech_Sound + +void ScriptBase::Ambient_Sounds_Remove_All_Non_Looping_Sounds(int time) { + //TODO + warning("Ambient_Sounds_Remove_All_Non_Looping_Sounds(%d)", time); + // _vm->_ambientSounds->removeAllNonLoopingSounds(time); +} + +void ScriptBase::Ambient_Sounds_Add_Looping_Sound(int id, int volume, int pan, int fadeInTime) { + _vm->_ambientSounds->addLoopingSound(id, volume, pan, fadeInTime); +} + +void ScriptBase::Ambient_Sounds_Adjust_Looping_Sound(int id, int panBegin, int panEnd, int a4) { + //TODO + warning("Ambient_Sounds_Adjust_Looping_Sound(%d, %d, %d, %d)", id, panBegin, panEnd, a4); +} + +void ScriptBase::Ambient_Sounds_Remove_Looping_Sound(int id, bool a2){ + //TODO + warning("Ambient_Sounds_Remove_Looping_Sound(%d, %d)", id, a2); +} + +void ScriptBase::Ambient_Sounds_Remove_All_Looping_Sounds(int time) { + //TODO + warning("Ambient_Sounds_Remove_All_Looping_Sounds(%d)", time); + // _vm->_ambientSounds->removeAllLoopingSounds(time); +} + +void ScriptBase::Setup_Scene_Information(float actorX, float actorY, float actorZ, int actorFacing) { + _vm->_scene->setActorStart(Vector3(actorX, actorY, actorZ), actorFacing); +} + +bool ScriptBase::Dialogue_Menu_Appear(int x, int y) { + //TODO + warning("Dialogue_Menu_Appear(%d, %d)", x, y); + return false; +} + +bool ScriptBase::Dialogue_Menu_Disappear() { + //TODO + warning("Dialogue_Menu_Disappear()"); + return false; +} + +bool ScriptBase::Dialogue_Menu_Clear_List() { + //TODO + warning("Dialogue_Menu_Clear_List()"); + return false; +} + +bool ScriptBase::Dialogue_Menu_Add_To_List(int answer) { + //TODO + warning("Dialogue_Menu_Add_To_List(%d)", answer); + return false; +} + +bool ScriptBase::Dialogue_Menu_Add_DONE_To_List(int answerValue) { + //TODO + warning("Dialogue_Menu_Add_DONE_To_List(%d)", answerValue); + return false; +} + +// Dialogue_Menu_Add_To_List_Never_Repeat_Once_Selected + +bool ScriptBase::DM_Add_To_List(int answer, int a2, int a3, int a4) { + //TODO + warning("DM_Add_To_List(%d, %d, %d, %d)", answer, a2, a3, a4); + return false; +} + +bool ScriptBase::DM_Add_To_List_Never_Repeat_Once_Selected(int answer, int a2, int a3, int a4) { + //TODO + warning("DM_Add_To_List_Never_Repeat_Once_Selected(%d, %d, %d, %d)", answer, a2, a3, a4); + return false; +} + +void ScriptBase::Dialogue_Menu_Remove_From_List(int answer) { + //TODO + warning("Dialogue_Menu_Remove_From_List(%d)", answer); +} + +int ScriptBase::Dialogue_Menu_Query_Input() { + //TODO + warning("Dialogue_Menu_Query_Input()"); + return 0; +} + +int ScriptBase::Dialogue_Menu_Query_List_Size() { + //TODO + warning("Dialogue_Menu_Query_List_Size()"); + return 0; +} + +void ScriptBase::Scene_Exit_Add_2D_Exit(int index, int left, int top, int right, int down, int type) { + _vm->_scene->_exits->add(index, Common::Rect(left, top, right, down), type); +} + +void ScriptBase::Scene_Exit_Remove(int index) { + _vm->_scene->_exits->remove(index); +} + +void ScriptBase::Scene_Exits_Disable() { + _vm->_scene->_exits->setEnabled(false); +} +void ScriptBase::Scene_Exits_Enable() { + _vm->_scene->_exits->setEnabled(true); +} + +void ScriptBase::Scene_2D_Region_Add(int index, int left, int top, int right, int down) { + _vm->_scene->_regions->add(index, Common::Rect(left, top, right, down), 0); +} + +void ScriptBase::Scene_2D_Region_Remove(int index) { + _vm->_scene->_regions->remove(index); +} + +void ScriptBase::World_Waypoint_Set(int waypointId, int sceneId, float x, float y, float z) { + //TODO + warning("World_Waypoint_Set(%d, %d, %f, %f, %f)", waypointId, sceneId, x, y, z); +} +// ScriptBase::World_Waypoint_Reset + +float ScriptBase::World_Waypoint_Query_X(int waypointId) { + //TODO + warning("World_Waypoint_Query_X(%d)", waypointId); + return 0.0f; +} + +float ScriptBase::World_Waypoint_Query_Y(int waypointId) { + //TODO + warning("World_Waypoint_Query_Y(%d)", waypointId); + return 0.0f; +} + +float ScriptBase::World_Waypoint_Query_Z(int waypointId) { + //TODO + warning("World_Waypoint_Query_Z(%d)", waypointId); + return 0.0f; +} + +void ScriptBase::Combat_Cover_Waypoint_Set_Data(int combatCoverId, int a2, int sceneId, int a4, float x, float y, float z) { + //TODO + warning("Combat_Cover_Waypoint_Set_Data(%d, %d, %d, %d, %f, %f, %f)", combatCoverId, a2, sceneId, a4, x, y, z); +} + +void ScriptBase::Combat_Flee_Waypoint_Set_Data(int combatFleeWaypointId, int a2, int sceneId, int a4, float x, float y, float z, int a8) { + //TODO + warning("Combat_Cover_Waypoint_Set_Data(%d, %d, %d, %d, %f, %f, %f, %d)", combatFleeWaypointId, a2, sceneId, a4, x, y, z, a8); +} + +void ScriptBase::Police_Maze_Target_Track_Add(int itemId, float startX, float startY, float startZ, float endX, float endY, float endZ, int steps, signed int data[], bool a10) { + //TODO + warning("Police_Maze_Target_Track_Add(%d, %f, %f, %f, %f, %f, %f, %d, %p, %d)", itemId, startX, startY, startZ, endX, endY, endZ, steps, (void *)data, a10); + +} + +// ScriptBase::Police_Maze_Query_Score +// ScriptBase::Police_Maze_Zero_Score +// ScriptBase::Police_Maze_Increment_Score +// ScriptBase::Police_Maze_Decrement_Score +// ScriptBase::Police_Maze_Set_Score + +void ScriptBase::Police_Maze_Set_Pause_State(int a1) { + //TODO + warning("Police_Maze_Set_Pause_State(%d)", a1); +} + +void ScriptBase::CDB_Set_Crime(int crimeId, int value) { + _vm->_crimesDatabase->setCrime(crimeId, value); +} + +void ScriptBase::CDB_Set_Clue_Asset_Type(int assetId, int type) { + _vm->_crimesDatabase->setAssetType(assetId, type); +} + +void ScriptBase::SDB_Set_Actor(int suspectId, int actorId) { + _vm->_suspectsDatabase->get(suspectId)->setActor(actorId); +} + +bool ScriptBase::SDB_Add_Photo_Clue(int suspectId, int a2, int a3) { + return _vm->_suspectsDatabase->get(suspectId)->addPhotoClue(a2, a3); +} + +void ScriptBase::SDB_Set_Name(int actorId) { + // not implemented in game +} + +void ScriptBase::SDB_Set_Sex(int suspectId, int sex) { + _vm->_suspectsDatabase->get(suspectId)->setSex(sex); +} + +bool ScriptBase::SDB_Add_Identity_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addIdentityClue(clueId); +} + +bool ScriptBase::SDB_Add_MO_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addMOClue(clueId); +} + +bool ScriptBase::SDB_Add_Whereabouts_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addWhereaboutsClue(clueId); +} + +bool ScriptBase::SDB_Add_Replicant_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addReplicantClue(clueId); +} + +bool ScriptBase::SDB_Add_Non_Replicant_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addNonReplicantClue(clueId); +} + +bool ScriptBase::SDB_Add_Other_Clue(int suspectId, int clueId) { + return _vm->_suspectsDatabase->get(suspectId)->addOtherClue(clueId); +} + +void ScriptBase::Spinner_Set_Selectable_Destination_Flag(int a1, int a2) { + //TODO + warning("Spinner_Set_Selectable_Destination_Flag(%d, %d)", a1, a2); +} + +// ScriptBase::Spinner_Query_Selectable_Destination_Flag + +int ScriptBase::Spinner_Interface_Choose_Dest(int a1, int a2) { + //TODO + warning("Spinner_Interface_Choose_Dest(%d, %d)", a1, a2); + return -1; +} + +// ScriptBase::Spinner_Set_Selectable_Destination_Flag +// ScriptBase::Spinner_Query_Selectable_Destination_Flag +// ScriptBase::Spinner_Interface_Choose_Dest + +void ScriptBase::ESPER_Flag_To_Activate() { + //TODO + warning("ESPER_Flag_To_Activate()"); +} + +bool ScriptBase::Voight_Kampff_Activate(int a1, int a2){ + //TODO + warning("Voight_Kampff_Activate(%d, %d)", a1, a2); + return false; +} + +int ScriptBase::Elevator_Activate(int elevator) { + //TODO + warning("Elevator_Activate(%d)", elevator); + return 0; +} + +void ScriptBase::View_Score_Board() { + //TODO + warning("View_Score_Board()"); +} +// ScriptBase::Query_Score + +void ScriptBase::Set_Score(int a0, int a1) { + // debug("STUB: Set_Score(%d, %d)", a0, a1); +} + +void ScriptBase::Give_McCoy_Ammo(int ammoType, int ammo) { + _vm->_settings->addAmmo(ammoType, ammo); +} + +void ScriptBase::Assign_Player_Gun_Hit_Sounds(int row, int soundId1, int soundId2, int soundId3) { + _vm->_combat->setHitSoundId(row, 0, soundId1); + _vm->_combat->setHitSoundId(row, 1, soundId2); + _vm->_combat->setHitSoundId(row, 2, soundId3); +} + +void ScriptBase::Assign_Player_Gun_Miss_Sounds(int row, int soundId1, int soundId2, int soundId3) { + _vm->_combat->setMissSoundId(row, 0, soundId1); + _vm->_combat->setMissSoundId(row, 1, soundId2); + _vm->_combat->setMissSoundId(row, 2, soundId3); +} + +void ScriptBase::Disable_Shadows(int animationsIdsList[], int listSize) { + _vm->_sliceRenderer->disableShadows(animationsIdsList, listSize); +} + +bool ScriptBase::Query_System_Currently_Loading_Game() { + return _vm->_gameIsLoading; +} + +void ScriptBase::Actor_Retired_Here(int actorId, int width, int height, int retired, int retiredByActorId) { + Actor *actor = _vm->_actors[actorId]; + Vector3 actorPosition; + actor->getXYZ(&actorPosition.x, &actorPosition.y, &actorPosition.z); + actor->retire(retired, width, height, retiredByActorId); + actor->setAtXYZ(actorPosition, actor->getFacing(), true, 0, true); + _vm->_sceneObjects->setRetired(actorId, true); +} + +void ScriptBase::Clickable_Object(const char *objectName) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsClickable(objectId, true, !_vm->_sceneIsLoading); +} + +void ScriptBase::Unclickable_Object(const char *objectName) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsClickable(objectId, false, !_vm->_sceneIsLoading); +} + +void ScriptBase::Obstacle_Object(const char *objectName, bool updateWalkpath) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsObstacle(objectId, true, !_vm->_sceneIsLoading, !_vm->_sceneIsLoading && updateWalkpath); +} + +void ScriptBase::Unobstacle_Object(const char *objectName, bool updateWalkpath) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsObstacle(objectId, false, !_vm->_sceneIsLoading, !_vm->_sceneIsLoading && updateWalkpath); +} + +void ScriptBase::Obstacle_Flag_All_Objects(bool isObstacle) { + _vm->_scene->objectSetIsObstacleAll(isObstacle, !_vm->_sceneIsLoading); +} + +void ScriptBase::Combat_Target_Object(const char *objectName) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsTarget(objectId, true, !_vm->_sceneIsLoading); +} + +void ScriptBase::Un_Combat_Target_Object(const char *objectName) { + int objectId = _vm->_scene->findObject(objectName); + if (objectId == -1) + return; + _vm->_scene->objectSetIsTarget(objectId, true, !_vm->_sceneIsLoading); +} + +void ScriptBase::Set_Fade_Color(float r, float g, float b) { + _vm->_scene->_set->_effects->setFadeColor(r, g, b); +} + +void ScriptBase::Set_Fade_Density(float density) { + _vm->_scene->_set->_effects->setFadeDensity(density); +} + +void ScriptBase::Set_Fog_Color(const char* fogName, float r, float g, float b) { + _vm->_scene->_set->_effects->setFogColor(fogName, r, g, b); +} + +void ScriptBase::Set_Fog_Density(const char* fogName, float density) { + _vm->_scene->_set->_effects->setFogDensity(fogName, density); +} + +void ScriptBase::ADQ_Flush() { + _vm->_adq->flush(0, true); +} + +void ScriptBase::ADQ_Add(int actorId, int sentenceId, int animationMode) { + _vm->_adq->add(actorId, sentenceId, animationMode); +} + +void ScriptBase::ADQ_Add_Pause(int delay) { + _vm->_adq->addPause(delay); +} + +bool ScriptBase::Game_Over() { + _vm->_gameIsRunning = false; + _vm->_gameOver = true; + return true; +} + +void ScriptBase::Autosave_Game(int textId) { + _vm->_gameAutoSave = textId; +} + +void ScriptBase::I_Sez(const char *str) { + _vm->ISez(str); +} + +void ScriptBase::AI_Countdown_Timer_Start(int actorId, signed int timer, int seconds) { +// if (timer >= 0 && timer <= 2) +// _vm->_actors[actorId]->timerSet(timer, 1000 * seconds); +} + +void ScriptBase::AI_Countdown_Timer_Reset(int actorId, int timer) { +// if (timer >= 0 && timer <= 2) +// _vm->_actors[actorId]->timerReset(timer); +} + +void ScriptBase::AI_Movement_Track_Unpause(int actorId) { + //_vm->_actors[actorId]->movementTrackUnpause(); +} + +void ScriptBase::AI_Movement_Track_Pause(int actorId) { + //_vm->_actors[actorId]->movementTrackPause(); +} + +void ScriptBase::AI_Movement_Track_Repeat(int actorId) { + _vm->_actors[actorId]->_movementTrack->repeat(); + //_vm->_actors[actorId]->movementTrackRepeat(1); +} + +void ScriptBase::AI_Movement_Track_Append_Run_With_Facing(int actorId, int waypointId, int delay, int angle) { + _vm->_actors[actorId]->_movementTrack->append(waypointId, delay, angle, 1); +} + +void ScriptBase::AI_Movement_Track_Append_With_Facing(int actorId, int waypointId, int delay, int angle) { + _vm->_actors[actorId]->_movementTrack->append(waypointId, delay, angle, 0); +} + +void ScriptBase::AI_Movement_Track_Append_Run(int actorId, int waypointId, int delay) { + _vm->_actors[actorId]->_movementTrack->append(waypointId, delay, 1); +} + +void ScriptBase::AI_Movement_Track_Append(int actorId, int waypointId, int delay) { + _vm->_actors[actorId]->_movementTrack->append(waypointId, delay, 0); +} + +void ScriptBase::AI_Movement_Track_Flush(int actorId) { + _vm->_actors[actorId]->_movementTrack->flush(); + _vm->_actors[actorId]->stopWalking(false); +} + +void ScriptBase::KIA_Play_Actor_Dialogue(int a1, int a2) { + //TODO + warning("KIA_Play_Actor_Dialogue(%d, %d)", a1, a2); +} + +void ScriptBase::KIA_Play_Slice_Model(int a1) { + //TODO + warning("KIA_Play_Slice_Model(%d)", a1); +} + +void ScriptBase::KIA_Play_Photograph(int a1) { + //TODO + warning("KIA_Play_Photograph(%d)", a1); +} + +void ScriptBase::ESPER_Add_Photo(const char* fileName, int a2, int a3) { + //TODO + warning("ESPER_Add_Photo(%s, %d, %d)", fileName, a2, a3); +} + +void ScriptBase::ESPER_Define_Special_Region(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, const char *name) { + //TODO + warning("ESPER_Define_Special_Region(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %s)", a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, name); +} + +AIScripts::AIScripts(BladeRunnerEngine *vm) : _vm(vm), _inScriptCounter(0) { + for (int i = 0; i != 100; ++i) + _AIScripts[i] = 0; + + _AIScripts[0] = new AIScript_McCoy(_vm); + _AIScripts[23] = new AIScript_Officer_Leroy(_vm); +} + +void AIScripts::Initialize(int actor) { + if (_AIScripts[actor]) + _AIScripts[actor]->Initialize(); +} + +void AIScripts::UpdateAnimation(int actor, int *animation, int *frame) { + _inScriptCounter++; + if (_AIScripts[actor]) + _AIScripts[actor]->UpdateAnimation(animation, frame); + _inScriptCounter--; +} + +void AIScripts::ChangeAnimationMode(int actor, int mode) { + _inScriptCounter++; + if (_AIScripts[actor]) + _AIScripts[actor]->ChangeAnimationMode(mode); + _inScriptCounter--; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h new file mode 100644 index 0000000000..5966b67868 --- /dev/null +++ b/engines/bladerunner/script/script.h @@ -0,0 +1,855 @@ +/* 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_SCRIPT_H +#define BLADERUNNER_SCRIPT_H + +#include "common/str.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ScriptBase { +protected: + BladeRunnerEngine *_vm; + +public: + ScriptBase(BladeRunnerEngine *vm) : _vm(vm) {} + virtual ~ScriptBase() {} + +protected: + void Preload(int animationId); + void Actor_Put_In_Set(int actorId, int set); + void Actor_Set_At_XYZ(int actorId, float x, float y, float z, int direction); + void Actor_Set_At_Waypoint(int actorId, int waypointId, int angle); + bool Region_Check(int left, int top, int right, int down); + bool Object_Query_Click(const char *objectName1, const char *objectName2); + void Object_Do_Ground_Click(); + bool Object_Mark_For_Hot_Mouse(const char *objectName); + void Actor_Face_Actor(int actorId, int otherActorId, bool animate); + void Actor_Face_Object(int actorId, const char *objectName, bool animate); + void Actor_Face_Item(int actorId, int itemId, bool animate); + void Actor_Face_Waypoint(int actorId, int waypointId, bool animate); + void Actor_Face_XYZ(int actorId, float x, float y, float z, bool animate); + void Actor_Face_Current_Camera(int actorId, bool animate); + void Actor_Face_Heading(int actorId, int heading, bool animate); + int Actor_Query_Friendliness_To_Other(int actorId, int otherActorId); + void Actor_Modify_Friendliness_To_Other(int actorId, int otherActorId, signed int change); + void Actor_Set_Friendliness_To_Other(int actorId, int otherActorId, int friendliness); + void Actor_Set_Honesty(int actorId, int honesty); + void Actor_Set_Intelligence(int actorId, int intelligence); + void Actor_Set_Stability(int actorId, int stability); + void Actor_Set_Combat_Aggressiveness(int actorId, int combatAggressiveness); + int Actor_Query_Current_HP(int actorId); + int Actor_Query_Max_HP(int actorId); + int Actor_Query_Combat_Aggressiveness(int actorId); + int Actor_Query_Honesty(int actorId); + int Actor_Query_Intelligence(int actorId); + int Actor_Query_Stability(int actorId); + void Actor_Modify_Current_HP(int actorId, signed int change); + void Actor_Modify_Max_HP(int actorId, signed int change); + void Actor_Modify_Combat_Aggressiveness(int actorId, signed int change); + void Actor_Modify_Honesty(int actorId, signed int change); + void Actor_Modify_Intelligence(int actorId, signed int change); + void Actor_Modify_Stability(int actorId, signed int change); + void Actor_Set_Flag_Damage_Anim_If_Moving(int actorId, bool value); + bool Actor_Query_Flag_Damage_Anim_If_Moving(int actorId); + void Actor_Combat_AI_Hit_Attempt(int actorId); + void Non_Player_Actor_Combat_Mode_On(int actorId, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14); + void Non_Player_Actor_Combat_Mode_Off(int actorId); + void Actor_Set_Health(int actor, int hp, int maxHp); + void Actor_Set_Targetable(int actor, bool targetable); + void Actor_Says(int actorId, int sentenceId, int animationMode); + void Actor_Says_With_Pause(int actorId, int sentenceId, float pause, int animationMode); + void Actor_Voice_Over(int sentenceId, int actorId); + void Actor_Start_Speech_Sample(int actorId, int sentenceId); + void Actor_Start_Voice_Over_Sample(int sentenceId); + int Actor_Query_Which_Set_In(int actorId); + bool Actor_Query_Is_In_Current_Set(int actorId); + bool Actor_Query_In_Set(int actorId, int setId); + int Actor_Query_Inch_Distance_From_Actor(int actorId, int otherActorId); + int Actor_Query_Inch_Distance_From_Waypoint(int actorId, int waypointId); + bool Actor_Query_In_Between_Two_Actors(int actorId, int otherActor1Id, int otherActor2Id); + void Actor_Set_Goal_Number(int actorId, int goalNumber); + int Actor_Query_Goal_Number(int actorId); + void Actor_Query_XYZ(int actorId, float *x, float *y, float *z); + int Actor_Query_Facing_1024(int actorId); + void Actor_Set_Frame_Rate_FPS(int actorId, int fps); + int Slice_Animation_Query_Number_Of_Frames(int animationId); + void Actor_Change_Animation_Mode(int actorId, int animationMode); + int Actor_Query_Animation_Mode(int actorId); + bool Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int a3, int a4, bool running); + bool Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool run); + bool Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int distance, bool a4, bool run); + bool Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int a4, bool run); + bool Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a4, int a5, bool run, int a7); + void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int run); + void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a5, bool run); + void Actor_Force_Stop_Walking(int actorId); + bool Loop_Actor_Travel_Stairs(int actorId, int a2, int a3, int a4); + bool Loop_Actor_Travel_Ladder(int actorId, int a2, int a3, int a4); + void Actor_Clue_Add_To_Database(int actorId, int clueId, int unknown, bool clueAcquired, bool unknownFlag, int fromActorId); + void Actor_Clue_Acquire(int actorId, int clueId, byte unknownFlag, int fromActorId); + void Actor_Clue_Lose(int actorId, int clueId); + bool Actor_Clue_Query(int actorId, int clueId); + void Actor_Clues_Transfer_New_To_Mainframe(int actorId); + void Actor_Clues_Transfer_New_From_Mainframe(int actorId); + void Actor_Set_Invisible(int actorId, bool isInvisible); + void Actor_Set_Immunity_To_Obstacles(int actorId, bool isImmune); + void Item_Add_To_World(int itemId, int animationId, int setId, float x, float y, float z, signed int facing, int height, int width, bool isTargetable, bool isObstacle, bool isPoliceMazeEnemy, bool updateOnly); + void Item_Remove_From_World(int itemId); + void Item_Spin_In_World(int itemId); + void Item_Flag_As_Target(int itemId); + void Item_Flag_As_Non_Target(int itemId); + void Item_Pickup_Spin_Effect(int a1, int a2, int a3); + int Animation_Open(); + int Animation_Close(); + int Animation_Start(); + int Animation_Stop(); + int Animation_Skip_To_Frame(); + void Delay(int miliseconds); + void Player_Loses_Control(); + void Player_Gains_Control(); + void Player_Set_Combat_Mode(bool activate); + bool Player_Query_Combat_Mode(); + void Player_Set_Combat_Mode_Access(bool enable); + int Player_Query_Current_Set(); + int Player_Query_Current_Scene(); + int Player_Query_Agenda(); + void Player_Set_Agenda(int agenda); + int Query_Difficulty_Level(); + void Game_Flag_Set(int flag); + void Game_Flag_Reset(int flag); + bool Game_Flag_Query(int flag); + void Set_Enter(int setId, int sceneId); + void Chapter_Enter(int chapter, int setId, int sceneId); + int Global_Variable_Set(int, int); + int Global_Variable_Reset(int); + int Global_Variable_Query(int); + int Global_Variable_Increment(int, int); + int Global_Variable_Decrement(int, int); + int Random_Query(int min, int max); + void Sound_Play(int id, int volume, int panFrom, int panTo, int priority); + void Sound_Play_Speech_Line(int actorId, int speechId, int a3, int a4, int a5); + void Sound_Left_Footstep_Walk(int actorId); + void Sound_Right_Footstep_Walk(int actorId); + void Sound_Left_Footstep_Run(int actorId); + void Sound_Right_Footstep_Run(int actorId); + // Sound_Walk_Shuffle_Stop + void Footstep_Sounds_Set(int index, int value); + void Footstep_Sound_Override_On(int footstepSoundOverride); + void Footstep_Sound_Override_Off(); + bool Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7); + void Music_Adjust(int a1, int a2, int a3); + void Music_Stop(int a1); + bool Music_Is_Playing(); + void Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5); + void Overlay_Remove(const char *overlay); + void Scene_Loop_Set_Default(int); + void Scene_Loop_Start_Special(int, int, int); + void Outtake_Play(int id, int noLocalization = false, int container = -1); + void Ambient_Sounds_Add_Sound(int id, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk); + void Ambient_Sounds_Remove_Sound(int id, bool a2); + void Ambient_Sounds_Add_Speech_Sound(int id, int unk1, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk2); + // Ambient_Sounds_Remove_Speech_Sound + int Ambient_Sounds_Play_Sound(int a1, int a2, int a3, int a4, int a5); + // Ambient_Sounds_Play_Speech_Sound + void Ambient_Sounds_Remove_All_Non_Looping_Sounds(int time); + void Ambient_Sounds_Add_Looping_Sound(int id, int volume, int pan, int fadeInTime); + void Ambient_Sounds_Adjust_Looping_Sound(int id, int panBegin, int panEnd, int a4); + void Ambient_Sounds_Remove_Looping_Sound(int id, bool a2); + void Ambient_Sounds_Remove_All_Looping_Sounds(int time); + void Setup_Scene_Information(float actorX, float actorY, float actorZ, int actorFacing); + bool Dialogue_Menu_Appear(int x, int y); + bool Dialogue_Menu_Disappear(); + bool Dialogue_Menu_Clear_List(); + bool Dialogue_Menu_Add_To_List(int answer); + bool Dialogue_Menu_Add_DONE_To_List(int answer); + // Dialogue_Menu_Add_To_List_Never_Repeat_Once_Selected + bool DM_Add_To_List(int answer, int a2, int a3, int a4); + bool DM_Add_To_List_Never_Repeat_Once_Selected(int answer, int a2, int a3, int a4); + void Dialogue_Menu_Remove_From_List(int answer); + int Dialogue_Menu_Query_Input(); + int Dialogue_Menu_Query_List_Size(); + void Scene_Exit_Add_2D_Exit(int index, int left, int top, int right, int down, int type); + void Scene_Exit_Remove(int index); + void Scene_Exits_Disable(); + void Scene_Exits_Enable(); + void Scene_2D_Region_Add(int index, int left, int top, int right, int down); + void Scene_2D_Region_Remove(int index); + void World_Waypoint_Set(int waypointId, int sceneId, float x, float y, float z); + // World_Waypoint_Reset + float World_Waypoint_Query_X(int waypointId); + float World_Waypoint_Query_Y(int waypointId); + float World_Waypoint_Query_Z(int waypointId); + void Combat_Cover_Waypoint_Set_Data(int combatCoverId, int a2, int sceneId, int a4, float x, float y, float z); + void Combat_Flee_Waypoint_Set_Data(int combatFleeWaypointId, int a2, int sceneId, int a4, float x, float y, float z, int a8); + void Police_Maze_Target_Track_Add(int itemId, float startX, float startY, float startZ, float endX, float endY, float endZ, int steps, signed int data[], bool a10); + // Police_Maze_Query_Score + // Police_Maze_Zero_Score + // Police_Maze_Increment_Score + // Police_Maze_Decrement_Score + // Police_Maze_Set_Score + void Police_Maze_Set_Pause_State(int a1); + void CDB_Set_Crime(int crimeId, int value); + void CDB_Set_Clue_Asset_Type(int assetId, int type); + void SDB_Set_Actor(int suspectId, int actorId); + bool SDB_Add_Photo_Clue(int suspectId, int a2, int a3); + void SDB_Set_Name(int suspectId); + void SDB_Set_Sex(int suspectId, int sex); + bool SDB_Add_Identity_Clue(int suspectId, int clueId); + bool SDB_Add_MO_Clue(int suspectId, int clueId); + bool SDB_Add_Whereabouts_Clue(int suspectId, int clueId); + bool SDB_Add_Replicant_Clue(int suspectId, int clueId); + bool SDB_Add_Non_Replicant_Clue(int suspectId, int clueId); + bool SDB_Add_Other_Clue(int suspectId, int clueId); + void Spinner_Set_Selectable_Destination_Flag(int a1, int a2); + // Spinner_Query_Selectable_Destination_Flag + int Spinner_Interface_Choose_Dest(int a1, int a2); + void ESPER_Flag_To_Activate(); + bool Voight_Kampff_Activate(int a1, int a2); + int Elevator_Activate(int elevator); + void View_Score_Board(); + // Query_Score + void Set_Score(int a0, int a1); + void Give_McCoy_Ammo(int ammoType, int ammo); + void Assign_Player_Gun_Hit_Sounds(int row, int soundId1, int soundId2, int soundId3); + void Assign_Player_Gun_Miss_Sounds(int row, int soundId1, int soundId2, int soundId3); + void Disable_Shadows(int animationsIdsList[], int listSize); + bool Query_System_Currently_Loading_Game(); + void Actor_Retired_Here(int actorId, int width, int height, int retired, int retiredByActorId); + void Clickable_Object(const char *objectName); + void Unclickable_Object(const char *objectName); + void Obstacle_Object(const char *objectName, bool updateWalkpath); + void Unobstacle_Object(const char *objectName, bool updateWalkpath); + void Obstacle_Flag_All_Objects(bool isObstacle); + void Combat_Target_Object(const char *objectName); + void Un_Combat_Target_Object(const char *objectName); + void Set_Fade_Color(float r, float g, float b); + void Set_Fade_Density(float density); + void Set_Fog_Color(const char* fogName, float r, float g, float b); + void Set_Fog_Density(const char* fogName, float density); + void ADQ_Flush(); + void ADQ_Add(int actorId, int sentenceId, int animationMode); + void ADQ_Add_Pause(int delay); + bool Game_Over(); + void Autosave_Game(int textId); + void I_Sez(const char *str); + + void AI_Countdown_Timer_Start(int actorId, signed int timer, int seconds); + void AI_Countdown_Timer_Reset(int actorId, int timer); + void AI_Movement_Track_Unpause(int actorId); + void AI_Movement_Track_Pause(int actorId); + void AI_Movement_Track_Repeat(int actorId); + void AI_Movement_Track_Append_Run_With_Facing(int actorId, int waypointId, int delay, int angle); + void AI_Movement_Track_Append_With_Facing(int actorId, int waypointId, int delay, int angle); + void AI_Movement_Track_Append_Run(int actorId, int waypointId, int delay); + void AI_Movement_Track_Append(int actorId, int waypointId, int delay); + void AI_Movement_Track_Flush(int actorId); + + void ESPER_Add_Photo(const char* fileName, int a2, int a3); + void ESPER_Define_Special_Region(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, const char *name); + + void KIA_Play_Actor_Dialogue(int a1, int a2); + void KIA_Play_Slice_Model(int a1); + void KIA_Play_Photograph(int a1); + + void VK_Play_Speech_Line(int actorIndex, int a2, float a3); + void VK_Add_Question(int a1, int a2, int a3); + void VK_Subject_Reacts(int a1, int a2, int a3, int a4); + void VK_Eye_Animates(int a1); +}; + +class SceneScriptBase : public ScriptBase { +public: + SceneScriptBase(BladeRunnerEngine *vm) : ScriptBase(vm) {} + + virtual void InitializeScene() = 0; + virtual void SceneLoaded() = 0; + virtual bool MouseClick(int x, int y) = 0; + virtual bool ClickedOn3DObject(const char *objectName, bool a2) = 0; + virtual bool ClickedOnActor(int actorId) = 0; + virtual bool ClickedOnItem(int itemId, bool a2) = 0; + virtual bool ClickedOnExit(int exitId) = 0; + virtual bool ClickedOn2DRegion(int region) = 0; + virtual void SceneFrameAdvanced(int frame) = 0; + virtual void ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) = 0; + virtual void PlayerWalkedIn() = 0; + virtual void PlayerWalkedOut() = 0; + virtual void DialogueQueueFlushed(int a1) = 0; +}; + +/* + * Scene Scripts + */ + +class Script { +public: + BladeRunnerEngine *_vm; + int _inScriptCounter; + SceneScriptBase *_currentScript; + + Script(BladeRunnerEngine *vm) + : _vm(vm), + _inScriptCounter(0), + _currentScript(nullptr) { + } + ~Script(); + + bool open(const Common::String &name); + + void InitializeScene(); + void SceneLoaded(); + bool MouseClick(int x, int y); + bool ClickedOn3DObject(const char *objectName, bool a2); + bool ClickedOnActor(int actorId); + bool ClickedOnItem(int itemId, bool a2); + bool ClickedOnExit(int exitId); + bool ClickedOn2DRegion(int region); + void SceneFrameAdvanced(int frame); + void ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet); + void PlayerWalkedIn(); + void PlayerWalkedOut(); + void DialogueQueueFlushed(int a1); +}; + +#define DECLARE_SCRIPT(name) \ +class Script##name : public SceneScriptBase { \ +public: \ + Script##name(BladeRunnerEngine *vm) \ + : SceneScriptBase(vm) \ + {} \ + void InitializeScene(); \ + void SceneLoaded(); \ + bool MouseClick(int x, int y); \ + bool ClickedOn3DObject(const char *objectName, bool a2); \ + bool ClickedOnActor(int actorId); \ + bool ClickedOnItem(int itemId, bool a2); \ + bool ClickedOnExit(int exitId); \ + bool ClickedOn2DRegion(int region); \ + void SceneFrameAdvanced(int frame); \ + void ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet); \ + void PlayerWalkedIn(); \ + void PlayerWalkedOut(); \ + void DialogueQueueFlushed(int a1); \ +private: +#define END_SCRIPT }; + +DECLARE_SCRIPT(AR01) +END_SCRIPT + +DECLARE_SCRIPT(AR02) + void sub_402694(); + void sub_402AE0(); + void sub_402CE4(); +END_SCRIPT + +DECLARE_SCRIPT(BB01) +END_SCRIPT + +DECLARE_SCRIPT(BB02) +END_SCRIPT + +DECLARE_SCRIPT(BB03) +END_SCRIPT + +DECLARE_SCRIPT(BB04) +END_SCRIPT + +DECLARE_SCRIPT(BB05) +END_SCRIPT + +DECLARE_SCRIPT(BB06) +END_SCRIPT + +DECLARE_SCRIPT(BB07) +END_SCRIPT + +DECLARE_SCRIPT(BB08) +END_SCRIPT + +DECLARE_SCRIPT(BB09) +END_SCRIPT + +DECLARE_SCRIPT(BB10) +END_SCRIPT + +DECLARE_SCRIPT(BB11) +END_SCRIPT + +DECLARE_SCRIPT(BB12) +END_SCRIPT + +DECLARE_SCRIPT(BB51) +END_SCRIPT + +DECLARE_SCRIPT(CT01) + void sub_40269C(); +END_SCRIPT + +DECLARE_SCRIPT(CT02) + void sub_401ACC(); +END_SCRIPT + +DECLARE_SCRIPT(CT03) +END_SCRIPT + +DECLARE_SCRIPT(CT04) + void sub_401D4C(); +END_SCRIPT + +DECLARE_SCRIPT(CT05) +END_SCRIPT + +DECLARE_SCRIPT(CT06) +END_SCRIPT + +DECLARE_SCRIPT(CT07) +END_SCRIPT + +DECLARE_SCRIPT(CT08) +END_SCRIPT + +DECLARE_SCRIPT(CT09) +END_SCRIPT + +DECLARE_SCRIPT(CT10) + void sub_401844(); +END_SCRIPT + +DECLARE_SCRIPT(CT11) +END_SCRIPT + +DECLARE_SCRIPT(CT12) +END_SCRIPT + +DECLARE_SCRIPT(CT51) +END_SCRIPT + +DECLARE_SCRIPT(DR01) +END_SCRIPT + +DECLARE_SCRIPT(DR02) +END_SCRIPT + +DECLARE_SCRIPT(DR03) + void sub_401B18(); +END_SCRIPT + +DECLARE_SCRIPT(DR04) + bool sub_401160(); +END_SCRIPT + +DECLARE_SCRIPT(DR05) +END_SCRIPT + +DECLARE_SCRIPT(DR06) +END_SCRIPT + +DECLARE_SCRIPT(HC01) + void sub_402384(); + void sub_40346C(); +END_SCRIPT + +DECLARE_SCRIPT(HC02) +END_SCRIPT + +DECLARE_SCRIPT(HC03) +END_SCRIPT + +DECLARE_SCRIPT(HC04) + void sub_401B90(); +END_SCRIPT + +DECLARE_SCRIPT(HF01) + void sub_4026B4(); + void sub_4032DC(); + void sub_403484(); +END_SCRIPT + +DECLARE_SCRIPT(HF02) +END_SCRIPT + +DECLARE_SCRIPT(HF03) + void sub_401C80(); +END_SCRIPT + +DECLARE_SCRIPT(HF04) +END_SCRIPT + +DECLARE_SCRIPT(HF05) + void sub_402370(); + void sub_402970(); + void sub_402AE4(); + void sub_403738(); + void sub_403A34(int actorId); + void sub_403F0C(); + void sub_40410C(); + void sub_4042E4(); + void sub_404474(); + int sub_404858(); + int sub_4048C0(); +END_SCRIPT + +DECLARE_SCRIPT(HF06) + void sub_401EF4(); + void sub_4023E0(); +END_SCRIPT + +DECLARE_SCRIPT(HF07) + int sub_401864(); +END_SCRIPT + +DECLARE_SCRIPT(KP01) +END_SCRIPT + +DECLARE_SCRIPT(KP02) +END_SCRIPT + +DECLARE_SCRIPT(KP03) + void sub_401E54(); +END_SCRIPT + +DECLARE_SCRIPT(KP04) +END_SCRIPT + +DECLARE_SCRIPT(KP05) +END_SCRIPT + +DECLARE_SCRIPT(KP06) +END_SCRIPT + +DECLARE_SCRIPT(KP07) +END_SCRIPT + +DECLARE_SCRIPT(MA01) +END_SCRIPT + +DECLARE_SCRIPT(MA02) + void sub_401E4C(); + bool sub_401F7C(); + void sub_402044(); +END_SCRIPT + +//MA03 does not exists + +DECLARE_SCRIPT(MA04) + bool sub_402758(); + bool sub_402820(); + bool sub_402888(); + void sub_4028A8(); + void sub_402F2C(); + void sub_4032A0(); + void sub_4034D8(); + void sub_403864(); + void sub_403DA8(); +END_SCRIPT + +DECLARE_SCRIPT(MA05) + bool sub_401990(); +END_SCRIPT + +DECLARE_SCRIPT(MA06) + bool sub_4012C0(); + void sub_4014E4(); +END_SCRIPT + +DECLARE_SCRIPT(MA07) +END_SCRIPT + +DECLARE_SCRIPT(MA08) +END_SCRIPT + +DECLARE_SCRIPT(NR01) +END_SCRIPT + +DECLARE_SCRIPT(NR02) + void sub_402134(); +END_SCRIPT + +DECLARE_SCRIPT(NR03) + void sub_40259C(int frame); + void sub_402994(); +END_SCRIPT + +DECLARE_SCRIPT(NR04) + void sub_401DB0(); + void sub_402860(int frame); + void sub_402960(); +END_SCRIPT + +DECLARE_SCRIPT(NR05) + void sub_401F74(int frame); + void sub_4020B4(); + void sub_4022DC(); + void sub_402A48(int actorId); + void sub_402B9C(); +END_SCRIPT + +DECLARE_SCRIPT(NR06) + void sub_401BAC(); +END_SCRIPT + +DECLARE_SCRIPT(NR07) + void sub_4018D4(); + void sub_401A10(); + void sub_401C60(); + void sub_401EF4(); + void sub_4020F0(); + void sub_402284(); + void sub_402510(); + void sub_402614(); + void sub_402738(); + void sub_4028FC(); +END_SCRIPT + +DECLARE_SCRIPT(NR08) + void sub_4021B4(); +END_SCRIPT + +DECLARE_SCRIPT(NR09) + void sub_40172C(); +END_SCRIPT + +DECLARE_SCRIPT(NR10) +END_SCRIPT + +DECLARE_SCRIPT(NR11) + void sub_4027D0(int actorId, signed int frame); + void sub_4028EC(); +END_SCRIPT + +DECLARE_SCRIPT(PS01) +END_SCRIPT + +DECLARE_SCRIPT(PS02) + void sub_4018BC(); +END_SCRIPT + +DECLARE_SCRIPT(PS03) +END_SCRIPT + +DECLARE_SCRIPT(PS04) + void sub_4017E4(); +END_SCRIPT + +DECLARE_SCRIPT(PS05) + void sub_401B34(); + void sub_401C30(); +END_SCRIPT + +DECLARE_SCRIPT(PS06) +END_SCRIPT + +DECLARE_SCRIPT(PS07) + void sub_401D60(); +END_SCRIPT + +// PS08 does not exits + +DECLARE_SCRIPT(PS09) + void sub_402090(); +END_SCRIPT + +DECLARE_SCRIPT(PS10) + void sub_402238(); +END_SCRIPT + +DECLARE_SCRIPT(PS11) + void sub_402744(); +END_SCRIPT + +DECLARE_SCRIPT(PS12) + void sub_4028C4(); +END_SCRIPT + +DECLARE_SCRIPT(PS13) + void sub_40267C(); +END_SCRIPT + +DECLARE_SCRIPT(PS14) +END_SCRIPT + +DECLARE_SCRIPT(PS15) +END_SCRIPT + +DECLARE_SCRIPT(RC01) + void sub_403850(); + void sub_4037AC(); +END_SCRIPT + +DECLARE_SCRIPT(RC02) + void sub_402A7C(); +END_SCRIPT + +DECLARE_SCRIPT(RC03) + void sub_402834(); +END_SCRIPT + +DECLARE_SCRIPT(RC04) + void sub_401DF4(); +END_SCRIPT + +DECLARE_SCRIPT(RC51) +END_SCRIPT + +DECLARE_SCRIPT(TB02) + void sub_402644(); + void sub_402B50(); +END_SCRIPT + +DECLARE_SCRIPT(TB03) +END_SCRIPT + +DECLARE_SCRIPT(TB05) +END_SCRIPT + +DECLARE_SCRIPT(TB06) +END_SCRIPT + +DECLARE_SCRIPT(TB07) + void sub_401B0C(); +END_SCRIPT + +DECLARE_SCRIPT(UG01) +END_SCRIPT + +DECLARE_SCRIPT(UG02) + bool sub_402354(); +END_SCRIPT + +DECLARE_SCRIPT(UG03) +END_SCRIPT + +DECLARE_SCRIPT(UG04) +END_SCRIPT + +DECLARE_SCRIPT(UG05) + int sub_4021B0(); + void sub_402218(); +END_SCRIPT + +DECLARE_SCRIPT(UG06) +END_SCRIPT + +DECLARE_SCRIPT(UG07) +END_SCRIPT + +DECLARE_SCRIPT(UG08) +END_SCRIPT + +DECLARE_SCRIPT(UG09) +END_SCRIPT + +DECLARE_SCRIPT(UG10) +END_SCRIPT + +// UG11 does not exists + +DECLARE_SCRIPT(UG12) +END_SCRIPT + +DECLARE_SCRIPT(UG13) + void sub_40223C(); + void sub_4023D8(); + void sub_4025E0(); + void sub_402960(); + int sub_402AD0(); + void sub_402AD4(); + void sub_402E24(); +END_SCRIPT + +DECLARE_SCRIPT(UG14) +END_SCRIPT + +DECLARE_SCRIPT(UG15) +END_SCRIPT + +DECLARE_SCRIPT(UG16) + void sub_401D78(); +END_SCRIPT + +DECLARE_SCRIPT(UG17) +END_SCRIPT + +DECLARE_SCRIPT(UG18) + void sub_402734(); + void sub_402DE8(); + void sub_402F8C(); + void sub_403114(); + void sub_403278(); + void sub_403588(); +END_SCRIPT + +DECLARE_SCRIPT(UG19) +END_SCRIPT + +#undef DECLARE_SCRIPT + +/* + * Actor Scripts + */ + +class AIScriptBase : public ScriptBase { +public: + AIScriptBase(BladeRunnerEngine *vm) : ScriptBase(vm) {} + + virtual void Initialize() = 0; + virtual bool Update() = 0; + virtual void TimerExpired(int timer) = 0; + virtual void CompletedMovementTrack() = 0; + virtual void ReceivedClue(int clueId, int fromActorId) = 0; + virtual void ClickedByPlayer() = 0; + virtual void EnteredScene(int sceneId) = 0; + virtual void OtherAgentEnteredThisScene() = 0; + virtual void OtherAgentExitedThisScene() = 0; + virtual void OtherAgentEnteredCombatMode() = 0; + virtual void ShotAtAndMissed() = 0; + virtual void ShotAtAndHit() = 0; + virtual void Retired(int byActorId) = 0; + virtual void GetFriendlinessModifierIfGetsClue() = 0; + virtual bool GoalChanged(int currentGoalNumber, int newGoalNumber) = 0; + virtual bool UpdateAnimation(int *animation, int *frame) = 0; + virtual bool ChangeAnimationMode(int mode) = 0; + virtual void QueryAnimationState(int *animationState, int *a2, int *a3, int *a4) = 0; + virtual void SetAnimationState(int animationState, int a2, int a3, int a4) = 0; + virtual bool ReachedMovementTrackWaypoint() = 0; +}; + +class AIScripts { +public: + BladeRunnerEngine *_vm; + int _inScriptCounter; + AIScriptBase *_AIScripts[100]; + + AIScripts(BladeRunnerEngine *vm); + ~AIScripts(); + + void Initialize(int actor); + void UpdateAnimation(int actor, int *animation, int *frame); + void ChangeAnimationMode(int actor, int mode); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/script/tb02.cpp b/engines/bladerunner/script/tb02.cpp new file mode 100644 index 0000000000..50f3b9728e --- /dev/null +++ b/engines/bladerunner/script/tb02.cpp @@ -0,0 +1,469 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptTB02::InitializeScene() { + if (Game_Flag_Query(155)) { + Setup_Scene_Information(-152.0f, 0.0f, 1774.0f, 999); + } else if (Game_Flag_Query(95)) { + Setup_Scene_Information(-32.0f, 0.0f, 1578.0f, 639); + } else if (Game_Flag_Query(608)) { + Setup_Scene_Information(-32.0f, 0.0f, 1578.0f, 639); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(27, 0, -1); + Setup_Scene_Information(-304.0f, -81.46f, 1434.0f, 250); + } + if (Global_Variable_Query(1) > 3) { + Scene_Exit_Add_2D_Exit(0, 0, 455, 639, 479, 2); + } + Ambient_Sounds_Add_Looping_Sound(211, 20, 0, 1); + Ambient_Sounds_Add_Sound(212, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(213, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(214, 2, 20, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(215, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(216, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + if (Global_Variable_Query(1) <= 3) { + Ambient_Sounds_Add_Looping_Sound(45, 35, 0, 1); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + } + if (Game_Flag_Query(307) && Global_Variable_Query(1) < 4) { + Scene_Exit_Add_2D_Exit(2, 67, 0, 233, 362, 3); + } + if (Game_Flag_Query(155)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(1); + } + Actor_Put_In_Set(17, 17); + Actor_Set_At_XYZ(17, -38.53f, 2.93f, 1475.97f, 673); + if (Global_Variable_Query(1) == 4) { + if (Actor_Query_Goal_Number(17) < 300) { + Actor_Set_Goal_Number(17, 300); + } + Scene_Exit_Add_2D_Exit(1, 430, 235, 487, 396, 0); + } +} + +void ScriptTB02::SceneLoaded() { + Obstacle_Object("SPHERE02", true); + Unobstacle_Object("BOX36", true); +} + +bool ScriptTB02::MouseClick(int x, int y) { + return Region_Check(600, 300, 639, 479); +} + +bool ScriptTB02::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptTB02::ClickedOnActor(int actorId) { + if (actorId == 17) { + if (!Loop_Actor_Walk_To_XYZ(0, -76.35f, 0.15f, 1564.2f, 0, 1, false, 0)) { + Actor_Face_Actor(0, 17, true); + int v1 = Global_Variable_Query(1); + if (v1 == 2) { + if (Game_Flag_Query(450) && !Game_Flag_Query(451)) { + Actor_Says(0, 5150, 18); + Actor_Says(17, 60, 12); + Actor_Says(17, 70, 13); + Actor_Says(0, 5155, 13); + Actor_Modify_Friendliness_To_Other(17, 0, -1); + return true; + } + if (!Game_Flag_Query(450) && !Game_Flag_Query(451)) { + Game_Flag_Set(450); + Actor_Says(0, 5160, 18); + Actor_Says(17, 80, 14); + Scene_Exit_Add_2D_Exit(1, 430, 235, 487, 396, 0); + return true; + } + if (Game_Flag_Query(451)) { + sub_402644(); + } else { + Actor_Face_Actor(17, 0, true); + Actor_Says(0, 5150, 18); + Actor_Says(17, 60, 13); + Actor_Says(17, 70, 12); + Actor_Says(0, 5155, 13); + Actor_Modify_Friendliness_To_Other(17, 0, -1); + Actor_Face_Heading(17, 788, false); + } + return true; + } + if (v1 == 3) { + Actor_Says(0, 5235, 18); + Actor_Says(17, 280, 13); + Actor_Says(17, 290, 12); + Actor_Says(0, 5240, 18); + Actor_Says(17, 300, 12); + return false; + } + if (v1 == 4) { + if (Actor_Query_Goal_Number(17) == 300) { + Actor_Set_Goal_Number(17, 301); + } + } + } + } + return false; +} + +bool ScriptTB02::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptTB02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -152.0f, 0.0f, 1774.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(154); + Game_Flag_Reset(450); + Set_Enter(17, 83); + Async_Actor_Walk_To_XYZ(0, -152.0f, 0.0f, 1890.0f, 0, false); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -32.0f, 0.0f, 1578.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (Global_Variable_Query(1) < 4) { + Game_Flag_Set(451); + Game_Flag_Set(96); + Set_Enter(72, 84); + } else { + Set_Enter(18, 108); + } + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -192.0f, 0.0f, 1430.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 800, false); + Loop_Actor_Travel_Stairs(0, 9, 0, 0); + if (Actor_Query_Goal_Number(17) == 300) { + Actor_Set_Goal_Number(17, 301); + } else { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + Game_Flag_Reset(257); + Game_Flag_Reset(261); + Game_Flag_Reset(450); + switch (Spinner_Interface_Choose_Dest(-1, 0)) { + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(307); + Game_Flag_Set(256); + Set_Enter(37, 34); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(307); + Game_Flag_Set(255); + Set_Enter(54, 54); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(307); + Game_Flag_Set(254); + Set_Enter(20, 2); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(307); + Game_Flag_Set(253); + Set_Enter(7, 25); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(307); + Game_Flag_Set(252); + Set_Enter(0, 0); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(307); + Game_Flag_Set(248); + Set_Enter(4, 13); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(307); + Game_Flag_Set(249); + Set_Enter(69, 78); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(307); + Game_Flag_Set(250); + Set_Enter(49, 48); + break; + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(307); + Game_Flag_Set(251); + Set_Enter(61, 65); + break; + default: + Game_Flag_Set(261); + break; + } + } + } + return true; + } + return false; +} + +bool ScriptTB02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptTB02::SceneFrameAdvanced(int frame) { +} + +void ScriptTB02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptTB02::PlayerWalkedIn() { + if (Game_Flag_Query(625) && ((Game_Flag_Reset(625) , Global_Variable_Query(1) == 2) || Global_Variable_Query(1) == 3)) { + Set_Enter(18, 108); + //return true; + return; + } + if (Game_Flag_Query(155)) { + Async_Actor_Walk_To_XYZ(0, -152.0f, 0.0f, 1702.0f, 0, false); + Game_Flag_Reset(155); + } else if (Game_Flag_Query(95)) { + Game_Flag_Reset(95); + } else if (Game_Flag_Query(608)) { + Game_Flag_Reset(608); + if (Actor_Query_Goal_Number(17) == 300) { + Actor_Set_Goal_Number(17, 302); + } + Music_Play(1, 50, 0, 2, -1, 0, 0); + } else { + Loop_Actor_Travel_Stairs(0, 9, 1, 0); + Loop_Actor_Walk_To_XYZ(0, -140.0f, 0.79f, 1470.0f, 0, 0, false, 0); + } + int v0 = Global_Variable_Query(1); + if (v0 > 4) { + //return false; + return; + } + if (v0 == 2) { + if (!Game_Flag_Query(453)) { + Player_Loses_Control(); + Actor_Says(0, 5125, 18); + Actor_Says(17, 0, 50); + Actor_Says(0, 5130, 13); + Actor_Says(17, 10, 15); + Item_Pickup_Spin_Effect(975, 351, 315); + Actor_Says(17, 20, 23); + Actor_Says(0, 5140, 17); + Actor_Says(17, 30, 14); + Actor_Says(17, 40, 13); + Loop_Actor_Walk_To_XYZ(0, -140.0f, 0.0f, 1586.0f, 12, 0, false, 0); + Loop_Actor_Walk_To_XYZ(0, -112.0f, 0.0f, 1586.0f, 12, 0, false, 0); + Actor_Face_Actor(0, 17, true); + Actor_Face_Actor(17, 0, true); + Actor_Says(0, 5145, 13); + Actor_Says(17, 50, 15); + Actor_Face_Heading(17, 788, false); + Actor_Clue_Acquire(0, 45, 1, -1); + Game_Flag_Set(453); + Game_Flag_Set(450); + Player_Gains_Control(); + Loop_Actor_Walk_To_XYZ(0, -138.17f, 0.15f, 1578.32f, 0, 1, false, 0); + } + if (Game_Flag_Query(450)) { + Scene_Exit_Add_2D_Exit(1, 430, 235, 487, 396, 0); + } + if (Game_Flag_Query(451) && !Game_Flag_Query(450)) { + Actor_Says(17, 90, 18); + Game_Flag_Set(450); + Scene_Exit_Add_2D_Exit(1, 430, 235, 487, 396, 0); + } + if (Game_Flag_Query(451) && !Game_Flag_Query(456)) { + Loop_Actor_Walk_To_Actor(1, 0, 36, 1, false); + Actor_Says(1, 2220, 14); + Actor_Says(0, 5245, 13); + Actor_Says(1, 2230, 12); + Actor_Says(1, 2240, 13); + sub_402B50(); + //return true; + } + //return false; + return; + } + if (v0 == 3 && !Game_Flag_Query(455)) { + Loop_Actor_Walk_To_XYZ(0, -131.28f, 0.79f, 1448.25f, 12, 1, false, 0); + Actor_Says(17, 260, 15); + Actor_Says(0, 5225, 16); + Actor_Says(17, 270, 14); + Game_Flag_Set(455); + Actor_Modify_Friendliness_To_Other(17, 0, -1); + } + //return false; +} + +void ScriptTB02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptTB02::DialogueQueueFlushed(int a1) { +} + +void ScriptTB02::sub_402644() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(700, 4, 5, 6); + if (Actor_Clue_Query(0, 44)) { + DM_Add_To_List_Never_Repeat_Once_Selected(710, 5, 5, 4); + } + if (Actor_Clue_Query(0, 50) || Actor_Clue_Query(0, 51)) { + DM_Add_To_List_Never_Repeat_Once_Selected(720, 3, 5, 5); + } + if (Actor_Clue_Query(0, 51)) { + DM_Add_To_List_Never_Repeat_Once_Selected(730, 3, 4, 8); + } + Dialogue_Menu_Add_DONE_To_List(100); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 100: + Actor_Says(0, 5145, 13); + Actor_Says(17, 50, 15); + break; + case 730: + Actor_Says(0, 5180, 16); + Actor_Says(17, 240, 12); + Actor_Says(0, 5215, 18); + Actor_Says(17, 250, 13); + Actor_Says(0, 5220, 16); + break; + case 720: + Actor_Says(0, 5175, 12); + Actor_Says(17, 210, 14); + Actor_Says(0, 5200, 13); + Actor_Says(17, 220, 13); + Actor_Says(0, 5205, 15); + Actor_Says(17, 230, 12); + Actor_Says(0, 5210, 12); + break; + case 710: + Actor_Says(0, 5170, 12); + Actor_Says(17, 180, 12); + Actor_Says(17, 190, 14); + if (Game_Flag_Query(102)) { + Actor_Says(0, 5195, 13); + Actor_Says(17, 200, 13); + } + break; + case 700: + Actor_Says(0, 5165, 11); + Actor_Says(17, 100, 13); + Actor_Says(17, 110, 12); + Actor_Says(0, 5185, 15); + Actor_Says(17, 120, 12); + Actor_Says(17, 130, 14); + Actor_Says(0, 5190, 16); + Actor_Says(17, 140, 13); + Actor_Says(17, 150, 14); + Actor_Says(17, 170, 12); + Actor_Clue_Acquire(0, 50, 1, 17); + break; + } +} + +void ScriptTB02::sub_402B50() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(740, 4, 5, 6); + DM_Add_To_List_Never_Repeat_Once_Selected(750, 3, 5, 5); + Dialogue_Menu_Add_DONE_To_List(100); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 740: + Actor_Says(0, 5250, 15); + if (Game_Flag_Query(48)) { + Actor_Says(1, 2250, 12); + Actor_Says(1, 2260, 13); + Actor_Says(0, 5265, 12); + Actor_Says(1, 2270, 16); + Actor_Says(1, 2280, 13); + Actor_Says(0, 5270, 16); + Actor_Says(1, 2290, 14); + Actor_Clue_Acquire(0, 52, 1, 1); + Actor_Modify_Friendliness_To_Other(1, 0, 1); + Game_Flag_Set(456); + } else { + Actor_Says(1, 2300, 12); + Actor_Says(1, 2310, 15); + Actor_Says(0, 5275, 14); + Actor_Says(1, 2320, 12); + Actor_Says(0, 5280, 13); + Actor_Modify_Friendliness_To_Other(1, 0, 1); + Game_Flag_Set(456); + } + break; + case 750: + Actor_Says(0, 5255, 11); + Actor_Says(1, 2330, 13); + Actor_Says(1, 2340, 14); + Game_Flag_Set(456); + break; + case 100: + Actor_Says(1, 2350, 13); + Actor_Modify_Friendliness_To_Other(1, 0, -5); + Game_Flag_Set(456); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/tb03.cpp b/engines/bladerunner/script/tb03.cpp new file mode 100644 index 0000000000..5a2996f6d9 --- /dev/null +++ b/engines/bladerunner/script/tb03.cpp @@ -0,0 +1,155 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptTB03::InitializeScene() { + if (Game_Flag_Query(448)) { + Setup_Scene_Information(-260.0f, 0.15f, 2014.0f, 276); + } else { + Setup_Scene_Information(-152.0f, 0.0f, 1890.0f, 500); + } + Scene_Exit_Add_2D_Exit(0, 25, 227, 81, 300, 0); + Scene_Exit_Add_2D_Exit(1, 298, 0, 639, 305, 0); + Ambient_Sounds_Add_Looping_Sound(211, 16, 0, 1); + Ambient_Sounds_Add_Sound(212, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(213, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(214, 2, 20, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(215, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(216, 2, 15, 16, 20, 0, 0, -101, -101, 0, 0); + if (Global_Variable_Query(1) <= 3) { + Ambient_Sounds_Add_Looping_Sound(45, 25, 0, 1); + Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); + } + Actor_Put_In_Set(17, 17); + Actor_Set_At_XYZ(17, -38.53f, 2.93f, 1475.97f, 673); + if (Global_Variable_Query(1) == 4) { + int goal = Actor_Query_Goal_Number(17); + if (goal == 304) { + Actor_Change_Animation_Mode(17, 0); + Actor_Set_Goal_Number(24, 399); + } else if (goal != 302) { + Actor_Set_Goal_Number(17, 300); + } + } + if (Game_Flag_Query(448)) { + if (Game_Flag_Query(549)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + Game_Flag_Set(549); + } + Game_Flag_Reset(448); + } else { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } +} + +void ScriptTB03::SceneLoaded() { + Obstacle_Object("SPHERE02", true); +} + +bool ScriptTB03::MouseClick(int x, int y) { + return false; +} + +bool ScriptTB03::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptTB03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptTB03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptTB03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -260.0f, 0.15f, 2014.0f, 0, 1, false, 0)) { + Actor_Set_Goal_Number(17, 304); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(447); + Set_Enter(88, 101); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -152.0f, 0.0f, 1774.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(155); + Set_Enter(17, 82); + Async_Actor_Walk_To_XYZ(0, -152.0f, 0.0f, 1702.0f, 0, false); + } + return true; + } + return false; +} + +bool ScriptTB03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptTB03::SceneFrameAdvanced(int frame) { +} + +void ScriptTB03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptTB03::PlayerWalkedIn() { + if (Actor_Query_Goal_Number(17) == 304) { + Player_Set_Combat_Mode(false); + Actor_Says(24, 260, -1); + Actor_Says(0, 170, 14); + Delay(1000); + Actor_Set_Goal_Number(0, 500); + } +} + +void ScriptTB03::PlayerWalkedOut() { + Music_Stop(2); +} + +void ScriptTB03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/tb05.cpp b/engines/bladerunner/script/tb05.cpp new file mode 100644 index 0000000000..e61fec4a2d --- /dev/null +++ b/engines/bladerunner/script/tb05.cpp @@ -0,0 +1,197 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptTB05::InitializeScene() { + if (Game_Flag_Query(98)) { + Setup_Scene_Information(23.0f, 151.53f, -205.0f, 450); + Game_Flag_Set(102); + Game_Flag_Reset(98); + } else { + Setup_Scene_Information(14.0f, 151.53f, -77.0f, 6); + } + Scene_Exit_Add_2D_Exit(0, 62, 193, 206, 419, 0); + Scene_Exit_Add_2D_Exit(1, 0, 455, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(236, 100, 0, 1); + Ambient_Sounds_Add_Looping_Sound(237, 100, 0, 1); + Ambient_Sounds_Add_Sound(217, 5, 30, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(218, 5, 30, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(219, 5, 30, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(220, 5, 30, 25, 33, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(146, 2, 30, 20, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(147, 2, 30, 20, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(148, 2, 30, 20, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(149, 2, 30, 20, 25, 0, 0, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(151, 2, 30, 20, 25, 0, 0, -101, -101, 0, 0); + Scene_Loop_Set_Default(0); +} + +void ScriptTB05::SceneLoaded() { + Clickable_Object("MONITOR05"); + Unclickable_Object("SMUDGE_GLASS01"); + if (!Actor_Clue_Query(0, 44)) { + Item_Add_To_World(76, 940, 72, 76.160004f, 147.36f, -235.14999f, 0, 6, 6, false, true, false, true); + } + if (!Actor_Clue_Query(0, 54) && !Actor_Clue_Query(0, 55) && (Game_Flag_Query(45) || Game_Flag_Query(46))) { + Item_Add_To_World(119, 972, 72, 129.00999f, 147.12f, -162.98f, 0, 8, 8, false, true, false, true); + } +} + +bool ScriptTB05::MouseClick(int x, int y) { + return false; +} + +bool ScriptTB05::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("MONITOR05", objectName) && !Loop_Actor_Walk_To_XYZ(0, 122.54f, 147.12f, -197.17f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 38, false); + if (!Actor_Clue_Query(0, 152) && !Game_Flag_Query(99)) { + Actor_Clue_Acquire(0, 51, 1, -1); + Actor_Voice_Over(2170, 99); + Actor_Voice_Over(2180, 99); + Actor_Voice_Over(2190, 99); + Actor_Voice_Over(2200, 99); + Game_Flag_Set(99); + return true; + } + if (Game_Flag_Query(99) && !Game_Flag_Query(100) && !Actor_Clue_Query(0, 152)) { + if (Actor_Clue_Query(0, 65) || Actor_Clue_Query(0, 262)) { + Actor_Clue_Acquire(0, 152, 1, -1); + Actor_Voice_Over(2230, 99); + Item_Pickup_Spin_Effect(941, 352, 333); + Actor_Voice_Over(2240, 99); + Actor_Voice_Over(2250, 99); + Actor_Voice_Over(2260, 99); + Game_Flag_Set(100); + Game_Flag_Set(101); + } else { + Actor_Voice_Over(2270, 99); + Game_Flag_Set(100); + } + return true; + } + if (Game_Flag_Query(100) && !Game_Flag_Query(101)) { + if (Actor_Clue_Query(0, 65) || Actor_Clue_Query(0, 262)) { + Actor_Clue_Acquire(0, 152, 1, -1); + Actor_Voice_Over(2230, 99); + Item_Pickup_Spin_Effect(941, 352, 333); + Actor_Voice_Over(2240, 99); + Actor_Voice_Over(2250, 99); + Actor_Voice_Over(2260, 99); + Game_Flag_Set(101); + } else { + Actor_Voice_Over(2280, 99); + Actor_Voice_Over(2290, 99); + Game_Flag_Set(101); + } + return true; + } + if (Game_Flag_Query(101)) { + Actor_Voice_Over(3700, 99); + return true; + } + return false; + } + return false; +} + +bool ScriptTB05::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptTB05::ClickedOnItem(int itemId, bool a2) { + if (itemId == 76 && !Loop_Actor_Walk_To_XYZ(0, 54.0f, 147.12f, -209.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 126, false); + Item_Remove_From_World(76); + Item_Pickup_Spin_Effect(940, 295, 408); + Actor_Voice_Over(2140, 99); + Actor_Voice_Over(2150, 99); + Actor_Voice_Over(2160, 99); + Actor_Clue_Acquire(0, 44, 1, -1); + return true; + } + if (itemId == 119 && !Loop_Actor_Walk_To_XYZ(0, 107.89f, 147.12f, -156.26f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 126, false); + Item_Remove_From_World(119); + Item_Pickup_Spin_Effect(972, 449, 431); + Actor_Voice_Over(4280, 99); + if (Game_Flag_Query(45)) { + Actor_Voice_Over(4290, 99); + Actor_Clue_Acquire(0, 54, 1, -1); + } else { + Actor_Voice_Over(4300, 99); + Actor_Clue_Acquire(0, 55, 1, -1); + } + } + return false; +} + +bool ScriptTB05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 23.0f, 151.53f, -205.0f, 12, 1, false, 0)) { + Game_Flag_Set(97); + Set_Enter(73, 85); + Scene_Loop_Start_Special(1, 2, 1); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 14.0f, 147.12f, 123.0f, 0, 1, false, 0)) { + Game_Flag_Set(95); + Set_Enter(17, 82); + } + return true; + } + return false; +} + +bool ScriptTB05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptTB05::SceneFrameAdvanced(int frame) { + if (frame == 61) { + Sound_Play(150, Random_Query(52, 52), 0, 0, 50); + } + if (frame == 63) { + Sound_Play(283, Random_Query(55, 55), 0, 0, 50); + } + //return true; +} + +void ScriptTB05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptTB05::PlayerWalkedIn() { +} + +void ScriptTB05::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptTB05::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/tb06.cpp b/engines/bladerunner/script/tb06.cpp new file mode 100644 index 0000000000..d266e52b28 --- /dev/null +++ b/engines/bladerunner/script/tb06.cpp @@ -0,0 +1,192 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptTB06::InitializeScene() { + Setup_Scene_Information(-16.0f, 149.0f, -466.0f, 990); + Scene_Exit_Add_2D_Exit(0, 330, 195, 417, 334, 0); + Ambient_Sounds_Add_Looping_Sound(236, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(237, 50, 0, 1); + Ambient_Sounds_Add_Looping_Sound(285, 66, 0, 1); + if (Game_Flag_Query(103)) { + Scene_Loop_Set_Default(0); + //return false; + return; + } else { + Actor_Put_In_Set(21, 73); + Actor_Set_At_XYZ(21, 135.0f, 151.0f, -671.0f, 800); + Actor_Retired_Here(21, 60, 32, 1, -1); + //return true; + return; + } +} + +void ScriptTB06::SceneLoaded() { + Obstacle_Object("DOOR", true); + Unobstacle_Object("GLASS01", true); + Clickable_Object("DOOR"); + Unclickable_Object("SMUDGE_GLASS01"); + if (!Game_Flag_Query(519) && Actor_Query_Goal_Number(37) != 199) { + Item_Add_To_World(84, 942, 73, 36.54f, 149.48f, -565.67f, 0, 6, 6, false, true, false, true); + } + if (!Game_Flag_Query(520)) { + Item_Add_To_World(108, 955, 73, 18.0f, 149.65f, -599.0f, 0, 6, 6, false, true, false, true); + } + if (Actor_Query_Goal_Number(37) != 199) { + Item_Add_To_World(103, 978, 73, -46.82f, 149.6f, -666.88f, 0, 12, 12, false, true, false, true); + Item_Add_To_World(104, 979, 73, -30.27f, 149.6f, -610.7f, 0, 15, 45, false, true, false, true); + Item_Add_To_World(105, 980, 73, 9.87f, 149.6f, -683.5f, 0, 12, 12, false, true, false, true); + } +} + +bool ScriptTB06::MouseClick(int x, int y) { + return false; +} + +bool ScriptTB06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptTB06::ClickedOnActor(int actorId) { + if (actorId == 21 && !Loop_Actor_Walk_To_Actor(0, 21, 24, 1, false)) { + if (Actor_Clue_Query(0, 49)) { + Actor_Says(0, 8665, 13); + return false; + } + Actor_Voice_Over(2300, 99); + Actor_Voice_Over(2310, 99); + Item_Pickup_Spin_Effect(974, 66, 397); + Actor_Voice_Over(2320, 99); + if (Game_Flag_Query(48)) { + Actor_Voice_Over(2330, 99); + Actor_Voice_Over(2340, 99); + } + Actor_Voice_Over(2350, 99); + Actor_Clue_Acquire(0, 49, 1, -1); + return true; + } + return false; +} + +bool ScriptTB06::ClickedOnItem(int itemId, bool a2) { + if (itemId == 84 && !Loop_Actor_Walk_To_Item(0, 84, 12, 1, false)) { + Actor_Face_Item(0, 84, true); + Actor_Clue_Acquire(0, 65, 1, -1); + Item_Pickup_Spin_Effect(942, 341, 368); + Item_Remove_From_World(84); + Actor_Voice_Over(4160, 99); + Game_Flag_Set(519); + return true; + } + if (itemId == 108 && !Loop_Actor_Walk_To_Item(0, 108, 12, 1, false)) { + Actor_Face_Item(0, 108, true); + Actor_Clue_Acquire(0, 53, 1, -1); + Item_Remove_From_World(108); + Item_Pickup_Spin_Effect(955, 390, 368); + Actor_Says(0, 8775, 3); + Game_Flag_Set(520); + return true; + } + if (itemId == 82 && !Loop_Actor_Walk_To_Item(0, 82, 12, 1, false)) { + Actor_Face_Item(0, 82, true); + Actor_Says(0, 5285, 3); + return true; + } + if ((itemId == 103 || itemId == 104 || itemId == 105) && !Loop_Actor_Walk_To_Item(0, 103, 24, 1, false)) { + Actor_Face_Item(0, 103, true); + Actor_Voice_Over(2380, 99); + Actor_Voice_Over(2390, 99); + Actor_Voice_Over(2400, 99); + return true; + } + return false; +} + +bool ScriptTB06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -16.0f, 149.0f, -427.0f, 12, 1, false, 0)) { + Game_Flag_Set(98); + Set_Enter(72, 84); + Scene_Loop_Start_Special(1, 2, 1); + } + return true; + } + return false; +} + +bool ScriptTB06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptTB06::SceneFrameAdvanced(int frame) { + if (frame == 61) { + Sound_Play(150, Random_Query(52, 52), 0, 0, 50); + } + if (frame == 63) { + Sound_Play(283, Random_Query(55, 55), 0, 0, 50); + } + //return true; +} + +void ScriptTB06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptTB06::PlayerWalkedIn() { + if (!Game_Flag_Query(102) && !Game_Flag_Query(483)) { + Actor_Face_Actor(0, 21, true); + Actor_Says(0, 5290, 3); + Loop_Actor_Walk_To_XYZ(0, -10.0f, 149.0f, -631.0f, 0, 0, false, 0); + AI_Movement_Track_Pause(37); + Actor_Face_Actor(0, 37, true); + Actor_Face_Actor(37, 0, true); + Actor_Says(37, 0, 3); + Actor_Says(0, 5295, 3); + Actor_Face_Actor(37, 21, true); + Actor_Says(37, 10, 3); + AI_Movement_Track_Unpause(37); + Game_Flag_Set(483); + //return true; + return; + } + if (Game_Flag_Query(103)) { + Item_Remove_From_World(84); + Item_Remove_From_World(82); + Item_Remove_From_World(98); + //return true; + return; + } + //return false; + return; +} + +void ScriptTB06::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptTB06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/tb07.cpp b/engines/bladerunner/script/tb07.cpp new file mode 100644 index 0000000000..ca42ebbcd5 --- /dev/null +++ b/engines/bladerunner/script/tb07.cpp @@ -0,0 +1,290 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptTB07::InitializeScene() { + Setup_Scene_Information(68.0f, 12.0f, 288.0f, 0); + Scene_Exit_Add_2D_Exit(0, 383, 445, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(109, 20, 0, 1); + Ambient_Sounds_Add_Sound(363, 2, 55, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(364, 2, 55, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(365, 2, 55, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(366, 2, 55, 14, 14, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(212, 1, 15, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(213, 1, 15, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(214, 1, 20, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(215, 1, 15, 20, 25, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(216, 1, 15, 20, 25, -100, 100, -101, -101, 0, 0); + if (Global_Variable_Query(1) == 4 && !Actor_Clue_Query(0, 147)) { + Item_Add_To_World(83, 941, 18, 9.7f, 48.7f, -174.22f, 0, 12, 12, false, true, false, true); + } + if (Game_Flag_Query(661)) { + Scene_Loop_Set_Default(3); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptTB07::SceneLoaded() { + Obstacle_Object("EAGLE01", true); + Clickable_Object("EAGLE01"); +} + +bool ScriptTB07::MouseClick(int x, int y) { + return false; +} + +bool ScriptTB07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptTB07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptTB07::ClickedOnItem(int itemId, bool a2) { + if (!Loop_Actor_Walk_To_Item(0, itemId, 36, 1, false)) { + Actor_Face_Item(0, itemId, true); + if (itemId == 83) { + Item_Pickup_Spin_Effect(941, 331, 296); + Actor_Clue_Acquire(0, 147, 0, -1); + } + Item_Remove_From_World(itemId); + } + return false; +} + +bool ScriptTB07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 68.0f, 12.0f, 288.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (Global_Variable_Query(1) == 4) { + Game_Flag_Set(608); + Set_Enter(17, 82); + } else { + Game_Flag_Reset(176); + Game_Flag_Reset(182); + Game_Flag_Reset(179); + Game_Flag_Reset(178); + Game_Flag_Reset(258); + Game_Flag_Reset(257); + Game_Flag_Reset(261); + Game_Flag_Reset(450); + switch (Spinner_Interface_Choose_Dest(-1, 0)) { + case 9: + Game_Flag_Set(257); + Game_Flag_Reset(307); + Game_Flag_Set(256); + Set_Enter(37, 34); + break; + case 8: + Game_Flag_Set(181); + Game_Flag_Reset(307); + Game_Flag_Set(255); + Set_Enter(54, 54); + break; + case 7: + Game_Flag_Set(258); + Game_Flag_Reset(307); + Game_Flag_Set(254); + Set_Enter(20, 2); + break; + case 6: + Game_Flag_Set(177); + Game_Flag_Reset(307); + Game_Flag_Set(253); + Set_Enter(7, 25); + break; + case 4: + Game_Flag_Set(180); + Game_Flag_Reset(307); + Game_Flag_Set(252); + Set_Enter(0, 0); + break; + case 3: + Game_Flag_Set(176); + Game_Flag_Reset(307); + Game_Flag_Set(248); + Set_Enter(4, 13); + break; + case 2: + Game_Flag_Set(182); + Game_Flag_Reset(307); + Game_Flag_Set(249); + Set_Enter(69, 78); + break; + case 1: + Game_Flag_Set(179); + Game_Flag_Reset(307); + Game_Flag_Set(250); + Set_Enter(49, 48); + break; + case 0: + Game_Flag_Set(178); + Game_Flag_Reset(307); + Game_Flag_Set(251); + Set_Enter(61, 65); + break; + default: + Game_Flag_Set(261); + Loop_Actor_Walk_To_XYZ(0, 44.0f, 12.0f, 176.0f, 0, 0, false, 0); + break; + } + } + } + return true; + } + return false; +} + +bool ScriptTB07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptTB07::SceneFrameAdvanced(int frame) { + if (frame == 66) { + Ambient_Sounds_Play_Sound(591, 20, 99, 0, 0); + } + //return false; +} + +void ScriptTB07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptTB07::PlayerWalkedIn() { + int v0 = Global_Variable_Query(1); + Loop_Actor_Walk_To_XYZ(0, 44.0f, 12.0f, 176.0f, 0, 0, false, 0); + if ((v0 == 2 || v0 == 3) && !Game_Flag_Query(612)) { + Player_Set_Combat_Mode(false); + sub_401B0C(); + } +} + +void ScriptTB07::PlayerWalkedOut() { +} + +void ScriptTB07::DialogueQueueFlushed(int a1) { +} + +void ScriptTB07::sub_401B0C() { + Game_Flag_Set(612); + Delay(1500); + Loop_Actor_Walk_To_XYZ(0, 44.98f, 12.0f, 49.79f, 0, 0, false, 0); + Actor_Face_Heading(0, 178, true); + Delay(3000); + Actor_Put_In_Set(57, 18); + Actor_Set_At_XYZ(57, -260.15f, 12.0f, -19.16f, 256); + Actor_Change_Animation_Mode(57, 0); + Outtake_Play(39, 1, -1); + Loop_Actor_Walk_To_XYZ(57, -146.15f, 12.0f, -5.84f, 0, 0, false, 0); + Actor_Face_Actor(57, 0, true); + Actor_Says(57, 480, 14); + Actor_Face_Actor(0, 57, true); + Actor_Says(0, 5315, 9); + Actor_Says(57, 490, 3); + Actor_Face_Heading(0, 178, true); + Actor_Says(0, 5320, 15); + Actor_Says_With_Pause(0, 5325, 1.0f, 19); + Actor_Start_Speech_Sample(57, 500); + Loop_Actor_Walk_To_XYZ(57, -60.15f, 12.0f, 60.84f, 0, 0, false, 0); + Actor_Face_Actor(57, 0, true); + Actor_Face_Actor(0, 57, true); + Actor_Says(0, 5330, 14); + Actor_Says(57, 510, 12); + Actor_Says(0, 5335, 16); + Actor_Says(57, 520, 17); + Actor_Says(0, 5340, 3); + Actor_Start_Speech_Sample(57, 530); + Loop_Actor_Walk_To_XYZ(57, -4.15f, 12.0f, 54.73f, 0, 0, false, 0); + Actor_Says(57, 540, 16); + Actor_Says(0, 5345, 18); + Actor_Says(57, 550, 13); + Actor_Says(57, 570, 18); + Actor_Says_With_Pause(0, 5350, 0.0f, 18); + Actor_Says(57, 580, 16); + Actor_Says(0, 5355, 16); + Actor_Says(57, 590, 17); + Actor_Says(0, 5360, 17); + Actor_Says(0, 5365, 13); + Actor_Says_With_Pause(57, 600, 1.0f, 12); + Actor_Says(0, 5370, 3); + Loop_Actor_Walk_To_XYZ(57, -24.15f, 12.0f, -10.84f, 0, 0, false, 0); + Actor_Says(57, 610, 13); + Actor_Face_Actor(0, 57, true); + Actor_Says(0, 5375, 18); + Actor_Says(0, 5380, 19); + Actor_Face_Actor(57, 0, true); + Actor_Says(57, 620, 18); + Actor_Says_With_Pause(0, 5385, 2.0f, 12); + Actor_Says_With_Pause(0, 5390, 2.0f, 14); + Actor_Says(0, 5395, 15); + Actor_Says_With_Pause(57, 630, 0.0f, 14); + Actor_Says(0, 5400, 18); + Actor_Says(0, 5405, 3); + Actor_Says(57, 640, 12); + Actor_Says(0, 5410, 16); + Actor_Says(57, 650, 15); + Actor_Says_With_Pause(0, 5415, 1.0f, 17); + Actor_Says(0, 5420, 14); + Actor_Says(57, 660, 15); + Actor_Put_In_Set(51, 18); + Actor_Set_At_XYZ(51, 68.0f, 12.0f, 288.0f, 0); + Actor_Change_Animation_Mode(51, 0); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 0); + Actor_Start_Speech_Sample(51, 0); + Loop_Actor_Walk_To_XYZ(51, 44.0f, 12.0f, 176.0f, 0, 0, false, 0); + Actor_Face_Actor(51, 0, true); + Actor_Face_Actor(0, 51, true); + Actor_Face_Actor(57, 51, true); + Actor_Says(51, 10, 12); + Actor_Says(51, 20, 3); + Actor_Says(51, 30, 12); + Actor_Says(0, 5425, 18); + Actor_Set_Goal_Number(57, 200); + Actor_Says(51, 40, 15); + Actor_Start_Speech_Sample(51, 50); + Loop_Actor_Walk_To_XYZ(51, -10.0f, 12.0f, 100.0f, 0, 0, false, 0); + Actor_Face_Actor(51, 0, true); + Actor_Face_Actor(0, 51, true); + Actor_Says(0, 5430, 17); + Actor_Says(0, 5435, 16); + Actor_Says(51, 60, 14); + Actor_Face_Actor(0, 51, true); + Actor_Says(0, 5440, 14); + Actor_Says(51, 70, 13); + Actor_Says(0, 5445, 15); + Actor_Says_With_Pause(51, 80, 1.0f, 12); + Actor_Says(51, 90, 15); + Actor_Says_With_Pause(0, 5450, 1.0f, 15); + Actor_Says(0, 5455, 12); + Actor_Says(51, 100, 14); + Actor_Clue_Acquire(0, 278, 0, 57); + Actor_Clue_Acquire(0, 279, 0, 51); + Loop_Actor_Walk_To_XYZ(51, -260.15f, 12.0f, -19.16f, 0, 0, false, 0); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug01.cpp b/engines/bladerunner/script/ug01.cpp new file mode 100644 index 0000000000..1d39e9553e --- /dev/null +++ b/engines/bladerunner/script/ug01.cpp @@ -0,0 +1,179 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG01::InitializeScene() { + if (Game_Flag_Query(317)) { + Setup_Scene_Information(34.47f, -50.13f, -924.11f, 500); + Game_Flag_Reset(317); + } else if (Game_Flag_Query(118)) { + Setup_Scene_Information(-68.0f, -50.13f, -504.0f, 377); + } else { + Setup_Scene_Information(-126.0f, -50.13f, -286.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 280, 204, 330, 265, 0); + Scene_Exit_Add_2D_Exit(1, 144, 0, 210, 104, 0); + Scene_Exit_Add_2D_Exit(2, 0, 173, 139, 402, 3); + Ambient_Sounds_Add_Looping_Sound(331, 28, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 10, 11, 20, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(370, 2, 120, 10, 11, 20, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 10, 11, 20, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(396, 2, 120, 10, 11, 20, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(391, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(394, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, 0, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, 0, 100, -101, -101, 0, 0); + if (Game_Flag_Query(324)) { + Scene_Loop_Set_Default(3); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptUG01::SceneLoaded() { + Unobstacle_Object("BEAM02", true); + Unobstacle_Object("BEAM03", true); + Unobstacle_Object("BEAM04", true); + Clickable_Object("PIPES_FG_LFT"); +} + +bool ScriptUG01::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG01::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("PIPES_FG_LFT", objectName)) { + if (!Loop_Actor_Walk_To_XYZ(0, -9.0f, -50.13f, -148.0f, 0, 1, false, 0) && !Game_Flag_Query(324)) { + Actor_Says(0, 8525, 13); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Game_Flag_Set(324); + } else { + Actor_Says(0, 8525, 13); + } + } + return false; +} + +bool ScriptUG01::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG01::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG01::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -32.0f, -50.13f, -1350.0f, 12, 1, false, 0)) { + Game_Flag_Set(316); + Set_Enter(83, 95); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -70.0f, -50.13f, -500.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 768, false); + Loop_Actor_Travel_Ladder(0, 12, 1, 0); + Game_Flag_Set(119); + Game_Flag_Reset(259); + Game_Flag_Set(182); + Set_Enter(70, 80); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -126.0f, -50.13f, -286.0f, 0, 1, false, 0)) { + Game_Flag_Set(314); + Set_Enter(75, 87); + } + return true; + } + return false; +} + +bool ScriptUG01::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG01::SceneFrameAdvanced(int frame) { + if (frame >= 61 && frame <= 120) { + float v1 = (120 - frame) / 29500.0f; + Set_Fog_Density("BoxFog01", v1); + Set_Fog_Density("BoxFog02", v1); + Set_Fog_Density("BoxFog03", v1); + Set_Fog_Density("BoxFog04", v1); + } else if (frame > 120) { + Set_Fog_Density("BoxFog01", 0.0f); + Set_Fog_Density("BoxFog02", 0.0f); + Set_Fog_Density("BoxFog03", 0.0f); + Set_Fog_Density("BoxFog04", 0.0f); + } + //return false; +} + +void ScriptUG01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG01::PlayerWalkedIn() { + if (Game_Flag_Query(315)) { + Loop_Actor_Walk_To_XYZ(0, -55.0f, -50.13f, -288.0f, 12, 0, false, 0); + Game_Flag_Reset(315); + } + if (Game_Flag_Query(118)) { + Actor_Set_At_XYZ(0, -70.0f, 93.87f, -500.0f, 768); + Loop_Actor_Travel_Ladder(0, 12, 0, 0); + Loop_Actor_Walk_To_XYZ(0, -58.0f, -50.13f, -488.0f, 0, 0, false, 0); + Game_Flag_Reset(118); + } + if (Actor_Query_Goal_Number(6) == 310) { + Music_Play(21, 35, 0, 3, -1, 0, 0); + Actor_Set_Goal_Number(6, 311); + } + //return false; +} + +void ScriptUG01::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptUG01::DialogueQueueFlushed(int a1) { +} + + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug02.cpp b/engines/bladerunner/script/ug02.cpp new file mode 100644 index 0000000000..d58806c335 --- /dev/null +++ b/engines/bladerunner/script/ug02.cpp @@ -0,0 +1,256 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG02::InitializeScene() { + if (Game_Flag_Query(319)) { + Setup_Scene_Information(-313.0f, 155.73f, -128.0f, 556); + } else { + Setup_Scene_Information(-95.0f, 74.78f, -503.0f, 556); + } + Scene_Exit_Add_2D_Exit(0, 529, 130, 607, 277, 0); + Scene_Exit_Add_2D_Exit(1, 305, 36, 335, 192, 0); + Ambient_Sounds_Add_Looping_Sound(332, 43, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 43, 0, 1); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, 100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(123, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(130, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(131, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(132, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(133, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(134, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(135, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(136, 2, 50, 17, 37, -50, -20, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(47, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(48, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(49, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(50, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(51, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(52, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(53, 2, 50, 27, 27, 10, 30, -101, -101, 0, 0); +} + +void ScriptUG02::SceneLoaded() { + Unobstacle_Object("BOX BACKROOM 2", true); + Unobstacle_Object("BACK_ROOM HALFWALL_", true); + Unobstacle_Object("GUN_4", true); + Obstacle_Object("GUN_1", true); + Unobstacle_Object("WALL_LEFT", true); + Unobstacle_Object("BOX BY STAIRS 1", true); + Unobstacle_Object("TANK", true); + Unobstacle_Object("DESK_DRUM", true); + Clickable_Object("GUN_1"); + Clickable_Object("GUN_2"); + Clickable_Object("CRATE_3"); + Footstep_Sounds_Set(0, 0); + Footstep_Sounds_Set(8, 2); + if (!Game_Flag_Query(656) && Game_Flag_Query(44)) { + Item_Add_To_World(88, 963, 75, -300.37f, 120.16f, -81.31f, 0, 8, 8, false, true, false, true); + } +} + +bool ScriptUG02::MouseClick(int x, int y) { + if (Game_Flag_Query(499)) { + return false; + } + if (Region_Check(0, 0, 245, 285) || Region_Check(0, 0, 350, 257)) { + return true; + } + if (Region_Check(81, 224, 639, 479) && !Game_Flag_Query(498)) { + Game_Flag_Set(499); + sub_402354(); + Game_Flag_Reset(499); + return true; + } + return false; +} + +bool ScriptUG02::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("GUN_1", objectName) || Object_Query_Click("GUN_2", objectName) || Object_Query_Click("CRATE_3", objectName)) { + Actor_Face_Object(0, "GUN_1", true); + if (!Game_Flag_Query(449) && Global_Variable_Query(1) < 4) { + Actor_Voice_Over(2430, 99); + Actor_Voice_Over(2440, 99); + Actor_Voice_Over(2450, 99); + Actor_Voice_Over(2460, 99); + Game_Flag_Set(449); + Actor_Clue_Acquire(0, 66, 1, -1); + return true; + } + if (Global_Variable_Query(1) <= 3) { + Actor_Says(0, 8580, 14); + return false; + } + if (Actor_Clue_Query(0, 66) && !Actor_Clue_Query(0, 121)) { + Actor_Voice_Over(2470, 99); + Actor_Voice_Over(2480, 99); + Actor_Voice_Over(2490, 99); + Actor_Voice_Over(2500, 99); + Actor_Clue_Acquire(0, 121, 1, -1); + } else if (!Actor_Clue_Query(0, 66)) { + Actor_Voice_Over(2510, 99); + Actor_Voice_Over(2520, 99); + Actor_Voice_Over(2530, 99); + } else if (Game_Flag_Query(708)) { + Actor_Says(0, 8580, 14); + } else { + Item_Pickup_Spin_Effect(996, 360, 440); + Actor_Says(0, 8525, 14); + Give_McCoy_Ammo(2, 18); + Game_Flag_Set(708); + } + return true; + } + return false; +} + +bool ScriptUG02::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG02::ClickedOnItem(int itemId, bool a2) { + if (itemId == 88) { + Actor_Face_Item(0, 88, true); + Actor_Clue_Acquire(0, 62, 1, -1); + Game_Flag_Set(656); + Item_Remove_From_World(88); + Item_Pickup_Spin_Effect(963, 426, 316); + return true; + } + return false; +} + +bool ScriptUG02::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (Game_Flag_Query(498) || !sub_402354()) { + int v2 = Player_Query_Combat_Mode(); + if (!Loop_Actor_Walk_To_XYZ(0, -202.0f, 120.16f, -74.0f, 0, 1, v2, 0)) { + Actor_Face_Heading(0, 270, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 4, 0, 0); + Footstep_Sound_Override_Off(); + int v3 = Player_Query_Combat_Mode(); + Loop_Actor_Walk_To_XYZ(0, -96.57f, 74.870003f, -271.28f, 0, 0, v3, 0); + int v4 = Player_Query_Combat_Mode(); + Loop_Actor_Walk_To_XYZ(0, -95.0f, 74.870003f, -503.0f, 0, 0, v4, 0); + Game_Flag_Set(315); + Set_Enter(74, 86); + } + } + return true; + } + if (exitId == 1) { + if (Game_Flag_Query(498)) { + if (sub_402354()) { + return true; + } + Loop_Actor_Walk_To_XYZ(0, -368.75f, 155.75f, -63.0f, 0, 0, false, 0); + Loop_Actor_Walk_To_XYZ(0, -340.75f, 155.75f, -119.0f, 0, 0, false, 0); + } + Loop_Actor_Walk_To_XYZ(0, -304.75f, 155.75f, -171.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 14, false); + Loop_Actor_Travel_Ladder(0, 9, 1, 0); + Game_Flag_Set(318); + Game_Flag_Reset(259); + Game_Flag_Set(479); + if (!Game_Flag_Query(403)) { + Game_Flag_Set(388); + Game_Flag_Set(403); + Item_Remove_From_World(121); + } + Set_Enter(8, 33); + return true; + } + return false; +} + +bool ScriptUG02::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG02::SceneFrameAdvanced(int frame) { + //return true; +} + +void ScriptUG02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG02::PlayerWalkedIn() { + if (Game_Flag_Query(314)) { + Actor_Set_At_XYZ(0, -106.01f, 84.13f, -228.62f, 575); + Loop_Actor_Walk_To_XYZ(0, -148.0f, 84.13f, -67.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 761, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 4, 1, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Reset(314); + Game_Flag_Set(498); + } else if (Game_Flag_Query(319)) { + Actor_Set_At_XYZ(0, -304.75f, 265.0f, -171.0f, 0); + Loop_Actor_Travel_Ladder(0, 9, 0, 0); + Game_Flag_Reset(319); + Game_Flag_Reset(498); + } else { + Actor_Set_At_XYZ(0, -269.24f, 120.16f, -9.94f, 477); + Game_Flag_Set(498); + } + Game_Flag_Reset(499); + //return false; +} + +void ScriptUG02::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptUG02::DialogueQueueFlushed(int a1) { +} + +bool ScriptUG02::sub_402354() { + if (!Game_Flag_Query(498)) { + int v0 = Player_Query_Combat_Mode(); + Loop_Actor_Walk_To_XYZ(0, -340.75f, 155.75f, -119.0f, 0, 0, v0, 0); + Loop_Actor_Walk_To_XYZ(0, -368.75f, 155.75f, -63.0f, 0, 0, v0, 0); + Loop_Actor_Walk_To_XYZ(0, -365.0f, 155.65f, -19.0f, 0, 0, v0, 0); + Actor_Face_Heading(0, 318, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 4, 0, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Set(498); + return false; + } + if (!Loop_Actor_Walk_To_XYZ(0, -312.75f, 120.16f, 1.01f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 830, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 4, 1, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Reset(498); + return false; + } + return true; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug03.cpp b/engines/bladerunner/script/ug03.cpp new file mode 100644 index 0000000000..89c142dcb5 --- /dev/null +++ b/engines/bladerunner/script/ug03.cpp @@ -0,0 +1,145 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG03::InitializeScene() { + if (Game_Flag_Query(335)) { + Setup_Scene_Information(-51.0f, 0.03f, 255.0f, 780); + Game_Flag_Reset(335); + } else if (Game_Flag_Query(337)) { + Setup_Scene_Information(-139.0f, 0.03f, -13.0f, 540); + Game_Flag_Reset(337); + } else { + Setup_Scene_Information(-121.88f, 0.03f, 213.35f, 540); + } + Scene_Exit_Add_2D_Exit(0, 46, 137, 131, 296, 0); + Scene_Exit_Add_2D_Exit(1, 559, 141, 639, 380, 1); + Ambient_Sounds_Add_Looping_Sound(331, 15, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(402, 2, 120, 10, 11, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(370, 2, 120, 10, 11, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(396, 2, 120, 10, 11, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(395, 2, 120, 10, 11, 0, 100, 0, 100, 0, 0); + Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(391, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(392, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(393, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(394, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(225, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(226, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); +} + +void ScriptUG03::SceneLoaded() { + Obstacle_Object("=WALL_RIGHT_HOLE", true); + Unobstacle_Object("=HOLERUBBLE1", true); + Clickable_Object("CHAIR_HEADZAPPER"); + Clickable_Object("CHAIR_BACK"); + Clickable_Object("CHAIR_SEAT"); + Clickable_Object("CHAIR_STRAPLEGLEFT"); + Clickable_Object("CHAIR_STRAPLEGRIGHT"); +} + +bool ScriptUG03::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG03::ClickedOn3DObject(const char *objectName, bool a2) { + if ((Object_Query_Click("CHAIR_BACK", objectName) || Object_Query_Click("CHAIR_SEAT", objectName) || Object_Query_Click("CHAIR_HEADZAPPER", objectName)) && !Loop_Actor_Walk_To_Scene_Object(0, "CHAIR_BACK", 36, 1, false)) { + Actor_Face_Object(0, "CHAIR_BACK", true); + if (!Actor_Clue_Query(0, 120)) { + Actor_Voice_Over(2550, 99); + Actor_Voice_Over(2560, 99); + Actor_Voice_Over(2570, 99); + Actor_Voice_Over(2580, 99); + Actor_Voice_Over(2590, 99); + Actor_Clue_Acquire(0, 120, 1, -1); + } + } + return false; +} + +bool ScriptUG03::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG03::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG03::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -139.0f, 0.0f, -13.0f, 0, 1, false, 0)) { + if (Global_Variable_Query(1) < 4) { + Actor_Says(0, 8522, 14); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(336); + Set_Enter(83, 95); + } + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -51.0f, 0.0f, 255.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(334); + Set_Enter(77, 89); + } + return true; + } + return false; +} + +bool ScriptUG03::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG03::SceneFrameAdvanced(int frame) { +} + +void ScriptUG03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG03::PlayerWalkedIn() { +} + +void ScriptUG03::PlayerWalkedOut() { +} + +void ScriptUG03::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug04.cpp b/engines/bladerunner/script/ug04.cpp new file mode 100644 index 0000000000..c65d74fdf5 --- /dev/null +++ b/engines/bladerunner/script/ug04.cpp @@ -0,0 +1,140 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG04::InitializeScene() { + if (Game_Flag_Query(339)) { + Setup_Scene_Information(0.0f, -1.74f, -2400.0f, 496); + Game_Flag_Reset(339); + } else if (Game_Flag_Query(341)) { + Setup_Scene_Information(164.0f, 11.87f, -1013.0f, 83); + } else { + Setup_Scene_Information(-172.0f, 16.29f, -735.0f, 380); + Game_Flag_Reset(334); + } + Scene_Exit_Add_2D_Exit(0, 123, 308, 159, 413, 3); + if (Global_Variable_Query(1) > 3) { + Scene_Exit_Add_2D_Exit(1, 256, 333, 290, 373, 0); + } + Scene_Exit_Add_2D_Exit(2, 344, 298, 451, 390, 1); + Ambient_Sounds_Add_Looping_Sound(331, 25, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(225, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(370, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(392, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(394, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); +} + +void ScriptUG04::SceneLoaded() { + Obstacle_Object("NAV", true); + Unobstacle_Object("RUBBLE", true); + Unobstacle_Object("FLOOR DEBRIS WADS", true); + Unobstacle_Object("FLOOR DEBRIS WADS01", true); + Unobstacle_Object("FLOOR DEBRIS WADS02", true); +} + +bool ScriptUG04::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG04::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG04::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG04::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG04::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -172.0f, 16.29f, -735.0f, 0, 1, false, 0)) { + Game_Flag_Set(335); + Set_Enter(76, 88); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 0.0f, -1.74f, -2400.0f, 0, 1, false, 0)) { + Game_Flag_Set(338); + Set_Enter(78, 90); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, 164.0f, 11.87f, -1013.0f, 0, 1, false, 0)) { + Game_Flag_Set(340); + Set_Enter(79, 91); + } + return true; + } + return false; +} + +bool ScriptUG04::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG04::SceneFrameAdvanced(int frame) { + if (frame == 1) { + Ambient_Sounds_Play_Sound(367, 90, -100, 100, 100); + } +} + +void ScriptUG04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG04::PlayerWalkedIn() { + if (Game_Flag_Query(341)) { + Loop_Actor_Walk_To_XYZ(0, 60.0f, -1.74f, -976.0f, 6, 0, false, 0); + Game_Flag_Reset(341); + } +} + +void ScriptUG04::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptUG04::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug05.cpp b/engines/bladerunner/script/ug05.cpp new file mode 100644 index 0000000000..e087cacf92 --- /dev/null +++ b/engines/bladerunner/script/ug05.cpp @@ -0,0 +1,275 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG05::InitializeScene() { + if (Game_Flag_Query(360)) { + if (Game_Flag_Query(663) && !Game_Flag_Query(368)) { + Setup_Scene_Information(-356.35f, 132.77f, -1092.36f, 389); + } else { + Setup_Scene_Information(-180.0f, 37.28f, -1124.0f, 296); + } + } else { + Setup_Scene_Information(0.0f, -1.37f, 0.0f, 0); + Game_Flag_Reset(338); + } + Scene_Exit_Add_2D_Exit(0, 215, 240, 254, 331, 3); + if (!Game_Flag_Query(663)) { + Scene_Exit_Add_2D_Exit(1, 303, 422, 639, 479, 2); + } + if (!Game_Flag_Query(663) || Game_Flag_Query(368)) { + Scene_Exit_Add_2D_Exit(2, 352, 256, 393, 344, 0); + } + Ambient_Sounds_Add_Looping_Sound(105, 28, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(225, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(226, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(391, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(395, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(392, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(368)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptUG05::SceneLoaded() { + if (!Game_Flag_Query(368)) { + Unobstacle_Object("DROPPED CAR OBSTACL", true); + } + Obstacle_Object("VANBODY", true); +} + +bool ScriptUG05::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG05::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG05::ClickedOnActor(int actorId) { + if (!Loop_Actor_Walk_To_Actor(0, actorId, 30, 1, false)) { + Actor_Face_Actor(0, actorId, true); + int v1 = sub_4021B0(); + if (actorId == 24 && Game_Flag_Query(368) && !Game_Flag_Query(683)) { + Actor_Says(24, 220, -1); + Actor_Says(0, 5540, 14); + Actor_Says(24, 230, -1); + Actor_Says(0, 5545, 17); + Actor_Says(24, 240, -1); + Actor_Says(0, 5550, 3); + Game_Flag_Set(683); + return false; + } + if (actorId == v1) { + sub_402218(); + return true; + } + return false; + } + return false; +} + +bool ScriptUG05::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG05::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (Game_Flag_Query(663) && !Game_Flag_Query(368)) { + Loop_Actor_Walk_To_XYZ(0, -356.35f, 132.77f, -1092.36f, 0, 0, false, 0); + Game_Flag_Set(361); + Set_Enter(43, 40); + } else if (!Loop_Actor_Walk_To_XYZ(0, -156.72f, 3.03f, -1118.17f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 760, false); + Loop_Actor_Travel_Stairs(0, 3, 1, 0); + Game_Flag_Set(361); + Set_Enter(43, 40); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 4.0f, -11.67f, -4.0f, 0, 1, false, 0)) { + Game_Flag_Set(339); + Set_Enter(77, 89); + } + return true; + } + if (exitId == 2) { + if (!Game_Flag_Query(662)) { + if (!Loop_Actor_Walk_To_XYZ(0, 0.0f, -1.37f, -1500.0f, 0, 1, false, 0)) { + if (!Game_Flag_Query(522)) { + Actor_Voice_Over(2600, 99); + Actor_Voice_Over(2610, 99); + Game_Flag_Set(522); + } + return true; + } + } else { + int v1 = sub_4021B0(); + bool v2; + if (v1 == -1) { + v2 = Loop_Actor_Walk_To_XYZ(0, 0.0f, -1.37f, -1500.0f, 0, 1, false, 0) != 0; + } else { + v2 = Loop_Actor_Walk_To_Actor(0, v1, 30, 1, false) != 0; + } + if (!v2) { + sub_402218(); + return true; + } + } + } + return false; +} + +bool ScriptUG05::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG05::SceneFrameAdvanced(int frame) { +} + +void ScriptUG05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG05::PlayerWalkedIn() { + if (Game_Flag_Query(663)) { + if (Game_Flag_Query(368)) { + Music_Stop(2); + Actor_Put_In_Set(24, 78); + Actor_Set_At_XYZ(24, 4.22f, -1.37f, -925.0f, 750); + Actor_Set_Goal_Number(24, 599); + Actor_Retired_Here(24, 70, 36, 1, -1); + int v0 = sub_4021B0(); + if (v0 == 3) { + Actor_Put_In_Set(3, 78); + Actor_Set_At_XYZ(3, -100.0f, -10.31f, -906.0f, 866); + Actor_Force_Stop_Walking(3); + } else if (v0 == 6) { + Actor_Put_In_Set(6, 78); + Actor_Set_At_XYZ(6, -100.0f, -10.31f, -906.0f, 866); + Actor_Force_Stop_Walking(6); + } + } else { + if (!Actor_Query_In_Set(23, 78)) { + Actor_Put_In_Set(23, 78); + Actor_Set_At_XYZ(23, 0.0f, -1.37f, -1400.0f, 768); + } + if (!Actor_Query_In_Set(24, 78)) { + ADQ_Flush(); + ADQ_Add(24, 280, 3); + Actor_Put_In_Set(24, 78); + Actor_Set_At_XYZ(24, -16.0f, -1.37f, -960.0f, 768); + } + } + } + if (Game_Flag_Query(360)) { + if (Game_Flag_Query(663) && !Game_Flag_Query(368)) { + Loop_Actor_Walk_To_XYZ(0, -288.35f, 132.77f, -1092.36f, 0, 1, false, 0); + } else { + Loop_Actor_Travel_Stairs(0, 2, 0, 0); + } + } + if (Game_Flag_Query(663)) { + Game_Flag_Query(368); + } + Game_Flag_Reset(360); +} + +void ScriptUG05::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptUG05::DialogueQueueFlushed(int a1) { +} + +int ScriptUG05::sub_4021B0() { + if (Global_Variable_Query(45) == 2 && Actor_Query_Goal_Number(3) != 599) { + return 3; + } + if (Global_Variable_Query(45) == 3 && Actor_Query_Goal_Number(6) != 599) { + return 6; + } + return -1; +} + +void ScriptUG05::sub_402218() { + int v0 = sub_4021B0(); + if (v0 != -1) { + Actor_Face_Actor(0, v0, true); + Actor_Face_Actor(v0, 0, true); + Actor_Says(0, 5535, 13); + if (v0 == 3) { + Actor_Says(3, 1110, 15); + } else { + Actor_Says(6, 670, 17); + } + } + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (v0 == 6) { + if (Game_Flag_Query(46)) { + if (Global_Variable_Query(48) > 3) { + Outtake_Play(13, 0, -1); + } else { + Outtake_Play(14, 0, -1); + } + } else { + Outtake_Play(12, 0, -1); + } + } else if (v0 == 3) { + if (Game_Flag_Query(47)) { + if (Global_Variable_Query(48) > 3) { + Outtake_Play(16, 0, -1); + } else { + Outtake_Play(17, 0, -1); + } + } else { + Outtake_Play(15, 0, -1); + } + } else { + Outtake_Play(19, 0, -1); + } + Outtake_Play(18, 0, -1); + Game_Over(); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug06.cpp b/engines/bladerunner/script/ug06.cpp new file mode 100644 index 0000000000..b3198c79ea --- /dev/null +++ b/engines/bladerunner/script/ug06.cpp @@ -0,0 +1,161 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG06::InitializeScene() { + if (Game_Flag_Query(680)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Outtake_Play(7, 0, -1); + if (Game_Flag_Query(560)) { + Outtake_Play(9, 0, -1); + } else { + Outtake_Play(8, 0, -1); + } + Game_Flag_Reset(680); + } + if (Game_Flag_Query(340)) { + Setup_Scene_Information(23.0f, 0.0f, 321.0f, 0); + } else if (Game_Flag_Query(343)) { + Setup_Scene_Information(66.0f, 153.0f, -301.4f, 512); + } else { + Setup_Scene_Information(-165.0f, 1.0f, 89.0f, 990); + } + Scene_Exit_Add_2D_Exit(0, 0, 0, 30, 479, 3); + Scene_Exit_Add_2D_Exit(1, 294, 68, 544, 236, 0); + Ambient_Sounds_Add_Looping_Sound(288, 18, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(234, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(392, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(394, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(225, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(227, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); +} + +void ScriptUG06::SceneLoaded() { + Obstacle_Object("BOX06", true); + Unobstacle_Object("BOX06", true); + Unobstacle_Object("BOX07", true); + Unobstacle_Object("BOX16", true); + Unobstacle_Object("BOX05", true); +} + +bool ScriptUG06::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG06::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG06::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG06::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG06::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 23.0f, 0.0f, 321.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(341); + Set_Enter(77, 89); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 66.0f, 0.0f, -90.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 0, false); + Loop_Actor_Travel_Stairs(0, 17, 1, 0); + Loop_Actor_Walk_To_XYZ(0, 66.0f, 153.0f, -446.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(342); + Set_Enter(54, 54); + } + return true; + } + return false; +} + +bool ScriptUG06::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG06::SceneFrameAdvanced(int frame) { +} + +void ScriptUG06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG06::PlayerWalkedIn() { + if (Game_Flag_Query(340)) { + Loop_Actor_Walk_To_XYZ(0, 23.0f, 0.0f, 273.0f, 0, 0, false, 0); + Game_Flag_Reset(340); + } + if (Game_Flag_Query(343)) { + Loop_Actor_Travel_Stairs(0, 17, 0, 0); + Loop_Actor_Walk_To_XYZ(0, 66.0f, 0.0f, -36.91f, 0, 0, false, 0); + Game_Flag_Reset(343); + } + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(524)) { + Player_Loses_Control(); + Actor_Voice_Over(2620, 99); + Actor_Voice_Over(2630, 99); + Actor_Voice_Over(2640, 99); + Actor_Voice_Over(2650, 99); + Actor_Voice_Over(2660, 99); + Actor_Voice_Over(2670, 99); + Actor_Voice_Over(2680, 99); + Actor_Voice_Over(2690, 99); + Actor_Voice_Over(2700, 99); + Player_Gains_Control(); + Game_Flag_Set(524); + Autosave_Game(2); + } + //return false; +} + +void ScriptUG06::PlayerWalkedOut() { +} + +void ScriptUG06::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug07.cpp b/engines/bladerunner/script/ug07.cpp new file mode 100644 index 0000000000..b27063b8ce --- /dev/null +++ b/engines/bladerunner/script/ug07.cpp @@ -0,0 +1,193 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG07::InitializeScene() { + if (Game_Flag_Query(428)) { + Setup_Scene_Information(-76.0f, -12.21f, -738.0f, 505); + Game_Flag_Reset(428); + } else if (Game_Flag_Query(426)) { + Setup_Scene_Information(110.0f, -12.21f, -276.0f, 605); + } else { + Setup_Scene_Information(-10.0f, -12.21f, -58.0f, 0); + Game_Flag_Reset(424); + } + if (Game_Flag_Query(623)) { + Scene_Exit_Add_2D_Exit(0, 0, 192, 51, 334, 0); + Scene_Exit_Add_2D_Exit(1, 226, 224, 314, 396, 1); + } + Scene_Exit_Add_2D_Exit(2, 60, 440, 460, 479, 2); + Ambient_Sounds_Add_Looping_Sound(105, 90, -45, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(395, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(291, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); +} + +void ScriptUG07::SceneLoaded() { + Obstacle_Object("BOX RIGHT WALL 01", true); + Obstacle_Object("BOX RIGHT WALL 09", true); + Obstacle_Object("SLIDING DOOR", true); + Unobstacle_Object("BOX LEFT WALL 01", true); + Unclickable_Object("BOX RIGHT WALL 09"); + Unclickable_Object("BOX RIGHT WALL 01"); + Unclickable_Object("SLIDING DOOR"); + Unobstacle_Object("BOX FOR WALL LEFT02", true); + Unobstacle_Object("BOX FOR WALL LEFT03", true); + Unobstacle_Object("BOX FOR WALL LEFT05", true); + Unobstacle_Object("BOX FOR WALL LEFT07", true); + Unobstacle_Object("BOX FOR WALL LEFT09", true); + Unobstacle_Object("BOX FOR WALL LEFT10", true); + Unobstacle_Object("BOX FOR WALL LEFT11", true); + Unobstacle_Object("BOX FOR WALL LEFT12", true); + Unobstacle_Object("BOX FOR WALL LEFT13", true); +} + +bool ScriptUG07::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG07::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG07::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG07::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG07::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -94.0f, -12.21f, -710.0f, 0, 1, false, 0) && Actor_Query_Goal_Number(5) != 402) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(427); + Set_Enter(82, 94); + return true; + } + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 110.0f, -12.21f, -274.0f, 0, 1, false, 0) && Actor_Query_Goal_Number(5) != 402) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(425); + Set_Enter(81, 93); + return true; + } + } + if (exitId == 2) { + if (!Game_Flag_Query(607) && Game_Flag_Query(671) && Global_Variable_Query(1) == 4 && !Game_Flag_Query(598)) { + if (!Loop_Actor_Walk_To_XYZ(0, 49.0f, -12.21f, -130.0f, 0, 1, false, 0)) { + Game_Flag_Set(598); + Actor_Put_In_Set(5, 80); + Actor_Set_At_XYZ(5, 118.02f, -12.21f, -154.0f, 768); + Player_Set_Combat_Mode(true); + Actor_Face_Actor(0, 5, true); + Loop_Actor_Walk_To_XYZ(5, 98.019997f, -12.21f, -154.0f, 0, 0, false, 0); + Actor_Face_Actor(5, 0, true); + Actor_Set_Goal_Number(0, 301); + Actor_Face_Heading(0, 0, true); + Delay(1500); + Actor_Says_With_Pause(5, 550, 1.0f, 3); + if (Actor_Clue_Query(5, 224)) { + Actor_Says(5, 560, 3); + Actor_Set_Goal_Number(0, 302); + Sound_Play(561, 100, 0, 0, 50); + Delay(2000); + } + if (Actor_Clue_Query(5, 223)) { + Actor_Says(5, 570, 3); + Actor_Set_Goal_Number(0, 302); + Sound_Play(561, 100, 0, 0, 50); + Delay(2000); + } + Actor_Set_Goal_Number(0, 303); + Delay(1000); + Actor_Set_Goal_Number(5, 401); + } + } else { + if (!Loop_Actor_Walk_To_XYZ(0, -10.0f, -21.47f, -58.0f, 0, 1, false, 0) && Actor_Query_Goal_Number(5) != 402) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(423); + Set_Enter(83, 95); + return true; + } + } + } + return false; +} + +bool ScriptUG07::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG07::SceneFrameAdvanced(int frame) { +} + +void ScriptUG07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG07::PlayerWalkedIn() { + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(623)) { + Actor_Set_Goal_Number(23, 307); + Actor_Set_Goal_Number(24, 307); + } + if (Game_Flag_Query(426)) { + Loop_Actor_Walk_To_XYZ(0, 62.0f, -12.21f, -274.0f, 0, 0, false, 0); + Game_Flag_Reset(426); + } +} + +void ScriptUG07::PlayerWalkedOut() { + if (Global_Variable_Query(1) == 4 && (Actor_Query_Goal_Number(23) == 307 || Actor_Query_Goal_Number(24) == 307)) { + Non_Player_Actor_Combat_Mode_Off(23); + Non_Player_Actor_Combat_Mode_Off(24); + Actor_Set_Goal_Number(23, 306); + Actor_Set_Goal_Number(24, 306); + } + if (Actor_Query_In_Set(5, 80)) { + Actor_Set_Goal_Number(5, 400); + } +} + +void ScriptUG07::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug08.cpp b/engines/bladerunner/script/ug08.cpp new file mode 100644 index 0000000000..34c1943cd7 --- /dev/null +++ b/engines/bladerunner/script/ug08.cpp @@ -0,0 +1,145 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG08::InitializeScene() { + if (Game_Flag_Query(430)) { + Setup_Scene_Information(-124.0f, 93.18f, 71.0f, 745); + } else { + Setup_Scene_Information(-432.0f, 0.0f, -152.0f, 370); + } + Scene_Exit_Add_2D_Exit(0, 125, 220, 157, 303, 3); + Scene_Exit_Add_2D_Exit(1, 353, 145, 552, 309, 1); + Ambient_Sounds_Add_Looping_Sound(331, 28, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(291, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + if (!Game_Flag_Query(610)) { + Game_Flag_Set(431); + Game_Flag_Set(610); + } + if (Game_Flag_Query(430)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(431)) { + Scene_Loop_Set_Default(1); + } else { + Scene_Loop_Set_Default(4); + } +} + +void ScriptUG08::SceneLoaded() { + Obstacle_Object("ELEV LEGS", true); + Unobstacle_Object("ELEV LEGS", true); + Unobstacle_Object("BOX RIGHT WALL ", true); +} + +bool ScriptUG08::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG08::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG08::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG08::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG08::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -432.0f, 0.0f, -152.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(426); + Set_Enter(80, 92); + } + } else if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -312.0f, -2.0f, 152.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 240, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 11, 1, 0); + Footstep_Sound_Override_Off(); + Loop_Actor_Walk_To_XYZ(0, -118.02f, 93.02f, 52.76f, 0, 0, false, 0); + Player_Loses_Control(); + Actor_Set_Invisible(0, true); + Game_Flag_Set(429); + Game_Flag_Reset(431); + Set_Enter(85, 97); + Scene_Loop_Start_Special(1, 3, 0); + } + } + return false; +} + +bool ScriptUG08::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG08::SceneFrameAdvanced(int frame) { + if (frame == 91) { + Ambient_Sounds_Play_Sound(372, 90, 0, 0, 100); + } +} + +void ScriptUG08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG08::PlayerWalkedIn() { + if (Game_Flag_Query(430)) { + Loop_Actor_Walk_To_XYZ(0, -167.0f, 93.18f, 71.0f, 0, 0, false, 0); + Loop_Actor_Walk_To_XYZ(0, -180.0f, 93.18f, 134.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 745, false); + Footstep_Sound_Override_On(2); + Loop_Actor_Travel_Stairs(0, 11, 0, 0); + Footstep_Sound_Override_Off(); + Player_Gains_Control(); + } + Game_Flag_Reset(425); + Game_Flag_Reset(430); +} + +void ScriptUG08::PlayerWalkedOut() { +} + +void ScriptUG08::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug09.cpp b/engines/bladerunner/script/ug09.cpp new file mode 100644 index 0000000000..e76f9870b7 --- /dev/null +++ b/engines/bladerunner/script/ug09.cpp @@ -0,0 +1,153 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG09::InitializeScene() { + if (Game_Flag_Query(433)) { + Setup_Scene_Information(-67.0f, 156.94f, -425.0f, 500); + Game_Flag_Reset(433); + } else { + Setup_Scene_Information(-53.0f, 156.94f, 174.0f, 1000); + Game_Flag_Reset(427); + } + Scene_Exit_Add_2D_Exit(0, 204, 159, 392, 360, 0); + Scene_Exit_Add_2D_Exit(1, 0, 455, 639, 479, 2); + Ambient_Sounds_Add_Looping_Sound(105, 71, 0, 1); + Ambient_Sounds_Add_Looping_Sound(95, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 76, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(57, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(58, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(198, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(199, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); +} + +void ScriptUG09::SceneLoaded() { + Obstacle_Object("FACADE_CANOPY", true); + Obstacle_Object("VW PROP SLAB", true); + Obstacle_Object("WALL_LEFT FRONT", true); + Unobstacle_Object("PATH_FRAGMENT 1", true); + Unobstacle_Object("BOXS FOR ARCHWAY 02", true); + Unobstacle_Object("BOXS FOR ARCHWAY 04", true); + Unobstacle_Object("BOXS FOR ARCHWAY 05", true); + Unobstacle_Object("BOX45", true); + Unobstacle_Object("BOX44", true); + Unobstacle_Object("BOX43", true); + Unobstacle_Object("BOX42", true); + Unobstacle_Object("BOX41", true); + Unobstacle_Object("BOX40", true); + Unobstacle_Object("BOX39", true); + Unobstacle_Object("BOX38", true); + Unobstacle_Object("BOX37", true); + Unobstacle_Object("BOX36", true); + Unobstacle_Object("BOX35", true); + Unobstacle_Object("BOX34", true); + Unobstacle_Object("BOX32", true); + Clickable_Object("FACADE_CANOPY"); +} + +bool ScriptUG09::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG09::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG09::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG09::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG09::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -67.0f, 156.94f, -425.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(432); + Set_Enter(4, 24); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -53.0f, 156.94f, 206.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(428); + Set_Enter(80, 92); + } + return true; + } + return false; +} + +bool ScriptUG09::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG09::SceneFrameAdvanced(int frame) { + //return false; +} + +void ScriptUG09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG09::PlayerWalkedIn() { + if (Global_Variable_Query(1) == 4 && Game_Flag_Query(623)) { + Game_Flag_Set(630); + } +} + +void ScriptUG09::PlayerWalkedOut() { + if (Global_Variable_Query(1) == 4 && Global_Variable_Query(1) != 5) { + Game_Flag_Reset(630); + } + if (Game_Flag_Query(432)) { + Game_Flag_Set(176); + Game_Flag_Reset(259); + } +} + +void ScriptUG09::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug10.cpp b/engines/bladerunner/script/ug10.cpp new file mode 100644 index 0000000000..9879b6e204 --- /dev/null +++ b/engines/bladerunner/script/ug10.cpp @@ -0,0 +1,234 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG10::InitializeScene() { + if (Game_Flag_Query(336)) { + Setup_Scene_Information(-92.0f, 81.33f, -652.0f, 520); + } else if (Game_Flag_Query(423)) { + Game_Flag_Reset(423); + Setup_Scene_Information(-385.12f, 1.15f, 57.44f, 400); + } else if (Game_Flag_Query(346)) { + Setup_Scene_Information(2.5f, 1.15f, 405.0f, 200); + } else { + Setup_Scene_Information(235.0f, 1.15f, 29.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 589, 300, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 460, 70, 632, 171, 0); + Scene_Exit_Add_2D_Exit(2, 38, 78, 83, 264, 3); + Scene_Exit_Add_2D_Exit(3, 0, 0, 30, 479, 3); + Scene_2D_Region_Add(0, 349, 311, 382, 364); + Ambient_Sounds_Add_Looping_Sound(105, 71, 0, 1); + Ambient_Sounds_Add_Looping_Sound(95, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 76, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(1, 5, 150, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(58, 5, 150, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(230, 2, 20, 25, 32, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(233, 2, 20, 25, 32, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(235, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(394, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(224, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(228, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(229, 2, 190, 12, 16, -100, 100, -100, 100, 0, 0); + if (Game_Flag_Query(474)) { + Scene_Loop_Set_Default(4); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptUG10::SceneLoaded() { + Obstacle_Object("SLUICEGATE_LEVER", true); + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(474) && Game_Flag_Query(172) && !Game_Flag_Query(693)) { + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 6, 1); + Game_Flag_Set(693); + //return true; + } + //return false; +} + +bool ScriptUG10::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG10::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG10::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG10::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG10::ClickedOnExit(int exitId) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if (exitId == 0) { + if ((!Game_Flag_Query(474) && x > 125.0f) || Game_Flag_Query(474)) { + if (!Loop_Actor_Walk_To_XYZ(0, 235.0f, 1.15f, 29.0f, 0, 1, false, 0)) { + Game_Flag_Set(317); + Set_Enter(74, 86); + return true; + } + } else if (!Game_Flag_Query(474)) { + Actor_Says(0, 8521, 3); + } + } else if (exitId == 1) { + if ((!Game_Flag_Query(474) && x < 120.0f) || Game_Flag_Query(474)) { + if (!Loop_Actor_Walk_To_XYZ(0, -1.83f, 1.15f, -410.8f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 0, false); + Loop_Actor_Travel_Stairs(0, 9, 1, 0); + Loop_Actor_Walk_To_XYZ(0, -92.0f, 81.83f, -652.0f, 0, 0, false, 0); + Game_Flag_Set(337); + Set_Enter(76, 88); + return true; + } + } else if (!Game_Flag_Query(474)) { + Actor_Says(0, 6165, 3); + } + } else if (exitId == 2) { + if ((!Game_Flag_Query(474) && x < 120.0f) || Game_Flag_Query(474)) { + if (!Loop_Actor_Walk_To_XYZ(0, -385.0f, 1.15f, 57.44f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 1001, false); + Loop_Actor_Travel_Ladder(0, 1, 1, 0); + Game_Flag_Set(424); + Set_Enter(80, 92); + return true; + } + } else if (!Game_Flag_Query(474)) { + Actor_Says(0, 6165, 3); + } + } else if (exitId == 3) { + if ((!Game_Flag_Query(474) && x < 120.0f) || Game_Flag_Query(474)) { + if (!Loop_Actor_Walk_To_XYZ(0, 2.5f, 1.15f, 405.0f, 0, 1, false, 0)) { + Game_Flag_Set(347); + Set_Enter(86, 98); + return true; + } + } else if (!Game_Flag_Query(474)) { + Actor_Says(0, 6165, 3); + } + } + return false; +} + +bool ScriptUG10::ClickedOn2DRegion(int region) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if (region == 0 && !Player_Query_Combat_Mode()) { + if (x >= 120.0f) { + Actor_Says(0, 8525, 3); + } else if (!Loop_Actor_Walk_To_XYZ(0, 4.98f, 0.38f, 83.15f, 0, 1, false, 0)) { + if (Game_Flag_Query(474)) { + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 0, 0); + Game_Flag_Reset(474); + Obstacle_Object("BOX01 BRIDGE", true); + Player_Loses_Control(); + } else { + Scene_Loop_Set_Default(4); + Scene_Loop_Start_Special(2, 3, 0); + Game_Flag_Set(474); + Unobstacle_Object("BOX01 BRIDGE", true); + Player_Loses_Control(); + } + } + return true; + } + return false; +} + +void ScriptUG10::SceneFrameAdvanced(int frame) { + if (frame == 121) { + Ambient_Sounds_Play_Sound(558, 90, 0, 0, 99); + } + if (frame == 127) { + Ambient_Sounds_Play_Sound(353, 90, 0, 0, 99); + } + if (frame == 147) { + Ambient_Sounds_Play_Sound(353, 90, 0, 0, 99); + } + if (frame == 1) { + Ambient_Sounds_Play_Sound(558, 90, 0, 0, 99); + } + if (frame == 3) { + Ambient_Sounds_Play_Sound(353, 90, 0, 0, 99); + } + if (frame == 23) { + Ambient_Sounds_Play_Sound(353, 90, 0, 0, 99); + } + if (frame == 58 || frame == 179) { + Player_Gains_Control(); + } + //return false; +} + +void ScriptUG10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG10::PlayerWalkedIn() { + if (Game_Flag_Query(346)) { + Game_Flag_Reset(346); + Loop_Actor_Walk_To_XYZ(0, 2.5f, 1.15f, 377.0f, 0, 0, false, 0); + } else if (Game_Flag_Query(316)) { + Game_Flag_Reset(316); + Loop_Actor_Walk_To_XYZ(0, 207.0f, 1.15f, 29.0f, 0, 0, false, 0); + } else if (Game_Flag_Query(336)) { + Game_Flag_Reset(336); + Loop_Actor_Walk_To_XYZ(0, -1.83f, 81.33f, -518.8f, 0, 0, false, 0); + Actor_Face_Heading(0, 506, false); + Loop_Actor_Travel_Stairs(0, 9, 0, 0); + } + if (Game_Flag_Query(474)) { + Unobstacle_Object("BOX01 BRIDGE", true); + } else { + Obstacle_Object("BOX01 BRIDGE", true); + } +} + +void ScriptUG10::PlayerWalkedOut() { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); +} + +void ScriptUG10::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug12.cpp b/engines/bladerunner/script/ug12.cpp new file mode 100644 index 0000000000..695d3093ca --- /dev/null +++ b/engines/bladerunner/script/ug12.cpp @@ -0,0 +1,122 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG12::InitializeScene() { + if (Game_Flag_Query(411)) { + Setup_Scene_Information(207.0f, -126.21f, -364.0f, 561); + Game_Flag_Reset(411); + } else { + Setup_Scene_Information(375.0f, -126.21f, 180.0f, 730); + Game_Flag_Reset(345); + } + Scene_Exit_Add_2D_Exit(0, 538, 222, 615, 346, 1); + if (Game_Flag_Query(373)) { + Scene_Exit_Add_2D_Exit(1, 334, 176, 426, 266, 0); + } + Ambient_Sounds_Add_Looping_Sound(105, 47, 60, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(370, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + if (Game_Flag_Query(373)) { + Scene_Loop_Set_Default(2); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptUG12::SceneLoaded() { + Unobstacle_Object("GATE1", true); + Obstacle_Object("TRAIN WRECK", true); +} + +bool ScriptUG12::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG12::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG12::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG12::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG12::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 375.0f, -126.21f, 180.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(344); + Set_Enter(86, 98); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 207.0f, -126.21f, -364.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(412); + Set_Enter(45, 42); + } + return true; + } + return false; +} + +bool ScriptUG12::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG12::SceneFrameAdvanced(int frame) { +} + +void ScriptUG12::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG12::PlayerWalkedIn() { +} + +void ScriptUG12::PlayerWalkedOut() { +} + +void ScriptUG12::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug13.cpp b/engines/bladerunner/script/ug13.cpp new file mode 100644 index 0000000000..6391b8b97f --- /dev/null +++ b/engines/bladerunner/script/ug13.cpp @@ -0,0 +1,410 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG13::InitializeScene() { + if (Game_Flag_Query(435)) { + Setup_Scene_Information(-477.0f, 141.9f, -870.0f, 378); + } else if (Game_Flag_Query(350)) { + Setup_Scene_Information(39.0f, 52.94f, -528.0f, 600); + } else { + Setup_Scene_Information(-22.0f, 54.63f, -883.0f, 578); + Actor_Set_Invisible(0, false); + } + if (!Game_Flag_Query(431)) { + Scene_Exit_Add_2D_Exit(0, 394, 205, 464, 281, 0); + } + Scene_Exit_Add_2D_Exit(1, 560, 90, 639, 368, 1); + Scene_Exit_Add_2D_Exit(2, 108, 85, 175, 210, 3); + Ambient_Sounds_Add_Looping_Sound(331, 15, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(169)) { + Actor_Set_Goal_Number(12, 390); + } + if (Actor_Query_Goal_Number(12) == 599) { + Actor_Change_Animation_Mode(12, 89); + } + if (Game_Flag_Query(429)) { + Scene_Loop_Start_Special(0, 0, 0); + Scene_Loop_Set_Default(1); + } else if (Game_Flag_Query(431)) { + Scene_Loop_Set_Default(4); + } else { + Scene_Loop_Set_Default(1); + } +} + +void ScriptUG13::SceneLoaded() { + Obstacle_Object("BASKET", true); + Obstacle_Object("BOLLARD", true); + Unobstacle_Object("STAIR", true); + Unobstacle_Object("BOX FOR ARCHWAY 02", true); + Unobstacle_Object("STAIR_RAIL", true); + Unobstacle_Object("DISC_LEFT", true); + Clickable_Object("BASKET"); + Clickable_Object("BOLLARD"); + Unclickable_Object("BASKET"); + if (Global_Variable_Query(1) >= 3 && !Actor_Clue_Query(0, 128) && Game_Flag_Query(169) && (Actor_Clue_Query(0, 81) || Actor_Clue_Query(0, 80))) { + Item_Add_To_World(111, 958, 85, -209.01f, 70.76f, -351.79f, 0, 16, 12, false, true, false, true); + } +} + +bool ScriptUG13::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG13::ClickedOn3DObject(const char *objectName, bool a2) { + + if (Object_Query_Click("BOLLARD", objectName) && !Loop_Actor_Walk_To_XYZ(0, 7.0f, 44.0f, -695.0f, 0, 1, false, 0)) { + Actor_Face_Object(0, "BOLLARD", true); + if (Game_Flag_Query(431)) { + Scene_Loop_Set_Default(1); + Scene_Loop_Start_Special(2, 0, 0); + Game_Flag_Reset(431); + Game_Flag_Set(436); + return true; + } else { + Scene_Loop_Set_Default(4); + Scene_Loop_Start_Special(2, 3, 0); + Game_Flag_Set(431); + Scene_Exit_Remove(0); + return true; + } + } + return false; +} + +bool ScriptUG13::ClickedOnActor(int actorId) { + if (actorId == 12 && Global_Variable_Query(1) == 4 && !Loop_Actor_Walk_To_XYZ(0, -248.0f, 44.0f, -390.0f, 12, 1, false, 0)) { + Actor_Face_Actor(0, 12, true); + if (Actor_Query_Goal_Number(12) != 6 && Actor_Query_Goal_Number(12) != 599) { + if (!Game_Flag_Query(554)) { + sub_40223C(); + } else if (!Actor_Clue_Query(0, 122) || !Actor_Clue_Query(0, 123)) { + sub_402AD4(); + } else { + Actor_Set_Goal_Number(12, 391); + if (Actor_Clue_Query(0, 131)) { + sub_402AD4(); + } else { + Actor_Face_Actor(0, 12, true); + Actor_Says(0, 5600, 14); + Actor_Says(12, 100, 53); + Actor_Says(0, 5605, 18); + Actor_Start_Speech_Sample(12, 110); + Actor_Set_Goal_Number(12, 395); + } + } + } else if (Random_Query(0, 1) == 1) { + Actor_Says(0, 8590, 16); + } else { + Actor_Says(0, 8655, 15); + } + } + return false; +} + +bool ScriptUG13::ClickedOnItem(int itemId, bool a2) { + if (itemId == 111 && !Loop_Actor_Walk_To_Item(0, 111, 36, 1, false)) { + Actor_Face_Item(0, 111, true); + Actor_Clue_Acquire(0, 128, 1, -1); + Item_Remove_From_World(111); + Item_Pickup_Spin_Effect(958, 426, 316); + Actor_Voice_Over(3950, 99); + Actor_Voice_Over(3960, 99); + Actor_Voice_Over(3970, 99); + Actor_Voice_Over(3980, 99); + Actor_Voice_Over(3990, 99); + Actor_Voice_Over(4000, 99); + return true; + } + return false; +} + +bool ScriptUG13::ClickedOnExit(int exitId) { + + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -32.0f, 54.63f, -883.0f, 0, 1, false, 0)) { + Player_Loses_Control(); + Game_Flag_Set(430); + Game_Flag_Set(431); + Set_Enter(81, 93); + Scene_Loop_Start_Special(1, 3, 0); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 39.0f, 52.94f, -528.0f, 0, 1, false, 0)) { + Game_Flag_Set(351); + Set_Enter(87, 99); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -267.0f, 44.0f, -795.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 830, false); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 11, 1, 0); + Footstep_Sound_Override_Off(); + if (!sub_402AD0()) { + Loop_Actor_Walk_To_XYZ(0, -477.0f, 141.9f, -870.0f, 0, 0, false, 0); + Game_Flag_Set(434); + Set_Enter(89, 102); + return true; + } + Actor_Face_Heading(0, 325, false); + Loop_Actor_Travel_Stairs(0, 11, 0, 0); + } else { + return true; + } + } + + return false; +} + +bool ScriptUG13::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG13::SceneFrameAdvanced(int frame) { + if (frame == 94) { + Ambient_Sounds_Play_Sound(372, 90, 0, 0, 100); + } + if (Game_Flag_Query(436) && frame > 29 && frame < 91) { + Scene_Exit_Add_2D_Exit(0, 394, 205, 464, 281, 0); + Game_Flag_Reset(436); + //return true; + return; + } + if (Game_Flag_Query(429) && frame < 25) { + Actor_Set_Invisible(0, true); + } else if (Game_Flag_Query(430) && frame >= 94 && frame <= 120) { + Actor_Set_Invisible(0, true); + } else { + Actor_Set_Invisible(0, false); + } + //return false; + return; +} + +void ScriptUG13::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG13::PlayerWalkedIn() { + if (Game_Flag_Query(435)) { + Loop_Actor_Walk_To_XYZ(0, -389.0f, 143.0f, -844.0f, 0, 0, false, 0); + Actor_Face_Heading(0, 325, false); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 11, 0, 0); + Footstep_Sound_Override_Off(); + Game_Flag_Reset(435); + } else if (Game_Flag_Query(350)) { + Loop_Actor_Walk_To_XYZ(0, -12.0f, 44.0f, -528.0f, 0, 0, false, 0); + Game_Flag_Reset(350); + } else { + Loop_Actor_Walk_To_XYZ(0, -60.0f, 55.24f, -816.0f, 0, 0, false, 0); + Game_Flag_Reset(429); + Player_Gains_Control(); + } + if (Actor_Query_Goal_Number(12) >= 390 && !Game_Flag_Query(169)) { + if (Game_Flag_Query(553)) { + if (Random_Query(1, 3) == 1) { + Actor_Set_Goal_Number(12, 395); + } + } else { + Game_Flag_Set(553); + Actor_Says(12, 50, 3); + } + } + //return false; +} + +void ScriptUG13::PlayerWalkedOut() { + Actor_Set_Invisible(0, false); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + if (Game_Flag_Query(430)) { + Ambient_Sounds_Remove_Sound(401, false); + Ambient_Sounds_Remove_Sound(402, false); + Ambient_Sounds_Remove_Sound(369, false); + Ambient_Sounds_Remove_Sound(397, false); + Ambient_Sounds_Remove_Sound(398, false); + } else { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + } +} + +void ScriptUG13::DialogueQueueFlushed(int a1) { +} + +void ScriptUG13::sub_40223C() { + Actor_Face_Actor(0, 12, true); + Game_Flag_Set(554); + Actor_Says(0, 5560, 13); + Actor_Says_With_Pause(0, 5565, 3.0f, 18); + Actor_Says(12, 70, 31); + Actor_Says(12, 80, 32); + Actor_Says(0, 5570, 3); + Actor_Says(12, 90, 32); +} + +void ScriptUG13::sub_4023D8() { + Actor_Face_Actor(0, 12, true); + Actor_Clue_Acquire(0, 122, 0, 12); + Actor_Modify_Friendliness_To_Other(12, 0, -5); + Actor_Says(0, 5575, 16); + Actor_Says(12, 120, 31); + Actor_Says(0, 5610, 15); + Actor_Says(12, 140, 32); + Actor_Says(0, 5615, 18); + Actor_Says(12, 160, 33); + Actor_Says(0, 5620, 9); + Actor_Says(12, 170, 30); + Actor_Says(0, 5625, 12); + Actor_Says(12, 180, 32); + Actor_Says(0, 5630, 18); + Actor_Says(12, 190, 32); + Actor_Says(0, 5635, 15); + Actor_Says(12, 200, 31); +} + +void ScriptUG13::sub_4025E0() { + Actor_Clue_Acquire(0, 123, 0, 12); + Actor_Modify_Friendliness_To_Other(12, 0, -10); + Actor_Says(12, 220, 30); + Actor_Says(0, 5640, 19); + Actor_Says(12, 230, 33); + Actor_Says(0, 5645, 16); + Actor_Says(12, 240, 30); + Actor_Says(12, 250, 33); + Actor_Says(0, 5650, 14); + Actor_Says(12, 260, 32); +} + +void ScriptUG13::sub_402960() { + Actor_Says(0, 5670, 9); + Actor_Says(12, 340, 31); + Actor_Says(0, 5690, 19); + Actor_Says(12, 350, 32); + Actor_Says(0, 5695, 14); + Actor_Says(12, 360, 33); + Actor_Voice_Over(2710, 99); + Actor_Voice_Over(2730, 99); + Actor_Clue_Acquire(0, 124, 0, 12); +} + +int ScriptUG13::sub_402AD0() { + return 0; +} + +void ScriptUG13::sub_402AD4() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(1320, 6, 3, 1); + if (Actor_Clue_Query(0, 122)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1330, 5, 8, 5); + } + DM_Add_To_List_Never_Repeat_Once_Selected(1340, 2, 4, 6); + if (Actor_Clue_Query(0, 131)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1350, 1, 3, 7); + } + Dialogue_Menu_Add_DONE_To_List(1360); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 1360: + return; + case 1350: + Actor_Clue_Acquire(12, 131, 0, 0); + Actor_Says_With_Pause(0, 5595, 1.0f, 23); + Item_Pickup_Spin_Effect(945, 193, 325); + Actor_Says(12, 290, 33); + Actor_Says(0, 5660, 13); + Actor_Clue_Lose(0, 131); + sub_402E24(); + break; + case 1340: + Actor_Modify_Friendliness_To_Other(12, 0, -10); + Actor_Says(0, 5590, 15); + Actor_Says(12, 270, 31); + Actor_Says(0, 5655, 16); + Actor_Says(12, 280, 32); + break; + case 1330: + Actor_Says(0, 5585, 16); + sub_4025E0(); + break; + case 1320: + sub_4023D8(); + break; + default: + Actor_Face_Actor(0, 12, true); + Actor_Says(0, 5600, 14); + Actor_Says(12, 100, 53); + Actor_Says(0, 5605, 18); + Actor_Start_Speech_Sample(12, 110); + Actor_Set_Goal_Number(12, 395); + break; + } +} + +void ScriptUG13::sub_402E24() { + Actor_Set_Friendliness_To_Other(12, 0, 40); + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(1370, 1, 1, 8); + DM_Add_To_List_Never_Repeat_Once_Selected(1380, 1, 8, 1); + DM_Add_To_List_Never_Repeat_Once_Selected(1390, 8, 1, 1); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + if (answer == 1370) { + Actor_Says(0, 5665, 16); + Actor_Says(12, 300, 32); + Actor_Says(0, 5680, 19); + Actor_Says(12, 310, 33); + Actor_Says(12, 330, 30); + Actor_Start_Speech_Sample(12, 110); + Actor_Set_Goal_Number(12, 395); + Actor_Says(0, 5685, 18); + } else if (answer == 1380) { + if (Actor_Clue_Query(0, 123)) { + sub_402960(); + } else { + Actor_Says(0, 5700, 15); + sub_4025E0(); + } + } else if (answer == 1390) { + Actor_Says(0, 5675, 9); + Actor_Says(12, 370, 32); + Actor_Says(0, 5705, 10); + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug14.cpp b/engines/bladerunner/script/ug14.cpp new file mode 100644 index 0000000000..156f405b0b --- /dev/null +++ b/engines/bladerunner/script/ug14.cpp @@ -0,0 +1,193 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG14::InitializeScene() { + if (Game_Flag_Query(349)) { + Setup_Scene_Information(-278.0f, 12.97f, -152.0f, 200); + } else if (Game_Flag_Query(344)) { + Setup_Scene_Information(-50.0f, 129.0f, -814.0f, 533); + } else { + Setup_Scene_Information(233.0f, 186.04f, -32.0f, 865); + } + Scene_Exit_Add_2D_Exit(0, 0, 232, 45, 427, 3); + Scene_Exit_Add_2D_Exit(1, 175, 44, 228, 115, 0); + Scene_Exit_Add_2D_Exit(2, 537, 0, 639, 190, 1); + Ambient_Sounds_Add_Looping_Sound(331, 28, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 20, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); +} + +void ScriptUG14::SceneLoaded() { + Obstacle_Object("OBSTACLE02", true); + Unobstacle_Object("WALL_E_01", true); + Unclickable_Object("OBSTACLE02"); +} + +bool ScriptUG14::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG14::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG14::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG14::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG14::ClickedOnExit(int exitId) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + bool v1 = y > 57.0f; + if (exitId > 2) { + return false; + } + if (!exitId) { + if (v1) { + if (Loop_Actor_Walk_To_XYZ(0, 141.47f, 128.92f, -150.16f, 0, 1, false, 0)) { + return false; + } + Actor_Face_XYZ(0, -14.53f, 12.12f, -150.16f, true); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 13, 0, 0); + Footstep_Sound_Override_Off(); + } + if (!Loop_Actor_Walk_To_XYZ(0, -278.0f, 12.97f, -152.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(348); + Set_Enter(90, 103); + } + return true; + } + if (exitId == 1) { + if (!v1) { + if (Loop_Actor_Walk_To_XYZ(0, -14.53f, 12.12f, -150.16f, 0, 1, false, 0)) { + return false; + } + Actor_Face_XYZ(0, 141.47f, 128.92f, -150.16f, true); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 13, 1, 0); + Footstep_Sound_Override_Off(); + } + if (!Loop_Actor_Walk_To_XYZ(0, -50.0f, 129.0f, -814.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(345); + Set_Enter(6, 96); + } + return true; + } + + if (exitId == 2) { + if (!v1) { + if (Loop_Actor_Walk_To_XYZ(0, -14.53f, 12.12f, -150.16f, 0, 1, false, 0)) { + return false; + } + Actor_Face_XYZ(0, 141.47f, 128.92f, -150.16f, true); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 13, 1, 0); + Footstep_Sound_Override_Off(); + } + if (!Loop_Actor_Walk_To_XYZ(0, 157.0f, 128.92f, -108.01f, 0, 1, false, 0)) { + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 6, 1, 0); + Footstep_Sound_Override_Off(); + Loop_Actor_Walk_To_XYZ(0, 233.0f, 186.04f, -32.0f, 0, 0, false, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(346); + Set_Enter(83, 95); + } + return true; + } + return false; +} + +bool ScriptUG14::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG14::SceneFrameAdvanced(int frame) { +} + +void ScriptUG14::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG14::PlayerWalkedIn() { + if (Game_Flag_Query(349)) { + Loop_Actor_Walk_To_XYZ(0, -250.0f, 12.97f, -152.0f, 0, 0, false, 0); + Game_Flag_Reset(349); + } else if (Game_Flag_Query(344)) { + Loop_Actor_Walk_To_XYZ(0, -50.0f, 129.0f, -604.0f, 0, 0, false, 0); + Game_Flag_Reset(344); + } else { + Loop_Actor_Walk_To_XYZ(0, 157.0f, 186.04f, -44.01f, 0, 0, false, 0); + Actor_Face_Heading(0, 10, false); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Stairs(0, 6, 0, 0); + Footstep_Sound_Override_Off(); + Loop_Actor_Walk_To_XYZ(0, 157.0f, 128.92f, -148.01f, 0, 0, false, 0); + Actor_Face_Heading(0, 807, false); + Game_Flag_Reset(347); + } + if (Global_Variable_Query(1) == 4 && Game_Flag_Query(172) && !Game_Flag_Query(694)) { + Overlay_Play("UG14OVER", 0, 0, 1, 0); + Delay(1000); + Actor_Face_Heading(0, 609, false); + Delay(3000); + Actor_Voice_Over(270, 99); + Delay(2150); + Actor_Voice_Over(300, 99); + Game_Flag_Set(694); + } + //return false; +} + +void ScriptUG14::PlayerWalkedOut() { +} + +void ScriptUG14::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug15.cpp b/engines/bladerunner/script/ug15.cpp new file mode 100644 index 0000000000..c43288241d --- /dev/null +++ b/engines/bladerunner/script/ug15.cpp @@ -0,0 +1,203 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG15::InitializeScene() { + if (Game_Flag_Query(353)) { + Setup_Scene_Information(-25.0f, 26.309999f, -434.0f, 520); + } else if (Game_Flag_Query(153)) { + Setup_Scene_Information(-17.0f, 26.309999f, -346.0f, 711); + } else if (Game_Flag_Query(355)) { + Setup_Scene_Information(-18.0f, 48.07f, 62.0f, 650); + } else { + Setup_Scene_Information(-238.0f, 48.07f, 222.0f, 180); + if (Game_Flag_Query(676) && Random_Query(1, 10) == 10) { + Game_Flag_Reset(676); + } + } + if (Game_Flag_Query(682)) { + Scene_Loop_Set_Default(3); + } + if (Game_Flag_Query(353) || Game_Flag_Query(153)) { + Scene_Exit_Add_2D_Exit(0, 260, 0, 307, 298, 0); + Scene_Exit_Add_2D_Exit(1, 301, 147, 337, 304, 1); + Game_Flag_Reset(353); + Game_Flag_Reset(153); + } else { + Scene_Exit_Add_2D_Exit(2, 406, 128, 480, 316, 1); + Scene_Exit_Add_2D_Exit(3, 0, 0, 30, 479, 3); + } + Ambient_Sounds_Add_Looping_Sound(105, 71, 0, 1); + Ambient_Sounds_Add_Looping_Sound(95, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 76, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(57, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(58, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(196, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(197, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(198, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(199, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + +} + +void ScriptUG15::SceneLoaded() { + Unobstacle_Object("CATWALK_01_RAIL02", true); + Unobstacle_Object("LOFT01", true); + Obstacle_Object("NUT1", true); + Clickable_Object("NUT1"); +} + +bool ScriptUG15::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG15::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG15::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG15::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG15::ClickedOnExit(int exitId) { + + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -25.0f, 26.31f, -434.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(352); + Set_Enter(88, 101); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -17.0f, 26.31f, -346.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(152); + Set_Enter(19, 100); + } + return true; + } + if (exitId == 2) { + int v1 = Actor_Query_Goal_Number(64); + if (v1 >= 300 && v1 <= 303) { + Loop_Actor_Walk_To_XYZ(0, -137.61f, 48.07f, 147.12f, 0, 1, false, 0); + } else if (!Loop_Actor_Walk_To_XYZ(0, 18.0f, 52.28f, 46.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(354); + Set_Enter(19, 100); + } + return true; + } + if (exitId == 3) { + if (!Loop_Actor_Walk_To_XYZ(0, -238.0f, 52.46f, 222.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(350); + Set_Enter(85, 97); + } + return true; + } + return false; + +} + +bool ScriptUG15::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG15::SceneFrameAdvanced(int frame) { + if (Actor_Query_Goal_Number(64) == 300) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if (-160.0f <= x && z < 220.0f) { + Actor_Set_Goal_Number(64, 301); + } + } + if (frame == 61) { + Ambient_Sounds_Play_Sound(583, 80, 0, 0, 99); + } + if (Game_Flag_Query(677) && !Game_Flag_Query(682)) { + float x, y, z; + Actor_Query_XYZ(0, &x, &y, &z); + if (-180.0f <= x && (z < 220.0f && !Game_Flag_Query(724))) { + Game_Flag_Set(724); + Game_Flag_Set(682); + Scene_Loop_Set_Default(3); + Scene_Loop_Start_Special(2, 2, 1); + Actor_Set_Goal_Number(0, 390); + Actor_Query_XYZ(64, &x, &y, &z); + if (-200.0f < x && -62.0f > x) { + Actor_Set_Goal_Number(64, 309); + } + } + } + // return false; +} + +void ScriptUG15::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG15::PlayerWalkedIn() { + if (Game_Flag_Query(355)) { + Loop_Actor_Walk_To_XYZ(0, -62.0f, 48.07f, 102.0f, 0, 0, false, 0); + Game_Flag_Reset(355); + } else if (Game_Flag_Query(351)) { + Game_Flag_Reset(351); + if (!Game_Flag_Query(676)) { + Actor_Set_Goal_Number(64, 310); + } + } +} + +void ScriptUG15::PlayerWalkedOut() { +} + +void ScriptUG15::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug16.cpp b/engines/bladerunner/script/ug16.cpp new file mode 100644 index 0000000000..2a4a028c3d --- /dev/null +++ b/engines/bladerunner/script/ug16.cpp @@ -0,0 +1,369 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG16::InitializeScene() { + if (Game_Flag_Query(552)) { + Setup_Scene_Information(-270.76f, -34.88f, -504.02f, 404); + Game_Flag_Reset(552); + } else if (Game_Flag_Query(152)) { + Setup_Scene_Information(-322.0f, -34.0f, -404.0f, 345); + Game_Flag_Reset(152); + } else { + Setup_Scene_Information(-318.0f, -34.0f, -216.0f, 340); + Game_Flag_Reset(354); + } + Scene_Exit_Add_2D_Exit(0, 242, 169, 282, 262, 3); + Scene_Exit_Add_2D_Exit(1, 375, 166, 407, 251, 3); + Scene_Exit_Add_2D_Exit(2, 461, 148, 523, 248, 0); + Ambient_Sounds_Add_Looping_Sound(516, 33, 81, 0); + Ambient_Sounds_Add_Looping_Sound(332, 40, 0, 1); + Ambient_Sounds_Add_Looping_Sound(333, 40, 0, 1); + if (Game_Flag_Query(568)) { + Scene_Loop_Set_Default(5); + } else { + Scene_Loop_Set_Default(0); + } +} + +void ScriptUG16::SceneLoaded() { + Obstacle_Object("BED", true); + Obstacle_Object("QUADPATCH07", true); + Obstacle_Object("QUADPATCH05", true); + Obstacle_Object("SCREEN 01", true); + Obstacle_Object("BOX49", true); + Obstacle_Object("CYLINDER07", true); + Unobstacle_Object("SEAT 1", true); + Unobstacle_Object("SEAT 2", true); + Unclickable_Object("BED"); + Unclickable_Object("QUADPATCH07"); + Clickable_Object("QUADPATCH05"); + Clickable_Object("SCREEN 01"); + Unclickable_Object("BOX49"); + Unclickable_Object("CYLINDER07"); + Unobstacle_Object("BOX67", true); + Footstep_Sounds_Set(0, 3); + Footstep_Sounds_Set(1, 2); + Footstep_Sounds_Set(2, 3); + Footstep_Sounds_Set(6, 3); +} + +bool ScriptUG16::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG16::ClickedOn3DObject(const char *objectName, bool a2) { + if (Object_Query_Click("QUADPATCH05", objectName) && !Loop_Actor_Walk_To_XYZ(0, 194.0f, -35.0f, 160.8f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 870, false); + if (!Game_Flag_Query(597) && Game_Flag_Query(595)) { + Game_Flag_Set(597); + Delay(1000); + Actor_Voice_Over(3480, 99); + Actor_Change_Animation_Mode(0, 38); + Sound_Play(339, 100, 0, 0, 50); + Delay(1000); + Item_Pickup_Spin_Effect(948, 460, 287); + Actor_Voice_Over(2740, 99); + Actor_Voice_Over(2750, 99); + Actor_Voice_Over(2760, 99); + Actor_Voice_Over(2770, 99); + Actor_Clue_Acquire(0, 125, 1, -1); + } else { + Actor_Says(0, 8523, 12); + Actor_Says(0, 8635, 12); + } + return true; + } + if (Object_Query_Click("SCREEN 01", objectName) && !Loop_Actor_Walk_To_XYZ(0, 194.0f, -35.0f, 160.8f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 870, false); + if ((!Game_Flag_Query(595) && Actor_Query_Is_In_Current_Set(10)) || Actor_Clue_Query(0, 151) || Game_Flag_Query(568)) { + Actor_Says(0, 8525, 12); + Actor_Says(0, 8526, 12); + return false; + } + Delay(2000); + Actor_Face_Heading(0, 1016, false); + Delay(2000); + Actor_Says(0, 5725, 14); + Delay(1000); + Item_Pickup_Spin_Effect(941, 418, 305); + Actor_Clue_Acquire(0, 151, 1, -1); + return true; + } + return false; +} + +bool ScriptUG16::ClickedOnActor(int actorId) { + if (Actor_Query_Goal_Number(10) < 490) { + sub_401D78(); + return true; + } + return false; +} + +bool ScriptUG16::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG16::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -322.0f, -34.0f, -216.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(355); + Set_Enter(87, 99); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, -322.0f, -34.0f, -404.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(153); + Set_Enter(87, 99); + } + return true; + } + if (exitId == 2) { + if (!Loop_Actor_Walk_To_XYZ(0, -316.78f, -34.88f, -533.27f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 0, false); + Loop_Actor_Travel_Stairs(0, 13, 1, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(551); + Set_Enter(36, 30); + } + return true; + } + return false; +} + +bool ScriptUG16::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG16::SceneFrameAdvanced(int frame) { + if (frame == 132) { + Ambient_Sounds_Remove_Looping_Sound(516, true); + } +} + +void ScriptUG16::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG16::PlayerWalkedIn() { + Game_Flag_Set(715); + if (!Game_Flag_Query(595)) { + Actor_Set_Goal_Number(10, 403); + } + if (!Game_Flag_Query(556) && Actor_Query_Is_In_Current_Set(10)) { + Player_Loses_Control(); + Loop_Actor_Walk_To_XYZ(0, 120.29f, -35.67f, 214.8f, 310, 0, false, 0); + Actor_Face_Actor(0, 10, true); + Actor_Says(10, 0, 6); + Actor_Says(10, 30, 13); + Actor_Change_Animation_Mode(10, 17); + Actor_Says(13, 0, 17); + Actor_Says(0, 5710, 14); + Actor_Says(10, 40, 13); + Actor_Says(10, 50, 15); + Actor_Says(13, 20, 12); + Actor_Says(10, 60, 23); + Actor_Says(0, 5715, 14); + Actor_Says(13, 30, 16); + Actor_Says(10, 70, 6); + Player_Gains_Control(); + Game_Flag_Set(556); + } +} + +void ScriptUG16::PlayerWalkedOut() { + if (!Game_Flag_Query(595)) { + Actor_Set_Goal_Number(10, 401); + //return true; + } + //return false; +} + +void ScriptUG16::DialogueQueueFlushed(int a1) { +} + +void ScriptUG16::sub_401D78() { + Dialogue_Menu_Clear_List(); + DM_Add_To_List_Never_Repeat_Once_Selected(1400, 5, 6, 2); + DM_Add_To_List_Never_Repeat_Once_Selected(1410, 5, 4, 8); + if (Game_Flag_Query(600) || Game_Flag_Query(601)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1420, 6, 4, 5); + DM_Add_To_List_Never_Repeat_Once_Selected(1430, 6, 4, 5); + DM_Add_To_List_Never_Repeat_Once_Selected(1440, 6, 4, 5); + } + if (Global_Variable_Query(49) > 1 && !Actor_Clue_Query(0, 125)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1450, 6, 4, 5); + } + if (Actor_Clue_Query(0, 76)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1460, 6, 4, 5); + } + if (Actor_Clue_Query(0, 147) && !Actor_Clue_Query(0, 125) && Game_Flag_Query(698)) { + DM_Add_To_List_Never_Repeat_Once_Selected(1470, 6, 4, 5); + } + Dialogue_Menu_Add_DONE_To_List(1480); + Dialogue_Menu_Appear(320, 240); + int answer = Dialogue_Menu_Query_Input(); + Dialogue_Menu_Disappear(); + switch (answer) { + case 1400: + Actor_Says(0, 5730, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(10, 100, 18); + Actor_Says(0, 5775, 13); + Actor_Says(13, 70, 17); + Actor_Says(10, 110, 16); + Actor_Says(13, 80, 6); + Actor_Says(0, 5780, 13); + Actor_Says(10, 120, 16); + Actor_Says(13, 120, 13); + Actor_Says(0, 5785, 13); + Actor_Says(10, 130, 6); + Actor_Says(0, 5825, 13); + Actor_Modify_Friendliness_To_Other(10, 0, -5); + if (Game_Flag_Query(560)) { + Actor_Says(10, 140, 13); + Actor_Says(10, 150, 14); + Actor_Says(10, 160, 13); + Actor_Says(13, 140, 16); + Actor_Says(0, 5790, 13); + Actor_Says(10, 170, 14); + Game_Flag_Set(600); + Actor_Modify_Friendliness_To_Other(10, 0, 5); + } else { + Actor_Says(10, 180, 14); + Actor_Says(0, 5795, 13); + Actor_Says(13, 150, 17); + Actor_Says(0, 5800, 13); + Actor_Says(10, 190, 15); + Game_Flag_Set(601); + Actor_Modify_Friendliness_To_Other(10, 0, -10); + } + break; + case 1410: + Actor_Says(0, 5735, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 160, 17); + Actor_Says(10, 200, 14); + break; + case 1420: + Actor_Says(0, 5740, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 180, 15); + Actor_Says(10, 220, 13); + Actor_Says(13, 190, 17); + Actor_Says(0, 5805, 13); + Actor_Says(10, 230, 14); + Actor_Says(10, 240, 13); + Actor_Says(13, 200, 17); + Actor_Says(10, 260, 13); + Actor_Says(10, 270, 15); + Actor_Says(13, 210, 14); + Actor_Says(0, 5810, 13); + Actor_Says(13, 220, 14); + Actor_Says(13, 230, 17); + Actor_Clue_Acquire(0, 136, 1, 10); + break; + case 1430: + Actor_Says(0, 5745, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 240, 15); + Actor_Says(0, 5815, 13); + Actor_Says(13, 250, 16); + Actor_Says(10, 290, 15); + Actor_Says(13, 260, 15); + break; + case 1440: + Actor_Says(0, 5750, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 280, 6); + Actor_Says(10, 300, 14); + Actor_Says(10, 310, 15); + Actor_Modify_Friendliness_To_Other(10, 0, -5); + break; + case 1450: + Actor_Says(0, 5755, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 290, 17); + Actor_Says(10, 320, 16); + Actor_Says(0, 5820, 13); + Actor_Says(13, 300, 17); + Actor_Says(10, 330, 14); + Actor_Says(0, 5825, 13); + Actor_Says(10, 340, 13); + Actor_Says(13, 310, 13); + Actor_Says(10, 350, 13); + Actor_Says(10, 360, 15); + Actor_Says(0, 5830, 13); + Actor_Says(13, 320, 16); + Actor_Says(13, 330, 15); + Game_Flag_Set(698); + break; + case 1460: + Actor_Says(0, 5760, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(10, 370, 15); + Actor_Says(13, 340, 14); + Actor_Says(0, 5835, 13); + Actor_Says(10, 380, 15); + Actor_Says(13, 370, 6); + Actor_Says(0, 5840, 13); + Actor_Says(13, 380, 13); + break; + case 1470: + Actor_Says(0, 5765, 13); + Actor_Face_Actor(0, 10, true); + Actor_Says(13, 400, 15); + Actor_Says(0, 5845, 13); + Actor_Says(10, 390, 23); + Actor_Says(13, 410, 14); + Actor_Says(13, 420, 17); + Actor_Says(0, 5835, 13); + Delay(1000); + Item_Pickup_Spin_Effect(948, 239, 454); + Actor_Voice_Over(2740, 99); + Actor_Voice_Over(2750, 99); + Actor_Voice_Over(2760, 99); + Actor_Voice_Over(2770, 99); + Actor_Says(0, 5850, 13); + Actor_Says(10, 400, 15); + Actor_Says(13, 430, 6); + Actor_Says(0, 5855, 13); + Actor_Says(10, 410, 14); + Game_Flag_Set(597); + Actor_Clue_Acquire(0, 125, 1, 10); + break; + case 1480: + Actor_Says(0, 4595, 14); + break; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug17.cpp b/engines/bladerunner/script/ug17.cpp new file mode 100644 index 0000000000..d438a62ae4 --- /dev/null +++ b/engines/bladerunner/script/ug17.cpp @@ -0,0 +1,117 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG17::InitializeScene() { + if (Game_Flag_Query(447)) { + Setup_Scene_Information(1013.0f, 67.96f, -1892.0f, 525); + Game_Flag_Reset(447); + } else { + Setup_Scene_Information(1000.0f, 67.96f, -1539.0f, 0); + } + Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1); + Scene_Exit_Add_2D_Exit(1, 551, 347, 594, 386, 0); + Ambient_Sounds_Add_Looping_Sound(589, 100, 1, 1); + Ambient_Sounds_Add_Looping_Sound(384, 50, 1, 1); + Ambient_Sounds_Add_Sound(72, 5, 80, 10, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(73, 5, 80, 10, 11, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(74, 5, 80, 10, 11, -100, 100, -101, -101, 0, 0); + Overlay_Play("UG17OVER", 0, 1, 0, 0); +} + +void ScriptUG17::SceneLoaded() { + Obstacle_Object("BOX FOR BIG VENT13", true); + Unclickable_Object("BOX FOR BIG VENT13"); +} + +bool ScriptUG17::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG17::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG17::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG17::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG17::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 1000.0f, 67.96f, -1539.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(353); + Set_Enter(87, 99); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 1013.0f, 67.96f, -1892.0f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 89, false); + if (Global_Variable_Query(1) == 5) { + Actor_Says(0, 8522, 14); + } else { + Loop_Actor_Travel_Ladder(0, 10, 1, 0); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(448); + Set_Enter(17, 83); + } + } + return true; + } + return false; +} + +bool ScriptUG17::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG17::SceneFrameAdvanced(int frame) { +} + +void ScriptUG17::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG17::PlayerWalkedIn() { + if (Game_Flag_Query(352)) { + Loop_Actor_Walk_To_XYZ(0, 961.0f, 67.96f, -1539.0f, 0, 0, false, 0); + Game_Flag_Reset(352); + } + //return false; +} + +void ScriptUG17::PlayerWalkedOut() { +} + +void ScriptUG17::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug18.cpp b/engines/bladerunner/script/ug18.cpp new file mode 100644 index 0000000000..215d447a85 --- /dev/null +++ b/engines/bladerunner/script/ug18.cpp @@ -0,0 +1,407 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG18::InitializeScene() { + Setup_Scene_Information(-684.71f, 0.0f, 171.59f, 0); + Game_Flag_Reset(434); + Scene_Exit_Add_2D_Exit(0, 0, 158, 100, 340, 3); + Ambient_Sounds_Add_Looping_Sound(105, 71, 0, 1); + Ambient_Sounds_Add_Looping_Sound(95, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 76, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(402, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(368, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 25, 25, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(57, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(58, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(196, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(197, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(198, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(199, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Scene_Loop_Set_Default(4); + if (Game_Flag_Query(670) && !Game_Flag_Query(671) && Global_Variable_Query(1) == 4) { + Actor_Set_Goal_Number(4, 300); + Actor_Set_Goal_Number(5, 300); + Actor_Set_Goal_Number(8, 300); + } +} + +void ScriptUG18::SceneLoaded() { + Obstacle_Object("MACHINE_01", true); + Unobstacle_Object("PLATFM_RAIL 01", true); + Unobstacle_Object("PLATFM_RAIL 02", true); + Unobstacle_Object("OBSTACLE1", true); + Clickable_Object("MACHINE_01"); + Unclickable_Object("MACHINE_01"); + if (Game_Flag_Query(671)) { + Actor_Put_In_Set(4, 99); + Actor_Set_At_Waypoint(4, 41, 0); + if (Actor_Query_Which_Set_In(8) == 89) { + Actor_Put_In_Set(8, 91); + Actor_Set_At_Waypoint(8, 33, 0); + } + } + if (Game_Flag_Query(670) && !Game_Flag_Query(671) && Global_Variable_Query(1) == 4) { + Item_Add_To_World(91, 987, 89, -55.21f, 0.0f, -302.17f, 0, 12, 12, false, true, false, true); + } + +} + +bool ScriptUG18::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG18::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG18::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG18::ClickedOnItem(int itemId, bool a2) { + if (itemId == 91) { + if (a2) { + Item_Remove_From_World(91); + } else if (!Loop_Actor_Walk_To_Item(0, 91, 12, 1, false)) { + Item_Pickup_Spin_Effect(987, 368, 243); + Item_Remove_From_World(itemId); + Game_Flag_Set(703); + Actor_Clue_Acquire(0, 32, 1, 4); + } + } + return false; +} + +bool ScriptUG18::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, -684.712f, 0.0f, 171.59f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(435); + Set_Enter(85, 97); + } + return true; + } + return false; +} + +bool ScriptUG18::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG18::SceneFrameAdvanced(int frame) { +} + +void ScriptUG18::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { + if (actorId == 4) { + if (newGoal == 303) { + Game_Flag_Set(607); + ADQ_Flush(); + Actor_Modify_Friendliness_To_Other(5, 0, 7); + Actor_Modify_Friendliness_To_Other(8, 0, 10); + Player_Loses_Control(); + Actor_Face_Actor(4, 0, true); + ADQ_Add(4, 1220, 58); + Scene_Exits_Enable(); + Actor_Set_Goal_Number(4, 305); + } else if (newGoal == 304) { + ADQ_Flush(); + Actor_Modify_Friendliness_To_Other(5, 0, 7); + Actor_Modify_Friendliness_To_Other(8, 0, 10); + Player_Loses_Control(); + Actor_Face_Actor(4, 0, true); + ADQ_Add(4, 1220, 58); + Scene_Exits_Enable(); + Actor_Set_Goal_Number(4, 306); + } + } else if (actorId == 8) { + if (newGoal == 302) { + if (Actor_Query_Friendliness_To_Other(5, 0) > 55 && Game_Flag_Query(607)) { + sub_403588(); + } else { + Actor_Set_Goal_Number(8, 307); + Actor_Set_Goal_Number(5, 310); + } + } else if (newGoal == 304) { + Actor_Modify_Friendliness_To_Other(5, 0, -3); + ADQ_Add(8, 380, -1); + Actor_Set_Goal_Number(8, 306); + } else if (newGoal == 305) { + Actor_Change_Animation_Mode(8, 6); + Sound_Play(12, 100, 0, 0, 50); + Actor_Force_Stop_Walking(0); + Actor_Change_Animation_Mode(0, 48); + Player_Loses_Control(); + Actor_Retired_Here(0, 6, 6, 1, 8); + } + } +} + +void ScriptUG18::PlayerWalkedIn() { + Loop_Actor_Walk_To_XYZ(0, -488.71f, 0.0f, 123.59f, 0, 0, false, 0); + if (Game_Flag_Query(670) && !Game_Flag_Query(671) && Actor_Query_Is_In_Current_Set(4)) { + Scene_Exits_Disable(); + sub_402734(); + sub_403278(); + Game_Flag_Set(671); + } +} + +void ScriptUG18::PlayerWalkedOut() { +} + +void ScriptUG18::DialogueQueueFlushed(int a1) { + int v0 = Actor_Query_Goal_Number(4); + if (v0 == 301) { + Actor_Set_Goal_Number(4, 302); + Actor_Change_Animation_Mode(8, 6); + Sound_Play(14, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 22); + ADQ_Add(5, 630, 13); + Actor_Set_Goal_Number(5, 301); + } else if (v0 == 305) { + Actor_Change_Animation_Mode(0, 6); + Sound_Play(13, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 22); + Delay(900); + Actor_Change_Animation_Mode(0, 6); + Sound_Play(14, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 22); + Delay(1100); + Actor_Change_Animation_Mode(0, 6); + Sound_Play(12, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 22); + Delay(900); + Actor_Change_Animation_Mode(0, 6); + Sound_Play(14, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 61); + Overlay_Play("UG18over", 1, 0, 1, 0); + Actor_Set_Goal_Number(4, 307); + Player_Gains_Control(); + ADQ_Add_Pause(2000); + ADQ_Add(8, 360, -1); + ADQ_Add_Pause(2000); + ADQ_Add(5, 650, 14); + ADQ_Add(8, 370, 14); + ADQ_Add(5, 1320, 14); + Actor_Set_Goal_Number(5, 303); + } else if (v0 == 306) { + Actor_Change_Animation_Mode(4, 6); + Sound_Play(13, 100, 0, 0, 50); + Actor_Force_Stop_Walking(0); + Actor_Change_Animation_Mode(0, 48); + Player_Loses_Control(); + Actor_Retired_Here(0, 6, 6, 1, 4); + Actor_Set_Goal_Number(4, 307); + } + + int v1 = Actor_Query_Goal_Number(5); + if (v1 == 301) { + Actor_Change_Animation_Mode(8, 6); + Sound_Play(14, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 22); + ADQ_Add(5, 640, 13); + ADQ_Add(4, 1210, 13); + Actor_Set_Goal_Number(5, 302); + } else if (v1 == 302) { + Actor_Change_Animation_Mode(8, 6); + Sound_Play(14, 100, 0, 0, 50); + Actor_Change_Animation_Mode(4, 61); + ADQ_Add_Pause(2000); + ADQ_Add(5, 650, 14); + ADQ_Add(8, 370, 14); + ADQ_Add(5, 1320, 14); + Actor_Set_Goal_Number(4, 390); + Actor_Retired_Here(4, 72, 32, 1, 8); + Actor_Set_Goal_Number(5, 303); + Scene_Exits_Enable(); + } else if (v1 == 303) { + Actor_Set_Goal_Number(8, 301); + } + if (Actor_Query_Goal_Number(8) == 306) { + Actor_Change_Animation_Mode(8, 48); + Actor_Set_Goal_Number(8, 307); + Actor_Set_Goal_Number(5, 310); + } +} + +void ScriptUG18::sub_402734() { + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5860, 9); + Delay(500); + Actor_Face_Actor(4, 0, true); + Delay(500); + Actor_Says(4, 790, 3); + Actor_Says(0, 5865, 12); + Actor_Says(4, 800, 3); + Loop_Actor_Walk_To_XYZ(0, -357.13f, 0.0f, -44.47f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5870, 14); + Actor_Face_Actor(4, 0, true); + Actor_Start_Speech_Sample(4, 810); + Loop_Actor_Walk_To_XYZ(4, -57.21f, 0.0f, -334.17f, 0, 0, false, 0); + Actor_Says(0, 5875, 13); + Actor_Says(4, 830, 3); + Actor_Says(4, 840, 12); + Actor_Says(4, 850, 14); + Actor_Says(4, 860, 13); + Actor_Says(0, 5880, 15); + Actor_Says(0, 5885, 9); + Actor_Says(0, 5890, 13); + Actor_Says(4, 870, 15); + Loop_Actor_Walk_To_XYZ(0, -205.13f, 0.0f, -184.47f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5900, 15); + Actor_Says(4, 880, 13); + Actor_Says(0, 5905, 9); + Actor_Says(0, 5910, 12); + Actor_Says(0, 5915, 13); + Actor_Says(4, 890, 16); + Actor_Says(0, 5920, 14); + Loop_Actor_Walk_To_XYZ(4, -57.21f, 0.0f, -334.17f, 0, 0, false, 0); + Actor_Face_Actor(4, 0, true); + Actor_Says(4, 900, 15); + Actor_Says(4, 910, 12); + Actor_Says(4, 920, 16); + Actor_Says(0, 5925, 14); + Actor_Says(4, 940, 14); + Actor_Says(0, 5930, 18); + Actor_Says(4, 950, 14); + Actor_Says(4, 960, 13); + Actor_Says(4, 970, 3); + if (Game_Flag_Query(607)) { + Actor_Modify_Friendliness_To_Other(5, 0, 3); + Actor_Modify_Friendliness_To_Other(8, 0, 5); + Loop_Actor_Walk_To_XYZ(0, -117.13f, 0.0f, -284.47f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5960, 9); + Actor_Says(0, 5965, 14); + Actor_Says(4, 980, 15); + Actor_Says(4, 990, 13); + Actor_Says(0, 5970, 14); + Actor_Says(4, 1000, 3); + Actor_Says(0, 5975, 15); + } else { + sub_402DE8(); + } +} + +void ScriptUG18::sub_402DE8() { + + if (Player_Query_Agenda()) { + if (Global_Variable_Query(45) > 1 || Player_Query_Agenda() == 2) { + sub_403114(); + } else { + sub_402F8C(); + } + } else { + Actor_Modify_Friendliness_To_Other(5, 0, -1); + Actor_Modify_Friendliness_To_Other(8, 0, -1); + Actor_Says(0, 5935, 14); + Actor_Says(0, 5940, 18); + Actor_Says(4, 1020, 13); + Actor_Says(4, 1030, 14); + } +} + +void ScriptUG18::sub_402F8C() { + Loop_Actor_Walk_To_XYZ(0, -117.13f, 0.0f, -284.47f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5945, 12); + Actor_Says(4, 1040, 15); + Actor_Says(0, 5980, 15); + Actor_Says(4, 1050, 12); + Actor_Says(4, 1060, 13); + Actor_Says(4, 1070, 14); + Actor_Says(0, 5985, 18); + Actor_Says(4, 1080, 3); + Actor_Says(4, 1090, 14); + Actor_Says(4, 1100, 13); +} + +void ScriptUG18::sub_403114() { + Actor_Modify_Friendliness_To_Other(5, 0, 20); + Actor_Modify_Friendliness_To_Other(8, 0, 10); + Loop_Actor_Walk_To_XYZ(0, -117.13f, 0.0f, -284.47f, 0, 0, false, 0); + Actor_Face_Actor(0, 4, true); + Actor_Says(0, 5950, 16); + Actor_Says(0, 5955, 14); + Actor_Says(4, 1110, 13); + Actor_Says(4, 1120, 15); + Actor_Says(0, 5990, 3); + Actor_Says(4, 1130, 15); + Actor_Says(4, 1140, 16); +} + +void ScriptUG18::sub_403278() { + ADQ_Flush(); + Actor_Start_Speech_Sample(5, 590); + Delay(500); + Loop_Actor_Walk_To_XYZ(4, 126.79f, 0.0f, -362.17f, 0, 0, false, 0); + Actor_Face_Heading(4, 729, false); + Actor_Set_Goal_Number(4, 301); + ADQ_Add(8, 350, 13); + ADQ_Add_Pause(1500); + ADQ_Add(4, 1150, 58); + ADQ_Add(5, 600, 13); + ADQ_Add_Pause(1000); + ADQ_Add(4, 1160, 60); + ADQ_Add_Pause(500); + ADQ_Add(4, 1170, 59); + ADQ_Add(4, 1180, 58); + ADQ_Add(5, 610, 13); + ADQ_Add(4, 1190, 60); + ADQ_Add(5, 620, 13); + ADQ_Add(4, 1200, 59); +} + +void ScriptUG18::sub_403588() { + Actor_Says(5, 660, 13); + Actor_Says(0, 5995, 13); + Actor_Says(5, 670, 13); + Actor_Says(0, 6000, 13); + Actor_Says_With_Pause(5, 680, 2.0f, 13); + Actor_Says(5, 690, 13); + Actor_Says(5, 700, 13); + Actor_Set_Goal_Number(8, 310); + Actor_Set_Goal_Number(5, 310); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/ug19.cpp b/engines/bladerunner/script/ug19.cpp new file mode 100644 index 0000000000..9a6000d363 --- /dev/null +++ b/engines/bladerunner/script/ug19.cpp @@ -0,0 +1,139 @@ +/* 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/script/script.h" + +namespace BladeRunner { + +void ScriptUG19::InitializeScene() { + if (Game_Flag_Query(357)) { + Setup_Scene_Information(67.03f, 105.0f, -74.97f, 256); + } else { + Setup_Scene_Information(181.0f, 11.52f, -18.0f, 777); + } + Scene_Exit_Add_2D_Exit(0, 351, 0, 491, 347, 0); + Scene_Exit_Add_2D_Exit(1, 548, 124, 639, 369, 1); + Ambient_Sounds_Add_Looping_Sound(95, 45, 0, 1); + Ambient_Sounds_Add_Looping_Sound(332, 76, 0, 1); + Ambient_Sounds_Add_Sound(291, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(292, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(293, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(294, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(295, 2, 20, 25, 33, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(401, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(396, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); + Ambient_Sounds_Add_Sound(303, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(304, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(305, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(1, 5, 50, 47, 57, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(57, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(58, 5, 50, 17, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(306, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(307, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(308, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(196, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(197, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(198, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + Ambient_Sounds_Add_Sound(199, 5, 50, 27, 37, -100, 100, -101, -101, 0, 0); + +} + +void ScriptUG19::SceneLoaded() { + Obstacle_Object("LADDER", true); + Unclickable_Object("LADDER"); + Footstep_Sounds_Set(1, 0); + Footstep_Sounds_Set(0, 3); +} + +bool ScriptUG19::MouseClick(int x, int y) { + return false; +} + +bool ScriptUG19::ClickedOn3DObject(const char *objectName, bool a2) { + return false; +} + +bool ScriptUG19::ClickedOnActor(int actorId) { + return false; +} + +bool ScriptUG19::ClickedOnItem(int itemId, bool a2) { + return false; +} + +bool ScriptUG19::ClickedOnExit(int exitId) { + if (exitId == 0) { + if (!Loop_Actor_Walk_To_XYZ(0, 67.03f, 7.29f, -74.97f, 0, 1, false, 0)) { + Actor_Face_Heading(0, 256, false); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Ladder(0, 8, 1, 0); + Footstep_Sound_Override_Off(); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(356); + Set_Enter(53, 53); + } + return true; + } + if (exitId == 1) { + if (!Loop_Actor_Walk_To_XYZ(0, 181.0f, 11.52f, -18.0f, 0, 1, false, 0)) { + Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Looping_Sounds(1); + Game_Flag_Set(349); + Set_Enter(86, 98); + } + return true; + } + return false; +} + +bool ScriptUG19::ClickedOn2DRegion(int region) { + return false; +} + +void ScriptUG19::SceneFrameAdvanced(int frame) { +} + +void ScriptUG19::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { +} + +void ScriptUG19::PlayerWalkedIn() { + if (Game_Flag_Query(348)) { + Game_Flag_Reset(348); + Loop_Actor_Walk_To_XYZ(0, 129.0f, 11.52f, -18.0f, 0, 0, false, 0); + } else { + Game_Flag_Reset(357); + Footstep_Sound_Override_On(3); + Loop_Actor_Travel_Ladder(0, 8, 0, 0); + Footstep_Sound_Override_Off(); + } +} + +void ScriptUG19::PlayerWalkedOut() { +} + +void ScriptUG19::DialogueQueueFlushed(int a1) { +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/vk.cpp b/engines/bladerunner/script/vk.cpp new file mode 100644 index 0000000000..5dfbbd7ae4 --- /dev/null +++ b/engines/bladerunner/script/vk.cpp @@ -0,0 +1,3524 @@ +/* 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/script/vk.h" + +#include "bladerunner/bladerunner.h" + +namespace BladeRunner { + +bool ScriptVK::SCRIPT_VK_DLL_Initialize(int a1) { + VK_Add_Question(0, 7400, -1); + VK_Add_Question(0, 7405, -1); + VK_Add_Question(0, 7410, -1); + VK_Add_Question(0, 7415, -1); + VK_Add_Question(0, 7420, -1); + VK_Add_Question(0, 7425, -1); + if (a1 == 6 || a1 == 3) { + VK_Add_Question(0, 7430, -1); + } + VK_Add_Question(0, 7435, -1); + VK_Add_Question(0, 7440, -1); + VK_Add_Question(0, 7445, -1); + VK_Add_Question(0, 7450, -1); + VK_Add_Question(0, 7455, -1); + VK_Add_Question(0, 7460, -1); + VK_Add_Question(0, 7465, -1); + VK_Add_Question(0, 7470, -1); + VK_Add_Question(1, 7475, -1); + VK_Add_Question(1, 7480, -1); + VK_Add_Question(1, 7485, -1); + VK_Add_Question(1, 7490, -1); + VK_Add_Question(1, 7495, -1); + VK_Add_Question(1, 7515, -1); + VK_Add_Question(1, 7525, -1); + VK_Add_Question(1, 7535, -1); + VK_Add_Question(1, 7540, -1); + VK_Add_Question(1, 7550, -1); + VK_Add_Question(1, 7565, -1); + VK_Add_Question(1, 7580, -1); + VK_Add_Question(1, 7585, -1); + VK_Add_Question(1, 7595, -1); + VK_Add_Question(1, 7600, -1); + VK_Add_Question(2, 7605, -1); + VK_Add_Question(2, 7620, -1); + VK_Add_Question(2, 7635, -1); + VK_Add_Question(2, 7670, -1); + VK_Add_Question(2, 7680, -1); + VK_Add_Question(2, 7690, -1); + VK_Add_Question(2, 7705, -1); + VK_Add_Question(2, 7740, -1); + VK_Add_Question(2, 7750, -1); + VK_Add_Question(2, 7770, -1); + switch (a1) { + default: + return false; + case 3: + case 6: + case 11: + case 14: + case 15: + return true; + + } +} + +void ScriptVK::SCRIPT_VK_DLL_Calibrate(int a1) { + + if (unknown1 <= 2) { + if (unknown1 == 0) { + VK_Play_Speech_Line(0, 7370, 0.5f); + VK_Play_Speech_Line(0, 7385, 0.5f); + sub_40A300(a1, 7385); + + } else if (unknown1 == 1) { + VK_Play_Speech_Line(0, 7390, 0.5f); + sub_40A350(a1, 7390); + } else { + VK_Play_Speech_Line(0, 7395, 0.5f); + sub_40A3A0(a1, 7395); + } + } + unknown1++; + if (unknown1 > 3) //bug? + { + unknown1 = 0; + } +} + +bool ScriptVK::SCRIPT_VK_DLL_Begin_Test() { + unknown2 = 0; + return false; +} + +void ScriptVK::SCRIPT_VK_DLL_McCoy_Asks_Question(int a1, int a2) { + switch (a2) { + case 7495: + VK_Play_Speech_Line(0, 7495, 0.5f); + VK_Play_Speech_Line(0, 7500, 0.5f); + VK_Play_Speech_Line(0, 7505, 0.5f); + VK_Play_Speech_Line(0, 7510, 0.5f); + break; + case 7490: + VK_Play_Speech_Line(0, 7490, 0.5f); + break; + case 7485: + VK_Play_Speech_Line(0, 7485, 0.5f); + break; + case 7480: + VK_Play_Speech_Line(0, 7480, 0.5f); + break; + case 7475: + VK_Play_Speech_Line(0, 7475, 0.5f); + break; + case 7470: + VK_Play_Speech_Line(0, 7470, 0.5f); + break; + case 7465: + VK_Play_Speech_Line(0, 7465, 0.5f); + break; + case 7460: + VK_Play_Speech_Line(0, 7460, 0.5f); + break; + case 7455: + VK_Play_Speech_Line(0, 7455, 0.5f); + break; + case 7450: + VK_Play_Speech_Line(0, 7450, 0.5f); + break; + case 7445: + VK_Play_Speech_Line(0, 7445, 0.5f); + break; + case 7440: + VK_Play_Speech_Line(0, 7440, 0.5f); + break; + case 7435: + VK_Play_Speech_Line(0, 7435, 0.5f); + break; + case 7430: + VK_Play_Speech_Line(0, 7430, 0.5f); + break; + case 7425: + VK_Play_Speech_Line(0, 7425, 0.5f); + break; + case 7420: + VK_Play_Speech_Line(0, 7420, 0.5f); + break; + case 7415: + VK_Play_Speech_Line(0, 7415, 0.5f); + break; + case 7410: + VK_Play_Speech_Line(0, 7410, 0.5f); + break; + case 7405: + VK_Play_Speech_Line(0, 7405, 0.5f); + break; + case 7400: + VK_Play_Speech_Line(0, 7400, 0.5f); + break; + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + break; + default: + switch (a2) { + case 7635: + VK_Play_Speech_Line(0, 7635, 0.5f); + VK_Play_Speech_Line(0, 7640, 0.5f); + if (a1 != 11 && a1 != 14) { + VK_Play_Speech_Line(0, 7645, 0.5f); + VK_Play_Speech_Line(0, 7650, 0.5f); + if (a1 != 6) { + VK_Play_Speech_Line(0, 7655, 0.5f); + VK_Play_Speech_Line(0, 7660, 0.5f); + VK_Play_Speech_Line(0, 7665, 0.5f); + } + } + break; + case 7620: + VK_Play_Speech_Line(0, 7620, 0.5f); + VK_Play_Speech_Line(0, 7625, 0.5f); + if (a1 != 14) { + if (a1 == 3 && Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2330, 0.5f); + VK_Play_Speech_Line(0, 7880, 0.5f); + } + VK_Play_Speech_Line(0, 7630, 0.5f); + } + break; + case 7605: + VK_Play_Speech_Line(0, 7605, 0.5f); + VK_Play_Speech_Line(0, 7610, 0.5f); + VK_Play_Speech_Line(0, 7615, 0.5f); + break; + case 7600: + VK_Play_Speech_Line(0, 7600, 0.5f); + break; + case 7595: + VK_Play_Speech_Line(0, 7595, 0.5f); + break; + case 7585: + VK_Play_Speech_Line(0, 7585, 0.5f); + if (a1 != 6 && a1 != 14) { + VK_Play_Speech_Line(0, 7590, 0.5f); + } + break; + case 7580: + VK_Play_Speech_Line(0, 7580, 0.5f); + break; + case 7565: + VK_Play_Speech_Line(0, 7565, 0.5f); + if (a1 != 14) { + VK_Play_Speech_Line(0, 7570, 0.5f); + VK_Play_Speech_Line(0, 7575, 0.5f); + } + break; + case 7550: + VK_Play_Speech_Line(0, 7550, 0.5f); + VK_Play_Speech_Line(0, 7555, 0.5f); + VK_Play_Speech_Line(0, 7560, 0.5f); + break; + case 7540: + VK_Play_Speech_Line(0, 7540, 0.5f); + VK_Play_Speech_Line(0, 7545, 0.5f); + break; + case 7535: + VK_Play_Speech_Line(0, 7535, 0.5f); + break; + case 7525: + VK_Play_Speech_Line(0, 7525, 0.5f); + VK_Play_Speech_Line(0, 7530, 0.5f); + break; + case 7515: + VK_Play_Speech_Line(0, 7515, 0.5f); + VK_Play_Speech_Line(0, 7520, 0.5f); + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + if (++unknown2 >= 10) { + VK_Subject_Reacts(5, 0, 0, 100); + } + return; + default: + switch (a2) { + case 7705: + VK_Play_Speech_Line(0, 7705, 0.5f); + VK_Play_Speech_Line(0, 7710, 0.5f); + VK_Play_Speech_Line(0, 7715, 0.5f); + if (a1 != 11 && a1 != 14) { + VK_Play_Speech_Line(0, 7720, 0.5f); + VK_Play_Speech_Line(0, 7725, 0.5f); + if (a1 != 6) { + if (a1 == 3) { + VK_Play_Speech_Line(3, 2490, 0.5f); + } + VK_Play_Speech_Line(0, 7730, 0.5f); + VK_Play_Speech_Line(0, 7735, 0.5f); + } + } + break; + case 7690: + VK_Play_Speech_Line(0, 7690, 0.5f); + if (a1 != 11) { + VK_Play_Speech_Line(0, 7695, 0.5f); + VK_Play_Speech_Line(0, 7700, 0.5f); + } + break; + case 7680: + VK_Play_Speech_Line(0, 7680, 0.5f); + VK_Play_Speech_Line(0, 7685, 0.5f); + break; + case 7670: + VK_Play_Speech_Line(0, 7670, 0.5f); + VK_Play_Speech_Line(0, 7675, 0.5f); + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + if (++unknown2 >= 10) { + VK_Subject_Reacts(5, 0, 0, 100); + } + return; + default: + if ((unsigned int)(a2 - 7740) > 10) { + if (a2 == 7770) { + VK_Play_Speech_Line(0, 7770, 0.5f); + if (a1 == 3) { + VK_Play_Speech_Line(3, 2620, 0.5f); + } + VK_Play_Speech_Line(0, 7775, 0.5f); + VK_Play_Speech_Line(0, 7780, 0.5f); + } + } else if (a2 == 7740) { + VK_Play_Speech_Line(0, 7740, 0.5f); + VK_Play_Speech_Line(0, 7745, 0.5f); + } else if (a2 == 7750) { + VK_Play_Speech_Line(0, 7750, 0.5f); + VK_Play_Speech_Line(0, 7755, 0.5f); + if (a1 == 3) { + VK_Play_Speech_Line(3, 2570, 0.5f); + } + VK_Play_Speech_Line(0, 7760, 0.5f); + VK_Play_Speech_Line(0, 7765, 0.5f); + } + break; + } + break; + } + break; + } + if (++unknown2 >= 10) { + VK_Subject_Reacts(5, 0, 0, 100); + } +} + +void ScriptVK::SCRIPT_VK_DLL_Question_Asked(int a1, int a2) { + switch (a1) { + case 15: + sub_407CF8(a2); + break; + case 14: + sub_40897C(a2); + break; + case 11: + sub_404B44(a2); + break; + case 6: + sub_402604(a2); + break; + case 3: + sub_406088(a2); + break; + } +} + +void ScriptVK::SCRIPT_VK_DLL_Shutdown(int a1, signed int a2, signed int a3) { + if (a2 > 79 && a3 > 79) { + VK_Play_Speech_Line(39, 450, 0.5f); + } else if (a3 > 79) { + VK_Play_Speech_Line(39, 420, 0.5f); + VK_Play_Speech_Line(39, 430, 0.5f); + switch (a1) { + case 15: + Actor_Clue_Acquire(0, 174, 1, -1); + break; + case 14: + Actor_Clue_Acquire(0, 164, 1, -1); + break; + case 11: + Actor_Clue_Acquire(0, 168, 1, -1); + break; + case 6: + Actor_Clue_Acquire(0, 271, 1, -1); + break; + case 3: + Actor_Clue_Acquire(0, 162, 1, -1); + break; + default: + break; + } + } else if (a2 > 79) { + VK_Play_Speech_Line(39, 420, 0.5f); + VK_Play_Speech_Line(39, 440, 0.5f); + switch (a1) { + case 15: + Actor_Clue_Acquire(0, 175, 1, -1); + break; + case 14: + Actor_Clue_Acquire(0, 165, 1, -1); + break; + case 11: + Actor_Clue_Acquire(0, 169, 1, -1); + break; + case 6: + Actor_Clue_Acquire(0, 272, 1, -1); + break; + case 3: + Actor_Clue_Acquire(0, 163, 1, -1); + break; + case 4: + case 5: + case 7: + case 8: + case 9: + case 10: + case 12: + case 13: + break; + } + } + VK_Play_Speech_Line(39, 460, 0.5f); +} + +void ScriptVK::sub_402604(int a1) { + switch (a1) { + case 7495: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(10, 2, 8, 5); + } else { + VK_Subject_Reacts(30, 10, -1, 5); + } + VK_Play_Speech_Line(6, 1770, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 1780, 0.5f); + break; + case 7490: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(30, 3, 11, 9); + } else { + VK_Subject_Reacts(40, 11, 1, 8); + } + VK_Play_Speech_Line(6, 1750, 0.5f); + VK_Play_Speech_Line(0, 7985, 0.5f); + VK_Play_Speech_Line(0, 7990, 0.5f); + VK_Play_Speech_Line(6, 1760, 0.5f); + break; + case 7485: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, -2, 10, 6); + } else { + VK_Subject_Reacts(30, 10, -2, 6); + VK_Eye_Animates(2); + } + VK_Play_Speech_Line(6, 1740, 0.5f); + break; + case 7480: + VK_Play_Speech_Line(6, 1720, 0.5f); + VK_Play_Speech_Line(0, 7975, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, 2, 10, 7); + } else { + VK_Subject_Reacts(50, 12, 3, 7); + } + VK_Play_Speech_Line(6, 1730, 0.5f); + VK_Play_Speech_Line(0, 7980, 0.5f); + break; + case 7475: + if (Game_Flag_Query(46)) { + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1660, 0.5f); + VK_Play_Speech_Line(0, 7965, 0.5f); + VK_Subject_Reacts(70, -3, 13, 10); + VK_Play_Speech_Line(6, 1670, 0.5f); + } else { + VK_Play_Speech_Line(6, 1680, 0.5f); + VK_Subject_Reacts(60, 13, -4, 5); + VK_Play_Speech_Line(6, 1690, 0.5f); + VK_Play_Speech_Line(0, 7970, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1700, 0.5f); + VK_Play_Speech_Line(6, 1710, 0.5f); + } + break; + case 7470: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1610, 0.5f); + VK_Subject_Reacts(20, 3, 9, -5); + VK_Play_Speech_Line(6, 1620, 0.5f); + } else { + VK_Subject_Reacts(30, 9, 0, -5); + VK_Play_Speech_Line(6, 1630, 0.5f); + VK_Play_Speech_Line(6, 1640, 0.5f); + VK_Play_Speech_Line(0, 7960, 0.5f); + VK_Play_Speech_Line(6, 1650, 0.5f); + } + break; + case 7465: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, -1, 11, 2); + VK_Play_Speech_Line(6, 1590, 0.5f); + } else { + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 1590, 0.5f); + VK_Subject_Reacts(20, 9, 2, -8); + } + break; + case 7460: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(30, 1, 10, -5); + } else { + VK_Subject_Reacts(30, 9, 2, -5); + } + VK_Play_Speech_Line(6, 1560, 0.5f); + VK_Play_Speech_Line(0, 7955, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1570, 0.5f); + VK_Play_Speech_Line(6, 1580, 0.5f); + break; + case 7455: + VK_Play_Speech_Line(6, 1540, 0.5f); + VK_Play_Speech_Line(0, 7950, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(10, 1, 8, -5); + } else { + VK_Subject_Reacts(10, 9, -1, -2); + } + VK_Play_Speech_Line(6, 1550, 0.5f); + break; + case 7450: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, 3, 9, -6); + } else { + VK_Subject_Reacts(30, 9, 4, -6); + VK_Eye_Animates(2); + } + VK_Play_Speech_Line(6, 1530, 0.5f); + break; + case 7445: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1480, 0.5f); + VK_Play_Speech_Line(0, 7940, 0.5f); + VK_Subject_Reacts(50, 4, 11, 10); + VK_Play_Speech_Line(6, 1500, 0.5f); + } else { + VK_Subject_Reacts(30, 9, -1, -2); + VK_Play_Speech_Line(6, 1510, 0.5f); + VK_Play_Speech_Line(0, 7945, 0.5f); + VK_Play_Speech_Line(6, 1520, 0.5f); + } + break; + case 7440: + VK_Play_Speech_Line(6, 1460, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, 5, 10, 2); + VK_Eye_Animates(3); + } else { + VK_Subject_Reacts(20, 9, -3, 2); + } + VK_Play_Speech_Line(6, 1470, 0.5f); + break; + case 7435: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1440, 0.5f); + VK_Subject_Reacts(30, 5, 10, 2); + } else { + VK_Subject_Reacts(30, 9, 3, 2); + VK_Play_Speech_Line(6, 1450, 0.5f); + } + break; + case 7430: + VK_Play_Speech_Line(6, 1420, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, -1, 9, -3); + } else { + VK_Subject_Reacts(30, 9, -1, -3); + } + VK_Play_Speech_Line(6, 1430, 0.5f); + VK_Play_Speech_Line(0, 7940, 0.5f); + VK_Eye_Animates(2); + break; + case 7425: + VK_Play_Speech_Line(6, 1400, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, -2, 9, -2); + } else { + VK_Subject_Reacts(20, 9, -2, -2); + } + VK_Play_Speech_Line(6, 1410, 0.5f); + break; + case 7420: + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1370, 0.5f); + VK_Play_Speech_Line(0, 8000, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(50, 1, 11, -8); + } else { + VK_Subject_Reacts(60, 11, -2, -8); + } + VK_Play_Speech_Line(6, 1390, 0.5f); + break; + case 7415: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1340, 0.5f); + VK_Subject_Reacts(50, 1, 11, -5); + VK_Play_Speech_Line(0, 7935, 0.5f); + VK_Play_Speech_Line(6, 1350, 0.5f); + } else { + VK_Play_Speech_Line(6, 1360, 0.5f); + VK_Subject_Reacts(20, 9, -2, -5); + } + break; + case 7410: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, 1, 10, -5); + VK_Eye_Animates(2); + } else { + VK_Subject_Reacts(40, 10, -2, -5); + } + VK_Play_Speech_Line(6, 1330, 0.5f); + break; + case 7405: + VK_Play_Speech_Line(6, 1310, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(50, 1, 11, 5); + } else { + VK_Subject_Reacts(60, 11, 1, 5); + } + VK_Play_Speech_Line(6, 1320, 0.5f); + break; + case 7400: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, 0, 8, -5); + } else { + VK_Subject_Reacts(30, 9, 0, -10); + } + VK_Play_Speech_Line(6, 1300, 0.5f); + VK_Eye_Animates(3); + break; + case 7395: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1280, 0.5f); + VK_Subject_Reacts(40, 0, 0, 0); + } else { + VK_Subject_Reacts(40, 0, 0, 0); + VK_Play_Speech_Line(6, 1280, 0.5f); + } + break; + case 7390: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 1250, 0.5f); + VK_Subject_Reacts(40, 0, 2, 5); + VK_Play_Speech_Line(6, 1260, 0.5f); + VK_Eye_Animates(3); + } else { + VK_Play_Speech_Line(6, 1270, 0.5f); + VK_Subject_Reacts(40, 3, 0, 2); + } + break; + case 7385: + VK_Subject_Reacts(40, 0, 0, 0); + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 1240, 0.5f); + break; + case 7386: + case 7387: + case 7388: + case 7389: + case 7391: + case 7392: + case 7393: + case 7394: + case 7396: + case 7397: + case 7398: + case 7399: + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + return; + default: + switch (a1) { + case 7635: + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 2110, 0.5f); + VK_Play_Speech_Line(0, 7655, 0.5f); + VK_Play_Speech_Line(0, 7660, 0.5f); + VK_Play_Speech_Line(0, 7665, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(80, 5, 14, 25); + } else { + VK_Subject_Reacts(70, 9, -2, 20); + } + VK_Play_Speech_Line(6, 2120, 0.5f); + break; + case 7620: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(60, -2, 14, 12); + } else { + VK_Subject_Reacts(70, 9, -1, 10); + } + VK_Play_Speech_Line(6, 2090, 0.5f); + VK_Play_Speech_Line(0, 8055, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 2100, 0.5f); + break; + case 7605: + VK_Play_Speech_Line(6, 2070, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(30, 0, 11, 12); + } else { + VK_Subject_Reacts(50, 10, -3, 15); + } + VK_Play_Speech_Line(6, 2080, 0.5f); + break; + case 7600: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(75, 4, 13, 15); + } else { + VK_Subject_Reacts(60, 12, -2, 10); + } + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 2050, 0.5f); + VK_Play_Speech_Line(0, 8050, 0.5f); + VK_Subject_Reacts(90, 0, 0, 0); + VK_Play_Speech_Line(6, 2060, 0.5f); + break; + case 7595: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 2010, 0.5f); + VK_Subject_Reacts(30, -2, 10, 5); + VK_Play_Speech_Line(6, 2020, 0.5f); + VK_Play_Speech_Line(0, 8045, 0.5f); + VK_Play_Speech_Line(6, 2030, 0.5f); + } else { + VK_Subject_Reacts(60, 12, -3, 7); + VK_Play_Speech_Line(6, 2040, 0.5f); + } + break; + case 7585: + VK_Play_Speech_Line(6, 1950, 0.5f); + VK_Play_Speech_Line(0, 8030, 0.5f); + VK_Play_Speech_Line(6, 1960, 0.5f); + VK_Play_Speech_Line(0, 8035, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1970, 0.5f); + VK_Play_Speech_Line(0, 7590, 0.5f); + VK_Play_Speech_Line(6, 1980, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, 1, 11, 5); + } else { + VK_Subject_Reacts(50, 12, -3, 5); + } + VK_Play_Speech_Line(6, 1990, 0.5f); + VK_Play_Speech_Line(0, 8040, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 2000, 0.5f); + break; + case 7580: + VK_Play_Speech_Line(6, 1930, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, 5, 10, -1); + } else { + VK_Subject_Reacts(30, 10, 3, 0); + } + VK_Play_Speech_Line(0, 8025, 0.5f); + VK_Play_Speech_Line(6, 1940, 0.5f); + break; + case 7565: + VK_Play_Speech_Line(6, 1910, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(30, -2, 10, 8); + } else { + VK_Subject_Reacts(20, 9, -3, 6); + } + VK_Play_Speech_Line(6, 1920, 0.5f); + VK_Play_Speech_Line(0, 8020, 0.5f); + VK_Eye_Animates(2); + break; + case 7550: + VK_Play_Speech_Line(6, 1890, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, 2, 9, -1); + } else { + VK_Subject_Reacts(10, 8, -1, -2); + } + VK_Play_Speech_Line(6, 1900, 0.5f); + VK_Play_Speech_Line(0, 8015, 0.5f); + break; + case 7540: + if (Game_Flag_Query(46)) { + VK_Eye_Animates(3); + VK_Play_Speech_Line(6, 1860, 0.5f); + VK_Play_Speech_Line(0, 8010, 0.5f); + VK_Subject_Reacts(50, -2, 12, 5); + VK_Play_Speech_Line(6, 1870, 0.5f); + } else { + VK_Subject_Reacts(60, 12, -2, 5); + VK_Play_Speech_Line(6, 1880, 0.5f); + } + break; + case 7535: + VK_Play_Speech_Line(6, 1830, 0.5f); + VK_Play_Speech_Line(0, 8000, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(10, 1, 8, 0); + } else { + VK_Subject_Reacts(20, 9, -1, 0); + } + VK_Play_Speech_Line(6, 1840, 0.5f); + VK_Play_Speech_Line(6, 1850, 0.5f); + VK_Play_Speech_Line(0, 8005, 0.5f); + break; + case 7525: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(20, -4, 9, 5); + VK_Eye_Animates(3); + } else { + VK_Subject_Reacts(40, 11, -3, 7); + VK_Eye_Animates(2); + } + VK_Play_Speech_Line(6, 1820, 0.5f); + break; + case 7515: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(50, -1, 12, 5); + VK_Play_Speech_Line(6, 1790, 0.5f); + VK_Play_Speech_Line(0, 7995, 0.5f); + VK_Play_Speech_Line(6, 1800, 0.5f); + } else { + VK_Subject_Reacts(30, 10, 0, 3); + VK_Play_Speech_Line(6, 1810, 0.5f); + } + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + return; + default: + switch (a1) { + case 7705: + if (Game_Flag_Query(46)) { + VK_Eye_Animates(3); + VK_Subject_Reacts(30, 0, 0, 0); + VK_Play_Speech_Line(6, 2220, 0.5f); + VK_Play_Speech_Line(0, 7730, 0.5f); + VK_Play_Speech_Line(0, 7735, 0.5f); + VK_Subject_Reacts(50, 2, 10, 12); + VK_Play_Speech_Line(6, 2230, 0.5f); + VK_Play_Speech_Line(0, 8065, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 2240, 0.5f); + VK_Play_Speech_Line(0, 8070, 0.5f); + VK_Play_Speech_Line(0, 8075, 0.5f); + } else { + VK_Eye_Animates(2); + VK_Subject_Reacts(50, 0, 0, 0); + VK_Play_Speech_Line(6, 2250, 0.5f); + VK_Play_Speech_Line(0, 7730, 0.5f); + VK_Play_Speech_Line(0, 7735, 0.5f); + VK_Eye_Animates(3); + VK_Subject_Reacts(60, 12, 2, 12); + VK_Play_Speech_Line(6, 2230, 0.5f); + VK_Play_Speech_Line(6, 2270, 0.5f); + VK_Play_Speech_Line(0, 8080, 0.5f); + VK_Play_Speech_Line(6, 2280, 0.5f); + } + break; + case 7690: + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, 0, 12, 0); + } else { + VK_Subject_Reacts(50, 13, 0, 0); + } + VK_Play_Speech_Line(6, 2190, 0.5f); + VK_Play_Speech_Line(0, 8060, 0.5f); + VK_Play_Speech_Line(6, 2200, 0.5f); + VK_Subject_Reacts(30, -4, -4, -5); + VK_Play_Speech_Line(6, 2210, 0.5f); + break; + case 7680: + VK_Eye_Animates(2); + VK_Play_Speech_Line(6, 2170, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(65, 1, 6, 5); + } else { + VK_Subject_Reacts(50, 10, 3, 4); + } + VK_Play_Speech_Line(6, 2180, 0.5f); + break; + case 7670: + if (Game_Flag_Query(46)) { + VK_Play_Speech_Line(6, 2130, 0.5f); + VK_Subject_Reacts(30, -3, 11, 8); + VK_Play_Speech_Line(6, 2140, 0.5f); + } else { + VK_Subject_Reacts(20, 10, 0, 5); + VK_Play_Speech_Line(6, 2150, 0.5f); + VK_Play_Speech_Line(6, 2160, 0.5f); + } + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + return; + default: + if ((unsigned int)(a1 - 7740) > 10) { + if (a1 == 7770) { + VK_Play_Speech_Line(6, 2350, 0.5f); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(90, -3, -1, 12); + } else { + VK_Eye_Animates(2); + VK_Subject_Reacts(90, 13, -4, 12); + } + VK_Play_Speech_Line(6, 2360, 0.5f); + } + } else if (a1 == 7740) { + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(40, -3, -1, 3); + } else { + VK_Subject_Reacts(50, -1, -3, 3); + } + VK_Play_Speech_Line(6, 2290, 0.5f); + VK_Play_Speech_Line(0, 8085, 0.5f); + VK_Play_Speech_Line(6, 2300, 0.5f); + VK_Play_Speech_Line(0, 8090, 0.5f); + VK_Subject_Reacts(20, 2, 2, 0); + VK_Play_Speech_Line(6, 2310, 0.5f); + VK_Play_Speech_Line(6, 2320, 0.5f); + } else if (a1 == 7750) { + VK_Eye_Animates(3); + if (Game_Flag_Query(46)) { + VK_Subject_Reacts(60, 4, 10, 15); + } else { + VK_Subject_Reacts(80, 12, -3, 18); + } + VK_Play_Speech_Line(6, 2330, 0.5f); + VK_Play_Speech_Line(0, 8095, 0.5f); + VK_Play_Speech_Line(6, 2340, 0.5f); + } + break; + } + break; + } + break; + } +} + +void ScriptVK::sub_404B44(int a1) { + switch (a1) { + case 7495: + VK_Play_Speech_Line(11, 780, 0.5f); + VK_Subject_Reacts(30, 9, 6, 5); + VK_Play_Speech_Line(11, 790, 0.5f); + break; + case 7490: + VK_Eye_Animates(3); + VK_Subject_Reacts(30, 7, -4, 12); + VK_Play_Speech_Line(11, 770, 0.5f); + break; + case 7485: + VK_Subject_Reacts(15, 8, 8, 5); + VK_Play_Speech_Line(11, 760, 0.5f); + break; + case 7480: + VK_Subject_Reacts(20, 9, 4, 8); + VK_Play_Speech_Line(11, 740, 0.5f); + VK_Play_Speech_Line(11, 750, 0.5f); + break; + case 7475: + VK_Subject_Reacts(15, 8, 2, 5); + VK_Play_Speech_Line(11, 730, 0.5f); + break; + case 7470: + VK_Subject_Reacts(30, 4, 8, -2); + VK_Play_Speech_Line(11, 720, 0.5f); + break; + case 7465: + VK_Subject_Reacts(5, 7, -4, -7); + VK_Play_Speech_Line(11, 710, 0.5f); + break; + case 7460: + VK_Subject_Reacts(15, 4, 8, 0); + VK_Play_Speech_Line(11, 700, 0.5f); + break; + case 7455: + VK_Play_Speech_Line(11, 680, 0.5f); + VK_Subject_Reacts(20, 7, -3, -5); + VK_Play_Speech_Line(11, 690, 0.5f); + break; + case 7450: + VK_Play_Speech_Line(11, 660, 0.5f); + VK_Subject_Reacts(35, 4, 8, 3); + VK_Play_Speech_Line(0, 8145, 0.5f); + VK_Play_Speech_Line(11, 670, 0.5f); + break; + case 7445: + VK_Subject_Reacts(30, 8, 3, 5); + VK_Play_Speech_Line(11, 650, 0.5f); + break; + case 7440: + VK_Subject_Reacts(25, 4, 7, -3); + VK_Play_Speech_Line(11, 640, 0.5f); + break; + case 7435: + VK_Play_Speech_Line(11, 620, 0.5f); + VK_Subject_Reacts(15, 8, -3, -5); + VK_Play_Speech_Line(11, 630, 0.5f); + break; + case 7430: + VK_Eye_Animates(2); + VK_Subject_Reacts(45, 8, 7, 15); + VK_Play_Speech_Line(11, 600, 0.5f); + VK_Play_Speech_Line(0, 8130, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 610, 0.5f); + VK_Play_Speech_Line(0, 8135, 0.5f); + VK_Play_Speech_Line(0, 8140, 0.5f); + break; + case 7425: + VK_Subject_Reacts(30, 8, -2, 5); + VK_Play_Speech_Line(11, 590, 0.5f); + break; + case 7420: + VK_Subject_Reacts(10, 6, 8, -5); + VK_Play_Speech_Line(11, 580, 0.5f); + break; + case 7415: + VK_Play_Speech_Line(11, 550, 0.5f); + VK_Subject_Reacts(25, 7, 8, 8); + VK_Play_Speech_Line(11, 560, 0.5f); + VK_Play_Speech_Line(0, 8120, 0.5f); + VK_Play_Speech_Line(0, 8125, 0.5f); + VK_Subject_Reacts(75, 8, 0, 0); + VK_Play_Speech_Line(11, 570, 0.5f); + break; + case 7410: + VK_Subject_Reacts(20, 12, -3, -3); + VK_Play_Speech_Line(11, 530, 0.5f); + VK_Play_Speech_Line(11, 540, 0.5f); + break; + case 7405: + VK_Play_Speech_Line(11, 510, 0.5f); + VK_Subject_Reacts(30, 10, 7, 0); + VK_Play_Speech_Line(11, 520, 0.5f); + VK_Play_Speech_Line(0, 8115, 0.5f); + break; + case 7400: + VK_Subject_Reacts(10, 8, 0, -5); + VK_Play_Speech_Line(11, 490, 0.5f); + VK_Play_Speech_Line(11, 500, 0.5f); + break; + case 7395: + VK_Subject_Reacts(20, 0, 0, 7); + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 470, 0.5f); + VK_Play_Speech_Line(11, 480, 0.5f); + VK_Play_Speech_Line(0, 8105, 0.5f); + break; + case 7390: + VK_Subject_Reacts(20, 0, 0, 3); + VK_Play_Speech_Line(11, 460, 0.5f); + break; + case 7385: + VK_Subject_Reacts(20, 0, 0, 5); + VK_Play_Speech_Line(11, 440, 0.5f); + VK_Play_Speech_Line(0, 8100, 0.5f); + VK_Play_Speech_Line(11, 450, 0.5f); + VK_Play_Speech_Line(0, 8105, 0.5f); + break; + case 7386: + case 7387: + case 7388: + case 7389: + case 7391: + case 7392: + case 7393: + case 7394: + case 7396: + case 7397: + case 7398: + case 7399: + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + return; + default: + switch (a1) { + case 7635: + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 970, 0.5f); + VK_Play_Speech_Line(0, 7645, 0.5f); + VK_Play_Speech_Line(0, 7650, 0.5f); + VK_Play_Speech_Line(0, 7655, 0.5f); + VK_Play_Speech_Line(0, 7660, 0.5f); + VK_Play_Speech_Line(0, 7665, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 980, 0.5f); + VK_Subject_Reacts(20, 10, 5, 12); + break; + case 7620: + VK_Subject_Reacts(30, 9, 10, 10); + VK_Play_Speech_Line(11, 960, 0.5f); + break; + case 7605: + VK_Eye_Animates(3); + VK_Subject_Reacts(40, 10, -3, 15); + VK_Play_Speech_Line(11, 950, 0.5f); + break; + case 7600: + VK_Subject_Reacts(20, 5, 9, 2); + VK_Play_Speech_Line(11, 940, 0.5f); + break; + case 7595: + VK_Subject_Reacts(25, 8, -3, 5); + VK_Play_Speech_Line(11, 920, 0.5f); + VK_Play_Speech_Line(0, 8185, 0.5f); + VK_Play_Speech_Line(11, 930, 0.5f); + break; + case 7585: + VK_Subject_Reacts(50, 9, 3, 8); + VK_Play_Speech_Line(11, 1250, 0.5f); + break; + case 7580: + VK_Play_Speech_Line(11, 900, 0.5f); + VK_Play_Speech_Line(0, 8180, 0.5f); + VK_Subject_Reacts(20, 8, 3, 6); + VK_Play_Speech_Line(11, 910, 0.5f); + break; + case 7565: + VK_Subject_Reacts(40, 8, 8, 12); + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 870, 0.5f); + VK_Play_Speech_Line(0, 8175, 0.5f); + VK_Play_Speech_Line(11, 880, 0.5f); + VK_Play_Speech_Line(11, 890, 0.5f); + break; + case 7550: + VK_Eye_Animates(3); + VK_Play_Speech_Line(11, 850, 0.5f); + VK_Play_Speech_Line(0, 8165, 0.5f); + VK_Subject_Reacts(60, 6, 2, 15); + VK_Play_Speech_Line(11, 860, 0.5f); + VK_Play_Speech_Line(0, 8170, 0.5f); + VK_Eye_Animates(3); + break; + case 7540: + VK_Play_Speech_Line(11, 840, 0.5f); + VK_Subject_Reacts(20, 5, 1, 8); + break; + case 7535: + VK_Subject_Reacts(20, 9, 2, 4); + VK_Play_Speech_Line(11, 830, 0.5f); + break; + case 7525: + VK_Subject_Reacts(30, 8, 5, 8); + VK_Play_Speech_Line(11, 820, 0.5f); + break; + case 7515: + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 800, 0.5f); + VK_Play_Speech_Line(0, 8150, 0.5f); + VK_Play_Speech_Line(0, 8155, 0.5f); + VK_Subject_Reacts(30, 9, -5, 12); + VK_Play_Speech_Line(11, 810, 0.5f); + VK_Play_Speech_Line(0, 8160, 0.5f); + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + return; + default: + switch (a1) { + case 7705: + VK_Eye_Animates(3); + VK_Play_Speech_Line(11, 1070, 0.5f); + VK_Play_Speech_Line(0, 7720, 0.5f); + VK_Play_Speech_Line(0, 7725, 0.5f); + VK_Play_Speech_Line(0, 7730, 0.5f); + VK_Play_Speech_Line(0, 7735, 0.5f); + VK_Subject_Reacts(60, 14, 3, 20); + VK_Play_Speech_Line(11, 1080, 0.5f); + VK_Play_Speech_Line(0, 8195, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(11, 1090, 0.5f); + VK_Play_Speech_Line(0, 8200, 0.5f); + break; + case 7690: + VK_Play_Speech_Line(11, 1050, 0.5f); + VK_Play_Speech_Line(0, 7695, 0.5f); + VK_Play_Speech_Line(0, 7700, 0.5f); + VK_Subject_Reacts(60, 11, 9, 100); + VK_Play_Speech_Line(11, 1060, 0.5f); + break; + case 7680: + VK_Play_Speech_Line(11, 1000, 0.5f); + VK_Subject_Reacts(30, 9, 3, 10); + VK_Play_Speech_Line(11, 1010, 0.5f); + VK_Play_Speech_Line(0, 8190, 0.5f); + VK_Play_Speech_Line(11, 1020, 0.5f); + VK_Play_Speech_Line(11, 1030, 0.5f); + VK_Play_Speech_Line(11, 1040, 0.5f); + break; + case 7670: + VK_Subject_Reacts(30, 4, 1, 10); + VK_Play_Speech_Line(11, 990, 0.5f); + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + return; + default: + if ((unsigned int)(a1 - 7740) > 10) { + if (a1 == 7770) { + VK_Play_Speech_Line(11, 1160, 0.5f); + VK_Subject_Reacts(5, -8, 7, 10); + } + } else if (a1 == 7740) { + VK_Subject_Reacts(40, 10, 1, 15); + VK_Play_Speech_Line(11, 1100, 0.5f); + VK_Play_Speech_Line(0, 8205, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(11, 1110, 0.5f); + VK_Play_Speech_Line(0, 8210, 0.5f); + } else if (a1 == 7750) { + VK_Eye_Animates(2); + VK_Subject_Reacts(50, 9, -4, 20); + VK_Play_Speech_Line(11, 1120, 0.5f); + VK_Play_Speech_Line(11, 1130, 0.5f); + VK_Play_Speech_Line(11, 1140, 0.5f); + VK_Play_Speech_Line(0, 8220, 0.5f); + VK_Play_Speech_Line(11, 1150, 0.5f); + } + break; + } + break; + } + break; + } +} + +void ScriptVK::sub_406088(int a1) { + switch (a1) { + case 7495: + VK_Play_Speech_Line(3, 1970, 0.5f); + VK_Play_Speech_Line(0, 7830, 0.5f); + VK_Play_Speech_Line(3, 1980, 0.5f); + VK_Subject_Reacts(65, 4, 4, 5); + VK_Play_Speech_Line(3, 1990, 0.5f); + break; + case 7490: + VK_Subject_Reacts(43, 8, 8, 5); + VK_Play_Speech_Line(3, 1950, 0.5f); + VK_Play_Speech_Line(0, 7820, 0.5f); + VK_Play_Speech_Line(3, 1960, 0.5f); + VK_Play_Speech_Line(0, 7825, 0.5f); + break; + case 7485: + VK_Play_Speech_Line(3, 1940, 0.5f); + VK_Subject_Reacts(38, 4, 9, 0); + break; + case 7480: + if (Game_Flag_Query(47)) { + VK_Subject_Reacts(55, -3, 12, 5); + VK_Play_Speech_Line(3, 1910, 0.5f); + } else { + VK_Play_Speech_Line(3, 1920, 0.5f); + VK_Subject_Reacts(55, 17, -3, 5); + VK_Play_Speech_Line(3, 1930, 0.5f); + } + break; + case 7475: + VK_Subject_Reacts(28, 0, 0, 0); + VK_Play_Speech_Line(3, 1900, 0.5f); + break; + case 7470: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 1850, 0.5f); + VK_Subject_Reacts(50, -2, 11, 0); + VK_Play_Speech_Line(3, 1860, 0.5f); + } else { + VK_Subject_Reacts(90, 15, -5, 10); + VK_Play_Speech_Line(3, 1870, 0.5f); + VK_Play_Speech_Line(0, 8532, 0.5f); + VK_Play_Speech_Line(3, 1890, 0.5f); + } + break; + case 7465: + if (Game_Flag_Query(47)) { + VK_Subject_Reacts(60, -3, 10, 5); + VK_Play_Speech_Line(3, 1830, 0.5f); + } else { + VK_Play_Speech_Line(3, 1840, 0.5f); + VK_Subject_Reacts(60, 13, 2, 5); + } + break; + case 7460: + if (Game_Flag_Query(47)) { + VK_Subject_Reacts(40, -2, 10, 10); + VK_Play_Speech_Line(3, 1810, 0.5f); + } else { + VK_Subject_Reacts(35, 14, 3, 0); + VK_Play_Speech_Line(3, 1820, 0.5f); + } + break; + case 7455: + VK_Play_Speech_Line(3, 1780, 0.5f); + VK_Subject_Reacts(35, 3, 5, 0); + VK_Play_Speech_Line(3, 1790, 0.5f); + VK_Play_Speech_Line(0, 7810, 0.5f); + VK_Play_Speech_Line(3, 1800, 0.5f); + VK_Play_Speech_Line(0, 7815, 0.5f); + break; + case 7450: + VK_Eye_Animates(2); + VK_Subject_Reacts(60, 7, 7, 20); + VK_Play_Speech_Line(3, 1740, 0.5f); + VK_Play_Speech_Line(0, 7805, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(3, 1750, 0.89999998f); + VK_Play_Speech_Line(3, 1760, 0.5f); + break; + case 7445: + VK_Play_Speech_Line(3, 1710, 0.5f); + VK_Play_Speech_Line(0, 7800, 0.5f); + VK_Play_Speech_Line(3, 1720, 0.5f); + VK_Subject_Reacts(45, 4, 6, 0); + VK_Play_Speech_Line(3, 1730, 0.5f); + break; + case 7440: + VK_Subject_Reacts(30, 3, 5, 0); + VK_Play_Speech_Line(3, 1700, 0.5f); + break; + case 7435: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 1670, 0.5f); + VK_Subject_Reacts(60, -2, 9, 0); + VK_Play_Speech_Line(3, 1680, 0.5f); + } else { + VK_Subject_Reacts(60, 14, 2, 0); + VK_Play_Speech_Line(3, 1690, 0.5f); + } + break; + case 7430: + VK_Subject_Reacts(65, 4, 6, 10); + VK_Eye_Animates(3); + VK_Play_Speech_Line(3, 1660, 0.5f); + break; + case 7425: + VK_Subject_Reacts(40, -1, -1, 0); + VK_Play_Speech_Line(3, 1650, 0.5f); + break; + case 7420: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 1620, 0.5f); + VK_Subject_Reacts(25, -1, 9, 0); + } else { + VK_Subject_Reacts(25, 14, -2, 0); + VK_Play_Speech_Line(3, 1630, 0.89999998f); + VK_Play_Speech_Line(3, 1640, 0.5f); + } + break; + case 7415: + VK_Eye_Animates(3); + VK_Subject_Reacts(80, 6, 4, 10); + VK_Play_Speech_Line(3, 1610, 0.5f); + break; + case 7410: + VK_Play_Speech_Line(3, 1590, 0.5f); + VK_Subject_Reacts(50, 10, 10, 10); + VK_Play_Speech_Line(3, 1600, 0.5f); + break; + case 7405: + VK_Eye_Animates(3); + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 1520, 0.5f); + VK_Play_Speech_Line(0, 7840, 0.5f); + VK_Subject_Reacts(20, -1, 9, 10); + VK_Play_Speech_Line(3, 1540, 0.80000001f); + VK_Play_Speech_Line(3, 1550, 0.5f); + } else { + VK_Play_Speech_Line(3, 1560, 0.5f); + VK_Subject_Reacts(25, 13, -3, 0); + VK_Play_Speech_Line(3, 1570, 0.80000001f); + VK_Play_Speech_Line(3, 1580, 0.5f); + } + break; + case 7400: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 1490, 0.5f); + VK_Subject_Reacts(15, -1, 9, 0); + VK_Play_Speech_Line(3, 1500, 0.5f); + } else { + VK_Subject_Reacts(15, 13, -1, 0); + VK_Play_Speech_Line(3, 1510, 0.5f); + } + break; + case 7395: + VK_Play_Speech_Line(3, 1470, 0.5f); + VK_Subject_Reacts(40, 4, 4, 0); + VK_Play_Speech_Line(0, 7795, 0.5f); + VK_Play_Speech_Line(3, 1480, 0.5f); + break; + case 7390: + VK_Subject_Reacts(40, 2, 2, 0); + VK_Play_Speech_Line(3, 1450, 0.5f); + VK_Play_Speech_Line(0, 7785, 0.5f); + VK_Play_Speech_Line(3, 1460, 0.5f); + VK_Play_Speech_Line(0, 7790, 0.5f); + break; + case 7385: + VK_Subject_Reacts(36, 0, 0, 0); + VK_Play_Speech_Line(3, 1440, 0.5f); + break; + case 7386: + case 7387: + case 7388: + case 7389: + case 7391: + case 7392: + case 7393: + case 7394: + case 7396: + case 7397: + case 7398: + case 7399: + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + return; + default: + switch (a1) { + case 7635: + VK_Subject_Reacts(60, 6, 7, 0); + VK_Play_Speech_Line(3, 2370, 0.5f); + break; + case 7620: + VK_Play_Speech_Line(3, 2340, 0.5f); + VK_Subject_Reacts(72, 9, 9, 5); + VK_Play_Speech_Line(3, 2350, 0.5f); + VK_Play_Speech_Line(0, 7885, 0.5f); + VK_Play_Speech_Line(3, 2360, 0.5f); + break; + case 7605: + VK_Subject_Reacts(60, -1, -1, 5); + VK_Play_Speech_Line(3, 2320, 0.5f); + break; + case 7600: + VK_Play_Speech_Line(3, 2300, 0.5f); + VK_Subject_Reacts(30, 4, 4, 5); + if (!Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2310, 0.5f); + } + break; + case 7595: + VK_Eye_Animates(3); + VK_Play_Speech_Line(3, 2290, 0.5f); + VK_Subject_Reacts(30, 5, 5, 8); + break; + case 7585: + VK_Subject_Reacts(50, 8, 8, 7); + VK_Play_Speech_Line(3, 2280, 0.5f); + break; + case 7580: + VK_Play_Speech_Line(3, 2260, 0.5f); + VK_Subject_Reacts(40, 5, 5, 10); + VK_Play_Speech_Line(3, 2270, 0.5f); + break; + case 7565: + VK_Eye_Animates(2); + VK_Play_Speech_Line(3, 2210, 0.5f); + VK_Play_Speech_Line(0, 7870, 0.5f); + VK_Play_Speech_Line(3, 2220, 0.5f); + VK_Subject_Reacts(70, 8, 7, 10); + VK_Play_Speech_Line(3, 2230, 0.5f); + VK_Play_Speech_Line(0, 7875, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(3, 2240, 0.5f); + VK_Play_Speech_Line(3, 2250, 0.5f); + break; + case 7550: + VK_Play_Speech_Line(3, 2170, 0.5f); + VK_Play_Speech_Line(0, 7865, 0.5f); + VK_Play_Speech_Line(3, 2180, 0.5f); + VK_Subject_Reacts(55, 6, 5, 0); + VK_Play_Speech_Line(3, 2190, 0.5f); + break; + case 7540: + VK_Eye_Animates(2); + if (Game_Flag_Query(47)) { + VK_Subject_Reacts(70, -5, 12, 80); + VK_Play_Speech_Line(3, 2140, 0.5f); + } else { + VK_Subject_Reacts(80, 17, -1, 80); + VK_Play_Speech_Line(3, 2150, 1.0f); + VK_Play_Speech_Line(3, 2160, 0.5f); + VK_Play_Speech_Line(0, 7860, 0.5f); + } + break; + case 7535: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2080, 0.5f); + VK_Play_Speech_Line(0, 7845, 0.5f); + VK_Play_Speech_Line(3, 2090, 0.5f); + VK_Subject_Reacts(60, -6, 11, 0); + VK_Play_Speech_Line(3, 2100, 0.5f); + } else { + VK_Subject_Reacts(60, 17, -7, 0); + VK_Play_Speech_Line(3, 2110, 0.5f); + VK_Play_Speech_Line(0, 7850, 0.5f); + VK_Play_Speech_Line(3, 2120, 0.5f); + VK_Play_Speech_Line(0, 7855, 0.5f); + VK_Play_Speech_Line(3, 2130, 0.5f); + } + break; + case 7525: + VK_Subject_Reacts(40, 6, 6, 0); + VK_Play_Speech_Line(3, 2040, 0.5f); + VK_Play_Speech_Line(0, 8533, 0.5f); + VK_Play_Speech_Line(3, 2060, 0.5f); + VK_Play_Speech_Line(3, 2070, 0.5f); + break; + case 7515: + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2000, 0.5f); + VK_Subject_Reacts(72, -3, 12, 2); + VK_Play_Speech_Line(3, 2010, 0.5f); + VK_Play_Speech_Line(0, 7835, 0.5f); + VK_Play_Speech_Line(3, 2020, 0.5f); + } else { + VK_Subject_Reacts(60, 16, -1, 2); + VK_Play_Speech_Line(3, 2030, 0.5f); + VK_Play_Speech_Line(0, 7840, 0.5f); + } + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + return; + default: + switch (a1) { + case 7705: + VK_Eye_Animates(3); + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2500, 0.5f); + VK_Subject_Reacts(85, 7, 14, 20); + VK_Play_Speech_Line(3, 2510, 0.5f); + } else { + VK_Subject_Reacts(99, 18, 7, 20); + VK_Play_Speech_Line(3, 2530, 0.5f); + VK_Play_Speech_Line(0, 7910, 0.5f); + VK_Play_Speech_Line(3, 2550, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(0, 7915, 0.5f); + } + break; + case 7690: + VK_Play_Speech_Line(3, 2470, 0.5f); + VK_Subject_Reacts(20, 9, 8, 5); + VK_Play_Speech_Line(3, 2480, 0.5f); + VK_Play_Speech_Line(0, 7900, 0.5f); + break; + case 7680: + VK_Eye_Animates(3); + if (Game_Flag_Query(47)) { + VK_Subject_Reacts(70, -4, 14, 15); + VK_Play_Speech_Line(3, 2440, 0.5f); + } else { + VK_Play_Speech_Line(3, 2450, 0.5f); + VK_Subject_Reacts(70, 18, -4, 15); + VK_Play_Speech_Line(3, 2460, 0.5f); + } + break; + case 7670: + VK_Eye_Animates(3); + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2380, 0.5f); + VK_Play_Speech_Line(0, 7890, 0.5f); + VK_Play_Speech_Line(3, 2390, 0.5f); + VK_Subject_Reacts(90, -3, 14, 50); + VK_Play_Speech_Line(0, 7895, 0.5f); + } else { + VK_Subject_Reacts(80, 18, -3, 10); + VK_Play_Speech_Line(3, 2410, 0.5f); + VK_Play_Speech_Line(0, 8534, 0.5f); + VK_Play_Speech_Line(3, 2430, 0.5f); + } + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + return; + default: + if ((unsigned int)(a1 - 7740) > 10) { + if (a1 == 7770) { + VK_Eye_Animates(2); + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2630, 0.5f); + VK_Subject_Reacts(99, 6, 15, 30); + } else { + VK_Play_Speech_Line(3, 2640, 0.5f); + VK_Subject_Reacts(99, 15, -4, 30); + } + } + } else if (a1 == 7740) { + VK_Subject_Reacts(60, 5, 6, 0); + VK_Play_Speech_Line(3, 2560, 0.5f); + } else if (a1 == 7750) { + if (Game_Flag_Query(47)) { + VK_Play_Speech_Line(3, 2580, 0.5f); + VK_Subject_Reacts(90, -5, 14, 20); + VK_Play_Speech_Line(3, 2590, 0.5f); + VK_Play_Speech_Line(0, 7920, 0.5f); + } else { + VK_Subject_Reacts(90, 17, 3, 20); + VK_Play_Speech_Line(3, 2600, 0.5f); + VK_Play_Speech_Line(0, 7925, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(3, 2610, 0.5f); + VK_Play_Speech_Line(0, 7930, 0.5f); + } + } + break; + } + break; + } + break; + } +} + +void ScriptVK::sub_407CF8(int a1) { + switch (a1) { + case 7495: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7490: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7485: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7480: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7475: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7470: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7465: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7460: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7455: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7450: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7445: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7440: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7435: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7430: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7425: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7420: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7415: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7410: + VK_Subject_Reacts(100, 10, 10, 0); + VK_Play_Speech_Line(15, 1330, 0.5f); + break; + case 7405: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7400: + VK_Subject_Reacts(70, -10, -10, 0); + VK_Play_Speech_Line(15, 1300, 0.5f); + break; + case 7395: + VK_Eye_Animates(2); + VK_Subject_Reacts(90, -40, -10, 6); + VK_Play_Speech_Line(15, 1280, 0.5f); + break; + case 7390: + VK_Eye_Animates(3); + VK_Subject_Reacts(60, 15, -30, 2); + VK_Play_Speech_Line(15, 1260, 0.5f); + break; + case 7385: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7386: + case 7387: + case 7388: + case 7389: + case 7391: + case 7392: + case 7393: + case 7394: + case 7396: + case 7397: + case 7398: + case 7399: + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + return; + default: + switch (a1) { + case 7635: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7620: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7605: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7600: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7595: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7585: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7580: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7565: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7550: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7540: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7535: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7525: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7515: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + return; + default: + switch (a1) { + case 7705: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7690: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7680: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7670: + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + return; + default: + if ((unsigned int)(a1 - 7740) > 10) { + if (a1 == 7770) { + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + } + } else if (a1 == 7740) { + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + } else if (a1 == 7750) { + VK_Subject_Reacts(20, 10, 20, 0); + VK_Play_Speech_Line(15, 1240, 0.5f); + } + break; + } + break; + } + break; + } +} + +void ScriptVK::sub_40897C(int a1) { + switch (a1) { + case 7495: + VK_Eye_Animates(2); + VK_Play_Speech_Line(14, 1320, 0.5f); + VK_Subject_Reacts(10, 8, 7, 7); + break; + case 7490: + VK_Play_Speech_Line(14, 1290, 0.5f); + VK_Play_Speech_Line(14, 1300, 0.5f); + VK_Subject_Reacts(10, 11, 10, 0); + VK_Play_Speech_Line(14, 1310, 0.5f); + break; + case 7485: + VK_Subject_Reacts(70, 8, 9, 10); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1280, 0.5f); + break; + case 7480: + VK_Subject_Reacts(60, 10, 8, -6); + VK_Play_Speech_Line(14, 1270, 0.5f); + break; + case 7475: + VK_Play_Speech_Line(14, 1250, 0.5f); + VK_Subject_Reacts(30, 9, 7, -5); + VK_Play_Speech_Line(14, 1260, 0.5f); + break; + case 7470: + VK_Subject_Reacts(50, -4, 0, -5); + VK_Play_Speech_Line(14, 1240, 0.5f); + break; + case 7465: + VK_Subject_Reacts(15, 5, 3, -5); + VK_Play_Speech_Line(14, 1200, 0.5f); + if (Actor_Query_Friendliness_To_Other(14, 0) <= 40) { + VK_Eye_Animates(2); + VK_Play_Speech_Line(14, 1210, 0.5f); + VK_Eye_Animates(1); + } + break; + case 7460: + VK_Subject_Reacts(10, 4, 4, 2); + VK_Play_Speech_Line(14, 1190, 0.5f); + break; + case 7455: + VK_Subject_Reacts(30, 7, 6, 3); + VK_Play_Speech_Line(14, 1180, 0.5f); + break; + case 7450: + VK_Eye_Animates(2); + VK_Play_Speech_Line(14, 1160, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(60, 8, 8, -5); + VK_Play_Speech_Line(14, 1170, 0.5f); + break; + case 7445: + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1140, 0.5f); + VK_Subject_Reacts(80, 8, 8, -10); + VK_Eye_Animates(3); + VK_Play_Speech_Line(14, 1150, 0.5f); + break; + case 7440: + VK_Subject_Reacts(30, 8, 6, 0); + VK_Play_Speech_Line(14, 1130, 0.5f); + break; + case 7435: + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1100, 0.5f); + VK_Subject_Reacts(25, 8, 5, -7); + VK_Play_Speech_Line(0, 8265, 0.5f); + VK_Play_Speech_Line(14, 1110, 0.5f); + VK_Play_Speech_Line(14, 1120, 0.5f); + break; + case 7430: + VK_Subject_Reacts(15, 7, 6, -6); + VK_Play_Speech_Line(14, 1080, 0.5f); + break; + case 7425: + VK_Play_Speech_Line(14, 1050, 0.5f); + VK_Play_Speech_Line(14, 1060, 0.5f); + VK_Play_Speech_Line(0, 8260, 0.5f); + VK_Subject_Reacts(5, 5, 6, -5); + VK_Play_Speech_Line(14, 1070, 0.5f); + break; + case 7420: + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1030, 0.5f); + VK_Play_Speech_Line(0, 8255, 0.5f); + VK_Subject_Reacts(30, 7, 5, 3); + VK_Eye_Animates(3); + VK_Play_Speech_Line(14, 1040, 0.5f); + break; + case 7415: + VK_Subject_Reacts(25, 9, 6, 5); + VK_Play_Speech_Line(14, 1020, 0.5f); + break; + case 7410: + VK_Subject_Reacts(40, -6, -5, 5); + VK_Play_Speech_Line(14, 990, 0.5f); + VK_Play_Speech_Line(0, 8245, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1000, 0.5f); + VK_Play_Speech_Line(0, 8250, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(70, 8, 6, 0); + VK_Play_Speech_Line(14, 1010, 0.5f); + break; + case 7405: + VK_Subject_Reacts(25, 8, 7, 4); + VK_Play_Speech_Line(14, 970, 0.5f); + VK_Play_Speech_Line(0, 8240, 0.5f); + VK_Play_Speech_Line(14, 980, 0.5f); + break; + case 7400: + VK_Play_Speech_Line(14, 950, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(10, -5, -6, 2); + VK_Play_Speech_Line(14, 960, 0.5f); + break; + case 7395: + VK_Play_Speech_Line(14, 930, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(50, 0, 0, 8); + VK_Play_Speech_Line(14, 940, 0.5f); + VK_Play_Speech_Line(0, 8235, 0.5f); + break; + case 7390: + VK_Subject_Reacts(48, 0, 0, 3); + VK_Play_Speech_Line(14, 920, 0.5f); + VK_Play_Speech_Line(0, 8230, 0.5f); + break; + case 7385: + VK_Eye_Animates(1); + VK_Subject_Reacts(54, 0, 0, 0); + VK_Play_Speech_Line(14, 900, 0.5f); + VK_Play_Speech_Line(14, 910, 0.5f); + VK_Play_Speech_Line(0, 8225, 0.5f); + break; + case 7386: + case 7387: + case 7388: + case 7389: + case 7391: + case 7392: + case 7393: + case 7394: + case 7396: + case 7397: + case 7398: + case 7399: + case 7401: + case 7402: + case 7403: + case 7404: + case 7406: + case 7407: + case 7408: + case 7409: + case 7411: + case 7412: + case 7413: + case 7414: + case 7416: + case 7417: + case 7418: + case 7419: + case 7421: + case 7422: + case 7423: + case 7424: + case 7426: + case 7427: + case 7428: + case 7429: + case 7431: + case 7432: + case 7433: + case 7434: + case 7436: + case 7437: + case 7438: + case 7439: + case 7441: + case 7442: + case 7443: + case 7444: + case 7446: + case 7447: + case 7448: + case 7449: + case 7451: + case 7452: + case 7453: + case 7454: + case 7456: + case 7457: + case 7458: + case 7459: + case 7461: + case 7462: + case 7463: + case 7464: + case 7466: + case 7467: + case 7468: + case 7469: + case 7471: + case 7472: + case 7473: + case 7474: + case 7476: + case 7477: + case 7478: + case 7479: + case 7481: + case 7482: + case 7483: + case 7484: + case 7486: + case 7487: + case 7488: + case 7489: + case 7491: + case 7492: + case 7493: + case 7494: + return; + default: + switch (a1) { + case 7635: + VK_Play_Speech_Line(14, 1580, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(0, 8310, 0.5f); + VK_Play_Speech_Line(0, 7645, 0.5f); + VK_Play_Speech_Line(0, 7650, 0.5f); + VK_Play_Speech_Line(0, 7655, 0.5f); + VK_Play_Speech_Line(0, 7660, 0.5f); + VK_Play_Speech_Line(0, 7665, 0.5f); + VK_Eye_Animates(2); + VK_Subject_Reacts(60, 8, 8, 40); + VK_Play_Speech_Line(14, 1590, 0.5f); + VK_Play_Speech_Line(0, 8315, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(85, 10, 11, 0); + VK_Play_Speech_Line(14, 1600, 0.5f); + VK_Eye_Animates(3); + break; + case 7620: + VK_Play_Speech_Line(14, 1560, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(0, 7630, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(14, 1570, 0.5f); + VK_Subject_Reacts(10, 10, 9, 10); + break; + case 7605: + VK_Eye_Animates(1); + VK_Subject_Reacts(40, 9, 8, 10); + VK_Play_Speech_Line(14, 1550, 0.5f); + break; + case 7600: + VK_Subject_Reacts(20, 8, 8, 5); + VK_Play_Speech_Line(14, 1540, 0.5f); + break; + case 7595: + VK_Eye_Animates(1); + VK_Subject_Reacts(40, 10, 9, 15); + VK_Play_Speech_Line(14, 1530, 0.5f); + VK_Eye_Animates(2); + break; + case 7585: + VK_Play_Speech_Line(14, 1500, 0.5f); + VK_Play_Speech_Line(0, 7590, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(10, 8, 7, 5); + VK_Play_Speech_Line(14, 1510, 0.5f); + VK_Play_Speech_Line(14, 1520, 0.5f); + break; + case 7580: + VK_Subject_Reacts(20, 9, 7, 0); + VK_Play_Speech_Line(14, 1480, 0.5f); + VK_Play_Speech_Line(0, 8305, 0.5f); + VK_Play_Speech_Line(14, 1490, 0.5f); + break; + case 7565: + VK_Play_Speech_Line(14, 1440, 0.5f); + VK_Play_Speech_Line(0, 8295, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1450, 0.5f); + VK_Play_Speech_Line(0, 7570, 0.5f); + VK_Play_Speech_Line(0, 7575, 0.5f); + VK_Eye_Animates(3); + VK_Play_Speech_Line(14, 1460, 0.5f); + VK_Play_Speech_Line(0, 8300, 0.5f); + VK_Subject_Reacts(90, 8, 9, 18); + VK_Play_Speech_Line(14, 1470, 0.5f); + VK_Eye_Animates(3); + break; + case 7550: + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1420, 0.5f); + VK_Subject_Reacts(20, 7, 7, -5); + VK_Play_Speech_Line(14, 1430, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + break; + case 7540: + VK_Play_Speech_Line(14, 1400, 0.5f); + VK_Subject_Reacts(30, 10, 9, 10); + VK_Play_Speech_Line(14, 1410, 0.5f); + break; + case 7535: + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1360, 0.5f); + VK_Play_Speech_Line(0, 8275, 0.5f); + VK_Subject_Reacts(10, 9, 7, -4); + VK_Play_Speech_Line(0, 8280, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1380, 0.5f); + VK_Play_Speech_Line(14, 1390, 0.5f); + VK_Play_Speech_Line(0, 8285, 0.5f); + break; + case 7525: + VK_Play_Speech_Line(14, 1350, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(10, 7, 6, 6); + break; + case 7515: + VK_Subject_Reacts(25, 7, 7, 0); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1330, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1340, 0.5f); + break; + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7536: + case 7537: + case 7538: + case 7539: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7581: + case 7582: + case 7583: + case 7584: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7596: + case 7597: + case 7598: + case 7599: + case 7601: + case 7602: + case 7603: + case 7604: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + return; + default: + switch (a1) { + case 7705: + VK_Play_Speech_Line(14, 1680, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(0, 7720, 0.5f); + VK_Eye_Animates(1); + VK_Subject_Reacts(40, 12, 10, 0); + VK_Play_Speech_Line(0, 7725, 0.5f); + VK_Play_Speech_Line(0, 7730, 0.5f); + VK_Subject_Reacts(55, 6, 6, 0); + VK_Eye_Animates(1); + VK_Play_Speech_Line(0, 7735, 0.5f); + VK_Eye_Animates(2); + VK_Subject_Reacts(70, 11, 9, 100); + VK_Play_Speech_Line(14, 1690, 0.5f); + VK_Eye_Animates(2); + break; + case 7690: + VK_Eye_Animates(2); + VK_Subject_Reacts(50, 14, 13, 15); + VK_Play_Speech_Line(14, 1660, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(0, 8325, 0.5f); + VK_Play_Speech_Line(14, 1670, 0.5f); + break; + case 7680: + VK_Play_Speech_Line(14, 1640, 0.5f); + VK_Subject_Reacts(15, 5, 6, 5); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Play_Speech_Line(0, 8320, 0.5f); + VK_Play_Speech_Line(14, 1650, 0.5f); + break; + case 7670: + VK_Subject_Reacts(50, 12, 7, 10); + VK_Play_Speech_Line(14, 1620, 0.5f); + VK_Eye_Animates(1); + VK_Play_Speech_Line(14, 1630, 0.5f); + break; + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + return; + default: + if ((unsigned int)(a1 - 7740) > 10) { + if (a1 == 7770) { + VK_Play_Speech_Line(14, 1780, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Play_Speech_Line(0, 8335, 0.5f); + VK_Eye_Animates(2); + VK_Play_Speech_Line(14, 1790, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Subject_Reacts(30, 7, 7, 10); + } + } else if (a1 == 7740) { + VK_Subject_Reacts(30, 4, 3, 3); + VK_Eye_Animates(2); + VK_Play_Speech_Line(14, 1700, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Play_Speech_Line(14, 1710, 0.5f); + VK_Play_Speech_Line(14, 1720, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Play_Speech_Line(14, 1730, 0.5f); + } else if (a1 == 7750) { + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Subject_Reacts(10, 8, 5, 0); + VK_Play_Speech_Line(14, 1740, 0.5f); + VK_Play_Speech_Line(0, 8330, 0.5f); + if (Random_Query(0, 1) == 1) { + VK_Eye_Animates(1); + } + VK_Play_Speech_Line(14, 1750, 0.5f); + VK_Subject_Reacts(25, 7, 5, 8); + VK_Play_Speech_Line(14, 1760, 0.5f); + VK_Play_Speech_Line(14, 1770, 0.5f); + } + break; + } + break; + } + break; + } +} + +void ScriptVK::sub_40A300(int a1, int a2) { + switch (a1) { + case 15: + sub_407CF8(7385); + break; + case 14: + sub_40897C(7385); + break; + case 11: + sub_404B44(7385); + break; + case 6: + sub_402604(7385); + break; + case 3: + sub_40A510(7385); + break; + default: + return; + } +} + +void ScriptVK::sub_40A350(int a1, int a2) { + switch (a1) { + case 15: + sub_407CF8(7390); + break; + case 14: + sub_40897C(7390); + break; + case 11: + sub_404B44(7390); + break; + case 6: + sub_402604(7390); + break; + case 3: + sub_40A470(7390); + break; + default: + return; + } +} + +void ScriptVK::sub_40A3A0(int a1, int a2) { + switch (a1) { + case 15: + sub_407CF8(7395); + break; + case 14: + sub_40897C(7395); + break; + case 11: + sub_404B44(7395); + break; + case 6: + sub_402604(7395); + break; + case 3: + sub_40A3F0(7395); + break; + default: + return; + } +} + +void ScriptVK::sub_40A3F0(int a1) { + VK_Play_Speech_Line(3, 1470, 0.5f); + VK_Subject_Reacts(40, 4, 4, 0); + VK_Play_Speech_Line(0, 7795, 0.5f); + VK_Play_Speech_Line(3, 1480, 0.5f); +} + +void ScriptVK::sub_40A470(int a1) { + VK_Subject_Reacts(40, 2, 2, 0); + VK_Play_Speech_Line(3, 1450, 0.5f); + VK_Play_Speech_Line(0, 7785, 0.5f); + VK_Play_Speech_Line(3, 1460, 0.5f); + VK_Play_Speech_Line(0, 7790, 0.5f); +} + +void ScriptVK::sub_40A510(int a1) { + VK_Subject_Reacts(36, 0, 0, 0); + VK_Play_Speech_Line(3, 1440, 0.5f); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/script/vk.h b/engines/bladerunner/script/vk.h new file mode 100644 index 0000000000..087faa88d1 --- /dev/null +++ b/engines/bladerunner/script/vk.h @@ -0,0 +1,65 @@ +/* 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_SCRIPT_KIA_H +#define BLADERUNNER_SCRIPT_KIA_H + +#include "bladerunner/script/script.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class ScriptVK : ScriptBase { +public: + ScriptVK(BladeRunnerEngine *vm) + : ScriptBase(vm) { + } + + bool SCRIPT_VK_DLL_Initialize(int a1); + void SCRIPT_VK_DLL_Calibrate(int a1); + bool SCRIPT_VK_DLL_Begin_Test(); + void SCRIPT_VK_DLL_McCoy_Asks_Question(int a1, int a2); + void SCRIPT_VK_DLL_Question_Asked(int a1, int a2); + void SCRIPT_VK_DLL_Shutdown(int a1, signed int a2, signed int a3); + +private: + int unknown1; + int unknown2; + + void sub_402604(int a1); + void sub_404B44(int a1); + void sub_406088(int a1); + void sub_407CF8(int a1); + void sub_40897C(int a1); + void sub_40A300(int a1, int a2); + void sub_40A350(int a1, int a2); + void sub_40A3A0(int a1, int a2); + void sub_40A3F0(int a1); + void sub_40A470(int a1); + void sub_40A510(int a1); +}; + +} // End of namespace BladeRunner + +#endif + diff --git a/engines/bladerunner/set.cpp b/engines/bladerunner/set.cpp new file mode 100644 index 0000000000..f8a480c181 --- /dev/null +++ b/engines/bladerunner/set.cpp @@ -0,0 +1,329 @@ +/* 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/set.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/lights.h" +#include "bladerunner/scene_objects.h" +#include "bladerunner/set_effects.h" +#include "bladerunner/slice_renderer.h" + +#include "common/debug.h" +#include "common/ptr.h" +#include "common/str.h" +#include "common/stream.h" + +namespace BladeRunner { + +#define kSet0 0x53657430 + +Set::Set(BladeRunnerEngine *vm) : _vm(vm) { + _objectCount = 0; + _walkboxCount = 0; + _objects = new Object[85]; + _walkboxes = new Walkbox[95]; + _footstepSoundOverride = -1; + _effects = new SetEffects(vm); + _loaded = false; +} + +Set::~Set() { + delete _effects; + delete[] _objects; + delete[] _walkboxes; +} + +bool Set::open(const Common::String &name) { + Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(name)); + + uint32 sig = s->readUint32BE(); + if (sig != kSet0) + return false; + + int framesCount = s->readUint32LE(); + + _objectCount = s->readUint32LE(); + assert(_objectCount <= 85); + + for (int i = 0; i < _objectCount; ++i) { + s->read(_objects[i]._name, 20); + + float x0, y0, z0, x1, y1, z1; + x0 = s->readFloatLE(); + y0 = s->readFloatLE(); + z0 = s->readFloatLE(); + x1 = s->readFloatLE(); + y1 = s->readFloatLE(); + z1 = s->readFloatLE(); + + _objects[i]._bbox = BoundingBox(x0, y0, z0, x1, y1, z1); + + _objects[i]._isObstacle = s->readByte(); + _objects[i]._isClickable = s->readByte(); + _objects[i]._isHotMouse = 0; + _objects[i]._isTarget = 0; + s->skip(4); + + // debug("OBJECT: %s [%d%d%d%d]", _objects[i]._name, _objects[i]._isObstacle, _objects[i]._isClickable, _objects[i]._isHotMouse, _objects[i]._isTarget); + } + + _walkboxCount = s->readUint32LE(); + assert(_walkboxCount <= 95); + + for (int i = 0; i < _walkboxCount; ++i) { + float x, z; + + s->read(_walkboxes[i]._name, 20); + _walkboxes[i]._altitude = s->readFloatLE(); + _walkboxes[i]._vertexCount = s->readUint32LE(); + + assert(_walkboxes[i]._vertexCount <= 8); + + for (int j = 0; j < _walkboxes[i]._vertexCount; ++j) { + x = s->readFloatLE(); + z = s->readFloatLE(); + + _walkboxes[i]._vertices[j] = Vector3(x, _walkboxes[i]._altitude, z); + } + + // debug("WALKBOX: %s", _walkboxes[i]._name); + } + + _vm->_lights->reset(); + _vm->_lights->read(s.get(), framesCount); + _vm->_sliceRenderer->setLights(_vm->_lights); + _effects->reset(); + _effects->read(s.get(), framesCount); + _vm->_sliceRenderer->setSetEffects(_effects); + + // _vm->_sliceRenderer->set_setColors(&this->colors); + _loaded = true; + + for (int i = 0; i < _walkboxCount; ++i) { + this->setWalkboxStepSound(i, 0); + } + + return true; +} + +void Set::addObjectsToScene(SceneObjects *sceneObjects) { + for (int i = 0; i < _objectCount; i++) { + sceneObjects->addObject(i + SCENE_OBJECTS_OBJECTS_OFFSET, &_objects[i]._bbox, _objects[i]._isClickable, _objects[i]._isObstacle, _objects[i]._unknown1, _objects[i]._isTarget); + } +} + +// Source: http://www.faqs.org/faqs/graphics/algorithms-faq/ section 2.03 +/* +static +bool pointInWalkbox(float x, float z, const Walkbox &w) +{ + uint32 i, j; + bool c = false; + + for (i = 0, j = w._vertexCount - 1; i < w._vertexCount; j = i++) { + if ((((w._vertices[i].z <= z) && (z < w._vertices[j].z)) || + ((w._vertices[j].z <= z) && (z < w._vertices[i].z))) && + (x < (w._vertices[j].x - w._vertices[i].x) * (z - w._vertices[i].z) / (w._vertices[j].z - w._vertices[i].z) + w._vertices[i].x)) + { + c = !c; + } + } + return c; +} +*/ + +static bool isXZInWalkbox(float x, float z, const Walkbox &walkbox) { + int found = 0; + + float lastX = walkbox._vertices[walkbox._vertexCount - 1].x; + float lastZ = walkbox._vertices[walkbox._vertexCount - 1].z; + for (int i = 0; i < walkbox._vertexCount; i++) { + float currentX = walkbox._vertices[i].x; + float currentZ = walkbox._vertices[i].z; + + if ((currentZ > z && z >= lastZ) || (currentZ <= z && z < lastZ)) { + float lineX = (lastX - currentX) / (lastZ - currentZ) * (z - currentZ) + currentX; + if (x < lineX) + found++; + } + lastX = currentX; + lastZ = currentZ; + } + return found & 1; +} + +float Set::getAltitudeAtXZ(float x, float z, bool *inWalkbox) { + float altitude = _walkboxes[0]._altitude; + *inWalkbox = false; + + for (int i = 0; i < _walkboxCount; ++i) { + const Walkbox &w = _walkboxes[i]; + + if (isXZInWalkbox(x, z, w)) { + *inWalkbox = true; + if (w._altitude > altitude) { + altitude = w._altitude; + } + } + } + + return altitude; +} + +int Set::findWalkbox(float x, float z) { + int result = -1; + + for (int i = 0; i < _walkboxCount; ++i) { + const Walkbox &w = _walkboxes[i]; + + if (isXZInWalkbox(x, z, w)) { + if (result == -1 || w._altitude > _walkboxes[result]._altitude) { + result = i; + } + } + } + + return result; +} + +int Set::findObject(const char *objectName) { + int i; + for (i = 0; i < (int)_objectCount; i++) { + if (scumm_stricmp(objectName, _objects[i]._name) == 0) { + return i; + } + } + + debug("Set::findObject didn't find \"%s\"", objectName); + + return -1; +} + +bool Set::objectSetHotMouse(int objectId) { + if (!_objects || objectId < 0 || objectId >= (int)_objectCount) { + return false; + } + + _objects[objectId]._isHotMouse = true; + return true; +} + +bool Set::objectGetBoundingBox(int objectId, BoundingBox *boundingBox) { + assert(boundingBox); + + if (!_objects || objectId < 0 || objectId >= (int)_objectCount) { + boundingBox->setXYZ(0, 0, 0, 0, 0, 0); + return false; + } + float x0, y0, z0, x1, y1, z1; + + _objects[objectId]._bbox.getXYZ(&x0, &y0, &z0, &x1, &y1, &z1); + boundingBox->setXYZ(x0, y0, z0, x1, y1, z1); + + return true; +} + +void Set::objectSetIsClickable(int objectId, bool isClickable) { + _objects[objectId]._isClickable = isClickable; +} + +void Set::objectSetIsObstacle(int objectId, bool isObstacle) { + _objects[objectId]._isObstacle = isObstacle; +} + +void Set::objectSetIsTarget(int objectId, bool isTarget) { + _objects[objectId]._isTarget = isTarget; +} + +const char *Set::objectGetName(int objectId) { + return _objects[objectId]._name; +} + +void Set::setWalkboxStepSound(int walkboxId, int stepSound) { + this->_walkboxStepSound[walkboxId] = stepSound; +} + +void Set::setFoodstepSoundOverride(int soundId) { + _footstepSoundOverride = soundId; +} + +void Set::resetFoodstepSoundOverride() { + _footstepSoundOverride = -1; +} + +int Set::getWalkboxSoundWalkLeft(int walkboxId) { + int soundId; + if (this->_footstepSoundOverride >= 0) { + soundId = this->_footstepSoundOverride; + } else { + soundId = this->_walkboxStepSound[walkboxId]; + } + + if (soundId == 0) { //stone floor + return _vm->_rnd.getRandomNumberRng(160, 164); + } + if (soundId == 1) { //gravel floor + return _vm->_rnd.getRandomNumberRng(164, 170); + } + if (soundId == 2) { //wooden floor + return _vm->_rnd.getRandomNumberRng(476, 480); + } + if (soundId == 3) { //metal floor + return _vm->_rnd.getRandomNumberRng(466, 470); + } + + return -1; +} + +int Set::getWalkboxSoundWalkRight(int walkboxId) { + int soundId; + if (this->_footstepSoundOverride >= 0) { + soundId = this->_footstepSoundOverride; + } else { + soundId = this->_walkboxStepSound[walkboxId]; + } + + if (soundId == 0) { //stone floor + return _vm->_rnd.getRandomNumberRng(165, 169); + } + if (soundId == 1) { //gravel floor + return _vm->_rnd.getRandomNumberRng(169, 175); + } + if (soundId == 2) { //wooden floor + return _vm->_rnd.getRandomNumberRng(481, 485); + } + if (soundId == 3) { //metal floor + return _vm->_rnd.getRandomNumberRng(471, 475); + } + + return -1; +} + +int Set::getWalkboxSoundRunLeft(int walkboxId) { + return getWalkboxSoundWalkLeft(walkboxId); +} + +int Set::getWalkboxSoundRunRight(int walkboxId) { + return getWalkboxSoundWalkRight(walkboxId); +} +} // End of namespace BladeRunner diff --git a/engines/bladerunner/set.h b/engines/bladerunner/set.h new file mode 100644 index 0000000000..4b4a4d92df --- /dev/null +++ b/engines/bladerunner/set.h @@ -0,0 +1,107 @@ +/* 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_SET_H +#define BLADERUNNER_SET_H + +#include "bladerunner/boundingbox.h" + +#include "common/scummsys.h" +#include "common/str.h" + +namespace BladeRunner { + +class BladeRunnerEngine; + +class VQADecoder; +class SetEffects; +class SceneObjects; + +struct Object { + char _name[20]; + BoundingBox _bbox; + uint8 _isObstacle; + uint8 _isClickable; + uint8 _isHotMouse; + uint8 _isTarget; + uint8 _unknown1; +}; + +struct Walkbox { + char _name[20]; + float _altitude; + int _vertexCount; + Vector3 _vertices[8]; +}; + +class Set { +#if _DEBUG + friend class BladeRunnerEngine; +#endif + + BladeRunnerEngine *_vm; + + bool _loaded; + int _objectCount; + int _walkboxCount; + Object *_objects; + Walkbox *_walkboxes; + int _walkboxStepSound[85]; + int _footstepSoundOverride; +// float _unknown[10]; +public: + SetEffects *_effects; + +public: + Set(BladeRunnerEngine *vm); + ~Set(); + + bool open(const Common::String &name); + + void addObjectsToScene(SceneObjects *sceneObjects); + uint32 getObjectCount() { return _objectCount; } + + float getAltitudeAtXZ(float x, float z, bool *inWalkbox); + + int findWalkbox(float x, float z); + int findObject(const char *objectName); + + bool objectSetHotMouse(int objectId); + bool objectGetBoundingBox(int objectId, BoundingBox *boundingBox); + void objectSetIsClickable(int objectId, bool isClickable); + void objectSetIsObstacle(int objectId, bool isObstacle); + void objectSetIsTarget(int objectId, bool isTarget); + const char *objectGetName(int objectId); + + void setWalkboxStepSound(int walkboxId, int soundId); + void setFoodstepSoundOverride(int soundId); + void resetFoodstepSoundOverride(); + int getWalkboxSoundWalkLeft(int walkboxId); + int getWalkboxSoundWalkRight(int walkboxId); + int getWalkboxSoundRunLeft(int walkboxId); + int getWalkboxSoundRunRight(int walkboxId); + +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/set_effects.cpp b/engines/bladerunner/set_effects.cpp new file mode 100644 index 0000000000..8954b6f5db --- /dev/null +++ b/engines/bladerunner/set_effects.cpp @@ -0,0 +1,168 @@ +/* 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/set_effects.h" + +namespace BladeRunner { + +SetEffects::SetEffects(BladeRunnerEngine *vm) { + _vm = vm; + + _distanceColor.r = 1.0f; + _distanceColor.g = 1.0f; + _distanceColor.b = 1.0f; + _distanceCoeficient = 0.1f; + + _fadeColor.r = 0.0f; + _fadeColor.g = 0.0f; + _fadeColor.b = 0.0f; + _fadeDensity = 0.0f; + + _fogsCount = 0; + _fogs = NULL; +} + +SetEffects::~SetEffects() { + reset(); +} + +void SetEffects::read(Common::ReadStream *stream, int framesCount) { + _distanceCoeficient = stream->readFloatLE(); + _distanceColor.r = stream->readFloatLE(); + _distanceColor.g = stream->readFloatLE(); + _distanceColor.b = stream->readFloatLE(); + + _fogsCount = stream->readUint32LE(); + int i; + for (i = 0; i < _fogsCount; i++) { + int type = stream->readUint32LE(); + Fog *fog = NULL; + switch (type) { + case 0: + fog = new FogCone(); + break; + case 1: + fog = new FogSphere(); + break; + case 2: + fog = new FogBox(); + break; + } + if (!fog) { + //TODO exception, unknown fog type + } + fog->read(stream, framesCount); + fog->_next = _fogs; + _fogs = fog; + } +} + +void SetEffects::reset() { + Fog *fog, *nextFog; + + if (!_fogs) + return; + + do { + fog = _fogs; + nextFog = fog->_next; + delete fog; + fog = nextFog; + } while (nextFog); + +} + +void SetEffects::setupFrame(int frame) { +} + +void SetEffects::setFadeColor(float r, float g, float b) { + _fadeColor.r = r; + _fadeColor.r = g; + _fadeColor.b = b; +} + +void SetEffects::setFadeDensity(float density) { + _fadeDensity = density; +} + +void SetEffects::setFogColor(const char *fogName, float r, float g, float b) { + Fog *fog = findFog(fogName); + if (fog == nullptr) + return; + + fog->_fogColor.r = r; + fog->_fogColor.g = g; + fog->_fogColor.b = b; +} + +void SetEffects::setFogDensity(const char *fogName, float density) { + Fog *fog = findFog(fogName); + if (fog == nullptr) + return; + + fog->_fogDensity = density; +} + +void SetEffects::calculateColor(Vector3 viewPosition, Vector3 position, float *outCoeficient, Color *outColor) { + float distanceCoeficient = CLIP((position - viewPosition).length() * _distanceCoeficient, 0.0f, 1.0f); + + *outCoeficient = 1.0f - distanceCoeficient; + outColor->r = _distanceColor.r * distanceCoeficient; + outColor->g = _distanceColor.g * distanceCoeficient; + outColor->b = _distanceColor.b * distanceCoeficient; + + for (Fog *fog = this->_fogs; fog != nullptr; fog = fog->_next) { + float fogCoeficient = 0.0f; + fog->calculateCoeficient(position, viewPosition, &fogCoeficient); + if (fogCoeficient > 0.0f) { + fogCoeficient = CLIP(fog->_fogDensity * fogCoeficient, 0.0f, 1.0f); + + *outCoeficient = *outCoeficient * (1.0f - fogCoeficient); + outColor->r = outColor->r * (1.0f - fogCoeficient) + fog->_fogColor.r * fogCoeficient; + outColor->g = outColor->g * (1.0f - fogCoeficient) + fog->_fogColor.g * fogCoeficient; + outColor->b = outColor->b * (1.0f - fogCoeficient) + fog->_fogColor.b * fogCoeficient; + } + } + + *outCoeficient = *outCoeficient * (1.0f - this->_fadeDensity); + outColor->r = outColor->r * (1.0f - this->_fadeDensity) + this->_fadeColor.r * this->_fadeDensity; + outColor->g = outColor->g * (1.0f - this->_fadeDensity) + this->_fadeColor.g * this->_fadeDensity; + outColor->b = outColor->b * (1.0f - this->_fadeDensity) + this->_fadeColor.b * this->_fadeDensity; +} + +Fog *SetEffects::findFog(const char *fogName) { + if (!_fogs) + return nullptr; + + Fog *fog = _fogs; + + while (fog != nullptr) { + if (strcmp(fogName, fog->_name) == 0) { + break; + } + fog = fog->_next; + } + + return fog; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/set_effects.h b/engines/bladerunner/set_effects.h new file mode 100644 index 0000000000..1e041ad1d4 --- /dev/null +++ b/engines/bladerunner/set_effects.h @@ -0,0 +1,69 @@ +/* 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_SET_EFFECTS_H +#define BLADERUNNER_SET_EFFECTS_H + +#include "bladerunner/bladerunner.h" +#include "bladerunner/color.h" +#include "bladerunner/fog.h" + +#include "common/stream.h" + +namespace BladeRunner { + +class SetEffects { + BladeRunnerEngine *_vm; + +private: + Color _distanceColor; + float _distanceCoeficient; + Color _fadeColor; + float _fadeDensity; + int _fogsCount; + Fog *_fogs; + +public: + SetEffects(BladeRunnerEngine *vm); + ~SetEffects(); + + void read(Common::ReadStream *stream, int framesCount); + + void reset(); + + void setupFrame(int frame); + + void setFadeColor(float r, float g, float b); + void setFadeDensity(float density); + void setFogColor(const char* fogName, float r, float g, float b); + void setFogDensity(const char* fogName, float density); + + void calculateColor(Vector3 viewPosition, Vector3 position, float *outCoeficient, Color *outColor); +private: + + Fog *findFog(const char* fogName); + +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/settings.cpp b/engines/bladerunner/settings.cpp new file mode 100644 index 0000000000..679db5193e --- /dev/null +++ b/engines/bladerunner/settings.cpp @@ -0,0 +1,127 @@ +/* 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/settings.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/chapters.h" +#include "bladerunner/scene.h" + +#include "common/debug.h" + +namespace BladeRunner { + +Settings::Settings(BladeRunnerEngine *vm) : _vm(vm) { + _chapter = 1; + _gamma = 1.0f; + + _chapterChanged = false; + _newChapter = -1; + _newScene = -1; + _newSet = -1; + + _startingGame = true; + _loadingGame = false; + + _fullHDFrames = true; + _mst3k = false; +} + +bool Settings::openNewScene() { + if (_newSet == -1) { + assert(_newScene == -1); + return true; + } + assert(_newScene != -1); + + if (_startingGame) { + // Stop ambient audio and music +// ambient::removeAllNonLoopingSounds(Ambient, 1); +// ambient::removeAllLoopingSounds(Ambient, 1); +// music::stop(Music, 2); + } + + int currentSet = _vm->_scene->_setId; + int newSet = _newSet; + int newScene = _newScene; + + _newSet = -1; + _newScene = -1; + if (currentSet != -1) { + _vm->_scene->close(!_loadingGame && !_startingGame); + } + if (_chapterChanged) { + if (_vm->_chapters->hasOpenResources()) + _vm->_chapters->closeResources(); + + int newChapter = _newChapter; + _chapterChanged = false; + _newChapter = 0; + if (!_vm->_chapters->enterChapter(newChapter)) { + _vm->_gameIsRunning = false; + return false; + } + _chapter = newChapter; + if (_startingGame) + _startingGame = false; + } + + if (!_vm->_scene->open(newSet, newScene, _loadingGame)) { + _vm->_gameIsRunning = false; + return false; + } + + if (!_loadingGame && currentSet != newSet) { + // TODO: Reset actors for new set + } + + _loadingGame = false; + return true; +} + +int Settings::getAmmoType() { + return _ammoType; +} + +int Settings::getAmmoAmount(int ammoType) { + return _ammoAmounts[ammoType]; +} + +void Settings::addAmmo(int ammoType, int ammo) { + if (ammoType > _ammoType || _ammoAmounts[_ammoType] == 0) + _ammoType = ammoType; + _ammoAmounts[ammoType] += ammo; +} + +int Settings::getDifficulty() { + return _difficulty; +} + +int Settings::getPlayerAgenda() { + return _playerAgenda; +} + +void Settings::setPlayerAgenda(int agenda) { + _playerAgenda = agenda; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/settings.h b/engines/bladerunner/settings.h new file mode 100644 index 0000000000..de9846a854 --- /dev/null +++ b/engines/bladerunner/settings.h @@ -0,0 +1,108 @@ +/* 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_SETTINGS_H +#define BLADERUNNER_SETTINGS_H + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Settings { + BladeRunnerEngine *_vm; + + int _chapter; + float _gamma; + + bool _chapterChanged; + int _newChapter; + int _newScene; + int _newSet; + + bool _startingGame; + bool _loadingGame; + + int _fullHDFrames; + int _mst3k; + + int _difficulty; + int _playerAgenda; + + int _ammoType; + int _ammoAmounts[3]; + +public: + Settings(BladeRunnerEngine *vm); + + void setGamma(float gamma) { + _gamma = gamma; + } + + void setNewSetAndScene(int set, int scene) { + _newSet = set; + _newScene = scene; + } + + void clearNewSetAndScene() { + _newSet = -1; + _newScene = -1; + } + + int getNewScene() { + return _newScene; + } + + int getNewSet() { + return _newSet; + } + + void setChapter(int newChapter) { + _chapterChanged = true; + _newChapter = newChapter; + } + + void setLoadingGame(bool loadingGame) { + _loadingGame = loadingGame; + } + + bool getLoadingGame() { + return _loadingGame; + } + + void setStartingGame(bool startingGame) { + _startingGame = startingGame; + } + + bool openNewScene(); + + int getAmmoType(); + int getAmmoAmount(int ammoType); + + int getDifficulty(); + int getPlayerAgenda(); + void setPlayerAgenda(int agenda); + void addAmmo(int ammoType, int ammo); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/shape.cpp b/engines/bladerunner/shape.cpp new file mode 100644 index 0000000000..8e62aa4057 --- /dev/null +++ b/engines/bladerunner/shape.cpp @@ -0,0 +1,131 @@ +/* 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/shape.h" + +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" +#include "common/ptr.h" +#include "common/util.h" + +#include "graphics/surface.h" + +namespace BladeRunner { + +Shape::Shape(BladeRunnerEngine *vm) + : _vm(vm), _data(nullptr) { +} + +Shape::~Shape() { + delete[] _data; +} + +bool Shape::readFromContainer(const Common::String &container, int index) { + Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->getResourceStream(container)); + if (!stream) { + debug("Shape::readFromContainer failed to open '%s'", container.c_str()); + return false; + } + + uint32 count = stream->readUint32LE(); + if (index < 0 || (uint32)index >= count) { + debug("Shape::readFromContainer invalid index %d (count %u)", index, count); + return false; + } + + uint32 size = 0, width = 0, height = 0; + for (int i = 0; i <= index; ++i) { + width = stream->readUint32LE(); + height = stream->readUint32LE(); + size = stream->readUint32LE(); + + if (size != width * height * 2) { + debug("Shape::readFromContainer size mismatch (w %d, h %d, sz %d)", width, height, size); + return false; + } + + if (i != index) { + stream->skip(size); + } + } + + // Enfoce a reasonable size limit + if (width >= 2048 || height >= 2048) { + warning("Shape::readFromContainer shape too big (%d, %d)", width, height); + } + + _width = width; + _height = height; + _data = new byte[size]; + + if (stream->read(_data, size) != size) { + debug("Shape::readFromContainer error reading shape %d (w %d, h %d, sz %d)", index, width, height, size); + return false; + } + + return true; +} + +void Shape::draw(Graphics::Surface &surface, int x, int y) { + // debug("x=%d, y=%d", x, y); + // debug("w=%d, h=%d", _width, _height); + + int src_x = CLIP(-x, 0, _width); + int src_y = CLIP(-y, 0, _height); + + // debug("src_x=%d, src_y=%d", src_x, src_y); + + int dst_x = CLIP<int>(x, 0, surface.w); + int dst_y = CLIP<int>(y, 0, surface.h); + + // debug("dst_x=%d, dst_y=%d", dst_x, dst_y); + + int rect_w = MIN(CLIP(_width + x, 0, _width), surface.w - x); + int rect_h = MIN(CLIP(_height + y, 0, _height), surface.h - y); + + // debug("rect_w=%d, rect_h=%d", rect_w, rect_h); + + if (rect_w == 0 || rect_h == 0) { + return; + } + + byte *src_p = _data + 2 * (src_y * _width + src_x); + byte *dst_p = (byte*)surface.getBasePtr(dst_x, dst_y); + + for (int yi = 0; yi != rect_h; ++yi) { + for (int xi = 0; xi != rect_w; ++xi) { + uint16 color = READ_LE_UINT16(src_p); + if ((color & 0x8000) == 0) { + *(uint16*)dst_p = color; + } + + src_p += 2; + dst_p += 2; + } + + src_p += 2 * (_width - rect_w); + dst_p += surface.pitch - 2 * rect_w; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/shape.h b/engines/bladerunner/shape.h new file mode 100644 index 0000000000..e2e77b1a76 --- /dev/null +++ b/engines/bladerunner/shape.h @@ -0,0 +1,54 @@ +/* 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_SHAPE_H +#define BLADERUNNER_SHAPE_H + +#include "common/str.h" + +namespace Graphics { + struct Surface; +} + +namespace BladeRunner { + +class BladeRunnerEngine; + +class Shape { + BladeRunnerEngine *_vm; + + int _width; + int _height; + byte *_data; + +public: + Shape(BladeRunnerEngine *vm); + ~Shape(); + + bool readFromContainer(const Common::String &container, int index); + + void draw(Graphics::Surface &surface, int x, int y); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp new file mode 100644 index 0000000000..503193c2a6 --- /dev/null +++ b/engines/bladerunner/slice_animations.cpp @@ -0,0 +1,185 @@ +/* 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/slice_animations.h" + +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" +#include "common/file.h" +#include "common/system.h" + +namespace BladeRunner { + +bool SliceAnimations::open(const Common::String &name) { + Common::File file; + if (!file.open(_vm->getResourceStream(name), name)) + return false; + + _timestamp = file.readUint32LE(); + _pageSize = file.readUint32LE(); + _pageCount = file.readUint32LE(); + _paletteCount = file.readUint32LE(); + + if (_timestamp != 0x3457b6f6) // Timestamp: Wed, 29 Oct 1997 22:21:42 GMT + return false; + + _palettes.resize(_paletteCount); + + for (uint32 i = 0; i != _paletteCount; ++i) { + for (uint32 j = 0; j != 256; ++j) { + uint8 color_r = file.readByte(); + uint8 color_g = file.readByte(); + uint8 color_b = file.readByte(); + + _palettes[i].color[j].r = color_r; + _palettes[i].color[j].g = color_g; + _palettes[i].color[j].b = color_b; + + uint16 rgb555 = ((uint16)color_r << 10) | + ((uint16)color_g << 5) | + (uint16)color_b; + + _palettes[i].color555[j] = rgb555; + } + } + + uint32 animationCount = file.readUint32LE(); + _animations.resize(animationCount); + + for (uint32 i = 0; i != animationCount; ++i) { + _animations[i].frameCount = file.readUint32LE(); + _animations[i].frameSize = file.readUint32LE(); + _animations[i].fps = file.readFloatLE(); + _animations[i].positionChange.x = file.readFloatLE(); + _animations[i].positionChange.y = file.readFloatLE(); + _animations[i].positionChange.z = file.readFloatLE(); + _animations[i].facingChange = file.readFloatLE(); + _animations[i].offset = file.readUint32LE(); + +#if 0 + debug("%4d %6d %6x %7.2g %7.2g %7.2g %7.2g %7.2g %8x", + i, + _animations[i].frameCount, + _animations[i].frameSize, + _animations[i].fps, + _animations[i].unk0, + _animations[i].unk1, + _animations[i].unk2, + _animations[i].unk3, + _animations[i].offset); +#endif + } + + _pages.resize(_pageCount); + for (uint32 i = 0; i != _pageCount; ++i) + _pages[i]._data = nullptr; + + return true; +} + +SliceAnimations::~SliceAnimations() { + for (uint32 i = 0; i != _pages.size(); ++i) + free(_pages[i]._data); +} + +bool SliceAnimations::openCoreAnim() { + return _coreAnimPageFile.open("COREANIM.DAT"); +} + +bool SliceAnimations::openHDFrames() { + return _framesPageFile.open("HDFRAMES.DAT"); +} + +bool SliceAnimations::PageFile::open(const Common::String &name) { + if (!_file.open(name)) + return false; + + uint32 timestamp = _file.readUint32LE(); + if (timestamp != _sliceAnimations->_timestamp) + return false; + + _pageOffsets.resize(_sliceAnimations->_pageCount); + for (uint32 i = 0; i != _sliceAnimations->_pageCount; ++i) + _pageOffsets[i] = -1; + + uint32 pageCount = _file.readUint32LE(); + uint32 dataOffset = 8 + 4 * pageCount; + + for (uint32 i = 0; i != pageCount; ++i) { + uint32 pageNumber = _file.readUint32LE(); + if (pageNumber == 0xffffffff) + continue; + _pageOffsets[pageNumber] = dataOffset + i * _sliceAnimations->_pageSize; + } + + // debug("PageFile::Open: page file \"%s\" opened with %d pages", name.c_str(), pageCount); + + return true; +} + +void *SliceAnimations::PageFile::loadPage(uint32 pageNumber) { + if (_pageOffsets[pageNumber] == -1) + return nullptr; + + uint32 pageSize = _sliceAnimations->_pageSize; + + // TODO: Retire oldest pages if we exceed some memory limit + + void *data = malloc(pageSize); + _file.seek(_pageOffsets[pageNumber], SEEK_SET); + uint32 r = _file.read(data, pageSize); + assert(r == pageSize); + + return data; +} + +void *SliceAnimations::getFramePtr(uint32 animation, uint32 frame) { + assert(frame < _animations[animation].frameCount); + + uint32 frameOffset = _animations[animation].offset + frame * _animations[animation].frameSize; + uint32 page = frameOffset / _pageSize; + uint32 pageOffset = frameOffset % _pageSize; + + if (!_pages[page]._data) + _pages[page]._data = _coreAnimPageFile.loadPage(page); + + if (!_pages[page]._data) + _pages[page]._data = _framesPageFile.loadPage(page); + + if (!_pages[page]._data) + error("Unable to locate page %d for animation %d frame %d", page, animation, frame); + + _pages[page]._lastAccess = _vm->_system->getMillis(); + + return (byte*)_pages[page]._data + pageOffset; +} + +Vector3 SliceAnimations::getPositionChange(int animation) { + return _animations[animation].positionChange; +} + +float SliceAnimations::getFacingChange(int animation) { + return _animations[animation].facingChange; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/slice_animations.h b/engines/bladerunner/slice_animations.h new file mode 100644 index 0000000000..b5b60ef096 --- /dev/null +++ b/engines/bladerunner/slice_animations.h @@ -0,0 +1,115 @@ +/* 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_SLICE_ANIMATIONS_H +#define BLADERUNNER_SLICE_ANIMATIONS_H + +#include "common/array.h" +#include "common/file.h" +#include "common/str.h" +#include "common/types.h" + +#include "bladerunner/color.h" +#include "bladerunner/vector.h" + + +namespace BladeRunner { + +class BladeRunnerEngine; + +struct SlicePalette { + uint16 color555[256]; + Color256 color[256]; + +// uint16 &operator[](size_t i) { return color555[i]; } +}; + +class SliceAnimations { + friend class SliceRenderer; + + struct Animation { + uint32 frameCount; + uint32 frameSize; + float fps; + Vector3 positionChange; + float facingChange; + uint32 offset; + }; + + struct Page { + void *_data; + uint32 _lastAccess; + + Page() : _data(nullptr) {} + }; + + struct PageFile { + SliceAnimations *_sliceAnimations; + Common::File _file; + Common::Array<int32> _pageOffsets; + + PageFile(SliceAnimations *sliceAnimations) : _sliceAnimations(sliceAnimations) {} + + bool open(const Common::String &name); + void *loadPage(uint32 page); + }; + + BladeRunnerEngine *_vm; + + uint32 _timestamp; + uint32 _pageSize; + uint32 _pageCount; + uint32 _paletteCount; + + Common::Array<SlicePalette> _palettes; + Common::Array<Animation> _animations; + Common::Array<Page> _pages; + + PageFile _coreAnimPageFile; + PageFile _framesPageFile; + +public: + SliceAnimations(BladeRunnerEngine *vm) + : _vm(vm), + _coreAnimPageFile(this), + _framesPageFile(this) { + } + ~SliceAnimations(); + + bool open(const Common::String &name); + + bool openCoreAnim(); + bool openHDFrames(); + + SlicePalette &getPalette(int i) { return _palettes[i]; }; + void *getFramePtr(uint32 animation, uint32 frame); + + int getFrameCount(int animation){ return _animations[animation].frameCount; } + float getFPS(int animation){ return _animations[animation].fps; } + + Vector3 getPositionChange(int animation); + float getFacingChange(int animation); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp new file mode 100644 index 0000000000..f8d9a48dfc --- /dev/null +++ b/engines/bladerunner/slice_renderer.cpp @@ -0,0 +1,649 @@ +/* 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/slice_renderer.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/lights.h" +#include "bladerunner/set_effects.h" +#include "bladerunner/slice_animations.h" + +#include "common/memstream.h" +#include "common/rect.h" +#include "common/util.h" + +namespace BladeRunner { + +SliceRenderer::SliceRenderer(BladeRunnerEngine *vm) { + _vm = vm; + _pixelFormat = createRGB555(); + int i; + + for (i = 0; i < 942; i++) { // yes, its going just to 942 and not 997 + _animationsShadowEnabled[i] = true; + } +} + +SliceRenderer::~SliceRenderer() { +} + +void SliceRenderer::setView(const View &view) { + _view = view; +} + +void SliceRenderer::setLights(Lights *lights) { + _lights = lights; +} + +void SliceRenderer::setSetEffects(SetEffects *setEffects) { + _setEffects = setEffects; +} + +void SliceRenderer::setupFrameInWorld(int animationId, int animationFrame, Vector3 position, float facing, float scale) { + _position = position; + _facing = facing; + _scale = scale; + + loadFrame(animationId, animationFrame); + + calculateBoundingRect(); +} + +void SliceRenderer::getScreenRectangle(Common::Rect *screenRectangle, int animationId, int animationFrame, Vector3 position, float facing, float scale) { + assert(screenRectangle); + setupFrameInWorld(animationId, animationFrame, position, facing, scale); + *screenRectangle = _screenRectangle; +} + +Matrix3x2 SliceRenderer::calculateFacingRotationMatrix() { + assert(_sliceFramePtr); + + Matrix4x3 viewMatrix = _view._sliceViewMatrix; + Vector3 viewPos = viewMatrix * _position; + float dir = atan2f(viewPos.x, viewPos.z) + _facing; + float s = sinf(dir); + float c = cosf(dir); + + Matrix3x2 rotation( c, -s, 0.0f, + s, c, 0.0f); + + Matrix3x2 viewRotation(viewMatrix(0,0), viewMatrix(0,1), 0.0f, + viewMatrix(2,0), viewMatrix(2,1), 0.0f); + + return viewRotation * rotation; +} + +void SliceRenderer::calculateBoundingRect() { + assert(_sliceFramePtr); + + _screenRectangle.left = 0; + _screenRectangle.right = 0; + _screenRectangle.top = 0; + _screenRectangle.bottom = 0; + + Matrix4x3 viewMatrix = _view._sliceViewMatrix; + + Vector3 frameBottom = Vector3(0.0f, 0.0f, _frameBottomZ); + Vector3 frameTop = Vector3(0.0f, 0.0f, _frameBottomZ + _frameSliceCount * _frameSliceHeight); + + Vector3 bottom = viewMatrix * (_position + frameBottom); + Vector3 top = viewMatrix * (_position + frameTop); + + top = bottom + _scale * (top - bottom); + + if (bottom.z < 0.0f || top.z < 0.0f) + return; + + Matrix3x2 facingRotation = calculateFacingRotationMatrix(); + + Matrix3x2 m_projection(_view._viewportDistance / bottom.z, 0.0f, 0.0f, + 0.0f, 25.5f, 0.0f); + + Matrix3x2 m_frame(_frameScale.x, 0.0f, _framePos.x, + 0.0f, _frameScale.y, _framePos.y); + + _modelMatrix = m_projection * (facingRotation * m_frame); + + Vector4 startScreenVector( + _view._viewportHalfWidth + top.x / top.z * _view._viewportDistance, + _view._viewportHalfHeight + top.y / top.z * _view._viewportDistance, + 1.0f / top.z, + _frameSliceCount * (1.0f / top.z)); + + Vector4 endScreenVector( + _view._viewportHalfWidth + bottom.x / bottom.z * _view._viewportDistance, + _view._viewportHalfHeight + bottom.y / bottom.z * _view._viewportDistance, + 1.0f / bottom.z, + 0.0f); + + _startScreenVector.x = startScreenVector.x; + _startScreenVector.y = startScreenVector.y; + _startScreenVector.z = startScreenVector.z; + _endScreenVector.x = endScreenVector.x; + _endScreenVector.y = endScreenVector.y; + _endScreenVector.z = endScreenVector.z; + _startSlice = startScreenVector.w; + _endSlice = endScreenVector.w; + + Vector4 delta = endScreenVector - startScreenVector; + + if (delta.y == 0.0f) { + return; + } + + /* + * Calculate min and max Y + */ + + float screenMinY = 0.0f; + float screenMaxY = 479.0f; + + if (startScreenVector.y < screenMinY) { + if (endScreenVector.y < screenMinY) + return; + + float f = (screenMinY - startScreenVector.y) / delta.y; + startScreenVector = startScreenVector + f * delta; + } else if (startScreenVector.y > screenMaxY) { + if (endScreenVector.y >= screenMaxY) + return; + + float f = (screenMaxY - startScreenVector.y) / delta.y; + startScreenVector = startScreenVector + f * delta; + } + + if (endScreenVector.y < screenMinY) { + float f = (screenMinY - endScreenVector.y) / delta.y; + endScreenVector = endScreenVector + f * delta; + } else if (endScreenVector.y > screenMaxY) { + float f = (screenMaxY - endScreenVector.y) / delta.y; + endScreenVector = endScreenVector + f * delta; + } + + int bbox_min_y = (int)MIN(startScreenVector.y, endScreenVector.y); + int bbox_max_y = (int)MAX(startScreenVector.y, endScreenVector.y) + 1; + + /* + * Calculate min and max X + */ + + Matrix3x2 mB6 = _modelMatrix + Vector2(startScreenVector.x, 25.5f / startScreenVector.z); + Matrix3x2 mC2 = _modelMatrix + Vector2(endScreenVector.x, 25.5f / endScreenVector.z); + + float min_x = 640.0f; + float max_x = 0.0f; + + for (float i = 0.0f; i <= 256.0f; i += 255.0f) { + for (float j = 0.0f; j <= 256.0f; j += 255.0f) { + Vector2 v1 = mB6 * Vector2(i, j); + + min_x = MIN(min_x, v1.x); + max_x = MAX(max_x, v1.x); + + Vector2 v2 = mC2 * Vector2(i, j); + + min_x = MIN(min_x, v2.x); + max_x = MAX(max_x, v2.x); + } + } + + int bbox_min_x = CLIP((int)min_x, 0, 640); + int bbox_max_x = CLIP((int)max_x + 1, 0, 640); + + _startScreenVector.x = startScreenVector.x; + _startScreenVector.y = startScreenVector.y; + _startScreenVector.z = startScreenVector.z; + _endScreenVector.x = endScreenVector.x; + _endScreenVector.y = endScreenVector.y; + _endScreenVector.z = endScreenVector.z; + _startSlice = startScreenVector.w; + _endSlice = endScreenVector.w; + + _screenRectangle.left = bbox_min_x; + _screenRectangle.right = bbox_max_x; + _screenRectangle.top = bbox_min_y; + _screenRectangle.bottom = bbox_max_y; +} + +void SliceRenderer::loadFrame(int animation, int frame) { + _animation = animation; + _frame = frame; + _sliceFramePtr = _vm->_sliceAnimations->getFramePtr(_animation, _frame); + + Common::MemoryReadStream stream((byte*)_sliceFramePtr, _vm->_sliceAnimations->_animations[_animation].frameSize); + + _frameScale.x = stream.readFloatLE(); + _frameScale.y = stream.readFloatLE(); + _frameSliceHeight = stream.readFloatLE(); + _framePos.x = stream.readFloatLE(); + _framePos.y = stream.readFloatLE(); + _frameBottomZ = stream.readFloatLE(); + _framePaletteIndex = stream.readUint32LE(); + _frameSliceCount = stream.readUint32LE(); +} + +struct SliceLineIterator { + int _sliceMatrix[2][3]; + int _startY; + int _endY; + + float _currentZ; + float _stepZ; + float _currentSlice; + float _stepSlice; + float _currentX; + float _stepX; + int _field_38; + int _currentY; + + void setup(float endScreenX, float endScreenY, float endScreenZ, + float startScreenX, float startScreenY, float startScreenZ, + float endSlice, float startSlice, + Matrix3x2 m); + float line(); + void advance(); +}; + +void SliceLineIterator::setup( + float endScreenX, float endScreenY, float endScreenZ, + float startScreenX, float startScreenY, float startScreenZ, + float endSlice, float startSlice, + Matrix3x2 m) { + _startY = (int)startScreenY; + _endY = (int)endScreenY; + + float size = endScreenY - startScreenY; + + if (size <= 0.0f || startScreenZ <= 0.0f) + _currentY = _endY + 1; + + _currentZ = startScreenZ; + _stepZ = (endScreenZ - startScreenZ) / size; + + _stepSlice = (endSlice - startSlice) / size; + _currentSlice = startSlice - (startScreenY - floor(startScreenY) - 1.0f) * _stepSlice; + + _currentX = startScreenX; + _stepX = (endScreenX - startScreenX) / size; + + _field_38 = (int)((25.5f / size) * (1.0f / endScreenZ - 1.0f / startScreenZ) * 64.0); + _currentY = _startY; + + float offsetX = _currentX; + float offsetZ = 25.5f / _currentZ; + + Matrix3x2 translate_matrix = Matrix3x2(1.0f, 0.0f, offsetX, + 0.0f, 1.0f, offsetZ); + + Matrix3x2 scale_matrix = Matrix3x2(65536.0f, 0.0f, 0.0f, + 0.0f, 64.0f, 0.0f); + + m = scale_matrix * (translate_matrix * m); + + for (int r = 0; r != 2; ++r) + for (int c = 0; c != 3; ++c) + _sliceMatrix[r][c] = m(r, c); +} + +float SliceLineIterator::line() { + float var_0 = 0.0f; + + if (_currentZ != 0.0f) + var_0 = _currentSlice / _currentZ; + + if (var_0 < 0.0) + var_0 = 0.0f; + + return var_0; +} + +void SliceLineIterator::advance() { + _currentZ += _stepZ; + _currentSlice += _stepSlice; + _currentX += _stepX; + _currentY += 1; + _sliceMatrix[0][2] += (int)(65536.0f * _stepX); + _sliceMatrix[1][2] += _field_38; +} + +static void setupLookupTable(int t[256], int inc) { + int v = 0; + for (int i = 0; i != 256; ++i) { + t[i] = v; + v += inc; + } +} + +void SliceRenderer::drawInWorld(int animationId, int animationFrame, Vector3 position, float facing, float scale, Graphics::Surface &surface, uint16 *zbuffer) { + assert(_sliceFramePtr); + assert(_lights); + assert(_setEffects); + //assert(_view); + + _vm->_sliceRenderer->setupFrameInWorld(animationId, animationFrame, position, facing); + + SliceLineIterator sliceLineIterator; + sliceLineIterator.setup( + _endScreenVector.x, _endScreenVector.y, _endScreenVector.z, + _startScreenVector.x, _startScreenVector.y, _startScreenVector.z, + _endSlice, _startSlice, + _modelMatrix + ); + + SliceRendererLights sliceRendererLights = SliceRendererLights(_lights); + + _lights->setupFrame(_view._frame); + _setEffects->setupFrame(_view._frame); + + float sliceLine = sliceLineIterator.line(); + + sliceRendererLights.calculateColorBase( + Vector3(_position.x, _position.y, _position.z + _frameBottomZ + sliceLine * _frameSliceHeight), + Vector3(_position.x, _position.y, _position.z + _frameBottomZ), + sliceLineIterator._endY - sliceLineIterator._startY); + + float setEffectsColorCoeficient; + Color setEffectColor; + _setEffects->calculateColor( + _view._cameraPosition, + Vector3(_position.x, _position.y, _position.z + _frameBottomZ + sliceLine * _frameSliceHeight), + &setEffectsColorCoeficient, + &setEffectColor); + + _lightsColor.r = setEffectsColorCoeficient * sliceRendererLights._finalColor.r * 65536.0f; + _lightsColor.g = setEffectsColorCoeficient * sliceRendererLights._finalColor.g * 65536.0f; + _lightsColor.b = setEffectsColorCoeficient * sliceRendererLights._finalColor.b * 65536.0f; + + _setEffectColor.r = setEffectColor.r * 31.0f * 65536.0f; + _setEffectColor.g = setEffectColor.g * 31.0f * 65536.0f; + _setEffectColor.b = setEffectColor.b * 31.0f * 65536.0f; + + setupLookupTable(_m11lookup, sliceLineIterator._sliceMatrix[0][0]); + setupLookupTable(_m12lookup, sliceLineIterator._sliceMatrix[0][1]); + _m13 = sliceLineIterator._sliceMatrix[0][2]; + setupLookupTable(_m21lookup, sliceLineIterator._sliceMatrix[1][0]); + setupLookupTable(_m22lookup, sliceLineIterator._sliceMatrix[1][1]); + _m23 = sliceLineIterator._sliceMatrix[1][2]; + + + if(_animationsShadowEnabled[_animation]) { + //TODO: draw shadows + } + + int frameY = sliceLineIterator._startY; + + uint16 *frameLinePtr = (uint16*)surface.getPixels() + 640 * frameY; + uint16 *zBufferLinePtr = zbuffer + 640 * frameY; + + while (sliceLineIterator._currentY <= sliceLineIterator._endY) { + sliceLine = sliceLineIterator.line(); + + sliceRendererLights.calculateColorSlice(Vector3(_position.x, _position.y, _position.z + _frameBottomZ + sliceLine * _frameSliceHeight)); + + if (sliceLineIterator._currentY & 1) { + _setEffects->calculateColor( + _view._cameraPosition, + Vector3(_position.x, _position.y, _position.z + _frameBottomZ + sliceLine * _frameSliceHeight), + &setEffectsColorCoeficient, + &setEffectColor); + } + + _lightsColor.r = setEffectsColorCoeficient * sliceRendererLights._finalColor.r * 65536.0f; + _lightsColor.g = setEffectsColorCoeficient * sliceRendererLights._finalColor.g * 65536.0f; + _lightsColor.b = setEffectsColorCoeficient * sliceRendererLights._finalColor.b * 65536.0f; + + _setEffectColor.r = setEffectColor.r * 31.0f * 65536.0f; + _setEffectColor.g = setEffectColor.g * 31.0f * 65536.0f; + _setEffectColor.b = setEffectColor.b * 31.0f * 65536.0f; + + if (frameY >= 0 && frameY < 480) { + drawSlice((int)sliceLine, true, frameLinePtr, zBufferLinePtr); + } + + sliceLineIterator.advance(); + frameY += 1; + frameLinePtr += 640; + zBufferLinePtr += 640; + } +} + +void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screenX, int screenY, float facing, float scale, Graphics::Surface &surface, uint16 *zbuffer) { + if (scale == 0.0f) { + return; + } + _position.x = 0; + _position.y = 0; + _position.z = 0; + _facing = facing; + + loadFrame(animationId, animationFrame); + + float frameHeight = _frameSliceHeight * _frameSliceCount; + float frameSize = sqrtf(_frameScale.x * 255.0f * _frameScale.x * 255.0f + _frameScale.y * 255.0f * _frameScale.y * 255.0f); + float size = scale / MAX(frameSize, frameHeight); + + float s = sinf(_facing); + float c = cosf(_facing); + + Matrix3x2 m_rotation(c, -s, 0.0f, + s, c, 0.0f); + + Matrix3x2 m_frame(_frameScale.x, 0.0f, _framePos.x, + 0.0f, _frameScale.y, _framePos.y); + + Matrix3x2 m_scale_size_25_5(size, 0.0f, 0.0f, + 0.0f, 25.5f, 0.0f); + + Matrix3x2 m_translate_x_32k(1.0f, 0.0f, screenX, + 0.0f, 1.0f, 32768.0f); + + Matrix3x2 m_scale_64k_64(65536.0f, 0.0f, 0.0f, + 0.0f, 64.0f, 0.0f); + + Matrix3x2 m = m_scale_64k_64 * (m_translate_x_32k * (m_scale_size_25_5 * (m_rotation * m_frame))); + + setupLookupTable(_m11lookup, m(0, 0)); + setupLookupTable(_m12lookup, m(0, 1)); + _m13 = m(0, 2); + setupLookupTable(_m21lookup, m(1, 0)); + setupLookupTable(_m22lookup, m(1, 1)); + _m23 = m(1, 2); + + int frameY = screenY + (size / 2.0f * frameHeight); + int currentY = frameY; + + float currentSlice = 0; + float sliceStep = 1.0f / size / _frameSliceHeight; + + uint16 *frameLinePtr = (uint16*)surface.getPixels() + 640 * frameY; + uint16 lineZbuffer[640]; + + while (currentSlice < _frameSliceCount) { + if (currentY >= 0 && currentY < 480) { + memset(lineZbuffer, 0xFF, 640 * 2); + drawSlice(currentSlice, false, frameLinePtr, lineZbuffer); + currentSlice += sliceStep; + currentY--; + frameLinePtr -= 640; + } + } +} + +void SliceRenderer::drawSlice(int slice, bool advanced, uint16 *frameLinePtr, uint16 *zbufLinePtr) { + if (slice < 0 || (uint32)slice >= _frameSliceCount) + return; + + SlicePalette &palette = _vm->_sliceAnimations->getPalette(_framePaletteIndex); + + byte *p = (byte*)_sliceFramePtr + 0x20 + 4 * slice; + + uint32 polyOffset = READ_LE_UINT32(p); + + p = (byte*)_sliceFramePtr + polyOffset; + + uint32 polyCount = READ_LE_UINT32(p); + p += 4; + while (polyCount--) { + uint32 vertexCount = READ_LE_UINT32(p); + p += 4; + + if (vertexCount == 0) + continue; + + uint32 lastVertex = vertexCount - 1; + int lastVertexX = MAX((_m11lookup[p[3 * lastVertex]] + _m12lookup[p[3 * lastVertex + 1]] + _m13) >> 16, 0); + + int previousVertexX = lastVertexX; + + while (vertexCount--) { + int vertexX = CLIP((_m11lookup[p[0]] + _m12lookup[p[1]] + _m13) >> 16, 0, 640); + + if (vertexX > previousVertexX) { + int vertexZ = (_m21lookup[p[0]] + _m22lookup[p[1]] + _m23) >> 6; + + if (vertexZ >= 0 && vertexZ < 65536) { + int color555 = palette.color555[p[2]]; + if (advanced) { + Color256 color = palette.color[p[2]]; + + color.r = (int)(_setEffectColor.r + _lightsColor.r * color.r) >> 16; + color.g = (int)(_setEffectColor.g + _lightsColor.g * color.g) >> 16; + color.b = (int)(_setEffectColor.b + _lightsColor.b * color.b) >> 16; + + int bladeToScummVmConstant = 256 / 32; + + color555 = _pixelFormat.RGBToColor(CLIP(color.r * bladeToScummVmConstant, 0, 255), CLIP(color.g * bladeToScummVmConstant, 0, 255), CLIP(color.b * bladeToScummVmConstant, 0, 255)); + } + for (int x = previousVertexX; x != vertexX; ++x) { + if (vertexZ < zbufLinePtr[x]) { + frameLinePtr[x] = color555; + zbufLinePtr[x] = (uint16)vertexZ; + } + } + } + } + p += 3; + previousVertexX = vertexX; + } + } +} + +void SliceRenderer::preload(int animationId) { + int i; + int frameCount = _vm->_sliceAnimations->getFrameCount(animationId); + for (i = 0; i < frameCount; i++) + _vm->_sliceAnimations->getFramePtr(animationId, i); +} + +void SliceRenderer::disableShadows(int animationsIdsList[], int listSize) { + int i; + for (i = 0; i < listSize; i++) { + _animationsShadowEnabled[animationsIdsList[i]] = false; + } +} + +SliceRenderer::SliceRendererLights::SliceRendererLights(Lights *lights) { + _finalColor.r = 0.0f; + _finalColor.g = 0.0f; + _finalColor.b = 0.0f; + + _lights = lights; + + for (int i = 0; i < 20; i++) { + _colors[i].r = 0.0f; + _colors[i].g = 0.0f; + _colors[i].b = 0.0f; + } +} + +void SliceRenderer::SliceRendererLights::calculateColorBase(Vector3 position1, Vector3 position2, float height) { + _finalColor.r = 0.0f; + _finalColor.g = 0.0f; + _finalColor.b = 0.0f; + _hmm3 = 0; + if (_lights) { + for (uint i = 0; i < _lights->_lights.size(); i++) { + Light *light = _lights->_lights[i]; + if (i < 20) { + float v8 = light->calculate(position1, position2/*, height*/); + + this->_hmm2[i] = v8; + this->_hmm[i] = v8; + + Color v22; + light->calculateColor(&v22, position1); + _colors[i] = v22; + _finalColor.r += v22.r; + _finalColor.g += v22.g; + _finalColor.b += v22.b; + } else { + Color v23; + light->calculateColor(&v23, position1); + _finalColor.r += v23.r; + _finalColor.g += v23.g; + _finalColor.b += v23.b; + } + } + + _finalColor.r += _lights->_ambientLightColor.r; + _finalColor.g += _lights->_ambientLightColor.g; + _finalColor.b += _lights->_ambientLightColor.b; + } +} + +void SliceRenderer::SliceRendererLights::calculateColorSlice(Vector3 position) { + _finalColor.r = 0.0f; + _finalColor.g = 0.0f; + _finalColor.b = 0.0f; + + if (_lights) { + for (uint i = 0; i < _lights->_lights.size(); i++) { + Light *light = _lights->_lights[i]; + if (i < 20) { + _hmm[i] = _hmm[i] - 1.0f; + + if (_hmm[i] <= 0.0f) { + do { + _hmm[i] = _hmm[i] + _hmm2[i]; + } while (_hmm[i] <= 0.0f); + light->calculateColor(&_colors[i], position); + _hmm3++; + } + _finalColor.r += _colors[i].r; + _finalColor.g += _colors[i].g; + _finalColor.b += _colors[i].b; + } else { + Color color; + light->calculateColor(&color, position); + _hmm3++; + _finalColor.r += color.r; + _finalColor.g += color.g; + _finalColor.b += color.b; + } + } + _finalColor.r += _lights->_ambientLightColor.r; + _finalColor.g += _lights->_ambientLightColor.g; + _finalColor.b += _lights->_ambientLightColor.b; + } +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/slice_renderer.h b/engines/bladerunner/slice_renderer.h new file mode 100644 index 0000000000..d1659ec191 --- /dev/null +++ b/engines/bladerunner/slice_renderer.h @@ -0,0 +1,135 @@ +/* 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_SLICE_RENDERER_H +#define BLADERUNNER_SLICE_RENDERER_H + +#include "bladerunner/color.h" +#include "bladerunner/vector.h" +#include "bladerunner/view.h" +#include "bladerunner/matrix.h" + +#include "common/rect.h" + +#include "graphics/surface.h" + +namespace Common { +class MemoryReadStream; +} + +namespace BladeRunner { + +class BladeRunnerEngine; +class Lights; +class SetEffects; + +class SliceRenderer { + BladeRunnerEngine *_vm; + + int _animation; + int _frame; + Vector3 _position; + float _facing; + float _scale; + + View _view; + Lights *_lights; + SetEffects *_setEffects; + + void *_sliceFramePtr; + + // Animation frame data + Vector2 _frameScale; + float _frameBottomZ; + Vector2 _framePos; + float _frameSliceHeight; + uint32 _framePaletteIndex; + uint32 _frameSliceCount; + + Matrix3x2 _modelMatrix; + Vector3 _startScreenVector; + Vector3 _endScreenVector; + float _startSlice; + float _endSlice; + Common::Rect _screenRectangle; + + int _m11lookup[256]; + int _m12lookup[256]; + int _m13; + int _m21lookup[256]; + int _m22lookup[256]; + int _m23; + + bool _animationsShadowEnabled[997]; + + Color _setEffectColor; + Color _lightsColor; + + Graphics::PixelFormat _pixelFormat; + + Matrix3x2 calculateFacingRotationMatrix(); + void drawSlice(int slice, bool advanced, uint16 *frameLinePtr, uint16 *zbufLinePtr); + +public: + SliceRenderer(BladeRunnerEngine *vm); + ~SliceRenderer(); + + void setView(const View &view); + void setLights(Lights *lights); + void setSetEffects(SetEffects *setEffects); + + void setupFrameInWorld(int animationId, int animationFrame, Vector3 position, float facing, float scale = 1.0f); + void getScreenRectangle(Common::Rect *screenRectangle, int animationId, int animationFrame, Vector3 position, float facing, float scale); + void drawInWorld(int animationId, int animationFrame, Vector3 position, float facing, float scale, Graphics::Surface &surface, uint16 *zbuffer); + + void drawOnScreen(int animationId, int animationFrame, int screenX, int screenY, float facing, float scale, Graphics::Surface &surface, uint16 *zbuffer); + + void preload(int animationId); + + void disableShadows(int *animationsIdsList, int listSize); + +private: + + void calculateBoundingRect(); + void loadFrame(int animation, int frame); + + class SliceRendererLights { + Lights *_lights; + Color _colors[20]; + float _hmm[20]; + float _hmm2[20]; + int _hmm3; + + public: + Color _finalColor; + + public: + SliceRendererLights(Lights *lights); + + void calculateColorBase(Vector3 position1, Vector3 position2, float height); + void calculateColorSlice(Vector3 position); + }; +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/suspects_database.cpp b/engines/bladerunner/suspects_database.cpp new file mode 100644 index 0000000000..9c447841e9 --- /dev/null +++ b/engines/bladerunner/suspects_database.cpp @@ -0,0 +1,236 @@ +/* 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/suspects_database.h" + +#include "bladerunner/bladerunner.h" + +#include "bladerunner/text_resource.h" + +namespace BladeRunner { + +SuspectDatabaseEntry::SuspectDatabaseEntry(BladeRunnerEngine *vm) { + _vm = vm; + reset(); +} + +SuspectDatabaseEntry::~SuspectDatabaseEntry() { +} + +void SuspectDatabaseEntry::setActor(int actorId) { + _actorId = actorId; +} + +void SuspectDatabaseEntry::setSex(int sex) { + _sex = sex; +} + +bool SuspectDatabaseEntry::addMOClue(int clueId) { + if (_moCluesCount >= MO_CLUES_COUNT) { + return false; + } + _moClues[_moCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addWhereaboutsClue(int clueId) { + if (_whereaboutsCluesCount >= WHEREABOUTS_CLUES_COUNT) { + return false; + } + _whereaboutsClues[_whereaboutsCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addReplicantClue(int clueId) { + if (_replicantCluesCount >= REPLICANT_CLUES_COUNT) { + return false; + } + _replicantClues[_replicantCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addNonReplicantClue(int clueId) { + if (_nonReplicantCluesCount >= NONREPLICANT_CLUES_COUNT) { + return false; + } + _nonReplicantClues[_nonReplicantCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addOtherClue(int clueId) { + if (_otherCluesCount >= OTHER_CLUES_COUNT) { + return false; + } + _otherClues[_otherCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addIdentityClue(int clueId) { + if (_identityCluesCount >= IDENTITY_CLUES_COUNT) { + return false; + } + _identityClues[_identityCluesCount++] = clueId; + return true; +} + +bool SuspectDatabaseEntry::addPhotoClue(int a1, int a2) { + if (_photoCluesCount >= PHOTO_CLUES_COUNT) { + return false; + } + _photoClues[_photoCluesCount][0] = a2; + _photoClues[_photoCluesCount][1] = a1; + _photoClues[_photoCluesCount][2] = -1; + + _photoCluesCount++; + return true; +} + +const char *SuspectDatabaseEntry::getName() { + return _vm->_textActorNames->getText(_actorId); +} + +bool SuspectDatabaseEntry::hasMOClue(int clueId) { + for (int i = 0; i < _moCluesCount; i++) { + if (_moClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasWhereaboutsClue(int clueId) { + for (int i = 0; i < _whereaboutsCluesCount; i++) { + if (_whereaboutsClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasReplicantClue(int clueId) { + for (int i = 0; i < _replicantCluesCount; i++) { + if (_replicantClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasNonReplicantClue(int clueId) { + for (int i = 0; i < _nonReplicantCluesCount; i++) { + if (_nonReplicantClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasOtherClue(int clueId) { + for (int i = 0; i < _otherCluesCount; i++) { + if (_otherClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasIdentityClue(int clueId) { + for (int i = 0; i < _identityCluesCount; i++) { + if (_identityClues[i] == clueId) { + return true; + } + } + return false; +} + +bool SuspectDatabaseEntry::hasClue(int clueId) { + return hasMOClue(clueId) + || hasWhereaboutsClue(clueId) + || hasReplicantClue(clueId) + || hasNonReplicantClue(clueId) + || hasOtherClue(clueId); +} + +int SuspectDatabaseEntry::getPhotoClue1(int photoId) { + return _photoClues[photoId][0]; +} + +int SuspectDatabaseEntry::getPhotoClue2(int photoId) { + return _photoClues[photoId][1]; +} + +int SuspectDatabaseEntry::getPhotoClue3(int photoId) { + return _photoClues[photoId][2]; +} + +void SuspectDatabaseEntry::reset() { + _actorId = -1; + _sex = -1; + for (int i = 0; i < MO_CLUES_COUNT; i++) { + _moClues[i] = -1; + } + for (int i = 0; i < WHEREABOUTS_CLUES_COUNT; i++) { + _whereaboutsClues[i] = -1; + } + for (int i = 0; i < IDENTITY_CLUES_COUNT; i++) { + _identityClues[i] = -1; + } + for (int i = 0; i < REPLICANT_CLUES_COUNT; i++) { + _replicantClues[i] = -1; + } + for (int i = 0; i < NONREPLICANT_CLUES_COUNT; i++) { + _nonReplicantClues[i] = -1; + } + for (int i = 0; i < OTHER_CLUES_COUNT; i++) { + _otherClues[i] = -1; + } + + // photo clues are not reseted in original game + + _moCluesCount = 0; + _whereaboutsCluesCount = 0; + _replicantCluesCount = 0; + _nonReplicantCluesCount = 0; + _otherCluesCount = 0; + _identityCluesCount = 0; + _photoCluesCount = 0; +} + +SuspectsDatabase::SuspectsDatabase(BladeRunnerEngine *vm, int size) { + _vm = vm; + for (int i = 0; i < size; i++) { + _suspects.push_back(new SuspectDatabaseEntry(_vm)); + } +} + +SuspectsDatabase::~SuspectsDatabase() { + for (int i = _suspects.size() - 1; i >= 0; i--) { + delete _suspects.remove_at(i); + } + _suspects.clear(); +} + +SuspectDatabaseEntry *SuspectsDatabase::get(int suspectId) { + return _suspects[suspectId]; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/suspects_database.h b/engines/bladerunner/suspects_database.h new file mode 100644 index 0000000000..83e551b1a1 --- /dev/null +++ b/engines/bladerunner/suspects_database.h @@ -0,0 +1,104 @@ +/* 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_SUSPECTS_DATABASE_H +#define BLADERUNNER_SUSPECTS_DATABASE_H +#include "common/array.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class TextResource; + +#define MO_CLUES_COUNT 10 +#define WHEREABOUTS_CLUES_COUNT 10 +#define REPLICANT_CLUES_COUNT 20 +#define NONREPLICANT_CLUES_COUNT 20 +#define OTHER_CLUES_COUNT 20 +#define IDENTITY_CLUES_COUNT 10 +#define PHOTO_CLUES_COUNT 10 + +class SuspectDatabaseEntry { + BladeRunnerEngine *_vm; + + int _actorId; + int _sex; + int _moClues[MO_CLUES_COUNT]; + int _whereaboutsClues[WHEREABOUTS_CLUES_COUNT]; + int _replicantClues[REPLICANT_CLUES_COUNT]; + int _nonReplicantClues[NONREPLICANT_CLUES_COUNT]; + int _otherClues[OTHER_CLUES_COUNT]; + int _identityClues[IDENTITY_CLUES_COUNT]; + int _photoClues[6][3]; + int _moCluesCount; + int _whereaboutsCluesCount; + int _replicantCluesCount; + int _nonReplicantCluesCount; + int _otherCluesCount; + int _identityCluesCount; + int _photoCluesCount; + +public: + SuspectDatabaseEntry(BladeRunnerEngine *_vm); + ~SuspectDatabaseEntry(); + + void setActor(int actorId); + void setSex(int sex); + bool addMOClue(int clueId); + bool addWhereaboutsClue(int clueId); + bool addReplicantClue(int clueId); + bool addNonReplicantClue(int clueId); + bool addOtherClue(int clueId); + bool addIdentityClue(int clueId); + bool addPhotoClue(int a1, int a2); + + const char *getName(); + bool hasMOClue(int clueId); + bool hasWhereaboutsClue(int clueId); + bool hasReplicantClue(int clueId); + bool hasNonReplicantClue(int clueId); + bool hasOtherClue(int clueId); + bool hasIdentityClue(int clueId); + bool hasClue(int clueId); + int getPhotoClue1(int photoId); + int getPhotoClue2(int photoId); + int getPhotoClue3(int photoId); + +private: + void reset(); +}; + +class SuspectsDatabase { + BladeRunnerEngine *_vm; + + Common::Array<SuspectDatabaseEntry*> _suspects; + +public: + SuspectsDatabase(BladeRunnerEngine *_vm, int size); + ~SuspectsDatabase(); + + SuspectDatabaseEntry *get(int suspectId); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/text_resource.cpp b/engines/bladerunner/text_resource.cpp new file mode 100644 index 0000000000..03460d039f --- /dev/null +++ b/engines/bladerunner/text_resource.cpp @@ -0,0 +1,101 @@ +/* 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/text_resource.h" + +#include "bladerunner/bladerunner.h" + +#include "common/debug.h" +#include "common/util.h" + +namespace BladeRunner { + +TextResource::TextResource(BladeRunnerEngine *vm) : _vm(vm) { + _count = 0; + _ids = nullptr; + _offsets = nullptr; + _strings = nullptr; +} + +TextResource::~TextResource() { + delete[] _ids; + delete[] _offsets; + delete[] _strings; +} + +bool TextResource::open(const char *name) { + assert(strlen(name) <= 8); + + char resName[13]; + sprintf(resName, "%s.TRE", name); + Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(resName)); + if (!s) + return false; + + _count = s->readUint32LE(); + + _ids = new uint32[_count]; + _offsets = new uint32[_count + 1]; + + for (uint32 i = 0; i != _count; ++i) { + _ids[i] = s->readUint32LE(); + } + + for (uint32 i = 0; i != _count + 1; ++i) { + _offsets[i] = s->readUint32LE(); + } + + uint32 stringsStart = s->pos() - 4; + + for (uint32 i = 0; i != _count + 1; ++i) { + _offsets[i] -= stringsStart; + } + + uint32 remain = s->size() - s->pos(); + _strings = new char[remain]; + + assert(remain >= _offsets[_count]); + + s->read(_strings, remain); + +#if 0 + debug("\n%s\n----------------", resName); + for (uint32 i = 0; i != (uint32)_count; ++i) { + debug("%3d: %s", i, getText(i)); + } +#endif + + return true; +} + +const char *TextResource::getText(uint32 id) { + for (uint32 i = 0; i != _count; ++i) { + if (_ids[i] == id) { + return _strings + _offsets[i]; + } + } + + return ""; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/text_resource.h b/engines/bladerunner/text_resource.h new file mode 100644 index 0000000000..9554267b9b --- /dev/null +++ b/engines/bladerunner/text_resource.h @@ -0,0 +1,51 @@ +/* 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_TEXT_RESOURCE_H +#define BLADERUNNER_TEXT_RESOURCE_H + +#include "common/scummsys.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class TextResource; + +class TextResource { + BladeRunnerEngine *_vm; + + uint32 _count; + uint32 *_ids; + uint32 *_offsets; + char *_strings; + +public: + TextResource(BladeRunnerEngine *vm); + ~TextResource(); + + bool open(const char *name); + const char *getText(uint32 id); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/vector.h b/engines/bladerunner/vector.h new file mode 100644 index 0000000000..d04070f7c5 --- /dev/null +++ b/engines/bladerunner/vector.h @@ -0,0 +1,148 @@ +/* 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_VECTOR_H +#define BLADERUNNER_VECTOR_H + +#include "common/types.h" + +namespace BladeRunner { + +class Vector2 { +public: + float x; + float y; + + Vector2() : x(0.0), y(0.0) {} + + Vector2(float ax, float ay) : x(ax), y(ay) {} +}; + +class Vector3 { +public: + float x; + float y; + float z; + + Vector3() : x(0.0), y(0.0), z(0.0) {} + + Vector3(float ax, float ay, float az) : x(ax), y(ay), z(az) {} + + float length() { return sqrtf(x * x + y * y + z * z); } + Vector3 normalize() { + float len = length(); + if (len == 0) { + return Vector3(0.0f, 0.0f, 0.0f); + } + return Vector3(x / len, y / len, z / len); + } + + static Vector3 cross(Vector3 a, Vector3 b) { + return Vector3( + a.y * b.z - a.z * b.y, + a.z * b.x - a.x * b.z, + a.x * b.y - a.y * b.x); + } +}; + +inline Vector3 operator+(Vector3 a, Vector3 b) { + return Vector3(a.x + b.x, a.y + b.y, a.z + b.z); +} + +inline Vector3 operator-(Vector3 a, Vector3 b) { + return Vector3(a.x - b.x, a.y - b.y, a.z - b.z); +} + +inline Vector3 operator*(float f, Vector3 v) { + return Vector3(f * v.x, f * v.y, f * v.z); +} + +class Vector4 { +public: + float x; + float y; + float z; + float w; + + Vector4() : x(0.0), y(0.0), z(0.0), w(0.0) {} + + Vector4(float ax, float ay, float az, float aw) : x(ax), y(ay), z(az), w(aw) {} +}; + +inline Vector4 operator+(Vector4 a, Vector4 b) { + return Vector4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); +} + +inline Vector4 operator-(Vector4 a, Vector4 b) { + return Vector4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); +} + +inline Vector4 operator*(float f, Vector4 v) { + return Vector4(f * v.x, f * v.y, f * v.z, f * v.w); +} + +inline Vector4 operator*(Vector4 v, float f) { + return Vector4(f * v.x, f * v.y, f * v.z, f * v.w); +} + +inline Vector4 operator/(Vector4 a, Vector4 b) { + return Vector4(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); +} + +inline int angle_1024(float x1, float z1, float x2, float z2) { + float angle_rad = atan2(x2 - x1, z1 - z2); + int a = int(512.0 * angle_rad / M_PI); + return (a + 1024) % 1024; +} + +inline int angle_1024(const Vector3 &v1, const Vector3 &v2) { + return angle_1024(v1.x, v1.z, v2.x, v2.z); +} + +inline float distance(float x1, float z1, float x2, float z2) { + float dx = x1 - x2; + float dz = z1 - z2; + float d = sqrt(dx * dx + dz * dz); + + float int_part = (int)d; + float frac_part = d - int_part; + + if (frac_part < 0.001) + frac_part = 0.0; + + return int_part + frac_part; +} + +inline float distance(const Vector3 &v1, const Vector3 &v2) { + return distance(v1.x, v1.z, v2.x, v2.z); +} + +inline float cos_1024(int angle1024) { + return cos(angle1024 * (M_PI / 512.0f)); +} + +inline float sin_1024(int angle1024) { + return sin(angle1024 * (M_PI / 512.0f)); +} +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/view.cpp b/engines/bladerunner/view.cpp new file mode 100644 index 0000000000..ab9eb3e2e6 --- /dev/null +++ b/engines/bladerunner/view.cpp @@ -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. + * + */ + +#include "bladerunner/view.h" + +#include "common/debug.h" +#include "common/stream.h" + +namespace BladeRunner { + +bool View::read(Common::ReadStream *stream) { + _frame = stream->readUint32LE(); + + float d[12]; + for (int i = 0; i != 12; ++i) + d[i] = stream->readFloatLE(); + + _frameViewMatrix = Matrix4x3(d); + + float fovX = stream->readFloatLE(); + + setFovX(fovX); + calculateSliceViewMatrix(); + calculateCameraPosition(); + + return true; +} + +void View::setFovX(float fovX) { + _fovX = fovX; + + _viewportHalfWidth = 320.0f; + _viewportHalfHeight = 240.0f; + + _viewportDistance = 320.0f / tanf(_fovX / 2.0f); +} + +void View::calculateSliceViewMatrix() { + Matrix4x3 m = _frameViewMatrix; + + m = m * rotationMatrixX(float(M_PI) / 2.0f); + + Matrix4x3 a(-1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f); + + m = a * m; + + _sliceViewMatrix = m; +} + +void View::calculateCameraPosition() { + Matrix4x3 invertedMatrix = invertMatrix(_sliceViewMatrix); + + _cameraPosition.x = invertedMatrix(0, 3); + _cameraPosition.y = invertedMatrix(1, 3); + _cameraPosition.z = invertedMatrix(2, 3); +} + +Vector3 View::calculateScreenPosition(Vector3 worldPosition) { + Vector3 viewPosition = _frameViewMatrix * worldPosition; + return Vector3( + this->_viewportHalfWidth - viewPosition.x / viewPosition.z * _viewportDistance, + this->_viewportHalfHeight - viewPosition.y / viewPosition.z * _viewportDistance, + viewPosition.z + ); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/view.h b/engines/bladerunner/view.h new file mode 100644 index 0000000000..eb68aa9eb6 --- /dev/null +++ b/engines/bladerunner/view.h @@ -0,0 +1,58 @@ +/* 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_VIEW_H +#define BLADERUNNER_VIEW_H + +#include "matrix.h" + +namespace Common { +class ReadStream; +} + +namespace BladeRunner { + +class View { +public: + float _fovX; + Matrix4x3 _frameViewMatrix; + Matrix4x3 _sliceViewMatrix; + uint32 _frame; + + Vector3 _cameraPosition; + + float _viewportHalfWidth; + float _viewportHalfHeight; + float _viewportDistance; + + bool read(Common::ReadStream *stream); + Vector3 calculateScreenPosition(Vector3 worldPosition); + +private: + void setFovX(float fovX); + void calculateSliceViewMatrix(); + void calculateCameraPosition(); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp new file mode 100644 index 0000000000..940f53ee25 --- /dev/null +++ b/engines/bladerunner/vqa_decoder.cpp @@ -0,0 +1,971 @@ +/* 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/vqa_decoder.h" + +#include "bladerunner/bladerunner.h" +#include "bladerunner/decompress_lcw.h" +#include "bladerunner/decompress_lzo.h" +#include "bladerunner/lights.h" +#include "bladerunner/view.h" + +#include "audio/decoders/raw.h" + +#include "common/array.h" +#include "common/util.h" +#include "common/memstream.h" + + + +namespace BladeRunner { + +#define kAESC 0x41455343 +#define kCBFZ 0x4342465A +#define kCIND 0x43494E44 +#define kCINF 0x43494E46 +#define kCINH 0x43494E48 +#define kCLIP 0x434C4950 +#define kFINF 0x46494E46 +#define kFORM 0x464f524d +#define kLIND 0x4C494E44 +#define kLINF 0x4C494E46 +#define kLINH 0x4C494E48 +#define kLITE 0x4C495445 +#define kLNID 0x4C4E4944 +#define kLNIH 0x4C4E4948 +#define kLNIN 0x4C4E494E +#define kLNIO 0x4C4E494F +#define kMFCD 0x4D464344 +#define kMFCH 0x4D464348 +#define kMFCI 0x4D464349 +#define kMFCT 0x4D464354 +#define kMSCH 0x4D534348 +#define kMSCI 0x4D534349 +#define kMSCT 0x4D534354 +#define kSN2J 0x534e324a +#define kSND2 0x534e4432 +#define kVIEW 0x56494557 +#define kVPTR 0x56505452 +#define kVQFL 0x5651464C +#define kVQFR 0x56514652 +#define kVQHD 0x56514844 +#define kWVQA 0x57565141 +#define kZBUF 0x5A425546 + +int32 remain(Common::SeekableReadStream *s) { + int32 pos = s->pos(); + if (pos == -1) return -1; + + int32 size = s->size(); + if (size == -1) return -1; + + return size - pos; +} + +struct IFFChunkHeader { + IFFChunkHeader() + : id(0), size(0) + {} + + uint32 id; + uint32 size; +}; + +static bool readIFFChunkHeader(Common::SeekableReadStream *s, IFFChunkHeader *ts) { + if (remain(s) < 8) + return false; + + ts->id = s->readUint32BE(); + ts->size = s->readUint32BE(); + + return true; +} + +static inline uint32 roundup(uint32 v) { + return (v + 1) & ~1u; +} + +const char *strTag(uint32 tag) { + static char s[5]; + + sprintf(s, "%c%c%c%c", + (tag >> 24) & 0xff, + (tag >> 16) & 0xff, + (tag >> 8) & 0xff, + (tag >> 0) & 0xff); + + return s; +} + +VQADecoder::VQADecoder() : _s(nullptr), + _frameInfo(nullptr), + _videoTrack(nullptr), + _audioTrack(nullptr), + _maxVIEWChunkSize(0), + _maxZBUFChunkSize(0), + _maxAESCChunkSize(0) { +} + +VQADecoder::~VQADecoder() { + delete _audioTrack; + delete _videoTrack; + delete[] _frameInfo; +} + +bool VQADecoder::loadStream(Common::SeekableReadStream *s) { + // close(); + _s = s; + + IFFChunkHeader chd; + uint32 type; + bool rc; + + readIFFChunkHeader(s, &chd); + if (chd.id != kFORM || !chd.size) + return false; + + type = s->readUint32BE(); + + if (type != kWVQA) + return false; + + do { + if (!readIFFChunkHeader(_s, &chd)) + return false; + + rc = false; + switch (chd.id) { + case kCINF: rc = readCINF(s, chd.size); break; + case kCLIP: rc = readCLIP(s, chd.size); break; + case kFINF: rc = readFINF(s, chd.size); break; + case kLINF: rc = readLINF(s, chd.size); break; + case kLNIN: rc = readLNIN(s, chd.size); break; + case kMFCI: rc = readMFCI(s, chd.size); break; + case kMSCI: rc = readMSCI(s, chd.size); break; + case kVQHD: rc = readVQHD(s, chd.size); break; + default: + warning("Unhandled chunk '%s'", strTag(chd.id)); + s->skip(roundup(chd.size)); + rc = true; + } + + if (!rc) { + warning("failed to handle chunk %s", strTag(chd.id)); + return false; + } + } while (chd.id != kFINF); + + _videoTrack = new VQAVideoTrack(this); + _audioTrack = new VQAAudioTrack(this); + +#if 0 + for (int i = 0; i != _loopInfo.loopCount; ++i) { + debug("LOOP %2d: %4d %4d %s", i, + _loopInfo.loops[i].begin, + _loopInfo.loops[i].end, + _loopInfo.loops[i].name.c_str()); + } +#endif + + return true; +} + +const Graphics::Surface *VQADecoder::decodeVideoFrame() { + return _videoTrack->decodeVideoFrame(); +} + +const uint16 *VQADecoder::decodeZBuffer() { + return _videoTrack->decodeZBuffer(); +} + +Audio::SeekableAudioStream *VQADecoder::decodeAudioFrame() { + return _audioTrack->decodeAudioFrame(); +} + +void VQADecoder::decodeView(View *view) { + _videoTrack->decodeView(view); +} + +void VQADecoder::decodeLights(Lights *lights) { + _videoTrack->decodeLights(lights); +} + +void VQADecoder::readNextPacket() { + IFFChunkHeader chd; + + if (remain(_s) < 8) { + warning("remain: %d", remain(_s)); + assert(remain(_s) < 8); + } + + do { + if (!readIFFChunkHeader(_s, &chd)) { + warning("Error reading chunk header"); + return; + } + + bool rc = false; + switch (chd.id) { + // Video track + case kAESC: rc = _videoTrack->readAESC(_s, chd.size); break; + case kLITE: rc = _videoTrack->readLITE(_s, chd.size); break; + case kVIEW: rc = _videoTrack->readVIEW(_s, chd.size); break; + case kVQFL: rc = _videoTrack->readVQFL(_s, chd.size); break; + case kVQFR: rc = _videoTrack->readVQFR(_s, chd.size); break; + case kZBUF: rc = _videoTrack->readZBUF(_s, chd.size); break; + // Sound track + case kSN2J: rc = _audioTrack->readSN2J(_s, chd.size); break; + case kSND2: rc = _audioTrack->readSND2(_s, chd.size); break; + + default: + _s->skip(roundup(chd.size)); + rc = false; + } + + if (!rc) { + warning("Error handling chunk %s", strTag(chd.id)); + return; + } + } while (chd.id != kVQFR); +} + +void VQADecoder::readPacket(int frame) { + if (frame < 0 || frame >= numFrames()) { + error("frame %d out of bounds, frame count is %d", frame, numFrames()); + } + + uint32 frameOffset = 2 * (_frameInfo[frame] & 0x0FFFFFFF); + _s->seek(frameOffset); + readNextPacket(); +} + +bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) { + if (size != 42) + return false; + + _header.version = s->readUint16LE(); + _header.flags = s->readUint16LE(); + _header.numFrames = s->readUint16LE(); + _header.width = s->readUint16LE(); + _header.height = s->readUint16LE(); + _header.blockW = s->readByte(); + _header.blockH = s->readByte(); + _header.frameRate = s->readByte(); + _header.cbParts = s->readByte(); + _header.colors = s->readUint16LE(); + _header.maxBlocks = s->readUint16LE(); + _header.offsetX = s->readUint16LE(); + _header.offsetY = s->readUint16LE(); + _header.maxVPTRSize = s->readUint16LE(); + _header.freq = s->readUint16LE(); + _header.channels = s->readByte(); + _header.bits = s->readByte(); + _header.unk3 = s->readUint32LE(); + _header.unk4 = s->readUint16LE(); + _header.maxCBFZSize = s->readUint32LE(); + _header.unk5 = s->readUint32LE(); + + if (_header.offsetX || _header.offsetY) { + debug("_header.offsetX, _header.offsetY: %d %d", _header.offsetX, _header.offsetY); + } + + // if (_header.unk3 || _header.unk4 != 4 || _header.unk5 || _header.flags != 0x0014) + if (false) { + debug("_header.version %d", _header.version); + debug("_header.flags %04x", _header.flags); + debug("_header.numFrames %d", _header.numFrames); + debug("_header.width %d", _header.width); + debug("_header.height %d", _header.height); + debug("_header.blockW %d", _header.blockW); + debug("_header.blockH %d", _header.blockH); + debug("_header.frameRate %d", _header.frameRate); + debug("_header.cbParts %d", _header.cbParts); + debug("_header.colors %d", _header.colors); + debug("_header.maxBlocks %d", _header.maxBlocks); + debug("_header.offsetX %d", _header.offsetX); + debug("_header.offsetY %d", _header.offsetY); + debug("_header.maxVPTRSize %d", _header.maxVPTRSize); + debug("_header.freq %d", _header.freq); + debug("_header.channels %d", _header.channels); + debug("_header.bits %d", _header.bits); + debug("_header.unk3 %d", _header.unk3); + debug("_header.unk4 %d", _header.unk4); + debug("_header.maxCBFZSize %d", _header.maxCBFZSize); + debug("_header.unk5 %d", _header.unk5); + debug("\n"); + } + + assert(_header.version == 2); + if (_header.channels != 0) { + assert(_header.freq == 22050); + assert(_header.channels == 1); + assert(_header.bits == 16); + } + assert(_header.colors == 0); + + return true; +} + +bool VQADecoder::VQAVideoTrack::readVQFR(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + + while (size >= 8) { + if (!readIFFChunkHeader(s, &chd)) + return false; + size -= roundup(chd.size) + 8; + + bool rc = false; + switch (chd.id) { + case kCBFZ: rc = readCBFZ(s, chd.size); break; + case kVPTR: rc = readVPTR(s, chd.size); break; + default: + s->skip(roundup(chd.size)); + } + + if (!rc) { + debug("VQFR: error handling chunk %s", strTag(chd.id)); + return false; + } + } + + return true; +} + +bool VQADecoder::readMSCI(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + readIFFChunkHeader(_s, &chd); + + if (chd.id != kMSCH) + return false; + + uint32 count, unk0; + count = s->readUint32LE(); + unk0 = s->readUint32LE(); + assert(unk0 == 0); + + readIFFChunkHeader(_s, &chd); + if (chd.id != kMSCT || chd.size != count * 0x10) + return false; + + for (uint32 i = 0; i < count; ++i) { + uint32 tag, max_size; + tag = s->readUint32BE(); + max_size = s->readUint32LE(); + + switch (tag) { + case kVIEW: + _maxVIEWChunkSize = max_size; + break; + case kZBUF: + _maxZBUFChunkSize = max_size; + break; + case kAESC: + _maxAESCChunkSize = max_size; + break; + default: + warning("Unknown tag in MSCT: %s", strTag(tag)); + } + + uint32 zero; + zero = s->readUint32LE(); assert(zero == 0); + zero = s->readUint32LE(); assert(zero == 0); + } + + return true; +} + +bool VQADecoder::readLINF(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + readIFFChunkHeader(_s, &chd); + + if (chd.id != kLINH || chd.size != 6) + return false; + + _loopInfo.loopCount = s->readUint16LE(); + _loopInfo.flags = s->readUint32LE(); + + if ((_loopInfo.flags & 3) == 0) + return false; + + readIFFChunkHeader(_s, &chd); + if (chd.id != kLIND || chd.size != 4u * _loopInfo.loopCount) + return false; + + _loopInfo.loops = new Loop[_loopInfo.loopCount]; + for (int i = 0; i != _loopInfo.loopCount; ++i) { + _loopInfo.loops[i].begin = s->readUint16LE(); + _loopInfo.loops[i].end = s->readUint16LE(); + + // debug("Loop %d: %04x %04x", i, _loopInfo.loops[i].begin, _loopInfo.loops[i].end); + } + + return true; +} + +bool VQADecoder::readCINF(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + + readIFFChunkHeader(_s, &chd); + if (chd.id != kCINH || chd.size != 8u) + return false; + + _clipInfo.clipCount = s->readUint16LE(); + s->skip(6); + + readIFFChunkHeader(_s, &chd); + if (chd.id != kCIND || chd.size != 6u * _clipInfo.clipCount) + return false; + + for (int i = 0; i != _clipInfo.clipCount; ++i) { + uint16 a; + uint32 b; + a = s->readUint16LE(); + b = s->readUint32LE(); + } + + return true; +} + +bool VQADecoder::readFINF(Common::SeekableReadStream *s, uint32 size) { + if (size != 4u * _header.numFrames) + return false; + + _frameInfo = new uint32[_header.numFrames]; + + for (uint32 i = 0; i != _header.numFrames; ++i) + _frameInfo[i] = s->readUint32LE(); + + if (false) { + uint32 last = 0; + for (uint32 i = 0; i != _header.numFrames; ++i) { + uint32 diff = _frameInfo[i] - last; + debug("_frameInfo[%4d] = 0x%08x - %08x", i, _frameInfo[i], diff); + last = _frameInfo[i]; + } + } + + return true; +} + +bool VQADecoder::readLNIN(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + + readIFFChunkHeader(_s, &chd); + if (chd.id != kLNIH || chd.size != 10) + return false; + + uint16 loopNamesCount, loopUnk1, loopUnk2, loopUnk3, loopUnk4; + + loopNamesCount = s->readUint16LE(); + loopUnk1 = s->readUint16LE(); + loopUnk2 = s->readUint16LE(); + loopUnk3 = s->readUint16LE(); + loopUnk4 = s->readUint16LE(); + + if (loopNamesCount != _loopInfo.loopCount) + return false; + + readIFFChunkHeader(_s, &chd); + if (chd.id != kLNIO || chd.size != 4u * loopNamesCount) + return false; + + uint32 *loopNameOffsets = (uint32*)alloca(loopNamesCount * sizeof(uint32)); + for (int i = 0; i != loopNamesCount; ++i) { + loopNameOffsets[i] = s->readUint32LE(); + } + + readIFFChunkHeader(_s, &chd); + if (chd.id != kLNID) + return false; + + char *names = (char*)alloca(roundup(chd.size)); + s->read(names, roundup(chd.size)); + + for (int i = 0; i != loopNamesCount; ++i) { + char *begin = names + loopNameOffsets[i]; + uint32 len = ((i == loopNamesCount - 1) ? chd.size : loopNameOffsets[i+1]) - loopNameOffsets[i]; + + _loopInfo.loops[i].name = Common::String(begin, len); + + // debug("%2d: %s", i, _loopInfo.loops[i].name.c_str()); + } + + return true; +} + +bool VQADecoder::getLoopBeginAndEndFrame(int loop, int *begin, int *end) { + assert(begin && end); + + if (loop < 0 || loop >= _loopInfo.loopCount) + return false; + + *begin = _loopInfo.loops[loop].begin; + *end = _loopInfo.loops[loop].end; + + return true; +} + +bool VQADecoder::readCLIP(Common::SeekableReadStream *s, uint32 size) { + s->skip(roundup(size)); + return true; +} + +bool VQADecoder::readMFCI(Common::SeekableReadStream *s, uint32 size) { + s->skip(roundup(size)); + return true; +} + +VQADecoder::VQAVideoTrack::VQAVideoTrack(VQADecoder *vqaDecoder) { + VQADecoder::Header *header = &vqaDecoder->_header; + + _surface = nullptr; + _hasNewFrame = false; + + _numFrames = header->numFrames; + _width = header->width; + _height = header->height; + _blockW = header->blockW; + _blockH = header->blockH; + _frameRate = header->frameRate; + _maxBlocks = header->maxBlocks; + _offsetX = header->offsetX; + _offsetY = header->offsetY; + + _maxVPTRSize = header->maxVPTRSize; + _maxCBFZSize = header->maxCBFZSize; + _maxZBUFChunkSize = vqaDecoder->_maxZBUFChunkSize; + _zbuffer = nullptr; + + _codebookSize = 0; + _codebook = nullptr; + _cbfz = nullptr; + _zbufChunk = nullptr; + + _vpointerSize = 0; + _vpointer = nullptr; + + _curFrame = -1; + + + _zbufChunk = new uint8[roundup(_maxZBUFChunkSize)]; + + _surface = new Graphics::Surface(); + _surface->create(_width, _height, createRGB555()); + + _viewData = nullptr; + _lightsData = nullptr; +} + +VQADecoder::VQAVideoTrack::~VQAVideoTrack() { + delete[] _codebook; + delete[] _cbfz; + delete[] _zbufChunk; + delete[] _vpointer; + + if (_surface) + _surface->free(); + delete _surface; + delete[] _zbuffer; + + if (_viewData) + delete[] _viewData; + if (_lightsData) + delete[] _lightsData; +} + +uint16 VQADecoder::VQAVideoTrack::getWidth() const { + return _width; +} + +uint16 VQADecoder::VQAVideoTrack::getHeight() const { + return _height; +} + +Graphics::PixelFormat VQADecoder::VQAVideoTrack::getPixelFormat() const { + return _surface->format; +} + +int VQADecoder::VQAVideoTrack::getCurFrame() const { + return _curFrame; +} + +int VQADecoder::VQAVideoTrack::getFrameCount() const { + return _numFrames; +} + +Common::Rational VQADecoder::VQAVideoTrack::getFrameRate() const { + return _frameRate; +} + +const Graphics::Surface *VQADecoder::VQAVideoTrack::decodeVideoFrame() { + if (_hasNewFrame) { + decodeFrame((uint16*)_surface->getPixels()); + _curFrame++; + _hasNewFrame = false; + } + return _surface; +} + +bool VQADecoder::VQAVideoTrack::readVQFL(Common::SeekableReadStream *s, uint32 size) { + IFFChunkHeader chd; + + while (size >= 8) { + if (!readIFFChunkHeader(s, &chd)) + return false; + size -= roundup(chd.size) + 8; + + bool rc = false; + switch (chd.id) { + case kCBFZ: rc = readCBFZ(s, chd.size); break; + default: + s->skip(roundup(chd.size)); + } + + if (!rc) { + warning("VQFL: error handling chunk %s", strTag(chd.id)); + return false; + } + } + + return true; +} + +bool VQADecoder::VQAVideoTrack::readCBFZ(Common::SeekableReadStream *s, uint32 size) { + if (size > _maxCBFZSize) { + warning("readCBFZ: chunk too large: %d > %d", size, _maxCBFZSize); + return false; + } + + if (!_codebook) { + _codebookSize = 2 * _maxBlocks * _blockW * _blockH; + _codebook = new uint8[_codebookSize]; + } + if (!_cbfz) + _cbfz = new uint8[roundup(_maxCBFZSize)]; + + s->read(_cbfz, roundup(size)); + + decompress_lcw(_cbfz, size, _codebook, _codebookSize); + + return true; +} + +static int decodeZBUF_partial(uint8 *src, uint16 *curZBUF, uint32 srcLen) { + uint32 dstSize = 640 * 480; // This is taken from global variables? + uint32 dstRemain = dstSize; + + uint16 *curzp = curZBUF; + uint16 *inp = (uint16*)src; + + while (dstRemain && (inp - (uint16*)src) < (std::ptrdiff_t)srcLen) { + uint32 count = FROM_LE_16(*inp++); + + if (count & 0x8000) { + count = MIN(count & 0x7fff, dstRemain); + dstRemain -= count; + + while (count--) { + uint16 value = FROM_LE_16(*inp++); + if (value) + *curzp = value; + ++curzp; + } + } else { + count = MIN(count, dstRemain); + dstRemain -= count; + uint16 value = FROM_LE_16(*inp++); + + if (!value) { + curzp += count; + } else { + while (count--) + *curzp++ = value; + } + } + } + return dstSize - dstRemain; +} + +bool VQADecoder::VQAVideoTrack::readZBUF(Common::SeekableReadStream *s, uint32 size) { + if (size > _maxZBUFChunkSize) { + debug("VQA ERROR: ZBUF chunk size: %08x > %08x", size, _maxZBUFChunkSize); + s->skip(roundup(size)); + return false; + } + + uint32 width, height, complete, unk0; + width = s->readUint32LE(); + height = s->readUint32LE(); + complete = s->readUint32LE(); + unk0 = s->readUint32LE(); + + uint32 remain = size - 16; + + if (_width != width || _height != height) { + debug("%d, %d, %d, %d", width, height, complete, unk0); + s->skip(roundup(remain)); + return false; + } + + _zbufChunkComplete = complete; + _zbufChunkSize = remain; + s->read(_zbufChunk, roundup(remain)); + + return true; +} + +const uint16 *VQADecoder::VQAVideoTrack::decodeZBuffer() { + if (_maxZBUFChunkSize == 0) + return nullptr; + + if (!_zbuffer) + _zbuffer = new uint16[_width * _height]; + + if (_zbufChunkComplete) { + size_t zbufOutSize; + decompress_lzo1x(_zbufChunk, _zbufChunkSize, (uint8*)_zbuffer, &zbufOutSize); + } else { + decodeZBUF_partial(_zbufChunk, _zbuffer, _zbufChunkSize); + } + + return _zbuffer; +} + +bool VQADecoder::VQAVideoTrack::readVIEW(Common::SeekableReadStream *s, uint32 size) { + if (size != 56) + return false; + + if (_viewData) { + delete[] _viewData; + _viewData = nullptr; + } + + _viewDataSize = size; + _viewData = new uint8[_viewDataSize]; + s->read(_viewData, _viewDataSize); + + return true; +} + +void VQADecoder::VQAVideoTrack::decodeView(View *view) { + if (!view || !_viewData) + return; + + Common::MemoryReadStream s(_viewData, _viewDataSize); + view->read(&s); + + delete[] _viewData; + _viewData = nullptr; +} + +bool VQADecoder::VQAVideoTrack::readAESC(Common::SeekableReadStream *s, uint32 size) { + debug("VQADecoder::readAESC(%d)", size); + + s->skip(roundup(size)); + return true; +} + +bool VQADecoder::VQAVideoTrack::readLITE(Common::SeekableReadStream *s, uint32 size) { + if (_lightsData) { + delete[] _lightsData; + _lightsData = nullptr; + } + + _lightsDataSize = size; + _lightsData = new uint8[_lightsDataSize]; + s->read(_lightsData, _lightsDataSize); + + return true; +} + + +void VQADecoder::VQAVideoTrack::decodeLights(Lights *lights) { + if (!lights || !_lightsData) + return; + + Common::MemoryReadStream s(_lightsData, _lightsDataSize); + lights->readVqa(&s); + + delete[] _lightsData; + _lightsData = nullptr; +} + + +bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 size) { + if (size > _maxVPTRSize) + return false; + + if (!_vpointer) + _vpointer = new uint8[roundup(_maxVPTRSize)]; + + _vpointerSize = size; + s->read(_vpointer, roundup(size)); + + _hasNewFrame = true; + + return true; +} + +void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha) { + uint16 frame_width = _width; + uint32 frame_stride = 640; + uint16 block_width = _blockW; + uint16 block_height = _blockH; + + const uint8 *const block_src = + &_codebook[2 * srcBlock * block_width * block_height]; + + int blocks_per_line = frame_width / block_width; + + do { + uint32 frame_x = dstBlock % blocks_per_line * block_width + _offsetX / 2; + uint32 frame_y = dstBlock / blocks_per_line * block_height + _offsetY; + + uint32 dst_offset = frame_x + frame_y * frame_stride; + + const uint8 *__restrict src = block_src; + uint16 *__restrict dst = frame + dst_offset; + + unsigned int block_y; + for (block_y = 0; block_y != block_height; ++block_y) { + unsigned int block_x; + for (block_x = 0; block_x != block_width; ++block_x) { + uint16 rgb555 = src[0] | (src[1] << 8); + src += 2; + + if (!(alpha && (rgb555 & 0x8000))) + *dst = rgb555; + ++dst; + } + dst += frame_stride - block_width; + } + + ++dstBlock; + } while (--count); +} + +bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) { + if (!_codebook || !_vpointer) + return false; + + uint8 *src = _vpointer; + uint8 *end = _vpointer + _vpointerSize; + + uint16 count, srcBlock, dstBlock = 0; + (void)srcBlock; + + while (end - src >= 2) { + uint16 command = src[0] | (src[1] << 8); + uint8 prefix = command >> 13; + src += 2; + + switch (prefix) { + case 0: + count = command & 0x1fff; + dstBlock += count; + break; + case 1: + count = 2 * (((command >> 8) & 0x1f) + 1); + srcBlock = command & 0x00ff; + + VPTRWriteBlock(frame, dstBlock, srcBlock, count); + dstBlock += count; + break; + case 2: + count = 2 * (((command >> 8) & 0x1f) + 1); + srcBlock = command & 0x00ff; + + VPTRWriteBlock(frame, dstBlock, srcBlock, 1); + ++dstBlock; + + for (int i = 0; i < count; ++i) { + srcBlock = *src++; + VPTRWriteBlock(frame, dstBlock, srcBlock, 1); + ++dstBlock; + } + break; + case 3: + case 4: + count = 1; + srcBlock = command & 0x1fff; + + VPTRWriteBlock(frame, dstBlock, srcBlock, count, prefix == 4); + ++dstBlock; + break; + case 5: + case 6: + count = *src++; + srcBlock = command & 0x1fff; + + VPTRWriteBlock(frame, dstBlock, srcBlock, count, prefix == 6); + dstBlock += count; + break; + default: + warning("VQAVideoTrack::decodeFrame: Undefined case %d", command >> 13); + } + } + + return true; +} + +VQADecoder::VQAAudioTrack::VQAAudioTrack(VQADecoder *vqaDecoder) { + _frequency = vqaDecoder->_header.freq; +} + +VQADecoder::VQAAudioTrack::~VQAAudioTrack() { +} + +Audio::SeekableAudioStream *VQADecoder::VQAAudioTrack::decodeAudioFrame() { + int16 *audioFrame = (int16*)malloc(4 * 735); + memset(audioFrame, 0, 4 * 735); + + _adpcmDecoder.decode(_compressedAudioFrame, 735, audioFrame); + + uint flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; + + return Audio::makeRawStream((byte*)audioFrame, 4 * 735, _frequency, flags, DisposeAfterUse::YES); +} + +bool VQADecoder::VQAAudioTrack::readSND2(Common::SeekableReadStream *s, uint32 size) { + if (size != 735) { + warning("audio frame size: %d", size); + return false; + } + + s->read(_compressedAudioFrame, roundup(size)); + + return true; +} + +bool VQADecoder::VQAAudioTrack::readSN2J(Common::SeekableReadStream *s, uint32 size) { + if (size != 6) + return false; + + uint16 stepIndex = s->readUint16LE(); + uint32 predictor = s->readUint32LE(); + + _adpcmDecoder.setParameters(stepIndex >> 5, predictor); + + return true; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/vqa_decoder.h b/engines/bladerunner/vqa_decoder.h new file mode 100644 index 0000000000..7863afaff0 --- /dev/null +++ b/engines/bladerunner/vqa_decoder.h @@ -0,0 +1,238 @@ +/* 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_VQA_DECODER_H +#define BLADERUNNER_VQA_DECODER_H + +#include "bladerunner/adpcm_decoder.h" + +#include "audio/audiostream.h" + +#include "common/debug.h" +#include "common/str.h" +#include "common/stream.h" +#include "common/types.h" + +#include "graphics/surface.h" + +#include "video/video_decoder.h" + +namespace BladeRunner { + +class Lights; +class View; + +class VQADecoder { +public: + VQADecoder(); + ~VQADecoder(); + + bool loadStream(Common::SeekableReadStream *s); + + void readNextPacket(); + void readPacket(int frame); + + const Graphics::Surface *decodeVideoFrame(); + const uint16 *decodeZBuffer(); + Audio::SeekableAudioStream *decodeAudioFrame(); + void decodeView(View *view); + void decodeLights(Lights *lights); + + uint16 numFrames() const { return _header.numFrames; } + uint8 frameRate() const { return _header.frameRate; } + + uint16 offsetX() const { return _header.offsetX; } + uint16 offsetY() const { return _header.offsetY; } + + bool hasAudio() const { return _header.channels != 0; } + uint16 frequency() const { return _header.freq; } + + bool getLoopBeginAndEndFrame(int loop, int *begin, int *end); + +protected: + +private: + struct Header { + uint16 version; // 0x00 + uint16 flags; // 0x02 + uint16 numFrames; // 0x04 + uint16 width; // 0x06 + uint16 height; // 0x08 + uint8 blockW; // 0x0A + uint8 blockH; // 0x0B + uint8 frameRate; // 0x0C + uint8 cbParts; // 0x0D + uint16 colors; // 0x0E + uint16 maxBlocks; // 0x10 + uint16 offsetX; // 0x12 + uint16 offsetY; // 0x14 + uint16 maxVPTRSize; // 0x16 + uint16 freq; // 0x18 + uint8 channels; // 0x1A + uint8 bits; // 0x1B + uint32 unk3; // 0x1C + uint16 unk4; // 0x20 + uint32 maxCBFZSize; // 0x22 + uint32 unk5; // 0x26 + // 0x2A + }; + + struct Loop { + uint16 begin; + uint16 end; + Common::String name; + + Loop() : + begin(0), + end(0) + {} + }; + + struct LoopInfo { + uint16 loopCount; + uint32 flags; + Loop *loops; + + LoopInfo() : loopCount(0), loops(nullptr) {} + ~LoopInfo() { + delete[] loops; + } + }; + + struct ClipInfo { + uint16 clipCount; + }; + + class VQAVideoTrack; + class VQAAudioTrack; + + Common::SeekableReadStream *_s; + + Header _header; + LoopInfo _loopInfo; + ClipInfo _clipInfo; + + uint32 *_frameInfo; + + uint32 _maxVIEWChunkSize; + uint32 _maxZBUFChunkSize; + uint32 _maxAESCChunkSize; + + VQAVideoTrack *_videoTrack; + VQAAudioTrack *_audioTrack; + + bool readVQHD(Common::SeekableReadStream *s, uint32 size); + bool readMSCI(Common::SeekableReadStream *s, uint32 size); + bool readMFCI(Common::SeekableReadStream *s, uint32 size); + bool readLINF(Common::SeekableReadStream *s, uint32 size); + bool readCINF(Common::SeekableReadStream *s, uint32 size); + bool readFINF(Common::SeekableReadStream *s, uint32 size); + bool readLNIN(Common::SeekableReadStream *s, uint32 size); + bool readCLIP(Common::SeekableReadStream *s, uint32 size); + + class VQAVideoTrack { + public: + VQAVideoTrack(VQADecoder *vqaDecoder); + ~VQAVideoTrack(); + + uint16 getWidth() const; + uint16 getHeight() const; + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const; + int getFrameCount() const; + const Graphics::Surface *decodeVideoFrame(); + const uint16 *decodeZBuffer(); + void decodeView(View *view); + void decodeLights(Lights *lights); + + bool readVQFR(Common::SeekableReadStream *s, uint32 size); + bool readVPTR(Common::SeekableReadStream *s, uint32 size); + bool readVQFL(Common::SeekableReadStream *s, uint32 size); + bool readCBFZ(Common::SeekableReadStream *s, uint32 size); + bool readZBUF(Common::SeekableReadStream *s, uint32 size); + bool readVIEW(Common::SeekableReadStream *s, uint32 size); + bool readAESC(Common::SeekableReadStream *s, uint32 size); + bool readLITE(Common::SeekableReadStream *s, uint32 size); + + protected: + Common::Rational getFrameRate() const; + + bool useAudioSync() const { return false; } + + private: + Graphics::Surface *_surface; + uint16 *_zbuffer; + bool _hasNewFrame; + + uint16 _numFrames; + uint16 _width, _height; + uint8 _blockW, _blockH; + uint8 _frameRate; + uint16 _maxBlocks; + uint16 _offsetX, _offsetY; + + uint16 _maxVPTRSize; + uint32 _maxCBFZSize; + uint32 _maxZBUFChunkSize; + + uint32 _codebookSize; + uint8 *_codebook; + uint8 *_cbfz; + bool _zbufChunkComplete; + uint32 _zbufChunkSize; + uint8 *_zbufChunk; + + uint32 _vpointerSize; + uint8 *_vpointer; + + int _curFrame; + + uint8 *_viewData; + uint32 _viewDataSize; + uint8 *_lightsData; + uint32 _lightsDataSize; + + void VPTRWriteBlock(uint16 *frame, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha = false); + bool decodeFrame(uint16 *frame); + }; + + class VQAAudioTrack { + public: + VQAAudioTrack(VQADecoder *vqaDecoder); + ~VQAAudioTrack(); + + bool readSND2(Common::SeekableReadStream *s, uint32 size); + bool readSN2J(Common::SeekableReadStream *s, uint32 size); + + Audio::SeekableAudioStream *decodeAudioFrame(); + protected: + + private: + uint16 _frequency; + ADPCMWestwoodDecoder _adpcmDecoder; + uint8 _compressedAudioFrame[735]; + }; +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp new file mode 100644 index 0000000000..f875b84cce --- /dev/null +++ b/engines/bladerunner/vqa_player.cpp @@ -0,0 +1,178 @@ +/* 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/vqa_player.h" + +#include "bladerunner/bladerunner.h" + +#include "audio/decoders/raw.h" + +#include "common/system.h" + +namespace BladeRunner { + +bool VQAPlayer::open(const Common::String &name) { + _s = _vm->getResourceStream(name); + if (!_s) + return false; + + if(!_decoder.loadStream(_s)) { + delete _s; + _s = nullptr; + return false; + } + + _hasAudio = _decoder.hasAudio(); + if (_hasAudio) + _audioStream = Audio::makeQueuingAudioStream(_decoder.frequency(), false); + + return true; +} + +void VQAPlayer::close() { + _vm->_mixer->stopHandle(_soundHandle); + delete _s; + _s = nullptr; +} + +int VQAPlayer::update() { + uint32 now = 60 * _vm->_system->getMillis(); + + if (_curFrame == -1) { + _curFrame = 0; + if (_curFrame >= 0) { + _decoder.readPacket(_curFrame); + if (_hasAudio) + queueAudioFrame(_decoder.decodeAudioFrame()); + _surface = _decoder.decodeVideoFrame(); + _zBuffer = _decoder.decodeZBuffer(); + } + + _decodedFrame = calcNextFrame(_curFrame); + if (_decodedFrame >= 0) { + _decoder.readPacket(_decodedFrame); + if (_hasAudio) + queueAudioFrame(_decoder.decodeAudioFrame()); + } + + if (_hasAudio) { + _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, _audioStream); + _audioStarted = true; + } + + _nextFrameTime = now + 60000 / 15; + return _curFrame; + } + + if (now >= _nextFrameTime) { + _curFrame = _decodedFrame; + if (_curFrame >= 0) { + _surface = _decoder.decodeVideoFrame(); + _zBuffer = _decoder.decodeZBuffer(); + } + + _decodedFrame = calcNextFrame(_curFrame); + if (_decodedFrame >= 0) { + _decoder.readPacket(_decodedFrame); + if (_hasAudio) + queueAudioFrame(_decoder.decodeAudioFrame()); + } + + _nextFrameTime += 60000 / 15; + return _curFrame; + } + + _surface = nullptr; + return -1; +} + +const Graphics::Surface *VQAPlayer::getSurface() const { + return _surface; +} + +const uint16 *VQAPlayer::getZBuffer() const { + return _zBuffer; +} + +void VQAPlayer::updateView(View *view) { + _decoder.decodeView(view); +} + +void VQAPlayer::updateLights(Lights *lights) { + _decoder.decodeLights(lights); +} + +bool VQAPlayer::setLoop(int loop) { + int begin, end; + if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) { + return false; + } + + _curLoop = loop; + _loopBegin = begin; + _loopEnd = end; + + // warning("\t\t\tActive Loop: %d - %d\n", begin, end); + + return true; +} + +int VQAPlayer::getLoopBeginFrame(int loop) { + int begin, end; + if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) { + return -1; + } + return begin; +} + +int VQAPlayer::getLoopEndFrame(int loop) { + int begin, end; + if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) { + return -1; + } + return end; +} + +int VQAPlayer::calcNextFrame(int frame) const { + if (frame < 0) + return -3; + + if (_curLoop != -1 && frame >= _loopEnd) { + frame = _loopBegin; + } else { + frame++; + } + + if (frame == _decoder.numFrames()) + frame = -3; + + return frame; +} + +void VQAPlayer::queueAudioFrame(Audio::AudioStream *audioStream) { + int n = _audioStream->numQueuedStreams(); + if (n == 0) + warning("numQueuedStreams: %d", n); + _audioStream->queueAudioStream(audioStream, DisposeAfterUse::YES); +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h new file mode 100644 index 0000000000..f5769944cf --- /dev/null +++ b/engines/bladerunner/vqa_player.h @@ -0,0 +1,102 @@ +/* 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_VQA_PLAYER_H +#define BLADERUNNER_VQA_PLAYER_H + +#include "bladerunner/vqa_decoder.h" + +#include "audio/audiostream.h" +#include "audio/mixer.h" + +#include "graphics/surface.h" + +namespace BladeRunner { + +class BladeRunnerEngine; +class View; +class Lights; + +class VQAPlayer { + BladeRunnerEngine *_vm; + Common::SeekableReadStream *_s; + VQADecoder _decoder; + const Graphics::Surface *_surface; + const uint16 *_zBuffer; + Audio::QueuingAudioStream *_audioStream; + + int _curFrame; + int _decodedFrame; + int _curLoop; + int _loopBegin; + int _loopEnd; + + uint32 _nextFrameTime; + bool _hasAudio; + bool _audioStarted; + Audio::SoundHandle _soundHandle; + +public: + + VQAPlayer(BladeRunnerEngine *vm) + : _vm(vm), + _s(nullptr), + _surface(nullptr), + _audioStream(nullptr), + _curFrame(-1), + _decodedFrame(-1), + _curLoop(-1), + _loopBegin(-1), + _loopEnd(-1), + _nextFrameTime(0), + _hasAudio(false), + _audioStarted(false) { + } + + ~VQAPlayer() { + close(); + } + + bool open(const Common::String &name); + void close(); + + int update(); + const Graphics::Surface *getSurface() const; + const uint16 *getZBuffer() const; + void updateView(View *view); + void updateLights(Lights *lights); + + bool setLoop(int loop); + // void setLoopSpecial(int loop, bool wait); + // void setLoopDefault(int loop); + + int getLoopBeginFrame(int loop); + int getLoopEndFrame(int loop); + +private: + int calcNextFrame(int frame) const; + void queueAudioFrame(Audio::AudioStream *audioStream); +}; + +} // End of namespace BladeRunner + +#endif diff --git a/engines/bladerunner/waypoints.cpp b/engines/bladerunner/waypoints.cpp new file mode 100644 index 0000000000..bd78693328 --- /dev/null +++ b/engines/bladerunner/waypoints.cpp @@ -0,0 +1,90 @@ +/* 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/waypoints.h" +namespace BladeRunner { + +Waypoints::Waypoints(BladeRunnerEngine *vm, int count) { + _vm = vm; + _count = count; + _waypoints = new Waypoint[count]; +} + +Waypoints::~Waypoints() { +} + +void Waypoints::getXYZ(int waypointId, float *x, float *y, float *z) { + *x = 0; + *y = 0; + *z = 0; + + if (waypointId < 0 || waypointId >= _count || !_waypoints[waypointId]._present) + return; + + *x = _waypoints[waypointId]._position.x; + *y = _waypoints[waypointId]._position.y; + *z = _waypoints[waypointId]._position.z; +} + +int Waypoints::getSetId(int waypointId) { + if (waypointId < 0 || waypointId >= _count || !_waypoints[waypointId]._present) + return -1; + return _waypoints[waypointId]._setId; +} + +bool Waypoints::set(int waypointId, int setId, Vector3 position) { + if (waypointId < 0 || waypointId >= _count) + return false; + + _waypoints[waypointId]._setId = setId; + _waypoints[waypointId]._position = position; + _waypoints[waypointId]._present = true; + + return true; +} + +bool Waypoints::reset(int waypointId) { + if (waypointId < 0 || waypointId >= _count) + return false; + + _waypoints[waypointId]._setId = -1; + _waypoints[waypointId]._position.x = 0; + _waypoints[waypointId]._position.y = 0; + _waypoints[waypointId]._position.z = 0; + _waypoints[waypointId]._present = false; + + return true; +} + +float Waypoints::getX(int waypointId) { + return _waypoints[waypointId]._position.x; +} + +float Waypoints::getY(int waypointId) { + return _waypoints[waypointId]._position.y; +} + +float Waypoints::getZ(int waypointId) { + return _waypoints[waypointId]._position.z; +} + +} // End of namespace BladeRunner diff --git a/engines/bladerunner/waypoints.h b/engines/bladerunner/waypoints.h new file mode 100644 index 0000000000..c75cf00098 --- /dev/null +++ b/engines/bladerunner/waypoints.h @@ -0,0 +1,62 @@ +/* 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_WAYPOINTS_H +#define BLADERUNNER_WAYPOINTS_H + +#include "bladerunner/bladerunner.h" +#include "bladerunner/vector.h" + +#include "common/array.h" + +namespace BladeRunner { + +struct Waypoint { + int _setId; + Vector3 _position; + bool _present; +}; + +class Waypoints { + BladeRunnerEngine *_vm; + +private: + int _count; + Waypoint *_waypoints; + +public: + Waypoints(BladeRunnerEngine *vm, int count); + ~Waypoints(); + + void getXYZ(int waypointId, float *x, float *y, float *z); + float getX(int waypointId); + float getY(int waypointId); + float getZ(int waypointId); + int getSetId(int waypointId); + + bool set(int waypointId, int setId, Vector3 position); + bool reset(int waypointId); +}; + +} // End of namespace BladeRunner + +#endif |