comparison clojure/com/aurellem/gb/hxc.clj @ 283:516acb83410f

Added the hardcoded list of moves that the TMs and HMs teach.
author Dylan Holmes <ocsenave@gmail.com>
date Wed, 28 Mar 2012 04:52:09 -0500
parents 0c3fbb313e49
children 33c546273619
comparison
equal deleted inserted replaced
282:0c3fbb313e49 283:516acb83410f
18 18
19 (defn format-name 19 (defn format-name
20 "Convert the string of alphabetic/space characters into a keyword by 20 "Convert the string of alphabetic/space characters into a keyword by
21 replacing spaces with hyphens and converting to lowercase." 21 replacing spaces with hyphens and converting to lowercase."
22 [s] 22 [s]
23 (if (nil? s) nil
23 (keyword (.toLowerCase 24 (keyword (.toLowerCase
24 (apply str 25 (apply str
25 (map #(if (= % \space) "-" %) s))))) 26 (map #(if (= % \space) "-" %) s))))))
26 27
27 28
28 ;; used to decode item prices 29 ;; used to decode item prices
29 30
30 (defn decode-bcd 31 (defn decode-bcd
302 (drop 0x98000 rom)))))) 303 (drop 0x98000 rom))))))
303 ([] 304 ([]
304 (hxc-dialog com.aurellem.gb.gb-driver/original-rom))) 305 (hxc-dialog com.aurellem.gb.gb-driver/original-rom)))
305 306
306 307
307
308
309 (def hxc-move-names 308 (def hxc-move-names
310 "The hardcoded move names in memory. List begins at ROM@BC000" 309 "The hardcoded move names in memory. List begins at ROM@BC000"
311 (hxc-thunk-words 0xBC000 1551)) 310 (hxc-thunk-words 0xBC000 1551))
312 311
313 312
370 (partition move-size 369 (partition move-size
371 (take (* move-size move-count) 370 (take (* move-size move-count)
372 (drop 0x38000 rom)))))))) 371 (drop 0x38000 rom))))))))
373 372
374 373
375 374 (defn hxc-machines
375 "The hardcoded moves taught by TMs and HMs. List begins at ROM@0x1232D."
376 ([] (hxc-machines
377 com.aurellem.gb.gb-driver/original-rom))
378 ([rom]
379 (let [moves (hxc-move-names rom)]
380 (zipmap
381 (range)
382 (take-while
383 (comp not nil?)
384 (map (comp
385 format-name
386 (zipmap
387 (range)
388 moves)
389 dec)
390 (take 100
391 (drop 0x1232D rom))))))))
392
376 (defn hxc-pokenames 393 (defn hxc-pokenames
377 "The hardcoded names of the 190 species in memory. List begins at 394 "The hardcoded names of the 190 species in memory. List begins at
378 ROM@E8000. Although names in memory are padded with 0x50 to be 10 characters 395 ROM@E8000. Although names in memory are padded with 0x50 to be 10 characters
379 long, these names are stripped of padding." 396 long, these names are stripped of padding."
380 ([] 397 ([]
600 rating-special 617 rating-special
601 type-1 618 type-1
602 type-2 619 type-2
603 rarity 620 rarity
604 rating-xp 621 rating-xp
605 pic-dimensions 622 pic-dimensions ;; tile_width|tile_height (8px/tile)
606 ptr-pic-obverse-1 623 ptr-pic-obverse-1
607 ptr-pic-obverse-2 624 ptr-pic-obverse-2
608 ptr-pic-reverse-1 625 ptr-pic-reverse-1
609 ptr-pic-reverse-2 626 ptr-pic-reverse-2
610 move-1 627 move-1
767 784
768 785
769 786
770 787
771 788
789 ;; note: 0x2f31 contains the names "TM" "HM"?
790
772 ;; note for later: credits start at F1290 791 ;; note for later: credits start at F1290
773 792
774 793
775 794
776 795