Clicks v2.0

git-svn-id: svn://kolibrios.org@2794 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-06-16 15:59:51 +00:00
parent 5f5baa4e63
commit 196f1aeef1
12 changed files with 561 additions and 1599 deletions

View File

@ -1,5 +1,16 @@
********************************************************************************
********************************************************************************
***********************************************************************
***********************************************************************
Just Clicks [new]
Copyright (C) 2012 Leency
История версий:
v2.0
- полностью переписана мной;
- изменение размеров игрового поля;
- игра закрывается по Alt+F4.
***********************************************************************
***********************************************************************
Just Clicks
Copyright (C) 2008-2009 Leency
История версий:
@ -38,20 +49,21 @@ Just Clicks v0.5 (23.03.2008)
Just Clicks v0.4 (13.03.2008)
- окно теперь со скином
- при нажатии на кнопку больше не перерисовывается всё окно, только поле с блоками
- при нажатии на кнопку больше не перерисовывается всё окно, только поле
с блоками
- при нажатии на любую клавишу программа уже не уходит в бесконечный цикл
- клавиша F2 - новая игра
- устранена перерисовка окна в случае, если блоки не сдвигаются.
********************************************************************************
********************************************************************************
***********************************************************************
***********************************************************************
ClickoMania
Copyright (C) 2005 Александр Мушиков aka Olaf
История версий:
ClickoMania v0.2 (05.12.2005)
- Исправлена ошибка - выдача сообщения о конечном результате в то время как игру
можно еще продолжать.
- Исправлена ошибка - выдача сообщения о конечном результате в то время как
игру можно еще продолжать.
ClickoMania v0.1 (23.11.2005)
- Начальная.

View File

@ -0,0 +1,284 @@
//Leency 10.10.2011, JustClicks v2.0, GPL
#include "lib\kolibri.h"
#include "lib\random.h"
#include "lib\boxes.txt"
#include "lang.h"
system_colors sc;
//óðîâíè ñëîæíîñòè
int DIFFICULTY_LEVEL;
char *BOARD_SIZES[]={ "S", "M", "L", 0 };
int DIFFICULTY_LEV_PARAMS[]={ 9, 12, 16 };
int BLOCKS_NUM; //êîëè÷åñòâî êâàäðàòèêîâ ïî Õ è ïî Y
int BLOCKS_LEFT; //áëîêîâ îñòàëîñü
int blocks_matrix[28*28]; //öâåòà äëÿ ïîëÿ ñ êâàäðàòèêàìè
#define USER_PANEL_HEIGHT 35
#define BLOCK_SIZE 21 //ðàçìåð êâàäðàòèêà
#define MARKED 7
#define DELETED_BLOCK 6
#define HEADER "Just Clicks v2.0"
#ifdef LANG_RUS
char NEW_GAME_TEXT[]=" ‡ ­®¢® [F2]";
char REZULT_TEXT[]="<EFBFBD>¥§ã«ìâ â: ";
#else
char NEW_GAME_TEXT[]="New Game [F2]";
char REZULT_TEXT[]="Rezult: ";
#endif
void main()
{
int key, id;
BLOCKS_NUM=DIFFICULTY_LEV_PARAMS[0]; //ïî-óìîë÷àíèþ ñàìîå ìàëåíüêîå ïîëå
new_game();
loop()
switch(WaitEvent())
{
case evButton:
id = GetButtonID();
if (id==1) ExitProcess();
if (id==2) goto _NEW_GAME_MARK;
if (id>=100)
{
if (check_for_end()) break; //åñëè èãðà çàêîí÷åíà
move_blocks(id-100);
draw_field();
draw_clicks_num();
break;
}
if (id==10) //èçìåíÿåì ðàçìåð ïîëÿ
{
if (DIFFICULTY_LEVEL<2) DIFFICULTY_LEVEL++; else DIFFICULTY_LEVEL=0;
BLOCKS_NUM = DIFFICULTY_LEV_PARAMS[DIFFICULTY_LEVEL]; //êîëè÷åñòâî êâàäðàòèêîâ ïî Õ è ïî Y
new_game();
MoveSize(-1, -1, BLOCK_SIZE*BLOCKS_NUM +9, BLOCK_SIZE*BLOCKS_NUM +GetSkinWidth()+4+USER_PANEL_HEIGHT);
break;
}
break;
case evKey:
key = GetKey();
if (key==027) //Escape
ExitProcess();
if (key==051) //F2
{
_NEW_GAME_MARK:
new_game();
draw_clicks_num();
draw_field();
}
break;
case evReDraw:
draw_window();
}
}
void move_blocks(int button_id) //åñëè ôèøêà îäíà, òî íå óäàëÿåì
{
int i, j,
marked_num=1,
old_marker=blocks_matrix[button_id],
restart;
blocks_matrix[button_id]=MARKED;
//âûäåëÿåì âñå ôèøêè òîãî æå ÷âåòà
_RESTART_MARK:
restart=0;
for (i=0;i<BLOCKS_NUM;i++)
for (j=0;j<BLOCKS_NUM;j++)
{
if (blocks_matrix[i*BLOCKS_NUM+j]<>old_marker) continue; //åñëè ôèøêà íå íóæíîãî öâåòà èä¸ì äàëüøå
if (blocks_matrix[i*BLOCKS_NUM+j]==MARKED) continue; //åñëè ôèøêà óæå îòìå÷åíà, èä¸ì äàëåå
if (j>0) && (blocks_matrix[i*BLOCKS_NUM+j-1]==MARKED) blocks_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ëåâûé
if (i>0) && (blocks_matrix[i-1*BLOCKS_NUM+j]==MARKED) blocks_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì âåðõíèé
if (j<BLOCKS_NUM-1) && (blocks_matrix[i*BLOCKS_NUM+j+1]==MARKED) blocks_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì ïðàâûé
if (i<BLOCKS_NUM-1) && (blocks_matrix[i+1*BLOCKS_NUM+j]==MARKED) blocks_matrix[i*BLOCKS_NUM+j]=MARKED; //ñìîòðèì íèæíèé
if (blocks_matrix[i*BLOCKS_NUM+j]==MARKED) //åñëè ôèøêó îòìåòèëè, òî ïîòîì öèêë íóæíî áóäåò ïðîêðóòèòü ñíà÷àëà - ìîæ åù¸ ÷¸ îòìåòèì
{
restart=1;
marked_num++;
}
}
if (restart) goto _RESTART_MARK;
if (marked_num==1) //åñëè áëîê òîëüêî îäèí, óõîäèì
{
blocks_matrix[button_id]=old_marker;
return;
}
//äâèãàåì áëîêè ïî âåðòèêàëè
_2_RESTART_MARK:
restart=0;
for (i=BLOCKS_NUM;i>0;i--)
for (j=BLOCKS_NUM;j>=0;j--)
{
if (blocks_matrix[i*BLOCKS_NUM+j]==MARKED) && (blocks_matrix[i-1*BLOCKS_NUM+j]<>blocks_matrix[i*BLOCKS_NUM+j])
{
blocks_matrix[i*BLOCKS_NUM+j]><blocks_matrix[i-1*BLOCKS_NUM+j];
restart=1;
}
}
if (restart) goto _2_RESTART_MARK;
//îòìå÷àåì ôèøêè, êàê óäàë¸ííûå
for (i=0;i<BLOCKS_NUM*BLOCKS_NUM;i++)
if (blocks_matrix[i]==MARKED)
blocks_matrix[i]=DELETED_BLOCK;
//äâèãàåì áëîêè âëåâî, åñëè åñòü ïóñòîé ñòîëáåö
restart=BLOCKS_NUM; //íå ïðèäóìàë íè÷åãî ëó÷øå :(
_3_RESTART_MARK:
for (j=0;j<BLOCKS_NUM-1;j++)
if (blocks_matrix[BLOCKS_NUM-1*BLOCKS_NUM+j]==DELETED_BLOCK)
{
for (i=0;i<BLOCKS_NUM;i++)
blocks_matrix[i*BLOCKS_NUM+j]><blocks_matrix[i*BLOCKS_NUM+j+1];
}
restart--;
if (restart) goto _3_RESTART_MARK;
}
void draw_window()
{
int j, PANEL_Y;
proc_info Form;
sc.get();
DefineAndDrawWindow(300,176, BLOCK_SIZE*BLOCKS_NUM +9, BLOCK_SIZE*BLOCKS_NUM +GetSkinWidth()+4+USER_PANEL_HEIGHT,
0x74,sc.work,0,0,HEADER);
//ïðîâåðÿåì íå ñõëîïíóòî ëè îêíî â çàãîëîâîê
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
PANEL_Y=BLOCK_SIZE*BLOCKS_NUM;
DrawBar(0,PANEL_Y, PANEL_Y, USER_PANEL_HEIGHT, sc.work); //ïàíåëü ñíèçó
//íîâàÿ èãðà
DefineButton(10,PANEL_Y+7, 13*6+6, 20, 2,sc.work_button);
WriteText(10+4,PANEL_Y+14,0x80,sc.work_button_text,#NEW_GAME_TEXT,0);
//êíîïî÷êa âûáîðà óðîâíÿ ñëîæíîñòè
DefineButton(95,PANEL_Y+7, 20,20, 10,sc.work_button);
WriteText(95+8,PANEL_Y+14,0x80,sc.work_button_text,BOARD_SIZES[DIFFICULTY_LEVEL],0);
draw_field();
draw_clicks_num();
}
int check_for_end()
{
int i, j, button_id;
if (!BLOCKS_LEFT) return 1; //epic win
for (i=0;i<BLOCKS_NUM;i++)
for (j=0;j<BLOCKS_NUM;j++)
{
button_id=blocks_matrix[i*BLOCKS_NUM+j];
if (button_id==DELETED_BLOCK) continue;
if (j>0) && (blocks_matrix[i*BLOCKS_NUM+j-1]==button_id) return 0;
if (i>0) && (blocks_matrix[i-1*BLOCKS_NUM+j]==button_id) return 0;
if (j<BLOCKS_NUM-1) && (blocks_matrix[i*BLOCKS_NUM+j+1]==button_id) return 0;
if (i<BLOCKS_NUM-1) && (blocks_matrix[i+1*BLOCKS_NUM+j]==button_id) return 0;
}
return 2;
}
void draw_clicks_num()
{
char rezult[15];
int i;
int TEXT_Y=BLOCK_SIZE*BLOCKS_NUM+14;
int TEXT_X=TEXT_Y/2+48; //130;
BLOCKS_LEFT=0;
for (i=0;i<BLOCKS_NUM*BLOCKS_NUM;i++)
if (blocks_matrix[i]<>DELETED_BLOCK) BLOCKS_LEFT++;
DrawBar(TEXT_X, TEXT_Y, 18,9, sc.work_button);
WriteText(TEXT_X,TEXT_Y,0x80,sc.work_button_text,IntToStr(BLOCKS_LEFT),0);
if (check_for_end())
{
copystr(#REZULT_TEXT, #rezult);
copystr(IntToStr(BLOCKS_LEFT), #rezult+strlen(#rezult));
if (check_for_end()==1) copystr("Epic WIN!!1", #rezult);
DrawFlatButton(BLOCK_SIZE*BLOCKS_NUM/2-70, BLOCK_SIZE*BLOCKS_NUM/2-20, 140, 40, 2, #rezult);
}
}
void new_game()
{
int i;
//ïÿòü öâåòîâ èñïîëüçóåòñÿ â èãðå äëÿ êâàäðàòèêîâ, MARKED äëÿ òîãî,
//÷òîáû îòìåòèòü êâàäðàòèêè â ïðîöåññå çàëèâêè è DELETED_BLOCK äëÿ èõ óäàëåíèÿ
for (i=0;i<BLOCKS_NUM*BLOCKS_NUM;i++)
blocks_matrix[i] = random(5);
}
void draw_field()
{
int i, j;
int current_id;
for (i=0;i<BLOCKS_NUM;i++)
for (j=0;j<BLOCKS_NUM;j++)
{
current_id = i*BLOCKS_NUM+j;
DeleteButton(current_id+100);
if (blocks_matrix[current_id]==DELETED_BLOCK)
{
DrawBar(j*BLOCK_SIZE,i*BLOCK_SIZE, BLOCK_SIZE,BLOCK_SIZE, 0xB2B4BF);
}
else
{
DefineButton(j*BLOCK_SIZE,i*BLOCK_SIZE,BLOCK_SIZE-1,BLOCK_SIZE-1, current_id+100+BT_HIDE,0);
PutImage(blocks_matrix[current_id]*1323+#img,21,21,j*BLOCK_SIZE,i*BLOCK_SIZE);
}
}
}
void DrawFlatButton(dword x,y,width,height,id,text)
{
DrawRegion_3D(x,y,width,height,sc.work_graph,sc.work_graph);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,sc.work);
DrawBar(x+2,y+2,width-3,height-3,sc.work);
IF (id) DefineButton(x,y,width,height,id+BT_HIDE,sc.work);
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,sc.work_text,text,0);
}
stop:

View File

@ -1,247 +0,0 @@
/*
Just Clicks v0.8
Copyright (C) 2011 Leency
Just Clicks v0.79
Copyright (C) 2011 clevermouse
Clickomania v0.3
Copyright (C) 2005 €«¥ªá ­¤à Œã訪®¢ aka Olaf
*/
#pragma option meos
#include "lib\kolibri.h--"
#include "lib\random.h--"
#include "files\boxes.txt"
#include "files\cups.txt"
#ifndef AUTOBUILD
#include "lang.h--"
#endif
byte i,j, XX, YY;
system_colors sc;
proc_info Form;
struct
{
byte x;
byte y;
byte button_id;
byte mark;
dword color;
}matrix[64];
void check_n_destroy(byte ID, ID1)
{
IF (matrix[ID1].color == matrix[ID].color) && (matrix[ID1].mark!=1)
{
matrix[ID1].mark=1;
destroy_button(ID1);
}
}
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);
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;}
}
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 (matrix[id_next].mark == 1)&&(bz>0) {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;
}
}
}
byte check_for_end()
{
byte id_next, id_curr;
for (j=0; j<64; j+=8) for (i=0; i<8; i++)
{
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;
}
return 1;
}
void move_it()
byte but_id, count, x;
{
for (x=0;x<8;x++)
{
count = 0;
FOR (i=0;i<8;i++) IF (matrix[i*8+x].mark==1) count++;
if (count == 8) FOR (i=0;i<8;i++)
{
XX=x;
WHILE (XX<7)
{
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;
XX++;
}
}
}
}
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,y-22, 20, 20, num+BT_HIDE, 0);
PutImage(matrix[num].color-1*1323+#img,21,21,j*21,y-22);
}
ELSE
DrawBar(j*21,y-22,21,21, 0xB2B4BF);
num++;
}
y=y+21;
}
#ifdef LANG_RUS
DrawBar(90,178,71,8,sc.work);
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++;
WriteNumber(150,178,0x80,sc.work_text,count_blocks);
//
if (check_for_end()==1) && (count_blocks<8)
{
DrawFlatButton();
#ifdef LANG_RUS
IF (count_blocks==0) copystr(" ‹ãçè¥ ¢á¥å!", #temp);
IF (count_blocks==1) copystr(" <20>४à á­®", #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) //¡ £!!!
{
#ifdef LANG_RUS
copystr(" <20>¥¯«®å®", #temp);
#else
copystr(" Not bed", #temp);
#endif
count_blocks=3;
}
PutImage(count_blocks*4662+#cups,42,37,63,48);
#ifdef LANG_RUS
WriteText(46,91,0x80,0x0,#temp,0);
#else
WriteText(58,91,0x80,0x0,#temp,0);
#endif
}
}
void main()
{ byte id;
//randomize();
ReDraw_Blocks(1);
loop()
{
switch(WaitEvent())
{
CASE evKey:
IF (GetKey()==051) ReDraw_Blocks(1); //New game
break;
CASE evButton:
id=GetButtonID();
IF (id==255) ExitProcess();
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;
case evReDraw:
DefineAndDrawWindow(400,276,177,201+GetSkinWidth(),0x74,0x10B2B4BF,0,0,"Just Clicks v0.8");
DefineButton(150,-18,18,18,255+BT_HIDE+BT_NOFRAME,0); //ª­®¯®çª  § ªàëâ¨ï :]
GetProcessInfo(#Form, SelfInfo);
IF (Form.height==GetSkinWidth()+3) BREAK;
sc.get();
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:

View File

@ -1,6 +1,8 @@
echo #define LANG_ENG 1 >lang.h--
c--\c-- clicks.c--
del clicks.kex
rename clicks.com clicks.kex
rem rename clicks clicks.kex
del lang.h
echo #define LANG_ENG 1 >lang.h
..\C--\C-- clicks.c
del clicks
rename clicks.com clicks
del warning.txt
del lang.h
pause

View File

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

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,244 @@
//CODED by Veliant, Leency, Nable. GNU GPL licence.
#startaddress 0
#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 = #0x00010000;
dword x86esp_reg = #0x00010000;
dword I_Param = 0;
dword I_Path = 0;
//Events
#define evButton 3
#define evKey 2
#define evReDraw 1
//Button options
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
//-------------------------------------------------------------------------
struct proc_info{
dword use_cpu;
word pos_in_stack,num_slot,rezerv1;
char name[11];
char rezerv2;
dword adress,use_memory,ID,left,top,width,height;
word status_slot,rezerv3;
dword work_left,work_top,work_width,work_height;
char status_window;
void GetInfo(dword ECX);
byte reserved[1024-71];
#define SelfInfo -1
};
inline fastcall void GetProcessInfo(dword EBX, ECX)
{
EAX = 9;
$int 0x40
}
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(){
EAX = 10;
$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;
$int 0x40
EAX = EAX >> 8;
}
inline fastcall ExitProcess(){
EAX = -1; // close this program
$int 0x40
}
inline fastcall Pause(dword EBX)
{ //EBX = value in milisec
$mov eax, 5
$int 0x40
}
//------------------------------------------------------------------------------
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
}
inline fastcall copystr(dword ESI,EDI)
{
$cld
l1:
$lodsb
$stosb
$test al,al
$jnz l1
}
inline fastcall dword strlen(dword EDI){
EAX=0;
ECX=-1;
$REPNE $SCASB
EAX-=2+ECX;
}
//------------------------------------------------------------------------------
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
{
EAX = 12; // function 12:tell os about windowdraw
EBX = 1;
$int 0x40
EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour;
$xor eax,eax
$int 0x40
EAX = 12; // function 12:tell os about windowdraw
EBX = 2;
$int 0x40
}
inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
{
EAX = 67;
$int 0x40
}
inline fastcall dword GetSkinWidth()
{
$push ebx
$mov eax, 48
$mov ebx, 4
$int 0x40
$pop ebx
}
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
{
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$int 0x40;
}
void DrawBar(dword x,y,w,h,EDX)
{
EAX = 13;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
void DefineButton(dword x,y,w,h,EDX,ESI)
{
EAX = 8;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
inline fastcall void DeleteButton(dword EDX)
{
EAX = 8;
EDX += BT_DEL;
$int 0x40;
}
void DrawRegion_3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1);
DrawBar(x,y+1,1,height-1,color1);
DrawBar(x+width,y+1,1,height,color2);
DrawBar(x,y+height,width,1,color2);
}
void PutImage(dword EBX,w,h,x,y)
{
EAX = 7;
ECX = w<<16+h;
EDX = x<<16+y;
$int 0x40
}
inline fastcall dword WriteDebug(dword EDX)
{
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
next_char:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz done
$int 0x40
$inc edx
$jmp next_char
done:
$mov cl, 13
$int 0x40
$mov cl, 10
$int 0x40
$pop ecx
$pop ebx
}

View File

@ -1,167 +0,0 @@
#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 = 0x00004096;
dword x86esp_reg = 0x00004096;
dword I_Param = 0x0;
dword I_Icon = 0x0;
#define evButton 3
#define evKey 2
#define evReDraw 1
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
struct proc_info{
dword use_cpu;
word pos_in_stack,num_slot,rezerv1;
char name[11];
char rezerv2;
dword adress,use_memory,ID,left,top,width,height;
word status_slot,rezerv3;
dword work_left,work_top,work_width,work_height;
char status_window;
void GetInfo(dword ECX);
byte reserved[1024-71];
#define SelfInfo -1
};
void GetProcessInfo(dword EBX, ECX)
{
EAX = 9;
$int 0x40
}
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(){
EAX = 10; // wait here for event
$int 0x40
}
inline fastcall void ExitProcess(){
EAX = -1; // close this program
$int 0x40
}
inline fastcall byte GetKey(){
EAX = 2; // just read it key from buffer
$int 0x40
EAX = EAX >> 8;
}
inline fastcall byte GetButtonID(){
EAX = 17; // Get ID
$int 0x40
EAX = EAX >> 8;
}
inline fastcall dword GetSkinWidth()
{
EAX = 48;
EBX = 4;
$int 0x40
}
void DefineButton(dword x,y,w,h,EDX,ESI)
{
EAX = 8;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
inline fastcall void DeleteButton(dword EDX)
{
EAX = 8;
EDX += BT_DEL;
$int 0x40;
}
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)
{
WindowRedrawStatus(1);
EAX = 0;
EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour;
$int 0x40
WindowRedrawStatus(2);
}
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
{
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$int 0x40;
}
void DrawBar(dword x,y,w,h,EDX)
{
EAX = 13;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
void PutImage(dword EBX,w,h,x,y)
{
EAX = 7;
ECX = w<<16+h;
EDX = x<<16+y;
$int 0x40
}
void copystr(dword s,d)
{
$mov esi,s
$mov edi,d
$cld
l1:
$lodsb
$stosb
$test al,al
$jnz l1
}
void WriteNumber(dword x,y,byte fontType, ESI, ECX)
{
EAX = 47;
EBX = 2<<16;
EDX = x<<16+y;
ESI = fontType<<24+ESI;
$int 0x40;
}