comparison clojure/com/aurellem/gb/items.clj @ 345:3b3cd62b6106

script: made it to cereulean with TM55s worth 2 million.
author Robert McIntyre <rlm@mit.edu>
date Sun, 08 Apr 2012 20:58:14 -0500
parents 93e74ed34305
children 79252378fd22
comparison
equal deleted inserted replaced
344:9366539d29b6 345:3b3cd62b6106
6 "return pokemon-yellow header information" 6 "return pokemon-yellow header information"
7 [] 7 []
8 (map char (subvec (vec (memory)) 0x134 0x142))) 8 (map char (subvec (vec (memory)) 0x134 0x142)))
9 9
10 (def item-list-start 0xD31C) 10 (def item-list-start 0xD31C)
11 (def pc-item-list-start 0xD539)
12 (def pc-item-list-width 101)
13
11 14
12 (defn item-list 15 (defn item-list
13 ([^SaveState state] 16 ([^SaveState state]
14 (subvec 17 (subvec
15 (vec (memory state)) 18 (vec (memory state))
16 item-list-start 19 item-list-start
17 (+ item-list-start 255))) 20 (+ item-list-start 255)))
18 ([] (item-list @current-state))) 21 ([] (item-list @current-state)))
19 22
23 (defn nth-item
24 ([^SaveState state n]
25 (let [mem (memory state)]
26 [(aget mem (+ item-list-start 1 (* 2 n)))
27 (aget mem (+ item-list-start 2 (* 2 n)))]))
28 ([n] (nth-item @current-state n)))
29
30
31 (defn nth-pc-item
32 ([^SaveState state n]
33 (let [mem (memory state)]
34 [(aget mem (+ pc-item-list-start 1 (* 2 n)))
35 (aget mem (+ pc-item-list-start 2 (* 2 n)))]))
36 ([n] (nth-pc-item @current-state n)))
37
38
20 (def item-code->item-name 39 (def item-code->item-name
21 (hash-map 40 (hash-map
22 0x01 :master-ball 41 0x01 :master-ball
23 0x02 :ultra-ball 42 0x02 :ultra-ball
24 0x03 :great-ball 43 0x03 :great-ball