Improve keyboard control for replay system.
Keys should also work when dialog is hidden (but replay is active).
This commit is contained in:
parent
556f07b212
commit
5acd6d4c04
5 changed files with 57 additions and 72 deletions
|
@ -470,3 +470,33 @@ _setlistener("/sim/signals/fdm-initialized", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var replaySkip = func(skip_time)
|
||||||
|
{
|
||||||
|
var t = getprop("/sim/replay/time");
|
||||||
|
if (t != "")
|
||||||
|
{
|
||||||
|
t+=skip_time;
|
||||||
|
if (t>getprop("/sim/replay/end-time"))
|
||||||
|
t = getprop("/sim/replay/end-time");
|
||||||
|
if (t<0)
|
||||||
|
t=0;
|
||||||
|
setprop("/sim/replay/time", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var speedup = func(speed_up)
|
||||||
|
{
|
||||||
|
var t = getprop("/sim/speed-up");
|
||||||
|
if (speed_up < 0)
|
||||||
|
{
|
||||||
|
t = (t > 1/32) ? t/2 : 1/32;
|
||||||
|
if ((t<1)and(0==getprop("/sim/freeze/replay-state")))
|
||||||
|
t=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = (t < 32) ? t*2 : 32;
|
||||||
|
}
|
||||||
|
setprop("/sim/speed-up", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,17 +183,9 @@
|
||||||
<blue type="float">0.3</blue>
|
<blue type="float">0.3</blue>
|
||||||
<alpha type="float">0.8</alpha>
|
<alpha type="float">0.8</alpha>
|
||||||
</color>
|
</color>
|
||||||
<keynum>359</keynum>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.speedup(-1);</script>
|
||||||
var t = getprop("/sim/speed-up");
|
|
||||||
if (t > 1/32)
|
|
||||||
t=t/2;
|
|
||||||
else
|
|
||||||
t=1/32;
|
|
||||||
setprop("/sim/speed-up", t);
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
<text>
|
<text>
|
||||||
|
@ -219,17 +211,9 @@
|
||||||
<blue type="float">0.3</blue>
|
<blue type="float">0.3</blue>
|
||||||
<alpha type="float">0.8</alpha>
|
<alpha type="float">0.8</alpha>
|
||||||
</color>
|
</color>
|
||||||
<keynum>357</keynum>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.speedup(1);</script>
|
||||||
var t = getprop("/sim/speed-up");
|
|
||||||
if (t < 32)
|
|
||||||
t=t*2;
|
|
||||||
else
|
|
||||||
t=32;
|
|
||||||
setprop("/sim/speed-up", t);
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -290,15 +274,7 @@
|
||||||
</color>
|
</color>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.replaySkip(-30);</script>
|
||||||
var t = getprop("/sim/replay/time");
|
|
||||||
if (t != "")
|
|
||||||
{
|
|
||||||
t-=30;
|
|
||||||
if (t<0) t=0;
|
|
||||||
setprop("/sim/replay/time", t);
|
|
||||||
}
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -312,18 +288,9 @@
|
||||||
<blue type="float">0.3</blue>
|
<blue type="float">0.3</blue>
|
||||||
<alpha type="float">0.8</alpha>
|
<alpha type="float">0.8</alpha>
|
||||||
</color>
|
</color>
|
||||||
<keynum>356</keynum>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.replaySkip(-5);</script>
|
||||||
var t = getprop("/sim/replay/time");
|
|
||||||
if (t != "")
|
|
||||||
{
|
|
||||||
t-=5;
|
|
||||||
if (t<0) t=0;
|
|
||||||
setprop("/sim/replay/time", t);
|
|
||||||
}
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -386,20 +353,9 @@
|
||||||
<blue type="float">0.3</blue>
|
<blue type="float">0.3</blue>
|
||||||
<alpha type="float">0.8</alpha>
|
<alpha type="float">0.8</alpha>
|
||||||
</color>
|
</color>
|
||||||
<keynum>358</keynum>
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.replaySkip(5);</script>
|
||||||
var t = getprop("/sim/replay/time");
|
|
||||||
if (t != "")
|
|
||||||
{
|
|
||||||
t+=5;
|
|
||||||
if (t>getprop("/sim/replay/end-time"))
|
|
||||||
t = getprop("/sim/replay/end-time")-0.1;
|
|
||||||
if (t<0) t=0;
|
|
||||||
setprop("/sim/replay/time", t);
|
|
||||||
}
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -415,17 +371,7 @@
|
||||||
</color>
|
</color>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script><![CDATA[
|
<script>controls.replaySkip(30);</script>
|
||||||
var t = getprop("/sim/replay/time");
|
|
||||||
if (t != "")
|
|
||||||
{
|
|
||||||
t+=30;
|
|
||||||
if (t>getprop("/sim/replay/end-time"))
|
|
||||||
t = getprop("/sim/replay/end-time")-0.1;
|
|
||||||
if (t<0) t=0;
|
|
||||||
setprop("/sim/replay/time", t);
|
|
||||||
}
|
|
||||||
]]></script>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -86,10 +86,8 @@
|
||||||
<button>
|
<button>
|
||||||
<legend>-</legend>
|
<legend>-</legend>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-adjust</command>
|
<command>nasal</command>
|
||||||
<property>/sim/speed-up</property>
|
<script>controls.speedup(-1);</script>
|
||||||
<min>1</min>
|
|
||||||
<step type="double">-1</step>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
<button>
|
<button>
|
||||||
|
@ -104,10 +102,8 @@
|
||||||
<button>
|
<button>
|
||||||
<legend>+</legend>
|
<legend>+</legend>
|
||||||
<binding>
|
<binding>
|
||||||
<command>property-adjust</command>
|
<command>nasal</command>
|
||||||
<property>/sim/speed-up</property>
|
<script>controls.speedup(1);</script>
|
||||||
<min>1</min>
|
|
||||||
<step type="double">1</step>
|
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
</group>
|
</group>
|
||||||
|
|
20
keyboard.xml
20
keyboard.xml
|
@ -1259,7 +1259,10 @@ top down before the key bindings are parsed.
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
controls.incAileron(-0.05, -1.0)
|
if (getprop("/sim/freeze/replay-state"))
|
||||||
|
controls.replaySkip(-5);
|
||||||
|
else
|
||||||
|
controls.incAileron(-0.05, -1.0)
|
||||||
</script>
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-shift>
|
<mod-shift>
|
||||||
|
@ -1279,7 +1282,10 @@ top down before the key bindings are parsed.
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
controls.incElevator(0.05, -100)
|
if (getprop("/sim/freeze/replay-state"))
|
||||||
|
controls.speedup(1);
|
||||||
|
else
|
||||||
|
controls.incElevator(0.05, -100)
|
||||||
</script>
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-shift>
|
<mod-shift>
|
||||||
|
@ -1299,7 +1305,10 @@ top down before the key bindings are parsed.
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
controls.incAileron(0.05, 1.0)
|
if (getprop("/sim/freeze/replay-state"))
|
||||||
|
controls.replaySkip(5);
|
||||||
|
else
|
||||||
|
controls.incAileron(0.05, 1.0)
|
||||||
</script>
|
</script>
|
||||||
<step type="double">0.05</step>
|
<step type="double">0.05</step>
|
||||||
</binding>
|
</binding>
|
||||||
|
@ -1320,7 +1329,10 @@ top down before the key bindings are parsed.
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
controls.incElevator(-0.05, 100)
|
if (getprop("/sim/freeze/replay-state"))
|
||||||
|
controls.speedup(-1);
|
||||||
|
else
|
||||||
|
controls.incElevator(-0.05, 100)
|
||||||
</script>
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-shift>
|
<mod-shift>
|
||||||
|
|
|
@ -740,6 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
userarchive="y">true</chat-display>
|
userarchive="y">true</chat-display>
|
||||||
<chat-menu include="ATC/chat-menu-entries.xml"/>
|
<chat-menu include="ATC/chat-menu-entries.xml"/>
|
||||||
<write-message-log type="bool">false</write-message-log>
|
<write-message-log type="bool">false</write-message-log>
|
||||||
|
<freeze-on-replay type="bool">true</freeze-on-replay>
|
||||||
<default-model type="string">Models/Geometry/glider.ac</default-model>
|
<default-model type="string">Models/Geometry/glider.ac</default-model>
|
||||||
</multiplay>
|
</multiplay>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue