aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/queen/display.cpp15
-rw-r--r--engines/queen/graphics.cpp8
-rw-r--r--engines/queen/logic.cpp10
-rw-r--r--engines/queen/resource.cpp2
-rw-r--r--engines/queen/sound.cpp29
-rw-r--r--engines/queen/sound.h2
6 files changed, 39 insertions, 27 deletions
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index 35282440e1..e25470a9e7 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -286,7 +286,7 @@ void Display::palCustomColors(uint16 roomNum) {
palSetAmigaColor(30, 0x600);
break;
case 29:
- palSetAmigaColor(27, 0X58B);
+ palSetAmigaColor(27, 0x58B);
palSetAmigaColor(28, 0x369);
palSetAmigaColor(29, 0x158);
palSetAmigaColor(30, 0x046);
@@ -755,7 +755,7 @@ void Display::drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w,
if (data != NULL) {
if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) {
uint8 *dst = _panelBuf + y * PANEL_W + x;
- while (h--) {
+ for (int j = 0; j < h; ++j) {
for (int i = 0; i < w; ++i) {
dst[i] = 144 + *data++;
}
@@ -932,19 +932,14 @@ void Display::horizontalScroll(int16 scroll) {
void Display::setDirtyBlock(uint16 x, uint16 y, uint16 w, uint16 h) {
if (_fullRefresh < 2) {
+ assert(x + w <= SCREEN_W && y + h <= SCREEN_H);
uint16 ex = (x + w - 1) / D_BLOCK_W;
uint16 ey = (y + h - 1) / D_BLOCK_H;
x /= D_BLOCK_W;
y /= D_BLOCK_H;
- uint16 cy = ey - y + 1;
- uint16 cx = ex - x + 1;
- if (cy >= _dirtyBlocksHeight) cy = _dirtyBlocksHeight - 1;
- if (cx >= _dirtyBlocksWidth) cx = _dirtyBlocksWidth - 1;
uint8 *p = _dirtyBlocks + _dirtyBlocksWidth * y + x;
- while (cy--) {
- for (uint16 i = 0; i < cx; ++i) {
- p[i] = 2;
- }
+ for (; y <= ey; ++y) {
+ memset(p, 2, ex - x + 1);
p += _dirtyBlocksWidth;
}
}
diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp
index 1993ec47e4..bdd191e935 100644
--- a/engines/queen/graphics.cpp
+++ b/engines/queen/graphics.cpp
@@ -303,13 +303,13 @@ void Graphics::setupMouseCursor() {
const uint16 mask = (1 << (15 - b));
uint8 color = 0;
if (READ_BE_UINT16(src + 0) & mask) {
- color |= 1;
+ color |= 2;
}
if (READ_BE_UINT16(src + 2) & mask) {
- color |= 2;
+ color |= 1;
}
if (color != 0) {
- cursorData[i] = 0x90 + color;
+ cursorData[i] = 0x90 + color - 1;
}
++i;
}
@@ -488,7 +488,7 @@ void Graphics::stopBobs() {
}
BobSlot *Graphics::bob(int index) {
- assert(index < MAX_BOBS_NUMBER);
+ assert(index >= 0 && index < MAX_BOBS_NUMBER);
return &_bobs[index];
}
diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp
index 3b95e788fc..9f15e78a22 100644
--- a/engines/queen/logic.cpp
+++ b/engines/queen/logic.cpp
@@ -908,9 +908,7 @@ void Logic::inventoryRefresh() {
for (int i = 0; i < 4; ++i) {
uint16 itemNum = _inventoryItem[i];
if (itemNum != 0) {
- // 1st object in inventory uses frame 9,
- // whereas 2nd, 3rd and 4th uses frame 8
- uint16 dstFrame = (itemNum != 0) ? 8 : 9;
+ uint16 dstFrame = (i == 0) ? 8 : 9;
// unpack frame for object and draw it
_vm->bankMan()->unpack(_itemData[itemNum].frame, dstFrame, 14);
_vm->graphics()->drawInventoryItem(dstFrame, x, 14);
@@ -1578,7 +1576,7 @@ void Logic::asmMakeFrankGrowing() {
for (int i = 300; i >= 200; i -= 5) {
bobFrank->y = i;
_vm->update();
- }
+ }
} else {
bobFrank->curPos(160, 200);
for (int i = 10; i <= 100; i += 4) {
@@ -1608,7 +1606,7 @@ void Logic::asmMakeRobotGrowing() {
for (int i = 350; i >= 200; i -= 5) {
bobRobot->y = i;
_vm->update();
- }
+ }
} else {
bobRobot->curPos(160, 200);
for (int i = 10; i <= 100; i += 4) {
@@ -1799,7 +1797,7 @@ void Logic::asmSmoochNoScroll() {
bobJoe->x -= 2;
}
_vm->update();
- }
+ }
}
void Logic::asmMakeLightningHitPlane() {
diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp
index c7eabebc95..a7e029f0ce 100644
--- a/engines/queen/resource.cpp
+++ b/engines/queen/resource.cpp
@@ -296,7 +296,7 @@ const RetailGameVersion *Resource::detectGameVersionFromSize(uint32 size) {
}
Common::File *Resource::findSound(const char *filename, uint32 *size) {
- assert(strstr(filename, ".SB") != NULL || strstr(filename, ".AMR") != NULL);
+ assert(strstr(filename, ".SB") != NULL || strstr(filename, ".AMR") != NULL || strstr(filename, ".INS") != NULL);
ResourceEntry *re = resourceEntry(filename);
if (re) {
*size = re->size;
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp
index 280b56b7aa..74095cbe26 100644
--- a/engines/queen/sound.cpp
+++ b/engines/queen/sound.cpp
@@ -292,12 +292,12 @@ void AmigaSound::playSfx(uint16 sfx) {
void AmigaSound::playSong(int16 song) {
debug(2, "Sound::playSong %d override %d", song, _lastOverride);
- if (song < 0) {
- stopSong();
- return;
- }
+ if (song < 0) {
+ stopSong();
+ return;
+ }
- // remap song numbers for the Amiga
+ // remap song numbers for the Amiga
switch (song) {
case 1:
case 2:
@@ -539,7 +539,7 @@ void AmigaSound::updateMusic() {
if (_fluteCount > 0 && (_lastOverride == 40 || _lastOverride == 3)) {
--_fluteCount;
if (_fluteCount == 0) {
-// playPattern(3, 5 + (getRandomNumber() & 7));
+ playRandomPatternJungle();
_fluteCount = 100;
}
}
@@ -590,6 +590,23 @@ void AmigaSound::playModule(const char *base, int song) {
_fanfareCount = 0;
}
+void AmigaSound::playRandomPatternJungle() {
+ static const uint16 patOffset[] = { 2, 1416, 2722, 2242, 11046, 11046 };
+ static const uint16 patSize[] = { 1056, 826, 8100, 8580, 15808, 15808 };
+ uint32 soundSize;
+ Common::File *f = _vm->resource()->findSound("JUNG.INS", &soundSize);
+ if (f) {
+ const int i = _rnd.getRandomNumber(5);
+ uint8 *soundData = (uint8 *)malloc(patSize[i]);
+ if (soundData) {
+ f->seek(patOffset[i], SEEK_CUR);
+ f->read(soundData, patSize[i]);
+ byte flags = Audio::Mixer::FLAG_AUTOFREE;
+ _mixer->playRaw(Audio::Mixer::kSFXSoundType, NULL, soundData, patSize[i], 9000, flags);
+ }
+ }
+}
+
bool AmigaSound::playSpecialSfx(int16 sfx) {
switch (sfx) {
case 5: // normal volume
diff --git a/engines/queen/sound.h b/engines/queen/sound.h
index b719bce7a8..43c7b11bdf 100644
--- a/engines/queen/sound.h
+++ b/engines/queen/sound.h
@@ -178,12 +178,14 @@ protected:
void playSound(const char *base);
void playModule(const char *base, int song);
+ void playRandomPatternJungle();
bool playSpecialSfx(int16 sfx);
int16 _fanfareRestore;
int _fanfareCount, _fluteCount;
Audio::SoundHandle _modHandle;
Audio::SoundHandle _sfxHandle;
+ Common::RandomSource _rnd;
};
} // End of namespace Queen