Mercurial > vba-clojure
diff clojure/com/aurellem/gb/hxc.clj @ 272:a60ea8632ff4
beginning work on hxc-pokemon-base, the collection of base stats, battle sprite data, etc.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Tue, 27 Mar 2012 00:59:43 -0500 |
parents | 82ee2704c973 |
children | 69184558fcf3 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/hxc.clj Tue Mar 27 00:33:07 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/hxc.clj Tue Mar 27 00:59:43 2012 -0500 1.3 @@ -27,15 +27,15 @@ 1.4 1.5 1.6 (def pkmn-types 1.7 - [:normal 1.8 - :fighting 1.9 - :flying 1.10 - :poison 1.11 - :ground 1.12 - :rock 1.13 - :bird 1.14 - :bug 1.15 - :ghost 1.16 + [:normal ;;0 1.17 + :fighting ;;1 1.18 + :flying ;;2 1.19 + :poison ;;3 1.20 + :ground ;;4 1.21 + :rock ;;5 1.22 + :bird ;;6 1.23 + :bug ;;7 1.24 + :ghost ;;8 1.25 :A 1.26 :B 1.27 :C 1.28 @@ -47,13 +47,13 @@ 1.29 :I 1.30 :J 1.31 :K 1.32 - :fire 1.33 - :water 1.34 - :grass 1.35 - :electric 1.36 - :psychic 1.37 - :ice 1.38 - :dragon 1.39 + :fire ;;20 (0x14) 1.40 + :water ;;21 (0x15) 1.41 + :grass ;;22 (0x16) 1.42 + :electric ;;23 (0x17) 1.43 + :psychic ;;24 (0x18) 1.44 + :ice ;;25 (0x19) 1.45 + :dragon ;;26 (0x1A) 1.46 ]) 1.47 1.48 1.49 @@ -203,10 +203,73 @@ 1.50 (hxc-thunk-words 0xB8000 14754)) 1.51 1.52 1.53 -;; In red/blue, pokemon are in internal order. 1.54 -;; In yellow, pokemon are in pokedex order. 1.55 + 1.56 +(defn hxc-pokemon-base 1.57 + ([] (hxc-pokemon-base com.aurellem.gb.gb-driver/original-rom)) 1.58 + ([rom] 1.59 + (let [entry-size 28 1.60 + pkmn-count (count (hxc-pokedex-text rom)) 1.61 + types (apply assoc {} 1.62 + (interleave 1.63 + (range) 1.64 + pkmn-types)) ;;!! softcoded 1.65 + moves (apply assoc {} 1.66 + (interleave 1.67 + (range) 1.68 + (map format-name 1.69 + (hxc-move-names rom)))) 1.70 + 1.71 + ] 1.72 + (map 1.73 + 1.74 + (fn [[n 1.75 + rating-hp 1.76 + rating-atk 1.77 + rating-def 1.78 + rating-speed 1.79 + rating-special 1.80 + type-1 1.81 + type-2 1.82 + rarity 1.83 + rating-xp 1.84 + _ 1.85 + ptr-pic-obverse-1 1.86 + ptr-pic-obverse-2 1.87 + ptr-pic-reverse-1 1.88 + ptr-pic-reverse-2 1.89 + move-1 1.90 + move-2 1.91 + move-3 1.92 + move-4 1.93 + & 1.94 + TMs]] 1.95 + {:dex# n 1.96 + :base-moves 1.97 + (mapv moves 1.98 + ((comp 1.99 + ;; since the game uses zero as a delimiter, 1.100 + ;; it must also increment all move indices by 1. 1.101 + ;; here we decrement to correct this. 1.102 + (partial map dec) 1.103 + (partial take-while (comp not zero?))) 1.104 + [move-1 move-2 move-3 move-4])) 1.105 + 1.106 + :types (set (list (types type-1) 1.107 + (types type-2)))}) 1.108 + 1.109 + (partition entry-size 1.110 + (take (* entry-size pkmn-count) 1.111 + (drop 0x383DE 1.112 + rom))))))) 1.113 + 1.114 + 1.115 + 1.116 +;; In red/blue, pokedex stats are in internal order. 1.117 +;; In yellow, pokedex stats are in pokedex order. 1.118 1.119 (defn hxc-pokedex-stats 1.120 + "The hardcoded pokedex stats (species height weight) in memory. List 1.121 +begins at ROM@40687" 1.122 ;; uses hxc-pokedex-text to count pokemon 1.123 ;; since hxc-pokenames includes several missingno" 1.124 ([] (hxc-pokedex-stats com.aurellem.gb.gb-driver/original-rom))