original 1.0.1 release
[xwelltris.git] / src / include / welltris.h
blobaeec4931308b772c18a640c3b87d4e5eb2beef58
1 #ifndef WELLTRIS_H
2 #define WELLTRIS_H
3 /*
4 # GENERIC X-BASED WELLTRIS
6 # welltris.h
8 #
9 # C++ implementation by Leo Khramov, leo@xnc.dubna.su
13 /*** random number generator ***/
15 /* insert your favorite */
16 extern void SetRNG(long);
17 extern long LongRNG();
18 #define SRAND(X) SetRNG((long) X)
19 #define LRAND() LongRNG()
21 #define NRAND(X) ((int)(LRAND()%(X)))
23 /*** macros ***/
25 #define ZLIM(X, Y) (((int) X) < (Y) ? ((int) X) : (Y))
27 /*** constants ***/
29 #ifndef SCOREFILE
30 #define SCOREFILE "welltris.scores"
31 #endif
32 #ifndef POLYOMINOFILE
33 #define POLYOMINOFILE "polyomino.dat"
34 #endif
36 #define XWELL_DIR ".xwelltris"
37 #define RC_FILE "xwelltris.rc"
39 #define BVOLUME -90
40 #define NUM_FLASHES 5
42 #define SAMPLERATE 5000000
43 #define FLUSH_DELAY 100000
45 #define MILLION 1000000
46 #define PLAYER_NAME_LEN 15
47 #define TOP_NINE 9
48 #define L_DATE 11
50 #define NUM_LEVELS 19
54 #define MAX_WIDTH 8
55 #define MAX_DEPTH 12
56 #define MAX_SIDES 4
57 #define MAX_PERIMETER (MAX_SIDES*MAX_WIDTH)
60 #define EMPTY (-1)
61 #define NODIAG 0 /* Normal, ie no diagonals */
62 #define DIAGONAL 1 /* Normal and diagonal */
63 #define NOMIX 0 /* Do not mix lowered number squares with current */
64 #define MIXED 1
65 #define MAX_MODES 2
66 #define NONE 0 /* No rotation or reflection */
67 #define NOREFL 1 /* Normal, no reflection allow rotation */
68 #define ALL 2 /* Allow reflection or rotation */
69 #define MAX_TYPES 3
70 #define DEFAULT_SQUARES 4
71 #define MIN_SQUARES 2 /* Why not 1 you say? */
72 #define MAX_SQUARES 6
73 #define TOTAL_SQUARES (MAX_SQUARES - MIN_SQUARES + 1)
74 #define DEFAULT_DIAGONAL 3
75 #define MIN_DIAGONAL 2
76 #define MAX_DIAGONAL 3
77 #define MAX_POLYOMINOES 216
78 #define MAX_START_POLYOMINOES 55
79 #define JUMPIN 0
80 #define GRADUAL 1
81 #define LEGAL(n,g,m,o) ((n>=MIN_SQUARES+m)&&\
82 (n<=((g)?MAX_DIAGONAL:MAX_SQUARES)-o))
83 #define THRESHOLD(x) ((x)*(x)*4-(x)+1)
84 #define CHECKUP(x) ((x)%8)
85 #define CHECKRIGHT(x) (((x)/8)*8+(x)%4)
86 #define CHECKDOWN(x) (((x)/4)*4+(x)%2)
87 #define CHECKLEFT(x) (((x)/2)*2)
89 /*** types ***/
91 enum Actions {
92 NOTHING,
93 FALL,
94 DROP,
95 LEFT,
96 RIGHT,
97 ROTATE,
98 REFLECT,
99 PAUSE_GAME,
100 END_GAME,
101 OUTER_ROTATION,
102 INNER_ROTATION,
103 LEVEL_UP,
104 LEVEL_DOWN
107 #define SYSCOLORS 7
108 #define MAX_GAME_COLORS (MAX_START_POLYOMINOES+SYSCOLORS)
109 #define COLOR_DELTA MAX_START_POLYOMINOES
110 #define FREE_COLORS (255 - 211 - SYSCOLORS)
111 enum Colors {BackColor=COLOR_DELTA,
112 GridColor=COLOR_DELTA+1,
113 GridColor2=COLOR_DELTA+2,
114 FreezeColor=COLOR_DELTA+3,
115 FlashColor=COLOR_DELTA+4,
116 BonusColor=COLOR_DELTA+5,
117 BonusColor2=COLOR_DELTA+6};
120 enum Images {
121 imNone=-1,
122 imBoardBG=0,
123 imIntroBG=1,
124 imCuts=2,
125 imScoreBG=3,
126 imFont1=4 };
129 #define MAX_IMAGES 20
132 #define NEXT_CENTER_X 700
133 #define NEXT_CENTER_Y 519
134 #define NEXT_BOX_SIZE 15
135 #define NEXT_X_SIZE 120
136 #define NEXT_Y_SIZE 120
138 //scores region in the game
139 #define SCORE_REG_X 638
140 #define SCORE_REG_Y 112
141 #define SCORE_REG_L 126
142 #define SCORE_REG_H 30
144 //Lines region in the game
145 #define LINES_REG_X 775-5*11
146 #define LINES_REG_Y 172
147 #define LINES_REG_L 55
148 #define LINES_REG_H 17
150 //Level up region in the game
151 #define LEVUP_REG_X 775-4*11
152 #define LEVUP_REG_Y 212
153 #define LEVUP_REG_L 44
154 #define LEVUP_REG_H 17
156 //Level region in the game
157 #define LEVEL_REG_X 775-3*11
158 #define LEVEL_REG_Y 252
159 #define LEVEL_REG_L 33
160 #define LEVEL_REG_H 17
162 //Challengers region in the game
163 #define CHAL1_REG_X 613
164 #define CHAL1_REG_Y 333
165 #define CHAL2_REG_X 613
166 #define CHAL2_REG_Y 358
167 #define CHAL3_REG_X 613
168 #define CHAL3_REG_Y 382
169 #define CHAL_REG_L 12*15
170 #define CHAL_REG_H 17
172 //Top nine text
173 #define TOPNINE_TXT_X 30
174 #define TOPNINE_TXT_Y 140
175 #define TOPNINE_TXT_L 750
176 #define TOPNINE_TXT_H 22
177 #define TOPNINE_TXT_STEPY 42
179 //challengers display name len in symbols
180 #define CHAL_NAME_LEN 9
182 //game view and other
183 #define VIEW_X 30
184 #define VIEW_Y 30
185 #define VIEW_L 540
186 #define VIEW_H 540
188 #define NUM_ROT_STEPS 8
190 //Font sizes, delta ...
191 #define FONT1_L 10
192 #define FONT1_H 18
193 #define FONT1_DX 0
194 #define FONT1_DY 0
196 #define FONT2_L 19
197 #define FONT2_H 30
198 #define FONT2_DX 12
199 #define FONT2_DY 0
201 #define FONT3_L 15
202 #define FONT3_H 23
203 #define FONT3_DX 30
204 #define FONT3_DY 0
206 #define FONT4_L 15
207 #define FONT4_H 24
208 #define FONT4_DX 45
209 #define FONT4_DY 0
211 #define FONT5_L 15
212 #define FONT5_H 24
213 #define FONT5_DX 65
214 #define FONT5_DY 0
217 #define GEO_NAME 20
219 //Game geo idexes for wellbase
220 #define GEO_PAUSE_IDX 0
221 #define GEO_ROT_IDX 1
222 #define GEO_NEXT_IDX 2
223 #define GEO_MIXED_IDX 3
225 #endif