fix codegnerator overflow

this fixes the codegenerator overflow bug. the index counter wasn't
reset after loading the next scene thus growing bigger than the
number2numeral array resulting in values that can not be encoded.