view clojure/com/aurellem/gb/hxc.clj @ 243:5b59c6f17cd5

Added the list of types and advantages to the hardcoded collection.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 25 Mar 2012 22:29:12 -0500
parents ca9d2897435b
children 27ca947084cf
line wrap: on
line source
1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants))
4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState]))
8 (def hxc-pokenames
9 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
10 (let [count-species 190
11 name-length 10]
12 (map character-codes->str
13 (partition name-length
14 (take (* count-species name-length)
15 (drop 0xE8000
16 (rom(root))))))))
18 (def hxc-items
19 "The hardcoded names of the items in memory. List begins at ROM@45B7 "
20 (map character-codes->str
21 (take-nth 2
22 (partition-by #(= % 0x50)
23 (take 1200
24 (drop 0x45B7 (rom (root))))))))
25 (def hxc-titles
26 "The hardcoded names of the trainer titles in memory. List begins at
27 ROM@27E77"
28 (map character-codes->str
29 (take-nth 2
30 (partition-by #(= 0x50 %)
31 (take 196
32 (drop 0x27E77
33 (rom (root))))))))
36 (def hxc-pokedex
37 "The hardcoded pokedex entries in memory. List begins at
38 ROM@B8000, shortly before move names."
39 (map character-codes->str
40 (take-nth 2
41 (partition-by #(= % 0x50)
42 (take 14754
43 (drop 0xB8000
44 (rom (root))))))))
45 (def hxc-moves
46 "The hardcoded move names in memory. List begins at ROM@BC000"
47 (map character-codes->str
48 (take-nth 2
49 (partition-by #(= % 0x50)
50 (take 1551
51 (drop 0xBC000
52 (rom (root))))))))
56 (def hxc-places
57 "The hardcoded place names in memory. List begins at
58 ROM@71500. Cinnabar Mansion is dynamically calculated."
59 (map character-codes->str
60 (take-nth 2
61 (partition-by #(= % 0x50)
62 (take 560
63 (drop 0x71500
64 (rom (root))))))))
67 (def hxc-dialog
68 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
69 (character-codes->str(take 0x0F728
70 (drop (+ 0x98000)
71 (rom (root))))))
76 (def pkmn-types
77 {0 :normal
78 1 :fighting
79 2 :flying
80 3 :poison
81 4 :ground
82 5 :rock
83 7 :bug
84 8 :ghost
86 20 :fire
87 21 :water
88 22 :grass
89 23 :electric
90 24 :psychic
91 25 :ice
92 26 :dragon
93 })
96 (def hxc-advantage
97 (map
98 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
99 (get pkmn-types def (hex def))
100 (/ mult 10)])
101 (partition 3
102 (take-while (partial not= 0xFF)
103 (drop 0x3E62D (rom(root)))))))
107 ;; (def pkmn-types
108 ;; [:normal
109 ;; :fighting
110 ;; :flying
111 ;; :poison
112 ;; :ground
113 ;; :rock
114 ;; :bird ;;?
115 ;; :bug
116 ;; :ghost
117 ;; :A
118 ;; :B
119 ;; :C
120 ;; :D
121 ;; :E
122 ;; :fire
123 ;; :water
124 ;; :grass
125 ;; :electric
126 ;; :psychic
127 ;; :ice
128 ;; :poision?])
149 (def hxc-later
150 "Running this code produces, e.g. hardcoded names NPCs give
151 their pokemon. Will sort through it later."
152 (print (character-codes->str(take 10000
153 (drop 0x71597
154 (rom (root)))))))
156 (let [dex
157 (partition-by #(= 0x50 %)
158 (take 2540
159 (drop 0x40687
160 (rom (root)))))]
161 (def dex dex)
162 (def hxc-species
163 (map character-codes->str
164 (take-nth 4 dex))))