Mercurial > vba-clojure
diff clojure/com/aurellem/gb/experience.clj @ 192:fd549c8f42ae
fixed compilation problems, added more functionality to pokemon-info
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 22 Mar 2012 22:35:57 -0500 |
parents | 893c753f8088 |
children |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/experience.clj Thu Mar 22 20:10:09 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/experience.clj Thu Mar 22 22:35:57 2012 -0500 1.3 @@ -27,39 +27,27 @@ 1.4 special-exp-h 1.5 special-exp-l] 1.6 (subvec (vec (memory state)) 1.7 - start (+ experience-record-width start)) 1.8 - glue-bytes (fn [l h] 1.9 - (+ l (bit-shift-left h 8)))] 1.10 - {:main-exp (+ (glue-bytes exp-l exp-m) 1.11 - (bit-shift-left exp-h 16)) 1.12 - :hp-exp (glue-bytes hp-exp-l hp-exp-h) 1.13 - :attack-exp (glue-bytes attack-exp-l attack-exp-h) 1.14 - :defense-exp (glue-bytes defense-exp-l defense-exp-h) 1.15 - :speed-exp (glue-bytes speed-exp-l speed-exp-h) 1.16 - :special-exp (glue-bytes special-exp-l special-exp-h)})) 1.17 - ([poke-num] 1.18 + start (+ experience-record-width start))] 1.19 + {:main-exp (glue-bytes exp-h exp-m exp-l) 1.20 + :hp-exp (glue-bytes hp-exp-h hp-exp-l) 1.21 + :attack-exp (glue-bytes attack-exp-h attack-exp-l) 1.22 + :defense-exp (glue-bytes defense-exp-h defense-exp-l) 1.23 + :speed-exp (glue-bytes speed-exp-h speed-exp-l) 1.24 + :special-exp (glue-bytes special-exp-h special-exp-l)})) 1.25 + ([poke-num] 1.26 (read-experience @current-state poke-num))) 1.27 1.28 (defn give-experience 1.29 ([^SaveState state poke-num exp] 1.30 - (let [exp* (merge (read-experience state poke-num) 1.31 - exp) 1.32 - 1.33 - disect-bytes 1.34 - (fn [exp] 1.35 - [(bit-shift-right 1.36 - (bit-and exp 0xFF00) 8) 1.37 - (bit-and exp 0xFF)]) 1.38 - 1.39 + (let [exp* (merge (read-experience state poke-num) exp) 1.40 raw-exp-data 1.41 (flatten 1.42 - [(bit-shift-right (bit-and (:main-exp exp*) 0xFF0000) 16) 1.43 - (disect-bytes (:main-exp exp*)) 1.44 - (disect-bytes (:hp-exp exp*)) 1.45 - (disect-bytes (:attack-exp exp*)) 1.46 - (disect-bytes (:defense-exp exp*)) 1.47 - (disect-bytes (:speed-exp exp*)) 1.48 - (disect-bytes (:special-exp exp*))])] 1.49 + [(disect-bytes-3 (:main-exp exp*)) 1.50 + (disect-bytes-2 (:hp-exp exp*)) 1.51 + (disect-bytes-2 (:attack-exp exp*)) 1.52 + (disect-bytes-2 (:defense-exp exp*)) 1.53 + (disect-bytes-2 (:speed-exp exp*)) 1.54 + (disect-bytes-2 (:special-exp exp*))])] 1.55 (set-memory-range state 1.56 (experience-start-address poke-num) 1.57 raw-exp-data)))