aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-09 14:09:45 +0000
committerMartin Kiewitz2010-01-09 14:09:45 +0000
commita815d0e12a42b8880b5f629d6053f96139a46acc (patch)
tree070c14af7b0fac7732e24258b4d10e625dfc881f
parent5d4ff2930bee11dfef21c66009245d144db5d205 (diff)
downloadscummvm-rg350-a815d0e12a42b8880b5f629d6053f96139a46acc.tar.gz
scummvm-rg350-a815d0e12a42b8880b5f629d6053f96139a46acc.tar.bz2
scummvm-rg350-a815d0e12a42b8880b5f629d6053f96139a46acc.zip
SCI: added new debug command "picture_visualize", which enables visualization of the drawing process of EGA pictures
svn-id: r47201
-rw-r--r--engines/sci/console.cpp14
-rw-r--r--engines/sci/console.h1
-rw-r--r--engines/sci/graphics/gfx.cpp8
-rw-r--r--engines/sci/graphics/gfx.h5
-rw-r--r--engines/sci/graphics/gui.cpp5
-rw-r--r--engines/sci/graphics/gui.h1
-rw-r--r--engines/sci/graphics/picture.cpp14
-rw-r--r--engines/sci/graphics/picture.h5
8 files changed, 44 insertions, 9 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 05335d46ad..30dd6b179c 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -115,6 +115,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
DCmd_Register("draw_robot", WRAP_METHOD(Console, cmdDrawRobot));
#endif
DCmd_Register("undither", WRAP_METHOD(Console, cmdUndither));
+ DCmd_Register("pic_visualize", WRAP_METHOD(Console, cmdPicVisualize));
DCmd_Register("play_video", WRAP_METHOD(Console, cmdPlayVideo));
// Segments
DCmd_Register("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable));
@@ -314,6 +315,7 @@ bool Console::cmdHelp(int argc, const char **argv) {
DebugPrintf(" set_palette - Sets a palette resource\n");
DebugPrintf(" draw_pic - Draws a pic resource\n");
DebugPrintf(" draw_cel - Draws a cel from a view resource\n");
+ DebugPrintf(" pic_visualize - Enables visualization of the drawing process of EGA pictures\n");
DebugPrintf(" undither - Enable/disable undithering\n");
DebugPrintf("\n");
DebugPrintf("Segments:\n");
@@ -1049,6 +1051,18 @@ bool Console::cmdUndither(int argc, const char **argv) {
return _vm->_gamestate->_gui->debugUndither(flag);
}
+bool Console::cmdPicVisualize(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Enable/disable picture visualization (EGA only)\n");
+ DebugPrintf("Usage: %s <0/1>\n", argv[0]);
+ return true;
+ }
+
+ bool state = atoi(argv[1]) ? true : false;
+
+ return _vm->_gamestate->_gui->debugEGAdrawingVisualize(state);
+}
+
bool Console::cmdPlayVideo(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Plays a SEQ, AVI or VMD video.\n");
diff --git a/engines/sci/console.h b/engines/sci/console.h
index e325db25f1..6829208179 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -90,6 +90,7 @@ private:
bool cmdDrawRobot(int argc, const char **argv);
#endif
bool cmdUndither(int argc, const char **argv);
+ bool cmdPicVisualize(int argc, const char **argv);
bool cmdPlayVideo(int argc, const char **argv);
// Segments
bool cmdPrintSegmentTable(int argc, const char **argv);
diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp
index d2196d5140..d671d8e6e8 100644
--- a/engines/sci/graphics/gfx.cpp
+++ b/engines/sci/graphics/gfx.cpp
@@ -66,6 +66,8 @@ void Gfx::init(Text *text) {
_text->SetFont(0);
_menuPort->rect = Common::Rect(0, 0, _screen->getWidth(), _screen->getHeight());
_menuBarRect = Common::Rect(0, 0, _screen->getWidth(), 9);
+
+ _EGAdrawingVisualize = false;
}
void Gfx::purgeCache() {
@@ -323,8 +325,12 @@ void Gfx::BitsFree(reg_t memoryHandle) {
}
}
+void Gfx::setEGAdrawingVisualize(bool state) {
+ _EGAdrawingVisualize = state;
+}
+
void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) {
- SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId);
+ SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId, _EGAdrawingVisualize);
// do we add to a picture? if not -> clear screen with white
if (!addToFlag)
diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h
index 1c47d6af2a..eb7a02b2a1 100644
--- a/engines/sci/graphics/gfx.h
+++ b/engines/sci/graphics/gfx.h
@@ -83,6 +83,8 @@ public:
void BitsRestore(reg_t memoryHandle);
void BitsFree(reg_t memoryHandle);
+ void setEGAdrawingVisualize(bool state);
+
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
@@ -124,6 +126,9 @@ private:
byte _priorityBands[200];
ViewCache _cachedViews;
+
+ // true means make EGA picture drawing visible
+ bool _EGAdrawingVisualize;
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index ce03d94d14..eaf1fd4ac1 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -964,4 +964,9 @@ bool SciGui::debugShowMap(int mapNo) {
return false;
}
+bool SciGui::debugEGAdrawingVisualize(bool state) {
+ _gfx->setEGAdrawingVisualize(state);
+ return false;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index c3c5ca6d85..a42ae2fee5 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -167,6 +167,7 @@ public:
virtual bool debugUndither(bool flag);
virtual bool debugShowMap(int mapNo);
+ virtual bool debugEGAdrawingVisualize(bool state);
// FIXME: Don't store EngineState
virtual void resetEngineState(EngineState *s);
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index d7d7fa63d6..4dfa80ee11 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -33,8 +33,8 @@
namespace Sci {
-SciGuiPicture::SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId)
- : _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId) {
+SciGuiPicture::SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
+ : _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) {
assert(resourceId != -1);
initData(resourceId);
}
@@ -589,11 +589,11 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
default:
error("Unsupported pic-operation %X", pic_op);
}
- //printf("picop %X\n", pic_op);
- // for debug purposes
- //_screen->copyToScreen();
- //g_system->updateScreen();
- //g_system->delayMillis(500);
+ if ((_EGAdrawingVisualize) && (isEGA)) {
+ _screen->copyToScreen();
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
}
error("picture vector data without terminator");
}
diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h
index fcab244a36..04a5fb8fd6 100644
--- a/engines/sci/graphics/picture.h
+++ b/engines/sci/graphics/picture.h
@@ -34,7 +34,7 @@ namespace Sci {
class SciGuiPicture {
public:
- SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId);
+ SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
~SciGuiPicture();
GuiResourceId getResourceId();
@@ -75,6 +75,9 @@ private:
bool _addToFlag;
int16 _EGApaletteNo;
byte _priority;
+
+ // If true, we will show the whole EGA drawing process...
+ bool _EGAdrawingVisualize;
};
} // End of namespace Sci