k005289.c: refactored, removed redundant state variables and unneccessary floating point math, added savestate support [Alex Jackson]