view clojure/com/aurellem/gb/species.clj @ 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
line wrap: on
line source
1 (ns com.aurellem.gb.species
2 (:use (com.aurellem.gb gb-driver util))
3 (:import [com.aurellem.gb.gb_driver SaveState]))
6 (def species-code->species-name
7 {0x01 :rhydon
8 0x02 :kangaskhan
9 0x03 :nidoran-male
10 0x04 :clefairy
11 0x05 :spearow
12 0x06 :voltorb
13 0x07 :nidoking
14 0x08 :slowbro
15 0x09 :ivysaur
16 0x0A :exeggutor
17 0x0B :lickitung
18 0x0C :exeggcute
19 0x0D :grimer
20 0x0E :gengar
21 0x0F :nidoran-female
22 0x10 :nidoqueen
23 0x11 :cubone
24 0x12 :rhyhorn
25 0x13 :lapras
26 0x14 :arcanine
27 0x15 :mew
28 0x16 :gyarados
29 0x17 :shellder
30 0x18 :tentacool
31 0x19 :gastly
32 0x1A :scyther
33 0x1B :staryu
34 0x1C :blastoise
35 0x1D :pinsir
36 0x1E :tangela
37 0x21 :growlithe
38 0x22 :onix
39 0x23 :fearow
40 0x24 :pidgey
41 0x25 :slowpoke
42 0x26 :kadabra
43 0x27 :graveler
44 0x28 :chansey
45 0x29 :machoke
46 0x2A :mr-mime
47 0x2B :hitmonlee
48 0x2C :hitmonchan
49 0x2D :arbok
50 0x2E :parasect
51 0x2F :psyduck
52 0x30 :drowzee
53 0x31 :golem
54 0x33 :magmar
55 0x35 :electabuzz
56 0x36 :magneton
57 0x37 :koffing
58 0x39 :mankey
59 0x3A :seel
60 0x3B :diglett
61 0x3C :tauros
62 0x40 :farfetch'd
63 0x41 :venonat
64 0x42 :dragonite
65 0x46 :doduo
66 0x47 :poliwag
67 0x48 :jynx
68 0x49 :moltres
69 0x4A :articuno
70 0x4B :zapdos
71 0x4C :ditto
72 0x4D :meowth
73 0x4E :krabby
74 0x52 :vulpix
75 0x53 :ninetails
76 0x54 :pikachu
77 0x55 :riachu
78 0x58 :dratini
79 0x59 :dragonair
80 0x5A :kabuto
81 0x5B :kabutops
82 0x5C :horsea
83 0x5D :sedra
84 0x60 :sandshrew
85 0x61 :sandslash
86 0x62 :omanyte
87 0x63 :omastar
88 0x64 :jigglypuff
89 0x65 :wigglytuff
90 0x66 :eevee
91 0x67 :flareon
92 0x68 :jolteon
93 0x69 :vaporeon
94 0x6A :machop
95 0x6B :zubat
96 0x6C :ekans
97 0x6D :paras
98 0x6E :poliwhirl
99 0x6F :poliwrath
100 0x70 :weedle
101 0x71 :kakuna
102 0x72 :beedrill
103 0x74 :dodrio
104 0x75 :primeape
105 0x76 :dugtrio
106 0x77 :venomoth
107 0x78 :dewgong
108 0x7B :caterpie
109 0x7C :metapod
110 0x7D :butterfree
111 0x7E :machamp
112 0x80 :golduck
113 0x81 :hypno
114 0x82 :golbat
115 0x83 :mewtwo
116 0x84 :snorlax
117 0x85 :magikarp
118 0x88 :muk
119 0x8A :kingler
120 0x8B :cloyster
121 0x8D :electrode
122 0x8E :clefable
123 0x8F :wheezing
124 0x90 :persian
125 0x91 :marowak
126 0x93 :haunter
127 0x94 :abra
128 0x95 :alakazam
129 0x96 :pidgeotto
130 0x97 :pidgeot
131 0x98 :starmie
132 0x99 :bulbasaur
133 0x9A :venusaur
134 0x9B :tentacruel
135 0x9D :goldeen
136 0x9E :seaking
137 0xA3 :ponyta
138 0xA4 :rapidash
139 0xA5 :rattata
140 0xA6 :raticate
141 0xA7 :nidorino
142 0xA8 :nidorina
143 0xA9 :geodude
144 0xAA :porygon
145 0xAB :aerodactyl
146 0xAD :magnemite
147 0xB0 :charmander
148 0xB1 :squirtle
149 0xB2 :charmeleon
150 0xB3 :wartortle
151 0xB4 :charizard
152 0xB9 :oddish
153 0xBA :gloom
154 0xBB :vileplume
155 0xBC :bellsprout
156 0xBD :weepenbell
157 0xBE :victreebel})
159 (def species-ID-1 0xD163)
161 (def species-name->species-code
162 (zipmap (vals species-code->species-name)
163 (keys species-code->species-name)))
165 (defn set-species
166 ([^SaveState state pokemon-num species-name]
167 (assert (<= 0 pokemon-num 5))
168 (let [species-code (species-name->species-code
169 species-name
170 species-name)]
172 (set-memory state (+ species-ID-1 pokemon-num)
173 species-code)))
174 ([pokemon-num species-name]
175 (set-species @current-state pokemon-num species-name)))