4 # GENERIC X-BASED WELLTRIS
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)))
25 #define ZLIM(X, Y) (((int) X) < (Y) ? ((int) X) : (Y))
30 #define SCOREFILE "welltris.scores"
33 #define POLYOMINOFILE "polyomino.dat"
36 #define XWELL_DIR ".xwelltris"
37 #define RC_FILE "xwelltris.rc"
42 #define SAMPLERATE 5000000
43 #define FLUSH_DELAY 100000
45 #define MILLION 1000000
46 #define PLAYER_NAME_LEN 15
57 #define MAX_PERIMETER (MAX_SIDES*MAX_WIDTH)
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 */
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 */
70 #define DEFAULT_SQUARES 4
71 #define MIN_SQUARES 2 /* Why not 1 you say? */
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
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)
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};
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
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
188 #define NUM_ROT_STEPS 8
190 //Font sizes, delta ...
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