comparison clojure/com/aurellem/gb/hxc.clj @ 307:872e032949ff

completed cry functions.
author Dylan Holmes <ocsenave@gmail.com>
date Sat, 31 Mar 2012 03:54:21 -0500
parents 2873f50b7291
children de172acc5a03
comparison
equal deleted inserted replaced
306:2873f50b7291 307:872e032949ff
1 (ns com.aurellem.gb.hxc 1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util 2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants species)) 3 constants species))
4 ;; (:use (com.aurellem.world practice)) 4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState])) 5 (:import [com.aurellem.gb.gb_driver SaveState]))
6 6
7 7
8 8
9 9
207 names))))) 207 names)))))
208 208
209 209
210 210
211 ;; http://hax.iimarck.us/topic/581/ 211 ;; http://hax.iimarck.us/topic/581/
212 (defn hxc-pokedex-cry 212 (defn hxc-cry
213 "The pokemon cry data in internal order. List begins at ROM@410B1 213 "The pokemon cry data in internal order. List begins at ROM@39462"
214 [] 214 ([](hxc-cry com.aurellem.gb.gb-driver/original-rom)
215 215 ([rom]
216 216 (zipmap
217 (hxc-pokenames rom)
218 (map
219 (fn [[cry-id pitch length]]
220 {:cry-id cry-id
221 :pitch pitch
222 :length length}
223 )
224 (partition 3
225 (drop 0x39462 rom)))))))
226
227 (defn hxc-cry-groups
228 ([] (hxc-cry-ids com.aurellem.gb.gb-driver/original-rom))
229 ([rom]
230 (map #(mapv first
231 (filter
232 (fn [[k v]]
233 (= % (:cry-id v)))
234 (hxc-cry rom)))
235 ((comp
236 range
237 count
238 set
239 (partial map :cry-id)
240 vals
241 hxc-cry)
242 rom))))
243
244
245 (defn cry-conversion!
246 "Convert Porygon's cry in ROM to be the cry of the given pokemon."
247 [pkmn]
248 (write-rom!
249 (rewrite-memory
250 (vec(rom))
251 0x3965D
252 (map second
253 ((hxc-cry) pkmn)))))
217 254
218 (def hxc-items-raw 255 (def hxc-items-raw
219 "The hardcoded names of the items in memory. List begins at 256 "The hardcoded names of the items in memory. List begins at
220 ROM@045B7" 257 ROM@045B7"
221 (hxc-thunk-words 0x45B7 870)) 258 (hxc-thunk-words 0x45B7 870))