From 281c19ab036f387a99192594aa645e696009f40b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 3 Oct 2016 12:38:43 +0200 Subject: BLADERUNNER: Code formatting fixes --- engines/bladerunner/actor.cpp | 5 +- engines/bladerunner/actor.h | 4 +- engines/bladerunner/actor_clues.cpp | 51 ++--- engines/bladerunner/actor_clues.h | 6 +- engines/bladerunner/actor_combat.cpp | 2 +- engines/bladerunner/actor_combat.h | 3 +- engines/bladerunner/actor_walk.cpp | 69 +++---- engines/bladerunner/actor_walk.h | 6 +- engines/bladerunner/adpcm_decoder.cpp | 12 +- engines/bladerunner/adpcm_decoder.h | 7 +- engines/bladerunner/ambient_sounds.cpp | 20 +- engines/bladerunner/archive.cpp | 3 +- engines/bladerunner/aud_stream.cpp | 10 +- engines/bladerunner/audio_player.cpp | 13 +- engines/bladerunner/audio_player.h | 8 +- engines/bladerunner/audio_speech.cpp | 4 +- engines/bladerunner/bladerunner.cpp | 35 ++-- engines/bladerunner/boundingbox.h | 2 +- engines/bladerunner/chapters.h | 4 +- engines/bladerunner/clues.cpp | 4 +- engines/bladerunner/decompress_lcw.cpp | 64 ++----- engines/bladerunner/decompress_lzo.cpp | 23 +-- engines/bladerunner/fog.h | 12 +- engines/bladerunner/gameflags.cpp | 3 +- engines/bladerunner/gameinfo.cpp | 9 +- engines/bladerunner/image.cpp | 3 +- engines/bladerunner/image.h | 1 + engines/bladerunner/item.cpp | 1 + engines/bladerunner/light.h | 3 +- engines/bladerunner/matrix.cpp | 42 ++-- engines/bladerunner/matrix.h | 29 +-- engines/bladerunner/mouse.cpp | 13 +- engines/bladerunner/movement_track.cpp | 43 ++--- engines/bladerunner/movement_track.h | 3 +- engines/bladerunner/outtake.h | 4 +- engines/bladerunner/regions.h | 6 +- engines/bladerunner/scene_objects.h | 6 +- .../bladerunner/script/aiscript_officer_leroy.cpp | 31 ++- engines/bladerunner/script/ar02.cpp | 2 - engines/bladerunner/script/bb03.cpp | 2 - engines/bladerunner/script/bb04.cpp | 2 - engines/bladerunner/script/bb05.cpp | 2 - engines/bladerunner/script/bb06.cpp | 1 - engines/bladerunner/script/bb07.cpp | 2 - engines/bladerunner/script/bb08.cpp | 2 - engines/bladerunner/script/ct03.cpp | 1 - engines/bladerunner/script/dr06.cpp | 1 - engines/bladerunner/script/hf02.cpp | 1 - engines/bladerunner/script/init.h | 4 +- engines/bladerunner/script/ps15.cpp | 2 - engines/bladerunner/script/script.cpp | 22 +-- engines/bladerunner/script/script.h | 25 +-- engines/bladerunner/script/ug03.cpp | 1 - engines/bladerunner/script/ug15.cpp | 1 - engines/bladerunner/script/ug18.cpp | 2 - engines/bladerunner/set_effects.h | 5 +- engines/bladerunner/settings.cpp | 4 +- engines/bladerunner/shape.cpp | 5 +- engines/bladerunner/slice_animations.h | 15 +- engines/bladerunner/slice_renderer.cpp | 22 +-- engines/bladerunner/slice_renderer.h | 5 +- engines/bladerunner/text_resource.cpp | 4 +- engines/bladerunner/vector.h | 65 ++----- engines/bladerunner/view.h | 2 +- engines/bladerunner/vqa_decoder.cpp | 211 ++++++++------------- engines/bladerunner/vqa_decoder.h | 17 +- engines/bladerunner/vqa_player.cpp | 6 +- engines/bladerunner/vqa_player.h | 4 +- engines/bladerunner/waypoints.cpp | 2 +- 69 files changed, 335 insertions(+), 669 deletions(-) (limited to 'engines') diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index ba0bedae5f..1ea2b17de8 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -402,7 +402,7 @@ void Actor::draw() { float draw_scale = _scale; // TODO: Handle SHORTY mode - + _vm->_sliceRenderer->drawFrame(_animationId, _animationFrame, draw_position, draw_facing, draw_scale, _vm->_surface2, _vm->_zBuffer2); //todo udpate screenrect } @@ -798,8 +798,7 @@ bool Actor::hasClue(int clueId) { void Actor::copyClues(int actorId) { Actor *otherActor = _vm->_actors[actorId]; - int i; - for (i = 0; i < (int)_vm->_gameInfo->getClueCount(); i++) { + 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) diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h index 5383adb448..1edbea49b4 100644 --- a/engines/bladerunner/actor.h +++ b/engines/bladerunner/actor.h @@ -137,8 +137,8 @@ public: int getSetId(); void setSetId(int setId); - BoundingBox* getBoundingBox() { return _bbox; } - Common::Rect* getScreenRectangle() { return &_screenRectangle; } + BoundingBox *getBoundingBox() { return _bbox; } + Common::Rect *getScreenRectangle() { return &_screenRectangle; } int getWalkbox() { return _walkboxId; } bool isRetired() { return _isRetired; } bool isTargetable() { return _isTargetable; } diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp index c876829fa6..9c0a61c2cc 100644 --- a/engines/bladerunner/actor_clues.cpp +++ b/engines/bladerunner/actor_clues.cpp @@ -28,14 +28,12 @@ namespace BladeRunner { -ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) -{ +ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) { _vm = vm; _count = 0; _maxCount = 0; _clues = 0; - switch (cluesType) - { + switch (cluesType) { case 4: _maxCount = _vm->_gameInfo->getClueCount(); break; @@ -66,8 +64,7 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) _maxCount = 0; } -ActorClues::~ActorClues() -{ +ActorClues::~ActorClues() { if (_clues) delete[] _clues; @@ -75,8 +72,7 @@ ActorClues::~ActorClues() _count = 0; } -void ActorClues::acquire(int clueId, char flag2, int fromActorId) -{ +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); @@ -85,14 +81,12 @@ void ActorClues::acquire(int clueId, char flag2, int fromActorId) debug("Actor acquired clue: \"%s\" from %d", _vm->_clues->getClueText(clueId), fromActorId); } -void ActorClues::lose(int clueId) -{ +void ActorClues::lose(int clueId) { int clueIndex = findClueIndex(clueId); _clues[clueIndex]._flags = 0; } -bool ActorClues::isAcquired(int clueId) -{ +bool ActorClues::isAcquired(int clueId) { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) return 0; @@ -100,8 +94,7 @@ bool ActorClues::isAcquired(int clueId) return _clues[clueIndex]._flags & 0x01; } -int ActorClues::getFromActorId(int clueId) -{ +int ActorClues::getFromActorId(int clueId) { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) return -1; @@ -109,8 +102,7 @@ int ActorClues::getFromActorId(int clueId) return _clues[clueIndex]._fromActorId; } -bool ActorClues::isFlag2(int clueId) -{ +bool ActorClues::isFlag2(int clueId) { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) return 0; @@ -118,8 +110,7 @@ bool ActorClues::isFlag2(int clueId) return (_clues[clueIndex]._flags & 0x02) >> 1; } -bool ActorClues::isFlag3(int clueId) -{ +bool ActorClues::isFlag3(int clueId) { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) return 0; @@ -127,8 +118,7 @@ bool ActorClues::isFlag3(int clueId) return (_clues[clueIndex]._flags & 0x04) >> 2; } -bool ActorClues::isFlag4(int clueId) -{ +bool ActorClues::isFlag4(int clueId) { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) return 0; @@ -136,8 +126,7 @@ bool ActorClues::isFlag4(int clueId) return (_clues[clueIndex]._flags & 0x08) >> 3; } -int ActorClues::getField1(int clueId) -{ +int ActorClues::getField1(int clueId) { if (!_count) return 0; @@ -148,21 +137,18 @@ int ActorClues::getField1(int clueId) return _clues[clueIndex]._field1; } -int ActorClues::getCount() -{ +int ActorClues::getCount() { return _count; } -void ActorClues::removeAll() -{ +void ActorClues::removeAll() { _count = 0; for (int i = 0; i < _maxCount; ++i) { remove(i); } } -int ActorClues::findClueIndex(int clueId) -{ +int ActorClues::findClueIndex(int clueId) { for (int i = 0; i < _count; i++) { if (clueId == _clues[i]._clueId) { return i; @@ -171,8 +157,7 @@ int ActorClues::findClueIndex(int clueId) return -1; } -void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId) -{ +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->_clues->getClueText(clueId), fromActorId); @@ -188,8 +173,7 @@ void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool u ++_count; } -void ActorClues::remove(int index) -{ +void ActorClues::remove(int index) { if (_vm->_clues) debug("Actor removed clue: \"%s\"", _vm->_clues->getClueText(_clues[index]._clueId)); @@ -206,8 +190,7 @@ void ActorClues::remove(int index) _clues[index]._field8 = 0; } -bool ActorClues::exists(int clueId) -{ +bool ActorClues::exists(int clueId) { return findClueIndex(clueId) != -1; } diff --git a/engines/bladerunner/actor_clues.h b/engines/bladerunner/actor_clues.h index 06ac815c34..26510ecd33 100644 --- a/engines/bladerunner/actor_clues.h +++ b/engines/bladerunner/actor_clues.h @@ -29,8 +29,7 @@ namespace BladeRunner { -struct ActorClue -{ +struct ActorClue { int _clueId; int _field1; int _fromActorId; @@ -43,8 +42,7 @@ struct ActorClue unsigned char _flags; }; -class ActorClues -{ +class ActorClues { BladeRunnerEngine *_vm; private: diff --git a/engines/bladerunner/actor_combat.cpp b/engines/bladerunner/actor_combat.cpp index 09d89df6c1..4bd8d17c67 100644 --- a/engines/bladerunner/actor_combat.cpp +++ b/engines/bladerunner/actor_combat.cpp @@ -24,7 +24,7 @@ namespace BladeRunner { -ActorCombat::ActorCombat(BladeRunnerEngine* vm) { +ActorCombat::ActorCombat(BladeRunnerEngine *vm) { _vm = vm; } diff --git a/engines/bladerunner/actor_combat.h b/engines/bladerunner/actor_combat.h index df06e83f22..ee29bf4f0e 100644 --- a/engines/bladerunner/actor_combat.h +++ b/engines/bladerunner/actor_combat.h @@ -29,8 +29,7 @@ namespace BladeRunner { -class ActorCombat -{ +class ActorCombat { BladeRunnerEngine *_vm; private: diff --git a/engines/bladerunner/actor_walk.cpp b/engines/bladerunner/actor_walk.cpp index 5b237362c9..ed55bd0277 100644 --- a/engines/bladerunner/actor_walk.cpp +++ b/engines/bladerunner/actor_walk.cpp @@ -46,28 +46,23 @@ ActorWalk::ActorWalk(BladeRunnerEngine *vm) { ActorWalk::~ActorWalk() { } -int ActorWalk::setup(int actorId, int run, Vector3 from, Vector3 to, int unk1, int *unk2) -{ +int ActorWalk::setup(int actorId, int run, Vector3 from, Vector3 to, int unk1, int *unk2) { Vector3 next; *unk2 = 0; int r = nextOnPath(actorId, from, to, &next); if (r == 0) { - if (actorId != 0) - { + if (actorId != 0) { _current = from; _destination = to; stop(actorId, false); - } - else - { + } else { stop(actorId, true); } return 0; } - if (r == -1) - { + if (r == -1) { stop(actorId, true); *unk2 = 1; return 0; @@ -77,18 +72,14 @@ int ActorWalk::setup(int actorId, int run, Vector3 from, Vector3 to, int unk1, i // TODO: Update screen index // Set actor field e8 - if (_running) - { + if (_running) { run = true; } int animationMode; - if (_vm->_actors[actorId]->inCombat()) - { + if (_vm->_actors[actorId]->inCombat()) { animationMode = run ? 8 : 7; - } - else - { + } else { animationMode = run ? 2 : 1; } @@ -98,8 +89,7 @@ int ActorWalk::setup(int actorId, int run, Vector3 from, Vector3 to, int unk1, i _current = from; _next = next; - if (next.x != _current.x || next.z != _current.z) - { + if (next.x != _current.x || next.z != _current.z) { _facing = angle_1024(_current, next); _walking = true; _running = run; @@ -112,26 +102,21 @@ int ActorWalk::setup(int actorId, int run, Vector3 from, Vector3 to, int unk1, i return 0; } -bool ActorWalk::tick(int actorId, float stepDistance, bool flag) -{ - if (_status == 5) - { - if (flag) - { +bool ActorWalk::tick(int actorId, float stepDistance, bool flag) { + if (_status == 5) { + if (flag) { stop(actorId, true); return true; } - if (actorId != 0 && _vm->_rnd.getRandomNumberRng(1, 15) != 1) - { + if (actorId != 0 && _vm->_rnd.getRandomNumberRng(1, 15) != 1) { return false; } _status = 3; } // TODO: Handle collisions? - if (stepDistance > distance(_current, _destination)) - { + if (stepDistance > distance(_current, _destination)) { stop(actorId, true); _current = _destination; // TODO: Update y from walkbox @@ -149,14 +134,12 @@ bool ActorWalk::tick(int actorId, float stepDistance, bool flag) return false; } -void ActorWalk::getCurrentPosition(int actorId, Vector3 *pos, int *facing) -{ +void ActorWalk::getCurrentPosition(int actorId, Vector3 *pos, int *facing) { *pos = _current; *facing = _facing; } -void ActorWalk::setRunning() -{ +void ActorWalk::setRunning() { _running = true; // TODO: Set animation mode } @@ -182,10 +165,8 @@ void ActorWalk::stop(int actorId, bool unknown, int animationMode, int notused) } } -int ActorWalk::nextOnPath(int actorId, Vector3 from, Vector3 to, Vector3 *next) -{ - if (distance(from, to) < 6.0) - { +int ActorWalk::nextOnPath(int actorId, Vector3 from, Vector3 to, Vector3 *next) { + if (distance(from, to) < 6.0) { return -1; } @@ -197,25 +178,20 @@ int ActorWalk::nextOnPath(int actorId, Vector3 from, Vector3 to, Vector3 *next) error("TODO!"); } -static -int angle_1024(float x1, float z1, float x2, float z2) -{ +static 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; } -static -int angle_1024(Vector3 &v1, Vector3 &v2) -{ +static int angle_1024(Vector3 &v1, Vector3 &v2) { return angle_1024(v1.x, v1.z, v2.x, v2.z); } -float distance(float x1, float z1, float x2, float z2) -{ +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 d = sqrt(dx * dx + dz * dz); float int_part = (int)d; float frac_part = d - int_part; @@ -226,8 +202,7 @@ float distance(float x1, float z1, float x2, float z2) return int_part + frac_part; } -float distance(Vector3 &v1, Vector3 &v2) -{ +float distance(Vector3 &v1, Vector3 &v2) { return distance(v1.x, v1.z, v2.x, v2.z); } diff --git a/engines/bladerunner/actor_walk.h b/engines/bladerunner/actor_walk.h index 3e03c79a6c..12da69bead 100644 --- a/engines/bladerunner/actor_walk.h +++ b/engines/bladerunner/actor_walk.h @@ -29,14 +29,12 @@ namespace BladeRunner { class BladeRunnerEngine; -struct ActorWalkEntry -{ +struct ActorWalkEntry { int _actorId; int _present; }; -class ActorWalk -{ +class ActorWalk { BladeRunnerEngine *_vm; private: diff --git a/engines/bladerunner/adpcm_decoder.cpp b/engines/bladerunner/adpcm_decoder.cpp index e262da6430..c93d4eb2c1 100644 --- a/engines/bladerunner/adpcm_decoder.cpp +++ b/engines/bladerunner/adpcm_decoder.cpp @@ -30,8 +30,7 @@ static const int16 imaIndexTable[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; static const -uint16 imaStepTable[712] = -{ +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, @@ -123,19 +122,16 @@ uint16 imaStepTable[712] = 0x0fff,0x2ffe,0x4ffe,0x6ffd,0x8ffe,0xaffd,0xcffd,0xeffc }; -void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out) -{ +void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out) { uint8 *end = in + size; int16 stepIndex = _stepIndex; int32 predictor = _predictor; - while (in != end) - { + while (in != end) { uint16 bl = *in++; - for (int n = 0; n != 2; ++n) - { + for (int n = 0; n != 2; ++n) { uint8 nibble = (bl >> (4 * n)) & 0x0f; uint8 code = nibble & 0x07; uint8 sign = nibble & 0x08; diff --git a/engines/bladerunner/adpcm_decoder.h b/engines/bladerunner/adpcm_decoder.h index fd174aef42..8f7a2285a2 100644 --- a/engines/bladerunner/adpcm_decoder.h +++ b/engines/bladerunner/adpcm_decoder.h @@ -33,11 +33,10 @@ class ADPCMWestwoodDecoder { public: ADPCMWestwoodDecoder() - : _stepIndex(0), _predictor(0) - {} + : _stepIndex(0), _predictor(0) { + } - void setParameters(int16 stepIndex, int32 predictor) - { + void setParameters(int16 stepIndex, int32 predictor) { _stepIndex = stepIndex; _predictor = predictor; } diff --git a/engines/bladerunner/ambient_sounds.cpp b/engines/bladerunner/ambient_sounds.cpp index 77b819578f..c33deefb80 100644 --- a/engines/bladerunner/ambient_sounds.cpp +++ b/engines/bladerunner/ambient_sounds.cpp @@ -34,9 +34,7 @@ namespace BladeRunner { #define NON_LOOPING_SOUNDS 25 #define LOOPING_SOUNDS 3 -AmbientSounds::AmbientSounds(BladeRunnerEngine *vm) - : _vm(vm) -{ +AmbientSounds::AmbientSounds(BladeRunnerEngine *vm) : _vm(vm) { _nonLoopingSounds = new NonLoopingSound[NON_LOOPING_SOUNDS]; _loopingSounds = new LoopingSound[LOOPING_SOUNDS]; _ambientVolume = 65; @@ -66,13 +64,12 @@ static inline void sort(int &a, int &b) { } 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) -{ + 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); @@ -187,8 +184,7 @@ void AmbientSounds::addSoundByName( int volumeRangeBegin, int volumeRangeEnd, int pan1begin, int pan1end, int pan2begin, int pan2end, - int priority, int unk3) -{ + int priority, int unk3) { int i = findAvailableNonLoopingTrack(); if (i < 0) return; diff --git a/engines/bladerunner/archive.cpp b/engines/bladerunner/archive.cpp index 464ca15929..005145599d 100644 --- a/engines/bladerunner/archive.cpp +++ b/engines/bladerunner/archive.cpp @@ -121,8 +121,7 @@ int32 tlk_id(const Common::String &name) { uint32 MIXArchive::indexForId(int32 id) const { uint32 lo = 0, hi = _entry_count; - while (lo < hi) - { + while (lo < hi) { uint32 mid = lo + (hi - lo) / 2; if (id > _entries[mid].id) diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp index 8a17f6ba24..b583531ecd 100644 --- a/engines/bladerunner/aud_stream.cpp +++ b/engines/bladerunner/aud_stream.cpp @@ -28,22 +28,18 @@ namespace BladeRunner { -AudStream::AudStream(byte *data) - : _cache(nullptr) -{ +AudStream::AudStream(byte *data) : _cache(nullptr) { init(data); } AudStream::AudStream(AudioCache *cache, int32 hash) - : _cache(cache), _hash(hash) -{ + : _cache(cache), _hash(hash) { _cache->incRef(_hash); init(_cache->findByHash(_hash)); } -void AudStream::init(byte *data) -{ +void AudStream::init(byte *data) { _data = data; _end = _data + READ_LE_UINT32(_data + 2) + 12; assert(_end - _data >= 12); diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp index dc6f19542a..0c2b747c32 100644 --- a/engines/bladerunner/audio_player.cpp +++ b/engines/bladerunner/audio_player.cpp @@ -126,9 +126,7 @@ void AudioCache::decRef(int32 hash) { assert(0 && "AudioCache::decRef: hash not found"); } -AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) - : _vm(vm) -{ +AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) : _vm(vm) { _cache = new AudioCache(); for (int i = 0; i != 6; ++i) { @@ -141,23 +139,20 @@ AudioPlayer::~AudioPlayer() { delete _cache; } -bool AudioPlayer::isTrackActive(Track *track) -{ +bool AudioPlayer::isTrackActive(Track *track) { if (!track->isMaybeActive) return false; return track->isMaybeActive = _vm->_mixer->isSoundHandleActive(track->soundHandle); } -void AudioPlayer::stopAll() -{ +void AudioPlayer::stopAll() { for (int i = 0; i != TRACKS; ++i) { _vm->_mixer->stopHandle(_tracks[i].soundHandle); } } -void AudioPlayer::fadeAndStopTrack(Track *track, int time) -{ +void AudioPlayer::fadeAndStopTrack(Track *track, int time) { (void)time; _vm->_mixer->stopHandle(track->soundHandle); diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h index eb4c75dbb3..4260a7b32b 100644 --- a/engines/bladerunner/audio_player.h +++ b/engines/bladerunner/audio_player.h @@ -58,8 +58,8 @@ public: AudioCache() : _totalSize(0), _maxSize(2457600), - _accessCounter(0) - {} + _accessCounter(0) { + } ~AudioCache(); bool canAllocate(uint32 size); @@ -82,9 +82,7 @@ class AudioPlayer { int32 hash; int volume; - Track() - : isMaybeActive(false) - {} + Track() : isMaybeActive(false) {} }; Track _tracks[TRACKS]; diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp index 7e7e4f0b78..2d06025892 100644 --- a/engines/bladerunner/audio_speech.cpp +++ b/engines/bladerunner/audio_speech.cpp @@ -31,9 +31,7 @@ namespace BladeRunner { #define BUFFER_SIZE 200000 -AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) - : _vm(vm) -{ +AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) : _vm(vm) { _volume = 50; _isMaybeActive = false; _data = new byte[BUFFER_SIZE]; diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 6b97a0bb9a..3365bb1c09 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -61,9 +61,8 @@ namespace BladeRunner { BladeRunnerEngine::BladeRunnerEngine(OSystem *syst) - : Engine(syst), - _rnd("bladerunner") -{ + : Engine(syst), + _rnd("bladerunner") { _windowIsActive = true; _gameIsRunning = true; _playerLosesControlCounter = 0; @@ -616,8 +615,7 @@ void BladeRunnerEngine::gameTick() { // TODO: Process AUD // TODO: Footstep sound - if (_walkSoundId >= 0) - { + if (_walkSoundId >= 0) { const char *name = _gameInfo->getSfxTrack(_walkSoundId); _audioPlayer->playAud(name, _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0); _walkSoundId = -1; @@ -669,7 +667,7 @@ void BladeRunnerEngine::gameTick() { for (int i = 0; i < _scene->_set->_walkboxCount; i++) { Walkbox *walkbox = &_scene->_set->_walkboxes[i]; - for(int j = 0; j < walkbox->_vertexCount; j++) { + 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); @@ -709,11 +707,11 @@ void BladeRunnerEngine::handleEvents() { 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: - ; + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + handleMouseClick(event.mouse.x, event.mouse.y); + default: + ; } } } @@ -760,34 +758,29 @@ void BladeRunnerEngine::handleMouseClick(int x, int y) { } } -void BladeRunnerEngine::handleMouseClickExit(int x, int y, int exitIndex) -{ +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) -{ +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) -{ +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) -{ +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) -{ +void BladeRunnerEngine::handleMouseClickActor(int x, int y, int actorId) { debug("Clicked on actor %d", actorId); _script->ClickedOnActor(actorId); } diff --git a/engines/bladerunner/boundingbox.h b/engines/bladerunner/boundingbox.h index 5031ce555f..da91489f25 100644 --- a/engines/bladerunner/boundingbox.h +++ b/engines/bladerunner/boundingbox.h @@ -38,7 +38,7 @@ public: 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); + void getXYZ(float* x0, float *y0, float* z0, float *x1, float* y1, float* z1); float getZ0(); float getZ1(); diff --git a/engines/bladerunner/chapters.h b/engines/bladerunner/chapters.h index 9778209d04..5d4da5713d 100644 --- a/engines/bladerunner/chapters.h +++ b/engines/bladerunner/chapters.h @@ -35,9 +35,7 @@ class Chapters { bool _hasOpenResources; public: - Chapters(BladeRunnerEngine *vm) - : _vm(vm), _chapter(0) - { + Chapters(BladeRunnerEngine *vm) : _vm(vm), _chapter(0) { _chapter = 0; _resourceIds[0] = 1; diff --git a/engines/bladerunner/clues.cpp b/engines/bladerunner/clues.cpp index cbdf536c6d..b87761b470 100644 --- a/engines/bladerunner/clues.cpp +++ b/engines/bladerunner/clues.cpp @@ -28,9 +28,7 @@ namespace BladeRunner { -Clues::Clues(BladeRunnerEngine *vm, const char *cluesResource, int clueCount) - : _clueCount(clueCount) -{ +Clues::Clues(BladeRunnerEngine *vm, const char *cluesResource, int clueCount) : _clueCount(clueCount) { // reset(); _crimes = new int[_clueCount]; diff --git a/engines/bladerunner/decompress_lcw.cpp b/engines/bladerunner/decompress_lcw.cpp index 8d20e231c7..9fc4640d1b 100644 --- a/engines/bladerunner/decompress_lcw.cpp +++ b/engines/bladerunner/decompress_lcw.cpp @@ -34,79 +34,61 @@ uint32 decompress_lcw(uint8 *inBuf, uint32 inLen, uint8 *outBuf, uint32 outLen) uint8 *dst = outBuf; uint8 *outEnd = dst + outLen; - if (src[0] == 0) - { + if (src[0] == 0) { version = 2; ++src; } - while (src < inBuf + inLen && dst < outEnd && src[0] != 0x80) - { + while (src < inBuf + inLen && dst < outEnd && src[0] != 0x80) { out_remain = (int)(outEnd - dst); - if (src[0] == 0xff) // 0b11111111 - { + 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) - { + if (version == 1) { for (i = 0; i < count; i++) dst[i] = outBuf[i + pos]; - } - else - { + } else { for (i = 0; i < count; i++) dst[i] = *(dst + i - pos); } - } - else if (src[0] == 0xfe) // 0b11111110 - { + } 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?????? - { + } 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) - { + if (version == 1) { for (i = 0; i < count; i++) dst[i] = outBuf[i + pos]; - } - else - { + } else { for (i = 0; i < count; i++) dst[i] = *(dst + i - pos); } - } - else if (src[0] >= 0x80) // 0b10?????? - { + } else if (src[0] >= 0x80) { // 0b10?????? count = src[0] & 0x3f; ++src; count = MIN(count, out_remain); memcpy(dst, src, count); src += count; - } - else // 0b0??????? - { + } 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++) - { + for (i = 0; i < count; i++) { dst[i] = *(dst + i - relpos); } } @@ -125,30 +107,20 @@ uint32 decompress_lcw_output_size(uint8 *inBuf, uint32 inLen) { if (src[0] == 0) ++src; - while (src[0] != 0x80 && src < inBuf + inLen) - { - if (src[0] == 0xff) // 0b11111111 - { + 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 - { + } else if (src[0] == 0xfe) { // 0b11111110 count = src[1] | (src[2] << 8); src += 4; - } - else if (src[0] >= 0xc0) // 0b11?????? - { + } else if (src[0] >= 0xc0) { // 0b11?????? count = (src[0] & 0x3f) + 3; src += 3; - } - else if (src[0] & 0x80) // 0b10?????? - { + } else if (src[0] & 0x80) { // 0b10?????? count = src[0] & 0x3f; src += count + 1; - } - else // 0b0??????? - { + } else { // 0b0??????? count = ((src[0] & 0x70) >> 4) + 3; src += 2; } diff --git a/engines/bladerunner/decompress_lzo.cpp b/engines/bladerunner/decompress_lzo.cpp index aa4ebc74dd..c2c9712e8b 100644 --- a/engines/bladerunner/decompress_lzo.cpp +++ b/engines/bladerunner/decompress_lzo.cpp @@ -24,10 +24,9 @@ namespace BladeRunner { -static inline -uint32 decode_count(const uint8 **pp) { +static inline uint32 decode_count(const uint8 **pp) { uint32 v = 0; - for (;!**pp;(*pp)++) + for (; !**pp; (*pp)++) v += 255; v += **pp; @@ -36,8 +35,7 @@ uint32 decode_count(const uint8 **pp) { return v; } -static inline -void copy(uint8 **dst, const uint8 **src, int count) { +static inline void copy(uint8 **dst, const uint8 **src, int count) { assert(count > 0); uint8 *d = *dst; @@ -87,22 +85,17 @@ first_literal_run: for (;;) { match: - if (t >= 64) - { + if (t >= 64) { m_pos = op - 1 - ((t >> 2) & 7) - (*ip++ << 3); t = (t >> 5) - 1; goto copy_match; - } - else if (t >= 32) - { + } 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) - { + } else if (t >= 16) { m_pos = op - ((t & 8) << 11); t &= 7; if (t == 0) @@ -112,9 +105,7 @@ match: if (m_pos == op) goto eof_found; m_pos -= 0x4000; - } - else - { + } else { m_pos = op - 1 - (t >> 2) - (*ip++ << 2); copy(&op, &m_pos, 2); goto match_done; diff --git a/engines/bladerunner/fog.h b/engines/bladerunner/fog.h index 992ede56ed..445308d540 100644 --- a/engines/bladerunner/fog.h +++ b/engines/bladerunner/fog.h @@ -34,8 +34,7 @@ namespace BladeRunner { class SetEffects; -class Fog -{ +class Fog { friend class SetEffects; protected: @@ -82,20 +81,17 @@ protected: }; -class FogCone : public Fog -{ +class FogCone : public Fog { void read(Common::ReadStream *stream, int framesCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; -class FogSphere : public Fog -{ +class FogSphere : public Fog { void read(Common::ReadStream *stream, int framesCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; -class FogBox : public Fog -{ +class FogBox : public Fog { void read(Common::ReadStream *stream, int framesCount); void calculateCoeficient(Vector3 position, Vector3 viewPosition, float *coeficient); }; diff --git a/engines/bladerunner/gameflags.cpp b/engines/bladerunner/gameflags.cpp index 087292e39f..db4271d9d5 100644 --- a/engines/bladerunner/gameflags.cpp +++ b/engines/bladerunner/gameflags.cpp @@ -27,8 +27,7 @@ namespace BladeRunner { GameFlags::GameFlags() - : flags(NULL), flagCount(0) -{ + : flags(NULL), flagCount(0) { } GameFlags::~GameFlags() { diff --git a/engines/bladerunner/gameinfo.cpp b/engines/bladerunner/gameinfo.cpp index a5c01c1075..5f30e51b84 100644 --- a/engines/bladerunner/gameinfo.cpp +++ b/engines/bladerunner/gameinfo.cpp @@ -30,8 +30,7 @@ namespace BladeRunner { GameInfo::GameInfo(BladeRunnerEngine *vm) - : _vm(vm) -{ + : _vm(vm) { _scene_names = nullptr; _sfx_tracks = nullptr; _music_tracks = nullptr; @@ -78,15 +77,13 @@ bool GameInfo::open(const Common::String &name) { s->read(_scene_names[i], 5); _sfx_tracks = new char[_sfx_track_count][13]; - for (uint32 i = 0; i != _sfx_track_count; ++i) - { + 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) - { + for (uint32 i = 0; i != _music_track_count; ++i) { s->read(_music_tracks[i], 9); strcat(_music_tracks[i], ".AUD"); } diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp index abdd6ffe7e..1a23823b31 100644 --- a/engines/bladerunner/image.cpp +++ b/engines/bladerunner/image.cpp @@ -31,8 +31,7 @@ namespace BladeRunner { Image::Image(BladeRunnerEngine *vm) - : _vm(vm) -{ + : _vm(vm) { } Image::~Image() { diff --git a/engines/bladerunner/image.h b/engines/bladerunner/image.h index 376f9962a9..4e44ae9a80 100644 --- a/engines/bladerunner/image.h +++ b/engines/bladerunner/image.h @@ -36,6 +36,7 @@ class BladeRunnerEngine; class Image { BladeRunnerEngine *_vm; Graphics::Surface _surface; + public: Image(BladeRunnerEngine *vm); ~Image(); diff --git a/engines/bladerunner/item.cpp b/engines/bladerunner/item.cpp index fd5c3e545c..11e75e93e6 100644 --- a/engines/bladerunner/item.cpp +++ b/engines/bladerunner/item.cpp @@ -133,4 +133,5 @@ void Item::setup(int itemId, int setId, int animationId, Vector3 position, int f _screenRectangle.top = -1; _screenRectangle.left = -1; } + } // End of namespace BladeRunner diff --git a/engines/bladerunner/light.h b/engines/bladerunner/light.h index cae5816ae6..ce54171de2 100644 --- a/engines/bladerunner/light.h +++ b/engines/bladerunner/light.h @@ -36,8 +36,7 @@ namespace BladeRunner { class Lights; -class Light -{ +class Light { #if _DEBUG friend class BladeRunnerEngine; #endif diff --git a/engines/bladerunner/matrix.cpp b/engines/bladerunner/matrix.cpp index db4d4d5f9a..42e3f68e9e 100644 --- a/engines/bladerunner/matrix.cpp +++ b/engines/bladerunner/matrix.cpp @@ -26,15 +26,13 @@ namespace BladeRunner { -Matrix3x2::Matrix3x2() -{ +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]) -{ +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]; @@ -42,8 +40,7 @@ Matrix3x2::Matrix3x2(float d[6]) Matrix3x2::Matrix3x2( float m00, float m01, float m02, - float m10, float m11, float m12) -{ + float m10, float m11, float m12) { _m[0][0] = m00; _m[0][1] = m01; _m[0][2] = m02; @@ -52,15 +49,13 @@ Matrix3x2::Matrix3x2( _m[1][2] = m12; } -Matrix4x3::Matrix4x3() -{ +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]) -{ +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]; @@ -69,8 +64,7 @@ Matrix4x3::Matrix4x3(float d[12]) 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) -{ + float m20, float m21, float m22, float m23) { _m[0][0] = m00; _m[0][1] = m01; _m[0][2] = m02; @@ -85,8 +79,7 @@ Matrix4x3::Matrix4x3( _m[2][3] = m23; } -Matrix4x3 rotationMatrixX(float angle) -{ +Matrix4x3 rotationMatrixX(float angle) { float ca = cos(angle); float sa = sin(angle); @@ -95,33 +88,25 @@ Matrix4x3 rotationMatrixX(float angle) 0.0f, -sa, ca, 0.0f ); } -static inline -void swapRows(double *r1, double *r2) -{ - for (int c = 0; c != 8; ++c) - { +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) -{ +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) -{ +static inline void divideRow(double *r1, double d) { for (int c = 0; c != 8; ++c) r1[c] /= d; } -Matrix4x3 invertMatrix(const Matrix4x3 &m) -{ +Matrix4x3 invertMatrix(const Matrix4x3 &m) { double w[3][8]; for (int r = 0; r != 3; ++r) { @@ -166,8 +151,7 @@ Matrix4x3 invertMatrix(const Matrix4x3 &m) return result; } -void Matrix4x3::unknown() -{ +void Matrix4x3::unknown() { Matrix4x3 t; // Transpose the 3x3 top left submatrix diff --git a/engines/bladerunner/matrix.h b/engines/bladerunner/matrix.h index 4450306dad..5fe7fc2a01 100644 --- a/engines/bladerunner/matrix.h +++ b/engines/bladerunner/matrix.h @@ -27,8 +27,7 @@ namespace BladeRunner { -class Matrix3x2 -{ +class Matrix3x2 { public: float _m[2][3]; @@ -42,9 +41,7 @@ public: 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) -{ +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); @@ -57,9 +54,7 @@ Matrix3x2 operator*(const Matrix3x2 &a, const Matrix3x2 &b) return t; } -inline -Matrix3x2 operator+(const Matrix3x2 &a, Vector2 b) -{ +inline Matrix3x2 operator+(const Matrix3x2 &a, Vector2 b) { Matrix3x2 t(a); t(0,2) += b.x; @@ -68,9 +63,7 @@ Matrix3x2 operator+(const Matrix3x2 &a, Vector2 b) return t; } -inline -Vector2 operator*(const Matrix3x2 &a, Vector2 b) -{ +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); @@ -79,8 +72,7 @@ Vector2 operator*(const Matrix3x2 &a, Vector2 b) return t; } -class Matrix4x3 -{ +class Matrix4x3 { public: float _m[3][4]; @@ -100,13 +92,10 @@ public: Matrix4x3 invertMatrix(const Matrix4x3 &m); Matrix4x3 rotationMatrixX(float angle); -inline -Matrix4x3 operator*(const Matrix4x3 &a, const Matrix4x3 &b) -{ +inline Matrix4x3 operator*(const Matrix4x3 &a, const Matrix4x3 &b) { Matrix4x3 t; - for (int i = 0; i !=3; ++i) - { + 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); @@ -117,9 +106,7 @@ Matrix4x3 operator*(const Matrix4x3 &a, const Matrix4x3 &b) return t; } -inline -Vector3 operator*(const Matrix4x3 &m, const Vector3 &v) -{ +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); diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp index 14a2151e43..675e20c0fd 100644 --- a/engines/bladerunner/mouse.cpp +++ b/engines/bladerunner/mouse.cpp @@ -31,9 +31,7 @@ namespace BladeRunner { -Mouse::Mouse(BladeRunnerEngine *vm) - : _vm(vm) -{ +Mouse::Mouse(BladeRunnerEngine *vm) : _vm(vm) { _cursor = 0; _frame = 3; _hotspotX = 0; @@ -248,8 +246,7 @@ void Mouse::updateCursorFrame() { } } -void Mouse::tick(int x, int y) -{ +void Mouse::tick(int x, int y) { if (!_vm->playerHasControl() || isDisabled()) return; @@ -288,8 +285,7 @@ void Mouse::tick(int x, int y) if (true /* not in combat */) { if (sceneObjectId == 0 || (sceneObjectId >= 0 && isClickable) - || _vm->_scene->_regions->getRegionAtXY(x, y) >= 0) - { + || _vm->_scene->_regions->getRegionAtXY(x, y) >= 0) { cursorId = 1; } setCursor(cursorId); @@ -300,8 +296,7 @@ void Mouse::tick(int x, int y) } // TEST: RC01 after intro: [290, 216] -> [-204.589249 51.450668 7.659241] -Vector3 Mouse::getXYZ(int x, int y) -{ +Vector3 Mouse::getXYZ(int x, int y) { if (_vm->_scene->getSetId() == -1) return Vector3(); diff --git a/engines/bladerunner/movement_track.cpp b/engines/bladerunner/movement_track.cpp index b7d0adc6c0..60a190a9a2 100644 --- a/engines/bladerunner/movement_track.cpp +++ b/engines/bladerunner/movement_track.cpp @@ -24,24 +24,20 @@ namespace BladeRunner { -MovementTrack::MovementTrack() -{ +MovementTrack::MovementTrack() { reset(); } -MovementTrack::~MovementTrack() -{ +MovementTrack::~MovementTrack() { reset(); } -void MovementTrack::reset() -{ +void MovementTrack::reset() { _currentIndex = -1; _lastIndex = -1; _hasNext = 0; _paused = 0; - for (int i = 0; i < 100; i++) - { + for (int i = 0; i < 100; i++) { _entries[i].waypointId = -1; _entries[i].delay = -1; _entries[i].angle = -1; @@ -49,13 +45,11 @@ void MovementTrack::reset() } } -int MovementTrack::append(int waypointId, int delay, int running) -{ +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) -{ +int MovementTrack::append(int waypointId, int delay, int angle, int running) { if (_lastIndex > ARRAYSIZE(_entries)) return 0; @@ -70,41 +64,34 @@ int MovementTrack::append(int waypointId, int delay, int angle, int running) return 1; } -void MovementTrack::flush() -{ +void MovementTrack::flush() { reset(); } -void MovementTrack::repeat() -{ +void MovementTrack::repeat() { _currentIndex = 0; _hasNext = 1; } -int MovementTrack::pause() -{ +int MovementTrack::pause() { _paused = 1; return 1; } -int MovementTrack::unpause() -{ +int MovementTrack::unpause() { _paused = 0; return 1; } -int MovementTrack::isPaused() -{ +int MovementTrack::isPaused() { return _paused; } -int MovementTrack::hasNext() -{ +int MovementTrack::hasNext() { return _hasNext; } -int MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) -{ +int MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) { if (_currentIndex < _lastIndex && this->_hasNext) { *waypointId = _entries[_currentIndex].waypointId; @@ -112,9 +99,7 @@ int MovementTrack::next(int *waypointId, int *delay, int *angle, int *running) *angle = _entries[_currentIndex].angle; *running = _entries[_currentIndex++].running; return 1; - } - else - { + } else { *waypointId = -1; *delay = -1; *angle = -1; diff --git a/engines/bladerunner/movement_track.h b/engines/bladerunner/movement_track.h index 976adc23de..f5cb03ffec 100644 --- a/engines/bladerunner/movement_track.h +++ b/engines/bladerunner/movement_track.h @@ -30,8 +30,7 @@ namespace BladeRunner { class BladeRunnerEngine; class BoundingBox; -struct MovementTrackEntry -{ +struct MovementTrackEntry { int waypointId; int delay; int angle; diff --git a/engines/bladerunner/outtake.h b/engines/bladerunner/outtake.h index 872656e63b..acbd00f6a6 100644 --- a/engines/bladerunner/outtake.h +++ b/engines/bladerunner/outtake.h @@ -35,9 +35,7 @@ class OuttakePlayer { BladeRunnerEngine *_vm; public: - OuttakePlayer(BladeRunnerEngine *vm) : - _vm(vm) - {} + OuttakePlayer(BladeRunnerEngine *vm) : _vm(vm) {} void play(const Common::String &name, bool noLocalization, int container); }; diff --git a/engines/bladerunner/regions.h b/engines/bladerunner/regions.h index 0b722c84ed..2dd6808a25 100644 --- a/engines/bladerunner/regions.h +++ b/engines/bladerunner/regions.h @@ -29,15 +29,13 @@ namespace BladeRunner { -struct Region -{ +struct Region { Common::Rect _rectangle; int _type; int _present; }; -class Regions -{ +class Regions { #ifdef _DEBUG friend class BladeRunnerEngine; #endif diff --git a/engines/bladerunner/scene_objects.h b/engines/bladerunner/scene_objects.h index 5f52d85dbd..947ee17336 100644 --- a/engines/bladerunner/scene_objects.h +++ b/engines/bladerunner/scene_objects.h @@ -32,8 +32,7 @@ namespace BladeRunner { class BladeRunnerEngine; class View; -enum SceneObjectType -{ +enum SceneObjectType { SceneObjectTypeUnknown = -1, SceneObjectTypeActor = 0, SceneObjectTypeObject = 1, @@ -45,8 +44,7 @@ enum SceneObjectType #define SCENE_OBJECTS_ITEMS_OFFSET 74 #define SCENE_OBJECTS_OBJECTS_OFFSET 198 -struct SceneObject -{ +struct SceneObject { int _sceneObjectId; SceneObjectType _sceneObjectType; BoundingBox _boundingBox; diff --git a/engines/bladerunner/script/aiscript_officer_leroy.cpp b/engines/bladerunner/script/aiscript_officer_leroy.cpp index f388eded6b..7881984154 100644 --- a/engines/bladerunner/script/aiscript_officer_leroy.cpp +++ b/engines/bladerunner/script/aiscript_officer_leroy.cpp @@ -25,11 +25,10 @@ namespace BladeRunner { AIScript_Officer_Leroy::AIScript_Officer_Leroy(BladeRunnerEngine *vm) - : AIScriptBase(vm) -{} + : AIScriptBase(vm) { +} -void AIScript_Officer_Leroy::Initialize() -{ +void AIScript_Officer_Leroy::Initialize() { var_45D5B0_animation_state = 0; var_45D5B4_frame = 0; var_45D5B8 = 0; @@ -84,14 +83,12 @@ bool AIScript_Officer_Leroy::GoalChanged(int currentGoalNumber, int newGoalNumbe return false; } -bool AIScript_Officer_Leroy::UpdateAnimation(int *animation, int *frame) -{ +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)) - { + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(589)) { var_45D5B4_frame = 0; var_45D5B8 = Random_Query(0, 2); } @@ -99,8 +96,7 @@ bool AIScript_Officer_Leroy::UpdateAnimation(int *animation, int *frame) *animation = 590; var_45D5B4_frame++; - if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(590)) - { + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(590)) { var_45D5B4_frame = 0; var_45D5B8 = Random_Query(0, 2); } @@ -108,8 +104,7 @@ bool AIScript_Officer_Leroy::UpdateAnimation(int *animation, int *frame) *animation = 591; var_45D5B4_frame++; - if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(591)) - { + if (var_45D5B4_frame >= Slice_Animation_Query_Number_Of_Frames(591)) { var_45D5B4_frame = 0; var_45D5B8 = Random_Query(0, 2); } @@ -118,13 +113,11 @@ bool AIScript_Officer_Leroy::UpdateAnimation(int *animation, int *frame) return true; } -bool AIScript_Officer_Leroy::ChangeAnimationMode(int mode) -{ - switch (mode) - { - case 1: - var_45D5B0_animation_state = 32; - break; +bool AIScript_Officer_Leroy::ChangeAnimationMode(int mode) { + switch (mode) { + case 1: + var_45D5B0_animation_state = 32; + break; } return true; } diff --git a/engines/bladerunner/script/ar02.cpp b/engines/bladerunner/script/ar02.cpp index dc89758a0d..220402794e 100644 --- a/engines/bladerunner/script/ar02.cpp +++ b/engines/bladerunner/script/ar02.cpp @@ -224,7 +224,6 @@ bool ScriptAR02::ClickedOn2DRegion(int region) { } void ScriptAR02::SceneFrameAdvanced(int frame) { - } void ScriptAR02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -386,5 +385,4 @@ void ScriptAR02::sub_402CE4() { } } - } // End of namespace BladeRunner diff --git a/engines/bladerunner/script/bb03.cpp b/engines/bladerunner/script/bb03.cpp index 24b4332ce8..7307c5c3a1 100644 --- a/engines/bladerunner/script/bb03.cpp +++ b/engines/bladerunner/script/bb03.cpp @@ -136,7 +136,6 @@ bool ScriptBB03::ClickedOn2DRegion(int region) { } void ScriptBB03::SceneFrameAdvanced(int frame) { - } void ScriptBB03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -154,7 +153,6 @@ void ScriptBB03::PlayerWalkedIn() { } void ScriptBB03::PlayerWalkedOut() { - } void ScriptBB03::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/bb04.cpp b/engines/bladerunner/script/bb04.cpp index ca96c11ef3..b99ea5004d 100644 --- a/engines/bladerunner/script/bb04.cpp +++ b/engines/bladerunner/script/bb04.cpp @@ -108,7 +108,6 @@ bool ScriptBB04::ClickedOn2DRegion(int region) { } void ScriptBB04::SceneFrameAdvanced(int frame) { - } void ScriptBB04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -123,7 +122,6 @@ void ScriptBB04::PlayerWalkedIn() { } void ScriptBB04::PlayerWalkedOut() { - } void ScriptBB04::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/bb05.cpp b/engines/bladerunner/script/bb05.cpp index 1f2b9745ea..aff2f7bdc6 100644 --- a/engines/bladerunner/script/bb05.cpp +++ b/engines/bladerunner/script/bb05.cpp @@ -140,7 +140,6 @@ bool ScriptBB05::ClickedOn2DRegion(int region) { } void ScriptBB05::SceneFrameAdvanced(int frame) { - } void ScriptBB05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -206,7 +205,6 @@ void ScriptBB05::PlayerWalkedIn() { } void ScriptBB05::PlayerWalkedOut() { - } void ScriptBB05::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/bb06.cpp b/engines/bladerunner/script/bb06.cpp index d389fcceb6..66c9a85d3c 100644 --- a/engines/bladerunner/script/bb06.cpp +++ b/engines/bladerunner/script/bb06.cpp @@ -169,7 +169,6 @@ void ScriptBB06::PlayerWalkedIn() { } void ScriptBB06::PlayerWalkedOut() { - } void ScriptBB06::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/bb07.cpp b/engines/bladerunner/script/bb07.cpp index 3284df89f1..7b9b4aea1f 100644 --- a/engines/bladerunner/script/bb07.cpp +++ b/engines/bladerunner/script/bb07.cpp @@ -159,7 +159,6 @@ bool ScriptBB07::ClickedOn2DRegion(int region) { } void ScriptBB07::SceneFrameAdvanced(int frame) { - } void ScriptBB07::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -177,7 +176,6 @@ void ScriptBB07::PlayerWalkedIn() { } void ScriptBB07::PlayerWalkedOut() { - } void ScriptBB07::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/bb08.cpp b/engines/bladerunner/script/bb08.cpp index cd05fe84b7..5464aabc28 100644 --- a/engines/bladerunner/script/bb08.cpp +++ b/engines/bladerunner/script/bb08.cpp @@ -109,7 +109,6 @@ bool ScriptBB08::ClickedOn2DRegion(int region) { } void ScriptBB08::SceneFrameAdvanced(int frame) { - } void ScriptBB08::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -129,7 +128,6 @@ void ScriptBB08::PlayerWalkedIn() { } void ScriptBB08::PlayerWalkedOut() { - } void ScriptBB08::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/ct03.cpp b/engines/bladerunner/script/ct03.cpp index 133c5d0c18..b7dcdd4e46 100644 --- a/engines/bladerunner/script/ct03.cpp +++ b/engines/bladerunner/script/ct03.cpp @@ -110,7 +110,6 @@ bool ScriptCT03::ClickedOn2DRegion(int region) { } void ScriptCT03::SceneFrameAdvanced(int frame) { - } void ScriptCT03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { diff --git a/engines/bladerunner/script/dr06.cpp b/engines/bladerunner/script/dr06.cpp index 8556db75fb..f744d21a13 100644 --- a/engines/bladerunner/script/dr06.cpp +++ b/engines/bladerunner/script/dr06.cpp @@ -199,7 +199,6 @@ bool ScriptDR06::ClickedOn2DRegion(int region) { } void ScriptDR06::SceneFrameAdvanced(int frame) { - } void ScriptDR06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { diff --git a/engines/bladerunner/script/hf02.cpp b/engines/bladerunner/script/hf02.cpp index 8c6e24dad4..575e3f8604 100644 --- a/engines/bladerunner/script/hf02.cpp +++ b/engines/bladerunner/script/hf02.cpp @@ -136,7 +136,6 @@ void ScriptHF02::PlayerWalkedIn() { } void ScriptHF02::PlayerWalkedOut() { - } void ScriptHF02::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/init.h b/engines/bladerunner/script/init.h index e7023fb375..7b95008abb 100644 --- a/engines/bladerunner/script/init.h +++ b/engines/bladerunner/script/init.h @@ -32,8 +32,8 @@ class BladeRunnerEngine; class ScriptInit : ScriptBase { public: ScriptInit(BladeRunnerEngine *vm) - : ScriptBase(vm) - {} + : ScriptBase(vm) { + } void SCRIPT_Initialize_Game(); diff --git a/engines/bladerunner/script/ps15.cpp b/engines/bladerunner/script/ps15.cpp index 3e8224a07a..5200d89f7c 100644 --- a/engines/bladerunner/script/ps15.cpp +++ b/engines/bladerunner/script/ps15.cpp @@ -131,7 +131,6 @@ bool ScriptPS15::ClickedOn2DRegion(int region) { } void ScriptPS15::SceneFrameAdvanced(int frame) { - } void ScriptPS15::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -166,7 +165,6 @@ void ScriptPS15::PlayerWalkedIn() { } void ScriptPS15::PlayerWalkedOut() { - } void ScriptPS15::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 9f4f5392ef..216428c2f8 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -84,7 +84,7 @@ void Script::SceneLoaded() { bool Script::MouseClick(int x, int y) { if (_inScriptCounter > 0) return true; - + _inScriptCounter++; //MouseX = x; //MouseY = y; @@ -434,7 +434,7 @@ 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); @@ -1080,7 +1080,7 @@ void ScriptBase::Combat_Flee_Waypoint_Set_Data(int combatFleeWaypointId, int a2, 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 @@ -1184,7 +1184,7 @@ bool ScriptBase::Voight_Kampff_Activate(int a1, int a2){ int ScriptBase::Elevator_Activate(int elevator) { //TODO warning("Elevator_Activate(%d)", elevator); - return 0; + return 0; } void ScriptBase::View_Score_Board() { @@ -1387,10 +1387,7 @@ void ScriptBase::ESPER_Define_Special_Region(int a1, int a2, int a3, int a4, int 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) -{ +AIScripts::AIScripts(BladeRunnerEngine *vm) : _vm(vm), _inScriptCounter(0) { for (int i = 0; i != 100; ++i) _AIScripts[i] = 0; @@ -1398,22 +1395,19 @@ AIScripts::AIScripts(BladeRunnerEngine *vm) _AIScripts[23] = new AIScript_Officer_Leroy(_vm); } -void AIScripts::Initialize(int actor) -{ +void AIScripts::Initialize(int actor) { if (_AIScripts[actor]) _AIScripts[actor]->Initialize(); } -void AIScripts::UpdateAnimation(int actor, int *animation, int *frame) -{ +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) -{ +void AIScripts::ChangeAnimationMode(int actor, int mode) { _inScriptCounter++; if (_AIScripts[actor]) _AIScripts[actor]->ChangeAnimationMode(mode); diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index 914462a3a4..0e4c0e9f62 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -34,11 +34,8 @@ protected: BladeRunnerEngine *_vm; public: - ScriptBase(BladeRunnerEngine *vm) - : _vm(vm) - {} - virtual ~ScriptBase() - {} + ScriptBase(BladeRunnerEngine *vm) : _vm(vm) {} + virtual ~ScriptBase() {} protected: void Preload(int animationId); @@ -285,9 +282,7 @@ protected: class SceneScriptBase : public ScriptBase { public: - SceneScriptBase(BladeRunnerEngine *vm) - : ScriptBase(vm) - {} + SceneScriptBase(BladeRunnerEngine *vm) : ScriptBase(vm) {} virtual void InitializeScene() = 0; virtual void SceneLoaded() = 0; @@ -317,8 +312,8 @@ public: Script(BladeRunnerEngine *vm) : _vm(vm), _inScriptCounter(0), - _currentScript(nullptr) - {} + _currentScript(nullptr) { + } ~Script(); bool open(const Common::String &name); @@ -327,10 +322,10 @@ public: void SceneLoaded(); bool MouseClick(int x, int y); bool ClickedOn3DObject(const char *objectName, bool a2); - bool ClickedOnActor(int actorId); + bool ClickedOnActor(int actorId); bool ClickedOnItem(int itemId, bool a2); - bool ClickedOnExit(int exitId); - bool ClickedOn2DRegion(int region); + bool ClickedOnExit(int exitId); + bool ClickedOn2DRegion(int region); void SceneFrameAdvanced(int frame); void ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet); void PlayerWalkedIn(); @@ -817,9 +812,7 @@ END_SCRIPT class AIScriptBase : public ScriptBase { public: - AIScriptBase(BladeRunnerEngine *vm) - : ScriptBase(vm) - {} + AIScriptBase(BladeRunnerEngine *vm) : ScriptBase(vm) {} virtual void Initialize() = 0; virtual bool Update() = 0; diff --git a/engines/bladerunner/script/ug03.cpp b/engines/bladerunner/script/ug03.cpp index fa413175e3..89c142dcb5 100644 --- a/engines/bladerunner/script/ug03.cpp +++ b/engines/bladerunner/script/ug03.cpp @@ -128,7 +128,6 @@ bool ScriptUG03::ClickedOn2DRegion(int region) { } void ScriptUG03::SceneFrameAdvanced(int frame) { - } void ScriptUG03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { diff --git a/engines/bladerunner/script/ug15.cpp b/engines/bladerunner/script/ug15.cpp index c202e4f428..c43288241d 100644 --- a/engines/bladerunner/script/ug15.cpp +++ b/engines/bladerunner/script/ug15.cpp @@ -195,7 +195,6 @@ void ScriptUG15::PlayerWalkedIn() { } void ScriptUG15::PlayerWalkedOut() { - } void ScriptUG15::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/script/ug18.cpp b/engines/bladerunner/script/ug18.cpp index 3ba8223500..215d447a85 100644 --- a/engines/bladerunner/script/ug18.cpp +++ b/engines/bladerunner/script/ug18.cpp @@ -127,7 +127,6 @@ bool ScriptUG18::ClickedOn2DRegion(int region) { } void ScriptUG18::SceneFrameAdvanced(int frame) { - } void ScriptUG18::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) { @@ -186,7 +185,6 @@ void ScriptUG18::PlayerWalkedIn() { } void ScriptUG18::PlayerWalkedOut() { - } void ScriptUG18::DialogueQueueFlushed(int a1) { diff --git a/engines/bladerunner/set_effects.h b/engines/bladerunner/set_effects.h index 199009fc26..1e041ad1d4 100644 --- a/engines/bladerunner/set_effects.h +++ b/engines/bladerunner/set_effects.h @@ -31,8 +31,7 @@ namespace BladeRunner { -class SetEffects -{ +class SetEffects { BladeRunnerEngine *_vm; private: @@ -61,7 +60,7 @@ public: void calculateColor(Vector3 viewPosition, Vector3 position, float *outCoeficient, Color *outColor); private: - Fog* findFog(const char* fogName); + Fog *findFog(const char* fogName); }; diff --git a/engines/bladerunner/settings.cpp b/engines/bladerunner/settings.cpp index daf876c40b..679db5193e 100644 --- a/engines/bladerunner/settings.cpp +++ b/engines/bladerunner/settings.cpp @@ -30,9 +30,7 @@ namespace BladeRunner { -Settings::Settings(BladeRunnerEngine *vm) - : _vm(vm) -{ +Settings::Settings(BladeRunnerEngine *vm) : _vm(vm) { _chapter = 1; _gamma = 1.0f; diff --git a/engines/bladerunner/shape.cpp b/engines/bladerunner/shape.cpp index 4f5a826872..59fc103ccc 100644 --- a/engines/bladerunner/shape.cpp +++ b/engines/bladerunner/shape.cpp @@ -33,8 +33,7 @@ namespace BladeRunner { Shape::Shape(BladeRunnerEngine *vm) - : _vm(vm), _data(0) -{ + : _vm(vm), _data(0) { } Shape::~Shape() { @@ -125,7 +124,7 @@ void Shape::draw(Graphics::Surface &surface, int x, int y) { } src_p += 2 * (_width - rect_w); - dst_p += surface.pitch - 2*rect_w; + dst_p += surface.pitch - 2 * rect_w; } } diff --git a/engines/bladerunner/slice_animations.h b/engines/bladerunner/slice_animations.h index 0abdfb1ce0..bed4271c88 100644 --- a/engines/bladerunner/slice_animations.h +++ b/engines/bladerunner/slice_animations.h @@ -46,8 +46,7 @@ struct SlicePalette { class SliceAnimations { friend class SliceRenderer; - struct Animation - { + struct Animation { uint32 frameCount; uint32 frameSize; float fps; @@ -60,9 +59,7 @@ class SliceAnimations { void *_data; uint32 _lastAccess; - Page() - : _data(nullptr) - {} + Page() : _data(nullptr) {} }; struct PageFile { @@ -70,9 +67,7 @@ class SliceAnimations { Common::File _file; Common::Array _pageOffsets; - PageFile(SliceAnimations *sliceAnimations) - : _sliceAnimations(sliceAnimations) - {} + PageFile(SliceAnimations *sliceAnimations) : _sliceAnimations(sliceAnimations) {} bool open(const Common::String &name); void *loadPage(uint32 page); @@ -96,8 +91,8 @@ public: SliceAnimations(BladeRunnerEngine *vm) : _vm(vm), _coreAnimPageFile(this), - _framesPageFile(this) - {} + _framesPageFile(this) { + } ~SliceAnimations(); bool open(const Common::String &name); diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp index cf42f80294..0972598eca 100644 --- a/engines/bladerunner/slice_renderer.cpp +++ b/engines/bladerunner/slice_renderer.cpp @@ -218,10 +218,8 @@ void SliceRenderer::calculateBoundingRect() { 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) - { + 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); @@ -275,11 +273,10 @@ struct SliceLineIterator { }; void SliceLineIterator::setup( - float endScreenX, float endScreenY, float endScreenZ, - float startScreenX, float startScreenY, float startScreenZ, - float endSlice, float startSlice, - Matrix3x2 m) -{ + float endScreenX, float endScreenY, float endScreenZ, + float startScreenX, float startScreenY, float startScreenZ, + float endSlice, float startSlice, + Matrix3x2 m) { _startY = (int)startScreenY; _endY = (int)endScreenY; @@ -337,8 +334,7 @@ void SliceLineIterator::advance() { _sliceMatrix[1][2] += _field_38; } -static -void setupLookupTable(int t[256], int inc) { +static void setupLookupTable(int t[256], int inc) { int v = 0; for (int i = 0; i != 256; ++i) { t[i] = v; @@ -363,7 +359,7 @@ void SliceRenderer::drawFrame(int animationId, int animationFrame, Vector3 posit ); SliceRendererLights sliceRendererLights = SliceRendererLights(_lights); - + _lights->setupFrame(_view._frame); _setEffects->setupFrame(_view._frame); @@ -373,7 +369,7 @@ void SliceRenderer::drawFrame(int animationId, int animationFrame, Vector3 posit 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( diff --git a/engines/bladerunner/slice_renderer.h b/engines/bladerunner/slice_renderer.h index 9cbd3cec01..c1c0dc4603 100644 --- a/engines/bladerunner/slice_renderer.h +++ b/engines/bladerunner/slice_renderer.h @@ -31,7 +31,7 @@ #include "graphics/surface.h" namespace Common { - class MemoryReadStream; +class MemoryReadStream; } namespace BladeRunner { @@ -115,7 +115,8 @@ private: float _hmm[20]; float _hmm2[20]; int _hmm3; - public: + + public: Color _finalColor; public: diff --git a/engines/bladerunner/text_resource.cpp b/engines/bladerunner/text_resource.cpp index 801808d7d1..03460d039f 100644 --- a/engines/bladerunner/text_resource.cpp +++ b/engines/bladerunner/text_resource.cpp @@ -30,9 +30,7 @@ namespace BladeRunner { -TextResource::TextResource(BladeRunnerEngine *vm) - : _vm(vm) -{ +TextResource::TextResource(BladeRunnerEngine *vm) : _vm(vm) { _count = 0; _ids = nullptr; _offsets = nullptr; diff --git a/engines/bladerunner/vector.h b/engines/bladerunner/vector.h index 80fd5f8e14..070ca86190 100644 --- a/engines/bladerunner/vector.h +++ b/engines/bladerunner/vector.h @@ -27,35 +27,25 @@ namespace BladeRunner { -class Vector2 -{ +class Vector2 { public: float x; float y; - Vector2() - : x(0.0), y(0.0) - {} + Vector2() : x(0.0), y(0.0) {} - Vector2(float ax, float ay) - : x(ax), y(ay) - {} + Vector2(float ax, float ay) : x(ax), y(ay) {} }; -class Vector3 -{ +class Vector3 { public: float x; float y; float z; - Vector3() - : x(0.0), y(0.0), z(0.0) - {} + Vector3() : x(0.0), y(0.0), z(0.0) {} - Vector3(float ax, float ay, float az) - : x(ax), y(ay), z(az) - {} + 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() { @@ -74,68 +64,47 @@ public: } }; -inline -Vector3 operator+(Vector3 a, Vector3 b) -{ +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) -{ +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) -{ +inline Vector3 operator*(float f, Vector3 v) { return Vector3(f * v.x, f * v.y, f * v.z); } -class Vector4 -{ +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() : 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) - {} + Vector4(float ax, float ay, float az, float aw) : x(ax), y(ay), z(az), w(aw) {} }; -inline -Vector4 operator+(Vector4 a, Vector4 b) -{ +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) -{ +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) -{ +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) -{ +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) -{ +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); } diff --git a/engines/bladerunner/view.h b/engines/bladerunner/view.h index bb92dc1429..eb68aa9eb6 100644 --- a/engines/bladerunner/view.h +++ b/engines/bladerunner/view.h @@ -26,7 +26,7 @@ #include "matrix.h" namespace Common { - class ReadStream; +class ReadStream; } namespace BladeRunner { diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp index df1b4f4641..940f53ee25 100644 --- a/engines/bladerunner/vqa_decoder.cpp +++ b/engines/bladerunner/vqa_decoder.cpp @@ -81,8 +81,7 @@ int32 remain(Common::SeekableReadStream *s) { return size - pos; } -struct IFFChunkHeader -{ +struct IFFChunkHeader { IFFChunkHeader() : id(0), size(0) {} @@ -91,9 +90,7 @@ struct IFFChunkHeader uint32 size; }; -static -bool readIFFChunkHeader(Common::SeekableReadStream *s, IFFChunkHeader *ts) -{ +static bool readIFFChunkHeader(Common::SeekableReadStream *s, IFFChunkHeader *ts) { if (remain(s) < 8) return false; @@ -103,13 +100,11 @@ bool readIFFChunkHeader(Common::SeekableReadStream *s, IFFChunkHeader *ts) return true; } -static inline uint32 roundup(uint32 v) -{ +static inline uint32 roundup(uint32 v) { return (v + 1) & ~1u; } -const char *strTag(uint32 tag) -{ +const char *strTag(uint32 tag) { static char s[5]; sprintf(s, "%c%c%c%c", @@ -121,15 +116,13 @@ const char *strTag(uint32 tag) return s; } -VQADecoder::VQADecoder() - : _s(nullptr), +VQADecoder::VQADecoder() : _s(nullptr), _frameInfo(nullptr), _videoTrack(nullptr), _audioTrack(nullptr), _maxVIEWChunkSize(0), _maxZBUFChunkSize(0), - _maxAESCChunkSize(0) -{ + _maxAESCChunkSize(0) { } VQADecoder::~VQADecoder() { @@ -160,20 +153,19 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *s) { 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; + 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) { @@ -209,13 +201,11 @@ Audio::SeekableAudioStream *VQADecoder::decodeAudioFrame() { return _audioTrack->decodeAudioFrame(); } -void VQADecoder::decodeView(View* view) -{ +void VQADecoder::decodeView(View *view) { _videoTrack->decodeView(view); } -void VQADecoder::decodeLights(Lights *lights) -{ +void VQADecoder::decodeLights(Lights *lights) { _videoTrack->decodeLights(lights); } @@ -235,20 +225,20 @@ void VQADecoder::readNextPacket() { 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; + // 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; + default: + _s->skip(roundup(chd.size)); + rc = false; } if (!rc) { @@ -268,8 +258,7 @@ void VQADecoder::readPacket(int frame) { readNextPacket(); } -bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) { if (size != 42) return false; @@ -295,14 +284,12 @@ bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) _header.maxCBFZSize = s->readUint32LE(); _header.unk5 = s->readUint32LE(); - if (_header.offsetX || _header.offsetY) - { + 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) - { + if (false) { debug("_header.version %d", _header.version); debug("_header.flags %04x", _header.flags); debug("_header.numFrames %d", _header.numFrames); @@ -338,27 +325,23 @@ bool VQADecoder::readVQHD(Common::SeekableReadStream *s, uint32 size) return true; } -bool VQADecoder::VQAVideoTrack::readVQFR(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::VQAVideoTrack::readVQFR(Common::SeekableReadStream *s, uint32 size) { IFFChunkHeader chd; - while (size >= 8) - { + while (size >= 8) { if (!readIFFChunkHeader(s, &chd)) return false; size -= roundup(chd.size) + 8; bool rc = false; - switch (chd.id) - { + 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) - { + if (!rc) { debug("VQFR: error handling chunk %s", strTag(chd.id)); return false; } @@ -367,8 +350,7 @@ bool VQADecoder::VQAVideoTrack::readVQFR(Common::SeekableReadStream *s, uint32 s return true; } -bool VQADecoder::readMSCI(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readMSCI(Common::SeekableReadStream *s, uint32 size) { IFFChunkHeader chd; readIFFChunkHeader(_s, &chd); @@ -384,14 +366,12 @@ bool VQADecoder::readMSCI(Common::SeekableReadStream *s, uint32 size) if (chd.id != kMSCT || chd.size != count * 0x10) return false; - for (uint32 i = 0; i < count; ++i) - { + for (uint32 i = 0; i < count; ++i) { uint32 tag, max_size; tag = s->readUint32BE(); max_size = s->readUint32LE(); - switch (tag) - { + switch (tag) { case kVIEW: _maxVIEWChunkSize = max_size; break; @@ -413,8 +393,7 @@ bool VQADecoder::readMSCI(Common::SeekableReadStream *s, uint32 size) return true; } -bool VQADecoder::readLINF(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readLINF(Common::SeekableReadStream *s, uint32 size) { IFFChunkHeader chd; readIFFChunkHeader(_s, &chd); @@ -432,8 +411,7 @@ bool VQADecoder::readLINF(Common::SeekableReadStream *s, uint32 size) return false; _loopInfo.loops = new Loop[_loopInfo.loopCount]; - for (int i = 0; i != _loopInfo.loopCount; ++i) - { + for (int i = 0; i != _loopInfo.loopCount; ++i) { _loopInfo.loops[i].begin = s->readUint16LE(); _loopInfo.loops[i].end = s->readUint16LE(); @@ -443,8 +421,7 @@ bool VQADecoder::readLINF(Common::SeekableReadStream *s, uint32 size) return true; } -bool VQADecoder::readCINF(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readCINF(Common::SeekableReadStream *s, uint32 size) { IFFChunkHeader chd; readIFFChunkHeader(_s, &chd); @@ -458,8 +435,7 @@ bool VQADecoder::readCINF(Common::SeekableReadStream *s, uint32 size) if (chd.id != kCIND || chd.size != 6u * _clipInfo.clipCount) return false; - for (int i = 0; i != _clipInfo.clipCount; ++i) - { + for (int i = 0; i != _clipInfo.clipCount; ++i) { uint16 a; uint32 b; a = s->readUint16LE(); @@ -469,8 +445,7 @@ bool VQADecoder::readCINF(Common::SeekableReadStream *s, uint32 size) return true; } -bool VQADecoder::readFINF(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readFINF(Common::SeekableReadStream *s, uint32 size) { if (size != 4u * _header.numFrames) return false; @@ -481,8 +456,7 @@ bool VQADecoder::readFINF(Common::SeekableReadStream *s, uint32 size) if (false) { uint32 last = 0; - for (uint32 i = 0; i != _header.numFrames; ++i) - { + 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]; @@ -492,8 +466,7 @@ bool VQADecoder::readFINF(Common::SeekableReadStream *s, uint32 size) return true; } -bool VQADecoder::readLNIN(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::readLNIN(Common::SeekableReadStream *s, uint32 size) { IFFChunkHeader chd; readIFFChunkHeader(_s, &chd); @@ -696,42 +669,34 @@ bool VQADecoder::VQAVideoTrack::readCBFZ(Common::SeekableReadStream *s, uint32 s return true; } -static -int decodeZBUF_partial(uint8 *src, uint16 *curZBUF, uint32 srcLen) -{ +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) - { + while (dstRemain && (inp - (uint16*)src) < (std::ptrdiff_t)srcLen) { uint32 count = FROM_LE_16(*inp++); - if (count & 0x8000) - { + if (count & 0x8000) { count = MIN(count & 0x7fff, dstRemain); dstRemain -= count; - while (count--) - { + while (count--) { uint16 value = FROM_LE_16(*inp++); if (value) *curzp = value; ++curzp; } - } - else - { + } else { count = MIN(count, dstRemain); dstRemain -= count; uint16 value = FROM_LE_16(*inp++); - if (!value) + if (!value) { curzp += count; - else - { + } else { while (count--) *curzp++ = value; } @@ -740,8 +705,7 @@ int decodeZBUF_partial(uint8 *src, uint16 *curZBUF, uint32 srcLen) return dstSize - dstRemain; } -bool VQADecoder::VQAVideoTrack::readZBUF(Common::SeekableReadStream *s, uint32 size) -{ +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)); @@ -756,8 +720,7 @@ bool VQADecoder::VQAVideoTrack::readZBUF(Common::SeekableReadStream *s, uint32 s uint32 remain = size - 16; - if (_width != width || _height != height) - { + if (_width != width || _height != height) { debug("%d, %d, %d, %d", width, height, complete, unk0); s->skip(roundup(remain)); return false; @@ -770,8 +733,7 @@ bool VQADecoder::VQAVideoTrack::readZBUF(Common::SeekableReadStream *s, uint32 s return true; } -const uint16 *VQADecoder::VQAVideoTrack::decodeZBuffer() -{ +const uint16 *VQADecoder::VQAVideoTrack::decodeZBuffer() { if (_maxZBUFChunkSize == 0) return nullptr; @@ -788,8 +750,7 @@ const uint16 *VQADecoder::VQAVideoTrack::decodeZBuffer() return _zbuffer; } -bool VQADecoder::VQAVideoTrack::readVIEW(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::VQAVideoTrack::readVIEW(Common::SeekableReadStream *s, uint32 size) { if (size != 56) return false; @@ -805,8 +766,7 @@ bool VQADecoder::VQAVideoTrack::readVIEW(Common::SeekableReadStream *s, uint32 s return true; } -void VQADecoder::VQAVideoTrack::decodeView(View* view) -{ +void VQADecoder::VQAVideoTrack::decodeView(View *view) { if (!view || !_viewData) return; @@ -817,16 +777,14 @@ void VQADecoder::VQAVideoTrack::decodeView(View* view) _viewData = nullptr; } -bool VQADecoder::VQAVideoTrack::readAESC(Common::SeekableReadStream *s, uint32 size) -{ +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) -{ +bool VQADecoder::VQAVideoTrack::readLITE(Common::SeekableReadStream *s, uint32 size) { if (_lightsData) { delete[] _lightsData; _lightsData = nullptr; @@ -840,8 +798,7 @@ bool VQADecoder::VQAVideoTrack::readLITE(Common::SeekableReadStream *s, uint32 s } -void VQADecoder::VQAVideoTrack::decodeLights(Lights *lights) -{ +void VQADecoder::VQAVideoTrack::decodeLights(Lights *lights) { if (!lights || !_lightsData) return; @@ -853,8 +810,7 @@ void VQADecoder::VQAVideoTrack::decodeLights(Lights *lights) } -bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 size) { if (size > _maxVPTRSize) return false; @@ -869,8 +825,7 @@ bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 s return true; } -void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha) -{ +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; @@ -881,8 +836,7 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBl int blocks_per_line = frame_width / block_width; - do - { + do { uint32 frame_x = dstBlock % blocks_per_line * block_width + _offsetX / 2; uint32 frame_y = dstBlock / blocks_per_line * block_height + _offsetY; @@ -892,11 +846,9 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBl uint16 *__restrict dst = frame + dst_offset; unsigned int block_y; - for (block_y = 0; block_y != block_height; ++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) - { + for (block_x = 0; block_x != block_width; ++block_x) { uint16 rgb555 = src[0] | (src[1] << 8); src += 2; @@ -908,12 +860,10 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBl } ++dstBlock; - } - while (--count); + } while (--count); } -bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) -{ +bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) { if (!_codebook || !_vpointer) return false; @@ -923,14 +873,12 @@ bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) uint16 count, srcBlock, dstBlock = 0; (void)srcBlock; - while (end - src >= 2) - { + while (end - src >= 2) { uint16 command = src[0] | (src[1] << 8); uint8 prefix = command >> 13; src += 2; - switch (prefix) - { + switch (prefix) { case 0: count = command & 0x1fff; dstBlock += count; @@ -949,8 +897,7 @@ bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) VPTRWriteBlock(frame, dstBlock, srcBlock, 1); ++dstBlock; - for (int i = 0; i < count; ++i) - { + for (int i = 0; i < count; ++i) { srcBlock = *src++; VPTRWriteBlock(frame, dstBlock, srcBlock, 1); ++dstBlock; @@ -998,8 +945,7 @@ Audio::SeekableAudioStream *VQADecoder::VQAAudioTrack::decodeAudioFrame() { return Audio::makeRawStream((byte*)audioFrame, 4 * 735, _frequency, flags, DisposeAfterUse::YES); } -bool VQADecoder::VQAAudioTrack::readSND2(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::VQAAudioTrack::readSND2(Common::SeekableReadStream *s, uint32 size) { if (size != 735) { warning("audio frame size: %d", size); return false; @@ -1010,8 +956,7 @@ bool VQADecoder::VQAAudioTrack::readSND2(Common::SeekableReadStream *s, uint32 s return true; } -bool VQADecoder::VQAAudioTrack::readSN2J(Common::SeekableReadStream *s, uint32 size) -{ +bool VQADecoder::VQAAudioTrack::readSN2J(Common::SeekableReadStream *s, uint32 size) { if (size != 6) return false; diff --git a/engines/bladerunner/vqa_decoder.h b/engines/bladerunner/vqa_decoder.h index eb486c8413..7863afaff0 100644 --- a/engines/bladerunner/vqa_decoder.h +++ b/engines/bladerunner/vqa_decoder.h @@ -41,8 +41,7 @@ namespace BladeRunner { class Lights; class View; -class VQADecoder -{ +class VQADecoder { public: VQADecoder(); ~VQADecoder(); @@ -72,8 +71,7 @@ public: protected: private: - struct Header - { + struct Header { uint16 version; // 0x00 uint16 flags; // 0x02 uint16 numFrames; // 0x04 @@ -109,23 +107,18 @@ private: {} }; - struct LoopInfo - { + struct LoopInfo { uint16 loopCount; uint32 flags; Loop *loops; - LoopInfo() - : loopCount(0), - loops(nullptr) - {} + LoopInfo() : loopCount(0), loops(nullptr) {} ~LoopInfo() { delete[] loops; } }; - struct ClipInfo - { + struct ClipInfo { uint16 clipCount; }; diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp index 4d948fd2ac..f875b84cce 100644 --- a/engines/bladerunner/vqa_player.cpp +++ b/engines/bladerunner/vqa_player.cpp @@ -113,13 +113,11 @@ const uint16 *VQAPlayer::getZBuffer() const { return _zBuffer; } -void VQAPlayer::updateView(View* view) -{ +void VQAPlayer::updateView(View *view) { _decoder.decodeView(view); } -void VQAPlayer::updateLights(Lights* lights) -{ +void VQAPlayer::updateLights(Lights *lights) { _decoder.decodeLights(lights); } diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h index 0acbb35ee4..f5769944cf 100644 --- a/engines/bladerunner/vqa_player.h +++ b/engines/bladerunner/vqa_player.h @@ -69,8 +69,8 @@ public: _loopEnd(-1), _nextFrameTime(0), _hasAudio(false), - _audioStarted(false) - {} + _audioStarted(false) { + } ~VQAPlayer() { close(); diff --git a/engines/bladerunner/waypoints.cpp b/engines/bladerunner/waypoints.cpp index 3530da7f5e..2d7fd19aaa 100644 --- a/engines/bladerunner/waypoints.cpp +++ b/engines/bladerunner/waypoints.cpp @@ -23,7 +23,7 @@ #include "bladerunner/waypoints.h" namespace BladeRunner { -Waypoints::Waypoints(BladeRunnerEngine* vm, int count) { +Waypoints::Waypoints(BladeRunnerEngine *vm, int count) { _count = count; _waypoints = new Waypoint[count]; } -- cgit v1.2.3