Mercurial > vba-clojure
view clojure/com/aurellem/gb/species.clj @ 198:5055ec9de278
competed move-table printing component of pokemon printing function.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 00:30:34 -0500 |
parents | 893c753f8088 |
children | 85a2c2e2d318 |
line wrap: on
line source
1 (ns com.aurellem.gb.species2 (:use (com.aurellem.gb gb-driver util constants))3 (:import [com.aurellem.gb.gb_driver SaveState]))5 (def species-code->species-name6 {0x01 :rhydon7 0x02 :kangaskhan8 0x03 :nidoran-male9 0x04 :clefairy10 0x05 :spearow11 0x06 :voltorb12 0x07 :nidoking13 0x08 :slowbro14 0x09 :ivysaur15 0x0A :exeggutor16 0x0B :lickitung17 0x0C :exeggcute18 0x0D :grimer19 0x0E :gengar20 0x0F :nidoran-female21 0x10 :nidoqueen22 0x11 :cubone23 0x12 :rhyhorn24 0x13 :lapras25 0x14 :arcanine26 0x15 :mew27 0x16 :gyarados28 0x17 :shellder29 0x18 :tentacool30 0x19 :gastly31 0x1A :scyther32 0x1B :staryu33 0x1C :blastoise34 0x1D :pinsir35 0x1E :tangela36 0x21 :growlithe37 0x22 :onix38 0x23 :fearow39 0x24 :pidgey40 0x25 :slowpoke41 0x26 :kadabra42 0x27 :graveler43 0x28 :chansey44 0x29 :machoke45 0x2A :mr-mime46 0x2B :hitmonlee47 0x2C :hitmonchan48 0x2D :arbok49 0x2E :parasect50 0x2F :psyduck51 0x30 :drowzee52 0x31 :golem53 0x33 :magmar54 0x35 :electabuzz55 0x36 :magneton56 0x37 :koffing57 0x39 :mankey58 0x3A :seel59 0x3B :diglett60 0x3C :tauros61 0x40 :farfetch'd62 0x41 :venonat63 0x42 :dragonite64 0x46 :doduo65 0x47 :poliwag66 0x48 :jynx67 0x49 :moltres68 0x4A :articuno69 0x4B :zapdos70 0x4C :ditto71 0x4D :meowth72 0x4E :krabby73 0x52 :vulpix74 0x53 :ninetails75 0x54 :pikachu76 0x55 :riachu77 0x58 :dratini78 0x59 :dragonair79 0x5A :kabuto80 0x5B :kabutops81 0x5C :horsea82 0x5D :sedra83 0x60 :sandshrew84 0x61 :sandslash85 0x62 :omanyte86 0x63 :omastar87 0x64 :jigglypuff88 0x65 :wigglytuff89 0x66 :eevee90 0x67 :flareon91 0x68 :jolteon92 0x69 :vaporeon93 0x6A :machop94 0x6B :zubat95 0x6C :ekans96 0x6D :paras97 0x6E :poliwhirl98 0x6F :poliwrath99 0x70 :weedle100 0x71 :kakuna101 0x72 :beedrill102 0x74 :dodrio103 0x75 :primeape104 0x76 :dugtrio105 0x77 :venomoth106 0x78 :dewgong107 0x7B :caterpie108 0x7C :metapod109 0x7D :butterfree110 0x7E :machamp111 0x80 :golduck112 0x81 :hypno113 0x82 :golbat114 0x83 :mewtwo115 0x84 :snorlax116 0x85 :magikarp117 0x88 :muk118 0x8A :kingler119 0x8B :cloyster120 0x8D :electrode121 0x8E :clefable122 0x8F :wheezing123 0x90 :persian124 0x91 :marowak125 0x93 :haunter126 0x94 :abra127 0x95 :alakazam128 0x96 :pidgeotto129 0x97 :pidgeot130 0x98 :starmie131 0x99 :bulbasaur132 0x9A :venusaur133 0x9B :tentacruel134 0x9D :goldeen135 0x9E :seaking136 0xA3 :ponyta137 0xA4 :rapidash138 0xA5 :rattata139 0xA6 :raticate140 0xA7 :nidorino141 0xA8 :nidorina142 0xA9 :geodude143 0xAA :porygon144 0xAB :aerodactyl145 0xAD :magnemite146 0xB0 :charmander147 0xB1 :squirtle148 0xB2 :charmeleon149 0xB3 :wartortle150 0xB4 :charizard151 0xB9 :oddish152 0xBA :gloom153 0xBB :vileplume154 0xBC :bellsprout155 0xBD :weepenbell156 0xBE :victreebel})158 (def species-ID-1 0xD163)160 (def species-name->species-code161 (zipmap (vals species-code->species-name)162 (keys species-code->species-name)))164 (defn pokemon-species-data-address [poke-num]165 (+ species-ID-1 poke-num))167 (defn read-species168 ([^SaveState state poke-num]169 (assert (<= 0 poke-num 5))170 (species-code->species-name171 (aget (memory state)172 (pokemon-species-data-address poke-num))))173 ([poke-num]174 (read-species @current-state poke-num)))176 (defn set-species177 ([^SaveState state poke-num species-name]178 (assert (<= 0 poke-num 5))179 (let [species-code (species-name->species-code180 species-name181 species-name)]183 (set-memory state (pokemon-species-data-address poke-num)184 species-code)))185 ([poke-num species-name]186 (set-species @current-state poke-num species-name)))189 (def pokemon-1-species2-address 0xD16A)191 (defn pokemon-species2-address [poke-num]192 (+ pokemon-1-species2-address193 (* pokemon-record-width poke-num)))195 (defn read-species2196 ([^SaveState state poke-num]197 (species-code->species-name198 (aget (memory state)199 (pokemon-species2-address poke-num))))200 ([poke-num]201 (read-species2 @current-state poke-num)))203 (defn set-species2204 ([^SaveState state poke-num new-species]205 (let [species-code (species-name->species-code206 new-species207 new-species)]209 (set-memory state (pokemon-species2-address poke-num)210 species-code)))211 ([poke-num new-species]212 (set-species2 @current-state poke-num new-species)))