Upload 'bomber' game sources to SVN.

git-svn-id: svn://kolibrios.org@4323 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Yogev Ezra 2013-12-03 21:24:11 +00:00
parent 6c3d19779f
commit d24c668030
16 changed files with 3088 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
_window_caption db 'Soft landing',0 ;çàãîëîâîê ïðèëîæåíèÿ
_text_game_over db 'G A M E O V E R', 0
_text_level_complete db 'L E V E L C O M P L E T E', 0
_text_intro_title db ' S O F T L A N D I N G', 0
_text_intro_description1 db 'Provide a soft landing, clearing the runway from the city buildings', 0
_text_intro_key_controls db ' Control keys:', 0
_text_intro_key_ctrl db ' CTRL - drop a bomb', 0
_text_intro_key_space db 'SPACE - do a barrel roll', 0
_text_intro_select_level db ' Use UP and DOWN arrow keys for select game level:', 0
_text_intro_level_num db ' LEVEL', 0
_text_intro_set_volume db ' Use LEFT and RIGHT arrow keys for setting volume:', 0
_text_intro_volume_num db 'VOLUME', 0
_text_intro_start_space db 'Press SPACE for start game', 0
_text_intro_exit_key db 'Esc - exit', 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,16 @@
_window_caption db '<27>ਧ¥¬«¥­¨¥',0 ;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
_text_game_over db 'Š Ž <20> ˆ ƒ <20> ', 0
_text_level_complete db '“ <20> Ž <20> œ <20> <20> Ž ‰ „ … <20>', 0
_text_intro_title db ' <20> <20> ˆ ‡ … Œ <20> ˆ … ' , 0
_text_intro_description1 db ' Ž¡¥á¯¥çì⥠¯à¨§¥¬«¥­¨¥, à áç¨á⨢ ¯®«®á㠮⠣®à®¤áª¨å áâ஥­¨©', 0
_text_intro_key_controls db 'Š« ¢¨è¨ ã¯à ¢«¥­¨ï:', 0
_text_intro_key_ctrl db ' CTRL - ¡à®á¨âì ¡®¬¡ã', 0
_text_intro_key_space db 'SPACE - ᤥ« âì ¡®çªã', 0
_text_intro_select_level db ' ˆá¯®«ì§ã©â¥ áâ५ª¨ ¢¢¥àå ¨ ¢­¨§ ¤«ï ¢ë¡®à  ã஢­ï:', 0
_text_intro_level_num db '“஢¥­ì ', 0
_text_intro_set_volume db ' ˆá¯®«ì§ã©â¥ áâ५ª¨ ¢«¥¢® ¨ ¢¯à ¢® ¤«ï § ¤ ­¨ï £à®¬ª®áâ¨:', 0
_text_intro_volume_num db 'ƒà®¬ª®áâì', 0
_text_intro_start_space db '<27> ¦¬¨â¥ SPACE ¤«ï ­ ç «  ¨£àë', 0
_text_intro_exit_key db 'Esc - ¢ë室', 0

View File

@ -0,0 +1,41 @@
struc CTRL_INFO
{ .pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
.codec_io_base dd ?
.ctrl_io_base dd ?
.codec_mem_base dd ?
.ctrl_mem_base dd ?
.codec_id dd ?
}
CTRL_INFO_SIZE equ 9*4
SRV_GETVERSION equ 0
SND_CREATE_BUFF equ 1
SND_DESTROY_BUFF equ 2
SND_SETFORMAT equ 3
SND_GETFORMAT equ 4
SND_RESET equ 5
SND_SETPOS equ 6
SND_GETPOS equ 7
SND_SETBUFF equ 8
SND_OUT equ 9
SND_PLAY equ 10
SND_STOP equ 11
SND_SETVOLUME equ 12
SND_GETVOLUME equ 13
SND_SETPAN equ 14
SND_GETPAN equ 15
SND_GETBUFFSIZE equ 16
SND_GETFREESPACE equ 17
SND_SETTIMEBASE equ 18
SND_GETTIMESTAMP equ 19
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8

View File

@ -0,0 +1,45 @@
SOUND_VERSION equ 0x0101
PCM_ALL equ 0
PCM_OUT equ 0x08000000
PCM_RING equ 0x10000000
PCM_STATIC equ 0x20000000
PCM_FLOAT equ 0x40000000
PCM_FILTER equ 0x80000000
PCM_2_16_48 equ 1
PCM_1_16_48 equ 2
PCM_2_16_44 equ 3
PCM_1_16_44 equ 4
PCM_2_16_32 equ 5
PCM_1_16_32 equ 6
PCM_2_16_24 equ 7
PCM_1_16_24 equ 8
PCM_2_16_22 equ 9
PCM_1_16_22 equ 10
PCM_2_16_16 equ 11
PCM_1_16_16 equ 12
PCM_2_16_12 equ 13
PCM_1_16_12 equ 14
PCM_2_16_11 equ 15
PCM_1_16_11 equ 16
PCM_2_16_8 equ 17
PCM_1_16_8 equ 18
PCM_2_8_48 equ 19
PCM_1_8_48 equ 20
PCM_2_8_44 equ 21
PCM_1_8_44 equ 22
PCM_2_8_32 equ 23
PCM_1_8_32 equ 24
PCM_2_8_24 equ 25
PCM_1_8_24 equ 26
PCM_2_8_22 equ 27
PCM_1_8_22 equ 28
PCM_2_8_16 equ 29
PCM_1_8_16 equ 30
PCM_2_8_12 equ 31
PCM_1_8_12 equ 32
PCM_2_8_11 equ 33
PCM_1_8_11 equ 34
PCM_2_8_8 equ 35
PCM_1_8_8 equ 36

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,31 @@
db 'datapack'
count dd 5
dd wav_file1, wav_file1_end - wav_file1
dd wav_file2, wav_file2_end - wav_file2
dd wav_file3, wav_file3_end - wav_file3
dd wav_file4, wav_file4_end - wav_file4
dd wav_file5, wav_file5_end - wav_file5
dd 0
align 4
wav_file1:
file 'bombfly16_2_11.wav':0x36
wav_file1_end:
wav_file2:
file 'bombbang16_2_11.wav':0x36
wav_file2_end:
wav_file3:
file 'zenitka16_2_11.wav':0x36
wav_file3_end:
wav_file4:
file 'plane16_2_11.wav':0x36
wav_file4_end:
wav_file5:
file 'airradewarning16_2_11.wav':0x36
wav_file5_end:

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,571 @@
SSMIX_CHANMODE_FREE equ 0
SSMIX_CHANMODE_SINGLE equ 1
SSMIX_CHANMODE_REPEAT equ 2
SSMIX_CHANMODE_SINGLE_WITHOUT_RESET equ 3
SSMIX_CHANMODE_WAITRESET equ 4
include 'snd.inc'
include 'snd_const.inc'
include 'proc32.inc'
;include 'macros.inc'
;include 'debug.inc'
SSMIX_CHANNEL_COUNT equ 32
DEBUG equ 0 ; 0
; èíèöèàëèçàöèÿ ìèêøåðà
ssmix_init:
; âûäåëèòü ïàìÿòü äëÿ êàíàëîâ ìèêøåðà
mov eax, 68
mov ebx, 12
mov ecx, 4*8*SSMIX_CHANNEL_COUNT
int 0x40
mov [ssmix_channels], eax
; âûäåëèòü ïàìÿòü äëÿ ñòåêà ïîòîêà ìèêøåðà
mov eax, 68
mov ebx, 12
mov ecx, 4096
int 0x40
mov [ssmix_thread_stack], eax
; âêëþ÷èòü ìèêøåð
mov [ssmix_state], 1
; óñòàíîâèòü ãðîìêîñòè ñòåðåîêàíàëîâ
mov [ssmix_volumeL], 128
mov [ssmix_volumeR], 128
; ñîçäàòü ïîòîê
mov eax, 51
mov ebx, 1
mov ecx, ssmix_thread_proc
mov edx,[ssmix_thread_stack]
add edx,4092
int 0x40
ret
; çàâåðøåíèå ðàáîòû ìèêøåðà
ssmix_release:
; âûêëþ÷èòü ìèêøåð
mov [ssmix_state], 0
ret
; îñâîáîæäåíèå ïàìÿòè
ssmix_free:
; îñâîáîäèòü ïàìÿòü êàíàëîâ ìèêøåðà
mov eax, 68
mov ebx, 13
mov ecx, [ssmix_channels]
int 0x40
; îñâîáîäèòü ïàìÿòü ñòåêà ïîòîêà ìèêøåðà
mov eax, 68
mov ebx, 13
mov ecx, [ssmix_thread_stack]
int 0x40
ret
; óñòàíîâèòü ãðîìêîñòü
ssmix_setvolume: ; stdcall
; LeftVolume: dword, RightVolume: dword
push eax
mov eax, [esp+8] ; ãðîìêîñòü ëåâîãî êàíàëà
cmp eax, 255
jle @f
mov eax, 255
@@:
cmp eax, 0
jge @f
mov eax, 0
@@:
mov [ssmix_volumeL], eax
mov eax, [esp+12] ; ãðîìêîñòü ïðàâîãî êàíàëà
cmp eax, 255
jle @f
mov eax, 255
@@:
cmp eax, 0
jge @f
mov eax, 0
@@:
mov [ssmix_volumeR], eax
pop eax
ret
; âîñïðîèçâåñòè òðåê
ssmix_playtrack: ; stdcall
; p_starttrack:dword, p_endtrack:dword, volumeL: dword, volumeR: dword; playmode:dword;
; return eax - number of channel, if eax=-1 then no free channel
push ebx ecx
mov ebx, [ssmix_channels]
mov ecx, SSMIX_CHANNEL_COUNT
.channel_loop:
mov eax, [ebx]
cmp eax, SSMIX_CHANMODE_FREE
je .find_free_channel
add ebx, 32
dec ecx
jnz .channel_loop
mov eax, -1
jmp .end
.find_free_channel:
mov eax, [esp+28] ; ðåæèì âîñïðîèçâåäåíèÿ
mov [ebx], eax
mov eax, [esp+20] ; ãðîìêîñòü ëåâîãî êàíàëà
imul eax, [ssmix_volumeL]
sar eax, 7
mov [ebx+4], eax
mov eax, [esp+24] ; ãðîìêîñòü ïðàâîãî êàíàëà
imul eax, [ssmix_volumeR]
sar eax, 7
mov [ebx+8], eax
mov eax, [esp+12] ; íà÷àëî òðåêà
mov [ebx+16], eax
mov [ebx+20], eax
mov eax, [esp+16] ; êîíåö òðåêà
mov [ebx+24], eax
mov eax, SSMIX_CHANNEL_COUNT
sub eax, ecx
.end:
pop ecx ebx
ret 20
; îñòàíîâèòü òðåê ïî íîìåðó êàíàëà
ssmix_stoptrack: ; stdcall
; numchannel: dword
push eax ebx
mov ebx, [esp+12]
cmp ebx, 0
jl .end
cmp ebx, SSMIX_CHANNEL_COUNT
jge .end
shl ebx, 5
add ebx, [ssmix_channels]
mov eax, SSMIX_CHANMODE_FREE
mov [ebx], eax
.end:
pop ebx eax
ret 4
; îñòàíîâèòü âñå òðåêè
ssmix_stopalltracks:
push eax ebx ecx
mov eax, SSMIX_CHANMODE_FREE
mov ebx, [ssmix_channels]
mov ecx, SSMIX_CHANNEL_COUNT
.channel_loop:
mov [ebx], eax
add ebx, 32
dec ecx
jnz .channel_loop
pop ecx ebx eax
ret
; ïîòîê ìèêøåðà
ssmix_thread_proc:
stdcall _InitSound@4, ssmix_driver_version
test eax, eax
jz @f
if DEBUG
print "ssmix. Cannot load sound driver"
end if
jmp .end
@@:
mov ecx, [ssmix_driver_version]
cmp cx, SOUND_VERSION
jae @f
shr ecx, 16
cmp ecx, SOUND_VERSION
jbe @f
if DEBUG
print "ssmix. Sound version mismatch"
end if
jmp .end
@@:
stdcall _CreateBuffer@12, PCM_2_16_11+PCM_RING, 0, ssmix_hbuffer
test eax, eax
jz @f
if DEBUG
print "ssmix. create buffer error"
end if
jmp .end
@@:
stdcall _GetBufferSize@8, [ssmix_hbuffer], ssmix_buffer_size
test eax, eax
jz @f
if DEBUG
print "ssmix. getbuffersize procedure error"
end if
jmp .destroy_buffer
@@:
mov ecx, [ssmix_buffer_size]
shr ecx, 1
mov [ssmix_buffer_size], ecx
if DEBUG
print "ssmix. buffer size"
dph ecx
newline
end if
; âûäåëèòü ïàìÿòü äëÿ áóôôåðà âîñïðîèçâåäåíèÿ
mov eax, 68
mov ebx, 12
mov ecx, [ssmix_buffer_size]
int 0x40
test eax, eax
jnz @f
if DEBUG
print "ssmix. malloc memory error"
end if
jmp .destroy_buffer
@@:
mov [ssmix_pbuffer], eax
stdcall _PlayBuffer@8, [ssmix_hbuffer], 0
test eax, eax
jz @f
if DEBUG
print "ssmix. playbuffer error"
end if
jmp .free_buffer_memory
@@:
; öèêë âîñïðîèçâåäåíèÿ
.mixloop:
; ïîëó÷èòü äàííûå ñîáûòèÿ îò äðàéâåðà
mov eax, 68
mov ebx, 14
mov ecx, ssmix_driver_notify_struct
int 0x40
; ïðîâåðêà íà code
mov eax, [ssmix_driver_notify_struct]
cmp eax, 0xFF000001
jne .mixloop
; ïðîâåðêà íà stream
mov eax, [ssmix_driver_notify_struct+8]
cmp eax, [ssmix_hbuffer]
jne .mixloop
; ïîëó÷èòü ñìåùåíèå â áóôôåðå
mov eax, [ssmix_driver_notify_struct+12]
mov [ssmix_buffer_offset], eax
; öèêë çàïîëíåíèÿ áóôôåðà
mov ebx, [ssmix_pbuffer]
mov ecx, [ssmix_buffer_size]
shr ecx, 2
.fill_buffer_loop:
push ebx ecx
; öèêë ñìåøèâàíèÿ êàíàëîâ
mov esi, 0 ; ñóììà äëÿ ëåâîãî ñòåðåîêàíàëà
mov edi, 0 ; ñóììà äëÿ ïðàâîãî ñòåðåîêàíàëà
mov edx, [ssmix_channels]
mov ecx, SSMIX_CHANNEL_COUNT
.channel_loop:
mov eax, [edx]
cmp eax, SSMIX_CHANMODE_FREE
je .channel_end
cmp eax, SSMIX_CHANMODE_WAITRESET
je .channel_end
push ecx
; ñìåøèâàíèå êàíàëîâ ñ ó÷åòîì ãðîìêîñòè
mov ebx, [edx+4]
mov ecx, [edx+16]
movsx eax, word [ecx]
imul eax, ebx
add esi, eax
mov ebx, [edx+8]
movsx eax, word [ecx+2]
imul eax, ebx
add edi, eax
; ïðîâåðêà íà çàâåðøåíèå òðåêà
add ecx, 4
cmp ecx, [edx+24]
jb .notrackend
mov eax, [edx]
cmp eax, SSMIX_CHANMODE_SINGLE
jne @f
mov ebx, SSMIX_CHANMODE_FREE
mov [edx], ebx
jmp .notrackend
@@:
cmp eax, SSMIX_CHANMODE_REPEAT
jne @f
mov ecx, [edx+20]
jmp .notrackend
@@:
cmp eax, SSMIX_CHANMODE_SINGLE_WITHOUT_RESET
jne @f
mov ebx, SSMIX_CHANMODE_WAITRESET
mov [edx], ebx
jmp .notrackend
@@:
.notrackend:
mov [edx+16], ecx
pop ecx
.channel_end:
add edx, 32
dec ecx
jnz .channel_loop
; íîðìàëèçàöèÿ ñòåðåîêàíàëîâ
sar esi, 7
cmp esi, 0x7FFF
jle @f
mov esi, 0x7FFF
@@:
cmp esi, -0x8000
jge @f
mov esi, -0x8000
@@:
sar edi, 7
cmp edi, 0x7FFF
jle @f
mov edi, 0x7FFF
@@:
cmp edi, -0x8000
jge @f
mov edi, -0x8000
@@:
; ñîõðàíåíèå ðåçóëüòàòà â áóôôåðå ìèêøåðà
shl edi, 16
add esi, edi
pop ecx ebx
mov [ebx], esi
add ebx, 4
dec ecx
jnz .fill_buffer_loop
; óñòàíîâêà áóôôåðà äðàéâåðà
stdcall _SetBuffer@16, [ssmix_hbuffer], [ssmix_pbuffer], [ssmix_buffer_offset], [ssmix_buffer_size]
cmp [ssmix_state], 1
je .mixloop
; îñâîáîäèòü ïàìÿòü áóôôåðà âîñïðîèçâåäåíèÿ
.free_buffer_memory:
mov eax, 68
mov ebx, 13
mov ecx, [ssmix_pbuffer]
; óíè÷òîæèòü áóôôåð äðàéâåðà
.destroy_buffer:
stdcall _DestroyBuffer@4, [ssmix_hbuffer]
; çàâåðøèòü ðàáîòó ïîòîêà
.end:
call ssmix_free
mov eax, -1
int 0x40
;ret
;=================================================================================
align 4
_InitSound@4: ;p_ver:dword
push ebx
push ecx
mov eax, 68
mov ebx, 16
mov ecx, ssmix_szInfinity
int 0x40
mov [ssmix_hSound], eax
test eax, eax
jz .fail
mov eax, 68
mov ebx, 16
mov ecx, ssmix_szSound
int 0x40
mov [ssmix_hrdwSound], eax
lea eax, [esp+12] ;p_ver
xor ebx, ebx
push 4 ;.out_size
push eax ;.output
push ebx ;.inp_size
push ebx ;.input
push SRV_GETVERSION ;.code
push [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp ;[handle]
int 0x40
add esp, 24
pop ecx
pop ebx
ret 4
.fail:
or eax, -1
pop ecx
pop ebx
ret 4
align 4
_CreateBuffer@12: ;format:dword,size:dword,p_str:dword
push ebx
push ecx
lea eax, [esp+20] ;p_str
lea ebx, [esp+12] ;format
push 4 ;.out_size
push eax ;.output
push 8 ;.inp_size
push ebx ;.input
push SND_CREATE_BUFF;.code
push [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp
int 0x40
add esp, 24 ;io_cintrol
pop ecx
pop ebx
ret 12
align 4
_DestroyBuffer@4: ;str:dword
push ebx
push ecx
xor eax, eax
lea ebx, [esp+12] ;[stream]
push eax ;.out_size
push eax ;.output
push 4 ;.inp_size
push ebx ;.input
push SND_DESTROY_BUFF;.code
push [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp ;[handle]
int 0x40
add esp, 24
pop ecx
pop ebx
ret 4
align 4
_GetBufferSize@8: ;str:dword, p_size:dword
push ebx
push ecx
lea eax, [esp+16]
lea ebx, [esp+12] ;[stream]
push 4 ;.out_size
push eax ;.output
push 4 ;.inp_size
push ebx ;.input
push SND_GETBUFFSIZE;.code
push dword [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret 8
align 4
_SetBuffer@16: ;str:dword, src:dword, offs:dword, size:dword
push ebx
push ecx
xor eax, eax
lea ebx, [esp+12] ;[stream]
push eax ;.out_size
push eax ;.output
push 16 ;.inp_size
push ebx ;.input
push SND_SETBUFF ;.code
push dword [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret 16
align 4
_PlayBuffer@8: ;str:dword,flags:dword
push ebx
push ecx
xor eax, eax
lea ebx, [esp+12] ;[stream]
push eax ;.out_size
push eax ;.output
push 8 ;.inp_size
push ebx ;.input
push SND_PLAY ;.code
push dword [ssmix_hSound] ;.handle
mov eax, 68
mov ebx, 17
mov ecx, esp
int 0x40
add esp, 24
pop ecx
pop ebx
ret 8
; ========================= data =====================================
ssmix_hSound dd ?
ssmix_hrdwSound dd ?
ssmix_szInfinity db 'INFINITY',0
ssmix_szSound db 'SOUND',0
ssmix_channels dd 0
ssmix_thread_stack dd 0
ssmix_state dd 0
ssmix_volumeL dd ?
ssmix_volumeR dd ?
ssmix_driver_version dd ?
ssmix_hbuffer dd ?
ssmix_pbuffer dd 0
ssmix_buffer_size dd ?
ssmix_buffer_offset dd ?
ssmix_driver_notify_struct rd 6 ; ñòêóêòóðà ñîáûòèÿ îò äðàéâåðà

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB