diff --git a/programs/games/snake/first_menu.asm b/programs/games/snake/first_menu.asm index fad538aff..e99f43462 100644 --- a/programs/games/snake/first_menu.asm +++ b/programs/games/snake/first_menu.asm @@ -9,7 +9,7 @@ First_menu: mov [lives], START_LIVES call Show_cursor - mov [score], 0 + mov [numberScore.value], 0 call Set_first_level_of_play_mode mov ebx, [time_wait_limit_const] @@ -22,19 +22,20 @@ First_menu: test [proc_info.wnd_state], 0x04 ; is rolled up? jnz @f - call Draw_decorations - call Draw_first_menu_picture - call Draw_menu_strings - call Draw_buttons + call Draw_decorations + call Draw_first_menu_picture + stdcall draw.Navigation, labelExit, [posLabel.yTop], 0 + stdcall draw.Navigation, labelStart, [posLabel.yCenter], 0 + call Draw_buttons @@: mcall 12,2 .still: mcall 10 ; wait for event ; ok, what an event? dec al ; has the window been moved or resized? - jz .redraw ; + jz .redraw ; dec al ; was a key pressed? - jz .key ; + jz .key ; .button: ; a button was pressed @@ -115,32 +116,9 @@ Draw_first_menu_picture: call Draw_picture ret - + ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------ - -Draw_menu_strings: - ;;===Make_menu_strings====================================================================================================== - - mov ebx, [window_width] - shr ebx, 1 - sub ebx, press_to_start.size*3+6 - shl ebx, 16 - add ebx, dword[bottom_middle_strings] - mcall 4, ,[navigation_strings_color],press_to_start - mov ebx, [window_width] - shr ebx, 1 - sub ebx, press_esc_to_exit.size*3+6 - shl ebx, 16 - add ebx, [top_strings] - mcall , ,[navigation_strings_color],press_esc_to_exit -; mcall ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options - - ret - - ;;---Make_menu_strings------------------------------------------------------------------------------------------------------ - - Draw_buttons: ;;===Draw_buttons=========================================================================================================== @@ -278,33 +256,31 @@ Delete_buttons: Change_play_mode: ;;===Change_play_mode====================================================================================================== - - cmp [play_mode], LEVELS_MODE - jne @f - mov [play_mode], CLASSIC_MODE - mov [cur_level_number], 0 + xor [play_mode], LEVELS_MODE + call Set_first_level_of_play_mode ret - @@: - inc [play_mode] - - call Set_first_level_of_play_mode - - ret - ;;---Change_play_mode------------------------------------------------------------------------------------------------------ Set_first_level_of_play_mode: ;;===Set_first_level_of_play_mode========================================================================================== - - cmp [play_mode], CLASSIC_MODE - jne @f - mov [cur_level_number], CLASSIC_MODE_FIRST_LEVEL + cmp [play_mode], CLASSIC_MODE + jne @f + mov [numberLevel.value], CLASSIC_MODE_FIRST_LEVEL + mov eax, [numberHiscore.valueClassic] + mov esi, labelChampionName.valueClassic @@: - cmp [play_mode], LEVELS_MODE - jne @f - mov [cur_level_number], LEVELS_MODE_FIRST_LEVEL + cmp [play_mode], LEVELS_MODE + jne @f + mov [numberLevel.value], LEVELS_MODE_FIRST_LEVEL + mov eax, [numberHiscore.valueLevels] + mov esi, labelChampionName.valueLevels @@: + mov [numberHiscore.value], eax + mov edi, [labelChampionName.value] + mov ecx, CHAMPION_NAME_LENGTH + cld + rep movsb ret diff --git a/programs/games/snake/functions.asm b/programs/games/snake/functions.asm new file mode 100644 index 000000000..e398ae5d4 --- /dev/null +++ b/programs/games/snake/functions.asm @@ -0,0 +1,144 @@ +macro defLabel name, color, [text] +{ + common + local ..str + ..str db text, 0 + name#.len = $ - ..str - 1 + name LABEL color, name#.len, ..str +} +macro defNumber name, color, size +{ + common + name#.len = size + name LABEL color, name#.len, 0 +} +; ----------------------------- +; Рисует текст по yPosition и центрируя текст по ширине экрана +; с учетом длины текста и указанного смещения в символах +; input: pText - указатель на структуру +; yPosition - позиция Y +; countOffset - кол-во символов для смещения +; ----------------------------- +proc draw.Navigation pText, yPosition, countOffset + mov eax, [pText] + mov eax, [eax + LABEL.size] + sub eax, [countOffset] + stdcall draw.GetNavigationX, eax + stdcall draw.Label, [pText], eax, [yPosition], 0 + ret +endp +; ----------------------------- +; Рисует число по yPosition и центрируя число по ширине экрана +; с учетом длины числа и указанного смещения в символах +; input: pNumber - указатель на структуру +; yPosition - позиция Y +; countOffset - кол-во символов для смещения +; ----------------------------- +proc draw.NavigationNumber pNumber, yPosition, countOffset + mov eax, [pNumber] + mov eax, [eax + LABEL.size] + sub eax, [countOffset] + stdcall draw.GetNavigationX, eax + stdcall draw.Number, [pNumber], eax, [yPosition], 0 + ret +endp +; ----------------------------- +; Возвращает координату X для размещения текста по центру экрана +; с учетом указанного смещения в символах +; input: countOffset - кол-во символов для смещения +; output: eax - координата X +; ----------------------------- +proc draw.GetNavigationX countOffset + mov eax, [countOffset] + neg eax + mul [configFont.width] + add eax, [window_width] + sub eax, 10 + shr eax, 1 + ret +endp +; ----------------------------- +; Формирует в одном регистре координаты в нужном формате добавляя +; ширину смещения символов по X если указано кол-во +; input: xPosition - позиция по X +; yPosition - позиция по Y +; countOffset - кол-во символов для смещения +; output: eax - координата в формате X*65536+Y +; ----------------------------- +proc draw._prepareCoord xPosition, yPosition, countOffset + mov eax, [countOffset] + mul [configFont.width] + add eax, [xPosition] + shl eax, 16 + add eax, [yPosition] + ret +endp +; ----------------------------- +; Рисует текст по указанной позиции X и Y +; и смещает на ширину символов по X если указано +; input: pText - указатель на структуру +; xPosition - позиция X +; yPosition - позиция Y +; countOffset - кол-во символов для смещения +; ----------------------------- +proc draw.Label pText, xPosition, yPosition, countOffset + stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] + mov ebx, eax + mov eax, [pText] + mov ecx, [configFont.mask] + or ecx, [eax + LABEL.color] + mov edx, [eax + LABEL.value] + mcall 4 + ret +endp +; ----------------------------- +; Рисует число по указанной позиции X и Y +; и смещает на ширину символов по X если указано +; input: pNumber - указатель на структуру +; xPosition - позиция X +; yPosition - позиция Y +; countOffset - кол-во символов для смещения +; ----------------------------- +proc draw.Number pNumber, xPosition, yPosition, countOffset + stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset] + mov edx, eax + mov eax, [pNumber] + mov ebx, [eax + LABEL.size] + shl ebx, 16 + mov ecx, [eax + LABEL.value] + mov esi, [configFont.maskNumber] + or esi, [eax + LABEL.color] + mcall 47, , , , ,[background_color] + ret +endp +; ----------------------------- +; Установить настройки шрифта в зависимости от размера ячейки +; устанавливает высоту, ширину символа и маску для рисования текста и числа +; input: squareSideLength - размер ячейки +; ----------------------------- +proc draw.setConfigFont squareSideLength + cmp [squareSideLength], MIN_SQUARE_SIDE_LENGTH_FONT + jg @f + cmp [configFont.flag], FONT_SMALL + je .return + mov [configFont.flag], FONT_SMALL + jmp .set + @@: + cmp [configFont.flag], FONT_LARGE + je .return + mov [configFont.flag], FONT_LARGE + .set: + mov eax, [configFont.flag] + lea ebx, [eax + 8] + shl ebx, 28 + mov [configFont.mask], ebx + lea ebx, [eax*2 + 6] + mov [configFont.width], ebx + lea ebx, [8 + eax*4] + mov [configFont.height], ebx + lea ebx, [eax + 4] + shl ebx, 28 + mov [configFont.maskNumber], ebx + .return: + ret +endp \ No newline at end of file diff --git a/programs/games/snake/game_over.asm b/programs/games/snake/game_over.asm index a48b692d1..d5f379264 100644 --- a/programs/games/snake/game_over.asm +++ b/programs/games/snake/game_over.asm @@ -15,16 +15,16 @@ Game_over: mcall 66,1,0 ; set ascii mode for keyboard call Show_cursor - mov ebx, [score] - + mov ebx, [numberScore.value] + cmp [play_mode], CLASSIC_MODE jne @f - cmp ebx, [hi_score_classic] + cmp ebx, [numberHiscore.valueClassic] jng .redraw mov [is_new_record], 1 jmp .done @@: - cmp ebx, [hi_score_levels] + cmp ebx, [numberHiscore.valueLevels] jng .redraw mov [is_new_record], 1 jmp .done @@ -57,7 +57,7 @@ Game_over: .mouse: ; mouse event received invoke edit_box.mouse, edit1 - + jmp .still @@ -120,51 +120,29 @@ Draw_game_over_picture: Draw_game_over_strings: ;;===Draw_game_over_strings================================================================================================ + cmp [is_new_record], 1 + jnz @f + mov eax, [numberScore.value] + mov [numberGameOver.value], eax + stdcall draw.Navigation, labelCongratulations, [posLabel.yCenter], -numberGameOver.len + stdcall draw.NavigationNumber, numberGameOver, [posLabel.yCenter], labelCongratulations.len + stdcall draw.Navigation, labelEnterName, [posLabel.yBottom], -numberGameOver.len - 3 + stdcall draw.GetNavigationX, -labelCongratulations.len+numberGameOver.len + mov [edit1.left], eax + mov eax, [posLabel.yBottom] + sub eax, 3 + mov [edit1.top], eax + mov eax, [configFont.mask] + or [edit1.text_color], eax + invoke edit_box.draw, edit1 - cmp [is_new_record], 1 - jnz @f - - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_congratulations.size*3+6*6 - shl ebx, 16 - add ebx, [bottom_top_strings] - mcall 4, ,[game_over_strings_color],string_congratulations - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_enter_your_name.size*3+6*6 - shl ebx, 16 - add ebx, [bottom_bottom_strings] - mcall , , ,string_enter_your_name - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_apply_name_enter.size*3 - shl ebx, 16 - add ebx, [top_strings] - mcall , ,[navigation_strings_color],string_apply_name_enter - mov edx, [window_width] - shr edx, 1 - add edx, string_congratulations.size*3-6*6-1 - shl edx, 16 - add edx, dword[bottom_top_strings] - mcall 47,0x00070000,[score], ,[game_over_hiscore_color] - mov ebx, [window_width] - shr ebx, 1 - add ebx, string_enter_your_name.size*3-6*6-3 - mov [edit1.left], ebx - invoke edit_box.draw, edit1 - + stdcall draw.Navigation, labelApply, [posLabel.yTop], 0 ret - @@: - - call Draw_menu_esc - + stdcall draw.Navigation, labelMenu, [posLabel.yTop], 0 ret - ;;---Draw_game_over_strings------------------------------------------------------------------------------------------------ - Score_and_name_store: ;;===Name_store============================================================================================================ @@ -172,23 +150,23 @@ Score_and_name_store: cmp [play_mode], CLASSIC_MODE jne @f - mov edi, champion_name_classic + mov edi, labelChampionName.valueClassic jmp .done @@: - mov edi, champion_name_levels + mov edi, labelChampionName.valueLevels .done: mov ecx, CHAMPION_NAME_LENGTH rep movsb - - mov eax, [score] + + mov eax, [numberScore.value] cmp [play_mode], CLASSIC_MODE jne @f - mov [hi_score_classic], eax + mov [numberHiscore.valueClassic], eax jmp .done2 @@: - mov [hi_score_levels], eax + mov [numberHiscore.valueLevels], eax .done2: ret diff --git a/programs/games/snake/level.asm b/programs/games/snake/level.asm index b439459de..c9fc2825c 100644 --- a/programs/games/snake/level.asm +++ b/programs/games/snake/level.asm @@ -21,14 +21,14 @@ mcall 26, 9 mcall 0, , ,[window_style], ,window_title test [proc_info.wnd_state], 0x04 ; is rolled up? jnz Pause_mode - + call Draw_decorations call Draw_stones call Draw_snake call Draw_eat call Draw_level_strings mcall 12,2 - + .still: mcall 26, 9 push eax @@ -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 @@ -57,9 +57,9 @@ mcall 26, 9 dec al ; has the window been moved or resized? jz .redraw ; dec al ; was a key pressed? - jz .key ; + jz .key ; dec al ; was a button pressed? - jz .button ; + jz .button ; .button: ; процедура обрабоки кнопок в программе @@ -144,7 +144,7 @@ mcall 26, 9 call Decrease_geometry jmp .redraw @@: - + jmp .still ; jump to wait for another event @@ -162,7 +162,7 @@ mcall 26, 9 bts [acceleration_mask], LEFT jc Game_step jmp .still - + .key.down: bts [action], 0 jc @f @@ -177,7 +177,7 @@ mcall 26, 9 bts [acceleration_mask], DOWN jc Game_step jmp .still - + .key.up: bts [action], 0 jc @f @@ -192,7 +192,7 @@ mcall 26, 9 bts [acceleration_mask], UP jc Game_step jmp .still - + .key.right: bts [action], 0 jc @f @@ -235,17 +235,17 @@ mcall 26, 9 cmp [snake_direction], UP ; ... up? jz .up jmp .right ; then right - + .left: cmp [snake_direction_next], RIGHT ; next step is to right? jz .with_reverse jmp .without_reverse - + .down: cmp [snake_direction_next], UP ; next step is to up? jz .with_reverse jmp .without_reverse - + .up: cmp [snake_direction_next], DOWN ; next step is to bottom? jz .with_reverse @@ -260,20 +260,20 @@ mcall 26, 9 .with_reverse: call Set_reverse_direction call Reverse - + .without_reverse: mov edx, snake_dots-2 add edx, [snake_length_x2] - + cmp [snake_direction_next], LEFT je .to_left cmp [snake_direction_next], DOWN - je .to_down + je .to_down cmp [snake_direction_next], UP je .to_up cmp [snake_direction_next], RIGHT - je .to_right - + je .to_right + .to_left: mov [snake_direction], LEFT mov ax, [edx] @@ -294,7 +294,7 @@ mcall 26, 9 mov ah, 0 @@: jmp Snake_move - + .to_up: mov [snake_direction], UP mov ax, [edx] @@ -305,7 +305,7 @@ mcall 26, 9 dec ah @@: jmp Snake_move - + .to_right: mov [snake_direction], RIGHT mov ax, [edx] @@ -325,7 +325,7 @@ mcall 26, 9 Draw_snake: ;;===Draw_snake======================================================================================================== - + call Draw_head_prehead mov edx, [snake_color] mov esi, snake_dots-6 @@ -339,7 +339,7 @@ Draw_snake: jne @b ret - + ;;---Draw_snake-------------------------------------------------------------------------------------------------------- @@ -364,47 +364,26 @@ Draw_head_prehead: Draw_level_strings: ;;===Draw_level_strings================================================================================================ + stdcall draw.Navigation, labelPause, [posLabel.yTop], 0 - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_pause_space.size*3+6 - shl ebx, 16 - add ebx, [top_strings] - mcall 4, ,[navigation_strings_color],string_pause_space ; Draw 'PAUSE - SPACE' string + stdcall draw.Label, labelScore, [posLabel.xLeft], [posLabel.yCenter], 3 + stdcall draw.Number, numberScore, [posLabel.xLeft], [posLabel.yCenter], labelScore.len+3 -; call Draw_menu_esc - call Draw_score_string - call Draw_score_number ; Draw score (number) - call Draw_champion_string - call Draw_champion_name - call Draw_hiscore_string - call Draw_hiscore_number + stdcall draw.Label, labelChampion, [posLabel.xRight], [posLabel.yBottom], -labelChampion.len-numberHiscore.len-3 + stdcall draw.Label, labelChampionName, [posLabel.xRight], [posLabel.yBottom], -numberHiscore.len-3 - cmp [play_mode], LEVELS_MODE - jne @f + stdcall draw.Label, labelHiscore, [posLabel.xRight], [posLabel.yCenter], -labelHiscore.len-numberHiscore.len-3 + stdcall draw.Number, numberHiscore, [posLabel.xRight], [posLabel.yCenter], -numberHiscore.len-3 - mov ebx, [window_width] - shr ebx, 3 - sub ebx, 5 - shl ebx, 16 - add ebx, [bottom_bottom_strings] - mcall 4, ,[level_string_color],string_level - - mov edx, [window_width] - shr edx, 3 - sub edx, 5+1 - add edx, string_level.size*6 - shl edx, 16 - add edx, [bottom_bottom_strings] - mcall 47,0x00020000,[cur_level_number], ,[level_number_color],[background_color] + cmp [play_mode], LEVELS_MODE + jne @f + stdcall draw.Label, labelLevel, [posLabel.xLeft], [posLabel.yBottom], 3 + stdcall draw.Number, numberLevel, [posLabel.xLeft], [posLabel.yBottom], labelLevel.len+3 @@: - ret - ;;---Draw_level_strings------------------------------------------------------------------------------------------------ - - + Reverse: ;;===Reverse=========================================================================================================== @@ -427,18 +406,18 @@ Reverse: ret ;;---Reverse----------------------------------------------------------------------------------------------------------- - - + + Draw_eat: ;;===Draw_eat========================================================================================================== - + mov bx, word[eat] mov edx, [eat_color] - + call Draw_square - + ret - + ;;---Draw_eat---------------------------------------------------------------------------------------------------------- @@ -466,14 +445,14 @@ Get_eat: @@: inc ebx jmp .loop - + .place_found: sub ebx, field_map mov eax, ebx mov bl, GRID_WIDTH div bl xchg al, ah - + mov word[eat], ax ret @@ -488,7 +467,7 @@ Sdvig: mov edi, snake_dots mov ecx, [snake_length_x2] shr ecx, 1 - + cld rep movsw @@ -508,17 +487,17 @@ Set_reverse_direction: cmp cl, ch je .X_ravny - + cmp cl, 0 jne .skip2 - + mov dl, GRID_WIDTH dec dl cmp ch, dl jne .Normal_y_ravny mov [snake_direction_next], RIGHT ret - + .skip2: mov dl, GRID_WIDTH dec dl @@ -528,7 +507,7 @@ Set_reverse_direction: jne .Normal_y_ravny mov [snake_direction_next], LEFT ret - + .Normal_y_ravny: cmp cl, ch @@ -545,17 +524,17 @@ Set_reverse_direction: inc ebx mov cl, [eax] mov ch, [ebx] - + cmp cl, 0 jne .skip3 - + mov dl, GRID_HEIGHT dec dl cmp ch, dl jne .Normal_x_ravny mov [snake_direction_next], DOWN ret - + .skip3: mov dl, GRID_HEIGHT dec dl @@ -565,7 +544,7 @@ Set_reverse_direction: jne .Normal_x_ravny mov [snake_direction_next], UP ret - + .Normal_x_ravny: cmp cl, ch ; !!! @@ -579,8 +558,8 @@ Set_reverse_direction: ret ;;---Set_reverse_direction-------------------------------------------------------------------------------------------------- - - + + Snake_move: ;;===Snake_move============================================================================================================= ;; in : @@ -594,7 +573,7 @@ Snake_move: jne .eat_and_new_head_are_different add [snake_length_x2], 2 - add [score], SCORE_EAT + add [numberScore.value], SCORE_EAT dec [number_of_free_dots] cmp [number_of_free_dots], 0 je Game_over @@ -631,7 +610,7 @@ Snake_move: .eat_and_new_head_are_different: push ax - + mov ax, word[snake_dots] mov cl, 0 call Draw_on_map @@ -645,22 +624,22 @@ Snake_move: mov cl, 1 call Draw_on_map - + mov bx, word[snake_dots] mov edx, [background_color] call Draw_square - + call Sdvig - + call Draw_head_prehead Keys_done: - cmp [score], 0 + cmp [numberScore.value], 0 je @f - dec [score] - call Draw_score_number + dec [numberScore.value] + stdcall draw.Number, numberScore, [posLabel.xLeft], [posLabel.yCenter], labelScore.len+3 @@: cmp [play_mode], LEVELS_MODE @@ -681,10 +660,10 @@ Snake_move: Do_smth_between_levels: ;;===Do_smth_between_levels================================================================================================ - inc [cur_level_number] - cmp [cur_level_number], LAST_LEVEL_NUMBER+1 + inc [numberLevel.value] + cmp [numberLevel.value], LAST_LEVEL_NUMBER+1 jne @f - mov [cur_level_number], LEVELS_MODE_FIRST_LEVEL + mov [numberLevel.value], LEVELS_MODE_FIRST_LEVEL @@: call Draw_splash @@ -714,9 +693,9 @@ Draw_splash: sub bh, 2 cmp bh, 0 jg @b - + inc al - + mov bh, GRID_HEIGHT-2 mov bl, cl @@: @@ -753,11 +732,11 @@ Draw_splash: mov esi, picture_level call Draw_picture - mov eax, [cur_level_number] + mov eax, [numberLevel.value] mov dl, 10 div dl push ax - + mov esi, digits_font @@: test al, al @@ -766,12 +745,12 @@ Draw_splash: dec al jmp @b @@: - + mov ax, 9*0x100+4 mov cx, 8*0x100+5 mov edx, [splash_level_number_color] call Draw_picture - + pop ax mov esi, digits_font @@: @@ -844,5 +823,4 @@ Draw_lives_in_head: ;;---Draw_lives_in_head---------------------------------------------------------------------------------------------------- - ;;---Some_functions------------------------------------------------------------------------------------------------------------ diff --git a/programs/games/snake/pause.asm b/programs/games/snake/pause.asm index 2b88c212b..548a726e6 100644 --- a/programs/games/snake/pause.asm +++ b/programs/games/snake/pause.asm @@ -17,7 +17,8 @@ Pause_mode: call Draw_decorations call Draw_pause_picture - call Draw_pause_strings + stdcall draw.Navigation, labelMenu, [posLabel.yTop], 0 + stdcall draw.Navigation, labelResume, [posLabel.yCenter], 0 mcall 12,2 @@: .still: @@ -41,7 +42,7 @@ Pause_mode: .key: ; a key was pressed mcall 2 ; get keycode - + cmp ah, 0x01 ; Escape - go to menu je First_menu cmp ah, 0x39 ; Space - resume game @@ -56,7 +57,7 @@ Pause_mode: call Decrease_geometry jmp .redraw @@: - + jmp .still ;;---Pause_mode---------------------------------------------------------------------------------------------------------------- @@ -74,25 +75,7 @@ Draw_pause_picture: call Draw_picture ret - + ;;---Draw_pause_picture-------------------------------------------------------------------------------------------------------- - - -Draw_pause_strings: - ;;===Draw_pause_strings================================================================================================ - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_resume_space.size*3+6 - shl ebx, 16 - add ebx, dword[bottom_middle_strings] - mcall 4, ,[navigation_strings_color],string_resume_space ; Show 'RESUME - SPACE' string - - call Draw_menu_esc ; Show 'MENU - ESC' string - - - ret - - ;;---Draw_pause_strings------------------------------------------------------------------------------------------------ - ;;---Some_functions------------------------------------------------------------------------------------------------------------ diff --git a/programs/games/snake/snake.asm b/programs/games/snake/snake.asm index bd46ce0fa..1ca98f20c 100644 --- a/programs/games/snake/snake.asm +++ b/programs/games/snake/snake.asm @@ -7,11 +7,11 @@ use32 ;;---HEADER-------------------------------------------------------------------------------------------------------------------- +include 'lang.inc' include '../../proc32.inc' include '../../macros.inc' include '../../dll.inc' include '../../develop/libraries/box_lib/trunk/box_lib.mac' -;include '../../system/board/trunk/debug.inc' ;;===Define_chapter============================================================================================================ @@ -21,7 +21,15 @@ WINDOW_MODE_FULLSCREEN equ 1 GRID_WIDTH equ 28 GRID_HEIGHT equ 14 -MIN_SQUARE_SIDE_LENGTH equ 9 +MIN_SQUARE_SIDE_LENGTH equ 10 +MIN_SQUARE_SIDE_LENGTH_FONT equ 20 +FONT_SMALL equ 0 +FONT_LARGE equ 1 +DEFAULT_NAVIGATION_COLOR equ 0xff7777 +DEFAULT_LABEL_COLOR equ 0xffffff +DEFAULT_LABEL_END_COLOR equ 0xff9900 +DEFAULT_NUMBER_END_COLOR equ 0xffdd44 +DEFAULT_HISCORE equ 777 SCORE_EAT equ 100 @@ -53,7 +61,11 @@ CHAMPION_NAME_LENGTH equ 15 LAST_LEVEL_NUMBER equ 36 START_LIVES equ 3 - +struct LABEL + color dd ? + size dd ? + value dd ? +ends ;;---Define_chapter------------------------------------------------------------------------------------------------------------ start: @@ -61,7 +73,7 @@ start: stdcall dll.Load,@IMPORT or eax, eax jnz Exit - + align 4 mov edi, cur_dir_path @@ -129,30 +141,49 @@ align 4 or [you_win_picture_color], eax invoke ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11 or [eat_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777 - or [navigation_strings_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900 - or [game_over_strings_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff - or [score_string_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aLevel_string_color, 0xffffff - or [level_string_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff - or [hiscore_string_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff - or [champion_string_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44 - or [game_over_hiscore_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff - or [score_number_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aLevel_number_color, 0xffffff - or [level_number_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff - or [hiscore_number_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff - or [champion_name_color], eax - invoke ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00 - or [edit1.shift_color], eax + ; ini navigation color + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelNavigation, DEFAULT_NAVIGATION_COLOR + mov [labelMenu.color], eax + mov [labelExit.color], eax + mov [labelStart.color], eax + mov [labelPause.color], eax + mov [labelApply.color], eax + mov [labelResume.color], eax + ; ini color score + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelScore, DEFAULT_LABEL_COLOR + mov [labelScore.color], eax + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.numberScore, DEFAULT_LABEL_COLOR + mov [numberScore.color], eax + ; ini color hiscore + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelHiscore, DEFAULT_LABEL_COLOR + mov [labelHiscore.color], eax + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.numberHiscore, DEFAULT_LABEL_COLOR + mov [numberHiscore.color], eax + ; ini color champion + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelChampion, DEFAULT_LABEL_COLOR + mov [labelChampion.color], eax + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelChampionName, DEFAULT_LABEL_COLOR + mov [labelChampionName.color], eax + ; ini color level + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelLevel, DEFAULT_LABEL_COLOR + mov [labelLevel.color], eax + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.numberLevel, DEFAULT_LABEL_COLOR + mov [numberLevel.color], eax + ; ini color game over + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.labelGameOver, DEFAULT_LABEL_END_COLOR + mov [labelCongratulations.color], eax + mov [labelEnterName.color], eax + invoke ini.get_color, cur_dir_path, aTheme_name, configColor.numberGameOver, DEFAULT_NUMBER_END_COLOR + mov [numberGameOver.color], eax + mov [edit1.text_color], eax + ; ini color edit box + invoke ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00 + mov [edit1.shift_color], eax + mov eax, [background_color] + mov [edit1.color], eax + mov [edit1.focus_border_color], eax + mov [edit1.blur_border_color], eax + ; invoke ini.get_color, cur_dir_path, aTheme_name, aButton_color, 0xDDDDDD or [button_color], eax invoke ini.get_color, cur_dir_path, aTheme_name, aButton_text_color, 0x000000 @@ -166,21 +197,14 @@ align 4 invoke ini.get_color, cur_dir_path, aTheme_name, aSplash_level_string_color, 0x000000 or [splash_level_string_color], eax - invoke ini.get_int, cur_dir_path, aReserved, aSquare_side_length, 19 - mov [square_side_length], eax - invoke ini.get_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, CHAMPION_NAME_LENGTH, champion_name_classic - invoke ini.get_int, cur_dir_path, aReserved, aHiscore_classic, 777 - or [hi_score_classic], eax - invoke ini.get_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, CHAMPION_NAME_LENGTH, champion_name_levels - invoke ini.get_int, cur_dir_path, aReserved, aHiscore_levels, 777 - or [hi_score_levels], eax - - mov eax, [background_color] - mov [edit1.color], eax - mov [edit1.focus_border_color], eax - mov [edit1.blur_border_color], eax - mov eax, [game_over_hiscore_color] - mov [edit1.text_color], eax + invoke ini.get_int, cur_dir_path, aReserved, aSquare_side_length, 19 + mov [square_side_length], eax + invoke ini.get_str, cur_dir_path, aReserved, config.championNameClassic, labelChampionName.valueClassic, CHAMPION_NAME_LENGTH+1, labelChampionName.valueClassic + invoke ini.get_str, cur_dir_path, aReserved, config.championNameLevels, labelChampionName.valueLevels, CHAMPION_NAME_LENGTH+1, labelChampionName.valueLevels + invoke ini.get_int, cur_dir_path, aReserved, config.hiscoreClassic, DEFAULT_HISCORE + mov [numberHiscore.valueClassic], eax + invoke ini.get_int, cur_dir_path, aReserved, config.hiscoreLevels, DEFAULT_HISCORE + mov [numberHiscore.valueLevels], eax mcall 37,4,cursor_data,2 ; load empty cursor (for "hiding" cursor while level_mode) mov [cursor_handle], eax @@ -195,7 +219,7 @@ include 'first_menu.asm' ; First menu body and functions include 'level.asm' ; Level body and functions (game process) include 'pause.asm' ; Pause body and functions include 'game_over.asm' ; Game_over body and functions - +include 'functions.asm' ;;===Some_functions============================================================================================================ @@ -206,25 +230,25 @@ Save_do_smth_else_and_exit: invoke ini.set_int, cur_dir_path, aReserved, aSquare_side_length, [square_side_length] - mov edi, champion_name_classic + mov edi, labelChampionName.valueClassic xor al, al mov ecx, CHAMPION_NAME_LENGTH+1 cld repne scasb neg ecx add ecx, CHAMPION_NAME_LENGTH - invoke ini.set_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, ecx - invoke ini.set_int, cur_dir_path, aReserved, aHiscore_classic, [hi_score_classic] + invoke ini.set_str, cur_dir_path, aReserved, config.championNameClassic, labelChampionName.valueClassic, ecx + invoke ini.set_int, cur_dir_path, aReserved, config.hiscoreClassic, [numberHiscore.valueClassic] - mov edi, champion_name_levels + mov edi, labelChampionName.valueLevels xor al, al mov ecx, CHAMPION_NAME_LENGTH+1 cld repne scasb neg ecx add ecx, CHAMPION_NAME_LENGTH - invoke ini.set_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, ecx - invoke ini.set_int, cur_dir_path, aReserved, aHiscore_levels, [hi_score_levels] + invoke ini.set_str, cur_dir_path, aReserved, config.championNameLevels, labelChampionName.valueLevels, ecx + invoke ini.set_int, cur_dir_path, aReserved, config.hiscoreLevels, [numberHiscore.valueLevels] ;;---Save_do_smth_else_and_exit-------------------------------------------------------------------------------------------- @@ -234,7 +258,7 @@ Exit: or eax, -1 int 0x40 - + ;;---Exit------------------------------------------------------------------------------------------------------------------ @@ -273,7 +297,7 @@ Set_geometry: test [proc_info.wnd_state], 0x01 jnz .by_hotkey - + cmp [window_width], 250 jnl @f @@ -345,7 +369,9 @@ Set_geometry: @@: mov eax, [square_side_length] inc eax ; space between squares + mov [g_s], eax + stdcall draw.setConfigFont, eax mov eax, [g_s] shr eax, 1 @@ -401,7 +427,7 @@ Set_geometry: sub eax, ebx sub eax, 5 sub eax, 5 - + shr eax, 1 mov [gbym1], eax @@ -456,19 +482,27 @@ Set_geometry: shr cx, 1 add cx, dx mov word[wp_y], cx - - mov [top_strings], 8 - mov eax, [window_height] - sub eax, 50 - mov [bottom_top_strings], eax - add eax, 6 - mov [bottom_middle_strings], eax - add eax, 6 - mov [bottom_bottom_strings], eax - - sub eax, 4 - mov [edit1.top], eax - + ; ?????????? ????? ??? ?????? ?? + ; ????? ?? Y + mov ecx, [configFont.height] + mov ebx, ecx + shr ebx, 1 + mov eax, [gbym1] + sub eax, ecx + sub eax, ebx + mov [posLabel.yTop], eax + mov eax, [gbym1_plus_gh_mul_gs] + add eax, ecx + sub eax, ebx + mov [posLabel.yCenter], eax + add eax, ecx + add eax, ebx + mov [posLabel.yBottom], eax + ; x + mov eax, [gbxm1] + mov [posLabel.xLeft], eax + mov eax, [gbxm1_plus_gw_mul_gs] + mov [posLabel.xRight], eax mov eax, [g_s] shl eax, 2 @@ -497,26 +531,26 @@ Set_geometry: mov cx, ax add cx, word[gbym1] inc cx - + mov [button_x_left], ebx mov [button_y_top], ecx - + add ebx, [g_s] add ebx, [g_s] add ebx, [g_s] add ebx, [g_s] add ebx, [g_s] - + mov [button_x_right], ebx - + add ecx, [g_s] add ecx, [g_s] - + mov [button_y_middle], ecx - + add ecx, [g_s] add ecx, [g_s] - + mov [button_y_bottom], ecx .done: @@ -541,15 +575,12 @@ Increase_geometry: Decrease_geometry: ;;===Decrease_geometry================================================================================================= - cmp [square_side_length], MIN_SQUARE_SIDE_LENGTH - je @f + je @f dec [square_side_length] mov [resized_by_hotkey], 1 - @@: ret - ;;---Decrease_geometry------------------------------------------------------------------------------------------------- @@ -606,7 +637,7 @@ Draw_decorations: mov ecx, [gbym1_shl16_gbym1] mov esi, GRID_HEIGHT add esi, 1 - + @@: mcall add ecx, [gs_shl16_gs] @@ -643,7 +674,7 @@ Draw_decorations: mov ecx, [gbym1_shl16_gbym1] mov esi, GRID_HEIGHT add esi, 1 - + @@: mcall add ecx, [gs_shl16_gs] @@ -929,140 +960,6 @@ Draw_square: ret ;;---Draw_square------------------------------------------------------------------------------------------------------- - - -Draw_menu_esc: - ;;===Draw_menu_esc===================================================================================================== - - mov ebx, [window_width] - shr ebx, 1 - sub ebx, string_menu_esc.size*3+6 - shl ebx, 16 - add ebx, dword[top_strings] - mcall 4, ,[navigation_strings_color],string_menu_esc - - ret - - ;;---Draw_menu_esc----------------------------------------------------------------------------------------------------- - - -Draw_score_string: - ;;===Draw_score_string================================================================================================= - - mov ebx, [window_width] - shr ebx, 3 - sub ebx, 5 - shl ebx, 16 - add ebx, dword[bottom_top_strings] - mcall 4, ,[score_string_color],string_score - - ret - - ;;---Draw_score_string------------------------------------------------------------------------------------------------- - - -Draw_score_number: - ;;===Draw_score_number================================================================================================= - - mov edx, [window_width] - shr edx, 3 - sub edx, 5+1 - add edx, string_score.size*6 - shl edx, 16 - add edx, dword[bottom_top_strings] - mcall 47,0x00070000,[score], ,[score_number_color],[background_color] - - ret - - ;;---Draw_score_number------------------------------------------------------------------------------------------------- - - -Draw_hiscore_string: - ;;===Draw_hiscore_string=============================================================================================== - - mov ebx, [window_width] - shr ebx, 3 - neg ebx - add ebx, [window_width] - sub ebx, string_hi_score.size*6+7*6+5 - shl ebx, 16 - add ebx, dword[bottom_top_strings] - mcall 4, ,[hiscore_string_color],string_hi_score - - ret - - ;;---Draw_hiscore_string----------------------------------------------------------------------------------------------- - - -Draw_hiscore_number: - ;;===Draw_hiscore_number=================================================================================================== - - mov edx, [window_width] - shr edx, 3 - neg edx - add edx, [window_width] - sub edx, 7*6+6 - shl edx, 16 - add edx, dword[bottom_top_strings] - - cmp [play_mode], CLASSIC_MODE - jne @f - mov ecx, [hi_score_classic] - jmp .done - @@: - mov ecx, [hi_score_levels] - - .done: - mcall 47,0x00070000, , ,[hiscore_number_color] - - ret - - ;;---Draw_hiscore_number--------------------------------------------------------------------------------------------------- - - -Draw_champion_string: - ;;===Draw_champion_string================================================================================================== - - mov ebx, [window_width] - shr ebx, 3 - neg ebx - add ebx, [window_width] - sub ebx, string_champion.size*6+7*6+5 - shl ebx, 16 - add ebx, dword[bottom_bottom_strings] - mcall 4, ,[champion_string_color],string_champion - - ret - - ;;---Draw_champion_string---------------------------------------------------------------------------------------------- - - -Draw_champion_name: - ;;===Draw_champion_name================================================================================================ - - mov ebx, [window_width] - shr ebx, 3 - neg ebx - add ebx, [window_width] - sub ebx, CHAMPION_NAME_LENGTH/2*6+7*6+6 ; there is no difference between length of champion names for other play_modes - add ebx, CHAMPION_NAME_LENGTH/2*6 - shl ebx, 16 - add ebx, dword[bottom_bottom_strings] - - cmp [play_mode], CLASSIC_MODE - jne @f - mov edx, champion_name_classic - jmp .done - @@: - mov edx, champion_name_levels - - .done: - mcall 4, ,[champion_name_color], - - ret - - ;;---Draw_champion_name------------------------------------------------------------------------------------------------ - Draw_picture: ;;===Draw_picture====================================================================================================== @@ -1080,14 +977,14 @@ Draw_picture: .draw: mov bl, ah mov di, 7 - + .loop: bt word[esi], di jnc @f push eax ebx ecx esi edi call Draw_square pop edi esi ecx ebx eax - + @@: dec di jns @f @@ -1097,7 +994,7 @@ Draw_picture: inc bl cmp bl, al jne .loop - + inc bh cmp di, 7 jz @f @@ -1145,7 +1042,7 @@ Get_from_map: ;; push eax - + and eax, 0x0000ffff xor bx, bx mov bl, al @@ -1170,7 +1067,7 @@ Load_level: ;; cur_level_number = level number to load ;; - mov eax, [cur_level_number] + mov eax, [numberLevel.value] mov edx, stage_00 @@: test al, al @@ -1253,12 +1150,12 @@ Load_level: mov edi, snake_dots mov ecx, 3 rep movsw - + mov esi, edx add esi, LEVEL.snake_direction mov eax, [esi] mov [snake_direction], eax - + mov esi, edx add esi, LEVEL.snake_direction_next mov eax, [esi] @@ -1269,7 +1166,7 @@ Load_level: mov eax, [esi] mov [number_of_free_dots], GRID_WIDTH*GRID_HEIGHT-3 sub [number_of_free_dots], eax - + mov ax, word[snake_dots] mov cl, 1 call Draw_on_map @@ -1370,7 +1267,6 @@ Reverse_snake: ;;---Reverse_snake--------------------------------------------------------------------------------------------------------- - ;;===Variables================================================================================================================== window_title db 'Snake',64+15 dup (0) @@ -1388,29 +1284,6 @@ lives dd START_LIVES acceleration_mask dd 0x0 resized_by_hotkey dd 0x0 -fullscreen dd 0x0 - -szZ string_score ,'SCORE : ' -szZ string_hi_score ,'HI-SCORE : ' -szZ string_champion ,'CHAMPION : ' -szZ string_level ,'LEVEL : ' -szZ string_pause_space ,'PAUSE - ',0x27,'SPACE',0x27 -szZ string_resume_space ,'RESUME - ',0x27,'SPACE',0x27 -szZ string_menu_esc ,'MENU - ',0x27,'ESC',0x27 -szZ string_apply_name_enter ,'APPLY NAME - ',0x27,'ENTER',0x27 -szZ press_to_start ,'PRESS ',0x27,'ENTER',0x27,' TO START' -szZ press_esc_to_exit ,'PRESS ',0x27,'ESC',0x27,' TO EXIT' -;press_F2_to_options db 'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0 - -szZ string_congratulations ,' Congratulations!!! New hi-score is : ' -szZ string_enter_your_name ,'You are the champion! Enter your name : ' - -szZ string_button_play ,'PLAY' -szZ string_button_exit ,'EXIT' -szZ string_button_inc ,'+INC+' -szZ string_button_dec ,'-dec-' -szZ string_button_pm_classic,'CLASSIC mode' -szZ string_button_pm_levels ,'LEVELS mode' is_new_record dd 0 @@ -1449,19 +1322,6 @@ picture_game_over db 00110000b,00000000b,00000000b,00000000b,\ 00001000b,10010100b,10000111b,10000000b,\ 00000111b,00001000b,11110100b,01000000b -;picture_you_win db 10001001b,11001000b,10000000b,\ -; 10001010b,00101000b,10000000b,\ -; 01010010b,00101000b,10000000b,\ -; 00100010b,00101000b,10000000b,\ -; 00100001b,11000111b,00000000b,\ -; 00000000b,00000000b,00000000b,\ -; 00000000b,00000000b,00000000b,\ -; 01000100b,10010001b,00000000b,\ -; 01010100b,10011001b,00000000b,\ -; 01010100b,10010101b,00000000b,\ -; 01010100b,10010011b,00000000b,\ -; 00101000b,10010001b,00000000b - picture_you_win db 01000100b,01000011b,10001000b,10000000b,\ 01000100b,01000100b,01001000b,10000000b,\ 01000100b,01000100b,00001000b,10000000b,\ @@ -2357,23 +2217,12 @@ pause_picture_color dd 0x000000 game_over_picture_color dd 0x000000 you_win_picture_color dd 0x000000 eat_color dd 0x000000 -navigation_strings_color dd 0x80000000 -game_over_strings_color dd 0x80000000 -score_string_color dd 0x80000000 -hiscore_string_color dd 0x80000000 -champion_string_color dd 0x80000000 -game_over_hiscore_color dd 0x80000000 -score_number_color dd 0x40000000 -hiscore_number_color dd 0x00000000 -champion_name_color dd 0x80000000 button_color dd 0x000000 button_text_color dd 0x80000000 stone_color dd 0x000000 splash_background_color dd 0x000000 splash_level_string_color dd 0x000000 splash_level_number_color dd 0x000000 -level_string_color dd 0x80000000 -level_number_color dd 0x00000000 align 4 @@ -2396,8 +2245,6 @@ import box_lib,\ edit_box.key , 'edit_box_key' ,\ edit_box.mouse , 'edit_box_mouse' -bFirstDraw db 0 - aPreferences db 'Preferences',0 aSpeed db 'Speed',0 aTheme db 'Theme',0 @@ -2428,15 +2275,6 @@ aPause_picture_color db 'Pause_picture_color',0 aGame_over_picture_color db 'Game_over_picture_color',0 aYou_win_picture_color db 'You_win_picture_color',0 aEat_color db 'Eat_color',0 -aNavigation_strings_color db 'Navigation_string_color',0 -aGame_over_strings_color db 'Game_over_string_color',0 -aScore_string_color db 'Score_string_color',0 -aHiscore_string_color db 'Hiscore_string_color',0 -aChampion_string_color db 'Champion_string_color',0 -aGame_over_hiscore_color db 'Game_over_hiscore_color',0 -aScore_number_color db 'Score_number_color',0 -aHiscore_number_color db 'Hiscore_number_color',0 -aChampion_name_color db 'Champion_name_color',0 aEdit_box_selection_color db 'Edit_box_selection_color',0 aButton_color db 'Button_color',0 aButton_text_color db 'Button_text_color',0 @@ -2444,15 +2282,81 @@ aStone_color db 'Stone_color',0 aSplash_background_color db 'Splash_background_color',0 aSplash_level_string_color db 'Splash_level_string_color',0 aSplash_level_number_color db 'Splash_level_number_color',0 -aLevel_string_color db 'Level_string_color',0 -aLevel_number_color db 'Level_number_color',0 aReserved db 'Reserved',0 aSquare_side_length db 'Square_side_length',0 -aHiscore_classic db 'Hiscore_classic',0 -aChampion_name_classic db 'Champion_name_classic',0 -aHiscore_levels db 'Hiscore_levels',0 -aChampion_name_levels db 'Champion_name_levels',0 + +config: + .championNameClassic db 'Champion_name_classic',0 + .championNameLevels db 'Champion_name_levels',0 + .hiscoreClassic db 'Hiscore_classic',0 + .hiscoreLevels db 'Hiscore_levels',0 + +configFont: + .flag dd 0 + .width dd 6 + .height dd 9 + .mask dd 0x80000000 + .maskNumber dd 0x40000000 + +configColor: + .labelNavigation db 'Navigation_string_color',0 + .labelScore db 'Score_string_color',0 + .numberScore db 'Score_number_color',0 + .labelLevel db 'Level_string_color',0 + .numberLevel db 'Level_number_color',0 + .labelHiscore db 'Hiscore_string_color',0 + .numberHiscore db 'Hiscore_number_color',0 + .labelChampion db 'Champion_string_color',0 + .labelChampionName db 'Champion_name_color',0 + .labelGameOver db 'Game_over_string_color',0 + .numberGameOver db 'Game_over_hiscore_color',0 +if lang eq ru_RU + szZ string_button_play ,'ИГРАТЬ' + szZ string_button_exit ,'ВЫХОД' + szZ string_button_inc ,'+INC+' + szZ string_button_dec ,'-dec-' + szZ string_button_pm_classic,'режим КЛАССИЧЕСКИЙ' + szZ string_button_pm_levels ,'режим УРОВНЕЙ' + + defLabel labelScore , DEFAULT_LABEL_COLOR, 'СЧЕТ : ' + defLabel labelLevel , DEFAULT_LABEL_COLOR, 'УРОВЕНЬ : ' + defLabel labelHiscore , DEFAULT_LABEL_COLOR, 'ЛУЧШИЙ СЧЕТ : ' + defLabel labelChampion , DEFAULT_LABEL_COLOR, 'ЧЕМПИОН : ' + defLabel labelMenu , DEFAULT_NAVIGATION_COLOR, 'НАЖМИТЕ ',0x27,'ESC',0x27,' ДЛЯ ВЫХОДА В МЕНЮ' + defLabel labelExit , DEFAULT_NAVIGATION_COLOR, 'НАЖМИТЕ ',0x27,'ESC',0x27,' ДЛЯ ВЫХОДА ИЗ ИГРЫ' + defLabel labelStart , DEFAULT_NAVIGATION_COLOR, 'НАЖМИТЕ ',0x27,'ENTER',0x27,' ЧТОБЫ НАЧАТЬ' + defLabel labelPause , DEFAULT_NAVIGATION_COLOR, 'НАЖМИТЕ ',0x27,'SPACE',0x27, ' ДЛЯ ПАУЗЫ' + defLabel labelApply , DEFAULT_NAVIGATION_COLOR, 'ВВЕДИТЕ ИМЯ И НАЖМИТЕ ',0x27,'ENTER',0x27 + defLabel labelResume , DEFAULT_NAVIGATION_COLOR, 'НАЖМИТЕ ',0x27,'SPACE',0x27, ' ДЛЯ ПРОДОЛЖЕНИЯ' + defLabel labelCongratulations, DEFAULT_LABEL_END_COLOR, 'Поздравляем!!! Новый лучший счет : ' + defLabel labelEnterName , DEFAULT_LABEL_END_COLOR, 'Теперь вы чемпион! Введите свое имя : ' +else + szZ string_button_play ,'PLAY' + szZ string_button_exit ,'EXIT' + szZ string_button_inc ,'+INC+' + szZ string_button_dec ,'-dec-' + szZ string_button_pm_classic,'CLASSIC mode' + szZ string_button_pm_levels ,'LEVELS mode' + + defLabel labelScore , DEFAULT_LABEL_COLOR, 'SCORE : ' + defLabel labelLevel , DEFAULT_LABEL_COLOR, 'LEVEL : ' + defLabel labelHiscore , DEFAULT_LABEL_COLOR, 'HI-SCORE : ' + defLabel labelChampion , DEFAULT_LABEL_COLOR, 'CHAMPION : ' + defLabel labelMenu , DEFAULT_NAVIGATION_COLOR, 'MENU - ',0x27,'ESC',0x27 + defLabel labelExit , DEFAULT_NAVIGATION_COLOR, 'PRESS ',0x27,'ESC',0x27,' TO EXIT' + defLabel labelStart , DEFAULT_NAVIGATION_COLOR, 'PRESS ',0x27,'ENTER',0x27,' TO START' + defLabel labelPause , DEFAULT_NAVIGATION_COLOR, 'PAUSE - ',0x27,'SPACE',0x27 + defLabel labelApply , DEFAULT_NAVIGATION_COLOR, 'APPLY NAME - ',0x27,'ENTER',0x27 + defLabel labelResume , DEFAULT_NAVIGATION_COLOR, 'RESUME - ',0x27,'SPACE',0x27 + defLabel labelCongratulations, DEFAULT_LABEL_END_COLOR, 'Congratulations!!! New hi-score is : ' + defLabel labelEnterName , DEFAULT_LABEL_END_COLOR, 'You are the champion! Enter your name : ' +end if +defNumber numberScore , DEFAULT_LABEL_COLOR, 7 +defNumber numberLevel , DEFAULT_LABEL_COLOR, 2 +defNumber numberHiscore , DEFAULT_LABEL_COLOR, 7 +defLabel labelChampionName, DEFAULT_LABEL_COLOR, 15 dup (0x20) +defNumber numberGameOver , DEFAULT_NUMBER_END_COLOR, 7 edit1 edit_box 65,397,0x0,0x000000,0x000000,0x000000,0x000000,0x80000000,15,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1 @@ -2461,20 +2365,23 @@ hed db '',0 i_end: hed_end: rb 256 + +posLabel: + .xLeft rd 1 + .xRight rd 1 + .yTop rd 1 + .yCenter rd 1 + .yBottom rd 1 + +labelChampionName.valueClassic rb CHAMPION_NAME_LENGTH +labelChampionName.valueLevels rb CHAMPION_NAME_LENGTH +numberHiscore.valueClassic rd 1 +numberHiscore.valueLevels rd 1 mouse_dd rd 1 window_style rd 1 cur_level rd 1 -cur_level_number rd 1 -hi_level rd 1 - -score rd 1 -hi_score_classic rd 1 -hi_score_levels rd 1 - -champion_name_classic rb CHAMPION_NAME_LENGTH -champion_name_levels rb CHAMPION_NAME_LENGTH snake_dots rb GRID_WIDTH*GRID_HEIGHT*2+3 ; +3 bytes for faster dword copying snake_direction rd 1 @@ -2502,11 +2409,6 @@ gs_shl16_gs rd 1 gbxm1_shl16_gbxm1 rd 1 gbym1_shl16_gbym1 rd 1 -bottom_top_strings rd 1 -bottom_middle_strings rd 1 -bottom_bottom_strings rd 1 -top_strings rd 1 - button_x_left rd 1 button_x_right rd 1 button_y_top rd 1 diff --git a/programs/games/snake/snake.ini b/programs/games/snake/snake.ini index 12819c45f..7ae88eb65 100644 --- a/programs/games/snake/snake.ini +++ b/programs/games/snake/snake.ini @@ -1,217 +1,217 @@ -;;===Common_preferences================================================= -[Preferences] -Speed=80 -; Delay between moves in ms (1/100 second) -; SLOW == 0 <= Speed <= 100 == FAST -Theme=Theme_standard -; Theme name to use -; See [Theme_*] sections below for available themes -; Name of any theme must be shorter than 30 chars -Smart_reverse=0 -; 0 - disabled, 1 - eabled -; If this option is enabled, the snake may be reversed only by pressing Reverse key (see [Shortcuts] section) -; For example, if the snake is moving to the left and you press RIGHT key the snake will not move to the right -Show_lives_style=2 -; 0 - do not show remaining lives -; 1 - show as a number in window title -; 2 - draw the number in snake head -; 3 - both 1 & 2 -Draw_level_name_in_window_title=1 -; 1 - yes, draw -; 0 - no -; This option includes drawing 'Classic mode' string in window title for classic mode (without levels) -Separating_symbol=/ -; Symbol that separates 'Snake', '3 lives' and level name in window title -; 'Snake | 3 lives | Towers of Hanoi' -; 'Snake - 3 lives -; 'Snake / Towers of Hanoi' -; or smth like these ones -;;---Common_preferences------------------------------------------------- - -;;===Shortcuts========================================================== -[Shortcuts] -; Keys of moving. These ones are in addition to the standard combination of arrows. -; VIM-like navigation is used by default. -Move_left = h -Move_down = j -Move_up = k -Move_right = l -; Snake reverse key -Reverse = Tab -; Increare/decrease field keys -Increase = u -Decrease = i - -;;---Shortcuts---------------------------------------------------------- - -;;===Visual_themes====================================================== -[Theme_standard] -; all these keys are optional -Decorations = 3 -; 0 = nothing -; 1 = grid_lines -; 2 = grid_lines_with_ends -; 3 = grid_lines_with_corners -; 4 = grid_dots -; 5 = borders_lines -; 6 = borders_lines_with_corners -; 7 = borders_dots -; 8 = corners_dots -; 9 = corners_inner -; 10 = corners_outer -; 11 = corners_crosses -Background_color = 0,0,0 -Decorations_color = 35,35,0 -Snake_color = 17,17,255 -Snake_head_color = 107,107,255 -; by default Snake_head_color is equal to Snake_color, so the snake has no head -Lives_in_head_number_color= 255,136,0 -; color of the number in snake head which represents remaining lives -Snake_picture_color = 68,136,255 -; color of big 'SNAKE' label at start menu -Version_picture_color = 85,255,85 -Pause_picture_color = 17,255,17 -Game_over_picture_color = 255,17,17 -; ... if you end game without new record -You_win_picture_color = 255,255,17 -; ... if you end game with new record -Navigation_string_color = 255,119,119 -; color of 'PRESS * to *' and like this strings -Game_over_string_color = 255,153,0 -; color of strings on game_over screen -Game_over_hiscore_color = 255,221,68 -; color of new hiscore and champion name on game_over screen -Eat_color = 255,255,17 -Score_number_color = 255,255,255 -; color of "SCORE : " string at the left bottom screen part -Score_string_color = 255,255,255 -; color of digits after "SCORE : " -Level_string_color = 255,255,255 -; color of "LEVEL : " string at the left bottom screen part -Level_number_color = 255,255,255 -; color of digits after "LEVEL : " -Hiscore_number_color = 255,255,255 -Hiscore_string_color = 255,255,255 -Champion_string_color = 255,255,255 -Champion_name_color = 255,255,255 -Edit_box_selection_color= 0,176,0 -Button_color = 221,221,221 -; color of buttons 'play', 'exit' etc at start menu -Button_text_color = 0,0,0 -; color of the text on these buttons -Stone_color = 95,135,0 -Splash_background_color = 170,170,0 -; background color for "LEVEL ??" label between levels -Splash_level_string_color= 0,0,0 -; color of "LEVEL" label -Splash_level_number_color= 0,0,0 -; color of two level number digits on splash between levels - -[Theme_light] -Decorations = 2 -Background_color = 245,245,245 -Decorations_color = 55,55,55 -Snake_color = 225,125,225 -Snake_head_color = 255,125,55 -Lives_in_head_number_color= 255,255,255 -Snake_picture_color = 105,155,205 -Version_picture_color = 155,255,0 -Pause_picture_color = 75,255,75 -Game_over_picture_color = 225,125,105 -You_win_picture_color = 55,255,155 -Navigation_string_color = 205,105,105 -Game_over_string_color = 205,105,105 -Game_over_hiscore_color = 205,75,75 -Eat_color = 225,225,25 -Score_number_color = 100,100,255 -Score_string_color = 100,100,255 -Level_string_color = 100,100,255 -Level_number_color = 100,100,255 -Hiscore_number_color = 100,100,255 -Hiscore_string_color = 100,100,255 -Champion_string_color = 100,100,255 -Champion_name_color = 100,100,255 -Edit_box_selection_color= 0,176,0 -Button_color = 221,221,221 -Button_text_color = 0,0,0 -Stone_color = 105,185,255 -Splash_background_color = 185,255,185 -Splash_level_string_color= 165,165,255 -Splash_level_number_color= 255,165,165 - -[Theme_ultra_white] -Decorations = 10 -Background_color = 255,255,255 -Decorations_color = 0,0,0 -Snake_color = 30,30,30 -Snake_head_color = 30,30,30 -Lives_in_head_number_color= 255,255,255 -Snake_picture_color = 30,30,30 -Version_picture_color = 70,70,70 -Pause_picture_color = 30,30,30 -Game_over_picture_color = 30,30,30 -You_win_picture_color = 105,105,105 -Navigation_string_color = 255,255,255 -Game_over_string_color = 30,30,30 -Game_over_hiscore_color = 0,0,0 -Eat_color = 0,255,0 -Score_number_color = 0,0,0 -Score_string_color = 255,255,255 -Level_string_color = 255,255,255 -Level_number_color = 255,255,255 -Hiscore_number_color = 0,0,0 -Hiscore_string_color = 255,255,255 -Champion_string_color = 255,255,255 -Champion_name_color = 255,255,255 -Edit_box_selection_color= 176,176,176 -Button_color = 221,221,221 -Button_text_color = 0,0,0 -Stone_color = 145,145,145 -Splash_background_color = 205,205,205 -Splash_level_string_color= 255,255,255 -Splash_level_number_color= 255,255,255 - -[Theme_ultra_black] -Decorations = 6 -Background_color = 0,0,0 -Decorations_color = 255,255,255 -Snake_color = 255,255,255 -Snake_head_color = 255,255,255 -Lives_in_head_number_color= 30,30,30 -Snake_picture_color = 255,255,255 -Version_picture_color = 225,225,225 -Pause_picture_color = 225,225,225 -Game_over_picture_color = 225,225,225 -You_win_picture_color = 255,255,255 -Navigation_string_color = 0,0,0 -Game_over_string_color = 225,225,225 -Game_over_hiscore_color = 225,225,225 -Eat_color = 255,0,0 -Score_number_color = 255,255,255 -Score_string_color = 255,255,255 -Level_string_color = 0,0,0 -Level_number_color = 0,0,0 -Hiscore_number_color = 255,255,255 -Hiscore_string_color = 255,255,255 -Champion_string_color = 0,0,0 -Champion_name_color = 0,0,0 -Edit_box_selection_color= 100,100,100 -Button_color = 221,221,221 -Button_text_color = 0,0,0 -Stone_color = 145,145,145 -Splash_background_color = 30,30,30 -Splash_level_string_color= 255,255,255 -Splash_level_number_color= 255,255,255 - -[Theme_your_theme_name] - -;;---Visual_themes------------------------------------------------------ - -;;===Reserved_Section=================================================== -[Reserved] -Square_side_length=19 -Champion_name_classic= -Hiscore_classic=777 -Champion_name_levels= -Hiscore_levels=222 -;;---Reserved_Section--------------------------------------------------- \ No newline at end of file +;;===Common_preferences================================================= +[Preferences] +Speed=80 +; Delay between moves in ms (1/100 second) +; SLOW == 0 <= Speed <= 100 == FAST +Theme=Theme_standard +; Theme name to use +; See [Theme_*] sections below for available themes +; Name of any theme must be shorter than 30 chars +Smart_reverse=0 +; 0 - disabled, 1 - eabled +; If this option is enabled, the snake may be reversed only by pressing Reverse key (see [Shortcuts] section) +; For example, if the snake is moving to the left and you press RIGHT key the snake will not move to the right +Show_lives_style=2 +; 0 - do not show remaining lives +; 1 - show as a number in window title +; 2 - draw the number in snake head +; 3 - both 1 & 2 +Draw_level_name_in_window_title=1 +; 1 - yes, draw +; 0 - no +; This option includes drawing 'Classic mode' string in window title for classic mode (without levels) +Separating_symbol=/ +; Symbol that separates 'Snake', '3 lives' and level name in window title +; 'Snake | 3 lives | Towers of Hanoi' +; 'Snake - 3 lives +; 'Snake / Towers of Hanoi' +; or smth like these ones +;;---Common_preferences------------------------------------------------- + +;;===Shortcuts========================================================== +[Shortcuts] +; Keys of moving. These ones are in addition to the standard combination of arrows. +; VIM-like navigation is used by default. +Move_left = h +Move_down = j +Move_up = k +Move_right = l +; Snake reverse key +Reverse = Tab +; Increare/decrease field keys +Increase = u +Decrease = i + +;;---Shortcuts---------------------------------------------------------- + +;;===Visual_themes====================================================== +[Theme_standard] +; all these keys are optional +Decorations = 3 +; 0 = nothing +; 1 = grid_lines +; 2 = grid_lines_with_ends +; 3 = grid_lines_with_corners +; 4 = grid_dots +; 5 = borders_lines +; 6 = borders_lines_with_corners +; 7 = borders_dots +; 8 = corners_dots +; 9 = corners_inner +; 10 = corners_outer +; 11 = corners_crosses +Background_color = 0,0,0 +Decorations_color = 35,35,0 +Snake_color = 17,17,255 +Snake_head_color = 107,107,255 +; by default Snake_head_color is equal to Snake_color, so the snake has no head +Lives_in_head_number_color= 255,136,0 +; color of the number in snake head which represents remaining lives +Snake_picture_color = 68,136,255 +; color of big 'SNAKE' label at start menu +Version_picture_color = 85,255,85 +Pause_picture_color = 17,255,17 +Game_over_picture_color = 255,17,17 +; ... if you end game without new record +You_win_picture_color = 255,255,17 +; ... if you end game with new record +Navigation_string_color = 255,119,119 +; color of 'PRESS * to *' and like this strings +Game_over_string_color = 255,153,0 +; color of strings on game_over screen +Game_over_hiscore_color = 255,221,68 +; color of new hiscore and champion name on game_over screen +Eat_color = 255,255,17 +Score_number_color = 255,255,255 +; color of "SCORE : " string at the left bottom screen part +Score_string_color = 255,255,255 +; color of digits after "SCORE : " +Level_string_color = 255,255,255 +; color of "LEVEL : " string at the left bottom screen part +Level_number_color = 255,255,255 +; color of digits after "LEVEL : " +Hiscore_number_color = 255,255,255 +Hiscore_string_color = 255,255,255 +Champion_string_color = 255,255,255 +Champion_name_color = 255,255,255 +Edit_box_selection_color= 0,176,0 +Button_color = 221,221,221 +; color of buttons 'play', 'exit' etc at start menu +Button_text_color = 0,0,0 +; color of the text on these buttons +Stone_color = 95,135,0 +Splash_background_color = 170,170,0 +; background color for "LEVEL ??" label between levels +Splash_level_string_color= 0,0,0 +; color of "LEVEL" label +Splash_level_number_color= 0,0,0 +; color of two level number digits on splash between levels + +[Theme_light] +Decorations = 2 +Background_color = 245,245,245 +Decorations_color = 55,55,55 +Snake_color = 225,125,225 +Snake_head_color = 255,125,55 +Lives_in_head_number_color= 255,255,255 +Snake_picture_color = 105,155,205 +Version_picture_color = 155,255,0 +Pause_picture_color = 75,255,75 +Game_over_picture_color = 225,125,105 +You_win_picture_color = 55,255,155 +Navigation_string_color = 205,105,105 +Game_over_string_color = 205,105,105 +Game_over_hiscore_color = 205,75,75 +Eat_color = 225,225,25 +Score_number_color = 100,100,255 +Score_string_color = 100,100,255 +Level_string_color = 100,100,255 +Level_number_color = 100,100,255 +Hiscore_number_color = 100,100,255 +Hiscore_string_color = 100,100,255 +Champion_string_color = 100,100,255 +Champion_name_color = 100,100,255 +Edit_box_selection_color= 0,176,0 +Button_color = 221,221,221 +Button_text_color = 0,0,0 +Stone_color = 105,185,255 +Splash_background_color = 185,255,185 +Splash_level_string_color= 165,165,255 +Splash_level_number_color= 255,165,165 + +[Theme_ultra_white] +Decorations = 10 +Background_color = 255,255,255 +Decorations_color = 0,0,0 +Snake_color = 30,30,30 +Snake_head_color = 30,30,30 +Lives_in_head_number_color= 255,255,255 +Snake_picture_color = 30,30,30 +Version_picture_color = 70,70,70 +Pause_picture_color = 30,30,30 +Game_over_picture_color = 30,30,30 +You_win_picture_color = 105,105,105 +Navigation_string_color = 255,255,255 +Game_over_string_color = 30,30,30 +Game_over_hiscore_color = 0,0,0 +Eat_color = 0,255,0 +Score_number_color = 0,0,0 +Score_string_color = 255,255,255 +Level_string_color = 255,255,255 +Level_number_color = 255,255,255 +Hiscore_number_color = 0,0,0 +Hiscore_string_color = 255,255,255 +Champion_string_color = 255,255,255 +Champion_name_color = 255,255,255 +Edit_box_selection_color= 176,176,176 +Button_color = 221,221,221 +Button_text_color = 0,0,0 +Stone_color = 145,145,145 +Splash_background_color = 205,205,205 +Splash_level_string_color= 255,255,255 +Splash_level_number_color= 255,255,255 + +[Theme_ultra_black] +Decorations = 6 +Background_color = 0,0,0 +Decorations_color = 255,255,255 +Snake_color = 255,255,255 +Snake_head_color = 255,255,255 +Lives_in_head_number_color= 30,30,30 +Snake_picture_color = 255,255,255 +Version_picture_color = 225,225,225 +Pause_picture_color = 225,225,225 +Game_over_picture_color = 225,225,225 +You_win_picture_color = 255,255,255 +Navigation_string_color = 0,0,0 +Game_over_string_color = 225,225,225 +Game_over_hiscore_color = 225,225,225 +Eat_color = 255,0,0 +Score_number_color = 255,255,255 +Score_string_color = 255,255,255 +Level_string_color = 0,0,0 +Level_number_color = 0,0,0 +Hiscore_number_color = 255,255,255 +Hiscore_string_color = 255,255,255 +Champion_string_color = 0,0,0 +Champion_name_color = 0,0,0 +Edit_box_selection_color= 100,100,100 +Button_color = 221,221,221 +Button_text_color = 0,0,0 +Stone_color = 145,145,145 +Splash_background_color = 30,30,30 +Splash_level_string_color= 255,255,255 +Splash_level_number_color= 255,255,255 + +[Theme_your_theme_name] + +;;---Visual_themes------------------------------------------------------ + +;;===Reserved_Section=================================================== +[Reserved] +Square_side_length=19 +Champion_name_classic= +Hiscore_classic=777 +Champion_name_levels= +Hiscore_levels=222 +;;---Reserved_Section---------------------------------------------------