Rev 778 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 778 | Rev 1003 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | Just Clicks v0.6 |
2 | Just Clicks v0.75 |
3 | Copyright (C) 2008 Leency & Veliant |
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 8... | Line 8... | ||
8 | 8 | ||
9 | #pragma option meos |
- | |
10 | #jumptomain NONE |
9 | #pragma option meos |
11 | #include "lib\kolibri.h--" |
10 | #include "lib\kolibri.h--" |
- | 11 | #include "lib\random.h--" |
|
12 | #include "lib\random.h--" |
12 | #include "files\boxes.txt" |
Line -... | Line 13... | ||
- | 13 | #include "files\cups.txt" |
|
13 | #include "img.txt" |
14 | |
Line 14... | Line 15... | ||
14 | 15 | ||
15 | byte i, need_redraw, XX, YY; |
16 | byte i,j, XX, YY; |
16 | 17 | ||
17 | struct |
18 | struct |
18 | { |
19 | { |
19 | byte x; |
20 | byte x; |
20 | byte y; |
21 | byte y; |
21 | byte button_id; |
22 | byte button_id; |
Line 22... | Line 23... | ||
22 | byte mark; |
23 | byte mark; |
- | 24 | dword color; |
|
- | 25 | }matrix[64]; |
|
23 | dword color; |
26 | |
24 | }matrix[8*8]; |
- | |
25 | 27 | ||
26 | - | ||
27 | 28 | ||
28 | void destroy_button(dword ID) |
29 | void destroy_button(byte ID) |
29 | { |
30 | { |
- | 31 | IF (matrix[ID-8].color == matrix[ID].color) && (matrix[ID-8].mark!=1) |
|
30 | IF ((matrix[ID-8].color == matrix[ID].color)&&(matrix[ID-8].mark!=1)){ |
32 | { |
31 | matrix[ID-8].mark=1; |
- | |
32 | need_redraw=1; |
33 | matrix[ID-8].mark=1; |
33 | destroy_button(ID-8); |
34 | destroy_button(ID-8); |
34 | } |
35 | } |
35 | IF ((matrix[ID+8].color == matrix[ID].color)&&(matrix[ID+8].mark!=1)){ |
36 | IF (matrix[ID+8].color == matrix[ID].color) && (matrix[ID+8].mark!=1) |
- | 37 | { |
|
36 | matrix[ID+8].mark=1; |
38 | matrix[ID+8].mark=1; |
37 | need_redraw=1; |
- | |
38 | destroy_button(ID+8); |
39 | destroy_button(ID+8); |
39 | } |
40 | } |
40 | IF ((ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56)) |
41 | IF (ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56) |
41 | IF ((matrix[ID-1].color == matrix[ID].color)&&(matrix[ID-1].mark!=1)){ |
42 | && (matrix[ID-1].color == matrix[ID].color) && (matrix[ID-1].mark!=1) |
- | 43 | { |
|
42 | matrix[ID-1].mark=1; |
44 | matrix[ID-1].mark=1; |
43 | need_redraw=1; |
- | |
44 | destroy_button(ID-1); |
45 | destroy_button(ID-1); |
45 | } |
46 | } |
46 | IF ((ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63)) |
47 | IF (ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63) |
47 | IF ((matrix[ID+1].color == matrix[ID].color)&&(matrix[ID+1].mark!=1)){ |
48 | && (matrix[ID+1].color == matrix[ID].color) && (matrix[ID+1].mark!=1) |
48 | matrix[ID+1].mark=1; |
49 | { |
Line 71... | Line 72... | ||
71 | matrix[id_next].mark=1; |
72 | matrix[id_next].mark=1; |
72 | } |
73 | } |
73 | } |
74 | } |
74 | } |
75 | } |
Line 75... | Line -... | ||
75 | - | ||
76 | byte count_blocks() |
- | |
77 | { |
- | |
78 | byte kol_vo=0; |
- | |
79 | FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) kol_vo++; |
- | |
80 | return kol_vo; |
- | |
81 | } |
- | |
82 | - | ||
83 | 76 | ||
84 | byte check_for_end () |
- | |
85 | byte id_next_two, id_next_one, crr; |
77 | byte check_for_end() |
- | 78 | { |
|
86 | { |
79 | byte id_next, id_curr; |
87 | for (j=0; j<8; j++) for (i=0; i<8; i++) |
80 | for (j=0; j<64; j+=8) for (i=0; i<8; i++) |
88 | { |
81 | { |
89 | crr=j*8+i; |
82 | id_curr=j+i; |
90 | id_next_one=crr+1; |
- | |
91 | id_next_two=j+1*8+i; |
83 | id_next=id_curr+1; |
92 | IF (matrix[crr].color==matrix[id_next_one].color)&&(matrix[crr].mark==0)&&(matrix[id_next_one].mark==0) return 0; |
84 | IF (matrix[id_curr].color==matrix[id_next].color)&&(matrix[id_curr].mark==0)&&(matrix[id_next].mark==0) return 0; |
93 | IF (matrix[crr].color==matrix[id_next_two].color)&&(matrix[crr].mark==0)&&(matrix[id_next_two].mark==0) return 0; |
85 | IF (matrix[id_curr].color==matrix[id_next+7].color)&&(matrix[id_curr].mark==0)&&(matrix[id_next+7].mark==0) return 0; |
94 | } |
86 | } |
95 | return 1; |
87 | return 1; |
Line 96... | Line 88... | ||
96 | } |
88 | } |
97 | 89 | ||
98 | void move_it () |
90 | void move_it() |
99 | byte but_id_curr,but_id_next, count, x; |
91 | byte but_id, count, x; |
100 | { |
92 | { |
101 | for (x=0;x<8;x++) |
93 | for (x=0;x<8;x++) |
102 | { |
94 | { |
103 | count = 0; |
95 | count = 0; |
104 | FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++; |
96 | FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++; |
105 | if (count == 8) for (i=0;i<8;i++) |
97 | if (count == 8) FOR (i=0;i<8;i++) |
106 | { |
98 | { |
107 | XX=x; |
99 | XX=x; |
108 | WHILE (XX<7) |
100 | WHILE (XX<7) |
109 | { |
- | |
110 | but_id_curr=i*8+XX; |
101 | { |
111 | but_id_next=i*8+XX+1; |
102 | but_id=i*8+XX; |
112 | matrix[but_id_curr].mark=matrix[but_id_next].mark; |
- | |
113 | matrix[but_id_curr].color=matrix[but_id_next].color; |
103 | matrix[but_id].mark=matrix[but_id+1].mark; |
114 | matrix[but_id_next].mark=1; |
104 | matrix[but_id].color=matrix[but_id+1].color; |
115 | IF (XX+1 == 7) matrix[but_id_next].mark=1; |
105 | IF (XX == 6) matrix[but_id+1].mark=1; |
116 | XX++; |
106 | XX++; |
117 | } |
107 | } |
118 | } |
108 | } |
Line 119... | Line -... | ||
119 | } |
- | |
120 | } |
- | |
121 | - | ||
122 | - | ||
123 | void main() |
- | |
124 | { dword id; |
- | |
125 | randomize(); |
- | |
126 | skin_width = GetSkinWidth(); |
- | |
127 | ReDraw_Blocks(1); |
- | |
128 | loop() |
- | |
129 | { |
- | |
130 | switch(WaitEvent()) |
- | |
131 | { |
- | |
132 | CASE evButton: |
- | |
133 | id=GetButtonID(); |
- | |
134 | IF (id==600) {ExitProcess(); break;} |
- | |
135 | ELSE IF (id==500) {ReDraw_Blocks(1);break;} |
- | |
136 | ELSE { |
- | |
137 | destroy_button(id); |
- | |
138 | IF (XX!=9)&&(need_redraw==1) |
- | |
139 | { |
- | |
140 | shift_bars(XX,YY); |
- | |
141 | IF (YY == 7) {move_it();move_it();} |
- | |
142 | XX=9; |
- | |
143 | YY=0; |
- | |
144 | ReDraw_Blocks(0); |
- | |
145 | } |
- | |
146 | break; |
- | |
147 | } |
- | |
148 | case evKey: IF (GetKey()==051) ReDraw_Blocks(1); break;//New game |
- | |
149 | case evReDraw: draw_window(); break; |
- | |
150 | } |
- | |
151 | } |
109 | } |
152 | ExitProcess(); |
110 | } |
153 | } |
111 | |
154 | - | ||
155 | void ReDraw_Blocks(dword newgame) |
112 | |
156 | { |
113 | void ReDraw_Blocks(byte newgame) |
157 | dword num=0, y; |
114 | { |
158 | y=skin_width; |
115 | byte num=0, y=22, count_blocks=0, temp[10]; |
159 | for (i=0;i<8;i++) |
116 | for (i=0;i<8;i++) |
160 | { |
117 | { |
161 | for (j=0;j<8;j++) |
118 | for (j=0;j<8;j++) |
162 | { |
119 | { |
163 | IF (newgame == 1) |
120 | IF (newgame) |
164 | { |
121 | { |
165 | matrix[num].mark=0; |
122 | matrix[num].mark=0; |
166 | XX=9; YY=0; |
123 | XX=9; YY=0; |
167 | matrix[num].color = random(5)+1; |
124 | matrix[num].color = random(5)+1; |
168 | } |
125 | } |
169 | DefineButton(1,1,1,1,i*8+j+BT_DEL,1); |
126 | DeleteButton(i*8+j); |
170 | matrix[num].x=j; |
127 | matrix[num].x=j; |
171 | matrix[num].y=i; |
128 | matrix[num].y=i; |
172 | IF (matrix[num].mark==0) |
129 | IF (matrix[num].mark==0) |
173 | { |
130 | { |
174 | DefineButton(j*21+5,y-22, 20, 20, num+BT_HIDE, matrix[num].color); |
131 | DefineButton(j*21+5,y-22, 20, 20, num+BT_HIDE, 0); |
175 | PutImage(matrix[num].color-1*21*21*3+#img,21,21,j*21+5,y-22); |
132 | PutImage(matrix[num].color-1*1323+#img,21,21,j*21+5,y-22); |
176 | } ELSE DrawBar(j*21+5,y-22,21,21, 0xB2B4BF); |
133 | } ELSE DrawBar(j*21+5,y-22,21,21, 0xB2B4BF); |
177 | num++; |
134 | num++; |
178 | } |
135 | } |
179 | y=y+21; |
136 | y=y+21; |
- | 137 | } |
|
180 | } |
138 | DrawBar(95,178,71,8,0xE4DFE1); |
- | 139 | IF (check_for_end()==1) WriteText(95,178,0x80,0,"¥§ã«ìâ â:",10); |
|
- | 140 | ELSE WriteText(101,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++; |
|
- | 142 | WriteText(155,178,0x80,0,IntToStr(count_blocks),0); |
|
- | 143 | // |
|
181 | EDI = 0x00E4DFE1; //梥⠯ ¥«¨ |
144 | if (check_for_end()==1) && (count_blocks<8) |
- | 145 | { |
|
- | 146 | DrawFlatButton(26,42,125,62,0,0xE4DFE1,""); |
|
- | 147 | IF (count_blocks==0) copystr(" ãçè¥ ¢á¥å!", #temp); |
|
- | 148 | IF (count_blocks==1) copystr(" ४à á®", #temp); |
|
182 | IF (check_for_end()==1) WriteText(95,178,0xC0,0x000000,"¥§ã«ìâ â:",10); //184 |
149 | IF (count_blocks==2) copystr("ç¥ì å®à®è®!", #temp); |
- | 150 | IF (count_blocks>=3) //¡ £!!! |
|
- | 151 | { |
|
- | 152 | copystr(" ¥¯«®å®", #temp); |
|
183 | ELSE WriteText(95,178,0xC0,0x000000," áâ «®áì:",10); |
153 | count_blocks=3; |
- | 154 | } |
|
- | 155 | PutImage(count_blocks*42*37*3+#cups,42,37,68,48); |
|
Line 184... | Line 156... | ||
184 | WriteText(155,178,0xC0,0x000000,IntToStr(count_blocks()),0); //«®ª®¢ ®áâ «®áì |
156 | WriteText(51,91,0x80,0x0,#temp,0); |
- | 157 | } |
|
- | 158 | } |
|
- | 159 | ||
- | 160 | ||
185 | IF (count_blocks()<10) DrawBar(161,178,6,8,0xE4DFE1); |
161 | void main() |
- | 162 | { byte id; |
|
- | 163 | randomize(); |
|
- | 164 | ReDraw_Blocks(1); |
|
- | 165 | loop() |
|
- | 166 | { |
|
- | 167 | switch(WaitEvent()) |
|
- | 168 | { |
|
- | 169 | CASE evKey: IF (GetKey()==051) ReDraw_Blocks(1); break; //New game |
|
- | 170 | CASE evButton: |
|
- | 171 | id=GetButtonID(); |
|
- | 172 | IF (id==255) ExitProcess(); |
|
- | 173 | IF (id==254) {ReDraw_Blocks(1); break;} //New game |
|
- | 174 | IF (id<65) IF (check_for_end()<>1) |
|
- | 175 | { //if Button |
|
- | 176 | destroy_button(id); |
|
- | 177 | IF (XX!=9) |
|
- | 178 | { |
|
- | 179 | shift_bars(XX,YY); |
|
- | 180 | IF (YY == 7) {move_it();move_it();} |
|
- | 181 | XX=9; |
|
- | 182 | YY=0; |
|
186 | need_redraw=0; |
183 | ReDraw_Blocks(0); |
- | 184 | } |
|
187 | } |
185 | break; |
188 | 186 | } |
|
189 | void draw_window() |
- | |
190 | { |
187 | case evReDraw: |
191 | WindowRedrawStatus(1); |
188 | WindowRedrawStatus(1); |
192 | DefineAndDrawWindow(300,176,177,201+skin_width,0x04,0x00B2B4BF,0,0,0); |
189 | skin_width = GetSkinWidth(); |
193 | DefineButton(155,2-skin_width,18,18,600+BT_HIDE+BT_NOFRAME,0x0866CC00); //ª®¯ª § ªàëâ¨ï |
- | |
194 | DrawTitle("Just Clicks v0.6 L&V"); |
190 | DefineAndDrawWindow(400,276,177,201+skin_width,0x44,0x10B2B4BF,0,0,"Just Clicks v0.75"); |
195 | DrawBar(5,168,168,29,0xE4DFE1); //¯®«¥ ᨧã |
191 | //DefineButton(155,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00); |
196 | DrawFlatButton(9,172,84,19,500,0xE4DFE1); //New E4DFE1 |
192 | DrawBar(5,168,168,29,0xE4DFE1); |
- | 193 | //DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)"); |
|
- | 194 | DrawFlatButton(9,172,80,19,254,0xE4DFE1," ®¢® (F2)"); |
|
Line 197... | Line 195... | ||
197 | WriteText(14,178,0x80,0,"New game (F2) ",14); |
195 | ReDraw_Blocks(0); |