changeset 165:8f1b32d3f229

need to determine how colormaps for pokemon work.
author Robert McIntyre <rlm@mit.edu>
date Tue, 20 Mar 2012 18:07:42 -0500
parents 6f80c07eb32a
children 76b031d2f586
files clojure/com/aurellem/gb/species.clj
diffstat 1 files changed, 175 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/species.clj	Tue Mar 20 17:44:08 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/species.clj	Tue Mar 20 18:07:42 2012 -0500
     1.3 @@ -1,151 +1,175 @@
     1.4 -;; 001  01  :    rhydon
     1.5 -;; 002  02  :    kangaskhan
     1.6 -;; 003  03  :    nidoran-male
     1.7 -;; 004  04  :    clefairy
     1.8 -;; 005  05  :    spearow
     1.9 -;; 006  06  :    voltorb
    1.10 -;; 007  07  :    nidoking
    1.11 -;; 008  08  :    slowbro
    1.12 -;; 009  09  :    ivysaur
    1.13 -;; 010  0A  :    exeggutor
    1.14 -;; 011  0B  :    lickitung
    1.15 -;; 012  0C  :    exeggcute
    1.16 -;; 013  0D  :    grimer
    1.17 -;; 014  0E  :    gengar
    1.18 -;; 015  0F  :    nidoran-female
    1.19 -;; 016  10  :    nidoqueen
    1.20 -;; 017  11  :    cubone
    1.21 -;; 018  12  :    rhyhorn
    1.22 -;; 019  13  :    lapras
    1.23 -;; 020  14  :    arcanine
    1.24 -;; 021  15  :    mew
    1.25 -;; 022  16  :    gyarados
    1.26 -;; 023  17  :    shellder
    1.27 -;; 024  18  :    tentacool
    1.28 -;; 025  19  :    gastly
    1.29 -;; 026  1A  :    scyther
    1.30 -;; 027  1B  :    staryu
    1.31 -;; 028  1C  :    blastoise
    1.32 -;; 029  1D  :    pinsir
    1.33 -;; 030  1E  :    tangela
    1.34 -;; 033  21  :    growlithe
    1.35 -;; 034  22  :    onix
    1.36 -;; 035  23  :    fearow
    1.37 -;; 036  24  :    pidgey
    1.38 -;; 037  25  :    slowpoke
    1.39 -;; 038  26  :    kadabra
    1.40 -;; 039  27  :    graveler
    1.41 -;; 040  28  :    chansey
    1.42 -;; 041  29  :    machoke
    1.43 -;; 042  2A  :    mr-mime
    1.44 -;; 043  2B  :    hitmonlee
    1.45 -;; 044  2C  :    hitmonchan
    1.46 -;; 045  2D  :    arbok
    1.47 -;; 046  2E  :    parasect
    1.48 -;; 047  2F  :    psyduck
    1.49 -;; 048  30  :    drowzee
    1.50 -;; 049  31  :    golem
    1.51 -;; 051  33  :    magmar
    1.52 -;; 053  35  :    electabuzz
    1.53 -;; 054  36  :    magneton
    1.54 -;; 055  37  :    koffing
    1.55 -;; 057  39  :    mankey
    1.56 -;; 058  3A  :    seel
    1.57 -;; 059  3B  :    diglett
    1.58 -;; 060  3C  :    tauros
    1.59 -;; 064  40  :    farfetch'd
    1.60 -;; 065  41  :    venonat
    1.61 -;; 066  42  :    dragonite
    1.62 -;; 070  46  :    doduo
    1.63 -;; 071  47  :    poliwag
    1.64 -;; 072  48  :    jynx
    1.65 -;; 073  49  :    moltres
    1.66 -;; 074  4A  :    articuno
    1.67 -;; 075  4B  :    zapdos
    1.68 -;; 076  4C  :    ditto
    1.69 -;; 077  4D  :    meowth
    1.70 -;; 078  4E  :    krabby
    1.71 -;; 082  52  :    vulpix
    1.72 -;; 083  53  :    ninetails
    1.73 -;; 084  54  :    pikachu
    1.74 -;; 085  55  :    riachu
    1.75 -;; 088  58  :    dratini
    1.76 -;; 089  59  :    dragonair
    1.77 -;; 090  5A  :    kabuto
    1.78 -;; 091  5B  :    kabutops
    1.79 -;; 092  5C  :    horsea
    1.80 -;; 093  5D  :    sedra
    1.81 -;; 096  60  :    sandshrew
    1.82 -;; 097  61  :    sandslash
    1.83 -;; 098  62  :    omanyte
    1.84 -;; 099  63  :    omastar
    1.85 -;; 100  64  :    jigglypuff
    1.86 -;; 101  65  :    wigglytuff
    1.87 -;; 102  66  :    eevee
    1.88 -;; 103  67  :    flareon
    1.89 -;; 104  68  :    jolteon
    1.90 -;; 105  69  :    vaporeon
    1.91 -;; 106  6A  :    machop
    1.92 -;; 107  6B  :    zubat
    1.93 -;; 108  6C  :    ekans
    1.94 -;; 109  6D  :    paras
    1.95 -;; 110  6E  :    poliwhirl
    1.96 -;; 111  6F  :    poliwrath
    1.97 -;; 112  70  :    weedle
    1.98 -;; 113  71  :    kakuna
    1.99 -;; 114  72  :    beedrill
   1.100 -;; 116  74  :    dodrio
   1.101 -;; 117  75  :    primeape
   1.102 -;; 118  76  :    dugtrio
   1.103 -;; 119  77  :    venomoth
   1.104 -;; 120  78  :    dewgong
   1.105 -;; 123  7B  :    caterpie
   1.106 -;; 124  7C  :    metapod
   1.107 -;; 125  7D  :    butterfree
   1.108 -;; 126  7E  :    machamp
   1.109 -;; 128  80  :    golduck
   1.110 -;; 129  81  :    hypno
   1.111 -;; 130  82  :    golbat
   1.112 -;; 131  83  :    mewtwo
   1.113 -;; 132  84  :    snorlax
   1.114 -;; 133  85  :    magikarp
   1.115 -;; 136  88  :    muk
   1.116 -;; 138  8A  :    kingler
   1.117 -;; 139  8B  :    cloyster
   1.118 -;; 141  8D  :    electrode
   1.119 -;; 142  8E  :    clefable
   1.120 -;; 143  8F  :    wheezing
   1.121 -;; 144  90  :    persian
   1.122 -;; 145  91  :    marowak
   1.123 -;; 147  93  :    haunter
   1.124 -;; 148  94  :    abra
   1.125 -;; 149  95  :    alakazam
   1.126 -;; 150  96  :    pidgeotto
   1.127 -;; 151  97  :    pidgeot
   1.128 -;; 152  98  :    starmie
   1.129 -;; 153  99  :    bulbasaur
   1.130 -;; 154  9A  :    venusaur
   1.131 -;; 155  9B  :    tentacruel
   1.132 -;; 157  9D  :    goldeen
   1.133 -;; 158  9E  :    seaking
   1.134 -;; 163  A3  :    ponyta
   1.135 -;; 164  A4  :    rapidash
   1.136 -;; 165  A5  :    rattata
   1.137 -;; 166  A6  :    raticate
   1.138 -;; 167  A7  :    nidorino
   1.139 -;; 168  A8  :    nidorina
   1.140 -;; 169  A9  :    geodude
   1.141 -;; 170  AA  :    porygon
   1.142 -;; 171  AB  :    aerodactyl
   1.143 -;; 173  AD  :    magnemite
   1.144 -;; 176  B0  :    charmander
   1.145 -;; 177  B1  :    squirtle
   1.146 -;; 178  B2  :    charmeleon
   1.147 -;; 179  B3  :    wartortle
   1.148 -;; 180  B4  :    charizard
   1.149 -;; 185  B9  :    oddish
   1.150 -;; 186  BA  :    gloom
   1.151 -;; 187  BB  :    vileplume
   1.152 -;; 188  BC  :    bellsprout
   1.153 -;; 189  BD  :    weepenbell
   1.154 -;; 190  BE  :    victreebel
   1.155 \ No newline at end of file
   1.156 +(ns com.aurellem.gb.species
   1.157 +  (:use (com.aurellem.gb gb-driver util))
   1.158 +  (:import [com.aurellem.gb.gb_driver SaveState]))
   1.159 +
   1.160 +
   1.161 +(def species-code->species-name
   1.162 +  {0x01  :rhydon
   1.163 +   0x02  :kangaskhan
   1.164 +   0x03  :nidoran-male
   1.165 +   0x04  :clefairy
   1.166 +   0x05  :spearow
   1.167 +   0x06  :voltorb
   1.168 +   0x07  :nidoking
   1.169 +   0x08  :slowbro
   1.170 +   0x09  :ivysaur
   1.171 +   0x0A  :exeggutor
   1.172 +   0x0B  :lickitung
   1.173 +   0x0C  :exeggcute
   1.174 +   0x0D  :grimer
   1.175 +   0x0E  :gengar
   1.176 +   0x0F  :nidoran-female
   1.177 +   0x10  :nidoqueen
   1.178 +   0x11  :cubone
   1.179 +   0x12  :rhyhorn
   1.180 +   0x13  :lapras
   1.181 +   0x14  :arcanine
   1.182 +   0x15  :mew
   1.183 +   0x16  :gyarados
   1.184 +   0x17  :shellder
   1.185 +   0x18  :tentacool
   1.186 +   0x19  :gastly
   1.187 +   0x1A  :scyther
   1.188 +   0x1B  :staryu
   1.189 +   0x1C  :blastoise
   1.190 +   0x1D  :pinsir
   1.191 +   0x1E  :tangela
   1.192 +   0x21  :growlithe
   1.193 +   0x22  :onix
   1.194 +   0x23  :fearow
   1.195 +   0x24  :pidgey
   1.196 +   0x25  :slowpoke
   1.197 +   0x26  :kadabra
   1.198 +   0x27  :graveler
   1.199 +   0x28  :chansey
   1.200 +   0x29  :machoke
   1.201 +   0x2A  :mr-mime
   1.202 +   0x2B  :hitmonlee
   1.203 +   0x2C  :hitmonchan
   1.204 +   0x2D  :arbok
   1.205 +   0x2E  :parasect
   1.206 +   0x2F  :psyduck
   1.207 +   0x30  :drowzee
   1.208 +   0x31  :golem
   1.209 +   0x33  :magmar
   1.210 +   0x35  :electabuzz
   1.211 +   0x36  :magneton
   1.212 +   0x37  :koffing
   1.213 +   0x39  :mankey
   1.214 +   0x3A  :seel
   1.215 +   0x3B  :diglett
   1.216 +   0x3C  :tauros
   1.217 +   0x40  :farfetch'd
   1.218 +   0x41  :venonat
   1.219 +   0x42  :dragonite
   1.220 +   0x46  :doduo
   1.221 +   0x47  :poliwag
   1.222 +   0x48  :jynx
   1.223 +   0x49  :moltres
   1.224 +   0x4A  :articuno
   1.225 +   0x4B  :zapdos
   1.226 +   0x4C  :ditto
   1.227 +   0x4D  :meowth
   1.228 +   0x4E  :krabby
   1.229 +   0x52  :vulpix
   1.230 +   0x53  :ninetails
   1.231 +   0x54  :pikachu
   1.232 +   0x55  :riachu
   1.233 +   0x58  :dratini
   1.234 +   0x59  :dragonair
   1.235 +   0x5A  :kabuto
   1.236 +   0x5B  :kabutops
   1.237 +   0x5C  :horsea
   1.238 +   0x5D  :sedra
   1.239 +   0x60  :sandshrew
   1.240 +   0x61  :sandslash
   1.241 +   0x62  :omanyte
   1.242 +   0x63  :omastar
   1.243 +   0x64  :jigglypuff
   1.244 +   0x65  :wigglytuff
   1.245 +   0x66  :eevee
   1.246 +   0x67  :flareon
   1.247 +   0x68  :jolteon
   1.248 +   0x69  :vaporeon
   1.249 +   0x6A  :machop
   1.250 +   0x6B  :zubat
   1.251 +   0x6C  :ekans
   1.252 +   0x6D  :paras
   1.253 +   0x6E  :poliwhirl
   1.254 +   0x6F  :poliwrath
   1.255 +   0x70  :weedle
   1.256 +   0x71  :kakuna
   1.257 +   0x72  :beedrill
   1.258 +   0x74  :dodrio
   1.259 +   0x75  :primeape
   1.260 +   0x76  :dugtrio
   1.261 +   0x77  :venomoth
   1.262 +   0x78  :dewgong
   1.263 +   0x7B  :caterpie
   1.264 +   0x7C  :metapod
   1.265 +   0x7D  :butterfree
   1.266 +   0x7E  :machamp
   1.267 +   0x80  :golduck
   1.268 +   0x81  :hypno
   1.269 +   0x82  :golbat
   1.270 +   0x83  :mewtwo
   1.271 +   0x84  :snorlax
   1.272 +   0x85  :magikarp
   1.273 +   0x88  :muk
   1.274 +   0x8A  :kingler
   1.275 +   0x8B  :cloyster
   1.276 +   0x8D  :electrode
   1.277 +   0x8E  :clefable
   1.278 +   0x8F  :wheezing
   1.279 +   0x90  :persian
   1.280 +   0x91  :marowak
   1.281 +   0x93  :haunter
   1.282 +   0x94  :abra
   1.283 +   0x95  :alakazam
   1.284 +   0x96  :pidgeotto
   1.285 +   0x97  :pidgeot
   1.286 +   0x98  :starmie
   1.287 +   0x99  :bulbasaur
   1.288 +   0x9A  :venusaur
   1.289 +   0x9B  :tentacruel
   1.290 +   0x9D  :goldeen
   1.291 +   0x9E  :seaking
   1.292 +   0xA3  :ponyta
   1.293 +   0xA4  :rapidash
   1.294 +   0xA5  :rattata
   1.295 +   0xA6  :raticate
   1.296 +   0xA7  :nidorino
   1.297 +   0xA8  :nidorina
   1.298 +   0xA9  :geodude
   1.299 +   0xAA  :porygon
   1.300 +   0xAB  :aerodactyl
   1.301 +   0xAD  :magnemite
   1.302 +   0xB0  :charmander
   1.303 +   0xB1  :squirtle
   1.304 +   0xB2  :charmeleon
   1.305 +   0xB3  :wartortle
   1.306 +   0xB4  :charizard
   1.307 +   0xB9  :oddish
   1.308 +   0xBA  :gloom
   1.309 +   0xBB  :vileplume
   1.310 +   0xBC  :bellsprout
   1.311 +   0xBD  :weepenbell
   1.312 +   0xBE  :victreebel})
   1.313 +
   1.314 +(def species-ID-1 0xD163)
   1.315 +
   1.316 +(def species-name->species-code
   1.317 +  (zipmap (vals species-code->species-name)
   1.318 +          (keys species-code->species-name)))
   1.319 +
   1.320 +(defn set-species
   1.321 +  ([^SaveState state pokemon-num species-name]
   1.322 +     (assert (<= 0 pokemon-num 5))
   1.323 +     (let [species-code (species-name->species-code
   1.324 +                         species-name
   1.325 +                         species-name)]
   1.326 +       
   1.327 +       (set-memory state (+ species-ID-1 pokemon-num)
   1.328 +                   species-code)))
   1.329 +  ([pokemon-num species-name]
   1.330 +     (set-species @current-state pokemon-num species-name)))
   1.331 \ No newline at end of file