hi Denis,<div><br></div><div>good job! I still have a few questions and suggestions though.<br><br><div class="gmail_quote">On Wed, Jul 29, 2009 at 12:41 PM, <span dir="ltr"><<a href="mailto:dkasak13@users.sourceforge.net">dkasak13@users.sourceforge.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Revision: 42902<br>
<a href="http://scummvm.svn.sourceforge.net/scummvm/?rev=42902&view=rev" target="_blank">http://scummvm.svn.sourceforge.net/scummvm/?rev=42902&view=rev</a><br>
Author: dkasak13<br>
Date: 2009-07-29 19:41:30 +0000 (Wed, 29 Jul 2009)<br>
<br>
Log Message:<br>
-----------<br>
* Implemented the StartPlay and Play GPL commands properly<br>
* Changed Script::load() to use the new animation callbacks<br>
<br>
Modified Paths:<br>
--------------<br>
scummvm/branches/gsoc2009-draci/engines/draci/script.cpp<br>
scummvm/branches/gsoc2009-draci/engines/draci/script.h<br>
<br>
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp<br>
===================================================================<br>
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-29 19:39:10 UTC (rev 42901)<br>
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-07-29 19:41:30 UTC (rev 42902)<br>@@ -289,7 +289,15 @@<br>
/* GPL commands */<br>
<br>
void Script::play(Common::Queue<int> ¶ms) {<br>
+ if (_vm->_game->getLoopStatus() == kStatusInventory) {<br>
+ return;<br>
+ }<br>
+<br>
+ _vm->_game->setLoopStatus(kStatusStrange);<br>
+ _vm->_game->setExitLoop(true);<br>
_vm->_game->loop();<br>
+ _vm->_game->setExitLoop(false);<br>
+ _vm->_game->setLoopStatus(kStatusOrdinary);</blockquote><div><br></div><div>- when you finish the code, rename Strange into Inner or something like that</div><div>- not sure if the original LoopStatus could be different than Ordinary. I know that you check for Inventory and exit, but maybe there is yet another one. if this can happen, it would be safer to remember the original status and restore it rather than forcing Ordinary </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
+ // Stop all animation that the object owns<br>
+<br>
+ for (uint i = 0; i < obj->_anims.size(); ++i) {<br>
+ _vm->_anims->stop(obj->_anims[i]);<br>
+ }</blockquote><div><br></div><div>can it happen that there is more than 1 currently playing? the player would handle that, but it seems to be weird to me.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
@@ -345,6 +362,41 @@<br>
}<br>
}<br>
<br>
+void Script::startPlay(Common::Queue<int> ¶ms) {<br>
+ if (_vm->_game->getLoopStatus() == kStatusInventory) {<br>
+ return;<br>
+ }<br>
+<br>
+ int objID = params.pop() - 1;<br>
+ int animID = params.pop() - 1;<br>
+<br>
+ GameObject *obj = _vm->_game->getObject(objID);<br>
+<br>
+ // Stop all animation that the object owns<br>
+<br>
+ for (uint i = 0; i < obj->_anims.size(); ++i) {<br>
+ _vm->_anims->stop(obj->_anims[i]);<br>
+ }</blockquote><div><br></div><div>ditto</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">+ Animation *anim = _vm->_anims->getAnimation(animID);<br>
+ anim->registerCallback(&Animation::exitGameLoop);<br>
+<br>
+ _vm->_game->setLoopStatus(kStatusStrange);<br>
+ _vm->_anims->play(animID);<br>
+ _vm->_game->loop();<br>
+ _vm->_game->setExitLoop(false);<br>
+ _vm->_anims->stop(animID);<br>
+ _vm->_game->setLoopStatus(kStatusOrdinary);</blockquote><div><br></div><div>restoring original status instead of forcing Ordinary, like above</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ anim->registerCallback(&Animation::doNothing);</blockquote><div><br></div><div>restore the original callback if it could ever be different than Nothing</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ bool visible = (objID == kDragonObject || obj->_visible);<br>
+<br>
+ if (visible && (obj->_location == _vm->_game->getRoomNum())) {<br>
+ _vm->_anims->play(animID);<br>
+ }</blockquote><div><br></div><div>does the original player do this, too? it seems weird. you have just player animation animID and waited for it to finish. if you should play any animation on that object, it should probably be exactly the one playing before, but not the one just played. this is just my intuition and I know that the original player is a mess...</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">@@ -567,7 +619,12 @@<br>
/**<br>
* @brief Find the current command in the internal table<br>
*<br>
- * @param num Command number<br>
+ * @param G_LoopStatus=Inventory then Exit;<br>
+ G_LoopSubStatus:= Strange;<br>
+ G_QuitLoop:= True;<br>
+ Loop;<br>
+ G_QuitLoop:= False;<br>
+ G_LoopSubStatus:= Ordinary; num Command number<br>
* @param subnum Command subnumer<br>
*<br>
* @return NULL if command is not found. Otherwise, a pointer to a GPL2Command<br>
</blockquote><div><br></div><div>is it wise to copy & paste more or less a complete code into the comment? I'd rather say something like it runs an inner loop.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h<br>
===================================================================<br>
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-07-29 19:39:10 UTC (rev 42901)<br>
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-07-29 19:41:30 UTC (rev 42902)<br>
@@ -113,6 +113,7 @@<br>
void execUse(Common::Queue<int> ¶ms);<br>
void walkOn(Common::Queue<int> ¶ms);<br>
void play(Common::Queue<int> ¶ms);<br>
+ void startPlay(Common::Queue<int> ¶ms);<br>
</blockquote><div><br></div><div>also, one day, we should rename these methods. play/startPlay/start sound like really bad, nothing revealing, names. (I know they come from the original player.)</div><div><br></div></div>
-- <br>Robert Špalek <<a href="mailto:rspalek@gmail.com">rspalek@gmail.com</a>><br>
</div>