aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2003-12-26 15:36:28 +0000
committerGregory Montoir2003-12-26 15:36:28 +0000
commit749b5d4ca52c4af402dab8727f752234ff9396b7 (patch)
treec17381727113e52a3140e29314eb1158888558e7
parent5da05a84cb7b56233bfeb663a48d2b2515999752 (diff)
downloadscummvm-rg350-749b5d4ca52c4af402dab8727f752234ff9396b7.tar.gz
scummvm-rg350-749b5d4ca52c4af402dab8727f752234ff9396b7.tar.bz2
scummvm-rg350-749b5d4ca52c4af402dab8727f752234ff9396b7.zip
cleanup
svn-id: r11946
-rw-r--r--queen/display.cpp50
-rw-r--r--queen/display.h11
-rw-r--r--queen/graphics.cpp6
-rw-r--r--queen/resource.cpp60
-rw-r--r--queen/resource.h10
5 files changed, 68 insertions, 69 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index 5f31cfb4df..1635ff97b3 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -753,7 +753,7 @@ void Display::fill(RenderingBuffer dst, uint16 x, uint16 y, uint16 w, uint16 h,
}
-void Display::pcxRead(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) {
+void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) {
while (h--) {
uint8 *p = dst;
@@ -773,41 +773,23 @@ void Display::pcxRead(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, u
}
-void Display::pcxReadBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) {
+void Display::readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) {
_bdWidth = READ_LE_UINT16(pcxBuf + 12);
_bdHeight = READ_LE_UINT16(pcxBuf + 14);
- pcxRead(_buffer[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight);
+ readPCX(_buffer[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight);
memcpy(_pal.room, pcxBuf + size - 768, useFullPal ? 256 * 3 : 144 * 3);
}
-void Display::pcxReadPanel(const uint8 *pcxBuf, uint32 size) {
+void Display::readPCXPanel(const uint8 *pcxBuf, uint32 size) {
uint8 *dst = _buffer[RB_PANEL] + PANEL_W * 10;
- pcxRead(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
+ readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
memcpy(_pal.room + 144 * 3, pcxBuf + size - 768 + 144 * 3, (256 - 144) * 3);
}
-void Display::textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
-
- debug(9, "Display::textDraw(%s)", text);
- _textRenderer.drawString(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined);
-}
-
-
-uint16 Display::textWidth(const char *text) const {
-
- uint16 len = 0;
- while (*text) {
- len += _textRenderer._charWidth[ (uint8)*text ];
- ++text;
- }
- return len;
-}
-
-
void Display::horizontalScrollUpdate(int16 xCamera) {
debug(9, "Display::horizontalScrollUpdate(%d)", xCamera);
@@ -868,6 +850,24 @@ void Display::showMouseCursor(bool show) {
}
+uint16 Display::textWidth(const char *text) const {
+
+ uint16 len = 0;
+ while (*text) {
+ len += _textRenderer._charWidth[ (uint8)*text ];
+ ++text;
+ }
+ return len;
+}
+
+
+void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
+
+ debug(9, "Display::drawText(%s)", text);
+ _textRenderer.drawString(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined);
+}
+
+
void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
uint8 *p = _buffer[RB_SCREEN];
@@ -913,12 +913,12 @@ void Display::blankScreenEffect1() {
uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - MINI_H - 2) + 1;
uint8 *p = _buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x;
blit(RB_MINI, 0, 0, p, MINI_W, MINI_H, _bufPitch[RB_SCREEN], false, false);
- if (_vm->randomizer.getRandomNumber(1) & 1) {
+ if (_vm->randomizer.getRandomNumber(1)) {
--x;
} else {
++x;
}
- if (_vm->randomizer.getRandomNumber(1) & 1) {
+ if (_vm->randomizer.getRandomNumber(1)) {
--y;
} else {
++y;
diff --git a/queen/display.h b/queen/display.h
index 16dc3fb281..34faf886df 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -92,12 +92,9 @@ public:
void blit(RenderingBuffer dstBuf, uint16 dstX, uint16 dstY, const uint8 *srcBuf, uint16 srcW, uint16 srcH, uint16 srcPitch, bool xflip, bool masked);
void fill(RenderingBuffer dstBuf, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color);
- void pcxRead(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h);
- void pcxReadBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal);
- void pcxReadPanel(const uint8 *pcxBuf, uint32 size);
-
- void textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
- uint16 textWidth(const char *text) const;
+ void readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h);
+ void readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal);
+ void readPCXPanel(const uint8 *pcxBuf, uint32 size);
void horizontalScrollUpdate(int16 xCamera);
void horizontalScroll(int16 scroll);
@@ -112,6 +109,8 @@ public:
void setMouseCursor(uint8 *buf, uint16 w, uint16 h, uint16 xhs, uint16 yhs);
void showMouseCursor(bool show);
+ uint16 textWidth(const char *text) const;
+ void drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
void drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col);
void drawScreen();
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 3b49cdfe14..278b06b337 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -659,7 +659,7 @@ void Graphics::textDrawAll() {
for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
const TextSlot *pts = &_texts[y];
if (!pts->text.isEmpty()) {
- _vm->display()->textDraw(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
+ _vm->display()->drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
}
}
}
@@ -715,7 +715,7 @@ void Graphics::loadBackdrop(const char* name, uint16 room) {
error("Unable to load backdrop : '%s'", name);
}
uint32 size = _vm->resource()->fileSize(name);
- _vm->display()->pcxReadBackdrop(pcxbuf, size, room > 114);
+ _vm->display()->readPCXBackdrop(pcxbuf, size, room > 114);
delete[] pcxbuf;
if (room >= 90) {
@@ -731,7 +731,7 @@ void Graphics::loadPanel() {
error("Unable to open panel file");
}
uint32 size = _vm->resource()->fileSize("panel.pcx");
- _vm->display()->pcxReadPanel(pcxbuf, size);
+ _vm->display()->readPCXPanel(pcxbuf, size);
delete[] pcxbuf;
}
diff --git a/queen/resource.cpp b/queen/resource.cpp
index 9133c3c7f0..cd4daf7c8d 100644
--- a/queen/resource.cpp
+++ b/queen/resource.cpp
@@ -28,17 +28,17 @@ namespace Queen {
const char *Resource::_tableFilename = "queen.tbl";
const GameVersion Resource::_gameVersions[] = {
- { "PEM10", true, false, 0x00000008, 22677657 },
- { "CEM10", false, false, 0x0000584E, 190787021 },
- { "PFM10", true, false, 0x0002CD93, 22157304 },
- { "CFM10", false, false, 0x00032585, 186689095 },
- { "PGM10", true, false, 0x00059ACA, 22240013 },
- { "CGM10", false, false, 0x0005F2A7, 217648975 },
- { "PIM10", true, false, 0x000866B1, 22461366 },
- { "CIM10", false, false, 0x0008BEE2, 190795582 },
- { "CSM10", false, false, 0x000B343C, 190730602 },
- { "PE100", true, true, 0x000DA981, 3724538 },
- { "PE100", true, true, 0x000DB63A, 3732177 }
+ { "PEM10", false, 0x00000008, 22677657 },
+ { "CEM10", false, 0x0000584E, 190787021 },
+ { "PFM10", false, 0x0002CD93, 22157304 },
+ { "CFM10", false, 0x00032585, 186689095 },
+ { "PGM10", false, 0x00059ACA, 22240013 },
+ { "CGM10", false, 0x0005F2A7, 217648975 },
+ { "PIM10", false, 0x000866B1, 22461366 },
+ { "CIM10", false, 0x0008BEE2, 190795582 },
+ { "CSM10", false, 0x000B343C, 190730602 },
+ { "PE100", true, 0x000DA981, 3724538 },
+ { "PE100", true, 0x000DB63A, 3732177 }
};
@@ -164,36 +164,36 @@ bool Resource::exists(const char *filename) {
const char *Resource::JASVersion() {
static char versionStr[6];
- if (_gameVersion->isDemo)
- _resourceFile->seek(fileOffset("QUEEN.JAS") + DEMO_JAS_VERSION_OFFSET, SEEK_SET );
+ if (isDemo())
+ _resourceFile->seek(fileOffset("QUEEN.JAS") + JAS_VERSION_OFFSET_DEMO, SEEK_SET);
else
_resourceFile->seek(fileOffset("QUEEN.JAS") + JAS_VERSION_OFFSET, SEEK_SET);
_resourceFile->read(versionStr, 6);
return versionStr;
}
-bool Resource::isDemo() {
+bool Resource::isDemo() const {
return _gameVersion->isDemo;
}
-bool Resource::isFloppy() {
- return _gameVersion->isFloppy;
+bool Resource::isFloppy() const {
+ return _gameVersion->versionString[0] == 'P';
}
-Language Resource::getLanguage() {
+Language Resource::getLanguage() const {
switch (_gameVersion->versionString[1]) {
- case 'E':
- return ENGLISH;
- case 'G':
- return GERMAN;
- case 'F':
- return FRENCH;
- case 'I':
- return ITALIAN;
- case 'S':
- return SPANISH;
- default:
- return ENGLISH;
+ case 'E':
+ return ENGLISH;
+ case 'G':
+ return GERMAN;
+ case 'F':
+ return FRENCH;
+ case 'I':
+ return ITALIAN;
+ case 'S':
+ return SPANISH;
+ default:
+ return ENGLISH;
}
}
@@ -236,7 +236,7 @@ bool Resource::readTableFile() {
void Resource::readTableCompResource() {
GameVersion *gv = new GameVersion;
_resourceFile->read(gv->versionString, 6);
- gv->isFloppy = _resourceFile->readByte() != 0;
+ _resourceFile->readByte();
gv->isDemo = _resourceFile->readByte() != 0;
_compression = _resourceFile->readByte();
_resourceEntries = _resourceFile->readUint16BE();
diff --git a/queen/resource.h b/queen/resource.h
index c02033b808..c520b25c0f 100644
--- a/queen/resource.h
+++ b/queen/resource.h
@@ -53,7 +53,6 @@ struct ResourceEntry {
struct GameVersion {
char versionString[6];
- bool isFloppy;
bool isDemo;
uint32 tableOffset;
uint32 dataFileSize;
@@ -69,19 +68,20 @@ public:
uint8 *loadFileMalloc(const char *filename, uint32 skipBytes = 0, byte *dstBuf = NULL);
char *getJAS2Line();
bool exists(const char *filename);
- bool isDemo();
- bool isFloppy();
+ bool isDemo() const;
+ bool isFloppy() const;
uint8 compression() { return _compression; }
uint32 fileSize(const char *filename);
uint32 fileOffset(const char *filename);
File *giveCompressedSound(const char *filename);
- Language getLanguage();
+ Language getLanguage() const;
const char *JASVersion();
bool writeSave(uint16 slot, const byte *saveData, uint32 size);
bool readSave(uint16 slot, byte *&ptr);
enum {
- DEMO_JAS_VERSION_OFFSET = 0x119A8,
+ JAS_VERSION_OFFSET_DEMO = 0x119A8,
+ JAS_VERSION_OFFSET_INTV = 0xCF8,
JAS_VERSION_OFFSET = 0x12484
};