diff options
-rw-r--r-- | engines/sci/gui/gui_picture.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gui/gui_picture.h | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 2 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.cpp | 24 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.h | 26 | ||||
-rw-r--r-- | engines/sci/gui/gui_windowmgr.cpp | 54 | ||||
-rw-r--r-- | engines/sci/gui/gui_windowmgr.h | 23 |
7 files changed, 72 insertions, 75 deletions
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp index f839a41024..fb12c5d6ed 100644 --- a/engines/sci/gui/gui_picture.cpp +++ b/engines/sci/gui/gui_picture.cpp @@ -32,7 +32,7 @@ namespace Sci { -SciGUIpicture::SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, sciResourceId resourceId) +SciGUIpicture::SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId) : _s(state), _gfx(gfx), _screen(screen), _resourceId(resourceId) { assert(resourceId != -1); initData(resourceId); @@ -41,14 +41,14 @@ SciGUIpicture::SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *s SciGUIpicture::~SciGUIpicture() { } -void SciGUIpicture::initData(sciResourceId resourceId) { +void SciGUIpicture::initData(GUIResourceId resourceId) { _resource = _s->resMan->findResource(ResourceId(kResourceTypePic, resourceId), false); if (!_resource) { error("picture resource %d not found", resourceId); } } -sciResourceId SciGUIpicture::getResourceId() { +GUIResourceId SciGUIpicture::getResourceId() { return _resourceId; } @@ -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; - sciPalette palette; + GUIPalette palette; // Create palette and set it _gfx->CreatePaletteFromData(inbuffer + palette_data_ptr, &palette); @@ -302,7 +302,7 @@ void SciGUIpicture::drawVectorData(byte *data, int dataSize) { uint16 size; byte byte; int i; - sciPalette palette; + GUIPalette palette; int16 pattern_Code = 0, pattern_Texture = 0; bool sci1 = false; diff --git a/engines/sci/gui/gui_picture.h b/engines/sci/gui/gui_picture.h index 14704372e1..42a8ee7d1e 100644 --- a/engines/sci/gui/gui_picture.h +++ b/engines/sci/gui/gui_picture.h @@ -32,14 +32,14 @@ namespace Sci { class SciGUIpicture { public: - SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, sciResourceId resourceId); + SciGUIpicture(EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId); ~SciGUIpicture(); - sciResourceId getResourceId(); + GUIResourceId getResourceId(); void draw(uint16 style, bool addToFlag, int16 EGApaletteNo); private: - void initData(sciResourceId resourceId); + void initData(GUIResourceId resourceId); void reset(); void draw11(); void decodeRLE(byte *rledata, byte *pixeldata, byte *outbuffer, int size); @@ -59,7 +59,7 @@ private: int16 _resourceId; Resource *_resource; - sciPort *_curPort; + GUIPort *_curPort; uint16 _style; bool _addToFlag; int16 _EGApaletteNo; diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h index 242948ed8f..e27759f5f9 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -54,7 +54,7 @@ public: void BitsSave(Common::Rect rect, byte mask, byte *memoryPtr); void BitsRestore(byte *memoryPtr); - sciPalette _sysPalette; + GUIPalette _sysPalette; uint16 _width; uint16 _height; diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index a656a1c9e9..60506089d0 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -32,7 +32,7 @@ namespace Sci { -SciGUIview::SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, sciResourceId 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); @@ -41,7 +41,7 @@ SciGUIview::SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciG SciGUIview::~SciGUIview() { } -void SciGUIview::initData(sciResourceId resourceId) { +void SciGUIview::initData(GUIResourceId resourceId) { Resource *viewResource = _s->resMan->findResource(ResourceId(kResourceTypeView, resourceId), false); if (!viewResource) { error("view resource %d not found", resourceId); @@ -162,37 +162,37 @@ void SciGUIview::initData(sciResourceId resourceId) { } } -sciResourceId SciGUIview::getResourceId() { +GUIResourceId SciGUIview::getResourceId() { return _resourceId; } -int16 SciGUIview::getWidth(uint16 loopNo, uint16 cellNo) { +int16 SciGUIview::getWidth(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); if (cellNo >= _loop[loopNo].cellCount) cellNo = 0; return _loopCount ? _loop[loopNo].cell[cellNo].width : 0; } -int16 SciGUIview::getHeight(uint16 loopNo, uint16 cellNo) { +int16 SciGUIview::getHeight(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); if (cellNo >= _loop[loopNo].cellCount) cellNo = 0; return _loopCount ? _loop[loopNo].cell[cellNo].height : 0; } -sciViewCellInfo *SciGUIview::getCellInfo(uint16 loopNo, uint16 cellNo) { +sciViewCellInfo *SciGUIview::getCellInfo(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); if (cellNo >= _loop[loopNo].cellCount) cellNo = 0; return _loopCount ? &_loop[loopNo].cell[cellNo] : NULL; } -sciViewLoopInfo *SciGUIview::getLoopInfo(uint16 loopNo) { +sciViewLoopInfo *SciGUIview::getLoopInfo(GUIViewLoopNo loopNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); return _loopCount ? &_loop[loopNo] : NULL; } -void SciGUIview::getCellRect(uint16 loopNo, uint16 cellNo, int16 x, int16 y, int16 z, Common::Rect *outRect) { +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); @@ -202,7 +202,7 @@ void SciGUIview::getCellRect(uint16 loopNo, uint16 cellNo, int16 x, int16 y, int } } -void SciGUIview::unpackView(uint16 loopNo, uint16 cellNo, byte *outPtr, uint16 pixelCount) { +void SciGUIview::unpackView(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *outPtr, uint16 pixelCount) { byte *rlePtr = _resourceData + _loop[loopNo].cell[cellNo].offsetRLE; byte *literalPtr = _resourceData + _loop[loopNo].cell[cellNo].offsetLiteral; uint16 pixelNo = 0, brun; @@ -247,7 +247,7 @@ void SciGUIview::unpackView(uint16 loopNo, uint16 cellNo, byte *outPtr, uint16 p } } -byte *SciGUIview::getBitmap(uint16 loopNo, uint16 cellNo) { +byte *SciGUIview::getBitmap(GUIViewLoopNo loopNo, GUIViewCellNo cellNo) { loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); if (cellNo >= _loop[loopNo].cellCount) cellNo = 0; @@ -277,8 +277,8 @@ byte *SciGUIview::getBitmap(uint16 loopNo, uint16 cellNo) { return _loop[loopNo].cell[cellNo].rawBitmap; } -void SciGUIview::draw(Common::Rect rect, Common::Rect clipRect, uint16 loopNo, uint16 cellNo, byte priority, uint16 paletteNo) { - sciPalette *palette = _embeddedPal ? &_palette : &_gfx->_sysPalette; +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; diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h index c89ab000f9..22797fd180 100644 --- a/engines/sci/gui/gui_view.h +++ b/engines/sci/gui/gui_view.h @@ -43,36 +43,36 @@ struct sciViewLoopInfo { class SciGUIview { public: - SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, sciResourceId resourceId); + SciGUIview(OSystem *system, EngineState *state, SciGUIgfx *gfx, SciGUIscreen *screen, GUIResourceId resourceId); ~SciGUIview(); // TODO: Remove gfx reference after putting palette things into SciGUIscreen - sciResourceId getResourceId(); - int16 getWidth(uint16 loopNo, uint16 cellNo); - int16 getHeight(uint16 loopNo, uint16 cellNo); - sciViewCellInfo *getCellInfo(uint16 loopNo, uint16 cellNo); - sciViewLoopInfo *getLoopInfo(uint16 loopNo); - void getCellRect(uint16 loopNo, uint16 cellNo, int16 x, int16 y, int16 z, Common::Rect *outRect); - byte *getBitmap(uint16 loopNo, uint16 cellNo); - void draw(Common::Rect rect, Common::Rect clipRect, uint16 loopNo, uint16 cellNo, byte priority, uint16 paletteNo); + 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); private: - void initData(sciResourceId resourceId); - void unpackView(uint16 loopNo, uint16 cellNo, byte *outPtr, uint16 pixelCount); + void initData(GUIResourceId resourceId); + void unpackView(GUIViewLoopNo loopNo, GUIViewCellNo cellNo, byte *outPtr, uint16 pixelCount); OSystem *_system; EngineState *_s; SciGUIgfx *_gfx; SciGUIscreen *_screen; - sciResourceId _resourceId; + GUIResourceId _resourceId; byte *_resourceData; uint16 _loopCount; sciViewLoopInfo *_loop; bool _embeddedPal; - sciPalette _palette; + GUIPalette _palette; }; } // end of namespace Sci diff --git a/engines/sci/gui/gui_windowmgr.cpp b/engines/sci/gui/gui_windowmgr.cpp index 8a71ecbae7..e3ea6452cb 100644 --- a/engines/sci/gui/gui_windowmgr.cpp +++ b/engines/sci/gui/gui_windowmgr.cpp @@ -53,9 +53,9 @@ SciGUIwindowMgr::SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx) // FIXME: remove memmgr InitMem(0x320); - HEAPHANDLE wmgrPortH = heapNewPtr(sizeof(sciPort), kDataPort, "wmgrPort"); + HEAPHANDLE wmgrPortH = heapNewPtr(sizeof(GUIPort), kDataPort, "wmgrPort"); heapClearPtr(wmgrPortH); - _wmgrPort = (sciPort *)heap2Ptr(wmgrPortH); + _wmgrPort = (GUIPort *)heap2Ptr(wmgrPortH); int16 offTop = 20; @@ -76,17 +76,17 @@ SciGUIwindowMgr::SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx) SciGUIwindowMgr::~SciGUIwindowMgr() { } -int16 SciGUIwindowMgr::isFrontWindow(sciWnd *pWnd) { +int16 SciGUIwindowMgr::isFrontWindow(GUIWindow *pWnd) { if (heap2Ptr(windowList.getLast()) == (byte *)pWnd) return 1; return 0; } void SciGUIwindowMgr::SelectWindow(HEAPHANDLE hh) { - sciPort *port = (sciPort *)heap2Ptr(hh); + GUIPort *port = (GUIPort *)heap2Ptr(hh); _gfx->SetPort(port); if (hh != windowList.getLast()) { // selecting not topmost window - sciWnd *prevwnd = (sciWnd *)heap2Ptr(port->node.prev); + GUIWindow *prevwnd = (GUIWindow *)heap2Ptr(port->node.prev); BeginUpdate(prevwnd); windowList.MoveToEnd(hh); EndUpdate(prevwnd); @@ -94,28 +94,28 @@ void SciGUIwindowMgr::SelectWindow(HEAPHANDLE hh) { _gfx->SetPort(port); } -void SciGUIwindowMgr::BeginUpdate(sciWnd *wnd) { - sciPort *oldPort = _gfx->SetPort(_wmgrPort); - sciWnd *node = (sciWnd *)heap2Ptr(windowList.getLast()); +void SciGUIwindowMgr::BeginUpdate(GUIWindow *wnd) { + GUIPort *oldPort = _gfx->SetPort(_wmgrPort); + GUIWindow *node = (GUIWindow *)heap2Ptr(windowList.getLast()); while (node != wnd) { UpdateWindow(node); - node = (sciWnd *)heap2Ptr(node->node.prev); + node = (GUIWindow *)heap2Ptr(node->node.prev); } _gfx->SetPort(oldPort); } -void SciGUIwindowMgr::EndUpdate(sciWnd *wnd) { - sciPort *oldPort = _gfx->SetPort(_wmgrPort); - sciWnd *last = (sciWnd *)heap2Ptr(windowList.getLast()); +void SciGUIwindowMgr::EndUpdate(GUIWindow *wnd) { + GUIPort *oldPort = _gfx->SetPort(_wmgrPort); + GUIWindow *last = (GUIWindow *)heap2Ptr(windowList.getLast()); while (wnd != last) { - wnd = (sciWnd *)heap2Ptr(wnd->node.next); + wnd = (GUIWindow *)heap2Ptr(wnd->node.next); UpdateWindow(wnd); } _gfx->SetPort(oldPort); } -sciWnd *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA) { - HEAPHANDLE hWnd = heapNewPtr(sizeof(sciWnd), kDataWindow, title); +GUIWindow *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA) { + HEAPHANDLE hWnd = heapNewPtr(sizeof(GUIWindow), kDataWindow, title); Common::Rect r; if (!hWnd) { @@ -127,8 +127,8 @@ sciWnd *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect windowList.AddToFront(hWnd); else windowList.AddToEnd(hWnd); - sciWnd *pwnd = (sciWnd *)heap2Ptr(hWnd); - _gfx->OpenPort((sciPort *)pwnd); + GUIWindow *pwnd = (GUIWindow *)heap2Ptr(hWnd); + _gfx->OpenPort((GUIPort *)pwnd); r = dims; pwnd->rect = dims; if (restoreRect) @@ -136,7 +136,7 @@ sciWnd *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect pwnd->wndStyle = style; pwnd->hSaved1 = pwnd->hSaved2 = NULL_REG; - pwnd->bDrawed = false; + pwnd->bDrawn = false; if ((style & kTransparent) == 0) pwnd->uSaveFlag = (arg8 == 0xFFFF ? 1 : 3); @@ -184,20 +184,20 @@ sciWnd *SciGUIwindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect if (argA) DrawWindow(pwnd); - _gfx->SetPort((sciPort *)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(sciWnd *pWnd) { - if (pWnd->bDrawed) +void SciGUIwindowMgr::DrawWindow(GUIWindow *pWnd) { + if (pWnd->bDrawn) return; Common::Rect r; int16 wndStyle = pWnd->wndStyle; - pWnd->bDrawed = true; - sciPort *oldport = _gfx->SetPort(_wmgrPort); + pWnd->bDrawn = true; + GUIPort *oldport = _gfx->SetPort(_wmgrPort); _gfx->PenColor(0); if ((wndStyle & kTransparent) == 0) { pWnd->hSaved1 = _gfx->SaveBits(pWnd->restoreRect, 1); @@ -241,7 +241,7 @@ void SciGUIwindowMgr::DrawWindow(sciWnd *pWnd) { _gfx->SetPort(oldport); } -void SciGUIwindowMgr::DisposeWindow(sciWnd *pWnd, int16 arg2) { +void SciGUIwindowMgr::DisposeWindow(GUIWindow *pWnd, int16 arg2) { _gfx->SetPort(_wmgrPort); _gfx->RestoreBits(pWnd->hSaved1); _gfx->RestoreBits(pWnd->hSaved2); @@ -257,10 +257,10 @@ void SciGUIwindowMgr::DisposeWindow(sciWnd *pWnd, int16 arg2) { heapDisposePtr(hh); } -void SciGUIwindowMgr::UpdateWindow(sciWnd *wnd) { - sciMemoryHandle handle; +void SciGUIwindowMgr::UpdateWindow(GUIWindow *wnd) { + GUIMemoryHandle handle; - if (wnd->uSaveFlag && wnd->bDrawed) { + if (wnd->uSaveFlag && wnd->bDrawn) { handle = _gfx->SaveBits(wnd->restoreRect, 1); _gfx->RestoreBits(wnd->hSaved1); wnd->hSaved1 = handle; diff --git a/engines/sci/gui/gui_windowmgr.h b/engines/sci/gui/gui_windowmgr.h index b0d46cf31f..58db720663 100644 --- a/engines/sci/gui/gui_windowmgr.h +++ b/engines/sci/gui/gui_windowmgr.h @@ -32,20 +32,17 @@ public: SciGUIwindowMgr(EngineState *state, SciGUIgfx *gfx); ~SciGUIwindowMgr(); - int16 isFrontWindow(sciWnd *wnd); + int16 isFrontWindow(GUIWindow *wnd); void SelectWindow(HEAPHANDLE hh); - void BeginUpdate(sciWnd *wnd); - void EndUpdate(sciWnd *wnd); - SCILanguage getSCILanguage(); - char* StrSplit(char*buff, const char*msg, const char*fmt); - char* getIntlString(char*buff, const char*msg, const char*fmt, SCILanguage lang, SCILanguage prop); - sciWnd *NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, uint16 arg8, uint16 argA); - void DrawWindow(sciWnd *wnd); - void DisposeWindow(sciWnd *pWnd, int16 arg2); - void UpdateWindow(sciWnd *wnd); - - sciPort *_wmgrPort; - sciWnd *_picWind; + 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 *_wmgrPort; + GUIWindow *_picWind; private: EngineState *_s; |