diff clojure/com/aurellem/gb/hxc.clj @ 218:ca9d2897435b

moved hardcoded stuff into its own namespace.
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 20:18:03 -0500
parents
children 5b59c6f17cd5
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Fri Mar 23 20:18:03 2012 -0500
     1.3 @@ -0,0 +1,88 @@
     1.4 +(ns com.aurellem.gb.hxc
     1.5 +  (:use (com.aurellem.gb assembly characters gb-driver util
     1.6 +                         constants))
     1.7 +  (:use (com.aurellem.world practice))
     1.8 +  (:import [com.aurellem.gb.gb_driver SaveState]))
     1.9 +
    1.10 +
    1.11 +(def hxc-pokenames
    1.12 +  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
    1.13 +  (let [count-species 190
    1.14 +        name-length 10]
    1.15 +    (map character-codes->str
    1.16 +         (partition name-length
    1.17 +                    (take (* count-species name-length)
    1.18 +                          (drop 0xE8000
    1.19 +                                (rom(root))))))))
    1.20 +
    1.21 +(def hxc-items
    1.22 +  "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    1.23 +  (map character-codes->str
    1.24 +       (take-nth 2
    1.25 +                 (partition-by #(= % 0x50)
    1.26 +                               (take 1200
    1.27 +                                     (drop 0x45B7 (rom (root))))))))
    1.28 +(def hxc-titles
    1.29 +  "The hardcoded names of the trainer titles in memory. List begins at
    1.30 +ROM@27E77"
    1.31 +  (map character-codes->str
    1.32 +       (take-nth 2
    1.33 +                 (partition-by #(= 0x50 %)
    1.34 +                               (take 196
    1.35 +                                     (drop 0x27E77
    1.36 +                                           (rom (root))))))))
    1.37 +
    1.38 +
    1.39 +(def hxc-pokedex
    1.40 +  "The hardcoded pokedex entries in memory. List begins at
    1.41 +ROM@B8000, shortly before move names."
    1.42 +  (map character-codes->str
    1.43 +       (take-nth 2
    1.44 +                 (partition-by #(= % 0x50)
    1.45 +                               (take 14754
    1.46 +                                     (drop 0xB8000
    1.47 +                                           (rom (root))))))))
    1.48 +(def hxc-moves
    1.49 +  "The hardcoded move names in memory. List begins at ROM@BC000"
    1.50 +  (map character-codes->str
    1.51 +       (take-nth 2
    1.52 +                 (partition-by #(= % 0x50)
    1.53 +                               (take 1551
    1.54 +                                     (drop 0xBC000
    1.55 +                                           (rom (root))))))))   
    1.56 +
    1.57 +
    1.58 +
    1.59 +(def hxc-places
    1.60 +  "The hardcoded place names in memory. List begins at
    1.61 +ROM@71500. Cinnabar Mansion is dynamically calculated."
    1.62 +  (map character-codes->str
    1.63 +       (take-nth 2
    1.64 +                 (partition-by #(= % 0x50)
    1.65 +                               (take 560
    1.66 +                                     (drop 0x71500
    1.67 +                                           (rom (root))))))))
    1.68 +
    1.69 +
    1.70 +(def hxc-dialog
    1.71 +  "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
    1.72 +(character-codes->str(take 0x0F728
    1.73 +                          (drop (+ 0x98000)
    1.74 +                                (rom (root))))))
    1.75 +
    1.76 +(def hxc-later
    1.77 +  "Running this code produces, e.g. hardcoded names NPCs give
    1.78 +their pokemon. Will sort through it later."
    1.79 +(print (character-codes->str(take 10000
    1.80 +                          (drop 0x71597
    1.81 +                                (rom (root)))))))
    1.82 +
    1.83 +(let [dex
    1.84 +      (partition-by #(= 0x50 %)
    1.85 +                    (take 2540
    1.86 +                          (drop 0x40687
    1.87 +                                (rom (root)))))]
    1.88 +  (def dex dex)
    1.89 +  (def hxc-species
    1.90 +    (map character-codes->str
    1.91 +         (take-nth 4 dex))))