aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-29 14:16:20 +0000
committerMartin Kiewitz2009-10-29 14:16:20 +0000
commit8178d548eb2e822cfc7a9c21fa7c569f5b695398 (patch)
treebce90c6de9cfcedfd5dc85f228945ce0539c078c
parente5e80dd6d692b0b352913198a1bb5aa91da4402e (diff)
downloadscummvm-rg350-8178d548eb2e822cfc7a9c21fa7c569f5b695398.tar.gz
scummvm-rg350-8178d548eb2e822cfc7a9c21fa7c569f5b695398.tar.bz2
scummvm-rg350-8178d548eb2e822cfc7a9c21fa7c569f5b695398.zip
SCI/newgui: Defining color white and others in SciGuiScreen and using that. Also clears screen with 0 on sci1.1 games (needs further investigation), fixes pictures
svn-id: r45500
-rw-r--r--engines/sci/engine/kgraphics.cpp3
-rw-r--r--engines/sci/gui/gui_cursor.cpp7
-rw-r--r--engines/sci/gui/gui_cursor.h2
-rw-r--r--engines/sci/gui/gui_gfx.cpp5
-rw-r--r--engines/sci/gui/gui_picture.cpp12
-rw-r--r--engines/sci/gui/gui_screen.cpp21
-rw-r--r--engines/sci/gui/gui_screen.h8
-rw-r--r--engines/sci/sci.cpp4
8 files changed, 40 insertions, 22 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 21da6857dc..dbe3d2c109 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -440,7 +440,8 @@ reg_t kOnControl(EngineState *s, int argc, reg_t *argv) {
rect.right = rect.left + 1;
rect.bottom = rect.top + 1;
}
- return make_reg(0, s->_gui->onControl(screenMask, rect));
+ uint16 result = s->_gui->onControl(screenMask, rect);
+ return make_reg(0, result);
}
void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr);
diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp
index 76f1eb1b02..702c9447e6 100644
--- a/engines/sci/gui/gui_cursor.cpp
+++ b/engines/sci/gui/gui_cursor.cpp
@@ -30,13 +30,14 @@
#include "sci/sci.h"
#include "sci/engine/state.h"
#include "sci/gui/gui_palette.h"
+#include "sci/gui/gui_screen.h"
#include "sci/gui/gui_view.h"
#include "sci/gui/gui_cursor.h"
namespace Sci {
-SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette)
- : _resMan(resMan), _palette(palette) {
+SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen)
+ : _resMan(resMan), _palette(palette), _screen(screen) {
setPosition(Common::Point(160, 150)); // TODO: how is that different in 640x400 games?
setMoveZone(Common::Rect(0, 0, 320, 200)); // TODO: hires games
@@ -88,7 +89,7 @@ void SciGuiCursor::setShape(GuiResourceId resourceId) {
// Now find out what colors we are supposed to use
colorMapping[0] = 0; // Black is hardcoded
- colorMapping[1] = _resMan->isVGA() ? 255 : 15; // White is also hardcoded
+ colorMapping[1] = _screen->_colorWhite; // White is also hardcoded
colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR;
colorMapping[3] = _palette->matchColor(&_palette->_sysPalette, 170, 170, 170); // Grey
diff --git a/engines/sci/gui/gui_cursor.h b/engines/sci/gui/gui_cursor.h
index 9e237720ca..93527643f5 100644
--- a/engines/sci/gui/gui_cursor.h
+++ b/engines/sci/gui/gui_cursor.h
@@ -37,7 +37,7 @@ class SciGuiView;
class SciGuiPalette;
class SciGuiCursor {
public:
- SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette);
+ SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen);
~SciGuiCursor();
void show();
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index e44a44a819..0a3a36ce33 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -302,10 +302,7 @@ void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mir
picture = new SciGuiPicture(_s->resMan, this, _screen, _palette, pictureId);
// do we add to a picture? if not -> clear screen
if (!addToFlag) {
- if (_s->resMan->isVGA())
- ClearScreen(255);
- else
- ClearScreen(15);
+ ClearScreen(_screen->_colorClearScreen);
}
picture->draw(animationNr, mirroredFlag, addToFlag, paletteId);
}
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp
index 75892b7574..a21748286d 100644
--- a/engines/sci/gui/gui_picture.cpp
+++ b/engines/sci/gui/gui_picture.cpp
@@ -301,7 +301,8 @@ static const byte vector_defaultEGApriority[PIC_EGAPRIORITY_SIZE] = {
void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
byte pic_op;
- byte pic_color = 0, pic_priority = 255, pic_control = 255;
+ byte pic_color = _screen->_colorDefaultVectorData;
+ byte pic_priority = 255, pic_control = 255;
int16 x = 0, y = 0, oldx, oldy;
byte EGApalettes[PIC_EGAPALETTE_TOTALSIZE] = {0};
byte *EGApalette = &EGApalettes[_EGApaletteNo * PIC_EGAPALETTE_SIZE];
@@ -604,13 +605,8 @@ void SciGuiPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority,
// This logic was taken directly from sierra sci, floodfill will get aborted on various occations
if (screenMask & SCI_SCREEN_MASK_VISUAL) {
- if (_resMan->isVGA()) {
- if ((color == 255) || (searchColor != 255))
- return;
- } else {
- if ((color == 15) || (searchColor != 15))
- return;
- }
+ if ((color == _screen->_colorWhite) || (searchColor != _screen->_colorClearScreen))
+ return;
} else if (screenMask & SCI_SCREEN_MASK_PRIORITY) {
if ((priority == 0) || (searchPriority != 0))
return;
diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp
index 6e1be2a2d6..6818ed3182 100644
--- a/engines/sci/gui/gui_screen.cpp
+++ b/engines/sci/gui/gui_screen.cpp
@@ -33,8 +33,8 @@
namespace Sci {
-SciGuiScreen::SciGuiScreen(int16 width, int16 height, int16 scaleFactor) :
- _width(width), _height(height) {
+SciGuiScreen::SciGuiScreen(ResourceManager *resMan, int16 width, int16 height, int16 scaleFactor) :
+ _resMan(resMan), _width(width), _height(height) {
_pixels = _width * _height;
@@ -53,6 +53,23 @@ SciGuiScreen::SciGuiScreen(int16 width, int16 height, int16 scaleFactor) :
_picNotValid = false;
_unditherState = true;
+
+ if (_resMan->isVGA()) {
+ _colorWhite = 255;
+ // TODO: Find out whats really different between SCI11 and SCI1, because actually the clearScreen in SCI11
+ // really uses 255 as well
+ if (getSciVersion() >= SCI_VERSION_1_1) {
+ _colorClearScreen = 0;
+ _colorDefaultVectorData = 255;
+ } else {
+ _colorClearScreen = 255;
+ _colorDefaultVectorData = 0;
+ }
+ } else {
+ _colorWhite = 15;
+ _colorClearScreen = 15;
+ _colorDefaultVectorData = 0;
+ }
}
SciGuiScreen::~SciGuiScreen() {
diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h
index 74c5c53bc1..4c54c544f3 100644
--- a/engines/sci/gui/gui_screen.h
+++ b/engines/sci/gui/gui_screen.h
@@ -42,7 +42,7 @@ namespace Sci {
class SciGuiScreen {
public:
- SciGuiScreen(int16 width = 320, int16 height = 200, int16 scaleFactor = 1);
+ SciGuiScreen(ResourceManager *resMan, int16 width = 320, int16 height = 200, int16 scaleFactor = 1);
~SciGuiScreen();
void copyToScreen();
@@ -85,6 +85,10 @@ public:
int _picNotValid; // possible values 0, 1 and 2
+ byte _colorWhite;
+ byte _colorClearScreen;
+ byte _colorDefaultVectorData;
+
private:
void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen);
void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr);
@@ -104,6 +108,8 @@ public: // HACK. TODO: make private
byte *_displayScreen;
private:
+ ResourceManager *_resMan;
+
// this is a pointer to the currently active screen (changing it only required for debug purposes)
byte *_activeScreen;
};
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 1f38071a20..57270a4705 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -110,9 +110,9 @@ Common::Error SciEngine::run() {
_kernel = new Kernel(_resMan);
_vocabulary = new Vocabulary(_resMan);
- SciGuiScreen *screen = new SciGuiScreen();
+ SciGuiScreen *screen = new SciGuiScreen(_resMan);
SciGuiPalette *palette = new SciGuiPalette(_resMan, screen);
- SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette);
+ SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette, screen);
// We'll set the GUI below
_gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, cursor);