From 22db6b155840c145864ccc219b21e197d5dce738 Mon Sep 17 00:00:00 2001 From: Benjamin Haisch Date: Mon, 6 Jul 2009 10:59:42 +0000 Subject: TOLTECS: - Fixed clipping bugs (in 256-color sprites and scaled sprites) - Minor cleanup --- engines/toltecs/screen.cpp | 6 ------ engines/toltecs/segmap.cpp | 2 +- engines/toltecs/segmap.h | 2 +- engines/toltecs/sound.cpp | 14 ++++++++++---- engines/toltecs/sprite.cpp | 24 ++++++++++++------------ engines/toltecs/toltecs.cpp | 4 +++- 6 files changed, 27 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index c3487f42d2..9f77c0558f 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -805,10 +805,4 @@ void Screen::loadState(Common::ReadStream *in) { } - -/* -void Screen::update() { -} -*/ - } // End of namespace Toltecs diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp index b51886f19f..414ea46c9c 100644 --- a/engines/toltecs/segmap.cpp +++ b/engines/toltecs/segmap.cpp @@ -362,7 +362,7 @@ int8 SegmentMap::getScalingAtPoint(int16 x, int16 y) { if (_infoRects[i].id == 0 && _infoRects[i].isPointInside(x, y)) { int8 topScaling = (int8)_infoRects[i].b; int8 bottomScaling = (int8)_infoRects[i].c; - if (y - _infoRects[i].y > 0) { + if (y - _infoRects[i].y != 0) { scaling = (ABS(y - _infoRects[i].y) * (bottomScaling - topScaling) / _infoRects[i].height) + topScaling; } } diff --git a/engines/toltecs/segmap.h b/engines/toltecs/segmap.h index b860efb2ce..394d4ae10d 100644 --- a/engines/toltecs/segmap.h +++ b/engines/toltecs/segmap.h @@ -79,7 +79,7 @@ public: void getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b); void addMasksToRenderQueue(); - + //protected: public: // for debugging purposes diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp index 012b5eec61..875fd0b935 100644 --- a/engines/toltecs/sound.cpp +++ b/engines/toltecs/sound.cpp @@ -66,7 +66,7 @@ void Sound::playSound(int16 resIndex, int16 type, int16 volume) { debug("playSound(%d, %d, %d)", resIndex, type, volume); - if (volume == -1 || type == kChannelTypeSfx) { + if (volume == -1 || type == -2) { if (type == kChannelTypeBackground) { internalPlaySound(resIndex, type, 50 /*TODO*/, 0); } else { @@ -117,7 +117,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa channels[i].type = kChannelTypeEmpty; channels[i].resIndex = -1; } - } else if (type == kChannelTypeSfx) { + } else if (type == -2) { // Stop sounds with specified resIndex for (int i = 0; i < 4; i++) { if (channels[i].resIndex == resIndex) { @@ -128,7 +128,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa } } else { - if (type == -2) { + if (type == -3) { // Stop speech and play new sound stopSpeech(); } @@ -156,7 +156,13 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa channels[freeChannel].type = type; channels[freeChannel].resIndex = resIndex; - _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType/*TODO*/, &channels[freeChannel].handle, + Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType; + /* + switch (type) { + } + */ + + _vm->_mixer->playInputStream(soundType, &channels[freeChannel].handle, stream, -1, volume, panning); } diff --git a/engines/toltecs/sprite.cpp b/engines/toltecs/sprite.cpp index 787f15c15a..84b485d49b 100644 --- a/engines/toltecs/sprite.cpp +++ b/engines/toltecs/sprite.cpp @@ -287,7 +287,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) { sprite.x -= xoffs; sprite.y -= yoffs; - + sprite.yerror = sprite.ydelta; // Now we check if the sprite needs to be clipped @@ -296,7 +296,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) { if (sprite.y - _vm->_cameraY < 0) { int16 clipHeight = ABS(sprite.y - _vm->_cameraY); - int16 chopHeight, skipHeight, lineWidth; + int16 skipHeight = clipHeight; byte *spriteFrameData; sprite.height -= clipHeight; @@ -307,8 +307,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) { // If the sprite is scaled if (sprite.flags & 3) { - chopHeight = sprite.ydelta; - skipHeight = clipHeight; + int16 chopHeight = sprite.ydelta; if ((sprite.flags & 2) == 0) { do { chopHeight -= 100; @@ -336,20 +335,21 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) { // Now the sprite's offset is adjusted to point to the starting line if ((sprite.flags & 0x10) == 0) { - while (clipHeight--) { - lineWidth = 0; - while (lineWidth showMouse(true); + syncSoundSettings(); + //#define TEST_MENU #ifdef TEST_MENU _screen->registerFont(0, 0x0D); @@ -220,7 +222,7 @@ void ToltecsEngine::loadScene(uint resIndex) { _screen->_fullRefresh = true; _screen->_renderQueue->clear(); - + } void ToltecsEngine::updateScreen() { -- cgit v1.2.3