Subversion Repositories Kolibri OS

Rev

Rev 1003 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1003 Rev 1006
Line 1... Line 1...
1
/*
1
/*
2
Just Clicks v0.75
2
Just Clicks v0.76
3
Copyright (C) 2008 Leency
3
Copyright (C) 2008 Leency
4
Clickomania v0.3
4
Clickomania v0.3
5
Copyright (C) 2005 €«¥ªá ­¤à Œã訪®¢ aka Olaf
5
Copyright (C) 2005 €«¥ªá ­¤à Œã訪®¢ aka Olaf
6
Compiled by C--Sphinx v0.239 b26
6
Compiled by C--Sphinx v0.239 b26
7
*/
7
*/
Line 23... Line 23...
23
  byte mark;
23
  byte mark;
24
  dword color;
24
  dword color;
25
}matrix[64];
25
}matrix[64];
Line 26... Line -...
26
 
-
 
27
 
26
 
28
 
27
 
29
void destroy_button(byte ID)
28
void check_n_destroy(byte ID, ID1)
30
{
29
{
31
	IF (matrix[ID-8].color == matrix[ID].color) && (matrix[ID-8].mark!=1)
30
	IF (matrix[ID1].color == matrix[ID].color) && (matrix[ID1].mark!=1)
32
	{
31
	{
33
		matrix[ID-8].mark=1;
32
		matrix[ID1].mark=1;
34
		destroy_button(ID-8);
-
 
35
	}
-
 
36
	IF (matrix[ID+8].color == matrix[ID].color) && (matrix[ID+8].mark!=1)
-
 
37
	{
-
 
38
		matrix[ID+8].mark=1;
33
		destroy_button(ID1);
39
		destroy_button(ID+8);
-
 
-
 
34
	}
-
 
35
}
40
	}
36
 
41
	IF (ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56)
37
 
42
    && (matrix[ID-1].color == matrix[ID].color) && (matrix[ID-1].mark!=1)
38
void destroy_button(byte ID)
43
	{
39
{
-
 
40
	check_n_destroy(ID, ID-8);
44
		matrix[ID-1].mark=1;
41
	check_n_destroy(ID, ID+8);
45
		destroy_button(ID-1);
42
		IF (ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56)
46
    }
-
 
47
	IF (ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63)
-
 
48
	&& (matrix[ID+1].color == matrix[ID].color) && (matrix[ID+1].mark!=1)
-
 
49
	{
43
	check_n_destroy(ID, ID-1);
50
		matrix[ID+1].mark=1;
44
		IF (ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63)
51
		destroy_button(ID+1);
45
	check_n_destroy(ID, ID+1);
52
	}
46
 
53
	IF (matrix[ID].xYY) YY=matrix[ID].y;}
47
	IF (matrix[ID].xYY) YY=matrix[ID].y;}
Line -... Line 48...
-
 
48
	IF (matrix[ID].y>YY) {YY=matrix[ID].y;  IF (matrix[ID].x
54
	IF (matrix[ID].y>YY) {YY=matrix[ID].y;  IF (matrix[ID].x
49
}
55
}
50
 
56
 
51
 
57
void shift_bars(byte AA, BB)
52
void shift_bars(byte AA, BB)
58
byte id_curr,id_next,bz;
53
byte id_curr,id_next,bz;
Line 126... Line 121...
126
			DeleteButton(i*8+j);
121
			DeleteButton(i*8+j);
127
			matrix[num].x=j;
122
			matrix[num].x=j;
128
			matrix[num].y=i;
123
			matrix[num].y=i;
129
			IF (matrix[num].mark==0)
124
			IF (matrix[num].mark==0)
130
				{
125
				{
131
				DefineButton(j*21+5,y-22, 20, 20, num+BT_HIDE, 0);
126
				DefineButton(j*21,y-22, 20, 20, num+BT_HIDE, 0);
132
				PutImage(matrix[num].color-1*1323+#img,21,21,j*21+5,y-22);
127
				PutImage(matrix[num].color-1*1323+#img,21,21,j*21,y-22);
133
				}	ELSE DrawBar(j*21+5,y-22,21,21, 0xB2B4BF);
128
				}	ELSE DrawBar(j*21,y-22,21,21, 0xB2B4BF);
134
			num++;
129
			num++;
135
		}
130
		}
136
		y=y+21;
131
		y=y+21;
137
	}
132
	}
138
	DrawBar(95,178,71,8,0xE4DFE1);
133
	DrawBar(90,178,71,8,0xE4DFE1);
139
	IF (check_for_end()==1) WriteText(95,178,0x80,0,"¥§ã«ìâ â:",10);
134
	IF (check_for_end()==1) WriteText(90,178,0x80,0,"¥§ã«ìâ â:",10);
140
	ELSE WriteText(101,178,0x80,0,"Žáâ «®áì:",10);
135
	ELSE WriteText(96,178,0x80,0,"Žáâ «®áì:",10);
141
	FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++;
136
	FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++;
142
	WriteText(155,178,0x80,0,IntToStr(count_blocks),0);
137
	WriteNumber(150,178,0x80,0,count_blocks);
143
	//
138
	//
144
	if (check_for_end()==1) && (count_blocks<8)
139
	if (check_for_end()==1) && (count_blocks<8)
145
	{
140
	{
146
		DrawFlatButton(26,42,125,62,0,0xE4DFE1,"");
141
		DrawFlatButton(21,42,125,62,0,0xE4DFE1,"");
147
		IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp);  
142
		IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp);  
148
		IF (count_blocks==1) copystr("  à¥ªà á­®", #temp);
143
		IF (count_blocks==1) copystr("  à¥ªà á­®", #temp);
149
		IF (count_blocks==2) copystr("Žç¥­ì å®à®è®!", #temp);
144
		IF (count_blocks==2) copystr("Žç¥­ì å®à®è®!", #temp);
150
		IF (count_blocks>=3) //¡ £!!!
145
		IF (count_blocks>=3) //¡ £!!!
151
		{
146
		{
152
			copystr("   ¥¯«®å®", #temp);
147
			copystr("   ¥¯«®å®", #temp);
153
			count_blocks=3;
148
			count_blocks=3;
154
		}
149
		}
155
		PutImage(count_blocks*42*37*3+#cups,42,37,68,48);
150
		PutImage(count_blocks*42*37*3+#cups,42,37,63,48);
156
		WriteText(51,91,0x80,0x0,#temp,0);
151
		WriteText(46,91,0x80,0x0,#temp,0);
157
	}
152
	}
158
}
153
}
Line 159... Line 154...
159
 
154
 
160
 
155
 
161
void main()
156
void main()
162
{	byte id;
157
{	byte id, skin_width;
163
	randomize();
158
	randomize();
164
	ReDraw_Blocks(1);
159
	ReDraw_Blocks(1);
165
	loop()
160
	loop()
166
	{
161
	{
-
 
162
		switch(WaitEvent())
167
		switch(WaitEvent())
163
		{
-
 
164
			CASE evKey:
168
		{
165
				IF (GetKey()==051) ReDraw_Blocks(1); //New game
169
			CASE evKey: IF (GetKey()==051) ReDraw_Blocks(1); break; //New game
166
				break;
170
			CASE evButton:
167
			CASE evButton:
171
				id=GetButtonID();
168
				id=GetButtonID();
172
				IF (id==255) ExitProcess();
169
				IF (id==255) ExitProcess();
173
				IF (id==254) {ReDraw_Blocks(1); break;} //New game
170
				IF (id==254) ReDraw_Blocks(1); //New game
174
				IF (id<65) IF (check_for_end()<>1)
171
				IF (id<65) //Color Button
175
					{ 	//if Button
172
				{ 	
176
     					destroy_button(id);
173
     				destroy_button(id);
177
						IF (XX!=9)
174
					IF (XX!=9)
178
						{
175
					{
179
							shift_bars(XX,YY);
176
						shift_bars(XX,YY);
180
							IF (YY == 7) {move_it();move_it();}
177
						IF (YY==7) {move_it();move_it();}
181
							XX=9;
178
						XX=9;
182
							YY=0;
179
						YY=0;
183
							ReDraw_Blocks(0);
-
 
184
						}
180
						ReDraw_Blocks(0);
-
 
181
					}
185
					 	break;
182
				}    
186
					}    
183
				break;
187
			case evReDraw:
184
			case evReDraw:
188
				WindowRedrawStatus(1);
185
				WindowRedrawStatus(1);
189
				skin_width = GetSkinWidth();
186
				skin_width = GetSkinWidth();
190
				DefineAndDrawWindow(400,276,177,201+skin_width,0x44,0x10B2B4BF,0,0,"Just Clicks v0.75");
187
				DefineAndDrawWindow(400,276,177,201+skin_width,0x74,0x10B2B4BF,0,0,"Just Clicks v0.76");
191
				//DefineButton(155,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00);
188
				DefineButton(150,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00);
192
				DrawBar(5,168,168,29,0xE4DFE1);
189
				DrawBar(0,168,168,29,0xE4DFE1);
193
				//DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)");
190
				//DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)");
194
				DrawFlatButton(9,172,80,19,254,0xE4DFE1,"‡ ­®¢® (F2)");
191
				DrawFlatButton(4,172,80,19,254,0xE4DFE1,"‡ ­®¢® (F2)");
195
				ReDraw_Blocks(0);
192
				ReDraw_Blocks(0);
196
				WindowRedrawStatus(2);
193
				WindowRedrawStatus(2);
197
		}
194
		}