source: buchla-68k/ram/curset.c@ e225e77

Last change on this file since e225e77 was e225e77, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added missing includes and declarations.

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