2008-03-25 11:09:54 +01:00
|
|
|
|
/*
|
2009-01-28 16:20:29 +01:00
|
|
|
|
Just Clicks v0.76
|
2009-01-28 05:28:31 +01:00
|
|
|
|
Copyright (C) 2008 Leency
|
2008-03-25 11:09:54 +01:00
|
|
|
|
Clickomania v0.3
|
|
|
|
|
Copyright (C) 2005 <20><><EFBFBD><EFBFBD>ᠭ<EFBFBD><E1A0AD> <20><>訪<EFBFBD><E8A8AA> aka Olaf
|
|
|
|
|
Compiled by C--Sphinx v0.239 b26
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma option meos
|
|
|
|
|
#include "lib\kolibri.h--"
|
|
|
|
|
#include "lib\random.h--"
|
2009-01-28 05:28:31 +01:00
|
|
|
|
#include "files\boxes.txt"
|
|
|
|
|
#include "files\cups.txt"
|
2011-01-27 13:34:09 +01:00
|
|
|
|
|
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
2009-01-28 05:28:31 +01:00
|
|
|
|
|
|
|
|
|
byte i,j, XX, YY;
|
2011-01-27 13:34:09 +01:00
|
|
|
|
system_colors sc;
|
2008-03-25 11:09:54 +01:00
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
byte x;
|
|
|
|
|
byte y;
|
|
|
|
|
byte button_id;
|
|
|
|
|
byte mark;
|
|
|
|
|
dword color;
|
2009-01-28 05:28:31 +01:00
|
|
|
|
}matrix[64];
|
2008-03-25 11:09:54 +01:00
|
|
|
|
|
|
|
|
|
|
2009-01-28 16:20:29 +01:00
|
|
|
|
void check_n_destroy(byte ID, ID1)
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
2009-01-28 16:20:29 +01:00
|
|
|
|
IF (matrix[ID1].color == matrix[ID].color) && (matrix[ID1].mark!=1)
|
2009-01-28 05:28:31 +01:00
|
|
|
|
{
|
2009-01-28 16:20:29 +01:00
|
|
|
|
matrix[ID1].mark=1;
|
|
|
|
|
destroy_button(ID1);
|
2009-01-28 05:28:31 +01:00
|
|
|
|
}
|
2009-01-28 16:20:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void destroy_button(byte ID)
|
|
|
|
|
{
|
|
|
|
|
check_n_destroy(ID, ID-8);
|
|
|
|
|
check_n_destroy(ID, ID+8);
|
|
|
|
|
IF (ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56)
|
|
|
|
|
check_n_destroy(ID, ID-1);
|
|
|
|
|
IF (ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63)
|
|
|
|
|
check_n_destroy(ID, ID+1);
|
|
|
|
|
|
2009-01-28 05:28:31 +01:00
|
|
|
|
IF (matrix[ID].x<XX) {XX=matrix[ID].x; IF (matrix[ID].y>YY) YY=matrix[ID].y;}
|
|
|
|
|
IF (matrix[ID].y>YY) {YY=matrix[ID].y; IF (matrix[ID].x<XX) XX=matrix[ID].x;}
|
2008-03-25 11:09:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-28 16:20:29 +01:00
|
|
|
|
|
2008-03-25 11:09:54 +01:00
|
|
|
|
void shift_bars(byte AA, BB)
|
|
|
|
|
byte id_curr,id_next,bz;
|
|
|
|
|
{
|
|
|
|
|
for (j=AA;j<8;j++) for (i=BB; i>0; i--)
|
|
|
|
|
{
|
|
|
|
|
id_curr=i*8+j;
|
|
|
|
|
bz=i-1;
|
|
|
|
|
_HH:
|
|
|
|
|
id_next=bz*8+j;
|
|
|
|
|
IF (matrix[id_curr].mark == 1)
|
|
|
|
|
IF (bz>0)&&(matrix[id_next].mark == 1) {bz--; GOTO _HH;}
|
|
|
|
|
ELSE IF (matrix[id_next].mark == 0)
|
|
|
|
|
{
|
|
|
|
|
matrix[id_curr].color=matrix[id_next].color;
|
|
|
|
|
matrix[id_curr].mark=matrix[id_next].mark;
|
|
|
|
|
matrix[id_next].mark=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-28 05:28:31 +01:00
|
|
|
|
byte check_for_end()
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
2009-01-28 05:28:31 +01:00
|
|
|
|
byte id_next, id_curr;
|
|
|
|
|
for (j=0; j<64; j+=8) for (i=0; i<8; i++)
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
2009-01-28 05:28:31 +01:00
|
|
|
|
id_curr=j+i;
|
|
|
|
|
id_next=id_curr+1;
|
|
|
|
|
IF (matrix[id_curr].color==matrix[id_next].color)&&(matrix[id_curr].mark==0)&&(matrix[id_next].mark==0) return 0;
|
|
|
|
|
IF (matrix[id_curr].color==matrix[id_next+7].color)&&(matrix[id_curr].mark==0)&&(matrix[id_next+7].mark==0) return 0;
|
2008-03-25 11:09:54 +01:00
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-28 05:28:31 +01:00
|
|
|
|
void move_it()
|
|
|
|
|
byte but_id, count, x;
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
|
|
|
|
for (x=0;x<8;x++)
|
|
|
|
|
{
|
|
|
|
|
count = 0;
|
|
|
|
|
FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++;
|
2009-01-28 05:28:31 +01:00
|
|
|
|
if (count == 8) FOR (i=0;i<8;i++)
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
|
|
|
|
XX=x;
|
|
|
|
|
WHILE (XX<7)
|
|
|
|
|
{
|
2009-01-28 05:28:31 +01:00
|
|
|
|
but_id=i*8+XX;
|
|
|
|
|
matrix[but_id].mark=matrix[but_id+1].mark;
|
|
|
|
|
matrix[but_id].color=matrix[but_id+1].color;
|
|
|
|
|
IF (XX == 6) matrix[but_id+1].mark=1;
|
2008-03-25 11:09:54 +01:00
|
|
|
|
XX++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-28 05:28:31 +01:00
|
|
|
|
void ReDraw_Blocks(byte newgame)
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
2009-01-28 05:28:31 +01:00
|
|
|
|
byte num=0, y=22, count_blocks=0, temp[10];
|
2008-03-25 11:09:54 +01:00
|
|
|
|
for (i=0;i<8;i++)
|
|
|
|
|
{
|
|
|
|
|
for (j=0;j<8;j++)
|
|
|
|
|
{
|
2009-01-28 05:28:31 +01:00
|
|
|
|
IF (newgame)
|
2008-03-25 11:09:54 +01:00
|
|
|
|
{
|
|
|
|
|
matrix[num].mark=0;
|
|
|
|
|
XX=9; YY=0;
|
|
|
|
|
matrix[num].color = random(5)+1;
|
|
|
|
|
}
|
2009-01-28 05:28:31 +01:00
|
|
|
|
DeleteButton(i*8+j);
|
2008-03-25 11:09:54 +01:00
|
|
|
|
matrix[num].x=j;
|
|
|
|
|
matrix[num].y=i;
|
|
|
|
|
IF (matrix[num].mark==0)
|
|
|
|
|
{
|
2009-01-28 16:20:29 +01:00
|
|
|
|
DefineButton(j*21,y-22, 20, 20, num+BT_HIDE, 0);
|
|
|
|
|
PutImage(matrix[num].color-1*1323+#img,21,21,j*21,y-22);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
DrawBar(j*21,y-22,21,21, 0xB2B4BF);
|
2008-03-25 11:09:54 +01:00
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
y=y+21;
|
|
|
|
|
}
|
2011-01-27 13:34:09 +01:00
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
DrawBar(90,178,71,8,sc.work);
|
|
|
|
|
IF (check_for_end()==1) WriteText(90,178,0x80,sc.work_text,"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:",10);
|
|
|
|
|
ELSE WriteText(96,178,0x80,sc.work_text,"<22><>⠫<EFBFBD><E2A0AB><EFBFBD>:",10);
|
|
|
|
|
#else
|
|
|
|
|
DrawBar(108,178,60,8,sc.work);
|
|
|
|
|
IF (check_for_end()==1) WriteText(108,178,0x80,sc.work_text,"Result:",10);
|
|
|
|
|
ELSE WriteText(108,178,0x80,sc.work_text,"Blocks:",10);
|
|
|
|
|
#endif
|
2009-01-28 05:28:31 +01:00
|
|
|
|
FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++;
|
2011-01-27 13:34:09 +01:00
|
|
|
|
WriteNumber(150,178,0x80,sc.work_text,count_blocks);
|
2009-01-28 05:28:31 +01:00
|
|
|
|
//
|
|
|
|
|
if (check_for_end()==1) && (count_blocks<8)
|
|
|
|
|
{
|
2011-01-27 13:34:09 +01:00
|
|
|
|
DrawFlatButton();
|
|
|
|
|
#ifdef LANG_RUS
|
2009-01-28 05:28:31 +01:00
|
|
|
|
IF (count_blocks==0) copystr(" <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!", #temp);
|
|
|
|
|
IF (count_blocks==1) copystr(" <20>४<EFBFBD><E0A5AA>᭮", #temp);
|
|
|
|
|
IF (count_blocks==2) copystr("<22>祭<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", #temp);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
#else
|
|
|
|
|
IF (count_blocks==0) copystr("The best!", #temp);
|
|
|
|
|
IF (count_blocks==1) copystr("Wonderful", #temp);
|
|
|
|
|
IF (count_blocks==2) copystr("Very good", #temp);
|
|
|
|
|
#endif
|
2009-01-28 05:28:31 +01:00
|
|
|
|
IF (count_blocks>=3) //<2F><><EFBFBD>!!!
|
|
|
|
|
{
|
2011-01-27 13:34:09 +01:00
|
|
|
|
#ifdef LANG_RUS
|
2009-01-28 05:28:31 +01:00
|
|
|
|
copystr(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", #temp);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
#else
|
|
|
|
|
copystr(" Not bed", #temp);
|
|
|
|
|
#endif
|
2009-01-28 05:28:31 +01:00
|
|
|
|
count_blocks=3;
|
|
|
|
|
}
|
2011-01-27 13:34:09 +01:00
|
|
|
|
PutImage(count_blocks*4662+#cups,42,37,63,48);
|
|
|
|
|
#ifdef LANG_RUS
|
2009-01-28 16:20:29 +01:00
|
|
|
|
WriteText(46,91,0x80,0x0,#temp,0);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
#else
|
|
|
|
|
WriteText(58,91,0x80,0x0,#temp,0);
|
|
|
|
|
#endif
|
2009-01-28 05:28:31 +01:00
|
|
|
|
}
|
2008-03-25 11:09:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-28 05:28:31 +01:00
|
|
|
|
|
|
|
|
|
void main()
|
2011-01-27 13:34:09 +01:00
|
|
|
|
{ byte id;
|
|
|
|
|
//randomize();
|
2009-01-28 05:28:31 +01:00
|
|
|
|
ReDraw_Blocks(1);
|
|
|
|
|
loop()
|
|
|
|
|
{
|
|
|
|
|
switch(WaitEvent())
|
|
|
|
|
{
|
2009-01-28 16:20:29 +01:00
|
|
|
|
CASE evKey:
|
|
|
|
|
IF (GetKey()==051) ReDraw_Blocks(1); //New game
|
|
|
|
|
break;
|
2009-01-28 05:28:31 +01:00
|
|
|
|
CASE evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
IF (id==255) ExitProcess();
|
2009-01-28 16:20:29 +01:00
|
|
|
|
IF (id==254) ReDraw_Blocks(1); //New game
|
|
|
|
|
IF (id<65) //Color Button
|
|
|
|
|
{
|
|
|
|
|
destroy_button(id);
|
|
|
|
|
IF (XX!=9)
|
|
|
|
|
{
|
|
|
|
|
shift_bars(XX,YY);
|
|
|
|
|
IF (YY==7) {move_it();move_it();}
|
|
|
|
|
XX=9;
|
|
|
|
|
YY=0;
|
|
|
|
|
ReDraw_Blocks(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-01-28 05:28:31 +01:00
|
|
|
|
case evReDraw:
|
|
|
|
|
WindowRedrawStatus(1);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
DefineAndDrawWindow(400,276,177,201+GetSkinWidth(),0x74,0x10B2B4BF,0,0,"Just Clicks v0.77");
|
2009-01-28 05:28:31 +01:00
|
|
|
|
WindowRedrawStatus(2);
|
2011-01-27 13:34:09 +01:00
|
|
|
|
sc.get();
|
|
|
|
|
DefineButton(150,-18,18,18,255+BT_HIDE+BT_NOFRAME,0); //<2F><><EFBFBD><EFBFBD><EFBFBD>窠 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :]
|
|
|
|
|
DrawBar(0,168,168,29,sc.work); //<2F><><EFBFBD><EFBFBD><EFBFBD>쪠 ᭨<><E1ADA8>
|
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
DefineButton(9,172,76,19,254,sc.work_button);
|
|
|
|
|
WriteText(16,178,0x80,sc.work_button_text,"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (F2)",0);
|
|
|
|
|
#else
|
|
|
|
|
DefineButton(9,172,86,19,254,sc.work_button);
|
|
|
|
|
WriteText(15,178,0x80,sc.work_button_text,"New game (F2)",0);
|
|
|
|
|
#endif
|
|
|
|
|
ReDraw_Blocks(0);
|
2009-01-28 05:28:31 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2008-03-25 11:09:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-27 13:34:09 +01:00
|
|
|
|
|
|
|
|
|
void DrawFlatButton()
|
|
|
|
|
{
|
|
|
|
|
DrawBar(21,42,125,1,0x94AECE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᢥ<><E1A2A5><EFBFBD>
|
|
|
|
|
DrawBar(21,104,125,1,0x94AECE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᭨<><E1ADA8>
|
|
|
|
|
DrawBar(21,42,1,62,0x94AECE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <><E1ABA5>
|
|
|
|
|
DrawBar(146,42,1,63,0x94AECE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ࠢ<EFBFBD>
|
|
|
|
|
DrawBar(22,43,124,1,0xFFFFFF); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DrawBar(22,103,123,1,0xC7C7C7); //⥭<> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
DrawBar(22,43,1,61,0xFFFFFF); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DrawBar(145,44,1,60,0xC7C7C7); //⥭<> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
DrawBar(23,44,122,59,0xE4DFE1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-25 11:09:54 +01:00
|
|
|
|
stop:
|