castleraider

changeset 318:c92f31bf59a5

Added a check for the finishing location and added support for a finishing location in supporting tools and modules. Removed unused code.
author David Boddie <david@boddie.org.uk>
date Mon Sep 29 00:35:39 2014 +0200
parents 0189eca0359e
children 5b852b0c64bc
files build.py code.oph levels/default.txt tools/makelevels.py utilities/editor.py
diffstat 5 files changed, 69 insertions(+), 62 deletions(-) [+]
line diff
     1.1 --- a/build.py	Sun Sep 28 23:49:15 2014 +0200
     1.2 +++ b/build.py	Mon Sep 29 00:35:39 2014 +0200
     1.3 @@ -316,7 +316,7 @@
     1.4      
     1.5      # Create the level data.
     1.6      levels_address = level_data_start
     1.7 -    level_data, monster_row_address = makelevels.create_level(
     1.8 +    level_data, monster_row_address, finishing_offset = makelevels.create_level(
     1.9          levels_address, level_file, maximum_number_of_special_tiles, maximum_number_of_portals)
    1.10      
    1.11      level_extent = makelevels.level_extent
    1.12 @@ -389,6 +389,8 @@
    1.13          ".alias scrolled                        $7f\n"
    1.14          ".alias scroll_offset_low               $8e\n"
    1.15          ".alias scroll_offset_high              $8f\n"
    1.16 +        ".alias finish_scroll_offset_low        $%02x\n"
    1.17 +        ".alias finish_scroll_offset_high       $%02x\n"
    1.18          "\n"
    1.19          "; Declare these here to make it easy to see that they are being used.\n"
    1.20          ".alias tile_visibility_table_low       $82\n"
    1.21 @@ -400,7 +402,7 @@
    1.22          "\n"
    1.23          ".alias check_monster_tile              $8a\n"
    1.24          "\n"
    1.25 -        )
    1.26 +        ) % (finishing_offset & 0xff, finishing_offset >> 8)
    1.27  
    1.28      constants_oph += (
    1.29          ".alias player_x                        $%x\n"
     2.1 --- a/code.oph	Sun Sep 28 23:49:15 2014 +0200
     2.2 +++ b/code.oph	Mon Sep 29 00:35:39 2014 +0200
     2.3 @@ -153,8 +153,8 @@
     2.4                  dec $80
     2.5                  bpl main_loop_lost_loop
     2.6  
     2.7 -            lda player_lives
     2.8 -            beq main_loop_endloop
     2.9 +            lda player_lives            ; Exit the main loop if there are no
    2.10 +            beq main_loop_endloop       ; lives left.
    2.11  
    2.12              jsr clear_banks             ; Clear both banks and show the first.
    2.13  
    2.14 @@ -190,6 +190,15 @@
    2.15              jsr player_move         ; might still be forbidden by the jumping
    2.16                                      ; counter or falling flag.
    2.17  
    2.18 +            lda scroll_offset_low
    2.19 +            cmp #finish_scroll_offset_low
    2.20 +            bne main_loop_check_monsters
    2.21 +            lda scroll_offset_high
    2.22 +            cmp #finish_scroll_offset_high
    2.23 +            bne main_loop_check_monsters
    2.24 +
    2.25 +            jmp game_completed
    2.26 +
    2.27          main_loop_check_monsters:
    2.28          jsr check_player_monsters
    2.29  
    2.30 @@ -236,10 +245,13 @@
    2.31          main_loop_check_escape:
    2.32          ldx #143            ; (Escape)
    2.33          jsr check_key
    2.34 -        bne main_loop
    2.35 +        beq main_loop_endloop
    2.36 +        jmp main_loop
    2.37  
    2.38      main_loop_endloop:
    2.39  
    2.40 +    ; Do something to indicate the game is over.
    2.41 +
    2.42      jmp main
    2.43  
    2.44  player_move:
    2.45 @@ -1070,42 +1082,13 @@
    2.46      sec
    2.47      rts
    2.48  
    2.49 -;track_position: ; Scroll back to the last stored position.
    2.50 -;
    2.51 -;    clc
    2.52 -;
    2.53 -;    lda scroll_offset_high
    2.54 -;    cmp tracking_high
    2.55 -;    beq track_position_check_low
    2.56 -;    bcs track_position_scroll_left
    2.57 -;    bcc track_position_scroll_right
    2.58 -;
    2.59 -;    track_position_check_low:
    2.60 -;    lda scroll_offset_low
    2.61 -;    cmp tracking_low
    2.62 -;    beq track_position_check_bank
    2.63 -;    bcs track_position_scroll_left
    2.64 -;    bcc track_position_scroll_right
    2.65 -;
    2.66 -;    track_position_check_bank:
    2.67 -;    lda bank_number
    2.68 -;    cmp #0
    2.69 -;    beq track_position_exit
    2.70 -;    bcs track_position_scroll_left
    2.71 -;
    2.72 -;    track_position_scroll_right:
    2.73 -;    jsr scroll_right_update
    2.74 -;    sec
    2.75 -;    rts
    2.76 -;
    2.77 -;    track_position_scroll_left:
    2.78 -;    jsr scroll_left_update
    2.79 -;    sec
    2.80 -;    rts
    2.81 -;
    2.82 -;    track_position_exit:
    2.83 -;    clc
    2.84 -;    rts
    2.85 +game_completed:
    2.86 +
    2.87 +    ; Do something to indicate the game has been completed.
    2.88 +    ; Check whether the player found the treasures.
    2.89 +
    2.90 +    clc
    2.91 +    rts
    2.92  
    2.93  .include "screen.oph"
    2.94  .include "plotting.oph"
     3.1 --- a/levels/default.txt	Sun Sep 28 23:49:15 2014 +0200
     3.2 +++ b/levels/default.txt	Mon Sep 29 00:35:39 2014 +0200
     3.3 @@ -32,23 +32,25 @@
     3.4  Y Z magenta
     3.5  Z Y green
     3.6  
     3.7 +Finish: 772
     3.8 +
     3.9  Start
    3.10 -.............................................................................................................................................................................................................................................................@@..@@................@@..@@.....................@@..@@.........................@@@@@@@@@@@@@@@@@@@@@...<......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..............--.......<..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......................................................................................................................+++++++++++.................................................................................................
    3.11 -.............................................................................................................................................................................................................................................................@@@@@@................@@@@@@.....................@@@@@@.......................@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........--..........--............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................................................................................................................++++++###########+++++............................................................................................
    3.12 -................................................................?..?....?..?.................................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....................@@@@@@.....................@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..................................................................................@@@@@@@@@.............................................................................................................++++######################+++.........................................................................................
    3.13 -................................................................@@@@@@@@@@@@.................................................................................................................................................................................@@@@@@....................0..............................................@@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......................n.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..................................................................................@@@@@@@@@.........................................................................................................++++#############################++.......................................................................................
    3.14 -................................................................@@@@....@@@@....................................................................@..@..............@..@.......................................................................................@@@@@@....................0...............................................@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........<..............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......................--............................................................4...........................................................................................................+++###################################+......................................................................................
    3.15 -................................................................@@@@....@@@@....................................................................@@@@..............@@@@.......................................................................................@@........................0.................................................@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............................@@@@@@@@@@@@@@@@@@@@@@@@@@@@........................4.........................................................................................................++#######################################++....................................................................................
    3.16 -................@@..@@..@@..@@.......................................V..........................................................................@@@@@@@@@@@@@@@@@@@@@@.......................................................................................@@...........<........@@@@@@..................>..@@@@@@.............>.......@@@@@@@@@@@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................2........---.........@@@@@@@@@@@@@@@....@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....--......................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................V....4.......................................................................++++++++++++....................++###########################################++..................................................................................
    3.17 -................@@@@@@@@@@@@@@..................................................................................................................@@@@..............@@@@.............................................................................................................@@@@@@+++++++++++++++++++++@@@@@@++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.wx.............2....................@@@@@@@@@@@@@........@@@@@@@@@@@@@@@@@@@@@@@@@@@/.\@@@@........--.............<.....@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......................4...................................................................++++############++++++...........+++###############################################+++......................................................@@..@@..@@...............
    3.18 -.................@@@@@@@@@@@@...................................................................................................................@@@@..............@@@@....................?..?.....................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................2....................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@..................................m.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....................4.............................................................++++++######################++......+++#####################################################++++..................................................@@@@@@@@@@...............
    3.19 -.................@@@............................................................................................................................@@@@...........<..@@@@....................@@@@.....................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......<...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@....................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................@@@@@@@@@....................................................++++##############################++++++############################################################++++...............................................@@@@@@@@................
    3.20 -..................I.......................................................................................................................................................................@@@@.....<..........@@............>.........>...@@..................................@@@@@@/..\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@JJJ..............................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@............................................++++++++########################################################################################################+++....................................................................
    3.21 -..................I.............................................++++++++++++................................................................................................................................@@@@--------------------------@@@@.................@@@@@@@@@@@@@@@@@@.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@/.\@@@@@@@@@@..............2............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@..........@@@/.\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............--..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........@@@@@@@@@@@@@.......................................+++++###################################################################################################################++++................................................................
    3.22 -..................I..........................................+++############++++..........................................................................................................................@@@@@@..........................@@@@@@........................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@...........................2..........o.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................................V...........@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........@@@@@@@@@@@@@..................................+++++############################################################################################################################+++++...........................................................
    3.23 -..................I.......................................+++###################++........................+++++.....................+++++++.............................................................@@@@@@@@..........................@@@@@@@@..................................ZZZZ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...........................2............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...............................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........@@@@@@@@@@@@@............................++++++######################################################################################################################################+++........................................................
    3.24 -...@@------------@@@@@@@@@@@@.......>................+++++########################++++............>.....++#####++.>............+++++#######+++++@@........>.........@@++++++++++++++++++++++++++++++++@@@@@@@@@@..........................@@@@@@@@@@..................>.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@SSS.......................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......----..................................NNN@@@@@@@@@@@@@@@@@@@@@@@@@@@@................>........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..>......@@@@@@@@@@@@@..>..........+++++++++++++++###############################################################################################################################################++++++++++.....................@@@@@@@@@@----------@@...
    3.25 -+++@@............@@@@@@@@@@@@++++++++++++++++++++++++#################################++++++++++++++++++#########++++++++++++++#################@@@@@@@@@@@@@@@@@@@@@@################################@@@@@@@@@@..........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...............@@@@@@@@@@@@@@@@@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@########################################################################################################################################################################+++++++++++++++++++++@@@@@@@@@@..........@@+++
    3.26 +.............................................................................................................................................................................................................................................................@@..@@................@@..@@.....................@@..@@.........................@@@@@@@@@@@@@@@@@@@@@...<......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..............--.......<..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......................................................................................................................+++++++++++...................................................................................................
    3.27 +.............................................................................................................................................................................................................................................................@@@@@@................@@@@@@.....................@@@@@@.......................@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........--..........--............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................................................................................................................++++++###########+++++..............................................................................................
    3.28 +................................................................?..?....?..?.................................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....................@@@@@@.....................@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..................................................................................@@@@@@@@@.............................................................................................................++++######################+++...........................................................................................
    3.29 +................................................................@@@@@@@@@@@@.................................................................................................................................................................................@@@@@@....................0..............................................@@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......................n.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..................................................................................@@@@@@@@@.........................................................................................................++++#############################++.........................................................................................
    3.30 +................................................................@@@@....@@@@....................................................................@..@..............@..@.......................................................................................@@@@@@....................0...............................................@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........<..............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......................--............................................................4...........................................................................................................+++###################################+......................................................................?.................
    3.31 +................................................................@@@@....@@@@....................................................................@@@@..............@@@@.......................................................................................@@........................0.................................................@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............................@@@@@@@@@@@@@@@@@@@@@@@@@@@@........................4.........................................................................................................++#######################################++.................................................................@.@@.................
    3.32 +................@@..@@..@@..@@.......................................V..........................................................................@@@@@@@@@@@@@@@@@@@@@@.......................................................................................@@...........<........@@@@@@..................>..@@@@@@.............>.......@@@@@@@@@@@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................2........---.........@@@@@@@@@@@@@@@....@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....--......................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................V....4.......................................................................++++++++++++....................++###########################################++...............................................................@@@@.................
    3.33 +................@@@@@@@@@@@@@@..................................................................................................................@@@@..............@@@@.............................................................................................................@@@@@@+++++++++++++++++++++@@@@@@++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.wx.............2....................@@@@@@@@@@@@@........@@@@@@@@@@@@@@@@@@@@@@@@@@@/.\@@@@........--.............<.....@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......................4...................................................................++++############++++++...........+++###############################################+++.................................................................................
    3.34 +.................@@@@@@@@@@@@...................................................................................................................@@@@..............@@@@....................?..?.....................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................2....................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@..................................m.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....................4.............................................................++++++######################++......+++#####################################################++++.............................................................................
    3.35 +.................@@@............................................................................................................................@@@@...........<..@@@@....................@@@@.....................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......<...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@....................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@....................................................++++##############################++++++############################################################++++.........................................................................
    3.36 +..................I.......................................................................................................................................................................@@@@.....<..........@@............>.........>...@@..................................@@@@@@/..\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@................@@@@@@@@@@@@..........@@@@@@@@@@@@@@@@@@@@@@@@@@JJJ..............................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.................@@@@@@@............................................++++++++########################################################################################################+++......................................................................
    3.37 +..................I.............................................++++++++++++................................................................................................................................@@@@--------------------------@@@@.................@@@@@@@@@@@@@@@@@@.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@/.\@@@@@@@@@@..............2............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................@@@@@@@@@@@@..........@@@/.\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@............--..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...........@@@@@@@@@@@.......................................+++++###################################################################################################################++++.............................................@@@@..........@@.....
    3.38 +..................I..........................................+++############++++..........................................................................................................................@@@@@@..........................@@@@@@........................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@...........................2..........o.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...................................V...........@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...........@@@@@@@@@@@..................................+++++############################################################################################################################+++++......................................@@@@@@----------@@.....
    3.39 +..................I.......................................+++###################++........................+++++.....................+++++++.............................................................@@@@@@@@..........................@@@@@@@@..................................ZZZZ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...........................2............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...............................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@.........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...........@@@@@@@@@@@............................++++++######################################################################################################################################+++.................................@@@@@@@@..........@@.....
    3.40 +...@@------------@@@@@@@@@@@@.......>................+++++########################++++............>.....++#####++.>............+++++#######+++++@@........>.........@@++++++++++++++++++++++++++++++++@@@@@@@@@@..........................@@@@@@@@@@..................>.............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@SSS.......................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......----..................................NNN@@@@@@@@@@@@@@@@@@@@@@@@@@@@................>........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..>........@@@@@@@@@@@..>..........+++++++++++++++###############################################################################################################################################++++++++++.....................@@@@@@@@@@..........@@.....
    3.41 ++++@@............@@@@@@@@@@@@++++++++++++++++++++++++#################################++++++++++++++++++#########++++++++++++++#################@@@@@@@@@@@@@@@@@@@@@@################################@@@@@@@@@@..........................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...............@@@@@@@@@@@@@@@@@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@########################################################################################################################################################################+++++++++++++++++++++@@@@@@@@@@..........@@+++++
    3.42  
    3.43  Basement
    3.44  ..................@@@@@@@@@@]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
     4.1 --- a/tools/makelevels.py	Sun Sep 28 23:49:15 2014 +0200
     4.2 +++ b/tools/makelevels.py	Mon Sep 29 00:35:39 2014 +0200
     4.3 @@ -115,8 +115,14 @@
     4.4          portals[src] = (index, dest, colour)
     4.5          index += 1
     4.6      
     4.7 +    if lines[32].startswith("Finish:"):
     4.8 +        finish = int(lines[32][7:].strip())
     4.9 +        l = 33
    4.10 +    else:
    4.11 +        finish = 0
    4.12 +        l = 32
    4.13 +    
    4.14      levels = []
    4.15 -    l = 32
    4.16      
    4.17      while l < len(lines):
    4.18      
    4.19 @@ -124,7 +130,7 @@
    4.20          levels.append((name, lines[l + 1:l + 17]))
    4.21          l += 17
    4.22      
    4.23 -    return levels, special, portals
    4.24 +    return levels, special, portals, finish
    4.25  
    4.26  def create_level_data(levels, tiles, special, portals):
    4.27  
    4.28 @@ -245,7 +251,7 @@
    4.29  def create_level(levels_address, level_path, maximum_number_of_special_tiles,
    4.30                   maximum_number_of_portals):
    4.31      
    4.32 -    levels, special, portals = load_level(level_path)
    4.33 +    levels, special, portals, finish = load_level(level_path)
    4.34      
    4.35      tiles = {}
    4.36      for i in range(len(tile_order)):
    4.37 @@ -384,4 +390,4 @@
    4.38      # Append the data to the table of row offsets.
    4.39      data = special_tiles_table + visibility_table + portal_table + table + data
    4.40      
    4.41 -    return data, monster_row_address
    4.42 +    return data, monster_row_address, finish
     5.1 --- a/utilities/editor.py	Sun Sep 28 23:49:15 2014 +0200
     5.2 +++ b/utilities/editor.py	Mon Sep 29 00:35:39 2014 +0200
     5.3 @@ -116,6 +116,8 @@
     5.4          self.maximum_width = 1024
     5.5          self.monster_images = monster_images
     5.6          
     5.7 +        self.finishing_offset = 0x304
     5.8 +        
     5.9          font = QFont("Monospace")
    5.10          font.setPixelSize(min(4 * self.xs - 2, 8 * self.ys - 2))
    5.11          self.setFont(font)
    5.12 @@ -164,11 +166,12 @@
    5.13      def loadMap(self, path):
    5.14      
    5.15          try:
    5.16 -            levels, special, portals = makelevels.load_level(path)
    5.17 +            levels, special, portals, finish = makelevels.load_level(path)
    5.18              
    5.19              self.special = special
    5.20              self.portals = portals
    5.21              self.portal_locations = {}
    5.22 +            self.finishing_offset = finish
    5.23              
    5.24              self.rows = {}
    5.25              self.order = []
    5.26 @@ -233,6 +236,9 @@
    5.27              
    5.28              f.write("\n")
    5.29              
    5.30 +            # Write the finishing offset.
    5.31 +            f.write("Finish: %i\n\n" % self.finishing_offset)
    5.32 +            
    5.33              for name in self.order:
    5.34              
    5.35                  f.write(name + "\n")
    5.36 @@ -371,6 +377,15 @@
    5.37              painter.setPen(pen)
    5.38              painter.drawLine(19 * 4 * self.xs, 0, 19 * 4 * self.xs, 24 * 8 * self.ys)
    5.39          
    5.40 +        # Plot the finishing position.
    5.41 +        if c1 <= self.finishing_offset + 19 and c2 >= self.finishing_offset + 20:
    5.42 +        
    5.43 +            pen = QPen(Qt.white)
    5.44 +            pen.setStyle(Qt.DashLine)
    5.45 +            painter.setPen(pen)
    5.46 +            painter.drawRect((self.finishing_offset + 19) * 4 * self.xs, 0,
    5.47 +                              8 * self.xs, 24 * 8 * self.ys)
    5.48 +        
    5.49          painter.end()
    5.50      
    5.51      def sizeHint(self):