cgame: rewrite some autodemo code