view clojure/com/aurellem/gb/hxc.clj @ 245:a50faba43967

forgot to include Bird type with the list of available type names for type advantage data. now hxc-advantage is correct.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 25 Mar 2012 23:04:01 -0500
parents 27ca947084cf
children 921d2277bb57
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))))))))
26 (def hxc-types
27 "The hardcoded type names in memory. List begins at ROM@27D99,
28 shortly before hxc-titles."
29 (map character-codes->str
30 (take-nth 2
31 (partition-by #(= 0x50 %)
32 (take 102
33 (drop 0x27D99
34 (rom (root))))))))
36 (def hxc-titles
37 "The hardcoded names of the trainer titles in memory. List begins at
38 ROM@27E77"
39 (map character-codes->str
40 (take-nth 2
41 (partition-by #(= 0x50 %)
42 (take 196
43 (drop 0x27E77
44 (rom (root))))))))
47 (def hxc-pokedex
48 "The hardcoded pokedex entries in memory. List begins at
49 ROM@B8000, shortly before move names."
50 (map character-codes->str
51 (take-nth 2
52 (partition-by #(= % 0x50)
53 (take 14754
54 (drop 0xB8000
55 (rom (root))))))))
56 (def hxc-moves
57 "The hardcoded move names in memory. List begins at ROM@BC000"
58 (map character-codes->str
59 (take-nth 2
60 (partition-by #(= % 0x50)
61 (take 1551
62 (drop 0xBC000
63 (rom (root))))))))
67 (def hxc-places
68 "The hardcoded place names in memory. List begins at
69 ROM@71500. Cinnabar Mansion is dynamically calculated."
70 (map character-codes->str
71 (take-nth 2
72 (partition-by #(= % 0x50)
73 (take 560
74 (drop 0x71500
75 (rom (root))))))))
78 (def hxc-dialog
79 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
80 (character-codes->str(take 0x0F728
81 (drop (+ 0x98000)
82 (rom (root))))))
87 (def pkmn-types
88 [:normal
89 :fighting
90 :flying
91 :poison
92 :ground
93 :rock
94 :bird
95 :bug
96 :ghost
97 :A
98 :B
99 :C
100 :D
101 :E
102 :F
103 :G
104 :H
105 :I
106 :J
107 :K
108 :fire
109 :water
110 :grass
111 :electric
112 :psychic
113 :ice
114 :dragon
115 ])
118 (def hxc-advantage
119 "The hardcoded type advantages in memory, returned as tuples of [atk-type def-type multiplier]. By default (i.e. if not listed here), the multiplier is 1."
120 (map
121 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
122 (get pkmn-types def (hex def))
123 (/ mult 10)])
124 (partition 3
125 (take-while (partial not= 0xFF)
126 (drop 0x3E62D (rom(root)))))))
148 (def hxc-later
149 "Running this code produces, e.g. hardcoded names NPCs give
150 their pokemon. Will sort through it later."
151 (print (character-codes->str(take 10000
152 (drop 0x71597
153 (rom (root)))))))
155 (let [dex
156 (partition-by #(= 0x50 %)
157 (take 2540
158 (drop 0x40687
159 (rom (root)))))]
160 (def dex dex)
161 (def hxc-species
162 (map character-codes->str
163 (take-nth 4 dex))))