Esempio n. 1
0
bool CMovePlayerToFrom::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
	if (_string2.empty()) {
		changeView(_destination);
	} else {
		CViewItem *view = parseView(_string2);
		CViewItem *destView = parseView(_destination);
		CLinkItem *link = view->findLink(destView);
		changeView(_destination, link->getName());
	}

	return true;
}
Esempio n. 2
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;
}
Esempio n. 3
0
void Config::constructUnitWithXML(Unit* unit, xmlNodePtr node)
{
	xmlChar* szid = xmlGetProp(node, BAD_CAST"id");
	xmlChar* szname = xmlGetProp(node, BAD_CAST"name");
	xmlChar* szlevel = xmlGetProp(node, BAD_CAST"level");
	xmlChar* szAI = xmlGetProp(node, BAD_CAST"ai");
	xmlChar* szAlign = xmlGetProp(node, BAD_CAST"alignment");
	xmlChar* szMaxHealth = xmlGetProp(node, BAD_CAST"maxHealth");
	xmlChar* szAgility = xmlGetProp(node, BAD_CAST"agility");
	xmlChar* szSkills = xmlGetProp(node, BAD_CAST"skills");
	xmlChar* szAttackFreq = xmlGetProp(node, BAD_CAST"attackFreq");
	xmlChar* szAttackRange = xmlGetProp(node, BAD_CAST"attackRange");
	xmlChar *szView = xmlGetProp(node, BAD_CAST"view");

	unit->cid = atoi((const char*)szid);
	unit->name = (char*)szname;
	unit->maxHealth = atoi((const char*)szMaxHealth);
	unit->agility = atoi((const char*)szAgility);
	unit->ai = atoi((const char*)szAI);
	unit->alignment = atoi((const char*)szAlign);

	parseSkills(unit,szSkills);
	unit->attackFreq = atoi((const char*)szAttackFreq);
	parseRange(unit, szAttackRange);
	parseView(unit, szView);
}
Esempio n. 4
0
bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) {
	CPetControl *pet = getPetControl();
	if (!msg->_item)
		return false;

	CCarry *item = dynamic_cast<CCarry *>(msg->_item);
	if (!_enabled || !pet || !item) {
		item->petAddToInventory();
		return true;
	}

	uint petRoomFlags = pet->getRoomFlags();
	if (mailExists(petRoomFlags)) {
		petDisplayMessage(2, SUCCUBUS_SINGLE_DELIVERY);
		item->petAddToInventory();
		return true;
	}

	petContainerRemove(item);
	pet->phonographAction("");
	playSound("z#23.wav");

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

	if (chickenFlag) {
		if (_startFrame2 >= 0) {
			startTalking(this, 70219);
			playMovie(_startFrame2, _endFrame2, 0);
		}

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

		CViewItem *view = parseView(item->_fullViewName);
		if (view) {
			item->setVisible(false);
			setPosition(item->_origPos);
			item->moveUnder(view);

			CSUBTransition transMsg;
			transMsg.execute(this);
		} else {
			return false;
		}
	} else {
		item->addMail(petRoomFlags);
		if (_startFrame2 >= 0)
			playMovie(_startFrame2, _endFrame2, 0);

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

	return true;
}
Esempio n. 5
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 (!_isOn || !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->_condiment == "None" : false;

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

		if (!chickenFlag) {
			// Not chicken, or chicken with condiments
			_field188 = 1;
			item->addMail(roomFlags);
			petSetArea(PET_REMOTE);
			petHighlightGlyph(16);
			CSUBTransition transMsg;
			transMsg.execute(this);
		} else {
			// Chicken without condiments was passed to SuccUBus, so it'll
			// eat it immediately
			if (_okStartFrame >= 0) {
				startTalking(this, 70219, findView());
				playMovie(_okStartFrame, _okEndFrame, 0);
			}

			if (_sendStartFrame >= 0) {
				playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT);
				_sendAction = SA_EATEN;
			}

			// WORKAROUND: The original had code below to return the chicken
			// to the dispensor after eaten, but since _fullViewName isn't
			// set, it didn't work. I've added code below in the else block
			// that replicates what happens when the parrot eats the chicken
			CViewItem *view = parseView(chicken->_fullViewName);
			if (view) {
				item->setPosition(item->_origPos);
				item->moveUnder(view);

				CSUBTransition transMsg;
				transMsg.execute(this);
			} else {
				CActMsg actMsg("Eaten");
				actMsg.execute(chicken);
				return false;
			}
		}
	}

	return true;
}