From 5936066957572694552266e9d680113bda441e4e Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Wed, 24 Dec 2014 08:13:17 +0000 Subject: [PATCH] Rusty Earth - some code optimization for background music git-svn-id: svn://kolibrios.org@5263 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/rstearth/localization_eng.inc | 2 +- programs/games/rstearth/localization_rus.inc | 2 +- programs/games/rstearth/menu.inc | 8 +++ programs/games/rstearth/sound.inc | 57 ++++++++++++++++++-- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/programs/games/rstearth/localization_eng.inc b/programs/games/rstearth/localization_eng.inc index a460e674a6..112e35c2eb 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.6) 23.12.2014',0 + db 'Rusty Earth (Prototype 1.6) 24.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'GAME',0 diff --git a/programs/games/rstearth/localization_rus.inc b/programs/games/rstearth/localization_rus.inc index 247aed544b..dda174370f 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.6) 23.12.2014',0 + db 'Ржавая Земля (Прототип 1.6) 24.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'ИГРА',0 diff --git a/programs/games/rstearth/menu.inc b/programs/games/rstearth/menu.inc index c3c7b4679f..4f37d5fbee 100644 --- a/programs/games/rstearth/menu.inc +++ b/programs/games/rstearth/menu.inc @@ -71,6 +71,7 @@ main_menu_start: cmp [main_menu_pointer],0 je .still + call snd_kick_action call clear_old_pointer dec [main_menu_pointer] call draw_new_pointer @@ -80,6 +81,7 @@ main_menu_start: cmp [main_menu_pointer],4 je .still + call snd_kick_action call clear_old_pointer inc [main_menu_pointer] call draw_new_pointer @@ -176,10 +178,12 @@ clear_screen: ret ;--------------------------------------------------------------------- menu_credits: + call snd_kick_action mov [menu_text_pointers],menu_credits_text_pointers jmp menu_help.1 ;--------------------------------------------------------------------- menu_help: + call snd_kick_action mov [menu_text_pointers],menu_help_text_pointers ;-------------------------------------- .1: @@ -239,6 +243,7 @@ menu_help: jmp button.exit ;--------------------------------------------------------------------- settings_menu_start: + call snd_kick_action mov al,[main_menu_pointer] mov [settings_menu_pointer],al xor al,al @@ -314,6 +319,7 @@ settings_menu_start: cmp [main_menu_pointer],0 je .still + call snd_kick_action call clear_old_pointer dec [main_menu_pointer] call draw_new_pointer @@ -323,6 +329,7 @@ settings_menu_start: cmp [main_menu_pointer],2 je .still + call snd_kick_action call clear_old_pointer inc [main_menu_pointer] call draw_new_pointer @@ -348,6 +355,7 @@ settings_menu_start: cmp [main_menu_pointer],2 ; exit jne .still + call snd_kick_action mov al,[settings_menu_pointer] mov [main_menu_pointer],al diff --git a/programs/games/rstearth/sound.inc b/programs/games/rstearth/sound.inc index bd87264e48..f26c6113ef 100644 --- a/programs/games/rstearth/sound.inc +++ b/programs/games/rstearth/sound.inc @@ -114,8 +114,11 @@ wave_out: cmp eax,-1 popa je snd_wave_out_fail + + ret ;-------------------------------------- .exit: + popa ret ;------------------------------------------------------------------------------ snd_init_fail: @@ -145,17 +148,61 @@ snd_wave_out_fail: ;------------------------------------------------------------------------------ snd_background_music_thread_start: cmp [music_flag],1 - je @f + je .start mcall 5,50 mcall 68,1 jmp snd_background_music_thread_start ;-------------------------------------- -@@: +.start: mov eax,[background_music] - mov ebp,[hBuff1] - call wave_out - jmp snd_background_music_thread_start +; call wave_out +; pusha +; DEBUGF 1, "Wave out\n" +; check for correct data_offset + push eax + add eax,[data_offset] + sub eax,4 + cmp [eax],dword 'data' + pop eax + je @f + + mov [wav_for_test],eax + mov ebx,eax + add ebx,1024 + mov [wav_for_test_end],ebx + call find_data_offset + cmp [sound_flag],0 + jz snd_background_music_thread_start ;.exit +;-------------------------------------- +@@: + add eax,[data_offset] + mov ebx,[eax] + add eax,4 + mov ebp,eax +; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx +;-------------------------------------- +.loop: + cmp [music_flag],0 + je snd_background_music_thread_start +; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx +; stdcall _WaveOut@12,[hBuff],eax,ebx + stdcall _WaveOut@12,[hBuff1],ebp,8192 +; DEBUGF 1, "return EAX: %x\n",eax + cmp eax,-1 +; popa + je snd_wave_out_fail + + add ebp,8192*2 + cmp ebx,ebp + jae .start + + sub ebp,8192 + jmp .loop +;-------------------------------------- +;.exit: +; popa +; jmp snd_background_music_thread_start ; mcall -1 ;------------------------------------------------------------------------------ snd_kick_action: