Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/text_speed.clj @ 225:0587f266a735
added functions for setting rival's name and text speed
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 24 Mar 2012 05:26:33 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
224:10e26e7ceedb | 225:0587f266a735 |
---|---|
1 (ns com.aurellem.gb.text-speed | |
2 (:use (com.aurellem.gb gb-driver util characters)) | |
3 (:import [com.aurellem.gb.gb_driver SaveState])) | |
4 | |
5 (def text-speed-address 0xD354) | |
6 | |
7 (def text-speed->code | |
8 {:slow 69 | |
9 :mid 67 | |
10 :fast 65 | |
11 :ultra 64 | |
12 }) | |
13 | |
14 (def code->text-speed | |
15 (zipmap (vals text-speed->code) | |
16 (keys text-speed->code))) | |
17 | |
18 (defn read-text-speed | |
19 ([^SaveState state] | |
20 (code->text-speed (aget (memory state) | |
21 text-speed-address))) | |
22 ([] (read-text-speed @current-state))) | |
23 | |
24 (defn set-text-speed | |
25 ([^SaveState state new-speed] | |
26 (set-memory | |
27 state | |
28 text-speed-address | |
29 (text-speed->code new-speed new-speed))) | |
30 ([new-speed] (set-text-speed @current-state new-speed))) |