aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorDenis Kasak2009-08-02 05:21:21 +0000
committerDenis Kasak2009-08-02 05:21:21 +0000
commitf9bdd096595ceb924ffec95ea6f8225513e85670 (patch)
tree826bb3468281fa46908a1418d3a232206e76ca63 /engines/draci
parent77033ca9a1a61e9de988849618ddd12ad28f7e7b (diff)
downloadscummvm-rg350-f9bdd096595ceb924ffec95ea6f8225513e85670.tar.gz
scummvm-rg350-f9bdd096595ceb924ffec95ea6f8225513e85670.tar.bz2
scummvm-rg350-f9bdd096595ceb924ffec95ea6f8225513e85670.zip
* Fixed bug when reading in persons data. I was reading in coordinates as bytes and font colour as int16; it should be the other way around.
* Handled the kStatusTalk loop substatus properly inside Game::loop(). * Made Game::walkHero() set the person coordinates for the dragon after it warps him to a new location * Added Game::getPerson() method (used by Script::talk()) * Added Game::setSpeechTick() method (set by Script::talk() and used inside the loop to determine when to switch to new text). svn-id: r42994
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/game.cpp32
-rw-r--r--engines/draci/game.h11
2 files changed, 40 insertions, 3 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index a0e0acbe85..58eb10a0ce 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -52,9 +52,9 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
_persons = new Person[numPersons];
for (i = 0; i < numPersons; ++i) {
- _persons[i]._x = personData.readByte();
- _persons[i]._y = personData.readByte();
- _persons[i]._fontColour = personData.readUint16LE();
+ _persons[i]._x = personData.readUint16LE();
+ _persons[i]._y = personData.readUint16LE();
+ _persons[i]._fontColour = personData.readByte();
}
// Close persons file
@@ -277,6 +277,21 @@ void Game::loop() {
debugC(2, kDraciAnimationDebugLevel, "Anim under cursor: %d", animUnderCursor);
}
+ if (_loopSubstatus == kStatusTalk) {
+ Animation *speechAnim = _vm->_anims->getAnimation(kSpeechText);
+ Text *speechFrame = reinterpret_cast<Text *>(speechAnim->getFrame());
+
+ uint speechDuration = kBaseSpeechDuration +
+ speechFrame->getLength() * kSpeechTimeUnit /
+ (128 / 16 + 1);
+
+ if ((_vm->_system->getMillis() - _speechTick) >= speechDuration) {
+ _shouldExitLoop = true;
+ } else {
+ _shouldExitLoop = false;
+ }
+ }
+
if (shouldQuit())
return;
@@ -324,6 +339,9 @@ void Game::walkHero(int x, int y) {
// Fetch base height of the frame
uint height = frame->getHeight();
+ _persons[kDragonObject]._x = x;
+ _persons[kDragonObject]._y = y - lround(scaleY) * height;
+
// We naturally want the dragon to position its feet to the location of the
// click but sprites are drawn from their top-left corner so we subtract
// the current height of the dragon's sprite
@@ -727,6 +745,14 @@ int Game::getIconStatus(int iconID) {
return _iconStatus[iconID];
}
+Person *Game::getPerson(int personID) {
+ return &_persons[personID];
+}
+
+void Game::setSpeechTick(uint tick) {
+ _speechTick = tick;
+}
+
/**
* The GPL command Mark sets the animation index (which specifies the order in which
* animations were loaded in) which is then used by the Release command to delete
diff --git a/engines/draci/game.h b/engines/draci/game.h
index a38b71a256..33b6e76894 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -47,6 +47,11 @@ enum {
kNotFound = -1
};
+enum SpeechConstants {
+ kBaseSpeechDuration = 200,
+ kSpeechTimeUnit = 400
+};
+
class WalkingMap {
public:
@@ -204,6 +209,8 @@ public:
int getVariable(int varNum);
void setVariable(int varNum, int value);
+ Person *getPerson(int personID);
+
int getRoomNum();
void setRoomNum(int room);
@@ -228,6 +235,8 @@ public:
void runGateProgram(int gate);
+ void setSpeechTick(uint tick);
+
bool _roomChange;
private:
@@ -252,6 +261,8 @@ private:
bool _shouldQuit;
bool _shouldExitLoop;
+ uint _speechTick;
+
int _objUnderCursor;
int _markedAnimationIndex; //!< Used by the Mark GPL command
};