Rev 390 | Rev 489 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 390 | Rev 453 | ||
---|---|---|---|
1 | /**************************************************************************** |
1 | /**************************************************************************** |
2 | * Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje * |
2 | * Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje * |
3 | * admiralcascade@gmail.com * |
3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
5 | * * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License. * |
8 | * the Free Software Foundation; either version 2 of the License. * |
9 | * * |
9 | * * |
10 | * This program is distributed in the hope that it will be useful, * |
10 | * This program is distributed in the hope that it will be useful, * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 | * GNU General Public License for more details. * |
13 | * GNU General Public License for more details. * |
14 | * * |
14 | * * |
15 | * You should have received a copy of the GNU General Public License * |
15 | * You should have received a copy of the GNU General Public License * |
16 | * along with this program; if not, write to the * |
16 | * along with this program; if not, write to the * |
17 | * Free Software Foundation, Inc., * |
17 | * Free Software Foundation, Inc., * |
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 | ****************************************************************************/ |
19 | ****************************************************************************/ |
20 | 20 | ||
21 | #include <avr/pgmspace.h> |
21 | #include <avr/pgmspace.h> |
22 | #include "osd_helpers.h" |
22 | #include "osd_helpers.h" |
23 | #include "max7456_software_spi.h" |
23 | #include "max7456_software_spi.h" |
24 | 24 | ||
25 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
25 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
26 | /* ########################################################################## |
26 | /* ########################################################################## |
27 | * compass stuff |
27 | * compass stuff |
28 | * ##########################################################################*/ |
28 | * ##########################################################################*/ |
29 | 29 | ||
30 | /** |
30 | /** |
31 | * convert the <heading> gotton from NC into an index |
31 | * convert the <heading> gotton from NC into an index |
32 | */ |
32 | */ |
33 | uint8_t heading_conv(uint16_t heading) { |
33 | uint8_t heading_conv(uint16_t heading) { |
34 | if (heading > 23 && heading < 68) { |
34 | if (heading > 23 && heading < 68) { |
35 | //direction = "NE"; |
35 | //direction = "NE"; |
36 | return 0; |
36 | return 0; |
37 | } else if (heading > 67 && heading < 113) { |
37 | } else if (heading > 67 && heading < 113) { |
38 | //direction = "E "; |
38 | //direction = "E "; |
39 | return 1; |
39 | return 1; |
40 | } else if (heading > 112 && heading < 158) { |
40 | } else if (heading > 112 && heading < 158) { |
41 | //direction = "SE"; |
41 | //direction = "SE"; |
42 | return 2; |
42 | return 2; |
43 | } else if (heading > 157 && heading < 203) { |
43 | } else if (heading > 157 && heading < 203) { |
44 | //direction = "S "; |
44 | //direction = "S "; |
45 | return 3; |
45 | return 3; |
46 | } else if (heading > 202 && heading < 248) { |
46 | } else if (heading > 202 && heading < 248) { |
47 | //direction = "SW"; |
47 | //direction = "SW"; |
48 | return 4; |
48 | return 4; |
49 | } else if (heading > 247 && heading < 293) { |
49 | } else if (heading > 247 && heading < 293) { |
50 | //direction = "W "; |
50 | //direction = "W "; |
51 | return 5; |
51 | return 5; |
52 | } else if (heading > 292 && heading < 338) { |
52 | } else if (heading > 292 && heading < 338) { |
53 | //direction = "NW"; |
53 | //direction = "NW"; |
54 | return 6; |
54 | return 6; |
55 | } |
55 | } |
56 | //direction = "N "; |
56 | //direction = "N "; |
57 | return 7; |
57 | return 7; |
58 | } |
58 | } |
59 | 59 | ||
60 | /** |
60 | /** |
61 | * convert the <heading> gotton from NC into a more |
61 | * convert the <heading> gotton from NC into a more |
62 | * precise index |
62 | * precise index |
63 | */ |
63 | */ |
64 | uint8_t heading_fine_conv(uint16_t heading) { |
64 | uint8_t heading_fine_conv(uint16_t heading) { |
65 | heading = ((heading * 10) + 113) % 3600; |
65 | heading = ((heading * 10) + 113) % 3600; |
66 | return (heading / 225); |
66 | return (heading / 225); |
67 | } |
67 | } |
68 | 68 | ||
69 | /** |
69 | /** |
70 | * draw a compass rose at <x>/<y> for <heading> |
70 | * draw a compass rose at <x>/<y> for <heading> |
71 | */ |
71 | */ |
72 | void draw_compass(uint8_t x, uint8_t y, uint16_t heading) { |
72 | void draw_compass(uint8_t x, uint8_t y, uint16_t heading) { |
73 | //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W"; |
73 | //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W"; |
74 | char rose[48] = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
74 | char rose[48] = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
75 | 216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213, |
75 | 216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213, |
76 | 216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211, |
76 | 216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211, |
77 | 216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214}; |
77 | 216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214}; |
78 | // the center is char 19 (north), we add the current heading in 8th |
78 | // the center is char 19 (north), we add the current heading in 8th |
79 | // which would be 22.5 degrees, but float would bloat up the code |
79 | // which would be 22.5 degrees, but float would bloat up the code |
80 | // and *10 / 225 would take ages... so we take the uncorrect way |
80 | // and *10 / 225 would take ages... so we take the uncorrect way |
81 | uint8_t front = 19 + (heading / 22); |
81 | uint8_t front = 19 + (heading / 22); |
82 | for (uint8_t i = 0; i < 9; i++) { |
82 | for (uint8_t i = 0; i < 9; i++) { |
83 | write_char_xy(x++, y, rose[front - 4 + i]); |
83 | write_char_xy(x++, y, rose[front - 4 + i]); |
84 | } |
84 | } |
85 | } |
85 | } |
86 | 86 | ||
87 | /* ########################################################################## |
87 | /* ########################################################################## |
88 | * battery index |
88 | * battery index |
89 | * ##########################################################################*/ |
89 | * ##########################################################################*/ |
90 | /** |
90 | /** |
91 | * draw a battery symbol at <x>/<y> according to <voltage> |
91 | * draw a battery symbol at <x>/<y> according to <voltage> |
92 | */ |
92 | */ |
93 | void draw_battery(uint8_t x, uint8_t y, uint16_t voltage) { |
93 | void draw_battery(uint8_t x, uint8_t y, uint8_t min_voltage, uint8_t voltage, uint8_t max_voltage) { |
94 | uint8_t percent = (100* (voltage - UBAT_WRN) / (UBAT_MAX - UBAT_WRN)); |
94 | uint8_t percent = (100* (voltage - min_voltage) / (max_voltage - min_voltage)); |
95 | if (percent > 100) percent = 100; |
95 | if (percent > 100) percent = 100; |
96 | if (voltage < UBAT_WRN) percent = 0; |
96 | if (voltage < min_voltage) percent = 0; |
97 | write_char_xy(x, y, 0x9d - (percent * 13 / 100)); |
97 | write_char_xy(x, y, 0x9d - (percent * 13 / 100)); |
98 | //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0); |
98 | //write_ndigit_number_u(x, y-1, percent * 13 / 100, 100, 0); |
99 | } |
99 | } |
100 | 100 | ||
101 | /* ########################################################################## |
101 | /* ########################################################################## |
102 | * variometer |
102 | * variometer |
103 | * ##########################################################################*/ |
103 | * ##########################################################################*/ |
104 | /** |
104 | /** |
105 | * draw variometer arrows at <x>/<y> according to <variometer> |
105 | * draw variometer arrows at <x>/<y> according to <variometer> |
106 | */ |
106 | */ |
107 | void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
107 | void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
108 | if (variometer == 0) { |
108 | if (variometer == 0) { |
109 | write_char_xy(x, y, 0xbb); // plain line |
109 | write_char_xy(x, y, 0xbb); // plain line |
110 | } else if (variometer > 0) { // gain height |
110 | } else if (variometer > 0) { // gain height |
111 | switch (variometer / 5){ |
111 | switch (variometer / 5){ |
112 | case 0: |
112 | case 0: |
113 | //write_char_xy(x, y, 0xba); // smallest arrow up |
113 | //write_char_xy(x, y, 0xba); // smallest arrow up |
114 | write_char_xy(x, y, 0x70); // one arrow up |
114 | write_char_xy(x, y, 0x70); // one arrow up |
115 | break; |
115 | break; |
116 | case 1: |
116 | case 1: |
117 | //write_char_xy(x, y, 0xb9); // small arrow up |
117 | //write_char_xy(x, y, 0xb9); // small arrow up |
118 | write_char_xy(x, y, 0x71); // two arrows up |
118 | write_char_xy(x, y, 0x71); // two arrows up |
119 | break; |
119 | break; |
120 | case 2: |
120 | case 2: |
121 | //write_char_xy(x, y, 0xb8); // large arrow up |
121 | //write_char_xy(x, y, 0xb8); // large arrow up |
122 | write_char_xy(x, y, 0x72); // three arrows up |
122 | write_char_xy(x, y, 0x72); // three arrows up |
123 | break; |
123 | break; |
124 | default: |
124 | default: |
125 | //write_char_xy(x, y, 0xb7); // largest arrow up |
125 | //write_char_xy(x, y, 0xb7); // largest arrow up |
126 | write_char_xy(x, y, 0x73); // three black arrows up |
126 | write_char_xy(x, y, 0x73); // three black arrows up |
127 | } |
127 | } |
128 | } else { // sink |
128 | } else { // sink |
129 | switch (variometer / -5){ |
129 | switch (variometer / -5){ |
130 | case 0: |
130 | case 0: |
131 | //write_char_xy(x, y, 0xbc); // smallest arrow down |
131 | //write_char_xy(x, y, 0xbc); // smallest arrow down |
132 | write_char_xy(x, y, 0x77); // one arrow down |
132 | write_char_xy(x, y, 0x77); // one arrow down |
133 | break; |
133 | break; |
134 | case 1: |
134 | case 1: |
135 | //write_char_xy(x, y, 0xbd); // small arrow down |
135 | //write_char_xy(x, y, 0xbd); // small arrow down |
136 | write_char_xy(x, y, 0x76); // two arrows down |
136 | write_char_xy(x, y, 0x76); // two arrows down |
137 | break; |
137 | break; |
138 | case 2: |
138 | case 2: |
139 | //write_char_xy(x, y, 0xbe); // large arrow down |
139 | //write_char_xy(x, y, 0xbe); // large arrow down |
140 | write_char_xy(x, y, 0x75); // three arrows down |
140 | write_char_xy(x, y, 0x75); // three arrows down |
141 | break; |
141 | break; |
142 | default: |
142 | default: |
143 | //write_char_xy(x, y, 0xbf); // largest arrow down |
143 | //write_char_xy(x, y, 0xbf); // largest arrow down |
144 | write_char_xy(x, y, 0x74); // three black arrows down |
144 | write_char_xy(x, y, 0x74); // three black arrows down |
145 | } |
145 | } |
146 | } |
146 | } |
147 | } |
147 | } |
148 | 148 | ||
149 | // big vario arrays |
149 | // big vario arrays |
150 | char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff}; |
150 | char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff}; |
151 | char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0}; |
151 | char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0}; |
152 | char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1}; |
152 | char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1}; |
153 | char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00}; |
153 | char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00}; |
154 | char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00}; |
154 | char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00}; |
155 | char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00}; |
155 | char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00}; |
156 | char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00}; |
156 | char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00}; |
157 | char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00}; |
157 | char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00}; |
158 | char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00}; |
158 | char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00}; |
159 | char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00}; |
159 | char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00}; |
160 | char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00}; |
160 | char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00}; |
161 | char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00}; |
161 | char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00}; |
162 | char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00}; |
162 | char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00}; |
163 | char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00}; |
163 | char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00}; |
164 | char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00}; |
164 | char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00}; |
165 | char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04, |
165 | char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04, |
166 | vario_05, vario_06, vario_07, vario_08, |
166 | vario_05, vario_06, vario_07, vario_08, |
167 | vario_09, vario_10, vario_11, vario_12, |
167 | vario_09, vario_10, vario_11, vario_12, |
168 | vario_13, vario_14}; |
168 | vario_13, vario_14}; |
169 | 169 | ||
170 | /** |
170 | /** |
171 | * draw a bigger vario with middle at <x>/<y> acording to <variometer> |
171 | * draw a bigger vario with middle at <x>/<y> acording to <variometer> |
172 | */ |
172 | */ |
173 | void draw_big_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
173 | void draw_big_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
174 | int16_t index = 7 + variometer; |
174 | int16_t index = 7 + variometer; |
175 | if (index > 14) index = 14; |
175 | if (index > 14) index = 14; |
176 | else if (index < 0) index = 0; |
176 | else if (index < 0) index = 0; |
177 | 177 | ||
178 | // TODO: why does write_string_pgm_down(x, y-2, vario_pnt[index], 5); |
178 | // TODO: why does write_string_pgm_down(x, y-2, vario_pnt[index], 5); |
179 | // not work??? WTF?! |
179 | // not work??? WTF?! |
180 | switch (index) { |
180 | switch (index) { |
181 | case 0: write_string_pgm_down(x, y-2, vario_pnt[0], 5); |
181 | case 0: write_string_pgm_down(x, y-2, vario_pnt[0], 5); |
182 | break; |
182 | break; |
183 | case 1: write_string_pgm_down(x, y-2, vario_pnt[1], 5); |
183 | case 1: write_string_pgm_down(x, y-2, vario_pnt[1], 5); |
184 | break; |
184 | break; |
185 | case 2: write_string_pgm_down(x, y-2, vario_pnt[2], 5); |
185 | case 2: write_string_pgm_down(x, y-2, vario_pnt[2], 5); |
186 | break; |
186 | break; |
187 | case 3: write_string_pgm_down(x, y-2, vario_pnt[3], 5); |
187 | case 3: write_string_pgm_down(x, y-2, vario_pnt[3], 5); |
188 | break; |
188 | break; |
189 | case 4: write_string_pgm_down(x, y-2, vario_pnt[4], 5); |
189 | case 4: write_string_pgm_down(x, y-2, vario_pnt[4], 5); |
190 | break; |
190 | break; |
191 | case 5: write_string_pgm_down(x, y-2, vario_pnt[5], 5); |
191 | case 5: write_string_pgm_down(x, y-2, vario_pnt[5], 5); |
192 | break; |
192 | break; |
193 | case 6: write_string_pgm_down(x, y-2, vario_pnt[6], 5); |
193 | case 6: write_string_pgm_down(x, y-2, vario_pnt[6], 5); |
194 | break; |
194 | break; |
195 | case 7: write_string_pgm_down(x, y-2, vario_pnt[7], 5); |
195 | case 7: write_string_pgm_down(x, y-2, vario_pnt[7], 5); |
196 | break; |
196 | break; |
197 | case 8: write_string_pgm_down(x, y-2, vario_pnt[8], 5); |
197 | case 8: write_string_pgm_down(x, y-2, vario_pnt[8], 5); |
198 | break; |
198 | break; |
199 | case 9: write_string_pgm_down(x, y-2, vario_pnt[9], 5); |
199 | case 9: write_string_pgm_down(x, y-2, vario_pnt[9], 5); |
200 | break; |
200 | break; |
201 | case 10: write_string_pgm_down(x, y-2, vario_pnt[10], 5); |
201 | case 10: write_string_pgm_down(x, y-2, vario_pnt[10], 5); |
202 | break; |
202 | break; |
203 | case 11: write_string_pgm_down(x, y-2, vario_pnt[11], 5); |
203 | case 11: write_string_pgm_down(x, y-2, vario_pnt[11], 5); |
204 | break; |
204 | break; |
205 | case 12: write_string_pgm_down(x, y-2, vario_pnt[12], 5); |
205 | case 12: write_string_pgm_down(x, y-2, vario_pnt[12], 5); |
206 | break; |
206 | break; |
207 | case 13: write_string_pgm_down(x, y-2, vario_pnt[13], 5); |
207 | case 13: write_string_pgm_down(x, y-2, vario_pnt[13], 5); |
208 | break; |
208 | break; |
209 | default: write_string_pgm_down(x, y-2, vario_pnt[14], 5); |
209 | default: write_string_pgm_down(x, y-2, vario_pnt[14], 5); |
210 | } |
210 | } |
211 | } |
211 | } |
212 | 212 | ||
213 | /* ########################################################################## |
213 | /* ########################################################################## |
214 | * artificial horizon |
214 | * artificial horizon |
215 | * ##########################################################################*/ |
215 | * ##########################################################################*/ |
216 | // remember last time displayed values |
216 | // remember last time displayed values |
217 | int8_t old_af_x = -1, old_af_y = -1; |
217 | int8_t old_af_x = -1, old_af_y = -1; |
218 | 218 | ||
219 | /** |
219 | /** |
220 | * draw roll und nick indicators (could be enhanced to full artificial horizon) |
220 | * draw roll und nick indicators (could be enhanced to full artificial horizon) |
221 | * from line <firstline> to <listlines> for given <nick> and <roll> values |
221 | * from line <firstline> to <listlines> for given <nick> and <roll> values |
222 | */ |
222 | */ |
223 | void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) { |
223 | void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) { |
224 | char noodle[5] = {225, 225, 226, 227, 227}; |
224 | char noodle[5] = {225, 225, 226, 227, 227}; |
225 | uint8_t center_x = 15; |
225 | uint8_t center_x = 15; |
226 | uint8_t center_y = lastline - firstline; |
226 | uint8_t center_y = lastline - firstline; |
227 | center_y = 7; |
227 | center_y = 7; |
228 | write_char_xy(center_x,center_y,228); |
228 | write_char_xy(center_x,center_y,228); |
229 | uint8_t cpos, nicky, rollx; |
229 | uint8_t cpos, nicky, rollx; |
230 | 230 | ||
231 | // which line |
231 | // which line |
232 | int8_t ypos = nick / 20; |
232 | int8_t ypos = nick / 20; |
233 | // which character from the array? |
233 | // which character from the array? |
234 | if (nick < 0) { |
234 | if (nick < 0) { |
235 | cpos = -1*((nick - (ypos * 20))/4); |
235 | cpos = -1*((nick - (ypos * 20))/4); |
236 | ypos--; |
236 | ypos--; |
237 | } else cpos = 4-((nick - (ypos * 20))/4); |
237 | } else cpos = 4-((nick - (ypos * 20))/4); |
238 | if (cpos > 4) cpos = 4; |
238 | if (cpos > 4) cpos = 4; |
239 | 239 | ||
240 | nicky = center_y - ypos; |
240 | nicky = center_y - ypos; |
241 | if (nicky > lastline) nicky = lastline; |
241 | if (nicky > lastline) nicky = lastline; |
242 | else if (nicky < firstline) nicky = firstline; |
242 | else if (nicky < firstline) nicky = firstline; |
243 | 243 | ||
244 | // ensure roll-borders |
244 | // ensure roll-borders |
245 | rollx = (roll / 8)+15; |
245 | rollx = (roll / 8)+15; |
246 | if (rollx < 2) rollx = 2; |
246 | if (rollx < 2) rollx = 2; |
247 | else if (rollx > 28) rollx = 28; |
247 | else if (rollx > 28) rollx = 28; |
248 | 248 | ||
249 | 249 | ||
250 | // clear roll |
250 | // clear roll |
251 | if (old_af_x != rollx && old_af_x >= 0) { |
251 | if (old_af_x != rollx && old_af_x >= 0) { |
252 | write_char_xy(old_af_x, lastline, 0); |
252 | write_char_xy(old_af_x, lastline, 0); |
253 | } |
253 | } |
254 | 254 | ||
255 | // clear nick |
255 | // clear nick |
256 | if (old_af_y != nicky && old_af_y >= 0) { |
256 | if (old_af_y != nicky && old_af_y >= 0) { |
257 | write_char_xy(center_x-1, old_af_y, 0); |
257 | write_char_xy(center_x-1, old_af_y, 0); |
258 | write_char_xy(center_x+1, old_af_y, 0); |
258 | write_char_xy(center_x+1, old_af_y, 0); |
259 | } |
259 | } |
260 | 260 | ||
261 | 261 | ||
262 | // draw nick |
262 | // draw nick |
263 | write_char_xy(center_x-1, nicky, noodle[cpos]); |
263 | write_char_xy(center_x-1, nicky, noodle[cpos]); |
264 | write_char_xy(center_x+1, nicky, noodle[cpos]); |
264 | write_char_xy(center_x+1, nicky, noodle[cpos]); |
265 | 265 | ||
266 | // draw roll |
266 | // draw roll |
267 | write_char_xy(rollx, lastline, 229); |
267 | write_char_xy(rollx, lastline, 229); |
268 | 268 | ||
269 | // update old vars |
269 | // update old vars |
270 | old_af_x = rollx; |
270 | old_af_x = rollx; |
271 | old_af_y = nicky; |
271 | old_af_y = nicky; |
272 | 272 | ||
273 | // debug numbers |
273 | // debug numbers |
274 | //write_3digit_number_u(20,6,cpos); |
274 | //write_3digit_number_u(20,6,cpos); |
275 | //write_number_s(20,7,ypos); |
275 | //write_number_s(20,7,ypos); |
276 | //write_number_s(0,7,nick); |
276 | //write_number_s(0,7,nick); |
277 | //write_number_s(18,11,roll); |
277 | //write_number_s(18,11,roll); |
278 | } |
278 | } |
279 | 279 | ||
280 | #endif |
280 | #endif |
281 | 281 |