Rewrite kolory.cpp

90% code rewrite, keep it C-like (no classes, no STL, etc), verbose
variable naming, remove typedef-s and preprocesor macros, fix a stack
corrupion bug, general cleanup.