Mercurial > vba-clojure
comparison 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 |
comparison
equal
deleted
inserted
replaced
191:893c753f8088 | 192:fd549c8f42ae |
---|---|
25 speed-exp-h | 25 speed-exp-h |
26 speed-exp-l | 26 speed-exp-l |
27 special-exp-h | 27 special-exp-h |
28 special-exp-l] | 28 special-exp-l] |
29 (subvec (vec (memory state)) | 29 (subvec (vec (memory state)) |
30 start (+ experience-record-width start)) | 30 start (+ experience-record-width start))] |
31 glue-bytes (fn [l h] | 31 {:main-exp (glue-bytes exp-h exp-m exp-l) |
32 (+ l (bit-shift-left h 8)))] | 32 :hp-exp (glue-bytes hp-exp-h hp-exp-l) |
33 {:main-exp (+ (glue-bytes exp-l exp-m) | 33 :attack-exp (glue-bytes attack-exp-h attack-exp-l) |
34 (bit-shift-left exp-h 16)) | 34 :defense-exp (glue-bytes defense-exp-h defense-exp-l) |
35 :hp-exp (glue-bytes hp-exp-l hp-exp-h) | 35 :speed-exp (glue-bytes speed-exp-h speed-exp-l) |
36 :attack-exp (glue-bytes attack-exp-l attack-exp-h) | 36 :special-exp (glue-bytes special-exp-h special-exp-l)})) |
37 :defense-exp (glue-bytes defense-exp-l defense-exp-h) | 37 ([poke-num] |
38 :speed-exp (glue-bytes speed-exp-l speed-exp-h) | |
39 :special-exp (glue-bytes special-exp-l special-exp-h)})) | |
40 ([poke-num] | |
41 (read-experience @current-state poke-num))) | 38 (read-experience @current-state poke-num))) |
42 | 39 |
43 (defn give-experience | 40 (defn give-experience |
44 ([^SaveState state poke-num exp] | 41 ([^SaveState state poke-num exp] |
45 (let [exp* (merge (read-experience state poke-num) | 42 (let [exp* (merge (read-experience state poke-num) exp) |
46 exp) | |
47 | |
48 disect-bytes | |
49 (fn [exp] | |
50 [(bit-shift-right | |
51 (bit-and exp 0xFF00) 8) | |
52 (bit-and exp 0xFF)]) | |
53 | |
54 raw-exp-data | 43 raw-exp-data |
55 (flatten | 44 (flatten |
56 [(bit-shift-right (bit-and (:main-exp exp*) 0xFF0000) 16) | 45 [(disect-bytes-3 (:main-exp exp*)) |
57 (disect-bytes (:main-exp exp*)) | 46 (disect-bytes-2 (:hp-exp exp*)) |
58 (disect-bytes (:hp-exp exp*)) | 47 (disect-bytes-2 (:attack-exp exp*)) |
59 (disect-bytes (:attack-exp exp*)) | 48 (disect-bytes-2 (:defense-exp exp*)) |
60 (disect-bytes (:defense-exp exp*)) | 49 (disect-bytes-2 (:speed-exp exp*)) |
61 (disect-bytes (:speed-exp exp*)) | 50 (disect-bytes-2 (:special-exp exp*))])] |
62 (disect-bytes (:special-exp exp*))])] | |
63 (set-memory-range state | 51 (set-memory-range state |
64 (experience-start-address poke-num) | 52 (experience-start-address poke-num) |
65 raw-exp-data))) | 53 raw-exp-data))) |
66 ([poke-num exp] | 54 ([poke-num exp] |
67 (give-experience @current-state poke-num exp))) | 55 (give-experience @current-state poke-num exp))) |