bool CDoorbot::ActMsg(CActMsg *msg) { debugC(ERROR_DETAILED, kDebugScripts, "CDoorbot ActMsg action=%s v108=%d v110=%d v114=%d", msg->_action.c_str(), _introMovieNum, _field110, _field114); if (msg->_action == "DoorbotPlayerPressedTopButton") { disableMouse(); startTalking(this, 221471); } else if (msg->_action == "DoorbotPlayerPressedMiddleButton") { startTalking(this, 221470); } else if (msg->_action == "DoorbotPlayerPressedBottomButton") { startTalking(this, 221469); } else if (msg->_action == "DoorbotReachedEmbLobby") { startTalking(this, 221472); } else if (msg->_action == "PlayerPicksUpPhoto") { _field110 = 1; if (!_field114 && _introMovieNum == 4) { stopAnimTimer(_timerId); _timerId = 0; _introMovieNum = 5; startTalking(this, 221484); } } else if (msg->_action == "PlayerPutsPhotoInPet") { _field110 = 2; if (!_field114 && _introMovieNum == 5) { stopAnimTimer(_timerId); _timerId = 0; startTalking(this, 221486); disableMouse(); } } return true; }
bool CCage::ActMsg(CActMsg *msg) { if (msg->_action == "Shut") { if (!_open) { playClip("Shut", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); disableMouse(); } } else if (msg->_action == "Open") { if (_open) { playClip("Open", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT); disableMouse(); } } else if (msg->_action == "CoreReplaced") { CActMsg actMsg("Shut"); actMsg.execute(this); } else if (msg->_action == "OpenNow") { loadFrame(0); _open = false; } return true; }
bool CTitania::EnterViewMsg(CEnterViewMsg *msg) { if (_showIntro) { _showIntro = false; disableMouse(); petHide(); CSetFrameMsg frameMsg; frameMsg._frameNumber = 25; frameMsg.execute("Bomb"); playCutscene(0, 52); setVisible(false); CActMsg actMsg("TitaniaSpeech"); actMsg.execute("TitaniaSpeech"); } return true; }
void stopChopperDrop(ChopperDrop* game) { // unsubscribe devices unsubscribeKeyboard(); unsubscribeTimer(); unsubscribeMouse(); deleteBitmap(game->mouseCursor); deleteCurrentState(game); disableMouse(); cleanBuffer(); deleteMouse(); deleteTimer(game->timer); deleteDate(game->date); free(game); }
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; }
bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); if (_npcFlags & NPCFLAG_DOORBOT_INTRO) { // Initial speech by Doorbot in switch (msg->_dialogueId) { case 10552: playClip("SE Try Buttons", MOVIE_NOTIFY_OBJECT); _introMovieNum = 9; break; case 10553: enableMouse(); break; case 10557: playClip("SE Move To Right", MOVIE_NOTIFY_OBJECT); _introMovieNum = 11; break; case 10559: stopAnimTimer(_timerId); _timerId = addTimer(0, 2500, 0); break; case 10560: petShow(); petSetArea(PET_CONVERSATION); stopAnimTimer(_timerId); _timerId = addTimer(1, 1000, 0); break; case 10561: enableMouse(); _introMovieNum = 1; stopAnimTimer(_timerId); _timerId = addTimer(2, 10000, 0); break; case 10562: if (_introMovieNum == 1) { stopAnimTimer(_timerId); _timerId = addTimer(2, getRandomNumber(5000), 0); } break; case 10563: case 10564: disableMouse(); startTalking(this, 221480); break; case 10565: startTalking(this, 221481); break; case 10566: stopAnimTimer(_timerId); _timerId = 0; if (_field110 == 2) { playClip("Cloak On", MOVIE_NOTIFY_OBJECT); _introMovieNum = 6; } else { _timerId = addTimer(3, 2000, 0); } break; case 10567: { CActMsg actMsg("BecomeGettable"); actMsg.execute("Photograph"); enableMouse(); stopAnimTimer(_timerId); _timerId = addTimer(4, 5000, 0); break; } case 10568: // Start moving cursor to photograph mouseDisableControl(); mouseSetPosition(Point(600, 250), 2500); _timerId = addTimer(6, 2500, 0); break; case 10569: if (_field110 != 2) { stopAnimTimer(_timerId); _timerId = addTimer(5, 3000, 0); } break; case 10570: mouseSetPosition(Point(200, 430), 2500); _timerId = addTimer(7, 3000, 0); break; case 10571: playClip("Cloak On", MOVIE_NOTIFY_OBJECT); _introMovieNum = 6; break; default: break; } } return true; }
bool CDoorbot::TimerMsg(CTimerMsg *msg) { if (msg->_action == "NPCIdleAnim") { return CTrueTalkNPC::TimerMsg(msg); } else if (_npcFlags & NPCFLAG_DOORBOT_INTRO) { _timerId = 0; switch (msg->_actionVal) { case 0: startTalking(this, 221475); break; case 1: startTalking(this, 221476); break; case 2: startTalking(this, 221477); break; case 3: playClip("DoubleTake Start"); playClip("DoubleTake End"); playClip("DoubleTake Start"); playClip("DoubleTake End", MOVIE_NOTIFY_OBJECT); _introMovieNum = 3; break; case 4: startTalking(this, 221483); lockInputHandler(); _field114 = true; break; case 5: lockInputHandler(); mouseDisableControl(); _field114 = true; startTalking(this, 221485); break; case 6: // Start dragging photograph to PET CMouseButtonDownMsg::generate(); mouseSetPosition(Point(200, 430), 2500); _timerId = addTimer(7, 2500, 0); break; case 7: // Drop photograph in PET CMouseButtonUpMsg::generate(); startTalking(this, 221486); mouseEnableControl(); unlockInputHandler(); _field114 = false; disableMouse(); break; default: break; } } else if (msg->_action == "SummonBellbot") { CRoomItem *room = getRoom(); if (room) { CSummonBotMsg botMsg; botMsg._npcName = "Bellbot"; botMsg.execute(room); } _npcFlags &= ~NPCFLAG_4000000; } return true; }
int Player::collide(Object& other) { if (other.label() == SUPERFICIE || other.label() == PAREDE) { if (alturaMax - alturaChao >= 60) { queda.play(); vida-=40; barraDeVida.scale(vida/100.0,0.5); barraDeVida.position(20 + barraDeVida.width()/2,580 - barraDeVida.height()/2); alturaMax = 0; } else if (alturaMax - alturaChao >= 30) { queda2.play(); alturaMax = 0; } alturaChao = position().y(); pulo = true; return 1; } if (other.label() == VERMELHOBOX) { podeTeleportarVermelho = true; return 1; } if (other.label() == AZULBOX) { podeTeleportarAzul = true; return 1; } if (other.label() == INIMIGO) { if (vida > 0) { vida--; barraDeVida.scale(vida/100.0,0.5); barraDeVida.position(20 + barraDeVida.width()/2,580 - barraDeVida.height()/2); if (timer3 == 0) { dor.play(); timer3 = 30; } else if(timer4 == 0) { dor2.play(); timer4 = 30; } } if (vida <= 0) { if(!morto) { morte.play(); } control().disableAll(); disableMouse(); morto = true; } return 1; } if(other.label() == OCEANO) { if(timer2 == 0) { agua.play(); timer2 = 120; } alturaMax = 0; return 1; } if(other.label() == TOCHA) { return 1; } if(other.label() == BANDEIRA) { ending.play(); disableMouse(); venceu = true; return 1; } return 0; }
//=================================== // GetMouseData... //----------------------------------- MouseData* MouseGetData(void) { hd_data_t *hd_data = NULL; driver_info_t *di = NULL; MouseData* data = NULL; MouseData* first = NULL; MouseData* last = NULL; hd_t *hd = NULL; hd_t *first_dev = NULL; Display* dpy = NULL; int haveDisplay = 0; char buf[256] = ""; //=================================== // Open X11 display //----------------------------------- if ((dpy = XOpenDisplay (getenv("DISPLAY")))) { haveDisplay = 1; } //=================================== // Disable mouse //----------------------------------- if (haveDisplay) { disableMouse (dpy); } hd_data = (hd_data_t*)calloc(1, sizeof *hd_data); //hd_data->flags.fast = 1; hd = hd_list(hd_data, hw_mouse, 1, NULL); first_dev = hd; for(; hd; hd = hd->next) { if (! hd->unix_dev_name) { continue; } //=================================== // create new element and defaults... // ----------------------------------- data = (MouseData*)malloc(sizeof(MouseData)); sprintf (buf,"0x%04x",ID_VALUE(hd->device.id)); strcpy(data->did,buf); sprintf (buf,"0x%04x",ID_VALUE(hd->vendor.id)); strcpy(data->vid,buf); strcpy(data->name,hd->model); strcpy(data->device,"/dev/mouse"); strcpy(data->realdev,"<undefined>"); strcpy(data->protocol,"Auto"); data->buttons = -1; data->wheel = 1; data->emulate = 1; data->next = NULL; if (last != NULL) { last->next = data; } if (hd == first_dev) { first = data; } //=================================== // save hddata to struct... // ---------------------------------- di = hd->driver_info; if(di && di->any.type == di_mouse && di->mouse.xf86) { strcpy(data->protocol,di->mouse.xf86); if (di->mouse.buttons) { data->buttons = di->mouse.buttons; } if (di->mouse.wheels) { data->wheel = di->mouse.wheels; } if (data->buttons) { if ( (data->buttons >= 3) || (strcmp(data->protocol,"imps/2") == 0) || (strcmp(data->protocol,"explorerps/2") == 0) ) { data->emulate = 0; } } if (data->wheel) { if (data->wheel >= 1) { data->buttons = (data->wheel * 2) + data->buttons; } } } if (hd->unix_dev_name) { strcpy(data->device,hd->unix_dev_name); } if (hd->unix_dev_names && hd->unix_dev_names->next) { str_list_t* str = hd->unix_dev_names; for (; str; str = str->next) { if (strstr (str->str,"by-id")) { strcpy(data->realdev,str->str); } } } last = data; } //=================================== // Enable mouse //----------------------------------- if (haveDisplay) { enableMouse (dpy); } if (haveDisplay) { XCloseDisplay (dpy); } return(first); }