1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Torsten Dreyer 2010-09-05 11:58:34 +02:00
commit 8d0273a7d4
29 changed files with 344 additions and 122 deletions

View file

@ -3,33 +3,30 @@
<PropertyList>
<sim>
<model>
<livery>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/fuselage-eimcf.png</texture>
</livery>
<livery>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/fuselage.eimcf.png</texture>
</livery>
<liverytail>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/tail.png</texture>
</liverytail>
<liverytail>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/tail.png</texture>
</liverytail>
<liverywing>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/wing.png</texture>
</liverywing>
<name type="string">EI-MCF</name>
<index type="int">2</index>
<texture>Liveries/wing.png</texture>
</liverywing>
<c172p>
<immat>false</immat>
<c172p>
<immat>false</immat>
<fairing1>true</fairing1>
<fairing2>false</fairing2>
<fairing3>false</fairing3>
</c172p>
</c172p>
</model>
</sim>

View file

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

View file

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

View file

@ -17,7 +17,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
<instruments>
<!-- labels -->
<instrument include="/labels/labelbcn.xml">
<instrument include="/Labels/labelbcn.xml">
<name>labelbcn</name>
<x>495</x>
<y>-270</y>
@ -26,7 +26,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
</instrument>
<!-- labels -->
<instrument include="/labels/labelnav.xml">
<instrument include="/Labels/labelnav.xml">
<name>labelnav</name>
<x>458</x>
<y>-270</y>
@ -35,7 +35,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
</instrument>
<!-- labels -->
<instrument include="/labels/labelpto.xml">
<instrument include="/Labels/labelpto.xml">
<name>labelpto</name>
<x>422</x>
<y>-270</y>
@ -44,7 +44,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
</instrument>
<!-- labels -->
<instrument include="/labels/labelsto.xml">
<instrument include="/Labels/Labelsto.xml">
<name>labelsto</name>
<x>525</x>
<y>-270</y>
@ -53,7 +53,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
</instrument>
<!-- labels -->
<instrument include="/labels/labeltax.xml">
<instrument include="/Labels/labeltax.xml">
<name>labeltax</name>
<x>493</x>
<y>-204</y>
@ -62,7 +62,7 @@ Legacy 2D instruments and actions for the 3D C172P cockpit.
</instrument>
<!-- labels -->
<instrument include="/labels/labellng.xml">
<instrument include="/Labels/labellng.xml">
<name>labellng</name>
<x>525</x>
<y>-204</y>

View file

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

View file

@ -44,7 +44,7 @@ name "BottomLink"
loc 0.0176049 -0.0188099 0
data 8
Mesh.009
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 4
-1.048 -0.921304 0.020872
@ -65,7 +65,7 @@ name "TopLink"
loc 0.0274526 -0.0318764 0
data 8
Mesh.009
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 4
-0.881331 -0.859786 0.020872
@ -6481,7 +6481,7 @@ OBJECT poly
name "Panel_1"
data 8
Mesh.026
texture "c172p-int-02.rgb"
texture "c172p-int-02.png"
crease 80.000000
numvert 27
-0.596017 0.059132 0.497091
@ -21670,7 +21670,7 @@ OBJECT poly
name "BackSeat"
data 8
Mesh.099
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 28
1.0541 -0.62155 -0.460064
@ -22051,7 +22051,7 @@ OBJECT poly
name "BeaconSwitch"
data 16
RockerSwitch.006
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 10
-0.355953 -0.258566 0.147111
@ -25546,7 +25546,7 @@ OBJECT poly
name "CopilotSeat"
data 13
FrontSeat.002
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 24
0.324408 -0.59928 -0.432994
@ -25811,7 +25811,7 @@ OBJECT poly
name "Exhaust"
data 8
Mesh.108
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 16
-1.29585 -0.770666 -0.290534
@ -26519,7 +26519,7 @@ OBJECT poly
name "LandingLightSwitch"
data 16
RockerSwitch.007
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 10
-0.355953 -0.210915 0.122068
@ -26847,7 +26847,7 @@ OBJECT poly
name "LeftWheel"
data 8
Mesh.013
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 64
0.660989 -1.02105 1.09349
@ -27364,7 +27364,7 @@ OBJECT poly
name "LeftWheelStrut"
data 8
Mesh.014
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 24
0.764081 -0.650906 0.414912
@ -30339,7 +30339,7 @@ OBJECT poly
name "NavLightSwitch"
data 16
RockerSwitch.008
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 10
-0.355953 -0.258566 0.17285
@ -30410,7 +30410,7 @@ OBJECT poly
name "NoseWheel"
data 8
Mesh.003
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 64
-1.0174 -1.06218 -0.04389
@ -30927,7 +30927,7 @@ OBJECT poly
name "NoseWheelStrut"
data 8
Mesh.005
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 24
-0.951212 -0.69659 0.025989
@ -33719,7 +33719,7 @@ OBJECT poly
name "PilotSeat"
data 13
FrontSeat.003
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 24
0.324408 -0.59928 0.05193
@ -33926,7 +33926,7 @@ OBJECT poly
name "PitotHeatSwitch"
data 16
RockerSwitch.009
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 10
-0.355953 -0.258566 0.198937
@ -33997,7 +33997,7 @@ OBJECT poly
name "PitotTube"
data 8
Mesh.111
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 9
-0.227717 0.464279 1.53536
@ -35166,7 +35166,7 @@ OBJECT poly
name "Propeller"
data 8
Mesh.102
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 26
-1.80489 -0.18863 0.878791
@ -35401,7 +35401,7 @@ OBJECT poly
name "Propeller.Fast"
data 8
Mesh.136
texture "c172p-01.rgb"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 32
-1.78664 0.657935 -0.710061
@ -35622,7 +35622,7 @@ OBJECT poly
name "Propeller.Slow"
data 8
Mesh.137
texture "c172p-01.rgb"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 32
-1.78664 0.657935 -0.710061
@ -36100,7 +36100,7 @@ OBJECT poly
name "RightWheel"
data 8
Mesh.070
texture "c172p-02.rgb"
texture "c172p-02.png"
crease 30.000000
numvert 64
0.66085 -1.02854 -1.22172
@ -36617,7 +36617,7 @@ OBJECT poly
name "RightWheelStrut"
data 8
Mesh.004
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 24
0.576418 -1.10992 -1.08343
@ -36692,7 +36692,7 @@ OBJECT poly
name "StrobeSwitch"
data 16
RockerSwitch.010
texture "c172p-int-02.rgb"
texture "c172p-int-02.png"
crease 30.000000
numvert 10
-0.355953 -0.258566 0.122068
@ -36763,7 +36763,7 @@ OBJECT poly
name "TaxiLightSwitch"
data 16
RockerSwitch.011
texture "c172p-int-01.rgb"
texture "c172p-int-01.png"
crease 30.000000
numvert 10
-0.355953 -0.211263 0.147111
@ -42563,7 +42563,7 @@ OBJECT poly
name "baggagedoor"
data 8
Mesh.072
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 44
1.45499 -0.166666 0.478551
@ -44122,7 +44122,7 @@ OBJECT poly
name "charniere3"
data 8
Mesh.191
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 55.000000
numvert 28
-0.128478 -0.335913 0.535157
@ -44317,7 +44317,7 @@ OBJECT poly
name "charniere4"
data 8
Mesh.141
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 55.000000
numvert 28
-0.128478 -0.335913 -0.535158
@ -45270,7 +45270,7 @@ OBJECT poly
name "fairing1"
data 9
Plane.019
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 324
-1.17802 -1.00328 0.034077
@ -47857,7 +47857,7 @@ OBJECT poly
name "fairing2"
data 9
Plane.021
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 324
0.444673 -0.918008 1.18589
@ -50444,7 +50444,7 @@ OBJECT poly
name "fairing3"
data 9
Plane.020
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 324
0.444673 -0.913253 -1.14083
@ -53222,7 +53222,7 @@ OBJECT poly
name "fuselage_1"
data 8
Mesh.073
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 80.000000
numvert 1166
1.73839 0.167172 0
@ -64254,7 +64254,7 @@ OBJECT poly
name "leftdoor"
data 8
Mesh.074
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 125
-0.10498 -0.63518 0.50491
@ -78790,7 +78790,7 @@ OBJECT poly
name "rightdoor"
data 8
Mesh.075
texture "fuselage.n301dp.png"
texture "c172p-fuselage-skyhawk.png"
crease 30.000000
numvert 125
-0.10498 -0.63518 -0.504908

View file

@ -2499,7 +2499,7 @@
<object-name>LeftWheelStrut</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2508,7 +2508,7 @@
<object-name>fairing1</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2517,7 +2517,7 @@
<object-name>fairing2</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2526,7 +2526,7 @@
<object-name>fairing3</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2535,7 +2535,7 @@
<object-name>fuselage</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2547,7 +2547,7 @@
<object-name>charniere4</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2556,7 +2556,7 @@
<object-name>leftdoor</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2565,7 +2565,7 @@
<object-name>rightdoor</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>
@ -2574,7 +2574,7 @@
<object-name>baggagedoor</object-name>
<property-base>sim/model/livery/</property-base>
<texture-prop>texture</texture-prop>
<texture>fuselage.n301dp.png</texture>
<texture>fuselage-n301dp.png</texture>
</animation>
<animation>

View file

@ -36,7 +36,7 @@
<write-mask>false</write-mask>
</depth>
<render-bin>
<bin-number>9</bin-number>
<bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
<texture-unit>

11
Nasal/seaport.nas Normal file
View file

@ -0,0 +1,11 @@
_setlistener("/sim/presets/latitude-deg", func {
print("*** NEW LOCATION ***");
settimer(func {
var typ = getprop("/sim/type");
var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg");
var g = geodinfo(lat, lon);
if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") )
fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" }));
}, 8);
}, 1);

View file

@ -8,7 +8,7 @@
##
###############################################################################
# The cellular automata model used here is based on
# The cellular automata model used here is loosely based on
# A. Hernandez Encinas, L. Hernandez Encinas, S. Hoya White,
# A. Martin del Rey, G. Rodriguez Sanchez,
# "Simulation of forest fire fronts using cellular automata",
@ -127,13 +127,14 @@ var MP_share_pp = "environment/wildfire/share-events";
var save_on_exit_pp = "environment/wildfire/save-on-exit";
var restore_on_startup_pp = "environment/wildfire/restore-on-startup";
var crash_fire_pp = "environment/wildfire/fire-on-crash";
var impact_fire_pp = "environment/wildfire/fire-on-impact";
var report_score_pp = "environment/wildfire/report-score";
# Internal properties to control the models
var models_enabled_pp = "environment/wildfire/models/enabled";
var fire_LOD_pp = "environment/wildfire/models/fire-lod";
var smoke_LOD_pp = "environment/wildfire/models/smoke-lod";
var LOD_High = 20;
var LOD_Low = 80;
var LOD_Low = 50;
var mp_last_limited_event = {}; # source : time
var score = { extinguished : 0, protected : 0, waste : 0 };
@ -201,7 +202,7 @@ var parse_msg = func (source, msg) {
var pos = Binary.decodeCoord(substr(msg, 6));
ignite(pos, 0);
} else {
printlog("warn", "wildfire.nas: Ignored ignite event from " ~
printlog("alert", "wildfire.nas: Ignored ignite event flood from " ~
source.getNode("callsign").getValue());
}
mp_last_limited_event[i] = cur_time;
@ -239,13 +240,13 @@ var SimTime = {
}
};
###############################################################################
# Class that maintains one fire cell.
###############################################################################
# Class that maintains the state of one fire cell.
var FireCell = {
############################################################
new : func (x, y) {
# print("Creating FireCell[" ~ x ~ "," ~ y ~ "]");
trace("Creating FireCell[" ~ x ~ "," ~ y ~ "]");
var m = { parents: [FireCell] };
m.lat = y * CAFire.CELL_SIZE/60.0 + 0.5 * CAFire.CELL_SIZE / 60.0;
m.lon = x * CAFire.CELL_SIZE/60.0 + 0.5 * CAFire.CELL_SIZE / 60.0;
@ -268,7 +269,7 @@ var FireCell = {
m.burn_rate = CAFire.BURN_RATE[mat];
}
}
m.model = CellModel.new(x, y, m.alt);
CAFireModels.add(x, y, m.alt);
append(CAFire.active, m);
CAFire.cells_created += 1;
return m;
@ -279,7 +280,7 @@ var FireCell = {
trace("FireCell[" ~ me.x ~ "," ~me.y ~ "] Ignited!");
me.burning[CAFire.next] = 1;
me.burning[CAFire.old] = 1;
me.model.set_type("fire");
CAFireModels.set_type(me.x, me.y, "fire");
# Prevent update() on this cell in this generation.
me.last = CAFire.generation;
} else {
@ -299,16 +300,16 @@ var FireCell = {
# Prevent update() on this cell in this generation.
me.last = CAFire.generation;
if ((me.state[CAFire.old] > 0.0) and (me.burning[CAFire.old] > 0)) {
me.model.set_type("soot");
CAFireModels.set_type(me.x, me.y, "soot");
} else {
# Use a model representing contamination here.
me.model.set_type(type);
CAFireModels.set_type(me.x, me.y, type);
}
return result;
},
############################################################
update : func () {
# print("FireCell[" ~ me.x ~ "," ~me.y ~ "] " ~ me.state[CAFire.old]);
trace("FireCell[" ~ me.x ~ "," ~me.y ~ "] " ~ me.state[CAFire.old]);
if ((me.state[CAFire.old] == 1) and (me.burning[CAFire.old] == 0))
return 0;
if ((me.burn_rate == 0) and (me.burning[CAFire.old] == 0))
@ -336,7 +337,7 @@ var FireCell = {
return 0;
}
me.burning[CAFire.next] = me.burning[CAFire.old];
me.model.set_type(me.burning[CAFire.old] ? "fire" : "soot");
CAFireModels.set_type(me.x, me.y, me.burning[CAFire.old] ? "fire" : "soot");
return 1;
},
############################################################
@ -401,13 +402,13 @@ var CellModel = {
me.model = nil;
}
me.type = type;
if (CAFire.MODEL[type] == "") return;
if (CAFireModels.MODEL[type] == "") return;
# Always put "cheap" models for now.
if (CAFire.models_enabled or (type != "fire")) {
if (CAFireModels.models_enabled or (type != "fire")) {
me.model =
geo.put_model(CAFire.MODEL[type], me.lat, me.lon, me.alt);
# print("Created 3d model " ~ type ~ " " ~ CAFire.MODEL[type]);
geo.put_model(CAFireModels.MODEL[type], me.lat, me.lon, me.alt);
trace("Created 3d model " ~ type ~ " " ~ CAFireModels.MODEL[type]);
}
},
############################################################
@ -419,7 +420,95 @@ var CellModel = {
};
###############################################################################
# Singleton that maintains the fire CA grid.
# Singleton that maintains the CA models.
var CAFireModels = {};
# Constants
CAFireModels.MODEL = { # Model paths
"fire" : "Models/Effects/Wildfire/wildfire.xml",
"soot" : "Models/Effects/Wildfire/soot.xml",
"foam" : "Models/Effects/Wildfire/foam.xml",
"water" : "",
"protected" : "",
"none" : "",
};
# State
CAFireModels.grid = {}; # Sparse cell model grid storage.
CAFireModels.pending = []; # List of pending model changes.
CAFireModels.models_enabled = 1;
CAFireModels.loopid = 0;
######################################################################
# Public operations
############################################################
CAFireModels.init = func {
# Initialization.
setlistener(models_enabled_pp, func (n) {
me.set_models_enabled(n.getValue());
}, 1);
me.reset(1);
}
############################################################
# Reset the model grid to the empty state.
CAFireModels.reset = func (enabled) {
# Clear the model grid.
foreach (var x; keys(me.grid)) {
foreach (var y; keys(me.grid[x])) {
if (me.grid[x][y] != nil) me.grid[x][y].remove();
}
}
# Reset state.
me.grid = {};
me.pending = [];
me.loopid += 1;
me._loop_(me.loopid);
}
############################################################
# Add a new cell model.
CAFireModels.add = func(x, y, alt) {
append(me.pending, { x: x, y: y, alt: alt });
}
############################################################
# Update a cell model.
CAFireModels.set_type = func(x, y, type) {
append(me.pending, { x: x, y: y, type: type });
}
############################################################
CAFireModels.set_models_enabled = func(on=1) {
me.models_enabled = on;
# We should do a pass over all cells here to add/remove models.
# For now I don't so only active cells will actually remove the
# models. All models will be hidden by their select animations, though.
}
######################################################################
# Private operations
############################################################
CAFireModels.update = func {
var work = size(me.pending)/10;
while (size(me.pending) > 0 and work > 0) {
var c = me.pending[0];
me.pending = subvec(me.pending, 1);
work -= 1;
if (contains(c, "alt")) {
if (me.grid[c.x] == nil) {
me.grid[c.x] = {};
}
me.grid[c.x][c.y] = CellModel.new(c.x, c.y, c.alt);
}
if (contains(c, "type")) {
me.grid[c.x][c.y].set_type(c.type);
}
}
}
############################################################
CAFireModels._loop_ = func(id) {
id == me.loopid or return;
me.update();
settimer(func { me._loop_(id); }, 0);
}
###############################################################################
###############################################################################
# Singleton that maintains the fire cell CA grid.
var CAFire = {};
# State
CAFire.CELL_SIZE = 0.03; # "nm" (or rather minutes)
@ -465,14 +554,6 @@ CAFire.BURN_RATE = { # Burn rate DB. grid widths per second
# ?
"Landmass" : 0.0005
};
CAFire.MODEL = { # Model paths
"fire" : "Models/Effects/Wildfire/wildfire.xml",
"soot" : "Models/Effects/Wildfire/soot.xml",
"foam" : "Models/Effects/Wildfire/foam.xml",
"water" : "",
"protected" : "",
"none" : "",
};
CAFire.NEIGHBOURS = # Neighbour index offsets. First row and column
# and then diagonal.
[[[-1, 0], [0, 1], [1, 0], [0, -1]],
@ -482,21 +563,13 @@ CAFire.NEIGHBOURS = # Neighbour index offsets. First row and column
############################################################
CAFire.init = func {
# Initialization.
setlistener(models_enabled_pp, func (n) {
me.set_models_enabled(n.getValue());
}, 1);
me.reset(1, SimTime.current_time());
}
############################################################
# Reset the CA to the empty state and set its current time to sim_time.
CAFire.reset = func (enabled, sim_time) {
# Clear the grid.
foreach (var x; keys(me.grid)) {
foreach (var y; keys(me.grid[x])) {
if (me.grid[x][y].model != nil) me.grid[x][y].model.remove();
me.grid[x][y] = nil;
}
}
# Clear the model grid.
CAFireModels.reset(enabled);
# Reset state.
me.grid = {};
me.generation = int(sim_time/CAFire.GENERATION_DURATION);
@ -517,7 +590,7 @@ CAFire.reset = func (enabled, sim_time) {
############################################################
# Start a fire in the cell at pos.
CAFire.ignite = func (lat, lon) {
# print("Fire at " ~ lat ~", " ~ lon ~ ".");
trace("CAFire.ignite: Fire at " ~ lat ~", " ~ lon ~ ".");
var x = int(lon*60/me.CELL_SIZE);
var y = int(lat*60/me.CELL_SIZE);
var cell = me.get_cell(x, y);
@ -536,17 +609,16 @@ CAFire.ignite = func (lat, lon) {
# radius - meter : double
# Note: volume is unused ATM.
CAFire.resolve_water_drop = func (lat, lon, radius, volume=0) {
trace("CAFire.resolve_water_drop: Dumping water at " ~ lat ~", " ~ lon ~
" radius " ~ radius ~".");
var x = int(lon*60/me.CELL_SIZE);
var y = int(lat*60/me.CELL_SIZE);
var r = int(2*radius/(me.CELL_SIZE*1852.0));
# print("Dumping water at " ~ lat ~", " ~ lon ~
# ". Center (" ~ x ~ "," ~ y ~ ") radius " ~ r ~".");
var result = { extinguished : 0, protected : 0, waste : 0 };
for (var dx = -r; dx <= r; dx += 1) {
for (var dy = -r; dy <= r; dy += 1) {
var cell = me.get_cell(x + dx, y + dy);
if (cell == nil) {
# print(" (" ~ (x + dx) ~ ", " ~ (y + dy) ~ ")");
cell = FireCell.new(x + dx, y + dy);
me.set_cell(x + dx, y + dy,
cell);
@ -583,17 +655,16 @@ CAFire.resolve_retardant_drop = func (lat, lon, radius, volume=0) {
# radius - meter : double
# Note: volume is unused ATM.
CAFire.resolve_foam_drop = func (lat, lon, radius, volume=0) {
trace("CAFire.resolve_foam_drop: Dumping foam at " ~ lat ~", " ~ lon ~
" radius " ~ radius ~".");
var x = int(lon*60/me.CELL_SIZE);
var y = int(lat*60/me.CELL_SIZE);
var r = int(2*radius/(me.CELL_SIZE*1852.0));
# print("Dumping foam at " ~ lat ~", " ~ lon ~
# ". Center (" ~ x ~ "," ~ y ~ ") radius " ~ r ~".");
var result = { extinguished : 0, protected : 0, waste : 0 };
for (var dx = -r; dx <= r; dx += 1) {
for (var dy = -r; dy <= r; dy += 1) {
var cell = me.get_cell(x + dx, y + dy);
if (cell == nil) {
# print(" (" ~ (x + dx) ~ ", " ~ (y + dy) ~ ")");
cell = FireCell.new(x + dx, y + dy);
me.set_cell(x + dx, y + dy,
cell);
@ -660,12 +731,12 @@ CAFire.load_event_log = func (filename, skip_ahead_until=-1) {
if (!fgcommand("loadxml",
props.Node.new({ filename : filename,
targetnode : logbase }))) {
printlog("warn", "Wildfire ... failed loading '" ~ filename ~ "'");
printlog("alert", "Wildfire ... failed loading '" ~ filename ~ "'");
return;
}
# Fast forward the automaton from the first logged event to the current time.
me.set_models_enabled(0);
CAFireModels.set_models_enabled(0);
var first = 1;
var events = props.globals.getNode(logbase).getChildren("event");
foreach (var event; events) {
@ -719,14 +790,7 @@ CAFire.load_event_log = func (filename, skip_ahead_until=-1) {
while (me.generation * me.GENERATION_DURATION < now)
me.update();
}
me.set_models_enabled(getprop(models_enabled_pp));
}
############################################################
CAFire.set_models_enabled = func(on=1) {
me.models_enabled = on;
# We should do a pass over all cells here to add/remove models.
# For now I don't so only active cells will actually remove the
# models. All models will be hidden by there select animations, though.
CAFireModels.set_models_enabled(getprop(models_enabled_pp));
}
######################################################################
# Internal operations
@ -820,6 +884,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
});
props.globals.initNode(MP_share_pp, 1, "BOOL");
props.globals.initNode(crash_fire_pp, 1, "BOOL");
props.globals.initNode(impact_fire_pp, 1, "BOOL");
props.globals.initNode(save_on_exit_pp, 0, "BOOL");
props.globals.initNode(restore_on_startup_pp, 0, "BOOL");
props.globals.initNode(models_enabled_pp, 1, "BOOL");
@ -855,6 +920,22 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
wildfire.ignite(geo.aircraft_position());
});
# Detect impact
var impact_node = props.globals.getNode("sim/ai/aircraft/impact/bomb", 1);
setlistener("sim/ai/aircraft/impact/bomb", func(n) {
if (getprop(impact_fire_pp) and n.getBoolValue()){
var node = props.globals.getNode(n.getValue(), 1);
var impactpos = geo.Coord.new();
impactpos.set_latlon(
node.getNode("impact/latitude-deg").getValue(),
node.getNode("impact/longitude-deg").getValue()
);
wildfire.ignite(impactpos);
}
});
printlog("info", "Wildfire ... initialized.");
});
###############################################################################
@ -917,6 +998,7 @@ var dialog = {
["Share over MP", MP_share_pp],
["Show 3d models", models_enabled_pp],
["Crash starts fire", crash_fire_pp],
["Impact starts fire", impact_fire_pp],
["Report score", report_score_pp],
["Save on exit", save_on_exit_pp]]) {
var w = content.addChild("checkbox");

View file

@ -9,6 +9,8 @@ uniform sampler3D NoiseTex;
uniform sampler2D SampleTex;
uniform sampler1D ColorsTex;
varying vec4 constantColor;
uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0;
@ -57,7 +59,7 @@ void main (void)
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz));
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
c1 *= ambient_light;
vec4 finalColor = c1;

View file

@ -4,6 +4,7 @@ varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 Normal;
varying vec4 constantColor;
void main(void)
{
@ -14,6 +15,10 @@ void main(void)
VNormal = normalize(gl_NormalMatrix * gl_Normal);
Normal = normalize(gl_Normal);
gl_FrontColor = gl_Color;
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
}

123
gui/dialogs/seaport.xml Normal file
View file

@ -0,0 +1,123 @@
<?xml version="1.0"?>
<PropertyList>
<name>seaport</name>
<layout>vbox</layout>
<nasal>
<!--
Our coastlines are too unrealiable to just teleport to the nearest seaport.
We may have to search around its reported location until we actually find water.
-->
<open>
var label = cmdarg().getNode("text/label");
var apt = airportinfo("seaport");
var rwys = apt.runways;
var lat = apt.lat;
var lon = apt.lon;
label.setValue(" The nearest seaport is \"" ~ apt.name ~ "\" (" ~ apt.id ~ ") ");
var goto_seaport = func {
var rwyid = keys(rwys)[0];
var rwy = rwys[rwyid];
print("SP: going to seaport ", apt.id, "/", rwyid, " (\"", apt.name, "\")");
setprop("/sim/presets/airport-id", apt.id);
teleport(rwy.lat, rwy.lon);
settimer(verify, 4);
}
var verify = func {
var p = geo.aircraft_position();
if (on_water(p.lat(), p.lon())) {
print("SP: seaport center is on water");
return;
}
foreach (var r; keys(rwys)) {
print("SP: trying runway ", r);
var lat = rwys[r].lat;
var lon = rwys[r].lon;
if (on_water(lat, lon)) {
setprop("/sim/presets/runway", r);
setprop("/sim/presets/heading-deg", rwys[r].heading);
print("SP: runway ", r, " is on water");
return teleport(lat, lon);
}
}
print("SP: trying circle");
for (var dist = 500; dist &lt;= 1500; dist += 500) {
print("SP:\tat distance ", dist, " m");
for (var course = 0; course &lt; 360; course += 60) {
print("SP:\t\tat course ", course, " degree");
p.set_latlon(apt.lat, apt.lon);
p.apply_course_distance(course, dist);
if (on_water(p.lat(), p.lon())) {
print("SP: found water");
setprop("/sim/presets/heading-deg", course);
return teleport(p.lat(), p.lon());
}
}
}
print("SP: no water found");
}
var teleport = func(lat, lon) {
setprop("/sim/presets/latitude-deg", lat);
setprop("/sim/presets/longitude-deg", lon);
fgcommand("presets-commit");
}
var on_water = func(lat, lon) {
var g = geodinfo(lat, lon);
return g != nil and g[1] != nil and !g[1].solid;
}
</open>
</nasal>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Location inappropriate for a seaplane</label>
</text>
<empty><stretch>1</stretch></empty>
</group>
<hrule/>
<text>
<label></label>
</text>
<group>
<layout>hbox</layout>
<button>
<legend>Stay anyway</legend>
<equal>1</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Go to seaport</legend>
<default>1</default>
<equal>1</equal>
<binding>
<command>nasal</command>
<script>goto_seaport()</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -597,7 +597,9 @@ Started September 2000 by David Megginson, david@megginson.com
<traffic-manager>
<enabled type="bool">true</enabled>
<heuristics type="bool">true</heuristics>
<datafile type="string"></datafile>
<instantaneous-action type="bool">false</instantaneous-action>
<dumpdata type="bool">false</dumpdata>
<proportion>1.0</proportion>
</traffic-manager>