# HG changeset patch # User Dylan Holmes # Date 1335749758 18000 # Node ID 5f87c3e46c22e32a2cb64e6e421dfb2a42712ca8 # Parent c02108ddcb35db0d7116363c300a7b4090f674f6 Added interactive Pokemon cries. diff -r c02108ddcb35 -r 5f87c3e46c22 org/rom.org --- a/org/rom.org Sun Apr 29 19:48:43 2012 -0500 +++ b/org/rom.org Sun Apr 29 20:35:58 2012 -0500 @@ -6,6 +6,8 @@ #+SETUPFILE: ../../aurellem/org/setup.org #+INCLUDE: ../../aurellem/org/level-0.org #+BABEL: :exports both :noweb yes :cache no :mkdirp yes +#+OPTIONS: num:2 + # about map headers http://datacrystal.romhacking.net/wiki/Pokemon_Red/Blue:Notes # map headers Yellow http://www.pokecommunity.com/archive/index.php/t-235311.html @@ -26,7 +28,7 @@ above, or browse the [[#sec-9-1][map of the ROM]], below. -(If you have any questions or comments, please e-mail =rlm@mit.edu=) +If you have any questions or comments, please e-mail =rlm@mit.edu=. ** COMMENT Getting linguistic data: names, words, etc. @@ -527,6 +529,134 @@ ** Pok\eacute{}mon cries +*** See the data + +Here, you can see that each Pok\eacute{}mon's cry data consists of +three bytes: the =cry-id=, which is the basic sound byte to use, the +=pitch=, which determines how high or low to make the sound byte, and +the =length=, which is the amount of the sound byte to play. + +Even though there are only a few different basic sound bytes (cry +ids) to build from, by varying the pitch and length, +you can create a wide variety of different Pok\eacute{}mon cries. + +#+begin_src clojure :exports both :cache no :results output +(ns com.aurellem.gb.hxc + (:use (com.aurellem.gb assembly characters gb-driver util mem-util + constants)) + (:import [com.aurellem.gb.gb_driver SaveState])) + +(->> + (rom) + (drop 0x39462) + (take 12) + (println)) + +(->> + (rom) + (drop 0x39462) + (take 12) + (partition 3) + (map vec) + (println)) + +(->> + (rom) + (drop 0x39462) + (take 12) + (partition 3) + (map + (fn [[id pitch length]] + {:cry-id id :pitch pitch :length length})) + (println)) + +#+end_src + +#+results: +: (17 0 128 3 0 128 0 0 128 25 204 1) +: ([17 0 128] [3 0 128] [0 0 128] [25 204 1]) +: ({:cry-id 17, :pitch 0, :length 128} {:cry-id 3, :pitch 0, :length 128} {:cry-id 0, :pitch 0, :length 128} {:cry-id 25, :pitch 204, :length 1}) + + +It is interesting to note which Pok\eacute{}mon use the same basic +=cry-id= --- I call these /cry groups/. Here, you can see which +Pok\eacute{}mon belong to the same cry group. + +#+begin_src clojure :exports both :cache no :results output +(ns com.aurellem.gb.hxc + (:use (com.aurellem.gb assembly characters gb-driver util mem-util + constants)) + (:import [com.aurellem.gb.gb_driver SaveState])) + +(println "POKEMON CRY GROUPS") +(doall + (map println + (let [cry-id + (->> + (rom) + (drop 0x39462) ;; get the cry data + (partition 3) ;; partition it into groups of three + (map first) ;; keep only the first item, the cry-id + (zipmap (hxc-pokenames)) ;; associate each pokemon with its cry-id + )] + + (->> (hxc-pokenames) ;; start with the list of pokemon + (remove (partial = :missingno.)) ;; remove missingnos + (sort-by cry-id) + (partition-by cry-id) + (map vec))))) + +#+end_src + +#+results: +#+begin_example +POKEMON CRY GROUPS +[:nidoran♂ :sandshrew :sandslash :nidorino] +[:nidoran♀ :nidorina] +[:slowpoke] +[:kangaskhan] +[:rhyhorn :magmar :charmander :charmeleon :charizard] +[:grimer :snorlax] +[:voltorb :electabuzz :electrode] +[:gengar :muk] +[:marowak :oddish :gloom] +[:nidoking :moltres :articuno :raichu] +[:nidoqueen :mankey :primeape] +[:exeggcute :diglett :doduo :dodrio :dugtrio] +[:lickitung :hitmonchan :seel :dewgong] +[:exeggutor :drowzee :jynx :hypno] +[:pidgey :poliwag :ditto :jigglypuff :wigglytuff :poliwhirl :poliwrath] +[:ivysaur :dragonite :pikachu :dratini :dragonair :bulbasaur :venusaur] +[:spearow :farfetch'd] +[:rhydon] +[:tangela :hitmonlee :golem :koffing :weezing] +[:blastoise :kakuna :beedrill] +[:pinsir :chansey :pidgeotto :pidgeot] +[:arcanine :weedle] +[:scyther :kabuto :caterpie :butterfree :goldeen :seaking] +[:gyarados :onix :arbok :ekans :magikarp] +[:shellder :fearow :zapdos :kabutops :cloyster] +[:clefairy :cubone :meowth :horsea :seadra :clefable :persian] +[:tentacool :venonat :eevee :flareon :jolteon :vaporeon :venomoth :tentacruel] +[:lapras] +[:gastly :kadabra :magneton :metapod :haunter :abra :alakazam :magnemite] +[:tauros :zubat :golbat :squirtle :wartortle] +[:mew :staryu :parasect :paras :mewtwo :starmie] +[:slowbro :growlithe :machoke :omanyte :omastar :machop :machamp] +[:mr.mime :krabby :kingler] +[:psyduck :golduck :bellsprout] +[:rattata :raticate] +[:aerodactyl :vileplume] +[:graveler :vulpix :ninetales :geodude] +[:ponyta :rapidash :porygon :weepinbell :victreebel] +#+end_example + + + + + + +*** Automatically grab the data #+name: pokecry #+begin_src clojure (defn hxc-cry