void LabEngine::drawJournalText() { uint16 drawingToPage = 1; const char *curText = _journalText.c_str(); assert((_journalPage & 1) == 0); while (drawingToPage < _journalPage) { updateEvents(); // flowText without output curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, false, _utils->vgaRectScale(52, 32, 152, 148), curText); _lastPage = (*curText == 0); if (_lastPage) { // Reset _journalPage to this page, in case it was set too high _journalPage = (drawingToPage / 2) * 2; break; } drawingToPage++; } if (_journalPage == 0) { // draw title page centered _graphics->flowText(_journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), _journalTextTitle.c_str(), _journalBackImage); } else { curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage); } updateEvents(); curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText, _journalBackImage); _lastPage = (*curText == 0); }
void LabEngine::turnPage(bool fromLeft) { if (fromLeft) { for (int i = 0; i < _graphics->_screenWidth; i += 8) { updateEvents(); waitTOF(); _journalBackImage->blitBitmap(i, 0, nullptr, i, 0, 8, _graphics->_screenHeight, false); } } else { for (int i = (_graphics->_screenWidth - 8); i > 0; i -= 8) { updateEvents(); waitTOF(); _journalBackImage->blitBitmap(i, 0, nullptr, i, 0, 8, _graphics->_screenHeight, false); } } }
// // Requirement here is to merge in any event records that have // just arrived in the last timestep (from my.metric) with the // set already being displayed. // Additionally, we need to cull those that are no longer within // the time window of interest. // void TracingItem::updateValues(TracingEngine *engine, double left, double right) { QmcMetric *metric = ChartItem::my.metric; #if DESPERATE console->post(PmChart::DebugForce, "TracingItem::updateValues: " "%d total events, left=%.2f right=%.2f\n" "Metadata counts: drops=%d spans=%d points=%d " "Metric values: %d count\n", my.events.size(), left, right, my.drops.size(), my.spans.size(), my.points.size(), metric->numValues()); #endif cullOutlyingSpans(left, right); cullOutlyingDrops(left, right); cullOutlyingPoints(left, right); cullOutlyingEvents(left, right); // crack open newly arrived event records if (metric->numValues() > 0) updateEvents(engine, metric); // update the display my.dropCurve->setSamples(my.drops); my.spanCurve->setSamples(my.spans); my.pointCurve->setSamples(my.points); my.selectionCurve->setSamples(my.selections); }
bool DrasculaEngine::pickupObject() { int obj = pickedObject; checkFlags = 1; updateRoom(); showMenu(); updateScreen(); // Objects with an ID smaller than 7 are the inventory verbs if (pickedObject >= 7) { int n = whichObject(); if (n != 0 && inventoryObjects[n] == 0) { inventoryObjects[n] = obj; takeObject = 0; checkFlags = 0; } } if (checkFlags == 1) { if (checkMenuFlags()) return true; } updateEvents(); if (takeObject == 0) selectVerb(kVerbNone); return false; }
void Simulator::startSimulation(){ setReportsFilePath("Reports.ini"); updateConf("Configuration.ini"); updateRoadMap("RoadMap.ini"); updateEvents("Events.ini"); updateReports("Commands.ini"); // Starting the cycle bool isCycleRunning = true; while(isCycleRunning){ // Perform Events std::pair <std::multimap<int,Event*>::iterator, std::multimap<int,Event*>::iterator> event_it; event_it = _events.equal_range(getCurrentTime()); for (std::multimap<int,Event*>::iterator it=event_it.first; it!=event_it.second; ++it) (it->second)->performEvent(); updateCarsHistory(); // Execute Commands std::pair <std::multimap<int,Report*>::iterator, std::multimap<int,Report*>::iterator> report_it; report_it = _reports.equal_range(getCurrentTime()); for (std::multimap<int,Report*>::iterator it=report_it.first; it!=report_it.second && isCycleRunning; ++it){ if((it->second)->getReportType() == "termination") isCycleRunning = false; else (it->second)->writeReport(); } advanceCarsInRoads(); advanceCarsInJunctions(); increaseTime(); } }
void LabEngine::doMap() { static uint16 amigaMapPalette[] = { 0x0BA8, 0x0C11, 0x0A74, 0x0076, 0x0A96, 0x0DCB, 0x0CCA, 0x0222, 0x0444, 0x0555, 0x0777, 0x0999, 0x0AAA, 0x0ED0, 0x0EEE, 0x0694 }; _graphics->_fadePalette = amigaMapPalette; updateEvents(); loadMapData(); _graphics->blackAllScreen(); _interface->attachButtonList(&_mapButtonList); drawMap(_roomNum, _roomNum, _maps[_roomNum]._pageNumber, true); _event->mouseShow(); _graphics->screenUpdate(); processMap(_roomNum); _event->mouseHide(); _interface->attachButtonList(nullptr); _graphics->fade(false); _graphics->blackAllScreen(); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); freeMapData(); _event->mouseShow(); _graphics->screenUpdate(); }
virtual void operator()( osg::RenderInfo& renderInfo ) const { osg::Viewport* viewport = renderInfo.getCurrentCamera()->getViewport(); if ( viewport ) TwWindowSize( viewport->width(), viewport->height() ); updateEvents(); TwDraw(); }
void LabEngine::doJournal() { _graphics->blackAllScreen(); _lastPage = false; _journalBackImage->_width = _graphics->_screenWidth; _journalBackImage->_height = _graphics->_screenHeight; _journalBackImage->setData(nullptr, true); updateEvents(); loadJournalData(); _interface->attachButtonList(&_journalButtonList); drawJournal(0, true); _event->mouseShow(); processJournal(); _interface->attachButtonList(nullptr); _graphics->fade(false); _event->mouseHide(); delete[] _blankJournal; _blankJournal = nullptr; _journalBackImage->setData(nullptr, true); _interface->freeButtonList(&_journalButtonList); _graphics->freeFont(&_journalFont); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _graphics->blackScreen(); }
Common::Error FullpipeEngine::run() { const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); // Initialize backend initGraphics(800, 600, true, &format); _backgroundSurface.create(800, 600, format); _origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); _console = new Console(this); initialize(); _isSaveAllowed = false; int scene = 0; if (ConfMan.hasKey("boot_param")) scene = convertScene(ConfMan.getInt("boot_param")); if (!loadGam("fullpipe.gam", scene)) return Common::kNoGameDataFoundError; #if 0 loadAllScenes(); #endif _gameContinue = true; while (_gameContinue) { updateEvents(); updateScreen(); if (_needRestart) { if (_modalObject) { delete _modalObject; _modalObject = 0; } freeGameLoader(); _currentScene = 0; _updateTicks = 0; loadGam("fullpipe.gam"); _needRestart = false; } if (_normalSpeed) _system->delayMillis(10); _system->updateScreen(); } freeGameLoader(); cleanup(); return Common::kNoError; }
void editerMap() { int continuer = 1; int yActuel = 0, tpsActuel = 0, tpsPrecedent = 0; Chunk terrain; initialiserInput(&event); while(continuer) { updateEvents(&event); if(event.quitter == 1) exit(EXIT_SUCCESS); if(event.touche[SDLK_ESCAPE] == 1) continuer = 0; if(event.souris[SDL_BUTTON_LEFT] == 1 || event.souris[SDL_BUTTON_RIGHT] == 1) remplirTerrain(&terrain, yActuel); if(event.touche[SDLK_s] == 1) { sauvegarderMapF("map/test.map", terrain); printf("Sauvegardé\n"); event.touche[SDLK_s] = 0; } if(event.touche[SDLK_LALT] == 1) { if(yActuel > 0) yActuel--; printf("%d\n", yActuel); event.touche[SDLK_LALT] = 0; } if(event.touche[SDLK_SPACE] == 1) { if(yActuel < 127) yActuel++; printf("%d\n", yActuel); event.touche[SDLK_SPACE] = 0; } tpsActuel = SDL_GetTicks(); if(tpsActuel - tpsPrecedent > 50) { affichageEditeur(terrain, yActuel); tpsPrecedent = tpsActuel; } else SDL_Delay(50 - (tpsActuel - tpsPrecedent)); } }
ComingUpViewItemModel::ComingUpViewItemModel( MViewManager& manager, bool showOnlyNextFewEvents) : viewManager(manager), restrictEventCount(showOnlyNextFewEvents) { modelEventList = new QList<CalendarEvent*>(); theHeaderData.append("Title"); theHeaderData.append("Subtitle"); updateEvents(); }
Common::KeyCode DrasculaEngine::getScan() { updateEvents(); if (_keyBufferHead == _keyBufferTail) return Common::KEYCODE_INVALID; Common::KeyCode key = _keyBuffer[_keyBufferTail].keycode; _keyBufferTail = (_keyBufferTail + 1) % KEYBUFSIZE; return key; }
void DrasculaEngine::updateEvents() { Common::Event event; Common::EventManager *eventMan = _system->getEventManager(); updateMusic(); #ifdef _WIN32_WCE if (eventMan->pollEvent(event)) { #else while (eventMan->pollEvent(event)) { #endif switch (event.type) { case Common::EVENT_KEYDOWN: addKeyToBuffer(event.kbd); break; case Common::EVENT_KEYUP: break; case Common::EVENT_MOUSEMOVE: mouseX = event.mouse.x; mouseY = event.mouse.y; break; case Common::EVENT_LBUTTONDOWN: leftMouseButton = 1; break; case Common::EVENT_LBUTTONUP: leftMouseButton = 0; break; case Common::EVENT_RBUTTONDOWN: // We changed semantic and react only on button up event break; case Common::EVENT_RBUTTONUP: rightMouseButton = 1; break; case Common::EVENT_QUIT: // TODO endChapter(); _system->quit(); break; default: break; } } } void DrasculaEngine::delay(int ms) { uint32 end = _system->getMillis() + ms * 2; // originally was 1 do { _system->delayMillis(10); updateEvents(); _system->updateScreen(); } while (_system->getMillis() < end); }
void LabEngine::loadJournalData() { if (_journalFont) _graphics->freeFont(&_journalFont); _journalFont = _resource->getFont("F:Journal.fon"); updateEvents(); Common::String filename = "Lab:Rooms/j"; bool bridge = _conditions->in(kCondBridge0) || _conditions->in(kCondBridge1); bool dirty = _conditions->in(kCondDirty); bool news = !_conditions->in(kCondNoNews); bool clean = !_conditions->in(kCondNoClean); if (bridge && clean && news) filename += '8'; else if (clean && news) filename += '9'; else if (bridge && clean) filename += '6'; else if (clean) filename += '7'; else if (bridge && dirty && news) filename += '4'; else if (dirty && news) filename += '5'; else if (bridge && dirty) filename += '2'; else if (dirty) filename += '3'; else if (bridge) filename += '1'; else filename += '0'; _journalText = _resource->getText(filename); _journalTextTitle = _resource->getText("Lab:Rooms/jt"); Common::File *journalFile = _resource->openDataFile("P:JImage"); _journalButtonList.push_back(_interface->createButton( 80, _utils->vgaScaleY(162) + _utils->svgaCord(1), 0, Common::KEYCODE_LEFT, new Image(journalFile, this), new Image(journalFile, this))); // back _journalButtonList.push_back(_interface->createButton(194, _utils->vgaScaleY(162) + _utils->svgaCord(1), 2, Common::KEYCODE_RIGHT, new Image(journalFile, this), new Image(journalFile, this))); // forward _journalButtonList.push_back(_interface->createButton(144, _utils->vgaScaleY(164) - _utils->svgaCord(1), 1, Common::KEYCODE_ESCAPE, new Image(journalFile, this), new Image(journalFile, this))); // cancel delete journalFile; _anim->_noPalChange = true; _journalBackImage->setData(new byte[_graphics->_screenBytesPerPage]); _graphics->readPict("P:Journal.pic", true, false, _journalBackImage->_imageData); _anim->_noPalChange = false; // Keep a copy of the blank journal _blankJournal = new byte[_graphics->_screenBytesPerPage]; memcpy(_blankJournal, _journalBackImage->_imageData, _graphics->_screenBytesPerPage); }
void DrasculaEngine::updateEvents() { Common::Event event; Common::EventManager *eventMan = _system->getEventManager(); updateMusic(); #ifdef _WIN32_WCE if (eventMan->pollEvent(event)) { #else while (eventMan->pollEvent(event)) { #endif switch (event.type) { case Common::EVENT_KEYDOWN: if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) { // Start the debugger getDebugger()->attach(); getDebugger()->onFrame(); } addKeyToBuffer(event.kbd); break; case Common::EVENT_KEYUP: break; case Common::EVENT_MOUSEMOVE: _mouseX = event.mouse.x; _mouseY = event.mouse.y; break; case Common::EVENT_LBUTTONDOWN: _leftMouseButton = 1; break; case Common::EVENT_LBUTTONUP: _leftMouseButton = 0; break; case Common::EVENT_RBUTTONDOWN: // We changed semantic and react only on button up event break; case Common::EVENT_RBUTTONUP: _rightMouseButton = 1; break; default: break; } } } void DrasculaEngine::delay(int ms) { uint32 end = _system->getMillis() + ms * 2; // originally was 1 do { _system->delayMillis(10); updateEvents(); _system->updateScreen(); } while (_system->getMillis() < end && !shouldQuit()); }
void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeIn) { _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _imgMap->drawImage(0, 0); _interface->drawButtonList(&_mapButtonList); for (int i = 1; i <= _maxRooms; i++) { if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) { drawRoomMap(i, (bool)(i == curRoom)); } } updateEvents(); // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird // condition, like the surreal maze where there are no rooms if ((_maps[curRoom]._pageNumber == floorNum) && _roomsFound->in(curRoom) && _maps[curRoom]._x) drawRoomMap(curRoom, true); _interface->toggleButton(_interface->getButton(1), 12, (getUpperFloor(floorNum) != kFloorNone)); // up button _interface->toggleButton(_interface->getButton(2), 12, (getLowerFloor(floorNum) != kFloorNone)); // down button // Labyrinth specific code if (floorNum == kFloorLower) { if (floorVisited(kFloorSurMaze)) _imgMaze->drawImage(_utils->mapScaleX(538), _utils->mapScaleY(277)); } else if (floorNum == kFloorMiddle) { if (floorVisited(kFloorCarnival)) _imgMaze->drawImage(_utils->mapScaleX(358), _utils->mapScaleY(72)); if (floorVisited(kFloorMedMaze)) _imgMaze->drawImage(_utils->mapScaleX(557), _utils->mapScaleY(325)); } else if (floorNum == kFloorUpper) { if (floorVisited(kFloorHedgeMaze)) _imgHugeMaze->drawImage(_utils->mapScaleX(524), _utils->mapScaleY(97)); } else if (floorNum == kFloorSurMaze) { Common::Rect textRect = Common::Rect(_utils->mapScaleX(360), 0, _utils->mapScaleX(660), _utils->mapScaleY(450)); const char *textPtr = _resource->getStaticText(kTextSurmazeMessage).c_str(); _graphics->flowText(_msgFont, 0, 7, 0, true, true, true, true, textRect, textPtr); } if ((floorNum >= kFloorLower) && (floorNum <= kFloorCarnival)) { const char *textPrt = _resource->getStaticText(floorNum - 1).c_str(); _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 75, 134, 97), textPrt); } if (!_rooms[curMsg]._roomMsg.empty()) _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 148, 134, 186), _rooms[curMsg]._roomMsg.c_str()); if (fadeIn) _graphics->fade(true); }
void HexagonGame::update(float mFT) { if(!assets.pIsLocal() && Config::isEligibleForScore()) { assets.playedSeconds += mFT / 60.f; if(assets.playedSeconds >= 60.f) { assets.playedSeconds = 0; Online::trySendMinutePlayed(); } } updateFlash(mFT); effectTimelineManager.update(mFT); if(!status.hasDied) { manager.update(mFT); updateEvents(mFT); updateTimeStop(mFT); updateIncrement(); if(mustChangeSides && !manager.hasEntity(HGGroup::Wall)) sideChange(getRnd(levelStatus.sidesMin, levelStatus.sidesMax + 1)); updateLevel(mFT); if(Config::getBeatPulse()) updateBeatPulse(mFT); if(Config::getPulse()) updatePulse(mFT); if(!Config::getBlackAndWhite()) styleData.update(mFT, pow(difficultyMult, 0.8f)); } else levelStatus.rotationSpeed *= 0.99f; if(Config::get3D()) update3D(mFT); if(!Config::getNoRotation()) updateRotation(mFT); overlayCamera.update(mFT); backgroundCamera.update(mFT); for(auto& c : depthCameras) c.update(mFT); if(status.mustRestart) { changeLevel(restartId, restartFirstTime); if(!assets.pIsLocal() && Config::isEligibleForScore()) { Online::trySendRestart(); } } if(!status.scoreInvalid && Config::getOfficial() && fpsWatcher.isLimitReached()) invalidateScore(); fpsWatcher.update(); }
void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rect textRect, bool isinteractive) { uint16 drawingToPage = 0, yspacing = 0; _event->mouseHide(); if (*text == '%') { text++; uint16 numlines = (*text - '0') * 10; text++; numlines += (*text - '0'); text += 2; uint16 fheight = _graphics->textHeight(monitorFont); textRect.left = _monitorButton->_width + _utils->vgaScaleX(3); _monitorButtonHeight = _monitorButton->_height + _utils->vgaScaleY(3); if (_monitorButtonHeight > fheight) yspacing = _monitorButtonHeight - fheight; else _monitorButtonHeight = fheight; _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom, 0); for (int i = 0; i < numlines; i++) _monitorButton->drawImage(0, i * _monitorButtonHeight); } else if (isinteractive) { _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom, 0); } else { _graphics->rectFill(textRect, 0); } const char *curText = text; while (drawingToPage < _monitorPage) { updateEvents(); curText += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, textRect, curText); _lastPage = (*curText == 0); if (_lastPage) _monitorPage = drawingToPage; else drawingToPage++; } curText += _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, textRect, curText); _lastPage = (*curText == 0); _event->mouseShow(); }
void BaseInstance::tick(float deltaTime, float interpolation) { pthread_mutex_lock(&m_canTickMutex); // Update event input state and get pending actions updateEvents(m_actions); // Execute callbacks bound to actions bool isValid = false; uint64 action = m_actions.pop(isValid); while(isValid) { executeAction(action); action = m_actions.pop(isValid); } m_activeScene->tick(deltaTime, interpolation); tickInternal(deltaTime, interpolation); m_uiManager->tick(deltaTime); if(m_debugUI) { m_debugUI->tick(getKeyCodesCount(), getKeyCodes()); if(m_debugUI->isInputReady()) { executeConsoleCommand(m_debugUI->consumeInput()); } } // Reset keyboard input cache. Make sure to do this after last tick operation. resetKeyCodes(); // Find visible actors only if draw thread is awaiting sync operation. Otherwise it would be a waste of time if(pthread_mutex_trylock(&m_canDrawMutex) > 0) { m_renderQueue.clear(); m_activeScene->findVisibleActors(m_renderQueue); pthread_mutex_unlock(&m_canSyncMutex); } else { pthread_mutex_unlock(&m_canDrawMutex); pthread_mutex_unlock(&m_canTickMutex); } }
/** * Remove an item from the inventory, namely the item in the slot * over which the mouse cursor currently hovers. */ void DrasculaEngine::removeObject() { int obj = 0, n; updateRoom(); n = whichObject(); if (n != 0) { obj = inventoryObjects[n]; inventoryObjects[n] = 0; if (obj != 0) takeObject = 1; } updateEvents(); if (takeObject == 1) chooseObject(obj); }
void DrasculaEngine::MusicFadeout() { int org_vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); while (!shouldQuit()) { int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); vol -= 10; if (vol < 0) vol = 0; _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); if (vol == 0) break; updateEvents(); _system->updateScreen(); _system->delayMillis(50); } _system->getAudioCDManager()->stop(); _system->delayMillis(100); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol); }
void DrasculaEngine::fadeToBlack(int fadeSpeed) { signed char fade; unsigned int color, component; DacPalette256 palFade; for (fade = 63; fade >= 0; fade--) { for (color = 0; color < 256; color++) { for (component = 0; component < 3; component++) { palFade[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fade); } } pause(fadeSpeed); setPalette((byte *)&palFade); updateEvents(); } }
void MYGUIManager::drawImplementation( osg::RenderInfo& renderInfo ) const { unsigned int contextID = renderInfo.getContextID(); if ( !_initialized ) { MYGUIManager* constMe = const_cast<MYGUIManager*>(this); constMe->_platform = new MyGUI::OpenGLPlatform; constMe->_platform->initialise( constMe ); constMe->setupResources(); constMe->_gui = new MyGUI::Gui; constMe->_gui->initialise( _resourceCoreFile ); constMe->initializeControls(); osg::ref_ptr<osgViewer::GraphicsWindow> gw; if (_gw.lock(gw)) { gw->useCursor(_useHWCursor); } MyGUI::PointerManager& manager = MyGUI::PointerManager::getInstance(); manager.setVisible(!_useHWCursor); manager.eventChangeMousePointer += MyGUI::newDelegate(constMe, &MYGUIManager::notifyChangeMousePointer); constMe->_activeContextID = contextID; constMe->_initialized = true; } else if ( contextID==_activeContextID ) { osg::State* state = renderInfo.getState(); state->disableAllVertexArrays(); state->disableTexCoordPointer( 0 ); glPushMatrix(); glPushAttrib( GL_ALL_ATTRIB_BITS ); if ( _platform ) { updateEvents(); _platform->getRenderManagerPtr()->drawOneFrame(); } glPopAttrib(); glPopMatrix(); } }
void LabEngine::loadMapData() { Common::File *mapImages = _resource->openDataFile("P:MapImage"); _imgMap = new Image(mapImages, this); _imgRoom = new Image(mapImages, this); _imgUpArrowRoom = new Image(mapImages, this); _imgDownArrowRoom = new Image(mapImages, this); _imgHRoom = new Image(mapImages, this); _imgVRoom = new Image(mapImages, this); _imgMaze = new Image(mapImages, this); _imgHugeMaze = new Image(mapImages, this); _imgMapX[kDirectionNorth] = new Image(mapImages, this); _imgMapX[kDirectionEast] = new Image(mapImages, this); _imgMapX[kDirectionSouth] = new Image(mapImages, this); _imgMapX[kDirectionWest] = new Image(mapImages, this); _imgPath = new Image(mapImages, this); _imgBridge = new Image(mapImages, this); _mapButtonList.push_back(_interface->createButton( 8, _utils->vgaScaleY(105), 0, Common::KEYCODE_ESCAPE, new Image(mapImages, this), new Image(mapImages, this))); // back _mapButtonList.push_back(_interface->createButton( 55, _utils->vgaScaleY(105), 1, Common::KEYCODE_UP, new Image(mapImages, this), new Image(mapImages, this))); // up _mapButtonList.push_back(_interface->createButton(101, _utils->vgaScaleY(105), 2, Common::KEYCODE_DOWN, new Image(mapImages, this), new Image(mapImages, this))); // down delete mapImages; Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); updateEvents(); _maxRooms = mapFile->readUint16LE(); _maps = new MapData[_maxRooms + 1]; // will be freed when the user exits the map for (int i = 0; i <= _maxRooms; i++) { _maps[i]._x = mapFile->readUint16LE(); _maps[i]._y = mapFile->readUint16LE(); _maps[i]._pageNumber = mapFile->readUint16LE(); _maps[i]._specialID = (SpecialRoom) mapFile->readUint16LE(); _maps[i]._mapFlags = mapFile->readUint32LE(); } delete mapFile; }
void DrasculaEngine::placeVonBraun(int pointX) { trackVonBraun = (pointX < vonBraunX) ? 0 : 1; vonBraunHasMoved = 1; while (!shouldQuit()) { updateEvents(); updateRoom(); updateScreen(); if (trackVonBraun == 0) { vonBraunX = vonBraunX - 5; if (vonBraunX <= pointX) break; } else { vonBraunX = vonBraunX + 5; if (vonBraunX >= pointX) break; } pause(5); } vonBraunHasMoved = 0; }
static PDDebugState update(void* userData, PDAction action, PDReader* reader, PDWriter* writer) { PluginData* plugin = (PluginData*)userData; plugin->hasUpdatedRegistes = false; plugin->hasUpdatedExceptionLocation = false; onAction(plugin, action); processEvents(plugin, reader, writer); updateEvents(plugin, writer); if (plugin->hasUpdatedRegistes) { PDWrite_eventBegin(writer, PDEventType_setRegisters); PDWrite_arrayBegin(writer, "registers"); writeStatusRegister(writer, "flags", plugin->regs.flags); writeRegister(writer, "pc", 2, plugin->regs.pc, 1); writeRegister(writer, "sp", 1, plugin->regs.sp, 0); writeRegister(writer, "a", 1, plugin->regs.a, 0); writeRegister(writer, "x", 1, plugin->regs.x, 0); writeRegister(writer, "y", 1, plugin->regs.y, 0); PDWrite_arrayEnd(writer); PDWrite_eventEnd(writer); } if (plugin->hasUpdatedExceptionLocation) { PDWrite_eventBegin(writer, PDEventType_setExceptionLocation); PDWrite_u64(writer, "address", plugin->regs.pc); PDWrite_u8(writer, "address_size", 2); PDWrite_eventEnd(writer); } return plugin->state; }
void KODayMatrix::updateIncidences() { if ( !mCalendar ) { return; } mEvents.clear(); if ( mHighlightEvents ) { updateEvents(); } if ( mHighlightTodos ) { updateTodos(); } if ( mHighlightJournals ) { updateJournals(); } mPendingChanges = false; }
void DrasculaEngine::gotoObject(int pointX, int pointY) { bool cursorVisible = isCursorVisible(); hideCursor(); if (currentChapter == 5 || currentChapter == 6) { if (hare_se_ve == 0) { curX = roomX; curY = roomY; updateRoom(); updateScreen(); return; } } roomX = pointX; roomY = pointY; startWalking(); for (;;) { updateRoom(); updateScreen(); updateEvents(); if (characterMoved == 0) break; pause(3); } if (walkToObject == 1) { walkToObject = 0; trackProtagonist = trackFinal; } updateRoom(); updateScreen(); // roomNumber -2 is end credits. Do not show cursor there if (cursorVisible && roomNumber != -2) showCursor(); }
void LabEngine::processJournal() { while (1) { IntuiMessage *msg = _event->getMsg(); if (shouldQuit()) { _quitLab = true; return; } updateEvents(); _graphics->screenUpdate(); _system->delayMillis(10); if (!msg) continue; MessageClass msgClass = msg->_msgClass; if ((msgClass == kMessageRightClick) || ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) return; else if (msgClass == kMessageButtonUp) { uint16 buttonId = msg->_code; if (buttonId == 0) { if (_journalPage >= 2) { _journalPage -= 2; drawJournal(1, false); } } else if (buttonId == 1) { return; } else if (buttonId == 2) { if (!_lastPage) { _journalPage += 2; drawJournal(2, false); } } } } // while }
void LabEngine::drawJournal(uint16 wipenum, bool needFade) { _event->mouseHide(); updateEvents(); drawJournalText(); _graphics->loadBackPict("P:Journal.pic", _highPalette); if (wipenum == 0) _journalBackImage->blitBitmap(0, 0, nullptr, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false); else turnPage((wipenum == 1)); _interface->toggleButton(_interface->getButton(0), 15, (_journalPage > 0)); // back button _interface->toggleButton(_interface->getButton(2), 15, (!_lastPage)); // forward button if (needFade) _graphics->fade(true); // Reset the journal background, so that all the text that has been blitted on it is erased memcpy(_journalBackImage->_imageData, _blankJournal, _graphics->_screenBytesPerPage); eatMessages(); _event->mouseShow(); }