diff options
author | Filippos Karapetis | 2009-10-05 07:10:01 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-05 07:10:01 +0000 |
commit | 8568892bf56269c9e19c98e1b834bb407df58aa2 (patch) | |
tree | 603a7b53a2cc5376b8e92ca77881172ecc487816 /engines/sci | |
parent | 136dbba9c4542dc83814ca24f5ae1604cb380dd7 (diff) | |
download | scummvm-rg350-8568892bf56269c9e19c98e1b834bb407df58aa2.tar.gz scummvm-rg350-8568892bf56269c9e19c98e1b834bb407df58aa2.tar.bz2 scummvm-rg350-8568892bf56269c9e19c98e1b834bb407df58aa2.zip |
- Renamed GUI -> Gui and capitalized as appropriate (e.g. SciGUIwindowMgr -> SciGuiWindowMgr)
- Renamed "cell" -> "cel"
svn-id: r44649
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 4 | ||||
-rw-r--r-- | engines/sci/gfx/res_view.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 104 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 34 | ||||
-rw-r--r-- | engines/sci/gui/gui_font.cpp | 16 | ||||
-rw-r--r-- | engines/sci/gui/gui_font.h | 12 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 236 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 92 | ||||
-rw-r--r-- | engines/sci/gui/gui_helpers.h | 32 | ||||
-rw-r--r-- | engines/sci/gui/gui_picture.cpp | 36 | ||||
-rw-r--r-- | engines/sci/gui/gui_picture.h | 16 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 32 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.cpp | 194 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.h | 42 | ||||
-rw-r--r-- | engines/sci/gui/gui_windowmgr.cpp | 40 | ||||
-rw-r--r-- | engines/sci/gui/gui_windowmgr.h | 32 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 110 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 12 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 6 |
21 files changed, 543 insertions, 543 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 9090a0286c..a824b974a7 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -896,7 +896,7 @@ void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr #define K_DRAWPIC_FLAG_MIRRORED (1 << 14) reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) { - GUIResourceId pictureId = argv[0].toUint16(); + GuiResourceId pictureId = argv[0].toUint16(); uint16 flags = 0; uint16 style = 1; int16 EGApaletteNo = -1; @@ -1550,9 +1550,9 @@ void _k_view_list_mark_free(EngineState *s, reg_t off) { } reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) { - GUIResourceId viewId; - GUIViewLoopNo loopNo; - GUIViewCellNo cellNo; + GuiResourceId viewId; + GuiViewLoopNo loopNo; + GuiViewCelNo celNo; int16 leftPos, topPos, priority, control; switch (argc) { @@ -1564,12 +1564,12 @@ reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) { case 7: viewId = argv[0].toUint16(); loopNo = argv[1].toSint16(); - cellNo = argv[2].toSint16(); + celNo = argv[2].toSint16(); leftPos = argv[3].toSint16(); topPos = argv[4].toSint16(); priority = argv[5].toSint16(); control = argv[6].toSint16(); - s->gui->addToPicView(viewId, loopNo, cellNo, leftPos, topPos, priority, control); + s->gui->addToPicView(viewId, loopNo, celNo, leftPos, topPos, priority, control); break; default: error("kAddToPic with unsupported parameter count %d", argc); @@ -1610,15 +1610,15 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) { } reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { - GUIResourceId viewId = argv[0].toSint16(); - GUIViewLoopNo loopNo = argv[1].toSint16(); - GUIViewCellNo cellNo = argv[2].toSint16(); + GuiResourceId viewId = argv[0].toSint16(); + GuiViewLoopNo loopNo = argv[1].toSint16(); + GuiViewCelNo celNo = argv[2].toSint16(); int x = argv[3].toSint16(); int y = argv[4].toSint16(); int priority = (argc > 5) ? argv[5].toUint16() : -1; int paletteNo = (argc > 6) ? argv[6].toSint16() : 0; - s->gui->drawCell(viewId, loopNo, cellNo, x, y, priority, paletteNo); + s->gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo); return s->r_acc; } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 7d06c2a0a9..ae1f4184d3 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -48,7 +48,7 @@ namespace Common { namespace Sci { class Menubar; -class SciGUI; +class SciGui; struct GfxState; struct GfxPort; @@ -176,7 +176,7 @@ public: /* Non-VM information */ - SciGUI *gui; /* Currently active GUI */ + SciGui *gui; /* Currently active Gui */ GfxState *gfx_state; /**< Graphics state and driver */ gfx_pixmap_t *old_screen; /**< Old screen content: Stored during kDrawPic() for kAnimate() */ diff --git a/engines/sci/gfx/res_view.cpp b/engines/sci/gfx/res_view.cpp index cbe26b97d6..c10f62f676 100644 --- a/engines/sci/gfx/res_view.cpp +++ b/engines/sci/gfx/res_view.cpp @@ -368,7 +368,7 @@ gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *reso // SCI1: // [LoopCount:WORD] [MirrorMask:WORD] [??:WORD] [PaletteOffset:WORD] [LoopOffset0:WORD] [LoopOffset1:WORD]... // Loop-data: -// [CellCount:WORD] [Unknown:WORD] [CellOffset0:WORD] [CellOffset1:WORD]... +// [CelCount:WORD] [Unknown:WORD] [CelOffset0:WORD] [CelOffset1:WORD]... // SCI11: // [HeaderSize:WORD] [LoopCount:BYTE] [Unknown:BYTE] [??:WORD] [??:WORD] [PaletteOffset:WORD] gfxr_view_t *getVGAView(int id, byte *resource, int size, ViewType viewType) { @@ -416,10 +416,10 @@ gfxr_view_t *getVGAView(int id, byte *resource, int size, ViewType viewType) { view->loops[i].cels_nr = buf[V2_CELS_NUM]; view->loops[i].cels = (gfx_pixmap_t**)calloc(view->loops[i].cels_nr, sizeof(gfx_pixmap_t *)); - byte* cellSeeker = resource + loopOffset; + byte* celSeeker = resource + loopOffset; for (int j = 0; j < view->loops[i].cels_nr; j++) { - view->loops[i].cels[j] = gfxr_draw_cel1(id, i, j, mirrored, resource, cellSeeker, size, view, viewType); - cellSeeker += resource[V2_BYTES_PER_CEL]; + view->loops[i].cels[j] = gfxr_draw_cel1(id, i, j, mirrored, resource, celSeeker, size, view, viewType); + celSeeker += resource[V2_BYTES_PER_CEL]; } seeker += resource[V2_BYTES_PER_LOOP]; diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 633d8eb436..7d74877ba6 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -38,30 +38,30 @@ namespace Sci { -SciGUI::SciGUI(OSystem *system, EngineState *state) +SciGui::SciGui(OSystem *system, EngineState *state) : _system(system), _s(state) { - _screen = new SciGUIscreen(_system, _s); - _gfx = new SciGUIgfx(_system, _s, _screen); - _windowMgr = new SciGUIwindowMgr(_s, _gfx); + _screen = new SciGuiScreen(_system, _s); + _gfx = new SciGuiGfx(_system, _s, _screen); + _windowMgr = new SciGuiWindowMgr(_s, _gfx); } -SciGUI::SciGUI() { +SciGui::SciGui() { } -SciGUI::~SciGUI() { +SciGui::~SciGui() { } -void SciGUI::init(bool oldGfxFunctions) { +void SciGui::init(bool oldGfxFunctions) { _usesOldGfxFunctions = oldGfxFunctions; /* Set default SCI0 palette */ } -int16 SciGUI::getTimeTicks() { +int16 SciGui::getTimeTicks() { return _gfx->_sysTicks; } -void SciGUI::wait(int16 ticks) { +void SciGui::wait(int16 ticks) { uint32 waitto = _gfx->_sysTicks + ticks; do { //eventMgr->pollEvents(); @@ -69,7 +69,7 @@ void SciGUI::wait(int16 ticks) { } while (_gfx->_sysTicks < waitto); } -void SciGUI::setPort(uint16 portPtr) { +void SciGui::setPort(uint16 portPtr) { switch (portPtr) { case 0: _gfx->SetPort(_windowMgr->_wmgrPort); @@ -82,7 +82,7 @@ void SciGUI::setPort(uint16 portPtr) { }; } -void SciGUI::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { +void SciGui::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { _windowMgr->_picWind->rect = rect; _windowMgr->_picWind->top = picTop; _windowMgr->_picWind->left = picLeft; @@ -90,24 +90,24 @@ void SciGUI::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { //InitPri(42,190); } -reg_t SciGUI::getPort() { +reg_t SciGui::getPort() { return make_reg(0, _gfx->GetPort()->id); } -void SciGUI::globalToLocal(int16 *x, int16 *y) { - GUIPort *curPort = _gfx->GetPort(); +void SciGui::globalToLocal(int16 *x, int16 *y) { + GuiPort *curPort = _gfx->GetPort(); *x = *x - curPort->left; *y = *y - curPort->top; } -void SciGUI::localToGlobal(int16 *x, int16 *y) { - GUIPort *curPort = _gfx->GetPort(); +void SciGui::localToGlobal(int16 *x, int16 *y) { + GuiPort *curPort = _gfx->GetPort(); *x = *x + curPort->left; *y = *y + curPort->top; } -reg_t SciGUI::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) { - GUIWindow *wnd = NULL; +reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) { + GuiWindow *wnd = NULL; if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0) wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, 0); @@ -120,20 +120,20 @@ reg_t SciGUI::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 styl return make_reg(0, wnd->id); } -void SciGUI::disposeWindow(uint16 windowPtr, int16 arg2) { - GUIWindow *wnd = (GUIWindow *)_windowMgr->getPortById(windowPtr); +void SciGui::disposeWindow(uint16 windowPtr, int16 arg2) { + GuiWindow *wnd = (GuiWindow *)_windowMgr->getPortById(windowPtr); _windowMgr->DisposeWindow(wnd, arg2); } -void SciGUI::display(const char *text, int argc, reg_t *argv) { +void SciGui::display(const char *text, int argc, reg_t *argv) { int displayArg; int16 align = 0; int16 bgcolor = -1, width = -1, bRedraw = 1; byte bSaveUnder = false; - Common::Rect rect, *orect = &((GUIWindow *)_gfx->GetPort())->dims; + Common::Rect rect, *orect = &((GuiWindow *)_gfx->GetPort())->dims; // Make a "backup" of the port settings - GUIPort oldPort = *_gfx->GetPort(); + GuiPort oldPort = *_gfx->GetPort(); // setting defaults _gfx->PenMode(0); @@ -206,7 +206,7 @@ void SciGUI::display(const char *text, int argc, reg_t *argv) { // if (_picNotValid == 0 && bRedraw) // _gfx->ShowBits(rect, 1); // restoring port and cursor pos - GUIPort *currport = _gfx->GetPort(); + GuiPort *currport = _gfx->GetPort(); uint16 tTop = currport->curTop; uint16 tLeft = currport->curLeft; *currport = oldPort; @@ -216,25 +216,25 @@ void SciGUI::display(const char *text, int argc, reg_t *argv) { _screen->UpdateWhole(); } -void SciGUI::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { +void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { Common::Rect rect(0, 0, *textWidth, *textHeight); _gfx->TextSize(rect, text, font, maxWidth); *textWidth = rect.width(); *textHeight = rect.height(); } // Used SCI1+ for text codes -void SciGUI::textFonts(int argc, reg_t *argv) { +void SciGui::textFonts(int argc, reg_t *argv) { _gfx->SetTextFonts(argc, argv); } // Used SCI1+ for text codes -void SciGUI::textColors(int argc, reg_t *argv) { +void SciGui::textColors(int argc, reg_t *argv) { _gfx->SetTextColors(argc, argv); } -void SciGUI::drawPicture(GUIResourceId pictureId, uint16 style, uint16 flags, int16 EGApaletteNo) { +void SciGui::drawPicture(GuiResourceId pictureId, uint16 style, uint16 flags, int16 EGApaletteNo) { bool addToFlag = flags ? true : false; - GUIPort *oldPort = _gfx->SetPort((GUIPort *)_windowMgr->_picWind); + GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); if (_windowMgr->isFrontWindow(_windowMgr->_picWind)) { _gfx->drawPicture(pictureId, style, addToFlag, EGApaletteNo); @@ -249,13 +249,13 @@ void SciGUI::drawPicture(GUIResourceId pictureId, uint16 style, uint16 flags, in _gfx->_picNotValid = true; } -void SciGUI::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) { - _gfx->drawCell(viewId, loopNo, cellNo, leftPos, topPos, priority, paletteNo); +void SciGui::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) { + _gfx->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo); _gfx->SetCLUT(&_gfx->_sysPalette); _screen->UpdateWhole(); } -void SciGUI::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { +void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { rect.grow(1); _gfx->EraseRect(rect); _gfx->FrameRect(rect); @@ -270,7 +270,7 @@ void SciGUI::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i _screen->UpdateWhole(); } -void SciGUI::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { +void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { rect.grow(1); _gfx->EraseRect(rect); rect.grow(-1); @@ -281,56 +281,56 @@ void SciGUI::drawControlText(Common::Rect rect, reg_t obj, const char *text, int _screen->UpdateWhole(); } -void SciGUI::graphFillBoxForeground(Common::Rect rect) { +void SciGui::graphFillBoxForeground(Common::Rect rect) { _gfx->PaintRect(rect); _screen->UpdateWhole(); } -void SciGUI::graphFillBoxBackground(Common::Rect rect) { +void SciGui::graphFillBoxBackground(Common::Rect rect) { _gfx->EraseRect(rect); _screen->UpdateWhole(); } -void SciGUI::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) { +void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) { _gfx->FillRect(rect, colorMask, color, priority, control); _screen->UpdateWhole(); } -void SciGUI::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) { +void SciGui::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) { _gfx->Draw_Line(rect.left, rect.top, rect.right, rect.bottom, color, priority, control); _screen->UpdateWhole(); } -reg_t SciGUI::graphSaveBox(Common::Rect rect, uint16 flags) { +reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) { return _gfx->SaveBits(rect, flags); } -void SciGUI::graphRestoreBox(reg_t handle) { +void SciGui::graphRestoreBox(reg_t handle) { _gfx->RestoreBits(handle); _screen->UpdateWhole(); } -void SciGUI::paletteSet(int resourceNo, int flags) { +void SciGui::paletteSet(int resourceNo, int flags) { _gfx->SetResPalette(resourceNo, flags); } -int16 SciGUI::paletteFind(int r, int g, int b) { +int16 SciGui::paletteFind(int r, int g, int b) { return _gfx->MatchColor(&_gfx->_sysPalette, r, g, b) & 0xFF; } -void SciGUI::paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette) { +void SciGui::paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette) { _gfx->PaletteSetIntensity(fromColor, toColor, intensity, &_gfx->_sysPalette); if (setPalette) { _gfx->SetCLUT(&_gfx->_sysPalette); } } -void SciGUI::paletteAnimate(int fromColor, int toColor, int speed) { +void SciGui::paletteAnimate(int fromColor, int toColor, int speed) { _gfx->PaletteAnimate(fromColor, toColor, speed); } -int16 SciGUI::onControl(byte screenMask, Common::Rect rect) { - GUIPort *oldPort = _gfx->SetPort((GUIPort *)_windowMgr->_picWind); +int16 SciGui::onControl(byte screenMask, Common::Rect rect) { + GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); int16 result; result = _gfx->onControl(screenMask, rect); @@ -338,7 +338,7 @@ int16 SciGUI::onControl(byte screenMask, Common::Rect rect) { return result; } -void SciGUI::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { +void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { bool old_picNotValid = _gfx->_picNotValid; if (listReference.isNull()) { @@ -359,7 +359,7 @@ void SciGUI::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { _gfx->AnimateInvoke(list, argc, argv); } - GUIPort *oldPort = _gfx->SetPort((GUIPort *)_windowMgr->_picWind); + GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); _gfx->AnimateDisposeLastCast(); _gfx->AnimateFill(); @@ -369,7 +369,7 @@ void SciGUI::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { _gfx->AnimateUpdate(); } - _gfx->AnimateDrawCells(); + _gfx->AnimateDrawCels(); if (_gfx->_picNotValid) { //(this->*ShowPic)(_showMap, _showStyle); @@ -383,19 +383,19 @@ void SciGUI::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { _gfx->SetPort(oldPort); } -void SciGUI::addToPicList(reg_t listReference, int argc, reg_t *argv) { +void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) { // FIXME: port over from gregs engine } -void SciGUI::addToPicView(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { +void SciGui::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { // FIXME: port over from gregs engine } -void SciGUI::setNowSeen(reg_t objectReference) { +void SciGui::setNowSeen(reg_t objectReference) { _gfx->SetNowSeen(objectReference); } -void SciGUI::moveCursor(int16 x, int16 y) { +void SciGui::moveCursor(int16 x, int16 y) { Common::Point newPos; x += _windowMgr->_picWind->rect.left; diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index fc50c4979a..febf5d363d 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -23,22 +23,22 @@ * */ -#ifndef SCI_GUI_GUI_H -#define SCI_GUI_GUI_H +#ifndef SCI_GUI_Gui_H +#define SCI_GUI_Gui_H #include "sci/gui/gui_helpers.h" namespace Sci { -class SciGUIscreen; -class SciGUIgfx; -class SciGUIresources; -class SciGUIwindowMgr; -class SciGUI { +class SciGuiScreen; +class SciGuiGfx; +class SciGuiresources; +class SciGuiWindowMgr; +class SciGui { public: - SciGUI(OSystem *system, EngineState *s); - SciGUI(); - virtual ~SciGUI(); + SciGui(OSystem *system, EngineState *s); + SciGui(); + virtual ~SciGui(); // FIXME: Don't store EngineState virtual void resetEngineState(EngineState *s) { _s = s; } @@ -61,8 +61,8 @@ public: virtual void textFonts(int argc, reg_t *argv); virtual void textColors(int argc, reg_t *argv); - virtual void drawPicture(GUIResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); - virtual void drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); + virtual void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); + virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse); @@ -81,7 +81,7 @@ public: virtual int16 onControl(byte screenMask, Common::Rect rect); virtual void animate(reg_t listReference, bool cycle, int argc, reg_t *argv); virtual void addToPicList(reg_t listReference, int argc, reg_t *argv); - virtual void addToPicView(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 leftPos, int16 topPos, int16 priority, int16 control); + virtual void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control); virtual void setNowSeen(reg_t objectReference); virtual void moveCursor(int16 x, int16 y); @@ -89,10 +89,10 @@ public: private: OSystem *_system; EngineState *_s; - SciGUIscreen *_screen; - SciGUIgfx *_gfx; - SciGUIresources *_resources; - SciGUIwindowMgr *_windowMgr; + SciGuiScreen *_screen; + SciGuiGfx *_gfx; + SciGuiresources *_resources; + SciGuiWindowMgr *_windowMgr; bool _usesOldGfxFunctions; }; diff --git a/engines/sci/gui/gui_font.cpp b/engines/sci/gui/gui_font.cpp index 8165db1fd0..4ae488e682 100644 --- a/engines/sci/gui/gui_font.cpp +++ b/engines/sci/gui/gui_font.cpp @@ -31,7 +31,7 @@ namespace Sci { -SciGUIfont::SciGUIfont(ResourceManager *resMan, GUIResourceId resourceId) +SciGuiFont::SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId) : _resourceId(resourceId) { assert(resourceId != -1); @@ -52,27 +52,27 @@ SciGUIfont::SciGUIfont(ResourceManager *resMan, GUIResourceId resourceId) } } -SciGUIfont::~SciGUIfont() { +SciGuiFont::~SciGuiFont() { } -GUIResourceId SciGUIfont::getResourceId() { +GuiResourceId SciGuiFont::getResourceId() { return _resourceId; } -byte SciGUIfont::getHeight() { +byte SciGuiFont::getHeight() { return mFontH; } -byte SciGUIfont::getCharWidth(byte chr) { +byte SciGuiFont::getCharWidth(byte chr) { return chr < mCharMax ? mChars[chr].w : 0; } -byte SciGUIfont::getCharHeight(byte chr) { +byte SciGuiFont::getCharHeight(byte chr) { return chr < mCharMax ? mChars[chr].h : 0; } -byte *SciGUIfont::getCharData(byte chr) { +byte *SciGuiFont::getCharData(byte chr) { return chr < mCharMax ? _resourceData + mChars[chr].offset + 2 : 0; } -void SciGUIfont::draw(SciGUIscreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface) { +void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface) { int charWidth = MIN<int>(getCharWidth(chr), screen->_width - left); int charHeight = MIN<int>(getCharHeight(chr), 200 - top); byte b = 0, mask = 0xFF; diff --git a/engines/sci/gui/gui_font.h b/engines/sci/gui/gui_font.h index dd20016a14..e1916ff2ac 100644 --- a/engines/sci/gui/gui_font.h +++ b/engines/sci/gui/gui_font.h @@ -30,20 +30,20 @@ namespace Sci { -class SciGUIfont { +class SciGuiFont { public: - SciGUIfont(ResourceManager *resMan, GUIResourceId resourceId); - ~SciGUIfont(); + SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId); + ~SciGuiFont(); - GUIResourceId getResourceId(); + GuiResourceId getResourceId(); byte getHeight(); byte getCharWidth(byte chr); byte getCharHeight(byte chr); byte *getCharData(byte chr); - void draw(SciGUIscreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface); + void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface); private: - GUIResourceId _resourceId; + GuiResourceId _resourceId; byte *_resourceData; struct charinfo { diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 0745da943e..c1484ca171 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -37,18 +37,18 @@ namespace Sci { -SciGUIgfx::SciGUIgfx(OSystem *system, EngineState *state, SciGUIscreen *screen) +SciGuiGfx::SciGuiGfx(OSystem *system, EngineState *state, SciGuiScreen *screen) : _system(system), _s(state), _screen(screen) { init(); initPalette(); initTimer(); } -SciGUIgfx::~SciGUIgfx() { +SciGuiGfx::~SciGuiGfx() { _system->getTimerManager()->removeTimerProc(&timerHandler); } -void SciGUIgfx::init() { +void SciGuiGfx::init() { _font = NULL; _textFonts = NULL; _textFontsCount = 0; _textColors = NULL; _textColorsCount = 0; @@ -72,7 +72,7 @@ void SciGUIgfx::init() { _sysTicks = 0; } -void SciGUIgfx::initPalette() { +void SciGuiGfx::initPalette() { int16 i; for (i = 0; i < 256; i++) { _sysPalette.colors[i].used = 0; @@ -102,28 +102,28 @@ void SciGUIgfx::initPalette() { _clrPowers[i] = i*i; } -void SciGUIgfx::initTimer() { +void SciGuiGfx::initTimer() { _sysSpeed = 1000000 / 60; Common::TimerManager *tm = _system->getTimerManager(); tm->removeTimerProc(&timerHandler); tm->installTimerProc(&timerHandler, _sysSpeed, this); } -void SciGUIgfx::timerHandler(void *ref) { - ((SciGUIgfx *)ref)->_sysTicks++; +void SciGuiGfx::timerHandler(void *ref) { + ((SciGuiGfx *)ref)->_sysTicks++; } -GUIPort *SciGUIgfx::mallocPort() { - GUIPort *newPort = (GUIPort *)malloc(sizeof(GUIPort)); +GuiPort *SciGuiGfx::mallocPort() { + GuiPort *newPort = (GuiPort *)malloc(sizeof(GuiPort)); assert(newPort); - memset(newPort, 0, sizeof(GUIPort)); + memset(newPort, 0, sizeof(GuiPort)); return newPort; } #define SCI_PAL_FORMAT_CONSTANT 1 #define SCI_PAL_FORMAT_VARIABLE 0 -void SciGUIgfx::SetEGApalette() { +void SciGuiGfx::SetEGApalette() { int i; _sysPalette.colors[1].r = 0x000; _sysPalette.colors[1].g = 0x000; _sysPalette.colors[1].b = 0x0AA; _sysPalette.colors[2].r = 0x000; _sysPalette.colors[2].g = 0x0AA; _sysPalette.colors[2].b = 0x000; @@ -150,14 +150,14 @@ void SciGUIgfx::SetEGApalette() { SetCLUT(&_sysPalette); } -void SciGUIgfx::CreatePaletteFromData(byte *data, GUIPalette *paletteOut) { +void SciGuiGfx::CreatePaletteFromData(byte *data, GuiPalette *paletteOut) { int palFormat = 0; int palOffset = 0; int palColorStart = 0; int palColorCount = 0; int colorNo = 0; - memset(paletteOut, 0, sizeof(GUIPalette)); + memset(paletteOut, 0, sizeof(GuiPalette)); // Setup default mapping for (colorNo = 0; colorNo < 256; colorNo++) { paletteOut->mapping[colorNo] = colorNo; @@ -194,9 +194,9 @@ void SciGUIgfx::CreatePaletteFromData(byte *data, GUIPalette *paletteOut) { } } -bool SciGUIgfx::SetResPalette(int16 resourceNo, int16 flag) { +bool SciGuiGfx::SetResPalette(int16 resourceNo, int16 flag) { Resource *palResource = _s->resMan->findResource(ResourceId(kResourceTypePalette, resourceNo), 0); - GUIPalette palette; + GuiPalette palette; if (palResource) { CreatePaletteFromData(palResource->data, &palette); @@ -206,7 +206,7 @@ bool SciGUIgfx::SetResPalette(int16 resourceNo, int16 flag) { return false; } -void SciGUIgfx::SetPalette(GUIPalette *sciPal, int16 flag) { +void SciGuiGfx::SetPalette(GuiPalette *sciPal, int16 flag) { uint32 systime = _sysPalette.timestamp; if (flag == 2 || sciPal->timestamp != systime) { MergePalettes(sciPal, &_sysPalette, flag); @@ -216,7 +216,7 @@ void SciGUIgfx::SetPalette(GUIPalette *sciPal, int16 flag) { } } -void SciGUIgfx::MergePalettes(GUIPalette *pFrom, GUIPalette *pTo, uint16 flag) { +void SciGuiGfx::MergePalettes(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) { uint16 res; int i,j; // colors 0 (black) and 255 (white) are not affected by merging @@ -257,7 +257,7 @@ void SciGUIgfx::MergePalettes(GUIPalette *pFrom, GUIPalette *pTo, uint16 flag) { pTo->timestamp = _sysTicks; } -uint16 SciGUIgfx::MatchColor(GUIPalette*pPal, byte r, byte g, byte b) { +uint16 SciGuiGfx::MatchColor(GuiPalette*pPal, byte r, byte g, byte b) { byte found = 0xFF; int diff = 0x2FFFF, cdiff; int16 dr,dg,db; @@ -282,9 +282,9 @@ uint16 SciGUIgfx::MatchColor(GUIPalette*pPal, byte r, byte g, byte b) { return found; } -void SciGUIgfx::SetCLUT(GUIPalette*pal) { +void SciGuiGfx::SetCLUT(GuiPalette*pal) { if (pal != &_sysPalette) - memcpy(&_sysPalette,pal,sizeof(GUIPalette)); + memcpy(&_sysPalette,pal,sizeof(GuiPalette)); // just copy palette to system byte bpal[4 * 256]; // Get current palette, update it and put back @@ -301,42 +301,42 @@ void SciGUIgfx::SetCLUT(GUIPalette*pal) { _system->updateScreen(); } -void SciGUIgfx::GetCLUT(GUIPalette*pal) { +void SciGuiGfx::GetCLUT(GuiPalette*pal) { if (pal != &_sysPalette) - memcpy(pal,&_sysPalette,sizeof(GUIPalette)); + memcpy(pal,&_sysPalette,sizeof(GuiPalette)); } -GUIPort *SciGUIgfx::SetPort(GUIPort *newPort) { - GUIPort *oldPort = _curPort; +GuiPort *SciGuiGfx::SetPort(GuiPort *newPort) { + GuiPort *oldPort = _curPort; _curPort = newPort; return oldPort; } -GUIPort *SciGUIgfx::GetPort(void) { +GuiPort *SciGuiGfx::GetPort(void) { return _curPort; } -void SciGUIgfx::SetOrigin(int16 left, int16 top) { +void SciGuiGfx::SetOrigin(int16 left, int16 top) { _curPort->left = left; _curPort->top = top; } -void SciGUIgfx::MoveTo(int16 left, int16 top) { +void SciGuiGfx::MoveTo(int16 left, int16 top) { _curPort->curTop = top; _curPort->curLeft = left; } -void SciGUIgfx::Move(int16 left, int16 top) { +void SciGuiGfx::Move(int16 left, int16 top) { _curPort->curTop += top; _curPort->curLeft += left; } -GUIResourceId SciGUIgfx::GetFontId() { +GuiResourceId SciGuiGfx::GetFontId() { return _curPort->fontId; } -SciGUIfont *SciGUIgfx::GetFont() { - GUIResourceId fontId = _curPort->fontId; +SciGuiFont *SciGuiGfx::GetFont() { + GuiResourceId fontId = _curPort->fontId; // Workaround: lsl1sci mixes its own internal fonts with the global // SCI ones, so we translate them here, by removing their extra bits @@ -344,13 +344,13 @@ SciGUIfont *SciGUIgfx::GetFont() { fontId &= 0x7ff; if ((_font == NULL) || (_font->getResourceId() != _curPort->fontId)) - _font = new SciGUIfont(_s->resMan, fontId); + _font = new SciGuiFont(_s->resMan, fontId); return _font; } -void SciGUIgfx::SetFont(GUIResourceId fontId) { - GUIResourceId actualFontId = fontId; +void SciGuiGfx::SetFont(GuiResourceId fontId) { + GuiResourceId actualFontId = fontId; // Workaround: lsl1sci mixes its own internal fonts with the global // SCI ones, so we translate them here, by removing their extra bits @@ -358,17 +358,17 @@ void SciGUIgfx::SetFont(GUIResourceId fontId) { actualFontId &= 0x7ff; if ((_font == NULL) || (_font->getResourceId() != fontId)) - _font = new SciGUIfont(_s->resMan, actualFontId); + _font = new SciGuiFont(_s->resMan, actualFontId); _curPort->fontId = fontId; _curPort->fontHeight = _font->getHeight(); } -void SciGUIgfx::OpenPort(GUIPort *port) { +void SciGuiGfx::OpenPort(GuiPort *port) { port->fontId = 0; port->fontHeight = 8; - GUIPort *tmp = _curPort; + GuiPort *tmp = _curPort; _curPort = port; SetFont(port->fontId); _curPort = tmp; @@ -382,42 +382,42 @@ void SciGUIgfx::OpenPort(GUIPort *port) { port->rect = _bounds; } -void SciGUIgfx::PenColor(int16 color) { +void SciGuiGfx::PenColor(int16 color) { _curPort->penClr = color; } -void SciGUIgfx::PenMode(int16 mode) { +void SciGuiGfx::PenMode(int16 mode) { _curPort->penMode = mode; } -void SciGUIgfx::TextFace(int16 textFace) { +void SciGuiGfx::TextFace(int16 textFace) { _curPort->textFace = textFace; } -int16 SciGUIgfx::GetPointSize(void) { +int16 SciGuiGfx::GetPointSize(void) { return _curPort->fontHeight; } -void SciGUIgfx::ClearScreen(byte color) { +void SciGuiGfx::ClearScreen(byte color) { FillRect(_curPort->rect, SCI_SCREEN_MASK_ALL, color, 0, 0); } -void SciGUIgfx::InvertRect(const Common::Rect &rect) { +void SciGuiGfx::InvertRect(const Common::Rect &rect) { int16 oldpenmode = _curPort->penMode; _curPort->penMode = 2; FillRect(rect, 1, _curPort->penClr, _curPort->backClr); _curPort->penMode = oldpenmode; } //----------------------------- -void SciGUIgfx::EraseRect(const Common::Rect &rect) { +void SciGuiGfx::EraseRect(const Common::Rect &rect) { FillRect(rect, 1, _curPort->backClr); } //----------------------------- -void SciGUIgfx::PaintRect(const Common::Rect &rect) { +void SciGuiGfx::PaintRect(const Common::Rect &rect) { FillRect(rect, 1, _curPort->penClr); } -void SciGUIgfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) { +void SciGuiGfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) { Common::Rect r(rect.left, rect.top, rect.right, rect.bottom); r.clip(_curPort->rect); if (r.isEmpty()) // nothing to fill @@ -469,7 +469,7 @@ void SciGUIgfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, } } -void SciGUIgfx::FrameRect(const Common::Rect &rect) { +void SciGuiGfx::FrameRect(const Common::Rect &rect) { Common::Rect r; // left r = rect; @@ -489,14 +489,14 @@ void SciGUIgfx::FrameRect(const Common::Rect &rect) { PaintRect(r); } -void SciGUIgfx::OffsetRect(Common::Rect &r) { +void SciGuiGfx::OffsetRect(Common::Rect &r) { r.top += _curPort->top; r.bottom += _curPort->top; r.left += _curPort->left; r.right += _curPort->left; } -byte SciGUIgfx::CharHeight(int16 ch) { +byte SciGuiGfx::CharHeight(int16 ch) { #if 0 CResFont *res = getResFont(); return res ? res->getCharH(ch) : 0; @@ -504,12 +504,12 @@ byte SciGUIgfx::CharHeight(int16 ch) { return 0; } //----------------------------- -byte SciGUIgfx::CharWidth(int16 ch) { - SciGUIfont *font = GetFont(); +byte SciGuiGfx::CharWidth(int16 ch) { + SciGuiFont *font = GetFont(); return font ? font->getCharWidth(ch) : 0; } -void SciGUIgfx::ClearChar(int16 chr) { +void SciGuiGfx::ClearChar(int16 chr) { if (_curPort->penMode != 1) return; Common::Rect rect; @@ -520,14 +520,14 @@ void SciGUIgfx::ClearChar(int16 chr) { EraseRect(rect); } -void SciGUIgfx::DrawChar(int16 chr) { +void SciGuiGfx::DrawChar(int16 chr) { chr = chr & 0xFF; ClearChar(chr); StdChar(chr); _curPort->curLeft += CharWidth(chr); } -void SciGUIgfx::StdChar(int16 chr) { +void SciGuiGfx::StdChar(int16 chr) { #if 0 CResFont*res = getResFont(); if (res) @@ -537,20 +537,20 @@ void SciGUIgfx::StdChar(int16 chr) { #endif } -void SciGUIgfx::SetTextFonts(int argc, reg_t *argv) { +void SciGuiGfx::SetTextFonts(int argc, reg_t *argv) { int i; if (_textFonts) { delete _textFonts; } _textFontsCount = argc; - _textFonts = new GUIResourceId[argc]; + _textFonts = new GuiResourceId[argc]; for (i = 0; i < argc; i++) { - _textFonts[i] = (GUIResourceId)argv[i].toUint16(); + _textFonts[i] = (GuiResourceId)argv[i].toUint16(); } } -void SciGUIgfx::SetTextColors(int argc, reg_t *argv) { +void SciGuiGfx::SetTextColors(int argc, reg_t *argv) { int i; if (_textColors) { @@ -567,7 +567,7 @@ void SciGUIgfx::SetTextColors(int argc, reg_t *argv) { // It will process the encountered code and set new font/set color // We only support one-digit codes currently, don't know if multi-digit codes are possible // Returns textcode character count -int16 SciGUIgfx::TextCodeProcessing(const char *&text, GUIResourceId orgFontId, int16 orgPenColor) { +int16 SciGuiGfx::TextCodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor) { const char *textCode = text; int16 textCodeSize = 0; char curCode; @@ -610,11 +610,11 @@ int16 SciGUIgfx::TextCodeProcessing(const char *&text, GUIResourceId orgFontId, } // return max # of chars to fit maxwidth with full words -int16 SciGUIgfx::GetLongest(const char *text, int16 maxWidth, GUIResourceId orgFontId) { +int16 SciGuiGfx::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) { char curChar; int16 maxChars = 0, curCharCount = 0; uint16 width = 0; - GUIResourceId oldFontId = GetFontId(); + GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _curPort->penClr; GetFont(); @@ -652,9 +652,9 @@ int16 SciGUIgfx::GetLongest(const char *text, int16 maxWidth, GUIResourceId orgF return maxChars; } -void SciGUIgfx::TextWidth(const char *text, int16 from, int16 len, GUIResourceId orgFontId, int16 &textWidth, int16 &textHeight) { +void SciGuiGfx::TextWidth(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { unsigned char curChar; - GUIResourceId oldFontId = GetFontId(); + GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _curPort->penClr; textWidth = 0; textHeight = 0; @@ -683,12 +683,12 @@ void SciGUIgfx::TextWidth(const char *text, int16 from, int16 len, GUIResourceId return; } -void SciGUIgfx::StringWidth(const char *str, GUIResourceId orgFontId, int16 &textWidth, int16 &textHeight) { +void SciGuiGfx::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { TextWidth(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight); } -int16 SciGUIgfx::TextSize(Common::Rect &rect, const char *str, GUIResourceId fontId, int16 maxWidth) { - GUIResourceId oldFontId = GetFontId(); +int16 SciGuiGfx::TextSize(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) { + GuiResourceId oldFontId = GetFontId(); int16 oldPenColor = _curPort->penClr; int16 charCount; int16 maxTextWidth = 0, textWidth; @@ -729,7 +729,7 @@ int16 SciGUIgfx::TextSize(Common::Rect &rect, const char *str, GUIResourceId fon } // returns maximum font height used -void SciGUIgfx::DrawText(const char *text, int16 from, int16 len, GUIResourceId orgFontId, int16 orgPenColor) { +void SciGuiGfx::DrawText(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { int16 curChar, charWidth; Common::Rect rect; @@ -768,7 +768,7 @@ void SciGUIgfx::DrawText(const char *text, int16 from, int16 len, GUIResourceId } // returns maximum font height used -void SciGUIgfx::ShowText(const char *text, int16 from, int16 len, GUIResourceId orgFontId, int16 orgPenColor) { +void SciGuiGfx::ShowText(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { Common::Rect rect; rect.top = _curPort->curTop; @@ -780,10 +780,10 @@ void SciGUIgfx::ShowText(const char *text, int16 from, int16 len, GUIResourceId } // Draws a text in rect. -void SciGUIgfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect, int16 align, GUIResourceId fontId) { +void SciGuiGfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId) { int16 textWidth, textHeight, charCount, offset; int16 hline = 0; - GUIResourceId orgFontId = GetFontId(); + GuiResourceId orgFontId = GetFontId(); int16 orgPenColor = _curPort->penClr; if (fontId != -1) @@ -824,7 +824,7 @@ void SciGUIgfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect, } // Update (part of) screen -void SciGUIgfx::ShowBits(const Common::Rect &r, uint16 flags) { +void SciGuiGfx::ShowBits(const Common::Rect &r, uint16 flags) { Common::Rect rect(r.left, r.top, r.right, r.bottom); rect.clip(_curPort->rect); if (rect.isEmpty()) // nothing to show @@ -837,8 +837,8 @@ void SciGUIgfx::ShowBits(const Common::Rect &r, uint16 flags) { // _system->updateScreen(); } -GUIMemoryHandle SciGUIgfx::SaveBits(const Common::Rect &rect, byte screenMask) { - GUIMemoryHandle memoryId; +GuiMemoryHandle SciGuiGfx::SaveBits(const Common::Rect &rect, byte screenMask) { + GuiMemoryHandle memoryId; byte *memoryPtr; int size; @@ -858,7 +858,7 @@ GUIMemoryHandle SciGUIgfx::SaveBits(const Common::Rect &rect, byte screenMask) { return memoryId; } -void SciGUIgfx::RestoreBits(GUIMemoryHandle memoryHandle) { +void SciGuiGfx::RestoreBits(GuiMemoryHandle memoryHandle) { byte *memoryPtr = kmem(_s->_segMan, memoryHandle);; if (memoryPtr) { @@ -867,7 +867,7 @@ void SciGUIgfx::RestoreBits(GUIMemoryHandle memoryHandle) { } } -void SciGUIgfx::Draw_Line(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control) { +void SciGuiGfx::Draw_Line(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control) { //set_drawing_flag byte flag = _screen->GetDrawingMask(color, prio, control); prio &= 0xF0; @@ -929,7 +929,7 @@ void SciGUIgfx::Draw_Line(int16 left, int16 top, int16 right, int16 bottom, byte //ShowBits(&_rThePort->rect,6); } -void SciGUIgfx::Draw_Horiz(int16 left, int16 right, int16 top, byte flag, byte color, byte prio, byte control) { +void SciGuiGfx::Draw_Horiz(int16 left, int16 right, int16 top, byte flag, byte color, byte prio, byte control) { if (right < left) SWAP(right, left); for (int i = left; i <= right; i++) @@ -937,7 +937,7 @@ void SciGUIgfx::Draw_Horiz(int16 left, int16 right, int16 top, byte flag, byte c } //-------------------------------- -void SciGUIgfx::Draw_Vert(int16 top, int16 bottom, int16 left, byte flag, byte color, byte prio, byte control) { +void SciGuiGfx::Draw_Vert(int16 top, int16 bottom, int16 left, byte flag, byte color, byte prio, byte control) { if (top > bottom) SWAP(top, bottom); for (int i = top; i <= bottom; i++) @@ -1058,7 +1058,7 @@ const byte pattern_TextureOffset[128] = { 0x06, 0x6f, 0xc6, 0x4a, 0xa4, 0x75, 0x97, 0xe1 }; -void SciGUIgfx::Draw_Box(Common::Rect box, byte color, byte prio, byte control) { +void SciGuiGfx::Draw_Box(Common::Rect box, byte color, byte prio, byte control) { byte flag = _screen->GetDrawingMask(color, prio, control); int y, x; @@ -1069,7 +1069,7 @@ void SciGUIgfx::Draw_Box(Common::Rect box, byte color, byte prio, byte control) } } -void SciGUIgfx::Draw_TexturedBox(Common::Rect box, byte color, byte prio, byte control, byte texture) { +void SciGuiGfx::Draw_TexturedBox(Common::Rect box, byte color, byte prio, byte control, byte texture) { byte flag = _screen->GetDrawingMask(color, prio, control); const bool *textureData = &pattern_Textures[pattern_TextureOffset[texture]]; int y, x; @@ -1084,7 +1084,7 @@ void SciGUIgfx::Draw_TexturedBox(Common::Rect box, byte color, byte prio, byte c } } -void SciGUIgfx::Draw_Circle(Common::Rect box, byte size, byte color, byte prio, byte control) { +void SciGuiGfx::Draw_Circle(Common::Rect box, byte size, byte color, byte prio, byte control) { byte flag = _screen->GetDrawingMask(color, prio, control); byte *circle = (byte *)&pattern_Circles[size]; byte circleBitmap; @@ -1102,7 +1102,7 @@ void SciGUIgfx::Draw_Circle(Common::Rect box, byte size, byte color, byte prio, } } -void SciGUIgfx::Draw_TexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture) { +void SciGuiGfx::Draw_TexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture) { byte flag = _screen->GetDrawingMask(color, prio, control); byte *circle = (byte *)&pattern_Circles[size]; byte circleBitmap; @@ -1124,7 +1124,7 @@ void SciGUIgfx::Draw_TexturedCircle(Common::Rect box, byte size, byte color, byt } } -void SciGUIgfx::Draw_Pattern(int16 x, int16 y, byte color, byte priority, byte control, byte code, byte texture) { +void SciGuiGfx::Draw_Pattern(int16 x, int16 y, byte color, byte priority, byte control, byte code, byte texture) { byte size = code & SCI_PATTERN_CODE_PENSIZE; Common::Rect rect; @@ -1153,7 +1153,7 @@ void SciGUIgfx::Draw_Pattern(int16 x, int16 y, byte color, byte priority, byte c } } -void SciGUIgfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) { +void SciGuiGfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) { Common::Stack<Common::Point> stack; Common::Point p, p1; @@ -1231,10 +1231,10 @@ void SciGUIgfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) } } -void SciGUIgfx::drawPicture(GUIResourceId pictureId, uint16 style, bool addToFlag, GUIResourceId paletteId) { - SciGUIpicture *picture; +void SciGuiGfx::drawPicture(GuiResourceId pictureId, uint16 style, bool addToFlag, GuiResourceId paletteId) { + SciGuiPicture *picture; - picture = new SciGUIpicture(_s, this, _screen, pictureId); + picture = new SciGuiPicture(_s, this, _screen, pictureId); // do we add to a picture? if not -> clear screen if (!addToFlag) { ClearScreen(0); @@ -1242,31 +1242,31 @@ void SciGUIgfx::drawPicture(GUIResourceId pictureId, uint16 style, bool addToFla picture->draw(style, addToFlag, paletteId); } -void SciGUIgfx::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo) { - SciGUIview *view = new SciGUIview(_system, _s, this, _screen, viewId); +void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo) { + SciGuiView *view = new SciGuiView(_system, _s, this, _screen, viewId); Common::Rect rect(0, 0); Common::Rect clipRect(0, 0); if (view) { rect.left = leftPos; rect.top = topPos; - rect.right = rect.left + view->getWidth(loopNo, cellNo); - rect.bottom = rect.top + view->getHeight(loopNo, cellNo); + rect.right = rect.left + view->getWidth(loopNo, celNo); + rect.bottom = rect.top + view->getHeight(loopNo, celNo); clipRect = rect; clipRect.clip(_curPort->rect); if (clipRect.isEmpty()) // nothing to draw return; - view->draw(rect, clipRect, loopNo, cellNo, priority, paletteNo); + view->draw(rect, clipRect, loopNo, celNo, priority, paletteNo); //if (_picNotValid == 0) // _gfx->ShowBits(rect, 1); } } -void SciGUIgfx::PaletteSetIntensity(int fromColor, int toColor, int intensity, GUIPalette *destPalette) { +void SciGuiGfx::PaletteSetIntensity(int fromColor, int toColor, int intensity, GuiPalette *destPalette) { memset(destPalette->intensity + fromColor, intensity, toColor - fromColor); } -void SciGUIgfx::PaletteAnimate(byte fromColor, byte toColor, int speed) { - GUIColor col; +void SciGuiGfx::PaletteAnimate(byte fromColor, byte toColor, int speed) { + GuiColor col; int len = toColor - fromColor - 1; uint32 now = _sysTicks; // search for sheduled animations with the same 'from' value @@ -1276,11 +1276,11 @@ void SciGUIgfx::PaletteAnimate(byte fromColor, byte toColor, int speed) { if (_palSchedules[i].schedule < now) { if (speed > 0) { col = _sysPalette.colors[fromColor]; - memmove(&_sysPalette.colors[fromColor], &_sysPalette.colors[fromColor + 1], len * sizeof(GUIColor)); + memmove(&_sysPalette.colors[fromColor], &_sysPalette.colors[fromColor + 1], len * sizeof(GuiColor)); _sysPalette.colors[toColor - 1] = col; } else { col = _sysPalette.colors[toColor - 1]; - memmove(&_sysPalette.colors[fromColor+1], &_sysPalette.colors[fromColor], len * sizeof(GUIColor)); + memmove(&_sysPalette.colors[fromColor+1], &_sysPalette.colors[fromColor], len * sizeof(GuiColor)); _sysPalette.colors[fromColor] = col; } // removing schedule @@ -1291,13 +1291,13 @@ void SciGUIgfx::PaletteAnimate(byte fromColor, byte toColor, int speed) { } } // adding a new schedule - GUIPalSchedule sched; + GuiPalSchedule sched; sched.from = fromColor; sched.schedule = now + ABS(speed); _palSchedules.push_back(sched); } -int16 SciGUIgfx::onControl(uint16 screenMask, Common::Rect rect) { +int16 SciGuiGfx::onControl(uint16 screenMask, Common::Rect rect) { Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom); int16 x, y; int16 result = 0; @@ -1330,13 +1330,13 @@ static inline int sign_extend_byte(int value) { return value; } -void SciGUIgfx::AnimateDisposeLastCast() { +void SciGuiGfx::AnimateDisposeLastCast() { // FIXME //if (!_lastCast->first.isNull()) //_lastCast->DeleteList(); } -void SciGUIgfx::AnimateInvoke(List *list, int argc, reg_t *argv) { +void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) { reg_t curAddress = list->first; Node *curNode = lookup_node(_s, curAddress); reg_t curObject; @@ -1356,28 +1356,28 @@ void SciGUIgfx::AnimateInvoke(List *list, int argc, reg_t *argv) { } } -void SciGUIgfx::AnimateFill() { +void SciGuiGfx::AnimateFill() { } -void SciGUIgfx::AnimateSort() { +void SciGuiGfx::AnimateSort() { } -void SciGUIgfx::AnimateUpdate() { +void SciGuiGfx::AnimateUpdate() { } -void SciGUIgfx::AnimateDrawCells() { +void SciGuiGfx::AnimateDrawCels() { } -void SciGUIgfx::AnimateRestoreAndDelete() { +void SciGuiGfx::AnimateRestoreAndDelete() { } -void SciGUIgfx::SetNowSeen(reg_t objectReference) { +void SciGuiGfx::SetNowSeen(reg_t objectReference) { SegManager *segMan = _s->_segMan; - SciGUIview *view = NULL; - Common::Rect cellRect(0, 0); - GUIResourceId viewId = (GUIResourceId)GET_SEL32V(objectReference, view); - GUIViewLoopNo loopNo = sign_extend_byte((GUIViewLoopNo)GET_SEL32V(objectReference, loop)); - GUIViewCellNo cellNo = sign_extend_byte((GUIViewCellNo)GET_SEL32V(objectReference, cel)); + SciGuiView *view = NULL; + Common::Rect celRect(0, 0); + GuiResourceId viewId = (GuiResourceId)GET_SEL32V(objectReference, view); + GuiViewLoopNo loopNo = sign_extend_byte((GuiViewLoopNo)GET_SEL32V(objectReference, loop)); + GuiViewCelNo celNo = sign_extend_byte((GuiViewCelNo)GET_SEL32V(objectReference, cel)); int16 x = (int16)GET_SEL32V(objectReference, x); int16 y = (int16)GET_SEL32V(objectReference, y); int16 z = 0; @@ -1385,16 +1385,16 @@ void SciGUIgfx::SetNowSeen(reg_t objectReference) { z = (int16)GET_SEL32V(objectReference, z); } - // now get cell rectangle - view = new SciGUIview(_system, _s, this, _screen, viewId); - view->getCellRect(loopNo, cellNo, x, y, z, &cellRect); + // now get cel rectangle + view = new SciGuiView(_system, _s, this, _screen, viewId); + view->getCelRect(loopNo, celNo, x, y, z, &celRect); // TODO: sometimes loop is negative. Check what it means if (lookup_selector(_s->_segMan, objectReference, _s->_kernel->_selectorCache.nsTop, NULL, NULL) == kSelectorVariable) { - PUT_SEL32V(objectReference, nsLeft, cellRect.left); - PUT_SEL32V(objectReference, nsRight, cellRect.right); - PUT_SEL32V(objectReference, nsTop, cellRect.top); - PUT_SEL32V(objectReference, nsBottom, cellRect.bottom); + PUT_SEL32V(objectReference, nsLeft, celRect.left); + PUT_SEL32V(objectReference, nsRight, celRect.right); + PUT_SEL32V(objectReference, nsTop, celRect.top); + PUT_SEL32V(objectReference, nsBottom, celRect.bottom); } } diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 3749de520e..228f62188e 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -34,45 +34,45 @@ namespace Sci { #define SCI_PATTERN_CODE_USE_TEXTURE 0x20 #define SCI_PATTERN_CODE_PENSIZE 0x07 -class SciGUIscreen; -class SciGUIfont; -class SciGUIpicture; -class SciGUIview; -class SciGUIgfx { +class SciGuiScreen; +class SciGuiFont; +class SciGuiPicture; +class SciGuiView; +class SciGuiGfx { public: - SciGUIgfx(OSystem *system, EngineState *state, SciGUIscreen *screen); - ~SciGUIgfx(); + SciGuiGfx(OSystem *system, EngineState *state, SciGuiScreen *screen); + ~SciGuiGfx(); void init(void); void initPalette(); void initTimer(); static void timerHandler(void*ref); - GUIPort *mallocPort (); + GuiPort *mallocPort (); byte *GetSegment(byte seg); void ResetScreen(); void SetEGApalette(); - void CreatePaletteFromData(byte *paletteData, GUIPalette *paletteOut); + void CreatePaletteFromData(byte *paletteData, GuiPalette *paletteOut); bool SetResPalette(int16 resourceNo, int16 flag); - void SetPalette(GUIPalette *sciPal, int16 flag); - void MergePalettes(GUIPalette* pFrom, GUIPalette* pTo, uint16 flag); - uint16 MatchColor(GUIPalette* pPal, byte r, byte g, byte b); - void SetCLUT(GUIPalette*pal); - void GetCLUT(GUIPalette*pal); - - GUIPort *SetPort(GUIPort *port); - GUIPort *GetPort(); + void SetPalette(GuiPalette *sciPal, int16 flag); + void MergePalettes(GuiPalette* pFrom, GuiPalette* pTo, uint16 flag); + uint16 MatchColor(GuiPalette* pPal, byte r, byte g, byte b); + void SetCLUT(GuiPalette*pal); + void GetCLUT(GuiPalette*pal); + + GuiPort *SetPort(GuiPort *port); + GuiPort *GetPort(); void SetOrigin(int16 left, int16 top); void MoveTo(int16 left, int16 top); void Move(int16 left, int16 top); - void OpenPort(GUIPort *port); + void OpenPort(GuiPort *port); void PenColor(int16 color); void PenMode(int16 mode); void TextFace(int16 textFace); int16 GetPointSize(void); - GUIResourceId GetFontId(); - SciGUIfont *GetFont(); - void SetFont(GUIResourceId fontId); + GuiResourceId GetFontId(); + SciGuiFont *GetFont(); + void SetFont(GuiResourceId fontId); void ClearScreen(byte color = 255); void InvertRect(const Common::Rect &rect); @@ -90,17 +90,17 @@ public: void SetTextFonts(int argc, reg_t *argv); void SetTextColors(int argc, reg_t *argv); - int16 TextSize(Common::Rect &rect, const char *str, GUIResourceId fontId, int16 maxwidth); - void ShowString(const char *str, GUIResourceId orgFontId, int16 orgPenColor) { + int16 TextSize(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxwidth); + void ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { ShowText(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } - void DrawString(const char *str, GUIResourceId orgFontId, int16 orgPenColor) { + void DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { DrawText(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } - void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GUIResourceId fontId); + void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId); void ShowBits(const Common::Rect &r, uint16 flags); - GUIMemoryHandle SaveBits(const Common::Rect &rect, byte screenFlags); - void RestoreBits(GUIMemoryHandle memoryHandle); + GuiMemoryHandle SaveBits(const Common::Rect &rect, byte screenFlags); + void RestoreBits(GuiMemoryHandle memoryHandle); void Draw_Line(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control); void Draw_Horiz(int16 left, int16 right, int16 top, byte flag, byte color, byte prio, byte control); @@ -112,10 +112,10 @@ public: void Draw_Pattern(int16 x, int16 y, byte pic_color, byte pic_priority, byte pic_control, byte code, byte texture); void Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control); - void drawPicture(GUIResourceId pictureId, uint16 style, bool addToFlag, GUIResourceId paletteId); - void drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo); + void drawPicture(GuiResourceId pictureId, uint16 style, bool addToFlag, GuiResourceId paletteId); + void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo); - void PaletteSetIntensity(int fromColor, int toColor, int intensity, GUIPalette *destPalette); + void PaletteSetIntensity(int fromColor, int toColor, int intensity, GuiPalette *destPalette); void PaletteAnimate(byte fromColor, byte toColor, int speed); int16 onControl(uint16 screenMask, Common::Rect rect); @@ -124,47 +124,47 @@ public: void AnimateFill(); void AnimateSort(); void AnimateUpdate(); - void AnimateDrawCells(); + void AnimateDrawCels(); void AnimateRestoreAndDelete(); void SetNowSeen(reg_t objectReference); - GUIPort *_menuPort; + GuiPort *_menuPort; uint32 _sysTicks; int32 _sysSpeed; // ticker timer in ms - GUIPalette _sysPalette; + GuiPalette _sysPalette; bool _picNotValid; private: - int16 TextCodeProcessing(const char *&text, GUIResourceId orgFontId, int16 orgPenColor); - void TextWidth(const char*text, int16 from, int16 len, GUIResourceId orgFontId, int16 &textWidth, int16 &textHeight); - void StringWidth(const char*str, GUIResourceId orgFontId, int16 &textWidth, int16 &textHeight); - int16 GetLongest(const char *str, int16 maxwidth, GUIResourceId orgFontId); - void DrawText(const char *str, int16 from, int16 len, GUIResourceId orgFontId, int16 orgPenColor); - void ShowText(const char *str, int16 from, int16 len, GUIResourceId orgFontId, int16 orgPenColor); + int16 TextCodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor); + void TextWidth(const char*text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight); + void StringWidth(const char*str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight); + int16 GetLongest(const char *str, int16 maxwidth, GuiResourceId orgFontId); + void DrawText(const char *str, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); + void ShowText(const char *str, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); OSystem *_system; EngineState *_s; - SciGUIscreen *_screen; + SciGuiScreen *_screen; Common::Rect _bounds; - GUIPort *_mainPort; - GUIPort *_curPort; + GuiPort *_mainPort; + GuiPort *_curPort; uint16 _clrPowers[256]; byte bMapColors; - GUIPalette *pPicPal; - Common::Array<GUIPalSchedule> _palSchedules; + GuiPalette *pPicPal; + Common::Array<GuiPalSchedule> _palSchedules; int _textFontsCount; - GUIResourceId *_textFonts; + GuiResourceId *_textFonts; int _textColorsCount; uint16 *_textColors; // Animate* related variables List *_lastCast; - SciGUIfont *_font; + SciGuiFont *_font; }; } // End of namespace Sci diff --git a/engines/sci/gui/gui_helpers.h b/engines/sci/gui/gui_helpers.h index b4f028f03d..0fcf4ce6ca 100644 --- a/engines/sci/gui/gui_helpers.h +++ b/engines/sci/gui/gui_helpers.h @@ -31,31 +31,31 @@ namespace Sci { -typedef int GUIResourceId; // is a resource-number and -1 means no parameter given -typedef reg_t GUIMemoryHandle; -typedef int16 GUIViewLoopNo; -typedef int16 GUIViewCellNo; +typedef int GuiResourceId; // is a resource-number and -1 means no parameter given +typedef reg_t GuiMemoryHandle; +typedef int16 GuiViewLoopNo; +typedef int16 GuiViewCelNo; -typedef uint16 GUIHandle; +typedef uint16 GuiHandle; -struct GUIPort { +struct GuiPort { uint16 id; int16 top, left; Common::Rect rect; int16 curTop, curLeft; int16 fontHeight; - GUIResourceId fontId; + GuiResourceId fontId; int16 textFace, penClr, backClr; int16 penMode; - GUIPort(uint16 theId) : id(theId), top(0), left(0), + GuiPort(uint16 theId) : id(theId), top(0), left(0), curTop(0), curLeft(0), fontHeight(0), fontId(0), textFace(0), penClr(0), backClr(0xFF), penMode(0) { } }; -struct GUIWindow : public GUIPort { +struct GuiWindow : public GuiPort { Common::Rect dims; // client area of window Common::Rect restoreRect; // total area of window including borders uint16 wndStyle; @@ -65,36 +65,36 @@ struct GUIWindow : public GUIPort { Common::String title; bool bDrawn; - GUIWindow(uint16 theId) : GUIPort(theId), + GuiWindow(uint16 theId) : GuiPort(theId), wndStyle(0), uSaveFlag(0), hSaved1(NULL_REG), hSaved2(NULL_REG), bDrawn(false) { } }; -struct GUICast { +struct GuiCast { uint16 view; uint16 loop; uint16 cel; uint16 z; uint16 pal; - GUIHandle hSaved; + GuiHandle hSaved; Common::Rect rect; }; -struct GUIColor { +struct GuiColor { byte used; byte r, g, b; }; -struct GUIPalette { +struct GuiPalette { byte mapping[256]; uint32 timestamp; - GUIColor colors[256]; + GuiColor colors[256]; byte intensity[256]; }; -struct GUIPalSchedule { +struct GuiPalSchedule { byte from; uint32 schedule; }; diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp index a4261a0db8..c10105279f 100644 --- a/engines/sci/gui/gui_picture.cpp +++ b/engines/sci/gui/gui_picture.cpp @@ -32,23 +32,23 @@ namespace Sci { -SciGUIpicture::SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId) +SciGuiPicture::SciGuiPicture(EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, GuiResourceId resourceId) : _s(state), _gfx(gfx), _screen(screen), _resourceId(resourceId) { assert(resourceId != -1); initData(resourceId); } -SciGUIpicture::~SciGUIpicture() { +SciGuiPicture::~SciGuiPicture() { } -void SciGUIpicture::initData(GUIResourceId resourceId) { +void SciGuiPicture::initData(GuiResourceId resourceId) { _resource = _s->resMan->findResource(ResourceId(kResourceTypePic, resourceId), false); if (!_resource) { error("picture resource %d not found", resourceId); } } -GUIResourceId SciGUIpicture::getResourceId() { +GuiResourceId SciGuiPicture::getResourceId() { return _resourceId; } @@ -56,7 +56,7 @@ GUIResourceId SciGUIpicture::getResourceId() { #define CEL_HEADER_SIZE 7 #define EXTRA_MAGIC_SIZE 15 -void SciGUIpicture::draw(uint16 style, bool addToFlag, int16 EGApaletteNo) { +void SciGuiPicture::draw(uint16 style, bool addToFlag, int16 EGApaletteNo) { _style = style; _addToFlag = addToFlag; _EGApaletteNo = EGApaletteNo; @@ -73,7 +73,7 @@ void SciGUIpicture::draw(uint16 style, bool addToFlag, int16 EGApaletteNo) { } } -void SciGUIpicture::reset() { +void SciGuiPicture::reset() { int16 x, y; for (y = _curPort->top; y < _screen->_height; y++) { for (x = 0; x < _screen->_width; x++) { @@ -82,7 +82,7 @@ void SciGUIpicture::reset() { } } -void SciGUIpicture::draw11() { +void SciGuiPicture::draw11() { byte *inbuffer = _resource->data; int size = _resource->size; int has_view = READ_LE_UINT16(inbuffer + 4); @@ -94,7 +94,7 @@ void SciGUIpicture::draw11() { int view_rle_ptr = READ_LE_UINT16(inbuffer + view_data_ptr + 24); int view_pixel_ptr = READ_LE_UINT16(inbuffer + view_data_ptr + 28); byte *view = NULL; - GUIPalette palette; + GuiPalette palette; // Create palette and set it _gfx->CreatePaletteFromData(inbuffer + palette_data_ptr, &palette); @@ -115,7 +115,7 @@ void SciGUIpicture::draw11() { drawVectorData(inbuffer + vector_data_ptr, vector_size); } -void SciGUIpicture::decodeRLE(byte *rledata, byte *pixeldata, byte *outbuffer, int size) { +void SciGuiPicture::decodeRLE(byte *rledata, byte *pixeldata, byte *outbuffer, int size) { int pos = 0; byte nextbyte; byte *rd = rledata; @@ -145,7 +145,7 @@ void SciGUIpicture::decodeRLE(byte *rledata, byte *pixeldata, byte *outbuffer, i } } -void SciGUIpicture::drawCel(int16 x, int16 y, byte *pdata, int size) { +void SciGuiPicture::drawCel(int16 x, int16 y, byte *pdata, int size) { byte* pend = pdata + size; uint16 width = READ_LE_UINT16(pdata + 0); uint16 height = READ_LE_UINT16(pdata + 2); @@ -199,7 +199,7 @@ void SciGUIpicture::drawCel(int16 x, int16 y, byte *pdata, int size) { } } -void SciGUIpicture::drawCelAmiga(int16 x, int16 y, byte *pdata, int size) { +void SciGuiPicture::drawCelAmiga(int16 x, int16 y, byte *pdata, int size) { byte* pend = pdata + size; uint16 width = READ_LE_UINT16(pdata + 0); uint16 height = READ_LE_UINT16(pdata + 2); @@ -291,7 +291,7 @@ static const byte vector_defaultEGApalette[PIC_EGAPALETTE_SIZE] = { 0x08, 0x91, 0x2a, 0x3b, 0x4c, 0x5d, 0x6e, 0x88 }; -void SciGUIpicture::drawVectorData(byte *data, int dataSize) { +void SciGuiPicture::drawVectorData(byte *data, int dataSize) { byte pic_op; byte pic_color = 0, pic_priority = 0x0F, pic_control = 0x0F; int16 x = 0, y = 0, oldx, oldy; @@ -302,7 +302,7 @@ void SciGUIpicture::drawVectorData(byte *data, int dataSize) { uint16 size; byte byte; int i; - GUIPalette palette; + GuiPalette palette; int16 pattern_Code = 0, pattern_Texture = 0; bool sci1 = false; @@ -510,20 +510,20 @@ void SciGUIpicture::drawVectorData(byte *data, int dataSize) { error("picture vector data without terminator"); } -bool SciGUIpicture::vectorIsNonOpcode(byte byte) { +bool SciGuiPicture::vectorIsNonOpcode(byte byte) { if (byte >= PIC_OP_FIRST) return false; return true; } -void SciGUIpicture::vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y) { +void SciGuiPicture::vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y) { byte byte = data[curPos++]; x = data[curPos++] + ((byte & 0xF0) << 4); y = data[curPos++] + ((byte & 0x0F) << 8); if (_style & PIC_STYLE_MIRRORED) x = 319 - x; } -void SciGUIpicture::vectorGetRelCoords(byte *data, int &curPos, int16 oldx, int16 oldy, int16 &x, int16 &y) { +void SciGuiPicture::vectorGetRelCoords(byte *data, int &curPos, int16 oldx, int16 oldy, int16 &x, int16 &y) { byte byte = data[curPos++]; if (byte & 0x80) { x = oldx - ((byte >> 4) & 7) * (_style & PIC_STYLE_MIRRORED ? -1 : 1); @@ -537,7 +537,7 @@ void SciGUIpicture::vectorGetRelCoords(byte *data, int &curPos, int16 oldx, int1 } } -void SciGUIpicture::vectorGetRelCoordsMed(byte *data, int &curPos, int16 oldx, int16 oldy, int16 &x, int16 &y) { +void SciGuiPicture::vectorGetRelCoordsMed(byte *data, int &curPos, int16 oldx, int16 oldy, int16 &x, int16 &y) { byte byte = data[curPos++]; if (byte & 0x80) { y = oldy - (byte & 0x7F); @@ -552,7 +552,7 @@ void SciGUIpicture::vectorGetRelCoordsMed(byte *data, int &curPos, int16 oldx, i } } -void SciGUIpicture::vectorGetPatternTexture(byte *data, int &curPos, int16 pattern_Code, int16 &pattern_Texture) { +void SciGuiPicture::vectorGetPatternTexture(byte *data, int &curPos, int16 pattern_Code, int16 &pattern_Texture) { if (pattern_Code & SCI_PATTERN_CODE_USE_TEXTURE) { pattern_Texture = (data[curPos++] >> 1) & 0x7f; } diff --git a/engines/sci/gui/gui_picture.h b/engines/sci/gui/gui_picture.h index 969e7c3433..54d7c7d6e4 100644 --- a/engines/sci/gui/gui_picture.h +++ b/engines/sci/gui/gui_picture.h @@ -33,16 +33,16 @@ namespace Sci { #define PIC_STYLE_MIRRORED 0x4000 -class SciGUIpicture { +class SciGuiPicture { public: - SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId); - ~SciGUIpicture(); + SciGuiPicture(EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, GuiResourceId resourceId); + ~SciGuiPicture(); - GUIResourceId getResourceId(); + GuiResourceId getResourceId(); void draw(uint16 style, bool addToFlag, int16 EGApaletteNo); private: - void initData(GUIResourceId resourceId); + void initData(GuiResourceId resourceId); void reset(); void draw11(); void decodeRLE(byte *rledata, byte *pixeldata, byte *outbuffer, int size); @@ -56,13 +56,13 @@ private: void vectorGetPatternTexture(byte *data, int &curPos, int16 pattern_Code, int16 &pattern_Texture); EngineState *_s; - SciGUIgfx *_gfx; - SciGUIscreen *_screen; + SciGuiGfx *_gfx; + SciGuiScreen *_screen; int16 _resourceId; Resource *_resource; - GUIPort *_curPort; + GuiPort *_curPort; uint16 _style; bool _addToFlag; int16 _EGApaletteNo; diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index fb37707d2b..caf665a4ef 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -33,15 +33,15 @@ namespace Sci { -SciGUIscreen::SciGUIscreen(OSystem *system, EngineState *state) +SciGuiScreen::SciGuiScreen(OSystem *system, EngineState *state) : _system(system), _s(state) { init(); } -SciGUIscreen::~SciGUIscreen() { +SciGuiScreen::~SciGuiScreen() { } -void SciGUIscreen::init() { +void SciGuiScreen::init() { int i; uint16 base = 0; @@ -66,18 +66,18 @@ void SciGUIscreen::init() { } } -byte *SciGUIscreen::initScreen(uint16 pixelCount) { +byte *SciGuiScreen::initScreen(uint16 pixelCount) { byte *screen = (byte *)malloc(pixelCount); memset(screen, 0, pixelCount); return screen; } -void SciGUIscreen::UpdateWhole() { +void SciGuiScreen::UpdateWhole() { _system->copyRectToScreen(_displayScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight); _system->updateScreen(); } -byte SciGUIscreen::GetDrawingMask(byte color, byte prio, byte control) { +byte SciGuiScreen::GetDrawingMask(byte color, byte prio, byte control) { byte flag = 0; if (color != 255) flag |= SCI_SCREEN_MASK_VISUAL; @@ -88,7 +88,7 @@ byte SciGUIscreen::GetDrawingMask(byte color, byte prio, byte control) { return flag; } -void SciGUIscreen::Put_Pixel(int x, int y, byte drawMask, byte color, byte priority, byte control) { +void SciGuiScreen::Put_Pixel(int x, int y, byte drawMask, byte color, byte priority, byte control) { int offset = _baseTable[y] + x; if (drawMask & SCI_SCREEN_MASK_VISUAL) { @@ -105,19 +105,19 @@ void SciGUIscreen::Put_Pixel(int x, int y, byte drawMask, byte color, byte prior *(_controlScreen + offset) = control; } -byte SciGUIscreen::Get_Visual(int x, int y) { +byte SciGuiScreen::Get_Visual(int x, int y) { return _visualScreen[_baseTable[y] + x]; } -byte SciGUIscreen::Get_Priority(int x, int y) { +byte SciGuiScreen::Get_Priority(int x, int y) { return _priorityScreen[_baseTable[y] + x]; } -byte SciGUIscreen::Get_Control(int x, int y) { +byte SciGuiScreen::Get_Control(int x, int y) { return _controlScreen[_baseTable[y] + x]; } -byte SciGUIscreen::IsFillMatch(int16 x, int16 y, byte flag, byte t_color, byte t_pri, byte t_con) { +byte SciGuiScreen::IsFillMatch(int16 x, int16 y, byte flag, byte t_color, byte t_pri, byte t_con) { int offset = _baseTable[y] + x; byte match = 0; @@ -130,7 +130,7 @@ byte SciGUIscreen::IsFillMatch(int16 x, int16 y, byte flag, byte t_color, byte t return match; } -int SciGUIscreen::BitsGetDataSize(Common::Rect rect, byte mask) { +int SciGuiScreen::BitsGetDataSize(Common::Rect rect, byte mask) { int byteCount = sizeof(rect) + sizeof(mask); int pixels = rect.width() * rect.height(); if (mask & SCI_SCREEN_MASK_VISUAL) { @@ -145,7 +145,7 @@ int SciGUIscreen::BitsGetDataSize(Common::Rect rect, byte mask) { return byteCount; } -void SciGUIscreen::BitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { +void SciGuiScreen::BitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { memcpy(memoryPtr, (void *)&rect, sizeof(rect)); memoryPtr += sizeof(rect); memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask); @@ -161,7 +161,7 @@ void SciGUIscreen::BitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { } } -void SciGUIscreen::BitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { +void SciGuiScreen::BitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { int width = rect.width(); int y; @@ -173,7 +173,7 @@ void SciGUIscreen::BitsSaveScreen(Common::Rect rect, byte *screen, byte *&memory } } -void SciGUIscreen::BitsRestore(byte *memoryPtr) { +void SciGuiScreen::BitsRestore(byte *memoryPtr) { Common::Rect rect; byte mask; @@ -192,7 +192,7 @@ void SciGUIscreen::BitsRestore(byte *memoryPtr) { } } -void SciGUIscreen::BitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { +void SciGuiScreen::BitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { int width = rect.width(); int y; diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h index db054aa61b..a8c3776173 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -38,10 +38,10 @@ namespace Sci { #define SCI_SCREEN_MASK_ALL SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_CONTROL #define SCI_SCREEN_MASK_DITHERED 128 -class SciGUIscreen { +class SciGuiScreen { public: - SciGUIscreen(OSystem *system, EngineState *state); - ~SciGUIscreen(); + SciGuiScreen(OSystem *system, EngineState *state); + ~SciGuiScreen(); void init(void); byte *initScreen(uint16 pixelCount); @@ -59,7 +59,7 @@ public: void BitsSave(Common::Rect rect, byte mask, byte *memoryPtr); void BitsRestore(byte *memoryPtr); - GUIPalette _sysPalette; + GuiPalette _sysPalette; uint16 _width; uint16 _height; diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index 7b5df78be3..61995f0731 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -32,33 +32,33 @@ namespace Sci { -SciGUIview::SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId) +SciGuiView::SciGuiView(OSystem *system, EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, GuiResourceId resourceId) : _system(system), _s(state), _gfx(gfx), _screen(screen), _resourceId(resourceId) { assert(resourceId != -1); initData(resourceId); } -SciGUIview::~SciGUIview() { +SciGuiView::~SciGuiView() { } static const byte EGAMappingDefault[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -void SciGUIview::initData(GUIResourceId resourceId) { +void SciGuiView::initData(GuiResourceId resourceId) { Resource *viewResource = _s->resMan->findResource(ResourceId(kResourceTypeView, resourceId), false); if (!viewResource) { error("view resource %d not found", resourceId); } _resourceData = viewResource->data; - byte *cellData, *loopData; - uint16 cellOffset; - sciViewCellInfo *cell; - uint16 cellCount = 0; + byte *celData, *loopData; + uint16 celOffset; + sciViewCelInfo *cel; + uint16 celCount = 0; uint16 mirrorBits = 0; uint16 palOffset = 0; uint16 headerSize = 0; - uint16 loopSize = 0, cellSize = 0; - int loopNo, cellNo; + uint16 loopSize = 0, celSize = 0; + int loopNo, celNo; byte seekEntry; bool IsEGA = false; @@ -89,40 +89,40 @@ void SciGUIview::initData(GUIResourceId resourceId) { _loop = new sciViewLoopInfo[_loopCount]; for (loopNo = 0; loopNo < _loopCount; loopNo++) { loopData = _resourceData + READ_LE_UINT16(_resourceData + 8 + loopNo * 2); - // CellCount:WORD Unknown:WORD CellOffset0:WORD CellOffset1:WORD... + // CelCount:WORD Unknown:WORD CelOffset0:WORD CelOffset1:WORD... - cellCount = READ_LE_UINT16(loopData); - _loop[loopNo].cellCount = cellCount; + celCount = READ_LE_UINT16(loopData); + _loop[loopNo].celCount = celCount; _loop[loopNo].mirrorFlag = mirrorBits & 1 ? true : false; mirrorBits >>= 1; // read cel info - _loop[loopNo].cell = new sciViewCellInfo[cellCount]; - for (cellNo = 0; cellNo < cellCount; cellNo++) { - cellOffset = READ_LE_UINT16(loopData + 4 + cellNo * 2); - cellData = _resourceData + cellOffset; + _loop[loopNo].cel = new sciViewCelInfo[celCount]; + for (celNo = 0; celNo < celCount; celNo++) { + celOffset = READ_LE_UINT16(loopData + 4 + celNo * 2); + celData = _resourceData + celOffset; // For VGA // Width:WORD Height:WORD DisplaceX:BYTE DisplaceY:BYTE ClearKey:BYTE Unknown:BYTE RLEData starts now directly // For EGA // Width:WORD Height:WORD DisplaceX:BYTE DisplaceY:BYTE ClearKey:BYTE EGAData starts now directly - cell = &_loop[loopNo].cell[cellNo]; - cell->width = READ_LE_UINT16(cellData); - cell->height = READ_LE_UINT16(cellData + 2); - cell->displaceX = cellData[4]; - cell->displaceY = cellData[5]; - cell->clearKey = cellData[6]; + cel = &_loop[loopNo].cel[celNo]; + cel->width = READ_LE_UINT16(celData); + cel->height = READ_LE_UINT16(celData + 2); + cel->displaceX = celData[4]; + cel->displaceY = celData[5]; + cel->clearKey = celData[6]; if (IsEGA) { - cell->offsetEGA = cellOffset + 7; - cell->offsetRLE = 0; + cel->offsetEGA = celOffset + 7; + cel->offsetRLE = 0; } else { - cell->offsetEGA = 0; - cell->offsetRLE = cellOffset + 8; + cel->offsetEGA = 0; + cel->offsetRLE = celOffset + 8; } - cell->offsetLiteral = 0; - cell->rawBitmap = 0; + cel->offsetLiteral = 0; + cel->rawBitmap = 0; if (_loop[loopNo].mirrorFlag) - cell->displaceX = -cell->displaceX; + cel->displaceX = -cel->displaceX; } } break; @@ -136,7 +136,7 @@ void SciGUIview::initData(GUIResourceId resourceId) { loopData = _resourceData + headerSize; loopSize = _resourceData[12]; - cellSize = _resourceData[13]; + celSize = _resourceData[13]; if (palOffset) { _gfx->CreatePaletteFromData(&_resourceData[palOffset], &_palette); @@ -152,29 +152,29 @@ void SciGUIview::initData(GUIResourceId resourceId) { loopData = _resourceData + headerSize + (seekEntry * loopNo); } - cellCount = loopData[4]; - _loop[loopNo].cellCount = cellCount; + celCount = loopData[4]; + _loop[loopNo].celCount = celCount; _loop[loopNo].mirrorFlag = false; - cellData = _resourceData + READ_LE_UINT16(loopData + 14); + celData = _resourceData + READ_LE_UINT16(loopData + 14); // read cel info - _loop[loopNo].cell = new sciViewCellInfo[cellCount]; - for (cellNo = 0; cellNo < cellCount; cellNo++) { - cell = &_loop[loopNo].cell[cellNo]; - cell->width = READ_LE_UINT16(cellData); - cell->height = READ_LE_UINT16(cellData + 2); - cell->displaceX = READ_LE_UINT16(cellData + 4); - cell->displaceY = READ_LE_UINT16(cellData + 6); - cell->clearKey = cellData[8]; - cell->offsetEGA = 0; - cell->offsetRLE = READ_LE_UINT16(cellData + 24); - cell->offsetLiteral = READ_LE_UINT16(cellData + 28); - cell->rawBitmap = 0; + _loop[loopNo].cel = new sciViewCelInfo[celCount]; + for (celNo = 0; celNo < celCount; celNo++) { + cel = &_loop[loopNo].cel[celNo]; + cel->width = READ_LE_UINT16(celData); + cel->height = READ_LE_UINT16(celData + 2); + cel->displaceX = READ_LE_UINT16(celData + 4); + cel->displaceY = READ_LE_UINT16(celData + 6); + cel->clearKey = celData[8]; + cel->offsetEGA = 0; + cel->offsetRLE = READ_LE_UINT16(celData + 24); + cel->offsetLiteral = READ_LE_UINT16(celData + 28); + cel->rawBitmap = 0; if (_loop[loopNo].mirrorFlag) - cell->displaceX = -cell->displaceX; + cel->displaceX = -cel->displaceX; - cellData += cellSize; + celData += celSize; } } break; @@ -189,62 +189,62 @@ void SciGUIview::initData(GUIResourceId resourceId) { } } -GUIResourceId SciGUIview::getResourceId() { +GuiResourceId SciGuiView::getResourceId() { return _resourceId; } -int16 SciGUIview::getWidth(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { +int16 SciGuiView::getWidth(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); - if (cellNo >= _loop[loopNo].cellCount) - cellNo = 0; - return _loopCount ? _loop[loopNo].cell[cellNo].width : 0; + if (celNo >= _loop[loopNo].celCount) + celNo = 0; + return _loopCount ? _loop[loopNo].cel[celNo].width : 0; } -int16 SciGUIview::getHeight(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { +int16 SciGuiView::getHeight(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); - if (cellNo >= _loop[loopNo].cellCount) - cellNo = 0; - return _loopCount ? _loop[loopNo].cell[cellNo].height : 0; + if (celNo >= _loop[loopNo].celCount) + celNo = 0; + return _loopCount ? _loop[loopNo].cel[celNo].height : 0; } -sciViewCellInfo *SciGUIview::getCellInfo(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { +sciViewCelInfo *SciGuiView::getCelInfo(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); - if (cellNo >= _loop[loopNo].cellCount) - cellNo = 0; - return _loopCount ? &_loop[loopNo].cell[cellNo] : NULL; + if (celNo >= _loop[loopNo].celCount) + celNo = 0; + return _loopCount ? &_loop[loopNo].cel[celNo] : NULL; } -sciViewLoopInfo *SciGUIview::getLoopInfo(GUIViewLoopNo loopNo) { +sciViewLoopInfo *SciGuiView::getLoopInfo(GuiViewLoopNo loopNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); return _loopCount ? &_loop[loopNo] : NULL; } -void SciGUIview::getCellRect(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 x, int16 y, int16 z, Common::Rect *outRect) { - sciViewCellInfo *cellInfo = getCellInfo(loopNo, cellNo); - if (cellInfo) { - outRect->left = x + cellInfo->displaceX - (cellInfo->width >> 1); - outRect->right = outRect->left + cellInfo->width; - outRect->bottom = y + cellInfo->displaceY - z + 1; - outRect->top = outRect->bottom - cellInfo->height; +void SciGuiView::getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect) { + sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); + if (celInfo) { + outRect->left = x + celInfo->displaceX - (celInfo->width >> 1); + outRect->right = outRect->left + celInfo->width; + outRect->bottom = y + celInfo->displaceY - z + 1; + outRect->top = outRect->bottom - celInfo->height; } } -void SciGUIview::unpackCel(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *outPtr, uint16 pixelCount) { - sciViewCellInfo *cellInfo = getCellInfo(loopNo, cellNo); +void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPtr, uint16 pixelCount) { + sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); byte *rlePtr; byte *literalPtr; uint16 pixelNo = 0, brun; byte b; - if (cellInfo->offsetEGA) { // EGA data - literalPtr = _resourceData + _loop[loopNo].cell[cellNo].offsetEGA; + if (celInfo->offsetEGA) { // EGA data + literalPtr = _resourceData + _loop[loopNo].cel[celNo].offsetEGA; // FIXME: Implement EGA "decompression" return; } - rlePtr = _resourceData + cellInfo->offsetRLE; - if (!cellInfo->offsetLiteral) { // no extra literal data + rlePtr = _resourceData + celInfo->offsetRLE; + if (!celInfo->offsetLiteral) { // no extra literal data while (pixelNo < pixelCount) { b = *rlePtr++; brun = b & 0x3F; // bytes run length on this step @@ -263,7 +263,7 @@ void SciGUIview::unpackCel(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *out } } } else { - literalPtr = _resourceData + cellInfo->offsetLiteral; + literalPtr = _resourceData + celInfo->offsetLiteral; while (pixelNo < pixelCount) { b = *rlePtr++; brun = b & 0x3F; // bytes run length on this step @@ -284,25 +284,25 @@ void SciGUIview::unpackCel(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *out } } -byte *SciGUIview::getBitmap(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { +byte *SciGuiView::getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); - if (cellNo >= _loop[loopNo].cellCount) - cellNo = 0; - if (_loop[loopNo].cell[cellNo].rawBitmap) - return _loop[loopNo].cell[cellNo].rawBitmap; + if (celNo >= _loop[loopNo].celCount) + celNo = 0; + if (_loop[loopNo].cel[celNo].rawBitmap) + return _loop[loopNo].cel[celNo].rawBitmap; - uint16 width = _loop[loopNo].cell[cellNo].width; - uint16 height = _loop[loopNo].cell[cellNo].height; + uint16 width = _loop[loopNo].cel[celNo].width; + uint16 height = _loop[loopNo].cel[celNo].height; // allocating memory to store cel's bitmap assert(width * height <= 64000); uint16 pixelCount = width * height; - _loop[loopNo].cell[cellNo].rawBitmap = new byte[pixelCount]; - byte *pOut = _loop[loopNo].cell[cellNo].rawBitmap; + _loop[loopNo].cel[celNo].rawBitmap = new byte[pixelCount]; + byte *pOut = _loop[loopNo].cel[celNo].rawBitmap; // Some RLE compressed cels end with the last non-transparent pixel, thats why we fill it up here // FIXME: change this to fill the remaining bytes within unpackCel() - memset(pOut, _loop[loopNo].cell[cellNo].clearKey, pixelCount); - unpackCel(loopNo, cellNo, pOut, pixelCount); + memset(pOut, _loop[loopNo].cel[celNo].clearKey, pixelCount); + unpackCel(loopNo, celNo, pOut, pixelCount); // mirroring the view if needed if (_loop[loopNo].mirrorFlag) { @@ -310,16 +310,16 @@ byte *SciGUIview::getBitmap(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { for (int j = 0; j < width / 2; j++) SWAP(pOut[j], pOut[width - j - 1]); } - return _loop[loopNo].cell[cellNo].rawBitmap; + return _loop[loopNo].cel[celNo].rawBitmap; } -void SciGUIview::draw(Common::Rect rect, Common::Rect clipRect, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte priority, uint16 paletteNo) { - GUIPalette *palette = _embeddedPal ? &_palette : &_gfx->_sysPalette; - sciViewCellInfo *cellInfo = getCellInfo(loopNo, cellNo); - byte *bitmap = getBitmap(loopNo, cellNo); - int16 cellHeight = cellInfo->height, cellWidth = cellInfo->width; +void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo) { + GuiPalette *palette = _embeddedPal ? &_palette : &_gfx->_sysPalette; + sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); + byte *bitmap = getBitmap(loopNo, celNo); + int16 celHeight = celInfo->height, celWidth = celInfo->width; int16 width, height; - byte clearKey = cellInfo->clearKey; + byte clearKey = celInfo->clearKey; byte color; byte drawMask = priority == 255 ? SCI_SCREEN_MASK_VISUAL : SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY; int x, y; @@ -328,13 +328,13 @@ void SciGUIview::draw(Common::Rect rect, Common::Rect clipRect, GUIViewLoopNo lo if (_embeddedPal) _gfx->SetPalette(&_palette, 1); - width = MIN(clipRect.width(), cellWidth); - height = MIN(clipRect.height(), cellHeight); + width = MIN(clipRect.width(), celWidth); + height = MIN(clipRect.height(), celHeight); - bitmap += (clipRect.top - rect.top) * cellWidth + (clipRect.left - rect.left); + bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left); _gfx->OffsetRect(clipRect); - for (y = clipRect.top; y < clipRect.top + height; y++, bitmap += cellWidth) { + for (y = clipRect.top; y < clipRect.top + height; y++, bitmap += celWidth) { for (x = 0; x < width; x++) { color = bitmap[x]; if (color != clearKey && priority >= _screen->Get_Priority(clipRect.left + x, y)) diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h index a34153c39b..89bdcc3332 100644 --- a/engines/sci/gui/gui_view.h +++ b/engines/sci/gui/gui_view.h @@ -28,7 +28,7 @@ namespace Sci { -struct sciViewCellInfo { +struct sciViewCelInfo { int16 width, height; char displaceX; byte displaceY; @@ -41,42 +41,42 @@ struct sciViewCellInfo { struct sciViewLoopInfo { bool mirrorFlag; - uint16 cellCount; - sciViewCellInfo *cell; + uint16 celCount; + sciViewCelInfo *cel; }; -class SciGUIview { +class SciGuiView { public: - SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId); - ~SciGUIview(); + SciGuiView(OSystem *system, EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, GuiResourceId resourceId); + ~SciGuiView(); - // TODO: Remove gfx reference after putting palette things into SciGUIscreen + // TODO: Remove gfx reference after putting palette things into SciGuiScreen - GUIResourceId getResourceId(); - int16 getWidth(GUIViewLoopNo loopNo, GUIViewCellNo cellNo); - int16 getHeight(GUIViewLoopNo loopNo, GUIViewCellNo cellNo); - sciViewCellInfo *getCellInfo(GUIViewLoopNo loopNo, GUIViewCellNo cellNo); - sciViewLoopInfo *getLoopInfo(GUIViewLoopNo loopNo); - void getCellRect(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 x, int16 y, int16 z, Common::Rect *outRect); - byte *getBitmap(GUIViewLoopNo loopNo, GUIViewCellNo cellNo); - void draw(Common::Rect rect, Common::Rect clipRect, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte priority, uint16 paletteNo); + GuiResourceId getResourceId(); + int16 getWidth(GuiViewLoopNo loopNo, GuiViewCelNo celNo); + int16 getHeight(GuiViewLoopNo loopNo, GuiViewCelNo celNo); + sciViewCelInfo *getCelInfo(GuiViewLoopNo loopNo, GuiViewCelNo celNo); + sciViewLoopInfo *getLoopInfo(GuiViewLoopNo loopNo); + void getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); + byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo); + void draw(Common::Rect rect, Common::Rect clipRect, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo); private: - void initData(GUIResourceId resourceId); - void unpackCel(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *outPtr, uint16 pixelCount); + void initData(GuiResourceId resourceId); + void unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPtr, uint16 pixelCount); OSystem *_system; EngineState *_s; - SciGUIgfx *_gfx; - SciGUIscreen *_screen; + SciGuiGfx *_gfx; + SciGuiScreen *_screen; - GUIResourceId _resourceId; + GuiResourceId _resourceId; byte *_resourceData; uint16 _loopCount; sciViewLoopInfo *_loop; bool _embeddedPal; - GUIPalette _palette; + GuiPalette _palette; const byte *_EGAMapping; // simple translation map for all 16 colors }; diff --git a/engines/sci/gui/gui_windowmgr.cpp b/engines/sci/gui/gui_windowmgr.cpp index 38d2cc8787..46ead18fda 100644 --- a/engines/sci/gui/gui_windowmgr.cpp +++ b/engines/sci/gui/gui_windowmgr.cpp @@ -42,10 +42,10 @@ enum { kUser = (1 << 7) }; -SciGUIwindowMgr::SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx) +SciGuiWindowMgr::SciGuiWindowMgr(EngineState *state, SciGuiGfx *gfx) : _s(state), _gfx(gfx) { - _wmgrPort = new GUIPort(1); + _wmgrPort = new GuiPort(1); _windowsById.resize(2); _windowsById[0] = 0; _windowsById[1] = _wmgrPort; @@ -66,42 +66,42 @@ SciGUIwindowMgr::SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx) _picWind = NewWindow(Common::Rect(0, 10, 320, 200), 0, 0, kTransparent | kNoFrame, 0, 1); } -SciGUIwindowMgr::~SciGUIwindowMgr() { +SciGuiWindowMgr::~SciGuiWindowMgr() { // TODO: Clear _windowList and delete all stuff in it? } -int16 SciGUIwindowMgr::isFrontWindow(GUIWindow *pWnd) { +int16 SciGuiWindowMgr::isFrontWindow(GuiWindow *pWnd) { return _windowList.back() == pWnd; } -void SciGUIwindowMgr::BeginUpdate(GUIWindow *wnd) { - GUIPort *oldPort = _gfx->SetPort(_wmgrPort); +void SciGuiWindowMgr::BeginUpdate(GuiWindow *wnd) { + GuiPort *oldPort = _gfx->SetPort(_wmgrPort); PortList::iterator it = _windowList.reverse_begin(); const PortList::iterator end = Common::find(_windowList.begin(), _windowList.end(), wnd); while (it != end) { - // FIXME: We also store GUIPort objects in the window list. + // FIXME: We also store GuiPort objects in the window list. // We should add a check that we really only pass windows here... - UpdateWindow((GUIWindow *)*it); + UpdateWindow((GuiWindow *)*it); --it; } _gfx->SetPort(oldPort); } -void SciGUIwindowMgr::EndUpdate(GUIWindow *wnd) { - GUIPort *oldPort = _gfx->SetPort(_wmgrPort); +void SciGuiWindowMgr::EndUpdate(GuiWindow *wnd) { + GuiPort *oldPort = _gfx->SetPort(_wmgrPort); const PortList::iterator end = _windowList.end(); PortList::iterator it = Common::find(_windowList.begin(), end, wnd); while (it != end) { ++it; - // FIXME: We also store GUIPort objects in the window list. + // FIXME: We also store GuiPort objects in the window list. // We should add a check that we really only pass windows here... - UpdateWindow((GUIWindow *)*it); + UpdateWindow((GuiWindow *)*it); } _gfx->SetPort(oldPort); } -GUIWindow *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA) { +GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA) { // Find an unused window/port id uint id = 1; while (id < _windowsById.size() && _windowsById[id]) { @@ -112,7 +112,7 @@ GUIWindow *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Re assert(0 < id && id < 0xFFFF); - GUIWindow *pwnd = new GUIWindow(id); + GuiWindow *pwnd = new GuiWindow(id); Common::Rect r; if (!pwnd) { @@ -175,20 +175,20 @@ GUIWindow *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Re if (argA) DrawWindow(pwnd); - _gfx->SetPort((GUIPort *)pwnd); + _gfx->SetPort((GuiPort *)pwnd); _gfx->SetOrigin(pwnd->rect.left, pwnd->rect.top + _wmgrPort->top); pwnd->rect.moveTo(0, 0); return pwnd; } -void SciGUIwindowMgr::DrawWindow(GUIWindow *pWnd) { +void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) { if (pWnd->bDrawn) return; Common::Rect r; int16 wndStyle = pWnd->wndStyle; pWnd->bDrawn = true; - GUIPort *oldport = _gfx->SetPort(_wmgrPort); + GuiPort *oldport = _gfx->SetPort(_wmgrPort); _gfx->PenColor(0); if ((wndStyle & kTransparent) == 0) { pWnd->hSaved1 = _gfx->SaveBits(pWnd->restoreRect, 1); @@ -232,7 +232,7 @@ void SciGUIwindowMgr::DrawWindow(GUIWindow *pWnd) { _gfx->SetPort(oldport); } -void SciGUIwindowMgr::DisposeWindow(GUIWindow *pWnd, int16 arg2) { +void SciGuiWindowMgr::DisposeWindow(GuiWindow *pWnd, int16 arg2) { _gfx->SetPort(_wmgrPort); _gfx->RestoreBits(pWnd->hSaved1); _gfx->RestoreBits(pWnd->hSaved2); @@ -246,8 +246,8 @@ void SciGUIwindowMgr::DisposeWindow(GUIWindow *pWnd, int16 arg2) { delete pWnd; } -void SciGUIwindowMgr::UpdateWindow(GUIWindow *wnd) { - GUIMemoryHandle handle; +void SciGuiWindowMgr::UpdateWindow(GuiWindow *wnd) { + GuiMemoryHandle handle; if (wnd->uSaveFlag && wnd->bDrawn) { handle = _gfx->SaveBits(wnd->restoreRect, 1); diff --git a/engines/sci/gui/gui_windowmgr.h b/engines/sci/gui/gui_windowmgr.h index c975f94e69..c34ce906ed 100644 --- a/engines/sci/gui/gui_windowmgr.h +++ b/engines/sci/gui/gui_windowmgr.h @@ -31,35 +31,35 @@ namespace Sci { -class SciGUIwindowMgr { +class SciGuiWindowMgr { public: - SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx); - ~SciGUIwindowMgr(); + SciGuiWindowMgr(EngineState *state, SciGuiGfx *gfx); + ~SciGuiWindowMgr(); - int16 isFrontWindow(GUIWindow *wnd); - void BeginUpdate(GUIWindow *wnd); - void EndUpdate(GUIWindow *wnd); - GUIWindow *NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA); - void DrawWindow(GUIWindow *wnd); - void DisposeWindow(GUIWindow *pWnd, int16 arg2); - void UpdateWindow(GUIWindow *wnd); + int16 isFrontWindow(GuiWindow *wnd); + void BeginUpdate(GuiWindow *wnd); + void EndUpdate(GuiWindow *wnd); + GuiWindow *NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA); + void DrawWindow(GuiWindow *wnd); + void DisposeWindow(GuiWindow *pWnd, int16 arg2); + void UpdateWindow(GuiWindow *wnd); - GUIPort *getPortById(uint16 id) const { return _windowsById[id]; } + GuiPort *getPortById(uint16 id) const { return _windowsById[id]; } - GUIPort *_wmgrPort; - GUIWindow *_picWind; + GuiPort *_wmgrPort; + GuiWindow *_picWind; private: - typedef Common::List<GUIPort *> PortList; + typedef Common::List<GuiPort *> PortList; EngineState *_s; - SciGUIgfx *_gfx; + SciGuiGfx *_gfx; /** The list of open 'windows' (and ports), in visual order. */ PortList _windowList; /** The list of all open 'windows' (and ports), ordered by their id. */ - Common::Array<GUIPort *> _windowsById; + Common::Array<GuiPort *> _windowsById; }; } // End of namespace Sci diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index c1c317a41f..718b96dc7f 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -64,14 +64,14 @@ namespace Sci { -SciGUI32::SciGUI32(OSystem *system, EngineState *state) +SciGui32::SciGui32(OSystem *system, EngineState *state) : _system(system), s(state) { } -SciGUI32::~SciGUI32() { +SciGui32::~SciGui32() { } -void SciGUI32::init(bool oldGfxFunctions) { +void SciGui32::init(bool oldGfxFunctions) { _usesOldGfxFunctions = oldGfxFunctions; _k_animate_ran = false; activated_icon_bar = false; @@ -79,13 +79,13 @@ void SciGUI32::init(bool oldGfxFunctions) { port_origin_y = 0; } -int16 SciGUI32::getTimeTicks() { +int16 SciGui32::getTimeTicks() { uint32 start_time; start_time = _system->getMillis() - s->game_start_time; return start_time * 60 / 1000; } -void SciGUI32::wait(int16 ticks) { +void SciGui32::wait(int16 ticks) { uint32 time; time = g_system->getMillis(); @@ -101,7 +101,7 @@ void SciGUI32::wait(int16 ticks) { s->speedThrottler->reset(); } -void SciGUI32::setPort(uint16 portPtr) { +void SciGui32::setPort(uint16 portPtr) { GfxPort *new_port; /* We depart from official semantics here, sorry! @@ -123,7 +123,7 @@ void SciGUI32::setPort(uint16 portPtr) { s->port = new_port; } -void SciGUI32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { +void SciGui32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { if (activated_icon_bar) { port_origin_x = port_origin_y = 0; activated_icon_bar = false; @@ -142,7 +142,7 @@ void SciGUI32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { // Notify the graphics resource manager that the pic port bounds changed s->gfx_state->gfxResMan->changePortBounds(picLeft, picTop, rect.right + picLeft, rect.bottom + picTop); - // LSL6 calls kSetPort to extend the screen to draw the GUI. If we free all resources + // LSL6 calls kSetPort to extend the screen to draw the Gui. If we free all resources // here, the background picture is freed too, and this makes everything a big mess. // FIXME/TODO: This code really needs to be rewritten to conform to the original behavior if (s->_gameName != "lsl6") { @@ -157,21 +157,21 @@ void SciGUI32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft) { } } -reg_t SciGUI32::getPort() { +reg_t SciGui32::getPort() { return make_reg(0, s->port->_ID); } -void SciGUI32::globalToLocal(int16 *x, int16 *y) { +void SciGui32::globalToLocal(int16 *x, int16 *y) { *x = *x - s->port->zone.x; *y = *y - s->port->zone.y; } -void SciGUI32::localToGlobal(int16 *x, int16 *y) { +void SciGui32::localToGlobal(int16 *x, int16 *y) { *x = *x + s->port->zone.x; *y = *y + s->port->zone.y; } -reg_t SciGUI32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) { +reg_t SciGui32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) { GfxPort *window; int x, y, xl, yl; gfx_color_t bgcolor; @@ -241,7 +241,7 @@ reg_t SciGUI32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 st return make_reg(0, window->_ID); } -void SciGUI32::disposeWindow(uint16 windowPtr, int16 arg2) { +void SciGui32::disposeWindow(uint16 windowPtr, int16 arg2) { GfxPort *goner; GfxPort *pred; @@ -288,7 +288,7 @@ void SciGUI32::disposeWindow(uint16 windowPtr, int16 arg2) { #define K_DISPLAY_RESTORE_UNDER 108 #define K_DONT_UPDATE_IMMEDIATELY 121 -void SciGUI32::display(const char *text, int argc, reg_t *argv) { +void SciGui32::display(const char *text, int argc, reg_t *argv) { int argpt = 0; int temp; bool save_under = false; @@ -470,7 +470,7 @@ void SciGUI32::display(const char *text, int argc, reg_t *argv) { } } -void SciGUI32::textSize(const char *text, int16 fontId, int16 maxWidth, int16 *textWidth, int16 *textHeight) { +void SciGui32::textSize(const char *text, int16 fontId, int16 maxWidth, int16 *textWidth, int16 *textHeight) { int width, height; if (maxWidth < 0) maxWidth = 0; @@ -479,15 +479,15 @@ void SciGUI32::textSize(const char *text, int16 fontId, int16 maxWidth, int16 *t *textWidth = width; *textHeight = height; } -void SciGUI32::textFonts(int argc, reg_t *argv) { +void SciGui32::textFonts(int argc, reg_t *argv) { // stub } -void SciGUI32::textColors(int argc, reg_t *argv) { +void SciGui32::textColors(int argc, reg_t *argv) { // stub } -void SciGUI32::drawPicture(GUIResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo) { +void SciGui32::drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo) { drawn_pic_t dp; gfx_color_t transparent = s->wm_port->_bgcolor; int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY; @@ -552,9 +552,9 @@ void SciGUI32::drawPicture(GUIResourceId pictureId, uint16 showStyle, uint16 fla s->pic_is_new = 1; } -void SciGUI32::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) { +void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) { int loop = loopNo; - int cel = cellNo; + int cel = celNo; GfxView *new_view; gfxop_check_cel(s->gfx_state, viewId, &loop, &cel); @@ -568,7 +568,7 @@ void SciGUI32::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellN FULL_REDRAW(); } -void SciGUI32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { +void SciGui32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_button_control(s->port, obj, area, text, fontId, @@ -576,7 +576,7 @@ void SciGUI32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, if (!s->pic_not_valid) FULL_REDRAW(); } -void SciGUI32::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { +void SciGui32::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_text_control(s->port, obj, area, text, fontId, (gfx_alignment_t) mode, @@ -624,21 +624,21 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) { delete port; } -void SciGUI32::graphFillBoxForeground(Common::Rect rect) { +void SciGui32::graphFillBoxForeground(Common::Rect rect) { _k_graph_rebuild_port_with_color(s, s->port->_color); //port = _s->port; FULL_REDRAW(); } -void SciGUI32::graphFillBoxBackground(Common::Rect rect) { +void SciGui32::graphFillBoxBackground(Common::Rect rect) { _k_graph_rebuild_port_with_color(s, s->port->_bgcolor); //port = _s->port; FULL_REDRAW(); } -void SciGUI32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) { +void SciGui32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) { gfx_color_t fillColor = graph_map_color(s, color, priority, control); fillColor.mask = (byte)colorMask; rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); @@ -655,7 +655,7 @@ void SciGUI32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, in s->picture_port->add((GfxContainer *)s->picture_port, gfxw_new_box(s->gfx_state, area, fillColor, fillColor, GFX_BOX_SHADE_FLAT)); } -void SciGUI32::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) { +void SciGui32::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) { gfx_color_t gfxcolor = graph_map_color(s, color, priority, control); debugC(2, kDebugLevelGraphics, "draw_line((%d, %d), (%d, %d), col=%d, p=%d, c=%d, mask=%d)\n", @@ -670,7 +670,7 @@ void SciGUI32::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int FULL_REDRAW(); } -reg_t SciGUI32::graphSaveBox(Common::Rect rect, uint16 flags) { +reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 flags) { rect_t area; area.x = rect.left + s->port->zone.x + port_origin_x; area.y = rect.top + s->port->zone.y + port_origin_y; @@ -680,15 +680,15 @@ reg_t SciGUI32::graphSaveBox(Common::Rect rect, uint16 flags) { return graph_save_box(s, area); } -void SciGUI32::graphRestoreBox(reg_t handle) { +void SciGui32::graphRestoreBox(reg_t handle) { graph_restore_box(s, handle); } -void SciGUI32::paletteSet(int resourceNo, int flags) { +void SciGui32::paletteSet(int resourceNo, int flags) { //warning("STUB"); } -int16 SciGUI32::paletteFind(int r, int g, int b) { +int16 SciGui32::paletteFind(int r, int g, int b) { int i, delta, bestindex = -1, bestdelta = 200000; for (i = 0; i < s->gfx_state->gfxResMan->getColorCount(); i++) { @@ -708,17 +708,17 @@ int16 SciGUI32::paletteFind(int r, int g, int b) { return bestindex; } -void SciGUI32::paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette) { +void SciGui32::paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette) { #if 0 s->gfx_state->gfxResMan->setPaletteIntensity(fromColor, toColor, intensity); #endif } -void SciGUI32::paletteAnimate(int fromColor, int toColor, int speed) { +void SciGui32::paletteAnimate(int fromColor, int toColor, int speed) { warning("STUB"); } -int16 SciGUI32::onControl(byte screenMask, Common::Rect rect) { +int16 SciGui32::onControl(byte screenMask, Common::Rect rect) { gfx_map_mask_t map = (gfx_map_mask_t)screenMask; rect_t gfxrect = gfx_rect(rect.left, rect.top + 10, rect.width(), rect.height()); @@ -831,7 +831,7 @@ Common::Rect get_nsrect32(EngineState *s, reg_t object, byte clip) { return retval; } -GfxDynView *SciGUI32::_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv) { +GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; short oldloop, oldcel; int cel, loop, view_nr = (int16)GET_SEL32V(obj, view); @@ -909,7 +909,7 @@ GfxDynView *SciGUI32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar } } -void SciGUI32::_k_make_view_list(GfxList **widget_list, List *list, int options, int argc, reg_t *argv) { +void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options, int argc, reg_t *argv) { /* Creates a view_list from a node list in heap space. Returns the list, stores the ** number of list entries in *list_nr. Calls doit for each entry if cycle is set. ** argc, argv should be the same as in the calling kernel function. @@ -975,7 +975,7 @@ void SciGUI32::_k_make_view_list(GfxList **widget_list, List *list, int options, } } -void SciGUI32::draw_rect_to_control_map(Common::Rect abs_zone) { +void SciGui32::draw_rect_to_control_map(Common::Rect abs_zone) { GfxBox *box; gfx_color_t color; @@ -991,7 +991,7 @@ void SciGUI32::draw_rect_to_control_map(Common::Rect abs_zone) { ADD_TO_CURRENT_PICTURE_PORT(box); } -void SciGUI32::draw_obj_to_control_map(GfxDynView *view) { +void SciGui32::draw_obj_to_control_map(GfxDynView *view) { reg_t obj = make_reg(view->_ID, view->_subID); if (!s->_segMan->isObject(obj)) @@ -1004,7 +1004,7 @@ void SciGUI32::draw_obj_to_control_map(GfxDynView *view) { } } -int SciGUI32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc, reg_t *argv) { +int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc, reg_t *argv) { // disposes all list members flagged for disposal // returns non-zero IFF views were dropped int signal; @@ -1091,7 +1091,7 @@ int SciGUI32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc return dropped; } -void SciGUI32::_k_set_now_seen(reg_t object) { +void SciGui32::_k_set_now_seen(reg_t object) { SegManager *segMan = s->_segMan; Common::Rect absrect = get_nsrect32(s, object, 0); @@ -1105,7 +1105,7 @@ void SciGUI32::_k_set_now_seen(reg_t object) { PUT_SEL32V(object, nsBottom, absrect.bottom); } -void SciGUI32::_k_prepare_view_list(GfxList *list, int options) { +void SciGui32::_k_prepare_view_list(GfxList *list, int options) { SegManager *segMan = s->_segMan; GfxDynView *view = (GfxDynView *) list->_contents; while (view) { @@ -1190,7 +1190,7 @@ void SciGUI32::_k_prepare_view_list(GfxList *list, int options) { } } -void SciGUI32::_k_update_signals_in_view_list(GfxList *old_list, GfxList *new_list) { +void SciGui32::_k_update_signals_in_view_list(GfxList *old_list, GfxList *new_list) { // O(n^2)... a bit painful, but much faster than the redraws it helps prevent GfxDynView *old_widget = (GfxDynView *)old_list->_contents; @@ -1229,14 +1229,14 @@ void SciGUI32::_k_update_signals_in_view_list(GfxList *old_list, GfxList *new_li } } -void SciGUI32::_k_view_list_kryptonize(GfxWidget *v) { +void SciGui32::_k_view_list_kryptonize(GfxWidget *v) { if (v) { v->_flags &= ~GFXW_FLAG_IMMUNE_TO_SNAPSHOTS; _k_view_list_kryptonize(v->_next); } } -void SciGUI32::_k_raise_topmost_in_view_list(GfxList *list, GfxDynView *view) { +void SciGui32::_k_raise_topmost_in_view_list(GfxList *list, GfxDynView *view) { if (view) { GfxDynView *next = (GfxDynView *)view->_next; @@ -1263,7 +1263,7 @@ void SciGUI32::_k_raise_topmost_in_view_list(GfxList *list, GfxDynView *view) { } } -void SciGUI32::_k_redraw_view_list(GfxList *list) { +void SciGui32::_k_redraw_view_list(GfxList *list) { GfxDynView *view = (GfxDynView *) list->_contents; while (view) { @@ -1314,7 +1314,7 @@ void SciGUI32::_k_redraw_view_list(GfxList *list) { // Draw as picviews #define _K_DRAW_VIEW_LIST_PICVIEW 8 -void SciGUI32::_k_draw_view_list(GfxList *list, int flags) { +void SciGui32::_k_draw_view_list(GfxList *list, int flags) { // Draws list_nr members of list to s->pic. GfxDynView *widget = (GfxDynView *) list->_contents; @@ -1357,7 +1357,7 @@ void SciGUI32::_k_draw_view_list(GfxList *list, int flags) { } // while (widget) } -void SciGUI32::_k_view_list_do_postdraw(GfxList *list) { +void SciGui32::_k_view_list_do_postdraw(GfxList *list) { SegManager *segMan = s->_segMan; GfxDynView *widget = (GfxDynView *) list->_contents; @@ -1444,7 +1444,7 @@ void SciGUI32::_k_view_list_do_postdraw(GfxList *list) { #define GRAPH_UPDATE_BOX(s, x, y, xl, yl) gfxop_draw_pixmap(s->gfx_state, newscreen, \ gfx_rect(x, (((y) < 10)? 10 : (y)) - 10, xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), Common::Point(x, ((y) < 10)? 10 : (y) )); -void SciGUI32::animate_do_animation(int argc, reg_t *argv) { +void SciGui32::animate_do_animation(int argc, reg_t *argv) { long animation_delay = 5; int i, remaining_checkers; int update_counter; @@ -1830,7 +1830,7 @@ void SciGUI32::animate_do_animation(int argc, reg_t *argv) { s->old_screen = NULL; } -void SciGUI32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { +void SciGui32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { // Animations are supposed to take a maximum of animation_delay milliseconds. List *cast_list = NULL; int open_animation = 0; @@ -1934,7 +1934,7 @@ void SciGUI32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { FULL_REDRAW(); } -void SciGUI32::addToPicList(reg_t listReference, int argc, reg_t *argv) { +void SciGui32::addToPicList(reg_t listReference, int argc, reg_t *argv) { List *list; GfxList *pic_views; @@ -1963,21 +1963,21 @@ void SciGUI32::addToPicList(reg_t listReference, int argc, reg_t *argv) { reparentize_primary_widget_lists(s, s->port); } -void SciGUI32::addToPicView(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { +void SciGui32::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { assert_primary_widget_lists(s); GfxWidget *widget; topPos++; // magic +1 - widget = gfxw_new_dyn_view(s->gfx_state, Common::Point(leftPos, topPos), 0, viewId, loopNo, cellNo, 0, priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0); + widget = gfxw_new_dyn_view(s->gfx_state, Common::Point(leftPos, topPos), 0, viewId, loopNo, celNo, 0, priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0); if (!widget) { - error("Attempt to single-add invalid picview (%d/%d/%d)", viewId, loopNo, cellNo); + error("Attempt to single-add invalid picview (%d/%d/%d)", viewId, loopNo, celNo); } else { widget->_ID = -1; if (control >= 0) { - Common::Rect abs_zone = nsrect_clip(s, topPos, calculate_nsrect(s, leftPos, topPos, viewId, loopNo, cellNo), priority); + Common::Rect abs_zone = nsrect_clip(s, topPos, calculate_nsrect(s, leftPos, topPos, viewId, loopNo, celNo), priority); draw_rect_to_control_map(abs_zone); } ADD_TO_CURRENT_PICTURE_PORT(gfxw_picviewize_dynview((GfxDynView *) widget)); @@ -1985,12 +1985,12 @@ void SciGUI32::addToPicView(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewC return; } -void SciGUI32::setNowSeen(reg_t objectReference) { +void SciGui32::setNowSeen(reg_t objectReference) { _k_set_now_seen(objectReference); } -void SciGUI32::moveCursor(int16 x, int16 y) { +void SciGui32::moveCursor(int16 x, int16 y) { Common::Point newPos; // newPos = s->gfx_state->pointer_pos; diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index 27334b0d83..d49fcfa503 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -30,10 +30,10 @@ namespace Sci { -class SciGUI32 : public SciGUI { +class SciGui32 : public SciGui { public: - SciGUI32(OSystem *system, EngineState *s); - ~SciGUI32(); + SciGui32(OSystem *system, EngineState *s); + ~SciGui32(); // FIXME: Don't store EngineState virtual void resetEngineState(EngineState *newState) { s = newState; } @@ -56,8 +56,8 @@ public: void textFonts(int argc, reg_t *argv); void textColors(int argc, reg_t *argv); - void drawPicture(GUIResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); - void drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); + void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); + void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse); @@ -76,7 +76,7 @@ public: int16 onControl(byte screenMask, Common::Rect rect); void animate(reg_t castListReference, bool cycle, int argc, reg_t *argv); void addToPicList(reg_t listReference, int argc, reg_t *argv); - void addToPicView(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, int16 leftPos, int16 topPos, int16 priority, int16 control); + void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control); void setNowSeen(reg_t objectReference); void moveCursor(int16 x, int16 y); diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 33124f50bb..f43f763cc0 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -155,9 +155,9 @@ Common::Error SciEngine::run() { GfxState gfx_state; _gamestate->gfx_state = &gfx_state; - // GUI change - //_gamestate->gui = new SciGUI(_system, _gamestate); // new - _gamestate->gui = new SciGUI32(_system, _gamestate); // old + // Gui change + //_gamestate->gui = new SciGui(_system, _gamestate); // new + _gamestate->gui = new SciGui32(_system, _gamestate); // old // Assign default values to the config manager, in case settings are missing ConfMan.registerDefault("dither_mode", "0"); |