Mercurial > vba-clojure
diff clojure/com/aurellem/exp/pokemon.clj @ 145:412ca096a9ba
major refactoring complete.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 19 Mar 2012 21:23:46 -0500 |
parents | |
children | c5914665012d |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/clojure/com/aurellem/exp/pokemon.clj Mon Mar 19 21:23:46 2012 -0500 1.3 @@ -0,0 +1,92 @@ 1.4 +(ns com.aurellem.exp.pokemon 1.5 + "Here I find out how pokemon are stored in memory." 1.6 + (:use (com.aurellem.gb gb-driver items assembly util 1.7 + characters)) 1.8 + (:import [com.aurellem.gb.gb_driver SaveState])) 1.9 + 1.10 + 1.11 +(def pidgeot-lvl-36 (mid-game)) 1.12 + 1.13 + 1.14 +(def pidgeot-lvl-37 (read-state "pidgeot-lvl-37")) 1.15 + 1.16 + 1.17 +(def pidgeot-lvl-38 (read-state "pidgeot-lvl-38")) 1.18 + 1.19 + 1.20 +(def pidgeot-lvl-39 (read-state "pidgeot-lvl-39")) 1.21 + 1.22 + 1.23 +(def pidgeot-lvl-40 (read-state "pidgeot-lvl-40")) 1.24 + 1.25 + 1.26 +(defn level-analysis [] 1.27 + (apply common-differences 1.28 + (map (comp vec memory) 1.29 + [pidgeot-lvl-36 1.30 + pidgeot-lvl-37 1.31 + pidgeot-lvl-38 1.32 + pidgeot-lvl-39 1.33 + pidgeot-lvl-40]))) 1.34 + 1.35 +;; inconclusive -- implies that level is calculated from 1.36 +;; some other values. 1.37 + 1.38 + 1.39 +(def name-pidgeotto (read-state "name-pidgeotto")) 1.40 +(def named-A (read-state "named-A")) 1.41 +(def named-B (read-state "named-B")) 1.42 +(def named-C (read-state "named-C")) 1.43 +(def named-D (read-state "named-D")) 1.44 +(def named-E (read-state "named-E")) 1.45 +(def named-F (read-state "named-F")) 1.46 + 1.47 +(defn name-analysis [] 1.48 + (apply common-differences 1.49 + (map (comp vec memory) 1.50 + [named-A 1.51 + named-B 1.52 + named-C 1.53 + named-D 1.54 + named-E 1.55 + named-F]))) 1.56 + 1.57 +;; resluted in 3 separate locations that could 1.58 +;; possibly hold the first letter of the pokemon's name 1.59 + 1.60 +0xCF4A 1.61 +0xD2EB 1.62 +0xCEED 1.63 + 1.64 +;; try changing each of them 1.65 + 1.66 + 1.67 +(defn test-cf4a [] 1.68 + (continue! 1.69 + (set-memory named-A 0xCF4A (character->character-code "Z")))) 1.70 +;; result -- pidgeotto named "A" 1.71 + 1.72 +(defn test-d2eb [] 1.73 + (continue! 1.74 + (set-memory named-A 0xD2EB (character->character-code "Z")))) 1.75 +;; result -- pidgeotto named "Z" 1.76 + 1.77 +(defn test-ceed [] 1.78 + (continue! 1.79 + (set-memory named-A 0xCEED (character->character-code "Z")))) 1.80 +;; result -- pidgeotto named "A" 1.81 + 1.82 +(def sixth-pokemon-name-start 0xD2EB) 1.83 + 1.84 + 1.85 +(defn set-sixth-pokemon-name-first-character 1.86 + ([state character] 1.87 + (set-memory state sixth-pokemon-name-start 1.88 + (character->character-code character))) 1.89 + ([character] 1.90 + (set-sixth-pokemon-name-first-character @current-state 1.91 + character))) 1.92 + 1.93 + 1.94 + 1.95 +