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>
|
||||
<alpha type="float">0.8</alpha>
|
||||
</color>
|
||||
<keynum>359</keynum>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
var t = getprop("/sim/speed-up");
|
||||
if (t > 1/32)
|
||||
t=t/2;
|
||||
else
|
||||
t=1/32;
|
||||
setprop("/sim/speed-up", t);
|
||||
]]></script>
|
||||
<script>controls.speedup(-1);</script>
|
||||
</binding>
|
||||
</button>
|
||||
<text>
|
||||
|
@ -219,17 +211,9 @@
|
|||
<blue type="float">0.3</blue>
|
||||
<alpha type="float">0.8</alpha>
|
||||
</color>
|
||||
<keynum>357</keynum>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
var t = getprop("/sim/speed-up");
|
||||
if (t < 32)
|
||||
t=t*2;
|
||||
else
|
||||
t=32;
|
||||
setprop("/sim/speed-up", t);
|
||||
]]></script>
|
||||
<script>controls.speedup(1);</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
|
@ -290,15 +274,7 @@
|
|||
</color>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
var t = getprop("/sim/replay/time");
|
||||
if (t != "")
|
||||
{
|
||||
t-=30;
|
||||
if (t<0) t=0;
|
||||
setprop("/sim/replay/time", t);
|
||||
}
|
||||
]]></script>
|
||||
<script>controls.replaySkip(-30);</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
|
@ -312,18 +288,9 @@
|
|||
<blue type="float">0.3</blue>
|
||||
<alpha type="float">0.8</alpha>
|
||||
</color>
|
||||
<keynum>356</keynum>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
var t = getprop("/sim/replay/time");
|
||||
if (t != "")
|
||||
{
|
||||
t-=5;
|
||||
if (t<0) t=0;
|
||||
setprop("/sim/replay/time", t);
|
||||
}
|
||||
]]></script>
|
||||
<script>controls.replaySkip(-5);</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
|
@ -386,20 +353,9 @@
|
|||
<blue type="float">0.3</blue>
|
||||
<alpha type="float">0.8</alpha>
|
||||
</color>
|
||||
<keynum>358</keynum>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
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>
|
||||
<script>controls.replaySkip(5);</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
|
@ -415,17 +371,7 @@
|
|||
</color>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
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>
|
||||
<script>controls.replaySkip(30);</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
|
|
@ -86,10 +86,8 @@
|
|||
<button>
|
||||
<legend>-</legend>
|
||||
<binding>
|
||||
<command>property-adjust</command>
|
||||
<property>/sim/speed-up</property>
|
||||
<min>1</min>
|
||||
<step type="double">-1</step>
|
||||
<command>nasal</command>
|
||||
<script>controls.speedup(-1);</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
|
@ -104,10 +102,8 @@
|
|||
<button>
|
||||
<legend>+</legend>
|
||||
<binding>
|
||||
<command>property-adjust</command>
|
||||
<property>/sim/speed-up</property>
|
||||
<min>1</min>
|
||||
<step type="double">1</step>
|
||||
<command>nasal</command>
|
||||
<script>controls.speedup(1);</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
|
20
keyboard.xml
20
keyboard.xml
|
@ -1259,7 +1259,10 @@ top down before the key bindings are parsed.
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controls.incAileron(-0.05, -1.0)
|
||||
if (getprop("/sim/freeze/replay-state"))
|
||||
controls.replaySkip(-5);
|
||||
else
|
||||
controls.incAileron(-0.05, -1.0)
|
||||
</script>
|
||||
</binding>
|
||||
<mod-shift>
|
||||
|
@ -1279,7 +1282,10 @@ top down before the key bindings are parsed.
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controls.incElevator(0.05, -100)
|
||||
if (getprop("/sim/freeze/replay-state"))
|
||||
controls.speedup(1);
|
||||
else
|
||||
controls.incElevator(0.05, -100)
|
||||
</script>
|
||||
</binding>
|
||||
<mod-shift>
|
||||
|
@ -1299,7 +1305,10 @@ top down before the key bindings are parsed.
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controls.incAileron(0.05, 1.0)
|
||||
if (getprop("/sim/freeze/replay-state"))
|
||||
controls.replaySkip(5);
|
||||
else
|
||||
controls.incAileron(0.05, 1.0)
|
||||
</script>
|
||||
<step type="double">0.05</step>
|
||||
</binding>
|
||||
|
@ -1320,7 +1329,10 @@ top down before the key bindings are parsed.
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controls.incElevator(-0.05, 100)
|
||||
if (getprop("/sim/freeze/replay-state"))
|
||||
controls.speedup(-1);
|
||||
else
|
||||
controls.incElevator(-0.05, 100)
|
||||
</script>
|
||||
</binding>
|
||||
<mod-shift>
|
||||
|
|
|
@ -740,6 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
userarchive="y">true</chat-display>
|
||||
<chat-menu include="ATC/chat-menu-entries.xml"/>
|
||||
<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>
|
||||
</multiplay>
|
||||
|
||||
|
|
Loading…
Reference in a new issue