More renaming

svn-id: r47009
This commit is contained in:
Filippos Karapetis 2010-01-05 01:37:57 +00:00
parent 2f1a909696
commit d99aa0f126
42 changed files with 616 additions and 616 deletions

View file

@ -44,7 +44,7 @@
#include "sci/sound/softseq/mididriver.h" #include "sci/sound/softseq/mididriver.h"
#include "sci/vocabulary.h" #include "sci/vocabulary.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
#include "graphics/video/avi_decoder.h" #include "graphics/video/avi_decoder.h"
#include "sci/video/seq_decoder.h" #include "sci/video/seq_decoder.h"

View file

@ -709,7 +709,7 @@ void kernel_sleep(SciEvent *event, uint32 msecs ) {
while (true) { while (true) {
// let backend process events and update the screen // let backend process events and update the screen
event->get(SCI_EVENT_PEEK); event->get(SCI_EVENT_PEEK);
// TODO: we need to call SciGuiCursor::refreshPosition() before each screen update to limit the mouse cursor position // TODO: we need to call Cursor::refreshPosition() before each screen update to limit the mouse cursor position
g_system->updateScreen(); g_system->updateScreen();
time = g_system->getMillis(); time = g_system->getMillis();
if (time + 10 < wakeup_time) { if (time + 10 < wakeup_time) {

View file

@ -30,7 +30,7 @@
#include "sci/debug.h" // for g_debug_simulated_key #include "sci/debug.h" // for g_debug_simulated_key
#include "sci/event.h" #include "sci/event.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
namespace Sci { namespace Sci {

View file

@ -34,10 +34,10 @@
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/engine/kernel.h" #include "sci/engine/kernel.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
namespace Sci { namespace Sci {
@ -701,12 +701,12 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
reg_t textReference = GET_SEL32(s->_segMan, controlObject, text); reg_t textReference = GET_SEL32(s->_segMan, controlObject, text);
Common::String text; Common::String text;
Common::Rect rect; Common::Rect rect;
GuiTextAlignment alignment; TextAlignment alignment;
int16 mode, maxChars, cursorPos, upperPos, listCount, i; int16 mode, maxChars, cursorPos, upperPos, listCount, i;
int16 upperOffset, cursorOffset; int16 upperOffset, cursorOffset;
GuiResourceId viewId; GuiResourceId viewId;
GuiViewLoopNo loopNo; LoopNo loopNo;
GuiViewCelNo celNo; CelNo celNo;
reg_t listSeeker; reg_t listSeeker;
Common::String *listStrings = NULL; Common::String *listStrings = NULL;
const char **listEntries = NULL; const char **listEntries = NULL;
@ -842,8 +842,8 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) { reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
GuiResourceId viewId; GuiResourceId viewId;
GuiViewLoopNo loopNo; LoopNo loopNo;
GuiViewCelNo celNo; CelNo celNo;
int16 leftPos, topPos, priority, control; int16 leftPos, topPos, priority, control;
switch (argc) { switch (argc) {
@ -909,8 +909,8 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) {
GuiResourceId viewId = argv[0].toSint16(); GuiResourceId viewId = argv[0].toSint16();
GuiViewLoopNo loopNo = argv[1].toSint16(); LoopNo loopNo = argv[1].toSint16();
GuiViewCelNo celNo = argv[2].toSint16(); CelNo celNo = argv[2].toSint16();
uint16 x = argv[3].toUint16(); uint16 x = argv[3].toUint16();
uint16 y = argv[4].toUint16(); uint16 y = argv[4].toUint16();
int16 priority = (argc > 5) ? argv[5].toSint16() : -1; int16 priority = (argc > 5) ? argv[5].toSint16() : -1;

View file

@ -28,7 +28,7 @@
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/engine/kernel.h" #include "sci/engine/kernel.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
namespace Sci { namespace Sci {

View file

@ -27,7 +27,7 @@
#include "sci/resource.h" #include "sci/resource.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/engine/kernel.h" #include "sci/engine/kernel.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
namespace Sci { namespace Sci {

View file

@ -52,7 +52,7 @@ namespace Sci {
class SciEvent; class SciEvent;
class Menubar; class Menubar;
class SciGui; class SciGui;
class SciGuiCursor; class Cursor;
class MessageState; class MessageState;
class SoundCommandParser; class SoundCommandParser;

View file

@ -329,7 +329,7 @@ sciEvent SciEvent::get(unsigned int mask) {
//sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; //sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 };
sciEvent event = { 0, 0, 0, 0 }; sciEvent event = { 0, 0, 0, 0 };
// TODO: we need to call SciGuiCursor::refreshPosition() before each screen update to limit the mouse cursor position // TODO: we need to call Cursor::refreshPosition() before each screen update to limit the mouse cursor position
// Update the screen here, since it's called very often // Update the screen here, since it's called very often
g_system->updateScreen(); g_system->updateScreen();

View file

@ -30,15 +30,15 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/engine/vm.h" #include "sci/engine/vm.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_transitions.h" #include "sci/graphics/transitions.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
namespace Sci { namespace Sci {
SciGuiAnimate::SciGuiAnimate(EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, SciGuiPalette *palette) SciGuiAnimate::SciGuiAnimate(EngineState *state, Gfx *gfx, Screen *screen, SciPalette *palette)
: _s(state), _gfx(gfx), _screen(screen), _palette(palette) { : _s(state), _gfx(gfx), _screen(screen), _palette(palette) {
init(); init();
} }
@ -101,7 +101,7 @@ bool SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
return true; return true;
} }
bool sortHelper(const GuiAnimateEntry* entry1, const GuiAnimateEntry* entry2) { bool sortHelper(const AnimateEntry* entry1, const AnimateEntry* entry2) {
return (entry1->y == entry2->y) ? (entry1->z < entry2->z) : (entry1->y < entry2->y); return (entry1->y == entry2->y) ? (entry1->z < entry2->z) : (entry1->y < entry2->y);
} }
@ -109,7 +109,7 @@ void SciGuiAnimate::makeSortedList(List *list) {
reg_t curAddress = list->first; reg_t curAddress = list->first;
Node *curNode = _s->_segMan->lookupNode(curAddress); Node *curNode = _s->_segMan->lookupNode(curAddress);
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
int16 listNr, listCount = 0; int16 listNr, listCount = 0;
// Count the list entries // Count the list entries
@ -128,13 +128,13 @@ void SciGuiAnimate::makeSortedList(List *list) {
// Adjust list size, if needed // Adjust list size, if needed
if ((_listData == NULL) || (_listCount < listCount)) { if ((_listData == NULL) || (_listCount < listCount)) {
free(_listData); free(_listData);
_listData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry)); _listData = (AnimateEntry *)malloc(listCount * sizeof(AnimateEntry));
if (!_listData) if (!_listData)
error("Could not allocate memory for _listData"); error("Could not allocate memory for _listData");
_listCount = listCount; _listCount = listCount;
free(_lastCastData); free(_lastCastData);
_lastCastData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry)); _lastCastData = (AnimateEntry *)malloc(listCount * sizeof(AnimateEntry));
if (!_lastCastData) if (!_lastCastData)
error("Could not allocate memory for _lastCastData"); error("Could not allocate memory for _lastCastData");
_lastCastCount = 0; _lastCastCount = 0;
@ -169,19 +169,19 @@ void SciGuiAnimate::makeSortedList(List *list) {
} }
// Now sort the list according y and z (descending) // Now sort the list according y and z (descending)
GuiAnimateList::iterator listBegin = _list.begin(); AnimateList::iterator listBegin = _list.begin();
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
Common::sort(_list.begin(), _list.end(), sortHelper); Common::sort(_list.begin(), _list.end(), sortHelper);
} }
void SciGuiAnimate::fill(byte &old_picNotValid) { void SciGuiAnimate::fill(byte &old_picNotValid) {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
uint16 signal; uint16 signal;
SciGuiView *view = NULL; View *view = NULL;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
listIterator = _list.begin(); listIterator = _list.begin();
while (listIterator != listEnd) { while (listIterator != listEnd) {
@ -236,13 +236,13 @@ void SciGuiAnimate::fill(byte &old_picNotValid) {
void SciGuiAnimate::update() { void SciGuiAnimate::update() {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
uint16 signal; uint16 signal;
reg_t bitsHandle; reg_t bitsHandle;
Common::Rect rect; Common::Rect rect;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listBegin = _list.begin(); AnimateList::iterator listBegin = _list.begin();
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
// Remove all no-update cels, if requested // Remove all no-update cels, if requested
listIterator = _list.reverse_begin(); listIterator = _list.reverse_begin();
@ -341,12 +341,12 @@ void SciGuiAnimate::update() {
void SciGuiAnimate::drawCels() { void SciGuiAnimate::drawCels() {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
GuiAnimateEntry *lastCastEntry = _lastCastData; AnimateEntry *lastCastEntry = _lastCastData;
uint16 signal; uint16 signal;
reg_t bitsHandle; reg_t bitsHandle;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
_lastCastCount = 0; _lastCastCount = 0;
@ -371,7 +371,7 @@ void SciGuiAnimate::drawCels() {
listEntry->signal = signal; listEntry->signal = signal;
// Remember that entry in lastCast // Remember that entry in lastCast
memcpy(lastCastEntry, listEntry, sizeof(GuiAnimateEntry)); memcpy(lastCastEntry, listEntry, sizeof(AnimateEntry));
lastCastEntry++; _lastCastCount++; lastCastEntry++; _lastCastCount++;
} }
listIterator++; listIterator++;
@ -380,10 +380,10 @@ void SciGuiAnimate::drawCels() {
void SciGuiAnimate::updateScreen(byte oldPicNotValid) { void SciGuiAnimate::updateScreen(byte oldPicNotValid) {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
uint16 signal; uint16 signal;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
Common::Rect lsRect; Common::Rect lsRect;
Common::Rect workerRect; Common::Rect workerRect;
@ -429,10 +429,10 @@ void SciGuiAnimate::updateScreen(byte oldPicNotValid) {
void SciGuiAnimate::restoreAndDelete(int argc, reg_t *argv) { void SciGuiAnimate::restoreAndDelete(int argc, reg_t *argv) {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
uint16 signal; uint16 signal;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
// This has to be done in a separate loop. At least in sq1 some .dispose modifies FIXEDLOOP flag in signal for // This has to be done in a separate loop. At least in sq1 some .dispose modifies FIXEDLOOP flag in signal for
@ -469,7 +469,7 @@ void SciGuiAnimate::restoreAndDelete(int argc, reg_t *argv) {
} }
void SciGuiAnimate::reAnimate(Common::Rect rect) { void SciGuiAnimate::reAnimate(Common::Rect rect) {
GuiAnimateEntry *lastCastEntry; AnimateEntry *lastCastEntry;
uint16 lastCastCount; uint16 lastCastCount;
if (_lastCastCount > 0) { if (_lastCastCount > 0) {
@ -517,10 +517,10 @@ void SciGuiAnimate::reAnimate(Common::Rect rect) {
void SciGuiAnimate::addToPicDrawCels() { void SciGuiAnimate::addToPicDrawCels() {
reg_t curObject; reg_t curObject;
GuiAnimateEntry *listEntry; AnimateEntry *listEntry;
SciGuiView *view = NULL; View *view = NULL;
GuiAnimateList::iterator listIterator; AnimateList::iterator listIterator;
GuiAnimateList::iterator listEnd = _list.end(); AnimateList::iterator listEnd = _list.end();
listIterator = _list.begin(); listIterator = _list.begin();
while (listIterator != listEnd) { while (listIterator != listEnd) {
@ -547,8 +547,8 @@ void SciGuiAnimate::addToPicDrawCels() {
} }
} }
void SciGuiAnimate::addToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { void SciGuiAnimate::addToPicDrawView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
SciGuiView *view = _gfx->getView(viewId); View *view = _gfx->getView(viewId);
Common::Rect celRect; Common::Rect celRect;
// Create rect according to coordinates and given cel // Create rect according to coordinates and given cel

View file

@ -23,10 +23,10 @@
* *
*/ */
#ifndef SCI_GUI_ANIMATE_H #ifndef SCI_GRAPHICS_ANIMATE_H
#define SCI_GUI_ANIMATE_H #define SCI_GRAPHICS_ANIMATE_H
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
@ -52,13 +52,13 @@ enum ViewSignals {
kSignalStopUpdHack = 0x20000000 // View has been stop-updated (again???) - a hack used by the old GUI code only, for dynamic views kSignalStopUpdHack = 0x20000000 // View has been stop-updated (again???) - a hack used by the old GUI code only, for dynamic views
}; };
class SciGuiGfx; class Gfx;
class SciGuiScreen; class Screen;
class SciGuiPalette; class SciPalette;
class SciGuiTransitions; class Transitions;
class SciGuiAnimate { class SciGuiAnimate {
public: public:
SciGuiAnimate(EngineState *state, SciGuiGfx *gfx, SciGuiScreen *screen, SciGuiPalette *palette); SciGuiAnimate(EngineState *state, Gfx *gfx, Screen *screen, SciPalette *palette);
~SciGuiAnimate(); ~SciGuiAnimate();
// FIXME: Don't store EngineState // FIXME: Don't store EngineState
@ -74,22 +74,22 @@ public:
void restoreAndDelete(int argc, reg_t *argv); void restoreAndDelete(int argc, reg_t *argv);
void reAnimate(Common::Rect rect); void reAnimate(Common::Rect rect);
void addToPicDrawCels(); void addToPicDrawCels();
void addToPicDrawView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control); void addToPicDrawView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
private: private:
void init(); void init();
EngineState *_s; EngineState *_s;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
uint16 _listCount; uint16 _listCount;
GuiAnimateEntry *_listData; AnimateEntry *_listData;
GuiAnimateList _list; AnimateList _list;
uint16 _lastCastCount; uint16 _lastCastCount;
GuiAnimateEntry *_lastCastData; AnimateEntry *_lastCastData;
bool _ignoreFastCast; bool _ignoreFastCast;
}; };

View file

@ -30,14 +30,14 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/event.h" #include "sci/event.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_font.h" #include "sci/graphics/font.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
#include "sci/graphics/gui_controls.h" #include "sci/graphics/controls.h"
namespace Sci { namespace Sci {
SciGuiControls::SciGuiControls(SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text) SciGuiControls::SciGuiControls(SegManager *segMan, Gfx *gfx, Text *text)
: _segMan(segMan), _gfx(gfx), _text(text) { : _segMan(segMan), _gfx(gfx), _text(text) {
init(); init();
} }

View file

@ -23,17 +23,17 @@
* *
*/ */
#ifndef SCI_GUI_CONTROLS_H #ifndef SCI_GRAPHICS_CONTROLS_H
#define SCI_GUI_CONTROLS_H #define SCI_GRAPHICS_CONTROLS_H
namespace Sci { namespace Sci {
class SciGuiGfx; class Gfx;
class SciGuiFont; class Font;
class SciGuiText; class Text;
class SciGuiControls { class SciGuiControls {
public: public:
SciGuiControls(SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text); SciGuiControls(SegManager *segMan, Gfx *gfx, Text *text);
~SciGuiControls(); ~SciGuiControls();
void drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias); void drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias);
@ -46,8 +46,8 @@ private:
void TexteditSetBlinkTime(); void TexteditSetBlinkTime();
SegManager *_segMan; SegManager *_segMan;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiText *_text; Text *_text;
// Textedit-Control related // Textedit-Control related
Common::Rect _texteditCursorRect; Common::Rect _texteditCursorRect;

View file

@ -29,14 +29,14 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
namespace Sci { namespace Sci {
SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen) Cursor::Cursor(ResourceManager *resMan, SciPalette *palette, Screen *screen)
: _resMan(resMan), _palette(palette), _screen(screen) { : _resMan(resMan), _palette(palette), _screen(screen) {
_upscaledHires = _screen->getUpscaledHires(); _upscaledHires = _screen->getUpscaledHires();
@ -47,25 +47,25 @@ SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciG
_isVisible = true; _isVisible = true;
} }
SciGuiCursor::~SciGuiCursor() { Cursor::~Cursor() {
purgeCache(); purgeCache();
} }
void SciGuiCursor::show() { void Cursor::show() {
CursorMan.showMouse(true); CursorMan.showMouse(true);
_isVisible = true; _isVisible = true;
} }
void SciGuiCursor::hide() { void Cursor::hide() {
CursorMan.showMouse(false); CursorMan.showMouse(false);
_isVisible = false; _isVisible = false;
} }
bool SciGuiCursor::isVisible() { bool Cursor::isVisible() {
return _isVisible; return _isVisible;
} }
void SciGuiCursor::purgeCache() { void Cursor::purgeCache() {
for (CursorCache::iterator iter = _cachedCursors.begin(); iter != _cachedCursors.end(); ++iter) { for (CursorCache::iterator iter = _cachedCursors.begin(); iter != _cachedCursors.end(); ++iter) {
delete iter->_value; delete iter->_value;
iter->_value = 0; iter->_value = 0;
@ -74,7 +74,7 @@ void SciGuiCursor::purgeCache() {
_cachedCursors.clear(); _cachedCursors.clear();
} }
void SciGuiCursor::setShape(GuiResourceId resourceId) { void Cursor::setShape(GuiResourceId resourceId) {
Resource *resource; Resource *resource;
byte *resourceData; byte *resourceData;
Common::Point hotspot = Common::Point(0, 0); Common::Point hotspot = Common::Point(0, 0);
@ -133,16 +133,16 @@ void SciGuiCursor::setShape(GuiResourceId resourceId) {
delete[] rawBitmap; delete[] rawBitmap;
} }
void SciGuiCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) { void Cursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) {
if (_cachedCursors.size() >= MAX_CACHED_CURSORS) if (_cachedCursors.size() >= MAX_CACHED_CURSORS)
purgeCache(); purgeCache();
if (!_cachedCursors.contains(viewNum)) if (!_cachedCursors.contains(viewNum))
_cachedCursors[viewNum] = new SciGuiView(_resMan, _screen, _palette, viewNum); _cachedCursors[viewNum] = new View(_resMan, _screen, _palette, viewNum);
SciGuiView *cursorView = _cachedCursors[viewNum]; View *cursorView = _cachedCursors[viewNum];
sciViewCelInfo *celInfo = cursorView->getCelInfo(loopNum, celNum); CelInfo *celInfo = cursorView->getCelInfo(loopNum, celNum);
int16 width = celInfo->width; int16 width = celInfo->width;
int16 height = celInfo->height; int16 height = celInfo->height;
byte clearKey = celInfo->clearKey; byte clearKey = celInfo->clearKey;
@ -180,7 +180,7 @@ void SciGuiCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Commo
delete cursorHotspot; delete cursorHotspot;
} }
void SciGuiCursor::setPosition(Common::Point pos) { void Cursor::setPosition(Common::Point pos) {
if (!_upscaledHires) { if (!_upscaledHires) {
g_system->warpMouse(pos.x, pos.y); g_system->warpMouse(pos.x, pos.y);
} else { } else {
@ -188,7 +188,7 @@ void SciGuiCursor::setPosition(Common::Point pos) {
} }
} }
Common::Point SciGuiCursor::getPosition() { Common::Point Cursor::getPosition() {
Common::Point mousePos = g_system->getEventManager()->getMousePos(); Common::Point mousePos = g_system->getEventManager()->getMousePos();
if (_upscaledHires) { if (_upscaledHires) {
@ -199,7 +199,7 @@ Common::Point SciGuiCursor::getPosition() {
return mousePos; return mousePos;
} }
void SciGuiCursor::refreshPosition() { void Cursor::refreshPosition() {
bool clipped = false; bool clipped = false;
Common::Point mousePoint = getPosition(); Common::Point mousePoint = getPosition();

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_CURSOR_H #ifndef SCI_GRAPHICS_CURSOR_H
#define SCI_GUI_CURSOR_H #define SCI_GRAPHICS_CURSOR_H
#include "common/hashmap.h" #include "common/hashmap.h"
@ -37,15 +37,15 @@ namespace Sci {
#define MAX_CACHED_CURSORS 10 #define MAX_CACHED_CURSORS 10
class SciGuiView; class View;
class SciGuiPalette; class SciPalette;
typedef Common::HashMap<int, SciGuiView *> CursorCache; typedef Common::HashMap<int, View *> CursorCache;
class SciGuiCursor { class Cursor {
public: public:
SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen); Cursor(ResourceManager *resMan, SciPalette *palette, Screen *screen);
~SciGuiCursor(); ~Cursor();
void show(); void show();
void hide(); void hide();
@ -67,8 +67,8 @@ private:
void purgeCache(); void purgeCache();
ResourceManager *_resMan; ResourceManager *_resMan;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
bool _upscaledHires; bool _upscaledHires;

View file

@ -25,12 +25,12 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_font.h" #include "sci/graphics/font.h"
namespace Sci { namespace Sci {
SciGuiFont::SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId) Font::Font(ResourceManager *resMan, GuiResourceId resourceId)
: _resourceId(resourceId), _resMan(resMan) { : _resourceId(resourceId), _resMan(resMan) {
assert(resourceId != -1); assert(resourceId != -1);
@ -56,29 +56,29 @@ SciGuiFont::SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId)
} }
} }
SciGuiFont::~SciGuiFont() { Font::~Font() {
delete []_chars; delete []_chars;
_resMan->unlockResource(_resource); _resMan->unlockResource(_resource);
} }
GuiResourceId SciGuiFont::getResourceId() { GuiResourceId Font::getResourceId() {
return _resourceId; return _resourceId;
} }
byte SciGuiFont::getHeight() { byte Font::getHeight() {
return _fontHeight; return _fontHeight;
} }
byte SciGuiFont::getCharWidth(byte chr) { byte Font::getCharWidth(byte chr) {
return chr < _numChars ? _chars[chr].w : 0; return chr < _numChars ? _chars[chr].w : 0;
} }
byte SciGuiFont::getCharHeight(byte chr) { byte Font::getCharHeight(byte chr) {
return chr < _numChars ? _chars[chr].h : 0; return chr < _numChars ? _chars[chr].h : 0;
} }
byte *SciGuiFont::getCharData(byte chr) { byte *Font::getCharData(byte chr) {
return chr < _numChars ? _resourceData + _chars[chr].offset + 2 : 0; return chr < _numChars ? _resourceData + _chars[chr].offset + 2 : 0;
} }
void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput) { void Font::draw(Screen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput) {
int charWidth = MIN<int>(getCharWidth(chr), screen->_width - left); int charWidth = MIN<int>(getCharWidth(chr), screen->_width - left);
int charHeight = MIN<int>(getCharHeight(chr), 200 - top); int charHeight = MIN<int>(getCharHeight(chr), 200 - top);
byte b = 0, mask = 0xFF; byte b = 0, mask = 0xFF;

View file

@ -23,24 +23,24 @@
* *
*/ */
#ifndef SCI_GUI_FONT_H #ifndef SCI_GRAPHICS_FONT_H
#define SCI_GUI_FONT_H #define SCI_GRAPHICS_FONT_H
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
class SciGuiFont { class Font {
public: public:
SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId); Font(ResourceManager *resMan, GuiResourceId resourceId);
~SciGuiFont(); ~Font();
GuiResourceId getResourceId(); GuiResourceId getResourceId();
byte getHeight(); byte getHeight();
byte getCharWidth(byte chr); byte getCharWidth(byte chr);
byte getCharHeight(byte chr); byte getCharHeight(byte chr);
byte *getCharData(byte chr); byte *getCharData(byte chr);
void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput); void draw(Screen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput);
private: private:
ResourceManager *_resMan; ResourceManager *_resMan;

View file

@ -29,46 +29,46 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/gui_font.h" #include "sci/graphics/font.h"
#include "sci/graphics/gui_picture.h" #include "sci/graphics/picture.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
namespace Sci { namespace Sci {
SciGuiGfx::SciGuiGfx(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, SciGuiScreen *screen, SciGuiPalette *palette) Gfx::Gfx(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, Screen *screen, SciPalette *palette)
: _resMan(resMan), _segMan(segMan), _kernel(kernel), _screen(screen), _palette(palette) { : _resMan(resMan), _segMan(segMan), _kernel(kernel), _screen(screen), _palette(palette) {
} }
SciGuiGfx::~SciGuiGfx() { Gfx::~Gfx() {
purgeCache(); purgeCache();
delete _mainPort; delete _mainPort;
delete _menuPort; delete _menuPort;
} }
void SciGuiGfx::init(SciGuiText *text) { void Gfx::init(Text *text) {
_text = text; _text = text;
// _mainPort is not known to windowmanager, that's okay according to sierra sci // _mainPort is not known to windowmanager, that's okay according to sierra sci
// its not even used currently in our engine // its not even used currently in our engine
_mainPort = new GuiPort(0); _mainPort = new Port(0);
SetPort(_mainPort); SetPort(_mainPort);
OpenPort(_mainPort); OpenPort(_mainPort);
// _menuPort has actually hardcoded id 0xFFFF. Its not meant to be known to windowmanager according to sierra sci // _menuPort has actually hardcoded id 0xFFFF. Its not meant to be known to windowmanager according to sierra sci
_menuPort = new GuiPort(0xFFFF); _menuPort = new Port(0xFFFF);
OpenPort(_menuPort); OpenPort(_menuPort);
_text->SetFont(0); _text->SetFont(0);
_menuPort->rect = Common::Rect(0, 0, _screen->_width, _screen->_height); _menuPort->rect = Common::Rect(0, 0, _screen->_width, _screen->_height);
_menuBarRect = Common::Rect(0, 0, _screen->_width, 9); _menuBarRect = Common::Rect(0, 0, _screen->_width, 9);
} }
void SciGuiGfx::purgeCache() { void Gfx::purgeCache() {
for (ViewCache::iterator iter = _cachedViews.begin(); iter != _cachedViews.end(); ++iter) { for (ViewCache::iterator iter = _cachedViews.begin(); iter != _cachedViews.end(); ++iter) {
delete iter->_value; delete iter->_value;
iter->_value = 0; iter->_value = 0;
@ -77,46 +77,46 @@ void SciGuiGfx::purgeCache() {
_cachedViews.clear(); _cachedViews.clear();
} }
SciGuiView *SciGuiGfx::getView(GuiResourceId viewNum) { View *Gfx::getView(GuiResourceId viewNum) {
if (_cachedViews.size() >= MAX_CACHED_VIEWS) if (_cachedViews.size() >= MAX_CACHED_VIEWS)
purgeCache(); purgeCache();
if (!_cachedViews.contains(viewNum)) if (!_cachedViews.contains(viewNum))
_cachedViews[viewNum] = new SciGuiView(_resMan, _screen, _palette, viewNum); _cachedViews[viewNum] = new View(_resMan, _screen, _palette, viewNum);
return _cachedViews[viewNum]; return _cachedViews[viewNum];
} }
GuiPort *SciGuiGfx::SetPort(GuiPort *newPort) { Port *Gfx::SetPort(Port *newPort) {
GuiPort *oldPort = _curPort; Port *oldPort = _curPort;
_curPort = newPort; _curPort = newPort;
return oldPort; return oldPort;
} }
GuiPort *SciGuiGfx::GetPort() { Port *Gfx::GetPort() {
return _curPort; return _curPort;
} }
void SciGuiGfx::SetOrigin(int16 left, int16 top) { void Gfx::SetOrigin(int16 left, int16 top) {
_curPort->left = left; _curPort->left = left;
_curPort->top = top; _curPort->top = top;
} }
void SciGuiGfx::MoveTo(int16 left, int16 top) { void Gfx::MoveTo(int16 left, int16 top) {
_curPort->curTop = top; _curPort->curTop = top;
_curPort->curLeft = left; _curPort->curLeft = left;
} }
void SciGuiGfx::Move(int16 left, int16 top) { void Gfx::Move(int16 left, int16 top) {
_curPort->curTop += top; _curPort->curTop += top;
_curPort->curLeft += left; _curPort->curLeft += left;
} }
void SciGuiGfx::OpenPort(GuiPort *port) { void Gfx::OpenPort(Port *port) {
port->fontId = 0; port->fontId = 0;
port->fontHeight = 8; port->fontHeight = 8;
GuiPort *tmp = _curPort; Port *tmp = _curPort;
_curPort = port; _curPort = port;
_text->SetFont(port->fontId); _text->SetFont(port->fontId);
_curPort = tmp; _curPort = tmp;
@ -130,46 +130,46 @@ void SciGuiGfx::OpenPort(GuiPort *port) {
port->rect = _bounds; port->rect = _bounds;
} }
void SciGuiGfx::PenColor(int16 color) { void Gfx::PenColor(int16 color) {
_curPort->penClr = color; _curPort->penClr = color;
} }
void SciGuiGfx::BackColor(int16 color) { void Gfx::BackColor(int16 color) {
_curPort->backClr = color; _curPort->backClr = color;
} }
void SciGuiGfx::PenMode(int16 mode) { void Gfx::PenMode(int16 mode) {
_curPort->penMode = mode; _curPort->penMode = mode;
} }
void SciGuiGfx::TextGreyedOutput(bool state) { void Gfx::TextGreyedOutput(bool state) {
_curPort->greyedOutput = state; _curPort->greyedOutput = state;
} }
int16 SciGuiGfx::GetPointSize() { int16 Gfx::GetPointSize() {
return _curPort->fontHeight; return _curPort->fontHeight;
} }
void SciGuiGfx::ClearScreen(byte color) { void Gfx::ClearScreen(byte color) {
FillRect(_curPort->rect, SCI_SCREEN_MASK_ALL, color, 0, 0); FillRect(_curPort->rect, SCI_SCREEN_MASK_ALL, color, 0, 0);
} }
void SciGuiGfx::InvertRect(const Common::Rect &rect) { void Gfx::InvertRect(const Common::Rect &rect) {
int16 oldpenmode = _curPort->penMode; int16 oldpenmode = _curPort->penMode;
_curPort->penMode = 2; _curPort->penMode = 2;
FillRect(rect, 1, _curPort->penClr, _curPort->backClr); FillRect(rect, 1, _curPort->penClr, _curPort->backClr);
_curPort->penMode = oldpenmode; _curPort->penMode = oldpenmode;
} }
void SciGuiGfx::EraseRect(const Common::Rect &rect) { void Gfx::EraseRect(const Common::Rect &rect) {
FillRect(rect, 1, _curPort->backClr); FillRect(rect, 1, _curPort->backClr);
} }
void SciGuiGfx::PaintRect(const Common::Rect &rect) { void Gfx::PaintRect(const Common::Rect &rect) {
FillRect(rect, 1, _curPort->penClr); FillRect(rect, 1, _curPort->penClr);
} }
void SciGuiGfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) { void Gfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) {
Common::Rect r = rect; Common::Rect r = rect;
r.clip(_curPort->rect); r.clip(_curPort->rect);
if (r.isEmpty()) // nothing to fill if (r.isEmpty()) // nothing to fill
@ -221,7 +221,7 @@ void SciGuiGfx::FillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen,
} }
} }
void SciGuiGfx::FrameRect(const Common::Rect &rect) { void Gfx::FrameRect(const Common::Rect &rect) {
Common::Rect r; Common::Rect r;
// left // left
r = rect; r = rect;
@ -241,21 +241,21 @@ void SciGuiGfx::FrameRect(const Common::Rect &rect) {
PaintRect(r); PaintRect(r);
} }
void SciGuiGfx::OffsetRect(Common::Rect &r) { void Gfx::OffsetRect(Common::Rect &r) {
r.top += _curPort->top; r.top += _curPort->top;
r.bottom += _curPort->top; r.bottom += _curPort->top;
r.left += _curPort->left; r.left += _curPort->left;
r.right += _curPort->left; r.right += _curPort->left;
} }
void SciGuiGfx::OffsetLine(Common::Point &start, Common::Point &end) { void Gfx::OffsetLine(Common::Point &start, Common::Point &end) {
start.x += _curPort->left; start.x += _curPort->left;
start.y += _curPort->top; start.y += _curPort->top;
end.x += _curPort->left; end.x += _curPort->left;
end.y += _curPort->top; end.y += _curPort->top;
} }
void SciGuiGfx::BitsShow(const Common::Rect &rect) { void Gfx::BitsShow(const Common::Rect &rect) {
Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom); Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom);
workerRect.clip(_curPort->rect); workerRect.clip(_curPort->rect);
if (workerRect.isEmpty()) // nothing to show if (workerRect.isEmpty()) // nothing to show
@ -265,8 +265,8 @@ void SciGuiGfx::BitsShow(const Common::Rect &rect) {
_screen->copyRectToScreen(workerRect); _screen->copyRectToScreen(workerRect);
} }
GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) { MemoryHandle Gfx::BitsSave(const Common::Rect &rect, byte screenMask) {
GuiMemoryHandle memoryId; MemoryHandle memoryId;
byte *memoryPtr; byte *memoryPtr;
int size; int size;
@ -286,7 +286,7 @@ GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) {
return memoryId; return memoryId;
} }
void SciGuiGfx::BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect) { void Gfx::BitsGetRect(MemoryHandle memoryHandle, Common::Rect *destRect) {
byte *memoryPtr = NULL; byte *memoryPtr = NULL;
if (!memoryHandle.isNull()) { if (!memoryHandle.isNull()) {
@ -298,7 +298,7 @@ void SciGuiGfx::BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect
} }
} }
void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) { void Gfx::BitsRestore(MemoryHandle memoryHandle) {
byte *memoryPtr = NULL; byte *memoryPtr = NULL;
if (!memoryHandle.isNull()) { if (!memoryHandle.isNull()) {
@ -311,13 +311,13 @@ void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) {
} }
} }
void SciGuiGfx::BitsFree(GuiMemoryHandle memoryHandle) { void Gfx::BitsFree(MemoryHandle memoryHandle) {
if (!memoryHandle.isNull()) { if (!memoryHandle.isNull()) {
kfree(_segMan, memoryHandle); kfree(_segMan, memoryHandle);
} }
} }
void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) { void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) {
SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId); SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId);
// do we add to a picture? if not -> clear screen with white // do we add to a picture? if not -> clear screen with white
@ -329,8 +329,8 @@ void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mir
} }
// This one is the only one that updates screen! // This one is the only one that updates screen!
void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) { void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) {
SciGuiView *view = getView(viewId); View *view = getView(viewId);
Common::Rect rect; Common::Rect rect;
Common::Rect clipRect; Common::Rect clipRect;
if (view) { if (view) {
@ -358,8 +358,8 @@ void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
} }
// This version of drawCel is not supposed to call BitsShow()! // This version of drawCel is not supposed to call BitsShow()!
void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) { void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) {
SciGuiView *view = getView(viewId); View *view = getView(viewId);
Common::Rect clipRect; Common::Rect clipRect;
if (view) { if (view) {
clipRect = celRect; clipRect = celRect;
@ -375,7 +375,7 @@ void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
} }
// This version of drawCel is not supposed to call BitsShow()! // This version of drawCel is not supposed to call BitsShow()!
void SciGuiGfx::drawCel(SciGuiView *view, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) { void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) {
Common::Rect clipRect; Common::Rect clipRect;
clipRect = celRect; clipRect = celRect;
clipRect.clip(_curPort->rect); clipRect.clip(_curPort->rect);
@ -387,7 +387,7 @@ void SciGuiGfx::drawCel(SciGuiView *view, GuiViewLoopNo loopNo, GuiViewCelNo cel
view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo); view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo);
} }
uint16 SciGuiGfx::onControl(uint16 screenMask, Common::Rect rect) { uint16 Gfx::onControl(uint16 screenMask, Common::Rect rect) {
Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom); Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom);
int16 x, y; int16 x, y;
uint16 result = 0; uint16 result = 0;
@ -420,7 +420,7 @@ static inline int sign_extend_byte(int value) {
return value; return value;
} }
void SciGuiGfx::PriorityBandsInit(int16 bandCount, int16 top, int16 bottom) { void Gfx::PriorityBandsInit(int16 bandCount, int16 top, int16 bottom) {
int16 y; int16 y;
int32 bandSize; int32 bandSize;
@ -449,7 +449,7 @@ void SciGuiGfx::PriorityBandsInit(int16 bandCount, int16 top, int16 bottom) {
_priorityBands[y] = _priorityBandCount; _priorityBands[y] = _priorityBandCount;
} }
void SciGuiGfx::PriorityBandsInit(byte *data) { void Gfx::PriorityBandsInit(byte *data) {
int i = 0, inx; int i = 0, inx;
byte priority = 0; byte priority = 0;
@ -462,7 +462,7 @@ void SciGuiGfx::PriorityBandsInit(byte *data) {
_priorityBands[i++] = inx; _priorityBands[i++] = inx;
} }
byte SciGuiGfx::CoordinateToPriority(int16 y) { byte Gfx::CoordinateToPriority(int16 y) {
if (y < _priorityTop) if (y < _priorityTop)
return _priorityBands[_priorityTop]; return _priorityBands[_priorityTop];
if (y > _priorityBottom) if (y > _priorityBottom)
@ -470,7 +470,7 @@ byte SciGuiGfx::CoordinateToPriority(int16 y) {
return _priorityBands[y]; return _priorityBands[y];
} }
int16 SciGuiGfx::PriorityToCoordinate(byte priority) { int16 Gfx::PriorityToCoordinate(byte priority) {
int16 y; int16 y;
if (priority <= _priorityBandCount) { if (priority <= _priorityBandCount) {
for (y = 0; y <= _priorityBottom; y++) for (y = 0; y <= _priorityBottom; y++)
@ -480,7 +480,7 @@ int16 SciGuiGfx::PriorityToCoordinate(byte priority) {
return _priorityBottom; return _priorityBottom;
} }
bool SciGuiGfx::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list) { bool Gfx::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list) {
reg_t curAddress = list->first; reg_t curAddress = list->first;
Node *curNode = _segMan->lookupNode(curAddress); Node *curNode = _segMan->lookupNode(curAddress);
reg_t curObject; reg_t curObject;
@ -508,12 +508,12 @@ bool SciGuiGfx::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect
return true; return true;
} }
void SciGuiGfx::SetNowSeen(reg_t objectReference) { void Gfx::SetNowSeen(reg_t objectReference) {
SciGuiView *view = NULL; View *view = NULL;
Common::Rect celRect(0, 0); Common::Rect celRect(0, 0);
GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view); GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view);
GuiViewLoopNo loopNo = sign_extend_byte((GuiViewLoopNo)GET_SEL32V(_segMan, objectReference, loop)); LoopNo loopNo = sign_extend_byte((LoopNo)GET_SEL32V(_segMan, objectReference, loop));
GuiViewCelNo celNo = sign_extend_byte((GuiViewCelNo)GET_SEL32V(_segMan, objectReference, cel)); CelNo celNo = sign_extend_byte((CelNo)GET_SEL32V(_segMan, objectReference, cel));
int16 x = (int16)GET_SEL32V(_segMan, objectReference, x); int16 x = (int16)GET_SEL32V(_segMan, objectReference, x);
int16 y = (int16)GET_SEL32V(_segMan, objectReference, y); int16 y = (int16)GET_SEL32V(_segMan, objectReference, y);
int16 z = 0; int16 z = 0;

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_GFX_H #ifndef SCI_GRAPHICS_GFX_H
#define SCI_GUI_GFX_H #define SCI_GRAPHICS_GFX_H
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
@ -38,30 +38,30 @@ namespace Sci {
#define MAX_CACHED_VIEWS 50 #define MAX_CACHED_VIEWS 50
class SciGuiScreen; class Screen;
class SciGuiPalette; class SciPalette;
class SciGuiFont; class Font;
class SciGuiPicture; class SciGuiPicture;
class SciGuiView; class View;
typedef Common::HashMap<int, SciGuiView *> ViewCache; typedef Common::HashMap<int, View *> ViewCache;
class SciGuiGfx { class Gfx {
public: public:
SciGuiGfx(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, SciGuiScreen *screen, SciGuiPalette *palette); Gfx(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, Screen *screen, SciPalette *palette);
~SciGuiGfx(); ~Gfx();
void init(SciGuiText *text); void init(Text *text);
byte *GetSegment(byte seg); byte *GetSegment(byte seg);
void ResetScreen(); void ResetScreen();
GuiPort *SetPort(GuiPort *port); Port *SetPort(Port *port);
GuiPort *GetPort(); Port *GetPort();
void SetOrigin(int16 left, int16 top); void SetOrigin(int16 left, int16 top);
void MoveTo(int16 left, int16 top); void MoveTo(int16 left, int16 top);
void Move(int16 left, int16 top); void Move(int16 left, int16 top);
void OpenPort(GuiPort *port); void OpenPort(Port *port);
void PenColor(int16 color); void PenColor(int16 color);
void BackColor(int16 color); void BackColor(int16 color);
void PenMode(int16 mode); void PenMode(int16 mode);
@ -78,15 +78,15 @@ public:
void OffsetLine(Common::Point &start, Common::Point &end); void OffsetLine(Common::Point &start, Common::Point &end);
void BitsShow(const Common::Rect &r); void BitsShow(const Common::Rect &r);
GuiMemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags); MemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags);
void BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect); void BitsGetRect(MemoryHandle memoryHandle, Common::Rect *destRect);
void BitsRestore(GuiMemoryHandle memoryHandle); void BitsRestore(MemoryHandle memoryHandle);
void BitsFree(GuiMemoryHandle memoryHandle); void BitsFree(MemoryHandle memoryHandle);
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId); void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1); void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1);
void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo); void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo);
void drawCel(SciGuiView *view, GuiViewLoopNo loopNo, GuiViewCelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo); void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo);
uint16 onControl(uint16 screenMask, Common::Rect rect); uint16 onControl(uint16 screenMask, Common::Rect rect);
@ -99,11 +99,11 @@ public:
void SetNowSeen(reg_t objectReference); void SetNowSeen(reg_t objectReference);
GuiPort *_menuPort; Port *_menuPort;
Common::Rect _menuBarRect; Common::Rect _menuBarRect;
GuiPort *_curPort; Port *_curPort;
SciGuiView *getView(GuiResourceId viewNum); View *getView(GuiResourceId viewNum);
private: private:
void purgeCache(); void purgeCache();
@ -111,12 +111,12 @@ private:
ResourceManager *_resMan; ResourceManager *_resMan;
SegManager *_segMan; SegManager *_segMan;
Kernel *_kernel; Kernel *_kernel;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
SciGuiText *_text; Text *_text;
Common::Rect _bounds; Common::Rect _bounds;
GuiPort *_mainPort; Port *_mainPort;
// Priority Bands related variables // Priority Bands related variables
int16 _priorityTop, _priorityBottom, _priorityBandCount; int16 _priorityTop, _priorityBottom, _priorityBandCount;

View file

@ -31,35 +31,35 @@
#include "sci/event.h" #include "sci/event.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_windowmgr.h" #include "sci/graphics/windowmgr.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/gui_controls.h" #include "sci/graphics/controls.h"
#include "sci/graphics/gui_menu.h" #include "sci/graphics/menu.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
#include "sci/graphics/gui_transitions.h" #include "sci/graphics/transitions.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
namespace Sci { namespace Sci {
// for debug purposes // for debug purposes
// class SciGui32 : public SciGui { // class SciGui32 : public SciGui {
// public: // public:
// SciGui32(EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor); // SciGui32(EngineState *s, Screen *screen, SciPalette *palette, Cursor *cursor);
// ~SciGui32(); // ~SciGui32();
// }; // };
SciGui::SciGui(EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor) SciGui::SciGui(EngineState *state, Screen *screen, SciPalette *palette, Cursor *cursor)
: _s(state), _screen(screen), _palette(palette), _cursor(cursor) { : _s(state), _screen(screen), _palette(palette), _cursor(cursor) {
_gfx = new SciGuiGfx(_s->resMan, _s->_segMan, _s->_kernel, _screen, _palette); _gfx = new Gfx(_s->resMan, _s->_segMan, _s->_kernel, _screen, _palette);
_transitions = new SciGuiTransitions(this, _screen, _palette, _s->resMan->isVGA()); _transitions = new Transitions(this, _screen, _palette, _s->resMan->isVGA());
_animate = new SciGuiAnimate(_s, _gfx, _screen, _palette); _animate = new SciGuiAnimate(_s, _gfx, _screen, _palette);
_text = new SciGuiText(_s->resMan, _gfx, _screen); _text = new Text(_s->resMan, _gfx, _screen);
_windowMgr = new SciGuiWindowMgr(this, _screen, _gfx, _text); _windowMgr = new WindowMgr(this, _screen, _gfx, _text);
_controls = new SciGuiControls(_s->_segMan, _gfx, _text); _controls = new SciGuiControls(_s->_segMan, _gfx, _text);
_menu = new SciGuiMenu(_s->_event, _s->_segMan, _gfx, _text, _screen, _cursor); _menu = new SciGuiMenu(_s->_event, _s->_segMan, _gfx, _text, _screen, _cursor);
// _gui32 = new SciGui32(_s, _screen, _palette, _cursor); // for debug purposes // _gui32 = new SciGui32(_s, _screen, _palette, _cursor); // for debug purposes
@ -142,13 +142,13 @@ reg_t SciGui::getPort() {
} }
void SciGui::globalToLocal(int16 *x, int16 *y) { void SciGui::globalToLocal(int16 *x, int16 *y) {
GuiPort *curPort = _gfx->GetPort(); Port *curPort = _gfx->GetPort();
*x = *x - curPort->left; *x = *x - curPort->left;
*y = *y - curPort->top; *y = *y - curPort->top;
} }
void SciGui::localToGlobal(int16 *x, int16 *y) { void SciGui::localToGlobal(int16 *x, int16 *y) {
GuiPort *curPort = _gfx->GetPort(); Port *curPort = _gfx->GetPort();
*x = *x + curPort->left; *x = *x + curPort->left;
*y = *y + curPort->top; *y = *y + curPort->top;
} }
@ -162,7 +162,7 @@ int16 SciGui::priorityToCoordinate(int16 priority) {
} }
reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) { reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
GuiWindow *wnd = NULL; Window *wnd = NULL;
if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0) if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false); wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false);
@ -176,7 +176,7 @@ reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 styl
} }
void SciGui::disposeWindow(uint16 windowPtr, bool reanimate) { void SciGui::disposeWindow(uint16 windowPtr, bool reanimate) {
GuiWindow *wnd = (GuiWindow *)_windowMgr->getPortById(windowPtr); Window *wnd = (Window *)_windowMgr->getPortById(windowPtr);
_windowMgr->DisposeWindow(wnd, reanimate); _windowMgr->DisposeWindow(wnd, reanimate);
} }
@ -193,13 +193,13 @@ void SciGui::disposeWindow(uint16 windowPtr, bool reanimate) {
void SciGui::display(const char *text, int argc, reg_t *argv) { void SciGui::display(const char *text, int argc, reg_t *argv) {
int displayArg; int displayArg;
GuiTextAlignment alignment = SCI_TEXT_ALIGNMENT_LEFT; TextAlignment alignment = SCI_TEXT_ALIGNMENT_LEFT;
int16 bgcolor = -1, width = -1, bRedraw = 1; int16 bgcolor = -1, width = -1, bRedraw = 1;
bool doSaveUnder = false; bool doSaveUnder = false;
Common::Rect rect; Common::Rect rect;
// Make a "backup" of the port settings // Make a "backup" of the port settings
GuiPort oldPort = *_gfx->GetPort(); Port oldPort = *_gfx->GetPort();
// setting defaults // setting defaults
_gfx->PenMode(0); _gfx->PenMode(0);
@ -274,7 +274,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
if (_screen->_picNotValid == 0 && bRedraw) if (_screen->_picNotValid == 0 && bRedraw)
_gfx->BitsShow(rect); _gfx->BitsShow(rect);
// restoring port and cursor pos // restoring port and cursor pos
GuiPort *currport = _gfx->GetPort(); Port *currport = _gfx->GetPort();
uint16 tTop = currport->curTop; uint16 tTop = currport->curTop;
uint16 tLeft = currport->curLeft; uint16 tLeft = currport->curLeft;
*currport = oldPort; *currport = oldPort;
@ -300,7 +300,7 @@ void SciGui::textColors(int argc, reg_t *argv) {
} }
void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) { void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort); Port *oldPort = _gfx->SetPort(_gfx->_menuPort);
_gfx->FillRect(_gfx->_menuBarRect, 1, colorBack); _gfx->FillRect(_gfx->_menuBarRect, 1, colorBack);
_gfx->PenColor(colorPen); _gfx->PenColor(colorPen);
@ -313,7 +313,7 @@ void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
void SciGui::drawMenuBar(bool clear) { void SciGui::drawMenuBar(bool clear) {
if (!clear) { if (!clear) {
GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort); Port *oldPort = _gfx->SetPort(_gfx->_menuPort);
_menu->drawBar(); _menu->drawBar();
if (_screen->_picNotValid == 0) if (_screen->_picNotValid == 0)
_gfx->BitsShow(_gfx->_menuBarRect); _gfx->BitsShow(_gfx->_menuBarRect);
@ -345,7 +345,7 @@ reg_t SciGui::menuSelect(reg_t eventObject) {
} }
void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) {
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); Port *oldPort = _gfx->SetPort((Port *)_windowMgr->_picWind);
if (_windowMgr->isFrontWindow(_windowMgr->_picWind)) { if (_windowMgr->isFrontWindow(_windowMgr->_picWind)) {
_screen->_picNotValid = 1; _screen->_picNotValid = 1;
@ -359,7 +359,7 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat
_gfx->SetPort(oldPort); _gfx->SetPort(oldPort);
} }
void SciGui::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) { void SciGui::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) {
_gfx->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight); _gfx->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight);
_palette->setOnScreen(); _palette->setOnScreen();
} }
@ -392,7 +392,7 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i
} }
} }
void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, GuiTextAlignment alignment, int16 style, bool hilite) { void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) {
if (!hilite) { if (!hilite) {
rect.grow(1); rect.grow(1);
_gfx->EraseRect(rect); _gfx->EraseRect(rect);
@ -430,7 +430,7 @@ void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text,
_gfx->BitsShow(rect); _gfx->BitsShow(rect);
} }
void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool hilite) { void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 style, bool hilite) {
if (!hilite) { if (!hilite) {
_gfx->drawCel(viewId, loopNo, celNo, rect.left, rect.top, 255, 0); _gfx->drawCel(viewId, loopNo, celNo, rect.left, rect.top, 255, 0);
if (style & 0x20) { if (style & 0x20) {
@ -510,7 +510,7 @@ void SciGui::graphUpdateBox(Common::Rect rect) {
void SciGui::graphRedrawBox(Common::Rect rect) { void SciGui::graphRedrawBox(Common::Rect rect) {
localToGlobal(&rect.left, &rect.top); localToGlobal(&rect.left, &rect.top);
localToGlobal(&rect.right, &rect.bottom); localToGlobal(&rect.right, &rect.bottom);
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); Port *oldPort = _gfx->SetPort((Port *)_windowMgr->_picWind);
globalToLocal(&rect.left, &rect.top); globalToLocal(&rect.left, &rect.top);
globalToLocal(&rect.right, &rect.bottom); globalToLocal(&rect.right, &rect.bottom);
@ -596,7 +596,7 @@ void SciGui::shakeScreen(uint16 shakeCount, uint16 directions) {
} }
uint16 SciGui::onControl(byte screenMask, Common::Rect rect) { uint16 SciGui::onControl(byte screenMask, Common::Rect rect) {
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); Port *oldPort = _gfx->SetPort((Port *)_windowMgr->_picWind);
uint16 result; uint16 result;
result = _gfx->onControl(screenMask, rect); result = _gfx->onControl(screenMask, rect);
@ -605,7 +605,7 @@ uint16 SciGui::onControl(byte screenMask, Common::Rect rect) {
} }
void SciGui::animateShowPic() { void SciGui::animateShowPic() {
GuiPort *picPort = _windowMgr->_picWind; Port *picPort = _windowMgr->_picWind;
Common::Rect picRect = picPort->rect; Common::Rect picRect = picPort->rect;
bool previousCursorState = _cursor->isVisible(); bool previousCursorState = _cursor->isVisible();
@ -637,7 +637,7 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
return; return;
} }
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); Port *oldPort = _gfx->SetPort((Port *)_windowMgr->_picWind);
_animate->disposeLastCast(); _animate->disposeLastCast();
_animate->makeSortedList(list); _animate->makeSortedList(list);
@ -670,7 +670,7 @@ void SciGui::addToPicSetPicNotValid() {
void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) { void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) {
List *list; List *list;
_gfx->SetPort((GuiPort *)_windowMgr->_picWind); _gfx->SetPort((Port *)_windowMgr->_picWind);
list = _s->_segMan->lookupList(listReference); list = _s->_segMan->lookupList(listReference);
if (!list) if (!list)
@ -682,8 +682,8 @@ void SciGui::addToPicList(reg_t listReference, int argc, reg_t *argv) {
addToPicSetPicNotValid(); addToPicSetPicNotValid();
} }
void SciGui::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { void SciGui::addToPicView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
_gfx->SetPort((GuiPort *)_windowMgr->_picWind); _gfx->SetPort((Port *)_windowMgr->_picWind);
_animate->addToPicDrawView(viewId, loopNo, celNo, leftPos, topPos, priority, control); _animate->addToPicDrawView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
addToPicSetPicNotValid(); addToPicSetPicNotValid();
} }
@ -693,7 +693,7 @@ void SciGui::setNowSeen(reg_t objectReference) {
} }
bool SciGui::canBeHere(reg_t curObject, reg_t listReference) { bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind); Port *oldPort = _gfx->SetPort((Port *)_windowMgr->_picWind);
Common::Rect checkRect; Common::Rect checkRect;
uint16 signal, controlMask; uint16 signal, controlMask;
bool result; bool result;
@ -717,8 +717,8 @@ bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
} }
bool SciGui::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) { bool SciGui::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
SciGuiView *tmpView = _gfx->getView(viewId); View *tmpView = _gfx->getView(viewId);
sciViewCelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo); CelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
position.x = CLIP<int>(position.x, 0, celInfo->width - 1); position.x = CLIP<int>(position.x, 0, celInfo->width - 1);
position.y = CLIP<int>(position.y, 0, celInfo->height - 1); position.y = CLIP<int>(position.y, 0, celInfo->height - 1);
byte *celData = tmpView->getBitmap(loopNo, celNo); byte *celData = tmpView->getBitmap(loopNo, celNo);
@ -733,10 +733,10 @@ void SciGui::baseSetter(reg_t object) {
int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0; int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0;
int16 yStep = GET_SEL32V(_s->_segMan, object, yStep); int16 yStep = GET_SEL32V(_s->_segMan, object, yStep);
GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view); GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view);
GuiViewLoopNo loopNo = GET_SEL32V(_s->_segMan, object, loop); LoopNo loopNo = GET_SEL32V(_s->_segMan, object, loop);
GuiViewCelNo celNo = GET_SEL32V(_s->_segMan, object, cel); CelNo celNo = GET_SEL32V(_s->_segMan, object, cel);
SciGuiView *tmpView = _gfx->getView(viewId); View *tmpView = _gfx->getView(viewId);
Common::Rect celRect; Common::Rect celRect;
tmpView->getCelRect(loopNo, celNo, x, y, z, &celRect); tmpView->getCelRect(loopNo, celNo, x, y, z, &celRect);

View file

@ -23,10 +23,10 @@
* *
*/ */
#ifndef SCI_GUI_GUI_H #ifndef SCI_GRAPHICS_GUI_H
#define SCI_GUI_GUI_H #define SCI_GRAPHICS_GUI_H
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
@ -41,21 +41,21 @@ enum {
SCI_CONTROLS_TYPE_DUMMY = 10 SCI_CONTROLS_TYPE_DUMMY = 10
}; };
class SciGuiScreen; class Screen;
class SciGuiPalette; class SciPalette;
class SciGuiCursor; class Cursor;
class SciGuiGfx; class Gfx;
class SciGuiWindowMgr; class WindowMgr;
class SciGuiAnimate; class SciGuiAnimate;
class SciGuiControls; class SciGuiControls;
class SciGuiMenu; class SciGuiMenu;
class SciGuiText; class Text;
class SciGuiTransitions; class Transitions;
class SciGui32; // for debug purposes class SciGui32; // for debug purposes
class SciGui { class SciGui {
public: public:
SciGui(EngineState *s, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor); SciGui(EngineState *s, Screen *screen, SciPalette *palette, Cursor *cursor);
SciGui(); SciGui();
virtual ~SciGui(); virtual ~SciGui();
@ -89,11 +89,11 @@ public:
virtual reg_t menuSelect(reg_t eventObject); virtual reg_t menuSelect(reg_t eventObject);
virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo);
virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1); virtual void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight = -1);
virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite);
virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite);
virtual void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); virtual void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite);
virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool hilite); virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 style, bool hilite);
virtual void drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite); virtual void drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite);
virtual void editControl(reg_t controlObject, reg_t eventObject); virtual void editControl(reg_t controlObject, reg_t eventObject);
@ -125,7 +125,7 @@ public:
virtual void animateShowPic(); virtual void animateShowPic();
virtual void animate(reg_t listReference, bool cycle, int argc, reg_t *argv); 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 addToPicList(reg_t listReference, int argc, reg_t *argv);
virtual void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control); virtual void addToPicView(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
virtual void setNowSeen(reg_t objectReference); virtual void setNowSeen(reg_t objectReference);
virtual bool canBeHere(reg_t curObject, reg_t listReference); virtual bool canBeHere(reg_t curObject, reg_t listReference);
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position); virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
@ -170,23 +170,23 @@ public:
virtual void resetEngineState(EngineState *s); virtual void resetEngineState(EngineState *s);
protected: protected:
SciGuiCursor *_cursor; Cursor *_cursor;
EngineState *_s; EngineState *_s;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
SciGuiGfx *_gfx; Gfx *_gfx;
private: private:
virtual void initPriorityBands(); virtual void initPriorityBands();
virtual void addToPicSetPicNotValid(); virtual void addToPicSetPicNotValid();
virtual int getControlPicNotValid(); virtual int getControlPicNotValid();
SciGuiWindowMgr *_windowMgr; WindowMgr *_windowMgr;
SciGuiAnimate *_animate; SciGuiAnimate *_animate;
SciGuiControls *_controls; SciGuiControls *_controls;
SciGuiMenu *_menu; SciGuiMenu *_menu;
SciGuiText *_text; Text *_text;
SciGuiTransitions *_transitions; Transitions *_transitions;
// SciGui32 *_gui32; // for debug purposes // SciGui32 *_gui32; // for debug purposes
bool _usesOldGfxFunctions; bool _usesOldGfxFunctions;

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_HELPERS_H #ifndef SCI_GRAPHICS_HELPERS_H
#define SCI_GUI_HELPERS_H #define SCI_GRAPHICS_HELPERS_H
#include "common/endian.h" // for READ_LE_UINT16 #include "common/endian.h" // for READ_LE_UINT16
#include "common/rect.h" #include "common/rect.h"
@ -36,13 +36,13 @@ namespace Sci {
#define SCI_SHAKE_DIRECTION_HORIZONTAL 2 #define SCI_SHAKE_DIRECTION_HORIZONTAL 2
typedef int GuiResourceId; // is a resource-number and -1 means no parameter given typedef int GuiResourceId; // is a resource-number and -1 means no parameter given
typedef reg_t GuiMemoryHandle; typedef reg_t MemoryHandle;
typedef int16 GuiViewLoopNo; typedef int16 LoopNo;
typedef int16 GuiViewCelNo; typedef int16 CelNo;
typedef int16 GuiTextAlignment; typedef int16 TextAlignment;
struct GuiPort { struct Port {
uint16 id; uint16 id;
int16 top, left; int16 top, left;
Common::Rect rect; Common::Rect rect;
@ -53,14 +53,14 @@ struct GuiPort {
int16 penClr, backClr; int16 penClr, backClr;
int16 penMode; int16 penMode;
GuiPort(uint16 theId) : id(theId), top(0), left(0), Port(uint16 theId) : id(theId), top(0), left(0),
curTop(0), curLeft(0), curTop(0), curLeft(0),
fontHeight(0), fontId(0), greyedOutput(false), fontHeight(0), fontId(0), greyedOutput(false),
penClr(0), backClr(0xFF), penMode(0) { penClr(0), backClr(0xFF), penMode(0) {
} }
}; };
struct GuiWindow : public GuiPort { struct Window : public Port {
Common::Rect dims; // client area of window Common::Rect dims; // client area of window
Common::Rect restoreRect; // total area of window including borders Common::Rect restoreRect; // total area of window including borders
uint16 wndStyle; uint16 wndStyle;
@ -70,41 +70,41 @@ struct GuiWindow : public GuiPort {
Common::String title; Common::String title;
bool bDrawn; bool bDrawn;
GuiWindow(uint16 theId) : GuiPort(theId), Window(uint16 theId) : Port(theId),
wndStyle(0), saveScreenMask(0), wndStyle(0), saveScreenMask(0),
hSaved1(NULL_REG), hSaved2(NULL_REG), hSaved1(NULL_REG), hSaved2(NULL_REG),
bDrawn(false) { bDrawn(false) {
} }
}; };
struct GuiAnimateEntry { struct AnimateEntry {
reg_t object; reg_t object;
GuiResourceId viewId; GuiResourceId viewId;
GuiViewLoopNo loopNo; LoopNo loopNo;
GuiViewCelNo celNo; CelNo celNo;
int16 paletteNo; int16 paletteNo;
int16 x, y, z; int16 x, y, z;
int16 priority; int16 priority;
uint16 signal; uint16 signal;
Common::Rect celRect; Common::Rect celRect;
bool showBitsFlag; bool showBitsFlag;
GuiMemoryHandle castHandle; MemoryHandle castHandle;
}; };
typedef Common::List<GuiAnimateEntry *> GuiAnimateList; typedef Common::List<AnimateEntry *> AnimateList;
struct GuiColor { struct Color {
byte used; byte used;
byte r, g, b; byte r, g, b;
}; };
struct GuiPalette { struct Palette {
byte mapping[256]; byte mapping[256];
uint32 timestamp; uint32 timestamp;
GuiColor colors[256]; Color colors[256];
byte intensity[256]; byte intensity[256];
}; };
struct GuiPalSchedule { struct PalSchedule {
byte from; byte from;
uint32 schedule; uint32 schedule;
}; };

View file

@ -30,17 +30,17 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/event.h" #include "sci/event.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/gui_font.h" #include "sci/graphics/font.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_menu.h" #include "sci/graphics/menu.h"
namespace Sci { namespace Sci {
SciGuiMenu::SciGuiMenu(SciEvent *event, SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text, SciGuiScreen *screen, SciGuiCursor *cursor) SciGuiMenu::SciGuiMenu(SciEvent *event, SegManager *segMan, Gfx *gfx, Text *text, Screen *screen, Cursor *cursor)
: _event(event), _segMan(segMan), _gfx(gfx), _text(text), _screen(screen), _cursor(cursor) { : _event(event), _segMan(segMan), _gfx(gfx), _text(text), _screen(screen), _cursor(cursor) {
_listCount = 0; _listCount = 0;

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_MENU_H #ifndef SCI_GRAPHICS_MENU_H
#define SCI_GUI_MENU_H #define SCI_GRAPHICS_MENU_H
namespace Sci { namespace Sci {
@ -78,7 +78,7 @@ typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList;
class SciGuiMenu { class SciGuiMenu {
public: public:
SciGuiMenu(SciEvent *event, SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text, SciGuiScreen *screen, SciGuiCursor *cursor); SciGuiMenu(SciEvent *event, SegManager *segMan, Gfx *gfx, Text *text, Screen *screen, Cursor *cursor);
~SciGuiMenu(); ~SciGuiMenu();
void reset(); void reset();
@ -100,10 +100,10 @@ private:
SciEvent *_event; SciEvent *_event;
SegManager *_segMan; SegManager *_segMan;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiText *_text; Text *_text;
SciGuiScreen *_screen; Screen *_screen;
SciGuiCursor *_cursor; Cursor *_cursor;
uint16 _listCount; uint16 _listCount;
GuiMenuList _list; GuiMenuList _list;
@ -112,9 +112,9 @@ private:
uint16 _curMenuId; uint16 _curMenuId;
uint16 _curItemId; uint16 _curItemId;
GuiPort *_oldPort; Port *_oldPort;
GuiMemoryHandle _barSaveHandle; MemoryHandle _barSaveHandle;
GuiMemoryHandle _menuSaveHandle; MemoryHandle _menuSaveHandle;
Common::Rect _menuRect; Common::Rect _menuRect;
}; };

View file

@ -28,12 +28,12 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
namespace Sci { namespace Sci {
SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen, bool autoSetPalette) SciPalette::SciPalette(ResourceManager *resMan, Screen *screen, bool autoSetPalette)
: _resMan(resMan), _screen(screen) { : _resMan(resMan), _screen(screen) {
int16 color; int16 color;
@ -63,20 +63,20 @@ SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen, bool
} }
} }
SciGuiPalette::~SciGuiPalette() { SciPalette::~SciPalette() {
} }
#define SCI_PAL_FORMAT_CONSTANT 1 #define SCI_PAL_FORMAT_CONSTANT 1
#define SCI_PAL_FORMAT_VARIABLE 0 #define SCI_PAL_FORMAT_VARIABLE 0
void SciGuiPalette::createFromData(byte *data, GuiPalette *paletteOut) { void SciPalette::createFromData(byte *data, Palette *paletteOut) {
int palFormat = 0; int palFormat = 0;
int palOffset = 0; int palOffset = 0;
int palColorStart = 0; int palColorStart = 0;
int palColorCount = 0; int palColorCount = 0;
int colorNo = 0; int colorNo = 0;
memset(paletteOut, 0, sizeof(GuiPalette)); memset(paletteOut, 0, sizeof(Palette));
// Setup default mapping // Setup default mapping
for (colorNo = 0; colorNo < 256; colorNo++) { for (colorNo = 0; colorNo < 256; colorNo++) {
paletteOut->mapping[colorNo] = colorNo; paletteOut->mapping[colorNo] = colorNo;
@ -115,7 +115,7 @@ void SciGuiPalette::createFromData(byte *data, GuiPalette *paletteOut) {
// Will try to set amiga palette by using "spal" file. If not found, we return false // Will try to set amiga palette by using "spal" file. If not found, we return false
bool SciGuiPalette::setAmiga() { bool SciPalette::setAmiga() {
Common::File file; Common::File file;
int curColor, byte1, byte2; int curColor, byte1, byte2;
@ -137,7 +137,7 @@ bool SciGuiPalette::setAmiga() {
return false; return false;
} }
void SciGuiPalette::setEGA() { void SciPalette::setEGA() {
int i; int i;
byte color1, color2; byte color1, color2;
_sysPalette.colors[1].r = 0x000; _sysPalette.colors[1].g = 0x000; _sysPalette.colors[1].b = 0x0AA; _sysPalette.colors[1].r = 0x000; _sysPalette.colors[1].g = 0x000; _sysPalette.colors[1].b = 0x0AA;
@ -170,9 +170,9 @@ void SciGuiPalette::setEGA() {
setOnScreen(); setOnScreen();
} }
bool SciGuiPalette::setFromResource(GuiResourceId resourceId, uint16 flag) { bool SciPalette::setFromResource(GuiResourceId resourceId, uint16 flag) {
Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), 0); Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), 0);
GuiPalette palette; Palette palette;
if (palResource) { if (palResource) {
createFromData(palResource->data, &palette); createFromData(palResource->data, &palette);
@ -182,7 +182,7 @@ bool SciGuiPalette::setFromResource(GuiResourceId resourceId, uint16 flag) {
return false; return false;
} }
void SciGuiPalette::set(GuiPalette *sciPal, uint16 flag) { void SciPalette::set(Palette *sciPal, uint16 flag) {
uint32 systime = _sysPalette.timestamp; uint32 systime = _sysPalette.timestamp;
if (flag == 2 || sciPal->timestamp != systime) { if (flag == 2 || sciPal->timestamp != systime) {
merge(sciPal, &_sysPalette, flag); merge(sciPal, &_sysPalette, flag);
@ -192,7 +192,7 @@ void SciGuiPalette::set(GuiPalette *sciPal, uint16 flag) {
} }
} }
void SciGuiPalette::merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) { void SciPalette::merge(Palette *pFrom, Palette *pTo, uint16 flag) {
uint16 res; uint16 res;
int i,j; int i,j;
// colors 0 (black) and 255 (white) are not affected by merging // colors 0 (black) and 255 (white) are not affected by merging
@ -240,7 +240,7 @@ void SciGuiPalette::merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) {
pTo->timestamp = g_system->getMillis() * 60 / 1000; pTo->timestamp = g_system->getMillis() * 60 / 1000;
} }
uint16 SciGuiPalette::matchColor(GuiPalette *pPal, byte r, byte g, byte b) { uint16 SciPalette::matchColor(Palette *pPal, byte r, byte g, byte b) {
byte found = 0xFF; byte found = 0xFF;
int diff = 0x2FFFF, cdiff; int diff = 0x2FFFF, cdiff;
int16 dr,dg,db; int16 dr,dg,db;
@ -265,40 +265,40 @@ uint16 SciGuiPalette::matchColor(GuiPalette *pPal, byte r, byte g, byte b) {
return found; return found;
} }
void SciGuiPalette::getSys(GuiPalette *pal) { void SciPalette::getSys(Palette *pal) {
if (pal != &_sysPalette) if (pal != &_sysPalette)
memcpy(pal, &_sysPalette,sizeof(GuiPalette)); memcpy(pal, &_sysPalette,sizeof(Palette));
} }
void SciGuiPalette::setOnScreen() { void SciPalette::setOnScreen() {
// if (pal != &_sysPalette) // if (pal != &_sysPalette)
// memcpy(&_sysPalette,pal,sizeof(GuiPalette)); // memcpy(&_sysPalette,pal,sizeof(Palette));
_screen->setPalette(&_sysPalette); _screen->setPalette(&_sysPalette);
} }
void SciGuiPalette::setFlag(uint16 fromColor, uint16 toColor, uint16 flag) { void SciPalette::setFlag(uint16 fromColor, uint16 toColor, uint16 flag) {
uint16 colorNr; uint16 colorNr;
for (colorNr = fromColor; colorNr < toColor; colorNr++) { for (colorNr = fromColor; colorNr < toColor; colorNr++) {
_sysPalette.colors[colorNr].used |= flag; _sysPalette.colors[colorNr].used |= flag;
} }
} }
void SciGuiPalette::unsetFlag(uint16 fromColor, uint16 toColor, uint16 flag) { void SciPalette::unsetFlag(uint16 fromColor, uint16 toColor, uint16 flag) {
uint16 colorNr; uint16 colorNr;
for (colorNr = fromColor; colorNr < toColor; colorNr++) { for (colorNr = fromColor; colorNr < toColor; colorNr++) {
_sysPalette.colors[colorNr].used &= ~flag; _sysPalette.colors[colorNr].used &= ~flag;
} }
} }
void SciGuiPalette::setIntensity(uint16 fromColor, uint16 toColor, uint16 intensity, bool setPalette) { void SciPalette::setIntensity(uint16 fromColor, uint16 toColor, uint16 intensity, bool setPalette) {
memset(&_sysPalette.intensity[0] + fromColor, intensity, toColor - fromColor); memset(&_sysPalette.intensity[0] + fromColor, intensity, toColor - fromColor);
if (setPalette) if (setPalette)
setOnScreen(); setOnScreen();
} }
// Returns true, if palette got changed // Returns true, if palette got changed
bool SciGuiPalette::animate(byte fromColor, byte toColor, int speed) { bool SciPalette::animate(byte fromColor, byte toColor, int speed) {
GuiColor col; Color col;
//byte colorNr; //byte colorNr;
int16 colorCount; int16 colorCount;
uint32 now = g_system->getMillis() * 60 / 1000; uint32 now = g_system->getMillis() * 60 / 1000;
@ -313,7 +313,7 @@ bool SciGuiPalette::animate(byte fromColor, byte toColor, int speed) {
} }
if (scheduleNr == scheduleCount) { if (scheduleNr == scheduleCount) {
// adding a new schedule // adding a new schedule
GuiPalSchedule newSchedule; PalSchedule newSchedule;
newSchedule.from = fromColor; newSchedule.from = fromColor;
newSchedule.schedule = now + ABS(speed); newSchedule.schedule = now + ABS(speed);
_schedules.push_back(newSchedule); _schedules.push_back(newSchedule);
@ -328,14 +328,14 @@ bool SciGuiPalette::animate(byte fromColor, byte toColor, int speed) {
col = _sysPalette.colors[fromColor]; col = _sysPalette.colors[fromColor];
if (fromColor < toColor) { if (fromColor < toColor) {
colorCount = toColor - fromColor - 1; colorCount = toColor - fromColor - 1;
memmove(&_sysPalette.colors[fromColor], &_sysPalette.colors[fromColor + 1], colorCount * sizeof(GuiColor)); memmove(&_sysPalette.colors[fromColor], &_sysPalette.colors[fromColor + 1], colorCount * sizeof(Color));
} }
_sysPalette.colors[toColor - 1] = col; _sysPalette.colors[toColor - 1] = col;
} else { } else {
col = _sysPalette.colors[toColor - 1]; col = _sysPalette.colors[toColor - 1];
if (fromColor < toColor) { if (fromColor < toColor) {
colorCount = toColor - fromColor - 1; colorCount = toColor - fromColor - 1;
memmove(&_sysPalette.colors[fromColor + 1], &_sysPalette.colors[fromColor], colorCount * sizeof(GuiColor)); memmove(&_sysPalette.colors[fromColor + 1], &_sysPalette.colors[fromColor], colorCount * sizeof(Color));
} }
_sysPalette.colors[fromColor] = col; _sysPalette.colors[fromColor] = col;
} }

View file

@ -23,27 +23,27 @@
* *
*/ */
#ifndef SCI_GUI_PALETTE_H #ifndef SCI_GRAPHICS_PALETTE_H
#define SCI_GUI_PALETTE_H #define SCI_GRAPHICS_PALETTE_H
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
class SciGuiScreen; class Screen;
class SciGuiPalette { class SciPalette {
public: public:
SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen, bool autoSetPalette = true); SciPalette(ResourceManager *resMan, Screen *screen, bool autoSetPalette = true);
~SciGuiPalette(); ~SciPalette();
void createFromData(byte *data, GuiPalette *paletteOut); void createFromData(byte *data, Palette *paletteOut);
bool setAmiga(); bool setAmiga();
void setEGA(); void setEGA();
bool setFromResource(GuiResourceId resourceId, uint16 flag); bool setFromResource(GuiResourceId resourceId, uint16 flag);
void set(GuiPalette *sciPal, uint16 flag); void set(Palette *sciPal, uint16 flag);
void merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag); void merge(Palette *pFrom, Palette *pTo, uint16 flag);
uint16 matchColor(GuiPalette *pPal, byte r, byte g, byte b); uint16 matchColor(Palette *pPal, byte r, byte g, byte b);
void getSys(GuiPalette *pal); void getSys(Palette *pal);
void setOnScreen(); void setOnScreen();
@ -52,13 +52,13 @@ public:
void setIntensity(uint16 fromColor, uint16 toColor, uint16 intensity, bool setPalette); void setIntensity(uint16 fromColor, uint16 toColor, uint16 intensity, bool setPalette);
bool animate(byte fromColor, byte toColor, int speed); bool animate(byte fromColor, byte toColor, int speed);
GuiPalette _sysPalette; Palette _sysPalette;
private: private:
SciGuiScreen *_screen; Screen *_screen;
ResourceManager *_resMan; ResourceManager *_resMan;
Common::Array<GuiPalSchedule> _schedules; Common::Array<PalSchedule> _schedules;
}; };
} // End of namespace Sci } // End of namespace Sci

View file

@ -26,14 +26,14 @@
#include "common/stack.h" #include "common/stack.h"
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_picture.h" #include "sci/graphics/picture.h"
namespace Sci { namespace Sci {
SciGuiPicture::SciGuiPicture(ResourceManager *resMan, SciGuiGfx *gfx, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId) SciGuiPicture::SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId)
: _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId) { : _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId) {
assert(resourceId != -1); assert(resourceId != -1);
initData(resourceId); initData(resourceId);
@ -98,7 +98,7 @@ void SciGuiPicture::drawSci11Vga() {
int cel_headerPos = READ_LE_UINT16(inbuffer + 32); int cel_headerPos = READ_LE_UINT16(inbuffer + 32);
int cel_RlePos = READ_LE_UINT16(inbuffer + cel_headerPos + 24); int cel_RlePos = READ_LE_UINT16(inbuffer + cel_headerPos + 24);
int cel_LiteralPos = READ_LE_UINT16(inbuffer + cel_headerPos + 28); int cel_LiteralPos = READ_LE_UINT16(inbuffer + cel_headerPos + 28);
GuiPalette palette; Palette palette;
// Create palette and set it // Create palette and set it
_palette->createFromData(inbuffer + palette_data_ptr, &palette); _palette->createFromData(inbuffer + palette_data_ptr, &palette);
@ -122,7 +122,7 @@ void SciGuiPicture::drawSci32Vga() {
int cel_headerPos = header_size; int cel_headerPos = header_size;
int cel_RlePos = READ_LE_UINT16(inbuffer + cel_headerPos + 24); int cel_RlePos = READ_LE_UINT16(inbuffer + cel_headerPos + 24);
int cel_LiteralPos = READ_LE_UINT16(inbuffer + cel_headerPos + 28); int cel_LiteralPos = READ_LE_UINT16(inbuffer + cel_headerPos + 28);
GuiPalette palette; Palette palette;
// Create palette and set it // Create palette and set it
_palette->createFromData(inbuffer + palette_data_ptr, &palette); _palette->createFromData(inbuffer + palette_data_ptr, &palette);
@ -371,7 +371,7 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
uint16 size; uint16 size;
byte pixel; byte pixel;
int i; int i;
GuiPalette palette; Palette palette;
int16 pattern_Code = 0, pattern_Texture = 0; int16 pattern_Code = 0, pattern_Texture = 0;
memset(&palette, 0, sizeof(palette)); memset(&palette, 0, sizeof(palette));
@ -647,7 +647,7 @@ void SciGuiPicture::vectorGetPatternTexture(byte *data, int &curPos, int16 patte
// Do not replace w/ some generic code. This algo really needs to behave exactly as the one from sierra // Do not replace w/ some generic code. This algo really needs to behave exactly as the one from sierra
void SciGuiPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, byte control) { void SciGuiPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, byte control) {
GuiPort *curPort = _gfx->GetPort(); Port *curPort = _gfx->GetPort();
Common::Stack<Common::Point> stack; Common::Stack<Common::Point> stack;
Common::Point p, p1; Common::Point p, p1;
byte screenMask = _screen->getDrawingMask(color, priority, control); byte screenMask = _screen->getDrawingMask(color, priority, control);

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_PICTURE_H #ifndef SCI_GRAPHICS_PICTURE_H
#define SCI_GUI_PICTURE_H #define SCI_GRAPHICS_PICTURE_H
namespace Sci { namespace Sci {
@ -34,7 +34,7 @@ namespace Sci {
class SciGuiPicture { class SciGuiPicture {
public: public:
SciGuiPicture(ResourceManager *resMan, SciGuiGfx *gfx, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId); SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId);
~SciGuiPicture(); ~SciGuiPicture();
GuiResourceId getResourceId(); GuiResourceId getResourceId();
@ -63,9 +63,9 @@ private:
void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture); void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture);
ResourceManager *_resMan; ResourceManager *_resMan;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
int16 _resourceId; int16 _resourceId;
Resource *_resource; Resource *_resource;

View file

@ -29,21 +29,21 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_portrait.h" #include "sci/graphics/portrait.h"
namespace Sci { namespace Sci {
SciGuiPortrait::SciGuiPortrait(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, Common::String resourceName) Portrait::Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, Common::String resourceName)
: _resMan(resMan), _screen(screen), _palette(palette), _resourceName(resourceName) { : _resMan(resMan), _screen(screen), _palette(palette), _resourceName(resourceName) {
init(); init();
} }
SciGuiPortrait::~SciGuiPortrait() { Portrait::~Portrait() {
} }
void SciGuiPortrait::init() { void Portrait::init() {
// .BIN files are loaded from actors directory and from .\ directory // .BIN files are loaded from actors directory and from .\ directory
// header: // header:
// 3 bytes "WIN" // 3 bytes "WIN"

View file

@ -23,22 +23,22 @@
* *
*/ */
#ifndef SCI_GUI_PORTRAITS_H #ifndef SCI_GRAPHICS_PORTRAITS_H
#define SCI_GUI_PORTRAITS_H #define SCI_GRAPHICS_PORTRAITS_H
namespace Sci { namespace Sci {
class SciGuiPortrait { class Portrait {
public: public:
SciGuiPortrait(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, Common::String resourceName); Portrait(ResourceManager *resMan, Screen *screen, SciPalette *palette, Common::String resourceName);
~SciGuiPortrait(); ~Portrait();
private: private:
void init(); void init();
ResourceManager *_resMan; ResourceManager *_resMan;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
Common::String _resourceName; Common::String _resourceName;
byte *_resourceData; byte *_resourceData;

View file

@ -29,11 +29,11 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
namespace Sci { namespace Sci {
SciGuiScreen::SciGuiScreen(ResourceManager *resMan, int16 width, int16 height, bool upscaledHires) : Screen::Screen(ResourceManager *resMan, int16 width, int16 height, bool upscaledHires) :
_resMan(resMan), _width(width), _height(height), _upscaledHires(upscaledHires) { _resMan(resMan), _width(width), _height(height), _upscaledHires(upscaledHires) {
_pixels = _width * _height; _pixels = _width * _height;
@ -73,25 +73,25 @@ SciGuiScreen::SciGuiScreen(ResourceManager *resMan, int16 width, int16 height, b
initGraphics(_displayWidth, _displayHeight, _displayWidth > 320); initGraphics(_displayWidth, _displayHeight, _displayWidth > 320);
} }
SciGuiScreen::~SciGuiScreen() { Screen::~Screen() {
free(_visualScreen); free(_visualScreen);
free(_priorityScreen); free(_priorityScreen);
free(_controlScreen); free(_controlScreen);
free(_displayScreen); free(_displayScreen);
} }
void SciGuiScreen::copyToScreen() { void Screen::copyToScreen() {
g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight); g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight);
} }
void SciGuiScreen::copyFromScreen(byte *buffer) { void Screen::copyFromScreen(byte *buffer) {
Graphics::Surface *screen; Graphics::Surface *screen;
screen = g_system->lockScreen(); screen = g_system->lockScreen();
memcpy(buffer, screen->pixels, _displayWidth * _displayHeight); memcpy(buffer, screen->pixels, _displayWidth * _displayHeight);
g_system->unlockScreen(); g_system->unlockScreen();
} }
void SciGuiScreen::copyRectToScreen(const Common::Rect &rect) { void Screen::copyRectToScreen(const Common::Rect &rect) {
if (!_upscaledHires) { if (!_upscaledHires) {
g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, rect.left, rect.top, rect.width(), rect.height()); g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, rect.left, rect.top, rect.width(), rect.height());
} else { } else {
@ -99,7 +99,7 @@ void SciGuiScreen::copyRectToScreen(const Common::Rect &rect) {
} }
} }
void SciGuiScreen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y) { void Screen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y) {
if (!_upscaledHires) { if (!_upscaledHires) {
g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, x, y, rect.width(), rect.height()); g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, x, y, rect.width(), rect.height());
} else { } else {
@ -107,7 +107,7 @@ void SciGuiScreen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y)
} }
} }
byte SciGuiScreen::getDrawingMask(byte color, byte prio, byte control) { byte Screen::getDrawingMask(byte color, byte prio, byte control) {
byte flag = 0; byte flag = 0;
if (color != 255) if (color != 255)
flag |= SCI_SCREEN_MASK_VISUAL; flag |= SCI_SCREEN_MASK_VISUAL;
@ -118,7 +118,7 @@ byte SciGuiScreen::getDrawingMask(byte color, byte prio, byte control) {
return flag; return flag;
} }
void SciGuiScreen::putPixel(int x, int y, byte drawMask, byte color, byte priority, byte control) { void Screen::putPixel(int x, int y, byte drawMask, byte color, byte priority, byte control) {
int offset = y * _width + x; int offset = y * _width + x;
if (drawMask & SCI_SCREEN_MASK_VISUAL) { if (drawMask & SCI_SCREEN_MASK_VISUAL) {
@ -141,14 +141,14 @@ void SciGuiScreen::putPixel(int x, int y, byte drawMask, byte color, byte priori
// This will just change a pixel directly on displayscreen. Its supposed to get only used on upscaled-Hires games where // This will just change a pixel directly on displayscreen. Its supposed to get only used on upscaled-Hires games where
// hires content needs to get drawn ONTO the upscaled display screen (like japanese fonts, hires portraits, etc.) // hires content needs to get drawn ONTO the upscaled display screen (like japanese fonts, hires portraits, etc.)
void SciGuiScreen::putPixelOnDisplay(int x, int y, byte color) { void Screen::putPixelOnDisplay(int x, int y, byte color) {
int offset = y * _width + x; int offset = y * _width + x;
_displayScreen[offset] = color; _displayScreen[offset] = color;
} }
// Sierra's Bresenham line drawing // Sierra's Bresenham line drawing
// WARNING: Do not just blindly replace this with Graphics::drawLine(), as it seems to create issues with flood fill // WARNING: Do not just blindly replace this with Graphics::drawLine(), as it seems to create issues with flood fill
void SciGuiScreen::drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) { void Screen::drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) {
int16 left = startPoint.x; int16 left = startPoint.x;
int16 top = startPoint.y; int16 top = startPoint.y;
int16 right = endPoint.x; int16 right = endPoint.x;
@ -210,19 +210,19 @@ void SciGuiScreen::drawLine(Common::Point startPoint, Common::Point endPoint, by
} }
} }
byte SciGuiScreen::getVisual(int x, int y) { byte Screen::getVisual(int x, int y) {
return _visualScreen[y * _width + x]; return _visualScreen[y * _width + x];
} }
byte SciGuiScreen::getPriority(int x, int y) { byte Screen::getPriority(int x, int y) {
return _priorityScreen[y * _width + x]; return _priorityScreen[y * _width + x];
} }
byte SciGuiScreen::getControl(int x, int y) { byte Screen::getControl(int x, int y) {
return _controlScreen[y * _width + x]; return _controlScreen[y * _width + x];
} }
byte SciGuiScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color, byte t_pri, byte t_con) { byte Screen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color, byte t_pri, byte t_con) {
int offset = y * _width + x; int offset = y * _width + x;
byte match = 0; byte match = 0;
@ -235,7 +235,7 @@ byte SciGuiScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color,
return match; return match;
} }
int SciGuiScreen::bitsGetDataSize(Common::Rect rect, byte mask) { int Screen::bitsGetDataSize(Common::Rect rect, byte mask) {
int byteCount = sizeof(rect) + sizeof(mask); int byteCount = sizeof(rect) + sizeof(mask);
int pixels = rect.width() * rect.height(); int pixels = rect.width() * rect.height();
if (mask & SCI_SCREEN_MASK_VISUAL) { if (mask & SCI_SCREEN_MASK_VISUAL) {
@ -261,7 +261,7 @@ int SciGuiScreen::bitsGetDataSize(Common::Rect rect, byte mask) {
return byteCount; return byteCount;
} }
void SciGuiScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { void Screen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) {
memcpy(memoryPtr, (void *)&rect, sizeof(rect)); memoryPtr += sizeof(rect); memcpy(memoryPtr, (void *)&rect, sizeof(rect)); memoryPtr += sizeof(rect);
memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask); memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask);
@ -282,7 +282,7 @@ void SciGuiScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) {
} }
} }
void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { void Screen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) {
int width = rect.width(); int width = rect.width();
int y; int y;
@ -294,7 +294,7 @@ void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memory
} }
} }
void SciGuiScreen::bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr) { void Screen::bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
byte *screen = _displayScreen; byte *screen = _displayScreen;
int width = rect.width(); int width = rect.width();
int y; int y;
@ -313,11 +313,11 @@ void SciGuiScreen::bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
} }
} }
void SciGuiScreen::bitsGetRect(byte *memoryPtr, Common::Rect *destRect) { void Screen::bitsGetRect(byte *memoryPtr, Common::Rect *destRect) {
memcpy((void *)destRect, memoryPtr, sizeof(Common::Rect)); memcpy((void *)destRect, memoryPtr, sizeof(Common::Rect));
} }
void SciGuiScreen::bitsRestore(byte *memoryPtr) { void Screen::bitsRestore(byte *memoryPtr) {
Common::Rect rect; Common::Rect rect;
byte mask; byte mask;
@ -341,7 +341,7 @@ void SciGuiScreen::bitsRestore(byte *memoryPtr) {
} }
} }
void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { void Screen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) {
int width = rect.width(); int width = rect.width();
int y; int y;
@ -353,7 +353,7 @@ void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *
} }
} }
void SciGuiScreen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr) { void Screen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
byte *screen = _displayScreen; byte *screen = _displayScreen;
int width = rect.width(); int width = rect.width();
int y; int y;
@ -372,7 +372,7 @@ void SciGuiScreen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr)
} }
} }
void SciGuiScreen::setPalette(GuiPalette*pal) { void Screen::setPalette(Palette*pal) {
// just copy palette to system // just copy palette to system
byte bpal[4 * 256]; byte bpal[4 * 256];
// Get current palette, update it and put back // Get current palette, update it and put back
@ -388,14 +388,14 @@ void SciGuiScreen::setPalette(GuiPalette*pal) {
g_system->setPalette(bpal, 0, 256); g_system->setPalette(bpal, 0, 256);
} }
void SciGuiScreen::setVerticalShakePos(uint16 shakePos) { void Screen::setVerticalShakePos(uint16 shakePos) {
if (!_upscaledHires) if (!_upscaledHires)
g_system->setShakePos(shakePos); g_system->setShakePos(shakePos);
else else
g_system->setShakePos(shakePos * 2); g_system->setShakePos(shakePos * 2);
} }
void SciGuiScreen::dither(bool addToFlag) { void Screen::dither(bool addToFlag) {
int y, x; int y, x;
byte color, ditheredColor; byte color, ditheredColor;
byte *visualPtr = _visualScreen; byte *visualPtr = _visualScreen;
@ -461,18 +461,18 @@ void SciGuiScreen::dither(bool addToFlag) {
} }
} }
void SciGuiScreen::unditherSetState(bool flag) { void Screen::unditherSetState(bool flag) {
_unditherState = flag; _unditherState = flag;
} }
int16 *SciGuiScreen::unditherGetMemorial() { int16 *Screen::unditherGetMemorial() {
if (_unditherState) if (_unditherState)
return (int16 *)&_unditherMemorial; return (int16 *)&_unditherMemorial;
else else
return NULL; return NULL;
} }
void SciGuiScreen::debugShowMap(int mapNo) { void Screen::debugShowMap(int mapNo) {
// We cannot really support changing maps when in upscaledHires mode // We cannot really support changing maps when in upscaledHires mode
if (_upscaledHires) if (_upscaledHires)
return; return;
@ -494,7 +494,7 @@ void SciGuiScreen::debugShowMap(int mapNo) {
copyToScreen(); copyToScreen();
} }
void SciGuiScreen::scale2x(byte *src, byte *dst, int16 srcWidth, int16 srcHeight) { void Screen::scale2x(byte *src, byte *dst, int16 srcWidth, int16 srcHeight) {
int newWidth = srcWidth * 2; int newWidth = srcWidth * 2;
byte *srcPtr = src; byte *srcPtr = src;

View file

@ -23,11 +23,11 @@
* *
*/ */
#ifndef SCI_GUI_SCREEN_H #ifndef SCI_GRAPHICS_SCREEN_H
#define SCI_GUI_SCREEN_H #define SCI_GRAPHICS_SCREEN_H
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
@ -41,10 +41,10 @@ namespace Sci {
#define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256 #define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256
class SciGuiScreen { class Screen {
public: public:
SciGuiScreen(ResourceManager *resMan, int16 width = 320, int16 height = 200, bool upscaledHires = false); Screen(ResourceManager *resMan, int16 width = 320, int16 height = 200, bool upscaledHires = false);
~SciGuiScreen(); ~Screen();
void copyToScreen(); void copyToScreen();
void copyFromScreen(byte *buffer); void copyFromScreen(byte *buffer);
@ -71,7 +71,7 @@ public:
void bitsGetRect(byte *memoryPtr, Common::Rect *destRect); void bitsGetRect(byte *memoryPtr, Common::Rect *destRect);
void bitsRestore(byte *memoryPtr); void bitsRestore(byte *memoryPtr);
void setPalette(GuiPalette*pal); void setPalette(Palette*pal);
void setVerticalShakePos(uint16 shakePos); void setVerticalShakePos(uint16 shakePos);

View file

@ -29,22 +29,22 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_font.h" #include "sci/graphics/font.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
namespace Sci { namespace Sci {
SciGuiText::SciGuiText(ResourceManager *resMan, SciGuiGfx *gfx, SciGuiScreen *screen) Text::Text(ResourceManager *resMan, Gfx *gfx, Screen *screen)
: _resMan(resMan), _gfx(gfx), _screen(screen) { : _resMan(resMan), _gfx(gfx), _screen(screen) {
init(); init();
} }
SciGuiText::~SciGuiText() { Text::~Text() {
delete _font; delete _font;
} }
void SciGuiText::init() { void Text::init() {
_font = NULL; _font = NULL;
_codeFonts = NULL; _codeFonts = NULL;
_codeFontsCount = 0; _codeFontsCount = 0;
@ -52,26 +52,26 @@ void SciGuiText::init() {
_codeColorsCount = 0; _codeColorsCount = 0;
} }
GuiResourceId SciGuiText::GetFontId() { GuiResourceId Text::GetFontId() {
return _gfx->_curPort->fontId; return _gfx->_curPort->fontId;
} }
SciGuiFont *SciGuiText::GetFont() { Font *Text::GetFont() {
if ((_font == NULL) || (_font->getResourceId() != _gfx->_curPort->fontId)) if ((_font == NULL) || (_font->getResourceId() != _gfx->_curPort->fontId))
_font = new SciGuiFont(_resMan, _gfx->_curPort->fontId); _font = new Font(_resMan, _gfx->_curPort->fontId);
return _font; return _font;
} }
void SciGuiText::SetFont(GuiResourceId fontId) { void Text::SetFont(GuiResourceId fontId) {
if ((_font == NULL) || (_font->getResourceId() != fontId)) if ((_font == NULL) || (_font->getResourceId() != fontId))
_font = new SciGuiFont(_resMan, fontId); _font = new Font(_resMan, fontId);
_gfx->_curPort->fontId = _font->getResourceId(); _gfx->_curPort->fontId = _font->getResourceId();
_gfx->_curPort->fontHeight = _font->getHeight(); _gfx->_curPort->fontHeight = _font->getHeight();
} }
void SciGuiText::CodeSetFonts(int argc, reg_t *argv) { void Text::CodeSetFonts(int argc, reg_t *argv) {
int i; int i;
delete _codeFonts; delete _codeFonts;
@ -82,7 +82,7 @@ void SciGuiText::CodeSetFonts(int argc, reg_t *argv) {
} }
} }
void SciGuiText::CodeSetColors(int argc, reg_t *argv) { void Text::CodeSetColors(int argc, reg_t *argv) {
int i; int i;
delete _codeColors; delete _codeColors;
@ -93,7 +93,7 @@ void SciGuiText::CodeSetColors(int argc, reg_t *argv) {
} }
} }
void SciGuiText::ClearChar(int16 chr) { void Text::ClearChar(int16 chr) {
if (_gfx->_curPort->penMode != 1) if (_gfx->_curPort->penMode != 1)
return; return;
Common::Rect rect; Common::Rect rect;
@ -104,14 +104,14 @@ void SciGuiText::ClearChar(int16 chr) {
_gfx->EraseRect(rect); _gfx->EraseRect(rect);
} }
void SciGuiText::DrawChar(int16 chr) { void Text::DrawChar(int16 chr) {
chr = chr & 0xFF; chr = chr & 0xFF;
ClearChar(chr); ClearChar(chr);
StdChar(chr); StdChar(chr);
_gfx->_curPort->curLeft += GetFont()->getCharWidth(chr); _gfx->_curPort->curLeft += GetFont()->getCharWidth(chr);
} }
void SciGuiText::StdChar(int16 chr) { void Text::StdChar(int16 chr) {
#if 0 #if 0
CResFont*res = getResFont(); CResFont*res = getResFont();
if (res) if (res)
@ -125,7 +125,7 @@ void SciGuiText::StdChar(int16 chr) {
// It will process the encountered code and set new font/set color // 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 // We only support one-digit codes currently, don't know if multi-digit codes are possible
// Returns textcode character count // Returns textcode character count
int16 SciGuiText::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor) { int16 Text::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor) {
const char *textCode = text; const char *textCode = text;
int16 textCodeSize = 0; int16 textCodeSize = 0;
char curCode; char curCode;
@ -168,7 +168,7 @@ int16 SciGuiText::CodeProcessing(const char *&text, GuiResourceId orgFontId, int
} }
// return max # of chars to fit maxwidth with full words // return max # of chars to fit maxwidth with full words
int16 SciGuiText::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) { int16 Text::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) {
char curChar; char curChar;
int16 maxChars = 0, curCharCount = 0; int16 maxChars = 0, curCharCount = 0;
uint16 width = 0; uint16 width = 0;
@ -213,7 +213,7 @@ int16 SciGuiText::GetLongest(const char *text, int16 maxWidth, GuiResourceId org
return maxChars; return maxChars;
} }
void SciGuiText::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { void Text::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) {
unsigned char curChar; unsigned char curChar;
GuiResourceId oldFontId = GetFontId(); GuiResourceId oldFontId = GetFontId();
int16 oldPenColor = _gfx->_curPort->penClr; int16 oldPenColor = _gfx->_curPort->penClr;
@ -246,18 +246,18 @@ void SciGuiText::Width(const char *text, int16 from, int16 len, GuiResourceId or
return; return;
} }
void SciGuiText::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { void Text::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) {
Width(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight); Width(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight);
} }
void SciGuiText::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { void Text::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) {
Show(str, 0, (int16)strlen(str), orgFontId, orgPenColor); Show(str, 0, (int16)strlen(str), orgFontId, orgPenColor);
} }
void SciGuiText::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { void Text::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) {
Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor); Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor);
} }
int16 SciGuiText::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) { int16 Text::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) {
GuiResourceId oldFontId = GetFontId(); GuiResourceId oldFontId = GetFontId();
int16 oldPenColor = _gfx->_curPort->penClr; int16 oldPenColor = _gfx->_curPort->penClr;
int16 charCount; int16 charCount;
@ -299,7 +299,7 @@ int16 SciGuiText::Size(Common::Rect &rect, const char *str, GuiResourceId fontId
} }
// returns maximum font height used // returns maximum font height used
void SciGuiText::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { void Text::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) {
int16 curChar, charWidth; int16 curChar, charWidth;
Common::Rect rect; Common::Rect rect;
@ -338,7 +338,7 @@ void SciGuiText::Draw(const char *text, int16 from, int16 len, GuiResourceId org
} }
// returns maximum font height used // returns maximum font height used
void SciGuiText::Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) { void Text::Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor) {
Common::Rect rect; Common::Rect rect;
rect.top = _gfx->_curPort->curTop; rect.top = _gfx->_curPort->curTop;
@ -350,7 +350,7 @@ void SciGuiText::Show(const char *text, int16 from, int16 len, GuiResourceId org
} }
// Draws a text in rect. // Draws a text in rect.
void SciGuiText::Box(const char *text, int16 bshow, const Common::Rect &rect, GuiTextAlignment alignment, GuiResourceId fontId) { void Text::Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) {
int16 textWidth, textHeight, charCount; int16 textWidth, textHeight, charCount;
int16 offset = 0; int16 offset = 0;
int16 hline = 0; int16 hline = 0;
@ -398,7 +398,7 @@ void SciGuiText::Box(const char *text, int16 bshow, const Common::Rect &rect, Gu
_gfx->PenColor(orgPenColor); _gfx->PenColor(orgPenColor);
} }
void SciGuiText::Draw_String(const char *text) { void Text::Draw_String(const char *text) {
GuiResourceId orgFontId = GetFontId(); GuiResourceId orgFontId = GetFontId();
int16 orgPenColor = _gfx->_curPort->penClr; int16 orgPenColor = _gfx->_curPort->penClr;

View file

@ -23,8 +23,8 @@
* *
*/ */
#ifndef SCI_GUI_TEXT_H #ifndef SCI_GRAPHICS_TEXT_H
#define SCI_GUI_TEXT_H #define SCI_GRAPHICS_TEXT_H
namespace Sci { namespace Sci {
@ -32,16 +32,16 @@ namespace Sci {
#define SCI_TEXT_ALIGNMENT_CENTER 1 #define SCI_TEXT_ALIGNMENT_CENTER 1
#define SCI_TEXT_ALIGNMENT_LEFT 0 #define SCI_TEXT_ALIGNMENT_LEFT 0
class SciGuiGfx; class Gfx;
class SciGuiScreen; class Screen;
class SciGuiFont; class Font;
class SciGuiText { class Text {
public: public:
SciGuiText(ResourceManager *_resMan, SciGuiGfx *gfx, SciGuiScreen *screen); Text(ResourceManager *_resMan, Gfx *gfx, Screen *screen);
~SciGuiText(); ~Text();
GuiResourceId GetFontId(); GuiResourceId GetFontId();
SciGuiFont *GetFont(); Font *GetFont();
void SetFont(GuiResourceId fontId); void SetFont(GuiResourceId fontId);
void CodeSetFonts(int argc, reg_t *argv); void CodeSetFonts(int argc, reg_t *argv);
@ -60,17 +60,17 @@ public:
int16 Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth); int16 Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth);
void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
void Box(const char *text, int16 bshow, const Common::Rect &rect, GuiTextAlignment alignment, GuiResourceId fontId); void Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId);
void Draw_String(const char *text); void Draw_String(const char *text);
SciGuiFont *_font; Font *_font;
private: private:
void init(); void init();
ResourceManager *_resMan; ResourceManager *_resMan;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiScreen *_screen; Screen *_screen;
int _codeFontsCount; int _codeFontsCount;
GuiResourceId *_codeFonts; GuiResourceId *_codeFonts;

View file

@ -31,18 +31,18 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_transitions.h" #include "sci/graphics/transitions.h"
namespace Sci { namespace Sci {
SciGuiTransitions::SciGuiTransitions(SciGui *gui, SciGuiScreen *screen, SciGuiPalette *palette, bool isVGA) Transitions::Transitions(SciGui *gui, Screen *screen, SciPalette *palette, bool isVGA)
: _gui(gui), _screen(screen), _palette(palette), _isVGA(isVGA) { : _gui(gui), _screen(screen), _palette(palette), _isVGA(isVGA) {
init(); init();
} }
SciGuiTransitions::~SciGuiTransitions() { Transitions::~Transitions() {
delete[] _oldScreen; delete[] _oldScreen;
} }
@ -101,7 +101,7 @@ static const GuiTransitionTranslateEntry blackoutTransitionIDs[] = {
{ 255, 255, true } { 255, 255, true }
}; };
void SciGuiTransitions::init() { void Transitions::init() {
_oldScreen = new byte[_screen->_displayHeight * _screen->_displayWidth]; _oldScreen = new byte[_screen->_displayHeight * _screen->_displayWidth];
if (getSciVersion() >= SCI_VERSION_1_LATE) if (getSciVersion() >= SCI_VERSION_1_LATE)
@ -114,14 +114,14 @@ void SciGuiTransitions::init() {
_blackoutFlag = false; _blackoutFlag = false;
} }
void SciGuiTransitions::setup(int16 number, bool blackoutFlag) { void Transitions::setup(int16 number, bool blackoutFlag) {
if (number != -1) { if (number != -1) {
_number = number; _number = number;
_blackoutFlag = blackoutFlag; _blackoutFlag = blackoutFlag;
} }
} }
void SciGuiTransitions::updateScreenAndWait(int msec) { void Transitions::updateScreenAndWait(int msec) {
Common::Event ev; Common::Event ev;
g_system->updateScreen(); g_system->updateScreen();
g_system->delayMillis(msec); g_system->delayMillis(msec);
@ -129,7 +129,7 @@ void SciGuiTransitions::updateScreenAndWait(int msec) {
} }
// will translate a number and return corresponding translationEntry // will translate a number and return corresponding translationEntry
const GuiTransitionTranslateEntry *SciGuiTransitions::translateNumber (int16 number, const GuiTransitionTranslateEntry *tablePtr) { const GuiTransitionTranslateEntry *Transitions::translateNumber (int16 number, const GuiTransitionTranslateEntry *tablePtr) {
while (1) { while (1) {
if (tablePtr->orgId == 255) if (tablePtr->orgId == 255)
return NULL; return NULL;
@ -139,7 +139,7 @@ const GuiTransitionTranslateEntry *SciGuiTransitions::translateNumber (int16 num
} }
} }
void SciGuiTransitions::doit(Common::Rect picRect) { void Transitions::doit(Common::Rect picRect) {
const GuiTransitionTranslateEntry *translationEntry = _translationTable; const GuiTransitionTranslateEntry *translationEntry = _translationTable;
_picRect = picRect; _picRect = picRect;
@ -151,7 +151,7 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
_number = translationEntry->newId; _number = translationEntry->newId;
_blackoutFlag = translationEntry->blackoutFlag; _blackoutFlag = translationEntry->blackoutFlag;
} else { } else {
warning("SciGuiTransitions: old ID %d not supported", _number); warning("Transitions: old ID %d not supported", _number);
_number = SCI_TRANSITIONS_NONE; _number = SCI_TRANSITIONS_NONE;
_blackoutFlag = false; _blackoutFlag = false;
} }
@ -163,7 +163,7 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
if (translationEntry) { if (translationEntry) {
doTransition(translationEntry->newId, true); doTransition(translationEntry->newId, true);
} else { } else {
warning("SciGuiTransitions: ID %d not listed in blackoutTransitionIDs", _number); warning("Transitions: ID %d not listed in blackoutTransitionIDs", _number);
} }
} }
@ -182,7 +182,7 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
// This may get called twice, if blackoutFlag is set. It will get once called with blackoutFlag set and another time // This may get called twice, if blackoutFlag is set. It will get once called with blackoutFlag set and another time
// with no blackoutFlag. // with no blackoutFlag.
void SciGuiTransitions::doTransition(int16 number, bool blackoutFlag) { void Transitions::doTransition(int16 number, bool blackoutFlag) {
if (number != SCI_TRANSITIONS_FADEPALETTE) { if (number != SCI_TRANSITIONS_FADEPALETTE) {
setNewPalette(blackoutFlag); setNewPalette(blackoutFlag);
} }
@ -241,25 +241,25 @@ void SciGuiTransitions::doTransition(int16 number, bool blackoutFlag) {
break; break;
default: default:
warning("SciGuiTransitions: ID %d not implemented", number); warning("Transitions: ID %d not implemented", number);
setNewScreen(blackoutFlag); setNewScreen(blackoutFlag);
} }
} }
void SciGuiTransitions::setNewPalette(bool blackoutFlag) { void Transitions::setNewPalette(bool blackoutFlag) {
if (!blackoutFlag) if (!blackoutFlag)
if (_isVGA) if (_isVGA)
_palette->setOnScreen(); _palette->setOnScreen();
} }
void SciGuiTransitions::setNewScreen(bool blackoutFlag) { void Transitions::setNewScreen(bool blackoutFlag) {
if (!blackoutFlag) { if (!blackoutFlag) {
_screen->copyRectToScreen(_picRect); _screen->copyRectToScreen(_picRect);
g_system->updateScreen(); g_system->updateScreen();
} }
} }
void SciGuiTransitions::copyRectToScreen(const Common::Rect rect, bool blackoutFlag) { void Transitions::copyRectToScreen(const Common::Rect rect, bool blackoutFlag) {
if (!blackoutFlag) { if (!blackoutFlag) {
_screen->copyRectToScreen(rect); _screen->copyRectToScreen(rect);
} else { } else {
@ -270,7 +270,7 @@ void SciGuiTransitions::copyRectToScreen(const Common::Rect rect, bool blackoutF
} }
// Note: dont do too many steps in here, otherwise cpu will crap out because of the load // Note: dont do too many steps in here, otherwise cpu will crap out because of the load
void SciGuiTransitions::fadeOut() { void Transitions::fadeOut() {
byte oldPalette[4 * 256], workPalette[4 * 256]; byte oldPalette[4 * 256], workPalette[4 * 256];
int16 stepNr, colorNr; int16 stepNr, colorNr;
@ -288,7 +288,7 @@ void SciGuiTransitions::fadeOut() {
} }
// Note: dont do too many steps in here, otherwise cpu will crap out because of the load // Note: dont do too many steps in here, otherwise cpu will crap out because of the load
void SciGuiTransitions::fadeIn() { void Transitions::fadeIn() {
int16 stepNr; int16 stepNr;
for (stepNr = 0; stepNr <= 100; stepNr += 10) { for (stepNr = 0; stepNr <= 100; stepNr += 10) {
@ -299,7 +299,7 @@ void SciGuiTransitions::fadeIn() {
// pixelates the new picture over the old one - works against the whole screen // pixelates the new picture over the old one - works against the whole screen
// TODO: it seems this needs to get applied on _picRect only if possible // TODO: it seems this needs to get applied on _picRect only if possible
void SciGuiTransitions::pixelation (bool blackoutFlag) { void Transitions::pixelation (bool blackoutFlag) {
uint16 mask = 0x40, stepNr = 0; uint16 mask = 0x40, stepNr = 0;
Common::Rect pixelRect; Common::Rect pixelRect;
@ -321,7 +321,7 @@ void SciGuiTransitions::pixelation (bool blackoutFlag) {
// like pixelation but uses 8x8 blocks - works against the whole screen // like pixelation but uses 8x8 blocks - works against the whole screen
// TODO: it seems this needs to get applied on _picRect only if possible // TODO: it seems this needs to get applied on _picRect only if possible
void SciGuiTransitions::blocks(bool blackoutFlag) { void Transitions::blocks(bool blackoutFlag) {
uint16 mask = 0x40, stepNr = 0; uint16 mask = 0x40, stepNr = 0;
Common::Rect blockRect; Common::Rect blockRect;
@ -342,7 +342,7 @@ void SciGuiTransitions::blocks(bool blackoutFlag) {
} }
// directly shows new screen starting up/down/left/right and going to the opposite direction - works on _picRect area only // directly shows new screen starting up/down/left/right and going to the opposite direction - works on _picRect area only
void SciGuiTransitions::straight(int16 number, bool blackoutFlag) { void Transitions::straight(int16 number, bool blackoutFlag) {
int16 stepNr = 0; int16 stepNr = 0;
Common::Rect newScreenRect = _picRect; Common::Rect newScreenRect = _picRect;
@ -394,7 +394,7 @@ void SciGuiTransitions::straight(int16 number, bool blackoutFlag) {
} }
// scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area only // scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area only
void SciGuiTransitions::scroll(int16 number) { void Transitions::scroll(int16 number) {
int16 screenWidth, screenHeight; int16 screenWidth, screenHeight;
byte *oldScreenPtr; byte *oldScreenPtr;
int16 stepNr = 0; int16 stepNr = 0;
@ -471,7 +471,7 @@ void SciGuiTransitions::scroll(int16 number) {
} }
// vertically displays new screen starting from center - works on _picRect area only // vertically displays new screen starting from center - works on _picRect area only
void SciGuiTransitions::verticalRollFromCenter(bool blackoutFlag) { void Transitions::verticalRollFromCenter(bool blackoutFlag) {
Common::Rect leftRect = Common::Rect(_picRect.left + (_picRect.width() / 2) -1, _picRect.top, _picRect.left + (_picRect.width() / 2), _picRect.bottom); Common::Rect leftRect = Common::Rect(_picRect.left + (_picRect.width() / 2) -1, _picRect.top, _picRect.left + (_picRect.width() / 2), _picRect.bottom);
Common::Rect rightRect = Common::Rect(leftRect.right, _picRect.top, leftRect.right + 1, _picRect.bottom); Common::Rect rightRect = Common::Rect(leftRect.right, _picRect.top, leftRect.right + 1, _picRect.bottom);
@ -487,7 +487,7 @@ void SciGuiTransitions::verticalRollFromCenter(bool blackoutFlag) {
} }
// vertically displays new screen starting from edges - works on _picRect area only // vertically displays new screen starting from edges - works on _picRect area only
void SciGuiTransitions::verticalRollToCenter(bool blackoutFlag) { void Transitions::verticalRollToCenter(bool blackoutFlag) {
Common::Rect leftRect = Common::Rect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom); Common::Rect leftRect = Common::Rect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom);
Common::Rect rightRect = Common::Rect(leftRect.right - 1, _picRect.top, leftRect.right, _picRect.bottom); Common::Rect rightRect = Common::Rect(leftRect.right - 1, _picRect.top, leftRect.right, _picRect.bottom);
@ -499,7 +499,7 @@ void SciGuiTransitions::verticalRollToCenter(bool blackoutFlag) {
} }
// horizontally displays new screen starting from center - works on _picRect area only // horizontally displays new screen starting from center - works on _picRect area only
void SciGuiTransitions::horizontalRollFromCenter(bool blackoutFlag) { void Transitions::horizontalRollFromCenter(bool blackoutFlag) {
Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top + (_picRect.height() / 2) - 1, _picRect.right, _picRect.top + (_picRect.height() / 2)); Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top + (_picRect.height() / 2) - 1, _picRect.right, _picRect.top + (_picRect.height() / 2));
Common::Rect lowerRect = Common::Rect(upperRect.left, upperRect.bottom, upperRect.right, upperRect.bottom + 1); Common::Rect lowerRect = Common::Rect(upperRect.left, upperRect.bottom, upperRect.right, upperRect.bottom + 1);
@ -515,7 +515,7 @@ void SciGuiTransitions::horizontalRollFromCenter(bool blackoutFlag) {
} }
// horizontally displays new screen starting from upper and lower edge - works on _picRect area only // horizontally displays new screen starting from upper and lower edge - works on _picRect area only
void SciGuiTransitions::horizontalRollToCenter(bool blackoutFlag) { void Transitions::horizontalRollToCenter(bool blackoutFlag) {
Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1); Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1);
Common::Rect lowerRect = Common::Rect(upperRect.left, _picRect.bottom - 1, upperRect.right, _picRect.bottom); Common::Rect lowerRect = Common::Rect(upperRect.left, _picRect.bottom - 1, upperRect.right, _picRect.bottom);
@ -528,7 +528,7 @@ void SciGuiTransitions::horizontalRollToCenter(bool blackoutFlag) {
// diagonally displays new screen starting from center - works on _picRect area only // diagonally displays new screen starting from center - works on _picRect area only
// assumes that height of rect is larger than width // assumes that height of rect is larger than width
void SciGuiTransitions::diagonalRollFromCenter(bool blackoutFlag) { void Transitions::diagonalRollFromCenter(bool blackoutFlag) {
int16 halfHeight = _picRect.height() / 2; int16 halfHeight = _picRect.height() / 2;
Common::Rect upperRect(_picRect.left + halfHeight - 2, _picRect.top + halfHeight, _picRect.right - halfHeight + 1, _picRect.top + halfHeight + 1); Common::Rect upperRect(_picRect.left + halfHeight - 2, _picRect.top + halfHeight, _picRect.right - halfHeight + 1, _picRect.top + halfHeight + 1);
Common::Rect lowerRect(upperRect.left, upperRect.top, upperRect.right, upperRect.bottom); Common::Rect lowerRect(upperRect.left, upperRect.top, upperRect.right, upperRect.bottom);
@ -558,7 +558,7 @@ void SciGuiTransitions::diagonalRollFromCenter(bool blackoutFlag) {
// diagonally displays new screen starting from edges - works on _picRect area only // diagonally displays new screen starting from edges - works on _picRect area only
// assumes that height of rect is larger than width // assumes that height of rect is larger than width
void SciGuiTransitions::diagonalRollToCenter(bool blackoutFlag) { void Transitions::diagonalRollToCenter(bool blackoutFlag) {
Common::Rect upperRect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1); Common::Rect upperRect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1);
Common::Rect lowerRect(_picRect.left, _picRect.bottom - 1, _picRect.right, _picRect.bottom); Common::Rect lowerRect(_picRect.left, _picRect.bottom - 1, _picRect.right, _picRect.bottom);
Common::Rect leftRect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom); Common::Rect leftRect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom);

View file

@ -23,10 +23,10 @@
* *
*/ */
#ifndef SCI_GUI_TRANSITIONS_H #ifndef SCI_GRAPHICS_TRANSITIONS_H
#define SCI_GUI_TRANSITIONS_H #define SCI_GRAPHICS_TRANSITIONS_H
#include "sci/graphics/gui_helpers.h" #include "sci/graphics/helpers.h"
namespace Sci { namespace Sci {
@ -59,11 +59,11 @@ enum {
SCI_TRANSITIONS_HORIZONTALROLL_TOCENTER = 301 SCI_TRANSITIONS_HORIZONTALROLL_TOCENTER = 301
}; };
class SciGuiScreen; class Screen;
class SciGuiTransitions { class Transitions {
public: public:
SciGuiTransitions(SciGui *gui, SciGuiScreen *screen, SciGuiPalette *palette, bool isVGA); Transitions(SciGui *gui, Screen *screen, SciPalette *palette, bool isVGA);
~SciGuiTransitions(); ~Transitions();
void setup(int16 number, bool blackoutFlag); void setup(int16 number, bool blackoutFlag);
void doit(Common::Rect picRect); void doit(Common::Rect picRect);
@ -90,8 +90,8 @@ private:
void updateScreenAndWait(int msec); void updateScreenAndWait(int msec);
SciGui *_gui; SciGui *_gui;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
bool _isVGA; bool _isVGA;
const GuiTransitionTranslateEntry *_translationTable; const GuiTransitionTranslateEntry *_translationTable;

View file

@ -25,20 +25,20 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_view.h" #include "sci/graphics/view.h"
namespace Sci { namespace Sci {
SciGuiView::SciGuiView(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId) View::View(ResourceManager *resMan, Screen *screen, SciPalette *palette, GuiResourceId resourceId)
: _resMan(resMan), _screen(screen), _palette(palette), _resourceId(resourceId) { : _resMan(resMan), _screen(screen), _palette(palette), _resourceId(resourceId) {
assert(resourceId != -1); assert(resourceId != -1);
initData(resourceId); initData(resourceId);
} }
SciGuiView::~SciGuiView() { View::~View() {
// Iterate through the loops // Iterate through the loops
for (uint16 loopNum = 0; loopNum < _loopCount; loopNum++) { for (uint16 loopNum = 0; loopNum < _loopCount; loopNum++) {
// and through the cells of each loop // and through the cells of each loop
@ -56,7 +56,7 @@ static const byte EGAmappingStraight[SCI_VIEW_EGAMAPPING_SIZE] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
}; };
void SciGuiView::initData(GuiResourceId resourceId) { void View::initData(GuiResourceId resourceId) {
_resource = _resMan->findResource(ResourceId(kResourceTypeView, resourceId), true); _resource = _resMan->findResource(ResourceId(kResourceTypeView, resourceId), true);
if (!_resource) { if (!_resource) {
error("view resource %d not found", resourceId); error("view resource %d not found", resourceId);
@ -65,7 +65,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
byte *celData, *loopData; byte *celData, *loopData;
uint16 celOffset; uint16 celOffset;
sciViewCelInfo *cel; CelInfo *cel;
uint16 celCount = 0; uint16 celCount = 0;
uint16 mirrorBits = 0; uint16 mirrorBits = 0;
uint16 palOffset = 0; uint16 palOffset = 0;
@ -120,7 +120,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
} }
} }
_loop = new sciViewLoopInfo[_loopCount]; _loop = new LoopInfo[_loopCount];
for (loopNo = 0; loopNo < _loopCount; loopNo++) { for (loopNo = 0; loopNo < _loopCount; loopNo++) {
loopData = _resourceData + READ_LE_UINT16(_resourceData + 8 + loopNo * 2); loopData = _resourceData + READ_LE_UINT16(_resourceData + 8 + loopNo * 2);
// CelCount:WORD Unknown:WORD CelOffset0:WORD CelOffset1:WORD... // CelCount:WORD Unknown:WORD CelOffset0:WORD CelOffset1:WORD...
@ -131,7 +131,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
mirrorBits >>= 1; mirrorBits >>= 1;
// read cel info // read cel info
_loop[loopNo].cel = new sciViewCelInfo[celCount]; _loop[loopNo].cel = new CelInfo[celCount];
for (celNo = 0; celNo < celCount; celNo++) { for (celNo = 0; celNo < celCount; celNo++) {
celOffset = READ_LE_UINT16(loopData + 4 + celNo * 2); celOffset = READ_LE_UINT16(loopData + 4 + celNo * 2);
celData = _resourceData + celOffset; celData = _resourceData + celOffset;
@ -184,7 +184,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
_embeddedPal = true; _embeddedPal = true;
} }
_loop = new sciViewLoopInfo[_loopCount]; _loop = new LoopInfo[_loopCount];
for (loopNo = 0; loopNo < _loopCount; loopNo++) { for (loopNo = 0; loopNo < _loopCount; loopNo++) {
loopData = _resourceData + headerSize + (loopNo * loopSize); loopData = _resourceData + headerSize + (loopNo * loopSize);
@ -204,7 +204,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
celData = _resourceData + READ_LE_UINT16(loopData + 14); celData = _resourceData + READ_LE_UINT16(loopData + 14);
// read cel info // read cel info
_loop[loopNo].cel = new sciViewCelInfo[celCount]; _loop[loopNo].cel = new CelInfo[celCount];
for (celNo = 0; celNo < celCount; celNo++) { for (celNo = 0; celNo < celCount; celNo++) {
cel = &_loop[loopNo].cel[celNo]; cel = &_loop[loopNo].cel[celNo];
cel->width = READ_LE_UINT16(celData); cel->width = READ_LE_UINT16(celData);
@ -229,35 +229,35 @@ void SciGuiView::initData(GuiResourceId resourceId) {
} }
} }
GuiResourceId SciGuiView::getResourceId() { GuiResourceId View::getResourceId() {
return _resourceId; return _resourceId;
} }
int16 SciGuiView::getWidth(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { int16 View::getWidth(LoopNo loopNo, CelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1); celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? _loop[loopNo].cel[celNo].width : 0; return _loopCount ? _loop[loopNo].cel[celNo].width : 0;
} }
int16 SciGuiView::getHeight(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { int16 View::getHeight(LoopNo loopNo, CelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1); celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? _loop[loopNo].cel[celNo].height : 0; return _loopCount ? _loop[loopNo].cel[celNo].height : 0;
} }
sciViewCelInfo *SciGuiView::getCelInfo(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { CelInfo *View::getCelInfo(LoopNo loopNo, CelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1); celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
return _loopCount ? &_loop[loopNo].cel[celNo] : NULL; return _loopCount ? &_loop[loopNo].cel[celNo] : NULL;
} }
sciViewLoopInfo *SciGuiView::getLoopInfo(GuiViewLoopNo loopNo) { LoopInfo *View::getLoopInfo(LoopNo loopNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1); loopNo = CLIP<int16>(loopNo, 0, _loopCount - 1);
return _loopCount ? &_loop[loopNo] : NULL; return _loopCount ? &_loop[loopNo] : NULL;
} }
void SciGuiView::getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect) { void View::getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect) {
sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); CelInfo *celInfo = getCelInfo(loopNo, celNo);
if (celInfo) { if (celInfo) {
outRect->left = x + celInfo->displaceX - (celInfo->width >> 1); outRect->left = x + celInfo->displaceX - (celInfo->width >> 1);
outRect->right = outRect->left + celInfo->width; outRect->right = outRect->left + celInfo->width;
@ -266,8 +266,8 @@ void SciGuiView::getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, i
} }
} }
void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPtr, uint16 pixelCount) { void View::unpackCel(LoopNo loopNo, CelNo celNo, byte *outPtr, uint16 pixelCount) {
sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); CelInfo *celInfo = getCelInfo(loopNo, celNo);
byte *rlePtr; byte *rlePtr;
byte *literalPtr; byte *literalPtr;
uint16 pixelNo = 0, runLength; uint16 pixelNo = 0, runLength;
@ -354,7 +354,7 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt
error("Unable to decompress view"); error("Unable to decompress view");
} }
byte *SciGuiView::getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo) { byte *View::getBitmap(LoopNo loopNo, CelNo celNo) {
loopNo = CLIP<int16>(loopNo, 0, _loopCount -1); loopNo = CLIP<int16>(loopNo, 0, _loopCount -1);
celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1); celNo = CLIP<int16>(celNo, 0, _loop[loopNo].celCount - 1);
if (_loop[loopNo].cel[celNo].rawBitmap) if (_loop[loopNo].cel[celNo].rawBitmap)
@ -388,7 +388,7 @@ byte *SciGuiView::getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo) {
// Called after unpacking an EGA cel, this will try to undither (parts) of the cel if the dithering in here // Called after unpacking an EGA cel, this will try to undither (parts) of the cel if the dithering in here
// matches dithering used by the current picture // matches dithering used by the current picture
void SciGuiView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clearKey) { void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clearKey) {
int16 *unditherMemorial = _screen->unditherGetMemorial(); int16 *unditherMemorial = _screen->unditherGetMemorial();
// It makes no sense to go further, if no memorial data from current picture is available // It makes no sense to go further, if no memorial data from current picture is available
@ -461,9 +461,9 @@ void SciGuiView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte
} }
} }
void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight) { void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight) {
GuiPalette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo); CelInfo *celInfo = getCelInfo(loopNo, celNo);
byte *bitmap = getBitmap(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo);
int16 celHeight = celInfo->height, celWidth = celInfo->width; int16 celHeight = celInfo->height, celWidth = celInfo->width;
int16 width, height; int16 width, height;
@ -506,7 +506,7 @@ void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect cli
} }
} }
GuiPalette *SciGuiView::getPalette() { Palette *View::getPalette() {
return _embeddedPal ? &_viewPalette : &_palette->_sysPalette; return _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
} }

View file

@ -23,12 +23,12 @@
* *
*/ */
#ifndef SCI_GUI_VIEW_H #ifndef SCI_GRAPHICS_VIEW_H
#define SCI_GUI_VIEW_H #define SCI_GRAPHICS_VIEW_H
namespace Sci { namespace Sci {
struct sciViewCelInfo { struct CelInfo {
int16 width, height; int16 width, height;
char displaceX; char displaceX;
byte displaceY; byte displaceY;
@ -39,49 +39,49 @@ struct sciViewCelInfo {
byte *rawBitmap; byte *rawBitmap;
}; };
struct sciViewLoopInfo { struct LoopInfo {
bool mirrorFlag; bool mirrorFlag;
uint16 celCount; uint16 celCount;
sciViewCelInfo *cel; CelInfo *cel;
}; };
#define SCI_VIEW_EGAMAPPING_SIZE 16 #define SCI_VIEW_EGAMAPPING_SIZE 16
#define SCI_VIEW_EGAMAPPING_COUNT 8 #define SCI_VIEW_EGAMAPPING_COUNT 8
class SciGuiView { class View {
public: public:
SciGuiView(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId); View(ResourceManager *resMan, Screen *screen, SciPalette *palette, GuiResourceId resourceId);
~SciGuiView(); ~View();
GuiResourceId getResourceId(); GuiResourceId getResourceId();
int16 getWidth(GuiViewLoopNo loopNo, GuiViewCelNo celNo); int16 getWidth(LoopNo loopNo, CelNo celNo);
int16 getHeight(GuiViewLoopNo loopNo, GuiViewCelNo celNo); int16 getHeight(LoopNo loopNo, CelNo celNo);
sciViewCelInfo *getCelInfo(GuiViewLoopNo loopNo, GuiViewCelNo celNo); CelInfo *getCelInfo(LoopNo loopNo, CelNo celNo);
sciViewLoopInfo *getLoopInfo(GuiViewLoopNo loopNo); LoopInfo *getLoopInfo(LoopNo loopNo);
void getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); void getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo); byte *getBitmap(LoopNo loopNo, CelNo celNo);
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1); void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1);
uint16 getLoopCount() const { return _loopCount; } uint16 getLoopCount() const { return _loopCount; }
uint16 getCelCount(GuiViewLoopNo loopNo) { return _loop[loopNo].celCount; } uint16 getCelCount(LoopNo loopNo) { return _loop[loopNo].celCount; }
GuiPalette *getPalette(); Palette *getPalette();
private: private:
void initData(GuiResourceId resourceId); void initData(GuiResourceId resourceId);
void unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPtr, uint16 pixelCount); void unpackCel(LoopNo loopNo, CelNo celNo, byte *outPtr, uint16 pixelCount);
void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey); void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey);
ResourceManager *_resMan; ResourceManager *_resMan;
SciGuiScreen *_screen; Screen *_screen;
SciGuiPalette *_palette; SciPalette *_palette;
GuiResourceId _resourceId; GuiResourceId _resourceId;
Resource *_resource; Resource *_resource;
byte *_resourceData; byte *_resourceData;
uint16 _loopCount; uint16 _loopCount;
sciViewLoopInfo *_loop; LoopInfo *_loop;
bool _embeddedPal; bool _embeddedPal;
GuiPalette _viewPalette; Palette _viewPalette;
byte *_EGAmapping; byte *_EGAmapping;
}; };

View file

@ -27,11 +27,11 @@
#include "sci/sci.h" #include "sci/sci.h"
#include "sci/engine/state.h" #include "sci/engine/state.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/gui_gfx.h" #include "sci/graphics/gfx.h"
#include "sci/graphics/gui_animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/gui_text.h" #include "sci/graphics/text.h"
#include "sci/graphics/gui_windowmgr.h" #include "sci/graphics/windowmgr.h"
namespace Sci { namespace Sci {
@ -44,18 +44,18 @@ enum {
SCI_WINDOWMGR_STYLE_USER = (1 << 7) SCI_WINDOWMGR_STYLE_USER = (1 << 7)
}; };
SciGuiWindowMgr::SciGuiWindowMgr(SciGui *gui, SciGuiScreen *screen, SciGuiGfx *gfx, SciGuiText *text) WindowMgr::WindowMgr(SciGui *gui, Screen *screen, Gfx *gfx, Text *text)
: _gui(gui), _screen(screen), _gfx(gfx), _text(text) { : _gui(gui), _screen(screen), _gfx(gfx), _text(text) {
} }
SciGuiWindowMgr::~SciGuiWindowMgr() { WindowMgr::~WindowMgr() {
// TODO: Clear _windowList and delete all stuff in it? // TODO: Clear _windowList and delete all stuff in it?
} }
void SciGuiWindowMgr::init(Common::String gameId) { void WindowMgr::init(Common::String gameId) {
int16 offTop = 10; int16 offTop = 10;
_wmgrPort = new GuiPort(1); _wmgrPort = new Port(1);
_windowsById.resize(2); _windowsById.resize(2);
_windowsById[0] = _wmgrPort; // wmgrPort is supposed to be accessible via id 0 _windowsById[0] = _wmgrPort; // wmgrPort is supposed to be accessible via id 0
_windowsById[1] = _wmgrPort; // but wmgrPort may not actually have id 0, so we assign id 1 (as well) _windowsById[1] = _wmgrPort; // but wmgrPort may not actually have id 0, so we assign id 1 (as well)
@ -81,25 +81,25 @@ void SciGuiWindowMgr::init(Common::String gameId) {
_picWind = NewWindow(Common::Rect(0, offTop, _screen->_width, _screen->_height), 0, 0, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true); _picWind = NewWindow(Common::Rect(0, offTop, _screen->_width, _screen->_height), 0, 0, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true);
} }
int16 SciGuiWindowMgr::isFrontWindow(GuiWindow *pWnd) { int16 WindowMgr::isFrontWindow(Window *pWnd) {
return _windowList.back() == pWnd; return _windowList.back() == pWnd;
} }
void SciGuiWindowMgr::BeginUpdate(GuiWindow *wnd) { void WindowMgr::BeginUpdate(Window *wnd) {
GuiPort *oldPort = _gfx->SetPort(_wmgrPort); Port *oldPort = _gfx->SetPort(_wmgrPort);
PortList::iterator it = _windowList.reverse_begin(); PortList::iterator it = _windowList.reverse_begin();
const PortList::iterator end = Common::find(_windowList.begin(), _windowList.end(), wnd); const PortList::iterator end = Common::find(_windowList.begin(), _windowList.end(), wnd);
while (it != end) { while (it != end) {
// FIXME: We also store GuiPort objects in the window list. // FIXME: We also store Port objects in the window list.
// We should add a check that we really only pass windows here... // We should add a check that we really only pass windows here...
UpdateWindow((GuiWindow *)*it); UpdateWindow((Window *)*it);
--it; --it;
} }
_gfx->SetPort(oldPort); _gfx->SetPort(oldPort);
} }
void SciGuiWindowMgr::EndUpdate(GuiWindow *wnd) { void WindowMgr::EndUpdate(Window *wnd) {
GuiPort *oldPort = _gfx->SetPort(_wmgrPort); Port *oldPort = _gfx->SetPort(_wmgrPort);
const PortList::iterator end = _windowList.end(); const PortList::iterator end = _windowList.end();
PortList::iterator it = Common::find(_windowList.begin(), end, wnd); PortList::iterator it = Common::find(_windowList.begin(), end, wnd);
@ -107,15 +107,15 @@ void SciGuiWindowMgr::EndUpdate(GuiWindow *wnd) {
assert(it != end); assert(it != end);
while (++it != end) { while (++it != end) {
// FIXME: We also store GuiPort objects in the window list. // FIXME: We also store Port objects in the window list.
// We should add a check that we really only pass windows here... // We should add a check that we really only pass windows here...
UpdateWindow((GuiWindow *)*it); UpdateWindow((Window *)*it);
} }
_gfx->SetPort(oldPort); _gfx->SetPort(oldPort);
} }
GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw) { Window *WindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw) {
// Find an unused window/port id // Find an unused window/port id
uint id = 1; uint id = 1;
while (id < _windowsById.size() && _windowsById[id]) { while (id < _windowsById.size() && _windowsById[id]) {
@ -125,7 +125,7 @@ GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Re
_windowsById.push_back(0); _windowsById.push_back(0);
assert(0 < id && id < 0xFFFF); assert(0 < id && id < 0xFFFF);
GuiWindow *pwnd = new GuiWindow(id); Window *pwnd = new Window(id);
Common::Rect r; Common::Rect r;
if (!pwnd) { if (!pwnd) {
@ -195,20 +195,20 @@ GuiWindow *SciGuiWindowMgr::NewWindow(const Common::Rect &dims, const Common::Re
if (draw) if (draw)
DrawWindow(pwnd); DrawWindow(pwnd);
_gfx->SetPort((GuiPort *)pwnd); _gfx->SetPort((Port *)pwnd);
_gfx->SetOrigin(pwnd->rect.left, pwnd->rect.top + _wmgrPort->top); _gfx->SetOrigin(pwnd->rect.left, pwnd->rect.top + _wmgrPort->top);
pwnd->rect.moveTo(0, 0); pwnd->rect.moveTo(0, 0);
return pwnd; return pwnd;
} }
void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) { void WindowMgr::DrawWindow(Window *pWnd) {
if (pWnd->bDrawn) if (pWnd->bDrawn)
return; return;
Common::Rect r; Common::Rect r;
int16 wndStyle = pWnd->wndStyle; int16 wndStyle = pWnd->wndStyle;
pWnd->bDrawn = true; pWnd->bDrawn = true;
GuiPort *oldport = _gfx->SetPort(_wmgrPort); Port *oldport = _gfx->SetPort(_wmgrPort);
_gfx->PenColor(0); _gfx->PenColor(0);
if ((wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT) == 0) { if ((wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT) == 0) {
pWnd->hSaved1 = _gfx->BitsSave(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL); pWnd->hSaved1 = _gfx->BitsSave(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL);
@ -254,7 +254,7 @@ void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) {
_gfx->SetPort(oldport); _gfx->SetPort(oldport);
} }
void SciGuiWindowMgr::DisposeWindow(GuiWindow *pWnd, bool reanimate) { void WindowMgr::DisposeWindow(Window *pWnd, bool reanimate) {
_gfx->SetPort(_wmgrPort); _gfx->SetPort(_wmgrPort);
_gfx->BitsRestore(pWnd->hSaved1); _gfx->BitsRestore(pWnd->hSaved1);
_gfx->BitsRestore(pWnd->hSaved2); _gfx->BitsRestore(pWnd->hSaved2);
@ -268,8 +268,8 @@ void SciGuiWindowMgr::DisposeWindow(GuiWindow *pWnd, bool reanimate) {
delete pWnd; delete pWnd;
} }
void SciGuiWindowMgr::UpdateWindow(GuiWindow *wnd) { void WindowMgr::UpdateWindow(Window *wnd) {
GuiMemoryHandle handle; MemoryHandle handle;
if (wnd->saveScreenMask && wnd->bDrawn) { if (wnd->saveScreenMask && wnd->bDrawn) {
handle = _gfx->BitsSave(wnd->restoreRect, SCI_SCREEN_MASK_VISUAL); handle = _gfx->BitsSave(wnd->restoreRect, SCI_SCREEN_MASK_VISUAL);

View file

@ -23,47 +23,47 @@
* *
*/ */
#ifndef SCI_GUI_WINDOWMGR_H #ifndef SCI_GRAPHICS_WINDOWMGR_H
#define SCI_GUI_WINDOWMGR_H #define SCI_GRAPHICS_WINDOWMGR_H
#include "common/list.h" #include "common/list.h"
#include "common/array.h" #include "common/array.h"
namespace Sci { namespace Sci {
class SciGuiWindowMgr { class WindowMgr {
public: public:
SciGuiWindowMgr(SciGui *gui, SciGuiScreen *screen, SciGuiGfx *gfx, SciGuiText *text); WindowMgr(SciGui *gui, Screen *screen, Gfx *gfx, Text *text);
~SciGuiWindowMgr(); ~WindowMgr();
void init(Common::String gameId); void init(Common::String gameId);
int16 isFrontWindow(GuiWindow *wnd); int16 isFrontWindow(Window *wnd);
void BeginUpdate(GuiWindow *wnd); void BeginUpdate(Window *wnd);
void EndUpdate(GuiWindow *wnd); void EndUpdate(Window *wnd);
GuiWindow *NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw); Window *NewWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw);
void DrawWindow(GuiWindow *wnd); void DrawWindow(Window *wnd);
void DisposeWindow(GuiWindow *pWnd, bool reanimate); void DisposeWindow(Window *pWnd, bool reanimate);
void UpdateWindow(GuiWindow *wnd); void UpdateWindow(Window *wnd);
GuiPort *getPortById(uint16 id) const { return _windowsById[id]; } Port *getPortById(uint16 id) const { return _windowsById[id]; }
GuiPort *_wmgrPort; Port *_wmgrPort;
GuiWindow *_picWind; Window *_picWind;
private: private:
typedef Common::List<GuiPort *> PortList; typedef Common::List<Port *> PortList;
SciGui *_gui; SciGui *_gui;
SciGuiScreen *_screen; Screen *_screen;
SciGuiGfx *_gfx; Gfx *_gfx;
SciGuiText *_text; Text *_text;
/** The list of open 'windows' (and ports), in visual order. */ /** The list of open 'windows' (and ports), in visual order. */
PortList _windowList; PortList _windowList;
/** The list of all open 'windows' (and ports), ordered by their id. */ /** The list of all open 'windows' (and ports), ordered by their id. */
Common::Array<GuiPort *> _windowsById; Common::Array<Port *> _windowsById;
}; };
} // End of namespace Sci } // End of namespace Sci

View file

@ -36,20 +36,20 @@ MODULE_OBJS := \
engine/state.o \ engine/state.o \
engine/vm.o \ engine/vm.o \
graphics/gui.o \ graphics/gui.o \
graphics/gui_animate.o \ graphics/animate.o \
graphics/gui_controls.o \ graphics/controls.o \
graphics/gui_cursor.o \ graphics/cursor.o \
graphics/gui_font.o \ graphics/font.o \
graphics/gui_gfx.o \ graphics/gfx.o \
graphics/gui_menu.o \ graphics/menu.o \
graphics/gui_palette.o \ graphics/palette.o \
graphics/gui_picture.o \ graphics/picture.o \
graphics/gui_portrait.o \ graphics/portrait.o \
graphics/gui_screen.o \ graphics/screen.o \
graphics/gui_text.o \ graphics/text.o \
graphics/gui_transitions.o \ graphics/transitions.o \
graphics/gui_view.o \ graphics/view.o \
graphics/gui_windowmgr.o \ graphics/windowmgr.o \
sound/audio.o \ sound/audio.o \
sound/midiparser_sci.o \ sound/midiparser_sci.o \
sound/music.o \ sound/music.o \

View file

@ -34,7 +34,7 @@
#include "sound/audiostream.h" #include "sound/audiostream.h"
#include "sound/mixer.h" // for SoundHandle #include "sound/mixer.h" // for SoundHandle
#include "graphics/gui_helpers.h" // for ViewType #include "graphics/helpers.h" // for ViewType
#include "sci/decompressor.h" #include "sci/decompressor.h"
#include "sci/sci.h" #include "sci/sci.h"

View file

@ -39,9 +39,9 @@
#include "sci/sound/audio.h" #include "sci/sound/audio.h"
#include "sci/sound/soundcmd.h" #include "sci/sound/soundcmd.h"
#include "sci/graphics/gui.h" #include "sci/graphics/gui.h"
#include "sci/graphics/gui_palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/gui_cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/gui_screen.h" #include "sci/graphics/screen.h"
namespace Sci { namespace Sci {
@ -118,9 +118,9 @@ Common::Error SciEngine::run() {
// TODO: Possibly look at first picture resource and determine if its hires or not // TODO: Possibly look at first picture resource and determine if its hires or not
// Initialize graphics-related parts // Initialize graphics-related parts
SciGuiScreen *screen = new SciGuiScreen(_resMan, 320, 200, upscaledHires); // invokes initGraphics() Screen *screen = new Screen(_resMan, 320, 200, upscaledHires); // invokes initGraphics()
SciGuiPalette *palette = new SciGuiPalette(_resMan, screen); SciPalette *palette = new SciPalette(_resMan, screen);
SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette, screen); Cursor *cursor = new Cursor(_resMan, palette, screen);
// Create debugger console. It requires GFX to be initialized // Create debugger console. It requires GFX to be initialized
_console = new Console(this); _console = new Console(this);