From 3e5852cee7bc0ecf75fbaa45b2d428b1e1df4e0d Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 7 Feb 2016 20:43:08 +0000 Subject: [PATCH] tetris, mine: appearance fixes git-svn-id: svn://kolibrios.org@6166 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/mine/trunk/draw.h-- | 6 +- programs/games/mine/trunk/kos_sys.h-- | 10 +- programs/games/mine/trunk/mine.c-- | 1 - programs/games/mine/trunk/uf.h-- | 232 ------------------------- programs/games/tetris/trunk/tetris.asm | 49 ++---- 5 files changed, 22 insertions(+), 276 deletions(-) delete mode 100644 programs/games/mine/trunk/uf.h-- diff --git a/programs/games/mine/trunk/draw.h-- b/programs/games/mine/trunk/draw.h-- index 09270bccae..1cf29c7af6 100644 --- a/programs/games/mine/trunk/draw.h-- +++ b/programs/games/mine/trunk/draw.h-- @@ -27,7 +27,7 @@ void draw_window() // sys_window_redraw(1); EBX = xpos << 16 + xsize; ECX = ypos << 16 + ysize; - sys_draw_window(EBX, ECX, 0x14CCCCCC, colors.w_grab | 0x80000000, "MineSweeper"); + sys_draw_window(EBX, ECX, 0x14CCCCCC, colors.w_work | 0x80000000, "MineSweeper"); sys_window_redraw(2); // Leency ROLLED UP FIX @@ -135,7 +135,7 @@ void draw_square(int x, y) // Таймер void draw_time() { - sys_draw_bar(XST<<16+25, 31<<16+10, 0xCCCCCC); + sys_draw_bar(XST<<16+25, 31<<16+14, 0xCCCCCC); sys_write_number(0x00030000, time, XST<<16+32, 0x10ff0000); } @@ -146,7 +146,7 @@ void draw_minesi() EBX = xsize - XST - 25; $PUSH EBX EBX = EBX << 16 + 25; - sys_draw_bar(EBX, 31<<16+10, 0xCCCCCC); + sys_draw_bar(EBX, 31<<16+14, 0xCCCCCC); $POP EDX EDX <<= 16; EDX += 32; sys_write_number(0x00030000, cmines, EDX, 0x10ff0000); diff --git a/programs/games/mine/trunk/kos_sys.h-- b/programs/games/mine/trunk/kos_sys.h-- index 9a926894bd..b0254b51d7 100644 --- a/programs/games/mine/trunk/kos_sys.h-- +++ b/programs/games/mine/trunk/kos_sys.h-- @@ -65,11 +65,11 @@ struct ProcessInfo struct SystemColours { - dword w_frames, - w_grab, - w_grab_button, - w_grab_button_text, - w_grab_text, + dword nonset1, + nonset2, + work_3d_dark, + work_3d_light, + w_title, w_work, w_work_button, w_work_button_text, diff --git a/programs/games/mine/trunk/mine.c-- b/programs/games/mine/trunk/mine.c-- index 38482ba191..5cb55705dd 100644 --- a/programs/games/mine/trunk/mine.c-- +++ b/programs/games/mine/trunk/mine.c-- @@ -102,7 +102,6 @@ inline void fastcall mouse_disable() # include "draw.h--" // drawing functions # include "access.h--" // get & set functions # include "random.h--" // random number generator -//? include "uf.h--" // user field window void init() diff --git a/programs/games/mine/trunk/uf.h-- b/programs/games/mine/trunk/uf.h-- deleted file mode 100644 index cf140ab013..0000000000 --- a/programs/games/mine/trunk/uf.h-- +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - - MenuetOS MineSweeper - Copyright (C) 2003, 2004 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 - -*******************************************************************************/ - -// USER FIELD WINDOW - -byte px,py,pm; - -byte uf_open = FALSE; -byte uf_stack[2048]; - -dword active_textbox = #str1; - -byte str1[4] = {'1','1','1',0}; -byte str2[4] = {'2','2','2',0}; -byte str3[4] = {'3','2','1',0}; - -dword uf_x=0, - uf_y=0; - -:fastcall dword str2dword(dword EAX) -// str2byte переводит строку из 3ёх цифр в байт -// IN: EAX = адрес сторки -// OUT: EAX = байт -{ - EDX = 0; - ECX = 0; - WHILE(ECX<3) - { - EDX *= 10; - EBX = DSBYTE[EAX+ECX]; - EBX -= '0'; - EDX += EBX; - ECX++; - } - EAX = EDX; -} - -:fastcall void dword2str(dword EAX,ESI) -{ - $PUSHA - DSDWORD[ESI]=0; -// EAX &= 255; - EDI = 10; - ECX = 2; - WHILE(ECX>=0) - { - IF(!EAX) BREAK; - $XOR EDX,EDX - $DIV EDI // al = div; dl = mod - DL += '0'; - DSBYTE[ESI+ECX] = DL; - ECX--; - } - $POPA -} - -void draw_uf_window() -{ - #ifdef DEBUG - sys_debug_write_string("MINE: отрисовка UF\n"w); - #endif - - sys_get_colors(#colors, 40); - sys_window_redraw(1); - - EDX = colors.w_work; - $bts edx,25 - EBX = uf_x; - ECX = uf_y; - sys_draw_window(EBX, ECX, EDX, colors.w_grab | 0x80000000, colors.w_frames); - ECX = colors.w_grab_text | 0x10000000; - sys_write_text(7<<16+8, colors.w_grab_text | 0x10000000, "USER FIELD"n, 10); - sys_draw_button(83<<16+12, 5<<16+12, 1, colors.w_grab_button); - - // three buttons: - // 1) WIDTH 10 - // 2) HEIGHT 11 - // 3) MINES 12 - // and also: - // OK, Cancel - 20,21 - - sys_draw_button(54<<16+38, 30<<16+10, 10, 0xe0e0e0); // WIDTH - EDX++; sys_draw_button(EBX, 48<<16+10, EDX, ESI); // HEIGHT - EDX++; sys_draw_button(EBX, 66<<16+10, EDX, ESI); // MINES - - ESI = colors.w_work_button; - ECX = 84<<16+10; - sys_draw_button( 8<<16+38, ECX, 20, ESI); EDX++; - sys_draw_button(54<<16+38, ECX, EDX, ESI); - - ECX = colors.w_work_text | 0x10000000; - sys_write_text(8<<16+32, ECX, "WIDTH"n, 5); - sys_write_text(8<<16+50, ECX, "HEIGHT"n, 6); - sys_write_text(8<<16+68, ECX, "MINES"n, 5); - - sys_write_text(72<<16+32, 0, #str1, 3); - sys_write_text(72<<16+50, 0, #str2, 3); - sys_write_text(72<<16+68, 0, #str3, 3); - - sys_write_text(21<<16+86, colors.w_work_button_text, "OK Cancel", 12); - - sys_window_redraw(2); -} - - -void uf_main() -{ - #ifdef DEBUG - sys_debug_write_string("MINE: поток создан\n"w); - #endif - -// dword2str(13, #str1); -// EAX = str2dword(#str3); -// dword2str(EAX, #str2); - - uf_x <<= 16; uf_x += 100; - uf_y <<= 16; uf_y += 104; - draw_uf_window(); - - #ifdef DEBUG - sys_debug_write_string("MINE: жду событий\n"w); - #endif - - WHILE() - { - SWITCH (sys_wait_event()) - { - case 1: draw_uf_window(); - break; - - case 2: //IF (sys_get_key() == 27) - //{ - // uf_open = FALSE; - // sys_exit_process(); - //} - //EAX = key now! - EAX = sys_get_key(); - if (active_textbox != 0) - { - EBX = #str1; //active_textbox; - DSBYTE[EBX] = 'A'; - DSBYTE[EBX] = DSBYTE[EBX+1]; - DSBYTE[EBX+1] = DSBYTE[EBX+2]; - DSBYTE[EBX+2] = AL; - draw_uf_window(); - } - break; - - case 3: uf_button(); - } - } -} - -uf_button() -{ - switch (sys_get_button_id()) - { - case 10: - // set [width] INPUT active - active_textbox = #str1; break; - case 11: - // set [height] INPUT active - active_textbox = #str2; break; - case 12: - // set [mines] INPUT active - active_textbox = #str3; break; - - case 20: - // [string -> byte] three times and save them - px = str2dword(#str1); - py = str2dword(#str2); - pm = str2dword(#str3); - mode = 4; - case 21: - // close UF window, forget all changes - - case 1: - uf_open = FALSE; - sys_exit_process(); - } -} - -void start_uf() -{ - #ifdef DEBUG - sys_debug_write_string("MINE: вызвана start_uf\n"w); - #endif - - sys_process_info(#procinfo, -1); - uf_x = procinfo.xstart + XST; - uf_y = procinfo.ystart + YST; - - #ifdef DEBUG - sys_debug_write_string("MINE: создаю поток...\n"w); - #endif - - sys_create_thread(#uf_main, #uf_stack + 2048); - - IF(EAX > 0x80000000) - return; - - uf_open = TRUE; - mouse_disable(); - WHILE (uf_open == TRUE) - { - SWITCH (sys_wait_event_timeout(5)) - { - CASE 1: draw_window(); CONTINUE; - CASE 2: sys_get_key(); CONTINUE; - CASE 3: sys_get_button_id(); CONTINUE; - } - } - mouse_enable(); -} \ No newline at end of file diff --git a/programs/games/tetris/trunk/tetris.asm b/programs/games/tetris/trunk/tetris.asm index ccf9198635..95cd38c8d8 100644 --- a/programs/games/tetris/trunk/tetris.asm +++ b/programs/games/tetris/trunk/tetris.asm @@ -26,7 +26,6 @@ ; 31.10.2001 - rdtsc replaced - quickcode ; 28.06.2001 - fasm port & framed blocks - Ville Turjanmaa ; -; LEN_X equ 19 ;width of table LEN_Y equ 29 ; height of table @@ -254,50 +253,30 @@ jmp still ; ********************************************* draw_window: - - mov eax,48 - mov ebx,3 - mov ecx,sc - mov edx,sizeof.system_colors - int 0x40 - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw - int 0x40 - - ; DRAW WINDOW + mcall 48,3,sc,sizeof.system_colors + mcall 12,1 + ; DRAW WINDOW xor eax,eax ; function 0 : define and draw window mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2 - mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30 + mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+36 mov edx,[sc.work] ; color of work area RRGGBB or edx,0x13000000 mov edi,title ; WINDOW LABEL int 0x40 - - mov eax,8 - mov ebx,30*65536+100 - mov ecx,378*65536+18 - mov edx,2 - mov esi,[sc.work_button] - int 0x40 -;/////////////////////////////////////////////// Wildwest's 'Pause' button - ;mov eax,8 - mov ebx,132*65536+102 - mov ecx,378*65536+18 - mov edx,3 - mov esi,[sc.work_button]; - int 0x40 + mcall 8, 30*65536+100,378*65536+22,2,[sc.work_button] ;new game + mcall ,132*65536+102, ,3 ;Wildwest's 'Pause' button +;/////////////////////////////////////////////// mov eax,4 ; function 4 : write text to window - mov ebx,164*65536+384 ; [x start] *65536 + [y start] + mov ebx,164*65536+383 ; [x start] *65536 + [y start] mov ecx,[sc.work_button_text] ; color of text RRGGBB or ecx,0x90000000 mov edx,labe ; pointer to text int 0x40 ;/////////////////////////////////////////////// ;mov eax,4 - mov ebx,49*65536+384 + mov ebx,49*65536+383 mov edx,game_finished int 0x40 call draw_table @@ -306,7 +285,7 @@ draw_window: call draw_block cld - mov ebx,38*65536+35 ; draw info text with function 4 + mov ebx,38*65536+32 ; draw info text with function 4 mov ecx,[sc.work_text] ; color or ecx,0x90000000 mov edx,text @@ -658,7 +637,7 @@ write_score: mov eax,[score] call number_to_str - mov ebx,90*65536+35 ; draw info text with function 4 + mov ebx,90*65536+32 ; draw info text with function 4 mov ecx,[sc.work_text] ; color or ecx,0x50000000 mov edx,number_str @@ -841,21 +820,21 @@ block_table: if lang eq ru - title db '’…’ђ€‘ 1.61 - ‘’ђ…‹Љ€ € ЏђЋЃ…‹',0 + title db '’ҐваЁб 1.62',0 labe db 'ЏЂ“‡Ђ',0 text db 'ЋзЄЁ:',0 game_finished: db ' ЌЋ‚Ђџ',0 else if lang eq et - title db 'TETRIS 1.61 - NOOLED & TЬHIK',0 + title db 'Tetris 1.62',0 labe db 'PAUS',0 text db 'Tulemus:',0 game_finished: db 'UUS MДNG',0 else - title db 'TETRIS 1.61 - ARROWS & SPACE',0 + title db 'Tetris 1.62',0 labe db 'PAUSE',0 text db 'Score:',0 game_finished: db 'NEW GAME',0