Rusty Earth - some code optimization for background music

git-svn-id: svn://kolibrios.org@5263 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2014-12-24 08:13:17 +00:00
parent 49aa2adc78
commit 5936066957
4 changed files with 62 additions and 7 deletions

View File

@ -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

View File

@ -2,7 +2,7 @@
; Code page - Cyrillic OEM866
;---------------------------------------------------------------------
title:
db '<27>¦ Ά ο ‡¥¬«ο (<28>ΰ®β®β¨― 1.6) 23.12.2014',0
db '<27>¦ Ά ο ‡¥¬«ο (<28>ΰ®β®β¨― 1.6) 24.12.2014',0
;---------------------------------------------------------------------
menu_game_label:
db 'ˆƒ<CB86>€',0

View File

@ -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

View File

@ -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: