Ignore:
Timestamp:
03/01/11 21:30:33 (8 years ago)
Author:
aspidites
Message:

Patch by Aspidites:

+ maps load properly once again
+ obsoleted get/set methods in settings.py

  • pc speed is no longer set, so walk speed is unbearably slow
Location:
branches/active/character_customization/game/parpg
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/active/character_customization/game/parpg/application.py

    r754 r756  
    2323from fife.extensions.basicapplication import ApplicationBase 
    2424 
     25from parpg import console 
    2526from parpg.gamemodel import GameModel 
    2627from parpg.mainmenuview import MainMenuView 
    27 from parpg import console 
    2828from parpg.mainmenucontroller import MainMenuController 
    2929from parpg.common.listeners.event_listener import EventListener 
     
    128128        #self.engine.getModel(self) 
    129129        self.model = GameModel(self.engine, setting) 
    130         self.model.maps_file = self._setting.parpg.MapsFile 
    131130        self.model.readMapFiles() 
    132         self.model.object_db_file = self._setting.parpg.ObjectDatabaseFile 
    133131        self.model.readObjectDB() 
    134         self.model.agents_directory = self._setting.parpg.AgentsDirectory 
    135132        self.model.getAgentImportFiles() 
    136         self.model.all_agents_file = self._setting.parpg.AllAgentsFile 
    137133        self.model.readAllAgents() 
    138         self.model.dialogues_directory = self._setting.parpg.DialoguesDirectory 
    139134        self.model.getDialogues() 
    140135        self.view = MainMenuView(self.engine, self.model) 
     
    143138        self.event_listener = EventListener(self.engine) 
    144139        self.controllers = [] 
    145         controller = MainMenuController(self.engine,  
    146                                                         self.view,  
    147                                                         self.model, 
    148                                                         self) 
     140        controller = MainMenuController(self.engine, self.view, self.model,  
     141                                        self) 
    149142        #controller.initHud() 
    150143        self.controllers.append(controller) 
  • branches/active/character_customization/game/parpg/charactercreationcontroller.py

    r745 r756  
    4646        self.application.view = view 
    4747        self.application.switchController(controller) 
    48         start_map = self.model.settings.get("PARPG", "Map") 
     48        start_map = self.model.settings.parpg.Map 
    4949        self.model.changeMap(start_map) 
    5050     
  • branches/active/character_customization/game/parpg/gamemodel.py

    r753 r756  
    5555        @type emgome: fife.Engine  
    5656        @param setting: The applications settigns 
    57         @type setting: fife_settings.Setting  
     57        @type setting: parpg.settings.Settings object 
    5858        @return: None""" 
    5959        self.map_change = False 
     
    7373        self.engine = engine 
    7474        self.fife_model = engine.getModel() 
    75         self.game_state.maps_file = "maps/maps.yaml" 
    76         self.all_agents_file = "maps/all_agents.yaml" 
    77         self.object_db_file = "objects/object_database.yaml" 
    78         self.agents_directory = "objects/" 
    79         self.dialogues_directory = "dialogue" 
     75 
     76        # set values from settings 
     77        self.game_state.maps_file = settings.parpg.MapsFile 
     78        self.all_agents_file = settings.parpg.AllAgentsFile 
     79        self.object_db_file = settings.parpg.ObjectDatabaseFile 
     80        self.agents_directory = settings.parpg.AgentsDirectory 
     81        self.dialogues_directory = settings.parpg.DialoguesDirectory 
    8082        self.dialogues = {} 
    8183        self.agent_import_files = {} 
     
    718720    def getAgentImportFiles(self): 
    719721        """Searches the agents directory for import files """ 
    720         print self.agents_directory 
    721722        files = locateFiles("*.xml", self.agents_directory) 
    722723        for xml_file in files: 
  • branches/active/character_customization/game/parpg/gamescenecontroller.py

    r736 r756  
    9191        self.paused = False 
    9292 
    93         if model.settings.get("FIFE",  "PlaySounds"): 
     93        if model.settings.fife.PlaySounds: 
    9494            if not self.view.sounds.music_init: 
    9595                music_file = random.choice(glob.glob(os.path.join( 
     
    243243                direction[0] += 1 
    244244                direction[1] -= 1 
    245                 image = settings.get("PARPG", "CursorUp") 
     245                image = settings.parpg.CursorUp 
    246246                 
    247247            #right 
     
    249249                direction[0] += 1 
    250250                direction[1] += 1 
    251                 image = settings.get("PARPG", "CursorRight") 
     251                image = settings.parpg.CursorRight 
    252252                 
    253253            #down 
     
    255255                direction[0] -= 1 
    256256                direction[1] += 1 
    257                 image = settings.get("PARPG", "CursorDown") 
     257                image = settings.parpg.CursorDown 
    258258                 
    259259            #left 
     
    261261                direction[0] -= 1 
    262262                direction[1] -= 1 
    263                 image = settings.get("PARPG", "CursorLeft") 
     263                image = settings.parpg.CursorLeft 
    264264             
    265265            if image != None and not data_drag.dragging: 
  • branches/active/character_customization/game/parpg/mainmenucontroller.py

    r736 r756  
    3434    def __init__(self, engine, view, model, application): 
    3535        """Constructor""" 
    36         ControllerBase.__init__(self, engine, view, model, application) 
     36        super(MainMenuController, self).__init__(engine, view, model,  
     37                                                 application) 
    3738     
    3839        #this can be helpful for IDEs code analysis 
     
    9495           @return: None""" 
    9596        self.application.listener.quitGame() 
    96  
    97  
  • branches/active/character_customization/game/parpg/objects/actors.py

    r755 r756  
    2424from composed import CarryableItem 
    2525from parpg.inventory import Inventory 
    26 from parpg.common.utils import loadSettings 
    2726 
    2827"""All actors go here. Concrete classes only.""" 
     
    5150        self.state = _AGENT_STATE_NONE 
    5251        # TODO: rework/improve 
    53         self.speed = Settings.get("PARPG", "PCSpeed") - 1 
     52        #self.speed = Settings.get("PARPG", "PCSpeed") - 1 
    5453         
    5554    def getX(self): 
     
    8988        self.idle_counter = 1 
    9089        # TODO: rework/improve 
    91         self.speed = Settings.get("PARPG", "PCSpeed") 
     90        #self.speed = Settings.get("PARPG", "PCSpeed") 
    9291        self.nextAction = None 
    9392        self.agent = None 
  • branches/active/character_customization/game/parpg/settings.py

    r747 r756  
    7878            @param option: name of the option whose value is being requested 
    7979        """ 
    80         try: 
    81             return self.__dict__[option] 
    82         except KeyError: 
    83             return None 
     80        return self.__dict__[option] 
    8481 
    8582    def options(self): 
     
    132129            @type name: string 
    133130        """ 
    134         if not self.__dict__.has_key(name): 
    135             setattr(self, name, Section(name)) 
     131        if name in ['get', 'set']: 
     132            raise AttributeError("{0} is not a valid method. Please consult " 
     133                                 "Settings' documentation for a list of " 
     134                                 " available methods.".format(name)) 
     135        else: 
     136            if not self.__dict__.has_key(name): 
     137                setattr(self, name, Section(name)) 
    136138 
    137139        return getattr(self, name) 
     
    205207        sections.pop(sections.index('config_file')) 
    206208        return sections 
    207  
    208     # backward compatibility methods 
    209     def get(self, section, option, default=None): 
    210         """ Returns the value of the requested option located in the 
    211             requested section. 
    212  
    213             This method is provided strictly for backwards                    
    214             compatibility be deprecated in future versions. 
    215   
    216             @param section: the section in which the option is located in 
    217             @type section: string 
    218             @param option: the option being requested 
    219             @type section: string 
    220             @param default: the default value to return if a section's option 
    221                 is not defined 
    222             @type section: any valid object 
    223         """ 
    224         value = getattr(getattr(self, section), option) 
    225         if value is None and default is not None: 
    226             return default 
    227         else: 
    228             return value 
    229  
    230     def getScreenWidth(self): 
    231         return self.FIFE.ScreenWidth 
    232  
    233     def getScreenHeight(self): 
    234         return self.FIFE.ScreenHeight 
Note: See TracChangeset for help on using the changeset viewer.