From 5907e5759e4354d91a5496fbc22da3a276414abf Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 28 Jan 2009 04:28:31 +0000 Subject: [PATCH] Clicks 0.75 git-svn-id: svn://kolibrios.org@1003 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/clicks/trunk/History.txt | 43 +- programs/games/clicks/trunk/clicks.c-- | 212 ++- programs/games/clicks/trunk/compile.bat | 2 +- .../clicks/trunk/{4.gif => files/boxes.gif} | Bin .../clicks/trunk/{img.txt => files/boxes.txt} | 2 +- programs/games/clicks/trunk/files/cups.png | Bin 0 -> 3936 bytes programs/games/clicks/trunk/files/cups.txt | 1168 +++++++++++++++++ programs/games/clicks/trunk/lib/RANDOM.H-- | 52 + programs/games/clicks/trunk/lib/kolibri.h-- | 182 +++ 9 files changed, 1536 insertions(+), 125 deletions(-) rename programs/games/clicks/trunk/{4.gif => files/boxes.gif} (100%) rename programs/games/clicks/trunk/{img.txt => files/boxes.txt} (98%) create mode 100644 programs/games/clicks/trunk/files/cups.png create mode 100644 programs/games/clicks/trunk/files/cups.txt create mode 100644 programs/games/clicks/trunk/lib/RANDOM.H-- create mode 100644 programs/games/clicks/trunk/lib/kolibri.h-- diff --git a/programs/games/clicks/trunk/History.txt b/programs/games/clicks/trunk/History.txt index a7096b7bbb..cf402bdb90 100644 --- a/programs/games/clicks/trunk/History.txt +++ b/programs/games/clicks/trunk/History.txt @@ -1,31 +1,42 @@ +******************************************************************************** +******************************************************************************** Just Clicks -Copyright (C) 2008 Leency & Veliant -€бв®аЁп ўҐабЁ©: +Copyright (C) 2008 Leency +История версий: + +Just Clicks v0.75 (20.11.2008) +- три багфикса, небольшие оптимизации + +Just Clicks v0.70 (01.10.2008) +- извещения о победе, небольшие оптимизации + +Just Clicks v0.65 (24.03.2008) +- сильно уменьшена перерисовка окна, исправлен один недочёт Just Clicks v0.6 (24.03.2008) -- ­ҐЇ®¤ҐжЄЁ ®ЇвЁ¬Ё§Ёа®ў ­ Ё­¤гббЄЁ© Є®¤ :) - “¤ «Ґ­® Ў®«ҐҐ 25% бва®Є. +- неподецки оптимизирован индусский код :) + Удалено более 25% строк. Just Clicks v0.5 (23.03.2008) -- гбва ­с­ Ў Ј, бўп§ ­­л© б ®в®Ўа ¦ Ґ¬л¬ Є®«ЁзҐбвў®¬ ®бв ўиЁебп Ў«®Є®ў -- Ё§®Ўа ¦Ґ­Ёп ў¬Ґбв® бв ­¤ ав­ле Є­®Ї®Є +- устранён баг, связанный с отображаемым количеством оставшихся блоков +- изображения вместо стандартных кнопок Just Clicks v0.4 (13.03.2008) -- ®Є­® ⥯Ґам б® бЄЁ­®¬ -- ЇаЁ ­ ¦ вЁЁ ­  Є­®ЇЄг Ў®«миҐ ­Ґ ЇҐаҐаЁб®ўлў Ґвбп ўбс ®Є­®, в®«мЄ® Ї®«Ґ б Ў«®Є ¬Ё -- ЇаЁ ­ ¦ вЁЁ ­  «оЎго Є« ўЁиг Їа®Ја ¬¬  㦥 ­Ґ г室Ёв ў ЎҐбЄ®­Ґз­л© жЁЄ« -- Є« ўЁи  F2 - ­®ў п ЁЈа  -- гбва ­Ґ­  ЇҐаҐаЁб®ўЄ  ®Є­  ў б«гз Ґ, Ґб«Ё Ў«®ЄЁ ­Ґ б¤ўЁЈ овбп. +- окно теперь со скином +- при нажатии на кнопку больше не перерисовывается всё окно, только поле с блоками +- при нажатии на любую клавишу программа уже не уходит в бесконечный цикл +- клавиша F2 - новая игра +- устранена перерисовка окна в случае, если блоки не сдвигаются. ******************************************************************************** ******************************************************************************** ClickoMania -Copyright (C) 2005 Ђ«ҐЄб ­¤а ЊгиЁЄ®ў aka Olaf -€бв®аЁп ўҐабЁ©: +Copyright (C) 2005 Александр Мушиков aka Olaf +История версий: ClickoMania v0.2 (05.12.2005) -- €бЇа ў«Ґ­  ®иЁЎЄ  - ўл¤ з  б®®ЎйҐ­Ёп ® Є®­Ґз­®¬ १г«мв вҐ ў в® ўаҐ¬п Є Є ЁЈаг - ¬®¦­® ҐйҐ Їа®¤®«¦ вм. +- Исправлена ошибка - выдача сообщения о конечном результате в то время как игру + можно еще продолжать. ClickoMania v0.1 (23.11.2005) -- Ќ з «м­ п. +- Начальная. \ No newline at end of file diff --git a/programs/games/clicks/trunk/clicks.c-- b/programs/games/clicks/trunk/clicks.c-- index 162ca744e6..f9ea6d5a11 100644 --- a/programs/games/clicks/trunk/clicks.c-- +++ b/programs/games/clicks/trunk/clicks.c-- @@ -1,18 +1,19 @@ /* -Just Clicks v0.6 -Copyright (C) 2008 Leency & Veliant +Just Clicks v0.75 +Copyright (C) 2008 Leency Clickomania v0.3 Copyright (C) 2005 Ђ«ҐЄб ­¤а ЊгиЁЄ®ў aka Olaf Compiled by C--Sphinx v0.239 b26 */ #pragma option meos -#jumptomain NONE #include "lib\kolibri.h--" #include "lib\random.h--" -#include "img.txt" +#include "files\boxes.txt" +#include "files\cups.txt" -byte i, need_redraw, XX, YY; + +byte i,j, XX, YY; struct { @@ -21,36 +22,36 @@ struct byte button_id; byte mark; dword color; -}matrix[8*8]; +}matrix[64]; -void destroy_button(dword ID) +void destroy_button(byte ID) { - IF ((matrix[ID-8].color == matrix[ID].color)&&(matrix[ID-8].mark!=1)){ + IF (matrix[ID-8].color == matrix[ID].color) && (matrix[ID-8].mark!=1) + { matrix[ID-8].mark=1; - need_redraw=1; destroy_button(ID-8); } - IF ((matrix[ID+8].color == matrix[ID].color)&&(matrix[ID+8].mark!=1)){ + IF (matrix[ID+8].color == matrix[ID].color) && (matrix[ID+8].mark!=1) + { matrix[ID+8].mark=1; - need_redraw=1; destroy_button(ID+8); } - IF ((ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56)) - IF ((matrix[ID-1].color == matrix[ID].color)&&(matrix[ID-1].mark!=1)){ - matrix[ID-1].mark=1; - need_redraw=1; - destroy_button(ID-1); - } - IF ((ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63)) - IF ((matrix[ID+1].color == matrix[ID].color)&&(matrix[ID+1].mark!=1)){ - matrix[ID+1].mark=1; - need_redraw=1; - destroy_button(ID+1); - } - IF (matrix[ID].xYY) YY=matrix[ID].y;} - IF (matrix[ID].y>YY){YY=matrix[ID].y; IF (matrix[ID].xYY) YY=matrix[ID].y;} + IF (matrix[ID].y>YY) {YY=matrix[ID].y; IF (matrix[ID].x=3) //Ў Ј!!! + { + copystr(" ЌҐЇ«®е®", #temp); + count_blocks=3; + } + PutImage(count_blocks*42*37*3+#cups,42,37,68,48); + WriteText(51,91,0x80,0x0,#temp,0); + } } -void draw_window() -{ - WindowRedrawStatus(1); - DefineAndDrawWindow(300,176,177,201+skin_width,0x04,0x00B2B4BF,0,0,0); - DefineButton(155,2-skin_width,18,18,600+BT_HIDE+BT_NOFRAME,0x0866CC00); //Є­®ЇЄ  § ЄалвЁп - DrawTitle("Just Clicks v0.6 L&V"); - DrawBar(5,168,168,29,0xE4DFE1); //Ї®«Ґ б­Ё§г - DrawFlatButton(9,172,84,19,500,0xE4DFE1); //New E4DFE1 - WriteText(14,178,0x80,0,"New game (F2) ",14); - //WriteText(95,172,0x80,0," “а®ўҐ­м:01",10); //“а®ўҐ­м - ReDraw_Blocks(0); - WindowRedrawStatus(2); + +void main() +{ byte id; + randomize(); + ReDraw_Blocks(1); + loop() + { + switch(WaitEvent()) + { + CASE evKey: IF (GetKey()==051) ReDraw_Blocks(1); break; //New game + CASE evButton: + id=GetButtonID(); + IF (id==255) ExitProcess(); + IF (id==254) {ReDraw_Blocks(1); break;} //New game + IF (id<65) IF (check_for_end()<>1) + { //if 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; + } + case evReDraw: + WindowRedrawStatus(1); + skin_width = GetSkinWidth(); + DefineAndDrawWindow(400,276,177,201+skin_width,0x44,0x10B2B4BF,0,0,"Just Clicks v0.75"); + //DefineButton(155,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00); + DrawBar(5,168,168,29,0xE4DFE1); + //DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)"); + DrawFlatButton(9,172,80,19,254,0xE4DFE1,"‡ ­®ў® (F2)"); + ReDraw_Blocks(0); + WindowRedrawStatus(2); + } + } } stop: diff --git a/programs/games/clicks/trunk/compile.bat b/programs/games/clicks/trunk/compile.bat index 3eef0d1b02..0638c99da5 100644 --- a/programs/games/clicks/trunk/compile.bat +++ b/programs/games/clicks/trunk/compile.bat @@ -1,5 +1,5 @@ c--\c-- clicks.c-- del clicks.kex rename clicks.com clicks.kex -rename clicks clicks.kex +rem rename clicks clicks.kex pause \ No newline at end of file diff --git a/programs/games/clicks/trunk/4.gif b/programs/games/clicks/trunk/files/boxes.gif similarity index 100% rename from programs/games/clicks/trunk/4.gif rename to programs/games/clicks/trunk/files/boxes.gif diff --git a/programs/games/clicks/trunk/img.txt b/programs/games/clicks/trunk/files/boxes.txt similarity index 98% rename from programs/games/clicks/trunk/img.txt rename to programs/games/clicks/trunk/files/boxes.txt index d2bc5442ae..288eb21717 100644 --- a/programs/games/clicks/trunk/img.txt +++ b/programs/games/clicks/trunk/files/boxes.txt @@ -1,4 +1,4 @@ -char img[6615] = { +unsigned char img[6615] = { 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, diff --git a/programs/games/clicks/trunk/files/cups.png b/programs/games/clicks/trunk/files/cups.png new file mode 100644 index 0000000000000000000000000000000000000000..9b0132cfbe6a3cd337e183f8ccc532153fef15d3 GIT binary patch literal 3936 zcmV-m51;UfP)CA6cpSy7R4nc$Tm0DC@I!BIOGHb=Mo3!8yVv!3+5sd<|iiRJ1FKj zH_ksm$6pZFLKNObCfZyxz{t1#}fKJct3{j?+bx;o5@M8}&%!JAXli%i>wRMMJM*_dO^p+?N4RMDkL(yCU> zsb|HhcF(kW(yV6Cu5s71YTCPe>$FAYw^sVRLh`*);kj!3z()MXUFX1a`N(DT%X$3L zdV+zChliD!ii41jn4OS|laig4mZFfGv7Vx>nW3|zje(_-iKv^FwU>smos*%SrL&=m zxu%z=q^YT>vahqhwX3JGuClnWtGBhey1T=?!pG8wiQAZ(#jS+FshP>Lip#f|)3%7y zyp_eSp~$wV!@IiJrKZxqq}IB&?3#w+w2a`RrNO?z-M_%y!;Q?syV1d?)Wx{&$$;U< zll|3(_}G`@%A)4crs~k%oT*rQTShz;OfEeXWC?|Jj6lHMMWGIqJa+HnnAuFpR^%V5 zK;SqqTz`J~7qvX|(RzllqMWcj=OIJ`tAwySw8RHcGGc11LuPI&#Hd=)7Xx z(}|G`pj&?=W<(9ePyRGjqf3u|{^y9+JRot&s|!-m`39*{LNtQ_i{_<))11)x8#Y8> znnBz(t$9%@D#HEI6T)mzgWldej@n1o+bwW34R0f(YW(^!n5+e1FReba7e5 z`%Hiu5e|^82(4uVqO^*giPCO6;@Y(5niF3J22j?ja?~q{lkTr1z4R+Pjol$R65Fin zhRPuk^t^AuR+tX-Zr^SEF2s%r-oak8qwk%%Dw{_M37Nq*)`3=aY8lO_*syofIysD; zxmeJP1%=X~AjS!WJB!Rz=X>ldaqo56ZffdHpF`05y>O+|s>Cl*l3}?bYUs``wq>XP z@~CWF7|8_9xT2PT-Q4bztl3JF;zr4b@^__%1_3bO?3NvtzDItlk-LnbNZ3@K7C$nA z0|)4YS`M-J*N}QNX~N1&MXPbVW&l!E&CU{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?Qpuqi?adSyGI z3p$gpJXpR#w_KvBmJI=4c{*33dgi#Gf?OOqFTkI7nKq=Nk105f?<{qo@o}Av%u0XW z?X=O8)1v(Kj$kEp=xO}T-L!Eg&LqTfr>HD&BzBzNa8qg|ccizAY!r3O^jnk39reiy zNwL4@n>*u#*pDi@6gP5_jX*ApLfqO`x4~{KUOY1sW4VycbDcIyMv@8Qlb%cED|TZO zI>gF9%mwBbx6?-1C~YmVm*y*x-}idfsC zEik0D_l!muLEhiSdU|*)1^gwYC-m58l32djx_-C%WIFk~gC{gMp6rQIMjPAf$=yPa ztKx7I2~Xu?@(q26<)QQ%i`H_hKOy8zaac`c5mUFkM8F&+Sl^pH*7C@8-dkMnN7c7@ zW+Wuu>^%i=WDMoFb(Qyy+FS=$pWLA~-^uIQ>vc5@+-|P|gW6E}td53}Xc&L}QE6-H z!LkTlOWGUSxAE5#NPqF5e;7)yZ{!W_O(y83^1UYL2I;T0O+2E)Q+Qv=vZ)Q8H-HUs z^KS_vS99T-XwoB!3R#Zr?o@m%8kqgGdvtt>LN)U3YRB=HH-p!CFrZ+H@6W#Mi)0+! zW@4JGrfZ|-t21cje`*F(I&#-QXShK}-{YB49909AjoS=|Xg3Bt7>9g@AScwcOG;HOSjb&xwNw#PVOLe0#?-*4bC~{q6{dAv%Kt3s&n*CNAop4hj^rCFnHTSL2 zl5@n>P2Ji0>{G4_K{a5pK_<)M3sqtUa)Scgo8az{s<+;41m326>h> 8; +} + +inline fastcall word GetButtonID(){ + EAX = 17; // Get ID + $int 0x40 + EAX = EAX >> 8; +} + +inline fastcall dword GetSkinWidth() +{ + EAX = 48; + EBX = 4; + $int 0x40 +} + +inline fastcall void DeleteButton(dword EDX) +{ + EAX = 8; + EDX += BT_DEL; + $int 0x40; +} + +inline fastcall dword strlen(dword EDI){ + ECX=EAX=0; + ECX--; + $REPNE $SCASB + EAX-=2+ECX; +} + + +inline fastcall void WindowRedrawStatus(dword EBX){ + EAX = 12; + $int 0x40 +} + + +void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI) +{ + EBX = x << 16 + sizeX; + ECX = y << 16 + sizeY; + EDX = mainAreaType << 24 | mainAreaColour; + ESI = headerType << 24 | headerColour; + $xor eax,eax + $int 0x40 +} + +void DefineButton(dword x,y,w,h,EDX,ESI) +{ + EAX = 8; + EBX = x<<16+w; + ECX = skin_width+y<<16+h; + $int 0x40 +} + +void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) +{ + EAX = 4; + EBX = x<<16+skin_width+y; + ECX = fontType<<24+color; + $int 0x40; +} + + +void DrawBar(dword x,y,w,h,EDX) +{ + EAX = 13; + EBX = x<<16+w; + ECX = skin_width+y<<16+h; + $int 0x40 +} + + +void DrawRegion(dword x,y,width,height,color1) +{ + DrawBar(x,y,width,1,color1); //полоса гор сверху + DrawBar(x,y+height,width,1,color1); //полоса гор снизу + DrawBar(x,y,1,height,color1); //полоса верт слева + DrawBar(x+width,y,1,height+1,color1); //полоса верт справа +} + +void DrawFlatButton(dword x,y,width,height,id,color,text) +{ + DrawRegion(x,y,width,height,0x94AECE); + DrawBar(x+1,y+1,width-1,1,0xFFFFFF); //полоса гор белая + DrawBar(x+1,y+height-1,width-2,1,0xC7C7C7); //тень верт + DrawBar(x+1,y+1,1,height-1,0xFFFFFF); //полоса верт белая + DrawBar(x+width-1,y+2,1,height-2,0xC7C7C7); //тень верт + DrawBar(x+2,y+2,width-3,height-3,color); //заливка + IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //определяем кнопку + WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); +} + + +void PutImage(dword buf,w,h,x,y) +{ + EDI=buf; + EAX = 7; + EBX = buf; + ECX = w<<16+h; + EDX = x<<16+y+skin_width; + $int 0x40 +} + + +void copystr(dword s,d) +{ + $mov esi,s + $mov edi,d + $cld +l1: + $lodsb + $stosb + $test al,al + $jnz l1 +} + + +char buffer[11]=""; +inline fastcall dword IntToStr(dword ESI) +{ + $mov edi, #buffer + $mov ecx, 10 + $test esi, esi + $jns f1 + $mov al, '-' + $stosb + $neg esi +f1: + $mov eax, esi + $push -'0' +f2: + $xor edx, edx + $div ecx + $push edx + $test eax, eax + $jnz f2 +f3: + $pop eax + $add al, '0' + $stosb + $jnz f3 + $mov eax, #buffer + $ret +}