- if (state_block > 100)
- state_block = 100;
- if (state < min_state) state = min_state;
- if (state >= max_state) state = max_state - 1;
- state -= min_state;
-
- int pos = state * 100 + state_block;
+ double pos;
+ String s;
+
+ if (min_state == AltosLib.ao_flight_invalid) {
+ int lblock = block;
+ if (lblock > 1000)
+ lblock = 1000;
+ pos = lblock / 1000.0;
+ s = String.format("block %d", block);
+ } else {
+ if (state_block > 100)
+ state_block = 100;
+ if (state < min_state) state = min_state;
+ if (state >= max_state) state = max_state - 1;
+ state -= min_state;
+
+ int nstate = max_state - min_state;
+
+ double spos = (double) (state - min_state) / (double) nstate;
+ double bpos = state_block / 100.0;
+
+ pos = spos + bpos / nstate;
+
+ s = String.format("block %d state %s", block, state_name);
+ }