Example #1
0
void sceneHandler10_clickGum() {
	if (g_vars->scene10_hasGum) {
		if (sceneHandler10_inflaterIsBlind()) {
			if (g_vars->scene10_hasGum) {
				int x = g_vars->scene10_gum->_ox - 139;
				int y = g_vars->scene10_gum->_oy - 48;

				if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1) {
					MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_RIGHT);
					if (mq) {
						ExCommand *ex = new ExCommand(0, 17, MSG_SC10_CLICKGUM, 0, 0, 0, 1, 0, 0, 0);
						ex->_excFlags = 2;
						mq->addExCommandToEnd(ex);

						postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1);
					}
				} else {
					g_vars->scene10_hasGum = 0;

					chainQueue(QU_SC10_TAKEGUM, 1);
				}
			}
		} else {
			g_vars->scene10_inflater->changeStatics2(ST_NDV_SIT);

			if (g_fp->getObjectState(sO_Inflater) == g_fp->getObjectEnumState(sO_Inflater, sO_WithGum))
				g_vars->scene10_inflater->startAnim(MV_NDV_DENIES, 0, -1);
			else
				g_vars->scene10_inflater->startAnim(MV_NDV_DENY_NOGUM, 0, -1);
		}
	}
}
Example #2
0
void sceneHandler11_jumpOver(double angle) {
	MGMInfo mgminfo;

	sceneHandler11_emptySwing();

	g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0),
						  MV_MAN11_JUMPOVER, 0);
	g_fp->_aniMan->_priority = 0;

	mgminfo.staticsId2 = ST_MAN_1PIX;
	mgminfo.ani = g_fp->_aniMan;
	mgminfo.x1 = 1163;
	mgminfo.y1 = 837 - (int)(angle * 153.0);
	mgminfo.field_1C = 0;
	mgminfo.field_10 = 1;
	mgminfo.flags = 78;
	mgminfo.movementId = MV_MAN11_JUMPOVER;

	MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);

	if (mq) {
		g_vars->scene11_crySound = SND_11_022;

		ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0);
		ex->_excFlags = 2;

		mq->addExCommandToEnd(ex);

		if (!mq->chain(g_fp->_aniMan))
			delete mq;
	}
}
Example #3
0
void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *bhe) {
	debug(0, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName));

	MessageQueue *mq = 0;

	if (bhe->_flags & 1) {
		uint rnd = g_fullpipe->_rnd->getRandomNumber(32767);
		uint runPercent = 0;
		for (int i = 0; i < bhe->_itemsCount; i++) {
			if (!(bhe->_items[i]->_flags & 1) && bhe->_items[i]->_percent) {
				if ((rnd >= runPercent && rnd <= runPercent + bhe->_items[i]->_percent) || i == bhe->_itemsCount - 1) {
					mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
					break;
				}
				runPercent += bhe->_items[i]->_percent;
			}
		}
	} else {
		for (int i = 0; i < bhe->_itemsCount; i++) {
			if (!(bhe->_items[i]->_flags & 1) && delay >= bhe->_items[i]->_delay) {
				if (bhe->_items[i]->_percent) {
					if (g_fullpipe->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) {
						mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
						break;
					}
				}
			}
		}
	}

	if (mq) {
		mq->replaceKeyCode(-1, ani->_okeyCode);
		mq->chain(ani);
	}
}
void TeamDataProvider::handleMessages(MessageQueue& teamReceiver)
{
  if(theInstance)
    teamReceiver.handleAllMessages(*theInstance);

  teamReceiver.clear();
}
Example #5
0
void sceneHandler03_takeEgg(ExCommand *ex) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);

	if (mq && mq->getCount() > 0) {
		ExCommand *ex0 = mq->getExCommandByIndex(0);
		ExCommand *ex1 = mq->getExCommandByIndex(1);

		int egg1 = sceneHandler03_swallowedEgg1State();

		if (egg1 && ex0) {
			ex0->_parentId = egg1;
			sceneHandler03_pushEggStack();
		}

		if ( g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGAPL
			 && !g_vars->swallowedEgg2->_value.intValue
			 && !g_vars->swallowedEgg3->_value.intValue
			 && ex1) {

			if (ex1->_objtype == kObjTypeObjstateCommand) {
				ObjstateCommand *com = (ObjstateCommand *)ex1;

				com->_value = g_fp->getObjectEnumState(sO_EggGulper, sO_WantsNothing);
			}
		}
	}
}
Example #6
0
void OldDiversifiedKeccakPadding::pad(unsigned int rate, MessageQueue& queue) const
{
    append10star(8, queue);
    queue.appendByte(diversifier);
    queue.appendByte(rate/8);
    append10star(rate, queue);
}
Example #7
0
void sceneHandler25_animateBearders() {
	if (g_fp->_rnd->getRandomNumber(32767) < 218) {
		MessageQueue *mq;

		mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1);

		mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode);
		mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
		mq->chain(0);

		g_vars->scene25_beardersCounter = 0;

		if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) {
			mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1);

			mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode);
			mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
			mq->chain(0);

			if (g_fp->_rnd->getRandomNumber(32767) < 8191) {
				mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1);

				mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode);
				mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
				mq->chain(0);
			}
		}
	}
}
Example #8
0
bool MessageQueue::checkGlobalExCommandList1() {
	ExCommand *ex, *ex1;

	for (uint i = 0; i < getCount(); i++) {
		ex = getExCommandByIndex(i);

		if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
			continue;

		for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end(); it++) {
			ex1 = *it;

			if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27)
				continue;

			if (ex1->_keyCode != ex->_keyCode && ex1->_keyCode != -1 && ex->_keyCode != -1)
				continue;

			MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId);

			if (mq) {
				if (mq->getFlags() & 1)
					return false;
			}
		}
	}
	return true;
}
void CIMExportRequestDispatcher::handleEnqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
        "CIMExportRequestDispatcher::handleEnqueue");

    PEGASUS_ASSERT(message != 0);

    switch (message->getType())
    {
        case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
        {
            CIMExportIndicationResponseMessage* response =
                _handleExportIndicationRequest(
                    (CIMExportIndicationRequestMessage*) message);

            PEG_TRACE((
                TRC_HTTP,
                Tracer::LEVEL4,
                "_CIMExportRequestDispatcher::handleEnqueue(message) - "
                    "message->getCloseConnect() returned %d",
                message->getCloseConnect()));

            response->setCloseConnect(message->getCloseConnect());

            MessageQueue* queue = MessageQueue::lookup(response->dest);
            PEGASUS_ASSERT(queue != 0);

            queue->enqueue(response);
            break;
        }

        default:
            PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
            break;
    }
void CIMListenerIndicationDispatcher::handleEnqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_SERVER,
        "CIMListenerIndicationDispatcher::handleEnqueue");

    if(message!=NULL)
    {
        switch (message->getType())
        {
            case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
                {
                    CIMExportIndicationRequestMessage* request =
                        (CIMExportIndicationRequestMessage*)message;

                    CIMExportIndicationResponseMessage* response =
                        static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->
                            handleIndicationRequest(request);

                    MessageQueue* queue = MessageQueue::lookup(response->dest);
                    PEGASUS_ASSERT(queue != 0);
                    queue->enqueue(response);
                }
                break;
            default:
                break;
        }
    delete message;
    }

    PEG_METHOD_EXIT();
}
Example #11
0
void sceneHandler28_makeFaces(ExCommand *cmd) {
	g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB;

	g_vars->scene28_lighteningObject = 0;

	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
	if (mq) {
		int frames[5];

		frames[0] = MV_WMN28_IN_1;
		frames[1] = MV_WMN28_IN_2;
		frames[2] = MV_WMN28_IN_3;
		frames[3] = MV_WMN28_IN_4;
		frames[4] = MV_WMN28_IN_5;

		for (int i = 0; i < 5; i++) {
			int pos;

			while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0)
				;

			mq->getExCommandByIndex(i)->_messageNum = frames[pos];

			frames[pos] = 0;
		}
	}
}
void MessageQueueService::handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req)
{
   // remove the legacy message from the request and enqueue it to its destination
   Uint32 result = async_results::CIM_NAK;

   Message *legacy = req->_act;
   if (legacy != 0)
   {
      MessageQueue* queue = MessageQueue::lookup(req->_legacy_destination);
      if (queue != 0)
      {
         if (queue->isAsync() == true)
         {
            (static_cast<MessageQueueService *>(queue))->handleEnqueue(legacy);
         }
         else
         {
            // Enqueue the response:
            queue->enqueue(req->get_action());
         }

         result = async_results::OK;
      }
   }
   _make_response(req, result);
}
Example #13
0
void sceneHandler14_showBallMan() {
	if (g_vars->scene14_flyingBall) {
		g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 166, g_vars->scene14_dudeY + 40, MV_BAL14_TOGMA, 0);
		g_vars->scene14_flyingBall->_priority = 27;

		MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
		ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0);

		ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
		ex->_excFlags |= 2;
		ex->_field_24 = 1;
		mq->addExCommandToEnd(ex);

		ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0);
		ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
		ex->_excFlags |= 3;
		mq->addExCommandToEnd(ex);
		mq->chain(0);

		g_vars->scene14_flyingBall->startAnim(MV_BAL14_TOGMA, 0, -1);

		g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
		g_vars->scene14_flyingBall = 0;

		if (g_vars->scene14_dudeX >= 1300)
			sceneHandler14_exitScene();
	}
}
Example #14
0
void SendIPCMessage(ipc_message_t msg, bool blocking) {
    MessageQueue* q = msg.ConsumableEarly() ? ipcEarlyMessageQueue : ipcMessageQueue;
    msg.blocking = blocking;

#ifdef IPC_DEBUG
    lk_lock(printing_lock, 1);
    std::cerr << "[SEND] IPC message, ID: " << msg.id << std::endl;
    lk_unlock(printing_lock);
#endif

    lk_lock(lk_ipcMessageQueue, 1);
    q->push_back(msg);

    if (blocking)
        ackMessages->operator[](msg) = false;
    lk_unlock(lk_ipcMessageQueue);

    if (blocking) {
        lk_lock(lk_ipcMessageQueue, 1);
        while (ackMessages->at(msg) == false) {
            lk_unlock(lk_ipcMessageQueue);
            xio_sleep(10);
            lk_lock(lk_ipcMessageQueue, 1);
        }
        lk_unlock(lk_ipcMessageQueue);
    }
}
Example #15
0
void Kernel::writeIntoMessageQueue(Task* task, int length, int params[])  {
	int activeTaskId = _taskManager->getActiveTask()->id;

    if ((std::strcmp(_taskManager->getActiveTask()->name, "ScreenSwitcher") == 0) && (params[0] == 398)) {
        activeTaskId = -1;
        int nextTaskId = -1;
        Task** tasks = _taskManager->getTaskList();
        
        for (int i = _displayTaskId + 1; nextTaskId < 0; i++) {
            if (i >= MAX_TASKS) {
                i = 0;
            }
            if (tasks[i] != NULL) {
                nextTaskId = i;
            }
        }
        
        _displayTaskId = nextTaskId;
        params[1] = _displayTaskId;
    }

//    if (task->status == Blocked) {
//	   task->status = Ready;
//    }

	MemoryManager* memoryManager = task->memoryManager;
	MessageQueue* messageQueue = memoryManager->getMessageQueueWithoutVirtualOffset();

	if (!messageQueue->isFull())  {
		Message* message = memoryManager->createMessage(activeTaskId, length, params);
		messageQueue->pushMessage(message);
	};
}
Example #16
0
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL fibonacci(void * parm)
{
    Thread* my_thread = (Thread *)parm;
    parmdef * Parm = (parmdef *)my_thread->get_parm();
    int first = Parm->first;
    int second = Parm->second;
    int count = Parm->count;
    Condition * condstart = Parm->cond_start;
    MessageQueue * mq = Parm->mq;
    
    condstart->signal(my_thread->self());

    int add_to_type = 0;
    if (count < 20)
        add_to_type = 100;

    for (int i=0; i < count; i++)
    {
        int sum = first + second;
        first = second;
        second = sum;
        Message * message = new Message(i+add_to_type, 0, sum);
        mq->enqueue(message);
    }

    if (!add_to_type)
        Parm->th->thread_switch();

    my_thread->exit_self(0);
    return NULL;
}
Example #17
0
void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) {
    if (ani->_okeyCode || g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) {
        if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
            g_vars->scene26_activeVent = ani;

            int x = ani->_ox - 20;
            int y = ani->_oy + 61;

            if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
                MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP);

                if (mq) {
                    ExCommand *ex = new ExCommand(0, 17, MSG_SC26_CLICKVENT, 0, 0, 0, 1, 0, 0, 0);

                    ex->_excFlags |= 3;
                    ex->_keyCode = ani->_okeyCode;

                    mq->addExCommandToEnd(ex);

                    postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1);
                }
            } else {
                sceneHandler26_animateVents(ani);
            }
        }
    }

    cmd->_messageKind = 0;
}
void RebalanceImpl::truncateMessageQueueNotMyTopic()
{
	std::map<std::string, SubscriptionData> subTable = getSubscriptionInner();
	std::map<MessageQueue, ProcessQueue*>::iterator it = m_processQueueTable.begin();

	for ( ; it != m_processQueueTable.end(); it++)
	{
		MessageQueue mq = it->first;
		std::map<std::string, SubscriptionData>::iterator itt = subTable.find(mq.getTopic());

		if (itt == subTable.end())
		{
			ProcessQueue* pq = it->second;
			if (pq != NULL)
			{
				pq->setDroped(true);
				//TODO log.info("doRebalance, {}, truncateMessageQueueNotMyTopic remove unnecessary mq, {}",
				//	consumerGroup, mq);
			}
			std::map<MessageQueue, ProcessQueue*>::iterator ittmp = it;
			it++;
			m_processQueueTable.erase(ittmp);
		}
		else
		{
			it++;
		}
	}
}
Example #19
0
void sceneHandler32_trySit(ExCommand *cmd) {
	MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);

	if (!mq || mq->getCount() == 0)
		return;

	ExCommand *ex = mq->getExCommandByIndex(0);

	if (g_vars->scene32_cactusIsGrowing || g_vars->scene32_cactus->_movement
		|| g_vars->scene32_cactus->_statics->_staticsId != ST_CTS_EMPTY
		|| (g_vars->scene32_cactusCounter >= 0 && g_vars->scene32_cactusCounter <= 20)) {
		ex->_messageKind = 0;
		ex->_excFlags |= 1;
	} else {
		ex->_parentId = ANI_MAN;
		ex->_messageKind = 1;
		ex->_messageNum = MV_MAN32_SITDOWN;
		ex->_param = g_fp->_aniMan->_odelay;

		g_vars->scene32_dudeIsSitting = true;

		getCurrSceneSc2MotionController()->deactivate();
		getGameLoaderInteractionController()->disableFlag24();
	}
}
void SocketConnect::revMessage()
{
    CCLOG("RECEIVE THREAD HAS BEGAN !\n");
    
    SOCKET socket = this->socketSet;
    
    char buf[1024] = "";
    
    while (true) {
        if (-1 == recv(socket, buf, sizeof(buf), 0)) {
            CCLOG("RECEIVE ERROR !\n");
        }
        else{
            
            MessageQueue * queue = MessageQueueManager::getInstance()->getRevQueue();
            
            SocketMessage * msg = SocketMessage::create();
            msg->setData(buf);
            
            CCLOG("CLIENT HAS RECEIVE : %s",msg->getData().c_str());
            
            if (msg->dataLength() > 0) {
                
                queue->queueLck();
                MessageQueueManager::getInstance()->sendMsgToRevQueue(msg);
                queue->queueUnlck();
                
                memset(buf, 0, 1024);
            }else{
                CCLOG("MAYBE SOMETHING WRONG !\n");
            }
        }
    }
}
MessageQueue * MessageQueue::create()
{
    MessageQueue * ret = new MessageQueue();
    if (ret && ret->init()) {
        return ret;
    }
    return nullptr;
}
Example #22
0
void sceneHandler28_clickLift(int numLift) {
	int x = 0;

	debugC(2, kDebugSceneLogic, "scene28: clickLift(%d)", numLift);

	switch (numLift) {
	case 0: x = 600; break;
	case 1: x = 824; break;
	case 2: x = 1055; break;
	case 3: x = 1286; break;
	case 4: x = 1517; break;
	case 5: x = 1748; break;
	case 6: x = 1979; break;
	}

	if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1
		|| g_fp->_aniMan->_movement
		|| g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
		debugC(2, kDebugSceneLogic, "scene28: clickLift: overwrite");

		MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, 472, 1, ST_MAN_UP);
		if (mq) {
			ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0);
			ex->_excFlags |= 3;
			ex->_param = numLift;

			mq->addExCommandToEnd(ex);

			postExCommand(g_fp->_aniMan->_id, 2, x, 472, 0, -1);
		}
	} else {
		switch (numLift) {
		case 0:
			sceneHandler28_lift0Start();
			break;
		case 1:
			sceneHandler28_lift1Start();
			break;
		case 2:
			sceneHandler28_lift2Start();
			break;
		case 3:
			sceneHandler28_lift3Start();
			break;
		case 4:
			sceneHandler28_lift4Start();
			break;
		case 5:
			sceneHandler28_lift5Start();
			break;
		case 6:
			sceneHandler28_lift6Start();
			break;
		default:
			return;
		}
	}
}
Example #23
0
static void CALLBACK PromiseContinuationCallback(JsValueRef task, void *callbackState)
{
    Assert(task != JS_INVALID_REFERENCE);
    Assert(callbackState != JS_INVALID_REFERENCE);
    MessageQueue * messageQueue = (MessageQueue *)callbackState;

    WScriptJsrt::CallbackMessage *msg = new WScriptJsrt::CallbackMessage(0, task);
    messageQueue->InsertSorted(msg);
}
Example #24
0
void scene32_initScene(Scene *sc) {
	g_vars->scene32_flagIsWaving = false;
	g_vars->scene32_flagNeedsStopping = false;
	g_vars->scene32_dudeIsSitting = false;
	g_vars->scene32_cactusCounter = -1;
	g_vars->scene32_dudeOnLadder = false;
	g_vars->scene32_cactusIsGrowing = false;
	g_vars->scene32_flag = sc->getStaticANIObject1ById(ANI_FLAG, -1);
	g_vars->scene32_cactus = sc->getStaticANIObject1ById(ANI_CACTUS, -1);
	g_vars->scene32_massOrange = sc->getStaticANIObject1ById(ANI_TESTO_ORANGE, -1);
	g_vars->scene32_massBlue = sc->getStaticANIObject1ById(ANI_TESTO_BLUE, -1);
	g_vars->scene32_massGreen = sc->getStaticANIObject1ById(ANI_TESTO_GREEN, -1);
	g_vars->scene32_button = sc->getStaticANIObject1ById(ANI_BUTTON_32, -1);

	g_vars->scene32_massOrange->startAnim(MV_TSTO_FLOW, 0, -1);
	g_vars->scene32_massOrange->_movement->setDynamicPhaseIndex(15);

	g_vars->scene32_massGreen->startAnim(MV_TSTG_FLOW, 0, -1);
	g_vars->scene32_massGreen->_movement->setDynamicPhaseIndex(26);

	Scene *oldsc = g_fp->_currentScene;
	StaticANIObject *ani;

	if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Lies)) {
		ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1);
		if (ani) {
			g_fp->_currentScene = sc;

			ani->changeStatics2(ST_HDL_LAID);
		}
	} else {
		if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) {
			ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1);

			g_fp->_currentScene = sc;

			if (ani)
				ani->changeStatics2(ST_HDL_PLUGGED);

			g_vars->scene32_button->changeStatics2(ST_BTN32_ON);
		}
	}

	g_fp->_currentScene = oldsc;

	if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) {
		MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK32_START), 0, 0);

		mq->sendNextCommand();
	}

	g_fp->lift_setButton(sO_Level9, ST_LBN_9N);
	g_fp->lift_init(sc, QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT);

	g_fp->initArcadeKeys("SC_32");
}
Example #25
0
void sceneHandler27_showNextBat() {
    if (g_vars->scene27_bat) {
        MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC27_SHOWBET), 0, 1);

        mq->setParamInt(-1, g_vars->scene27_bat->_odelay);
        mq->chain(0);
    }

    g_vars->scene27_batHandler->_priority = 1045;
}
Example #26
0
void TeamDataProvider::handleMessages(MessageQueue& teamReceiver)
{
  if(theInstance)
  {
    teamReceiver.handleAllMessages(*theInstance);
    TEAM_OUTPUT(idRobot, bin, theInstance->theRobotInfoBH.number);
  }

  teamReceiver.clear();
}
Example #27
0
void main()
{
  MessageQueue outQ;
  FileTransfer ft(outQ);
  
  ft.EnQ(new FileTransfer::PutFile("C:\\tmp\\a.txt"));
  Message *rsp = outQ.deQ();

  std::cout << "Success = " << rsp->Headers()["Success"] << std::endl;
}
void SocketConnect::sendMessage()
{
    CCLOG("SEND THREAD HAS BEGAN !\n");
    SOCKET socket = this->socketSet;
    MessageQueue * queue = MessageQueueManager::getInstance()->getSendQueue();
    while (true)
    {
        if (queue->getQueueSize() > 0)
        {
            CCLOG("SENDQUEUE SIZE IS %d\n",queue->getQueueSize());
            
            queue->queueLck();
            SocketMessage *  msg = queue->frontQueue();
            queue->queueUnlck();
            
            CCLOG("SEND TO SERVER FROM SENDQUEUE : %s, DATA LENGTHT : %d\n",msg->getData().c_str(),msg->dataLength());
        
            if (-1 == send(socket, msg->getData().c_str(), msg->dataLength(), 0)) {
                CCLOG("SEND TO SERVER ERROR ! WILL BE TRY TO SEND AGAGIN !\n");
            }
            else{
                CCLOG("SEND TO SERVER SUCCESS !\n");
                
                queue->queueLck();
                queue->popQueue();
                queue->queueUnlck();
                delete msg;
            }
        }
        else{
           // CCLOG("QUEUE IS EMPTY !");
        }
    }
}
Example #29
0
/*
 * Process Any Waiting Decided Data
 * Push to the Parser for Display
 */
void SequenceManager::update()
{
    //std::cout << "SequenceManager upadate() " << std::endl;


    if(TheQueueManager::Instance()->m_queue.isEmpty())
        return;

    /*
     * Loop the Queue and Send all decoded data
     * Through to be parsed and displayed.
     */
    MessageQueue msgQueue;
    while(!TheQueueManager::Instance()->m_queue.isEmpty())
    {
        msgQueue = std::move(TheQueueManager::Instance()->m_queue.dequeue());
        if(msgQueue.m_text.empty())
        {
            // Make Sure Vector is not Empty!
            if(msgQueue.m_queueParams.size() > 0)
            {
                TheSequenceParser::Instance()->sequenceInput(
                    msgQueue.m_queueParams);
            }
        }
        else
        {
            TheSequenceParser::Instance()->textInput(
                msgQueue.m_text);
        }
        msgQueue.clear();
    }

    /*
     * Render The final screen data
     * 1. Copy Surface to Texture
     * 2. Render the Texture to Monitor.
     */

    TheRenderer::Instance()->renderScreen();
    TheRenderer::Instance()->drawTextureScreen();

    // When no data received, this is when we want to show the cursor!
    // Setup cursor in current x/y position Cursor. after getting
    // New Data Received.
    if (TheSequenceParser::Instance()->isCursorActive())
    {
       TheRenderer::Instance()->setupCursorChar();
       TheRenderer::Instance()->renderCursorOnScreen();
       TheRenderer::Instance()->drawTextureScreen();
    }

    // Clear And Move on.
    msgQueue.clear();
}
Example #30
0
void sceneHandler26_animateVents(StaticANIObject *ani) {
    int qId = 0;

    switch (ani->_okeyCode) {
    case 0:
        if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Closed))
            qId = QU_SC26_OPEN1;
        else
            qId = QU_SC26_CLOSE1;

        break;

    case 1:
        if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Closed))
            qId = QU_SC26_OPEN2;
        else
            qId = QU_SC26_CLOSE2;

        break;

    case 2:
        if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Closed))
            qId = QU_SC26_OPEN3;
        else
            qId = QU_SC26_CLOSE3;

        break;

    case 3:
        if (g_fp->getObjectState(sO_Valve4_26) == g_fp->getObjectEnumState(sO_Valve4_26, sO_Closed))
            qId = QU_SC26_OPEN4;
        else
            qId = QU_SC26_CLOSE4;

        break;

    case 4:
        if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed))
            qId = QU_SC26_OPEN5;
        else
            qId = QU_SC26_CLOSE5;

        break;

    default:
        return;
    }

    if (qId) {
        MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId);

        mq->setFlags(mq->getFlags() | 1);
        mq->chain(0);
    }
}