# HG changeset patch # User Dylan Holmes # Date 1333184061 18000 # Node ID 872e032949ff2a0614c7d1c7b40157b6b922c380 # Parent 2873f50b7291dd5d5df82c28b647983d4396e66d completed cry functions. diff -r 2873f50b7291 -r 872e032949ff clojure/com/aurellem/gb/hxc.clj --- a/clojure/com/aurellem/gb/hxc.clj Sat Mar 31 01:27:46 2012 -0500 +++ b/clojure/com/aurellem/gb/hxc.clj Sat Mar 31 03:54:21 2012 -0500 @@ -1,7 +1,7 @@ (ns com.aurellem.gb.hxc (:use (com.aurellem.gb assembly characters gb-driver util constants species)) - ;; (:use (com.aurellem.world practice)) + (:use (com.aurellem.world practice)) (:import [com.aurellem.gb.gb_driver SaveState])) @@ -209,12 +209,49 @@ ;; http://hax.iimarck.us/topic/581/ -(defn hxc-pokedex-cry - "The pokemon cry data in internal order. List begins at ROM@410B1 - [] +(defn hxc-cry + "The pokemon cry data in internal order. List begins at ROM@39462" + ([](hxc-cry com.aurellem.gb.gb-driver/original-rom) + ([rom] + (zipmap + (hxc-pokenames rom) + (map + (fn [[cry-id pitch length]] + {:cry-id cry-id + :pitch pitch + :length length} + ) + (partition 3 + (drop 0x39462 rom))))))) +(defn hxc-cry-groups + ([] (hxc-cry-ids com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (map #(mapv first + (filter + (fn [[k v]] + (= % (:cry-id v))) + (hxc-cry rom))) + ((comp + range + count + set + (partial map :cry-id) + vals + hxc-cry) + rom)))) +(defn cry-conversion! + "Convert Porygon's cry in ROM to be the cry of the given pokemon." + [pkmn] + (write-rom! + (rewrite-memory + (vec(rom)) + 0x3965D + (map second + ((hxc-cry) pkmn))))) + (def hxc-items-raw "The hardcoded names of the items in memory. List begins at ROM@045B7"