diff --git a/Effects/reflect.eff b/Effects/reflect.eff index 819cc3ebe..3ad47b33f 100644 --- a/Effects/reflect.eff +++ b/Effects/reflect.eff @@ -289,8 +289,10 @@ - Shaders/reflect.vert - Shaders/reflect.frag + Shaders/include_fog.vert + Shaders/reflect.vert + Shaders/include_fog.frag + Shaders/reflect.frag tangent 6 diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index 5f8581076..c606f02d9 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -437,12 +437,14 @@ var model = { }, }; -_setlistener("/sim/signals/nasal-dir-initialized", func { +var mp_mode_changed = func(n) { + var is_online = n.getBoolValue(); + foreach (var menuitem;["mp-chat","mp-chat-menu","mp-list","mp-carrier"]) + { + gui.menuEnable(menuitem, is_online); + } - model.init(); - - setlistener("/sim/multiplay/online", func(n) { - if (n.getBoolValue()) { + if (is_online) { if (getprop("/sim/multiplay/write-message-log")) { var ac = getprop("/sim/aircraft"); var cs = getprop("/sim/multiplay/callsign"); @@ -468,7 +470,18 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { } check_messages(msg_loop_id += 1); } - }, 1, 0); + else + { + # stop message loop + msg_loop_id += 1; + } +} + +_setlistener("/sim/signals/nasal-dir-initialized", func { + + model.init(); + + setlistener("/sim/multiplay/online", mp_mode_changed, 1, 0); # Call-back to ensure we see our own messages. setlistener("/sim/multiplay/chat", chat_listener); diff --git a/Nasal/weather-utility.nas b/Nasal/weather-utility.nas index 90e735e61..6c93051b4 100644 --- a/Nasal/weather-utility.nas +++ b/Nasal/weather-utility.nas @@ -3,6 +3,9 @@ # be used with a tied property # +# TODO: Make this optional (when shaders disabled etc), or move computation +# away from Nasal. + #does what it says on the tin var clamp = func(v, min, max) { v < min ? min : v > max ? max : v } @@ -44,7 +47,44 @@ props.globals.initNode("/orientation/model/pitch-deg", 0, "DOUBLE"); props.globals.initNode("/orientation/model/roll-deg", 0, "DOUBLE"); +var update_waves = func (wind) { + var wind = 0; + var amp = 0; + var angle = 0; + var dangle = 0; + var freq = 0; + var factor = 0; + var sharp = 0; + + amp = Amp + 0.02 * wind; + amp = clamp(amp, 1.0, 2.0); + + setprop("/environment/wave/amp", amp); + + angle = Angle + 0.2 * wind; + setprop("/environment/wave/angle", angle); + + dangle = DAngle - 0.4 * wind; + setprop("/environment/wave/dangle", dangle); + + freq = Freq + 0.0008 * wind; + freq = clamp(freq, 0.01, 0.015); + setprop("/environment/wave/freq", freq); + + factor = Factor - 0.00001 * wind; + factor = clamp(factor, 0.0001, 0.0004); + setprop("/environment/wave/factor", factor); + + sharp = Sharp + 0.02 * wind; + sharp = clamp(sharp, 1.0, 2.0); + setprop("/environment/wave/sharp", sharp); +}; + +var is_initialized = 0; var initialize = func { + if (is_initialized) + return; # only install listeners once + is_initialized = 1; var wind_from_east_Node = props.globals.getNode("/environment/config/boundary/entry[0]/wind-from-east-fps", 1); wind_from_east_Node.setDoubleValue(0); @@ -72,48 +112,14 @@ var initialize = func { # ################## listeners #################### # - setlistener("/environment/sea/surface/wind-speed-kt", func (n) { - var wind = 0; - var amp = 0; - var angle = 0; - var dangle = 0; - var freq = 0; - var factor = 0; - var sharp = 0; - - wind = n.getValue(); - - amp = Amp + 0.02 * wind; - amp = clamp(amp, 1.0, 2.0); - - setprop("/environment/wave/amp", amp); - - angle = Angle + 0.2 * wind; - setprop("/environment/wave/angle", angle); - - dangle = DAngle - 0.4 * wind; - setprop("/environment/wave/dangle", dangle); - - freq = Freq + 0.0008 * wind; - freq = clamp(freq, 0.01, 0.015); - setprop("/environment/wave/freq", freq); - - factor = Factor - 0.00001 * wind; - factor = clamp(factor, 0.0001, 0.0004); - setprop("/environment/wave/factor", factor); - - sharp = Sharp + 0.02 * wind; - sharp = clamp(sharp, 1.0, 2.0); - setprop("/environment/wave/sharp", sharp); - - - }, - 1, - 0);# end listener +# installing a listener to /environment/sea/surface/wind-speed-kt does not make sense, +# since it's currently being written in _every_ update loop anyway). +# setlistener("/environment/sea/surface/wind-speed-kt", func(n) {update_waves(n.getValue())}, +# 1, +# 0);# end listener - print("weather util initialized ..."); + print("weather util initialized ..."); loop(); - }# end init var loop = func { @@ -132,6 +138,9 @@ var loop = func { value = getprop("/environment/config/boundary/entry[0]/wind-speed-kt"); setprop("/environment/sea/surface/wind-speed-kt", value); # print("wind-speed-kt ", getprop("/environment/sea/surface/wind-speed-kt")); + # Direct call to update wave settings (much more effective than using a listener, + # since it's written in every loop anyway. + update_waves(value); value = getprop("/environment/config/enabled"); setprop("/environment/sea/config/enabled", value); diff --git a/gui/dialogs/weather.xml b/gui/dialogs/weather.xml index e9055cfd4..5b56ade46 100644 --- a/gui/dialogs/weather.xml +++ b/gui/dialogs/weather.xml @@ -1759,7 +1759,7 @@ Fix for #567 --> nasal - + diff --git a/gui/menubar.xml b/gui/menubar.xml index a952ecea4..4a5b5f0a0 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -568,9 +568,9 @@ nasal diff --git a/preferences.xml b/preferences.xml index 67c557594..785b5005a 100644 --- a/preferences.xml +++ b/preferences.xml @@ -710,6 +710,7 @@ Started September 2000 by David Megginson, david@megginson.com true + @@ -739,7 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com - + Hello 118500000 false true Models/Geometry/glider.ac + callsign +