From 1d31cd12233d8a98ea9288147cde946d3884c7c0 Mon Sep 17 00:00:00 2001 From: Andrew Kurushin Date: Sun, 15 May 2005 17:45:59 +0000 Subject: fixed give verb fixed occasional verbs redraw svn-id: r18113 --- saga/actor.cpp | 4 ++-- saga/interface.cpp | 22 ++++++++++------------ saga/scene.h | 2 +- saga/script.cpp | 7 +++---- saga/sfuncs.cpp | 13 +++++++++---- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/saga/actor.cpp b/saga/actor.cpp index ed3231fc3c..856225e111 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -1136,7 +1136,7 @@ int Actor::direct(int msec) { // FIXME: HACK. This should be turned into cycle event. _lastTickMsec += msec; - if (_lastTickMsec > 1000 / 15) { // fixme + if (_lastTickMsec > 1000 / 15) { // fixme choose 50 for speed up _lastTickMsec = 0; //process actions handleActions(msec, false); @@ -1238,7 +1238,7 @@ void Actor::createDrawOrderList() { bool Actor::getSpriteParams(CommonObjectData *commonObjectData, int &frameNumber, SpriteList *&spriteList) { if (_vm->_scene->currentSceneResourceId() == RID_ITE_OVERMAP_SCENE) { if (!(commonObjectData->flags & kProtagonist)){ - warning("not protagonist"); +// warning("not protagonist"); return false; } frameNumber = 8; diff --git a/saga/interface.cpp b/saga/interface.cpp index b40512c3bf..4a6b786382 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -569,21 +569,19 @@ void Interface::handleCommandUpdate(const Point& mousePoint) { panelButton = _mainPanel.hitTest(mousePoint, kPanelAllButtons); - if (panelButton != NULL) { - if (panelButton->type == kPanelButtonArrow) { - if (panelButton->state == 1) { - //TODO: insert timeout catchup - inventoryChangePos(panelButton->id); - } - draw(); - } + bool changed = false; - if (panelButton->type == kPanelButtonInventory) { - _vm->_script->whichObject(mousePoint); - } + if ((panelButton != NULL) && (panelButton->type == kPanelButtonArrow)) { + if (panelButton->state == 1) { + //TODO: insert timeout catchup + inventoryChangePos(panelButton->id); + } + changed = true; + } else { + _vm->_script->whichObject(mousePoint); } - bool changed = (panelButton != _mainPanel.currentButton); + changed = changed || (panelButton != _mainPanel.currentButton); _mainPanel.currentButton = panelButton; if (changed) { draw(); diff --git a/saga/scene.h b/saga/scene.h index 6281497fb5..125283136a 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -262,7 +262,7 @@ class Scene { int getSceneResourceId(int sceneNumber) { if ((sceneNumber < 0) || (sceneNumber >= _sceneMax)) { - error("getSceneResourceId: wrong sceneNumber"); + error("getSceneResourceId: wrong sceneNumber"); } return _sceneLUT[sceneNumber]; } diff --git a/saga/script.cpp b/saga/script.cpp index 47823abf45..77bac9b850 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -685,8 +685,7 @@ void Script::whichObject(const Point& mousePoint) { _leftButtonVerb = _currentVerb; newRightButtonVerb = kVerbNone; - if (_vm->_actor->_protagonist->currentAction == kActionWalkDir) { - } else { + if (_vm->_actor->_protagonist->currentAction != kActionWalkDir) { if (_vm->getSceneHeight() >= mousePoint.y) { newObjectId = _vm->_actor->hitTest(mousePoint, true); @@ -755,7 +754,7 @@ void Script::whichObject(const Point& mousePoint) { newRightButtonVerb = kVerbNone; } - if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && !_firstObjectSet)) { + if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && _firstObjectSet)) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } @@ -766,7 +765,7 @@ void Script::whichObject(const Point& mousePoint) { } } } else { - if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && !_firstObjectSet)) { + if ((_currentVerb == kVerbTalkTo) || ((_currentVerb == kVerbGive) && _firstObjectSet)) { // no way } else { panelButton = _vm->_interface->inventoryHitTest(mousePoint); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 7ff0a1c225..98ac131ae6 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -195,10 +195,15 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) { // Check if an object is carried. void Script::sfIsCarried(SCRIPTFUNC_PARAMS) { uint16 objectId = thread->pop(); - ObjectData *obj; - obj = _vm->_actor->getObj(objectId); - - thread->_returnValue = (obj->sceneNumber == ITE_SCENE_INV) ? 1 : 0; + CommonObjectData *object; + if (_vm->_actor->validObjId(objectId)) { + object = _vm->_actor->getObj(objectId); + thread->_returnValue = (object->sceneNumber == ITE_SCENE_INV) ? 1 : 0; + } else { + thread->_returnValue = 0; + } + + } // Script function #4 (0x04) nonblocking -- cgit v1.2.3