1
0
Fork 0
Commit graph

380 commits

Author SHA1 Message Date
mfranz
faf9ea862d implement writexml() function for writing non-standard XML files
(that is: such that don't use PropertyList as root element and have
data hidden in attributes)
2007-07-01 15:05:16 +00:00
mfranz
122423aa2b - make io.readxml() a lot faster
- documentation update
2007-06-30 11:06:36 +00:00
mfranz
7b1ac37678 add readxml function that reads an XML file and returns it as property tree 2007-06-29 15:49:08 +00:00
mfranz
968c517a71 bye ... we have a Nasal interface to the built-in EasyXML parser now 2007-06-29 15:44:15 +00:00
mfranz
2e9c693e67 use geodinfo() function to retrieve the terrain elevation for a coordinate 2007-06-23 15:28:08 +00:00
mfranz
43d6e707bb minus can't be delimiter in a [] range 2007-06-22 20:41:00 +00:00
mfranz
cfd9c1b48f pointless spelling fixes 2007-06-22 18:49:38 +00:00
mfranz
248d4fcf60 - fix behavior for broken input
- more documentation
2007-06-22 17:52:37 +00:00
mfranz
f827653668 - create new Nasal module string.nas with simple shell style pattern matching
algorithm (needed for the file selector and useful for other purposes, like
  assembling lists of livery or screenshot files etc.)
- io.nas: move fixpath to string.nas (it's not only useful for file paths
  but can also be used for property paths)
- screen.nas: move trim to string.nas (used by screen.nas and nasal-console.xml)
- gui.nas: add pattern matching to FileSelctor
- ufo.nas: use patterm matching (only *.ac and *.xml files shall be listed)
2007-06-22 14:13:30 +00:00
mfranz
44cbca565d add ghost(type) output, just like nasal/lib/debug.nas :-) 2007-06-21 20:00:21 +00:00
mfranz
ce356a350e don't multiply with nil 2007-06-20 15:16:29 +00:00
mfranz
fa820545b7 livery: need to set name for standard dialogs separately 2007-06-18 15:34:36 +00:00
mfranz
b96c113765 always the same module dependency problems ... sigh 2007-06-18 15:15:16 +00:00
mfranz
ce70468d73 - fix Coord.latlon() method (output degree instead of radian to be consistent
with Coord.lat() and Coord.lon(), and because this is the preferable unit
  in script space)
- add put_model(<path>, <coord> [, <hdg> [, <pitch> [, <roll>]]]) variant,
  which takes a Coord instead of <lon>/<lat>/<alt>). Here's some inspiration:

  setlistener("/sim/signals/click", func {
      geo.put_model("Models/Fauna/cow.ac", geo.click_position(), 360 * rand());
  });
2007-06-18 11:06:10 +00:00
mfranz
870830b4a7 - import asin/acos/mod from the new math.nas
- drop parentheses where not necessary (looks cleaner :-)
2007-06-18 10:33:37 +00:00
mfranz
b2750d8a05 adapt for geo.nas changes (swapping lon & lat) 2007-06-18 10:23:14 +00:00
mfranz
32616f42a0 swap lon & lat everywhere. lat/lon is illogical, but unortunately a kind of
standard.  :-(
2007-06-18 10:22:17 +00:00
mfranz
31eff644c1 - add setters to the gui.FileSelector, so that title/button text/dir/file/
dotfile flag can be set later (and take effect after the next open())
- add Alt-".." binding: change to $PWD (which is the default starting dir)
2007-06-17 22:56:22 +00:00
mfranz
10ca74fc83 - make dir entry an input field
- make title & button text separately settable
- sequential numbers for clones rather than random numbers
2007-06-17 15:27:33 +00:00
mfranz
e91115e328 Maik JUSTUS: use geodtocart() and carttogeod() functions, rather than
simplified conversion based on a spheroidal Earth
2007-06-16 18:26:06 +00:00
mfranz
59c303bcc1 add printerror() function that prints error vectors as set by call() 2007-06-16 08:21:39 +00:00
mfranz
75a2b57a83 - move dialog registration to the Dialog class
- fix documentation
2007-06-15 16:22:13 +00:00
mfranz
57b8debf7e - Dialog: add optional third arg: dialog name (by default taken from the
dialog's <name> entry)
- FileSelctor: new class derived from Dialog. It clones the file-select
  dialog and reports chosen files/dirs via callback function.
2007-06-14 23:19:43 +00:00
mfranz
183672f8a2 - don't prepend slash on relative paths or archaic paths with drive letters
- documentation updates
2007-06-14 11:26:16 +00:00
mfranz
0fed31d7b7 - fixpath: don't need to remove leading/trailing slashes "manually"; that's
a side effect of the stack loop already
- replace all backslashes by slashes, to avoid security problems on UNIX
  (if support for them is desirable on MS Windows, then we'd need an OS
  property)
2007-06-13 20:31:09 +00:00
mfranz
120d09b5e6 Andy ROSS: functions to check for stat()[2] flags, such as isdir()
mf: fixpath(): function to normalize file paths (doesn't handle escaped
    characters yet)
2007-06-13 16:46:41 +00:00
mfranz
d9910b27e7 simplification 2007-06-12 22:08:18 +00:00
mfranz
3c73eaa45f documentation update and cosmetics 2007-06-12 21:27:48 +00:00
mfranz
4c2ded3509 throw out load_xml_nasal and implement load_nasal(<file> [, <module>]);
This can be used to load and run Nasal code at runtime (without need
for an XML frame).
2007-06-12 19:13:28 +00:00
mfranz
a1fd54cfdf aircraft.nas, gui.nas: adapt loadxml for absolute paths, drop second fgcommand arg
debug.nas, tutorial.nas: adapt for abs. paths
fuel.nas: cleanup
screen.nas: don't remove listeners -- that's done automatically by removind
    the node in NasalSys.cxx
xml.nas: minor documentation fix
2007-06-12 16:20:55 +00:00
mfranz
39ee6cff4f fix backtrace() (probably broken since the last Nasal update) 2007-06-10 20:31:33 +00:00
andy
30502189d8 The screen-capture command no longer pops up a dialog, so toss up a tip
from within the F3 keybaord handler instead.
2007-06-07 16:59:07 +00:00
mfranz
0fcdafe2aa add autotrim class to help with trimming (read the class documentation for
an explanation). There's no button/key using this by default (yet?).
2007-06-07 10:12:03 +00:00
mfranz
71fa47d99d drop clumsy handling of temporary file data branch, and use the "savexml"
fgcommand's temporary <data> argument branch instead
2007-06-06 21:40:47 +00:00
mfranz
c050b436fa livery handling: add sort option and next()/previous() methods 2007-06-05 14:21:12 +00:00
mfranz
95caf1a918 add livery singleton class that maintains livery XML files.
TODO: allow explicit sorting (currently only alphabetic) and add next()
      and previous() methods
2007-06-04 13:45:23 +00:00
mfranz
6cb769ebf7 in addition to aircraft dialogs from arbitrary paths also allow gui.Dialog
to handle regular dialogs from $FG_ROOT/gui/dialogs/.
Example:   var fps = gui.Dialog.new("fps"); fps.open(); fps.close();
2007-06-04 12:42:29 +00:00
mfranz
fef7057bfc flyby: don't choke on <view>s without <name>, even though these are bugs 2007-06-03 20:54:31 +00:00
mfranz
9a37371eaa document geo.put_model() 2007-05-31 20:19:26 +00:00
mfranz
eb1e986889 whoops ... no comment 2007-05-15 20:46:59 +00:00
curt
203c61aaa1 Minor cosmetic changes. 2007-05-15 16:07:15 +00:00
mfranz
bec64d9c9e s/play-audio-message/play-audio-sample/ 2007-05-15 14:40:58 +00:00
mfranz
436bf87c54 debug.benchmark(): helper function that prints the system time in seconds
for the given function call
2007-05-14 16:28:53 +00:00
mfranz
a9b9c86750 - add Node.getValues() in analogy to Node.setValues(). Returns a hash with
all children, vectors for multiply used names, further hashes for subtrees
  etc. Meant for quickly pulling in config branches where (almost) all values
  are needed.
- usage of "var" keyword and named parameters in other (but not all) funcs
2007-05-14 15:15:00 +00:00
mfranz
02b4dc58e8 geo.nas:
- add put_model() function to place models at given lon/lat. If
  elevation is nil, then it will be put on the surface. The path is
  relative to $FG_ROOT.
- let geo.click_position() and geo.aircraft_position() return copies
  of the Coord class, not just a reference

view.nas: adaptation for geo.nas change; minor changes
2007-05-12 18:38:57 +00:00
mfranz
1a19f8a8e5 - make viewReset reset fly-by view
- cleanup
2007-05-11 21:16:35 +00:00
mfranz
874d55b6e7 simplify by using the props.Node.setBinding() method 2007-05-11 19:02:20 +00:00
mfranz
5f97465d6e - make view_manager singleton class
- simplify lookat wrapper with a call()
- cosmetics
2007-05-11 18:59:34 +00:00
mfranz
47d675bfd5 - make the HUD and the data class singleton classes
- use var everywhere, cosmetics
2007-05-11 18:04:51 +00:00
mfranz
c54fbb1e39 _c should be a valid function from the beginning 2007-05-11 18:03:44 +00:00
mfranz
d92ae39349 - skip DOCTYPE
- optional attr prefix in xml.dump
2007-05-11 15:44:16 +00:00
mfranz
8befda2655 whoops ... forgot one "arg" fix 2007-05-10 17:37:28 +00:00
mfranz
e22a4086ff "fixed" the "arg bug". (Wasn't really a bug, just old-style Nasal code
that doesn't work with new nasal. :-)
2007-05-10 17:33:28 +00:00
mfranz
80fd0740e5 new commands:
debug.color(bool)                 turns terminal colors on/off
  debug.tree(property="", mode=1);  dumps property tree in flat
                                    mode (0) or space indented mode (1).

Flat tree mode is similar to props.debug(), but colored, and it outputs
all attribute flags and the number of attached listeners.
2007-05-09 17:31:45 +00:00
mfranz
3b6a79ee8b - use Nasal's rethrow capabilities
- remove redundant lines
2007-05-08 22:21:34 +00:00
mfranz
072610c001 aircraft.steering: redefine the controls.applyBrakes() wrapper, too.
If this isn't what the aircraft developer wants, then s/he can still
redefine it again afterwards.
2007-05-08 14:22:54 +00:00
mfranz
6b533c19a9 add class that implements differential braking with rudder input 2007-05-08 09:52:13 +00:00
mfranz
f7a9ef4d37 - use heading instead of last course (works better in curves)
- stop at crash
2007-05-05 21:36:31 +00:00
mfranz
d225de2aea fix behavior for begin and end of replay 2007-05-05 15:07:54 +00:00
mfranz
c13914937e make "terrain-elevation" wrapper more efficient 2007-05-05 10:09:13 +00:00
mfranz
d4e030f9c6 - don't update when aircraft stays within threshold distance
- randomize left/right, better parameters
- don't reset on pause
2007-05-04 22:48:40 +00:00
mfranz
66f9e552ba - first stab at fly-by view mode
- hack for the panView functions: work in paused mode, too!
2007-05-04 18:01:26 +00:00
mfranz
9785ce8e36 - make stepView robuster and view order changeable (via view.views vector)
- de-classify view.point
2007-05-04 17:19:31 +00:00
mfranz
9f1bc7efeb add "terrain-elevation" utility function 2007-05-03 22:09:34 +00:00
mfranz
d9b0226d30 - add process_file() function (still reads the whole file into memory)
- handle "processing instructions"
- don't gobble leading spaces in non-cdata data sections
- minor fixes, cosmetics, documentation changes
2007-05-03 15:56:59 +00:00
mfranz
af56aed55e simple xml parser that allows to read non-fgfs-standard xml files such as
those from traffic manager and AI, so that it will later be possible to
load the data into the UFO Scenery Object Editor, to visualize and edit
parking positions, taxiing routes etc. The parser also allows to suck
arbitrary (simple) XML data files into fgfs from Nasal context.

In the long run the non-standard XML files in fgfs shall, of course, be
converted to standard format, in which no data may be stored in attributes.
2007-05-02 20:55:54 +00:00
mfranz
24b8156e9f HUD: only consider i/I/H presses when a HUD is displayed 2007-05-01 19:36:41 +00:00
mfranz
1e446a26ae setlistener(): don't drop calls with invalid property -- the c++ side
outputs a nice error message in this case
2007-04-27 15:52:54 +00:00
mfranz
944e6a8548 in debug levels "debug" and "bulk" output listener id, file name, and
line-number for every setlistener() wrapper call. This allows to identify
listeners later by their id.
2007-04-27 14:27:01 +00:00
sydadams
bafa93e8fd Added volume control to the atc-chatter 2007-04-19 04:42:20 +00:00
mfranz
47f5e58005 can't hurt to initialized light.endstate (state after number of sequences) 2007-04-06 21:53:46 +00:00
mfranz
5471f0cd5b - remove hack around Nasal bug, which is already fixed
- add second optional argument to light.blink() method, which
  defines which state should be set after the end of the sequences
  (defaults: 0)
2007-04-06 21:33:22 +00:00
mfranz
c331a49dea add optional argument to blink() method:
blink()  ... set signal generator to unlimited blinking
blink(3) ... set signal generator to blinking only 3 sequences
             after turning the switch on.
2007-04-06 20:03:47 +00:00
mfranz
38c170baa5 props.copy: add third argument that, if set, also copies the node attributes 2007-04-04 14:44:13 +00:00
mfranz
2893846dea - add <abort> group (like <exit> but works when <error>s are still made)
- rename <interval> to <wait>
- add <step-time> and <exit-time> on the <tutorial> level for default
  step iteration and exit time
- let <init>, <step>, <error>, <end>, <abort> share handler for
  <marker>, <set>, <view>, <nasal>
2007-03-30 20:24:26 +00:00
andy
3bcfb0624a Add soft-coded utilites to the "io" and "math" modules. The math
stuff is, for the most part, already available in the geo module; but
it's small and this naming matches the evolvoing "standard nasal
library".
2007-03-29 22:09:25 +00:00
andy
3bcb193cb9 Fix symbol lookup issue via a caller() hack. Not sure what the
underlying problem is, but this allows fpsDisplay() to be called both
as a command handler and as a function.
2007-03-29 19:32:59 +00:00
mfranz
de80a63ae6 don't rely on the existence of an "arg" pointer 2007-03-29 18:39:10 +00:00
mfranz
abaa43a1a5 add function to reload Nasal module at runtime. Very convenient for
development. The file must be an XML file with Nasal between a
header/footer. It's a good idea to give it a *.nas extension, so
that editors choose the Nasal syntax coloring.

  <PropertyList><script><![CDATA[

  ... here goes the Nasal code ...

  ]]></script></PropertyList>
2007-03-29 15:00:04 +00:00
mfranz
88b81056e1 - make fuel checkbox/slider "live"
- add two dialog helper functions dialog_apply() and dialog_update()
2007-03-29 14:50:27 +00:00
mfranz
44bb7bb192 reload XML dialogs on gui-reinit 2007-03-28 20:35:12 +00:00
mfranz
6fdf07b79e reverting; just saw why I hadn't turned it on 2007-03-27 18:02:12 +00:00
mfranz
bf1f438380 make the screen.log window keep the position it was dragged to 2007-03-27 17:48:16 +00:00
mfranz
bcb244be92 use <hrule/> without dummy children 2007-03-26 15:26:23 +00:00
mfranz
c09c7ac5c6 When loading a dialog, first close it, then remove the whole branch,
then load, and finally open the dialog again if it was open at the
beginning. That way it's easy to edit and to update a Nasal-loaded
XML dialog.
2007-03-25 10:00:53 +00:00
mfranz
7a300fca3e add tutorial loader function for AJ :-) 2007-03-24 23:28:41 +00:00
mfranz
269396c421 - remove tutorial dialogs from gui.nas and create a new XML dialog
$FG_ROOT/gui/dialogs/tutorial.xml. It combines the former selection
  and description dialogs, which makes browsing much more pleasant.
  No more switching back and forth between the two old dialogs. Also,
  the <list> box can handle a bigger number of tutorials than the
  <combo> box could.
- remove comments from the top of tutorial.nas. The documentation is
  now $FG_ROOT/Docs/README.tutorials
2007-03-24 20:56:40 +00:00
mfranz
b47f8f439d change <marker><[xyz]> to <marker><[xyz]-m> (for consistency with the
animation syntax, and to make tutorials noisier and harder to read :-)
2007-03-24 18:10:33 +00:00
mfranz
44305607b3 - s,/sim/tutorial,/sim/tutorials,
- add a <delay> property that can be used at top level (for the default),
  and in <init> and <step>  (Time in seconds in which the main loop should
  run again.)
- fix initialization bug
2007-03-24 13:39:01 +00:00
mfranz
7f375cf76c s,/sim/tutorial,/sim/tutorials, 2007-03-24 13:32:15 +00:00
mfranz
10093284ba If text contains "{display|voice}" groups, skip the delimiters and discard
the "voice" part. It's no longer possible to display the three letters {|}
in screen message at the moment, but they aren't overly useful. We may want
to support escaping in the future, if necessary.
2007-03-23 15:56:34 +00:00
mfranz
03ba6e2b80 - now *really* disable marker on stopTutorial()
- add target heading
2007-03-23 10:58:15 +00:00
mfranz
8a288f59c2 calculate "Estimated Time of Arrival" (ETA) in minutes for each <target>.
Negative values show that you are actually moving away. To avoid division
by zero, a small value is always added to speed. So, if you aren't moving
at all, you still get a non-infinity, but huge ETA.
2007-03-22 22:10:55 +00:00
mfranz
ef9caa1310 - <targets> can have arbitrary names
- <set> pair: allow to set <property> from <value> or second <property>
- support <set> pairs in <end>, too. This can be used to restore values.
- add optional <view> to <init>/<step>/<exit>/<end>. This is meant for
  cockpit tutorials. See the Lightning's startup tutorial for an example.
2007-03-22 17:08:05 +00:00
mfranz
9a0600b150 - replace "sprintf hack" by real sprintf
- add view manager for saving/restoring and moving/interpolating view
  axes & fov to absolute values. This is used for cockpit tutorials in
  $FG_ROOT/Nasal/tutorial.nas
2007-03-22 16:22:41 +00:00
mfranz
0606fa3703 make condition() slightly faster and prettier (or not) 2007-03-21 18:37:06 +00:00
mfranz
54693a663f - fix <audio> bug
- check a step's errors in random order (otherwise a retarded instructor
  bitches minutes about the climb angle, and only then notices that the
  heading is totally wrong ;-) ... mabye simple scheduling would be better
- document embedded <nasal>
- start of <view> support
2007-03-21 17:31:26 +00:00
mfranz
b482f5d852 - add <target> feature: for each defined <target> lon/lat pair, corresponding
entries /sim/tutorial/targets/target[n]/{distance-m,direction-deg} are
  provided and kept up-to-date. A direction angle of 0 means that the target
  is straight ahead, 90 means it's to the right (3 o'clock) 179 means the
  target is right behind, etc.

- everywhere where <message> and/or <audio> is supported, there can be more
  of those entries, in which case one is randomly chosen. This is to make
  the instructions less monotone:

  <message>You are too fast. Fly at 100 knots.</message>
  <message>Not so fast. 100 knots are more than enough.</message>
  <message>Slower! Idiot!</message>                                  ;-)
2007-03-21 00:21:51 +00:00
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