translating and fixing comments
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 26s
Build system / Build (pull_request) Successful in 16m14s

This commit is contained in:
2026-02-22 15:22:42 +04:00
parent 9ecd89c51b
commit c092246a99
4 changed files with 62 additions and 76 deletions

View File

@@ -1,19 +1,19 @@
; ----------------------------- ; -----------------------------
; Рисует кнопку с текстовой меткой ; Draws a button with a text label
; input: pLabel - указатель на структуру LABEL ; input: pLabel - pointer to the LABEL structure
; id - идентификатор кнопки ; id - button identifier
; xPosition - позиция X ; xPosition - button position X
; yPosition - позиция Y ; yPosition - button position Y
; bWidth - ширина кнопки ; bWidth - button width
; bHeight - высота кнопки ; bHeight - button height
; ----------------------------- ; -----------------------------
proc draw.Button pLabel, id, xPosition, yPosition, bWidth, bHeight proc draw.Button pLabel, id, xPosition, yPosition, bWidth, bHeight
mcall 8, <[xPosition], [bWidth]>, <[yPosition], [bHeight]>, [id], [button_color] mcall 8, <[xPosition], [bWidth]>, <[yPosition], [bHeight]>, [id], [button_color]
; позиция X для размещения текста ; position X for text positioning
mov eax, [bHeight] mov eax, [bHeight]
shr eax, 1 shr eax, 1
add [yPosition], eax add [yPosition], eax
; позиция Y для размещения текста ; position Y for text positioning
mov eax, [pLabel] mov eax, [pLabel]
mov eax, [eax+LABEL.size] mov eax, [eax+LABEL.size]
neg eax neg eax
@@ -22,16 +22,16 @@ proc draw.Button pLabel, id, xPosition, yPosition, bWidth, bHeight
add eax, 4 add eax, 4
shr eax, 1 shr eax, 1
add [xPosition], eax add [xPosition], eax
; размещаем текст на кнопке ; draw text on the button
stdcall draw.Label, [pLabel], [xPosition], [yPosition] stdcall draw.Label, [pLabel], [xPosition], [yPosition]
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Рисует текст по yPosition и центрируя текст по ширине экрана ; 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 - указатель на структуру LABEL ; input: pLabel - pointer to the LABEL structure
; yPosition - позиция Y ; yPosition - text position Y
; countOffset - кол-во символов для смещения ; countOffset - number of symbols for offset
; ----------------------------- ; -----------------------------
proc draw.Navigation pLabel, yPosition, countOffset proc draw.Navigation pLabel, yPosition, countOffset
mov eax, [pLabel] mov eax, [pLabel]
@@ -42,11 +42,11 @@ proc draw.Navigation pLabel, yPosition, countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Рисует число по yPosition и центрируя число по ширине экрана ; 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 - указатель на структуру LABEL ; input: pLabel - pointer to the LABEL structure
; yPosition - позиция Y ; yPosition - text position Y
; countOffset - кол-во символов для смещения ; countOffset - number of symbols for offset
; ----------------------------- ; -----------------------------
proc draw.NavigationNumber pLabel, yPosition, countOffset proc draw.NavigationNumber pLabel, yPosition, countOffset
mov eax, [pLabel] mov eax, [pLabel]
@@ -57,10 +57,10 @@ proc draw.NavigationNumber pLabel, yPosition, countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Возвращает координату X для размещения текста по центру экрана ; Returns the X coordinate for the text positioning on the center of the screen
; с учетом указанного смещения в символах ; considering the offset in symbols
; input: countOffset - кол-во символов для смещения ; input: countOffset - number of symbols for offset
; output: eax - координата X ; output: eax - X coordinate
; ----------------------------- ; -----------------------------
proc draw.GetNavigationX countOffset proc draw.GetNavigationX countOffset
mov eax, [countOffset] mov eax, [countOffset]
@@ -72,12 +72,11 @@ proc draw.GetNavigationX countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Формирует в одном регистре координаты в нужном формате добавляя ; Builds the coordinates of the text label adding the offset in symbols along X
; ширину смещения символов по X если указано кол-во ; input: xPosition - X coordinate
; input: xPosition - позиция по X ; yPosition - Y coordinate
; yPosition - позиция по Y ; countOffset - number of symbols for offset
; countOffset - кол-во символов для смещения ; output: eax - X coordinate in format X*65536+Y
; output: eax - координата в формате X*65536+Y
; ----------------------------- ; -----------------------------
proc draw._prepareCoord xPosition, yPosition, countOffset proc draw._prepareCoord xPosition, yPosition, countOffset
mov eax, [countOffset] mov eax, [countOffset]
@@ -92,12 +91,11 @@ proc draw._prepareCoord xPosition, yPosition, countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Рисует текст по указанной позиции X и Y ; Draws the text at the X and Y positions and shifts the offset in symbols along X
; и смещает на ширину символов по X если указано ; input: pLabel - pointer to the LABEL structure
; input: pLabel - указатель на структуру LABEL ; xPosition - text position X
; xPosition - позиция X ; yPosition - text position Y
; yPosition - позиция Y ; countOffset - number of symbols for offset
; countOffset - кол-во символов для смещения
; ----------------------------- ; -----------------------------
proc draw.Label pLabel, xPosition, yPosition, countOffset proc draw.Label pLabel, xPosition, yPosition, countOffset
stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset]
@@ -110,12 +108,11 @@ proc draw.Label pLabel, xPosition, yPosition, countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Рисует число по указанной позиции X и Y ; Draws the number at the X and Y positions and shifts the offset in symbols along X
; и смещает на ширину символов по X если указано ; input: pLabel - pointer to the LABEL structure
; input: pLabel - указатель на структуру LABEL ; xPosition - text position X
; xPosition - позиция X ; yPosition - text position Y
; yPosition - позиция Y ; countOffset - number of symbols for offset
; countOffset - кол-во символов для смещения
; ----------------------------- ; -----------------------------
proc draw.Number pLabel, xPosition, yPosition, countOffset proc draw.Number pLabel, xPosition, yPosition, countOffset
stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset]
@@ -130,9 +127,9 @@ proc draw.Number pLabel, xPosition, yPosition, countOffset
ret ret
endp endp
; ----------------------------- ; -----------------------------
; Установить настройки шрифта в зависимости от размера ячейки ; 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 - размер ячейки ; input: squareSideLength - size of the square side
; ----------------------------- ; -----------------------------
proc draw.setConfigFont squareSideLength proc draw.setConfigFont squareSideLength
cmp [squareSideLength], MIN_SQUARE_SIDE_LENGTH_FONT cmp [squareSideLength], MIN_SQUARE_SIDE_LENGTH_FONT

View File

@@ -36,7 +36,7 @@ Game_over:
call Set_geometry call Set_geometry
mcall 12,1 mcall 12,1
mcall 0, , ,[window_style], ,window_title 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 jnz @f
call Draw_decorations call Draw_decorations

View File

@@ -19,7 +19,7 @@ mcall 26, 9
call Set_geometry call Set_geometry
mcall 12,1 mcall 12,1
mcall 0, , ,[window_style], ,window_title 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 jnz Pause_mode
call Draw_decorations call Draw_decorations
@@ -40,7 +40,7 @@ mcall 26, 9
jne Game_step jne Game_step
@@: @@:
sub [time_to_wait], eax sub [time_to_wait], eax
mcall 23, [time_to_wait] ; mcall 23, [time_to_wait]
test al, al test al, al
jnz @f jnz @f
@@ -62,10 +62,10 @@ mcall 26, 9
jz .button ; jz .button ;
.button: ; процедура обрабоки кнопок в программе .button: ; proccesing buttons
mcall 17 ; функция 17: получить номер нажатой кнопки 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 cmp eax, 1
je Save_do_smth_else_and_exit je Save_do_smth_else_and_exit
@@ -75,14 +75,6 @@ mcall 26, 9
.key: .key:
mcall 2 ; get keycode mcall 2 ; get keycode
;pushf
;pusha
;movzx eax, ah
;dph eax
;newline
;popa
;popf
cmp ah, 0x01 ; Escape cmp ah, 0x01 ; Escape
je First_menu je First_menu
cmp ah, 0x39 ; Space cmp ah, 0x39 ; Space
@@ -430,7 +422,6 @@ Get_eat:
;; ;;
mcall 26,9 mcall 26,9
; xor eax, esp
shl eax, 1 shl eax, 1
xor edx, edx xor edx, edx
div word[number_of_free_dots] div word[number_of_free_dots]

View File

@@ -189,7 +189,11 @@ align 4
or [button_color], eax or [button_color], eax
invoke ini.get_color, cur_dir_path, aTheme_name, configColor.buttonText, DEFAULT_BUTTON_TEXT_COLOR invoke ini.get_color, cur_dir_path, aTheme_name, configColor.buttonText, DEFAULT_BUTTON_TEXT_COLOR
mov [labelButtonPlay.color], eax 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 invoke ini.get_color, cur_dir_path, aTheme_name, aStone_color, 0x5f8700
or [stone_color], eax or [stone_color], eax
invoke ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00 invoke ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00
@@ -274,7 +278,7 @@ Set_geometry:
jnz .by_hotkey jnz .by_hotkey
mcall 9,proc_info,-1 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 jz @f
mov eax, [proc_info.box.width] mov eax, [proc_info.box.width]
mov [window_width], eax mov [window_width], eax
@@ -295,7 +299,7 @@ Set_geometry:
mov eax, [proc_info.box.height] mov eax, [proc_info.box.height]
mov [window_height], eax 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 test [proc_info.wnd_state], 0x01
jnz .by_hotkey jnz .by_hotkey
@@ -356,12 +360,10 @@ Set_geometry:
mov byte[square_side_length], al mov byte[square_side_length], al
jmp .by_hotkey jmp .by_hotkey
; jmp .done
.by_hotkey: .by_hotkey:
mcall 9,proc_info,-1 mcall 9,proc_info,-1
mov [resized_by_hotkey], 0 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 jz @f
mov eax, [proc_info.box.width] mov eax, [proc_info.box.width]
mov [window_width], eax mov [window_width], eax
@@ -370,7 +372,7 @@ Set_geometry:
jmp .quit jmp .quit
@@: @@:
mov eax, [square_side_length] mov eax, [square_side_length]
inc eax ; space between squares inc eax ; space between squares
mov [g_s], eax mov [g_s], eax
stdcall draw.setConfigFont, eax stdcall draw.setConfigFont, eax
@@ -484,9 +486,9 @@ Set_geometry:
shr cx, 1 shr cx, 1
add cx, dx add cx, dx
mov word[wp_y], cx mov word[wp_y], cx
; зафиксируем позиции для меток ; fixing the positions for the labels
; Y ; Y position
mov ebx, 13 ; одинаковый отступ от границ грида mov ebx, 13 ; margin from grid borders
mov eax, [gbym1] mov eax, [gbym1]
sub eax, ebx sub eax, ebx
mov [posLabel.yTop], eax mov [posLabel.yTop], eax
@@ -497,7 +499,7 @@ Set_geometry:
shr ebx, 1 shr ebx, 1
add eax, ebx add eax, ebx
mov [posLabel.yBottom], eax mov [posLabel.yBottom], eax
; x ; X position
mov eax, [gbxm1] mov eax, [gbxm1]
mov [posLabel.xLeft], eax mov [posLabel.xLeft], eax
mov eax, [gbxm1_plus_gw_mul_gs] mov eax, [gbxm1_plus_gw_mul_gs]
@@ -615,9 +617,7 @@ Draw_decorations:
grid_lines: grid_lines:
mov eax, 38 mov eax, 38
;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1)
mov ebx, [gbxm1_shl16_gbxm1] 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] mov ecx, [gbym1_shl16_gbym1]
add ecx, [gh_mul_gs] add ecx, [gh_mul_gs]
mov edx, [decorations_color] mov edx, [decorations_color]
@@ -630,7 +630,6 @@ Draw_decorations:
dec esi dec esi
jnz @b jnz @b
;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)
mov ebx, [gbxm1_shl16_gbxm1] mov ebx, [gbxm1_shl16_gbxm1]
add ebx, [gw_mul_gs] add ebx, [gw_mul_gs]
mov ecx, [gbym1_shl16_gbym1] mov ecx, [gbym1_shl16_gbym1]
@@ -2217,7 +2216,6 @@ game_over_picture_color dd 0x000000
you_win_picture_color dd 0x000000 you_win_picture_color dd 0x000000
eat_color dd 0x000000 eat_color dd 0x000000
button_color dd 0x000000 button_color dd 0x000000
button_text_color dd 0x80000000
stone_color dd 0x000000 stone_color dd 0x000000
splash_background_color dd 0x000000 splash_background_color dd 0x000000
splash_level_string_color dd 0x000000 splash_level_string_color dd 0x000000
@@ -2360,7 +2358,7 @@ else
defLabel labelButtonClassic, DEFAULT_BUTTON_TEXT_COLOR, 'CLASSIC mode' defLabel labelButtonClassic, DEFAULT_BUTTON_TEXT_COLOR, 'CLASSIC mode'
defLabel labelButtonLevels , DEFAULT_BUTTON_TEXT_COLOR, 'LEVELS mode' defLabel labelButtonLevels , DEFAULT_BUTTON_TEXT_COLOR, 'LEVELS mode'
defLabel labelButtonInc , DEFAULT_BUTTON_TEXT_COLOR, '+INC+' 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 labelScore , DEFAULT_LABEL_COLOR, 'SCORE : '
defLabel labelLevel , DEFAULT_LABEL_COLOR, 'LEVEL : ' defLabel labelLevel , DEFAULT_LABEL_COLOR, 'LEVEL : '