예제 #1
0
uint32_t MoveEvents::onCreatureMove(Creature* creature, const Tile* tile, bool isIn)
{
	MoveEvent_t eventType;

	if (isIn) {
		eventType = MOVE_EVENT_STEP_IN;
	} else {
		eventType = MOVE_EVENT_STEP_OUT;
	}

	Position pos = tile->getPosition();

	uint32_t ret = 1;

	MoveEvent* moveEvent = getEvent(tile, eventType);
	if (moveEvent) {
		ret = ret & moveEvent->fireStepEvent(creature, nullptr, pos);
	}

	for (int32_t i = tile->__getFirstIndex(), j = tile->__getLastIndex(); i < j; ++i) {
		Thing* thing = tile->__getThing(i);
		if (thing) {
			Item* tileItem = thing->getItem();
			if (tileItem) {
				moveEvent = getEvent(tileItem, eventType);
				if (moveEvent) {
					ret = ret & moveEvent->fireStepEvent(creature, tileItem, pos);
				}
			}
		}
	}

	return ret;
}
예제 #2
0
MoveEvent* TouchDevice::ReadSingleTouchEvent(int touch_device)
{
    MoveEvent moveEvent;
    TOUCH_DEVICE_STATUS tds = DEVICE_TOUCH_NONE;;
    int x, y;

    read(touch_device, &tds, sizeof(tds));
    read(touch_device, &x, sizeof(x));
    read(touch_device, &y, sizeof(y));
    switch (tds)
    {
        case DEVICE_TOUCH_START:
            moveEvent.m_action = MoveEvent::ACTION_DOWN;
            break;
        case DEVICE_TOUCH_END:
            moveEvent.m_action = MoveEvent::ACTION_UP;
            break;
        case DEVICE_TOUCH_UPDATE:
            moveEvent.m_action = MoveEvent::ACTION_MOVE;
            break;
        case DEVICE_TOUCH_NONE:
        case DEVICE_TOUCH_POINTER_DOWN:
        case DEVICE_TOUCH_POINTER_UP:
        default:
            break;
    }
    x = GetScreenHorizonPostion(x);
    y = GetScreenVerticalPostion(y);
    moveEvent.m_x[0] = x;
    moveEvent.m_y[0] = y;
    moveEvent.m_pointerId[0] = 0;
    moveEvent.m_pointerCount = 1;
    moveEvent.m_eventTime = SystemUtil::GetUpdateTimeInMs();
    return moveEvent.Clone();
}
예제 #3
0
uint32_t MoveEvents::onCreatureMove(Creature* creature, const Tile* tile, const Position& fromPos, MoveEvent_t eventType)
{
	const Position& pos = tile->getPosition();

	uint32_t ret = 1;

	MoveEvent* moveEvent = getEvent(tile, eventType);
	if (moveEvent) {
		ret &= moveEvent->fireStepEvent(creature, nullptr, pos, fromPos);
	}

	for (size_t i = tile->getFirstIndex(), j = tile->getLastIndex(); i < j; ++i) {
		Thing* thing = tile->getThing(i);
		if (!thing) {
			continue;
		}

		Item* tileItem = thing->getItem();
		if (!tileItem) {
			continue;
		}

		moveEvent = getEvent(tileItem, eventType);
		if (moveEvent) {
			ret &= moveEvent->fireStepEvent(creature, tileItem, pos, fromPos);
		}
	}
	return ret;
}
예제 #4
0
uint32_t MoveEvents::onCreatureMove(Creature* creature, Tile* tile, bool isIn)
{
	MoveEvent_t eventType;
	if(isIn){
		eventType = MOVE_EVENT_STEP_IN;
	}
	else{
		eventType = MOVE_EVENT_STEP_OUT;
	}

	uint32_t ret = 1;
	MoveEvent* moveEvent = getEvent(tile, eventType);
	if(moveEvent){
		ret = ret & moveEvent->fireStepEvent(creature, NULL, tile->getPosition());
	}

	int32_t j = tile->__getLastIndex();
	Item* tileItem = NULL;
	for(int32_t i = tile->__getFirstIndex(); i < j; ++i){
		Thing* thing = tile->__getThing(i);
		if(thing && (tileItem = thing->getItem())){
			moveEvent = getEvent(tileItem, eventType);
			if(moveEvent){
				ret = ret & moveEvent->fireStepEvent(creature, tileItem, tile->getPosition());
			}
		}
	}
	return ret;
}
예제 #5
0
void Widget::setGeometry(const Rect<int>& geometry)
{
	if(!geometry.size().isValid())
		return;

	if(!parent_) {
		ws_->moveWindow(handle_, geometry.topLeft());
		ws_->resizeWindow(handle_, geometry.size());
		ws_->sync();
	}
	else {
		// Calculate invalidated rectangle
		int x = minOf(pos_.x(), geometry.x());
		int y = minOf(pos_.y(), geometry.y());
		int width = maxOf(size_.width(), geometry.size().width());
		int height = maxOf(size_.height(), geometry.size().height());
		Rect<int> rect(x, y, width, height);

		// Send events
		MoveEvent me;
		me.setOldPos(pos_, {});
		me.setPos(geometry.topLeft(), {});
		processEvent(&me, {});

		ResizeEvent re;
		re.setOldSize(size_, {});
		re.setSize(geometry.size(), {});
		processEvent(&re, {});

		rect.intersect(parent_->rect());
		parent_->repaint();
	}
}
예제 #6
0
PlayerOctopus::PlayerOctopus(Character* c, GridOctopus* grid)
    : OctopusBaby(PLAYER_WIDTH, PLAYER_HEIGHT), _character(c), _grid(grid), destination_cell(_character->getCell())
{
    if (!_basic_player.valid())
    {
        _basic_player = (*ServiceLocator::getTextureManager())["knight"];

        // compute ratio
        double ratiox = (double)_relative_rect.w / _basic_player.getWidth();
        double ratioy = (double)_relative_rect.h / _basic_player.getHeight();
        _ratio = min(ratioy, ratiox);

        // calculate padding
        int xpadding = -5;
        int ypadding = 7;
        PADDINGFaceLeft = Point(-_basic_player.getWidth() * _ratio / 2 + xpadding, -_basic_player.getHeight() * _ratio + ypadding);
        PADDINGFaceRight = Point(PADDINGFaceLeft.x -2*xpadding, PADDINGFaceLeft.y);

    }
    setBgColor(Color::TRANSPARENT);

    // event registration
    EventService* evs = EVENTSERVICE;
    evs->listen(typeid(MoveEvent), [=](Event* e) {
        MoveEvent* ev = dynamic_cast<MoveEvent*>(e);
        if (ev && ev->getCharacter() == _character)
            addMove(ev->destination, ev->move_wanted);
    }
               );
}
예제 #7
0
uint32_t MoveEvents::onPlayerDeEquip(Player* player, Item* item, slots_t slot)
{
	MoveEvent* moveEvent = getEvent(item, MOVE_EVENT_DEEQUIP, slot);
	if (!moveEvent) {
		return 1;
	}
	return moveEvent->fireEquip(player, item, slot, true);
}
예제 #8
0
uint32_t MoveEvents::onPlayerEquip(Player* player, Item* item, slots_t slot)
{
	MoveEvent* moveEvent = getEvent(item, MOVE_EVENT_EQUIP, slot);
	if(moveEvent && slot == moveEvent->getSlot()){
		return moveEvent->fireEquip(player, item, slot, false);
	}
	return 1;
}
예제 #9
0
uint32_t MoveEvents::onPlayerDeEquip(Player* player, Item* item, slots_t slot, bool isRemoval)
{
	MoveEvent* moveEvent = getEvent(item, MOVE_EVENT_DEEQUIP, slot);
	if(moveEvent && slot == moveEvent->getSlot()){
		return moveEvent->fireEquip(player, item, slot, isRemoval);
	}
	return 1;
}
예제 #10
0
uint32_t MoveEvents::onPlayerEquip(Player* player, Item* item, slots_t slot, bool isCheck)
{
	MoveEvent* moveEvent = getEvent(item, MOVE_EVENT_EQUIP, slot);
	if (!moveEvent) {
		return 1;
	}
	return moveEvent->fireEquip(player, item, slot, isCheck);
}
예제 #11
0
ReturnValue MoveEvents::canPlayerWearEquip(Player* player, Item* item, slots_t slot)
{
	MoveEvent* moveEvent = getEvent(item, MOVE_EVENT_EQUIP, slot);
	if(moveEvent){
		return moveEvent->canPlayerWearEquip(player, slot);
	}
	return RET_NOERROR;
}
예제 #12
0
void SampleView::Update(MoveEvent &e)
{
 	int x = e.GetOldX();
	int y = e.GetOldY();
	RECT rOld = {x,y,x+40,y+40};
	FillRect(m_HDC,&rOld,(HBRUSH)GetStockObject(WHITE_BRUSH));

	x = e.GetSender()->getX();
	y = e.GetSender()->getY();
	RECT rNew = {x,y,x+40,y+40};
	FillRect(m_HDC,&rNew,(HBRUSH)GetStockObject(GRAY_BRUSH));
}
예제 #13
0
void* UIGestureRecognizer::longTapTriggerThread(void * _pUseless)
{
    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
    pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
    long nowThreadID = UIGestureRecognizer::m_longTapNo;
    timeval longTapStarttime, longTapNowTime;
    UIGestureRecognizer::GetTime(longTapStarttime);

    while(true)
    {
        if (UIGestureRecognizer::m_longTapOpen)
        {
            const int iPreX = UIGestureRecognizer::m_iNow_x;
            const int iPreY = UIGestureRecognizer::m_iNow_y;
            nowThreadID = UIGestureRecognizer::m_longTapNo;
            UIGestureRecognizer::GetTime(longTapStarttime);
            DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "longTapTriggerThread before sleep(1) [%d, %d]", iPreX, iPreY);
            sleep(1);
            const int iDiffX = iPreX - UIGestureRecognizer::m_iNow_x;
            const int iDiffY = iPreY - UIGestureRecognizer::m_iNow_y;
            UIGestureRecognizer::GetTime(longTapNowTime);
            DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "longTapTriggerThread after sleep(1) [%d, %d]", iDiffX, iDiffY);
            DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "longTapTriggerThread nowThreadID = %d, m_longTapNo = %d", nowThreadID, m_longTapNo);
            DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "longTapTriggerThread longTapNowTime.tv_sec   = %d", longTapNowTime.tv_sec);
            DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "longTapTriggerThread longTapStarttime.tv_sec = %d", longTapStarttime.tv_sec);

            if ((nowThreadID == UIGestureRecognizer::m_longTapNo) 
                && ((longTapNowTime.tv_sec - longTapStarttime.tv_sec) < 2)
                && (iDiffX >= m_minLongTapDistance && iDiffX <= m_maxLongTapDistance 
                && iDiffY >= m_minLongTapDistance && iDiffY <= m_maxLongTapDistance))
            {
                DebugPrintf(DLC_TOUCHSTACK_LONGTAP, "UIGestureRecognizer::longTapTriggerThread sleep(1) TOUCH_LONG_TAP");
                MoveEvent* event = new MoveEvent();
                event->m_x[0] = UIGestureRecognizer::m_iNow_x;
                event->m_y[0] = UIGestureRecognizer::m_iNow_y;
                event->m_pointerCount = 1;
                event->m_pointerId[0] = 0;
                event->SetAction(MoveEvent::ACTION_LONG_TAP);
                SNativeMessage msg;
                msg.iType   = KMessageTouchEvent;
                msg.iParam1 = (int)event;
                INativeMessageQueue::GetMessageQueue()->Send(msg);
                continue;
            }
        }
        usleep(50000);
    }
    return NULL;
}
예제 #14
0
void TouchDevice::ReadTouchEvents(int touch_device)
{
      s_curPointerCount = 0;
    s_curSlotId = 0;
    int oldX = -1, oldY = -1;
    int64_t downTime = 0;
    for (;;)
    {
        MoveEvent* moveEvent = ReadSingleTouchEvent(touch_device);
        if (NULL == moveEvent)
        {
            continue;
        }
        if (MoveEvent::ACTION_DOWN == moveEvent->GetActionMasked())
        {
            oldX = moveEvent->GetX();
            oldY = moveEvent->GetY();
            downTime = moveEvent->m_eventTime;
            moveEvent->m_downTime = downTime; 

            SNativeMessage msg;
            msg.iType = MESSAGE_TYPE;

            msg.iParam1 = (uint32_t)moveEvent;
            msg.iParam2 = 0;
            msg.iParam3 = 0;
            INativeMessageQueue::GetMessageQueue()->Send(msg);
        }
        else if (MoveEvent::ACTION_UP == moveEvent->GetActionMasked())
        {
	        SNativeMessage msg;
            moveEvent->m_x[0] = oldX;
            moveEvent->m_y[0] = oldY;
            moveEvent->m_downTime = downTime;
            
            msg.iType = MESSAGE_TYPE;
            msg.iParam1 = (uint32_t)moveEvent;
            msg.iParam2 = 0;
            msg.iParam3 = 0;
            INativeMessageQueue::GetMessageQueue()->Send(msg);
            break;
        }
        else if (MoveEvent::ACTION_MOVE == moveEvent->GetActionMasked())
        {
            oldX = moveEvent->GetX();
            oldY = moveEvent->GetY();
            moveEvent->m_downTime = downTime;
            //send message
            SNativeMessage msg;
            msg.iType = MESSAGE_TYPE;
            msg.iParam1 = (uint32_t)moveEvent;
            msg.iParam2 = 0;
            msg.iParam3 = 0;

            INativeMessageQueue::GetMessageQueue()->Send(msg);
        }
    }
}
예제 #15
0
uint32_t MoveEvents::onItemMove(Item* item, Tile* tile, bool isAdd)
{
	MoveEvent_t eventType1, eventType2;
	if (isAdd) {
		eventType1 = MOVE_EVENT_ADD_ITEM;
		eventType2 = MOVE_EVENT_ADD_ITEM_ITEMTILE;
	} else {
		eventType1 = MOVE_EVENT_REMOVE_ITEM;
		eventType2 = MOVE_EVENT_REMOVE_ITEM_ITEMTILE;
	}

	uint32_t ret = 1;
	MoveEvent* moveEvent = getEvent(tile, eventType1);
	if (moveEvent) {
		ret &= moveEvent->fireAddRemItem(item, nullptr, tile->getPosition());
	}

	moveEvent = getEvent(item, eventType1);
	if (moveEvent) {
		ret &= moveEvent->fireAddRemItem(item, nullptr, tile->getPosition());
	}

	for (size_t i = tile->getFirstIndex(), j = tile->getLastIndex(); i < j; ++i) {
		Thing* thing = tile->getThing(i);
		if (!thing) {
			continue;
		}

		Item* tileItem = thing->getItem();
		if (!tileItem || tileItem == item) {
			continue;
		}

		moveEvent = getEvent(tileItem, eventType2);
		if (moveEvent) {
			ret &= moveEvent->fireAddRemItem(item, tileItem, tile->getPosition());
		}
	}
	return ret;
}
예제 #16
0
void Widget::move(const Point<int>& pos)
{
	if(pos_ == pos)
		return;

	if(!parent_) {
		ws_->moveWindow(handle_, pos);
		ws_->sync();
	}
	else {
		// Calculate invalidated rectangle
		Rect<int> rect = geometry();
		Point<int> diff = pos - pos_;

		if(diff.x() > 0) {
			rect.setWidth(rect.width() + diff.x());
		}
		else if(diff.x() < 0) {
			rect.setX(rect.x() + diff.x());
			rect.setWidth(rect.width() - diff.x());
		}

		if(diff.y() > 0) {
			rect.setHeight(rect.height() + diff.y());
		}
		else if(diff.y() < 0) {
			rect.setY(rect.y() + diff.y());
			rect.setHeight(rect.height() - diff.y());
		}

		// Send event
		MoveEvent e;
		e.setOldPos(pos_, {});
		e.setPos(pos, {});
		processEvent(&e, {});

		rect.intersect(parent_->rect());
		parent_->repaint();
	}
}
예제 #17
0
uint32_t MoveEvents::onItemMove(Item* item, Tile* tile, bool isAdd)
{
	MoveEvent_t eventType1;
	MoveEvent_t eventType2;
	if(isAdd){
		eventType1 = MOVE_EVENT_ADD_ITEM;
		eventType2 = MOVE_EVENT_ADD_ITEM_ITEMTILE;
	}
	else{
		eventType1 = MOVE_EVENT_REMOVE_ITEM;
		eventType2 = MOVE_EVENT_REMOVE_ITEM_ITEMTILE;
	}

	uint32_t ret = 1;

	MoveEvent* moveEvent = getEvent(tile, eventType1);
	if(moveEvent){
		ret = ret & moveEvent->fireAddRemItem(item, NULL, tile->getPosition());
	}

	moveEvent = getEvent(item, eventType1);
	if(moveEvent){
		ret = ret & moveEvent->fireAddRemItem(item, NULL, tile->getPosition());
	}

	int32_t j = tile->__getLastIndex();
	Item* tileItem = NULL;
	for(int32_t i = tile->__getFirstIndex(); i < j; ++i){
		Thing* thing = tile->__getThing(i);
		if(thing && (tileItem = thing->getItem()) && (tileItem != item)){
			moveEvent = getEvent(tileItem, eventType2);
			if(moveEvent){
				ret = ret & moveEvent->fireAddRemItem(item, tileItem, tile->getPosition());
			}
		}
	}

	return ret;
}
예제 #18
0
void TouchDevice::ReadTouchEvents(int _touch_device)
{
    s_curPointerCount = 0;
    s_curSlotId = 0;
    for (;;)
    {
        MoveEvent* moveEvent =  ReadSingleTouchEvent(_touch_device);
        if (NULL == moveEvent)
        {
            continue;
        }

        SNativeMessage msg;
        msg.iType = MESSAGE_TYPE;
        msg.iParam1 = (int)moveEvent;
        bool isUp = (moveEvent->GetActionMasked() == MoveEvent::ACTION_UP);

        INativeMessageQueue::GetMessageQueue()->Send(msg);
        if (isUp)
        {
            break;
        }
    }
}
예제 #19
0
bool MoveEvents::registerEvent(Event* event, const pugi::xml_node& node)
{
	MoveEvent* moveEvent = static_cast<MoveEvent*>(event); //event is guaranteed to be a MoveEvent

	const MoveEvent_t eventType = moveEvent->getEventType();
	if (eventType == MOVE_EVENT_ADD_ITEM || eventType == MOVE_EVENT_REMOVE_ITEM) {
		pugi::xml_attribute tileItemAttribute = node.attribute("tileitem");
		if (tileItemAttribute && pugi::cast<uint16_t>(tileItemAttribute.value()) == 1) {
			switch (eventType) {
				case MOVE_EVENT_ADD_ITEM:
					moveEvent->setEventType(MOVE_EVENT_ADD_ITEM_ITEMTILE);
					break;
				case MOVE_EVENT_REMOVE_ITEM:
					moveEvent->setEventType(MOVE_EVENT_REMOVE_ITEM_ITEMTILE);
					break;
				default:
					break;
			}
		}
	}

	pugi::xml_attribute attr;
	if ((attr = node.attribute("itemid"))) {
		int32_t id = pugi::cast<int32_t>(attr.value());
		addEvent(moveEvent, id, m_itemIdMap);
		if (moveEvent->getEventType() == MOVE_EVENT_EQUIP) {
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();
		}
	} else if ((attr = node.attribute("fromid"))) {
		uint32_t id = pugi::cast<uint32_t>(attr.value());
		uint32_t endId = pugi::cast<uint32_t>(node.attribute("toid").value());

		addEvent(moveEvent, id, m_itemIdMap);

		if (moveEvent->getEventType() == MOVE_EVENT_EQUIP) {
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();

			while (++id <= endId) {
				addEvent(moveEvent, id, m_itemIdMap);

				ItemType& tit = Item::items.getItemType(id);
				tit.wieldInfo = moveEvent->getWieldInfo();
				tit.minReqLevel = moveEvent->getReqLevel();
				tit.minReqMagicLevel = moveEvent->getReqMagLv();
				tit.vocationString = moveEvent->getVocationString();
			}
		} else {
			while (++id <= endId) {
				addEvent(moveEvent, id, m_itemIdMap);
			}
		}
	} else if ((attr = node.attribute("uniqueid"))) {
		addEvent(moveEvent, pugi::cast<int32_t>(attr.value()), m_uniqueIdMap);
	} else if ((attr = node.attribute("fromuid"))) {
		uint32_t id = pugi::cast<uint32_t>(attr.value());
		uint32_t endId = pugi::cast<uint32_t>(node.attribute("touid").value());
		addEvent(moveEvent, id, m_uniqueIdMap);
		while (++id <= endId) {
			addEvent(moveEvent, id, m_uniqueIdMap);
		}
	} else if ((attr = node.attribute("actionid"))) {
		addEvent(moveEvent, pugi::cast<int32_t>(attr.value()), m_actionIdMap);
	} else if ((attr = node.attribute("fromaid"))) {
		uint32_t id = pugi::cast<uint32_t>(attr.value());
		uint32_t endId = pugi::cast<uint32_t>(node.attribute("toaid").value());
		addEvent(moveEvent, id, m_actionIdMap);
		while (++id <= endId) {
			addEvent(moveEvent, id, m_actionIdMap);
		}
	} else if ((attr = node.attribute("pos"))) {
		std::vector<int32_t> posList = vectorAtoi(explodeString(attr.as_string(), ";"));
		if (posList.size() < 3) {
			return false;
		}

		Position pos(posList[0], posList[1], posList[2]);
		addEvent(moveEvent, pos, m_positionMap);
	} else {
		return false;
	}
	return true;
}
예제 #20
0
void Widget::processEvent(Event* event, PassKey<Widget, WindowSystemPrivate>)
{
	switch(event->type()) {
	case Event::kFocusIn: {
		if(isAcceptsFocus_) {
			Widget* widget = first_;
			Widget* next = widget;

			while(next) {
				widget = next;

				if(widget->isAcceptsFocus_ && widget->first_ && widget->isVisible()
				   && widget->isEnabled()) {
					next = widget->first_;
				}
				else {
					next = next->next_;
				}
			}

			if(focus_)
				focus_->hasFocus_ = false;

			focus_ = widget;

			if(focus_) {
				focus_->hasFocus_ = true;
				focus_->dispatchEvent(event);
			}
		}

		return; }

	case Event::kFocusOut:
		if(focus_) {
			focus_->hasFocus_ = false;
			focus_->dispatchEvent(event);
		}

		return;

	case Event::kMouseEnter: {
		if(!hasGrab_) {
			MouseEvent* e = static_cast<MouseEvent*>(event);
			dispatchEvent(e);

			updateHoverPoint(e->pos());
		}

		return; }

	case Event::kMouseLeave: {
		if(!hasGrab_)
			sendMouseLeave();

		return; }

	case Event::kMouseMove: {
		MouseEvent* e = static_cast<MouseEvent*>(event);
		Widget* widget;
		Point<int> pos;

		if(hasGrab_) {
			std::tie(widget, pos) = hoveredWidget();

			e->setPos(e->windowPos() - pos, {});
			widget->processMouseEvent(e);
		}
		else {
			std::tie(widget, pos) = updateHoverPoint(e->pos());

			e->setPos(pos, {});
			widget->dispatchEvent(e);
		}

		return; }

	case Event::kMousePress: {
		MouseEvent* e = static_cast<MouseEvent*>(event);
		hasGrab_ = true;

		Widget* widget;
		Point<int> pos;
		std::tie(widget, pos) = hoveredWidget();

		widget->updateFocus(this);

		e->setPos(e->windowPos() - pos, {});
		widget->processMouseEvent(e);
		return; }

	case Event::kMouseRelease: {
		MouseEvent* e = static_cast<MouseEvent*>(event);

		Widget* widget;
		Point<int> pos;
		std::tie(widget, pos) = hoveredWidget();

		Point<int> eventPos = e->pos();
		e->setPos(e->windowPos() - pos, {});
		widget->processMouseEvent(e);

		if(e->buttons() == MouseButton::kNone) {
			hasGrab_ = false;
			updateHoverPoint(eventPos);
		}

		Duration duration = widget->timeCounter_.restart();
		if(duration <= 300_ms && e->button() != MouseButton::kNone
		   && e->button() == widget->lastButton_) {
			MouseEvent ev(Event::kMouseDoubleClick);
			ev.setTimestamp(e->timestamp(), {});
			ev.setModifiers(e->modifiers(), {});
			ev.setPos(e->pos(), {});
			ev.setWindowPos(e->windowPos(), {});
			ev.setGlobalPos(e->globalPos(), {});
			ev.setButton(e->button(), {});
			ev.setButtons(e->buttons(), {});
			widget->processEvent(&ev, {});

			widget->lastButton_ = MouseButton::kNone;
		}
		else {
			widget->lastButton_ = e->button();
		}

		return; }

	case Event::kMouseWheel: {
		MouseWheelEvent* e = static_cast<MouseWheelEvent*>(event);

		Widget* widget;
		Point<int> pos;
		std::tie(widget, pos) = hoveredWidget();

		e->setPos(e->windowPos() - pos, {});
		widget->processMouseEvent(e);
		return; }

	case Event::kKeyPress: {
		Widget* widget = focus_;
		while(focus_) {
			if(focus_->dispatchEvent(event)) {
				if(event->isAccepted())
					return;
			}

			widget = widget->parent_;
		}

		return; }

	case Event::kKeyRelease: {
		Widget* widget = focus_;
		while(focus_) {
			if(focus_->dispatchEvent(event)) {
				if(event->isAccepted())
					return;
			}

			widget = widget->parent_;
		}

		return; }

	case Event::kShow: {
		show();
		break; }

	case Event::kHide: {
		hide();
		break; }

	case Event::kEnable: {
		enable();
		break; }

	case Event::kDisable: {
		disable();
		break; }

	case Event::kClose : {
		if(dispatchEvent(event) && event->isAccepted()) {
			hide();
		}

		return; }

	case Event::kPaint: {
		repaint(static_cast<PaintEvent*>(event));

		// repaint() calls the dispatchEvent() by itself so we don't need to call it one
		// more time
		return; }

	case Event::kMove: {
		MoveEvent* e = static_cast<MoveEvent*>(event);
		pos_ = e->pos();
		break; }

	case Event::kResize: {
		ResizeEvent* e = static_cast<ResizeEvent*>(event);
		size_ = e->size();
		break; }

	default:
		break;
	}

	dispatchEvent(event);

	if(event->type() == Event::kResize && layout_) {
		layout_->setGeometry(rect());
	}
}
예제 #21
0
//maybe just update one of x/y
MoveEvent* TouchDevice::ReadSingleTouchEvent(int _touch_device)
{
    struct input_event iebuf;
    MoveEvent moveEvent;
    int moveAction = MoveEvent::ACTION_MASK;
    int curActionIndex = -1;
    int curIndex = -1;
    static int s_oldX[2] = {-1, -1};
    static int s_oldY[2] = {-1, -1};
    static int index2Slots[2] ={-1, -1};
    static int64_t downTime = -1;
    int readCount = 0;
    for (;;)
    {
        if (read(_touch_device, &iebuf, sizeof(iebuf)) >0 )
        {
            if (EV_ABS == iebuf.type)
            {
                ++readCount;
            }
            DebugPrintf(DLC_GESTURE, "type: %d, code: %d, value: %d", iebuf.type, iebuf.code, iebuf.value);
            
            if (iebuf.type == EV_ABS && iebuf.code == ABS_MT_SLOT)
            {
                s_curSlotId = iebuf.value;
                continue;
            }
            if (iebuf.type == EV_ABS && iebuf.code == ABS_MT_TRACKING_ID && iebuf.value >=0)
            {
                ++curIndex;
                index2Slots[curIndex] = s_curSlotId;
                ++s_curPointerCount;
                if (1 == s_curPointerCount)
                {
                    moveAction = MoveEvent::ACTION_DOWN;
                    downTime = SystemUtil::GetUpdateTimeInMs();
                }
                else if (2 == s_curPointerCount)
                {
                    moveAction = MoveEvent::ACTION_POINTER_DOWN;
                }
                curActionIndex = curIndex;
            }

            if (iebuf.type == EV_ABS && iebuf.code == ABS_MT_TRACKING_ID && iebuf.value ==-1)
            {
                ++curIndex;
                index2Slots[curIndex] = s_curSlotId;
                --s_curPointerCount;
                curActionIndex = curIndex;
                if (1 == s_curPointerCount)
                {
                    moveAction = MoveEvent::ACTION_POINTER_UP;
                    // sometimes we get two ABS_MT_TRACKING_ID in one loop
                    // and must break it in two
                    break;
                }
                else if (0 == s_curPointerCount)
                {
                    moveAction = MoveEvent::ACTION_UP;
                }
            }

            if (iebuf.type == EV_ABS && iebuf.code == ABS_MT_POSITION_X)
            {
                if (-1 == curIndex || s_curSlotId != index2Slots[curIndex])
                {
                    ++curIndex;
                    index2Slots[curIndex] = s_curSlotId;
                }
                if (-1 == curActionIndex)
                {
                    curActionIndex = curIndex;
                }
                s_oldX[s_curSlotId] = GetScreenHorizonPostion(iebuf.value);
                if (MoveEvent::ACTION_MASK == moveAction)
                {
                    moveAction = MoveEvent::ACTION_MOVE;
                }
            }

            if (iebuf.type == EV_ABS && iebuf.code == ABS_MT_POSITION_Y)
            {
                if (-1 == curIndex || s_curSlotId != index2Slots[curIndex])
                {
                    ++curIndex;
                    index2Slots[curIndex] = s_curSlotId;
                }
                if (-1 == curActionIndex)
                {
                    curActionIndex = curIndex;
                }
                s_oldY[s_curSlotId] = GetScreenVerticalPostion(iebuf.value);

                if (MoveEvent::ACTION_MASK == moveAction)
                {
                    moveAction = MoveEvent::ACTION_MOVE;
                }
                if (MoveEvent::ACTION_DOWN == moveAction)
                {
                    // 有可能action_down后还有一个action_pointer_down
                    // 需要拆成两个move event
                    break;
                }
            }

            if (iebuf.type == EV_SYN && iebuf.code == SYN_REPORT && iebuf.value ==0)
            {
                break;
            }
        }
        else
        {
            break;
        }
    }
    // previous read bread before read (0, 0, 0)
    // currently only read (0, 0, 0)
    if (0 == readCount)
    {
        return NULL;
    }
    moveEvent.m_pointerCount = curIndex + 1;
    moveEvent.m_action = moveAction;
    moveEvent.m_downTime = downTime;
    for (int i = 0; i < moveEvent.m_pointerCount; ++i)
    {
        moveEvent.m_x[i] = s_oldX[index2Slots[i]];
        moveEvent.m_y[i] = s_oldY[index2Slots[i]];
        moveEvent.m_pointerId[i] = index2Slots[i];
    }
    // 1. currently there're two fingers on touch screen
    //  but only one finger position information is reported in this loop
    // 2. previously there're two fingers on toush screen 
    //  but only one finger up information is reported in this loop
    // adding another's information
    if (2 == s_curPointerCount && 0 == curIndex
            || (MoveEvent::ACTION_POINTER_UP == moveAction && 0 == curIndex))
    {
        int anotherSlot = 1 - index2Slots[0];
        moveEvent.m_x[1] = s_oldX[anotherSlot];
        moveEvent.m_y[1] = s_oldY[anotherSlot];
        moveEvent.m_pointerId[1] = anotherSlot;
        moveEvent.m_pointerCount = 2;
    }
    moveEvent.m_actionIndex = curActionIndex;
    moveEvent.m_eventTime = SystemUtil::GetUpdateTimeInMs();

    for (int i = 0; i < 2; ++i)
    {
        DebugPrintf(DLC_GESTURE, "Slot %d: (%d, %d)", i, s_oldX[i], s_oldY[i]);
    }
    DebugPrintf(DLC_GESTURE, "Read move event %d: (%d, %d), pointer count: %d, action index: %d",
            moveEvent.GetActionMasked(),
            moveEvent.GetX(),
            moveEvent.GetY(),
            moveEvent.GetPointerCount(),
            moveEvent.GetActionIndex());
    return moveEvent.Clone();
}
예제 #22
0
bool MoveEvents::registerEvent(Event* event, xmlNodePtr p)
{
	MoveEvent* moveEvent = dynamic_cast<MoveEvent*>(event);
	if(!moveEvent)
		return false;

	bool success = true;
	int id;
	std::string str;

	MoveEvent_t eventType = moveEvent->getEventType();
	if(eventType == MOVE_EVENT_ADD_ITEM || eventType == MOVE_EVENT_REMOVE_ITEM){
		if(readXMLInteger(p,"tileitem",id) && id == 1){
			switch(eventType){
			case MOVE_EVENT_ADD_ITEM:
				moveEvent->setEventType(MOVE_EVENT_ADD_ITEM_ITEMTILE);
				break;
			case MOVE_EVENT_REMOVE_ITEM:
				moveEvent->setEventType(MOVE_EVENT_REMOVE_ITEM_ITEMTILE);
				break;
			default:
				break;
			}
		}
	}

	if(readXMLInteger(p,"itemid",id)){
		if(moveEvent->getEventType() == MOVE_EVENT_EQUIP){
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();
		}

		addEvent(moveEvent, id, m_itemIdMap);
	}
	else if(readXMLInteger(p,"uniqueid",id)){
		addEvent(moveEvent, id, m_uniqueIdMap);
	}
	else if(readXMLInteger(p,"actionid",id)){
		addEvent(moveEvent, id, m_actionIdMap);
	}
	else if(readXMLString(p,"pos",str)){
		std::vector<std::string> posList = explodeString(str, ";");
		if(posList.size() < 3){
			success = false;
		}
		else{
			Position pos;
			pos.x = atoi(posList[0].c_str());
			pos.y = atoi(posList[1].c_str());
			pos.z = atoi(posList[2].c_str());
			addEvent(moveEvent, pos, m_positionMap);
		}
	}
	else{
		success = false;
	}
	return success;
}
예제 #23
0
bool MoveEvents::registerEvent(Event* event, xmlNodePtr p)
{
	MoveEvent* moveEvent = dynamic_cast<MoveEvent*>(event);

	if (!moveEvent) {
		return false;
	}

	bool success = true;
	int32_t id, endId;
	std::string str;

	MoveEvent_t eventType = moveEvent->getEventType();

	if (eventType == MOVE_EVENT_ADD_ITEM || eventType == MOVE_EVENT_REMOVE_ITEM) {
		if (readXMLInteger(p, "tileitem", id) && id == 1) {
			switch (eventType) {
				case MOVE_EVENT_ADD_ITEM:
					moveEvent->setEventType(MOVE_EVENT_ADD_ITEM_ITEMTILE);
					break;
				case MOVE_EVENT_REMOVE_ITEM:
					moveEvent->setEventType(MOVE_EVENT_REMOVE_ITEM_ITEMTILE);
					break;
				default:
					break;
			}
		}
	}

	if (readXMLInteger(p, "itemid", id)) {
		addEvent(moveEvent, id, m_itemIdMap);

		if (moveEvent->getEventType() == MOVE_EVENT_EQUIP) {
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();
		}
	} else if (readXMLInteger(p, "fromid", id) && readXMLInteger(p, "toid", endId)) {
		addEvent(moveEvent, id, m_itemIdMap);

		if (moveEvent->getEventType() == MOVE_EVENT_EQUIP) {
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();

			while (id < endId) {
				id++;
				addEvent(new MoveEvent(moveEvent), id, m_itemIdMap);

				ItemType& tit = Item::items.getItemType(id);
				tit.wieldInfo = moveEvent->getWieldInfo();
				tit.minReqLevel = moveEvent->getReqLevel();
				tit.minReqMagicLevel = moveEvent->getReqMagLv();
				tit.vocationString = moveEvent->getVocationString();
			}
		} else {
			while (id < endId) {
				addEvent(new MoveEvent(moveEvent), ++id, m_itemIdMap);
			}
		}
	} else if (readXMLInteger(p, "uniqueid", id)) {
		addEvent(moveEvent, id, m_uniqueIdMap);
	} else if (readXMLInteger(p, "fromuid", id) && readXMLInteger(p, "touid", endId)) {
		addEvent(moveEvent, id, m_uniqueIdMap);

		while (id < endId) {
			addEvent(new MoveEvent(moveEvent), ++id, m_uniqueIdMap);
		}
	} else if (readXMLInteger(p, "actionid", id) || readXMLInteger(p, "aid", id)) {
		addEvent(moveEvent, id, m_actionIdMap);
	} else if (readXMLInteger(p, "fromaid", id) && readXMLInteger(p, "toaid", endId)) {
		addEvent(moveEvent, id, m_actionIdMap);

		while (id < endId) {
			addEvent(new MoveEvent(moveEvent), ++id, m_actionIdMap);
		}
	} else if (readXMLString(p, "pos", str)) {
		std::vector<int32_t> posList = vectorAtoi(explodeString(str, ";"));

		if (posList.size() >= 3) {
			Position pos(posList[0], posList[1], posList[2]);
			addEvent(moveEvent, pos, m_positionMap);
		} else {
			success = false;
		}
	} else {
		success = false;
	}

	return success;
}
예제 #24
0
	void WidgetImplWinGLX11::moveEvent( MoveEvent& event )
	{
		event.position( _rect.x, _rect.y );
		_widget->moveEvent( event );
	}
예제 #25
0
파일: movement.cpp 프로젝트: edubart/otserv
uint32_t MoveEvents::onItemMove(Item* item, Tile* tile, bool isAdd)
{
	MoveEvent_t eventType1;
	MoveEvent_t eventType2;

	if (isAdd)
	{
		eventType1 = MOVE_EVENT_ADD_ITEM;
		eventType2 = MOVE_EVENT_ADD_ITEM_ITEMTILE;
	}
	else
	{
		eventType1 = MOVE_EVENT_REMOVE_ITEM;
		eventType2 = MOVE_EVENT_REMOVE_ITEM_ITEMTILE;
	}

	uint32_t ret = 1;
	MoveEvent* moveEvent = getEvent(tile, eventType1);

	if (moveEvent)
	{
		ret &= moveEvent->fireAddRemItem(item, NULL, tile->getPosition());
	}

	moveEvent = getEvent(item, eventType1);

	if (moveEvent)
	{
		ret &= moveEvent->fireAddRemItem(item, NULL, tile->getPosition());
	}

	Item* tileItem = NULL;

	if (m_lastCacheTile == tile)
	{
		if (m_lastCacheItemVector.empty())
		{
			return false;
		}

		//We can not use iterators here since the scripts can invalidate the iterator
		for (uint32_t i = 0; i < m_lastCacheItemVector.size(); ++i)
		{
			tileItem = m_lastCacheItemVector[i];

			if (tileItem && tileItem != item)
			{
				moveEvent = getEvent(tileItem, eventType2);

				if (moveEvent)
				{
					ret &= moveEvent->fireAddRemItem(item, tileItem, tile->getPosition());
				}
			}
		}

		return ret;
	}

	m_lastCacheTile = tile;
	m_lastCacheItemVector.clear();
	//We can not use iterators here since the scripts can invalidate the iterator
	int32_t j = tile->__getLastIndex();

	for (int32_t i = tile->__getFirstIndex(); i < j; ++i)
	{
		Thing* thing = tile->__getThing(i);

		if (thing && (tileItem = thing->getItem()) && (tileItem != item))
		{
			moveEvent = getEvent(tileItem, eventType2);

			if (moveEvent)
			{
				m_lastCacheItemVector.push_back(tileItem);
				ret &= moveEvent->fireAddRemItem(item, tileItem, tile->getPosition());
			}
			else if (hasTileEvent(tileItem))
			{
				m_lastCacheItemVector.push_back(tileItem);
			}
		}
	}

	return ret;
}
예제 #26
0
uint32_t MoveEvent::EquipItem(Player* player, Item* item, slots_t slot, bool transform)
{
	if(player->isItemAbilityEnabled(slot)){
		return 1;
	}

	//Enable item only when requirements are complete
	//This includes item transforming
	MoveEvent* moveEvent = g_moveEvents->getEvent(item, MOVE_EVENT_EQUIP);
	if(moveEvent && !player->hasFlag(PlayerFlag_IgnoreWeaponCheck)){
		if(player->getLevel() < moveEvent->getReqLevel() || player->getMagicLevel() < moveEvent->getReqMagLv() ||
			!player->isPremium() && moveEvent->isPremium() || !moveEvent->getVocEquipMap().empty() &&
			moveEvent->getVocEquipMap().find(player->getVocationId()) == moveEvent->getVocEquipMap().end()){
				return 1;
		}
	}

	const ItemType& it = Item::items[item->getID()];

	if(it.transformEquipTo != 0){
		Item* newItem = g_game.transformItem(item, it.transformEquipTo);
		g_game.startDecay(newItem);
	}
	else{
		player->setItemAbility(slot, true);
	}

	if(it.abilities.invisible){
		Condition* condition = Condition::createCondition((ConditionId_t)slot, CONDITION_INVISIBLE, -1, 0);
		player->addCondition(condition);
	}

	if(it.abilities.manaShield){
		Condition* condition = Condition::createCondition((ConditionId_t)slot, CONDITION_MANASHIELD, -1, 0);
		player->addCondition(condition);
	}

	if(it.abilities.speed != 0){
		g_game.changeSpeed(player, it.abilities.speed);
	}

	if(it.abilities.conditionSuppressions != 0){
		player->setConditionSuppressions(it.abilities.conditionSuppressions, false);
		player->sendIcons();
	}

	if(it.abilities.regeneration){
		Condition* condition = Condition::createCondition((ConditionId_t)slot, CONDITION_REGENERATION, -1, 0);
		if(it.abilities.healthGain != 0){
			condition->setParam(CONDITIONPARAM_HEALTHGAIN, it.abilities.healthGain);
		}

		if(it.abilities.healthTicks != 0){
			condition->setParam(CONDITIONPARAM_HEALTHTICKS, it.abilities.healthTicks);
		}

		if(it.abilities.manaGain != 0){
			condition->setParam(CONDITIONPARAM_MANAGAIN, it.abilities.manaGain);
		}

		if(it.abilities.manaTicks != 0){
			condition->setParam(CONDITIONPARAM_MANATICKS, it.abilities.manaTicks);
		}

		player->addCondition(condition);
	}

	//skill modifiers
	bool needUpdateSkills = false;
	for(int32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i){
		if(it.abilities.skills[i]){
			needUpdateSkills = true;
			player->setVarSkill((skills_t)i, it.abilities.skills[i]);
		}
	}
	if(needUpdateSkills){
		player->sendSkills();
	}

	//stat modifiers
	bool needUpdateStats = false;
	for(int32_t s = STAT_FIRST; s <= STAT_LAST; ++s){
		if(it.abilities.stats[s]){
			needUpdateStats = true;
			player->setVarStats((stats_t)s, it.abilities.stats[s]);
		}
		if(it.abilities.statsPercent[s]){
			needUpdateStats = true;
			player->setVarStats((stats_t)s, (int32_t)(player->getDefaultStats((stats_t)s) * ((it.abilities.statsPercent[s] - 100) / 100.f)));
		}
	}
	if(needUpdateStats){
		player->sendStats();
	}

	return 1;
}
예제 #27
0
int32_t MoveEventScript::luaCallFunction(lua_State* L)
{
	//callFunction(...)
	MoveEvent* event = MoveEventScript::event;
	if(!event)
	{
		error(__FUNCTION__, "MoveEvent not set!");
		lua_pushboolean(L, false);
		return 1;
	}

	if(event->getEventType() == MOVE_EVENT_EQUIP || event->getEventType() == MOVE_EVENT_DE_EQUIP)
	{
		ScriptEnviroment* env = getEnv();
		bool boolean = popBoolean(L);
		slots_t slot = (slots_t)popNumber(L);

		Item* item = env->getItemByUID(popNumber(L));
		if(!item)
		{
			error(__FUNCTION__, getError(LUA_ERROR_ITEM_NOT_FOUND));
			lua_pushboolean(L, false);
			return 1;
		}

		Player* player = env->getPlayerByUID(popNumber(L));
		if(!player)
		{
			error(__FUNCTION__, getError(LUA_ERROR_PLAYER_NOT_FOUND));
			lua_pushboolean(L, false);
			return 1;
		}

		if(event->getEventType() != MOVE_EVENT_EQUIP)
			lua_pushboolean(L, MoveEvent::DeEquipItem(event, player, item, slot, boolean));
		else
			lua_pushboolean(L, MoveEvent::EquipItem(event, player, item, slot, boolean));

		return 1;
	}
	else if(event->getEventType() == MOVE_EVENT_STEP_IN)
	{
		ScriptEnviroment* env = getEnv();
		Item* item = env->getItemByUID(popNumber(L));
		if(!item)
		{
			error(__FUNCTION__, getError(LUA_ERROR_ITEM_NOT_FOUND));
			lua_pushboolean(L, false);
			return 1;
		}

		Creature* creature = env->getCreatureByUID(popNumber(L));
		if(!creature)
		{
			error(__FUNCTION__, getError(LUA_ERROR_CREATURE_NOT_FOUND));
			lua_pushboolean(L, false);
			return 1;
		}

		lua_pushboolean(L, MoveEvent::StepInField(creature, item));
		return 1;
	}
	else if(event->getEventType() == MOVE_EVENT_ADD_ITEM)
	{
		ScriptEnviroment* env = getEnv();
		Item* item = env->getItemByUID(popNumber(L));
		if(!item)
		{
			error(__FUNCTION__, getError(LUA_ERROR_ITEM_NOT_FOUND));
			lua_pushboolean(L, false);
			return 1;
		}

		lua_pushboolean(L, MoveEvent::AddItemField(item));
		return 1;
	}

	error(__FUNCTION__, "callFunction not available for current event.");
	lua_pushboolean(L, false);
	return 1;
}
예제 #28
0
파일: movement.cpp 프로젝트: edubart/otserv
uint32_t MoveEvents::onCreatureMove(Creature* creature, const Tile* fromTile, const Tile* toTile, bool isIn)
{
	MoveEvent_t eventType;
	const Tile* tile = NULL;

	if (isIn)
	{
		tile = toTile;
		eventType = MOVE_EVENT_STEP_IN;
	}
	else
	{
		tile = fromTile;
		eventType = MOVE_EVENT_STEP_OUT;
	}

	Position fromPos(0, 0, 0);

	if (fromTile)
	{
		fromPos = fromTile->getPosition();
	}

	Position toPos(0, 0, 0);

	if (toTile)
	{
		toPos = toTile->getPosition();
	}

	uint32_t ret = 1;
	MoveEvent* moveEvent = getEvent(tile, eventType);

	if (moveEvent)
	{
		ret = ret & moveEvent->fireStepEvent(creature, NULL, fromPos, toPos);
	}

	Item* tileItem = NULL;

	if (m_lastCacheTile == tile)
	{
		if (m_lastCacheItemVector.empty())
		{
			return ret;
		}

		//We can not use iterators here since the scripts can invalidate the iterator
		for (uint32_t i = 0; i < m_lastCacheItemVector.size(); ++i)
		{
			tileItem = m_lastCacheItemVector[i];

			if (tileItem)
			{
				moveEvent = getEvent(tileItem, eventType);

				if (moveEvent)
				{
					ret = ret & moveEvent->fireStepEvent(creature, tileItem, fromPos, toPos);
				}
			}
		}

		return ret;
	}

	m_lastCacheTile = tile;
	m_lastCacheItemVector.clear();
	//We can not use iterators here since the scripts can invalidate the iterator
	int32_t j = tile->__getLastIndex();

	for (int32_t i = tile->__getFirstIndex(); i < j; ++i)
	{
		Thing* thing = tile->__getThing(i);

		if (thing && (tileItem = thing->getItem()))
		{
			moveEvent = getEvent(tileItem, eventType);

			if (moveEvent)
			{
				m_lastCacheItemVector.push_back(tileItem);
				ret = ret & moveEvent->fireStepEvent(creature, tileItem, fromPos, toPos);
			}
			else if (hasTileEvent(tileItem))
			{
				m_lastCacheItemVector.push_back(tileItem);
			}
		}
	}

	return ret;
}