Mercurial > vba-clojure
view clojure/com/aurellem/gb/rival_name.clj @ 249:99227bec1123
Reworked the hxc definitions; they are now fns that optionally take a single rom arg and dynamically grab the data. Their commonalities are also consolidated into a single template function, hxc-thunk. Minor fixes include stripping pokenames of their padding and splitting the huge hxc-dialog string into a list.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Mon, 26 Mar 2012 03:45:24 -0500 |
parents | 0587f266a735 |
children |
line wrap: on
line source
1 (ns com.aurellem.gb.rival-name2 (: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-name11 ([^SaveState state]12 (read-name (subvec (vec (memory state))13 rival-name-start-address14 (+ rival-name-start-address15 rival-name-width))))16 ([] (read-rival-name @current-state)))18 (defn set-rival-name19 ([^SaveState state new-name]20 (assert (<= (count new-name) 10))21 (let [codes (str->character-codes new-name)]22 (set-memory-range state23 rival-name-start-address24 (concat codes [end-of-name-sentinel]))))25 ([new-name] (set-rival-name @current-state new-name)))