diff options
author | strangerke | 2011-03-10 01:32:03 +0100 |
---|---|---|
committer | strangerke | 2011-03-10 01:32:03 +0100 |
commit | fae2be668fb235c5f145276f98f264c254410d7e (patch) | |
tree | 537d04a49cf896bb78e35555ef6287637fb57bed /engines | |
parent | cf657d09e84f41ff8234f26e6086c48dfb2e8fb4 (diff) | |
download | scummvm-rg350-fae2be668fb235c5f145276f98f264c254410d7e.tar.gz scummvm-rg350-fae2be668fb235c5f145276f98f264c254410d7e.tar.bz2 scummvm-rg350-fae2be668fb235c5f145276f98f264c254410d7e.zip |
TOON: Cleanup
Diffstat (limited to 'engines')
-rw-r--r-- | engines/toon/anim.cpp | 14 | ||||
-rw-r--r-- | engines/toon/audio.cpp | 5 | ||||
-rw-r--r-- | engines/toon/character.cpp | 39 | ||||
-rw-r--r-- | engines/toon/character.h | 2 | ||||
-rw-r--r-- | engines/toon/conversation.cpp | 1 | ||||
-rw-r--r-- | engines/toon/drew.cpp | 1 | ||||
-rw-r--r-- | engines/toon/drew.h | 2 | ||||
-rw-r--r-- | engines/toon/flux.h | 1 | ||||
-rw-r--r-- | engines/toon/font.cpp | 4 | ||||
-rw-r--r-- | engines/toon/hotspot.cpp | 4 | ||||
-rw-r--r-- | engines/toon/movie.cpp | 8 | ||||
-rw-r--r-- | engines/toon/path.cpp | 9 | ||||
-rw-r--r-- | engines/toon/path.h | 1 | ||||
-rw-r--r-- | engines/toon/picture.cpp | 11 | ||||
-rw-r--r-- | engines/toon/resource.cpp | 4 | ||||
-rw-r--r-- | engines/toon/script.cpp | 3 | ||||
-rw-r--r-- | engines/toon/script.h | 1 | ||||
-rw-r--r-- | engines/toon/script_func.cpp | 9 | ||||
-rw-r--r-- | engines/toon/state.cpp | 1 | ||||
-rw-r--r-- | engines/toon/state.h | 2 | ||||
-rw-r--r-- | engines/toon/tools.cpp | 6 | ||||
-rw-r--r-- | engines/toon/tools.h | 4 | ||||
-rw-r--r-- | engines/toon/toon.cpp | 158 | ||||
-rw-r--r-- | engines/toon/toon.h | 2 |
24 files changed, 62 insertions, 230 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index 3ab69d8574..6004aacead 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -214,18 +214,14 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram int32 finalWidth = rectX * scale / 1024; int32 finalHeight = rectY * scale / 1024; - - // compute final x1,y1,x2,y2 + // compute final x1, y1, x2, y2 int32 xx1 = xx + _x1 + _frames[frame]._x1 * scale / 1024; int32 yy1 = yy + _y1 + _frames[frame]._y1 * scale / 1024; int32 xx2 = xx1 + finalWidth; int32 yy2 = yy1 + finalHeight; int32 w = _frames[frame]._x2 - _frames[frame]._x1; -// Strangerke - Commented (not used) -// int32 h = _frames[frame]._y2 - _frames[frame]._y1; - - _vm->addDirtyRect(xx1,yy1,xx2,yy2); + _vm->addDirtyRect(xx1, yy1, xx2, yy2); int32 destPitch = surface.pitch; int32 destPitchMask = mask->getWidth(); @@ -448,7 +444,6 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type) _layerZ = 0; } - void AnimationInstance::render() { debugC(5, kDebugAnim, "render()"); if (_visible && _animation) { @@ -580,7 +575,7 @@ void AnimationInstance::getRect(int32 *x1, int32 *y1, int32 *x2, int32 *y2) cons int32 finalWidth = rectX * _scale / 1024; int32 finalHeight = rectY * _scale / 1024; - // compute final x1,y1,x2,y2 + // compute final x1, y1, x2, y2 *x1 = _x + _animation->_x1 + _animation->_frames[_currentFrame]._x1 * _scale / 1024; *y1 = _y + _animation->_y1 + _animation->_frames[_currentFrame]._y1 * _scale / 1024; *x2 = *x1 + finalWidth; @@ -671,8 +666,6 @@ void AnimationInstance::load(Common::ReadStream *stream) { _useMask = stream->readSint32LE(); } - - void AnimationInstance::setLooping(bool enable) { debugC(6, kDebugAnim, "setLooping(%d)", (enable) ? 1 : 0); _looping = enable; @@ -723,7 +716,6 @@ void AnimationManager::addInstance(AnimationInstance *instance) { } else { _instances.insert_at(found, instance); } - } void AnimationManager::removeInstance(AnimationInstance *instance) { diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp index 9f1c316469..d76a63c1ae 100644 --- a/engines/toon/audio.cpp +++ b/engines/toon/audio.cpp @@ -209,7 +209,6 @@ void AudioManager::stopCurrentVoice() { _channels[2]->stop(false); } - void AudioManager::closeAudioPack(int32 id) { delete _audioPacks[id]; _audioPacks[id] = NULL; @@ -616,7 +615,8 @@ void AudioManager::killAllAmbientSFX() void AudioManager::updateAmbientSFX() { - if (_vm->getMoviePlayer()->isPlaying()) return; + if (_vm->getMoviePlayer()->isPlaying()) + return; for (int32 i = 0; i < 4; i++) { AudioAmbientSFX* ambient = &_ambientSFXs[i]; @@ -635,6 +635,5 @@ void AudioManager::updateAmbientSFX() } } - } // End of namespace Toon diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 31af1513df..a1bd3334c5 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -125,14 +125,13 @@ void Character::setFacing(int32 facing) { if (_currentPathNode == 0) playStandingAnim(); else - playWalkAnim(0,0); + playWalkAnim(0, 0); _vm->doFrame(); }; _flags &= ~2; } - _facing = facing; } @@ -140,7 +139,7 @@ void Character::forcePosition(int32 x, int32 y) { debugC(5, kDebugCharacter, "forcePosition(%d, %d)", x, y); - setPosition(x,y); + setPosition(x, y); _finalX = x; _finalY = y; } @@ -176,7 +175,6 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) { if (_x == _finalX && _y == _finalY) return true; - if (_vm->getPathFinding()->findPath(_x, _y, _finalX, _finalY)) { int32 localFinalX = _finalX; @@ -327,11 +325,6 @@ void Character::updateTimers(int32 relativeAdd) { void Character::stopSpecialAnim() { debugC(4, kDebugCharacter, "stopSpecialAnim()"); -// Strangerke - Commented (not used) -#if 0 - if (_animSpecialId != _animSpecialDefaultId) - delete anim; -#endif if (_animScriptId != -1) _vm->getSceneAnimationScript(_animScriptId)->_frozenForConversation = false; @@ -388,7 +381,6 @@ void Character::update(int32 timeIncrement) { if ((_flags & 4) == 0) return; - if (_animScriptId != -1) { _animationInstance = _vm->getSceneAnimation(this->) #endif @@ -423,19 +415,9 @@ void Character::update(int32 timeIncrement) { return; } -// Strangerke - Commented (not used) -#if 0 - if (_animFlags & 8) { - if (anim->_flags7 == 0xff && anim->_flags9 == 0xff) { - // start voice - } - } -#endif - if (_animScriptId != -1) _vm->getSceneAnimationScript(_animScriptId)->_frozenForConversation = true; - // TODO setup backup // _animFlags |= 0x10; @@ -494,17 +476,6 @@ void Character::update(int32 timeIncrement) { } } else { nextFrame = currentFrame + 1; -// Strangerke - Commented (not used) -#if 0 - if (!_vm->getAudioManager()->voiceStillPlaying()) { - if (_animFlags & 8) { - if ((anim->_flags9 == 0xff && nextFrame == anim->_flags6) || - (anim->_flags9 != 0xff && nextFrame >= anim->_flags9)) { - // start really talking - } - } - } -#endif if (nextFrame == anim->_flags7 + 1 && (_animFlags & 0x40) == 0) { if (anim->_flags8 != 1 && (_vm->randRange(0, 1) || anim->_flags8 == 2)) { _animFlags |= 0x20; @@ -525,7 +496,6 @@ void Character::update(int32 timeIncrement) { //label78 - #if 0 if (_id == 0) debug(" drew animation name %s / flag %d / frame %d", _specialAnim->_name, _animFlags, nextFrame); @@ -611,7 +581,6 @@ int32 Character::getScale() { } void Character::playWalkAnim(int32 startFrame, int32 endFrame) { - } void Character::setId(int32 id) { @@ -677,7 +646,6 @@ int32 Character::getAnimScript() { } void Character::playTalkAnim() { - } void Character::stopWalk() { @@ -1046,7 +1014,6 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { *strchr(animName, '?') = '0' + facing; strcat(animName, ".CAF"); - if (_animScriptId != -1 && (flags & 8) == 0) _vm->getSceneAnimationScript(_animScriptId)->_frozenForConversation = true; @@ -1068,11 +1035,9 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { } } - if (_sceneAnimationId > -1) setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance); - _animFlags |= flags; delete _specialAnim; diff --git a/engines/toon/character.h b/engines/toon/character.h index d4079d82ef..e870d81813 100644 --- a/engines/toon/character.h +++ b/engines/toon/character.h @@ -49,7 +49,6 @@ struct SpecialCharacterAnimation { byte _flags9; // 25 }; - class Character { public: Character(ToonEngine *vm); @@ -106,7 +105,6 @@ public: int32 getFacingFromDirection(int32 dx, int32 dy); static const SpecialCharacterAnimation *getSpecialAnimation(int32 characterId, int32 animationId); - protected: ToonEngine *_vm; diff --git a/engines/toon/conversation.cpp b/engines/toon/conversation.cpp index 4678ccc1c8..fc846288ef 100644 --- a/engines/toon/conversation.cpp +++ b/engines/toon/conversation.cpp @@ -45,5 +45,4 @@ void Conversation::load(Common::ReadStream *stream, int16 *conversationDataBase) } } - } diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp index b2d271a417..4f8152833b 100644 --- a/engines/toon/drew.cpp +++ b/engines/toon/drew.cpp @@ -115,7 +115,6 @@ void CharacterDrew::update(int32 timeIncrement) { _scale = _currentScale; } setPosition(_x, _y); - } int32 CharacterDrew::getRandomIdleAnim() { diff --git a/engines/toon/drew.h b/engines/toon/drew.h index d8091f2225..f248e4aa51 100644 --- a/engines/toon/drew.h +++ b/engines/toon/drew.h @@ -28,7 +28,6 @@ #include "toon/character.h" - namespace Toon { class ToonEngine; @@ -46,7 +45,6 @@ public: int32 getRandomIdleAnim(); protected: int32 _currentScale; - }; } // End of namespace Toon diff --git a/engines/toon/flux.h b/engines/toon/flux.h index a90853cb02..136dedd415 100644 --- a/engines/toon/flux.h +++ b/engines/toon/flux.h @@ -26,7 +26,6 @@ #ifndef TOON_FLUX_H #define TOON_FLUX_H - #include "toon/character.h" class ToonEngine; diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp index 8ce4d32c37..4a60f02f29 100644 --- a/engines/toon/font.cpp +++ b/engines/toon/font.cpp @@ -81,7 +81,7 @@ void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 m x -= xx / 2; } - _vm->addDirtyRect(x,y,x+xx,y+yy); + _vm->addDirtyRect(x, y, x + xx, y + yy); int32 curX = x; int32 curY = y; @@ -272,8 +272,6 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText int32 curX = x; int32 curY = y; - - for (int32 i = 0; i < numLines; i++) { const byte *line = lines[i]; curX = x - lineSize[i] / 2; diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp index 687ea6ee83..df55eadd05 100644 --- a/engines/toon/hotspot.cpp +++ b/engines/toon/hotspot.cpp @@ -78,8 +78,6 @@ int32 Hotspots::Find(int32 x, int32 y) { debugC(6, kDebugHotspot, "Find(%d, %d)", x, y); int32 priority = -1; -// Strangerke - Commented (not used) -// bool found = false; int32 foundId = -1; int32 testId = -1; @@ -91,8 +89,6 @@ int32 Hotspots::Find(int32 x, int32 y) { testId = i; if (_items[testId].getPriority() > priority) { -// Strangerke - Commented (not used) -// found = true; foundId = testId; priority = _items[testId].getPriority(); } diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index 6d18d82954..4305abb62b 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -56,8 +56,6 @@ bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename) { return true; } - - return false; } @@ -107,9 +105,9 @@ bool Movie::playVideo(bool isFirstIntroVideo) { if (_decoder->isLowRes()) { // handle manually 2x scaling here Graphics::Surface* surf = _vm->getSystem()->lockScreen(); - for (int y = 0; y < frame->h/2; y++) { - memcpy(surf->getBasePtr(0, y*2+0), frame->getBasePtr(0, y), frame->pitch); - memcpy(surf->getBasePtr(0, y*2+1), frame->getBasePtr(0, y), frame->pitch); + for (int y = 0; y < frame->h / 2; y++) { + memcpy(surf->getBasePtr(0, y * 2 + 0), frame->getBasePtr(0, y), frame->pitch); + memcpy(surf->getBasePtr(0, y * 2 + 1), frame->getBasePtr(0, y), frame->pitch); } _vm->getSystem()->unlockScreen(); } else { diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp index 3f948679f4..e0cdf87502 100644 --- a/engines/toon/path.cpp +++ b/engines/toon/path.cpp @@ -186,7 +186,7 @@ int32 PathFinding::findClosestWalkingPoint(int32 xx, int32 yy, int32 *fxx, int32 for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { - if (isWalkable(x, y) && isLikelyWalkable(x,y)) { + if (isWalkable(x, y) && isLikelyWalkable(x, y)) { int32 ndist = (x - xx) * (x - xx) + (y - yy) * (y - yy); int32 ndist2 = (x - origX) * (x - origX) + (y - origY) * (y - origY); if (currentFound < 0 || ndist < dist || (ndist == dist && ndist2 < dist2)) { @@ -283,8 +283,8 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { } // first test direct line - if (lineIsWalkable(x,y,destx,desty)) { - walkLine(x,y,destx,desty); + if (lineIsWalkable(x, y, destx, desty)) { + walkLine(x, y, destx, desty); return true; } @@ -317,7 +317,7 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { int32 curPNode = px + py * _width; if (isWalkable(px, py)) { // walkable ? - int sum = sq[curNode] + wei * (1 + (isLikelyWalkable(px,py) ? 5 : 0)); + int sum = sq[curNode] + wei * (1 + (isLikelyWalkable(px, py) ? 5 : 0)); if (sq[curPNode] > sum || !sq[curPNode]) { int newWeight = abs(destx - px) + abs(desty - py); sq[curPNode] = sum; @@ -438,7 +438,6 @@ void PathFinding::addBlockingEllipse(int32 x1, int32 y1, int32 w, int32 h) { _numBlockingRects++; } - int32 PathFinding::getPathNodeCount() const { return _gridPathCount; } diff --git a/engines/toon/path.h b/engines/toon/path.h index a2b1b7bf92..03d2b188e5 100644 --- a/engines/toon/path.h +++ b/engines/toon/path.h @@ -91,7 +91,6 @@ protected: int32 _gridPathCount; ToonEngine *_vm; - }; } // End of namespace Toon diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp index 18701b7a48..a6ac177e82 100644 --- a/engines/toon/picture.cpp +++ b/engines/toon/picture.cpp @@ -23,7 +23,6 @@ * */ - #include "toon/picture.h" #include "toon/tools.h" #include "common/stack.h" @@ -69,7 +68,7 @@ bool Picture::loadPicture(Common::String file, bool totalPalette /*= false*/) { } case kCompSPCN: { uint32 decSize = READ_LE_UINT32(fileData + 10); - _data = new uint8[decSize+100]; + _data = new uint8[decSize + 100]; _paletteEntries = READ_LE_UINT16(fileData + 14) / 3; if (_paletteEntries) { @@ -219,10 +218,7 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int curRow += destPitch; c += srcPitch; } - } - - } void Picture::draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy) { @@ -317,7 +313,6 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable else t = adx; - int32 cdx = (dx << 16) / t; int32 cdy = (dy << 16) / t; @@ -331,11 +326,11 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable // were drawing outside the screen causing corruption if (!walkable) { _data[_width * ry + rx] &= 0xe0; - _data[_width * ry + rx+1] &= 0xe0; + _data[_width * ry + rx + 1] &= 0xe0; } else { int32 v = _data[_width * (by >> 16) + rx - 1]; _data[_width * ry + rx] = v; - _data[_width * ry + rx+1] = v; + _data[_width * ry + rx + 1] = v; } } diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp index 6c70b1598d..b29aa3b72d 100644 --- a/engines/toon/resource.cpp +++ b/engines/toon/resource.cpp @@ -29,7 +29,6 @@ #include "common/substream.h" #include "toon/toon.h" - namespace Toon { Resources::Resources(ToonEngine *vm) : _vm(vm), _cacheSize(0) { @@ -218,6 +217,7 @@ void Resources::purgeFileData() { } _allocatedFileData.clear(); } + Common::SeekableReadStream *PakFile::createReadStream(Common::String fileName) { debugC(1, kDebugResource, "createReadStream(%s)", fileName.c_str()); @@ -284,11 +284,9 @@ void PakFile::open(Common::SeekableReadStream *rs, Common::String packName) { } void PakFile::close() { - } PakFile::PakFile() { - } PakFile::~PakFile() { diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp index 3cd56761f6..376b1db621 100644 --- a/engines/toon/script.cpp +++ b/engines/toon/script.cpp @@ -23,7 +23,6 @@ * */ - #include "common/endian.h" #include "common/stream.h" #include "common/util.h" @@ -177,7 +176,7 @@ bool EMCInterpreter::start(EMCState *script, int function) { if (functionOffset == 0xFFFF) return false; - script->ip = &script->dataPtr->data[functionOffset+1]; + script->ip = &script->dataPtr->data[functionOffset + 1]; return true; } diff --git a/engines/toon/script.h b/engines/toon/script.h index 6c46238238..2a74f9084f 100644 --- a/engines/toon/script.h +++ b/engines/toon/script.h @@ -31,7 +31,6 @@ #include "common/func.h" #include "common/iff_container.h" - // Based on Kyra script interpretor namespace Toon { diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp index 4687b88af9..ab6493563d 100644 --- a/engines/toon/script_func.cpp +++ b/engines/toon/script_func.cpp @@ -265,7 +265,6 @@ int32 ScriptFunc::sys_Cmd_Draw_Actor_Standing(EMCState *state) { arg1 = 1; } - if (arg2 > -1) _vm->getDrew()->forceFacing(arg2); @@ -495,7 +494,7 @@ int32 ScriptFunc::sys_Cmd_Set_Anim_Scale_Size(EMCState *state) { SceneAnimation *sceneAnim = _vm->getSceneAnimation(animID); if (sceneAnim) { sceneAnim->_animInstance->setUseMask(true); - sceneAnim->_animInstance->setScale(scale,true); + sceneAnim->_animInstance->setScale(scale, true); } return 0; } @@ -939,8 +938,6 @@ int32 ScriptFunc::sys_Cmd_Init_Scene_Anim(EMCState *state) { sceneAnim->_animInstance->setAnimationRange(stackPos(11), stackPos(11)); sceneAnim->_animInstance->setFrame(stackPos(11)); - - debugC(0, 0xfff, "Init Anim %s %d %d %d %d %d %d %d %d %d %d %d %d %d\n", GetText(12, state), stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPos(12)); @@ -1091,13 +1088,13 @@ int32 ScriptFunc::sys_Cmd_Proceed_To_Next_Chapter(EMCState *state) { } int32 ScriptFunc::sys_Cmd_Play_Sfx_Plus(EMCState *state) { - //debugC(0,0xfff, "playSfx ( %d , %d, %d, %d, %d )", stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); + //debugC(0, 0xfff, "playSfx ( %d , %d, %d, %d, %d )", stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _vm->playSFX(stackPos(0), stackPos(1)); return 0; } int32 ScriptFunc::sys_Cmd_Play_Sfx(EMCState *state) { - //debugC(0,0xfff, "playSfx ( %d , %d)", stackPos(0), stackPos(1)); + //debugC(0, 0xfff, "playSfx ( %d , %d)", stackPos(0), stackPos(1)); _vm->playSFX(stackPos(0), stackPos(1)); return 0; } diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp index f676a65025..0d6977842d 100644 --- a/engines/toon/state.cpp +++ b/engines/toon/state.cpp @@ -119,7 +119,6 @@ State::State(void) { } State::~State(void) { - } int32 State::getGameFlag(int32 flagId) { diff --git a/engines/toon/state.h b/engines/toon/state.h index d31ff4f3c2..63505fd5fb 100644 --- a/engines/toon/state.h +++ b/engines/toon/state.h @@ -81,7 +81,6 @@ public: int32 _nextSpecialEnterX; int32 _nextSpecialEnterY; - bool _timerEnabled[2]; int32 _timerTimeout[2]; int32 _timerDelay[2]; @@ -94,7 +93,6 @@ public: void loadConversations(Common::ReadStream *stream); void saveConversations(Common::WriteStream *stream); - }; } // End of namespace Toon diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp index a03a2d57ce..e1478645db 100644 --- a/engines/toon/tools.cpp +++ b/engines/toon/tools.cpp @@ -125,7 +125,6 @@ uint32 decompressSPCN(byte *src, byte *dst, uint32 dstsize) { return (dstp - dst); } - //return codes #define NOT_PACKED 0 #define PACKED_CRC -1 @@ -296,7 +295,6 @@ int32 RncDecoder::unpackM1(const void *input, void *output) { uint16 crcUnpacked = 0; uint16 crcPacked = 0; - _bitBuffl = 0; _bitBuffh = 0; _bitCount = 0; @@ -397,9 +395,6 @@ int32 RncDecoder::unpackM2(const void *input, void *output) { uint16 crcUnpacked = 0; uint16 crcPacked = 0; -// Strangerke - Commented (not used) -// uint16 counts = 0; - _bitBuffl = 0; _bitCount = 0; @@ -429,7 +424,6 @@ int32 RncDecoder::unpackM2(const void *input, void *output) { _srcPtr = inputptr; _dstPtr = (uint8 *)output; - uint16 ofs, len; byte ofs_hi, ofs_lo; diff --git a/engines/toon/tools.h b/engines/toon/tools.h index 05fc5c9cda..1d8b4a6a5b 100644 --- a/engines/toon/tools.h +++ b/engines/toon/tools.h @@ -42,8 +42,8 @@ const uint32 kCompRNC2 = 0x524E4302; #define READ_LE_INT16(x) (int16) READ_LE_UINT16(x) #define READ_LE_INT32(x) (int32) READ_LE_UINT32(x) -#define WRITE_LE_INT16(x,y) WRITE_LE_UINT16(x,(int16)y) -#define WRITE_LE_INT32(x,y) WRITE_LE_UINT32(x,(int32)y) +#define WRITE_LE_INT16(x, y) WRITE_LE_UINT16(x, (int16)y) +#define WRITE_LE_INT32(x, y) WRITE_LE_UINT32(x, (int32)y) uint32 decompressSPCN(byte *src, byte *dst, uint32 dstsize); uint32 decompressLZSS(byte *src, byte *dst, int dstsize); diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 45243ab81e..6ca0b66e42 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -49,7 +49,6 @@ namespace Toon { - void ToonEngine::init() { _currentScriptRegion = 0; _resources = new Resources(this); @@ -101,7 +100,6 @@ void ToonEngine::init() { SearchMan.addSubDirectoryMatching(gameDataDir, "ACT1"); SearchMan.addSubDirectoryMatching(gameDataDir, "ACT2"); - syncSoundSettings(); _pathFinding = new PathFinding(this); @@ -262,7 +260,6 @@ void ToonEngine::parseInput() { selectHotspot(); clickEvent(); } - } void ToonEngine::enableTimer(int32 timerId) { @@ -394,7 +391,7 @@ void ToonEngine::render() { clearDirtyRects(); - //_currentMask->drawMask(*_mainSurface,0,0,0,0); + //_currentMask->drawMask(*_mainSurface, 0, 0, 0, 0); _animationManager->render(); drawInfoLine(); @@ -410,7 +407,7 @@ void ToonEngine::render() { sprintf(test, "%d %d / mask %d layer %d z %d", _mouseX, _mouseY, getMask()->getData(_mouseX, _mouseY), getLayerAtPoint(_mouseX, _mouseY), getZAtPoint(_mouseX, _mouseY)); int32 c = *(uint8 *)_mainSurface->getBasePtr(_mouseX, _mouseY); - sprintf(test, "%d %d / color id %d %d,%d,%d", _mouseX, _mouseY, c, _finalPalette[c*3+0], _finalPalette[c*3+1], _finalPalette[c*3+2]); + sprintf(test, "%d %d / color id %d %d,%d,%d", _mouseX, _mouseY, c, _finalPalette[c * 3 + 0], _finalPalette[c * 3 + 1], _finalPalette[c * 3 + 2]); _fontRenderer->setFont(_fontToon); _fontRenderer->renderText(40, 150, Common::String(test), 0); @@ -465,12 +462,12 @@ void ToonEngine::doMagnifierEffect() { 11, 11, 11, 11, 12 }; - byte tempBuffer[25*25]; + byte tempBuffer[25 * 25]; for (int32 y = -12; y <= 12; y++) { for (int32 x = -12; x <= 12; x++) { int32 destPitch = surface.pitch; uint8 *curRow = (uint8 *)surface.pixels + (posY + y) * destPitch + (posX + x); - tempBuffer[(y+12) * 25 + x + 12] = *curRow; + tempBuffer[(y + 12) * 25 + x + 12] = *curRow; } } @@ -482,7 +479,7 @@ void ToonEngine::doMagnifierEffect() { int32 destPitch = surface.pitch; uint8 *curRow = (uint8 *)surface.pixels + (posY + y) * destPitch + (posX + x); int32 lerp = (512 + intSqrt[dist] * 256 / 12); - *curRow = tempBuffer[(y*lerp/1024+12) * 25 + x*lerp/1024 + 12]; + *curRow = tempBuffer[(y * lerp / 1024 + 12) * 25 + x * lerp / 1024 + 12]; } } } @@ -496,7 +493,6 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { _cursorAnimationInstance->render(); } - // Handle dirty rects here static int32 lastScroll = 0; @@ -508,7 +504,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { int32 offX = 0; for (uint i = 0; i < _oldDirtyRects.size(); i++) { Common::Rect rect = _oldDirtyRects[i]; - rect.translate(-state()->_currentScrollValue,0); + rect.translate(-state()->_currentScrollValue, 0); offX = 0; if(rect.right <= 0) continue; @@ -524,7 +520,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { for (uint i = 0; i < _dirtyRects.size(); i++) { Common::Rect rect = _dirtyRects[i]; - rect.translate(-state()->_currentScrollValue,0); + rect.translate(-state()->_currentScrollValue, 0); offX = 0; if (rect.right <= 0) continue; @@ -666,7 +662,7 @@ bool ToonEngine::showMainmenu(bool &loadedGame) { if(_dirtyAll) { mainmenuPicture->draw(*_mainSurface, 0, 0, 0, 0); - addDirtyRect(0,0,640,400); + addDirtyRect(0, 0, 640, 400); } else { mainmenuPicture->drawWithRectList(*_mainSurface, 0, 0, 0, 0, _dirtyRects); } @@ -965,7 +961,6 @@ ToonEngine::~ToonEngine() { delete _pathFinding; - for (int32 i = 0; i < 64; i++) { if (_sceneAnimations[i]._active) { // see if one character shares this instance @@ -1027,8 +1022,6 @@ void ToonEngine::simpleUpdate(bool waitCharacterToTalk) { _animationManager->update(elapsedTime); _audioManager->updateAmbientSFX(); render(); - - } void ToonEngine::fixPaletteEntries(uint8 *palette, int num) { @@ -1044,13 +1037,8 @@ void ToonEngine::fixPaletteEntries(uint8 *palette, int num) { // adapted from KyraEngine void ToonEngine::updateAnimationSceneScripts(int32 timeElapsed) { - - static int32 numReentrant = 0; numReentrant++; - -// Strangerke - Commented (not used) -// uint32 nextTime = _system->getMillis() + _tickLength; const int startScript = _lastProcessedSceneScript; _updatingSceneScriptRunFlag = true; @@ -1083,10 +1071,8 @@ void ToonEngine::updateAnimationSceneScripts(int32 timeElapsed) { } while (_lastProcessedSceneScript != startScript && !_shouldQuit); - _updatingSceneScriptRunFlag = false; numReentrant--; - } void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { @@ -1154,7 +1140,6 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { _mouseButton = 0; _lastMouseButton = 0x3; - // load package strcpy(temp, createRoomFilename(Common::String::format("%s.PAK", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str()); resources()->openPackage(temp); @@ -1370,7 +1355,6 @@ void ToonEngine::initChapter() { _script->unload(&data); setupGeneralPalette(); - } void ToonEngine::loadCursor() { @@ -1492,7 +1476,6 @@ void ToonEngine::clickEvent() { return; } - int32 mouseX = _mouseX; if (_gameState->_inCutaway) { mouseX += 1280; @@ -1523,7 +1506,6 @@ void ToonEngine::clickEvent() { } } - if (!currentHot) { int32 xx, yy; @@ -1551,9 +1533,6 @@ void ToonEngine::clickEvent() { int16 command = currentHot->getData(commandId); int16 argument = currentHot->getData(commandId + 1); int16 priority = currentHot->getPriority(); -// Strangerke - Commented (not used) -// int16 ref = currentHot->getRef(); -// int16 pad1 = currentHot->getData(6); if (!_gameState->_inCutaway && !_gameState->_inCloseUp) { if (leftButton && (currentHot->getData(4) != 2 || _gameState->_mouseState >= 0) && currentHot->getData(5) != -1) { @@ -1595,8 +1574,6 @@ void ToonEngine::clickEvent() { break; case 7: // switch to CloseUp -// Strangerke - Commented (not used) -// int closeup = 1; break; case 8: // face flux @@ -1604,11 +1581,6 @@ void ToonEngine::clickEvent() { break; case 9: case 10: -// Strangerke - Commented (not used) -// if (rand() % 1 == 1) { -// } else { -// } - // setFluxFacingPoint(x,y) sayLines(2, argument); break; case 11: @@ -1632,7 +1604,6 @@ void ToonEngine::clickEvent() { int32 val = _scriptState[_currentScriptRegion].regs[4]; currentHot->setData(4, currentHot->getData(4) & val); } - } void ToonEngine::selectHotspot() { @@ -1802,7 +1773,6 @@ void ToonEngine::exitScene() { strcpy(temp, createRoomFilename(Common::String::format("%s.PAK", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str()); resources()->closePackage(temp); - _drew->stopWalk(); _flux->stopWalk(); @@ -1830,9 +1800,9 @@ void ToonEngine::fadeIn(int32 numFrames) { uint8 vmpalette[3 * 256]; for (int32 i = 0; i < 256; i++) { - vmpalette[i*3+0] = f * _finalPalette[i*3+0] / (numFrames - 1); - vmpalette[i*3+1] = f * _finalPalette[i*3+1] / (numFrames - 1); - vmpalette[i*3+2] = f * _finalPalette[i*3+2] / (numFrames - 1); + vmpalette[i * 3 + 0] = f * _finalPalette[i * 3 + 0] / (numFrames - 1); + vmpalette[i * 3 + 1] = f * _finalPalette[i * 3 + 1] / (numFrames - 1); + vmpalette[i * 3 + 2] = f * _finalPalette[i * 3 + 2] / (numFrames - 1); } _system->getPaletteManager()->setPalette(vmpalette, 0, 256); _system->updateScreen(); @@ -1848,9 +1818,9 @@ void ToonEngine::fadeOut(int32 numFrames) { for (int32 f = 0; f < numFrames; f++) { uint8 vmpalette[3 * 256]; for (int32 i = 0; i < 256; i++) { - vmpalette[i*3+0] = (numFrames - f - 1) * oldpalette[i*3+0] / (numFrames - 1); - vmpalette[i*3+1] = (numFrames - f - 1) * oldpalette[i*3+1] / (numFrames - 1); - vmpalette[i*3+2] = (numFrames - f - 1) * oldpalette[i*3+2] / (numFrames - 1); + vmpalette[i * 3 + 0] = (numFrames - f - 1) * oldpalette[i * 3 + 0] / (numFrames - 1); + vmpalette[i * 3 + 1] = (numFrames - f - 1) * oldpalette[i * 3 + 1] / (numFrames - 1); + vmpalette[i * 3 + 2] = (numFrames - f - 1) * oldpalette[i * 3 + 2] / (numFrames - 1); } _system->getPaletteManager()->setPalette(vmpalette, 0, 256); _system->updateScreen(); @@ -1908,7 +1878,7 @@ int32 ToonEngine::getScaleAtPoint(int32 x, int32 y) { y = MIN<int32>(399, MAX<int32>(0, y)); int32 maskData = _currentMask->getData(x, y) & 0x1f; - return _roomScaleData[maskData+2] * 1024 / 100; + return _roomScaleData[maskData + 2] * 1024 / 100; } int32 ToonEngine::getLayerAtPoint(int32 x, int32 y) { @@ -1920,7 +1890,7 @@ int32 ToonEngine::getLayerAtPoint(int32 x, int32 y) { y = MIN<int32>(399, MAX<int32>(0, y)); int32 maskData = _currentMask->getData(x, y) & 0x1f; - return _roomScaleData[maskData+130] << 5; + return _roomScaleData[maskData + 130] << 5; } int32 ToonEngine::getZAtPoint(int32 x, int32 y) { @@ -1997,25 +1967,11 @@ void ToonEngine::sayLines(int numLines, int dialogId) { if (oldShowMouse) Game.MouseHiddenCount = 0; #endif - } int32 ToonEngine::simpleCharacterTalk(int32 dialogid) { int32 myId = 0; -// Strangerke - Commented (not used) -#if 0 - char *myLine; - if (dialogid < 1000) { - myLine = _roomTexts->getText(dialogid); - myId = dialogid; - } else { - myLine = _genericTexts->getText(dialogid - 1000); - myId = dialogid - 1000; - } - debugC(0, 0xfff, "Talker = %d will say '%s' \n", READ_LE_UINT16(c - 2), myLine); -#endif - if (_audioManager->voiceStillPlaying()) _audioManager->stopCurrentVoice(); @@ -2032,14 +1988,6 @@ int32 ToonEngine::simpleCharacterTalk(int32 dialogid) { void ToonEngine::playTalkAnimOnCharacter(int32 animID, int32 characterId, bool talker) { if (animID || talker) { -// Strangerke - Commented (not used) -#if 0 - if (_gameState->_inCutaway || _gameState->_inInventory) { - if (talker) { - // character talks - } - } else -#endif if (characterId == 0) { _drew->playAnim(animID, 0, (talker ? 8 : 0) + 2); } else if (characterId == 1) { @@ -2089,7 +2037,6 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { _gameState->_mouseHidden = true; } - // get what is before the string int a = READ_LE_UINT16(myLine - 2); char *b = myLine - 2 - 4 * a; @@ -2100,14 +2047,6 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { char *e = c - 2 - 4 * numParticipants; READ_LE_UINT16(e); -// Strangerke - Commented (not used) -// char *g = e - 2 * f; - - // flag as talking -// Strangerke - Commented (not used) -// char *h = c; - - // if one voice is still playing, wait ! if (blocking) { while (_audioManager->voiceStillPlaying() && !_shouldQuit) @@ -2165,8 +2104,6 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { _currentTextLine = myLine; _currentTextLineCharacterId = talkerId; _currentTextLineId = dialogid; - - } else { Character *character = getCharacterById(talkerId); if (character) @@ -2175,7 +2112,6 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { debugC(0, 0xfff, "Talker = %d (num participants : %d) will say '%s'", (int)talkerId , (int)numParticipants, myLine); - getTextPosition(talkerId, &_currentTextLineX, &_currentTextLineY); if (dialogid < 1000) { @@ -2195,8 +2131,6 @@ int32 ToonEngine::characterTalk(int32 dialogid, bool blocking) { if (character) character->setTalking(false); } - - return 1; } @@ -2229,7 +2163,6 @@ void ToonEngine::haveAConversation(int32 convId) { doFrame(); } - _mouseButton = 0; _gameState->_firstConverstationLine = true; @@ -2258,11 +2191,13 @@ void ToonEngine::haveAConversation(int32 convId) { a++; } } - if (_shouldQuit) return; + + if (_shouldQuit) + return; + _gameState->_showConversationIcons = false; _gameState->_mouseHidden = 1; - if (selected < 0 || selected == 1 || selected == 3) { if (_gameState->_firstConverstationLine) processConversationClick(conv, 3); @@ -2274,9 +2209,6 @@ void ToonEngine::haveAConversation(int32 convId) { } } -// Strangerke - Commented (not used) -// int cur = 0; - for (int i = 0; i < 10; i++) { if (conv->state[i]._data2 == 2) { if (i != 3) @@ -2292,7 +2224,6 @@ void ToonEngine::haveAConversation(int32 convId) { // switch back to original music playRoomMusic(); - } void ToonEngine::drawConversationIcons() { @@ -2414,7 +2345,6 @@ retry: break; } } - } // hardcoded conversation flag to know if one dialogue icon must be displayed or not @@ -2575,7 +2505,7 @@ int32 ToonEngine::runConversationCommand(int16 **command) { int16 *v5 = *command; int v2 = READ_LE_INT16(v5); - int v4 = READ_LE_INT16(v5+1); + int v4 = READ_LE_INT16(v5 + 1); int result = v2 - 100; switch (v2) { case 100: @@ -2608,9 +2538,6 @@ int32 ToonEngine::runConversationCommand(int16 **command) { } int32 ToonEngine::waitTicks(int32 numTicks, bool breakOnMouseClick) { -// Strangerke - Commented (not used) -// Common::EventManager *_event = _system->getEventManager(); - uint32 nextTime = _system->getMillis() + numTicks * _tickLength; while (_system->getMillis() < nextTime || numTicks == -1) { //if (!_animationSceneScriptRunFlag) @@ -2633,7 +2560,7 @@ void ToonEngine::renderInventory() { _inventoryPicture->drawWithRectList(*_mainSurface, 0, 0, 0, 0, _dirtyRects); } else { _inventoryPicture->draw(*_mainSurface, 0, 0, 0, 0); - _dirtyRects.push_back(Common::Rect(0,0,640,400)); + _dirtyRects.push_back(Common::Rect(0, 0, 640, 400)); } clearDirtyRects(); @@ -2663,8 +2590,7 @@ void ToonEngine::renderInventory() { int32 ToonEngine::showInventory() { int32 oldScrollValue = _gameState->_currentScrollValue; -// Strangerke - Commented (not used) -// Common::EventManager *_event = _system->getEventManager(); + delete _inventoryPicture; _inventoryPicture = new Picture(this); fadeOut(5); @@ -2719,7 +2645,6 @@ int32 ToonEngine::showInventory() { int32 modItem = getSpecialInventoryItem(item); if (modItem) { - if (modItem == -1) { _gameState->_mouseState = item; _gameState->_inventory[foundObj] = 0; @@ -2895,7 +2820,7 @@ void ToonEngine::rearrangeInventory() { if (_gameState->_inventory[i] == 0) { // move all the following items from one for (int32 j = i + 1; j < _gameState->_numInventoryItems; j++) { - _gameState->_inventory[j-1] = _gameState->_inventory[j]; + _gameState->_inventory[j - 1] = _gameState->_inventory[j]; } _gameState->_numInventoryItems--; } @@ -2916,7 +2841,6 @@ void ToonEngine::newGame() { } } - void ToonEngine::playSFX(int32 id, int32 volume) { if (id < 0) _audioManager->playSFX(-id + 1, volume, true); @@ -3103,7 +3027,6 @@ bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) { saveFile->writeUint32BE(saveDate); saveFile->writeUint16BE(saveTime); - // save global state _gameState->save(saveFile); _gameState->saveConversations(saveFile); @@ -3130,7 +3053,6 @@ bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) { _sceneAnimations[i].save(this, saveFile); } - for (int32 i = 0; i < 8; i++) { if (_characters[i]) { saveFile->writeSByte(i); @@ -3210,7 +3132,7 @@ bool ToonEngine::loadGame(int32 slot) { _sceneAnimationScripts[i]._frozen = loadFile->readByte(); _sceneAnimationScripts[i]._frozenForConversation = false; int32 oldTimer = loadFile->readSint32BE(); - _sceneAnimationScripts[i]._lastTimer = MAX<int32>(0,oldTimer + timerDiff); + _sceneAnimationScripts[i]._lastTimer = MAX<int32>(0, oldTimer + timerDiff); _script->loadState(&_sceneAnimationScripts[i]._state, loadFile); } @@ -3249,7 +3171,7 @@ bool ToonEngine::loadGame(int32 slot) { // load "command buffer" int32 size = loadFile->readSint16BE(); if (size) { - uint8 *buf = new uint8[size+2]; + uint8 *buf = new uint8[size + 2]; loadFile->read(buf, size + 2); Common::MemoryReadStream rStr(buf, size + 2); @@ -3368,10 +3290,6 @@ void ToonEngine::initCharacter(int32 characterId, int32 animScriptId, int32 scen return; } -// Strangerke - Commented (not used) -// if (_characters[characterIndex]) -// delete current char - _characters[characterIndex] = new Character(this); _characters[characterIndex]->setId(characterId); _characters[characterIndex]->setAnimScript(animScriptId); @@ -3541,7 +3459,6 @@ void ToonEngine::viewInventoryItem(Common::String str, int32 lineId, int32 itemD _firstFrame = true; _gameState->_currentScrollValue = oldScrollValue; delete pic; - } int32 ToonEngine::handleInventoryOnInventory(int32 itemDest, int32 itemSrc) { @@ -3583,7 +3500,7 @@ int32 ToonEngine::handleInventoryOnInventory(int32 itemDest, int32 itemSrc) { case 11: if (itemSrc == 0xb) { _gameState->_mouseState = -1; - replaceItemFromInventory(11,12); + replaceItemFromInventory(11, 12); setCursor(0, false, 0, 0); rearrangeInventory(); return 1; @@ -4596,9 +4513,9 @@ void ToonEngine::createShadowLUT() { for (int32 i = 0; i < 255; i++) { // goal color - uint32 destR = _finalPalette[i*3+0] * scaleNum / scaleDenom; - uint32 destG = _finalPalette[i*3+1] * scaleNum / scaleDenom; - uint32 destB = _finalPalette[i*3+2] * scaleNum / scaleDenom; + uint32 destR = _finalPalette[i * 3 + 0] * scaleNum / scaleDenom; + uint32 destG = _finalPalette[i * 3 + 1] * scaleNum / scaleDenom; + uint32 destB = _finalPalette[i * 3 + 2] * scaleNum / scaleDenom; // search only in the "picture palette" which is in colors 1-128 and 200-255 int32 colorDist = 0xffffff; @@ -4606,9 +4523,9 @@ void ToonEngine::createShadowLUT() { for (int32 c = 1; c < 129; c++) { - int32 diffR = _finalPalette[c*3+0] - destR; - int32 diffG = _finalPalette[c*3+1] - destG; - int32 diffB = _finalPalette[c*3+2] - destB; + int32 diffR = _finalPalette[c * 3 + 0] - destR; + int32 diffG = _finalPalette[c * 3 + 1] - destG; + int32 diffB = _finalPalette[c * 3 + 2] - destB; if (colorDist > diffR * diffR + diffG * diffG + diffB * diffB) { colorDist = diffR * diffR + diffG * diffG + diffB * diffB; @@ -4618,9 +4535,9 @@ void ToonEngine::createShadowLUT() { for (int32 c = 200; c < 256; c++) { - int32 diffR = _finalPalette[c*3+0] - destR; - int32 diffG = _finalPalette[c*3+1] - destG; - int32 diffB = _finalPalette[c*3+2] - destB; + int32 diffR = _finalPalette[c * 3 + 0] - destR; + int32 diffG = _finalPalette[c * 3 + 1] - destG; + int32 diffB = _finalPalette[c * 3 + 2] - destB; if (colorDist > diffR * diffR + diffG * diffG + diffB * diffB) { colorDist = diffR * diffR + diffG * diffG + diffB * diffB; @@ -4762,7 +4679,7 @@ void ToonEngine::addDirtyRect( int32 left, int32 top, int32 right, int32 bottom top = MAX<int32>(top, 0); bottom = MIN<int32>(bottom, 400); - Common::Rect rect(left,top,right,bottom); + Common::Rect rect(left, top, right, bottom); if (bottom - top <= 0 || right - left <= 0) return; @@ -4817,7 +4734,6 @@ void SceneAnimation::load(ToonEngine *vm, Common::ReadStream *stream) { _active = stream->readByte(); _id = stream->readSint32BE(); - if (!_active) return; diff --git a/engines/toon/toon.h b/engines/toon/toon.h index dca6bfe78e..580789e0c7 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -206,8 +206,6 @@ public: void waitForScriptStep(); void doMagnifierEffect(); - - bool canSaveGameStateCurrently(); bool canLoadGameStateCurrently(); void pauseEngineIntern(bool pause); |