Mercurial > parpg-source
diff gamemap.py @ 2:06145a6ee387
Fixed resource path dependencies issue that caused PARPG to crash on start.
* PARPG should now run without issue (system installation not tested).
* Utilized FIFE's VFS module to remove path dependencies from most PARPG modules.
* The new parpg.vfs module is a singleton with a single global variable, VFS, which is a reference to the global VFS instance. Although a singleton is not ideal it should be replaced once PARPG's core code is refactored.
* The parpg.vfs singleton is initialized in the parpg.applicaiton.PARPGApplication class with the absolute path to the data directory via the parpg.settings module and corresponding configuration file.
* A new DataPath entry was added to the default system configuration file template under the [parpg] section to support the new parpg.vfs module.
* Updated the parpg-assets subrepo to revision 3 to fix some dialog file format issues (for details see commit message for parpg-assets).
* Fixed a few bugs in the parpg.dialogueparsers.YAMLDialogueParser class related to exception handling.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Mon, 06 Jun 2011 15:56:14 -1000 |
parents | 7a89ea5404b1 |
children | 98f26f7636d8 |
line wrap: on
line diff
--- a/gamemap.py Tue May 31 02:46:20 2011 -0700 +++ b/gamemap.py Mon Jun 06 15:56:14 2011 -1000 @@ -14,7 +14,6 @@ # along with PARPG. If not, see <http://www.gnu.org/licenses/>. from fife import fife - from fife.extensions.loaders import loadMapFile class GameMap(fife.MapChangeListener): @@ -25,6 +24,7 @@ self.map = None self.engine = engine self.model = model + self.settings = self.model.settings # init map attributes self.my_cam_id = None @@ -46,6 +46,7 @@ if self.map: self.model.deleteObjects() self.model.deleteMap(self.map) + self.transitions = [] self.map = None self.agent_layer = None @@ -71,7 +72,9 @@ @param filename: Name of map to load @return: None""" self.reset() + self.map = loadMapFile(filename, self.engine) + self.agent_layer = self.map.getLayer('ObjectLayer') self.top_layer = self.map.getLayer('TopLayer') @@ -88,8 +91,8 @@ the proper camera is set as the 'main' camera. At this point we also set the viewport to the current resolution.""" for cam in self.map.getCameras(): - width = self.model.settings.fife.ScreenWidth - height = self.model.settings.fife.ScreenHeight + width = self.settings.fife.ScreenWidth + height = self.settings.fife.ScreenHeight viewport = fife.Rect(0, 0, width, height) cam.setViewPort(viewport) self.my_cam_id = cam.getId() @@ -108,9 +111,10 @@ rend = fife.FloatingTextRenderer.getInstance(self.cameras[ self.my_cam_id ]) - text = self.engine.getGuiManager().\ - createFont('fonts/rpgfont.png', 0, \ - self.model.settings.fife.FontGlyphs) + text = self.engine.getGuiManager().createFont('fonts/rpgfont.png', + 0, + self.settings.fife.FontGlyphs) + rend.changeDefaultFont(text) rend.activateAllLayers(self.map) rend.setEnabled(True)