diff options
author | Filippos Karapetis | 2009-11-04 14:22:17 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-11-04 14:22:17 +0000 |
commit | c8fbac1517cd2cd60791d598fb1922846ff0b867 (patch) | |
tree | affd460231664aa124193e0611af1c05a89589b7 /engines/sci/gui | |
parent | f83d7c6339258cef9d1c53d91a4e2d7b2637d1ec (diff) | |
download | scummvm-rg350-c8fbac1517cd2cd60791d598fb1922846ff0b867.tar.gz scummvm-rg350-c8fbac1517cd2cd60791d598fb1922846ff0b867.tar.bz2 scummvm-rg350-c8fbac1517cd2cd60791d598fb1922846ff0b867.zip |
- Changed the segment manager to be a static part of the engine, and stopped deleting and recreating it when restoring games
- Merged game_exit(), script_free_vm_memory() and script_free_engine()
- Cleanup
svn-id: r45666
Diffstat (limited to 'engines/sci/gui')
-rw-r--r-- | engines/sci/gui/gui.cpp | 5 | ||||
-rw-r--r-- | engines/sci/gui/gui_controls.cpp | 28 | ||||
-rw-r--r-- | engines/sci/gui/gui_controls.h | 5 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 2 |
4 files changed, 19 insertions, 21 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 992b66e5dd..e6b3bf422b 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -61,7 +61,7 @@ SciGui::SciGui(EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, _animate = new SciGuiAnimate(_s, _gfx, _screen, _palette); _text = new SciGuiText(_s->resMan, _gfx, _screen); _windowMgr = new SciGuiWindowMgr(this, _screen, _gfx, _text); - _controls = new SciGuiControls(_gfx, _text); + _controls = new SciGuiControls(_s->_segMan, _gfx, _text); _menu = new SciGuiMenu(_gfx, _text, _screen); // _gui32 = new SciGui32(_s, _screen, _palette, _cursor); // for debug purposes } @@ -81,7 +81,6 @@ SciGui::~SciGui() { void SciGui::resetEngineState(EngineState *s) { _s = s; - _gfx->resetSegMan(s->_segMan); _animate->resetEngineState(s); } @@ -443,7 +442,7 @@ void SciGui::editControl(reg_t controlObject, reg_t eventObject) { switch (controlType) { case SCI_CONTROLS_TYPE_TEXTEDIT: // Only process textedit controls in here - _controls->TexteditChange(_s->_segMan, controlObject, eventObject); + _controls->TexteditChange(controlObject, eventObject); return; } } diff --git a/engines/sci/gui/gui_controls.cpp b/engines/sci/gui/gui_controls.cpp index f9239f9573..40b61f3ef6 100644 --- a/engines/sci/gui/gui_controls.cpp +++ b/engines/sci/gui/gui_controls.cpp @@ -36,8 +36,8 @@ namespace Sci { -SciGuiControls::SciGuiControls(SciGuiGfx *gfx, SciGuiText *text) - : _gfx(gfx), _text(text) { +SciGuiControls::SciGuiControls(SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text) + : _segMan(segMan), _gfx(gfx), _text(text) { init(); } @@ -137,10 +137,10 @@ void SciGuiControls::TexteditSetBlinkTime() { _texteditBlinkTime = g_system->getMillis() + (30 * 1000 / 60); } -void SciGuiControls::TexteditChange(SegManager *segMan, reg_t controlObject, reg_t eventObject) { - uint16 cursorPos = GET_SEL32V(segMan, controlObject, cursor); - uint16 maxChars = GET_SEL32V(segMan, controlObject, max); - reg_t textReference = GET_SEL32(segMan, controlObject, text); +void SciGuiControls::TexteditChange(reg_t controlObject, reg_t eventObject) { + uint16 cursorPos = GET_SEL32V(_segMan, controlObject, cursor); + uint16 maxChars = GET_SEL32V(_segMan, controlObject, max); + reg_t textReference = GET_SEL32(_segMan, controlObject, text); Common::String text; uint16 textSize, eventType, eventKey; bool textChanged = false; @@ -148,18 +148,18 @@ void SciGuiControls::TexteditChange(SegManager *segMan, reg_t controlObject, reg if (textReference.isNull()) error("kEditControl called on object that doesnt have a text reference"); - text = segMan->getString(textReference); + text = _segMan->getString(textReference); if (!eventObject.isNull()) { textSize = text.size(); - eventType = GET_SEL32V(segMan, eventObject, type); + eventType = GET_SEL32V(_segMan, eventObject, type); switch (eventType) { case SCI_EVT_MOUSE_PRESS: // TODO: Implement mouse support for cursor change break; case SCI_EVT_KEYBOARD: - eventKey = GET_SEL32V(segMan, eventObject, message); + eventKey = GET_SEL32V(_segMan, eventObject, message); switch (eventKey) { case SCI_K_BACKSPACE: if (cursorPos > 0) { @@ -203,9 +203,9 @@ void SciGuiControls::TexteditChange(SegManager *segMan, reg_t controlObject, reg if (textChanged) { GuiResourceId oldFontId = _text->GetFontId(); - GuiResourceId fontId = GET_SEL32V(segMan, controlObject, font); - rect = Common::Rect(GET_SEL32V(segMan, controlObject, nsLeft), GET_SEL32V(segMan, controlObject, nsTop), - GET_SEL32V(segMan, controlObject, nsRight), GET_SEL32V(segMan, controlObject, nsBottom)); + GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, font); + rect = Common::Rect(GET_SEL32V(_segMan, controlObject, nsLeft), GET_SEL32V(_segMan, controlObject, nsTop), + GET_SEL32V(_segMan, controlObject, nsRight), GET_SEL32V(_segMan, controlObject, nsBottom)); TexteditCursorErase(); _gfx->EraseRect(rect); _text->Box(text.c_str(), 0, rect, SCI_TEXT_ALIGNMENT_LEFT, fontId); @@ -214,7 +214,7 @@ void SciGuiControls::TexteditChange(SegManager *segMan, reg_t controlObject, reg TexteditCursorDraw(rect, text.c_str(), cursorPos); _text->SetFont(oldFontId); // Write back string - segMan->strcpy(textReference, text.c_str()); + _segMan->strcpy(textReference, text.c_str()); } else { if (g_system->getMillis() >= _texteditBlinkTime) { _gfx->InvertRect(_texteditCursorRect); @@ -224,7 +224,7 @@ void SciGuiControls::TexteditChange(SegManager *segMan, reg_t controlObject, reg } } - PUT_SEL32V(segMan, controlObject, cursor, cursorPos); + PUT_SEL32V(_segMan, controlObject, cursor, cursorPos); } } // End of namespace Sci diff --git a/engines/sci/gui/gui_controls.h b/engines/sci/gui/gui_controls.h index 33b2e54989..a2d027d514 100644 --- a/engines/sci/gui/gui_controls.h +++ b/engines/sci/gui/gui_controls.h @@ -33,18 +33,19 @@ class SciGuiFont; class SciGuiText; class SciGuiControls { public: - SciGuiControls(SciGuiGfx *gfx, SciGuiText *text); + SciGuiControls(SegManager *segMan, SciGuiGfx *gfx, SciGuiText *text); ~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 TexteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos); void TexteditCursorErase(); - void TexteditChange(SegManager *segMan, reg_t controlObject, reg_t eventObject); + void TexteditChange(reg_t controlObject, reg_t eventObject); private: void init(); void TexteditSetBlinkTime(); + SegManager *_segMan; SciGuiGfx *_gfx; SciGuiText *_text; diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 516fa5466d..74334e5a39 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -53,8 +53,6 @@ public: void init(SciGuiText *text); - void resetSegMan(SegManager *segMan) { _segMan = segMan; } - byte *GetSegment(byte seg); void ResetScreen(); |