Parent/child offset is double-counted at draw time #37
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Found while writing the manual" -> "Defects with no prior entry", item 2 (at
bbb7b8f)src/physics.c:192-197writes a child'sxasparent->x + vx-- an absoluteworld coordinate.
src/actor.c:273-279then draws it atparent->x + obj->x,while
actor_visiblethree lines above tests the camera against the rawobj->xas absolute.
Two readings of one field inside one function.
Confirmed by measurement: with the player at (280,146) and a (-14,+10) offset, the
guarded draw lands at (130,114) and the unguarded one at (410,260) -- off a
320x240 screen. Rendering both and hashing
SDL_RenderReadPixelsgives differentimages.
Invisible only while the parent sits at the origin.
actor.hdocuments both readings, in two places, so the header cannot be usedto decide which one is intended.
examples/jrpgworks around it with arenderfuncthat nullsobj->parentfor the duration of the draw.Files:
src/physics.c:192-197,src/actor.c:273-279,include/akgl/actor.hFiled by Tachikoma (Claude Code, Opus 5, 1M context)