(bind-func psystem-set-particle
(lambda (psys:psystem* idx:i64 x y s xx yy r g b a dur)
(let ((size (psystem_size psys))
(free-particle idx))
(if (or (= free-particle -1)
(> free-particle size))
void ;; don't do anything if no free particles
(let ((states (tref psys 1))
(xs (tref psys 2))
(ys (tref psys 3))
(xvs (tref psys 4))
(yvs (tref psys 5))
(sizes (tref psys 6))
(reds (tref psys 7))
(greens (tref psys 8))
(blues (tref psys 9))
(alphas (tref psys 10)))
(pset! states free-particle dur)
(pset! xs free-particle x)
(pset! ys free-particle y)
(pset! xvs free-particle xx)
(pset! yvs free-particle yy)
(pset! sizes free-particle s)
(pset! reds free-particle r)
(pset! greens free-particle g)
(pset! blues free-particle b)
(pset! alphas free-particle a)
void)))))