- Moved cel width and height calculation in the GUI

- Merged the engine states of the old and new GUI

svn-id: r45057
This commit is contained in:
Filippos Karapetis 2009-10-14 09:28:58 +00:00
parent 8c17b257ea
commit 8570068f58
5 changed files with 492 additions and 500 deletions

View File

@ -388,8 +388,6 @@ reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
static Common::Rect nsrect_clip(EngineState *s, int y, Common::Rect retval, int priority);
reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) {
reg_t curObject = argv[0];
reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
@ -435,28 +433,16 @@ reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) {
int view = argv[0].toSint16();
int loop = argv[1].toSint16();
int cel = (argc >= 3) ? argv[2].toSint16() : 0;
int height, width;
Common::Point offset;
if (argc > 3)
error("celHigh called with more than 3 parameters");
gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset);
return make_reg(0, height);
return make_reg(0, s->_gui->getCelHeight(view, loop, cel));
}
reg_t kCelWide(EngineState *s, int argc, reg_t *argv) {
int view = argv[0].toSint16();
int loop = argv[1].toSint16();
int cel = (argc >= 3) ? argv[2].toSint16() : 0;
int height, width;
Common::Point offset;
if (argc > 3)
error("celWide called with more than 3 parameters");
gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset);
return make_reg(0, width);
return make_reg(0, s->_gui->getCelWidth(view, loop, cel));
}
reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) {

View File

@ -634,6 +634,24 @@ void SciGui::moveCursor(Common::Point pos) {
// FIXME!
}
int16 SciGui::getCelWidth(int view, int loop, int cel) {
SciGuiView *cursorView = new SciGuiView(_s->resMan, _screen, _palette, view);
sciViewCelInfo *celInfo = cursorView->getCelInfo(loop, cel);
int16 width = celInfo->width;
delete cursorView;
return width;
}
int16 SciGui::getCelHeight(int view, int loop, int cel) {
SciGuiView *cursorView = new SciGuiView(_s->resMan, _screen, _palette, view);
sciViewCelInfo *celInfo = cursorView->getCelInfo(loop, cel);
int16 height = celInfo->height;
delete cursorView;
return height;
}
bool SciGui::debugUndither(bool flag) {
_screen->unditherSetState(flag);
return false;

View File

@ -121,6 +121,9 @@ public:
virtual void setCursorPos(Common::Point pos);
virtual void moveCursor(Common::Point pos);
int16 getCelWidth(int view, int loop, int cel);
int16 getCelHeight(int view, int loop, int cel);
virtual bool debugUndither(bool flag);
virtual bool debugShowMap(int mapNo);
@ -129,13 +132,13 @@ public:
protected:
SciGuiCursor *_cursor;
EngineState *_s;
SciGuiScreen *_screen;
SciGuiPalette *_palette;
private:
virtual void initPriorityBands();
EngineState *_s;
SciGuiScreen *_screen;
SciGuiPalette *_palette;
SciGuiGfx *_gfx;
SciGuiresources *_resources;
SciGuiWindowMgr *_windowMgr;

File diff suppressed because it is too large Load Diff

View File

@ -103,10 +103,9 @@ public:
bool debugShowMap(int mapNo);
// FIXME: Don't store EngineState
virtual void resetEngineState(EngineState *newState) { s = newState; }
virtual void resetEngineState(EngineState *newState) { _s = newState; }
private:
EngineState *s;
bool _usesOldGfxFunctions;
GfxDynView *_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv);