CGE2: Rework Sprite::touch to use V2D for coords.

This commit is contained in:
uruk 2014-06-15 21:29:32 +02:00
parent 7f4af90777
commit c488c15289
3 changed files with 6 additions and 8 deletions

View File

@ -869,7 +869,7 @@ void CGE2Engine::switchHero(int sex) {
}
#pragma argsused
void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
void Sprite::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
if ((mask & kEventAttn) != 0)
return;

View File

@ -189,7 +189,7 @@ void EventManager::handleEvents() {
e._y -= _vm->_mouse->_siz.y;
if (_vm->_mouse->_hold && e._spritePtr != _vm->_mouse->_hold) {
_vm->_mouse->_hold->touch(e._mask | kEventAttn,
e._x - _vm->_mouse->_hold->_pos2D.x, e._y - _vm->_mouse->_hold->_pos2D.y, e._keyCode);
V2D(_vm, e._x - _vm->_mouse->_hold->_pos2D.x, e._y - _vm->_mouse->_hold->_pos2D.y), e._keyCode);
}
// update mouse cursor position
if (e._mask & kMouseRoll)
@ -199,11 +199,9 @@ void EventManager::handleEvents() {
// activate current touched SPRITE
if (e._spritePtr) {
if (e._mask & kEventKeyb)
e._spritePtr->touch(e._mask, _vm->_mouse->_point.x, _vm->_mouse->_point.y, e._keyCode);
else {
V2D temp = _vm->_mouse->_point - e._spritePtr->_pos2D;
e._spritePtr->touch(e._mask, temp.x, temp.y, e._keyCode);
}
e._spritePtr->touch(e._mask, _vm->_mouse->_point, e._keyCode);
else
e._spritePtr->touch(e._mask, _vm->_mouse->_point - e._spritePtr->_pos2D, e._keyCode);
} else if (_vm->_sys)
_vm->_sys->touch(e._mask, _vm->_mouse->_point, e._keyCode);

View File

@ -260,7 +260,7 @@ public:
void step(int nr = -1);
Seq *setSeq(Seq *seq);
CommandHandler::Command *snList(Action type);
virtual void touch(uint16 mask, int x, int y, Common::KeyCode keyCode);
virtual void touch(uint16 mask, V2D pos, Common::KeyCode keyCode);
virtual void tick();
virtual void setScene(int c);
void clrHide() { if (_ext) _ext->_b0 = NULL; }