Exemplo n.º 1
0
bool CParrot::EnterViewMsg(CEnterViewMsg *msg) {
	static const char *const NAMES[] = {
		"Talking0", "Talking1", "Talking2", "Talking3", "Talking4",
		"Talking5", "Talking6", "Talking7", nullptr
	};

	if (!_v4) {
		setPosition(Point(_field124, _bounds.top));
		_field118 = 1;
		_npcFlags &= ~(NPCFLAG_10000  |  NPCFLAG_20000  |  NPCFLAG_40000  |  NPCFLAG_80000  |  NPCFLAG_100000  |  NPCFLAG_200000  |  NPCFLAG_400000);
		loadFrame(0);
		endTalking(this, true, findView());

		if (_speechCounter > 0) {
			playRandomClip(NAMES, MOVIE_NOTIFY_OBJECT);
		} else {
			startTalking(this, 280258, findView());
		}

		petSetArea(PET_CONVERSATION);
		_field12C = 0;
		_npcFlags |= NPCFLAG_START_IDLING;
	}

	return true;
}
Exemplo n.º 2
0
bool CSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
    if (!_field1D8) {
        Rect tempRect = _rect1;
        tempRect.translate(_bounds.left, _bounds.top);

        if (!_enabled || (_field188 && tempRect.contains(msg->_mousePos))) {
            CTurnOn onMsg;
            onMsg.execute(this);
            _enabled = true;
        } else if (getRandomNumber(256) < 130) {
            _enabled = false;
            CTurnOff offMsg;
            offMsg.execute(this);
        } else {
            switch (getRandomNumber(2)) {
            case 0:
                startTalking(this, 230055, findView());
                break;
            case 1:
                startTalking(this, 230067, findView());
                break;
            case 2:
                startTalking(this, 230045, findView());
                break;
            default:
                break;
            }
        }
    }

    return true;
}
Exemplo n.º 3
0
bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
	petDisplayMessage(2, BLANK);
	if (_initialStartFrame >= 0)
		loadFrame(_initialStartFrame);
	else if (!_signalFlag && _onStartFrame >= 0)
		loadFrame(_onStartFrame);

	petClear();
	if (_soundHandle != -1) {
		stopSound(_soundHandle, 1);
		_soundHandle = -1;
	}

	if (_isOn) {
		_isOn = false;
		if (_offStartFrame >= 0)
			playSound("z#27.wav", 100);

		if (_signalFlag)
			setVisible(false);
	}

	performAction(true, findView());
	CSUBTransition transMsg;
	transMsg.execute(this);

	return true;
}
Exemplo n.º 4
0
bool CSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) {
    if (!msg->_item)
        return false;

    CPetControl *pet = getPetControl();
    CCarry *item = dynamic_cast<CCarry *>(msg->_item);
    Rect tempRect = _rect2;
    tempRect.translate(_bounds.left, _bounds.top);
    uint roomFlags = pet ? pet->getRoomFlags() : 0;

    if (!_enabled || !pet || !item || !tempRect.contains(item->getControid())) {
        item->petAddToInventory();
    } else if (mailExists(roomFlags)) {
        petDisplayMessage(SUCCUBUS_DESCRIPTION);
        item->petAddToInventory();
    } else {
        petContainerRemove(item);
        pet->phonographAction("");

        CChicken *chicken = dynamic_cast<CChicken *>(item);
        bool chickenFlag = chicken ? chicken->_string6 != "None" : false;

        item->setVisible(false);
        if (_startFrame1 >= 0) {
            playSound("z#23.wav");
            playMovie(_startFrame1, _endFrame1, 0);
        }

        if (!chickenFlag) {
            _field188 = 1;
            item->addMail(roomFlags);
            petSetArea(PET_REMOTE);
            petHighlightGlyph(16);
            CSUBTransition transMsg;
            transMsg.execute(this);
        } else {
            if (_startFrame2 >= 0) {
                startTalking(this, 70219, findView());
                playMovie(_startFrame2, _endFrame2, 0);
            }

            if (_startFrame3 >= 0) {
                playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT);
                _field158 = 2;
            }

            CViewItem *view = parseView(chicken->_fullViewName);
            if (!view)
                return false;

            item->setPosition(item->_origPos);
            item->moveUnder(view);

            CSUBTransition transMsg;
            transMsg.execute(this);
        }
    }

    return true;
}
Exemplo n.º 5
0
bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
    petDisplayMessage(2, BLANK);
    if (_startFrame8 >= 0)
        loadFrame(_startFrame8);
    else if (!_field15C && _startFrame9 >= 0)
        loadFrame(_startFrame9);

    petClear();
    if (_soundHandle != -1) {
        stopSound(_soundHandle, 1);
        _soundHandle = -1;
    }

    if (_enabled) {
        _enabled = false;
        if (_startFrame10 >= 0)
            playSound("z#27.wav", 100);

        if (_field15C)
            setVisible(false);
    }

    performAction(true, findView());
    CSUBTransition transMsg;
    transMsg.execute(this);

    return true;
}
Exemplo n.º 6
0
bool CNoseHolder::FrameMsg(CFrameMsg *msg) {
	if (!_dragObject) {
		CGameObject *dragObj = getDraggingObject();
		if (!dragObj)
			return false;

		if (!dragObj->isEquals("Feathers") || getView() != findView())
			return false;

		_dragObject = dragObj;
	}

	if (_dragObject) {
		if (!checkPoint(Point(_dragObject->_bounds.left,
				_dragObject->_bounds.top))) {
			_field11C = false;
		} else if (!_field11C) {
			CActMsg actMsg("Sneeze");
			actMsg.execute(this);
			_field11C = true;
		}
	}

	return true;
}
Exemplo n.º 7
0
bool CSuccUBus::TurnOn(CTurnOn *msg) {
    if (getRandomNumber(9) == 0) {
        CParrotSpeakMsg speakMsg("SuccUBus", "TurnOn");
        speakMsg.execute("PerchedParrot");
    }

    CPetControl *pet = getPetControl();
    if (pet) {
        if (!_field15C && _startFrame8 >= 0) {
            playMovie(_startFrame8, _endFrame8, 0);
            playSound("z#30.wav", 100);
        }

        if (_startFrame9 >= 0) {
            playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT);
            playSound("z#26.wav", 100);
        }

        uint petRoomFlags = pet->getRoomFlags();
        if (mailExists(petRoomFlags) && _endFrame1 >= 0)
            playMovie(_endFrame1, _endFrame1, 0);

        _enabled = true;
        CSUBTransition transMsg;
        transMsg.execute(this);

        setTalking(this, true, findView());
        petSetArea(PET_REMOTE);
        petHighlightGlyph(16);
    }

    return true;
}
Exemplo n.º 8
0
bool CSuccUBus::TurnOn(CTurnOn *msg) {
	if (getRandomNumber(9) == 0) {
		CParrotSpeakMsg speakMsg("SuccUBus", "TurnOn");
		speakMsg.execute("PerchedParrot");
	}

	CPetControl *pet = getPetControl();
	if (pet) {
		if (!_signalFlag && _initialStartFrame >= 0) {
			playMovie(_initialStartFrame, _initialEndFrame, 0);
			playSound("z#30.wav", 100);
		}

		if (_onStartFrame >= 0) {
			playMovie(_onStartFrame, _onEndFrame, MOVIE_NOTIFY_OBJECT);
			playSound("z#26.wav", 100);
		}

		uint petRoomFlags = pet->getRoomFlags();
		if (mailExists(petRoomFlags) && _endFrame1 >= 0)
			// Mail canister present
			playMovie(_endFrame1, _endFrame1, 0);

		_isOn = true;
		CSUBTransition transMsg;
		transMsg.execute(this);

		setTalking(this, true, findView());
		petSetArea(PET_REMOTE);
		petHighlightGlyph(16);
	}

	return true;
}
Exemplo n.º 9
0
bool CDeskbot::ActMsg(CActMsg *msg) {
    if (msg->_action == "2ndClassUpgrade" && getPassengerClass() > 2) {
        startTalking(this, 140, findView());
    }

    return true;
}
Exemplo n.º 10
0
bool CLemonDispensor::FrameMsg(CFrameMsg *msg) {
	if (_v2 || !_isSummer)
		return true;

	if (!_draggingObject) {
		CGameObject *obj = getDraggingObject();
		if (obj && getView() == findView()) {
			if (obj->isEquals("Perch")) {
				petDisplayMessage(1, TOO_SHORT_TO_REACH_BRANCHES);
				return true;
			}

			if (obj->isEquals("LongStick"))
				_draggingObject = obj;
		}
	}

	if (_draggingObject) {
		Point pt(_origPt.x + _draggingObject->_bounds.left,
			_origPt.y + _draggingObject->_bounds.top);
		bool flag = checkPoint(pt, true);

		if (_fieldEC == 0) {
			if (flag && ++_v3 > 10) {
				CLemonFallsFromTreeMsg lemonMsg(pt);
				lemonMsg.execute("Lemon");
				_v2 = 1;
			}
		} else if (_fieldEC == 1 && !flag) {
			_fieldEC = 0;
		}
	}

	return true;
}
Exemplo n.º 11
0
bool CViewTogglesOtherMusic::LeaveViewMsg(CLeaveViewMsg *msg) {
	if (msg->_oldView == findView()) {
		CTriggerAutoMusicPlayerMsg playerMsg(_value);
		playerMsg.execute(this);
	}

	return true;
}
Exemplo n.º 12
0
bool CParrot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
	if (_v4) {
		CViewItem *view = msg->_param2 ? findView() : nullptr;
		startTalking(this, msg->_action, view);
	}

	return true;
}
Exemplo n.º 13
0
void CSVSettings::SettingWindow::createConnections
                                    (const QList <CSMSettings::Setting *> &list)
{
    foreach (const CSMSettings::Setting *setting, list)
    {
        View *masterView = findView (setting->page(), setting->name());

        CSMSettings::Connector *connector =
                                new CSMSettings::Connector (masterView, this);

        connect (masterView,
                 SIGNAL (viewUpdated(const QString &, const QStringList &)),
                 connector,
                 SLOT (slotUpdateSlaves())
                 );

        const CSMSettings::ProxyValueMap &proxyMap = setting->proxyLists();

        foreach (const QString &key, proxyMap.keys())
        {
            QStringList keyPair = key.split('.');

            if (keyPair.size() != 2)
                continue;

            View *slaveView = findView (keyPair.at(0), keyPair.at(1));

            if (!slaveView)
            {
                qWarning () << "Unable to create connection for view "
                            << key;
                continue;
            }

            QList <QStringList> proxyList = proxyMap.value (key);
            connector->addSlaveView (slaveView, proxyList);

            connect (slaveView,
                     SIGNAL (viewUpdated(const QString &, const QStringList &)),
                    connector,
                     SLOT (slotUpdateMaster()));
        }
    }
Exemplo n.º 14
0
bool CSpeechDispensor::FrameMsg(CFrameMsg *msg) {
	if (_fieldEC || _seasonNum == SEASON_SUMMER || _seasonNum == SEASON_SPRING)
		return true;

	CGameObject *dragObject = getDraggingObject();
	if (!_dragItem && dragObject && getView() == findView()) {
		if (dragObject->isEquals("Perch")) {
			petDisplayMessage(1, TOO_SHORT_TO_REACH_BRANCHES);
			return true;
		}

		if (dragObject->isEquals("LongStick"))
			_dragItem = dragObject;
	}

	if (_dragItem) {
		Point pt(_itemPos.x + _dragItem->_bounds.left,
			_itemPos.y + _dragItem->_bounds.top);
		if (!checkPoint(pt, true))
			return true;

		switch (_state) {
		case 0:
			playSound("z#93.wav");
			if (_seasonNum == SEASON_WINTER) {
				petDisplayMessage(1, FROZEN_TO_BRANCH);
				_fieldE0 = false;
				_state = 1;
			} else {
				if (++_fieldE0 >= 5) {
					CActMsg actMsg("PlayerGetsSpeechCentre");
					actMsg.execute("SeasonalAdjust");
					CSpeechFallsFromTreeMsg fallMsg(pt);
					fallMsg.execute("SpeechCentre");

					_fieldEC = true;
					_fieldE0 = false;
				}

				_state = 1;
			}
			break;

		case 2:
			_state = 0;
			++_fieldE0;
			break;

		default:
			break;
		}
	}

	return true;
}
Exemplo n.º 15
0
bool CMaitreD::TimerMsg(CTimerMsg *msg) {
	if (msg->_action == "MD Fight") {
		if (_field12C && compareViewNameTo("1stClassRestaurant.MaitreD Node.N")) {
			startTalking(this, 131, findView());
		}
	} else {
		CTrueTalkNPC::TimerMsg(msg);
	}

	return true;
}
Exemplo n.º 16
0
bool CDeskbot::TurnOff(CTurnOff *msg) {
    if (_deskbotActive) {
        stopMovie();
        performAction(1, findView());

        _npcFlags = (_npcFlags & ~(NPCFLAG_SPEAKING | NPCFLAG_IDLING | NPCFLAG_START_IDLING)) | NPCFLAG_40000;
        playClip("Closing", MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
    }

    return true;
}
Exemplo n.º 17
0
bool CNoseHolder::ActMsg(CActMsg *msg) {
	if (msg->_action == "Sneeze" && !_itemName.empty() && _fieldF4) {
		CProximity prox;
		prox._positioningMode = POSMODE_VECTOR;
		playSound("z#35.wav", prox);

		if (getView() == findView()) {
			setVisible(true);
			playMovie(1, 13, MOVIE_NOTIFY_OBJECT);
		}
	}

	return true;
}
Exemplo n.º 18
0
bool CHammerDispensorButton::FrameMsg(CFrameMsg *msg) {
	if (!_fieldF8)
		return true;

	if (!_field10C) {
		CGameObject *obj = getDraggingObject();
		if (obj) {
			if (obj->isEquals("Perch") && getView() == findView())
				_field10C = obj;
		}
	}

	if (_field10C) {
		Point pt(_btnPos.x + _bounds.left, _btnPos.y + _bounds.top);
		bool flag = checkPoint(pt, true);

		switch (_fieldFC) {
		case 0:
			if (flag) {
				playSound("z#93.wav");
				if (++_field100 == 5) {
					if (!_field110) {
						CActMsg actMsg(_msgAction);
						actMsg.execute(_msgTarget);
					}

					setVisible(false);
					_fieldF8 = 0;
					_field100 = 0;
				}

				_fieldFC = 1;
			}
			break;

		case 1:
			if (!flag) {
				_fieldFC = 0;
				++_field100;
			}
			break;

		default:
			break;
		}
	}

	return true;
}
Exemplo n.º 19
0
bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
	CPetControl *pet = getPetControl();

	if (_inProgress || !pet)
		return true;
	if (!_isOn) {
		petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY);
		return true;
	}

	uint petRoomFlags = pet->getRoomFlags();
	if (mailExists(petRoomFlags)) {
		// There's already something to send in the tray, so you can't receive
		switch (getRandomNumber(2)) {
		case 0:
			startTalking(this, 70080, findView());
			break;
		case 1:
			startTalking(this, 70081, findView());
			break;
		case 2:
			startTalking(this, 70082, findView());
			break;
		default:
			break;
		}
	} else {
		CGameObject *mailObject = findMailByFlags(
			_enabled && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, petRoomFlags);
		if (!mailObject) {
			// No mail for this SuccUBus
			if (getRandomNumber(1) == 0) {
				startTalking(this, 70104, findView());
			} else {
				startTalking(this, 70105, findView());
			}

			playMovie(_emptyStartFrame, _emptyEndFrame, 0);
			playMovie(_smokeStartFrame, _smokeEndFrame, 0);
			petDisplayMessage(2, NOTHING_TO_DELIVER);
		} else {
			// Receive the mail addressed to this SuccUBus
			_mailP = mailObject;
			startTalking(this, 230004, findView());

			if (_receiveStartFrame >= 0) {
				_sendAction = SA_FEATHERS;
				_inProgress = true;
				incTransitions();
				playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT);
			}
		}
	}

	return true;
}
Exemplo n.º 20
0
bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) {
    bool flag = false;
    if (_npcFlags & NPCFLAG_10000) {
        if (_classNum) {
            petSetArea(PET_ROOMS);
            dec54();
            unlockMouse();
            playSound("z#47.wav");
            _classNum = NO_CLASS;
        }

        _npcFlags &= ~NPCFLAG_10000;
        flag = true;
    }

    if (_npcFlags & NPCFLAG_40000) {
        _deskbotActive = false;
        _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000);

        if (_npcFlags & NPCFLAG_80000) {
            CTurnOn turnOn;
            turnOn.execute("EmbBellbotTrigger");
            unlockMouse();
            changeView("EmbLobby.Node 4.N", "");
        } else if (_npcFlags & NPCFLAG_100000) {
            CTurnOn turnOn;
            turnOn.execute("EmbDoorBotTrigger");
            unlockMouse();
            changeView("EmbLobby.Node 4.N", "");
        }

        _npcFlags &= ~(NPCFLAG_80000 | NPCFLAG_100000);
        flag = true;
    }

    if (_npcFlags & NPCFLAG_20000) {
        _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000);
        setTalking(this, true, findView());

        _npcFlags |= NPCFLAG_START_IDLING;
        flag = true;
    }

    if (!flag)
        CTrueTalkNPC::MovieEndMsg(msg);

    return true;
}
Exemplo n.º 21
0
bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) {
	if (_fieldE0) {
		if (findView() == getView() && (!_fieldE8 || !_field114)) {
			loadFrame(_fieldEC);
			playSound(_ejectSoundName);
		}

		CQueryCylinderNameMsg nameMsg;
		nameMsg.execute(this);
		CRestaurantMusicChanged musicMsg(nameMsg._name);
		musicMsg.execute(findRoom());
	} else {
		loadFrame(_fieldF0);
	}

	return true;
}
Exemplo n.º 22
0
bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
    CPetControl *pet = getPetControl();

    if (_field1D8 || !pet)
        return true;
    if (!_enabled) {
        petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY);
        return true;
    }

    uint petRoomFlags = pet->getRoomFlags();
    if (mailExists(petRoomFlags)) {
        switch (getRandomNumber(2)) {
        case 0:
            startTalking(this, 70080, findView());
            break;
        case 1:
            startTalking(this, 70081, findView());
            break;
        case 2:
            startTalking(this, 70082, findView());
            break;
        default:
            break;
        }
    } else {
        CGameObject *mailObject = findMailByFlags(compareRoomNameTo("Titania")
                                  ? 3 : _field140, petRoomFlags);
        if (!mailObject) {
            if (getRandomNumber(1) == 0) {
                startTalking(this, 70104, findView());
            } else {
                startTalking(this, 70105, findView());
            }

            playMovie(_startFrame6, _endFrame6, 0);
            playMovie(_startFrame7, _endFrame7, 0);
            petDisplayMessage(2, NOTHING_TO_DELIVER);
        } else {
            startTalking(this, 230004, findView());

            if (_startFrame4 >= 0) {
                _field158 = 1;
                _field1D8 = 1;
                incTransitions();
                playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT);
            }
        }
    }

    return true;
}
Exemplo n.º 23
0
bool CViewAutoSoundPlayer::LeaveViewMsg(CLeaveViewMsg *msg) {
	CViewItem *view = findView();
	CRoomItem *room = findRoom();

	if (view == msg->_oldView) {
		CTurnOff offMsg;
		offMsg.execute(this);

		if (_enabled) {
			CChangeMusicMsg changeMsg;
			changeMsg._action = MUSIC_START;
			changeMsg.execute(room, CAutoMusicPlayer::_type,
				MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
		}
	}

	return true;
}
Exemplo n.º 24
0
bool CHammerDispensorButton::FrameMsg(CFrameMsg *msg) {
	if (!_active)
		return true;

	if (!_perch) {
		CGameObject *obj = getDraggingObject();
		if (obj) {
			if (obj->isEquals("Perch") && getView() == findView())
				_perch = static_cast<CPerch *>(obj);
		}
	}

	if (_perch) {
		Point pt(_btnPos.x + _perch->_bounds.left, _btnPos.y + _perch->_bounds.top);
		bool flag = checkPoint(pt, true);

		if (!_open) {
			if (flag) {
				playSound("z#93.wav");
				if (++_hitCounter == 5) {
					if (!_hammerTaken) {
						CActMsg actMsg(_msgAction);
						actMsg.execute(_msgTarget);
					}

					setVisible(false);
					_active = false;
					_hitCounter = 0;
				}

				_open = true;
			}
		} else {
			if (!flag) {
				_open = false;
				++_hitCounter;
			}
		}
	}

	return true;
}
Exemplo n.º 25
0
bool CParrot::ActMsg(CActMsg *msg) {
	if (msg->_action == "PistaccioEaten") {
		CActMsg actMsg("NutsEaten");
		actMsg.execute("Ear2");
	} else if (msg->_action == "Chicken") {
		// Nothing to do
	} else if (msg->_action == "CarryParrotLeftView") {
		if (!_v2) {
			_v1 = 0;
			CStatusChangeMsg statusMsg;
			statusMsg._newStatus = 1;
			statusMsg.execute("PerchCoreHolder");
		}
	} else if (msg->_action == "StartChickenDrag") {
		if (!_v4) {
			stopMovie();
			startTalking(this, 280275, findView());
			_field12C = 0;
		}
	} else if (msg->_action == "EnteringFromTOW" &&
			(_v4 == 0 || _v4 == 2)) {
		if (_v2) {
			_v2 = 2;
		} else {
			setVisible(true);
			CTreeItem *cageBar = getRoot()->findByName("CageBar");
			detach();
			attach(cageBar);

			_v4 = 0;
			CActMsg actMsg1("OpenNow");
			actMsg1.execute("ParrotCage");
			CActMsg actMsg2("GainParrot");
			actMsg2.execute("ParrotLobbyController");
		}
	}

	return true;
}
Exemplo n.º 26
0
bool CMaitreD::EnterViewMsg(CEnterViewMsg *msg) {
	endTalking(this, true, findView());
	_field12C = _field134;

	if (_string3 == "STMusic" && (!_field11C || _string2 == _string3))
		return true;

	if (_string3.contains("nasty ambient"))
		startTalking(this, 111, findView());
	else if (!CMusicRoom::_musicHandler->checkSound(1))
		startTalking(this, 114, findView());
	else if (!CMusicRoom::_musicHandler->checkSound(3))
		startTalking(this, 113, findView());
	else if (!CMusicRoom::_musicHandler->checkSound(2))
		startTalking(this, 115, findView());
	else {
		startTalking(this, 110, findView());
		CMaitreDHappyMsg happyMsg;
		happyMsg.execute("MaitreD Left Arm");
		happyMsg.execute("MaitreD Right Arm");
	}

	return true;
}
Exemplo n.º 27
0
bool CSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
    if (_field1D8)
        return true;

    if (!_enabled) {
        petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY);
        return true;
    }

    CPetControl *pet = getPetControl();
    if (!pet)
        return true;

    CGameObject *mailObject = findMail(pet->getRoomFlags());
    if (!mailObject) {
        switch (getRandomNumber(2)) {
        case 0:
            startTalking(this, 70111, findView());
            break;
        case 1:
            startTalking(this, 70112, findView());
            break;
        case 2:
            startTalking(this, 70113, findView());
            break;
        default:
            break;
        }

        petDisplayMessage(2, NOTHING_IN_SUCCUBUS_TRAY);
    } else {
        _field19C = 0;

        CRoomFlags roomFlags = _roomFlags;
        if (!pet->testRooms5(roomFlags) || getPassengerClass() > 0) {
            roomFlags = pet->getSpecialRoomFlags("BilgeRoom");
            _field19C = 1;
        } else {
            pet->getMailDest(roomFlags);
        }

        _isFeathers = mailObject->getName() == "Feathers";
        _isChicken = mailObject->getName() == "Chicken";
        _field158 = 0;
        _field188 = 0;
        _field1D8 = 1;
        incTransitions();

        if (_isFeathers) {
            _field19C = 0;
            removeMail(roomFlags, roomFlags);
            pet->phonographAction("");

            if (_startFrame2 >= 0) {
                playMovie(_startFrame2, _endFrame2, 0);
                startTalking(this, 230022, findView());
            }

            _field158 = 1;
            if (_startFrame3 >= 0)
                playMovie(_startFrame3, _endFrame3, 0);

            if (_startFrame4 >= 0) {
                _mailP = mailObject;
                playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT);
            }

            if (_startFrame5 >= 0) {
                playMovie(_startFrame5, _endFrame5, 0);
            }
        } else {
            removeMail(pet->getRoomFlags(), roomFlags);
            pet->phonographAction("");

            if (_startFrame2 >= 0) {
                playMovie(_startFrame2, _endFrame2, 0);
                startTalking(this, 230012, findView());
            }

            if (_startFrame3 >= 0)
                playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT);
        }
    }

    return true;
}
Exemplo n.º 28
0
bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) {
	static const char *const NAMES[] = {
		"Idle0", "Idle1", "Peck At Feet", "Peck At Feet Left"
		"Peck At Feet Right", nullptr
	};

	if (!(_npcFlags & (NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000))
			&& _visible && !_v4 && !compareViewNameTo("ParrotLobby.Node 1.N")) {
		CGameObject *dragItem = getDraggingObject();
		if (!dragItem || dragItem->getName() == "Chicken") {
			if (!_v5 ||getRandomNumber(3) != 0) {
				if (getRandomNumber(1)) {
					startTalking(this, 280267, findView());
				} else {
					msg->_names = NAMES;
				}
			} else {
				int id = -1;
				switch (stateGet38()) {
				case 0:
					id = 280107;
					break;
				case 1:
					id = 280106;
					break;
				case 2:
					id = 280115;
					break;
				case 3:
					id = 280114;
					break;
				case 4:
					id = 280113;
					break;
				case 5:
					id = 280112;
					break;
				case 6:
					id = 280111;
					break;
				case 7:
					id = 280110;
					break;
				case 8:
					id = 280109;
					break;
				case 9:
					id = 280108;
					break;
				case 10:
					id = 280105;
					break;
				case 11:
					id = 280000;
					break;
				default:
					break;
				}

				if (id != -1)
					startTalking(this, id, findView());

				CActMsg actMsg("FlashCore");
				actMsg.execute("PerchCoreHolder");
			}
		}
	}

	return true;
}
Exemplo n.º 29
0
void terrama2::services::view::core::makeView(ViewId viewId, std::shared_ptr< terrama2::services::view::core::ViewLogger > logger, std::weak_ptr<DataManager> weakDataManager)
{
  auto dataManager = weakDataManager.lock();
  if(!dataManager.get())
  {
    TERRAMA2_LOG_ERROR() << QObject::tr("Unable to access DataManager");
    return;
  }

  try
  {
    RegisterId logId = 0;
    if(logger.get())
      logId = logger->start(viewId);

    TERRAMA2_LOG_DEBUG() << QObject::tr("Starting view %1 generation.").arg(viewId);

    auto lock = dataManager->getLock();

    auto viewPtr = dataManager->findView(viewId);

    if(viewPtr->dataSeriesList.size() != viewPtr->filtersPerDataSeries.size())
    {
      QString message = QObject::tr("View %1 do not have the right number of filters for data.").arg(viewId);
      if(logger.get())
        logger->error(message.toStdString(), viewId);
      TERRAMA2_LOG_ERROR() << message;
      throw Exception() << ErrorDescription(message);
    }

    std::vector<std::unordered_map<terrama2::core::DataSetPtr, terrama2::core::DataSetSeries>> seriesList;

    for(auto dataSeriesId : viewPtr->dataSeriesList)
    {
      terrama2::core::DataSeriesPtr inputDataSeries = dataManager->findDataSeries(dataSeriesId);
      terrama2::core::DataProviderPtr inputDataProvider = dataManager->findDataProvider(inputDataSeries->dataProviderId);

      auto dataAccessor = terrama2::core::DataAccessorFactory::getInstance().make(inputDataProvider, inputDataSeries);

      terrama2::core::Filter filter(viewPtr->filtersPerDataSeries.at(dataSeriesId));
      std::unordered_map<terrama2::core::DataSetPtr, terrama2::core::DataSetSeries > series = dataAccessor->getSeries(filter);

      seriesList.push_back(series);
    }

    lock.unlock();

    if(seriesList.size() > 0)
    {
      drawSeriesList(viewId, logger, seriesList, viewPtr->resolutionWidth, viewPtr->resolutionHeight, viewPtr->srid);

      TERRAMA2_LOG_INFO() << QObject::tr("View %1 generated successfully.").arg(viewId);
    }
    else
    {
      QString message = QObject::tr("View %1 has no associated data to be generated.").arg(viewId);
      if(logger.get())
        logger->info(message.toStdString(), viewId);
      TERRAMA2_LOG_INFO() << message;
    }

    if(logger.get())
      logger->done(terrama2::core::TimeUtils::nowUTC(), logId);
  }
  catch(const terrama2::Exception& e)
  {
    TERRAMA2_LOG_ERROR() << boost::get_error_info<terrama2::ErrorDescription>(e) << std::endl;
    TERRAMA2_LOG_INFO() << QObject::tr("Build of view %1 finished with error(s).").arg(viewId);
  }
  catch(const boost::exception& e)
  {
    TERRAMA2_LOG_ERROR() << boost::get_error_info<terrama2::ErrorDescription>(e);
    TERRAMA2_LOG_INFO() << QObject::tr("Build of view %1 finished with error(s).").arg(viewId);
  }
  catch(const std::exception& e)
  {
    TERRAMA2_LOG_ERROR() << e.what();
    TERRAMA2_LOG_INFO() << QObject::tr("Build of view %1 finished with error(s).").arg(viewId);
  }
  catch(...)
  {
    TERRAMA2_LOG_ERROR() << QObject::tr("Unkown error.");
    TERRAMA2_LOG_INFO() << QObject::tr("Build of view %1 finished with error(s).").arg(viewId);
  }
}
Exemplo n.º 30
0
bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
    CPetControl *pet = getPetControl();
    uint petRoomFlags = pet ? pet->getRoomFlags() : 0;

    if (msg->_endFrame == _endFrame10) {
        if (_startFrame11 >= 0)
            playSound("z#30.wav", 100);

        if (_field15C) {
            _field15C = false;
            setVisible(false);
            CSignalObject signalMsg;
            signalMsg._numValue = 1;
            signalMsg.execute(_string2);
        }
    }

    if (msg->_endFrame == _endFrame9) {
        bool flag = false;

        if (pet && mailExists(petRoomFlags)) {
            CGameObject *mailObject = _v3 && compareRoomNameTo("Titania") ?
                                      findMailByFlags(3, petRoomFlags) :
                                      findMailByFlags(_field140, petRoomFlags);

            if (mailObject) {
                switch (getRandomNumber(4)) {
                case 0:
                    startTalking(this, 70094, findView());
                    break;
                case 1:
                    startTalking(this, 70095, findView());
                    break;
                case 2:
                    startTalking(this, 70096, findView());
                    break;
                case 3:
                    startTalking(this, 70098, findView());
                    break;
                case 4:
                    startTalking(this, 70099, findView());
                    break;
                default:
                    break;
                }
                flag = true;
            }
        }

        if (!_field188 && !flag) {
            stopSound(_soundHandle);
            _soundHandle = -1;

            switch (getRandomNumber(_v2 ? 7 : 5, &_field1B0)) {
            case 2:
                startTalking(this, 230001, findView());
                break;
            case 3:
                startTalking(this, 230002, findView());
                break;
            case 4:
                startTalking(this, 230003, findView());
                break;
            case 5:
                startTalking(this, 230064, findView());
                break;
            case 6:
                startTalking(this, 230062, findView());
                break;
            case 7:
                startTalking(this, 230063, findView());
                break;
            default:
                break;
            }
        }
    }

    if (msg->_endFrame == _endFrame3) {
        if (_field158 == 1) {
            startTalking(this, 230022, findView());
        } else if (_field158 == 2) {
            startTalking(this, 230017, findView());
        } else if (_field19C) {
            startTalking(this, 230019, findView());
            _field19C = 0;
        } else if (_isChicken) {
            startTalking(this, 230018, findView());
            _isChicken = false;
        } else {
            startTalking(this, 230013, findView());
        }

        if (_field1D8) {
            _field1D8 = 0;
            decTransitions();
        }

        CSUBTransition transMsg;
        transMsg.execute(this);
    }

    if (msg->_endFrame == _endFrame4) {
        if (pet && _mailP) {
            _mailP->setMailId(petRoomFlags);
        }

        _field188 = 1;
        _mailP = 0;
        if (_field1D8) {
            _field1D8 = 0;
            decTransitions();
        }

        CSUBTransition transMsg;
        transMsg.execute(this);
    }

    return true;
}