Ejemplo n.º 1
0
SCRIPTCALL Script::op4_mouse()
{
	parameter = getParameter();

	word function = parameter->get(0);
	switch (function) {
		case 0:
			input->showCursor();
			break;
		case 1:
			input->hideCursor();
			break;
		case 2:
			break;
		case 3:
			input->setCursorPosition(parameter->get(1), parameter->get(2));
			break;
		case 4:
		default:
			input->loadCursorImage(parameter->get(1));
			input->setCursorImage(CURSOR_FIRSTFRAME);
	}

	deleteParameter();

	return RETURN_NORMAL;
}
Ejemplo n.º 2
0
SCRIPTCALL Script::op4_dummy()
{
	parameter = getParameter();

	deleteParameter();

	return RETURN_NORMAL;
}
Ejemplo n.º 3
0
	FunctionParametersDialog::FunctionParametersDialog(const QString &name, const std::vector<unsigned> &parameters)
	{
		QVBoxLayout *mainLayout = new QVBoxLayout;
		
		// title
		QHBoxLayout *titleLayout = new QHBoxLayout;
		titleLayout->addWidget(new QLabel(QString("<b>%0</b>").arg(name)));
		titleLayout->addStretch();
		
		addParameterButton = new QPushButton(QIcon(":/images/add.png"), "");
		addParameterButton->setMinimumSize(20, 20);
		titleLayout->addWidget(addParameterButton);
		
		delParameterButton = new QPushButton(QIcon(":/images/remove.png"), "");
		delParameterButton->setMinimumSize(20, 20);
		delParameterButton->setDisabled(true);
		titleLayout->addWidget(delParameterButton);
		
		// parameter table
		parametersTable = new QTableWidget(0, 3);
		parametersTable->setShowGrid(false);
		parametersTable->verticalHeader()->hide();
		parametersTable->horizontalHeader()->hide();
		//parametersTable->setSelectionMode(QAbstractItemView::NoSelection);
		parametersTable->setSelectionMode(QAbstractItemView::SingleSelection);
		parametersTable->setSelectionBehavior(QAbstractItemView::SelectRows);
		parametersTable->setItemDelegateForColumn(0, &spinBoxDelegate);
		
		// fill table
		parametersTable->resizeColumnToContents(1);
		parametersTable->resizeColumnToContents(2);
		for (size_t i = 0; i < parameters.size(); i++)
			addEntry(parameters[i]);
		parametersTable->resizeRowsToContents();
		
		// ok button
		QPushButton *okButton = new QPushButton(tr("OK"));
		okButton->setDefault(true);
		
		// connections
		connect(addParameterButton, SIGNAL(clicked()), SLOT(addParameter()));
		connect(delParameterButton, SIGNAL(clicked()), SLOT(deleteParameter()));
		connect(parametersTable, SIGNAL(itemSelectionChanged()), SLOT(argumentSelectionChanged()));
		connect(parametersTable, SIGNAL(cellClicked ( int , int )), SLOT(cellClicked ( int , int )));
		connect(okButton, SIGNAL(clicked()), SLOT(accept()));
		
		// layout
		mainLayout->addLayout(titleLayout);
		mainLayout->addWidget(parametersTable);
		mainLayout->addWidget(okButton);
		
		// main
		setLayout(mainLayout);
		resize(240, 240);
		setWindowTitle(tr("Native function"));
	}
Ejemplo n.º 4
0
SCRIPTCALL Script::op_setColor()
{
	parameter = getParameter();

	memory->b_SystemVariable->writeWord(iw_Video_Color, parameter->get(0));

	deleteParameter();

	return RETURN_NORMAL;
}
/// Function name  : deleteParameterArray
// Description     : Delete a ParameterArray object, but do not attempt to free the PARAMETER objects it contains
// 
// PARAMETER_ARRAY*  &pArray   : [in] ParameterArray to delete
// 
VOID  deleteParameterArray(PARAMETER_ARRAY*  &pArray)
{
   // Delete Parameters
   for (UINT i = 0; i < pArray->iSize; i++)
   {
      // Items are not necessarily contiguous
      if (pArray->pItems[i])
         deleteParameter(pArray->pItems[i]);
   }

   // Delete parameter storage array
   utilDeleteObject(pArray->pItems);

   // Delete calling object
   utilDeleteObject(pArray);
}
Ejemplo n.º 6
0
SCRIPTCALL Script::op_setDialogueColor()
{
	parameter = getParameter();
	word color = memory->b_SystemVariable->queryWord(iw_Video_Color0 + (parameter->get(0) * 2));
	deleteParameter();

	memory->b_SystemVariable->writeWord(iw_Video_Palette8, color);
	video->setIntermediateColor(8, color);
	video->setColor(8, color);

	//HACK: it's too slow and needless
	//video->updateScreen();

	animation->setSlot(SLOT_ACTIVATE, 1);

	return RETURN_NORMAL;
}
Ejemplo n.º 7
0
ScriptParameter* Script::getParameter()
{
	//assert(parameter == NULL);
	deleteParameter();

	ScriptParameter *parameter = new ScriptParameter(memory);

	byte code;
	while (true) {
		code = fetch();
		if (code == CODE_PARAMETER_STRING) {
			parameter->add(PARAMETER_TYPE_STRING, getOffset());

			advance();
			while (fetchAdvance() != CODE_PARAMETER_STRING) {
				;
			}
		}
		else if (code == CODE_PARAMETER_BLOCK) {
			parameter->add(PARAMETER_TYPE_BLOCK, getOffset());

			skipScriptBlock();
		}
		else {
			if ((code == CODE_CONSTANT_1OP) || (code == CODE_CONSTANT_2OP) || (code == CODE_CONSTANT_3OP) || ((code >= CODE_CONSTANT_RE_FIRST) && (code <= CODE_BASEVARIABLE_LAST))) {
				parameter->add(PARAMETER_TYPE_CONSTANT, readExpression());
			}
			else {
				break;
			}
		}

		code = fetch();
		if (code == CODE_CONTINUE) {
			advance();
			continue;
		}
		else {
			break;
		}
	}

	return parameter;
}
Ejemplo n.º 8
0
SCRIPTCALL Script::op4_blitSwapped()
{
	parameter = getParameter();

	word source_coord_x0b = parameter->get(0);
	word source_coord_y0 = parameter->get(1);
	word source_coord_x1b = parameter->get(2);
	word source_coord_y1 = parameter->get(3);
	byte source_type = (byte) parameter->get(4);
	word destination_coord_xb = parameter->get(5);
	word destination_coord_y = parameter->get(6);
	byte destination_type = (byte) parameter->get(7);

	deleteParameter();

	video->blit(BLIT_SWAPPED, source_coord_x0b, source_coord_y0, source_coord_x1b, source_coord_y1, source_type, destination_coord_xb, destination_coord_y, destination_type);

	return RETURN_NORMAL;
}
Ejemplo n.º 9
0
//-----------------------------------------------------------------------------
void Function::deleteOutputParameter(ParameterPtr parameter)
{
	deleteParameter(mOutputParameters, parameter);
}
Ejemplo n.º 10
0
//-----------------------------------------------------------------------------
void Function::deleteInputParameter(ParameterPtr parameter)
{
	deleteParameter(mInputParameters, parameter);
}
Ejemplo n.º 11
0
SCRIPTCALL Script::op4_displaySelection()
{
	parameter = getParameter();
	if (parameter->getType(0) == PARAMETER_TYPE_BLOCK) {
		memory->b_Procedure->writeWord(iwpo_Selection_List, parameter->get(0));
	}
	else {
		word procedure_index = parameter->get(0) * 2;
		word procedure_offset = memory->b_Procedure->queryWord(procedure_index);
		memory->b_Procedure->writeWord(iwpo_Selection_List, procedure_offset);
	}
	deleteParameter();

	memory->b_SystemVariable->writeWord(iwf_Selection_InUse, INUSE_TRUE);

	word script_offset = getOffset();

	SCRIPTCALL condition = RETURN_NORMAL;

	setOffset(memory->b_Procedure->queryWord(iwpo_Selection_ShowMenu));
	condition = parseNested();
	if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
		return condition;
	}

	while (true) {
		//TODO: debugmode
		animation->show();
		if (input->refresh() == false) {
			break;
		}

		if (memory->b_SystemVariable->queryWord(iwf_Selection_InUse) == INUSE_FALSE) {
			setOffset(script_offset);
			break;
		}

		setOffset(memory->b_Procedure->queryWord(iwpo_Selection_CheckPosition));
		condition = parseNested();
		if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
			return condition;
		}

		if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_OK) && input->check(INPUT_OK)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_OK));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_OK)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}
		else if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_CANCEL) && input->check(INPUT_CANCEL)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_Cancel));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_CANCEL)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}
		else if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_UP) && input->check(INPUT_UP)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_Up));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_UP)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}
		else if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_DOWN) && input->check(INPUT_DOWN)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_Down));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_DOWN)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}
		else if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_LEFT) && input->check(INPUT_LEFT)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_Left));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_LEFT)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}
		else if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RIGHT) && input->check(INPUT_RIGHT)) {
			setOffset(memory->b_Procedure->queryWord(iwpo_Selection_Right));
			condition = parseNested();
			if ((condition == RETURN_EXIT) || (condition == RETURN_ERROR)) {
				return condition;
			}

			if (memory->b_SystemVariable->testByte(ibf_Selection_Status, STATUS_RELEASED) == false) {
				while (input->check(INPUT_RIGHT)) {
					//TODO: debugmode
					animation->show();
					input->refresh();
				}
			}
		}

		//timer->delay();
	}

	return RETURN_NORMAL;
}
void EditConfigWindow::deleteOutput()
{
    deleteParameter(ConfigMap::OUTPUT_REGISTER);
}
void EditConfigWindow::deleteInput()
{
    deleteParameter(ConfigMap::INPUT_REGISTER);
}
void EditConfigWindow::deleteCoil()
{
    deleteParameter(ConfigMap::COIL);
}