(Glide64) Create gSPNumLights and refactor identical code