Example #1
0
void RMGfxEngine::init() {
	// Screen loading
	RMResRaw *raw;
	RMGfxSourceBuffer16 *load = NULL;
	INIT_GFX16_FROMRAW(20038, load);
	_bigBuf.addPrim(new RMGfxPrimitive(load));
	_bigBuf.drawOT(Common::nullContext);
	_bigBuf.clearOT();
	delete load;

	// Display 'Loading' screen
	_bigBuf.addDirtyRect(Common::Rect(0, 0, RM_SX, RM_SY));
	g_vm->_window.getNewFrame(*this, NULL);
	g_vm->_window.repaint();

	// Activate GUI
	_bGUIOption = true;
	_bGUIInterface = true;
	_bGUIInventory = true;

	GLOBALS._bSkipSfxNoLoop = false;
	_bMustEnterMenu = false;
	GLOBALS._bIdleExited = false;
	_bOption = false;
	_bWiping = false;
	_hWipeEvent = CoroScheduler.createEvent(false, false);

	// Initialize the IRQ function for items for MPAL
	GLOBALS._gfxEngine = this;
	mpalInstallItemIrq(itemIrq);

	// Initialize the mouse pointer
	_point.init();

	// Initialize Tony
	_tony.init();
	_tony.linkToBoxes(&g_vm->_theBoxes);

	// Initialize the inventory and the interface
	_inv.init();
	_inter.init();

	// Download the location and set priorities   @@@@@
	_bLocationLoaded = false;

	enableInput();

	// Starting the game
	_tony.executeAction(20, 1, 0);
}
Example #2
0
void rgbCellsFree () {
        int freeCells;
        char tempStr[256];

        freeCells = cellsFree();
        if (isFree (thePixel)) {
            sprintf (tempStr, "%d cells free including %ld",freeCells,thePixel);
            enableInput();
        } else {
            sprintf (tempStr, "%d cells free but not %ld", freeCells, thePixel);
            disableInput();
        }
        setLabel (freeLabel, tempStr);
}
Example #3
0
void MainWindow::on_autoSyn_stateChanged(int arg1)
{
    // 选中自动同步
    autoSyn = (arg1 == 0) ? false : true;
    enableInput(!autoSyn);
    // 停止监听
    if(arg1 == 0)
    {
        stopWatch();
    }
    else
    {
        startWatch();
    }
}
Example #4
0
void MainWindow::on_manualSyn_clicked()
{
    // 点击手动同步
    qDebug() << "onMannualSynClicked";
    click = true;
    if(!watchList.empty())
        enableInput(false);
    for(auto path : watchList)
    {
        QFileInfo check(path);
        if(check.isFile())
            onFileChanged(path);
        else if(check.isDir())
            onDirectoryChanged(path);
    }
}
Example #5
0
void MainWindow::timeOut()
{
    ui->statusBar->showMessage("开始同步...");
    timer->stop();
    disconnect(timer,SIGNAL(timeout()),this,SLOT(timeOut()));
    timer = NULL;
    for(auto file : fileQueue)
        startCopyFile(file);
    for(auto directory : directoryQueue)
        startCopyDirectory(directory);
    if(click == true)
    {
        if(!autoSyn)
            enableInput(true);
        click = false;
    }
}
Example #6
0
void MainWindow::onOrderTaken() {
    ui->answer->setText("^");
    enableInput();
    int id = factory->take_order();
    if(id == -1) {
        ui->orderInfo->setText("");
        disableInput();
    } else {
        factory->remove_order(id);
        Order* order = factory->get_order_in_progress();
        QStringList words;
        for (std::string word : order->get_words()) {
            words << QString(word.c_str());
        }
        ui->orderInfo->setText(words.join(", "));
        ui->takeOrder->setDisabled(true);
    }
}
Example #7
0
void InputLine::readNumbers(char key){
	switch (key){
		case 'A': enableInput(false); break;
		case 'B': moveCursorForward(); break;
		case 'C': moveCursorBackward(); break;		  
		case 'D': switchInputMode(); break;
		case '*': removeCurrentElementMoveBackward(); break;
		case '#': removeCurrentElementMoveForward(); break;
		default:
			if(key){
				if(cursorPoint <= active->finish){
					inputLine[cursorPoint] = key;
					if(cursorPoint == active->finish){
						jumpField(true, false, false);
					} else {
						cursorPoint++;
					}
					displayInput();	  
				} 	
			}
		break;
		}
}
Example #8
0
void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
	CORO_BEGIN_CONTEXT;
	CORO_END_CONTEXT(_ctx);

	CORO_BEGIN_CODE(_ctx);

	// Poll of input devices
	_input.poll();

	if (_bMustEnterMenu && GLOBALS._bIdleExited) {
		_bOption = true;
		_bMustEnterMenu = false;
		GLOBALS._bIdleExited = false;
	}

	if (_bOption) {
		CORO_INVOKE_1(_opt.doFrame, &_input);
		_bOption = !_opt.isClosing();
		if (!_bOption) {
			disableMouse();
			enableInput();
			mpalStartIdlePoll(_nCurLoc);
			g_vm->pauseSound(false);
		}
	}

	if (bDrawLocation && _bLocationLoaded) {
		// Location and objects
		_loc.doFrame(&_bigBuf);

		// Check the mouse input
		if (_bInput && !_tony.inAction()) {
			// If we are on the inventory, it is it who controls all input
			if (_inv.haveFocus(_input.mousePos()) && !_inter.active()) {
				// Left Click
				// **********
				if (_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) {
					// Left click activates the combine, if we are on an object
					if (_inv.leftClick(_input.mousePos(), _curActionObj)) {
						_curAction = TA_COMBINE;
						_point.setAction(_curAction);
					}
				} else

					// Right Click
					// ***********
					if (_input.mouseRightClicked()) {
						if (_itemName.isItemSelected()) {
							_curActionObj = 0;
							_inv.rightClick(_input.mousePos());
						} else
							_inv.rightClick(_input.mousePos());
					} else

						// Right Release
						// *************
						if (_input.mouseRightReleased()) {
							if (_inv.rightRelease(_input.mousePos(), _curAction)) {
								CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction);

								_curAction = TA_GOTO;
								_point.setAction(_curAction);
							}
						}
			} else {
				// Options Menu
				// ************
				if (_bGUIOption) {
					if (!_tony.inAction() && _bInput) {
						if ((_input.mouseLeftClicked() && _input.mousePos()._x < 3 && _input.mousePos()._y < 3)) {
							CORO_INVOKE_1(openOptionScreen, 0);
							goto SKIPCLICKSINISTRO;
						} else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
							CORO_INVOKE_1(openOptionScreen, 0);
						else if (!g_vm->getIsDemo()) {
							if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5))
								// Save game screen
								CORO_INVOKE_1(openOptionScreen, 4);
							else if (_input.getAsyncKeyState(Common::KEYCODE_F2) || _input.getAsyncKeyState(Common::KEYCODE_F7))
								// Load game screen
								CORO_INVOKE_1(openOptionScreen, 3);
						}
					}
				}

				// Left Click
				// **************
				if (_input.mouseLeftClicked() && !_inter.active()) {

					if (_curAction != TA_COMBINE)
						CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction());
					else if (_itemName.getSelectedItem() != NULL)
						CORO_INVOKE_4(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj);

					if (_curAction == TA_COMBINE) {
						_inv.endCombine();
						_point.setSpecialPointer(RMPointer::PTR_NONE);
					}

					_curAction = TA_GOTO;
					_point.setAction(_curAction);
				}

SKIPCLICKSINISTRO:
				// Right Click
				// ************
				if (_curAction == TA_COMBINE) {
					// During a combine, it cancels it
					if (_input.mouseRightClicked()) {
						_inv.endCombine();
						_curActionObj = 0;
						_curAction = TA_GOTO;
						_point.setAction(_curAction);
						_point.setSpecialPointer(RMPointer::PTR_NONE);
					}
				} else if (_input.mouseRightClicked() && _itemName.isItemSelected() && _point.getSpecialPointer() == RMPointer::PTR_NONE) {
					if (_bGUIInterface) {
						// Before opening the interface, replaces GOTO
						_curAction = TA_GOTO;
						_curActionObj = 0;
						_point.setAction(_curAction);
						_inter.clicked(_input.mousePos());
					}
				}


				// Right Release
				// *************
				if (_input.mouseRightReleased()) {
					if (_bGUIInterface) {
						if (_inter.released(_input.mousePos(), _curAction)) {
							_point.setAction(_curAction);
							CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction);

							_curAction = TA_GOTO;
							_point.setAction(_curAction);
						}
					}
				}
			}

			// Update the name under the mouse pointer
			_itemName.setMouseCoord(_input.mousePos());
			if (!_inter.active() && !_inv.miniActive())
				CORO_INVOKE_4(_itemName.doFrame, _bigBuf, _loc, _point, _inv);
		}

		// Interface & Inventory
		_inter.doFrame(_bigBuf, _input.mousePos());
		_inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.inAction() && !_inter.active() && _bGUIInventory));
	}

	// Animate Tony
	CORO_INVOKE_2(_tony.doFrame, &_bigBuf, _nCurLoc);

	// Update screen scrolling to keep Tony in focus
	if (_tony.mustUpdateScrolling() && _bLocationLoaded) {
		RMPoint showThis = _tony.position();
		showThis._y -= 60;
		_loc.updateScrolling(showThis);
	}

	if (_bLocationLoaded)
		_tony.setScrollPosition(_loc.scrollPosition());

	if ((!_tony.inAction() && _bInput) || _bAlwaysDrawMouse) {
		_point.showCursor();
	} else {
		_point.hideCursor();
	}
	_point.doFrame();

	// **********************
	// Draw the list in the OT
	// **********************
	CORO_INVOKE_0(_bigBuf.drawOT);

#define FSTEP (480/32)

	// Wipe
	if (_bWiping) {
		switch (_nWipeType) {
		case 1:
			if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top >= FSTEP * 2)) {
				CoroScheduler.setEvent(_hWipeEvent);
				_nWipeType = 3;
				break;
			}

			_rcWipeEllipse.top += FSTEP;
			_rcWipeEllipse.left += FSTEP;
			_rcWipeEllipse.right -= FSTEP;
			_rcWipeEllipse.bottom -= FSTEP;
			break;

		case 2:
			if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top < 480 - FSTEP)) {
				CoroScheduler.setEvent(_hWipeEvent);
				_nWipeType = 3;
				break;
			}

			_rcWipeEllipse.top -= FSTEP;
			_rcWipeEllipse.left -= FSTEP;
			_rcWipeEllipse.right += FSTEP;
			_rcWipeEllipse.bottom += FSTEP;
			break;
		}
	}

	CORO_END_CODE;
}
Example #9
0
void InputLine::readLetters(char key){
	if(cursorMove){
		if(cursorMoveTimer < 1){
		    if(cursorPoint < active->finish){
				cursorMove = false;
				cursorMoveTimer = CURSORMOVETIME;
				cursorPoint++;
				displayInput();
				lastChar = '/';
			} else {
				if(jumpField(true, false, true)){
					displayInput();
					lastChar = '/';
				}
			}
		} else {
			cursorMoveTimer--;      
		}
	}
	
	switch (key){
		case 'A': enableInput(false); break;
		case 'B': moveCursorForward(); break;
		case 'C': moveCursorBackward(); break;		  
		case 'D': switchInputMode(); break;
		case '*': removeCurrentElementMoveBackward(); break;
		case '#': removeCurrentElementMoveForward(); break;
		default:
			//no key assigned to 0 while reading letters
			if(key && key != '0'){
				if(cursorPoint <= active->finish){
					if(lastChar == key){
						int pos = key - '0';
						if(charCount > 2){
							charCount = 0;
						}
						cursorMoveTimer = CURSORMOVETIME;
						inputLine[cursorPoint] = alphaNumeric[pos-1][charCount];
						charCount++;
						cursorMoveTimer = CURSORMOVETIME;
						displayInput();
					} else {
						int pos = key - '0';
						charCount = 0;
						if(cursorMove == true){
							if(cursorPoint < active->finish){
								cursorPoint++;
							}else{
								jumpField(true, false, true);
							}
						} 
						//check if the input mode is still alphabetic
						//it might have been changed by jumping to next input field
						if(currentReadMode == 1){
							inputLine[cursorPoint] = alphaNumeric[pos-1][charCount];
							cursorMove = true;
							cursorMoveTimer = CURSORMOVETIME;
							lastChar = key;
						}
						displayInput();	  
					}
				}
					
			} 
		break;
		}
}