[Scummvm-cvs-logs] SF.net SVN: scummvm:[35006] scummvm/trunk/engines/tucker
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Tue Nov 11 14:10:34 CET 2008
Revision: 35006
http://scummvm.svn.sourceforge.net/scummvm/?rev=35006&view=rev
Author: cyx
Date: 2008-11-11 13:10:34 +0000 (Tue, 11 Nov 2008)
Log Message:
-----------
enabled RTL
fixed bad glyphs display for non french version
got rid of Graphics::drawChar2
Modified Paths:
--------------
scummvm/trunk/engines/tucker/graphics.cpp
scummvm/trunk/engines/tucker/graphics.h
scummvm/trunk/engines/tucker/resource.cpp
scummvm/trunk/engines/tucker/staticres.cpp
scummvm/trunk/engines/tucker/tucker.cpp
scummvm/trunk/engines/tucker/tucker.h
Modified: scummvm/trunk/engines/tucker/graphics.cpp
===================================================================
--- scummvm/trunk/engines/tucker/graphics.cpp 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/graphics.cpp 2008-11-11 13:10:34 UTC (rev 35006)
@@ -223,36 +223,23 @@
}
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;
+ if (_charset == &_creditsCharset) {
+ dst[x] = color;
+ } else {
+ 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;
- }
- }
- dst += pitch;
- }
-}
-
-
} // namespace Tucker
Modified: scummvm/trunk/engines/tucker/graphics.h
===================================================================
--- scummvm/trunk/engines/tucker/graphics.h 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/graphics.h 2008-11-11 13:10:34 UTC (rev 35006)
@@ -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 @@
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
Modified: scummvm/trunk/engines/tucker/resource.cpp
===================================================================
--- scummvm/trunk/engines/tucker/resource.cpp 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/resource.cpp 2008-11-11 13:10:34 UTC (rev 35006)
@@ -203,6 +203,10 @@
}
}
+void TuckerEngine::closeCompressedSoundFile() {
+ _fCompressedSound.close();
+}
+
void TuckerEngine::loadImage(uint8 *dst, int type) {
int count = 0;
Common::File f;
@@ -254,7 +258,8 @@
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 @@
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) {
Modified: scummvm/trunk/engines/tucker/staticres.cpp
===================================================================
--- scummvm/trunk/engines/tucker/staticres.cpp 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/staticres.cpp 2008-11-11 13:10:34 UTC (rev 35006)
@@ -24,6 +24,7 @@
*/
#include "tucker/tucker.h"
+#include "tucker/graphics.h"
namespace Tucker {
@@ -233,4 +234,12 @@
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
Modified: scummvm/trunk/engines/tucker/tucker.cpp
===================================================================
--- scummvm/trunk/engines/tucker/tucker.cpp 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/tucker.cpp 2008-11-11 13:10:34 UTC (rev 35006)
@@ -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 @@
return Common::kNoError;
}
+bool TuckerEngine::hasFeature(EngineFeature f) const {
+ return (f == kSupportsRTL);
+}
+
Common::Error TuckerEngine::go() {
mainLoop();
return Common::kNoError;
@@ -469,30 +473,7 @@
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 @@
if (_flagsTable[100] != 1) {
handleCongratulationsSequence();
}
+ closeCompressedSoundFile();
freeBuffers();
}
@@ -1700,6 +1682,33 @@
}
}
+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 @@
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;
}
Modified: scummvm/trunk/engines/tucker/tucker.h
===================================================================
--- scummvm/trunk/engines/tucker/tucker.h 2008-11-11 13:08:06 UTC (rev 35005)
+++ scummvm/trunk/engines/tucker/tucker.h 2008-11-11 13:10:34 UTC (rev 35006)
@@ -210,7 +210,7 @@
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 @@
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 @@
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 @@
Common::RandomSource _rnd;
+ Common::Language _lang;
int _quitGame;
bool _fastMode;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list