source: buchla-68k/orig/RAM/CURSET.C@ 6d3de83

Last change on this file since 6d3de83 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

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