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

Robert Špalek rspalek at gmail.com
Sun Jul 26 07:18:18 CEST 2009


hi Denis,

I see that this commit of yours draws several comments of mine obsolete.
sorry that I replied to your commits as I read them instead of reading them
all and filtered unnecessary comments.  I have also already read your reply
to my e-mail.


On Wed, Jul 22, 2009 at 6:42 AM, <dkasak13 at users.sourceforge.net> wrote:

> Revision: 42647
>          http://scummvm.svn.sourceforge.net/scummvm/?rev=42647&view=rev
> Author:   dkasak13
> Date:     2009-07-22 04:42:33 +0000 (Wed, 22 Jul 2009)
>
> Log Message:
> -----------
> * Moved scaling support from Animation to Sprite
> * Now each Sprite (and hence frame in an animation) can have a separate
> zoom (which is needed for some animations in the game)
>

sounds good.  is it needed by the dragon's walking animations when he
gradually comes closer?  that makes sense.


> * Scale factors are not stored any more; instead, we only store scaled
> dimensions (since these are stored in the data files) and calculate the
> factors from those.
>

sounds good, and I would suggest on top of that to get rid of scaling
factors whatsoever and working only with the scaled dimensions.  that way
you will only need integers instead of floats.  we don't use floats except
for computing the perspective scaling, which is OK, because these
computations need not be precise.  however, sprite scaling must be precise,
so integers are generally better.


> Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-22
> 00:12:48 UTC (rev 42646)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-07-22
> 04:42:33 UTC (rev 42647)
> @@ -176,27 +176,33 @@
> +                       // Set the scaled dimensions for all frames
> +                       for (uint i = 0; i < anim->getFramesNum(); ++i) {
> +                               frame = anim->getFrame(i);
> +
> +                               // Calculate scaled dimensions
> +                               uint scaledWidth = scaleX *
> frame->getWidth();
> +                               uint scaledHeight = scaleY *
> frame->getHeight();
> +
> +                               frame->setScaled(scaledWidth,
> scaledHeight);
> +                       }


ok, as you said, this may be useful in the future if one uses zooming in the
game player.


> Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp    2009-07-22
> 00:12:48 UTC (rev 42646)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp    2009-07-22
> 04:42:33 UTC (rev 42647)
> @@ -152,6 +161,10 @@
>        int *rowIndices = new int[rows];
>        int *columnIndices = new int[columns];
>
> +       // Calculate scaling factors
> +       double scaleX = double(_scaledWidth) / _width;
> +       double scaleY = double(_scaledHeight) / _height;
> +
>        // Precalculate pixel indexes
>        for (int i = 0; i < rows; ++i) {
>                rowIndices[i] = lround(i / scaleY);
>

even if you keep the rest of the code as is, in the future, it would be nice
to reimplement it without using floats.  you only use it for linear scaling
and that can be done as well using integers only.  I can show you how if you
want.


> Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/sprite.h      2009-07-22
> 00:12:48 UTC (rev 42646)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.h      2009-07-22
> 04:42:33 UTC (rev 42647)
> @@ -38,17 +38,21 @@
>
>  public:
>        virtual void draw(Surface *surface, bool markDirty = true) const =
> 0;
> -       virtual void drawScaled(Surface *surface, double scaleX, double
> scaleY,
> -               bool markDirty = true) const = 0;
> +       virtual void drawScaled(Surface *surface, bool markDirty = true)
> const = 0;
>

please comment on which method does what

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


More information about the Scummvm-devel mailing list