comparison clojure/com/aurellem/exp/pokemon.clj @ 166:76b031d2f586

determined position of pokemon color maps
author Robert McIntyre <rlm@mit.edu>
date Tue, 20 Mar 2012 18:50:49 -0500
parents cd7979aa544e
children bfd06de5a934
comparison
equal deleted inserted replaced
165:8f1b32d3f229 166:76b031d2f586
1 (ns com.aurellem.exp.pokemon 1 (ns com.aurellem.exp.pokemon
2 "Here I find out how pokemon are stored in memory." 2 "Here I find out how pokemon are stored in memory."
3 (:use (com.aurellem.gb gb-driver items assembly util 3 (:use (com.aurellem.gb gb-driver items assembly util
4 characters)) 4 constants
5 characters species moves))
5 (:import java.io.File) 6 (:import java.io.File)
6 (:import [com.aurellem.gb.gb_driver SaveState])) 7 (:import [com.aurellem.gb.gb_driver SaveState]))
7 8
8 9
9 (def pidgeot-lvl-36 (mid-game)) 10 (def pidgeot-lvl-36 (mid-game))
550 ([] (compare-pokemon @current-state))) 551 ([] (compare-pokemon @current-state)))
551 552
552 553
553 (defn crazy-pid [] 554 (defn crazy-pid []
554 (read-state "crazy-pidgeot")) 555 (read-state "crazy-pidgeot"))
556
557 (def unknown "")
558
559 (def pokemon-1-info
560 {0xD16A "Color Map" ;; 0
561 0xD16B "Current-HP (h)" ;; 1
562 0xD16C "Current-HP (l)" ;; 2
563 0XD16D unknown ;; 3
564 0xD16E unknown ;; 4
565 0xD16F unknown ;; 5
566 0xD170 unknown ;; 6
567 0xD171 unknown ;; 7
568 0xD172 "Move 1 ID" ;; 8
569 0xD173 "Move 2 ID" ;; 9
570 0xD174 "Move 3 ID" ;; 10
571 0xD175 "Move 4 ID" ;; 11
572 0xD176 "OT-ID (h)" ;; 12
573 0xD177 "OT-ID (l)" ;; 13
574 0xD178 "Exp. Points (h)" ;; 14
575 0xD179 "Exp. Points (m)" ;; 15
576 0xD17A "Exp. Points (l)" ;; 16
577 0xD17B "HP DV" ;; 17
578 0xD17C unknown ;; 18
579 0xD17D "Attack DV" ;; 19
580 0xD17E unknown ;; 20
581 0xD17F "Defense DV" ;; 21
582 0xD180 unknown ;; 22
583 0xD181 "Speed DV" ;; 23
584 0xD182 unknown ;; 24
585 0xD183 "Special DV" ;; 25
586 0xD184 unknown ;; 26
587 0xD185 unknown ;; 27
588 0xD186 unknown ;; 28
589 0xD187 "PP Move 1" ;; 29
590 0xD188 "PP Move 2" ;; 30
591 0xD189 "PP Move 3" ;; 31
592 0xD18A "PP Move 4" ;; 32
593 0xD18B "Current Level" ;; 33
594 0xD18C "HP Total (h)" ;; 34
595 0xD18D "HP Total (l)" ;; 35
596 0xD18E "Attack (h)" ;; 36
597 0xD18F "Attack (l)" ;; 37
598 0xD190 "Defense (h)" ;; 38
599 0xD191 "Defense (l)" ;; 39
600 0xD192 "Speed (h)" ;; 40
601 0xD193 "Speed (l)" ;; 41
602 0xD194 "Special (h)" ;; 42
603 0xD195 "Special (h)" ;; 43
604 })
605
606 (defn pokemon-data
607 ([^SaveState state pokemon-num]
608 (assert (<= 0 pokemon-num 5))
609 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)]
610 (subvec (vec (memory state)) base
611 (+ base pokemon-record-width))))
612 ([pokemon-num] (pokemon-data @current-state pokemon-num)))
613
614 (defn set-pokemon-data
615 ([^SaveState state pokemon-num new-data]
616 (assert (<= 0 pokemon-num 5))
617 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)]
618 (set-memory-range state base new-data)))
619 ([pokemon-num new-data]
620 (set-pokemon-data @current-state pokemon-num new-data)))
621
622 (defn print-pokemon-data [^SaveState save pokemon-num])
623
624
625 (defn pre-battle [] (read-state "prepare-for-battle"))