<div class="gmail_quote">On Thu, Jul 30, 2009 at 9:32 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: 42957<br>
          <a href="http://scummvm.svn.sourceforge.net/scummvm/?rev=42957&view=rev" target="_blank">http://scummvm.svn.sourceforge.net/scummvm/?rev=42957&view=rev</a><br>
Author:   dkasak13<br>
Date:     2009-07-31 04:32:33 +0000 (Fri, 31 Jul 2009)<br>
<br>
Log Message:<br>
-----------<br>
* Added Game::runGateProgram()<br>
* Added a separate mechanism to Game to keep track both of the current room number and the next room/gate. Periodically, I check whether the new room differs from the old one and, if it does, I do the change. Doing it any other would is nearly impossible because of the way the original scripts were written.<br>


* Added GPL command Script::newRoom(). Rooms can now be traversed by clicking on their exits. Also, the intro animation partly works. Some parts go by far too soon. I assume this is because the engine still lacks a dialogue GPL command.<br>


* Fixed bug where the gates array of a room was not cleared between uses.<br>
* Save old jump value when we enter Script::run() and restore it in the end (mimicking the original engine).<br>
* Fixed small bug where the gate was supposed to be stored as the first in-game variable and not the room number.<br>
<br>
Modified Paths:<br>
--------------<br>
    scummvm/branches/gsoc2009-draci/engines/draci/game.cpp<br>
    scummvm/branches/gsoc2009-draci/engines/draci/game.h<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/game.cpp<br>
===================================================================<br>
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-31 00:27:38 UTC (rev 42956)<br>
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-31 04:32:33 UTC (rev 42957)<br>
@@ -153,13 +153,31 @@<br>
<br>
 void Game::start() {<br>
        while (!shouldQuit()) {<br>
-               Game::loop();<br>
+<br>
+               if (_newRoom != _currentRoom._roomNum) {<br>
+<br>
+                       changeRoom(_newRoom);<br>
+<br>
+                       _currentRoom._roomNum = _newRoom;</blockquote><div><br></div><div>isn't this already set by changeRoom()? </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

@@ -605,12 +632,39 @@<br>
        loadOverlays();<br>
 }<br>
<br>
+void Game::runGateProgram(int gate) {<br>
+<br>
+       // Mark last animation<br>
+       int lastAnimIndex = _vm->_anims->getLastIndex();<br>
+<br>
+       // Run gate program<br>
+       _vm->_script->run(_currentRoom._program, _currentRoom._gates[gate]);<br>
+<br>
+       // Delete all animations loaded after the marked one<br>
+       // (from objects and from the AnimationManager)<br>
+       for (uint i = 0; i < getNumObjects(); ++i) {<br>
+               GameObject *obj = &_objects[i];<br>
+<br>
+               for (uint j = 0; j < obj->_anims.size(); ++j) {<br>
+                       Animation *anim;<br>
+<br>
+                       anim = _vm->_anims->getAnimation(obj->_anims[j]);<br>
+                       if (anim != NULL && anim->getIndex() > lastAnimIndex)<br>
+                               obj->_anims.remove_at(j);<br>
+               }<br>
+       }</blockquote><div><br></div><div>is this block of code used at other places than this one?  maybe you should put it into a method.</div><div><br></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.cpp<br>
===================================================================<br>
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp    2009-07-31 00:27:38 UTC (rev 42956)<br>
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp    2009-07-31 04:32:33 UTC (rev 42957)<br>@@ -679,6 +696,8 @@<br>
<br>
 int Script::run(GPL2Program program, uint16 offset) {<br>
<br>
+       int oldJump = _jump;<br></blockquote><div><br></div><div>when is this saving needed?  is is when one loop() runs inside another one?  then it would make perfect sense.  on one hand it would be nice to have _jump as a local variable so that it doesn't get messed up, but then it wouldn't be accessible from subroutines which wanna touch it.  but then, again, only goto and if change its value.  I don't know; you have probably adapted the old player's behavior, which may be best at the moment.</div>

<div><br></div></div>-- <br>Robert Špalek <<a href="mailto:rspalek@gmail.com">rspalek@gmail.com</a>><br>