Mine game v0.60 (21/03/2025)
- proper window rolling up fix - bigger cells and fonts - add icon to a new game button
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
====Leency====
|
||||
|
||||
v0.60 (21/03/2025)
|
||||
- proper window rolling up fix
|
||||
- bigger cells and fonts
|
||||
- add icon to a new game button
|
||||
|
||||
v0.52 (16/12/2008)
|
||||
- window rolling up fix
|
||||
|
||||
|
@@ -19,29 +19,29 @@
|
||||
|
||||
*******************************************************************************/
|
||||
?define HEADER_Y 4
|
||||
?define BTNSIZE 19
|
||||
?define BTNSIZE 21
|
||||
?define CENTER_POS xsize / 2 - 10
|
||||
char game_mode[] = "1/3";
|
||||
|
||||
void draw_window() // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
void draw_window()
|
||||
{
|
||||
sys_get_colors(#colors, 40);
|
||||
dword iconimg = sys_memopen("ICONS18", 0, SHM_READ);
|
||||
//sys_get_colors(#colors, 40);
|
||||
|
||||
// WINDOW
|
||||
sys_window_redraw(1);
|
||||
EBX = xpos << 16 + xsize + 9;
|
||||
ECX = ypos << 16 + ysize;
|
||||
sys_draw_window(EBX, ECX, 0x34CCCCCC, colors.w_work | 0x80000000, "MineSweeper");
|
||||
sys_window_redraw(2);
|
||||
sys_draw_window(EBX, ECX, 0x34CCCCCC, clGray | 0x80000000, "MineSweeper");
|
||||
|
||||
// Leency ROLLED UP FIX
|
||||
sys_process_info(#procinfo, -1);
|
||||
IF (procinfo.ysize<70) return;
|
||||
#define ROLLED_UP 0x04
|
||||
IF (procinfo.status_window&ROLLED_UP) return;
|
||||
|
||||
// <NEW GAME> BUTTON (911)
|
||||
EBX = xsize / 2 - 10;
|
||||
EBX = EBX << 16 + BTNSIZE;
|
||||
sys_draw_button(EBX, HEADER_Y<<16+BTNSIZE, 911+BT_HIDE, clLightGray);
|
||||
draw_rectangle(xsize/2-10,HEADER_Y,BTNSIZE,BTNSIZE,clWhite,clDarkGray);
|
||||
sys_draw_button(CENTER_POS << 16 + BTNSIZE, HEADER_Y<<16+BTNSIZE, 911+BT_HIDE, clLightGray);
|
||||
draw_rectangle(CENTER_POS,HEADER_Y,BTNSIZE,BTNSIZE,clWhite,clDarkGray);
|
||||
draw_rectangle(CENTER_POS+1,HEADER_Y+1,BTNSIZE-2,BTNSIZE-2,clWhite,clWhite);
|
||||
sys_put_palette_image(18*18*4*58 + iconimg, 18<<16+18, CENTER_POS+2<<16+HEADER_Y+2, 32, 0);
|
||||
|
||||
// <CHANGE MODE> BUTTON (1001)
|
||||
sys_draw_button(5<<16+32, HEADER_Y<<16+BTNSIZE, 1001+BT_HIDE, clLightGray);
|
||||
@@ -52,9 +52,11 @@ void draw_window() //
|
||||
// <USER FIELD> BUTTON (1002)
|
||||
//sys_draw_button(BTNSIZE<<16+7, ECX, EDX+1, 0xddbb44);
|
||||
|
||||
draw_time(); // draw timer
|
||||
draw_mines_left(); // draw mines
|
||||
draw_squares(); // draw field
|
||||
draw_time();
|
||||
draw_mines_left();
|
||||
draw_squares();
|
||||
|
||||
sys_window_redraw(2);
|
||||
}
|
||||
|
||||
dword num_colors[8]=
|
||||
@@ -70,11 +72,11 @@ dword num_colors[8]=
|
||||
};
|
||||
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Draw a single square
|
||||
void draw_square(int x, y)
|
||||
{
|
||||
int xl, xr, yt, yb; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
dword tcolor = clBlack; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int xl, xr, yt, yb; // lefx, right, top, bottom
|
||||
dword tcolor = clBlack; // set default color as black
|
||||
byte tchar, tval;
|
||||
|
||||
xl = XPX * x + XST;
|
||||
@@ -86,7 +88,7 @@ void draw_square(int x, y)
|
||||
ECX = yt+1 << 16 + yb - yt-1;
|
||||
$inc ebx
|
||||
$inc ecx
|
||||
sys_draw_bar(EBX, ECX, clLightGray); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
sys_draw_bar(EBX, ECX, clLightGray); // fill bg
|
||||
|
||||
if (!get_open(x, y))
|
||||
{
|
||||
@@ -106,10 +108,10 @@ void draw_square(int x, y)
|
||||
|
||||
IF (get_mark(x,y))
|
||||
{
|
||||
EBX = xl + 5 << 16 + yt + 4;
|
||||
sys_write_text(EBX, tcolor, #tchar, 1);
|
||||
EBX = xl + 6 << 16 + yt + 4;
|
||||
sys_write_text(EBX, tcolor + 0x10000000, #tchar, 1);
|
||||
EBX += 0x00010000;
|
||||
/* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/* Second run - registers are saved */
|
||||
sys_write_text(EBX, ECX, EDX, ESI);
|
||||
}
|
||||
}
|
||||
@@ -128,8 +130,8 @@ void draw_square(int x, y)
|
||||
tchar = tval + '0';
|
||||
tcolor = num_colors[tval-1];
|
||||
}
|
||||
EBX = xl + 5 << 16 + yt + 5;
|
||||
sys_write_text(EBX, tcolor, #tchar, 1);
|
||||
EBX = xl + 7 << 16 + yt + 4;
|
||||
sys_write_text(EBX, tcolor+0x10000000, #tchar, 1);
|
||||
EBX += 0x00010000;
|
||||
sys_write_text(EBX, ECX, EDX, ESI);
|
||||
}
|
||||
@@ -152,7 +154,7 @@ void draw_mines_left()
|
||||
}
|
||||
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// Draw mine field
|
||||
void draw_squares()
|
||||
{
|
||||
int x,y;
|
||||
|
@@ -64,7 +64,8 @@ struct ProcessInfo
|
||||
ystart,
|
||||
xsize,
|
||||
ysize;
|
||||
byte not_used2[974];
|
||||
char status_window;
|
||||
byte reserved[1024-71];
|
||||
};
|
||||
|
||||
#define SystemColors SystemColours // usa/british
|
||||
@@ -212,6 +213,17 @@ inline fastcall dword sys_put_image(dword EBX, ECX, EDX)
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
:void sys_put_palette_image(dword inbuf,wh,xy,bits,pal)
|
||||
{
|
||||
EAX = 65;
|
||||
EBX = inbuf;
|
||||
ECX = wh;
|
||||
EDX = xy;
|
||||
ESI = bits;
|
||||
EDI = pal;
|
||||
EBP = 0;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
08 = DEFINE BUTTON
|
||||
@@ -1122,6 +1134,39 @@ inline fastcall dword window_move_size(dword EBX,ECX,EDX,ESI){
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
68.11 = mem_init is required to work with heap
|
||||
*********************************************************/
|
||||
|
||||
inline fastcall void sys_mem_init()
|
||||
{
|
||||
$mov eax, 68
|
||||
$mov ebx, 11
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
68.22 = shared memory
|
||||
in:
|
||||
ecx = area name, 31 symbols max
|
||||
edx = area size for SHM_CREATE SHM_OPEN_ALWAYS
|
||||
esi = flags, see the list below
|
||||
out:
|
||||
eax = pointer to memory or 0
|
||||
edx = memsize
|
||||
*********************************************************/
|
||||
|
||||
#define SHM_OPEN 0x00
|
||||
#define SHM_OPEN_ALWAYS 0x04
|
||||
#define SHM_CREATE 0x08
|
||||
#define SHM_READ 0x00
|
||||
#define SHM_WRITE 0x01
|
||||
inline fastcall dword sys_memopen(ECX, EDX, ESI)
|
||||
{
|
||||
$mov eax, 68
|
||||
$mov ebx, 22
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
-1 = EXIT PROCESS
|
||||
|
@@ -26,15 +26,15 @@
|
||||
//? define DEBUG 1
|
||||
|
||||
? print "\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ"
|
||||
? print "\n<> KolibriOS MineSweeper v0.52 <20>"
|
||||
? print "\n<> (C) Leency (leency@mail.ru) 2010,2011 <20>"
|
||||
? print "\n<> KolibriOS MineSweeper v0.60 <20>"
|
||||
? print "\n<> (C) Leency (leency@mail.ru) 2010-2025 <20>"
|
||||
? print "\n<> (C) Ivan Poddubny (ivan-yar@bk.ru) 2003,2004 <20>"
|
||||
? print "\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n"
|
||||
|
||||
/************************************** DATA **************************************/
|
||||
|
||||
? define XPX 16 // X pixels by square - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
? define YPX 16 // Y pixels by square
|
||||
? define XPX 21 // X pixels by square - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
? define YPX 21 // Y pixels by square
|
||||
? define MINE 255 // <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> value = MINE
|
||||
|
||||
struct
|
||||
@@ -59,7 +59,7 @@ struct
|
||||
} stdmodes[3] = {9,9,10, 16,16,40, 30,16,99}; // {x,y,m}
|
||||
|
||||
?define XST 5 // offset of first pixel X - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
?define YST 28
|
||||
?define YST 30
|
||||
|
||||
int ncx, // number of squares in X - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
ncy,
|
||||
@@ -429,6 +429,8 @@ void end_game()
|
||||
|
||||
void main()
|
||||
{
|
||||
sys_mem_init();
|
||||
|
||||
new_game();
|
||||
draw_window();
|
||||
|
||||
|
Reference in New Issue
Block a user