[Scummvm-devel] [Scummvm-cvs-logs] SF.net SVN: scummvm:[42957] scummvm/branches/gsoc2009-draci/engines/draci

Robert Špalek rspalek at gmail.com
Sat Aug 1 21:27:49 CEST 2009


On Thu, Jul 30, 2009 at 9:32 PM, <dkasak13 at users.sourceforge.net> wrote:

> Revision: 42957
>          http://scummvm.svn.sourceforge.net/scummvm/?rev=42957&view=rev
> Author:   dkasak13
> Date:     2009-07-31 04:32:33 +0000 (Fri, 31 Jul 2009)
>
> Log Message:
> -----------
> * Added Game::runGateProgram()
> * 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.
> * 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.
> * Fixed bug where the gates array of a room was not cleared between uses.
> * Save old jump value when we enter Script::run() and restore it in the end
> (mimicking the original engine).
> * Fixed small bug where the gate was supposed to be stored as the first
> in-game variable and not the room number.
>
> Modified Paths:
> --------------
>    scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
>    scummvm/branches/gsoc2009-draci/engines/draci/game.h
>    scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
>    scummvm/branches/gsoc2009-draci/engines/draci/script.h
>
> Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-31
> 00:27:38 UTC (rev 42956)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-31
> 04:32:33 UTC (rev 42957)
> @@ -153,13 +153,31 @@
>
>  void Game::start() {
>        while (!shouldQuit()) {
> -               Game::loop();
> +
> +               if (_newRoom != _currentRoom._roomNum) {
> +
> +                       changeRoom(_newRoom);
> +
> +                       _currentRoom._roomNum = _newRoom;


isn't this already set by changeRoom()?

@@ -605,12 +632,39 @@
>        loadOverlays();
>  }
>
> +void Game::runGateProgram(int gate) {
> +
> +       // Mark last animation
> +       int lastAnimIndex = _vm->_anims->getLastIndex();
> +
> +       // Run gate program
> +       _vm->_script->run(_currentRoom._program,
> _currentRoom._gates[gate]);
> +
> +       // Delete all animations loaded after the marked one
> +       // (from objects and from the AnimationManager)
> +       for (uint i = 0; i < getNumObjects(); ++i) {
> +               GameObject *obj = &_objects[i];
> +
> +               for (uint j = 0; j < obj->_anims.size(); ++j) {
> +                       Animation *anim;
> +
> +                       anim = _vm->_anims->getAnimation(obj->_anims[j]);
> +                       if (anim != NULL && anim->getIndex() >
> lastAnimIndex)
> +                               obj->_anims.remove_at(j);
> +               }
> +       }


is this block of code used at other places than this one?  maybe you should
put it into a method.

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp    2009-07-31
> 00:27:38 UTC (rev 42956)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp    2009-07-31
> 04:32:33 UTC (rev 42957)
> @@ -679,6 +696,8 @@
>
>  int Script::run(GPL2Program program, uint16 offset) {
>
> +       int oldJump = _jump;
>

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.

-- 
Robert Špalek <rspalek at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20090801/6253636a/attachment.html>


More information about the Scummvm-devel mailing list