Mercurial > vba-clojure
view clojure/com/aurellem/gb/species.clj @ 212:8523faa122b0
fixed compilaition error in dylan's code
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 18:06:37 -0500 |
parents | a67f1df5d096 |
children | 57258c269bcb 62969eb07e04 |
line wrap: on
line source
1 (ns com.aurellem.gb.species2 (:use (com.aurellem.gb characters gb-driver util constants))3 (:import [com.aurellem.gb.gb_driver SaveState]))6 (def hxc-pokenames7 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."8 (let [count-species 1909 name-length 10]10 (map character-codes->str11 (partition name-length12 (take (* count-species name-length)13 (drop 0xE800014 (rom(root))))))))16 (def hxc-items17 "The hardcoded names of the items in memory. List begins at ROM@45B7 "18 (map character-codes->str19 (take-nth 220 (partition-by #(= % 0x50)21 (take 120022 (drop 0x45B7 (rom (root))))))))23 (def hxc-titles24 "The hardcoded names of the trainer titles in memory. List begins at25 ROM@27E77"26 (map character-codes->str27 (take-nth 228 (partition-by #(= 0x50 %)29 (take 19630 (drop 0x27E7731 (rom (root))))))))34 (def hxc-pokedex35 "The hardcoded pokedex entries in memory. List begins at36 ROM@B8000, shortly before move names."37 (map character-codes->str38 (take-nth 239 (partition-by #(= % 0x50)40 (take 1475441 (drop 0xB800042 (rom (root))))))))43 (def hxc-moves44 "The hardcoded move names in memory. List begins at ROM@BC000"45 (map character-codes->str46 (take-nth 247 (partition-by #(= % 0x50)48 (take 155149 (drop 0xBC00050 (rom (root))))))))54 (def hxc-places55 "The hardcoded place names in memory. List begins at56 ROM@71500. Cinnabar Mansion is dynamically calculated."57 (map character-codes->str58 (take-nth 259 (partition-by #(= % 0x50)60 (take 56061 (drop 0x7150062 (rom (root))))))))64 (def hxc-later65 "Running this code produces, e.g. hardcoded names NPCs give66 their pokemon"67 (print (character-codes->str(take 1000068 (drop 0x7159769 (rom (root)))))))74 (let [dex75 (partition-by #(= 0x50 %)76 (take 254077 (drop 0x4068778 (rom (root)))))]79 (def dex dex)80 (def hxc-species81 (map character-codes->str82 (take-nth 4 dex))))86 (def species-code->species-name87 {0x01 :rhydon88 0x02 :kangaskhan89 0x03 :nidoran-male90 0x04 :clefairy91 0x05 :spearow92 0x06 :voltorb93 0x07 :nidoking94 0x08 :slowbro95 0x09 :ivysaur96 0x0A :exeggutor97 0x0B :lickitung98 0x0C :exeggcute99 0x0D :grimer100 0x0E :gengar101 0x0F :nidoran-female102 0x10 :nidoqueen103 0x11 :cubone104 0x12 :rhyhorn105 0x13 :lapras106 0x14 :arcanine107 0x15 :mew108 0x16 :gyarados109 0x17 :shellder110 0x18 :tentacool111 0x19 :gastly112 0x1A :scyther113 0x1B :staryu114 0x1C :blastoise115 0x1D :pinsir116 0x1E :tangela117 0x21 :growlithe118 0x22 :onix119 0x23 :fearow120 0x24 :pidgey121 0x25 :slowpoke122 0x26 :kadabra123 0x27 :graveler124 0x28 :chansey125 0x29 :machoke126 0x2A :mr-mime127 0x2B :hitmonlee128 0x2C :hitmonchan129 0x2D :arbok130 0x2E :parasect131 0x2F :psyduck132 0x30 :drowzee133 0x31 :golem134 0x33 :magmar135 0x35 :electabuzz136 0x36 :magneton137 0x37 :koffing138 0x39 :mankey139 0x3A :seel140 0x3B :diglett141 0x3C :tauros142 0x40 :farfetch'd143 0x41 :venonat144 0x42 :dragonite145 0x46 :doduo146 0x47 :poliwag147 0x48 :jynx148 0x49 :moltres149 0x4A :articuno150 0x4B :zapdos151 0x4C :ditto152 0x4D :meowth153 0x4E :krabby154 0x52 :vulpix155 0x53 :ninetails156 0x54 :pikachu157 0x55 :raichu158 0x58 :dratini159 0x59 :dragonair160 0x5A :kabuto161 0x5B :kabutops162 0x5C :horsea163 0x5D :sedra164 0x60 :sandshrew165 0x61 :sandslash166 0x62 :omanyte167 0x63 :omastar168 0x64 :jigglypuff169 0x65 :wigglytuff170 0x66 :eevee171 0x67 :flareon172 0x68 :jolteon173 0x69 :vaporeon174 0x6A :machop175 0x6B :zubat176 0x6C :ekans177 0x6D :paras178 0x6E :poliwhirl179 0x6F :poliwrath180 0x70 :weedle181 0x71 :kakuna182 0x72 :beedrill183 0x74 :dodrio184 0x75 :primeape185 0x76 :dugtrio186 0x77 :venomoth187 0x78 :dewgong188 0x7B :caterpie189 0x7C :metapod190 0x7D :butterfree191 0x7E :machamp192 0x80 :golduck193 0x81 :hypno194 0x82 :golbat195 0x83 :mewtwo196 0x84 :snorlax197 0x85 :magikarp198 0x88 :muk199 0x8A :kingler200 0x8B :cloyster201 0x8D :electrode202 0x8E :clefable203 0x8F :wheezing204 0x90 :persian205 0x91 :marowak206 0x93 :haunter207 0x94 :abra208 0x95 :alakazam209 0x96 :pidgeotto210 0x97 :pidgeot211 0x98 :starmie212 0x99 :bulbasaur213 0x9A :venusaur214 0x9B :tentacruel215 0x9D :goldeen216 0x9E :seaking217 0xA3 :ponyta218 0xA4 :rapidash219 0xA5 :rattata220 0xA6 :raticate221 0xA7 :nidorino222 0xA8 :nidorina223 0xA9 :geodude224 0xAA :porygon225 0xAB :aerodactyl226 0xAD :magnemite227 0xB0 :charmander228 0xB1 :squirtle229 0xB2 :charmeleon230 0xB3 :wartortle231 0xB4 :charizard232 0xB9 :oddish233 0xBA :gloom234 0xBB :vileplume235 0xBC :bellsprout236 0xBD :weepenbell237 0xBE :victreebel})239 (def species-ID-1 0xD163)241 (def species-name->species-code242 (zipmap (vals species-code->species-name)243 (keys species-code->species-name)))245 (defn pokemon-species-data-address [poke-num]246 (+ species-ID-1 poke-num))248 (defn read-species249 ([^SaveState state poke-num]250 (assert (<= 0 poke-num 5))251 (species-code->species-name252 (aget (memory state)253 (pokemon-species-data-address poke-num))))254 ([poke-num]255 (read-species @current-state poke-num)))257 (defn set-species258 ([^SaveState state poke-num species-name]259 (assert (<= 0 poke-num 5))260 (let [species-code (species-name->species-code261 species-name262 species-name)]264 (set-memory state (pokemon-species-data-address poke-num)265 species-code)))266 ([poke-num species-name]267 (set-species @current-state poke-num species-name)))270 (def pokemon-1-species2-address 0xD16A)272 (defn pokemon-species2-address [poke-num]273 (+ pokemon-1-species2-address274 (* pokemon-record-width poke-num)))276 (defn read-species2277 ([^SaveState state poke-num]278 (species-code->species-name279 (aget (memory state)280 (pokemon-species2-address poke-num))))281 ([poke-num]282 (read-species2 @current-state poke-num)))284 (defn set-species2285 ([^SaveState state poke-num new-species]286 (let [species-code (species-name->species-code287 new-species288 new-species)]290 (set-memory state (pokemon-species2-address poke-num)291 species-code)))292 ([poke-num new-species]293 (set-species2 @current-state poke-num new-species)))