Changeset 479


Ignore:
Timestamp:
02/04/10 14:52:40 (10 years ago)
Author:
maximinus_parpg
Message:

More code cleanup.
Some preperation for sorting out the beer quest.

Location:
trunk/game
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/gui/inventory.xml

    r118 r479  
    22  <Label text="Character Name Here" name="charName"/>/ 
    33 
     4  <!-- TODO: Document this mess --> 
    45 
    56  <HBox max_size="275,100"> 
  • trunk/game/scripts/console.py

    r476 r479  
    108108                result = str(eval(compile(end_python,'<string>','eval'))) 
    109109            except Exception, e: 
    110                 result = str(e) 
    111                  
     110                result = str(e)        
    112111        return result 
    113112 
     
    154153                    println('Error: ' + str(s_error)) 
    155154                result = "Failed to save file" 
    156  
    157155        return result  
    158  
    159156 
    160157    def handleConsoleCommand(self, command): 
     
    171168        if result is None: 
    172169            result = "Invalid command, enter help for more information" 
    173  
    174170        return result 
  • trunk/game/scripts/dialogue.py

    r469 r479  
    4242           d = DialogueEngine(tree, callbacks) 
    4343           d = DialogueEngine('screenplay.yaml', callbacks)""" 
    44  
    4544        if isinstance(obj, dict): 
    4645            self.tree = obj 
     
    5756    def run(self): 
    5857        """Start running the dialogue engine. 
    59         @returns: list of lists (if requesting a response) 
    60         @returns: None (if at the end of the script)""" 
     58           @returns: list of lists (if requesting a response) 
     59           @returns: None (if at the end of the script)""" 
    6160        start_section = self.tree['START'] 
    6261 
     
    9089    def getSection(self, section_name): 
    9190        """Return a section object. 
    92         @type section_name: string 
    93         @param section_name: The section to get 
    94         @return: dict""" 
     91           @type section_name: string 
     92           @param section_name: The section to get 
     93           @return: dict""" 
    9594        return self.tree['SECTIONS'][section_name] 
    9695 
  • trunk/game/scripts/dialoguevalidator.py

    r476 r479  
    158158                                              " contains an invalid target: " +\ 
    159159                                              option[1] + " in response") 
    160             #TODO: option[2] might be a conditional  
     160            #TODO: option[2] might be a conditional (why?) 
    161161         
    162162    def __isValidSectionName(self, name): 
  • trunk/game/scripts/engine.py

    r478 r479  
    2323from objects.action import * 
    2424 
    25  
    2625class Engine: 
    2726    """Engine holds the logic for the game. 
     
    3029       the fife view here. This also prevents us from just having a 
    3130       function heavy controller.""" 
    32      
    3331    def __init__(self, view): 
    3432        """Initialize the instance. 
     
    7371           @param filename: the name of the file (including path) to load from 
    7472           @return: None""" 
    75              
    7673        fname = '/'.join([path, filename]) 
    7774 
  • trunk/game/scripts/gui/context_menu.py

    r473 r479  
    3030           @param pos: Screen position to use  
    3131           @return: None""" 
    32  
    3332        self.vbox = pychan.widgets.VBox(position=pos) 
    3433        events_to_map = {} 
     
    5655        @param args: Unpacked list of positional arguments 
    5756        @param kwargs: Unpacked list of keyword arguments 
    58         @return: A wrapped version of func 
    59         """ 
    60          
     57        @return: A wrapped version of func""" 
    6158        def decoratedFunc (): 
    6259            """ This is the actual wrapped version of func, that is returned. 
  • trunk/game/scripts/gui/filebrowser.py

    r473 r479  
    2020 
    2121def u2s(string): 
     22    # TODO: cryptic function name 
    2223    return string.encode(sys.getfilesystemencoding()) 
    2324 
    2425class FileBrowser(object): 
    25     """ 
    26     FileBrowser displays directory and file listings from the vfs. 
    27     The file_selected parameter is a callback invoked when a file selection 
    28     has been made; its signature must be file_selected(path,filename). If 
    29     select_dir is set, file_selected's filename parameter should be optional. 
    30     The save_file option provides a box for supplying a new filename that 
    31     doesn't exist yet. The select_dir option allows directories to be 
    32     selected as well as files. 
    33     """ 
     26    """FileBrowser displays directory and file listings from the vfs. 
     27       The file_selected parameter is a callback invoked when a file selection 
     28       has been made; its signature must be file_selected(path,filename). If 
     29       select_dir is set, file_selected's filename parameter should be optional. 
     30       The save_file option provides a box for supplying a new filename that 
     31       doesn't exist yet. The select_dir option allows directories to be 
     32       selected as well as files.""" 
    3433    def __init__(self, engine, file_selected, save_file=False, \ 
    3534                 select_dir=False, extensions=('.dat',), \ 
     
    5049 
    5150    def showBrowser(self): 
    52         """ Shows the file dialog browser """ 
     51        """Shows the file dialog browser""" 
    5352        if self._widget: 
    5453            self._widget.show() 
     
    6867 
    6968    def _setDirectory(self): 
    70         """ Directory change callback. """ 
     69        """Directory change callback.""" 
    7170        selection = self._widget.collectData('dirList') 
    7271        if not (selection < 0): 
     
    138137 
    139138    def _warningMessage(self): 
    140         """ Shows the warning message dialog when a file with a 
    141         faulty extension was selected. """ 
     139        """Shows the warning message dialog when a file with a 
     140           faulty extension was selected.""" 
    142141        window = widgets.Window(title="Warning") 
    143142        text = "Please save the file as a .dat" 
  • trunk/game/scripts/gui/hud.py

    r473 r479  
    5151        self.data = data 
    5252        self.inventory = None 
    53          
    54  
    5553 
    5654        self.save_game_callback = callbacks['saveGame'] 
     
    143141                                                       inv_callbacks) 
    144142        self.refreshReadyImages() 
    145          
    146143 
    147144    def initializeContextMenu(self): 
     
    458455 
    459456    def updateVolumeText(self): 
    460         """ 
    461         Update the initial volume label to reflect the value of the slider 
    462         """ 
     457        """Update the initial volume label to the value of the slider""" 
    463458        volume = float(self.options_menu.collectData("InitialVolumeSlider")) 
    464459        volume_label = self.options_menu.findChild(name="InitialVolumeLabel") 
     
    604599            self.box_container.hideContainer() 
    605600            #TODO: Move the close() call into OpenBoxAction(). This can be done  
    606             # after createBoxGUI becomes a blocking call or it's otherwise possible 
    607             # to wait till the box GUI is closed. 
     601            # after createBoxGUI becomes a blocking call or it's otherwise 
     602            # possible to wait till the box GUI is closed. 
    608603            self.box_container.container.close() 
    609604            self.box_container = None 
     
    617612           @param desc: The main body of the examine box 
    618613           @return: None""" 
    619  
    620614        if self.examine_box is not None: 
    621615            self.examine_box.closePopUp() 
  • trunk/game/scripts/gui/inventorygui.py

    r473 r479  
    8484        events_to_map['close_button'] = self.closeInventoryAndToggle 
    8585        self.inventory.mapEvents(events_to_map) 
    86 #        self.resetMouseCursor() 
     86        # TODO: Why the commented out code? 
     87        # self.resetMouseCursor() 
    8788 
    8889    def updateInventoryButtons (self): 
     
    220221                       the dictionary 'self.buttons'  
    221222           @return: None""" 
    222  
    223223        drop_widget = self.inventory.findChild(name = obj) 
    224224        try : 
     
    243243           @param name: name of image to get 
    244244           @return: None""" 
    245         return self.inventory.findChild(name=name) 
    246  
     245        return self.inventory.findChild(name = name) 
  • trunk/game/scripts/gui/popups.py

    r473 r479  
    2121 
    2222from scripts.gui import drag_drop_data as data_drag 
    23 from scripts.items import item_image_dict 
    2423 
    2524class ContainerGUI(): 
    2625    def __init__(self, engine, title, container): 
    27         """ 
    28         A class to create a window showing the contents of a container. 
    29          
    30         @type engine: fife.Engine 
    31         @param engine: an instance of the fife engine 
    32         @type title: string 
    33         @param title: The title of the window 
    34         @type container: Container 
    35         @param container: A container to represent 
    36         @return: None 
    37         """ 
     26        """A class to create a window showing the contents of a container. 
     27           @type engine: fife.Engine 
     28           @param engine: an instance of the fife engine 
     29           @type title: string 
     30           @param title: The title of the window 
     31           @type container: Container 
     32           @param container: A container to represent 
     33           @return: None""" 
    3834        self.engine = engine 
    3935        pychan.init(self.engine, debug=True) 
     
    4844             
    4945    def updateImage(self, button): 
     46        # TODO: missing function information 
    5047        if (button.item == None): 
    5148            image = self.empty_images[button.name] 
     
    5754       
    5855    def showContainer(self): 
    59         """ 
    60         Show the container 
    61         @return: None 
    62         """ 
     56        """Show the container 
     57           @return: None""" 
    6358        # Prepare slots 1 through 9 
    6459        empty_image = "gui/inv_images/inv_backpack.png" 
     
    7671 
    7772        self.container_gui.mapEvents(self.events_to_map) 
    78  
    7973        self.container_gui.show() 
    8074 
    8175    def hideContainer(self): 
    82         """ 
    83         Hide the container 
    84         @return: None 
    85         """ 
     76        """Hide the container 
     77           @return: None""" 
    8678        if self.container_gui.isVisible(): 
    8779            self.container_gui.hide() 
     
    176168        self.resetMouseCursor() 
    177169 
    178  
    179170class ExaminePopup(): 
    180     """ 
    181     Create a popup for when you click examine on an object 
    182     """ 
     171    """Create a popup for when you click examine on an object""" 
    183172    def __init__(self, engine, object_title, desc): 
    184         """ 
    185         Initialize the popup 
    186          
    187         @type engine: fife.Engine 
    188         @param engine: an instance of the fife engine 
    189         @type object_title: string 
    190         @param object_title: The title for the window, probably should just be 
    191             the name of the object 
    192         @type desc: string 
    193         @param desc: The description of the object 
    194         @return: None 
    195         """ 
     173        """Initialize the popup   
     174           @type engine: fife.Engine 
     175           @param engine: an instance of the fife engine 
     176           @type object_title: string 
     177           @param object_title: The title for the window, probably should just 
     178                                be the name of the object 
     179           @type desc: string 
     180           @param desc: The description of the object 
     181           @return: None""" 
    196182        self.engine = engine 
    197183        pychan.init(self.engine, debug=True) 
     
    217203 
    218204    def closePopUp(self): 
     205        # TODO: missing function information 
    219206        if self.examine_window.isVisible(): 
    220207            self.examine_window.hide() 
    221208     
    222209    def showPopUp(self): 
     210        # TODO: missing function information 
    223211        self.examine_window.show() 
  • trunk/game/scripts/inventory.py

    r476 r479  
    3838        self.items["backpack"].placeItem(item, index) 
    3939        self.item_lookup[item.ID] = "backpack" 
    40  
    41  
    4240         
    4341    def takeItem(self,item): 
  • trunk/game/scripts/items.py

    r262 r479  
    1717 
    1818item_image_dict = {'dagger01':'gui/inv_images/inv_litem.png', 
     19                   'pamphlet':'gui/inv_images/inv_pamphlet.png', 
    1920                   'empty':'gui/inv_images/inv_backpack.png'} 
  • trunk/game/scripts/map.py

    r476 r479  
    160160            self.cameras[self.my_cam_id].attach(self.data.game_state.PC.behaviour.agent) 
    161161 
    162          
    163162    def toggleRenderer(self, r_name): 
    164163        """Enable or disable a renderer. 
     
    169168    def togglePause(self): 
    170169        """ Pause/Unpause the game. 
    171             @return: nothing"""         
    172          
     170            @return: nothing""" 
    173171        # Time multiplier is a float, never do equals on floats 
    174172        if self.map.getTimeMultiplier() >= 1.0: 
  • trunk/game/scripts/objects/actors.py

    r478 r479  
    119119            self.inventory.placeItem(CarryableItem(ID=456, name="Dagger123")) 
    120120            self.inventory.placeItem(CarryableItem(ID=555, name="Beer")) 
     121            self.inventory.placeItem(CarryableItem(ID=616, name="Pamphlet")) 
    121122        else: 
    122123            self.inventory = inventory 
Note: See TracChangeset for help on using the changeset viewer.