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

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

Removed redundant declarations.

  • Property mode set to 100644
File size: 6.5 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 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
139int16_t stdctp0(void)
140{
141 return(submenu ? CT_VIRT : CT_TEXT);
142}
143
144/*
145 =============================================================================
146 stdctp1() -- cursor type -- graphic, text, virtual -- text if > curslim
147 =============================================================================
148*/
149
150int16_t stdctp1(void)
151{
152 if (submenu)
153 return(CT_VIRT);
154
155 return((cyval > curslim) ? CT_TEXT : CT_GRAF);
156}
157
158/*
159 =============================================================================
160 stdctp2() -- cursor type -- graphic
161 =============================================================================
162*/
163
164int16_t stdctp2(void)
165{
166 return(CT_GRAF);
167}
168
169/*
170
171*/
172
173/*
174 =============================================================================
175 stdctp3() -- cursor type -- graphic, score text, virtual
176 =============================================================================
177*/
178
179int16_t stdctp3(void)
180{
181 if (submenu)
182 return(CT_VIRT);
183
184 return(((cyval < 14) OR (cyval > 237)) ? CT_SCOR : CT_GRAF);
185}
186
187/*
188 =============================================================================
189 stdctp4() -- cursor type -- graphic, text, virtual -- text if < curslim
190 =============================================================================
191*/
192
193int16_t stdctp4(void)
194{
195 if (submenu)
196 return(CT_VIRT);
197
198 return((cyval < curslim) ? CT_TEXT : CT_GRAF);
199}
200
201/*
202 =============================================================================
203 stdctp5() -- cursor type - text, virtual - character objects
204 =============================================================================
205*/
206
207int16_t stdctp5(void)
208{
209 return(submenu ? CT_MENU : CT_SMTH);
210}
211
212/*
213
214*/
215
216/*
217 =============================================================================
218 curset() -- setup the cursor control and data entry parameters
219 =============================================================================
220*/
221
222void curset(struct curpak *s)
223{
224#if DEBUGIT
225 if (debugsw AND debugcs)
226 printf("curset($%lX): ENTRY old cmtype=%d\n", s, cmtype);
227#endif
228
229 curtype = s->curtype;
230 premove = s->premove;
231 pstmove = s->pstmove;
232
233 curmove = cmvgen;
234
235 if (trkonly) {
236
237 cx_key = txstd;
238 cy_key = tystd;
239
240 } else {
241
242 cx_key = s->cx_key;
243 cy_key = s->cy_key;
244 }
245
246 cx_upd = s->cx_upd;
247 cy_upd = s->cy_upd;
248 xy_up = s->xy_up;
249 xy_dn = s->xy_dn;
250 x_key = s->x_key;
251 e_key = s->e_key;
252 m_key = s->m_key;
253 d_key = s->d_key;
254 not_fld = s->not_fld;
255 curfet = s->curfet;
256 csbp = s->csbp;
257 cratex = s->cratex;
258 cratey = s->cratey;
259 cmtype = s->cmtype;
260 cxval = s->cxval;
261 cyval = s->cyval;
262
263#if DEBUGIT
264 if (debugsw AND debugcs)
265 printf("curset($%lX): new cmtype=%d\n", s, cmtype);
266#endif
267
268/*
269
270*/
271 if (cmtype EQ CT_GRAF) { /* graphics */
272
273 chtime = hcwval;
274 cvtime = vcwval;
275
276 } else { /* text of some sort */
277
278 chtime = thcwval;
279 cvtime = (cmtype EQ CT_SMTH) ? syrate : tvcwval;
280 }
281
282 stccol = XTOC(cxval);
283 stcrow = YTOR(cyval);
284
285 chwait = chtime;
286 cvwait = cvtime;
287
288 nchwait = curhold;
289 ncvwait = curhold;
290
291 cmfirst = TRUE;
292
293 ebflag = FALSE;
294 memset(ebuf, '\0', sizeof ebuf);
295
296 cfetp = (struct fet *)NULL;
297 infetp = (struct fet *)NULL;
298
299#if DEBUGIT
300 if (debugsw AND debugcs) {
301
302 printf("curset($%lX): EXIT cmtype=%d=%s chtime=%d cvtime=%d curhold=%d\n",
303 s, cmtype,
304 (cmtype < 6) ? C_TYPE[cmtype] : "UNKNOWN",
305 chtime, cvtime, curhold);
306
307 SnapCT();
308 }
309#endif
310
311}
Note: See TracBrowser for help on using the repository browser.