#include /****************************************************************/ USHORT amptopot(amp) /* Convert an amplitude to an integer to put in the proportional */ /* gadget's VertPot value. */ LONG amp; { USHORT temp; temp = (127-abs(amp))<<9; return(temp); } /****************************************************************/ LONG pottoamp(pot,potsign) /* Converts a proportional gadget's VertPot value to an amplitude */ USHORT pot; SHORT potsign; { LONG temp; temp = (127-(pot>>9))*potsign; return(temp); } /************************************************************/ LONG randamp() /* Picks a random amplitude (for the game mode) */ { LONG temp; temp=(rand()&0xFF)-127; if (temp==128) temp=127; return(temp); }