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

Robert Špalek rspalek at gmail.com
Sat Aug 8 19:37:02 CEST 2009


hi Denis,

On Sat, Aug 8, 2009 at 5:31 AM, <dkasak13 at users.sourceforge.net> wrote:

> Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
> ===================================================================
> --- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-08-08
> 12:25:29 UTC (rev 43124)
> +++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp      2009-08-08
> 12:31:49 UTC (rev 43125)
> @@ -283,6 +284,15 @@
>
>
>  _vm->_mouse->cursorOff();
>
>  _vm->_mouse->lButtonSet(false);
> +
> +                                                       if (!obj->_imLook)
> {
> +                                                               if
> (obj->_lookDir == 0) {
> +
> walkHero(x, y);
> +                                                               } else {
> +
> walkHero(obj->_lookX, obj->_lookY);
>

once you implement the dragon's animations properly, you will probably also
want to ensure that the dragon is looking into the right direction at the
end.  you may need to pass an extra parameter to walkHero() denoting the
final direction to turn to.


> @@ -852,6 +877,103 @@
>        return mapByte & (1 << pixelIndex % 8);
>  }
>
> +/**
> + * @brief For a given point, find a nearest walkable point on the walking
> map
> + *
> + * @param startX       x coordinate of the point
> + * @param startY       y coordinate of the point
> + *
> + * @return A Common::Point representing the nearest walkable point
> + *
> + *     The algorithm was copied from the original engine for exactness.
> + *     TODO: Study this algorithm in more detail so it can be documented
> properly and
> + *     possibly improved / simplified.
> + */
> +Common::Point WalkingMap::findNearestWalkable(int startX, int startY,
> Common::Rect searchRect) {
>

you should maybe first check the walkability of [startX, startY].  it seems
to me that you first check a point by delta to the right, so the dragon
doesn't exactly end where I clicked.  also do you center the dragon on the
clicked point, or just place his left edge there?


> +       // The algorithm appears to start off with an ellipse with the
> minor radius equal to
> +       // zero and the major radius equal to the walking map delta (the
> number of pixels
> +       // one map pixel represents). It then uses a heuristic to gradually
> reshape it into
> +       // a circle (by shortening the major radius and lengthening the
> minor one). At each
> +       // such resizing step, it checks some select points on the ellipse
> for walkability.
> +       // It also does the same check for the ellipse perpendicular to it
> (rotated by 90 degrees).
>

wow, I didn't know we do such a magic.  but intuitively it seems to work
well and so does your implementation.  good!

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


More information about the Scummvm-devel mailing list