diff org/rom.org @ 471:5f87c3e46c22

Added interactive Pokemon cries.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 29 Apr 2012 20:35:58 -0500
parents c02108ddcb35
children 69d1787522c7
line wrap: on
line diff
     1.1 --- a/org/rom.org	Sun Apr 29 19:48:43 2012 -0500
     1.2 +++ b/org/rom.org	Sun Apr 29 20:35:58 2012 -0500
     1.3 @@ -6,6 +6,8 @@
     1.4  #+SETUPFILE: ../../aurellem/org/setup.org
     1.5  #+INCLUDE: ../../aurellem/org/level-0.org
     1.6  #+BABEL: :exports both :noweb yes :cache no :mkdirp yes
     1.7 +#+OPTIONS: num:2
     1.8 +
     1.9  
    1.10  # about map headers http://datacrystal.romhacking.net/wiki/Pokemon_Red/Blue:Notes
    1.11  # map headers Yellow http://www.pokecommunity.com/archive/index.php/t-235311.html
    1.12 @@ -26,7 +28,7 @@
    1.13  above, or browse the [[#sec-9-1][map of the ROM]], below.
    1.14  
    1.15  
    1.16 -(If you have any questions or comments, please e-mail =rlm@mit.edu=)
    1.17 +If you have any questions or comments, please e-mail =rlm@mit.edu=.
    1.18  
    1.19  
    1.20  ** COMMENT Getting linguistic data: names, words, etc.
    1.21 @@ -527,6 +529,134 @@
    1.22  
    1.23  
    1.24  ** Pok\eacute{}mon cries
    1.25 +*** See the data
    1.26 +
    1.27 +Here, you can see that each Pok\eacute{}mon's cry data consists of
    1.28 +three bytes: the =cry-id=, which is the basic sound byte to use, the
    1.29 +=pitch=, which determines how high or low to make the sound byte, and
    1.30 +the =length=, which is the amount of the sound byte to play. 
    1.31 +
    1.32 +Even though there are only a few different basic sound bytes (cry
    1.33 +ids) to build from, by varying the pitch and length, 
    1.34 +you can create a wide variety of different Pok\eacute{}mon cries. 
    1.35 +
    1.36 +#+begin_src clojure  :exports both :cache no :results output 
    1.37 +(ns com.aurellem.gb.hxc
    1.38 +  (:use (com.aurellem.gb assembly characters gb-driver util mem-util
    1.39 +                         constants))
    1.40 +  (:import [com.aurellem.gb.gb_driver SaveState]))
    1.41 +
    1.42 +(->>
    1.43 + (rom)
    1.44 + (drop 0x39462)
    1.45 + (take 12)
    1.46 + (println))
    1.47 +
    1.48 +(->>
    1.49 + (rom)
    1.50 + (drop 0x39462)
    1.51 + (take 12)
    1.52 + (partition 3)
    1.53 + (map vec)
    1.54 + (println))
    1.55 +
    1.56 +(->>
    1.57 + (rom)
    1.58 + (drop 0x39462)
    1.59 + (take 12)
    1.60 + (partition 3)
    1.61 + (map
    1.62 +  (fn [[id pitch length]]
    1.63 +    {:cry-id id :pitch pitch :length length}))
    1.64 + (println))
    1.65 +
    1.66 +#+end_src
    1.67 +
    1.68 +#+results:
    1.69 +: (17 0 128 3 0 128 0 0 128 25 204 1)
    1.70 +: ([17 0 128] [3 0 128] [0 0 128] [25 204 1])
    1.71 +: ({: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})
    1.72 +
    1.73 +
    1.74 +It is interesting to note which Pok\eacute{}mon use the same basic
    1.75 +=cry-id= --- I call these /cry groups/. Here, you can see which
    1.76 +Pok\eacute{}mon belong to the same cry group.
    1.77 + 
    1.78 +#+begin_src clojure  :exports both :cache no :results output 
    1.79 +(ns com.aurellem.gb.hxc
    1.80 +  (:use (com.aurellem.gb assembly characters gb-driver util mem-util
    1.81 +                         constants))
    1.82 +  (:import [com.aurellem.gb.gb_driver SaveState]))
    1.83 +
    1.84 +(println "POKEMON CRY GROUPS")
    1.85 +(doall
    1.86 + (map println
    1.87 +      (let [cry-id
    1.88 +            (->>
    1.89 +             (rom)
    1.90 +             (drop 0x39462)  ;; get the cry data
    1.91 +             (partition 3)   ;; partition it into groups of three
    1.92 +             (map first)     ;; keep only the first item, the cry-id
    1.93 +             (zipmap (hxc-pokenames)) ;; associate each pokemon with its cry-id
    1.94 +             )]
    1.95 +        
    1.96 +        (->> (hxc-pokenames)                 ;; start with the list of pokemon
    1.97 +             (remove (partial = :missingno.)) ;; remove missingnos
    1.98 +             (sort-by cry-id)
    1.99 +             (partition-by cry-id)
   1.100 +             (map vec)))))
   1.101 +
   1.102 +#+end_src
   1.103 +
   1.104 +#+results:
   1.105 +#+begin_example
   1.106 +POKEMON CRY GROUPS
   1.107 +[:nidoran♂ :sandshrew :sandslash :nidorino]
   1.108 +[:nidoran♀ :nidorina]
   1.109 +[:slowpoke]
   1.110 +[:kangaskhan]
   1.111 +[:rhyhorn :magmar :charmander :charmeleon :charizard]
   1.112 +[:grimer :snorlax]
   1.113 +[:voltorb :electabuzz :electrode]
   1.114 +[:gengar :muk]
   1.115 +[:marowak :oddish :gloom]
   1.116 +[:nidoking :moltres :articuno :raichu]
   1.117 +[:nidoqueen :mankey :primeape]
   1.118 +[:exeggcute :diglett :doduo :dodrio :dugtrio]
   1.119 +[:lickitung :hitmonchan :seel :dewgong]
   1.120 +[:exeggutor :drowzee :jynx :hypno]
   1.121 +[:pidgey :poliwag :ditto :jigglypuff :wigglytuff :poliwhirl :poliwrath]
   1.122 +[:ivysaur :dragonite :pikachu :dratini :dragonair :bulbasaur :venusaur]
   1.123 +[:spearow :farfetch'd]
   1.124 +[:rhydon]
   1.125 +[:tangela :hitmonlee :golem :koffing :weezing]
   1.126 +[:blastoise :kakuna :beedrill]
   1.127 +[:pinsir :chansey :pidgeotto :pidgeot]
   1.128 +[:arcanine :weedle]
   1.129 +[:scyther :kabuto :caterpie :butterfree :goldeen :seaking]
   1.130 +[:gyarados :onix :arbok :ekans :magikarp]
   1.131 +[:shellder :fearow :zapdos :kabutops :cloyster]
   1.132 +[:clefairy :cubone :meowth :horsea :seadra :clefable :persian]
   1.133 +[:tentacool :venonat :eevee :flareon :jolteon :vaporeon :venomoth :tentacruel]
   1.134 +[:lapras]
   1.135 +[:gastly :kadabra :magneton :metapod :haunter :abra :alakazam :magnemite]
   1.136 +[:tauros :zubat :golbat :squirtle :wartortle]
   1.137 +[:mew :staryu :parasect :paras :mewtwo :starmie]
   1.138 +[:slowbro :growlithe :machoke :omanyte :omastar :machop :machamp]
   1.139 +[:mr.mime :krabby :kingler]
   1.140 +[:psyduck :golduck :bellsprout]
   1.141 +[:rattata :raticate]
   1.142 +[:aerodactyl :vileplume]
   1.143 +[:graveler :vulpix :ninetales :geodude]
   1.144 +[:ponyta :rapidash :porygon :weepinbell :victreebel]
   1.145 +#+end_example
   1.146 +
   1.147 +
   1.148 +
   1.149 +
   1.150 +
   1.151 +
   1.152 +*** Automatically grab the data
   1.153  #+name: pokecry
   1.154  #+begin_src clojure
   1.155  (defn hxc-cry