1
0
Fork 0
Commit graph

1124 commits

Author SHA1 Message Date
mfranz
2b77665c22 setCursor: complain and show options if wrong cursor name was given 2008-11-20 23:03:24 +00:00
mfranz
8d7545252f convert more initNode to the method version (sorry, had forgotten these) 2008-11-20 22:06:54 +00:00
mfranz
f263e693f2 remove deprecated (wrapper) function props.initNode() 2008-11-20 20:41:19 +00:00
mfranz
55b7e3d8e0 dynamic_view.nas: use D2R/R2D constants
globals.nas: move constants to top
geo.nas: fix comments & make bucket_span "private"
2008-11-20 20:18:39 +00:00
mfranz
c74d6ee75e - make props.initNode a props.Node method
- props.nas: some minor improvements
2008-11-20 19:45:40 +00:00
mfranz
55c34a0748 calculate M2FT from FT2M (of course :-) 2008-11-20 11:33:42 +00:00
mfranz
eebfdf218c - make constants D2R, R2D, M2FT, FT2M global
- geo.put_model: use 'add-model' fgcommand
2008-11-20 11:24:46 +00:00
mfranz
dcb1321923 make constants D2R, R2D, M2FT, FT2M global 2008-11-20 11:24:45 +00:00
mfranz
9976b71472 init: make sure /sim/tutorials actually exists 2008-11-15 19:40:28 +00:00
mfranz
81e967a609 nasal now returns constant and readable ghosttypes, so we do no longer
need the symbol table and comparison with the ghosttype of props._globals()
2008-11-13 12:00:23 +00:00
mfranz
c6cd898f64 - update comment to reflect alias()/unalias() addition
- minor improvements & cosmetics
2008-11-13 11:57:07 +00:00
mfranz
2aba6e7d80 Node: only wrap() functions that actually return property ghosts 2008-11-12 17:06:53 +00:00
mfranz
547770e30b add alias()/unalias() wrapper methods 2008-11-12 14:43:41 +00:00
mfranz
78d1a6e631 OverlaySelector: check callback function explicitly for nil 2008-11-12 11:43:26 +00:00
mfranz
d1fd61c728 gui.nas: use nasal-dir-initialized signal for INIT func, so that it's
earlier available. (The settimer/1 was a workaround for another
    problem that should be fixed by now.)
globals.nas: load $FG_HOME/Nasal/ files as first settimer(0) function,
    so that it always comes after all nasal-dir-initialized callbacks

This should fix the glide_slope_tunnel/popupTip bug and makes the
startup order clearer and cleaner.
2008-11-11 14:54:51 +00:00
mfranz
05cc0f3fda add complementary function to bits.string(): bits.value() This is rather
pointless for running fgfs, but can be useful for development and debugging,
and it's just a few lines.
2008-10-25 15:03:32 +00:00
mfranz
6384588444 I said "correctly". 2008-10-25 14:24:26 +00:00
mfranz
f7bd13fed3 debug.dump(): print empty strings as hash key correctly 2008-10-25 14:20:47 +00:00
mfranz
6371627424 bits.string: add optional zero-padding 2008-10-23 22:16:32 +00:00
mfranz
97c1ec0ac7 set: bugfix (invert test; still faster than the old version :-) 2008-10-22 23:27:03 +00:00
mfranz
f5ab1de0b6 set/clear: shorter & a few nanoseconds faster 2008-10-22 23:04:07 +00:00
mfranz
464d9d3f75 add bits.toggle() and bits.switch() 2008-10-22 20:56:22 +00:00
mfranz
80215e0731 "export" bit vector & cleanup 2008-10-22 14:02:58 +00:00
mfranz
6003c3a17d bits.test: remove silly loop 2008-10-22 13:26:55 +00:00
mfranz
6d5585ec65 restore simple bits functions. Useful for setting/testing boolean values
inr MP transport, and for setting/clearing modifier bits in js config files.
2008-10-22 12:49:01 +00:00
mfranz
2f76461c8c io.nas/stat: drop use of broken bits library
gui.nas/OverlaySelector: me.data is no longer a node; only sort once
2008-10-21 21:37:41 +00:00
mfranz
0bd5bc58a7 livery: documentation fix 2008-10-19 21:12:57 +00:00
mfranz
c5fe446f58 overlay-select.xml, gui.nas: fix overlay-dialog close(); add relpath() func
aircraft.nas: remove redundant data.add()
2008-10-19 12:34:09 +00:00
mfranz
94211721cf livery: fix bad default nameprop (must be relative) 2008-10-19 11:55:52 +00:00
mfranz
32bf0f7265 gui.nas: remove trailing slashes in nameprop/sortprop
aircraft.nas: add generic overlay_update function, and make livery_update
         a wrapper for it
2008-10-19 11:52:56 +00:00
mfranz
da7d1ded71 aircraft.nas: make aircraft.livery a wrapper for gui.OverlaySelector
gui.nas: add file name to stored data (needed for MP-livery)
2008-10-16 15:26:19 +00:00
mfranz
a021ab0af0 - aircraft.nas: remove formation class (Deprecated only three hours ago.
Is this fast development, or what?! :-)
- gui.nas: remove debug message
2008-10-15 18:14:54 +00:00
mfranz
181dbba72c OverlaySelector: more robust path handling 2008-10-15 16:48:24 +00:00
mfranz
c350a7b6a8 s/fixpath/normpath/ (as in python) 2008-10-15 16:35:11 +00:00
mfranz
8c7e7cb994 OverlaySelector: add callback func arg; only store the file paths 2008-10-15 16:13:10 +00:00
mfranz
5d576f0e3d - gui.OverlaySelector: add optional sort criterion, add selection by index,
add next(), and previous() methods.
- aircraft.nas: deprecate formation class
2008-10-15 15:27:56 +00:00
mfranz
6a72126327 OverlaySelector: don't autosave choice. That's easy enough to do "by hand". 2008-10-14 18:48:54 +00:00
mfranz
4341781968 add overlay selector dialog class (similar to the livery selector) 2008-10-14 18:41:19 +00:00
mfranz
782368fefa documentation update and cosmetics 2008-10-09 17:20:27 +00:00
mfranz
b1017ac425 Vivian MEAZZA: tyresmoke: add spray flag/intensity for wet surfaces 2008-10-08 22:57:50 +00:00
mfranz
996fd73c0c - let F12 pop up radio settings dialog (used to be Ctrl-r)
- disable "reload global preferences", which is semi-broken
2008-10-08 21:59:31 +00:00
mfranz
ce0504cfd4 - move development functions from function keys to :Y (multikey)
- move replay from 'r' to 'Ctrl-r' where it is less dangerous
2008-10-07 20:13:34 +00:00
mfranz
3ba03ff2d7 AJ MacLEOD: add braking chute wrapper function 2008-10-07 19:22:49 +00:00
mfranz
363e210fda - typeset longer option lists in multiple columns
- make it a tad faster
2008-10-07 10:44:45 +00:00
mfranz
fe8f9134ec fun hack to get useful error message 2008-10-06 23:21:54 +00:00
mfranz
d9b5505a39 load_nasal(): hack around new Nasal bug 2008-10-06 21:21:13 +00:00
mfranz
77480233a6 ok, and now really fix it :-P 2008-10-06 20:22:28 +00:00
mfranz
459add7acb d'oh ... s/setlistener/_setlistener/ 2008-10-06 20:12:50 +00:00
mfranz
757b64a2c3 tyresmoke: s/getNode/getChild/ 2008-10-05 23:35:02 +00:00
mfranz
c56653d203 tyresmoke: make it faster, cleaner, shorter 2008-10-05 23:16:15 +00:00
vmmeazza
f7339eeb22 Add generic tyre smoke - correctly this time 2008-10-05 22:56:44 +00:00
vmmeazza
16818db739 Add generic tyre smoke 2008-10-05 22:41:39 +00:00
mfranz
eab70dccda improve dialog layout 2008-10-05 16:13:13 +00:00
mfranz
adc77f2777 replace all %% 2008-10-04 22:43:24 +00:00
mfranz
437dbf524d aircraft.nas: light: remove backwards compatibility warning
multikey.nas: don't show %% in option display for %
string.nas: scanf: add -1 return mode; documentation
2008-10-03 20:46:08 +00:00
mfranz
e6e1f8ae20 - move color functions from debug.nas to string.nas
- multikey.nas: add exit/no-exit markers to help output
2008-10-03 15:20:12 +00:00
mfranz
597a7d2187 add teleport() function 2008-10-03 10:48:39 +00:00
mfranz
fbd73ee7d3 multikey.nas: don't show empty ("reserved") entries
string.nas: scanf: detect %% correctly
2008-10-03 09:47:40 +00:00
abory
8fcaaf4491 - Alexis Bory: As seen previously with Till, the nasty F-14 radar brakes multiplayer.dialog.show() unless we better test the "valid" node. 2008-10-02 20:12:00 +00:00
mfranz
e561c08c04 - gui.nas: make fuel&payload warning closable with Esc
- multikey.nas: minor clarification in the help output
2008-10-02 15:19:47 +00:00
mfranz
a334ed9e7b add initial slightly greyed out help text about <Tab> options 2008-10-02 11:37:17 +00:00
mfranz
29f7d18865 repair :? help function ... sigh, should never have started with colorizing 2008-10-02 10:43:17 +00:00
mfranz
67c40af00c use patthern tree, offer options on <TAB> 2008-10-02 00:59:52 +00:00
mfranz
3fbb11b27a scanf: don't bark on empty test string if format ends with number element 2008-10-02 00:58:57 +00:00
mfranz
5fd89049bb add field width to %s & coding style 2008-10-01 19:51:44 +00:00
tat
04d90bae5a Added: %s support for scanf 2008-10-01 18:36:09 +00:00
mfranz
283dd67ca8 whoops 2008-10-01 16:39:26 +00:00
mfranz
32c5cde2f0 move improved help screen generator multikey.{xml -> nas} 2008-10-01 16:30:25 +00:00
mfranz
772112df89 use color codes only when printing to the terminal 2008-10-01 14:04:47 +00:00
mfranz
613e693656 Be a bit more careful with the kbd hack ... not that I noticed any problems.
(Proper fix probaly necessary in OSG. On my TODO list.)
2008-09-30 20:41:06 +00:00
mfranz
886cf8b382 also let adjEngControl return value (average of selected engines) 2008-09-30 20:33:18 +00:00
mfranz
b1a3428bd8 make slewProp(), and with it {aileron,elevator,rudder}Trim return new value 2008-09-30 18:11:46 +00:00
mfranz
f5babfe796 s/desc/_/ & cosmetics 2008-09-29 22:39:45 +00:00
mfranz
12412f0a56 does no longer work after the nasal update 2008-09-29 16:37:23 +00:00
mfranz
7274bfe94a s/desc/_/ (binding return variable) 2008-09-29 14:16:50 +00:00
mfranz
1b9f9a2f98 hack around kbd bug for now (eew!) 2008-09-29 13:30:42 +00:00
mfranz
024842d9b9 indendation fix, drop a few braces (because we can :-) 2008-09-29 10:06:50 +00:00
mfranz
df90d69de9 string.scanf(): return elements in vector given as argument; function
only returns success (0: no match, 1: extensible match, 2: safe match)
2008-09-29 10:06:16 +00:00
mfranz
eb11977be2 implementation of vi-like multiple-key commands (as suggested by John DENKER) 2008-09-28 20:28:28 +00:00
mfranz
3197bc3f24 string.scanf(): more efficient and (more :) correct %f detection 2008-09-28 20:23:14 +00:00
mfranz
13a5e62995 scanf: '+' or '-' alone aren't really numbers 2008-09-28 16:20:49 +00:00
mfranz
2ea8466111 steering: vim typo 2008-09-26 22:53:57 +00:00
mfranz
d5605e2280 steering: fix after nasal update 2008-09-26 22:48:48 +00:00
mfranz
3f4df41fc7 add simple scanf function (a.k.a. poor man's regex) 2008-09-26 12:04:57 +00:00
mfranz
bb6b98b306 runBinding: support optional default namespace/module 2008-09-25 11:10:35 +00:00
mfranz
ba68b4f8eb typo & consistency 2008-09-24 23:06:43 +00:00
mfranz
366792cf3d add props.runBinding(<binding-node>) command 2008-09-24 20:03:06 +00:00
mfranz
e354f26a4d add braces to work with Nasal TNG 2008-09-24 19:38:56 +00:00
mfranz
91ab7d4b97 - remove no longer neede complement_runways() function
- s/threshold1/threshold/
2008-09-23 20:08:15 +00:00
mfranz
c047efb41f debug.proptrace: increase the default frame number to get one complete frame 2008-08-17 07:35:27 +00:00
mfranz
a289958717 improve help message 2008-08-16 15:37:54 +00:00
mfranz
917cace77c string.nas: remove forgotten debug message
props.nas: replace some "arg[*]" by named args
aircraft.nas: load aircraft data only if the file exists (to avoid warning)
debug.nas: no space before colon & fixed comment & cosmetics
2008-08-14 22:13:25 +00:00
mfranz
4ac84809e9 nasal: cleanup & minor fixes
- fuel.nas: use props.initNode()
- debug.nas: fix comment
- globals.nas: load_nasal(): check extension and set module arg
- io.nas: update log message (the rules are no longer for io.open() only)
2008-08-10 17:53:41 +00:00
mfranz
51aae20072 screen.nas: evaluate --prop:display when fdm is up, or some props are missed
(you didn't take the "final version" seriously, anyway, did you?)
2008-08-05 12:35:01 +00:00
mfranz
f0463b345f screen.nas: display option (final version)
- use --prop:display=fdm/jsbsim/fcs   to display this node only
- use --prop:display=fdm/jsbsim/fcs/  to display this node's children
2008-08-05 12:20:27 +00:00
mfranz
2823009955 s/live/display/ ... makes more sense 2008-08-05 11:58:43 +00:00
mfranz
1f65d80475 allow to add properties to the live display with --prop:live=/some/property 2008-08-05 11:49:13 +00:00
mfranz
b360c2ad62 use <enabled>false</enabled> flag for widgets that shouldn't be drawn
instead of <hide>true</hide>. This is consistent with other places
in fgfs, like menu entries, hud elements, subsystem switches, etc.
2008-08-05 05:28:27 +00:00
mfranz
2040b96b4f s/show_widgets/enable_widgets/ (the function doesn't show anything) 2008-08-03 15:37:43 +00:00
mfranz
463105bca5 add show_widgets() function 2008-08-03 13:41:07 +00:00
mfranz
49defb639e - load_nasal(): catch usage of improper namespaces (e.g. $FG_HOME/Nasal/isa.nas)
- IOrules: add harmless rule for extremely popular Nasal addon script  :-)
2008-07-30 20:34:52 +00:00
mfranz
443c261cdd - drop redundant log message
- cosmetics: fix mixed tab/space indentation, drop pair of curly braces
2008-07-30 19:33:42 +00:00
mfranz
8202730c4e use io.load_nasal() to load the local Nasal files from ~/.fgfs/Nasal/ 2008-07-30 19:25:27 +00:00
mfranz
ad781922a7 here's a case where we want explicit namespace prefixes everywhere
(just renaming debug.string instead was plan B ;-)
2008-07-30 19:22:36 +00:00
mfranz
78ba60685c some convenience functions for the built-in bits library 2008-07-29 17:17:09 +00:00
mfranz
00475e2d5c - set "archive" flags on all /sim/presets/ children on saving flight, and
- run "presets-commit" after loading
2008-07-29 00:07:18 +00:00
mfranz
ae40faf4e5 cosmetics (comment fixes & improvements, variable name) 2008-07-27 22:00:58 +00:00
mfranz
dec94a9bb4 - fully complement runways (for external callers)
- show id/name of new airport
- use props.initNode()
- cleanup
2008-07-27 21:59:13 +00:00
mfranz
daee426f00 minor reorganization and cosmetics 2008-07-24 17:41:40 +00:00
mfranz
9148a4b2eb cosmetics: white space fix & one "var" added 2008-07-23 19:37:51 +00:00
mfranz
de1aa4c56e finally make printf() globally available 2008-07-23 15:43:45 +00:00
mfranz
93bc59c9a3 update comment 2008-07-23 15:42:43 +00:00
mfranz
f046c00c3d make valdiation listeners safe 2008-07-23 15:42:16 +00:00
mfranz
fee6139da5 partly revert last change: thisfunc() isn't safe enough for this purpose 2008-07-23 00:41:18 +00:00
mfranz
7bbbfa6a8e use thisfunc() instead of caller(0)[1] 2008-07-22 23:26:46 +00:00
mfranz
54e6ec55b4 closure(): better error formatting 2008-07-22 22:50:42 +00:00
mfranz
e522611638 closure(): level is optional and defaults to 0 2008-07-22 22:38:34 +00:00
mfranz
1ad5b18ec8 closure(): must freeze io.open for the comparison 2008-07-22 22:26:09 +00:00
mfranz
dc4b8633a3 new io.open()'s closure musn't get manipulated either 2008-07-22 21:30:47 +00:00
mfranz
3cfc93927f make sure the closure of security code can't be manipulated by wrapping
closure()
2008-07-22 21:23:54 +00:00
mfranz
8b6ff24167 make sure functions used by the security code are tamper-proof 2008-07-22 21:22:59 +00:00
mfranz
b9e7bb1b4b add thisfunc() for reliable recursion 2008-07-22 19:03:25 +00:00
mfranz
cb3150b915 (failing attempt to) lock down two functions 2008-07-22 16:46:18 +00:00
mfranz
30cd488f90 data.load(): use io.read_properties() (fixes *.sav loading bug) 2008-07-11 22:50:58 +00:00
mfranz
abdc416f32 - remove "load flight"/"save flight" dialogs, and
- use a file selector instead
- file-select.xml: handle non-existing files correctly
2008-07-11 20:57:52 +00:00
mfranz
c604b92deb now that the file reading/writing fgcommands underlie the same mechanism
as Nasal's io.open(), we need to allow saving/loading flights and saving
aircraft specific data at exit
2008-07-11 16:38:51 +00:00
mfranz
32f1730c6e - load_nasal: better error message if compile() fails
- io.open handler: extract validation to separate function and
- add detached read/write validation listeners
2008-07-11 15:37:27 +00:00
mfranz
86475efa5e fixpath: handle empty strings 2008-07-11 15:23:23 +00:00
mfranz
3be5c6956b io: use default attribs rather than a hard-coded number for globals identification
gui/tutorial/aircraft: use io.read_properties()/io.write_properties()
2008-07-11 09:37:33 +00:00
mfranz
ee44cdf0db Anders GIDENSTAM: enable fuel&payload dialog for JSBSim
mf: minor modifications & adding several instances of "var"
2008-07-10 20:13:58 +00:00
mfranz
9be716de1c typo 2008-07-10 16:55:45 +00:00
mfranz
8909695f36 add io.{read,write}_properties() convenience wrappers for
fgcommand("loadxml") and fgcommand("savexml")
2008-07-10 16:53:43 +00:00
mfranz
951f31a56c change attribute names from read/write to readable/writable 2008-07-07 10:25:08 +00:00
mfranz
b8ba3c5f66 cosmetics (no braces for one-liner functions; looks nicer, IMHO) 2008-07-03 16:24:52 +00:00
mfranz
6e24e077ba - invert io.load_nasal() return value
- let load_rules() return nil or the path (rather than 0 or 1)
- better log output
- cosmetics
2008-07-03 16:23:13 +00:00
mfranz
6f9f70e84d - don't use undefined variable `curr'
- cosmetics
2008-06-22 18:00:02 +00:00
mfranz
caca942012 revert last change: don't append cwd to relative paths for now. There's
no way yet to safely detect absolute paths, so this would break on MS Windows.
This will only mean that relative paths will always fail, as they don't
match any pattern. These are all absolute.
2008-06-22 13:54:36 +00:00
mfranz
875b99c90e whoops, wrong quotes 2008-06-22 12:17:02 +00:00
mfranz
cf9f30cb11 fixpath(): simplify by using new join() and replace() functions 2008-06-22 11:33:13 +00:00
mfranz
5240b57018 io.open(): turn relative paths into absolute ones before checking 2008-06-22 11:31:41 +00:00
mfranz
d86b1b9c74 string.nas: new functions string.join() and string.replace()
debug.nas: let benchmark() repeat tested function
io.nas: cosmetics
aircraft.nas: initialize time property only once
2008-06-21 07:10:32 +00:00
mfranz
ab08bfb8eb make sure that a die() (e.g. caused by an IOrules file being read protected)
doesn't disable the whole security mechanism
2008-06-16 11:19:29 +00:00
mfranz
94e010e4d1 whoops ... s/and/or/ 2008-06-16 11:00:05 +00:00
mfranz
bf9c2dc6a5 read rules for io.open() file access from $FG_ROOT/Nasal/IOrules or, if
available, from $FG_HOME/Nasal/IOrules. That's desirable because
ordinary users aren't allowed to edit files in $FG_ROOT.
2008-06-16 10:47:02 +00:00
mfranz
7cc783c2f5 this comes from not using tabs ... sigh 2008-06-16 07:16:10 +00:00
mfranz
b5cdfeb2b8 ... and allow reading only from ~/.fgfs/* and $FG_ROOT/* 2008-06-16 07:07:50 +00:00
mfranz
df018fff49 only allow writing to ~/.fgfs/Scenery/*.stg and ~/.fgfs/Export/* 2008-06-16 06:32:32 +00:00
mfranz
141f1c8da4 must not use setlistener in $FG_ROOT/Nasal/*.nas ... 2008-06-15 10:11:32 +00:00
mfranz
0fad328217 load_nasal: boolify result, as the number doesn't mean anything and might
be confusing
2008-06-14 22:39:28 +00:00
mfranz
56eef9c69f move load_nasal to io module 2008-06-14 14:32:37 +00:00
mfranz
62cc0f457c load_nasal: fix module and let it return whether there was an error 2008-06-14 14:25:34 +00:00
mfranz
a79c0e95c5 move load_nasal() here from the debug module 2008-06-14 14:22:34 +00:00
mfranz
c159ea1755 io.open(): drop die() color 2008-06-13 19:19:54 +00:00
mfranz
4a30ad6efe io.open(): remove debug messages (for easier code review) 2008-06-13 19:14:48 +00:00
mfranz
59e3d65545 and die() with red color for now 2008-06-13 13:18:16 +00:00
mfranz
0216b1a65c improve log messages 2008-06-13 13:08:56 +00:00
mfranz
4d17687f12 move fixpath back to string.nas. It *is* about strings, after all, and also
usable for property paths, so io.nas doesn't seem the right place.
2008-06-13 13:01:38 +00:00
mfranz
496a76b9fa and "br" as well :-) 2008-06-13 12:11:42 +00:00
mfranz
06aa2b772c open: allow "rb" everywhere like "r" 2008-06-13 12:09:45 +00:00
mfranz
2b3f574063 don't need /var/log/ 2008-06-13 11:57:20 +00:00
mfranz
7d9bd68742 - move fixpath() from "string" to "io" module
- first stab at Nasal security model: allow writing files only to authorized
  dirs. (Most of the debug messages will be removed later.)
2008-06-13 11:35:55 +00:00
mfranz
11d7de3e85 enable the Multiplayer menu if any of txport and rxport is set 2008-06-11 20:05:46 +00:00
mfranz
55670ccb35 enable multiplayer menu only in MP mode 2008-06-11 18:46:54 +00:00
mfranz
761444b917 close dialog on Esc, like every other dialog with a close button 2008-06-11 18:39:03 +00:00
mfranz
c1581e2ea1 Till BUSCH: multiplayer dialog (open with multiplayer.dialog.open() or toggle()) 2008-06-11 18:23:03 +00:00
mfranz
2866043c3d - prop_key_handler: limitate history to history-max-size on loading
- string/debug: cosmetics
2008-06-08 11:14:57 +00:00
mfranz
238fce1d15 let initNode() initialize a property to double(0) by default 2008-06-04 20:41:44 +00:00
mfranz
246ce973ec save and reload up to 20 history entries 2008-05-19 17:31:57 +00:00
mfranz
8fe1cf807d add initNode() function that initializes (if necessary) and returns a property.
If the property has a valid value already, then the given value is ignored.

  var x = props.initNode("/foo", 10);
  var y = props.initNode("/bar", 1, "BOOL");
2008-05-19 15:44:23 +00:00
mfranz
67ba396942 display: redraw on window resize so that the display won't disappear 2008-05-19 09:48:41 +00:00
mfranz
3184ea67a3 - add screen.display documentation
- add screen.display.setfont() and .toggle() method
- make property labels optional
2008-05-16 16:26:15 +00:00
mfranz
5334016034 display: format number, true/false for bools, quotes for strings 2008-05-15 20:31:35 +00:00
mfranz
f54cb1159f prop_disp: change color to white ... again. (Sorry for the many small commits. :-) 2008-05-15 16:11:50 +00:00
mfranz
54f8fc4370 property_display: turn it into a regular class & lots of improvements 2008-05-15 15:42:31 +00:00
mfranz
0b4322736f - make debug.dump() accept more than one argument (one could already write
debug.dump([a, b]) for that, but debug.dump(a, b) is more obvious)
- change output colors: variable names are no longer bold, all property
  attributes are now blue, not just the property type)
- drop redundant braces & other cosmetics
2008-05-15 15:23:17 +00:00
mfranz
b6d987453f data.add(): use props.nodeList() function 2008-05-15 15:20:11 +00:00
mfranz
a329a7ba14 - add props.nodeList() function which turns property ghosts, props.Nodes,
and path strings into a list of props.Nodes. It also digests lists of
  properties, or lists of lists of properties etc., thus allowing things
  like props.nodeList(arg), props.nodeList(n.getChildren("foo")). This is
  meant for functions like aircraft.data.add() or screen.display.add().
- remove some redundant braces
- fix comment
2008-05-15 15:17:56 +00:00
mfranz
e5c027786d property_display:
- don't use screen.window, but let it do its own dialog handling. Thereby
- make it faster  (update every frame by default)
- prevent collisions with the menu
- allow to move the dialog away (only the left edge is draggable!)
- try color white  (better color suggestions welcome :-)
2008-05-14 20:06:50 +00:00
mfranz
356a8430a7 property display: make sure tags are as short as possible but unique 2008-05-14 15:40:00 +00:00
mfranz
af38cc7c63 property display:
- make interval and color configurable
- use bigger font
- display strings containing \n in one line
2008-05-14 12:04:54 +00:00
mfranz
ee8b517246 property display: don't choke on nil properties 2008-05-14 10:57:02 +00:00
mfranz
ba57bd9a2e property display: set HELVETICA_12 font (same as for fps display) 2008-05-14 10:36:37 +00:00
mfranz
02c4b7a613 - screen.nas: add live property display
- prop_key_handler.nas add support for live property display
2008-05-14 10:23:47 +00:00
mfranz
b055de3528 add setCursor() wrapper function for the "set-cursor" fgcommand 2008-05-08 10:15:18 +00:00
mfranz
7c5bd888ac negative key numbers mark events consumed now 2008-05-03 21:29:38 +00:00
stuart
7513200f8e Add additional message check so callsign is not prefixed if present in message itself. 2008-05-03 19:45:22 +00:00
stuart
acef95d90c Re-order initialization and fix a couple of bugs. 2008-04-29 19:58:10 +00:00
mfranz
757c2314dd don't try to build completion from invalid node 2008-04-26 23:29:52 +00:00
mfranz
1544af3ab9 return negative key numbers to report key event as consumed 2008-04-26 13:27:27 +00:00
stuart
b703e21db9 Initialize on /sim/signals/fdm-initialized instead of /sim/signals/nasal-dir-initialized. This happens later on, and ensure we have a valid /sim/time/delta-sec value for the filters. 2008-04-23 22:09:34 +00:00
mfranz
c78327ee21 - lowpass: work with delta-sec = nil
- cosmetics
2008-04-23 22:01:44 +00:00
stuart
01d21c928a Add generic redout. 2008-04-23 20:44:57 +00:00
mfranz
efaeff5180 - make the limiter a tad faster
- fix comment
2008-04-21 21:39:45 +00:00
mfranz
ff6c9ec672 view_limiter: fix wrong starting offset 2008-04-15 16:55:40 +00:00
mfranz
c97010cefd make panViewDir use new limiter params & some parameter tweaks 2008-04-15 13:29:23 +00:00
mfranz
7fbeb50695 view_limiter:
- new parameter naming (left/right instead of min/max; signs are ignored)
- fix wrap-around skips
- use regular constructor so as not to confuse people  ;-)
2008-04-15 13:02:18 +00:00
mfranz
c4ebd9a0f2 - use separate view-limiter handler instances per view
- cleanup
2008-04-15 07:04:52 +00:00
mfranz
656340fa3d davidB21 + Vivian MEAZZA + /me: pilot view limiter
If a <view> contains a <limits> block, then a view handler gets attached to
it, which limits head turns to a given range, whereby headings beyond a given
threshold cause an additional sideways movement. This is turned off by default
for now.
2008-04-14 10:00:27 +00:00
mfranz
3e9a108288 make view.index (value of "/sim/current-view/view-number") and view.current
(a props.Node hash of the current view, e.g. /sim/view[100]/) available
2008-04-12 20:25:21 +00:00
sydadams
c7b3412af0 Added a check for passive mode to allow keyboard controls .. 2008-04-01 05:56:38 +00:00
mfranz
6d3676639b revert bad livery.current initialization 2008-03-01 12:01:23 +00:00
mfranz
4db470acd4 move MP livery update parts from the livery class into a separate
livery_update class and add an optional third argument to its constructor:
a callback function that's called whenever the class noticed a livery
change
2008-03-01 09:49:57 +00:00
mfranz
e9e234410d initialize livery.current at livery.init() 2008-02-29 21:28:34 +00:00
mfranz
713685f275 add aircraft.livery methods for updating the livery in MP loaded aircraft 2008-02-29 17:17:40 +00:00
mfranz
217cbcae34 add mod-up action to magneto keys, and ignore that in the controls wrapper;
This allows to implement car-like combined magneto/starter switches.
2008-02-23 18:18:55 +00:00
stuart
dc4ad0dc80 Update to generic blackout, incorporating feedback from Melchior FRANZ:
- Update redout level every frame
 - Replace reading of properties every iteration with listeners
 - move -onset and -complete properties into a parameters subtree
2008-02-16 20:23:27 +00:00
stuart
dd923792ec Add generic blackout/redout for all aircraft, along with a gui.
Based on previous work by vivian and myself.
2008-02-16 08:26:59 +00:00
vmmeazza
0e0b9b4b06 Add a new class which enables formations to be changed during runtime. A modification of the Livery Class 2008-02-15 14:09:37 +00:00
mfranz
80ed641d69 avoid unnecessary call() 2008-02-13 20:12:42 +00:00
andy
4ae206fc00 Turns out some code likes to call isa() with non-objects. Might as
well have it return false (which is valid) instead of throwing an
exception (also valid, but more surprising).
2008-02-07 21:23:42 +00:00
andy
bedac8ec83 Fix isa() when used on classes with superclasses. 2008-02-07 18:03:03 +00:00
mfranz
b94a02a4f5 disable ground steering head turn (until there's a better implementation?).
This does often work badly, especially in seaplanes.
2008-02-07 15:07:09 +00:00
mfranz
46f66693e2 - make timer.stop() return "me"
- make door.move() only spawn an interpolate event if the target value
  differs from the current pos (fixes brake problem in the dhc6)
2008-02-05 12:39:56 +00:00
mfranz
30f3dff563 make axis wrappers a tad faster (and a whole lot cooler :-) 2008-01-30 21:52:29 +00:00
mfranz
c35f3207d3 preferences.xml: drop /sim/input/selected/engine settings (these properties
are set in controls.nas since ages)
controls.nas: avoid repeated querying of /sim/input/selected/engine[*]
    properties; this isn't supposed to change at runtime and is a rather
    costly process, especially in axis handlers
2008-01-30 16:48:04 +00:00
mfranz
5776d1cc87 make mixture/propeller/carbHear only work for selected engine (like throttle) 2008-01-29 23:45:31 +00:00
mfranz
cce72f08a9 don't save view-enabled state of nameless views to aircraft config file
(the view may have been removed from the *-set.xml file)
2008-01-18 14:16:38 +00:00
mfranz
7c9566860d Stewart ANDREASON: fix broken index calculation in livery.set() 2007-12-17 21:49:52 +00:00
mfranz
c96fd4b089 - make stepView() read the <enabled> flag as bool
- some more 'var', as usual
2007-12-13 20:16:20 +00:00
mfranz
e37bd9d12f add new key defs 2007-12-09 22:58:51 +00:00
vmmeazza
4ee3367452 Stuart Buchanan:
Add chat menu
2007-12-08 19:01:03 +00:00
mfranz
cf0f21dec3 ... and turning them on again should actually make the frames visible. 2007-12-07 12:23:46 +00:00
mfranz
c83a76d585 disable top bar only if /sim/model/geometry/square/top is unset. Put this
into your ~/.fgfsrc if you want complete squares (yes, 0 is on :-).

  --prop:sim/model/geometry/square/top=0
2007-12-07 11:49:55 +00:00
mfranz
77dcb9dc34 glide slope tunnel visualization script 2007-12-01 19:10:12 +00:00
mfranz
62b3343fef Markus ZOJER: add wingSweep() wrapper
mf: add var keyword, use named args, ...
2007-11-29 13:16:13 +00:00
mfranz
0183e43b38 allow to open several property browsers with one command line argument
(comma separated paths):

  --prop:browser=position,orientation,sim/model
2007-11-28 22:22:29 +00:00
mfranz
8e1364713f reorder instructions in start(); rename some variables 2007-11-27 16:28:52 +00:00
mfranz
125d9d7f19 don't remove double entries in the whole history, but only push unique ones 2007-11-27 01:40:23 +00:00
mfranz
4faba765b0 remove obsolete code 2007-11-26 16:42:43 +00:00
mfranz
7592b8243a remove leftover debug statement 2007-11-26 16:14:44 +00:00
mfranz
73c0285ef9 - remove property browser binding from the <SPACE> key
- rename prop-key-handler.nas to prop_key_handler.nas  (the hyphens were
  intentional, exactly to *make* using it as namespace less inviting,
  but times change ...)
- add property browser binding to the '/'-key for when the property key handler
  is turned off (/sim/input/property-key-handler=0). If it's on, use /: or
  /<property>: to open the browser.
- run keyboard event listener only when property key handler is active

I hope that the '/' key can keep this binding even after a keyboard review.
The '/' is just the most natural key for dealing with properties, and it's
far less prominent on non-US-keyboards (e.g. Shift-7 on German keyboards),
so it's not really very well suited for important aircraft functions, anyway.
But I don't insist. :-)
2007-11-26 16:12:37 +00:00
mfranz
4b5550520b character class fixes (isfoo()) 2007-11-26 09:50:18 +00:00
mfranz
a53e636268 debug.nas: _dump_string(): escape some characters
prop-key-handler.nas: minor cleanup
2007-11-25 20:36:57 +00:00
mfranz
ecf469e295 prop-key-handler.nas: check for nil property
tutorial.nas, globals.nas, controls.nas: cosmetics
2007-11-20 17:02:13 +00:00
mfranz
73bbdd280d treat "Cockpit View" like other views; limit view.stepView() step to 1 and -1 2007-11-20 11:34:54 +00:00
mfranz
eccdedf12c - ensure correct order of initialization
- only save aircraft view properties that are defined
- unset "userarchive" flags, just in case
2007-11-19 20:20:55 +00:00
mfranz
73aeb8d772 OK, and now it Really Works.
(Yes, that's one way to get a better place in the number-of-commits ranking. ;-)
2007-11-19 18:55:24 +00:00
mfranz
87e746a755 sheesh ... another little bug to fix: fixate path for settimer closure 2007-11-19 18:30:55 +00:00
mfranz
59e51fa533 refresh "enabled" state of aircraft views (or they'd last only until the next run) 2007-11-19 18:07:30 +00:00
mfranz
b8b665d347 work correctly if the stepView() step is >1 or <-1 (though such steps
don't really make much sense)
2007-11-19 17:08:47 +00:00
mfranz
10c875f75e make system and aircraft views configurable in Menu->Views->View Options.
These are then skipped with view.stepView(n), unless the second, optional
argument is set to 1:  view.stepView(n, 1);
Whether a view is enabled or not, is saved in $FG_ROOT/.fgfs/autosave.xml
(system views) or $FG_ROOT/.fgfs/aircraft-data/<aircraft>.xml
2007-11-19 16:26:15 +00:00
mfranz
d6be4c8303 make sure aircraft don't use reserved view indices (0..99)
I tried it the nice way, but it didn't work. Why is it important to
reserve indices for fgfs? Because someone has otherwise to go through
all aircraft in CVS and move aircraft specific views out of the way,
every time a system view gets added. Been there, done that.
2007-11-19 14:22:55 +00:00
mfranz
96c76c4fe0 display hash keys that are numbers as numbers; import string.nas functions 2007-11-19 13:31:18 +00:00
mfranz
31807d6538 dump funny hash keys correctly, as string with escaped non-printables 2007-11-19 12:36:26 +00:00
mfranz
4ed4939b8e describe <Shift-TAB> and <Shift-Backspace> keys as well :-) 2007-11-18 13:30:30 +00:00
mfranz
0bca5bdea6 - add Debug->Development Extensions dialog with two checkboxes to
- allow turning on/off extra widgets for developers (HUD dialog: colors,
  rendering dialog: visualization of shadow edges), and to turn on/off new
- property key handler ('/'-key)

Both features are off by default, and their state is saved to autosave.xml.
2007-11-18 12:20:17 +00:00
mfranz
9dfa8830a7 more isfoo() functions (yes, I intend to use them :-) 2007-11-16 17:16:42 +00:00
mfranz
d85ba7575c make debug.attributes() verbose by default. This adds the refcounter to
the property attribute string, as in:

  (NONE, L1, #8345)

... for a node of type "NONE", with one listener attached, and 8345 instances
of the shared pointer around.
2007-11-15 21:27:42 +00:00
mfranz
3a83fb99d5 - "export" the attributes function for return a property node's attributes
as string (s/_attrib/attributes)
- bind() the code in load_nasal() correctly
2007-11-15 06:46:14 +00:00
mfranz
14a5f38be2 make gui.property_browser() not only digest property paths, but
also props.Node class hashes
2007-11-14 20:13:35 +00:00
david
45363925fc Add function to toggle lighting. 2007-11-10 01:29:31 +00:00
mfranz
5481c73b20 - fix bug that made gui.popupTip() ignore the optional delay argument
- use more "var" keywords and named args
- popupTip(): add optional third hash argument that is merged with the
  dialog properies hash. This can be used to select different font or
  dialog colors, etc.
2007-11-09 13:00:05 +00:00
mfranz
2ba2925cd0 add view manager which manages view handlers. fly-by-view is now implemented
as such a view handler. Views that don't use one aren't affected -- the view
manager doesn't run when they are active.
2007-11-06 21:49:33 +00:00
mfranz
b3ab26db07 fix comment & cosmetics 2007-11-06 21:23:53 +00:00
mfranz
9b7eafd658 use sim time delta for the lowpass, not realtime delta 2007-11-06 21:22:06 +00:00
mfranz
99bcbe8ea5 change global dynamic-view flag from /sim/view[0]/dynamic/enabled to
/sim/current-view/dynamic-view. There are additionally <dynamic-view>
settings per view, but those only enable it for that view if it's
globally turned on.
2007-11-03 14:08:39 +00:00
mfranz
eb5b350ec9 we need more colors! 2007-10-16 18:54:25 +00:00
mfranz
be3025b40f bah ... always shortly after presenting a new feature on the list, I change
it and the description doesn't match any more.  :-}
Number of frames makes more sense than seconds (default = 1):

  debug.proptrace([<property> [, <number_of_frames>]]);
2007-10-16 17:23:25 +00:00
mfranz
fc6f357a0e add new debugging function proptrace(), which outputs all regular property
writes (not directly written tied ones), all node additions and removal.
Frames are separated with a line. Turn off ANSI coloring if you want to
pipe the results into a file: --prop:sim/startup/terminal-ansi-colors=0
2007-10-16 15:24:30 +00:00
mfranz
c6790fd328 don't set stopTutorial listener before we can be sure that markerN is set 2007-10-15 21:55:23 +00:00
mfranz
256b1880cb wrapNode(): One argument ought to be enough for anybody. 2007-10-15 18:32:20 +00:00
mfranz
2bcddab9b6 setlistener(): accessing the node via cmdarg() is now depreciated. Use
a regular function argument for that. Note the "n" in this example:

   setlistener("/sim/current-view/view-number", func(n) {
       setprop("/sim/hud/visibility", !n.getValue());
   }, 1);
2007-10-15 18:27:42 +00:00
mfranz
12c11dfa6f setlistener(): now that we know the params, we only need to unwrap the first two 2007-10-15 18:00:17 +00:00
mfranz
0d3c7cec6f - setlistener(): add wrapper function to turn ghost arguments into props.Nodes
- "modernization": use more named function arguments and "var" keywords
2007-10-15 16:30:37 +00:00
mfranz
cdc2b360d7 launchbar message: adapt for new setlistener() syntax; fourth argument set
to zero, so that the listener is only triggered when the launchbar state
has change. (YASim writes it in every frame. Sigh.)
2007-10-14 18:04:53 +00:00
mfranz
705e4bcaac forward fourth setlistener() arg to _setlistener() 2007-10-14 18:03:31 +00:00
mfranz
3cccfaac53 re-activate launchbar listener, and make it a type 2 listener
(repeated writing of the same value doesn't trigger, only changes do)
2007-10-12 17:25:54 +00:00
mfranz
6149c6bbda commenting the "Engaged" message out ... YASim.cxx sets the launchbar
state string in *every* frame, so we shouldn't "listen" to it.  :-(
2007-10-10 10:59:41 +00:00
mfranz
520fff1c1e screen.nas: now *really* do the runway report quietly
startup.nas: cosmetics
2007-10-10 09:58:22 +00:00
mfranz
d003752d20 let copilot/ground crew report when engaged in launchbar 2007-10-09 14:48:44 +00:00
mfranz
693bebcd43 this module is meant for pure startup code. It shall not contain any library
code that is called from outside. It will be removed from the global namespace
once it has done its job. For now it only selects a proper runway for wind
directions reported by METAR, but only, of course, if an airport was chosen,
but no runway and no heading, and if the aircraft is actually on ground.
2007-10-07 19:44:58 +00:00
mfranz
095e3e717e agl: need to check for nil 2007-10-07 17:09:13 +00:00
mfranz
dfd21c722d - add more "var" keywords, fix indentation, drop some parentheses,
fix comments, consistency fixes, ...
- aircraft.nas: angular_lowpass -> minor speedup
2007-10-07 15:12:05 +00:00
mfranz
ef22d3f5a3 only report ATC/runway near ground & cleanup 2007-10-07 11:34:53 +00:00
mfranz
b7ddc05287 rwy info isn't always available 2007-10-04 22:07:37 +00:00
mfranz
321fbbbcab friendly ATC tells us on which runway we are, without sound.
Please complain if you find it, nevertheless, annoying.
2007-10-04 18:23:36 +00:00
mfranz
a895da0247 can't use props.getNode() on the top level ... 2007-10-03 19:14:04 +00:00
mfranz
eafc9c3a1d rename index() to indexof() 2007-10-03 19:01:01 +00:00
mfranz
63dca5051a add index() function which returns view index by name. Identifying views
by name is safer and especially useful for aircraft specific views, where
the XML index doesn't match the view number.
2007-10-03 18:15:50 +00:00
mfranz
0f69bc55ef enable dynamic view not only for view[0], but for all views with set
"config/dynamic-view" bool
2007-10-03 17:33:42 +00:00
mfranz
fd20d330ba props.Node: add remove() method that removes the node it was calleed on
from its property tree. The node remains accessible as long as references
to it are kept. Example:

  var cow_chain = func {
      var cow = geo.put_model("Models/Fauna/cow.ac", geo.aircraft_position());
      settimer(func { cow.remove() }, 10);
      settimer(cow_chain, 2);
  }
  cow_chain();
2007-08-07 11:30:30 +00:00
mfranz
bf050c012f load and execute all ~/.fgfs/Nasal/*.nas files in alphabetic order after
the $FG_ROOT/Nasal/*.nas ones are done. This allows to use props.Node etc.
immediately, without requirement for settimer(func{}, 0) constructions.

Rationale:
- clean separation of local additions (and hacks :-) from standard files
- users might not have write permission to $FG_ROOT/Nasal/ or shouldn't
  have to su to root for writing Nasal code
2007-08-06 22:50:06 +00:00
mfranz
109f38812b don't reset viewPosition on view.resetView(). This would break
"seat adjustment" view MMB-dragging.
2007-08-01 21:28:58 +00:00
mfranz
3132b5c962 Fix mouse MMB+LMB: this reset to view[0] parameters independent of the
current view, so it was only usable in cockpit view, and messed up every
other view.
2007-08-01 21:10:04 +00:00
mfranz
e092ee9abc - we prefer hyphens in property names to underscores
- save /sim/multiplayer/chat-display to autosave.xml
- remove trailing spaces
2007-08-01 19:37:51 +00:00
mfranz
7c2a88a98a Anders GIDENSTAM:
- Page up/down changes the selected throttles one step up/down, i.e.
  if the original throttle settings were x steps apart they remain
  steps apart (unless the boundary is reached).
- Mouse + MMB drag changes the selected throttles by the delta amount
  (length of drag).
- The throttleAxis() wrapper for joysticks sets the selected
  throttles to correspond to the joystick's axis position. I.e. all
  selected engines will get the same throttle setting. Since most
  joystick throttles are positional devices I think this behaviour
  is more logical than using a relative adjustment in this case. """

mf: slightly modified, added var etc. (more such changes in controls.nas
    to come)
2007-07-19 16:18:39 +00:00
mfranz
3ec61cdd5f key help: property browser: Shift-Enter -> Ctrl-Space 2007-07-19 10:51:24 +00:00
mfranz
b6b39def59 nextStyle: switch to next available style, allowing the index range to
have holes. That way people can start their private styles with e.g. 100
and can be sure that the system doesn't mess with them.
2007-07-17 10:05:14 +00:00
mfranz
886af1b68d fly-by: more variation of view points in air, with some limits on ground to
avoid irritating taxiing through the viewer or down view on the aircraft
2007-07-16 14:42:48 +00:00
mfranz
3c08f34027 - move "swap panels" from s-key to S-key
- move "fire starter" from SPACE-key to s-key
- move "open property browser" from Shift-SPACE to Shift-Enter (Shift-Return)
- implement PTT on SPACE/Shift-SPACE  (with the other six SPACE/modifier
  combinations unused, apart from a popup)
- add controls.ptt(v) wrapper function (v can be 1 or 2 for on, and 0 for off)

Easter-Egg:
- pressing the t-key for at least one second resets the warp delta.
  This is an experimental feature that most people won't notice. It's meant
  for investigating if suchlike "unorthodox" key use is acceptable. While
  modifier-keys are the norm on computer keyboards, modifier-times aren't,
  although we are used to them from other devices, such as alarm clocks etc.)
  May later get removed without warning.
2007-07-13 13:46:09 +00:00
mfranz
96a8a9657f - drop redundant aircraft namespace
- use getprop() instead of props.Node.getValue() here because it's faster
2007-07-06 21:28:07 +00:00
mfranz
d6ff854aa5 add class for variable inverval lowpass filtering of angles. (If there's
a better method or name for it, please tell me.) This is primarily for
smoothing view heading angles.
2007-07-06 20:31:14 +00:00
mfranz
bece57dfc8 output ghosts in a readable form 2007-07-02 20:58:30 +00:00
mfranz
54c28ced16 what I do best: cosmetics 2007-07-01 18:54:32 +00:00
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
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