Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1608 → Rev 1609

/programs/games/nu_pogodi/trunk/nu_pogod.asm
12,6 → 12,7
include '../../../macros.inc'
include '../../../proc32.inc'
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac' ;¬ ªà®áë ¤«ï § ¤ ­¨ï í«¥¬¥­â®¢ box_lib
include 'mem.inc'
include 'dll.inc'
 
61,6 → 62,7
BUT1_H equ 20 ;¢ëá®â 
BUT1_NEXT_TOP equ (BUT1_T+BUT1_H)*65536
 
game_select_mode db 1 ;०¨¬ ¢ë¡®à  ¨£àë
 
FILE_NAME_MAX equ 20 ;¬ ªá¨¬ «ì­ ï ¤«¨­­  ¨¬¥­¨ ä ©«  (¡¥§ ¯ ¯®ª, ®â­®á¨â¥«ì­® ⥪ã饩)
;§­ ç¥­¨ï ¨¬¥­ ¯® 㬮«ç ­¨î
67,18 → 69,28
ini_def_decorat_file db 'curici.png',0
ini_def_unit_file db 'wolf.png',0
ini_def_objects_file db 'eggs.png',0
ini_def_lost_file db 'chi.png',0
;¨¬¥­  ä ©«®¢
fn_icon0 rb FILE_NAME_MAX ;¨¬ï ä ©«  á ¤¥ª®à æ¨ï¬¨
fn_icon1 rb FILE_NAME_MAX ;¨¬ï ä ©«  á ¢®«ª®¬ ¨ § ©æ¥¬
fn_icon2 rb FILE_NAME_MAX ;¨¬ï ä ©«  á ï©æ ¬¨
fn_icon3 db 'chi.png',0 ;¨¬ï ä ©«  á 樯«ïâ ¬¨
fn_icon3 rb FILE_NAME_MAX ;¨¬ï ä ©«  á 樯«ïâ ¬¨
fn_font db 'font8x9.bmp',0
 
ini_name db 'nu_pogod.ini',0
fn_icon_tl_sys db 'tl_sys_16.png',0
TREE_ICON_SYS16_BMP_SIZE equ 256*3*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
 
ini_m_name db 'main.ini',0
key_count db 'count',0
key_game db 'g'
key_game_ind db 0,0,0
 
ini_name rb FILE_NAME_MAX ;¨¬ï ini ä ©«  c ¢ë¡à ­­®© ¨£à®©
ini_sec_files db 'Files',0
key_file_decorat db 'file_decorat',0
key_file_unit db 'file_unit',0
key_file_objects db 'file_objects',0
key_file_lost db 'file_lost',0
key_displ_w db 'displ_w',0
key_displ_h db 'displ_h',0
key_shadow_x db 'offs_shadow_x',0
612,25 → 624,35
ret
endp
 
txt_tile_type_0 rb FILE_NAME_MAX
 
align 4
start:
load_libraries l_libs_start,load_lib_end
user_is_select:
push ecx esi edi
 
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
stdcall [tl_node_get_data], tree1
pop esi
cmp esi,0 ;¥á«¨ ¨¬ï ¨£àë ¯ãá⮥
je @f
mov edi,ini_name
mov ecx,FILE_NAME_MAX
cld
rep movsb
 
mov byte[game_select_mode],0
call InitAll
@@:
mov ebp,lib1
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
pop edi esi ecx
 
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors ;¯®«ãç ¥¬ á¨á⥬­ë¥ 梥â 
call draw_window
ret
 
;******************************************************************************
; äã­ªæ¨ï, ª®â®à ï 1 à § ¤¥« ¥â ¢á¥ ­ áâனª¨ ­ã¦­ë¥ ¤«ï ¨£àë
;******************************************************************************
align 4
InitAll:
pushad
;à ¡®â  á ä ©«®¬ ­ áâ஥ª
copy_path ini_name,sys_path,file_name,0x0
stdcall dword[ini_get_int],file_name,ini_sec_files,key_displ_w,210
640,6 → 662,8
stdcall dword[ini_get_str],file_name,ini_sec_files,key_file_decorat,fn_icon0,FILE_NAME_MAX,ini_def_decorat_file
stdcall dword[ini_get_str],file_name,ini_sec_files,key_file_unit,fn_icon1,FILE_NAME_MAX,ini_def_unit_file
stdcall dword[ini_get_str],file_name,ini_sec_files,key_file_objects,fn_icon2,FILE_NAME_MAX,ini_def_objects_file
stdcall dword[ini_get_str],file_name,ini_sec_files,key_file_lost,fn_icon3,FILE_NAME_MAX,ini_def_lost_file
 
stdcall dword[ini_get_int],file_name,ini_sec_files,key_shadow_x,2
mov dword[offs_shadow_x],eax
stdcall dword[ini_get_int],file_name,ini_sec_files,key_shadow_y,2
714,6 → 738,58
 
call InitBackgroundBuffer ;§ ¯®«­ï¥¬ ¡ãä¥à á ä®­®¢ë¬¨ ¤¥ª®à æ¨ï¬¨
stdcall InitGame,0
popad
ret
 
align 4
start:
load_libraries l_libs_start,load_lib_end
 
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib1
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
 
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors ;¯®«ãç ¥¬ á¨á⥬­ë¥ 梥â 
 
;******************************************************************************
; ¯®¤£®â®¢ª  ᯨ᪠ ¨£®à
;******************************************************************************
stdcall dword[tl_data_init], tree1
 
load_image_file fn_icon_tl_sys, image_data_gray,TREE_ICON_SYS16_BMP_SIZE
stdcall [buf2d_create_f_img], buf_tree_sys,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
 
mov edi,buf_tree_sys
m2m dword[tree1.data_img_sys],buf2d_data
 
;à ¡®â  á £« ¢­ë¬ ä ©«®¬ ­ áâ஥ª
copy_path ini_m_name,sys_path,file_name,0x0
 
stdcall dword[ini_get_int],file_name,ini_sec_files,key_count,1
mov ecx,eax
mov dl,'0'
cld
@@:
mov byte[key_game_ind],dl
inc dl
push ecx edx
stdcall dword[ini_get_str],file_name,ini_sec_files,key_game,txt_tile_type_0,FILE_NAME_MAX,ini_def_decorat_file
stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1 ;¤®¡ ¢«ï¥¬ ­ §¢ ­¨¥ ¨£àë
stdcall dword[tl_cur_next], tree1 ;¯¥à¥­®á¨¬ ªãàá®à ¢­¨§, çâ®-¡ë ­¥ ¯®¬¥­ï«áï ¯®à冷ª ¨£à
pop edx ecx
loop @b
stdcall dword[tl_cur_beg], tree1 ;¯¥à¥­®á¨¬ ªãàá®à ¢¢¥àå
 
mcall 26,9
mov [last_time],ebx
 
725,7 → 801,11
 
align 4
still: ;£« ¢­ë© 横«
mcall 26,9
 
cmp byte[game_select_mode],0
jne .select_mode
mcall 26,9 ;¡¥à¥¬ á¨á⥬­®¥ ¢à¥¬ï
mov ebx,[last_time]
add ebx,dword[game_spd] ;delay
sub ebx,eax
738,22 → 818,38
cmp eax,0
je it_is_time_now
 
;mcall 10
jmp @f
.select_mode:
mcall 10
@@:
 
cmp al,0x1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
cmp al,1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,0x2
cmp al,2
jz key
cmp al,0x3
cmp al,3
jz button
cmp al,6
jz mouse
 
jmp still
 
align 4
mouse:
cmp byte[game_select_mode],0
je @f
stdcall [tl_mouse], tree1 ;¥á«¨ ¨£à  ¥é¥ ­¥ ¢ë¡à ­ 
@@:
jmp still
 
align 4
it_is_time_now:
mcall 26,9
mov [last_time],eax
 
cmp byte[game_select_mode],0
jne still
 
;...§¤¥áì ¨¤ãâ ¤¥©á⢨ï, ¢ë§ë¢ ¥¬ë¥ ª ¦¤ë¥ delay á®âëå ¤®«¥© ᥪ㭤...
call MoveEggs
call draw_display
764,6 → 860,11
push eax ebx
mcall 2
 
cmp byte[game_select_mode],0
je @f
stdcall [tl_key], tree1
@@:
 
cmp ah,176 ;Left
jne @f
and byte[pos_wolf],0xfe
818,6 → 919,9
mov edi,hed
mcall ;ᮧ¤ ­¨¥ ®ª­ 
 
cmp byte[game_select_mode],0
jne .select_mode
 
mcall 9,procinfo,-1
mov edi,buf_displ
mov eax,dword[procinfo.client_box.width]
908,6 → 1012,11
mov ecx,dword[displ_h]
int 0x40 ;à¨á®¢ ­¨¥ «¥¢®£® ¡®ª®¢®£® ¯®«ï
 
jmp @f
.select_mode:
stdcall dword[tl_draw],dword tree1
@@:
 
mcall 12,2
popad
ret
915,7 → 1024,7
align 4
draw_display:
 
stdcall mem_copy, dword[buf_fon],dword[buf_displ],315*210*3;dword[displ_bytes] ;ª®¯¨à®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¨§ ä®­®¢®£® ¡ãä¥à 
stdcall mem_copy, dword[buf_fon],dword[buf_displ],dword[displ_bytes] ;ª®¯¨à®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¨§ ä®­®¢®£® ¡ãä¥à 
call DrawZaac ;à¨á㥬 § ©æ 
call DrawWolf ;à¨á㥬 ¢®«ª 
call DrawEggs ;à¨á㥬 ï©æ 
946,6 → 1055,7
stdcall [buf2d_delete],buf_fon ;㤠«ï¥¬ ¡ãä¥à
stdcall [buf2d_delete],buf_displ ;㤠«ï¥¬ ¡ãä¥à
 
stdcall [buf2d_delete],buf_tree_sys
stdcall [buf2d_delete],buf_font
 
cld
974,6 → 1084,8
add edi,BUF_STRUCT_SIZE
loop @b
 
mov dword[tree1.data_img_sys],0 ;ç¨á⨬ 㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨¥
stdcall dword[tl_data_clear], tree1
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
 
head_f_i:
980,25 → 1092,31
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
 
system_dir0 db '/sys/lib/'
name_buf2d db 'buf2d.obj',0
lib0_name db 'buf2d.obj',0
err_message_found_lib0 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã buf2d.obj',0
err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ buf2d.obj',0
 
system_dir1 db '/sys/lib/'
name_libimg db 'libimg.obj',0
lib1_name db 'libimg.obj',0
err_message_found_lib1 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
 
system_dir2 db '/sys/lib/'
libini_name db 'libini.obj',0
lib2_name db 'libini.obj',0
err_message_found_lib2 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libini.obj',0
err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.obj',0
 
system_dir3 db '/sys/lib/'
lib3_name db 'box_lib.obj',0
err_message_found_lib3 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã box_lib.obj',0
err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
 
;library structures
l_libs_start:
lib0 l_libs name_buf2d, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, import_buf2d_lib, err_message_import0, head_f_i
lib1 l_libs name_libimg, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, import_libimg, err_message_import1, head_f_i
lib2 l_libs libini_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, libini_import, err_message_import2, head_f_i
lib0 l_libs lib0_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, import_buf2d_lib, err_message_import0, head_f_i
lib1 l_libs lib1_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, import_libimg, err_message_import1, head_f_i
lib2 l_libs lib2_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, import_libini, err_message_import2, head_f_i
lib3 l_libs lib3_name, sys_path, file_name, system_dir3, err_message_found_lib3, head_f_l, import_box_lib, err_message_import3, head_f_i
load_lib_end:
 
align 4
1050,10 → 1168,26
image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥­­ë¬¨ á¥à묨 ¨§®¡à ¦¥­¨ï¬¨ ¢ ä®à¬ â¥ 24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
 
run_file_70 FileInfoBlock
hed db 'Nu pogodi 22.08.10',0 ;¯®¤¯¨áì ®ª­ 
hed db 'Nu pogodi 08.09.10',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
 
count_of_dir_list_files equ 10
el_focus dd tree1
tree1 tree_list FILE_NAME_MAX,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\
16,16, 0x8080ff,0x0000ff,0xffffff, 10,10,140,100, 0,0,0, el_focus,\
0,user_is_select
 
align 4
buf_tree_sys:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 0 ;+4 left
dw 0 ;+6 top
dd 16 ;+8 w
dd 16*11 ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
 
align 4
buf_font: ;¡ãä¥à á® èà¨ä⮬
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 25 ;+4 left
1101,7 → 1235,7
 
 
align 4
libini_import:
import_libini:
dd alib_init0
ini_get_str dd aini_get_str
ini_get_int dd aini_get_int
1203,6 → 1337,57
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
 
align 4
import_box_lib:
dd alib_init2
 
;scrollbar_ver_draw dd aScrollbar_ver_draw
 
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
 
dd 0,0
alib_init2 db 'lib_init',0
 
;aScrollbar_ver_draw db 'scrollbar_v_draw',0
 
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
 
 
 
i_end:
rb 1024
align 16
1211,8 → 1396,6
sys_path rb 4096
file_name:
rb 4096
plugin_path:
rb 4096
openfile_path:
rb 4096
filename_area: