[Scummvm-cvs-logs] SF.net SVN: scummvm:[43081] scummvm/branches/gsoc2009-draci/engines/draci/ game.cpp
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Thu Aug 6 05:52:08 CEST 2009
Revision: 43081
http://scummvm.svn.sourceforge.net/scummvm/?rev=43081&view=rev
Author: dkasak13
Date: 2009-08-06 03:52:08 +0000 (Thu, 06 Aug 2009)
Log Message:
-----------
Made the game behave properly and safe when clicking on objects multiple times during talking or executing look/use scripts. Previously, the loop could be called nested arbitrarily many times.
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-06 02:13:15 UTC (rev 43080)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-06 03:52:08 UTC (rev 43081)
@@ -262,37 +262,41 @@
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
Text *title = reinterpret_cast<Text *>(titleAnim->getFrame());
- // If there is an object under the cursor, display its title and enable
- // executing its look and use scripts
- if (curObject != kObjectNotFound) {
- // Mark dirty rectangle to update the text
- titleAnim->markDirtyRect(surface);
+ if (_loopStatus == kStatusOrdinary) {
+ // If there is an object under the cursor, display its title and enable
+ // executing its look and use scripts
+ if (curObject != kObjectNotFound) {
+ // Mark dirty rectangle to update the text
+ titleAnim->markDirtyRect(surface);
- // Set the title for the current object
- title->setText(obj->_title);
+ // Set the title for the current object
+ title->setText(obj->_title);
- // Move the title to the correct place (just above the cursor)
- int newX = surface->centerOnX(x, title->getWidth());
- int newY = surface->centerOnY(y - smallFontHeight / 2, title->getHeight() * 2);
- titleAnim->setRelative(newX, newY);
+ // Move the title to the correct place (just above the cursor)
+ int newX = surface->centerOnX(x, title->getWidth());
+ int newY = surface->centerOnY(y - smallFontHeight / 2, title->getHeight() * 2);
+ titleAnim->setRelative(newX, newY);
- // HACK: Test running look and use scripts
- if (_vm->_mouse->lButtonPressed()) {
- _vm->_mouse->lButtonSet(false);
- _vm->_script->run(obj->_program, obj->_look);
+ if (_loopSubstatus == kStatusOrdinary) {
+ // HACK: Test running look and use scripts
+ if (_vm->_mouse->lButtonPressed()) {
+ _vm->_mouse->lButtonSet(false);
+ _vm->_script->run(obj->_program, obj->_look);
+ }
+
+ if (_vm->_mouse->rButtonPressed()) {
+ _vm->_mouse->rButtonSet(false);
+ _vm->_script->run(obj->_program, obj->_use);
+ }
+ }
+ } else {
+ // If there is no object under the cursor, just delete the previous title
+ titleAnim->markDirtyRect(surface);
+ title->setText("");
}
- if (_vm->_mouse->rButtonPressed()) {
- _vm->_mouse->rButtonSet(false);
- _vm->_script->run(obj->_program, obj->_use);
- }
- } else {
- // If there is no object under the cursor, just delete the previous title
- titleAnim->markDirtyRect(surface);
- title->setText("");
+ debugC(2, kDraciAnimationDebugLevel, "Anim under cursor: %d", animUnderCursor);
}
-
- debugC(2, kDraciAnimationDebugLevel, "Anim under cursor: %d", animUnderCursor);
}
// Handle character talking (if there is any)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list