comparison clojure/com/aurellem/gb/species.clj @ 218:ca9d2897435b

moved hardcoded stuff into its own namespace.
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 20:18:03 -0500
parents aba78e52faba
children c9a855de1d07
comparison
equal deleted inserted replaced
217:7ceaac84be57 218:ca9d2897435b
1 (ns com.aurellem.gb.species 1 (ns com.aurellem.gb.species
2 (:use (com.aurellem.gb assembly characters gb-driver util 2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants)) 3 constants))
4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState])) 4 (:import [com.aurellem.gb.gb_driver SaveState]))
6
7
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))))))))
17
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))))))))
25 (def hxc-titles
26 "The hardcoded names of the trainer titles in memory. List begins at
27 ROM@27E77"
28 (map character-codes->str
29 (take-nth 2
30 (partition-by #(= 0x50 %)
31 (take 196
32 (drop 0x27E77
33 (rom (root))))))))
34
35
36 (def hxc-pokedex
37 "The hardcoded pokedex entries in memory. List begins at
38 ROM@B8000, shortly before move names."
39 (map character-codes->str
40 (take-nth 2
41 (partition-by #(= % 0x50)
42 (take 14754
43 (drop 0xB8000
44 (rom (root))))))))
45 (def hxc-moves
46 "The hardcoded move names in memory. List begins at ROM@BC000"
47 (map character-codes->str
48 (take-nth 2
49 (partition-by #(= % 0x50)
50 (take 1551
51 (drop 0xBC000
52 (rom (root))))))))
53
54
55
56 (def hxc-places
57 "The hardcoded place names in memory. List begins at
58 ROM@71500. Cinnabar Mansion is dynamically calculated."
59 (map character-codes->str
60 (take-nth 2
61 (partition-by #(= % 0x50)
62 (take 560
63 (drop 0x71500
64 (rom (root))))))))
65
66
67 (def hxc-dialog
68 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
69 (character-codes->str(take 0x0F728
70 (drop (+ 0x98000)
71 (rom (root)))))
72
73 (def hxc-later
74 "Running this code produces, e.g. hardcoded names NPCs give
75 their pokemon. Will sort through it later."
76 (print (character-codes->str(take 10000
77 (drop 0x71597
78 (rom (root)))))))
79
80
81
82
83
84
85
86 (let [dex
87 (partition-by #(= 0x50 %)
88 (take 2540
89 (drop 0x40687
90 (rom (root)))))]
91 (def dex dex)
92 (def hxc-species
93 (map character-codes->str
94 (take-nth 4 dex))))
95
96
97 5
98 (def species-code->species-name 6 (def species-code->species-name
99 {0x01 :rhydon 7 {0x01 :rhydon
100 0x02 :kangaskhan 8 0x02 :kangaskhan
101 0x03 :nidoran-male 9 0x03 :nidoran-male