aboutsummaryrefslogtreecommitdiff
path: root/engines/tucker
diff options
context:
space:
mode:
authorGregory Montoir2008-11-11 13:10:34 +0000
committerGregory Montoir2008-11-11 13:10:34 +0000
commitb7c9958e82da768054ea6bc0b0a2bc7e173b3ef1 (patch)
tree522de642d43104b8849f2dbcc58855be16c66a00 /engines/tucker
parentedd61a4f4077ac0ddd649c2f186fa46b8bc830cf (diff)
downloadscummvm-rg350-b7c9958e82da768054ea6bc0b0a2bc7e173b3ef1.tar.gz
scummvm-rg350-b7c9958e82da768054ea6bc0b0a2bc7e173b3ef1.tar.bz2
scummvm-rg350-b7c9958e82da768054ea6bc0b0a2bc7e173b3ef1.zip
enabled RTL
fixed bad glyphs display for non french version got rid of Graphics::drawChar2 svn-id: r35006
Diffstat (limited to 'engines/tucker')
-rw-r--r--engines/tucker/graphics.cpp31
-rw-r--r--engines/tucker/graphics.h24
-rw-r--r--engines/tucker/resource.cpp16
-rw-r--r--engines/tucker/staticres.cpp9
-rw-r--r--engines/tucker/tucker.cpp61
-rw-r--r--engines/tucker/tucker.h7
6 files changed, 84 insertions, 64 deletions
diff --git a/engines/tucker/graphics.cpp b/engines/tucker/graphics.cpp
index 4498f553bb..4955068b05 100644
--- a/engines/tucker/graphics.cpp
+++ b/engines/tucker/graphics.cpp
@@ -223,36 +223,23 @@ void Graphics::copyTo640(uint8 *dst, const uint8 *src, int w, int srcPitch, int
}
void Graphics::drawStringChar(uint8 *dst, uint8 chr, int pitch, uint8 chrColor, const uint8 *src) {
- if (chr < 32 || chr - 32 >= kCharSet1CharsCount) {
+ if (chr < 32 || chr - 32 >= _charset->xCount * _charset->yCount) {
return;
}
- int offset = (chr - 32) * kCharSet1CharSize;
- for (int y = 0; y < kCharSet1CharH; ++y) {
- for (int x = 0; x < kCharSet1CharW; ++x) {
+ int offset = (chr - 32) * _charset->charH * _charset->charW;
+ for (int y = 0; y < _charset->charH; ++y) {
+ for (int x = 0; x < _charset->charW; ++x) {
const int color = src[offset++];
if (color != 0) {
- dst[x] = (color == 128) ? color : chrColor;
- }
- }
- dst += pitch;
- }
-}
-
-void Graphics::drawStringChar2(uint8 *dst, uint8 chr, int pitch, uint8 chrColor, const uint8 *src) {
- if (chr < 32 || chr - 32 >= kCharSet2CharsCount) {
- return;
- }
- int offset = (chr - 32) * kCharSet2CharSize;
- for (int y = 0; y < kCharSet2CharH; ++y) {
- for (int x = 0; x < kCharSet2CharW; ++x) {
- const int color = src[offset++];
- if (color != 0) {
- dst[x] = color;
+ if (_charset == &_creditsCharset) {
+ dst[x] = color;
+ } else {
+ dst[x] = (color == 128) ? color : chrColor;
+ }
}
}
dst += pitch;
}
}
-
} // namespace Tucker
diff --git a/engines/tucker/graphics.h b/engines/tucker/graphics.h
index c04ddc8b67..4ca51c39ec 100644
--- a/engines/tucker/graphics.h
+++ b/engines/tucker/graphics.h
@@ -30,20 +30,16 @@
namespace Tucker {
-enum {
- kCharSet1CharW = 10,
- kCharSet1CharH = 10,
- kCharSet1CharSize = kCharSet1CharW * kCharSet1CharH,
- kCharSet1CharsCount = 32 * 7,
- kCharSet2CharW = 19,
- kCharSet2CharH = 10,
- kCharSet2CharSize = kCharSet2CharW * kCharSet2CharH,
- kCharSet2CharsCount = 16 * 6
-};
-
class Graphics {
public:
+ struct Charset {
+ int charW;
+ int charH;
+ int xCount;
+ int yCount;
+ };
+
static int encodeRLE(const uint8 *src, uint8 *dst, int w, int h);
static int encodeRAW(const uint8 *src, uint8 *dst, int w, int h);
@@ -57,6 +53,12 @@ public:
static void drawStringChar(uint8 *dst, uint8 chr, int pitch, uint8 chrColor, const uint8 *src);
static void drawStringChar2(uint8 *dst, uint8 chr, int pitch, uint8 chrColor, const uint8 *src);
+
+ static const Charset _enCharset;
+ static const Charset _frCharset;
+ static const Charset _creditsCharset;
+
+ static const Charset *_charset;
};
} // namespace Tucker
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 15bfe1a9c8..80ccb8f9a4 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -203,6 +203,10 @@ void TuckerEngine::openCompressedSoundFile() {
}
}
+void TuckerEngine::closeCompressedSoundFile() {
+ _fCompressedSound.close();
+}
+
void TuckerEngine::loadImage(uint8 *dst, int type) {
int count = 0;
Common::File f;
@@ -254,7 +258,8 @@ void TuckerEngine::loadCursor() {
void TuckerEngine::loadCharset() {
strcpy(_fileToLoad, "charset.pcx");
loadImage(_loadTempBuf, 0);
- loadCharsetHelper(kCharSet1CharW, kCharSet1CharH, 32, 7);
+ Graphics::_charset = (_lang == Common::FR_FRA) ? &Graphics::_frCharset : &Graphics::_enCharset;
+ loadCharsetHelper();
}
void TuckerEngine::loadCharset2() {
@@ -263,10 +268,15 @@ void TuckerEngine::loadCharset2() {
memcpy(_charWidthTable + 65, _charWidthCharset2, 58);
strcpy(_fileToLoad, "char2.pcx");
loadImage(_loadTempBuf, 0);
- loadCharsetHelper(kCharSet2CharW, kCharSet2CharH, 16, 6);
+ Graphics::_charset = &Graphics::_creditsCharset;
+ loadCharsetHelper();
}
-void TuckerEngine::loadCharsetHelper(int charW, int charH, int xSize, int ySize) {
+void TuckerEngine::loadCharsetHelper() {
+ const int charW = Graphics::_charset->charW;
+ const int charH = Graphics::_charset->charH;
+ const int xSize = Graphics::_charset->xCount;
+ const int ySize = Graphics::_charset->yCount;
int offset = 0;
for (int y = 0; y < ySize; ++y) {
for (int x = 0; x < xSize; ++x) {
diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp
index 2a4cdefe9d..9a2402039b 100644
--- a/engines/tucker/staticres.cpp
+++ b/engines/tucker/staticres.cpp
@@ -24,6 +24,7 @@
*/
#include "tucker/tucker.h"
+#include "tucker/graphics.h"
namespace Tucker {
@@ -233,4 +234,12 @@ const uint8 TuckerEngine::_charWidthCharset2[58] = {
0x13, 0x12, 0x10, 0x11, 0x13, 0x14, 0x14, 0x10, 0x13, 0x10,
};
+const Graphics::Charset Graphics::_enCharset = { 10, 8, 32, 3 };
+
+const Graphics::Charset Graphics::_frCharset = { 10, 10, 32, 7 };
+
+const Graphics::Charset Graphics::_creditsCharset = { 19, 10, 16, 7 };
+
+const Graphics::Charset *Graphics::_charset = 0;
+
} // namespace Tucker
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index cfa8e850d2..5b11574cfc 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -35,7 +35,7 @@
namespace Tucker {
TuckerEngine::TuckerEngine(OSystem *system, Common::Language language)
- : Engine(system) {
+ : Engine(system), _lang(language) {
}
TuckerEngine::~TuckerEngine() {
@@ -53,6 +53,10 @@ Common::Error TuckerEngine::init() {
return Common::kNoError;
}
+bool TuckerEngine::hasFeature(EngineFeature f) const {
+ return (f == kSupportsRTL);
+}
+
Common::Error TuckerEngine::go() {
mainLoop();
return Common::kNoError;
@@ -469,30 +473,7 @@ void TuckerEngine::mainLoop() {
if (_backgroundSpriteCurrentAnimation > -1 && _backgroundSpriteCurrentFrame > 0) {
drawBackgroundSprites(0);
} else {
- int offset;
- SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
- if (_mirroredDrawing == 0) {
- offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent;
- offset += chr->xOffset - 14;
- } else {
- offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent;
- offset -= chr->xSize + chr->xOffset - 14;
- }
- Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
- chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
- if (_currentSpriteAnimationLength > 1) {
- SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
- if (_mirroredDrawing == 0) {
- offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent;
- offset += chr2->xOffset - 14;
- } else {
- offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent;
- offset -= chr2->xSize + chr2->xOffset - 14;
- }
- Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
- _spriteFramesTable[_currentSpriteAnimationFrame].yOffset, // _currentCharacter instead ?
- _locationHeightTable[_locationNum], _mirroredDrawing != 0);
- }
+ drawCurrentSprite();
}
}
if (_locationHeight == 140) {
@@ -571,6 +552,7 @@ void TuckerEngine::mainLoop() {
if (_flagsTable[100] != 1) {
handleCongratulationsSequence();
}
+ closeCompressedSoundFile();
freeBuffers();
}
@@ -1700,6 +1682,33 @@ void TuckerEngine::drawBackgroundSprites(int flipX) {
}
}
+void TuckerEngine::drawCurrentSprite() {
+ int offset;
+ SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
+ if (_mirroredDrawing == 0) {
+ offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent;
+ offset += chr->xOffset - 14;
+ } else {
+ offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent;
+ offset -= chr->xSize + chr->xOffset - 14;
+ }
+ Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
+ chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
+ if (_currentSpriteAnimationLength > 1) {
+ SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
+ if (_mirroredDrawing == 0) {
+ offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent;
+ offset += chr2->xOffset - 14;
+ } else {
+ offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent;
+ offset -= chr2->xSize + chr2->xOffset - 14;
+ }
+ Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
+ _spriteFramesTable[_currentSpriteAnimationFrame].yOffset, // _currentCharacter instead ?
+ _locationHeightTable[_locationNum], _mirroredDrawing != 0);
+ }
+}
+
void TuckerEngine::setVolumeSound(int index, int volume) {
if (volume < 0) {
volume = 0;
@@ -2808,7 +2817,7 @@ void TuckerEngine::drawString2(int x, int y, int num) {
int pos = getPositionForLine(num, _ptTextBuf);
while (_ptTextBuf[pos] != '\n') {
const uint8 chr = _ptTextBuf[pos];
- Graphics::drawStringChar2(dst, chr, 640, 1, _charsetGfxBuf);
+ Graphics::drawStringChar(dst, chr, 640, 1, _charsetGfxBuf);
dst += _charWidthTable[chr];
++pos;
}
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index a027bf56df..44f9c28185 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -210,7 +210,7 @@ public:
virtual Common::Error init();
virtual Common::Error go();
- virtual bool hasFeature(EngineFeature f) const { return false; }
+ virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
protected:
@@ -261,6 +261,7 @@ protected:
void drawData3();
void execData3PreUpdate();
void drawBackgroundSprites(int flipX);
+ void drawCurrentSprite();
void setVolumeSound(int index, int volume);
void setVolumeMusic(int index, int volume);
void startSound(int offset, int index, int volume);
@@ -510,12 +511,13 @@ protected:
int handleSpecialObjectSelectionSequence();
void openCompressedSoundFile();
+ void closeCompressedSoundFile();
uint8 *loadFile(uint8 *p = 0);
void loadImage(uint8 *dst, int a);
void loadCursor();
void loadCharset();
void loadCharset2();
- void loadCharsetHelper(int charW, int charH, int xSize, int ySize);
+ void loadCharsetHelper();
void loadCharSizeDta();
void loadPanel();
void loadBudSpr(int startOffset);
@@ -538,6 +540,7 @@ protected:
Common::RandomSource _rnd;
+ Common::Language _lang;
int _quitGame;
bool _fastMode;