Mercurial > vba-clojure
view clojure/com/aurellem/gb/species.clj @ 417:0b6624c1291c
made basic tone player.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 16 Apr 2012 14:08:56 -0500 |
parents | 3dfb9dd3db9d |
children |
line wrap: on
line source
1 (ns com.aurellem.gb.species2 (:use (com.aurellem.gb assembly characters gb-driver util3 constants))4 (:import [com.aurellem.gb.gb_driver SaveState]))8 (def species-code->species-name9 {0x01 :rhydon10 0x02 :kangaskhan11 0x03 :nidoran♂12 0x04 :clefairy13 0x05 :spearow14 0x06 :voltorb15 0x07 :nidoking16 0x08 :slowbro17 0x09 :ivysaur18 0x0A :exeggutor19 0x0B :lickitung20 0x0C :exeggcute21 0x0D :grimer22 0x0E :gengar23 0x0F :nidoran♀24 0x10 :nidoqueen25 0x11 :cubone26 0x12 :rhyhorn27 0x13 :lapras28 0x14 :arcanine29 0x15 :mew30 0x16 :gyarados31 0x17 :shellder32 0x18 :tentacool33 0x19 :gastly34 0x1A :scyther35 0x1B :staryu36 0x1C :blastoise37 0x1D :pinsir38 0x1E :tangela39 0x21 :growlithe40 0x22 :onix41 0x23 :fearow42 0x24 :pidgey43 0x25 :slowpoke44 0x26 :kadabra45 0x27 :graveler46 0x28 :chansey47 0x29 :machoke48 0x2A :mr-mime49 0x2B :hitmonlee50 0x2C :hitmonchan51 0x2D :arbok52 0x2E :parasect53 0x2F :psyduck54 0x30 :drowzee55 0x31 :golem56 0x33 :magmar57 0x35 :electabuzz58 0x36 :magneton59 0x37 :koffing60 0x39 :mankey61 0x3A :seel62 0x3B :diglett63 0x3C :tauros64 0x40 :farfetch65 0x41 :venonat66 0x42 :dragonite67 0x46 :doduo68 0x47 :poliwag69 0x48 :jynx70 0x49 :moltres71 0x4A :articuno72 0x4B :zapdos73 0x4C :ditto74 0x4D :meowth75 0x4E :krabby76 0x52 :vulpix77 0x53 :ninetales78 0x54 :pikachu79 0x55 :raichu80 0x58 :dratini81 0x59 :dragonair82 0x5A :kabuto83 0x5B :kabutops84 0x5C :horsea85 0x5D :seadra86 0x60 :sandshrew87 0x61 :sandslash88 0x62 :omanyte89 0x63 :omastar90 0x64 :jigglypuff91 0x65 :wigglytuff92 0x66 :eevee93 0x67 :flareon94 0x68 :jolteon95 0x69 :vaporeon96 0x6A :machop97 0x6B :zubat98 0x6C :ekans99 0x6D :paras100 0x6E :poliwhirl101 0x6F :poliwrath102 0x70 :weedle103 0x71 :kakuna104 0x72 :beedrill105 0x74 :dodrio106 0x75 :primeape107 0x76 :dugtrio108 0x77 :venomoth109 0x78 :dewgong110 0x7B :caterpie111 0x7C :metapod112 0x7D :butterfree113 0x7E :machamp114 0x80 :golduck115 0x81 :hypno116 0x82 :golbat117 0x83 :mewtwo118 0x84 :snorlax119 0x85 :magikarp120 0x88 :muk121 0x8A :kingler122 0x8B :cloyster123 0x8D :electrode124 0x8E :clefable125 0x8F :weezing126 0x90 :persian127 0x91 :marowak128 0x93 :haunter129 0x94 :abra130 0x95 :alakazam131 0x96 :pidgeotto132 0x97 :pidgeot133 0x98 :starmie134 0x99 :bulbasaur135 0x9A :venusaur136 0x9B :tentacruel137 0x9D :goldeen138 0x9E :seaking139 0xA3 :ponyta140 0xA4 :rapidash141 0xA5 :rattata142 0xA6 :raticate143 0xA7 :nidorino144 0xA8 :nidorina145 0xA9 :geodude146 0xAA :porygon147 0xAB :aerodactyl148 0xAD :magnemite149 0xB0 :charmander150 0xB1 :squirtle151 0xB2 :charmeleon152 0xB3 :wartortle153 0xB4 :charizard154 0xB9 :oddish155 0xBA :gloom156 0xBB :vileplume157 0xBC :bellsprout158 0xBD :weepinbell159 0xBE :victreebel})161 (def species-ID-1 0xD163)163 (def species-name->species-code164 (zipmap (vals species-code->species-name)165 (keys species-code->species-name)))167 (defn pokemon-species-data-address [poke-num]168 (+ species-ID-1 poke-num))170 (defn read-species171 ([^SaveState state poke-num]172 (assert (<= 0 poke-num 5))173 (species-code->species-name174 (aget (memory state)175 (pokemon-species-data-address poke-num))))176 ([poke-num]177 (read-species @current-state poke-num)))179 (defn set-species180 ([^SaveState state poke-num species-name]181 (assert (<= 0 poke-num 5))182 (let [species-code (species-name->species-code183 species-name184 species-name)]186 (set-memory state (pokemon-species-data-address poke-num)187 species-code)))188 ([poke-num species-name]189 (set-species @current-state poke-num species-name)))192 (def pokemon-1-species2-address 0xD16A)194 (defn pokemon-species2-address [poke-num]195 (+ pokemon-1-species2-address196 (* pokemon-record-width poke-num)))198 (defn read-species2199 ([^SaveState state poke-num]200 (species-code->species-name201 (aget (memory state)202 (pokemon-species2-address poke-num))))203 ([poke-num]204 (read-species2 @current-state poke-num)))206 (defn set-species2207 ([^SaveState state poke-num new-species]208 (let [species-code (species-name->species-code209 new-species210 new-species)]212 (set-memory state (pokemon-species2-address poke-num)213 species-code)))214 ([poke-num new-species]215 (set-species2 @current-state poke-num new-species)))218 (def pokedex-num->species-name219 {1 :bulbasaur220 2 :ivysaur221 3 :venusaur222 4 :charmander223 5 :charmeleon224 6 :charizard225 7 :squirtle226 8 :wartortle227 9 :blastoise228 10 :caterpie229 11 :metapod230 12 :butterfree231 13 :weedle232 14 :kakuna233 15 :beedrill234 16 :pidgey235 17 :pidgeotto236 18 :pidgeot237 19 :rattata238 20 :raticate239 21 :spearow240 22 :fearow241 23 :ekans242 24 :arbok243 25 :pikachu244 26 :raichu245 27 :sandshrew246 28 :sandslash247 29 :nidoran♀248 30 :nidorina249 31 :nidoqueen250 32 :nidoran♂251 33 :nidorino252 34 :nidoking253 35 :clefairy254 36 :clefable255 37 :vulpix256 38 :ninetales257 39 :jigglypuff258 40 :wigglytuff259 41 :zubat260 42 :golbat261 43 :oddish262 44 :gloom263 45 :vileplume264 46 :paras265 47 :parasect266 48 :venonat267 49 :venomoth268 50 :diglett269 51 :dugtrio270 52 :meowth271 53 :persian272 54 :psyduck273 55 :golduck274 56 :mankey275 57 :primeape276 58 :growlithe277 59 :arcanine278 60 :poliwag279 61 :poliwhirl280 62 :poliwrath281 63 :abra282 64 :kadabra283 65 :alakazam284 66 :machop285 67 :machoke286 68 :machamp287 69 :bellsprout288 70 :weepinbell289 71 :victreebel290 72 :tentacool291 73 :tentacruel292 74 :geodude293 75 :graveler294 76 :golem295 77 :ponyta296 78 :rapidash297 79 :slowpoke298 80 :slowbro299 81 :magnemite300 82 :magneton301 83 :farfetch302 84 :doduo303 85 :dodrio304 86 :seel305 87 :dewgong306 88 :grimer307 89 :muk308 90 :shellder309 91 :cloyster310 92 :gastly311 93 :haunter312 94 :gengar313 95 :onix314 96 :drowzee315 97 :hypno316 98 :krabby317 99 :kingler318 100 :voltorb319 101 :electrode320 102 :exeggcute321 103 :exeggutor322 104 :cubone323 105 :marowak324 106 :hitmonlee325 107 :hitmonchan326 108 :lickitung327 109 :koffing328 110 :weezing329 111 :rhyhorn330 112 :rhydon331 113 :chansey332 114 :tangela333 115 :kangaskhan334 116 :horsea335 117 :seadra336 118 :goldeen337 119 :seaking338 120 :staryu339 121 :starmie340 122 :mr-mime341 123 :scyther342 124 :jynx343 125 :electabuzz344 126 :magmar345 127 :pinsir346 128 :tauros347 129 :magikarp348 130 :gyarados349 131 :lapras350 132 :ditto351 133 :eevee352 134 :vaporeon353 135 :jolteon354 136 :flareon355 137 :porygon356 138 :omanyte357 139 :omastar358 140 :kabuto359 141 :kabutops360 142 :aerodactyl361 143 :snorlax362 144 :articuno363 145 :zapdos364 146 :moltres365 147 :dratini366 148 :dragonair367 149 :dragonite368 150 :mewtwo369 151 :mew})371 (def species-name->pokedex-num372 (zipmap (vals pokedex-num->species-name)373 (keys pokedex-num->species-name)))