changeset 211:661d35f1b56e

merge.
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 05:58:41 -0500
parents 565f5d17f90a (current diff) a67f1df5d096 (diff)
children 8523faa122b0
files
diffstat 2 files changed, 84 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/characters.clj	Fri Mar 23 05:58:04 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/characters.clj	Fri Mar 23 05:58:41 2012 -0500
     1.3 @@ -5,12 +5,14 @@
     1.4  (def character-code->character
     1.5    {
     1.6     0x00   "<";;"end-of-name-sentinel" ;; begin messsage
     1.7 +   0x4E   "[...]" ; ocsenave: scroll pokedex page
     1.8     0x4F   "\n" ; newline
     1.9     0x50   "#";;"end-of-pokemon-name-sentinel"
    1.10     0x51   "\n\n" ;; ocsenave: clear screen
    1.11     0x54   "[POKE]"
    1.12     0x55   "_" ;; ocsenave: breaking space?
    1.13     0x57   ">" ;; ocsenave: end message
    1.14 +   0x5F   ">" ;; ocsenave: end pokedex entry??
    1.15     0x60   "A-bold"
    1.16     0x61   "B-bold"
    1.17     0x62   "C-bold"
     2.1 --- a/clojure/com/aurellem/gb/species.clj	Fri Mar 23 05:58:04 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/species.clj	Fri Mar 23 05:58:41 2012 -0500
     2.3 @@ -1,7 +1,88 @@
     2.4  (ns com.aurellem.gb.species
     2.5 -  (:use (com.aurellem.gb gb-driver util constants))
     2.6 +  (:use (com.aurellem.gb characters gb-driver util constants))
     2.7    (:import [com.aurellem.gb.gb_driver SaveState]))
     2.8  
     2.9 +
    2.10 +(def hxc-pokenames
    2.11 +  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
    2.12 +  (let [count-species 190
    2.13 +        name-length 10]
    2.14 +    (map character-codes->str
    2.15 +         (partition name-length
    2.16 +                    (take (* count-species name-length)
    2.17 +                          (drop 0xE8000
    2.18 +                                (rom(root)))))))) 
    2.19 +)
    2.20 +(def hxc-items
    2.21 +  "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    2.22 +  (map character-codes->str
    2.23 +       (take-nth 2
    2.24 +                 (partition-by #(= % 0x50)
    2.25 +                               (take 1200
    2.26 +                                     (drop 0x45B7 (rom (root))))))))
    2.27 +(def hxc-titles
    2.28 +  "The hardcoded names of the trainer titles in memory. List begins at
    2.29 +ROM@27E77"
    2.30 +  (map character-codes->str
    2.31 +       (take-nth 2
    2.32 +                 (partition-by #(= 0x50 %)
    2.33 +                               (take 196
    2.34 +                                     (drop 0x27E77
    2.35 +                                           (rom (root))))))))
    2.36 +
    2.37 +
    2.38 +(def hxc-pokedex
    2.39 +  "The hardcoded pokedex entries in memory. List begins at
    2.40 +ROM@B8000, shortly before move names."
    2.41 +  (map character-codes->str
    2.42 +       (take-nth 2
    2.43 +                 (partition-by #(= % 0x50)
    2.44 +                               (take 14754
    2.45 +                                     (drop 0xB8000
    2.46 +                                           (rom (root))))))))
    2.47 +(def hxc-moves
    2.48 +  "The hardcoded move names in memory. List begins at ROM@BC000"
    2.49 +  (map character-codes->str
    2.50 +       (take-nth 2
    2.51 +                 (partition-by #(= % 0x50)
    2.52 +                               (take 1551
    2.53 +                                     (drop 0xBC000
    2.54 +                                           (rom (root))))))))   
    2.55 +
    2.56 +
    2.57 +
    2.58 +(def hxc-places
    2.59 +  "The hardcoded place names in memory. List begins at
    2.60 +ROM@71500. Cinnabar Mansion is dynamically calculated."
    2.61 +  (map character-codes->str
    2.62 +       (take-nth 2
    2.63 +                 (partition-by #(= % 0x50)
    2.64 +                               (take 560
    2.65 +                                     (drop 0x71500
    2.66 +                                           (rom (root))))))))
    2.67 +
    2.68 +(def hxc-later
    2.69 +  "Running this code produces, e.g. hardcoded names NPCs give
    2.70 +their pokemon"
    2.71 +(print (character-codes->str(take 10000
    2.72 +                          (drop 0x71597
    2.73 +                                (rom (root)))))))
    2.74 +
    2.75 +
    2.76 +
    2.77 +
    2.78 +(let [dex
    2.79 +      (partition-by #(= 0x50 %)
    2.80 +                    (take 2540
    2.81 +                          (drop 0x40687
    2.82 +                                (rom (root)))))]
    2.83 +  (def dex dex)
    2.84 +  (def hxc-species
    2.85 +    (map character-codes->str
    2.86 +         (take-nth 4 dex))))
    2.87 +
    2.88 +
    2.89 +
    2.90  (def species-code->species-name
    2.91    {0x01  :rhydon
    2.92     0x02  :kangaskhan