forked from KolibriOS/kolibrios
Clicks 0.75
git-svn-id: svn://kolibrios.org@1003 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
80c71dc52a
commit
5907e5759e
@ -1,31 +1,42 @@
|
|||||||
|
********************************************************************************
|
||||||
|
********************************************************************************
|
||||||
Just Clicks
|
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)
|
Just Clicks v0.6 (24.03.2008)
|
||||||
- ¥¯®¤¥æª¨ ®¯â¨¬¨§¨à®¢ ¨¤ãá᪨© ª®¤ :)
|
- неподецки оптимизирован индусский код :)
|
||||||
“¤ «¥® ¡®«¥¥ 25% áâப.
|
Удалено более 25% строк.
|
||||||
|
|
||||||
Just Clicks v0.5 (23.03.2008)
|
Just Clicks v0.5 (23.03.2008)
|
||||||
- ãáâà ñ ¡ £, á¢ï§ ë© á ®â®¡à ¦ ¥¬ë¬ ª®«¨ç¥á⢮¬ ®áâ ¢è¨åáï ¡«®ª®¢
|
- устранён баг, связанный с отображаемым количеством оставшихся блоков
|
||||||
- ¨§®¡à ¦¥¨ï ¢¬¥áâ® áâ ¤ àâëå ª®¯®ª
|
- изображения вместо стандартных кнопок
|
||||||
|
|
||||||
Just Clicks v0.4 (13.03.2008)
|
Just Clicks v0.4 (13.03.2008)
|
||||||
- ®ª® ⥯¥àì ᮠ᪨®¬
|
- окно теперь со скином
|
||||||
- ¯à¨ ¦ ⨨ ª®¯ªã ¡®«ìè¥ ¥ ¯¥à¥à¨á®¢ë¢ ¥âáï ¢áñ ®ª®, ⮫쪮 ¯®«¥ á ¡«®ª ¬¨
|
- при нажатии на кнопку больше не перерисовывается всё окно, только поле с блоками
|
||||||
- ¯à¨ ¦ ⨨ «î¡ãî ª« ¢¨èã ¯à®£à ¬¬ 㦥 ¥ ã室¨â ¢ ¡¥áª®¥çë© æ¨ª«
|
- при нажатии на любую клавишу программа уже не уходит в бесконечный цикл
|
||||||
- ª« ¢¨è F2 - ®¢ ï ¨£à
|
- клавиша F2 - новая игра
|
||||||
- ãáâà ¥ ¯¥à¥à¨á®¢ª ®ª ¢ á«ãç ¥, ¥á«¨ ¡«®ª¨ ¥ ᤢ¨£ îâáï.
|
- устранена перерисовка окна в случае, если блоки не сдвигаются.
|
||||||
|
|
||||||
|
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
ClickoMania
|
ClickoMania
|
||||||
Copyright (C) 2005 €«¥ªá ¤à Œã訪®¢ aka Olaf
|
Copyright (C) 2005 Александр Мушиков aka Olaf
|
||||||
ˆáâ®à¨ï ¢¥àᨩ:
|
История версий:
|
||||||
|
|
||||||
ClickoMania v0.2 (05.12.2005)
|
ClickoMania v0.2 (05.12.2005)
|
||||||
- ˆá¯à ¢«¥ ®è¨¡ª - ¢ë¤ ç á®®¡é¥¨ï ® ª®¥ç®¬ १ã«ìâ ⥠¢ â® ¢à¥¬ï ª ª ¨£àã
|
- Исправлена ошибка - выдача сообщения о конечном результате в то время как игру
|
||||||
¬®¦® ¥é¥ ¯à®¤®«¦ âì.
|
можно еще продолжать.
|
||||||
ClickoMania v0.1 (23.11.2005)
|
ClickoMania v0.1 (23.11.2005)
|
||||||
- <EFBFBD> ç «ì ï.
|
- Начальная.
|
@ -1,18 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
Just Clicks v0.6
|
Just Clicks v0.75
|
||||||
Copyright (C) 2008 Leency & Veliant
|
Copyright (C) 2008 Leency
|
||||||
Clickomania v0.3
|
Clickomania v0.3
|
||||||
Copyright (C) 2005 €«¥ªá ¤à Œã訪®¢ aka Olaf
|
Copyright (C) 2005 €«¥ªá ¤à Œã訪®¢ aka Olaf
|
||||||
Compiled by C--Sphinx v0.239 b26
|
Compiled by C--Sphinx v0.239 b26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma option meos
|
#pragma option meos
|
||||||
#jumptomain NONE
|
|
||||||
#include "lib\kolibri.h--"
|
#include "lib\kolibri.h--"
|
||||||
#include "lib\random.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
|
struct
|
||||||
{
|
{
|
||||||
@ -21,32 +22,32 @@ struct
|
|||||||
byte button_id;
|
byte button_id;
|
||||||
byte mark;
|
byte mark;
|
||||||
dword color;
|
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;
|
matrix[ID-8].mark=1;
|
||||||
need_redraw=1;
|
|
||||||
destroy_button(ID-8);
|
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;
|
matrix[ID+8].mark=1;
|
||||||
need_redraw=1;
|
|
||||||
destroy_button(ID+8);
|
destroy_button(ID+8);
|
||||||
}
|
}
|
||||||
IF ((ID!=0)&&(ID!=8)&&(ID!=16)&&(ID!=24)&&(ID!=32)&&(ID!=40)&&(ID!=48)&&(ID!=56))
|
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].color == matrix[ID].color) && (matrix[ID-1].mark!=1)
|
||||||
|
{
|
||||||
matrix[ID-1].mark=1;
|
matrix[ID-1].mark=1;
|
||||||
need_redraw=1;
|
|
||||||
destroy_button(ID-1);
|
destroy_button(ID-1);
|
||||||
}
|
}
|
||||||
IF ((ID!=7)&&(ID!=15)&&(ID!=23)&&(ID!=31)&&(ID!=39)&&(ID!=47)&&(ID!=55)&&(ID!=63))
|
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].color == matrix[ID].color) && (matrix[ID+1].mark!=1)
|
||||||
|
{
|
||||||
matrix[ID+1].mark=1;
|
matrix[ID+1].mark=1;
|
||||||
need_redraw=1;
|
|
||||||
destroy_button(ID+1);
|
destroy_button(ID+1);
|
||||||
}
|
}
|
||||||
IF (matrix[ID].x<XX) {XX=matrix[ID].x; IF (matrix[ID].y>YY) YY=matrix[ID].y;}
|
IF (matrix[ID].x<XX) {XX=matrix[ID].x; IF (matrix[ID].y>YY) YY=matrix[ID].y;}
|
||||||
@ -73,46 +74,35 @@ byte id_curr,id_next,bz;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte count_blocks()
|
|
||||||
{
|
|
||||||
byte kol_vo=0;
|
|
||||||
FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) kol_vo++;
|
|
||||||
return kol_vo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
byte check_for_end()
|
byte check_for_end()
|
||||||
byte id_next_two, id_next_one, crr;
|
|
||||||
{
|
{
|
||||||
for (j=0; j<8; j++) for (i=0; i<8; i++)
|
byte id_next, id_curr;
|
||||||
|
for (j=0; j<64; j+=8) for (i=0; i<8; i++)
|
||||||
{
|
{
|
||||||
crr=j*8+i;
|
id_curr=j+i;
|
||||||
id_next_one=crr+1;
|
id_next=id_curr+1;
|
||||||
id_next_two=j+1*8+i;
|
IF (matrix[id_curr].color==matrix[id_next].color)&&(matrix[id_curr].mark==0)&&(matrix[id_next].mark==0) return 0;
|
||||||
IF (matrix[crr].color==matrix[id_next_one].color)&&(matrix[crr].mark==0)&&(matrix[id_next_one].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;
|
||||||
IF (matrix[crr].color==matrix[id_next_two].color)&&(matrix[crr].mark==0)&&(matrix[id_next_two].mark==0) return 0;
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_it()
|
void move_it()
|
||||||
byte but_id_curr,but_id_next, count, x;
|
byte but_id, count, x;
|
||||||
{
|
{
|
||||||
for (x=0;x<8;x++)
|
for (x=0;x<8;x++)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++;
|
FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++;
|
||||||
if (count == 8) for (i=0;i<8;i++)
|
if (count == 8) FOR (i=0;i<8;i++)
|
||||||
{
|
{
|
||||||
XX=x;
|
XX=x;
|
||||||
WHILE (XX<7)
|
WHILE (XX<7)
|
||||||
{
|
{
|
||||||
but_id_curr=i*8+XX;
|
but_id=i*8+XX;
|
||||||
but_id_next=i*8+XX+1;
|
matrix[but_id].mark=matrix[but_id+1].mark;
|
||||||
matrix[but_id_curr].mark=matrix[but_id_next].mark;
|
matrix[but_id].color=matrix[but_id+1].color;
|
||||||
matrix[but_id_curr].color=matrix[but_id_next].color;
|
IF (XX == 6) matrix[but_id+1].mark=1;
|
||||||
matrix[but_id_next].mark=1;
|
|
||||||
IF (XX+1 == 7) matrix[but_id_next].mark=1;
|
|
||||||
XX++;
|
XX++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,22 +110,71 @@ byte but_id_curr,but_id_next, count, x;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReDraw_Blocks(byte newgame)
|
||||||
|
{
|
||||||
|
byte num=0, y=22, count_blocks=0, temp[10];
|
||||||
|
for (i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
for (j=0;j<8;j++)
|
||||||
|
{
|
||||||
|
IF (newgame)
|
||||||
|
{
|
||||||
|
matrix[num].mark=0;
|
||||||
|
XX=9; YY=0;
|
||||||
|
matrix[num].color = random(5)+1;
|
||||||
|
}
|
||||||
|
DeleteButton(i*8+j);
|
||||||
|
matrix[num].x=j;
|
||||||
|
matrix[num].y=i;
|
||||||
|
IF (matrix[num].mark==0)
|
||||||
|
{
|
||||||
|
DefineButton(j*21+5,y-22, 20, 20, num+BT_HIDE, 0);
|
||||||
|
PutImage(matrix[num].color-1*1323+#img,21,21,j*21+5,y-22);
|
||||||
|
} ELSE DrawBar(j*21+5,y-22,21,21, 0xB2B4BF);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
y=y+21;
|
||||||
|
}
|
||||||
|
DrawBar(95,178,71,8,0xE4DFE1);
|
||||||
|
IF (check_for_end()==1) WriteText(95,178,0x80,0,"<22>¥§ã«ìâ â:",10);
|
||||||
|
ELSE WriteText(101,178,0x80,0,"Žáâ «®áì:",10);
|
||||||
|
FOR (i=0;i<8;i++) FOR (j=0;j<8;j++) IF (matrix[j*8+i].mark==0) count_blocks++;
|
||||||
|
WriteText(155,178,0x80,0,IntToStr(count_blocks),0);
|
||||||
|
//
|
||||||
|
if (check_for_end()==1) && (count_blocks<8)
|
||||||
|
{
|
||||||
|
DrawFlatButton(26,42,125,62,0,0xE4DFE1,"");
|
||||||
|
IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp);
|
||||||
|
IF (count_blocks==1) copystr(" <20>४à á®", #temp);
|
||||||
|
IF (count_blocks==2) copystr("Žç¥ì å®à®è®!", #temp);
|
||||||
|
IF (count_blocks>=3) //¡ £!!!
|
||||||
|
{
|
||||||
|
copystr(" <20>¥¯«®å®", #temp);
|
||||||
|
count_blocks=3;
|
||||||
|
}
|
||||||
|
PutImage(count_blocks*42*37*3+#cups,42,37,68,48);
|
||||||
|
WriteText(51,91,0x80,0x0,#temp,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{ dword id;
|
{ byte id;
|
||||||
randomize();
|
randomize();
|
||||||
skin_width = GetSkinWidth();
|
|
||||||
ReDraw_Blocks(1);
|
ReDraw_Blocks(1);
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
switch(WaitEvent())
|
switch(WaitEvent())
|
||||||
{
|
{
|
||||||
|
CASE evKey: IF (GetKey()==051) ReDraw_Blocks(1); break; //New game
|
||||||
CASE evButton:
|
CASE evButton:
|
||||||
id=GetButtonID();
|
id=GetButtonID();
|
||||||
IF (id==600) {ExitProcess(); break;}
|
IF (id==255) ExitProcess();
|
||||||
ELSE IF (id==500) {ReDraw_Blocks(1);break;}
|
IF (id==254) {ReDraw_Blocks(1); break;} //New game
|
||||||
ELSE {
|
IF (id<65) IF (check_for_end()<>1)
|
||||||
|
{ //if Button
|
||||||
destroy_button(id);
|
destroy_button(id);
|
||||||
IF (XX!=9)&&(need_redraw==1)
|
IF (XX!=9)
|
||||||
{
|
{
|
||||||
shift_bars(XX,YY);
|
shift_bars(XX,YY);
|
||||||
IF (YY == 7) {move_it();move_it();}
|
IF (YY == 7) {move_it();move_it();}
|
||||||
@ -145,59 +184,18 @@ void main()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case evKey: IF (GetKey()==051) ReDraw_Blocks(1); break;//New game
|
case evReDraw:
|
||||||
case evReDraw: draw_window(); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ExitProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReDraw_Blocks(dword newgame)
|
|
||||||
{
|
|
||||||
dword num=0, y;
|
|
||||||
y=skin_width;
|
|
||||||
for (i=0;i<8;i++)
|
|
||||||
{
|
|
||||||
for (j=0;j<8;j++)
|
|
||||||
{
|
|
||||||
IF (newgame == 1)
|
|
||||||
{
|
|
||||||
matrix[num].mark=0;
|
|
||||||
XX=9; YY=0;
|
|
||||||
matrix[num].color = random(5)+1;
|
|
||||||
}
|
|
||||||
DefineButton(1,1,1,1,i*8+j+BT_DEL,1);
|
|
||||||
matrix[num].x=j;
|
|
||||||
matrix[num].y=i;
|
|
||||||
IF (matrix[num].mark==0)
|
|
||||||
{
|
|
||||||
DefineButton(j*21+5,y-22, 20, 20, num+BT_HIDE, matrix[num].color);
|
|
||||||
PutImage(matrix[num].color-1*21*21*3+#img,21,21,j*21+5,y-22);
|
|
||||||
} ELSE DrawBar(j*21+5,y-22,21,21, 0xB2B4BF);
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
y=y+21;
|
|
||||||
}
|
|
||||||
EDI = 0x00E4DFE1; //梥⠯ ¥«¨
|
|
||||||
IF (check_for_end()==1) WriteText(95,178,0xC0,0x000000,"<22>¥§ã«ìâ â:",10); //184
|
|
||||||
ELSE WriteText(95,178,0xC0,0x000000," Žáâ «®áì:",10);
|
|
||||||
WriteText(155,178,0xC0,0x000000,IntToStr(count_blocks()),0); //<2F>«®ª®¢ ®áâ «®áì
|
|
||||||
IF (count_blocks()<10) DrawBar(161,178,6,8,0xE4DFE1);
|
|
||||||
need_redraw=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_window()
|
|
||||||
{
|
|
||||||
WindowRedrawStatus(1);
|
WindowRedrawStatus(1);
|
||||||
DefineAndDrawWindow(300,176,177,201+skin_width,0x04,0x00B2B4BF,0,0,0);
|
skin_width = GetSkinWidth();
|
||||||
DefineButton(155,2-skin_width,18,18,600+BT_HIDE+BT_NOFRAME,0x0866CC00); //ª®¯ª § ªàëâ¨ï
|
DefineAndDrawWindow(400,276,177,201+skin_width,0x44,0x10B2B4BF,0,0,"Just Clicks v0.75");
|
||||||
DrawTitle("Just Clicks v0.6 L&V");
|
//DefineButton(155,2-skin_width,18,18,255+BT_HIDE+BT_NOFRAME,0x0866CC00);
|
||||||
DrawBar(5,168,168,29,0xE4DFE1); //¯®«¥ ᨧã
|
DrawBar(5,168,168,29,0xE4DFE1);
|
||||||
DrawFlatButton(9,172,84,19,500,0xE4DFE1); //New E4DFE1
|
//DrawFlatButton(9,172,84,19,254,0xE4DFE1,"New game (F2)");
|
||||||
WriteText(14,178,0x80,0,"New game (F2) ",14);
|
DrawFlatButton(9,172,80,19,254,0xE4DFE1,"‡ ®¢® (F2)");
|
||||||
//WriteText(95,172,0x80,0," “஢¥ì:01",10); //“஢¥ì
|
|
||||||
ReDraw_Blocks(0);
|
ReDraw_Blocks(0);
|
||||||
WindowRedrawStatus(2);
|
WindowRedrawStatus(2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
c--\c-- clicks.c--
|
c--\c-- clicks.c--
|
||||||
del clicks.kex
|
del clicks.kex
|
||||||
rename clicks.com clicks.kex
|
rename clicks.com clicks.kex
|
||||||
rename clicks clicks.kex
|
rem rename clicks clicks.kex
|
||||||
pause
|
pause
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@ -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, 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,
|
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,
|
0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C, 0xE2, 0xE2, 0x8C,
|
BIN
programs/games/clicks/trunk/files/cups.png
Normal file
BIN
programs/games/clicks/trunk/files/cups.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
1168
programs/games/clicks/trunk/files/cups.txt
Normal file
1168
programs/games/clicks/trunk/files/cups.txt
Normal file
File diff suppressed because it is too large
Load Diff
52
programs/games/clicks/trunk/lib/RANDOM.H--
Normal file
52
programs/games/clicks/trunk/lib/RANDOM.H--
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
MenuetOS MineSweeper
|
||||||
|
Copyright (C) 2003 Ivan Poddubny
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
|
||||||
|
|
||||||
|
:int random(int max)
|
||||||
|
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî
|
||||||
|
{
|
||||||
|
$rdtsc // eax & edx
|
||||||
|
$xor eax,edx
|
||||||
|
$not eax
|
||||||
|
|
||||||
|
EBX = generator;
|
||||||
|
$ror ebx,3
|
||||||
|
$xor ebx,0xdeadbeef
|
||||||
|
EBX += EAX;
|
||||||
|
generator = EBX;
|
||||||
|
|
||||||
|
EAX += EBX;
|
||||||
|
EAX = EAX % max;
|
||||||
|
return EAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
:randomize()
|
||||||
|
// initialize random number generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
||||||
|
{
|
||||||
|
asm
|
||||||
|
{
|
||||||
|
mov eax,3
|
||||||
|
int 0x40
|
||||||
|
ror eax,16
|
||||||
|
}
|
||||||
|
generator = EAX;
|
||||||
|
}
|
182
programs/games/clicks/trunk/lib/kolibri.h--
Normal file
182
programs/games/clicks/trunk/lib/kolibri.h--
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
#code32 TRUE
|
||||||
|
|
||||||
|
char os_name[8] = {'M','E','N','U','E','T','0','1'};
|
||||||
|
dword os_version = 0x00000001;
|
||||||
|
dword start_addr = #main;
|
||||||
|
dword final_addr = #stop+32;
|
||||||
|
dword alloc_mem = 0x00100000;
|
||||||
|
dword x86esp_reg = 0x0007fff0;
|
||||||
|
dword I_Param = 0x0;
|
||||||
|
dword I_Icon = 0x0;
|
||||||
|
dword skin_width;
|
||||||
|
|
||||||
|
#define evButton 3
|
||||||
|
#define evKey 2
|
||||||
|
#define evReDraw 1
|
||||||
|
#define evNet 8
|
||||||
|
|
||||||
|
#define BT_DEL 0x80000000
|
||||||
|
#define BT_HIDE 0x40000000
|
||||||
|
#define BT_NOFRAME 0x20000000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline fastcall dword WaitEvent(){
|
||||||
|
EAX = 10; // wait here for event
|
||||||
|
$int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline fastcall void ExitProcess(){
|
||||||
|
EAX = -1; // close this program
|
||||||
|
$int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fastcall word GetKey(){
|
||||||
|
EAX = 2; // just read it key from buffer
|
||||||
|
$int 0x40
|
||||||
|
EAX = EAX >> 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user