Пример #1
0
static void processStartBlock(int idxBlock) {
	EnumAction actionCode;
	int idxAction;
	CtnrBlock *block, *insertBlock;

	block = &context.package->blocks[idxBlock];
	insertBlock = getStartInsert(block->actionStartEnd, block->idxFirstAction);
	if (insertBlock)
		insertSound(getFileFromBlock(insertBlock),insertBlock,FALSE);
	actionCode = getStartCode(block,&idxAction,STARTING);
	if (idxAction >= 0)
		takeAction(&context.package->actions[idxAction],actionCode);
	else
		takeAction(NULL,actionCode);
}
Пример #2
0
static void processButtonEvent(int eventType) {
	Action *action = NULL;
	EnumAction actionCode;
	
	if (context.idxActiveList != -1) {
		action = getListActions(&pkgSystem.lists[context.idxActiveList]);
		while (action && !isEventInAction(action,eventType,context.isPaused))
			action = getNextAction(action);
	}
	if (!action)
		action = getMatchingAction(eventType);

	if (action)
		takeAction(action, -1);
	if (context.returnPackage) {
		if (action) {
			actionCode = getActionCode(action);
			if (actionCode == VOLUME_UP || actionCode == VOLUME_DOWN || actionCode == VOLUME_NORMAL
				|| actionCode == SPEED_UP || actionCode == SPEED_DOWN || actionCode == SPEED_NORMAL
				|| actionCode == JUMP_TIME || actionCode == PLAY_PAUSE || actionCode == PAUSE)
					context.package = context.returnPackage; // reset what might have been set in getMatchingAction
		}
		context.returnPackage = NULL;
	}
}
Пример #3
0
QAction *ActionCollection::addAction(const QString &name, QAction *action) {
  if(!action)
    return action;

  const QString origName = action->objectName();
  QString indexName = name;

  if(indexName.isEmpty())
    indexName = action->objectName();
  else
    action->setObjectName(indexName);
  if(indexName.isEmpty())
    indexName = indexName.sprintf("unnamed-%p", (void *)action);

  // do we already have this action?
  if(_actionByName.value(indexName, 0) == action)
    return action;
  // or maybe another action under this name?
  if(QAction *oldAction = _actionByName.value(indexName))
    takeAction(oldAction);

  // do we already have this action under a different name?
  int oldIndex = _actions.indexOf(action);
  if(oldIndex != -1) {
    _actionByName.remove(origName);
    _actions.removeAt(oldIndex);
  }

  // add action
  _actionByName.insert(indexName, action);
  _actions.append(action);

  foreach(QWidget *widget, _associatedWidgets) {
    widget->addAction(action);
  }
Пример #4
0
/*
	handle info
*/
void handleInfo(int type){
	// clock_t start, finish;
	// double duration;
	// fprintf(file, "handle info type: %d\n", type);
	switch(type){
		case 0: // seat info
			initEveryHandParams();
			splitSeatInfo(tmpInfo);
			fprintf(file, "-----------------hand %d------------------\n\n", pubInfo.handNum);
			fprintf(file, "my seat: %d \n", myInfo.mySeat);
			break;
		case 1: // blind info
			splitBlindInfo(tmpInfo, &(pubInfo.smallBlind), &(pubInfo.bigBlind));
			break;
		case 2: // hand card
			splitHandCardInfo(tmpInfo, myInfo.handCard);
			printCard("handcard");
			pubInfo.progress = PRGS_PREFLOP; //pre flop
			break;
		case 3: // inqure and take action !!!!
			// start = clock();
			splitInquireInfo(tmpInfo, pubInfo.inquire);
			takeAction();
			// finish = clock();
			// duration = (double)(finish - start) / CLOCKS_PER_SEC;
			// fprintf(file, "take action use %f ms\n", duration*1000);
			break;
		case 4: // flop
			splitPublicCardInfo(tmpInfo, pubInfo.publicCard, "flop");
			printCard("flop");
			pubInfo.progress = PRGS_FLOP; // flop
			break;
		case 5: // turn
			splitPublicCardInfo(tmpInfo, pubInfo.publicCard, "turn");
			printCard("turn");
			pubInfo.progress = PRGS_TURN; //turn
			break;
		case 6: // river
			splitPublicCardInfo(tmpInfo, pubInfo.publicCard, "river");
			printCard("river");
			pubInfo.progress = PRGS_RIVER; //river
			break;
		case 7: //show down info
			splitShowDownInfo(tmpInfo);
			break;
		case 8: // pot win
			splitPotWinInfo(tmpInfo);
			break;
		case 9: // notify
			//splitInquireInfo(tmpInfo, pubInfo.notify);
			break;
		default:
			break;
	}
	return ;
}
Пример #5
0
static EnumAction processEndBlock(int idxBlock) {
	// This fct checks for a sound insert and calls block's end action.
	// It returns the actionCode that was processed and calls TakeAction() if not continue.

	EnumAction actionCode;
	int idxAction;
	CtnrBlock *block, *insertBlock;
	block = &context.package->blocks[idxBlock];
	
	insertBlock = getEndInsert(block->actionStartEnd, block->idxFirstAction);
	if (insertBlock)
		insertSound(getFileFromBlock(insertBlock),insertBlock,FALSE);
	actionCode = getEndCode(block,&idxAction,PLAYING);
	if (actionCode != NOP) {
		if (actionCode == PAUSE)
			context.idxPausedOnBorder = idxBlock;
		if (idxAction >= 0)
			takeAction(&context.package->actions[idxAction],actionCode);
		else
			takeAction(NULL,actionCode);	
	}
	return actionCode;
}
Пример #6
0
ErrorPopup::ErrorPopup(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::ErrorPopup)
{
	ui->setupUi(this);
	whichfix = 0;
	wasfixed = false;
	for(unsigned char i = 0; i < fixcount; ++i)
		fixes[i] = nullptr;
	ui->fix1Choice->setDisabled(true);
	ui->fix2Choice->setDisabled(true);
	ui->fix3Choice->setDisabled(true);
	ui->fix4Choice->setDisabled(true);
	ui->fix5Choice->setDisabled(true);
	ui->fix6Choice->setDisabled(true);
	ui->fix7Choice->setDisabled(true);
	connect(ui->applyButton,SIGNAL(clicked()),SLOT(takeAction()));
}
Пример #7
0
    void PersonModel::takeAction(const State &state, 
                                 const Action &action, 
                                 float &reward, 
                                 State &next_state, 
                                 bool &terminal, 
                                 int &depth_count, 
                                 boost::shared_ptr<RNG> rng) {

      float unused_utility_loss, unused_time_loss;
      std::vector<State> unused_frame_vector;
      takeAction(state, 
                 action, 
                 reward, 
                 next_state, 
                 terminal, 
                 depth_count, 
                 rng,
                 unused_time_loss, 
                 unused_utility_loss, 
                 unused_frame_vector);
    }
Пример #8
0
bool Input::translateGameInput() {

	if (_engineFlags & kEnginePauseJobs) {
		return false;
	}

	if (_hasDelayedAction) {
		// if walking is over, then take programmed action
		takeAction(_delayedActionZone);
		_hasDelayedAction = false;
		_delayedActionZone.reset();
		return true;
	}

	if (_mouseButtons == kMouseRightDown) {
		// right button down shows inventory
		enterInventoryMode();
		return true;
	}

	Common::Point mousePos;
	getAbsoluteCursorPos(mousePos);
	// test if mouse is hovering on an interactive zone for the currently selected inventory item
	ZonePtr z = _vm->hitZone(_activeItem._id, mousePos.x, mousePos.y);

	if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) {
		walkTo(mousePos);
		return true;
	}

	trackMouse(z);
	if (!z) {
		return true;
	}

	if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (ACTIONTYPE(z) == kZoneCommand))) {

		bool noWalk = z->_flags & kFlagsNoWalk;	// check the explicit no-walk flag
		if (_gameType == GType_BRA) {
			// action performed on object marked for self-use do not need walk in BRA
			noWalk |= ((z->_flags & kFlagsYourself) != 0);
		}

		if (noWalk) {
			takeAction(z);
		} else {
			// action delayed: if Zone defined a moveto position the character is programmed to move there,
			// else it will move to the mouse position
			_delayedActionZone = z;
			_hasDelayedAction = true;
			if (z->_moveTo.y != 0) {
				mousePos = z->_moveTo;
			}

			walkTo(mousePos);
		}

		_vm->beep();
		setArrowCursor();
		return true;
	}

	return true;
}