1
0
Fork 0
Commit graph

382 commits

Author SHA1 Message Date
mfranz
80913de2e0 code from ufo.nas (used by ufo.nas and tutorial.nas)
- simple geo coordinates class: geo.Coord with methods to set/get single
  components, to apply distance/course and the get distance/course to other
  coords
- functions that return click and aircraft position as geo.Coord
- function that returns tile_path for given lon/lat
- function that returns normalized angle (0 <= angle < 360)
2007-03-20 20:54:52 +00:00
mfranz
cf16f4de88 support <model> definition in a tutorial file, so that tutorials can place
static scenery objects, like air-racing pylons, etc.
2007-03-20 17:32:28 +00:00
mfranz
6d20159866 - trim/sanitize screen messages, so that tabs aren't displayed as
question marks
- make listeners one-shot (saves a couple of bytes of RAM :-)
2007-03-20 16:25:11 +00:00
mfranz
7319f5e772 better condition() comment & cosmetics 2007-03-20 16:23:23 +00:00
mfranz
dcd471b63d - add dialog wrapper, so that "tutorial.dialog()" typed into the
Help->Nasal-Console opens the adjustment dialog
- reset Nasal namespace for emebedded Nasal for every tutorial
- rename <voice> to <audio>  (in the hope that this won't be mixed up
  with Festival voice synthesis; should we call it <audio-sample>?)
- rename <instruction> to <message> for consistency reasons, so there
  are now <step><message>s, <error><message>s, and <end><message>s
2007-03-20 16:22:26 +00:00
mfranz
7cb5ad477c major overhaul/part I:
- add <marker> support (blinking magenta circle to point to switches etc.)
- use "real" conditions instead of tutorial-only ones
- list of <error> with <message> and <condition> children, instead
  of one <error> group with <check> items (necessary because of <condition>)
- only one <exit> (use <condition><and>... to define a set
- rename properties <prop><val><msg> to <property><value><message>
  (consistency with other systems)
- <end><message>/<voice> instead of <endtext> and <endtext-voice> etc.
- add <nasal> support everywhere, with separate namespace and predefined
  tutorial functions in it (currently only say(), next(), previous())
- make <timeofday> property actually work

TODO:
- more cleanup/re-organization
- add optional <view> group, to direct user view to switches (for startup
  tutorials etc.)

2-space indentation changed to tabs (with Stuarts permission), and braces
to K&R style (rationale on request :-)
2007-03-19 23:46:50 +00:00
mfranz
5b812986fb undefined <condition>s are "true" 2007-03-19 18:17:05 +00:00
mfranz
b2f57eab81 boolify <property> result 2007-03-18 15:49:11 +00:00
mfranz
0b4e6f934e add a props.condition(property) command that evaluates a property branch
as <condition> according to the rules set out in $FG_ROOT/Docs/README.condition
2007-03-18 13:57:32 +00:00
mfranz
5f7104ac8a revert condition() patch. This can as easily be done in pure Nasal. 2007-03-18 10:52:08 +00:00
mfranz
d1c4bcea85 condition(property) wrapper for the _condition function.
See $FG_ROOT/Docs/README.condition
2007-03-17 15:59:39 +00:00
mfranz
ad8048627d add Dialog.namespace() method, which returns the XML dialog's namespace
if the dialog is open and contains embedded <nasal>, or nil otherwise.
This can be used to call dialog functions.
2007-02-26 11:00:04 +00:00
mfranz
2987f9660f let Shift-Space open property browser 2007-02-24 10:16:26 +00:00
mfranz
8f977f33ff - immediately unfreeze when mouse mode changes to a non-pointer mode
- rename variable s/speed/time/
2007-02-23 22:17:55 +00:00
mfranz
9e11e2102f - add property /sim/startup/terminal-ansi-colors {BOOL}. This is used
by debug.nas to turn on/off syntax coloring for dumped data (which
  is desirable as compound data types can fill several screens with
  rather hard to read data). Unfortunately, it can't be reliably deduced
  from the OS whether ANSI colors are available or not.
- move "multiplayer chat" properties to where they belong
2007-02-18 17:21:50 +00:00
mfranz
dfb4316b43 - make duration of view change configurable (default 0.2 seconds)
- extract some constants
2007-02-11 16:56:15 +00:00
mfranz
7763462f24 - add some documentation
- reset values
2007-02-10 23:47:02 +00:00
mfranz
7f30f1599e prevent math.ln(0) 2007-02-10 20:42:36 +00:00
mfranz
892f665997 small fix; need to remove the whole silly wrapper, anyway 2007-02-09 18:10:22 +00:00
mfranz
4b7c559b69 - extend lookat() function: dynamic_view.lookat(hdg, pitch, roll, x, y, z [, fov])
- use extra function for resuming normal mode after lookat: dynamic_view.resume()
- add fov (field-of-view) to interface:  me.fov_offset
- remove register_headshake and me.headshake; this can still be done via
  normal register(). If only headshaking is to be added, while keeping default
  plane view, do this:

  dynamic_view.register(func {
      default_plane();
      me.x_offset = ...
      me.y_offset = ...
      me.z_offset = ...
  });
2007-02-08 22:16:10 +00:00
mfranz
4ebd876c85 - move all module initialization code into one-shot listener
- initialize /sim/time/delta-realtime-sec, so that the lowpass filter doesn't
  complain if it's starter eraly (of course the results won't be correct
  until the delta is real)
2007-02-08 18:42:02 +00:00
mfranz
12f5714b37 add support for x/y/z axes. The built-in function is (still) a NOOP, but
aircraft can plug a custom function. This function can access all internal
variables of the ViewManager class. It can set me.{x,y,z}_offset, and also
add offsets to me.{heading,pitch,roll}_offset. Example:

dynamic_view.register_headshake(func {
        me.x_offset = rand() * 0.02;  # Parkinson effect
});

The advantage of this implementation is that it doesn't break MMB drag
functionality, and that is can be frozen by mouse movements.
2007-02-07 22:13:51 +00:00
mfranz
b07ebf0dfa work around Nasal bug (and/or operators) 2007-02-07 17:31:41 +00:00
mfranz
caf96d76c8 minor documentation fix 2007-02-07 17:06:52 +00:00
mfranz
3bec4f4cfc - add debug.local([<frame>]) to output local variables of frame #0
or of given frame
- add debug.string(<variable>). This returns the variable dump as
  string.
- add var to module function variables to avoid collisions with module names
2007-02-07 17:06:05 +00:00
mfranz
a1556fa69a make lookat work correctly for when the user changed view direction;
Remember: dynamic_view.lookat(heading, pitch, roll) moves view
smoothly to this direction, while dynamic_view.lookat() moves it back.
This can be used for quick view changes to the panel etc. It's currently
only used in the bo105 (flaps-up binding).
2007-02-07 16:58:46 +00:00
mfranz
e034e66c57 interpolate between frozen or lookat direction and current view direction 2007-02-06 16:25:44 +00:00
mfranz
df1bd972f8 - fix reinit/reset (has this caused the spinning view on reset for some?)
- add var to module functions to avoid conflicts with module names
2007-02-06 14:33:59 +00:00
mfranz
c9db8c22a3 don't waste time when we aren't in dyn-view mode at all 2007-02-05 22:59:51 +00:00
mfranz
286629c3e1 oh, and freeze while a button is pressed in arrow mode ... 2007-02-05 20:57:19 +00:00
mfranz
ea2d56aa33 don't generally freeze dynamic_view in arrow mouse mode, but only a short
time after mouse movements or clicks. After that period a rather ugly jump
happens. TODO: make this smoother
2007-02-05 20:36:29 +00:00
mfranz
90100e2514 disable dynamic view in mouse arrow mode. Operating all the tiny switches
on 3d panels while hopping over bumpy terrain has become difficult -- much
harder than in real life. I'm open for better solutions. Just complain. :-)
2007-02-05 16:14:51 +00:00
mfranz
0f07c14bd3 getBoolValue() on an undefined node shall return "false", not "true".
This isn't only more logical, it's also how SGPropertyNode::getBoolValue()
acts. The fix has potential to break code, but so far I haven't seen any
problems. I added a debug message to my copy and will for a while check
all cases that I run into. To check yourself, just add one line:

    getBoolValue : func {
        val = me.getValue();
+       if(val == nil) { debug.dump(me) }
        if(me.getType() == "STRING" and val == "false") { 0 }
        else { val != nil and val != 0 }
    }

This will output a debug message to the terminal for each case where
formerly "true" was returned, and now "false" is.
2007-02-05 11:40:49 +00:00
mfranz
cb25691c03 call setWeightOpts on reset, too 2007-01-31 21:37:14 +00:00
mfranz
003ba28784 make sure that setWeightOpts isn't called before fuel.nas' init fdm listener.
This is a bit hackish and needs to be reconsidered.
2007-01-31 21:13:16 +00:00
mfranz
221c23e18b - don't create tanks in empty tank nodes (that nasty native_fdm.cxx causes)
- use Nasal features that were introduced after this code was first written:
  * var for local variables (and to make clear when a variable is first used)
  * += operator
  * listeners to import seldom changing variables and to avoid waiting for
    the FDM in a loop

This new code started as empty file where I added my stuff and then copied
parts from the old code, piece by piece. This is why the coding & indentation
style has changed. Functionally the code should basically be equivalent.
2007-01-31 15:53:01 +00:00
mfranz
80b188706f cosmetics and stuff 2007-01-30 23:22:36 +00:00
mfranz
7ecdeec89e better backtrace section titles with added frame number 2007-01-29 23:48:41 +00:00
mfranz
6f073760af whoops 2007-01-29 19:57:54 +00:00
mfranz
feaf223d88 cleanup 2007-01-29 16:24:58 +00:00
mfranz
7d0fe51b9f first stab at nasal debugging helper module (nicks parts for files from
the Nasal repository :-)
2007-01-28 12:20:18 +00:00
mfranz
04de5c67c8 - add all entries in /sim/aircraft-data/path[*] to the save-list, so that one
can also write

      <sim>
          <aircraft-data>
              <path>/sim/author</path>
              <path>/sim/description</path>
              <path>/sim/rtatus</path>
          </aircraft-data>
      </sim>

  in a *-set.xml file instead of using Nasal (aircraft.data.add("/sim/author", ...)
- s/timeN/node/ to match the pattern described in the head comment
- make listener on-shot
2007-01-26 23:33:25 +00:00
mfranz
e3d90ee46c - don't prepend underscore to aircraft names (this was a leftover from
versions that wrote that name to the property tree)
- move HUD part to the bottom. It isn't really part of the library
- cleanup
2007-01-23 17:29:41 +00:00
mfranz
b47d2e2204 respect /sim/startup/save-on-exit 2007-01-22 19:05:35 +00:00
mfranz
97771b69ae - save aircraft data before the aircraft's Nasal files are executed
- make 0 a valid saving interval, and 'nil' or no arg stop the loop
  (this is for consistency with settimer() or aircraft.timer() intervals
- smaller fixes, cleanup
2007-01-22 16:49:28 +00:00
mfranz
f376ea5adb use /sim/signals/nasal-dir-initialized signal to simplify things 2007-01-22 00:03:07 +00:00
mfranz
bf7731c0af use /sim/signals/nasal-dir-initialized signal for library initialization;
this makes it possible to use screen.log.write() everywhere in aircraft
nasal files, not only after settimer(func{}, 0) were triggered
2007-01-21 20:56:25 +00:00
mfranz
977910c258 we can't use the setlistener() wrapper here, but need the real thing 2007-01-21 20:44:55 +00:00
mfranz
f61969ed01 add timer class that optionally saves time in the aircraft data file,
restores this time at next run and continues from this value. This is
meant for operation hour counters (Hobbs meters) for turbines, etc.
2007-01-21 20:06:05 +00:00
mfranz
722f35903d only save before the reset is executed, so we can save e.g. the Hobbs time 2007-01-21 00:21:53 +00:00
mfranz
ec18defa4c the dummy entry is no longer needed; files get only written if they
actually contain aircraft settings
2007-01-20 23:13:54 +00:00
mfranz
a73972512d add class for saving data into aircraft specific files
in ~/.fgfs/aircraft-data/ or %APPDATA%\flightgear.org\aircraft-data\
2007-01-20 20:15:06 +00:00
mfranz
51712052e1 this file is broken by design. Fixing the Nasal error apparently
overstrains it, so here's the error back. Have fun!  :-|
2007-01-13 22:37:38 +00:00
mfranz
4690b3c2c3 totally pointless mini-optimization 2007-01-13 21:46:07 +00:00
mfranz
f58fcdd492 make sure the property doesn't only exist, but is actually initialized 2007-01-13 18:35:22 +00:00
mfranz
7b6205d37b add props.Node.getAttribute() and props.Node.setAttribute() methods.
Examples:
  var tied = foo.getAttribute("TIED");
  foo.setAttribute("USERARCHIVE", 1);

Both methods accept attribute strings "READ", "WRITE", "ARCHIVE",
"TRACE_READ", "TRACE_WRITE", and "USERARCHIVE". getAttribute() does
additionally accept "TIED" (although this isn't an SGPropertyNode::Attribute).
Attribute "REMOVED" is not supported.
2007-01-12 18:06:50 +00:00
mfranz
41a756a6ba light class: make the first time-value always "on", even for odd numbered
light pattern. This is more robust and doesn't need the reinit listener.
2006-12-13 16:15:27 +00:00
mfranz
923f2b7299 - fix index and restart loop on reinit
- cosmetics
2006-12-12 22:42:52 +00:00
mfranz
30ce4f68c2 - make register() method more tolerant
- cosmetics
2006-12-11 18:37:10 +00:00
mfranz
ddc4b4c8e5 fix lookat() method (didn't consider unmanaged view "goals") 2006-12-10 23:09:42 +00:00
mfranz
bfacf76538 change per-aircraft configuration to a single function object that is
registered with dynamic_view.register() and is called in the main loop,
replacing the default plane/helicopter function. This has access to
all class functions/members and sets me.heading_offset, me.pitch_offset,
and me.roll_offset, which are then used as new view offsets.
The function can also do other things, such as call the lookat() method
to temporarily set heading and pitch. See the bo105 for an example.

While further minor changes are to be expected, the configuration method
seems to be the way to go.
2006-12-10 21:50:59 +00:00
mfranz
0529f66842 - first stab at making dynamic view parameters configurable on a per-aircraft
basis; see bo105.nas for an example; expect some changes, though
- move "lookat" feature here from bo105.nas (used by "flaps up" bindings)
2006-12-09 22:42:13 +00:00
mfranz
354a0f59ff make if-branch for helicopters (bo105 settings) and for everything else;
this *really* needs to be made configurable and less hackish
2006-12-07 22:38:07 +00:00
mfranz
28323bcec8 new light.new() arguments with light pattern array; error message for old
style args
2006-12-06 15:58:03 +00:00
mfranz
cb9361b067 showHelpDialog: automatically split the contents of a <line> block at
newlines
2006-12-06 00:24:48 +00:00
mfranz
a5aae32cc1 whoops; fix return value 2006-12-05 19:32:44 +00:00
mfranz
2cb4354814 - fix switch() method
- optimization (and code obfuscation ;-)
2006-12-05 19:17:17 +00:00
mfranz
eff0eecb8f lowpass: add set() method to set current average
light: - only trigger switch action if switch state actually changed
       - simplify loop
2006-12-04 10:42:05 +00:00
mfranz
c5ac5639a0 reset view after reinit (slowly, because the lowpass filters need to catch up) 2006-12-03 23:59:50 +00:00
mfranz
89710547ec Use a listener to watch the aircraft.light switch. This is slightly more
efficient and there's no more potential 0.5 s delay.
2006-12-03 22:20:16 +00:00
mfranz
4ae3ab11df don't silently fix bad user input -- complain loudly 2006-11-04 11:33:08 +00:00
mfranz
2145558999 documentation fix 2006-11-03 19:39:08 +00:00
mfranz
dabf3f300c - aircraft.nas: add variable-interval EWMA lowpass filter class
- dynamic_view.nas: use aircraft.lowpass() class

This makes the dynamic view independent of the frame rate. Currently,
each filter instance reads out dt on its own, which is a bit inefficient.
I'll change that to just one read for all instances later (when Nasal
implemented predictable module loading order. :-)
2006-11-03 17:38:32 +00:00
mfranz
0ff3f5da2b boring cleanup 2006-11-02 21:06:36 +00:00
mfranz
07e3e2b05b - minor fix
- add info/debug messages
2006-10-31 13:59:50 +00:00
mfranz
ae1df38643 better atc-message repetition (Remember: '+'-key) 2006-10-31 12:19:42 +00:00
mfranz
76e6f5247a disable joystick info dialog if no js available 2006-10-21 10:19:24 +00:00
mfranz
82c4dd05ed - replace indentation tabs with spaces
- fix sliders: revisions 1.43/1.44 had introduced a mandatory <min-lb>;
  if that was missing, a slider without handle was generated, and a click
  on the slider lead to a crash.
  -> check for both <min-lb> and <max-lb> and set default values
     0, respectively 100

  var min = w.getNode("min-lb", 1).getValue();
  var max = w.getNode("max-lb", 1).getValue();
  slider.set("min", min != nil ? min : 0);
  slider.set("max", max != nil ? max : 100);
2006-10-17 19:22:36 +00:00
frohlich
9c52cbf4ac Modified Files:
preferences.xml gui/menubar.xml gui/dialogs/rendering.xml
Added Files:
	Nasal/multiplayer.nas gui/dialogs/chat.xml
	gui/dialogs/chat_full.xml:
	the data part of Stuarts multiplayer/chat patch
2006-10-10 05:23:38 +00:00
mfranz
aad61698ff fix property_browser() 2006-08-27 19:27:21 +00:00
andy
d9ff131805 Oops, wrong sense of create predicte. Melchior was peeved. 2006-08-27 16:45:54 +00:00
andy
e2de2b4093 Melchior discovered an interpreter bug that is fixed (or seems to be
-- I need to verify) in current Nasal CVS.  Commit a workaround for
now.  Basically: don't return a tail call from a foreach.
2006-08-27 16:22:06 +00:00
mfranz
1f57ea72b4 a global symbol must not only *contain* __dlg:property_browser, but
start with it. ("__dlg:" is the namespace prefix for Nasal embedded
in XML dialogs. Subsequent property browsers get a random number added.)
2006-08-26 13:23:06 +00:00
mfranz
74b5436cde call Dialog.load() from the new() constructor already 2006-08-25 20:13:58 +00:00
andy
b6fb9d031a Further augment the weight subsystem so that weights can be tagged with
tank indices, so that changing drop tanks automatically modifies the
corresponding FDM tank capacity (and load, if it is too high).

Add the new tank stuff to the harrier config, along with a few new
items (e.g. AMRAAMs on the outboard pylons) that aren't in the 3D
model yet, but correspond to actual usage.
2006-08-25 19:59:05 +00:00
andy
3e268e394c [Yes, Andy's writing code again. The world is ending.]
An IRC discussion about shavlir's (really nice) harrier model showed
that it had its own version of something like the Fuel & Weight
dialog, developed because the existing subsystem only supported
sliders and not "combo box" style selection for specific external
stores.  That seemed sub-optimal, so I spent a few hours extending the
F&W dialog to do this and forward-ported the harrier to use it.

Check the harrier-set.xml file for an example.  Basically, the weight
dialog reads a list of options for each weight listed under
/sim/weight[n] and manages a "selected" proprty telling us which one
is in use.  The FDM code can then read out the weight-lb property as
before, and the model animations can use the selected option to
predicate drawing the appropriate 3D content.  It seems to work pretty
well.
2006-08-24 22:29:16 +00:00
mfranz
d27df588a6 reduce slip effect speed (harrier VTOL) 2006-08-24 20:55:18 +00:00
mfranz
b5863d9cad use gui.Dialog() class instead of gui.loadXMLDialog() function (which has
been removed)
2006-08-24 16:32:58 +00:00
mfranz
8aa5947e7a - move bo105's Dialog class here; replaces gui.loadXMLDialog()
- fix indentation
2006-08-24 16:32:09 +00:00
mfranz
d583bbcb4f - add property browser opening function
- open browser for each /browser[] property
- add Widget.setBinding() function to simplify dialog generation, and
  convert the dialogs to use it
2006-08-24 12:44:14 +00:00
mfranz
11dc7c5bcd - let Input class use Lowpass class
- preparation for configurability
- documentation/cleanup
2006-08-22 10:06:46 +00:00
mfranz
f3d14c408a - only allow dynamic view on some fdms, and disable menu entry on others
- decrease heading-due-to-sideslip
2006-08-21 09:45:48 +00:00
mfranz
8ecfdb2a96 add HUD manager class. The old and new HUD code is a bit tedious to handle
in keyboard.xml. Better concentrate that on one place.
2006-08-21 08:35:53 +00:00
curt
a6ebef1d0a Make lead aircraft behavior more uniform/predictable/repeatable. 2006-08-20 00:54:53 +00:00
mfranz
07f5dd24f3 use sideslip for heading offset in-air, and heading change rate on-ground.
Unfortunately, this is quite jittery on some aircraft, so it uses a slower
lowpass filter. I'd like to fix that, but don't even know what causes it.
Considering /sim/time/delta-realtime-sec didn't help.  :-/
2006-08-19 22:24:24 +00:00
mfranz
28a7b8cb6b - initialize a few properties that can be nil at startup
- start script at settimer(..., 0)
- fix heading mistake
- cleanup
2006-08-18 17:00:16 +00:00
mfranz
3f9bdb62ab fix property name (I had changed that in the environment files, and
apparently missed this instance when I searched for its use)
2006-08-18 15:50:53 +00:00
mfranz
8a31fbaae4 simpler & faster 2006-08-17 22:58:06 +00:00
mfranz
4099269ab3 using printlog() wasn't a good idea, as we don't know if globals.nas was
already initialized. Commenting the messages out.
2006-08-17 18:56:22 +00:00
mfranz
94835bb4e4 move the listener settings into the timer, as we don't know at that time
if globals.nas was already loaded
2006-08-17 18:53:44 +00:00
mfranz
8b77679c06 - don't update view as long as mouse button 0 is pressed (otherwise closing
the A-10 canopy is a bit difficult :-)
- reduce pitch-due-to-z-accel a bit
2006-08-17 16:42:00 +00:00
andy
591c72f5b4 Comments about -lbs and -gal_us were mixed up. Pounds are the
writable property.  Gallons are a read-only convenience.
2006-08-17 16:32:41 +00:00
mfranz
1a6a1a6436 first stab at generic dynamic view handling; can be turned on/off via menu
entry "View->Toggle Dynamic Cockpit View" entry; state saved to autosave.xml;
there are no configuration parameters yet, but the default values work for
most aircraft; exceptions: ground steering effect of jsbsim aircraft is
jittery; yawing effect on big aircraft is too abrupt. This needs to be
configurable.
Suggestions for improvements are welcome if they are bundled with a
working diff that actually proves the claimed advantages.   :-)
2006-08-17 15:59:44 +00:00
mfranz
ae6108de80 add n/N key binding (is it really called "finer" and "coarser"?) 2006-08-09 14:01:53 +00:00
mfranz
4f90536ea6 shut up 2006-08-09 13:55:48 +00:00
curt
7faa7a1edf Make one small path change (doesn't include Melchior's optimization fixes.) 2006-07-27 04:02:12 +00:00
curt
0ac3b042c2 Also set target true heading along with magnetic heading. 2006-07-26 14:43:22 +00:00
curt
3833703808 Rename to avoid "-" in class name. 2006-07-24 17:53:46 +00:00
mfranz
0246507821 fix indentation 2006-07-20 17:52:55 +00:00
mfranz
ac2225a65f add function that loads dialogs from XML files
(aircraft may prefer to use such dialogs to Nasal-generated ones)
2006-07-14 16:03:43 +00:00
mfranz
1c7e2b404a remove workaround for broken continue 2006-07-03 05:59:24 +00:00
curt
25edaaa068 Initial revision of target tracking script, see script code for operating
instructions.
2006-06-29 00:52:51 +00:00
mfranz
f491fd5291 add interface function for selecting weapons 2006-06-24 12:31:58 +00:00
mfranz
c39b82a4a4 add trigger interface function, to be used by all armed aircraft, so that
there's a unified way for joysticks/kbd bindings to activate weapons
2006-06-09 20:52:03 +00:00
mfranz
249dbd3303 the harrier triggers a Nasal bug: "continue" doesn't execute the "for"
loop's reinitialization part. We have to do that manually for now, or
get caught in an endless loop, until fgfs has mercy and segfaults.
2006-05-25 18:31:00 +00:00
mfranz
af04d04e79 fix rarely occurring bug: if the node isn't initialized, then cap is nil
and can't be compared with a scalar, but only with nil itself
2006-05-12 06:54:16 +00:00
mfranz
35f76bab96 delay menu disabling a bit for props.nas to be able to catch up (?)
(sometimes the AP menu entry didn't get enabled when it should)
2006-04-06 09:49:49 +00:00
mfranz
4a0b56deb3 - now that XML dialogs run their own Nasal namespace and have <open> and
<close> block, remove autopilot helper file autopilot.nas and (re)implement
  its functionality in autopilot.xml
- make AP dialog "bidirectional" and "live": all input fields are <live>
  (i.e. they are updated as the autopilot settings are changed, for example
  by panel actions or property browser changes)
- dialog input is only forwarded to the AP; no direct checkbox/radiobutton
  handling through widget operation, instead:
- changes to the AP properties operate checkboxes/radiobuttons

This makes the AP dialog always reflect the AP state. If the AP refuses
one setting and sets it back to something else, then the dialog will
immediately react and show the actual setting.
2006-04-05 20:24:21 +00:00
mfranz
357dfb3934 move gui styles from /sim/gui[n] to /sim/gui/style[n] to make /sim/gui
free for other gui related properties
2006-03-09 23:05:08 +00:00
mfranz
9d2216d5bc Stuart BUCHANAN: make adjEngControl() only work for selected engines
mf:
- some minor modifications to Stuart's version  :-)
- select all engines per default. This may seem less realistic (who starts
  all engines on the b29 at once?), but it'll prevent oodles of bug reports.
  And those who want it realistic shouldn't rely on engine 1 being selected
  by default, anyway, but rather actively select every single engine.
  Also: this new behavior is in line with the original intentions (see cvs
  log to preferences.xml -r1.51)
2006-03-04 18:21:06 +00:00
mfranz
e8f6224875 add resetFOV function 2006-03-02 16:23:05 +00:00
mfranz
157ae984dc - apply/release brakes smoothly by default
- let applyParkingBrake() return current state
2006-03-01 18:33:46 +00:00
mfranz
7e81d93f28 use wrappers for brakes/parking brake
(js files are to be converted)
2006-03-01 17:04:20 +00:00
mfranz
db731ee480 store listener ids in module hash, so that other modules can remove them:
removelistener(screen.listener["pilot"]);   # try in the Nasal console
2006-02-28 15:25:26 +00:00
mfranz
3e98f8353c cosmetics 2006-02-24 15:54:45 +00:00
mfranz
fa37af573c - let menuEnable() consider all <name>s
- always disable tutorial-stop; enable tutorial-start if tutorial available
- don't call the tutorial selector "Wizard 1/2". There is only one tutorial
  selector, the next dialog is already part of the tutorial. Also, the dialogs
  don't guide you through multi-dialog setup, which is what "wizards" normally
  stand for.
- use tutorial name as dialog title
- set button shortcuts (default == return, esc)
- make esc go back to select dialog
- beautify sliders & some other tweaks
2006-02-24 11:11:09 +00:00
mfranz
783256433a if a tutorial is running, let the '+' make the instructor repeat his
last message; otherwise ATC
2006-02-24 11:05:13 +00:00
mfranz
156de8e0c3 Stuart BUCHANAN: set /sim/tutorial/running; make last message available
mf: add isRunning() function to enable/disable "Stop Tutorial" menu
2006-02-24 11:03:22 +00:00
mfranz
d9bbddfe3d - make menuEnable() operate on all menus/items with that name (don't stop
when the first was found)
- disable tutorial entries if no tutorial is available
2006-02-23 18:52:32 +00:00
mfranz
c1e9de96c7 add "sticky" bool member that make the window class remember its last pos 2006-02-22 17:26:06 +00:00
mfranz
ceeb9503f8 Stuart BUCHANAN:
Nasal/XML based tutorial system
2006-02-22 17:03:42 +00:00
mfranz
3ee8f31785 simplification 2006-02-21 21:38:59 +00:00
mfranz
ba5d916dcb split multiline messages into separate lines;
move default window slightly up
2006-02-21 21:26:49 +00:00
mfranz
bd327892d6 let getBoolValue() actually return a bool 2006-02-20 10:59:52 +00:00
mfranz
cde64c8543 use __ for static variables (one underscore is too handy for use in other
modules to waste it here)
2006-02-18 00:12:09 +00:00
mfranz
f9089e95d6 noise reduction: only print file names if --log-level is at least "info" 2006-02-17 22:20:15 +00:00
mfranz
dc6ab58eaf allow printlog() to be used with variable arg list (like print()):
printlog("warn", "Monty", "Burns");
2006-02-17 22:05:32 +00:00
mfranz
003ae0986f add printlog() function that works like SG_LOG(). It takes two arguments:
a --log-level and a scalar. Example: printlog("info", "I want more noise");
2006-02-17 21:24:08 +00:00
mfranz
7a60fdc1e4 don't map ATC messages to screen and voice interface if /sim/screen/nomap
is "true"; Currently there's no way to remove Nasal listeners, and people
may not have write access to $FG_ROOT/Nasal/screen.nas. Tidy up, too.
2006-02-13 19:52:45 +00:00
mfranz
03c0dee1dc write ATC messages to the screen.log, and map them to the voice interface
properties
2006-02-11 12:05:50 +00:00
mfranz
6462caf7a4 help dialogs: add '+' keydef (let ATC repeat last message) 2006-02-11 10:33:16 +00:00
mfranz
c486d15803 "export" show(); don't add empty lines 2006-02-05 20:43:14 +00:00
mfranz
7dd2f271db use low window font if set, else the <message-display> theme font if set,
else the gui font
2006-02-04 13:31:16 +00:00
mfranz
41000cc513 various fixes; added color message properties 2006-02-03 00:02:26 +00:00
mfranz
5b4067a327 class for creating displays of automatically scrolling log messages;
one is created in the file and can be used as screen.log.write("message")
2006-02-02 23:34:16 +00:00
mfranz
525abca88d use setlistener()'s 3rd argument to open the fps display initially 2006-02-02 18:04:59 +00:00
mfranz
1ee5cea2f9 revert for now: there's one nasal interpreter problem left to solve first 2006-01-30 15:35:00 +00:00
mfranz
40621a028f use optional setlistener() arg 2006-01-30 15:04:42 +00:00
mfranz
714504b548 support optional setlistener() arg to fire callback function initially;
copy arg checking from interpolate()
2006-01-30 12:37:34 +00:00
mfranz
a1746e9f77 re-position FPS display on window resizing 2006-01-28 11:17:04 +00:00
curt
2c9ff12c17 Make ATC chatter script less verbose, especially when chatter turned off. 2006-01-14 17:30:55 +00:00
curt
a3c96d105c Be smarter about only attempting to play .wav files. 2006-01-10 02:57:32 +00:00
curt
7230b22fed Make it easy to adjust the pacing interval for ATC chatter messages. 2006-01-09 19:11:04 +00:00
curt
9d271d7e7c Add better protection against trying to play "." and ".." after scanning a
directory listing.
2006-01-09 15:18:16 +00:00
curt
5c6a9d76f0 Initial revision. 2006-01-09 14:39:33 +00:00
mfranz
e6ba63050e open fps dialog initially 2005-12-21 10:41:22 +00:00
mfranz
06fa115d86 add function that recursively copies property tree branches (ignoring aliases);
reviewed and OK'ed by Andy
2005-12-16 20:25:52 +00:00
mfranz
523b81e317 globals.nas: add _setlistener wrapper (needs to be used in INIT style
functions when used in $FG_ROOT/Nasal/*.nas, because it
             depends on props.nas being available; no restrictions in
             aircraft files, where it will proof most useful

gui.nas:     replace inefficient FPS display polling loop with listener
             callback
2005-12-16 19:15:08 +00:00
mfranz
df6d7171a6 - fps.xml: revive the traditional font color (a bit brighter than pure red)
- gui.nas: use 4-space indents like the rest of the file; waste slightly less
           cycles: checking for the property shouldn't be done in a loop at
           all, it only serves as a temporary solution
2005-12-16 12:14:43 +00:00
mfranz
fbd735408d implement frame rate display as transparent & draggable dialog
(ordered by Curt as Christmas present :-)
2005-12-15 22:00:31 +00:00
mfranz
defedcc961 use <hrule> instead of fake line; clean-up 2005-12-11 15:38:35 +00:00
mfranz
b8886814ec Access menu entries by their name. This way we can avoid fragile absolute
paths. (The label text isn't suitable for this, because it's subject to
translation.)
2005-12-09 10:34:43 +00:00
mfranz
7e982f91c2 disable "Autopilot" menu when using KAP140 2005-12-08 22:51:23 +00:00
mfranz
9af4695c3c - enable "Fuel & Payload" menu entry when YASim FDM is used
- indentation fix
2005-12-06 17:57:41 +00:00
andy
8a3d81fe0e Architectural fix allowing the "tip" popups (FOV, view name, etc...)
to pop themselves down while the simulator is paused.

The problem was with the "real time" queue in the event manager,
causing the third argument of Nasal's settimer() (a flag for "sim
time") to be ignored.  Inverts the default sense of the argument, as
there are lots of uses of settimer() in the current code, almost none
of which want to use real time.

Note this fix introduces a header file incompatibility in SimGear --
be sure to update.
2005-11-09 20:35:07 +00:00
mfranz
7a3799a241 use gui-redraw fgcommand 2005-11-09 17:17:51 +00:00
mfranz
a3984ccabd make <Esc> key close/cancel/dismiss dialogs; some material.nas tweaking
(Reminder: --aircraft=bo105 ... press Ctrl-C  :-)
2005-11-05 14:19:53 +00:00
mfranz
7f25352610 add support for removeChildren(): takes one name as optional argument
and removes all children with this name; if no name is given, removes
all children
2005-10-23 16:09:51 +00:00
mfranz
8c1e2a6499 make hrule thickness consistent with all other dialogs 2005-10-21 15:36:33 +00:00
andy
ca5982c16c From Vassilii Khachaturov: pop up a user-visible dialog when the FDM doesn't
support dynamic fuel/W&B.
2005-10-18 20:15:04 +00:00
curt
4100dc0f7b gearDown() expects a number either < 0 or > 0 to specify the direction of
gear movement.  gearToggle() was sending either a 0 (not handled) or a 1.
Change gearToggle() so it sends either -1 and 1 so gearToggle() will work
again.
2005-09-09 01:41:08 +00:00
mfranz
dc45f751bf - consider F10/F9 key changes in help screens
- put hrule under titlebar
2005-07-13 11:30:32 +00:00
mfranz
02ca61961d allow to cycle through available styles 2005-07-13 10:56:42 +00:00
mfranz
0f97cfccdf slightly more effective stop() method 2005-06-30 00:18:20 +00:00
andy
f1c70da6d4 Fix interpolate() so that interpolate("/prop/name") freezes the
interpolation at the current value.  This was always a feature of the
C++ code, but the Nasal wrapper couldn't handle the empty argument
list.
2005-06-29 23:58:58 +00:00
mfranz
17166921c0 - rename controls.stepFlaps() to controls.flapsDown(), because:
- to support "old-style" gear/flap control (operation as long as button
  pressed/lever pushed -> b29/hurricane), let bindings not only report
  up/down, but up (-1), stop (0), down (1).
- let controls.flapsDown() ignore "stop" so as to remain compatible with
  prior behavior
- adapt all joysticks/aircraft (sigh)
- some minor cosmetics in joystick configs, such as indentation fixes
2005-06-22 13:08:01 +00:00
mfranz
1988fbb089 Jim Campbell: add carb-heat axis support 2005-06-20 16:52:58 +00:00
mfranz
f4a90a615e add controls.gearToggle() convenience function; adapt all joystick files
to new controls function
2005-06-16 07:59:33 +00:00
mfranz
7cc31829a3 add one level of indirection for gear down/up and use that in all bindings,
so that aircraft with special requirements (hurricane) can simply redefine
controls.gearDown() without breaking all joystick setups
2005-06-16 07:36:54 +00:00
andy
57eea1be61 Melchior needs an equivalent of Perl's defined() function to test for
double-initialization of joystick blocks.  So here it is.
2005-06-12 18:17:00 +00:00
mfranz
b2348ece53 consider changed "material" animation syntax, ignoring the transparency's
new factor/offset properties for now
2005-05-24 12:11:31 +00:00
mfranz
4d185f250c - add gui.Widget.setFont(name, size=13, slant=0) method, and use it in
material.nas (fly the bo105 and press Ctrl-c to see font & color changes)
- use new Nasal feature:  i=i+1 --> i+=1
2005-05-03 13:45:33 +00:00
mfranz
c1be4e53b2 add gui.Widget.setColor() method: takes red/green/blue as mandatory, and
alpha value as optional argument (default: 1)
2005-05-02 16:00:13 +00:00
mfranz
7cecba5024 add 'condition' setter, analogous to 'mixture' etc. 2005-04-21 14:39:00 +00:00
mfranz
da9b28ea6e consider new keys: w/W is now +/- warp, while m/M is richer/leaner mixture 2005-04-20 12:19:27 +00:00
ehofman
ec8742bd65 Melchior FRANZ:
Implement simple help system with global and aircraft specific dialogs:

The gui.nas changes have been discussed with Andy. All ac have a help dialog,
but some are empty. (This wouldn't have been necessary, as the system falls
back to the "Common Aircraft Keys" if an aircraft has no help defined, but an
empty dialog is less confusing and encourages to be filled with interesting
information.   :-)    I scanned all aircraft files for interesting performance
data and added some to the dialogs (stall speed, etc.) The Concorde and the
p51d have (over?)complete dialogs and can serve as examples. The format is
documented in $FG_ROOT/Nasa/gui.nas.

There is also a couple of other, minor fixes.

The following files have ugly MSDOS line endings:

  $FG_ROOT/Aircraft/Hunter/hunter{-2tanks,}-set.xml
  $FG_ROOT/Aircraft/A380/A380-set.xml


The Concorde-jsbsim.nas file is a useless copy of the real */nas file, which is
in Nasal/. I'was debugging the Concorde and wondered why changes to this file
had no effect ...
(Fixed Concorde in the help-ac.diff patch: don't use "interpol" keyword as
variable.)
2005-04-19 13:43:44 +00:00
ehofman
ca224d0ea3 Melchior FRANZ:
- lights are by default off (what was I thinking?!?)
- setters return "me" reference by default, for easier code obfuscation:
  foo = aircraft.light.new("/foo").prop().switch(1);    :-)
- a few mebmers renamed; light.set() -> light.switch(); nodes are named *N
  to avoid collisions and to show relations (switch() <-> switchN)
- yet more (too much?) documentation
2005-04-06 08:18:06 +00:00
curt
b2efcab662 Take advantage of a recent nasal change to simplify a boolean condition. 2005-03-30 19:04:53 +00:00
curt
b0862aa5db A small fix to track latest nasal changes. 2005-03-30 17:00:50 +00:00
ehofman
a978a79d16 Melchior FRANZ:
- light class added (for lights and other pulsing/blinking objects)
- fixed and improved documentation
- all property args may be path strings or nodes
- existing nodes aren't overwritten any more
- better naming of class vars (for outside access)

Tested with the bo105 (which I fully ported to use aircraft.nas) and
the fokker70 (which are the only aircraft using the new classes  :-)
2005-03-30 09:53:00 +00:00
ehofman
39c82918cd Melchior has already a nice collection of animation type nasal classes. These will be converted in a Nasal toolbox so everybody can use them without reinventing the wheel. 2005-03-29 11:26:49 +00:00
ehofman
d0f032bf73 Melchior FRANZ:
Re-organisation: <diffuse>, <ambient>, <emission>, <specular> are
now groups with members <red>, <green>, <blue>, <factor>, <offset>,
and their <*-prop> forms. Additionally, there's an option <property-base>
that can be used to set a path that is prepended to all <*-prop> paths.
It defaults to an empty string. Rationale: see model-howto.html.
2005-03-28 09:15:07 +00:00
andy
4718f2f8f0 Fix broken getPath() method 2005-03-27 17:30:51 +00:00
andy
ca0fa1c427 Changes from Melchior to make use of the spiffy new format feature in
the text widget; and a props.getPath() method.
2005-03-26 22:15:26 +00:00
ehofman
7eb3327565 Melchior FRANZ:
Changes:

o new skids (yet again)
o sun shield for the panel
o beautified exhausts
o new door handling:
  "d"      ... toggle selected door (default: pilot door)
  "D"      ... select next door (indicated with popup)
  "Ctrl-d" ... remove selected door if opened (all bo105 doors can easily
               get removed in RL; it is even flown without doors!)
o dropped shadow boxes (once necessary workaround for the disappearing
  shadow problem, and the reason why the bo105 was so tiny in fgrun)
o automatically selects the emblem of the national Red Cross/Red Crescent
  society on startup
o 5 variants, that can be switched at runtime, with different emblems,
  colors(!), and extra equipment:
  "c"      ... switch to next variant
  "C"      ... pop-up material dialog, as a demonstration of the new
               "material" animation, well ... and for entertainment
               purposes  :-)


The bo105 was and is a testbed for the "material" animation. It uses one to
change a texture at runtime. This has the advantage, that only the currently
selected texture uses up memory (unlike the textranslate method), and it
saves a lot of disk space because it doesn't duplicate all textures (unlike
the current <texture-path> method. You can change the texture in the browser:

  http://localhost:5501/sim/model/bo105/material/emblem/texture
  (choose one of: emblems/{red-cross,red-crescent-[lr],star-of-life}.rgb

(the built-in property browser doesn't grok it, because I used quite long
path names. Needs to be fixed in the GUI.)

I suggest to add the material.nas file to the global Nasal/ dir, not only
because the bo105 update expects it. The Nasal module creates a dialog for
material editing, which is quite useful for development purposes, for gaining
better understanding of the OpenGL color properties, and finally: it's fun.

   http://members.aon.at/mfranz/material.jpg  [45 kB]

The dialog needs to be initialized with a property dir where material
redirects are placed. It isn't available from the menu, but may be useful
for other aircraft. Also, it's quite small and doesn't get in the way.
If people want it removed, I can still move its contents into bo105.nas.
The bo keyboard binding says:

   material.showDialog("/sim/model/bo105/material/fuselage/", "Bo105");

This is documented on top of the *.nas file.
2005-03-22 13:16:59 +00:00
curt
a9c8aeac7e Moved file to it's own aircraft specific directory so it doesn't waste
resources for everyone.
2005-02-15 18:02:06 +00:00
curt
5b34a96a12 Fix some property names. 2004-12-30 21:11:29 +00:00
curt
a355aa410d More /radios -> /instrumentation property name changes. However, we are still
missing something because the nav1 and nav2 are still inop.
2004-12-04 20:37:04 +00:00
curt
71bfe3a4db Move the kr-87 adf from /radios to /instrumentation 2004-11-19 23:56:47 +00:00
curt
565e8aafba Make the comments match reality. 2004-11-19 23:04:32 +00:00