I've updated the instrument modulator code to allow tricks like the one
described by Andy. It is now possible to define <min>, <max> and
<modulator> in one layer and if <min> and/or <max> ore within the range
of the <modulator> tag, their value will be honoured.
So, if you define
<layer>
<min>0</min>
<max>50</max>
<modulator>100</modulator>
</layer>
The value will stay at 50, until the modulator forces it back to 0.
FGPanelTransformation *t = *it;
if (t->test()) {
float val = (t->node == 0 ? 0.0 : t->node->getFloatValue());
+
+ if (t->has_mod)
+ val = fmod(val, t->mod);
if (val < t->min) {
val = t->min;
} else if (val > t->max) {
val = t->max;
}
+
if(t->table==0) {
val = val * t->factor + t->offset;
} else {
#include <simgear/misc/props.hxx>
#include <simgear/timing/timestamp.hxx>
+#include <cmath>
#include <vector>
#include <map>
#include <plib/fnt.h>
const SGPropertyNode * node;
float min;
float max;
+ bool has_mod;
+ float mod;
float factor;
float offset;
SGInterpTable * table;
t->node = target;
t->min = node->getFloatValue("min", -9999999);
t->max = node->getFloatValue("max", 99999999);
+ t->has_mod = node->hasChild("modulator");
+ if (t->has_mod)
+ t->mod = node->getFloatValue("modulator");
t->factor = node->getFloatValue("scale", 1.0);
t->offset = node->getFloatValue("offset", 0.0);