flood-it reduced binary file size
git-svn-id: svn://kolibrios.org@2282 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e5ad7f09dc
commit
571645e609
@ -120,15 +120,15 @@ void main()
|
||||
{
|
||||
case evButton:
|
||||
id = GetButtonID();
|
||||
if (id==1) || (id==4) ExitProcess();
|
||||
if (id==2) goto _NEW_GAME_MARK;
|
||||
if (id==3) goto _HELP_MARK;
|
||||
if (id>=100) make_turn(id-100);
|
||||
IF (id==1) || (id==4) ExitProcess();
|
||||
IF (id==2) goto _NEW_GAME_MARK;
|
||||
IF (id==3) goto _HELP_MARK;
|
||||
IF (id>=100) make_turn(id-100);
|
||||
if (id>=10)
|
||||
{
|
||||
id=id-10*3;
|
||||
|
||||
if (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[id]) break; //âûáðàí òîò æå ðàçìåð
|
||||
IF (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[id]) break; //âûáðàí òîò æå ðàçìåð
|
||||
|
||||
BLOCK_SIZE = DIFFICULTY_LEV_PARAMS[id]; //ðàçìåð êâàäðàòèêà
|
||||
BLOCKS_NUM = DIFFICULTY_LEV_PARAMS[id+1]; //êîëè÷åñòâî êâàäðàòèêîâ ïî Õ è ïî Y
|
||||
@ -141,26 +141,26 @@ void main()
|
||||
break;
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
if (key==027) //Escape
|
||||
IF (key==027) //Escape
|
||||
ExitProcess();
|
||||
if (key==050) //F1
|
||||
IF (key==050) //F1
|
||||
{
|
||||
_HELP_MARK:
|
||||
CreateThread(#help,#stak);
|
||||
}
|
||||
if (key==051) //F2
|
||||
IF (key==051) //F2
|
||||
{
|
||||
_NEW_GAME_MARK:
|
||||
new_game();
|
||||
draw_clicks_num();
|
||||
draw_field();
|
||||
}
|
||||
if (key==113) make_turn(0); //Q
|
||||
if (key==119) make_turn(1); //W
|
||||
if (key==101) make_turn(2); //E
|
||||
if (key==097) make_turn(3); //A
|
||||
if (key==115) make_turn(4); //S
|
||||
if (key==100) make_turn(5); //D
|
||||
IF (key==113) make_turn(0); //Q
|
||||
IF (key==119) make_turn(1); //W
|
||||
IF (key==101) make_turn(2); //E
|
||||
IF (key==097) make_turn(3); //A
|
||||
IF (key==115) make_turn(4); //S
|
||||
IF (key==100) make_turn(5); //D
|
||||
break;
|
||||
case evReDraw:
|
||||
draw_window();
|
||||
@ -171,8 +171,8 @@ void main()
|
||||
|
||||
void make_turn(int turn_id)
|
||||
{
|
||||
if (color_matrix[0]==turn_id) return; //åñëè öâåò ïåðâîé ôèøêè òàêîé æå, èãíîðèðóåì áåññìûñëåííûé õîä
|
||||
if (CLICKS>=MAX_CLICKS) return; //åñëè èãðà çàêîí÷åíà
|
||||
IF (color_matrix[0]==turn_id) return; //åñëè öâåò ïåðâîé ôèøêè òàêîé æå, èãíîðèðóåì áåññìûñëåííûé õîä
|
||||
IF (CLICKS>=MAX_CLICKS) return; //åñëè èãðà çàêîí÷åíà
|
||||
|
||||
CLICKS++;
|
||||
draw_clicks_num();
|
||||
@ -194,12 +194,12 @@ void draw_window()
|
||||
|
||||
//ïðîâåðÿåì íå ñõëîïíóòî ëè îêíî â çàãîëîâîê
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.height==GetSkinWidth()+3) return;
|
||||
IF (Form.height==GetSkinWidth()+3) return;
|
||||
|
||||
//çàêðàøèâàåì ôîí -> óìåíüøàåò ïåðåðèñîâêó
|
||||
for (i=0;i<=4;i++)
|
||||
{
|
||||
if (i<>4)
|
||||
IF (i<>4)
|
||||
DrawRegion(USER_PANEL_WIDTH+i-5,i, BLOCK_SIZE*BLOCKS_NUM +9-i-i, BLOCK_SIZE*BLOCKS_NUM+9-i-i, sc.work);
|
||||
else
|
||||
DrawRegion(USER_PANEL_WIDTH+i-5,i, BLOCK_SIZE*BLOCKS_NUM +9-i-i, BLOCK_SIZE*BLOCKS_NUM+9-i-i, sc.work_graph); //îáîäîê
|
||||
@ -224,7 +224,7 @@ void draw_window()
|
||||
{
|
||||
DefineButton(j*25+56,BLOCKS_NUM*BLOCK_SIZE-20, 20,20, j+10,sc.work_button);
|
||||
|
||||
if (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[j*3]) EDI=0x800080;
|
||||
IF (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[j*3]) EDI=0x800080;
|
||||
else EDI=sc.work_button_text;
|
||||
|
||||
WriteText(j*25+56+8,BLOCKS_NUM*BLOCK_SIZE-20+7,0x80,EDI,BOARD_SIZES[j],0);
|
||||
@ -268,21 +268,21 @@ void fill_field(int new_color_id)
|
||||
for (i=0;i<BLOCKS_NUM;i++)
|
||||
for (j=0;j<BLOCKS_NUM;j++)
|
||||
{
|
||||
if (color_matrix[i*BLOCKS_NUM+j]<>old_color_id) continue; //åñëè ôèøêà íå íóæíîãî öâåòà èä¸ì äàëüøå
|
||||
if (color_matrix[i*BLOCKS_NUM+j]==MARKED) continue; //åñëè ôèøêà óæå îòìå÷åíà, èä¸ì äàëåå
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]<>old_color_id) continue; //åñëè ôèøêà íå íóæíîãî öâåòà èä¸ì äàëüøå
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]==MARKED) continue; //åñëè ôèøêà óæå îòìå÷åíà, èä¸ì äàëåå
|
||||
|
||||
if (j>0) && (color_matrix[i*BLOCKS_NUM+j-1]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ëåâûé
|
||||
if (i>0) && (color_matrix[i-1*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì âåðõíèé
|
||||
if (j<BLOCKS_NUM-1) && (color_matrix[i*BLOCKS_NUM+j+1]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ïðàâûé
|
||||
if (i<BLOCKS_NUM-1) && (color_matrix[i+1*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì íèæíèé
|
||||
IF (j>0) && (color_matrix[i*BLOCKS_NUM+j-1]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ëåâûé
|
||||
IF (i>0) && (color_matrix[i-1*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì âåðõíèé
|
||||
IF (j<BLOCKS_NUM-1) && (color_matrix[i*BLOCKS_NUM+j+1]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ïðàâûé
|
||||
IF (i<BLOCKS_NUM-1) && (color_matrix[i+1*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì íèæíèé
|
||||
|
||||
if (color_matrix[i*BLOCKS_NUM+j]==MARKED) restart=1; //åñëè ôèøêó îòìåòèëè, òî ïîòîì öèêë íóæíî áóäåò ïðîêðóòèòü ñíà÷àëà - ìîæ åù¸ ÷¸ îòìåòèì
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]==MARKED) restart=1; //åñëè ôèøêó îòìåòèëè, òî ïîòîì öèêë íóæíî áóäåò ïðîêðóòèòü ñíà÷àëà - ìîæ åù¸ ÷¸ îòìåòèì
|
||||
}
|
||||
if (restart) goto _RESTART_MARK;
|
||||
IF (restart) goto _RESTART_MARK;
|
||||
|
||||
for (i=0;i<BLOCKS_NUM;i++)
|
||||
for (j=0;j<BLOCKS_NUM;j++)
|
||||
if (color_matrix[i*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=new_color_id;
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]==MARKED) color_matrix[i*BLOCKS_NUM+j]=new_color_id;
|
||||
}
|
||||
|
||||
|
||||
@ -292,11 +292,11 @@ int check_for_end()
|
||||
|
||||
if (CLICKS>=MAX_CLICKS) //åñëè ïðîèãðûø
|
||||
{
|
||||
if (CLICKS==MAX_CLICKS) //âûèãðûøü íà ïîñëåäíåì õîäå
|
||||
IF (CLICKS==MAX_CLICKS) //âûèãðûøü íà ïîñëåäíåì õîäå
|
||||
{
|
||||
for (i=0;i<BLOCKS_NUM;i++) //ïðîâåðÿåì âñ¸ ëè ïîëå îäíîãî öâåòà, åñëè íåò óõîäèì
|
||||
for (j=0;j<BLOCKS_NUM;j++)
|
||||
if (color_matrix[i*BLOCKS_NUM+j]<>color_matrix[0]) goto _LOOSE_MARK;
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]<>color_matrix[0]) goto _LOOSE_MARK;
|
||||
goto _WIN_MARK;
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ int check_for_end()
|
||||
for (i=0;i<14;i++)
|
||||
for (j=0;j<14;j++)
|
||||
{
|
||||
if (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[0])
|
||||
IF (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[0])
|
||||
{
|
||||
ii=i;
|
||||
jj=j;
|
||||
@ -328,7 +328,7 @@ int check_for_end()
|
||||
|
||||
for (i=0;i<BLOCKS_NUM;i++) //ïðîâåðÿåì âñ¸ ëè ïîëå îäíîãî öâåòà, åñëè íåò óõîäèì
|
||||
for (j=0;j<BLOCKS_NUM;j++)
|
||||
if (color_matrix[i*BLOCKS_NUM+j]<>color_matrix[0]) return 0;
|
||||
IF (color_matrix[i*BLOCKS_NUM+j]<>color_matrix[0]) return 0;
|
||||
|
||||
//âñ¸ ïîëå îäíîãî öâåòà è ôèøåê ìåíüøå MAX_CLICKS -> ïîáåäà
|
||||
|
||||
@ -346,7 +346,7 @@ int check_for_end()
|
||||
for (i=0;i<14;i++)
|
||||
for (j=0;j<14;j++)
|
||||
{
|
||||
if (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[0]) //çàëèâêà äëÿ ïîëåé ðàçíîãî ðàçìåðà ðàçíàÿ
|
||||
IF (BLOCK_SIZE == DIFFICULTY_LEV_PARAMS[0]) //çàëèâêà äëÿ ïîëåé ðàçíîãî ðàçìåðà ðàçíàÿ
|
||||
{
|
||||
ii=i;
|
||||
jj=j;
|
||||
@ -376,7 +376,7 @@ void draw_clicks_num()
|
||||
|
||||
WriteText(TEXT_X,TEXT_Y,0x80,sc.work_text,#CLICKS_TEXT,0);
|
||||
|
||||
if (CLICKS<10) EBX=9*6+TEXT_X;
|
||||
IF (CLICKS<10) EBX=9*6+TEXT_X;
|
||||
else EBX=8*6+TEXT_X;
|
||||
|
||||
WriteText(EBX,TEXT_Y,0x80,sc.work_text,IntToStr(CLICKS),0);
|
||||
@ -407,10 +407,10 @@ void help()
|
||||
switch (WaitEvent())
|
||||
{
|
||||
CASE evButton:
|
||||
if (GetButtonID()==1) ExitProcess();
|
||||
IF (GetButtonID()==1) ExitProcess();
|
||||
break;
|
||||
CASE evKey:
|
||||
if (GetKey()==27) ExitProcess(); //Esc
|
||||
IF (GetKey()==27) ExitProcess(); //Esc
|
||||
break;
|
||||
CASE evReDraw:
|
||||
for (i=0; HELP_TEXT[i]<>0; i++;) {};
|
||||
|
Loading…
Reference in New Issue
Block a user