OK, kind of a late reply, but Edge really has the general idea. I don't really understand why you think bg_pmove.c is sloppy :-? - in any case you should concentrate your study on the functions PM_GroundClimbTrace in bg_pmove.c and CG_smoothWWTransitions in cg_view.c
These are the main areas, but they are a tonne of places where assumptions that "up" was always {0,0,1} needed to be removed. I should also point out that the OSML applies. If you need any more help, gimme a shout.