view clojure/com/aurellem/gb/rival_name.clj @ 516:7eac27143ab9

cosmetic change. need to investigate why switching pallet and tile assembly does not work.
author Robert McIntyre <rlm@mit.edu>
date Fri, 22 Jun 2012 21:24:44 -0500
parents 0587f266a735
children
line wrap: on
line source
1 (ns com.aurellem.gb.rival-name
2 (:use (com.aurellem.gb gb-driver util characters))
3 (:import [com.aurellem.gb.gb_driver SaveState]))
6 (def rival-name-start-address 0xD349)
8 (def rival-name-width 12)
10 (defn read-rival-name
11 ([^SaveState state]
12 (read-name (subvec (vec (memory state))
13 rival-name-start-address
14 (+ rival-name-start-address
15 rival-name-width))))
16 ([] (read-rival-name @current-state)))
18 (defn set-rival-name
19 ([^SaveState state new-name]
20 (assert (<= (count new-name) 10))
21 (let [codes (str->character-codes new-name)]
22 (set-memory-range state
23 rival-name-start-address
24 (concat codes [end-of-name-sentinel]))))
25 ([new-name] (set-rival-name @current-state new-name)))