view clojure/com/aurellem/gb/hxc.clj @ 244:27ca947084cf

minor fixes
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 25 Mar 2012 22:33:17 -0500
parents 5b59c6f17cd5
children a50faba43967
line wrap: on
line source
1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants))
4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState]))
8 (def hxc-pokenames
9 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
10 (let [count-species 190
11 name-length 10]
12 (map character-codes->str
13 (partition name-length
14 (take (* count-species name-length)
15 (drop 0xE8000
16 (rom(root))))))))
18 (def hxc-items
19 "The hardcoded names of the items in memory. List begins at ROM@45B7 "
20 (map character-codes->str
21 (take-nth 2
22 (partition-by #(= % 0x50)
23 (take 1200
24 (drop 0x45B7 (rom (root))))))))
26 (def hxc-types
27 "The hardcoded type names in memory. List begins at ROM@27D99,
28 shortly before hxc-titles."
29 (map character-codes->str
30 (take-nth 2
31 (partition-by #(= 0x50 %)
32 (take 102
33 (drop 0x27D99
34 (rom (root))))))))
36 (def hxc-titles
37 "The hardcoded names of the trainer titles in memory. List begins at
38 ROM@27E77"
39 (map character-codes->str
40 (take-nth 2
41 (partition-by #(= 0x50 %)
42 (take 196
43 (drop 0x27E77
44 (rom (root))))))))
47 (def hxc-pokedex
48 "The hardcoded pokedex entries in memory. List begins at
49 ROM@B8000, shortly before move names."
50 (map character-codes->str
51 (take-nth 2
52 (partition-by #(= % 0x50)
53 (take 14754
54 (drop 0xB8000
55 (rom (root))))))))
56 (def hxc-moves
57 "The hardcoded move names in memory. List begins at ROM@BC000"
58 (map character-codes->str
59 (take-nth 2
60 (partition-by #(= % 0x50)
61 (take 1551
62 (drop 0xBC000
63 (rom (root))))))))
67 (def hxc-places
68 "The hardcoded place names in memory. List begins at
69 ROM@71500. Cinnabar Mansion is dynamically calculated."
70 (map character-codes->str
71 (take-nth 2
72 (partition-by #(= % 0x50)
73 (take 560
74 (drop 0x71500
75 (rom (root))))))))
78 (def hxc-dialog
79 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
80 (character-codes->str(take 0x0F728
81 (drop (+ 0x98000)
82 (rom (root))))))
87 (def pkmn-types
88 [:normal
89 :fighting
90 :flying
91 :poison
92 :ground
93 :rock
94 :bug
95 :ghost
96 :A
97 :B
98 :C
99 :D
100 :E
101 :F
102 :G
103 :H
104 :I
105 :J
106 :K
107 :fire
108 :water
109 :grass
110 :electric
111 :psychic
112 :ice
113 :dragon
114 ])
117 (def hxc-advantage
118 (map
119 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
120 (get pkmn-types def (hex def))
121 (/ mult 10)])
122 (partition 3
123 (take-while (partial not= 0xFF)
124 (drop 0x3E62D (rom(root)))))))
146 (def hxc-later
147 "Running this code produces, e.g. hardcoded names NPCs give
148 their pokemon. Will sort through it later."
149 (print (character-codes->str(take 10000
150 (drop 0x71597
151 (rom (root)))))))
153 (let [dex
154 (partition-by #(= 0x50 %)
155 (take 2540
156 (drop 0x40687
157 (rom (root)))))]
158 (def dex dex)
159 (def hxc-species
160 (map character-codes->str
161 (take-nth 4 dex))))