changeset 283:516acb83410f

Added the hardcoded list of moves that the TMs and HMs teach.
author Dylan Holmes <ocsenave@gmail.com>
date Wed, 28 Mar 2012 04:52:09 -0500
parents 0c3fbb313e49
children 57e0314e488d
files clojure/com/aurellem/gb/hxc.clj
diffstat 1 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/hxc.clj	Wed Mar 28 03:28:36 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Wed Mar 28 04:52:09 2012 -0500
     1.3 @@ -20,9 +20,10 @@
     1.4    "Convert the string of alphabetic/space characters into a keyword by
     1.5    replacing spaces with hyphens and converting to lowercase."
     1.6    [s]
     1.7 +  (if (nil? s) nil
     1.8    (keyword (.toLowerCase
     1.9              (apply str
    1.10 -                   (map #(if (= % \space) "-" %) s)))))
    1.11 +                   (map #(if (= % \space) "-" %) s))))))
    1.12  
    1.13  
    1.14  ;; used to decode item prices
    1.15 @@ -304,8 +305,6 @@
    1.16       (hxc-dialog com.aurellem.gb.gb-driver/original-rom)))
    1.17  
    1.18  
    1.19 -
    1.20 -
    1.21  (def hxc-move-names
    1.22    "The hardcoded move names in memory. List begins at ROM@BC000"
    1.23    (hxc-thunk-words 0xBC000 1551))
    1.24 @@ -372,7 +371,25 @@
    1.25                                   (drop 0x38000 rom))))))))
    1.26    
    1.27  
    1.28 -
    1.29 +(defn hxc-machines
    1.30 +  "The hardcoded moves taught by TMs and HMs. List begins at ROM@0x1232D."
    1.31 +  ([] (hxc-machines
    1.32 +       com.aurellem.gb.gb-driver/original-rom))
    1.33 +  ([rom]
    1.34 +     (let [moves (hxc-move-names rom)]
    1.35 +       (zipmap
    1.36 +        (range)
    1.37 +        (take-while
    1.38 +            (comp not nil?)
    1.39 +            (map (comp
    1.40 +                  format-name
    1.41 +                  (zipmap
    1.42 +                   (range)
    1.43 +                   moves)
    1.44 +              dec)
    1.45 +                 (take 100
    1.46 +                       (drop 0x1232D rom))))))))
    1.47 +  
    1.48  (defn hxc-pokenames
    1.49    "The hardcoded names of the 190 species in memory. List begins at
    1.50  ROM@E8000. Although names in memory are padded with 0x50 to be 10 characters
    1.51 @@ -602,7 +619,7 @@
    1.52                type-2
    1.53                rarity
    1.54                rating-xp
    1.55 -              pic-dimensions
    1.56 +              pic-dimensions ;; tile_width|tile_height (8px/tile)
    1.57                ptr-pic-obverse-1
    1.58                ptr-pic-obverse-2
    1.59                ptr-pic-reverse-1
    1.60 @@ -769,6 +786,8 @@
    1.61  
    1.62  
    1.63  
    1.64 +;; note: 0x2f31 contains the names "TM" "HM"?
    1.65 +
    1.66  ;; note for later: credits start at F1290
    1.67  
    1.68