aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBenjamin Haisch2009-07-06 10:59:42 +0000
committerWillem Jan Palenstijn2011-11-20 22:43:08 +0100
commit22db6b155840c145864ccc219b21e197d5dce738 (patch)
treeddec22518910b1a1267b54df43ab79f72f39135d /engines
parent9a84c13bef923eedc020b6706d0a7b6685bb42fd (diff)
downloadscummvm-rg350-22db6b155840c145864ccc219b21e197d5dce738.tar.gz
scummvm-rg350-22db6b155840c145864ccc219b21e197d5dce738.tar.bz2
scummvm-rg350-22db6b155840c145864ccc219b21e197d5dce738.zip
TOLTECS: - Fixed clipping bugs (in 256-color sprites and scaled sprites)
- Minor cleanup
Diffstat (limited to 'engines')
-rw-r--r--engines/toltecs/screen.cpp6
-rw-r--r--engines/toltecs/segmap.cpp2
-rw-r--r--engines/toltecs/segmap.h2
-rw-r--r--engines/toltecs/sound.cpp14
-rw-r--r--engines/toltecs/sprite.cpp24
-rw-r--r--engines/toltecs/toltecs.cpp4
6 files changed, 27 insertions, 25 deletions
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 </*CHECKME was != */ sprite.origWidth) {
+ while (skipHeight--) {
+ int16 lineWidth = 0;
+ while (lineWidth < sprite.origWidth) {
sprite.offset++;
- lineWidth += (*spriteFrameData++) & 0x0F;
+ lineWidth += spriteFrameData[0] & 0x0F;
+ spriteFrameData++;
}
}
} else {
- lineWidth = 0;
- while (clipHeight--) {
+ while (skipHeight--) {
+ int16 lineWidth = 0;
while (lineWidth < sprite.origWidth) {
sprite.offset += 2;
- spriteFrameData++;
- lineWidth += *spriteFrameData++;
+ lineWidth += spriteFrameData[1];
+ spriteFrameData += 2;
}
}
}
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index cd736fb129..a984ca7676 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -147,6 +147,8 @@ Common::Error ToltecsEngine::run() {
_system->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() {