From 10c14031bec1b69b848122673b1e41a597eaef49 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Tue, 23 Dec 2014 13:51:32 +0000 Subject: [PATCH] Rusty Earth - sub menu. git-svn-id: svn://kolibrios.org@5259 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/rstearth/i_data.inc | 23 +- programs/games/rstearth/localization_eng.inc | 35 ++- programs/games/rstearth/localization_rus.inc | 35 ++- programs/games/rstearth/menu.inc | 251 ++++++++++++++++++- programs/games/rstearth/rstearth.asm | 2 + programs/games/rstearth/sound.inc | 11 + programs/games/rstearth/u_data.inc | 6 + 7 files changed, 323 insertions(+), 40 deletions(-) diff --git a/programs/games/rstearth/i_data.inc b/programs/games/rstearth/i_data.inc index 89332e7ce8..30d0cd3d90 100644 --- a/programs/games/rstearth/i_data.inc +++ b/programs/games/rstearth/i_data.inc @@ -267,4 +267,25 @@ main_menu_text_pointers: dd menu_exit_label dd 0 ;--------------------------------------------------------------------- - +menu_credits_text_pointers: + dd menu_credits_text.1 + dd menu_credits_text.2 + dd menu_credits_text.3 + dd menu_credits_text.4 + dd menu_credits_text.5 + dd menu_credits_text.6 + dd 0 +;--------------------------------------------------------------------- +menu_help_text_pointers: + dd menu_help_text.1 + dd menu_help_text.2 + dd menu_help_text.3 + dd menu_help_text.4 + dd 0 +;--------------------------------------------------------------------- +settings_menu_text_pointers: + dd menu_settings_sound_label + dd menu_settings_music_label + dd menu_setting_exit + dd 0 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/localization_eng.inc b/programs/games/rstearth/localization_eng.inc index cb5b2c076f..a460e674a6 100644 --- a/programs/games/rstearth/localization_eng.inc +++ b/programs/games/rstearth/localization_eng.inc @@ -1,6 +1,6 @@ ;--------------------------------------------------------------------- title: - db 'Rusty Earth (Prototype 1.5) 23.12.2014',0 + db 'Rusty Earth (Prototype 1.6) 23.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'GAME',0 @@ -18,22 +18,31 @@ menu_exit_label: db 'EXIT',0 ;--------------------------------------------------------------------- menu_settings_sound_label: - db 'SOUNDS',0 + db 'SOUNDS OFF',0 ;-------------------------------------- menu_settings_music_label: - db 'MUSIC',0 + db 'MUSIC OFF',0 +;-------------------------------------- +text_off_label: + db 'OFF',0 +;-------------------------------------- +text_on_label: + db 'ON ',0 +;-------------------------------------- +menu_setting_exit: + db 'EXIT',0 ;--------------------------------------------------------------------- menu_credits_text: - db 'Hello KolibriOS Team!',0 - db 'The game used graphics and sound material',0 - db 'under a free license, borrowed from:',0 - db 'http://untamed.wild-refuge.net/',0 - db 'http://opengameart.org',0 - db 'https://wiki.themanaworld.org',0 +.1: db 'Hello KolibriOS Team!',0 +.2: db 'The game used graphics and sound material',0 +.3: db 'under a free license, borrowed from:',0 +.4: db 'http://untamed.wild-refuge.net/',0 +.5: db 'http://opengameart.org',0 +.6: db 'https://wiki.themanaworld.org',0 ;--------------------------------------------------------------------- menu_help_text: - db 'Game control',0 - db 'Move the player:',0 - db 'WASD, Arrows or Num8462',0 - db 'Player kick : Space',0 +.1: db 'Game control',0 +.2: db 'Move the player:',0 +.3: db 'WASD, Arrows or Num8462',0 +.4: db 'Player kick : Space',0 ;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/localization_rus.inc b/programs/games/rstearth/localization_rus.inc index 1582f54818..247aed544b 100644 --- a/programs/games/rstearth/localization_rus.inc +++ b/programs/games/rstearth/localization_rus.inc @@ -2,7 +2,7 @@ ; Code page - Cyrillic OEM866 ;--------------------------------------------------------------------- title: - db 'Ржавая Земля (Прототип 1.5) 23.12.2014',0 + db 'Ржавая Земля (Прототип 1.6) 23.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'ИГРА',0 @@ -20,22 +20,31 @@ menu_exit_label: db 'ВЫХОД',0 ;--------------------------------------------------------------------- menu_settings_sound_label: - db 'ЗВУКИ',0 + db 'ЗВУКИ ВЫКЛ',0 ;-------------------------------------- menu_settings_music_label: - db 'МУЗЫКА',0 + db 'МУЗЫКА ВЫКЛ',0 +;-------------------------------------- +text_off_label: + db 'ВЫКЛ',0 +;-------------------------------------- +text_on_label: + db 'ВКЛ',0 +;-------------------------------------- +menu_setting_exit: + db 'ВЫХОД',0 ;--------------------------------------------------------------------- menu_credits_text: - db 'Привет участникам команды KolibriOS Team!',0 - db 'В игре использованы графические и звуковые материалы',0 - db 'под свободными лицензиями, позаимствованные с сайтов:',0 - db 'http://untamed.wild-refuge.net/',0 - db 'http://opengameart.org',0 - db 'https://wiki.themanaworld.org',0 +.1: db 'Привет участникам команды KolibriOS Team!',0 +.2: db 'В игре использованы графические и звуковые материалы',0 +.3: db 'под свободными лицензиями, позаимствованные с сайтов:',0 +.4: db 'http://untamed.wild-refuge.net/',0 +.5: db 'http://opengameart.org',0 +.6: db 'https://wiki.themanaworld.org',0 ;--------------------------------------------------------------------- menu_help_text: - db 'Управление игрой',0 - db 'Перемещение игрока:',0 - db 'WASD, стрелки или Num8462',0 - db 'Удар игрока: "Пробел"',0 +.1: db 'Управление игрой',0 +.2: db 'Перемещение игрока:',0 +.3: db 'WASD, стрелки или Num8462',0 +.4: db 'Удар игрока: "Пробел"',0 ;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/menu.inc b/programs/games/rstearth/menu.inc index 51215396d5..c3c7b4679f 100644 --- a/programs/games/rstearth/menu.inc +++ b/programs/games/rstearth/menu.inc @@ -1,7 +1,12 @@ +;--------------------------------------------------------------------- main_menu_start: mov [main_menu_pointer],0 +;-------------------------------------- .red: - call draw_main_menu_window + mov [menu_text_pointers],main_menu_text_pointers + mov [text_step_Y],SPRITE_SIZE_Y + call draw_menu_window + call draw_new_pointer ;--------------------------------------------------------------------- .still: mcall 10 @@ -25,6 +30,13 @@ main_menu_start: test al,al jnz .still + cmp ah,0xE0 + jne @f + + mov [extended_key],1 + jmp .still +;-------------------------------------- +@@: cmp ah,72 ; arrow up je .arrow_up @@ -43,7 +55,6 @@ main_menu_start: cmp ah,28 ; enter je .enter_to_point - mov [extended_key],1 jmp .still ;--------------------------------------------------------------------- .extended_key: @@ -75,10 +86,19 @@ main_menu_start: jmp .still ;--------------------------------------------------------------------- .enter_to_point: - cmp [main_menu_pointer],0 + cmp [main_menu_pointer],0 ; game je start_level_0 - cmp [main_menu_pointer],4 + cmp [main_menu_pointer],1 ; settings + je settings_menu_start + + cmp [main_menu_pointer],2 ; credits + je menu_credits + + cmp [main_menu_pointer],3 ; help + je menu_help + + cmp [main_menu_pointer],4 ; exit je button.exit jmp .still @@ -107,21 +127,21 @@ draw_new_pointer: ; shl ecx,16 ; mov cx,SPRITE_SIZE_Y ; mcall 13,,,0xff0000 + + movzx edx,byte [main_menu_pointer] + imul edx,SPRITE_SIZE_Y + add edx,SPRITE_SIZE_Y*2 + 32 + add edx,SPRITE_SIZE_X*2 shl 16 mov eax,[npc_miku_icons] mov ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*12 call copy_base_8bpp - movzx edx,byte [main_menu_pointer] - imul edx,SPRITE_SIZE_Y - add edx,SPRITE_SIZE_Y*2 + 32 - add edx,SPRITE_SIZE_X*2 shl 16 - xor ebp,ebp mcall 65,buffer_area,,,32 ret ;--------------------------------------------------------------------- -draw_main_menu_window: +draw_menu_window: mcall 12,1 mcall 48,4 mov ecx,100 shl 16 + 644 @@ -133,7 +153,7 @@ draw_main_menu_window: mov eax,4 mov ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*3 mov ecx,0x90ffffff - mov esi,main_menu_text_pointers + mov esi,[menu_text_pointers] ;-------------------------------------- @@: mov edx,[esi] @@ -141,12 +161,11 @@ draw_main_menu_window: jz .end mcall - add ebx,SPRITE_SIZE_Y + add ebx,[text_step_Y] add esi,4 jmp @b ;-------------------------------------- .end: - call draw_new_pointer mcall 12,2 ret @@ -155,4 +174,210 @@ clear_screen: xor edx,edx mcall 13,<0,SPRITE_SIZE_X*LEVEL_MAP_SIZE_X>,<0,SPRITE_SIZE_Y*LEVEL_MAP_SIZE_Y> ret +;--------------------------------------------------------------------- +menu_credits: + mov [menu_text_pointers],menu_credits_text_pointers + jmp menu_help.1 +;--------------------------------------------------------------------- +menu_help: + mov [menu_text_pointers],menu_help_text_pointers +;-------------------------------------- +.1: + mov [text_step_Y],20 +;-------------------------------------- +.red: + call draw_menu_window +;--------------------------------------------------------------------- +.still: + mcall 10 + + cmp eax,1 + je .red + + cmp eax,2 + je .key + + cmp eax,3 + je .button + + jmp .still +;--------------------------------------------------------------------- +.key: + mcall 2 + cmp [extended_key],1 + je .extended_key + + test al,al + jnz .still + + cmp ah,0xE0 + jne @f + + mov [extended_key],1 + jmp .still +;-------------------------------------- +@@: + cmp ah,57 ; space + je main_menu_start.red + + cmp ah,28 ; enter + je main_menu_start.red + + jmp .still +;--------------------------------------------------------------------- +.extended_key: + mov [extended_key],0 + + jmp .still +;--------------------------------------------------------------------- +.button: + mcall 17 + + cmp ah,1 + jne .still + + jmp button.exit +;--------------------------------------------------------------------- +settings_menu_start: + mov al,[main_menu_pointer] + mov [settings_menu_pointer],al + xor al,al + mov [main_menu_pointer],al +;-------------------------------------- +.red: + mov [menu_text_pointers],settings_menu_text_pointers + mov [text_step_Y],SPRITE_SIZE_Y + call prepare_settings_text + call draw_menu_window + call draw_new_pointer +;--------------------------------------------------------------------- +.still: + mcall 10 + + cmp eax,1 + je .red + + cmp eax,2 + je .key + + cmp eax,3 + je .button + + jmp .still +;--------------------------------------------------------------------- +.key: + mcall 2 + cmp [extended_key],1 + je .extended_key + + test al,al + jnz .still + + cmp ah,0xE0 + jne @f + + mov [extended_key],1 + jmp .still +;-------------------------------------- +@@: + cmp ah,72 ; arrow up + je .arrow_up + + cmp ah,80 ; arrow down + je .arrow_down + + cmp ah,17 ; w - arrow up + je .arrow_up + + cmp ah,31 ; s - arrow down + je .arrow_down + + cmp ah,57 ; space + je .enter_to_point + + cmp ah,28 ; enter + je .enter_to_point + + jmp .still +;--------------------------------------------------------------------- +.extended_key: + mov [extended_key],0 + cmp ah,72 ; arrow up + je .arrow_up + + cmp ah,80 ; arrow down + je .arrow_down + + jmp .still +;--------------------------------------------------------------------- +.arrow_up: + cmp [main_menu_pointer],0 + je .still + + call clear_old_pointer + dec [main_menu_pointer] + call draw_new_pointer + jmp .still +;--------------------------------------------------------------------- +.arrow_down: + cmp [main_menu_pointer],2 + je .still + + call clear_old_pointer + inc [main_menu_pointer] + call draw_new_pointer + jmp .still +;--------------------------------------------------------------------- +.enter_to_point: + cmp [main_menu_pointer],0 ; sounds + jne @f + + inc [sounds_flag] + and [sounds_flag],1b + jmp .red +;-------------------------------------- +@@: + cmp [main_menu_pointer],1 ; music + jne @f + + inc [music_flag] + and [music_flag],1b + jmp .red +;-------------------------------------- +@@: + cmp [main_menu_pointer],2 ; exit + jne .still + + mov al,[settings_menu_pointer] + mov [main_menu_pointer],al + + jmp main_menu_start.red +;--------------------------------------------------------------------- +.button: + mcall 17 + + cmp ah,1 + jne .still + + jmp button.exit +;--------------------------------------------------------------------- +prepare_settings_text: + mov eax,[text_on_label] + cmp [sounds_flag],1 + je @f + + mov eax,[text_off_label] +;-------------------------------------- +@@: + mov [menu_settings_sound_label+7],eax +;-------------------------------------- + mov eax,[text_on_label] + cmp [music_flag],1 + je @f + + mov eax,[text_off_label] +;-------------------------------------- +@@: + mov [menu_settings_music_label+7],eax + ret ;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/rstearth.asm b/programs/games/rstearth/rstearth.asm index b1a6895d21..2b171e089f 100644 --- a/programs/games/rstearth/rstearth.asm +++ b/programs/games/rstearth/rstearth.asm @@ -98,6 +98,8 @@ load_libraries l_libs_start,end_l_libs mov [wav_for_test_end],ebx call initialize_sound_system + mov [sounds_flag],1 + mov [music_flag],1 mcall 51,1,snd_background_music_thread_start,snd_background_music_thread_stack ;--------------------------------------------------------------------- menu_still: diff --git a/programs/games/rstearth/sound.inc b/programs/games/rstearth/sound.inc index bc8d805849..bd87264e48 100644 --- a/programs/games/rstearth/sound.inc +++ b/programs/games/rstearth/sound.inc @@ -144,6 +144,14 @@ snd_wave_out_fail: ret ;------------------------------------------------------------------------------ snd_background_music_thread_start: + cmp [music_flag],1 + je @f + + mcall 5,50 + mcall 68,1 + jmp snd_background_music_thread_start +;-------------------------------------- +@@: mov eax,[background_music] mov ebp,[hBuff1] call wave_out @@ -151,6 +159,9 @@ snd_background_music_thread_start: ; mcall -1 ;------------------------------------------------------------------------------ snd_kick_action: + cmp [sounds_flag],1 + jne @f + cmp [snd_kick_flag],1 je @f diff --git a/programs/games/rstearth/u_data.inc b/programs/games/rstearth/u_data.inc index babf425542..02502f7c01 100644 --- a/programs/games/rstearth/u_data.inc +++ b/programs/games/rstearth/u_data.inc @@ -7,8 +7,11 @@ current_cell_NPC rb 1 death_of_protagonist rb 1 target_detected rb 1 sound_flag rb 1 +sounds_flag rb 1 +music_flag rb 1 snd_kick_flag rb 1 main_menu_pointer rb 1 +settings_menu_pointer rb 1 ;--------------------------------------------------------------------- align 4 N_error rd 1 @@ -40,6 +43,9 @@ action_cell_y rd 1 target_action_cell_x rd 1 target_action_cell_y rd 1 ;------------------------------------------------------------------------------ +menu_text_pointers rd 1 +text_step_Y rd 1 +;------------------------------------------------------------------------------ align 4 version rd 1 ; ╨▓╨╡╤А╤Б╨╕╤П ╨╕╨╜╤В╨╡╤А╤Д╨╡╨╣╤Б╨░, ╤В╨╡╨║╤Г╤Й╨░╤П 0x0101 ; snd_format ╨╛╨┤╨╜╨░ ╨╕╨╖ ╨║╨╛╨╜╤Б╤В╨░╨╜╤В ╨▓╨╕╨┤╨░ PCM_X_Y_Z ╨│╨┤╨╡