[f40a309] | 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 |
|
---|
[b28a12e] | 10 | #include "ram.h"
|
---|
[e225e77] | 11 |
|
---|
[f40a309] | 12 | #if DEBUGIT
|
---|
[b28a12e] | 13 | uint16_t debugcs = 1;
|
---|
[f40a309] | 14 |
|
---|
| 15 | char *C_TYPE[] = {
|
---|
| 16 |
|
---|
| 17 | "CT_GRAF", /* 0 graphics */
|
---|
| 18 | "CT_TEXT", /* 1 text -- general */
|
---|
| 19 | "CT_VIRT", /* 2 virtual -- graphic */
|
---|
| 20 | "CT_SCOR", /* 3 text -- score */
|
---|
| 21 | "CT_SMTH", /* 4 text -- smooth scroll */
|
---|
| 22 | "CT_MENU" /* 5 virtual -- character */
|
---|
| 23 | };
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
[7258c6a] | 26 | int16_t trkonly = FALSE; /* set TRUE to force use of trackball */
|
---|
[f40a309] | 27 |
|
---|
| 28 | #if DEBUGIT
|
---|
| 29 |
|
---|
| 30 | /*
|
---|
| 31 | =============================================================================
|
---|
| 32 | SnapCT() -- snap dump curpak variables
|
---|
| 33 | =============================================================================
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | SnapCT()
|
---|
| 37 | {
|
---|
| 38 | printf("\ncurpak variables:\n");
|
---|
| 39 | printf(" curtype = $%lX\n", curtype);
|
---|
| 40 | printf(" premove = $%lX\n", premove);
|
---|
| 41 | printf(" pstmove = $%lX\n", pstmove);
|
---|
| 42 | printf(" cx_key = $%lX\n", cx_key);
|
---|
| 43 | printf(" cy_key = $%lX\n", cy_key);
|
---|
| 44 | printf(" cx_upd = $%lX\n", cx_upd);
|
---|
| 45 | printf(" cy_upd = $%lX\n", cy_upd);
|
---|
| 46 | printf(" xy_up = $%lX\n", xy_up);
|
---|
| 47 | printf(" xy_dn = $%lX\n", xy_dn);
|
---|
| 48 | printf(" x_key = $%lX\n", x_key);
|
---|
| 49 | printf(" e_key = $%lX\n", e_key);
|
---|
| 50 | printf(" m_key = $%lX\n", m_key);
|
---|
| 51 | printf(" d_key = $%lX\n", d_key);
|
---|
| 52 | printf(" not_fld = $%lX\n", not_fld);
|
---|
| 53 | printf(" curfet = $%lX\n", curfet);
|
---|
| 54 | printf(" csbp = $%lX\n", csbp);
|
---|
| 55 | printf(" cratex = $%lX\n", cratex);
|
---|
| 56 | printf(" cratey = $%lX\n", cratey);
|
---|
| 57 | printf(" cmtype = %d\n", cmtype);
|
---|
| 58 | printf(" cxval = %d\n", cxval);
|
---|
| 59 | printf(" cyval = %d\n", cyval);
|
---|
| 60 | printf("\n");
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | #endif
|
---|
| 64 |
|
---|
| 65 | /*
|
---|
| 66 | =============================================================================
|
---|
| 67 | stdctp0() -- cursor type - text, virtual
|
---|
| 68 | =============================================================================
|
---|
| 69 | */
|
---|
| 70 |
|
---|
[7258c6a] | 71 | int16_t stdctp0(void)
|
---|
[f40a309] | 72 | {
|
---|
| 73 | return(submenu ? CT_VIRT : CT_TEXT);
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | /*
|
---|
| 77 | =============================================================================
|
---|
| 78 | stdctp1() -- cursor type -- graphic, text, virtual -- text if > curslim
|
---|
| 79 | =============================================================================
|
---|
| 80 | */
|
---|
| 81 |
|
---|
[7258c6a] | 82 | int16_t stdctp1(void)
|
---|
[f40a309] | 83 | {
|
---|
| 84 | if (submenu)
|
---|
| 85 | return(CT_VIRT);
|
---|
| 86 |
|
---|
| 87 | return((cyval > curslim) ? CT_TEXT : CT_GRAF);
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | /*
|
---|
| 91 | =============================================================================
|
---|
| 92 | stdctp2() -- cursor type -- graphic
|
---|
| 93 | =============================================================================
|
---|
| 94 | */
|
---|
| 95 |
|
---|
[7258c6a] | 96 | int16_t stdctp2(void)
|
---|
[f40a309] | 97 | {
|
---|
| 98 | return(CT_GRAF);
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | /*
|
---|
| 102 | =============================================================================
|
---|
| 103 | stdctp3() -- cursor type -- graphic, score text, virtual
|
---|
| 104 | =============================================================================
|
---|
| 105 | */
|
---|
| 106 |
|
---|
[7258c6a] | 107 | int16_t stdctp3(void)
|
---|
[f40a309] | 108 | {
|
---|
| 109 | if (submenu)
|
---|
| 110 | return(CT_VIRT);
|
---|
| 111 |
|
---|
| 112 | return(((cyval < 14) OR (cyval > 237)) ? CT_SCOR : CT_GRAF);
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | /*
|
---|
| 116 | =============================================================================
|
---|
| 117 | stdctp4() -- cursor type -- graphic, text, virtual -- text if < curslim
|
---|
| 118 | =============================================================================
|
---|
| 119 | */
|
---|
| 120 |
|
---|
[7258c6a] | 121 | int16_t stdctp4(void)
|
---|
[f40a309] | 122 | {
|
---|
| 123 | if (submenu)
|
---|
| 124 | return(CT_VIRT);
|
---|
| 125 |
|
---|
| 126 | return((cyval < curslim) ? CT_TEXT : CT_GRAF);
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | =============================================================================
|
---|
| 131 | stdctp5() -- cursor type - text, virtual - character objects
|
---|
| 132 | =============================================================================
|
---|
| 133 | */
|
---|
| 134 |
|
---|
[7258c6a] | 135 | int16_t stdctp5(void)
|
---|
[f40a309] | 136 | {
|
---|
| 137 | return(submenu ? CT_MENU : CT_SMTH);
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | /*
|
---|
| 141 | =============================================================================
|
---|
| 142 | curset() -- setup the cursor control and data entry parameters
|
---|
| 143 | =============================================================================
|
---|
| 144 | */
|
---|
| 145 |
|
---|
[0580615] | 146 | void curset(struct curpak *s)
|
---|
[f40a309] | 147 | {
|
---|
| 148 | #if DEBUGIT
|
---|
| 149 | if (debugsw AND debugcs)
|
---|
| 150 | printf("curset($%lX): ENTRY old cmtype=%d\n", s, cmtype);
|
---|
| 151 | #endif
|
---|
| 152 |
|
---|
| 153 | curtype = s->curtype;
|
---|
| 154 | premove = s->premove;
|
---|
| 155 | pstmove = s->pstmove;
|
---|
| 156 |
|
---|
| 157 | curmove = cmvgen;
|
---|
| 158 |
|
---|
| 159 | if (trkonly) {
|
---|
| 160 |
|
---|
| 161 | cx_key = txstd;
|
---|
| 162 | cy_key = tystd;
|
---|
| 163 |
|
---|
| 164 | } else {
|
---|
| 165 |
|
---|
| 166 | cx_key = s->cx_key;
|
---|
| 167 | cy_key = s->cy_key;
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | cx_upd = s->cx_upd;
|
---|
| 171 | cy_upd = s->cy_upd;
|
---|
| 172 | xy_up = s->xy_up;
|
---|
| 173 | xy_dn = s->xy_dn;
|
---|
| 174 | x_key = s->x_key;
|
---|
| 175 | e_key = s->e_key;
|
---|
| 176 | m_key = s->m_key;
|
---|
| 177 | d_key = s->d_key;
|
---|
| 178 | not_fld = s->not_fld;
|
---|
| 179 | curfet = s->curfet;
|
---|
| 180 | csbp = s->csbp;
|
---|
| 181 | cratex = s->cratex;
|
---|
| 182 | cratey = s->cratey;
|
---|
| 183 | cmtype = s->cmtype;
|
---|
| 184 | cxval = s->cxval;
|
---|
| 185 | cyval = s->cyval;
|
---|
| 186 |
|
---|
| 187 | #if DEBUGIT
|
---|
| 188 | if (debugsw AND debugcs)
|
---|
| 189 | printf("curset($%lX): new cmtype=%d\n", s, cmtype);
|
---|
| 190 | #endif
|
---|
| 191 |
|
---|
[fa38804] | 192 |
|
---|
[f40a309] | 193 | if (cmtype EQ CT_GRAF) { /* graphics */
|
---|
| 194 |
|
---|
| 195 | chtime = hcwval;
|
---|
| 196 | cvtime = vcwval;
|
---|
| 197 |
|
---|
| 198 | } else { /* text of some sort */
|
---|
| 199 |
|
---|
| 200 | chtime = thcwval;
|
---|
| 201 | cvtime = (cmtype EQ CT_SMTH) ? syrate : tvcwval;
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | stccol = XTOC(cxval);
|
---|
| 205 | stcrow = YTOR(cyval);
|
---|
| 206 |
|
---|
| 207 | chwait = chtime;
|
---|
| 208 | cvwait = cvtime;
|
---|
| 209 |
|
---|
| 210 | nchwait = curhold;
|
---|
| 211 | ncvwait = curhold;
|
---|
| 212 |
|
---|
| 213 | cmfirst = TRUE;
|
---|
| 214 |
|
---|
| 215 | ebflag = FALSE;
|
---|
| 216 | memset(ebuf, '\0', sizeof ebuf);
|
---|
| 217 |
|
---|
| 218 | cfetp = (struct fet *)NULL;
|
---|
| 219 | infetp = (struct fet *)NULL;
|
---|
| 220 |
|
---|
| 221 | #if DEBUGIT
|
---|
| 222 | if (debugsw AND debugcs) {
|
---|
| 223 |
|
---|
| 224 | printf("curset($%lX): EXIT cmtype=%d=%s chtime=%d cvtime=%d curhold=%d\n",
|
---|
| 225 | s, cmtype,
|
---|
| 226 | (cmtype < 6) ? C_TYPE[cmtype] : "UNKNOWN",
|
---|
| 227 | chtime, cvtime, curhold);
|
---|
| 228 |
|
---|
| 229 | SnapCT();
|
---|
| 230 | }
|
---|
| 231 | #endif
|
---|
| 232 |
|
---|
| 233 | }
|
---|
[6262b5c] | 234 |
|
---|