From 4bb602c2f1c0f138a544fb6496c730a1d16234a4 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 11 Dec 2011 18:07:54 +0000 Subject: [PATCH] fgdata changes for HUD cycling --- Nasal/aircraft.nas | 16 ++++++++++++++-- keyboard.xml | 5 +---- preferences.xml | 3 +++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index a8c2b08bc..cf9118652 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -1034,9 +1034,15 @@ var HUD = { init: func { me.vis1N = props.globals.getNode("/sim/hud/visibility[1]", 1); me.currcolN = props.globals.getNode("/sim/hud/current-color", 1); + me.currentPathN = props.globals.getNode("/sim/hud/current-path", 1); + me.hudN = props.globals.getNode("/sim/hud", 1); me.paletteN = props.globals.getNode("/sim/hud/palette", 1); me.brightnessN = props.globals.getNode("/sim/hud/color/brightness", 1); me.currentN = me.vis1N; + + # keep compatibility with earlier version of FG - hud/path[1] is + # the default Hud + me.currentPathN.setIntValue(1); }, cycle_color: func { # h-key if (!me.currentN.getBoolValue()) # if off, turn on @@ -1057,10 +1063,16 @@ var HUD = { me.brightnessN.setValue(br > 0.01 ? br : 1); }, normal_type: func { # i-key - + me.currentPathN.setIntValue(1); }, cycle_type: func { # I-key - + var i = me.currentPathN.getValue() + 1; + if (i < 1 or i > size(me.hudN.getChildren("path"))) { + # back to the start + me.currentPathN.setIntValue(1); + } else { + me.currentPathN.setIntValue(i); + } }, is_active: func { me.vis1N.getValue(); diff --git a/keyboard.xml b/keyboard.xml index 63634f863..f15aafb52 100644 --- a/keyboard.xml +++ b/keyboard.xml @@ -685,7 +685,6 @@ top down before the key bindings are parsed. - + M @@ -908,7 +907,6 @@ top down before the key bindings are parsed. - j diff --git a/preferences.xml b/preferences.xml index a3fa26661..ffb68620e 100644 --- a/preferences.xml +++ b/preferences.xml @@ -327,6 +327,9 @@ Started September 2000 by David Megginson, david@megginson.com Huds/default.xml + Huds/NTPS.xml + Huds/minimal.xml + false