Might not want to do so many traces, it can make things slow. Perhaps store the value of one trace in a variable instead of calling the c_trace function as many times.
like this maybe:
var trace_result
trace_result = c_trace (my.x,temp,IGNORE_ME);
if(trace_result == 0)
fall += fall_prec * time_step;
if(trace_result > 0)
fall = 0;
ect.
Good luck.