clicks v0.77 by Leency, multi-language build

git-svn-id: svn://kolibrios.org@1768 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2011-01-27 12:34:09 +00:00
parent 93d705041c
commit 7bc3bc518a
7 changed files with 98 additions and 60 deletions

View File

@ -7,7 +7,7 @@ define cmm_meta_rule
$(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \ $(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \
$$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*) $$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*)
flock $$(dir $(2)).lock -c '\ flock $$(dir $(2)).lock -c '\
win32-c-- $(5) /IP=Z:$$(dir $(2)) Z:$$< >&2 && \ win32-c-- /D=AUTOBUILD /D=LANG_ENG $(5) /IP=Z:$$(dir $(2)) Z:$$< >&2 && \
if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \ if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \
kpack --nologo $$$$f "$$@" && rm $$$$f' kpack --nologo $$$$f "$$@" && rm $$$$f'
endef endef

View File

@ -7,7 +7,7 @@ define cmm_meta_rule
$(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \ $(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \
$$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*) $$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*)
flock $$(dir $(2)).lock -c '\ flock $$(dir $(2)).lock -c '\
win32-c-- $(5) /IP=Z:$$(dir $(2)) Z:$$< >&2 && \ win32-c-- /D=AUTOBUILD /D=LANG_RUS $(5) /IP=Z:$$(dir $(2)) Z:$$< >&2 && \
if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \ if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \
kpack --nologo $$$$f "$$@" && rm $$$$f' kpack --nologo $$$$f "$$@" && rm $$$$f'
endef endef

View File

@ -1,9 +1,17 @@
******************************************************************************** ********************************************************************************
******************************************************************************** ********************************************************************************
Just Clicks Just Clicks
Copyright (C) 2008 Leency Copyright (C) 2008-2009 Leency
История версий: История версий:
Just Clicks v0.77 (08.09.2009)
- существенно уменьшено потребляемое программой количество памяти
- кнопки под стиль системы
- небольшие оптимизации
Just Clicks v0.76 (28.01.2009)
- оптимизации
Just Clicks v0.75 (20.11.2008) Just Clicks v0.75 (20.11.2008)
- три багфикса, небольшие оптимизации - три багфикса, небольшие оптимизации

View File

@ -12,8 +12,12 @@ Compiled by C--Sphinx v0.239 b26
#include "files\boxes.txt" #include "files\boxes.txt"
#include "files\cups.txt" #include "files\cups.txt"
#ifndef AUTOBUILD
#include "lang.h--"
#endif
byte i,j, XX, YY; byte i,j, XX, YY;
system_colors sc;
struct struct
{ {
@ -125,37 +129,59 @@ void ReDraw_Blocks(byte newgame)
{ {
DefineButton(j*21,y-22, 20, 20, num+BT_HIDE, 0); DefineButton(j*21,y-22, 20, 20, num+BT_HIDE, 0);
PutImage(matrix[num].color-1*1323+#img,21,21,j*21,y-22); PutImage(matrix[num].color-1*1323+#img,21,21,j*21,y-22);
} ELSE DrawBar(j*21,y-22,21,21, 0xB2B4BF); }
ELSE
DrawBar(j*21,y-22,21,21, 0xB2B4BF);
num++; num++;
} }
y=y+21; y=y+21;
} }
DrawBar(90,178,71,8,0xE4DFE1); #ifdef LANG_RUS
IF (check_for_end()==1) WriteText(90,178,0x80,0,"<22>¥§ã«ìâ â:",10); DrawBar(90,178,71,8,sc.work);
ELSE WriteText(96,178,0x80,0,"Žáâ «®áì:",10); IF (check_for_end()==1) WriteText(90,178,0x80,sc.work_text,"<22>¥§ã«ìâ â:",10);
ELSE WriteText(96,178,0x80,sc.work_text,"Žáâ «®áì:",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
FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++; FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++;
WriteNumber(150,178,0x80,0,count_blocks); WriteNumber(150,178,0x80,sc.work_text,count_blocks);
// //
if (check_for_end()==1) && (count_blocks<8) if (check_for_end()==1) && (count_blocks<8)
{ {
DrawFlatButton(21,42,125,62,0,0xE4DFE1,""); DrawFlatButton();
#ifdef LANG_RUS
IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp); IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp);
IF (count_blocks==1) copystr(" <20>४à á­®", #temp); IF (count_blocks==1) copystr(" <20>४à á­®", #temp);
IF (count_blocks==2) copystr("Žç¥­ì å®à®è®!", #temp); IF (count_blocks==2) copystr("Žç¥­ì å®à®è®!", #temp);
#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
IF (count_blocks>=3) //¡ £!!! IF (count_blocks>=3) //¡ £!!!
{ {
#ifdef LANG_RUS
copystr(" <20>¥¯«®å®", #temp); copystr(" <20>¥¯«®å®", #temp);
#else
copystr(" Not bed", #temp);
#endif
count_blocks=3; count_blocks=3;
} }
PutImage(count_blocks*42*37*3+#cups,42,37,63,48); PutImage(count_blocks*4662+#cups,42,37,63,48);
#ifdef LANG_RUS
WriteText(46,91,0x80,0x0,#temp,0); WriteText(46,91,0x80,0x0,#temp,0);
#else
WriteText(58,91,0x80,0x0,#temp,0);
#endif
} }
} }
void main() void main()
{ byte id, skin_width; { byte id;
randomize(); //randomize();
ReDraw_Blocks(1); ReDraw_Blocks(1);
loop() loop()
{ {
@ -183,16 +209,35 @@ void main()
break; break;
case evReDraw: case evReDraw:
WindowRedrawStatus(1); WindowRedrawStatus(1);
skin_width = GetSkinWidth(); DefineAndDrawWindow(400,276,177,201+GetSkinWidth(),0x74,0x10B2B4BF,0,0,"Just Clicks v0.77");
DefineAndDrawWindow(400,276,177,201+skin_width,0x74,0x10B2B4BF,0,0,"Just Clicks v0.76");
DefineButton(150,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00);
DrawBar(0,168,168,29,0xE4DFE1);
//DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)");
DrawFlatButton(4,172,80,19,254,0xE4DFE1,"‡ ­®¢® (F2)");
ReDraw_Blocks(0);
WindowRedrawStatus(2); WindowRedrawStatus(2);
sc.get();
DefineButton(150,-18,18,18,255+BT_HIDE+BT_NOFRAME,0); //ª­®¯®çª  § ªàëâ¨ï :]
DrawBar(0,168,168,29,sc.work); //¯ ­¥«ìª  á­¨§ã
#ifdef LANG_RUS
DefineButton(9,172,76,19,254,sc.work_button);
WriteText(16,178,0x80,sc.work_button_text,"‡ ­®¢® (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);
} }
} }
} }
void DrawFlatButton()
{
DrawBar(21,42,125,1,0x94AECE); //¯®«®á  £®à ᢥàåã
DrawBar(21,104,125,1,0x94AECE); //¯®«®á  £®à á­¨§ã
DrawBar(21,42,1,62,0x94AECE); //¯®«®á  ¢¥àâ á«¥¢ 
DrawBar(146,42,1,63,0x94AECE); //¯®«®á  ¢¥àâ á¯à ¢ 
DrawBar(22,43,124,1,0xFFFFFF); //¯®«®á  £®à ¡¥« ï
DrawBar(22,103,123,1,0xC7C7C7); //â¥­ì ¢¥àâ
DrawBar(22,43,1,61,0xFFFFFF); //¯®«®á  ¢¥àâ ¡¥« ï
DrawBar(145,44,1,60,0xC7C7C7); //â¥­ì ¢¥àâ
DrawBar(23,44,122,59,0xE4DFE1); //§ «¨¢ª 
}
stop: stop:

View File

@ -1,3 +1,4 @@
echo #define LANG_ENG 1 >lang.h--
c--\c-- clicks.c-- c--\c-- clicks.c--
del clicks.kex del clicks.kex
rename clicks.com clicks.kex rename clicks.com clicks.kex

View File

@ -0,0 +1,6 @@
echo #define LANG_RUS 1 >lang.h--
c--\c-- clicks.c--
del clicks.kex
rename clicks.com clicks.kex
rem rename clicks clicks.kex
pause

View File

@ -4,8 +4,8 @@ char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001; dword os_version = 0x00000001;
dword start_addr = #main; dword start_addr = #main;
dword final_addr = #stop+32; dword final_addr = #stop+32;
dword alloc_mem = 0x00100000; dword alloc_mem = 0x00004096;
dword x86esp_reg = 0x0007fff0; dword x86esp_reg = 0x00004096;
dword I_Param = 0x0; dword I_Param = 0x0;
dword I_Icon = 0x0; dword I_Icon = 0x0;
@ -18,6 +18,18 @@ dword I_Icon = 0x0;
#define BT_NOFRAME 0x20000000 #define BT_NOFRAME 0x20000000
struct system_colors{
dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
void get();
};
void system_colors::get()
{
EAX = 48;
EBX = 3;
ECX = #frame;
EDX = 40;
$int 0x40
}
inline fastcall dword WaitEvent(){ inline fastcall dword WaitEvent(){
EAX = 10; // wait here for event EAX = 10; // wait here for event
@ -30,13 +42,13 @@ inline fastcall void ExitProcess(){
$int 0x40 $int 0x40
} }
inline fastcall word GetKey(){ inline fastcall byte GetKey(){
EAX = 2; // just read it key from buffer EAX = 2; // just read it key from buffer
$int 0x40 $int 0x40
EAX = EAX >> 8; EAX = EAX >> 8;
} }
inline fastcall word GetButtonID(){ inline fastcall byte GetButtonID(){
EAX = 17; // Get ID EAX = 17; // Get ID
$int 0x40 $int 0x40
EAX = EAX >> 8; EAX = EAX >> 8;
@ -56,13 +68,6 @@ inline fastcall void DeleteButton(dword EDX)
$int 0x40; $int 0x40;
} }
inline fastcall dword strlen(dword EDI){
ECX=EAX=0;
ECX--;
$REPNE $SCASB
EAX-=2+ECX;
}
inline fastcall void WindowRedrawStatus(dword EBX){ inline fastcall void WindowRedrawStatus(dword EBX){
EAX = 12; EAX = 12;
@ -72,11 +77,11 @@ inline fastcall void WindowRedrawStatus(dword EBX){
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI) void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
{ {
EAX = 0;
EBX = x << 16 + sizeX; EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY; ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour; EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour; ESI = headerType << 24 | headerColour;
$xor eax,eax
$int 0x40 $int 0x40
} }
@ -106,27 +111,6 @@ void DrawBar(dword x,y,w,h,EDX)
} }
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 EBX,w,h,x,y) void PutImage(dword EBX,w,h,x,y)
{ {
EAX = 7; EAX = 7;
@ -152,12 +136,6 @@ void WriteNumber(dword x,y,byte fontType, ESI, ECX)
{ {
EAX = 47; EAX = 47;
EBX = 2<<16; EBX = 2<<16;
/*ecx = 0
while(eax>10)
{
ecx ++;
eax /= 10;
}*/
EDX = x<<16+y; EDX = x<<16+y;
ESI = fontType<<24+ESI; ESI = fontType<<24+ESI;
$int 0x40; $int 0x40;