So I came up with a change to sort of fix the shadow on the stairs. I'm attaching it instead of pushing it because it is a pretty big hack. One problem with it, I assume because of some Z sorting, the shadow shows on top of the character. Another problem, I'm not sure that this is the correct place for it. I assumed that shadow::cast_on would get called for each stair in the staircase, but it doesn't. The good news is, if this is the correct place for it, then I think making the shadow work on the original stairs shouldn't be too hard.
Other more caveat on the code: I assume there is a function that returns the intersection of two squares, but I couldn't find it. So I wrote only half of one, It only checks in the x direction, but for our current stairway, that's ok. Although you can notice it if you just to the right of the stairway and all the way up to the wall. Tyler
diff --git a/src/world/renderer.cc b/src/world/renderer.cc index 13a6963..39b7519 100644 --- a/src/world/renderer.cc +++ b/src/world/renderer.cc @@ -50,8 +50,22 @@ void renderer_base::draw (const s_int16 & x, const s_int16 & y, const render_inf // draw all pieces of the shadow for (std::list<gfx::drawing_area>::const_iterator area = shdw->Area.begin(); area != shdw->Area.end(); area++) { + // Make sure the area falls withing the object + s_int16 area_x = area->x(); + u_int16 area_length = area->length(); + if(area_x + area_length < obj.x() + obj.Shape->x()) + continue; + if(area_x < obj.x() + obj.Shape->x()) { + area_length -= obj.x() + obj.Shape->x() - area_x; + area_x = obj.x() + obj.Shape->x(); + } + if(area_x > obj.x() + obj.Shape->x() + obj.Shape->length()) + continue; + if(area_x + area_length > obj.x() + obj.Shape->x() + obj.Shape->length()) + area_length = obj.x() + obj.Shape->x() + obj.Shape->length() - area_x; + // relocate area to mapview position - gfx::drawing_area part (x + area->x(), y + area->y() - (obj.z() + obj.Shape->height()), area->length(), area->height()); + gfx::drawing_area part (x + area_x, y + area->y() - (obj.z() + obj.Shape->height()), area_length, area->height()); // clip with mapview ... just in case part.assign_drawing_area (&da); // render shadow
_______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel