source: buchla-68k/ram/select.c@ b28a12e

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

Zero redundant declarations.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 =============================================================================
3 select.c -- field selection processing
4 Version 9 -- 1988-12-13 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12#if DEBUGIT
13short debugsf = 1;;
14#endif
15
16/*
17 =============================================================================
18 whatbox() -- determine which selection box a hit occured in
19 =============================================================================
20*/
21
22int16_t whatbox(void)
23{
24 register struct selbox *sb;
25
26 sb = csbp;
27 hitbox = -1;
28
29#if DEBUGIT
30 if (debugsw AND debugsf)
31 printf("whatbox(): ENTRY cxval=%d cyval=%d cursbox=%d csbp=$%lX\n",
32 cxval, cyval, cursbox, csbp);
33#endif
34
35 if (0L EQ sb)
36 return(FALSE);
37
38 while (sb->boxhit) {
39
40 hitbox++;
41
42 if ((cxval GE sb->sbxmin) AND
43 (cxval LE sb->sbxmax) AND
44 (cyval GE sb->sbymin) AND
45 (cyval LE sb->sbymax)) {
46
47 hitcx = cxval;
48 hitcy = cyval;
49 curboxp = sb;
50
51#if DEBUGIT
52 if (debugsw AND debugsf)
53 printf("whatbox(): HIT hitbox=%d, curboxp=$%lX, sbarg=$%04.4X\n",
54 hitbox, curboxp, sb->sbarg);
55#endif
56
57 return(TRUE);
58 }
59
60 sb++;
61 }
62
63#if DEBUGIT
64 if (debugsw AND debugsf)
65 printf("whatbox(): FAILED\n");
66#endif
67
68 hitbox = -1;
69 return(FALSE);
70}
71
72/*
73
74*/
75
76/*
77 =============================================================================
78 select() -- standard item selection processing
79 =============================================================================
80*/
81
82void select(void)
83{
84 if (astat) { /* only when the E key goes down */
85
86#if DEBUGIT
87 if (debugsw AND debugsf)
88 printf("select(): ENTRY\n");
89#endif
90
91 if (whatbox()) { /* see if we're in a box */
92
93#if DEBUGIT
94 if (debugsw AND debugsf)
95 printf("select(): HIT hitbox = %d curboxp $%lX\n",
96 hitbox, curboxp);
97#endif
98
99 (*curboxp->boxhit)(curboxp->sbarg); /* process it */
100 cursbox = hitbox;
101
102 } else {
103
104#if DEBUGIT
105 if (debugsw AND debugsf)
106 printf("select(): FAILED\n");
107#endif
108
109 }
110 }
111}
112
Note: See TracBrowser for help on using the repository browser.