hi Denis,<br><br><div class="gmail_quote">On Sat, Aug 8, 2009 at 5:31 AM, <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;">
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp<br>
===================================================================<br>
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-08 12:25:29 UTC (rev 43124)<br>
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-08-08 12:31:49 UTC (rev 43125)<br>@@ -283,6 +284,15 @@<br>
<br>
_vm->_mouse->cursorOff();<br>
_vm->_mouse->lButtonSet(false);<br>
+<br>
+ if (!obj->_imLook) {<br>
+ if (obj->_lookDir == 0) {<br>
+ walkHero(x, y);<br>
+ } else {<br>
+ walkHero(obj->_lookX, obj->_lookY);<br>
</blockquote><div><br></div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">@@ -852,6 +877,103 @@<br>
return mapByte & (1 << pixelIndex % 8);<br>
}<br>
<br>
+/**<br>
+ * @brief For a given point, find a nearest walkable point on the walking map<br>
+ *<br>
+ * @param startX x coordinate of the point<br>
+ * @param startY y coordinate of the point<br>
+ *<br>
+ * @return A Common::Point representing the nearest walkable point<br>
+ *<br>
+ * The algorithm was copied from the original engine for exactness.<br>
+ * TODO: Study this algorithm in more detail so it can be documented properly and<br>
+ * possibly improved / simplified.<br>
+ */<br>
+Common::Point WalkingMap::findNearestWalkable(int startX, int startY, Common::Rect searchRect) {<br>
</blockquote><div><br></div><div>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?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">+ // The algorithm appears to start off with an ellipse with the minor radius equal to<br>
+ // zero and the major radius equal to the walking map delta (the number of pixels<br>
+ // one map pixel represents). It then uses a heuristic to gradually reshape it into<br>
+ // a circle (by shortening the major radius and lengthening the minor one). At each<br>
+ // such resizing step, it checks some select points on the ellipse for walkability.<br>
+ // It also does the same check for the ellipse perpendicular to it (rotated by 90 degrees).<br>
</blockquote><div><br></div><div>wow, I didn't know we do such a magic. but intuitively it seems to work well and so does your implementation. good!</div></div><br>-- <br>Robert Špalek <<a href="mailto:rspalek@gmail.com">rspalek@gmail.com</a>><br>