SCI: Slight cleanup to undithering code

This commit is contained in:
Max Horn 2011-05-09 14:41:49 +02:00
parent b4058a696a
commit 76cf7bc907
5 changed files with 32 additions and 23 deletions

View File

@ -1532,7 +1532,7 @@ bool Console::cmdUndither(int argc, const char **argv) {
}
bool flag = atoi(argv[1]) ? true : false;
_engine->_gfxScreen->debugUnditherSetState(flag);
_engine->_gfxScreen->enableUndithering(flag);
if (flag)
DebugPrintf("undithering ENABLED\n");
else

View File

@ -512,7 +512,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
// WORKAROUND: we remove certain visual&priority lines in underwater rooms of iceman, when not dithering the
// picture. Normally those lines aren't shown, because they share the same color as the dithered
// fill color combination. When not dithering, those lines would appear and get distracting.
if ((_screen->getUnditherState()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
if ((_screen->isUnditheringEnabled()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
icemanDrawFix = true;
}
if (g_sci->getGameId() == GID_KQ5) {

View File

@ -111,7 +111,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
_picNotValid = 0;
_picNotValidSci11 = 0;
_unditherState = true;
_unditheringEnabled = true;
_fontIsUpscaled = false;
if (_resMan->getViewType() != kViewEga) {
@ -560,7 +560,7 @@ void GfxScreen::dither(bool addToFlag) {
byte *visualPtr = _visualScreen;
byte *displayPtr = _displayScreen;
if (!_unditherState) {
if (!_unditheringEnabled) {
// Do dithering on visual and display-screen
for (y = 0; y < _height; y++) {
for (x = 0; x < _width; x++) {
@ -624,12 +624,12 @@ void GfxScreen::ditherForceDitheredColor(byte color) {
_ditheredPicColors[color] = 256;
}
void GfxScreen::debugUnditherSetState(bool flag) {
_unditherState = flag;
void GfxScreen::enableUndithering(bool flag) {
_unditheringEnabled = flag;
}
int16 *GfxScreen::unditherGetDitheredBgColors() {
if (_unditherState)
if (_unditheringEnabled)
return (int16 *)&_ditheredPicColors;
else
return NULL;

View File

@ -95,9 +95,10 @@ public:
return _upscaledHires;
}
bool getUnditherState() const {
return _unditherState;
bool isUnditheringEnabled() const {
return _unditheringEnabled;
}
void enableUndithering(bool flag);
void putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, uint16 chr, byte color);
byte getVisual(int x, int y);
@ -119,7 +120,6 @@ public:
// Force a color combination as a dithered color
void ditherForceDitheredColor(byte color);
void debugUnditherSetState(bool flag);
int16 *unditherGetDitheredBgColors();
void debugShowMap(int mapNo);
@ -151,7 +151,10 @@ private:
void setVerticalShakePos(uint16 shakePos);
bool _unditherState;
/**
* If this flag is true, undithering is enabled, otherwise disabled.
*/
bool _unditheringEnabled;
int16 _ditheredPicColors[DITHERED_BG_COLORS_SIZE];
// These screens have the real resolution of the game engine (320x200 for
@ -161,13 +164,13 @@ private:
byte *_priorityScreen;
byte *_controlScreen;
// This screen is the one that is actually displayed to the user. It may be
// 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
// Only read from this buffer for Save/ShowBits usage.
/**
* This screen is the one that is actually displayed to the user. It may be
* 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
* Only read from this buffer for Save/ShowBits usage.
*/
byte *_displayScreen;
Common::Rect getScaledRect(Common::Rect rect);
ResourceManager *_resMan;
/**
@ -176,16 +179,22 @@ private:
*/
byte *_activeScreen;
// This variable defines, if upscaled hires is active and what upscaled mode
// is used.
/**
* This variable defines, if upscaled hires is active and what upscaled mode
* is used.
*/
GfxScreenUpscaledMode _upscaledHires;
// This here holds a translation for vertical coordinates between native
// (visual) and actual (display) screen.
/**
* This here holds a translation for vertical coordinates between native
* (visual) and actual (display) screen.
*/
int _upscaledMapping[SCI_SCREEN_UPSCALEDMAXHEIGHT + 1];
// This defines whether or not the font we're drawing is already scaled
// to the screen size (and we therefore should not upscale it ourselves).
/**
* This defines whether or not the font we're drawing is already scaled
* to the screen size (and we therefore should not upscale it ourselves).
*/
bool _fontIsUpscaled;
uint16 getLowResScreenHeight();

View File

@ -218,7 +218,7 @@ Common::Error SciEngine::run() {
// Initialize the game screen
_gfxScreen = new GfxScreen(_resMan);
_gfxScreen->debugUnditherSetState(ConfMan.getBool("disable_dithering"));
_gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
// Create debugger console. It requires GFX to be initialized
_console = new Console(this);