void Goblin_v2::placeObject(Gob_Object *objDesc, char animated, int16 index, int16 x, int16 y, int16 state) { Mult::Mult_Object *obj; Mult::Mult_AnimData *objAnim; int16 layer; int16 animation; obj = &_vm->_mult->_objects[index]; objAnim = obj->pAnimData; obj->goblinX = x; obj->goblinY = y; objAnim->order = y; if (state == -1) { objAnim->frame = 0; objAnim->isPaused = 0; objAnim->isStatic = 0; objAnim->newCycle = 0; _vm->_scenery->updateAnim(objAnim->layer, 0, objAnim->animation, 0, *obj->pPosX, *obj->pPosY, 0); if (!_vm->_map->hasBigTiles()) *obj->pPosY = (y + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); else *obj->pPosY = ((y + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (y + 1) / 2; *obj->pPosX = x * _vm->_map->getTilesWidth(); } else { if ((obj->goblinStates != 0) && (obj->goblinStates[state] != 0)) { layer = obj->goblinStates[state][0].layer; animation = obj->goblinStates[state][0].animation; objAnim->state = state; objAnim->layer = layer; objAnim->animation = animation; objAnim->frame = 0; objAnim->isPaused = 0; objAnim->isStatic = 0; objAnim->newCycle = _vm->_scenery->getAnimLayer(animation, layer)->framesCount; _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); if (!_vm->_map->hasBigTiles()) *obj->pPosY = (y + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); else *obj->pPosY = ((y + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (y + 1) / 2; *obj->pPosX = x * _vm->_map->getTilesWidth(); initiateMove(obj); } else initiateMove(obj); } }
void MultiPurposeDragArea::mousePressEvent(QMouseEvent * event) { if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton) { grabMouse(); if (event->button() == Qt::LeftButton) { modificationMode = wmm_drag; emit initiateMove(mapToGlobal(event->pos())); } if (event->button() == Qt::RightButton) { modificationMode = wmm_resize; emit initiateResize(mapToGlobal(event->pos())); } } }