Perhaps it was just MonoDevelop, but yeah, it was stopping me at the compilation phase...
Well, the wiki page still uses the 3 parameter version that I know! But looking again at your code, particularly this line, because I know what it's doing now; index = (int)lerp(line, 170, Vres, 7, 0);
I can work out; lerp(cur_pos, min_pos, max_pos, min_output, max_output)
So you're converting the line position to an index in the palette based on its position between the min_pos and max_pos... I like it! I can see how the palette output is inverted for the bottom half of the screen. Thinking back I always used to do this in a 2 step process - get the position between two points as a percentage, then use that percentage to work out the position between two other points. Now I can use this handy dandy function to do it in one line of code.
Well, the wiki page still uses the 3 parameter version that I know! But looking again at your code, particularly this line, because I know what it's doing now; index = (int)lerp(line, 170, Vres, 7, 0);
I can work out; lerp(cur_pos, min_pos, max_pos, min_output, max_output)
So you're converting the line position to an index in the palette based on its position between the min_pos and max_pos... I like it! I can see how the palette output is inverted for the bottom half of the screen. Thinking back I always used to do this in a 2 step process - get the position between two points as a percentage, then use that percentage to work out the position between two other points. Now I can use this handy dandy function to do it in one line of code.