diff --git a/programs/games/snake/functions.asm b/programs/games/snake/functions.asm index 825b3d8b0..e7a6e8a5f 100644 --- a/programs/games/snake/functions.asm +++ b/programs/games/snake/functions.asm @@ -1,19 +1,19 @@ ; ----------------------------- -; Рисует кнопку с текстовой меткой -; input: pLabel - указатель на структуру LABEL -; id - идентификатор кнопки -; xPosition - позиция X -; yPosition - позиция Y -; bWidth - ширина кнопки -; bHeight - высота кнопки +; Draws a button with a text label +; input: pLabel - pointer to the LABEL structure +; id - button identifier +; xPosition - button position X +; yPosition - button position Y +; bWidth - button width +; bHeight - button height ; ----------------------------- proc draw.Button pLabel, id, xPosition, yPosition, bWidth, bHeight mcall 8, <[xPosition], [bWidth]>, <[yPosition], [bHeight]>, [id], [button_color] - ; позиция X для размещения текста + ; position X for text positioning mov eax, [bHeight] shr eax, 1 add [yPosition], eax - ; позиция Y для размещения текста + ; position Y for text positioning mov eax, [pLabel] mov eax, [eax+LABEL.size] neg eax @@ -22,18 +22,18 @@ proc draw.Button pLabel, id, xPosition, yPosition, bWidth, bHeight add eax, 4 shr eax, 1 add [xPosition], eax - ; размещаем текст на кнопке + ; draw text on the button stdcall draw.Label, [pLabel], [xPosition], [yPosition] ret endp ; ----------------------------- -; Рисует текст по yPosition и центрируя текст по ширине экрана -; с учетом длины текста и указанного смещения в символах -; input: pLabel - указатель на структуру LABEL -; yPosition - позиция Y -; countOffset - кол-во символов для смещения +; Draws text on position yPosition and centered on the width of the screen +; considering the length of the text and the offset in symbols +; input: pLabel - pointer to the LABEL structure +; yPosition - text position Y +; countOffset - number of symbols for offset ; ----------------------------- -proc draw.Navigation pLabel, yPosition, countOffset +proc draw.Label pLabel, yPosition, countOffset mov eax, [pLabel] mov eax, [eax + LABEL.size] sub eax, [countOffset] @@ -42,11 +42,11 @@ proc draw.Navigation pLabel, yPosition, countOffset ret endp ; ----------------------------- -; Рисует число по yPosition и центрируя число по ширине экрана -; с учетом длины числа и указанного смещения в символах -; input: pLabel - указатель на структуру LABEL -; yPosition - позиция Y -; countOffset - кол-во символов для смещения +; Draws a number on position yPosition and centered on the width of the screen +; considering the length of the number and the offset in symbols +; input: pLabel - pointer to the LABEL structure +; yPosition - text position Y +; countOffset - number of symbols for offset ; ----------------------------- proc draw.NavigationNumber pLabel, yPosition, countOffset mov eax, [pLabel] @@ -57,10 +57,10 @@ proc draw.NavigationNumber pLabel, yPosition, countOffset ret endp ; ----------------------------- -; Возвращает координату X для размещения текста по центру экрана -; с учетом указанного смещения в символах -; input: countOffset - кол-во символов для смещения -; output: eax - координата X +; Returns the X coordinate for the text positioning on the center of the screen +; considering the offset in symbols +; input: countOffset - number of symbols for offset +; output: eax - X coordinate ; ----------------------------- proc draw.GetNavigationX countOffset mov eax, [countOffset] @@ -72,12 +72,11 @@ proc draw.GetNavigationX countOffset ret endp ; ----------------------------- -; Формирует в одном регистре координаты в нужном формате добавляя -; ширину смещения символов по X если указано кол-во -; input: xPosition - позиция по X -; yPosition - позиция по Y -; countOffset - кол-во символов для смещения -; output: eax - координата в формате X*65536+Y +; Builds the coordinates of the text label adding the offset in symbols along X +; input: xPosition - X coordinate +; yPosition - Y coordinate +; countOffset - number of symbols for offset +; output: eax - X coordinate in format X*65536+Y ; ----------------------------- proc draw._prepareCoord xPosition, yPosition, countOffset mov eax, [countOffset] @@ -92,12 +91,11 @@ proc draw._prepareCoord xPosition, yPosition, countOffset ret endp ; ----------------------------- -; Рисует текст по указанной позиции X и Y -; и смещает на ширину символов по X если указано -; input: pLabel - указатель на структуру LABEL -; xPosition - позиция X -; yPosition - позиция Y -; countOffset - кол-во символов для смещения +; Draws the text at the X and Y positions and shifts the offset in symbols along X +; input: pLabel - pointer to the LABEL structure +; xPosition - text position X +; yPosition - text position Y +; countOffset - number of symbols for offset ; ----------------------------- proc draw.Label pLabel, xPosition, yPosition, countOffset stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] @@ -110,12 +108,11 @@ proc draw.Label pLabel, xPosition, yPosition, countOffset ret endp ; ----------------------------- -; Рисует число по указанной позиции X и Y -; и смещает на ширину символов по X если указано -; input: pLabel - указатель на структуру LABEL -; xPosition - позиция X -; yPosition - позиция Y -; countOffset - кол-во символов для смещения +; Draws the number at the X and Y positions and shifts the offset in symbols along X +; input: pLabel - pointer to the LABEL structure +; xPosition - text position X +; yPosition - text position Y +; countOffset - number of symbols for offset ; ----------------------------- proc draw.Number pLabel, xPosition, yPosition, countOffset stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] @@ -130,9 +127,9 @@ proc draw.Number pLabel, xPosition, yPosition, countOffset ret endp ; ----------------------------- -; Установить настройки шрифта в зависимости от размера ячейки -; устанавливает высоту, ширину символа и маску для рисования текста и числа -; input: squareSideLength - размер ячейки +; Set configuration of the font depending on the size of the square side +; setting the font size and the font mask text and number +; input: squareSideLength - size of the square side ; ----------------------------- proc draw.setConfigFont squareSideLength cmp [squareSideLength], MIN_SQUARE_SIDE_LENGTH_FONT diff --git a/programs/games/snake/game_over.asm b/programs/games/snake/game_over.asm index 83988c7ed..6c12bc8ec 100644 --- a/programs/games/snake/game_over.asm +++ b/programs/games/snake/game_over.asm @@ -36,7 +36,7 @@ Game_over: call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title - test [proc_info.wnd_state], 0x04 ; is rolled up? + test [proc_info.wnd_state], 0x04 ; is rolled up? jnz @f call Draw_decorations diff --git a/programs/games/snake/level.asm b/programs/games/snake/level.asm index 3e76aafff..887f89074 100644 --- a/programs/games/snake/level.asm +++ b/programs/games/snake/level.asm @@ -19,7 +19,7 @@ mcall 26, 9 call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title - test [proc_info.wnd_state], 0x04 ; is rolled up? + test [proc_info.wnd_state], 0x04 ; is rolled up? jnz Pause_mode call Draw_decorations @@ -40,7 +40,7 @@ mcall 26, 9 jne Game_step @@: sub [time_to_wait], eax - mcall 23, [time_to_wait] ; + mcall 23, [time_to_wait] test al, al jnz @f @@ -62,10 +62,10 @@ mcall 26, 9 jz .button ; - .button: ; процедура обрабоки кнопок в программе - mcall 17 ; функция 17: получить номер нажатой кнопки + .button: ; proccesing buttons + mcall 17 ; get button number - shr eax, 8 ; сдвигаем регистр eax на 8 бит вправо, чтобы получить номер + shr eax, 8 ; we should do it to get the real button code cmp eax, 1 je Save_do_smth_else_and_exit @@ -75,14 +75,6 @@ mcall 26, 9 .key: mcall 2 ; get keycode -;pushf -;pusha -;movzx eax, ah -;dph eax -;newline -;popa -;popf - cmp ah, 0x01 ; Escape je First_menu cmp ah, 0x39 ; Space @@ -430,7 +422,6 @@ Get_eat: ;; mcall 26,9 -; xor eax, esp shl eax, 1 xor edx, edx div word[number_of_free_dots] diff --git a/programs/games/snake/snake.asm b/programs/games/snake/snake.asm index d93e49657..e59fb6981 100644 --- a/programs/games/snake/snake.asm +++ b/programs/games/snake/snake.asm @@ -189,7 +189,11 @@ align 4 or [button_color], eax invoke ini.get_color, cur_dir_path, aTheme_name, configColor.buttonText, DEFAULT_BUTTON_TEXT_COLOR mov [labelButtonPlay.color], eax - mov [button_text_color], eax + mov [labelButtonExit.color], eax + mov [labelButtonClassic.color], eax + mov [labelButtonLevels.color], eax + mov [labelButtonInc.color], eax + mov [labelButtonDec.color], eax invoke ini.get_color, cur_dir_path, aTheme_name, aStone_color, 0x5f8700 or [stone_color], eax invoke ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00 @@ -274,7 +278,7 @@ Set_geometry: jnz .by_hotkey mcall 9,proc_info,-1 - test [proc_info.wnd_state], 0x04 ; is rolled up? + test [proc_info.wnd_state], 0x04 ; is rolled up? jz @f mov eax, [proc_info.box.width] mov [window_width], eax @@ -295,7 +299,7 @@ Set_geometry: mov eax, [proc_info.box.height] mov [window_height], eax - .by_mouse: ; or any other kind of resizing. for example, double click on window title + .by_mouse: ; or any other kind of resizing. for example, double click on window title test [proc_info.wnd_state], 0x01 jnz .by_hotkey @@ -356,12 +360,10 @@ Set_geometry: mov byte[square_side_length], al jmp .by_hotkey -; jmp .done - .by_hotkey: mcall 9,proc_info,-1 mov [resized_by_hotkey], 0 - test [proc_info.wnd_state], 0x04 ; is rolled up? + test [proc_info.wnd_state], 0x04 ; is rolled up? jz @f mov eax, [proc_info.box.width] mov [window_width], eax @@ -370,7 +372,7 @@ Set_geometry: jmp .quit @@: mov eax, [square_side_length] - inc eax ; space between squares + inc eax ; space between squares mov [g_s], eax stdcall draw.setConfigFont, eax @@ -484,9 +486,9 @@ Set_geometry: shr cx, 1 add cx, dx mov word[wp_y], cx - ; зафиксируем позиции для меток - ; Y - mov ebx, 13 ; одинаковый отступ от границ грида + ; fixing the positions for the labels + ; Y position + mov ebx, 13 ; margin from grid borders mov eax, [gbym1] sub eax, ebx mov [posLabel.yTop], eax @@ -497,7 +499,7 @@ Set_geometry: shr ebx, 1 add eax, ebx mov [posLabel.yBottom], eax - ; x + ; X position mov eax, [gbxm1] mov [posLabel.xLeft], eax mov eax, [gbxm1_plus_gw_mul_gs] @@ -615,9 +617,7 @@ Draw_decorations: grid_lines: mov eax, 38 -;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1) mov ebx, [gbxm1_shl16_gbxm1] -;mov ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP) mov ecx, [gbym1_shl16_gbym1] add ecx, [gh_mul_gs] mov edx, [decorations_color] @@ -630,7 +630,6 @@ Draw_decorations: dec esi jnz @b -;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP) mov ebx, [gbxm1_shl16_gbxm1] add ebx, [gw_mul_gs] mov ecx, [gbym1_shl16_gbym1] @@ -2217,7 +2216,6 @@ game_over_picture_color dd 0x000000 you_win_picture_color dd 0x000000 eat_color dd 0x000000 button_color dd 0x000000 -button_text_color dd 0x80000000 stone_color dd 0x000000 splash_background_color dd 0x000000 splash_level_string_color dd 0x000000 @@ -2360,7 +2358,7 @@ else defLabel labelButtonClassic, DEFAULT_BUTTON_TEXT_COLOR, 'CLASSIC mode' defLabel labelButtonLevels , DEFAULT_BUTTON_TEXT_COLOR, 'LEVELS mode' defLabel labelButtonInc , DEFAULT_BUTTON_TEXT_COLOR, '+INC+' - defLabel labelButtonDec , DEFAULT_BUTTON_TEXT_COLOR, '-dec-' + defLabel labelButtonDec , DEFAULT_BUTTON_TEXT_COLOR, '-DEC-' defLabel labelScore , DEFAULT_LABEL_COLOR, 'SCORE : ' defLabel labelLevel , DEFAULT_LABEL_COLOR, 'LEVEL : '