Changeset 253 for trunk/src/pyspacewar/ui.py
- Timestamp:
- 01/07/07 02:05:49 (5 years ago)
- Files:
-
- 1 modified
-
trunk/src/pyspacewar/ui.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/pyspacewar/ui.py
r250 r253 1447 1447 """Initialize the mode.""" 1448 1448 self.menu_items = [ 1449 ('Screen size :%dx%d' % self.ui.fullscreen_mode,1449 ('Screen size\t%dx%d' % self.ui.fullscreen_mode, 1450 1450 self.ui.screen_resolution_menu), 1451 (self.ui.fullscreen and ' Windowed mode'1452 or 'Full screen mode ',1451 (self.ui.fullscreen and 'Full screen mode\ton' 1452 or 'Full screen mode\toff', 1453 1453 self.toggle_fullscreen), 1454 (self.ui.show_missile_trails and ' Hide missile orbits'1455 or ' Show missile orbits',1454 (self.ui.show_missile_trails and 'Missile orbits\ton' 1455 or 'Missile orbits\toff', 1456 1456 self.toggle_missile_orbits), 1457 (self.ui.sound_in_vacuum and 'Sound in vacuum\ton' 1458 or 'Sound in vacuum\toff', 1459 self.toggle_sound_in_vacuum), 1457 1460 ('Controls', self.ui.controls_menu), 1458 1461 ('Return to main menu', self.close_menu), … … 1481 1484 """Toggle missile orbits and reflect the setting in the menu.""" 1482 1485 self.ui.toggle_missile_orbits() 1486 self.reinit_menu() 1487 1488 def toggle_sound_in_vacuum(self): 1489 """Toggle sound in vacuum and reflect the setting in the menu.""" 1490 self.ui.toggle_sound_in_vacuum() 1483 1491 self.reinit_menu() 1484 1492 … … 1784 1792 fullscreen_mode = None # Desired video mode (w, h) 1785 1793 show_missile_trails = True # Show missile trails by default 1794 sound_in_vacuum = True # Can you hear what happens to AI ships? 1786 1795 show_debug_info = False # Hide debug info by default 1787 1796 desired_zoom_level = 1.0 # The desired zoom level … … 1833 1842 self.show_missile_trails = config.getboolean('video', 1834 1843 'show_missile_trails') 1844 self.sound_in_vacuum = config.getboolean('sound', 1845 'sound_in_vacuum') 1835 1846 for action in self.controls: 1836 1847 key = config.get('controls', action) … … 1863 1874 config.set('video', 'show_missile_trails', 1864 1875 str(self.show_missile_trails)) 1876 config.add_section('sound') 1877 config.set('sound', 'sound_in_vacuum', str(self.sound_in_vacuum)) 1865 1878 config.add_section('controls') 1866 1879 for action, keys in self.controls.items(): … … 2296 2309 self.show_missile_trails = not self.show_missile_trails 2297 2310 2311 def toggle_sound_in_vacuum(self): 2312 """Toggle sound in vacuum.""" 2313 self.sound_in_vacuum = not self.sound_in_vacuum 2314 2298 2315 def toggle_ai(self, player_id): 2299 2316 """Toggle AI control for player.""" … … 2337 2354 """Play a sound effect when the player's ship bounces off something.""" 2338 2355 player_id = self.ships.index(ship) 2339 if not self.ai_controlled[player_id] :2356 if not self.ai_controlled[player_id] or self.sound_in_vacuum: 2340 2357 self.fire_sound.play() 2341 2358 … … 2343 2360 """Play a sound effect when the player's ship bounces off something.""" 2344 2361 player_id = self.ships.index(ship) 2345 if not self.ai_controlled[player_id] and not ship.dead: 2346 self.bounce_sound.play() 2362 if not ship.dead: 2363 # It sounds weird to hear that sound when dead ships bounce 2364 if not self.ai_controlled[player_id] or self.sound_in_vacuum: 2365 self.bounce_sound.play() 2347 2366 2348 2367 def hit_effect_Ship(self, ship, missile): 2349 2368 """Play a sound effect when the player's ship is hit.""" 2350 2369 player_id = self.ships.index(ship) 2351 if not self.ai_controlled[player_id] :2370 if not self.ai_controlled[player_id] or self.sound_in_vacuum: 2352 2371 self.hit_sound.play() 2353 2372 … … 2355 2374 """Play a sound effect when the player's ship explodes.""" 2356 2375 player_id = self.ships.index(ship) 2357 if not self.ai_controlled[player_id] :2376 if not self.ai_controlled[player_id] or self.sound_in_vacuum: 2358 2377 self.explode_sound.play() 2359 2378 … … 2367 2386 makes_noise = False 2368 2387 for player_id, ship in enumerate(self.ships): 2369 if not self.ai_controlled[player_id] :2388 if not self.ai_controlled[player_id] or self.sound_in_vacuum: 2370 2389 makes_noise = (ship.forward_thrust or ship.rear_thrust or 2371 2390 ship.left_thrust or ship.right_thrust or
