From 7cadd5ef2920f2186d6de66c1357e6645a79de55 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Tue, 30 Dec 2014 01:18:21 +0000 Subject: [PATCH] Rusty Earth 1) two demo level 2) screen for "game stage", "game over" and "game win" 3) NOSO boot parameter to start without sound and sound files git-svn-id: svn://kolibrios.org@5292 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/rstearth/actions.inc | 9 +- programs/games/rstearth/death_protagonist.inc | 51 -------- programs/games/rstearth/font.inc | 4 + programs/games/rstearth/i_data.inc | 11 ++ programs/games/rstearth/levels.inc | 52 ++++++-- programs/games/rstearth/localization_eng.inc | 12 +- programs/games/rstearth/localization_rus.inc | 12 +- programs/games/rstearth/rstearth.asm | 122 ++++++++++++++++-- programs/games/rstearth/u_data.inc | 8 +- 9 files changed, 203 insertions(+), 78 deletions(-) delete mode 100644 programs/games/rstearth/death_protagonist.inc diff --git a/programs/games/rstearth/actions.inc b/programs/games/rstearth/actions.inc index f787cc93b5..f0f828df5e 100644 --- a/programs/games/rstearth/actions.inc +++ b/programs/games/rstearth/actions.inc @@ -101,7 +101,9 @@ save_new_and_clear_old_position: ret ;--------------------------------------------------------------------- harvest_of_death: - mov [death_of_protagonist],0 + xor eax,eax + mov [death_of_protagonist],al + mov [npc_alive],al mov esi,plan_level mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y cld @@ -117,6 +119,11 @@ harvest_of_death: cmp al,BASE_WATER je .base_water + + cmp ah,OBJECT_FINAL_MONSTER + ja .counter + + mov [npc_alive],1 ;-------------------------------------- .counter: dec ecx diff --git a/programs/games/rstearth/death_protagonist.inc b/programs/games/rstearth/death_protagonist.inc deleted file mode 100644 index d35abdf272..0000000000 --- a/programs/games/rstearth/death_protagonist.inc +++ /dev/null @@ -1,51 +0,0 @@ -;--------------------------------------------------------------------- -death_of_protagonist_start: - mov esi,map_level_game_over - call map_level_to_plan_level -.red: - call draw_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 .menu_still ; start_level_0 - - mov [extended_key],1 - jmp .still -;--------------------------------------------------------------------- -.extended_key: - mov [extended_key],0 - jmp .menu_still ; start_level_0 -;--------------------------------------------------------------------- -.menu_still: - mcall 5,200 - jmp menu_still -;--------------------------------------------------------------------- -.button: - mcall 17 - - cmp ah,1 - jne .still - - jmp button.exit -;-------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/font.inc b/programs/games/rstearth/font.inc index 3ada448f0e..fccec2e88e 100644 --- a/programs/games/rstearth/font.inc +++ b/programs/games/rstearth/font.inc @@ -1,5 +1,9 @@ ;--------------------------------------------------------------------- draw_font: +; in: +; ebx - X*65536 + Y +; edx - text ASCII +; pusha xor ebp,ebp mov esi,edx diff --git a/programs/games/rstearth/i_data.inc b/programs/games/rstearth/i_data.inc index d9eeba3ec8..ab00f740f3 100644 --- a/programs/games/rstearth/i_data.inc +++ b/programs/games/rstearth/i_data.inc @@ -256,11 +256,13 @@ background_music_file_name db 'walking_with_poseidon.wav',0 stone_kick_sound_file_name db 'flaunch.wav',0 menu_sound_file_name db 'misc_menu.wav',0 ;--------------------------------------------------------------------- +align 4 protagonist_route dd 2 protagonist_position: .x dd 4 .y dd 4 ;--------------------------------------------------------------------- +align 4 main_menu_text_pointers: dd menu_game_label dd menu_settings_label @@ -269,6 +271,7 @@ main_menu_text_pointers: dd menu_exit_label dd 0 ;--------------------------------------------------------------------- +align 4 menu_credits_text_pointers: dd menu_credits_text.1 dd menu_credits_text.2 @@ -278,6 +281,7 @@ menu_credits_text_pointers: dd menu_credits_text.6 dd 0 ;--------------------------------------------------------------------- +align 4 menu_help_text_pointers: dd menu_help_text.1 dd menu_help_text.2 @@ -285,9 +289,16 @@ menu_help_text_pointers: dd menu_help_text.4 dd 0 ;--------------------------------------------------------------------- +align 4 settings_menu_text_pointers: dd menu_settings_sound_label dd menu_settings_music_label dd menu_setting_exit dd 0 ;--------------------------------------------------------------------- +align 4 +map_level_pointer: + dd map_level_0 + dd map_level_1 + dd 0 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/levels.inc b/programs/games/rstearth/levels.inc index 321e0115fe..8ffc13b3d9 100644 --- a/programs/games/rstearth/levels.inc +++ b/programs/games/rstearth/levels.inc @@ -7,7 +7,33 @@ ;--------------------------------------------------------------------- align 4 -map_level_0: +map_level_game_over: + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h + dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h +;--------------------------------------------------------------------- +align 4 +map_level_game_stage: + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h +;--------------------------------------------------------------------- +align 4 +map_level_1: dd 030100h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h dd 000000h,001001h,001001h,000001h,000001h,000001h,001001h,001001h,001001h,000000h dd 010200h,001001h,000002h,000002h,000000h,000000h,000000h,000000h,001001h,000000h @@ -20,15 +46,15 @@ map_level_0: dd 030300h,000000h,000000h,000000h,000000h,020400h,000000h,000000h,000003h,000003h ;--------------------------------------------------------------------- align 4 -map_level_game_over: - dd 000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h - dd 000000h,000002h,000002h,000000h,000000h,000002h,000000h,000002h,000002h,000000h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h - dd 000000h,000002h,000002h,000000h,000000h,000002h,000000h,000002h,000002h,000000h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h - dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h - dd 000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h -;--------------------------------------------------------------------- +map_level_0: + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h + dd 000001h,001001h,001001h,000001h,000001h,000001h,000001h,001101h,001101h,000001h + dd 000001h,001001h,000001h,000001h,000001h,000001h,000001h,000001h,001101h,000001h + dd 000001h,001101h,030101h,001101h,001101h,001001h,001001h,000001h,001001h,000001h + dd 000001h,001101h,000001h,001101h,000f01h,000001h,001001h,000001h,001001h,010301h + dd 000001h,001001h,000001h,001001h,000001h,000001h,001101h,000001h,001101h,000001h + dd 000001h,001001h,000001h,001001h,001001h,001101h,001101h,000001h,001101h,000001h + dd 000001h,001101h,000001h,000001h,000001h,000001h,000001h,000001h,001001h,000001h + dd 000001h,001101h,001101h,000001h,000001h,000001h,000001h,001001h,001001h,000001h + dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h +;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/localization_eng.inc b/programs/games/rstearth/localization_eng.inc index e9ef0225bd..c3b2a7404c 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.8) 28.12.2014',0 + db 'Rusty Earth (Prototype 1.9) 30.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'GAME',0 @@ -32,6 +32,16 @@ text_on_label: menu_setting_exit: db 'EXIT',0 ;--------------------------------------------------------------------- +stage_text: + db 'LEVEL ' +.1: db '00',0 +;-------------------------------------- +game_win_text: + db 'YES! YOU WIN!',0 +;-------------------------------------- +protagonist_death_text: + db 'REST IN PEACE',0 +;--------------------------------------------------------------------- menu_credits_text: .1: db 'Hello KolibriOS Team!',0 .2: db 'The game used graphics and sound material',0 diff --git a/programs/games/rstearth/localization_rus.inc b/programs/games/rstearth/localization_rus.inc index e008fdb74b..e8baf5289d 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.8) 28.12.2014',0 + db 'Ржавая Земля (Прототип 1.9) 30.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'ИГРА',0 @@ -34,6 +34,16 @@ text_on_label: menu_setting_exit: db 'ВЫХОД',0 ;--------------------------------------------------------------------- +stage_text: + db 'УРОВЕНЬ ' +.1: db '00',0 +;-------------------------------------- +game_win_text: + db 'УРА! ПОБЕДА!',0 +;-------------------------------------- +protagonist_death_text: + db 'ЭТО БЫЛ КОНЕЦ',0 +;--------------------------------------------------------------------- menu_credits_text: .1: db 'Привет участникам команды KolibriOS Team!',0 .2: db 'Графические и звуковые материалы под',0 diff --git a/programs/games/rstearth/rstearth.asm b/programs/games/rstearth/rstearth.asm index 18bc203c80..2876b86b54 100644 --- a/programs/games/rstearth/rstearth.asm +++ b/programs/games/rstearth/rstearth.asm @@ -34,7 +34,7 @@ dd IM_END dd I_END dd stacktop - dd 0x0 + dd bootparam dd path ;----------------------------------------------------------------------------- include 'lang.inc' @@ -65,10 +65,10 @@ OBJECT_DEATH = 1 OBJECT_SKELETON = 2 OBJECT_IFRIT = 3 OBJECT_BARRET = 4 -OBJECT_FINAL_MONSTER = 14 -OBJECT_PROTAGONIST = 15 -OBJECT_RED_BRICK = 16 -OBJECT_WHITE_BRICK = 17 +OBJECT_FINAL_MONSTER = 14 ; 0Eh +OBJECT_PROTAGONIST = 15 ; 0Fh +OBJECT_RED_BRICK = 16 ; 10h +OBJECT_WHITE_BRICK = 17 ; 11h RED_BRICK_CRASH_1 = 0x80 RED_BRICK_CRASH_2 = 0x81 ;----------------------------------------------------------------------------- @@ -93,6 +93,10 @@ load_libraries l_libs_start,end_l_libs mov [deflate_unpack],eax ;-------------------------------------- call load_and_convert_all_icons + + cmp [bootparam],dword 'NOSO' + je menu_still + call load_all_sound_files mov eax,[background_music] @@ -111,15 +115,69 @@ load_libraries l_libs_start,end_l_libs menu_still: jmp main_menu_start ;--------------------------------------------------------------------- +show_game_stage: + mov esi,map_level_game_stage + call map_level_to_plan_level + call draw_window + mov eax,[level_counter] + inc eax + mov ebx,stage_text.1 + call decimal_string_2 + mov edx,stage_text + mov ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*5 + call draw_font + mcall 5,300 + ret +;--------------------------------------------------------------------- +show_game_win: + mov esi,map_level_game_stage + call map_level_to_plan_level + call draw_window + mov edx,game_win_text + mov ebx,SPRITE_SIZE_X*2 shl 16 + SPRITE_SIZE_Y*5 + call draw_font + mcall 5,1000 + ret +;--------------------------------------------------------------------- +death_of_protagonist_show: + mov esi,map_level_game_over + call map_level_to_plan_level + call draw_window + mov edx,protagonist_death_text + mov ebx,SPRITE_SIZE_X*2 shl 16 + SPRITE_SIZE_Y*5 + call draw_font + mcall 5,500 + jmp main_menu_start +;--------------------------------------------------------------------- start_level_0: + xor eax,eax + mov [level_counter],eax +;--------------------------------------------------------------------- +start_level: + mov esi,[level_counter] + shl esi,2 + mov esi,[esi+map_level_pointer] + test esi,esi + jnz @f + + call show_game_win + jmp main_menu_start +;-------------------------------------- +@@: + call show_game_stage mov eax,[stone_kick_sound] mov [sounds_sample],eax +; xor eax,eax +; mov [level_counter],eax mov [death_of_protagonist],0 mov [protagonist_route],2 mov [protagonist_position.x],4 mov [protagonist_position.y],4 - mov esi,map_level_0 + mov esi,[level_counter] + shl esi,2 + mov esi,[esi+map_level_pointer] +; mov esi,map_level_0 call map_level_to_plan_level call generate_objects_id call copy_plan_level_to_plan_level_old @@ -145,8 +203,15 @@ still: call harvest_of_death call show_tiles_one_iteration cmp [death_of_protagonist],1 - je death_of_protagonist_start + je death_of_protagonist_show + cmp [npc_alive],0 + jne @f + + inc byte [level_counter] + jmp start_level +;-------------------------------------- +@@: mov eax,[protagonist_position.y] imul eax,LEVEL_MAP_SIZE_X*4 mov ebx,[protagonist_position.x] @@ -155,7 +220,7 @@ still: add eax,plan_level mov eax,[eax] cmp ah,OBJECT_PROTAGONIST - jne death_of_protagonist_start + jne death_of_protagonist_show jmp still ;--------------------------------------------------------------------- @@ -193,6 +258,46 @@ draw_window: mcall 12,2 ret ;--------------------------------------------------------------------- +; ПЕРЕВОД 10-НЫХ ЧИСЕЛ СО ЗНАКОМ В СТРОКОВЫЙ ВИД +; Вход: +; AX - число +; EBX - адрес строки +; Выход: +; строка содержит число, конец отмечен кодом 0 +;------------------------------------------------------------------------------ +decimal_string_2: + push eax ebx ecx edx + xor ecx,ecx + mov [ebx],byte '0' + inc ebx +;-------------------------------------- +.p3: + xor edx,edx + push ebx + mov ebx,10 + div ebx + pop ebx + add edx,48 + push edx + inc ecx + cmp ax,0 + jne .p3 + + cmp ecx,1 + jbe .p4 + + mov ecx,2 + dec ebx +;-------------------------------------- +.p4: + pop edx + mov [ebx],dl + inc ebx + loop .p4 + pop edx ecx ebx eax + ret +;------------------------------------------------------------------------------ +;--------------------------------------------------------------------- memory_free_error: mov [N_error],3 jmp button.exit @@ -205,7 +310,6 @@ include 'key.inc' include 'show_tiles.inc' include 'show_base.inc' include 'show_object.inc' -include 'death_protagonist.inc' include 'load.inc' include 'icon_convert.inc' include 'error_window.inc' diff --git a/programs/games/rstearth/u_data.inc b/programs/games/rstearth/u_data.inc index 616e08ede2..d7300d9d01 100644 --- a/programs/games/rstearth/u_data.inc +++ b/programs/games/rstearth/u_data.inc @@ -5,6 +5,7 @@ extended_key rb 1 draw_all_level rb 1 current_cell_NPC rb 1 death_of_protagonist rb 1 +npc_alive rb 1 target_detected rb 1 sound_flag rb 1 sounds_flag rb 1 @@ -52,6 +53,8 @@ target_action_cell_y rd 1 menu_text_pointers rd 1 text_step_Y rd 1 ;------------------------------------------------------------------------------ +level_counter rd 1 +;------------------------------------------------------------------------------ align 4 version rd 1 ; ╨▓╨╡╤А╤Б╨╕╤П ╨╕╨╜╤В╨╡╤А╤Д╨╡╨╣╤Б╨░, ╤В╨╡╨║╤Г╤Й╨░╤П 0x0101 ; snd_format ╨╛╨┤╨╜╨░ ╨╕╨╖ ╨║╨╛╨╜╤Б╤В╨░╨╜╤В ╨▓╨╕╨┤╨░ PCM_X_Y_Z ╨│╨┤╨╡ @@ -115,10 +118,11 @@ align 4 file_info: rb 40 ;--------------------------------------------------------------------- -;align 4 +align 4 +bootparam: ;procinfo: ;process_info: -; rb 1024 + rb 1024 ;--------------------------------------------------------------------- align 4 ; sound thread