[Scummvm-git-logs] scummvm master -> 879cd2c43c280c57db8eae330c8472a07a16eedc
sev-
sev at scummvm.org
Mon Mar 13 20:19:18 CET 2017
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b4a4ab6673 DIRECTOR: Initial work on sprite dragging
879cd2c43c DIRECTOR: Refactor events processor
Commit: b4a4ab667303beb01f6123182b21bcb803ff7154
https://github.com/scummvm/scummvm/commit/b4a4ab667303beb01f6123182b21bcb803ff7154
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-03-13T19:58:15+01:00
Commit Message:
DIRECTOR: Initial work on sprite dragging
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/events.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1077b75..70d5cf3 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -92,7 +92,10 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_keyCode = 0;
_machineType = 9; // Macintosh IIci
_playbackPaused = false;
- g_director->_skipFrameAdvance = false;
+ _skipFrameAdvance = false;
+
+ _draggingSprite = false;
+ _draggingSpriteId = 0;
}
DirectorEngine::~DirectorEngine() {
diff --git a/engines/director/director.h b/engines/director/director.h
index 61c5f4e..3c3e2e9 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -164,6 +164,10 @@ private:
Common::String _sharedCastFile;
Common::HashMap<int, CastType> _dummyCastType;
+ bool _draggingSprite;
+ uint16 _draggingSpriteId;
+ Common::Point _draggingSpritePos;
+
private:
void testFontScaling();
void testFonts();
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 116db9c..88716e4 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -123,6 +123,10 @@ void DirectorEngine::processEvents() {
}
void DirectorEngine::setDraggedSprite(uint16 id) {
+ _draggingSprite = true;
+ _draggingSpriteId = id;
+ _draggingSpritePos = g_system->getEventManager()->getMousePos();
+
warning("STUB: DirectorEngine::setDraggedSprite(%d)", id);
}
Commit: 879cd2c43c280c57db8eae330c8472a07a16eedc
https://github.com/scummvm/scummvm/commit/879cd2c43c280c57db8eae330c8472a07a16eedc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-03-13T20:04:55+01:00
Commit Message:
DIRECTOR: Refactor events processor
Changed paths:
engines/director/events.cpp
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 88716e4..9030fee 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -46,53 +46,57 @@ void DirectorEngine::processEvents() {
uint endTime = g_system->getMillis() + 200;
Score *sc = getCurrentScore();
- int currentFrame = sc->getCurrentFrame();
+ Frame *currentFrame = sc->_frames[sc->getCurrentFrame()];
uint16 spriteId = 0;
// TODO: re-instate when we know which script to run.
//if (currentFrame > 0)
// _lingo->processEvent(kEventIdle, currentFrame - 1);
+ Common::Point pos;
+
while (g_system->getMillis() < endTime) {
while (g_system->getEventManager()->pollEvent(event)) {
- if (event.type == Common::EVENT_QUIT)
+ switch (event.type) {
+ case Common::EVENT_QUIT:
sc->_stopPlay = true;
+ break;
- if (event.type == Common::EVENT_LBUTTONDOWN) {
- Common::Point pos = g_system->getEventManager()->getMousePos();
+ case Common::EVENT_LBUTTONDOWN:
+ pos = g_system->getEventManager()->getMousePos();
// D3 doesn't have both mouse up and down.
// But we still want to know if the mouse is down for press effects.
- spriteId = sc->_frames[currentFrame]->getSpriteIDFromPos(pos);
+ spriteId = currentFrame->getSpriteIDFromPos(pos);
sc->_currentMouseDownSpriteId = spriteId;
if (getVersion() > 3) {
// TODO: check that this is the order of script execution!
- _lingo->processEvent(kEventMouseDown, kCastScript, sc->_frames[currentFrame]->_sprites[spriteId]->_castId);
- _lingo->processEvent(kEventMouseDown, kSpriteScript, sc->_frames[currentFrame]->_sprites[spriteId]->_scriptId);
+ _lingo->processEvent(kEventMouseDown, kCastScript, currentFrame->_sprites[spriteId]->_castId);
+ _lingo->processEvent(kEventMouseDown, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId);
}
- }
+ break;
- if (event.type == Common::EVENT_LBUTTONUP) {
- Common::Point pos = g_system->getEventManager()->getMousePos();
+ case Common::EVENT_LBUTTONUP:
+ pos = g_system->getEventManager()->getMousePos();
- spriteId = sc->_frames[currentFrame]->getSpriteIDFromPos(pos);
+ spriteId = currentFrame->getSpriteIDFromPos(pos);
if (getVersion() > 3) {
// TODO: check that this is the order of script execution!
- _lingo->processEvent(kEventMouseUp, kCastScript, sc->_frames[currentFrame]->_sprites[spriteId]->_castId);
- _lingo->processEvent(kEventMouseUp, kSpriteScript, sc->_frames[currentFrame]->_sprites[spriteId]->_scriptId);
+ _lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId);
+ _lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId);
} else {
// Frame script overrides sprite script
- if (!sc->_frames[currentFrame]->_sprites[spriteId]->_scriptId)
- _lingo->processEvent(kEventMouseUp, kSpriteScript, sc->_frames[currentFrame]->_sprites[spriteId]->_castId + 1024);
+ if (!currentFrame->_sprites[spriteId]->_scriptId)
+ _lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + 1024);
else
- _lingo->processEvent(kEventMouseUp, kFrameScript, sc->_frames[currentFrame]->_sprites[spriteId]->_scriptId);
+ _lingo->processEvent(kEventMouseUp, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId);
}
sc->_currentMouseDownSpriteId = 0;
- }
+ break;
- if (event.type == Common::EVENT_KEYDOWN) {
+ case Common::EVENT_KEYDOWN:
_keyCode = event.kbd.keycode;
_key = (unsigned char)(event.kbd.ascii & 0xff);
@@ -114,6 +118,10 @@ void DirectorEngine::processEvents() {
}
_lingo->processEvent(kEventKeyDown, kGlobalScript, 0);
+ break;
+
+ default:
+ break;
}
}
More information about the Scummvm-git-logs
mailing list