Mercurial > parpg-core
comparison src/parpg/gamescenecontroller.py @ 12:d60f1dab8469
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 | 1fd2201f5c36 |
children | aa3d837024a3 |
comparison
equal
deleted
inserted
replaced
11:4706e0194af3 | 12:d60f1dab8469 |
---|---|
92 self.resetMouseCursor() | 92 self.resetMouseCursor() |
93 self.paused = False | 93 self.paused = False |
94 | 94 |
95 if model.settings.fife.EnableSound: | 95 if model.settings.fife.EnableSound: |
96 if not self.view.sounds.music_init: | 96 if not self.view.sounds.music_init: |
97 music_file = random.choice(glob.glob(os.path.join( | 97 music_path = 'music' |
98 "music", | 98 music_file = random.choice( |
99 "*.ogg"))) | 99 glob.glob('/'.join([music_path, '*.ogg'])) |
100 ) | |
100 self.view.sounds.playMusic(music_file) | 101 self.view.sounds.playMusic(music_file) |
101 self.initHud() | 102 self.initHud() |
102 | 103 |
103 | 104 |
104 def initHud(self): | 105 def initHud(self): |
133 self.model.active_map.toggleRenderer('CoordinateRenderer') | 134 self.model.active_map.toggleRenderer('CoordinateRenderer') |
134 if(key_val == key.F7): | 135 if(key_val == key.F7): |
135 # F7 saves a screenshot to screenshots directory | 136 # F7 saves a screenshot to screenshots directory |
136 | 137 |
137 settings = self.model.settings | 138 settings = self.model.settings |
139 # FIXME M. George Hansen 2011-06-06: Not sure that user_path is set | |
140 # correctly atm. | |
138 screenshot_directory = os.path.join(settings.user_path, | 141 screenshot_directory = os.path.join(settings.user_path, |
139 settings.parpg.ScreenshotsPath) | 142 'screenshots') |
140 # try to create the screenshots directory | 143 # try to create the screenshots directory |
141 try: | 144 try: |
142 os.mkdir(screenshot_directory) | 145 os.mkdir(screenshot_directory) |
143 #TODO: distinguish between already existing permissions error | 146 #TODO: distinguish between already existing permissions error |
144 except OSError: | 147 except OSError: |
254 direction = self.scroll_direction | 257 direction = self.scroll_direction |
255 #up | 258 #up |
256 if mouse_y <= pixle_edge: | 259 if mouse_y <= pixle_edge: |
257 direction[0] += 1 | 260 direction[0] += 1 |
258 direction[1] -= 1 | 261 direction[1] -= 1 |
259 image = os.path.join(settings.system_path, | 262 image = '/'.join(['gui/cursors', settings.parpg.CursorUp]) |
260 settings.parpg.GuiPath, | |
261 settings.parpg.CursorPath, | |
262 settings.parpg.CursorUp) | |
263 | 263 |
264 #right | 264 #right |
265 if mouse_x >= screen_width - pixle_edge: | 265 if mouse_x >= screen_width - pixle_edge: |
266 direction[0] += 1 | 266 direction[0] += 1 |
267 direction[1] += 1 | 267 direction[1] += 1 |
268 image = os.path.join(settings.system_path, | 268 image = '/'.join(['gui/cursors', settings.parpg.CursorRight]) |
269 settings.parpg.GuiPath, | |
270 settings.parpg.CursorPath, | |
271 settings.parpg.CursorRight) | |
272 | 269 |
273 #down | 270 #down |
274 if mouse_y >= screen_height - pixle_edge: | 271 if mouse_y >= screen_height - pixle_edge: |
275 direction[0] -= 1 | 272 direction[0] -= 1 |
276 direction[1] += 1 | 273 direction[1] += 1 |
277 image = os.path.join(settings.system_path, | 274 image = '/'.join(['gui/cursors', settings.parpg.CursorDown]) |
278 settings.parpg.GuiPath, | |
279 settings.parpg.CursorPath, | |
280 settings.parpg.CursorDown) | |
281 | 275 |
282 #left | 276 #left |
283 if mouse_x <= pixle_edge: | 277 if mouse_x <= pixle_edge: |
284 direction[0] -= 1 | 278 direction[0] -= 1 |
285 direction[1] -= 1 | 279 direction[1] -= 1 |
286 image = os.path.join(settings.system_path, | 280 image = '/'.join(['gui/cursors', settings.parpg.CursorLeft]) |
287 settings.parpg.GuiPath, | |
288 settings.parpg.CursorPath, | |
289 settings.parpg.CursorLeft) | |
290 | 281 |
291 if image is not None and not data_drag.dragging: | 282 if image is not None and not data_drag.dragging: |
292 self.setMouseCursor(image, image) | 283 self.setMouseCursor(image, image) |
293 | 284 |
294 | 285 |
308 pc_agent["Inventory"] = \ | 299 pc_agent["Inventory"] = \ |
309 player_char.inventory.serializeInventory() | 300 player_char.inventory.serializeInventory() |
310 player_agent = self.model.active_map.\ | 301 player_agent = self.model.active_map.\ |
311 agent_layer.getInstance("PlayerCharacter") | 302 agent_layer.getInstance("PlayerCharacter") |
312 self.model.active_map.agent_layer.deleteInstance(player_agent) | 303 self.model.active_map.agent_layer.deleteInstance(player_agent) |
304 | |
313 self.model.loadMap(self.model.target_map_name) | 305 self.model.loadMap(self.model.target_map_name) |
306 | |
314 self.model.setActiveMap(self.model.target_map_name) | 307 self.model.setActiveMap(self.model.target_map_name) |
315 self.model.readAgentsOfMap(self.model.target_map_name) | 308 self.model.readAgentsOfMap(self.model.target_map_name) |
309 | |
316 self.model.placeAgents() | 310 self.model.placeAgents() |
317 self.model.placePC() | 311 self.model.placePC() |
318 self.model.map_change = False | 312 self.model.map_change = False |
319 # The PlayerCharacter has an inventory, and also some | 313 # The PlayerCharacter has an inventory, and also some |
320 # filling of the ready slots in the HUD. | 314 # filling of the ready slots in the HUD. |