void RMDialogChoice::prepare(CORO_PARAM) { CORO_BEGIN_CONTEXT; int i; RMPoint ptPos; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); addPrim(new RMGfxPrimitive(&_dlgText, RMPoint(0, 0))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83 + 83))); _ctx->ptPos.set(20, 90); for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) { addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos)); _ptDrawStrings[_ctx->i] = _ctx->ptPos; _ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15); } CORO_INVOKE_0(drawOT); clearOT(); _ptDrawPos.set(0, 480 - _ctx->ptPos._y); CORO_END_CODE; }
void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); // Horizontally if (_aHorType == HCENTER) prim->getDst().topLeft() -= RMPoint(_dimx / 2, 0); else if (_aHorType == HRIGHT) prim->getDst().topLeft() -= RMPoint(_dimx, 0); // Vertically if (_aVerType == VTOP) { } else if (_aVerType == VCENTER) { prim->getDst()._y1 -= _dimy / 2; } else if (_aVerType == VBOTTOM) { prim->getDst()._y1 -= _dimy; } clipOnScreen(prim); CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim); CORO_END_CODE; }
void RMDialogChoice::setSelected(CORO_PARAM, int pos) { CORO_BEGIN_CONTEXT; RMGfxBox box; RMRect rc; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); if (pos == _curSelection) return; _ctx->box.setPriority(5); if (_curSelection != -1) { _ctx->box.setColor(0xCC, 0xCC, 0xFF); _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection]._y); _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy()); addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc)); addPrim(new RMGfxPrimitive(&_drawedStrings[_curSelection], _ptDrawStrings[_curSelection])); CORO_INVOKE_0(drawOT); clearOT(); } if (pos != -1) { _ctx->box.setColor(100, 100, 100); _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos]._y); _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy()); addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc)); addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos])); } CORO_INVOKE_0(drawOT); clearOT(); _curSelection = pos; CORO_END_CODE; }
void RMTextItemName::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); // If there is no text, it's pointless to continue if (_buf == NULL) return; // Set the destination coordinates of the mouse prim->getDst().topLeft() = _mpos - RMPoint(0, 30); CORO_INVOKE_2(RMText::draw, bigBuf, prim); CORO_END_CODE; }
RMTextDialog::RMTextDialog() : RMText() { _time = _startTime = 0; _dst = RMPoint(0, 0); _bSkipStatus = true; _bShowed = true; _bForceTime = false; _bForceNoTime = false; _bAlwaysDisplay = false; _bNoTab = false; _hCustomSkip = CORO_INVALID_PID_VALUE; _hCustomSkip2 = CORO_INVALID_PID_VALUE; _input = NULL; // Create the event for displaying the end _hEndDisplay = CoroScheduler.createEvent(false, false); }
void DebugChangeScene(CORO_PARAM, const void *param) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); uint32 result; const ChangeSceneDetails *details = (const ChangeSceneDetails *)param; RMPoint scenePos(details->x, details->y); CORO_BEGIN_CODE(_ctx); CORO_INVOKE_2(g_vm->getEngine()->unloadLocation, false, &result); g_vm->getEngine()->loadLocation(details->sceneNumber, scenePos, RMPoint(-1, -1)); mainEnableGUI(); CORO_END_CODE; }
RMPoint RMRect::center() { return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2); }
RMPointReference::operator RMPoint() const { return RMPoint(_x, _y); }
void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { // PROBLEM: You should change the location in a separate process to do the OnEnter CORO_BEGIN_CONTEXT; Common::InSaveFile *f; byte *state, *statecmp; uint32 size, sizecmp; char buf[4]; RMPoint tp; int loc; int ver; int i; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); _ctx->f = g_system->getSavefileManager()->openForLoading(fn); if (_ctx->f == NULL) return; _ctx->f->read(_ctx->buf, 4); if (_ctx->buf[0] != 'R' || _ctx->buf[1] != 'M' || _ctx->buf[2] != 'S') { delete _ctx->f; return; } _ctx->ver = _ctx->buf[3]; if (_ctx->ver == 0 || _ctx->ver > TONY_SAVEGAME_VERSION) { delete _ctx->f; return; } if (_ctx->ver >= 0x3) { // There is a thumbnail. If the version is between 5 and 7, it's compressed if ((_ctx->ver >= 0x5) && (_ctx->ver <= 0x7)) { _ctx->i = 0; _ctx->i = _ctx->f->readUint32LE(); _ctx->f->seek(_ctx->i); } else { if (_ctx->ver >= 8) // Skip thumbnail size _ctx->f->skip(4); _ctx->f->seek(160 * 120 * 2, SEEK_CUR); } } if (_ctx->ver >= 0x5) { // Skip the difficulty level _ctx->f->seek(1, SEEK_CUR); } if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose _ctx->i = _ctx->f->readByte(); _ctx->f->seek(_ctx->i, SEEK_CUR); } _ctx->loc = _ctx->f->readUint32LE(); _ctx->tp._x = _ctx->f->readUint32LE(); _ctx->tp._y = _ctx->f->readUint32LE(); _ctx->size = _ctx->f->readUint32LE(); if ((_ctx->ver >= 0x5) && (_ctx->ver <= 7)) { // MPAL was packed! _ctx->sizecmp = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->statecmp = new byte[_ctx->sizecmp]; _ctx->f->read(_ctx->statecmp, _ctx->sizecmp); lzo1x_decompress(_ctx->statecmp, _ctx->sizecmp, _ctx->state, &_ctx->size); delete[] _ctx->statecmp; } else { // Read uncompressed MPAL data _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); } mpalLoadState(_ctx->state); delete[] _ctx->state; // Inventory _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); _inv.loadState(_ctx->state); delete[] _ctx->state; if (_ctx->ver >= 0x2) { // Version 2: box please _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); g_vm->_theBoxes.loadState(_ctx->state); delete[] _ctx->state; } if (_ctx->ver >= 5) { // Version 5 bool bStat = false; bStat = _ctx->f->readByte(); _tony.setShepherdess(bStat); bStat = _ctx->f->readByte(); _inter.setPerorate(bStat); charsLoadAll(_ctx->f); } if (_ctx->ver >= 6) { // Load options GLOBALS._bCfgInvLocked = _ctx->f->readByte(); GLOBALS._bCfgInvNoScroll = _ctx->f->readByte(); GLOBALS._bCfgTimerizedText = _ctx->f->readByte(); GLOBALS._bCfgInvUp = _ctx->f->readByte(); GLOBALS._bCfgAnni30 = _ctx->f->readByte(); GLOBALS._bCfgAntiAlias = _ctx->f->readByte(); GLOBALS._bShowSubtitles = _ctx->f->readByte(); GLOBALS._bCfgTransparence = _ctx->f->readByte(); GLOBALS._bCfgInterTips = _ctx->f->readByte(); GLOBALS._bCfgDubbing = _ctx->f->readByte(); GLOBALS._bCfgMusic = _ctx->f->readByte(); GLOBALS._bCfgSFX = _ctx->f->readByte(); GLOBALS._nCfgTonySpeed = _ctx->f->readByte(); GLOBALS._nCfgTextSpeed = _ctx->f->readByte(); GLOBALS._nCfgDubbingVolume = _ctx->f->readByte(); GLOBALS._nCfgMusicVolume = _ctx->f->readByte(); GLOBALS._nCfgSFXVolume = _ctx->f->readByte(); // Load hotspots loadChangedHotspot(_ctx->f); } if (_ctx->ver >= 7) { loadMusic(_ctx->f); } delete _ctx->f; CORO_INVOKE_2(unloadLocation, false, NULL); loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); _tony.setPattern(RMTony::PAT_STANDRIGHT); // On older versions, need to an enter action if (_ctx->ver < 5) mpalQueryDoAction(0, _ctx->loc, 0); else { // In the new ones, we just reset the mcode mCharResetCodes(); } if (_ctx->ver >= 6) reapplyChangedHotspot(); CORO_INVOKE_0(restoreMusic); _bGUIInterface = true; _bGUIInventory = true; _bGUIOption = true; CORO_END_CODE; }