comparison clojure/com/aurellem/exp/pokemon.clj @ 149:79ffbd639b41

made a map of what I know about pokemon layout so far.
author Robert McIntyre <rlm@mit.edu>
date Mon, 19 Mar 2012 23:27:43 -0500
parents 06426d25c65b
children 544a97ac3d8a
comparison
equal deleted inserted replaced
148:06426d25c65b 149:79ffbd639b41
118 ([^SaveState state begin end] 118 ([^SaveState state begin end]
119 (dorun 119 (dorun
120 (map (fn [character-code line] 120 (map (fn [character-code line]
121 (println 121 (println
122 (format "0x%04X: " line) 122 (format "0x%04X: " line)
123 (str (character-code->character character-code)))) 123 (str (character-code->character character-code))))
124 (subvec (vec (memory state)) begin end) 124 (subvec (vec (memory state)) begin end)
125 (range begin end))) 125 (range begin end)))
126 state) 126 state)
127 ([begin end] 127 ([begin end]
128 (print-text @current-state begin end))) 128 (print-text @current-state begin end)))
394 394
395 395
396 ;; two canidates : 0xD162 or 0xDA7F 396 ;; two canidates : 0xD162 or 0xDA7F
397 ;; they seem to always sum to 6... 397 ;; they seem to always sum to 6...
398 398
399
400
401 ;; try to set both of them when having only one pokemon. 399 ;; try to set both of them when having only one pokemon.
402 400
403 (defn change-party-number [^SaveState state new-num] 401 (defn change-party-number [^SaveState state new-num]
404 (set-memory state 0xD162 new-num)) 402 (set-memory state 0xD162 new-num))
405 403
450 state 448 state
451 (+ (* n name-width) pokemon-names-start) 449 (+ (* n name-width) pokemon-names-start)
452 (concat (str->character-codes new-name) [end-of-name-marker]))) 450 (concat (str->character-codes new-name) [end-of-name-marker])))
453 ([n new-name] 451 ([n new-name]
454 (rename-pokemon @current-state n new-name))) 452 (rename-pokemon @current-state n new-name)))
455
456 453
457 ;; on further analysis, it appears that the original 454 ;; on further analysis, it appears that the original
458 ;; trainer info for each pokemon is also stored together, 455 ;; trainer info for each pokemon is also stored together,
459 ;; starting at 0xD272 and continuing to 0xD2B3, with 456 ;; starting at 0xD272 and continuing to 0xD2B3, with
460 ;; 11 bytes reserved for each OT name. 457 ;; 11 bytes reserved for each OT name.
488 (set-original-trainer @current-state n new-name))) 485 (set-original-trainer @current-state n new-name)))
489 486
490 ;; PIKACHU stops following if you set it's OT to another name 487 ;; PIKACHU stops following if you set it's OT to another name
491 ;; and then back to you own. 488 ;; and then back to you own.
492 ;; But not if you set it to your own name, obviously. 489 ;; But not if you set it to your own name, obviously.
493 490
491