diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/items.clj	Sun Apr 08 08:43:52 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/items.clj	Sun Apr 08 20:58:14 2012 -0500
     1.3 @@ -8,6 +8,9 @@
     1.4    (map char (subvec (vec (memory)) 0x134 0x142)))
     1.5  
     1.6  (def item-list-start 0xD31C)
     1.7 +(def pc-item-list-start 0xD539)
     1.8 +(def pc-item-list-width 101)
     1.9 +
    1.10  
    1.11  (defn item-list
    1.12    ([^SaveState state]
    1.13 @@ -16,7 +19,23 @@
    1.14        item-list-start
    1.15        (+ item-list-start 255)))
    1.16    ([] (item-list @current-state)))
    1.17 -  
    1.18 +
    1.19 +(defn nth-item
    1.20 +  ([^SaveState state n]
    1.21 +     (let [mem (memory state)]
    1.22 +       [(aget mem (+ item-list-start 1 (* 2 n)))
    1.23 +        (aget mem (+ item-list-start 2 (* 2 n)))]))
    1.24 +  ([n] (nth-item @current-state n)))
    1.25 +
    1.26 +
    1.27 +(defn nth-pc-item
    1.28 +  ([^SaveState state n]
    1.29 +     (let [mem (memory state)]
    1.30 +       [(aget mem (+ pc-item-list-start 1 (* 2 n)))
    1.31 +        (aget mem (+ pc-item-list-start 2 (* 2 n)))]))
    1.32 +  ([n] (nth-pc-item @current-state n)))
    1.33 +
    1.34 +
    1.35  (def item-code->item-name
    1.36    (hash-map
    1.37     0x01 :master-ball