[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.87,1.88 kyra.h,1.45,1.46 screen.cpp,1.30,1.31
Johannes Schickel
lordhoto at users.sourceforge.net
Tue Dec 13 07:11:11 CET 2005
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3675
Modified Files:
kyra.cpp kyra.h screen.cpp
Log Message:
Improved user controlled input handling.
Disabled use of _mouseLockCount in screen.cpp for now.
(that should fix a bug with not displayed cursor after using the debugger)
Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- kyra.cpp 13 Dec 2005 13:27:58 -0000 1.87
+++ kyra.cpp 13 Dec 2005 15:10:19 -0000 1.88
@@ -325,6 +325,8 @@
memset(_flagsTable, 0, sizeof(_flagsTable));
_fastMode = false;
+ _abortWalkFlag = false;
+ _abortWalkFlag2 = false;
_talkCoords.y = 0x88;
_talkCoords.x = 0;
_talkCoords.w = 0;
@@ -548,6 +550,11 @@
quitGame();
break;
case OSystem::EVENT_LBUTTONDOWN:
+ if (_abortWalkFlag2) {
+ _abortWalkFlag = true;
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ }
if (_handleInput) {
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
@@ -1163,6 +1170,7 @@
debug(9, "enterNewScene(%d, %d, %d, %d, %d)", sceneId, facing, unk1, unk2, brandonAlive);
int unkVar1 = 1;
_screen->hideMouse();
+ _abortWalkFlag2 = false;
if (_currentCharacter->sceneId == 7 && sceneId == 24) {
_newMusicTheme = 2;
} else if (_currentCharacter->sceneId == 25 && sceneId == 109) {
@@ -1321,7 +1329,8 @@
_screen->showMouse();
if (!brandonAlive) {
// XXX seq_poisionDeathNow
- }
+ }
+ updateMousePointer(true);
}
void KyraEngine::transcendScenes(int roomIndex, int roomName) {
@@ -4275,8 +4284,16 @@
bool running = true;
int returnValue = 0;
uint32 nextFrame = 0;
+ _abortWalkFlag = false;
while (running) {
- // XXX
+ if (_abortWalkFlag) {
+ *table = 8;
+ _currentCharacter->currentAnimFrame = 7;
+ animRefreshNPC(0);
+ updateAllObjectShapes();
+ processInput(_mouseX, _mouseY);
+ return 0;
+ }
bool forceContinue = false;
switch (*table) {
case 0: case 1: case 2:
@@ -4708,6 +4725,8 @@
void KyraEngine::processInput(int xpos, int ypos) {
debug(9, "processInput(%d, %d)", xpos, ypos);
+ _abortWalkFlag2 = false;
+
if (processInputHelper(xpos, ypos)) {
return;
}
@@ -4731,7 +4750,9 @@
}
if (exit != 0xFFFF) {
+ _abortWalkFlag2 = true;
handleSceneChange(xpos, ypos, 1, 1);
+ _abortWalkFlag2 = false;
return;
} else {
int script = checkForNPCScriptRun(xpos, ypos);
@@ -4742,14 +4763,18 @@
if (_itemInHand != -1) {
if (ypos < 155) {
if (hasClickedOnExit(xpos, ypos)) {
+ _abortWalkFlag2 = true;
handleSceneChange(xpos, ypos, 1, 1);
+ _abortWalkFlag2 = false;
return;
}
dropItem(0, _itemInHand, xpos, ypos, 1);
}
} else {
if (ypos <= 155) {
+ _abortWalkFlag2 = true;
handleSceneChange(xpos, ypos, 1, 1);
+ _abortWalkFlag2 = false;
}
}
}
@@ -4797,7 +4822,7 @@
return _scriptClick->variables[3];
}
-void KyraEngine::updateMousePointer() {
+void KyraEngine::updateMousePointer(bool forceUpdate) {
int shape = 0;
int newMouseState = 0;
@@ -4886,7 +4911,7 @@
newY = 4;
}
- if (newMouseState && _mouseState != newMouseState) {
+ if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) {
_mouseState = newMouseState;
_screen->hideMouse();
_screen->setMouseCursor(newX, newY, _shapes[4+shape]);
@@ -4894,8 +4919,8 @@
}
if (!newMouseState) {
- if (_mouseState != _itemInHand) {
- if (_mouseY > 158 || (_mouseX >= 12 && _mouseX < 308 && _mouseY < 136 && _mouseY >= 12)) {
+ if (_mouseState != _itemInHand || forceUpdate) {
+ if (_mouseY > 158 || (_mouseX >= 12 && _mouseX < 308 && _mouseY < 136 && _mouseY >= 12) || forceUpdate) {
_mouseState = _itemInHand;
_screen->hideMouse();
if (_itemInHand == -1) {
Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- kyra.h 10 Dec 2005 19:02:55 -0000 1.45
+++ kyra.h 13 Dec 2005 15:10:19 -0000 1.46
@@ -476,7 +476,7 @@
int processInputHelper(int xpos, int ypos);
int clickEventHandler(int xpos, int ypos);
void clickEventHandler2();
- void updateMousePointer();
+ void updateMousePointer(bool forceUpdate = false);
bool hasClickedOnExit(int xpos, int ypos);
int checkForNPCScriptRun(int xpos, int ypos);
void runNpcScript(int func);
@@ -560,6 +560,8 @@
bool _quitFlag;
bool _skipIntroFlag;
bool _abortIntroFlag;
+ bool _abortWalkFlag;
+ bool _abortWalkFlag2;
char _talkBuffer[300];
char _talkSubstrings[TALK_SUBSTRING_LEN * TALK_SUBSTRING_NUM];
TalkCoords _talkCoords;
Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- screen.cpp 9 Dec 2005 17:36:57 -0000 1.30
+++ screen.cpp 13 Dec 2005 15:10:20 -0000 1.31
@@ -1584,15 +1584,15 @@
void Screen::hideMouse() {
debug(9, "hideMouse()");
- ++_mouseLockCount;
+ //++_mouseLockCount;
_system->showMouse(false);
}
void Screen::showMouse() {
debug(9, "showMouse()");
- if (--_mouseLockCount == 0) {
+ //if (--_mouseLockCount == 0) {
_system->showMouse(true);
- }
+ //}
}
void Screen::setShapePages(int page1, int page2) {
More information about the Scummvm-git-logs
mailing list