max_range = Number(txt_max_range) + 10;
wind_angle = Number(txt_wind_angle);
wind_across_power = wind_power * Math.cos(wind_angle * 3.141593 / 180);
wind_vartical_power = wind_power * Math.sin(wind_angle * 3.141593 / 180);
if (wind_angle == 90 || wind_angle == 270)
{
wind_across_power = 0;
}
else if (wind_angle == 180)
{
wind_vertical_power = 0;
} // end if
var _l1 = 0;
while (_l1 <= 2)
{
switch (_l1)
{
case 0:
{
target_range = target_range0;
target_height = target_height0;
break;
}
case 1:
{
target_range = target_range1;
target_height = target_height1;
break;
}
case 2:
{
target_range = target_range2;
target_height = target_height2;
break;
}
} // End of switch
if (target_height < 0)
{
r_target_height = target_height * 0.900000;
}
else if (target_height >= 0)
{
r_target_height = target_height * 1.200000;
} // end if
if (wind_vartical_power < 0)
{
flight_range = target_range - r_target_height - wind_vartical_power;
}
else if (wind_vartical_power >= 0)
{
flight_range = target_range - r_target_height;
} // end if
need_range = target_range + r_target_height - wind_vartical_power;
if (flight_range < max_range * 0.850000 * 0.980000)
{
flight_sp = (-0.640000 * max_range + Math.sqrt(0.409600 * max_range * max_range + 1.600000 * max_range * flight_range)) / (0.008000 * max_range);
}
else if (flight_range >= max_range * 0.850000 * 0.980000)
{
flight_sp = (-0.810000 * max_range + Math.sqrt(0.656100 * max_range * max_range + 0.800000 * max_range * flight_range)) / (0.004000 * max_range);
} // end if
if (need_range < max_range * 0.850000 * 0.980000)
{
need_sp = (-0.640000 * max_range + Math.sqrt(0.409600 * max_range * max_range + 1.600000 * max_range * need_range)) / (0.008000 * max_range);
}
else if (need_range >= max_range * 0.850000 * 0.980000)
{
need_sp = (-0.810000 * max_range + Math.sqrt(0.656100 * max_range * max_range + 0.800000 * max_range * need_range)) / (0.004000 * max_range);
} // end if
bar_width = Math.ceil(360 * (0.010000 * need_sp));
need_sp = Math.round(10000 * bar_width / 360) / 100;
if (flight_sp < 92)
{
width_range = (flight_sp - 80) * 0.025000 + 0.700000;
}
else if (flight_sp >= 92)
{
width_range = (flight_sp - 92) * 0.030000 + 1;
} // end if
width_range_square = wind_across_power * 0.666667 * width_range;
if (select_stage == "SW" & select_hall == 7)
{
width_range_square = width_range_square - 0.200000;
}
else if (select_stage == "SW" & select_hall == 16)
{
width_range_square = width_range_square * 1.500000 / 2;
} // end if
width_range_square = Math.round(width_range_square * 100) / 100;
switch (_l1)
{
case 0:
{
txt_target0 = target_range + "Y/" + target_height + "m";
txt_sp0 = need_sp + "%";
if (width_range_square < 0)
{
txt_width_side0 = "?";
txt_width_range0 = -width_range_square;
}
else if (width_range_square > 0)
{
txt_width_side0 = "?";
txt_width_range0 = width_range_square;
}
else if (width_range_square == 0)
{
txt_width_side0 = "?";
txt_width_range0 = width_range_square;
} // end if
if (need_sp < 78)
{
mc_sp_bar1._alpha = 0;
mc_sp_ybar1._alpha = 0;
mc_sp_rbar1._alpha = 100;
mc_sp_rbar1._width = bar_width;
}
else if (need_sp >= 78 & need_sp < 80)
{
mc_sp_bar1._alpha = 0;
mc_sp_ybar1._alpha = 100;
mc_sp_rbar1._alpha = 0;
mc_sp_ybar1._width = bar_width;
} // end if
if (need_sp >= 80 & need_sp <= 100)
{
mc_sp_bar1._alpha = 100;
mc_sp_ybar1._alpha = 0;
mc_sp_rbar1._alpha = 0;
mc_sp_bar1._width = bar_width;
}
else if (need_sp > 100 & need_sp <= 101)
{
mc_sp_bar1._alpha = 0;
mc_sp_ybar1._alpha = 100;
mc_sp_rbar1._alpha = 0;
mc_sp_ybar1._width = 360;
}
else if (need_sp > 101)
{
mc_sp_bar1._alpha = 0;
mc_sp_ybar1._alpha = 0;
mc_sp_rbar1._alpha = 100;
mc_sp_rbar1._width = 360;
} // end if
break;
}
case 1:
{
txt_target1 = target_range + "Y/" + target_height + "m";
txt_sp1 = need_sp + "%";
if (width_range_square < 0)
{
txt_width_side1 = "?";
txt_width_range1 = -width_range_square;
}
else if (width_range_square > 0)
{
txt_width_side1 = "?";
txt_width_range1 = width_range_square;
}
else if (width_range_square == 0)
{
txt_width_side1 = "?";
txt_width_range1 = width_range_square;
} // end if
if (need_sp < 78)
{
mc_sp_bar2._alpha = 0;
mc_sp_ybar2._alpha = 0;
mc_sp_rbar2._alpha = 100;
mc_sp_rbar2._width = bar_width;
}
else if (need_sp >= 78 & need_sp < 80)
{
mc_sp_bar2._alpha = 0;
mc_sp_ybar2._alpha = 100;
mc_sp_rbar2._alpha = 0;
mc_sp_ybar2._width = bar_width;
} // end if
if (need_sp >= 80 & need_sp <= 100)
{
mc_sp_bar2._alpha = 100;
mc_sp_ybar2._alpha = 0;
mc_sp_rbar2._alpha = 0;
mc_sp_bar2._width = bar_width;
}
else if (need_sp > 100 & need_sp <= 102)
{
mc_sp_bar2._alpha = 0;
mc_sp_ybar2._alpha = 100;
mc_sp_rbar2._alpha = 0;
mc_sp_ybar2._width = 360;
}
else if (need_sp > 102)
{
mc_sp_bar2._alpha = 0;
mc_sp_ybar2._alpha = 0;
mc_sp_rbar2._alpha = 100;
mc_sp_rbar2._width = 360;
} // end if
break;
}
case 2:
{
txt_target2 = target_range + "Y/" + target_height + "m";
txt_sp2 = need_sp + "%";
if (width_range_square < 0)
{
txt_width_side2 = "?";
txt_width_range2 = -width_range_square;
}
else if (width_range_square > 0)
{
txt_width_side2 = "?";
txt_width_range2 = width_range_square;
}
else if (width_range_square == 0)
{
txt_width_side2 = "?";
txt_width_range2 = width_range_square;
} // end if
if (need_sp < 78)
{
mc_sp_bar3._alpha = 0;
mc_sp_ybar3._alpha = 0;
mc_sp_rbar3._alpha = 100;
mc_sp_rbar3._width = bar_width;
}
else if (need_sp >= 78 & need_sp < 80)
{
mc_sp_bar3._alpha = 0;
mc_sp_ybar3._alpha = 100;
mc_sp_rbar3._alpha = 0;
mc_sp_ybar3._width = bar_width;
} // end if
if (need_sp >= 80 & need_sp <= 100)
{
mc_sp_bar3._alpha = 100;
mc_sp_ybar3._alpha = 0;
mc_sp_rbar3._alpha = 0;
mc_sp_bar3._width = bar_width;
}
else if (need_sp > 100 & need_sp <= 102)
{
mc_sp_bar3._alpha = 0;
mc_sp_ybar3._alpha = 100;
mc_sp_rbar3._alpha = 0;
mc_sp_ybar3._width = 360;
}
else if (need_sp > 102)
{
mc_sp_bar3._alpha = 0;
mc_sp_ybar3._alpha = 0;
mc_sp_rbar3._alpha = 100;
mc_sp_rbar3._width = 360;
} // end if
break;
}
} // End of switch
_l1++;
} // end while
} // End of the function