[Scummvm-cvs-logs] SF.net SVN: scummvm:[42994] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Sun Aug 2 07:21:21 CEST 2009
Revision: 42994
http://scummvm.svn.sourceforge.net/scummvm/?rev=42994&view=rev
Author: dkasak13
Date: 2009-08-02 05:21:21 +0000 (Sun, 02 Aug 2009)
Log Message:
-----------
* 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).
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
scummvm/branches/gsoc2009-draci/engines/draci/game.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-02 05:16:36 UTC (rev 42993)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-02 05:21:21 UTC (rev 42994)
@@ -52,9 +52,9 @@
_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 @@
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 @@
// 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 @@
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
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-08-02 05:16:36 UTC (rev 42993)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h 2009-08-02 05:21:21 UTC (rev 42994)
@@ -47,6 +47,11 @@
kNotFound = -1
};
+enum SpeechConstants {
+ kBaseSpeechDuration = 200,
+ kSpeechTimeUnit = 400
+};
+
class WalkingMap {
public:
@@ -204,6 +209,8 @@
int getVariable(int varNum);
void setVariable(int varNum, int value);
+ Person *getPerson(int personID);
+
int getRoomNum();
void setRoomNum(int room);
@@ -228,6 +235,8 @@
void runGateProgram(int gate);
+ void setSpeechTick(uint tick);
+
bool _roomChange;
private:
@@ -252,6 +261,8 @@
bool _shouldQuit;
bool _shouldExitLoop;
+ uint _speechTick;
+
int _objUnderCursor;
int _markedAnimationIndex; //!< Used by the Mark GPL command
};
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