Mercurial > fife-parpg
changeset 6:61fdc090b0d4
both techdemo maps are now loaded correctly. Still segfaulting when scripts end
author | jasoka@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 05 Jul 2008 09:14:21 +0000 |
parents | 427bb0de3e29 |
children | 4ae1f92f3340 |
files | clients/rio_de_hola/maps/shrine.xml clients/rio_de_hola/settings.py engine/core/model/structures/layer.cpp |
diffstat | 3 files changed, 36 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/clients/rio_de_hola/maps/shrine.xml Fri Jul 04 19:02:53 2008 +0000 +++ b/clients/rio_de_hola/maps/shrine.xml Sat Jul 05 09:14:21 2008 +0000 @@ -57,7 +57,7 @@ <import file="../objects/items/beebox/object.xml"></import> <import file="../objects/agents/beekeeper/object.xml"></import> <import file="../objects/agents/hippie_priest/object.xml"></import> - <layer x_offset="0.0" pathing="cell_edges_only" y_offset="0.0" grid_type="square" id="TileLayer" x_scale="1.0" y_scale="1.0" rotation="0.0"> + <layer x_offset="0.0" pathing="cell_edges_only" y_offset="0.0" grid_type="square" id="TechdemoMapTileLayer" x_scale="1.0" y_scale="1.0" rotation="0.0"> <instances> <i x="-1.0" o="sands:01" y="1.0" r="0" z="0.0" ns="http://www.fifengine.de/xml/rio_de_hola"></i> <i x="0.0" o="sands:01" z="0.0" y="1.0" r="0"></i> @@ -5166,7 +5166,7 @@ <i x="-43.0" o="sands:02" z="0.0" y="-31.0" r="0"></i> </instances> </layer> - <layer x_offset="0.0" pathing="cell_edges_only" y_offset="0.0" grid_type="square" id="ObjectLayer" x_scale="0.5" y_scale="0.5" rotation="0.0"> + <layer x_offset="0.0" pathing="cell_edges_only" y_offset="0.0" grid_type="square" id="TechdemoMapGroundObjectLayer" x_scale="0.5" y_scale="0.5" rotation="0.0"> <instances> <i x="8.0" o="shrine" z="0.0" y="-1.0" r="180"></i> <i x="11.0" o="shrine" z="0.0" y="-1.0" r="0"></i> @@ -6102,10 +6102,12 @@ <i x="-41.0" o="beebox" z="0.0" y="-34.0" r="90"></i> <i x="-40.0" o="beekeeper" z="0.0" y="-31.0" r="180"></i> <i x="43.0" o="hippie_priest" z="0.0" y="19.0" r="180"></i> + <i r="0" id="PC" z="0.0" x="5.0" o="boy" y="4.0"></i> + <i r="0" id="NPC:girl" z="0.0" x="8.0" o="girl" y="2.0"></i> </instances> </layer> - <camera ref_cell_width="128" zoom="1.157625" tilt="-42.0" viewport="0,0,1280,960" id="main" ref_layer_id="TileLayer" ref_cell_height="96" rotation="45.0"> + <camera ref_cell_width="128" zoom="1.157625" tilt="-42.0" viewport="0,0,1280,960" id="main" ref_layer_id="TechdemoMapTileLayer" ref_cell_height="96" rotation="45.0"> </camera> - <camera ref_cell_width="128" zoom="1.0" tilt="-42.0" viewport="10,10,400,250" id="small" ref_layer_id="TileLayer" ref_cell_height="96" rotation="45.0"> + <camera ref_cell_width="128" zoom="1.0" tilt="-42.0" viewport="10,10,400,250" id="small" ref_layer_id="TechdemoMapTileLayer" ref_cell_height="96" rotation="45.0"> </camera> </map>
--- a/clients/rio_de_hola/settings.py Fri Jul 04 19:02:53 2008 +0000 +++ b/clients/rio_de_hola/settings.py Sat Jul 05 09:14:21 2008 +0000 @@ -6,7 +6,7 @@ SDLRemoveFakeAlpha = 1 ScreenWidth = 1024 ScreenHeight = 768 -MapFile = 'maps/testmap3.xml' +MapFile = 'maps/shrine.xml' Font = 'fonts/samanata.ttf' FontGlyphs = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\""
--- a/engine/core/model/structures/layer.cpp Fri Jul 04 19:02:53 2008 +0000 +++ b/engine/core/model/structures/layer.cpp Sat Jul 05 09:14:21 2008 +0000 @@ -119,35 +119,39 @@ } void Layer::getMinMaxCoordinates(ModelCoordinate& min, ModelCoordinate& max, const Layer* layer) const { - - if(layer == 0) { + if (!layer) { layer = this; } - min = m_instances.front()->getLocationRef().getLayerCoordinates(layer); - max = min; - - for(std::vector<Instance*>::const_iterator i = m_instances.begin(); - i != m_instances.end(); - ++i) { - - ModelCoordinate coord = (*i)->getLocationRef().getLayerCoordinates(layer); - - if(coord.x < min.x) { - min.x = coord.x; + bool first_found = false; + for (std::vector<Instance*>::const_iterator i = m_instances.begin(); i != m_instances.end(); ++i) { + if (!first_found) { + min = m_instances.front()->getLocationRef().getLayerCoordinates(layer); + max = min; + first_found = true; + } else { + ModelCoordinate coord = (*i)->getLocationRef().getLayerCoordinates(layer); + + if(coord.x < min.x) { + min.x = coord.x; + } + + if(coord.x > max.x) { + max.x = coord.x; + } + + if(coord.y < min.y) { + min.y = coord.y; + } + + if(coord.y > max.y) { + max.y = coord.y; + } } - - if(coord.x > max.x) { - max.x = coord.x; - } - - if(coord.y < min.y) { - min.y = coord.y; - } - - if(coord.y > max.y) { - max.y = coord.y; - } + } + if (!first_found) { + min = ModelCoordinate(); + max = min; } }