1 | /*
|
---|
2 | =============================================================================
|
---|
3 | curset.c -- cursor control and data entry parameter setup
|
---|
4 | Version 14 -- 1988-12-13 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DEBUGIT 0
|
---|
9 |
|
---|
10 | #include "all.h"
|
---|
11 |
|
---|
12 | #if DEBUGIT
|
---|
13 | extern short debugsw;
|
---|
14 |
|
---|
15 | short debugcs = 1;
|
---|
16 |
|
---|
17 | char *C_TYPE[] = {
|
---|
18 |
|
---|
19 | "CT_GRAF", /* 0 graphics */
|
---|
20 | "CT_TEXT", /* 1 text -- general */
|
---|
21 | "CT_VIRT", /* 2 virtual -- graphic */
|
---|
22 | "CT_SCOR", /* 3 text -- score */
|
---|
23 | "CT_SMTH", /* 4 text -- smooth scroll */
|
---|
24 | "CT_MENU" /* 5 virtual -- character */
|
---|
25 | };
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | int16_t trkonly = FALSE; /* set TRUE to force use of trackball */
|
---|
29 |
|
---|
30 | extern void txstd(void);
|
---|
31 | extern void tystd(void);
|
---|
32 | extern void cmvgen(void);
|
---|
33 |
|
---|
34 | extern void (*curmove)(void);
|
---|
35 | extern int16_t (*curtype)(void);
|
---|
36 | extern void (*cx_key)(void);
|
---|
37 | extern void (*cx_upd)(void);
|
---|
38 | extern void (*cy_key)(void);
|
---|
39 | extern void (*cy_upd)(void);
|
---|
40 | extern void (*d_key)(int16_t k);
|
---|
41 | extern void (*e_key)(void);
|
---|
42 | extern void (*m_key)(void);
|
---|
43 | extern int16_t (*not_fld)(int16_t k);
|
---|
44 | extern void (*premove)(void);
|
---|
45 | extern void (*pstmove)(void);
|
---|
46 | extern void (*x_key)(void);
|
---|
47 | extern void (*xy_dn)(void);
|
---|
48 | extern void (*xy_up)(void);
|
---|
49 |
|
---|
50 | extern int16_t *cratex;
|
---|
51 | extern int16_t *cratey;
|
---|
52 |
|
---|
53 | /* |
---|
54 |
|
---|
55 | */
|
---|
56 |
|
---|
57 | extern int16_t chtime;
|
---|
58 | extern int16_t chwait;
|
---|
59 | extern int16_t cmfirst;
|
---|
60 | extern int16_t cmtype;
|
---|
61 | extern int16_t curhold;
|
---|
62 | extern int16_t curslim;
|
---|
63 | extern int16_t cvtime;
|
---|
64 | extern int16_t cvwait;
|
---|
65 | extern int16_t cxval;
|
---|
66 | extern int16_t cyval;
|
---|
67 | extern int16_t hcwval;
|
---|
68 | extern int16_t nchwait;
|
---|
69 | extern int16_t ncvwait;
|
---|
70 | extern int16_t stccol;
|
---|
71 | extern int16_t stcrow;
|
---|
72 | extern int16_t submenu;
|
---|
73 | extern int16_t syrate;
|
---|
74 | extern int16_t thcwval;
|
---|
75 | extern int16_t tvcwval;
|
---|
76 | extern int16_t vcwval;
|
---|
77 |
|
---|
78 | extern struct selbox *csbp;
|
---|
79 |
|
---|
80 | /* |
---|
81 |
|
---|
82 | */
|
---|
83 |
|
---|
84 | #if DEBUGIT
|
---|
85 |
|
---|
86 | /*
|
---|
87 | =============================================================================
|
---|
88 | SnapCT() -- snap dump curpak variables
|
---|
89 | =============================================================================
|
---|
90 | */
|
---|
91 |
|
---|
92 | SnapCT()
|
---|
93 | {
|
---|
94 | printf("\ncurpak variables:\n");
|
---|
95 | printf(" curtype = $%lX\n", curtype);
|
---|
96 | printf(" premove = $%lX\n", premove);
|
---|
97 | printf(" pstmove = $%lX\n", pstmove);
|
---|
98 | printf(" cx_key = $%lX\n", cx_key);
|
---|
99 | printf(" cy_key = $%lX\n", cy_key);
|
---|
100 | printf(" cx_upd = $%lX\n", cx_upd);
|
---|
101 | printf(" cy_upd = $%lX\n", cy_upd);
|
---|
102 | printf(" xy_up = $%lX\n", xy_up);
|
---|
103 | printf(" xy_dn = $%lX\n", xy_dn);
|
---|
104 | printf(" x_key = $%lX\n", x_key);
|
---|
105 | printf(" e_key = $%lX\n", e_key);
|
---|
106 | printf(" m_key = $%lX\n", m_key);
|
---|
107 | printf(" d_key = $%lX\n", d_key);
|
---|
108 | printf(" not_fld = $%lX\n", not_fld);
|
---|
109 | printf(" curfet = $%lX\n", curfet);
|
---|
110 | printf(" csbp = $%lX\n", csbp);
|
---|
111 | printf(" cratex = $%lX\n", cratex);
|
---|
112 | printf(" cratey = $%lX\n", cratey);
|
---|
113 | printf(" cmtype = %d\n", cmtype);
|
---|
114 | printf(" cxval = %d\n", cxval);
|
---|
115 | printf(" cyval = %d\n", cyval);
|
---|
116 | printf("\n");
|
---|
117 | }
|
---|
118 |
|
---|
119 | #endif
|
---|
120 |
|
---|
121 | /* |
---|
122 |
|
---|
123 | */
|
---|
124 |
|
---|
125 | /*
|
---|
126 | =============================================================================
|
---|
127 | stdctp0() -- cursor type - text, virtual
|
---|
128 | =============================================================================
|
---|
129 | */
|
---|
130 |
|
---|
131 | int16_t stdctp0(void)
|
---|
132 | {
|
---|
133 | return(submenu ? CT_VIRT : CT_TEXT);
|
---|
134 | }
|
---|
135 |
|
---|
136 | /*
|
---|
137 | =============================================================================
|
---|
138 | stdctp1() -- cursor type -- graphic, text, virtual -- text if > curslim
|
---|
139 | =============================================================================
|
---|
140 | */
|
---|
141 |
|
---|
142 | int16_t stdctp1(void)
|
---|
143 | {
|
---|
144 | if (submenu)
|
---|
145 | return(CT_VIRT);
|
---|
146 |
|
---|
147 | return((cyval > curslim) ? CT_TEXT : CT_GRAF);
|
---|
148 | }
|
---|
149 |
|
---|
150 | /*
|
---|
151 | =============================================================================
|
---|
152 | stdctp2() -- cursor type -- graphic
|
---|
153 | =============================================================================
|
---|
154 | */
|
---|
155 |
|
---|
156 | int16_t stdctp2(void)
|
---|
157 | {
|
---|
158 | return(CT_GRAF);
|
---|
159 | }
|
---|
160 |
|
---|
161 | /* |
---|
162 |
|
---|
163 | */
|
---|
164 |
|
---|
165 | /*
|
---|
166 | =============================================================================
|
---|
167 | stdctp3() -- cursor type -- graphic, score text, virtual
|
---|
168 | =============================================================================
|
---|
169 | */
|
---|
170 |
|
---|
171 | int16_t stdctp3(void)
|
---|
172 | {
|
---|
173 | if (submenu)
|
---|
174 | return(CT_VIRT);
|
---|
175 |
|
---|
176 | return(((cyval < 14) OR (cyval > 237)) ? CT_SCOR : CT_GRAF);
|
---|
177 | }
|
---|
178 |
|
---|
179 | /*
|
---|
180 | =============================================================================
|
---|
181 | stdctp4() -- cursor type -- graphic, text, virtual -- text if < curslim
|
---|
182 | =============================================================================
|
---|
183 | */
|
---|
184 |
|
---|
185 | int16_t stdctp4(void)
|
---|
186 | {
|
---|
187 | if (submenu)
|
---|
188 | return(CT_VIRT);
|
---|
189 |
|
---|
190 | return((cyval < curslim) ? CT_TEXT : CT_GRAF);
|
---|
191 | }
|
---|
192 |
|
---|
193 | /*
|
---|
194 | =============================================================================
|
---|
195 | stdctp5() -- cursor type - text, virtual - character objects
|
---|
196 | =============================================================================
|
---|
197 | */
|
---|
198 |
|
---|
199 | int16_t stdctp5(void)
|
---|
200 | {
|
---|
201 | return(submenu ? CT_MENU : CT_SMTH);
|
---|
202 | }
|
---|
203 |
|
---|
204 | /* |
---|
205 |
|
---|
206 | */
|
---|
207 |
|
---|
208 | /*
|
---|
209 | =============================================================================
|
---|
210 | curset() -- setup the cursor control and data entry parameters
|
---|
211 | =============================================================================
|
---|
212 | */
|
---|
213 |
|
---|
214 | void curset(struct curpak *s)
|
---|
215 | {
|
---|
216 | #if DEBUGIT
|
---|
217 | if (debugsw AND debugcs)
|
---|
218 | printf("curset($%lX): ENTRY old cmtype=%d\n", s, cmtype);
|
---|
219 | #endif
|
---|
220 |
|
---|
221 | curtype = s->curtype;
|
---|
222 | premove = s->premove;
|
---|
223 | pstmove = s->pstmove;
|
---|
224 |
|
---|
225 | curmove = cmvgen;
|
---|
226 |
|
---|
227 | if (trkonly) {
|
---|
228 |
|
---|
229 | cx_key = txstd;
|
---|
230 | cy_key = tystd;
|
---|
231 |
|
---|
232 | } else {
|
---|
233 |
|
---|
234 | cx_key = s->cx_key;
|
---|
235 | cy_key = s->cy_key;
|
---|
236 | }
|
---|
237 |
|
---|
238 | cx_upd = s->cx_upd;
|
---|
239 | cy_upd = s->cy_upd;
|
---|
240 | xy_up = s->xy_up;
|
---|
241 | xy_dn = s->xy_dn;
|
---|
242 | x_key = s->x_key;
|
---|
243 | e_key = s->e_key;
|
---|
244 | m_key = s->m_key;
|
---|
245 | d_key = s->d_key;
|
---|
246 | not_fld = s->not_fld;
|
---|
247 | curfet = s->curfet;
|
---|
248 | csbp = s->csbp;
|
---|
249 | cratex = s->cratex;
|
---|
250 | cratey = s->cratey;
|
---|
251 | cmtype = s->cmtype;
|
---|
252 | cxval = s->cxval;
|
---|
253 | cyval = s->cyval;
|
---|
254 |
|
---|
255 | #if DEBUGIT
|
---|
256 | if (debugsw AND debugcs)
|
---|
257 | printf("curset($%lX): new cmtype=%d\n", s, cmtype);
|
---|
258 | #endif
|
---|
259 |
|
---|
260 | /* |
---|
261 |
|
---|
262 | */
|
---|
263 | if (cmtype EQ CT_GRAF) { /* graphics */
|
---|
264 |
|
---|
265 | chtime = hcwval;
|
---|
266 | cvtime = vcwval;
|
---|
267 |
|
---|
268 | } else { /* text of some sort */
|
---|
269 |
|
---|
270 | chtime = thcwval;
|
---|
271 | cvtime = (cmtype EQ CT_SMTH) ? syrate : tvcwval;
|
---|
272 | }
|
---|
273 |
|
---|
274 | stccol = XTOC(cxval);
|
---|
275 | stcrow = YTOR(cyval);
|
---|
276 |
|
---|
277 | chwait = chtime;
|
---|
278 | cvwait = cvtime;
|
---|
279 |
|
---|
280 | nchwait = curhold;
|
---|
281 | ncvwait = curhold;
|
---|
282 |
|
---|
283 | cmfirst = TRUE;
|
---|
284 |
|
---|
285 | ebflag = FALSE;
|
---|
286 | memset(ebuf, '\0', sizeof ebuf);
|
---|
287 |
|
---|
288 | cfetp = (struct fet *)NULL;
|
---|
289 | infetp = (struct fet *)NULL;
|
---|
290 |
|
---|
291 | #if DEBUGIT
|
---|
292 | if (debugsw AND debugcs) {
|
---|
293 |
|
---|
294 | printf("curset($%lX): EXIT cmtype=%d=%s chtime=%d cvtime=%d curhold=%d\n",
|
---|
295 | s, cmtype,
|
---|
296 | (cmtype < 6) ? C_TYPE[cmtype] : "UNKNOWN",
|
---|
297 | chtime, cvtime, curhold);
|
---|
298 |
|
---|
299 | SnapCT();
|
---|
300 | }
|
---|
301 | #endif
|
---|
302 |
|
---|
303 | }
|
---|
304 |
|
---|