(bind-func psystem-set-particle
  (lambda (psys:psystem* idx:i32 x y s xx yy r g b a state)
    (let ((size (tref psys 0))
          (free-particle idx))
      (if (or (< idx 0)
              (> idx size))
          void
          (let ((particle (pref-ptr (tref psys 2) idx)))
            (tfill! particle x y r b g a s xx yy state)
            void)))))