aboutsummaryrefslogtreecommitdiff
path: root/engines/queen
diff options
context:
space:
mode:
Diffstat (limited to 'engines/queen')
-rw-r--r--engines/queen/cutaway.cpp2
-rw-r--r--engines/queen/display.cpp92
-rw-r--r--engines/queen/display.h4
-rw-r--r--engines/queen/graphics.cpp6
-rw-r--r--engines/queen/input.cpp4
-rw-r--r--engines/queen/input.h4
-rw-r--r--engines/queen/journal.cpp4
-rw-r--r--engines/queen/logic.cpp8
-rw-r--r--engines/queen/queen.cpp2
-rw-r--r--engines/queen/resource.cpp4
-rw-r--r--engines/queen/sound.cpp6
-rw-r--r--engines/queen/sound.h2
-rw-r--r--engines/queen/talk.cpp7
-rw-r--r--engines/queen/talk.h2
14 files changed, 45 insertions, 102 deletions
diff --git a/engines/queen/cutaway.cpp b/engines/queen/cutaway.cpp
index de54b7e33c..1e53c00564 100644
--- a/engines/queen/cutaway.cpp
+++ b/engines/queen/cutaway.cpp
@@ -515,7 +515,7 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an
anim.scale = (int16)READ_BE_INT16(ptr);
ptr += 2;
- if ((_vm->resource()->isDemo() && _vm->resource()->getPlatform() == Common::kPlatformPC) ||
+ if ((_vm->resource()->isDemo() && _vm->resource()->getPlatform() == Common::kPlatformDOS) ||
(_vm->resource()->isInterview() && _vm->resource()->getPlatform() == Common::kPlatformAmiga)) {
anim.song = 0;
} else {
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index cd9a1075fa..7437bab974 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -29,6 +29,7 @@
#include "graphics/cursorman.h"
#include "graphics/palette.h"
#include "graphics/surface.h"
+#include "graphics/decoders/iff.h"
#include "graphics/decoders/pcx.h"
#include "queen/display.h"
@@ -166,7 +167,7 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) {
}
void Display::palSetJoeDress() {
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
memcpy(_pal.room + 144 * 3, _palJoeDress, 16 * 3);
memcpy(_pal.screen + 144 * 3, _palJoeDress, 16 * 3);
palSet(_pal.screen, 144, 159, true);
@@ -174,7 +175,7 @@ void Display::palSetJoeDress() {
}
void Display::palSetJoeNormal() {
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
memcpy(_pal.room + 144 * 3, _palJoeClothes, 16 * 3);
memcpy(_pal.screen + 144 * 3, _palJoeClothes, 16 * 3);
palSet(_pal.screen, 144, 159, true);
@@ -701,7 +702,7 @@ void Display::setupPanel() {
uint8 *data = _vm->resource()->loadFile(dataName, 0, &dataSize);
if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) {
- decodeLBM(data, dataSize, _panelBuf, PANEL_W, &panelWidth, &panelHeight, _pal.panel, 0, 32, 144);
+ decodeIFF(data, dataSize, _panelBuf, PANEL_W, &panelWidth, &panelHeight, _pal.panel, 0, 32, 144);
} else {
WRITE_LE_UINT16(data + 14, PANEL_H - 10);
decodePCX(data, dataSize, _panelBuf + PANEL_W * 10, PANEL_W, &panelWidth, &panelHeight, _pal.panel, 144, 256);
@@ -720,7 +721,7 @@ void Display::setupNewRoom(const char *name, uint16 room) {
uint8 *data = _vm->resource()->loadFile(dataName, 0, &dataSize);
if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) {
- decodeLBM(data, dataSize, _backdropBuf, BACKDROP_W, &_bdWidth, &_bdHeight, _pal.room, 0, 32);
+ decodeIFF(data, dataSize, _backdropBuf, BACKDROP_W, &_bdWidth, &_bdHeight, _pal.room, 0, 32);
if (_bdHeight < BACKDROP_H) {
memset(_backdropBuf + _bdHeight * BACKDROP_W, 0, (BACKDROP_H - _bdHeight) * BACKDROP_W);
}
@@ -828,73 +829,22 @@ void Display::decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dst
memcpy(dst + y * dstPitch, pcxSurface->getBasePtr(0, y), pcxSurface->w);
}
-void Display::decodeLBM(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase) {
- int planeCount = 0, planePitch = 0;
- const uint8 *srcEnd = src + srcSize;
- src += 12;
- while (src < srcEnd) {
- uint32 type = READ_BE_UINT32(src);
- uint32 size = READ_BE_UINT32(src + 4);
- src += 8;
- switch (type) {
- case MKTAG('B','M','H','D'): {
- *w = READ_BE_UINT16(src + 0);
- *h = READ_BE_UINT16(src + 2);
- planeCount = src[8];
- planePitch = ((*w + 15) >> 4) * 2;
- }
- break;
- case MKTAG('C','M','A','P'): {
- assert(palStart <= palEnd && palEnd <= size / 3);
- memcpy(pal, src + palStart * 3, (palEnd - palStart) * 3);
- }
- break;
- case MKTAG('B','O','D','Y'): {
- uint32 planarSize = (*h) * planeCount * planePitch;
- uint8 *planarBuf = new uint8[planarSize];
- uint8 *dstPlanar = planarBuf;
- for (int y = 0; y < *h; ++y) {
- for (int p = 0; p < planeCount; ++p) {
- const uint8 *end = dstPlanar + planePitch;
- while (dstPlanar < end) {
- int code = (int8)*src++;
- if (code != -128) {
- if (code < 0) {
- code = -code + 1;
- memset(dstPlanar, *src++, code);
- } else {
- ++code;
- memcpy(dstPlanar, src, code);
- src += code;
- }
- dstPlanar += code;
- }
- }
- }
- }
- src = planarBuf;
- for (int y = 0; y < *h; ++y) {
- for (int x = 0; x < *w / 8; ++x) {
- for (int b = 0; b < 8; ++b) {
- const uint8 mask = (1 << (7 - b));
- uint8 color = 0;
- for (int p = 0; p < planeCount; ++p) {
- if (src[planePitch * p + x] & mask) {
- color |= 1 << p;
- }
- }
- dst[x * 8 + b] = colorBase + color;
- }
- }
- src += planeCount * planePitch;
- dst += dstPitch;
- }
- delete[] planarBuf;
- }
- return;
- }
- src += size;
- }
+void Display::decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase) {
+ Common::MemoryReadStream str(src, srcSize);
+
+ ::Graphics::IFFDecoder iff;
+ if (!iff.loadStream(str))
+ error("Error while reading IFF image");
+
+ const ::Graphics::Surface *iffSurface = iff.getSurface();
+ *w = iffSurface->w;
+ *h = iffSurface->h;
+
+ assert(palStart <= palEnd && palEnd <= 256);
+ memcpy(pal, iff.getPalette() + palStart * 3, (palEnd - palStart) * 3);
+ for (uint16 y = 0; y < iffSurface->h; y++)
+ for(uint16 x = 0; x < iffSurface->w; x++)
+ dst[(y * dstPitch) + x] = *(const byte *)iffSurface->getBasePtr(x, y) + colorBase;
}
void Display::horizontalScrollUpdate(int16 xCamera) {
diff --git a/engines/queen/display.h b/engines/queen/display.h
index 4256b19d72..8a8aaef5a6 100644
--- a/engines/queen/display.h
+++ b/engines/queen/display.h
@@ -116,8 +116,8 @@ public:
//! decode PCX picture data
void decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd);
- //! decode ILBM picture data
- void decodeLBM(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase = 0);
+ //! decode IFF picture data
+ void decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase = 0);
void horizontalScrollUpdate(int16 xCamera);
void horizontalScroll(int16 scroll);
diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp
index fbb72fde44..70f7d7c94b 100644
--- a/engines/queen/graphics.cpp
+++ b/engines/queen/graphics.cpp
@@ -214,7 +214,7 @@ Graphics::~Graphics() {
}
void Graphics::unpackControlBank() {
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
_vm->bankMan()->load("CONTROL.BBK",17);
// unpack mouse pointer frame
@@ -231,7 +231,7 @@ void Graphics::unpackControlBank() {
}
void Graphics::setupArrows() {
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
int scrollX = _vm->display()->horizontalScroll();
BobSlot *arrow;
arrow = bob(ARROW_BOB_UP);
@@ -1250,7 +1250,7 @@ void BamScene::updateFightAnimation() {
break;
case 99: // end of BAM data
_lastSoundIndex = _index = 0;
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
_fightData = fightDataBlocks[_vm->randomizer.getRandomNumber(2)];
}
if (_flag == F_REQ_STOP) {
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp
index 30bf681e63..dd10e7ad46 100644
--- a/engines/queen/input.cpp
+++ b/engines/queen/input.cpp
@@ -50,12 +50,12 @@ const Verb Input::_verbKeys[] = {
VERB_USE
};
-Input::Input(Common::Language language, OSystem *system, QueenEngine *vm) :
+Input::Input(Common::Language language, OSystem *system) :
_system(system), _eventMan(system->getEventManager()), _fastMode(false),
_keyVerb(VERB_NONE), _cutawayRunning(false), _canQuit(false),
_cutawayQuit(false), _dialogueRunning(false), _talkQuit(false),
_quickSave(false), _quickLoad(false), _debugger(false), _inKey(Common::KEYCODE_INVALID),
- _mouseButton(0), _idleTime(0) , _vm(vm) {
+ _mouseButton(0), _idleTime(0) {
switch (language) {
case Common::EN_ANY:
diff --git a/engines/queen/input.h b/engines/queen/input.h
index b3bf811cd1..f04ecb24f7 100644
--- a/engines/queen/input.h
+++ b/engines/queen/input.h
@@ -46,7 +46,7 @@ public:
MOUSE_RBUTTON = 2
};
- Input(Common::Language language, OSystem *system, QueenEngine *vm);
+ Input(Common::Language language, OSystem *system);
void delay(uint amount);
@@ -96,8 +96,6 @@ private:
Common::EventManager *_eventMan;
- QueenEngine *_vm;
-
//! some cutaways require update() run faster
bool _fastMode;
diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp
index 704019641b..474f72eca5 100644
--- a/engines/queen/journal.cpp
+++ b/engines/queen/journal.cpp
@@ -400,7 +400,7 @@ static void removeLeadingAndTrailingSpaces(char *dst, size_t dstSize, const char
while (src[lastNonSpaceIndex] == ' ')
--lastNonSpaceIndex;
- size_t newLen = lastNonSpaceIndex - firstNonSpaceIndex + 1;
+ uint newLen = lastNonSpaceIndex - firstNonSpaceIndex + 1;
assert(newLen < dstSize);
for (size_t i = 0; i < newLen; ++i) {
dst[i] = src[firstNonSpaceIndex + i];
@@ -559,7 +559,7 @@ void Journal::updateTextField(uint16 ascii, int keycode) {
}
break;
default:
- if (isprint((char)ascii) &&
+ if (Common::isPrint((char)ascii) &&
_textField.textCharsCount < (sizeof(_textField.text) - 1) &&
_vm->display()->textWidth(_textField.text) < _textField.w) {
_textField.text[_textField.textCharsCount] = (char)ascii;
diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp
index 6d90254608..ea13e5973e 100644
--- a/engines/queen/logic.cpp
+++ b/engines/queen/logic.cpp
@@ -101,7 +101,7 @@ void Logic::readQueenJas() {
}
_roomData[_numRooms + 1] = _numObjects;
- if ((_vm->resource()->isDemo() && _vm->resource()->getPlatform() == Common::kPlatformPC) ||
+ if ((_vm->resource()->isDemo() && _vm->resource()->getPlatform() == Common::kPlatformDOS) ||
(_vm->resource()->isInterview() && _vm->resource()->getPlatform() == Common::kPlatformAmiga)) {
_sfxName = NULL;
} else {
@@ -1798,7 +1798,7 @@ void Logic::asmScaleBlimp() {
int16 x = bob->x;
int16 y = bob->y;
bob->scale = 100;
- while (bob->x > 150) {
+ while (bob->x > 150 && !_vm->shouldQuit()) {
bob->x = x * 256 / z + 150;
bob->y = y * 256 / z + 112;
if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) {
@@ -2088,7 +2088,7 @@ bool LogicDemo::changeToSpecialRoom() {
void LogicDemo::setupSpecialMoveTable() {
_specialMoves[4] = &LogicDemo::asmMakeJoeUseUnderwear;
_specialMoves[14] = &LogicDemo::asmEndDemo;
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
_specialMoves[5] = &LogicDemo::asmSwitchToDressPalette;
}
}
@@ -2185,7 +2185,7 @@ void LogicGame::setupSpecialMoveTable() {
_specialMoves[31] = &LogicGame::asmWaitForCarPosition;
_specialMoves[33] = &LogicGame::asmAttemptPuzzle;
_specialMoves[34] = &LogicGame::asmScrollTitle;
- if (_vm->resource()->getPlatform() == Common::kPlatformPC) {
+ if (_vm->resource()->getPlatform() == Common::kPlatformDOS) {
_specialMoves[5] = &LogicGame::asmSwitchToDressPalette;
_specialMoves[6] = &LogicGame::asmSwitchToNormalPalette;
_specialMoves[13] = &LogicGame::asmShrinkRobot;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index c403536e22..08fc594560 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -500,7 +500,7 @@ Common::Error QueenEngine::run() {
_display = new Display(this, _system);
_graphics = new Graphics(this);
_grid = new Grid(this);
- _input = new Input(_resource->getLanguage(), _system, this);
+ _input = new Input(_resource->getLanguage(), _system);
if (_resource->isDemo()) {
_logic = new LogicDemo(this);
diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp
index 84043fa3af..6a55929d65 100644
--- a/engines/queen/resource.cpp
+++ b/engines/queen/resource.cpp
@@ -204,11 +204,11 @@ bool Resource::detectVersion(DetectedGameVersion *ver, Common::File *f) {
switch (ver->str[0]) {
case 'P':
ver->features |= GF_FLOPPY;
- ver->platform = Common::kPlatformPC;
+ ver->platform = Common::kPlatformDOS;
break;
case 'C':
ver->features |= GF_TALKIE;
- ver->platform = Common::kPlatformPC;
+ ver->platform = Common::kPlatformDOS;
break;
case 'a':
ver->features |= GF_FLOPPY;
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp
index ac58dda728..6731a51e04 100644
--- a/engines/queen/sound.cpp
+++ b/engines/queen/sound.cpp
@@ -246,8 +246,8 @@ void PCSound::playSong(int16 songNum) {
if (!musicOn())
return;
- int override = (_vm->resource()->isDemo()) ? _songDemo[songNum - 1].override : _song[songNum - 1].override;
- switch (override) {
+ int overrideCmd = (_vm->resource()->isDemo()) ? _songDemo[songNum - 1].overrideCmd : _song[songNum - 1].overrideCmd;
+ switch (overrideCmd) {
// Override all songs
case 1:
break;
@@ -771,4 +771,4 @@ bool AmigaSound::playSpecialSfx(int16 sfx) {
return true;
}
-} //End of namespace Queen
+} // End of namespace Queen
diff --git a/engines/queen/sound.h b/engines/queen/sound.h
index 371500f356..6a5dfc2c28 100644
--- a/engines/queen/sound.h
+++ b/engines/queen/sound.h
@@ -39,7 +39,7 @@ struct SongData {
int16 volume;
int16 tempo;
int16 reverb;
- int16 override;
+ int16 overrideCmd;
int16 ignore;
};
diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp
index 94bc105bb0..1531510ba4 100644
--- a/engines/queen/talk.cpp
+++ b/engines/queen/talk.cpp
@@ -96,7 +96,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
}
int16 oldLevel = 0;
- bool personWalking = false; // FIXME: unused
// Lines 828-846 in talk.c
for (i = 1; i <= 4; i++) {
@@ -174,8 +173,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
if (1 == choicesLeft) {
// Automatically run the final dialogue option
- if (speak(_talkString[0], &person, otherVoiceFilePrefix))
- personWalking = true;
+ speak(_talkString[0], &person, otherVoiceFilePrefix);
if (_vm->input()->talkQuit())
break;
@@ -251,8 +249,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
findDialogueString(_person1PtrOff, head, _pMax, _talkString[0]);
if (_talkString[0][0] != '\0') {
sprintf(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head);
- if (speak(_talkString[0], &person, otherVoiceFilePrefix))
- personWalking = true;
+ speak(_talkString[0], &person, otherVoiceFilePrefix);
}
}
}
diff --git a/engines/queen/talk.h b/engines/queen/talk.h
index 68196784b1..cba77cc255 100644
--- a/engines/queen/talk.h
+++ b/engines/queen/talk.h
@@ -88,8 +88,6 @@ private:
QueenEngine *_vm;
- bool _wasFullscren;
-
//! Raw .dog file data (without 20 byte header)
byte *_fileData;