1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etvel.c -- velocity field handlers
|
---|
4 | Version 2 -- 1988-06-13 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "hwdefs.h"
|
---|
11 | #include "graphdef.h"
|
---|
12 | #include "vsdd.h"
|
---|
13 | #include "vsddsw.h"
|
---|
14 | #include "score.h"
|
---|
15 | #include "scfns.h"
|
---|
16 |
|
---|
17 | #include "midas.h"
|
---|
18 | #include "scdsp.h"
|
---|
19 | #include "instdsp.h"
|
---|
20 |
|
---|
21 | extern unsigned *obj8;
|
---|
22 |
|
---|
23 | extern short recsw;
|
---|
24 | extern short stccol;
|
---|
25 |
|
---|
26 | extern short grpmode[];
|
---|
27 | extern short grpstat[];
|
---|
28 | extern short lastvel[];
|
---|
29 |
|
---|
30 | /* |
---|
31 |
|
---|
32 | */
|
---|
33 |
|
---|
34 | /*
|
---|
35 | =============================================================================
|
---|
36 | et_vel() -- load edit buffer
|
---|
37 | =============================================================================
|
---|
38 | */
|
---|
39 |
|
---|
40 | short et_vel(short n)
|
---|
41 | {
|
---|
42 | sprintf(ebuf, "%03d", lastvel[n] / 252);
|
---|
43 |
|
---|
44 | ebflag = TRUE;
|
---|
45 | return(SUCCESS);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /* |
---|
49 |
|
---|
50 | */
|
---|
51 |
|
---|
52 | /*
|
---|
53 | =============================================================================
|
---|
54 | ef_vel() -- parse edit buffer
|
---|
55 | =============================================================================
|
---|
56 | */
|
---|
57 |
|
---|
58 | short ef_vel(short n)
|
---|
59 | {
|
---|
60 | register short ival, i;
|
---|
61 | register struct s_entry *ep;
|
---|
62 |
|
---|
63 | ival = 0;
|
---|
64 |
|
---|
65 | for (i = 0; i < 3; i++)
|
---|
66 | ival = (ival * 10) + (ebuf[i] - '0');
|
---|
67 |
|
---|
68 | ebflag = FALSE;
|
---|
69 |
|
---|
70 | if (ival > 127)
|
---|
71 | return(FAILURE);
|
---|
72 |
|
---|
73 | ival = SM_SCALE(ival);
|
---|
74 |
|
---|
75 | if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
|
---|
76 |
|
---|
77 | lastvel[n] = ival;
|
---|
78 | ep = ep_adj(p_cur, 1, t_cur);
|
---|
79 |
|
---|
80 | while (t_cur EQ ep->e_time) {
|
---|
81 |
|
---|
82 | if ((EV_NBEG EQ (0x007F & ep->e_type)) AND
|
---|
83 | (ep->e_data2 EQ n)) {
|
---|
84 |
|
---|
85 | ((struct n_entry *)ep)->e_vel = ival;
|
---|
86 | }
|
---|
87 |
|
---|
88 | ep = ep->e_fwd;
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | return(SUCCESS);
|
---|
93 | }
|
---|
94 |
|
---|
95 | /* |
---|
96 |
|
---|
97 | */
|
---|
98 |
|
---|
99 | /*
|
---|
100 | =============================================================================
|
---|
101 | rd_vel() -- (re)display the field
|
---|
102 | =============================================================================
|
---|
103 | */
|
---|
104 |
|
---|
105 | short rd_vel(short n)
|
---|
106 | {
|
---|
107 | char buf[6];
|
---|
108 |
|
---|
109 | sprintf(buf, "%03d", lastvel[n] / 252);
|
---|
110 |
|
---|
111 | if (v_regs[5] & 0x0180)
|
---|
112 | vbank(0);
|
---|
113 |
|
---|
114 | vputs(obj8, 5, 6 + (n * 5), buf, SDW11ATR);
|
---|
115 |
|
---|
116 | return(SUCCESS);
|
---|
117 | }
|
---|
118 |
|
---|
119 | /* |
---|
120 |
|
---|
121 | */
|
---|
122 |
|
---|
123 | /*
|
---|
124 | =============================================================================
|
---|
125 | nd_vel() -- data entry function
|
---|
126 | =============================================================================
|
---|
127 | */
|
---|
128 |
|
---|
129 | short nd_vel(short n, short k)
|
---|
130 | {
|
---|
131 | register short ec;
|
---|
132 |
|
---|
133 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
134 | ebuf[ec] = k + '0';
|
---|
135 |
|
---|
136 | if (v_regs[5] & 0x0180)
|
---|
137 | vbank(0);
|
---|
138 |
|
---|
139 | vputc(obj8, 5, stccol, k + '0', SDW11DEA);
|
---|
140 | advscur();
|
---|
141 |
|
---|
142 | return(SUCCESS);
|
---|
143 | }
|
---|