mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-03 22:01:55 +03:00
b6fd00c4e2
git-svn-id: svn://kolibrios.org@1555 a494cfbc-eb01-0410-851d-a64ba20cac60
1160 lines
29 KiB
NASM
1160 lines
29 KiB
NASM
use32
|
||
org 0x0
|
||
db 'MENUET01' ;¨¤¥â¨ä. ¨á¯®«ï¥¬®£® ä ©« ¢á¥£¤ 8 ¡ ©â
|
||
dd 0x1
|
||
dd start
|
||
dd i_end ;à §¬¥à ¯à¨«®¦¥¨ï
|
||
dd mem
|
||
dd stacktop
|
||
dd 0x0
|
||
dd sys_path
|
||
|
||
include '../../../macros.inc'
|
||
include '../../../proc32.inc'
|
||
include '../../../develop/libraries/box_lib/load_lib.mac'
|
||
include 'mem.inc'
|
||
include 'dll.inc'
|
||
|
||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
|
||
|
||
;ä« £¨, ¤«ï äãªæ¨¨ ®¡à¥§ ¨ï ¡ãä¥à
|
||
BUF2D_OPT_CROP_TOP equ 1 ;®¡à¥§ª ᢥàåã
|
||
BUF2D_OPT_CROP_LEFT equ 2 ;®¡à¥§ª á«¥¢
|
||
BUF2D_OPT_CROP_BOTTOM equ 4 ;®¡à¥§ª ᨧã
|
||
BUF2D_OPT_CROP_RIGHT equ 8 ;®¡à¥§ª á¯à ¢
|
||
BUF2D_BIT_OPT_CROP_TOP equ 0
|
||
BUF2D_BIT_OPT_CROP_LEFT equ 1
|
||
BUF2D_BIT_OPT_CROP_BOTTOM equ 2
|
||
BUF2D_BIT_OPT_CROP_RIGHT equ 3
|
||
|
||
BUF_STRUCT_SIZE equ 21
|
||
buf2d_data equ dword[edi] ;¤ ë¥ ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
buf2d_w equ dword[edi+8] ;è¨à¨ ¡ãä¥à
|
||
buf2d_h equ dword[edi+12] ;¢ëá®â ¡ãä¥à
|
||
buf2d_l equ word[edi+4] ;®âáâ㯠᫥¢
|
||
buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
|
||
buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢ ¨ á¯à ¢ ¤«ï ¡ãä¥à
|
||
buf2d_color equ dword[edi+16] ;梥â ä® ¡ãä¥à
|
||
buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥¨ï
|
||
|
||
struct FileInfoBlock
|
||
Function dd ?
|
||
Position dd ?
|
||
Flags dd ?
|
||
Count dd ?
|
||
Buffer dd ?
|
||
db ?
|
||
FileName dd ?
|
||
ends
|
||
|
||
displ_w dd ? ;è¨à¨ ¯®«ï
|
||
displ_h dd ? ;¢ëá®â ¯®«ï
|
||
displ_bytes dd ? ;à §¬¥à 1-£® ä ©« á ¨§®¡à ¦¥¨¥¬
|
||
;displ_bytes equ 315*210*3 ;à §¬¥à 1-£® ä ©« á ¨§®¡à ¦¥¨¥¬
|
||
|
||
OFFS_SHADOW_X equ 2 ;ᤢ¨£ ⥥© ¯® ®á¨ 'x'
|
||
OFFS_SHADOW_Y equ 2 ;ᤢ¨£ ⥥© ¯® ®á¨ 'y'
|
||
IMAGE_FONT_SIZE equ 128*144*3
|
||
|
||
use_but equ 1
|
||
|
||
if use_but eq 1
|
||
BUT1_T equ 10 ;®âáâ㯠ᢥàåã
|
||
BUT1_L equ 15 ;®âáâ㯠᫥¢
|
||
BUT1_W equ 50 ;è¨à¨
|
||
BUT1_H equ 20 ;¢ëá®â
|
||
BUT1_NEXT_TOP equ (BUT1_T+BUT1_H)*65536
|
||
end if
|
||
|
||
FILE_NAME_MAX equ 20 ;¬ ªá¨¬ «ì ï ¤«¨ ¨¬¥¨ ä ©« (¡¥§ ¯ ¯®ª, ®â®á¨â¥«ì® ⥪ã饩)
|
||
;§ ç¥¨ï ¨¬¥ ¯® 㬮«ç ¨î
|
||
ini_def_unit_file db 'wolf.png',0
|
||
;¨¬¥ ä ©«®¢
|
||
fn_icon0 db 'curici.png',0 ;¨¬ï ä ©« á ¤¥ª®à æ¨ï¬¨
|
||
fn_icon1 rb FILE_NAME_MAX ;¨¬ï ä ©« á ¢®«ª®¬ ¨ § ©æ¥¬
|
||
fn_icon2 db 'eggs.png',0 ;¨¬ï ä ©« á ï©æ ¬¨
|
||
fn_icon3 db 'chi.png',0 ;¨¬ï ä ©« á 樯«ïâ ¬¨
|
||
fn_font db 'font8x9.bmp',0
|
||
|
||
ini_name db 'nu_pogod.ini',0
|
||
ini_sec_files db 'Files',0
|
||
key_file_unit db 'file_unit',0
|
||
key_displ_w db 'displ_w',0
|
||
key_displ_h db 'displ_h',0
|
||
|
||
ini_sec_color db 'Colors',0
|
||
key_color_unit db 'unit',0
|
||
|
||
;梥⠢ ¨£à¥
|
||
color_fon dd 0xffffff
|
||
color_shadows dd 0xd0d0d0 ;梥â ⥥©
|
||
color_trees dd 0x008000 ;梥â âà ¢ë
|
||
color_wolf dd 0x800000 ;梥⠢®«ª ¨ § ©æ
|
||
color_egg dd 0x404080 ;梥â ï©æ
|
||
color_chick dd 0x00d0d0 ;梥â 樯«¥ª
|
||
color_curici dd 0x8080d0 ;梥⠪ãà¨æë
|
||
color_perilo dd 0x000080 ;梥⠯¥à¨« (£à¥¡ï)
|
||
;梥⠨â¥à䥩á
|
||
color_but_sm dd 0x808080 ;梥⠬ «¥ìª¨å ª®¯®ª
|
||
color_but_te dd 0xffffff ;梥â ⥪áâ ª®¯ª å
|
||
|
||
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥¨©
|
||
copy_path path,sys_path,file_name,0x0 ;ä®à¬¨à㥬 ¯®«ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ® ¢ ®¤®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
|
||
|
||
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥¨ï
|
||
mov [buf],eax
|
||
|
||
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨
|
||
mov [run_file_70.Function], 0
|
||
mov [run_file_70.Position], 0
|
||
mov [run_file_70.Flags], 0
|
||
mov [run_file_70.Count], dword size
|
||
m2m [run_file_70.Buffer], [buf]
|
||
mov byte[run_file_70+20], 0
|
||
mov [run_file_70.FileName], file_name
|
||
mov ebx,run_file_70
|
||
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥¨ï
|
||
cmp ebx,0xffffffff
|
||
je @f
|
||
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥ë© ¡ãä¥à image_data
|
||
stdcall dword[img_decode], dword[buf],ebx,0
|
||
mov dword[image_data],eax
|
||
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥¨¥ ª ä®à¬ âã rgb
|
||
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
|
||
;㤠«ï¥¬ ¢à¥¬¥ë© ¡ãä¥à image_data
|
||
stdcall dword[img_destroy], dword[image_data]
|
||
@@:
|
||
}
|
||
|
||
;¤ ë¥ ¨£àë
|
||
bit_zaac equ 2 ;¡¨â § ©æ
|
||
val_zaac equ 4 ;æ¨äà ®â¢¥ç îé ï § ¡¨â § ©æ
|
||
bit_mig equ 3 ;¡¨â ¬¨£ ¨ï
|
||
val_mig equ 8 ;æ¨äà ®â¢¥ç îé ï § ¡¨â ¬¨£ ¨ï
|
||
mask_lot_lu equ 1b ;¬ ᪠¤«ï «¥¢®£® ¢¥à奣® «®âª
|
||
mask_lot_ld equ 100000b ;¬ ᪠¤«ï «¥¢®£® ¨¦¥£® «®âª
|
||
mask_lot_ru equ 10000000000b ;¬ ᪠¤«ï ¯à ¢®£® ¢¥à奣® «®âª
|
||
mask_lot_rd equ 1000000000000000b ;¬ ᪠¤«ï ¯à ¢®£® ¨¦¥£® «®âª
|
||
mask_clear_all equ 11111011111011110111101111011110b ;¬ ᪠¤«ï ®ç¨á⪨ ¯ ¤ îé¨å ï¨æ ¨ ¯à¨¡¥¦ ¢è¨å 樯«ïâ
|
||
mask_fail_eggs equ 100001000010000100000b ;¬ ᪠¯ ¤ îé¨å ï¨æ
|
||
mask_chi_left equ 11111000000000000000000000b ;¬ ᪠«¥¢ëå 樯«ïâ
|
||
mask_chi_right equ 11111000000000000000000000000000b ;¬ ᪠¯à ¢ëå 樯«ïâ
|
||
mask_chi_cr_l equ 1000000000000000000000b ;¬ ᪠¤«ï ᮧ¤ ¨ï «¥¢®£®
|
||
mask_chi_cr_r equ 1000000000000000000000000000b ;¬ ᪠¤«ï ᮧ¤ ¨ï ¯à ¢®£®
|
||
bit_chi_left equ 21 ;1-© ¡¨â ª®â®àë© ®â¢¥ç ¥â § ¡¥£ã饣® á«¥¢
|
||
bit_chi_right equ 27 ;1-© ¡¨â ª®â®àë© ®â¢¥ç ¥â § ¡¥£ã饣® ¯à ¢
|
||
val_zaac_time_y equ 5 ;ª®««¨ç¥á⢮ ⠪⮢, ª®â®à®¥ ®¡ï§ â¥«ì® ¤®«¦¥ ¯à®¢¨á¥âì § ïæ
|
||
val_zaac_time_n equ 7 ;ª®««¨ç¥á⢮ ⠪⮢, ª®â®à®¥ ®¡ï§ â¥«ì® ¤®«¦¥ ¡ëâì á¯àïâ ë¬ § ïæ
|
||
|
||
txt_game_a db 'ˆ£à €',0
|
||
txt_game_b db 'ˆ£à <20>',0
|
||
|
||
zaac_status db 0
|
||
pos_wolf db 0 ;¯®§¨æ¨ï ¢®«ª 0-© ¡¨â á«¥¢ /á¯à ¢ , 1-© ¡¨â ᢥàåã/¢¨§
|
||
;rb 1
|
||
pos_eggs dd 0 ;¯®§¨æ¨¨ à ᯮ«®¦¥¨ï ï¨æ ¨ 樯«ïâ
|
||
eggs_count dw 0 ;ª®««¨ç¥á⢮ ¯®©¬ ëå ï¨æ
|
||
game_text db 'ˆ£à _',13
|
||
some_text db '0'
|
||
rb 8 ;⥪áâ á ç¨á«®¬ ¯®©¬ ëå ï¨æ
|
||
count_last db 0 ;áç¥â稪 ¯à®¯ãé¥ëå ï¨æ
|
||
game_spd dd 0 ;§ ¤¥à¦ª ¨£àë
|
||
|
||
;¤«ï £¥¥à 樨 á«ãç ©ëå ç¨á¥«
|
||
rand_x dd 0
|
||
|
||
align 4
|
||
rand_next:
|
||
;x(k+1) = (a*x(k)+c) mod m
|
||
; a=22695477, c=1, m=2^32
|
||
push eax
|
||
mov eax,dword[rand_x]
|
||
imul eax,22695477
|
||
inc eax
|
||
mov dword[rand_x],eax
|
||
pop eax
|
||
ret
|
||
|
||
;ᮧ¤ ¥¬ ¯à®§à çë¥ ¡ãä¥à ¯® 8 ¡¨â (âà ä à¥âë), ¤«ï à¨á®¢ ¨ï
|
||
;£¤¥ buf - ¡ãä¥à ®á®¢¥ ª®â®à®£® ¡ã¤¥â ᮧ¤ âà ä à¥â
|
||
;ä®®¢ë© 梥⠡ãä¥à ¤®«¦¥ ¡ëâì 0xffffff, ¨ ç¥ ¥ ¯à®¨§®©¤¥â ®¡à¥§ª
|
||
;¯® ä®®¢®¬ã 梥âã ¨ âà ä à¥â ¡ã¤¥â § ¨¬ â 쬮£® ¬¥áâ ¢ ¯ ¬ïâ¨
|
||
align 4
|
||
proc CreateTrapharetBuffer, buf:dword, img_data:dword
|
||
push eax edi
|
||
mov edi,dword[buf]
|
||
|
||
;§ ¯®«¥¨¥ ¤ ëå ¡ãä¥à
|
||
mov buf2d_size_lt,0
|
||
mov eax,dword[displ_w]
|
||
mov buf2d_w,eax
|
||
mov eax,dword[displ_h]
|
||
mov buf2d_h,eax
|
||
mov buf2d_color,0xffffff
|
||
mov buf2d_bits,24
|
||
|
||
stdcall [buf2d_create_f_img], edi,[img_data] ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall [buf2d_conv_24_to_8], edi,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç®á⨠8¡¨â
|
||
;®¡à¥§ ¥¬ «¨è¨¥ ªà ï ¡ãä¥à , ¤«ï ¡®«¥¥ ¡ëáâண® à¨á®¢ ¨ï
|
||
stdcall [buf2d_crop_color], edi,buf2d_color,BUF2D_OPT_CROP_TOP+BUF2D_OPT_CROP_BOTTOM+BUF2D_OPT_CROP_RIGHT+BUF2D_OPT_CROP_LEFT
|
||
pop edi eax
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
InitBackgroundBuffer: ;ᮧ¤ ¨¥ ä®®¢®£® ¨§®¡à ¦¥¨ï
|
||
pushad
|
||
mov edi,buf_fon
|
||
mov eax,[color_fon]
|
||
mov buf2d_color,eax
|
||
stdcall [buf2d_clear], edi,eax
|
||
mov esi,edi
|
||
|
||
xor eax,eax
|
||
xor ebx,ebx
|
||
|
||
mov edi,buf_decor
|
||
mov ax,buf2d_t
|
||
add eax,OFFS_SHADOW_Y
|
||
mov bx,buf2d_l
|
||
add ebx,OFFS_SHADOW_X
|
||
stdcall [buf2d_bit_blt_alpha], esi, ebx,eax, edi,[color_shadows] ;à¨á㥬 ⥨ ¤®¬¨ª®¢
|
||
add edi,BUF_STRUCT_SIZE
|
||
mov ax,buf2d_t
|
||
add eax,OFFS_SHADOW_Y
|
||
mov bx,buf2d_l
|
||
add ebx,OFFS_SHADOW_X
|
||
stdcall [buf2d_bit_blt_alpha], esi, ebx,eax, edi,[color_shadows] ;à¨á㥬 ⥨ ªãà¨æ
|
||
add edi,BUF_STRUCT_SIZE
|
||
mov ax,buf2d_t
|
||
add eax,OFFS_SHADOW_Y
|
||
mov bx,buf2d_l
|
||
add ebx,OFFS_SHADOW_X
|
||
stdcall [buf2d_bit_blt_alpha], esi, ebx,eax, edi,[color_shadows] ;à¨á㥬 ⥨ ¤¥à¥¢ì¥¢
|
||
|
||
mov edi,buf_decor
|
||
mov ax,buf2d_t
|
||
stdcall [buf2d_bit_blt_alpha], esi, 0,eax, edi,[color_perilo] ;à¨á㥬 ¤®¬¨ª¨
|
||
add edi,BUF_STRUCT_SIZE
|
||
mov ax,buf2d_t
|
||
stdcall [buf2d_bit_blt_alpha], esi, 0,eax, edi,[color_curici] ;à¨á㥬 ªãà¨æë
|
||
add edi,BUF_STRUCT_SIZE
|
||
mov ax,buf2d_t
|
||
stdcall [buf2d_bit_blt_alpha], esi, 0,eax, edi,[color_trees] ;à¨á㥬 ¤¥à¥¢ìï
|
||
popad
|
||
ret
|
||
|
||
;à¨áã¥â ª à⨪㠢 ¡ãä¥à¥ buf ¨§ ¬ áᨢ ¡ãä¥à®¢ buf_img á ¨¤¥ªá®¬ ind
|
||
;â. ¥. buf <- buf_img[ind]
|
||
align 4
|
||
proc DrawArrayImg, buf:dword, buf_img:dword, ind:dword, color:dword
|
||
pushad
|
||
mov edi,dword[ind]
|
||
imul edi,BUF_STRUCT_SIZE
|
||
add edi,dword[buf_img]
|
||
|
||
mov esi,dword[buf]
|
||
xor eax,eax
|
||
mov ax,buf2d_t
|
||
xor ebx,ebx
|
||
mov bx,buf2d_l
|
||
stdcall [buf2d_bit_blt_alpha], esi, ebx,eax, edi,[color]
|
||
popad
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
DrawZaac: ;à¨á®¢ ¨¥ § ©æ
|
||
push eax
|
||
bt word[pos_wolf],bit_zaac
|
||
jae .end_mig
|
||
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,6,[color_wolf] ;à¨á㥬 ⥫® § ©æ
|
||
mov eax,dword[pos_eggs]
|
||
and eax,mask_chi_right+mask_chi_left
|
||
cmp eax,0
|
||
je .end_mig ;¥á«¨ ¥â ¡¥£ îé¨å 樯«ïâ, â® § ïæ à㪮© ¥ ¬ è¥â
|
||
bt word[pos_wolf],bit_mig
|
||
jc @f
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,7,[color_wolf] ;à¨á㥬 àãªã § ©æ ¢¢¥àåã
|
||
jmp .end_mig
|
||
@@:
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,8,[color_wolf] ;à¨á㥬 àãªã § ©æ ¢¨§ã
|
||
.end_mig:
|
||
pop eax
|
||
ret
|
||
|
||
align 4
|
||
DrawWolf: ;à¨áã¥â ¢®«ª á ª®à§¨ ¬¨
|
||
bt word[pos_wolf],0
|
||
jc @f
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,0,[color_wolf]
|
||
bt word[pos_wolf],1
|
||
jc .corz_ldn
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,1,[color_wolf]
|
||
jmp .corz_lend
|
||
.corz_ldn:
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,2,[color_wolf]
|
||
.corz_lend:
|
||
jmp .wolf_b
|
||
@@:
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,3,[color_wolf]
|
||
bt word[pos_wolf],1
|
||
jc .corz_rdn
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,4,[color_wolf]
|
||
jmp .corz_rend
|
||
.corz_rdn:
|
||
stdcall DrawArrayImg, buf_displ,buf_wolf,5,[color_wolf]
|
||
.corz_rend:
|
||
.wolf_b:
|
||
ret
|
||
|
||
align 4
|
||
DrawEggs: ;à¨áã¥â ï©æ
|
||
pushad
|
||
cld
|
||
|
||
mov eax,dword[pos_eggs]
|
||
xor ebx,ebx
|
||
mov ecx,20 ;横« ¤«ï à¨á®¢ ¨ï ª®âïé¨åáï ï¨æ
|
||
@@:
|
||
bt eax,ebx
|
||
jae .draw_egg
|
||
stdcall DrawArrayImg, buf_displ,buf_egg,ebx,[color_egg]
|
||
.draw_egg:
|
||
inc ebx
|
||
loop @b
|
||
|
||
;mov eax,dword[pos_eggs]
|
||
and eax,mask_chi_left
|
||
cmp eax,0
|
||
je @f
|
||
stdcall DrawArrayImg, buf_displ,buf_egg,20,[color_egg] ;à §¡¨â®¥ ï©æ® á«¥¢
|
||
@@:
|
||
mov eax,dword[pos_eggs]
|
||
and eax,mask_chi_right
|
||
cmp eax,0
|
||
je @f
|
||
stdcall DrawArrayImg, buf_displ,buf_egg,21,[color_egg] ;à §¡¨â®¥ ï©æ® á¯à ¢
|
||
@@:
|
||
|
||
mov eax,dword[pos_eggs]
|
||
xor edx,edx
|
||
mov ebx,bit_chi_left
|
||
mov ecx,5 ;横« ¤«ï à¨á®¢ ¨ï «¥¢ëå 樯«ïâ
|
||
@@:
|
||
bt eax,ebx
|
||
jae .draw_chick_l
|
||
stdcall DrawArrayImg, buf_displ,buf_chi,edx,[color_chick]
|
||
.draw_chick_l:
|
||
inc ebx
|
||
inc edx
|
||
loop @b
|
||
mov ebx,bit_chi_right
|
||
mov ecx,5 ;横« ¤«ï à¨á®¢ ¨ï ¯à ¢ëå 樯«ïâ
|
||
@@:
|
||
bt eax,ebx
|
||
jae .draw_chick_r
|
||
stdcall DrawArrayImg, buf_displ,buf_chi,edx,[color_chick]
|
||
.draw_chick_r:
|
||
inc ebx
|
||
inc edx
|
||
loop @b
|
||
|
||
xor eax,eax
|
||
mov al,byte[count_last]
|
||
mov ecx,eax ;横« ¤«ï à¨á®¢ ¨ï èâà äëå ®çª®¢
|
||
shr ecx,1
|
||
mov edx,10 ;¨¤¥ªá ç « èâà äëå ¨ª®®ª ¢ ¡ãä¥à¥ buf_chi
|
||
cmp ecx,0
|
||
je .no_unit_last
|
||
@@:
|
||
stdcall DrawArrayImg, buf_displ,buf_chi,edx,[color_chick]
|
||
inc edx
|
||
loop @b
|
||
.no_unit_last:
|
||
|
||
bt ax,0 ;¯à®¢¥à塞 ¬¨£ î饥 ¥ ç¥â®¥ ®çª®
|
||
jae @f
|
||
bt word[pos_wolf],bit_mig
|
||
jc @f
|
||
stdcall DrawArrayImg, buf_displ,buf_chi,edx,[color_chick] ;¬¨£ î饥 èâà 䮥 ®çª®
|
||
@@:
|
||
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
CountEggsInc: ;㢥«¨ç¨¢ ¥¬ áç¥â稪 ï¨æ 1
|
||
push eax edi
|
||
xor eax,eax
|
||
inc word[eggs_count] ;㢥«¨ç¨¢ ¥¬ áç¥â稪 ï¨æ
|
||
cmp word[eggs_count],200 ;¡®ãáë¥ ®çª¨
|
||
je @f
|
||
cmp word[eggs_count],500 ;¡®ãáë¥ ®çª¨
|
||
je @f
|
||
jmp .no_bonus
|
||
@@:
|
||
mov byte[count_last],0
|
||
.no_bonus:
|
||
|
||
mov ax,word[eggs_count]
|
||
mov edi,some_text
|
||
call convert_to_str ;®¡®¢«ï¥¬ ⥪á⮢ãî áâபã
|
||
and ax,0xf ;ç¥à¥§ ª ¦¤ë¥ 16 ï¨æ 㬥ìè ¥¬ ¢à¥¬ï
|
||
cmp ax,0
|
||
jne @f
|
||
cmp dword[game_spd],15 ;¬¨¨¬ «ì ï § ¤¥à¦ª
|
||
jle @f
|
||
dec dword[game_spd]
|
||
@@:
|
||
pop edi eax
|
||
ret
|
||
|
||
;input:
|
||
; eax - ¬ ᪠, 㪠§ë¢ îé ï á ª ª®© áâà®ë 㯠«® ï©æ®
|
||
align 4
|
||
CountLastInc: ; ç¨á«¥¨¥ èâà äëå ®çª®¢
|
||
inc byte[count_last] ;¯®«®¢¨ ® èâà 䮣® ®çª
|
||
bt word[pos_wolf],bit_zaac
|
||
jc @f
|
||
inc byte[count_last] ;¥á«¨ ¥â § ©æ â® ¥é¥ 1- ¯®«®¢¨ èâà 䮣® ®çª
|
||
@@:
|
||
cmp byte[count_last],6
|
||
jle @f
|
||
mov byte[count_last],6 ;áâ ¢¨¬ ®£à ¨ç¥¨ ç¨á«® èâà äëå ®çª®¢
|
||
@@:
|
||
or dword[pos_eggs],eax ;ᮧ¤ ¥¬ ¡¥£ã饣® 樯«¥ª
|
||
ret
|
||
|
||
align 4
|
||
MoveEggs:
|
||
pushad
|
||
xor byte[pos_wolf],val_mig ;¡¨â ¤«ï ¬¨£ ¨ï
|
||
|
||
cmp byte[count_last],6 ;¬ ªá¨¬ «ì®¥ ç¨á«® èâà äëå ®çª®¢
|
||
je .end_fun
|
||
|
||
rol dword[pos_eggs],1
|
||
mov ecx,dword[pos_eggs]
|
||
and ecx,mask_fail_eggs
|
||
cmp ecx,0
|
||
je .no_fail ;¥â ¯ ¤ îé¨å ï¨æ
|
||
; ç¨á«¥¨¥ ï¨æ ¯®¯ ¢è¨å ¢ ª®à§¨ã
|
||
;¨«¨ ç¨á«¥¨¥ èâà äëå ®çª®¢
|
||
xor ebx,ebx
|
||
mov bl,byte[pos_wolf] ;¡¥à¥¬ ¯ à ¬¥âàë (¯®§¨æ¨î) ¢®«ª
|
||
and bl,3 ; ¢á直© á«ãç ©
|
||
|
||
bt ecx,5 ;¯à®¢¥à塞 ¢¥à奥 «¥¢®¥ ¯¥à¨«®
|
||
jae .perilo_lu
|
||
cmp bx,0 ;¯à®¢¥à塞 «¨ç¨¥ ª®à§¨ë
|
||
jne @f
|
||
call CountEggsInc
|
||
jmp .perilo_lu
|
||
@@:
|
||
mov eax,mask_chi_cr_l
|
||
call CountLastInc
|
||
.perilo_lu:
|
||
bt ecx,10 ;¯à®¢¥à塞 ¨¦¥¥ «¥¢®¥ ¯¥à¨«®
|
||
jae .perilo_ld
|
||
cmp bx,2 ;¯à®¢¥à塞 «¨ç¨¥ ª®à§¨ë
|
||
jne @f
|
||
call CountEggsInc
|
||
jmp .perilo_ld
|
||
@@:
|
||
mov eax,mask_chi_cr_l
|
||
call CountLastInc
|
||
.perilo_ld:
|
||
bt ecx,15 ;¯à®¢¥à塞 ¢¥à奥 ¯à ¢®¥ ¯¥à¨«®
|
||
jae .perilo_ru
|
||
cmp bx,1 ;¯à®¢¥à塞 «¨ç¨¥ ª®à§¨ë
|
||
jne @f
|
||
call CountEggsInc
|
||
jmp .perilo_ru
|
||
@@:
|
||
mov eax,mask_chi_cr_r
|
||
call CountLastInc
|
||
.perilo_ru:
|
||
bt ecx,20 ;¯à®¢¥à塞 ¨¦¥¥ ¯à ¢®¥ ¯¥à¨«®
|
||
jae .perilo_rd
|
||
cmp bx,3 ;¯à®¢¥à塞 «¨ç¨¥ ª®à§¨ë
|
||
jne @f
|
||
call CountEggsInc
|
||
jmp .perilo_rd
|
||
@@:
|
||
mov eax,mask_chi_cr_r
|
||
call CountLastInc
|
||
.perilo_rd:
|
||
.no_fail:
|
||
|
||
and dword[pos_eggs],mask_clear_all ;®ç¨á⪠㯠¢è¨å ï¨æ ¨ ¤®¡¥¦ ¢è¨å ªã३
|
||
|
||
call rand_next
|
||
cmp byte[zaac_status],0
|
||
jle @f
|
||
dec byte[zaac_status]
|
||
jmp .no_zaac_move ;§ ïæ ¯®ª ¥ ¤¢¨£ ¥âáï
|
||
@@:
|
||
|
||
bt dword[rand_x],6 ;§ ïæ ®â ä® àï ¬¥ï¥â áâ âãá
|
||
jc @f
|
||
xor byte[pos_wolf],val_zaac ;¢ëá®¢ë¢ ¥¬/§ á®¢ë¢ ¥¬ § ©æ
|
||
bt word[pos_wolf],val_zaac
|
||
jc .zaac_n
|
||
mov byte[zaac_status],val_zaac_time_y ;áâ ¢¨¬ ¬¨¨¬ «ì®¥ ¢à¥¬ï ¤«ï ᬥë áâ âãá
|
||
jmp @f
|
||
.zaac_n:
|
||
mov byte[zaac_status],val_zaac_time_n ;áâ ¢¨¬ ¬¨¨¬ «ì®¥ ¢à¥¬ï ¤«ï ᬥë áâ âãá
|
||
@@:
|
||
.no_zaac_move:
|
||
|
||
;ᮧ¤ ¨¥ ®¢ëå ï¨æ
|
||
bt dword[rand_x],4 ;¯à®¢¥à塞 ¡ã¤¥¬ «¨ ᮧ¤ ¢ âì ®¢®¥ ï©æ®
|
||
jc .end_creat
|
||
bt dword[rand_x],5 ;¯à®¢¥à塞 á ª ª®© áâ®à®ë ¡ã¤¥¬ ᮧ¤ ¢ âì ®¢®¥ ï©æ®
|
||
jc .creat_r
|
||
bt dword[rand_x],7
|
||
jc @f
|
||
or dword[pos_eggs],mask_lot_lu
|
||
jmp .end_creat
|
||
@@:
|
||
or dword[pos_eggs],mask_lot_ld
|
||
jmp .end_creat
|
||
.creat_r:
|
||
bt dword[rand_x],7
|
||
jc @f
|
||
or dword[pos_eggs],mask_lot_ru
|
||
jmp .end_creat
|
||
@@:
|
||
or dword[pos_eggs],mask_lot_rd
|
||
;jmp .end_creat
|
||
.end_creat:
|
||
|
||
.end_fun:
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
proc InitGame, b:dword ;¯¥à¢® ç «ìë¥ áâனª¨ ¨£àë
|
||
mov word[eggs_count],0 ;ª®««¨ç¥á⢮ ¯®©¬ ëå ï¨æ
|
||
mov byte[some_text],'0'
|
||
mov byte[some_text+1],0 ;⥪áâ á ç¨á«®¬ ¯®©¬ ëå ï¨æ
|
||
mov byte[count_last],0
|
||
mov dword[pos_eggs],0
|
||
mov byte[zaac_status],0
|
||
|
||
cmp dword[b],0
|
||
jne @f
|
||
mov byte[game_text+5],'€'
|
||
mov dword[game_spd],65 ;§ ¤¥à¦ª ¨£àë
|
||
jmp .end_init
|
||
@@:
|
||
mov byte[game_text+5],'<27>'
|
||
mov dword[game_spd],35 ;§ ¤¥à¦ª ¨£àë
|
||
.end_init:
|
||
|
||
push eax ebx
|
||
mcall 26,9
|
||
mov dword[rand_x],eax ;§ ¯®«ï¥¬ 1-¥ á«ãç ©®¥ ç¨á«®
|
||
pop ebx eax
|
||
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
proc LoadArrayBuffer, f_name:dword, buf_start:dword, count:dword
|
||
pushad
|
||
mov edx,dword[displ_bytes]
|
||
mov ecx,edx
|
||
imul ecx,dword[count]
|
||
mov eax,dword[f_name]
|
||
load_image_file eax,image_data_gray,ecx
|
||
mov edx,dword[displ_bytes]
|
||
mov eax,[image_data_gray]
|
||
mov edi,dword[buf_start]
|
||
mov ecx,dword[count]
|
||
cld
|
||
@@: ;áç¨âë¢ ¥¬ 3 ¡ãä¥à á ¤¥ª®à æ¨ï¬¨
|
||
stdcall CreateTrapharetBuffer,edi,eax
|
||
add eax,edx
|
||
add edi,BUF_STRUCT_SIZE
|
||
loop @b
|
||
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
popad
|
||
ret
|
||
endp
|
||
|
||
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 ;¯®«ãç ¥¬ á¨áâ¥¬ë¥ æ¢¥â
|
||
|
||
;à ¡®â á ä ©«®¬ áâ஥ª
|
||
copy_path ini_name,sys_path,file_name,0x0
|
||
stdcall dword[ini_get_int],file_name,ini_sec_files,key_displ_w,210
|
||
mov dword[displ_w],eax
|
||
stdcall dword[ini_get_int],file_name,ini_sec_files,key_displ_h,140
|
||
mov dword[displ_h],eax
|
||
stdcall dword[ini_get_color],file_name,ini_sec_color,key_color_unit,0
|
||
mov dword[color_wolf],eax
|
||
stdcall dword[ini_get_str],file_name,ini_sec_files,key_file_unit,fn_icon1,FILE_NAME_MAX,ini_def_unit_file
|
||
|
||
|
||
mov edx,dword[displ_w]
|
||
imul edx,dword[displ_h]
|
||
lea edx,[edx+edx*2]
|
||
mov dword[displ_bytes],edx ;¢ëç¨á«ï¥¬ à §¬¥à ¨£à®¢®£® ¯®«ï
|
||
|
||
stdcall LoadArrayBuffer, fn_icon0, buf_decor,3 ;áç¨âë¢ ¥¬ 3 ¡ãä¥à á ¤¥ª®à æ¨ï¬¨
|
||
stdcall LoadArrayBuffer, fn_icon1, buf_wolf,9 ;áç¨âë¢ ¥¬ 9 ¡ãä¥à®¢ á ¢®«ª®¬ ¨ § ©æ¥¬
|
||
stdcall LoadArrayBuffer, fn_icon2, buf_egg,22 ;áç¨âë¢ ¥¬ 22 ¡ãä¥à®¢ á ï©æ ¬¨
|
||
stdcall LoadArrayBuffer, fn_icon3, buf_chi,13 ;áç¨âë¢ ¥¬ 13 ¡ãä¥à®¢ á 樯«ïâ ¬¨
|
||
|
||
load_image_file fn_font, image_data_gray,IMAGE_FONT_SIZE
|
||
stdcall [buf2d_create_f_img], buf_font,[image_data_gray] ;ᮧ¤ ¥¬ ¡ãä¥à
|
||
stdcall mem.Free,[image_data_gray] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||
|
||
stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç®á⨠8 ¡¨â
|
||
stdcall [buf2d_convert_text_matrix], buf_font
|
||
|
||
;¯à®¢¥àª § ¨¬ ¥¬®£® ¡ãä¥à®¬ ¬¥áâ
|
||
;mov edi,buf_wolf
|
||
;add edi,BUF_STRUCT_SIZE ;¯¥à¥å®¤¨¬ ¡ãä¥à ª®à§¨ë
|
||
;stdcall [buf2d_clear],edi,0x808080 ;§ «¨¢ ¥¬ ¥£® á¥àë¬ æ¢¥â®¬
|
||
|
||
mov ebx,dword[displ_w]
|
||
mov edx,dword[displ_h]
|
||
|
||
mov edi,buf_displ
|
||
mov buf2d_w,ebx
|
||
mov buf2d_h,edx
|
||
stdcall [buf2d_create], buf_displ ;ᮧ¤ ¥¬ ¡ãä¥à ¤«ï ¢ë¢®¤ íªà
|
||
|
||
mov edi,buf_fon
|
||
mov buf2d_w,ebx
|
||
mov buf2d_h,edx
|
||
stdcall [buf2d_create], buf_fon ;ᮧ¤ ¥¬ ¡ãä¥à á ä®®¢ë¬¨ ¤¥ª®à æ¨ï¬¨
|
||
|
||
call InitBackgroundBuffer ;§ ¯®«ï¥¬ ¡ãä¥à á ä®®¢ë¬¨ ¤¥ª®à æ¨ï¬¨
|
||
stdcall InitGame,0
|
||
mcall 26,9
|
||
mov [last_time],ebx
|
||
|
||
|
||
|
||
align 4
|
||
red_win:
|
||
call draw_window
|
||
|
||
align 4
|
||
still: ;£« ¢ë© 横«
|
||
mcall 26,9
|
||
mov ebx,[last_time]
|
||
add ebx,dword[game_spd] ;delay
|
||
sub ebx,eax
|
||
cmp ebx,dword[game_spd] ;delay
|
||
ja it_is_time_now
|
||
test ebx,ebx
|
||
jz it_is_time_now
|
||
mcall 23
|
||
|
||
cmp eax,0
|
||
je it_is_time_now
|
||
|
||
;mcall 10
|
||
|
||
cmp al,0x1 ;¨§¬¥¨«®áì ¯®«®¦¥¨¥ ®ª
|
||
jz red_win
|
||
cmp al,0x2
|
||
jz key
|
||
cmp al,0x3
|
||
jz button
|
||
|
||
jmp still
|
||
|
||
align 4
|
||
it_is_time_now:
|
||
mcall 26,9
|
||
mov [last_time],eax
|
||
|
||
;...§¤¥áì ¨¤ãâ ¤¥©á⢨ï, ¢ë§ë¢ ¥¬ë¥ ª ¦¤ë¥ delay á®âëå ¤®«¥© ᥪã¤...
|
||
call MoveEggs
|
||
call draw_display
|
||
jmp still
|
||
|
||
align 4
|
||
key:
|
||
push eax ebx
|
||
mcall 2
|
||
|
||
cmp ah,176 ;Left
|
||
jne @f
|
||
and byte[pos_wolf],0xfe
|
||
@@:
|
||
cmp ah,179 ;Right
|
||
jne @f
|
||
or byte[pos_wolf],1
|
||
@@:
|
||
cmp ah,178 ;Up
|
||
jne @f
|
||
and byte[pos_wolf],0xff-2
|
||
@@:
|
||
cmp ah,177 ;Down
|
||
jne @f
|
||
or byte[pos_wolf],2
|
||
@@:
|
||
|
||
cmp ah,97 ;a
|
||
jne @f
|
||
and byte[pos_wolf],0xff-3 ;00
|
||
@@:
|
||
cmp ah,122 ;z
|
||
jne @f
|
||
and byte[pos_wolf],0xff-1
|
||
or byte[pos_wolf],2 ;10
|
||
@@:
|
||
cmp ah,39 ;'
|
||
jne @f
|
||
and byte[pos_wolf],0xff-2
|
||
or byte[pos_wolf],1 ;01
|
||
@@:
|
||
cmp ah,47 ;/
|
||
jne @f
|
||
or byte[pos_wolf],3 ;11
|
||
@@:
|
||
|
||
pop ebx eax
|
||
jmp still
|
||
|
||
|
||
align 4
|
||
draw_window:
|
||
pushad
|
||
mcall 12,1
|
||
|
||
xor eax,eax
|
||
mov ebx,20*65536+480
|
||
mov ecx,20*65536+270
|
||
mov edx,[sc.work]
|
||
;or edx,0x33000000
|
||
or edx,0x73000000
|
||
mov edi,hed
|
||
mcall ;ᮧ¤ ¨¥ ®ª
|
||
|
||
mcall 9,procinfo,-1
|
||
mov edi,buf_displ
|
||
mov eax,dword[procinfo.client_box.width]
|
||
cmp eax,dword[displ_w]
|
||
jle @f
|
||
sub eax,dword[displ_w]
|
||
shr eax,1
|
||
mov buf2d_l,ax ;¢ë¯à ¢¨¢ ¥¬ ¡ãä¥à ¯® æ¥âàã ®ª
|
||
@@:
|
||
|
||
call draw_display
|
||
|
||
mov eax,13 ;à¨á®¢ ¨¥ ¯àאַ㣮«ì¨ª
|
||
mov edx,[sc.work]
|
||
xor esi,esi
|
||
mov si,buf2d_l
|
||
add esi,dword[displ_w]
|
||
mov ebx,dword[procinfo.client_box.width]
|
||
inc ebx
|
||
cmp esi,ebx
|
||
jge @f
|
||
sub ebx,esi
|
||
rol ebx,16
|
||
mov bx,si
|
||
rol ebx,16
|
||
mov ecx,dword[procinfo.client_box.height]
|
||
inc ecx
|
||
int 0x40 ;à¨á®¢ ¨¥ ¯à ¢®£® ¡®ª®¢®£® ¯®«ï
|
||
jmp .draw_s
|
||
@@:
|
||
mov esi,dword[procinfo.client_box.width] ;ª®£¤ ¯® è¨à¨¥ ¥ ¢« §¨â
|
||
inc esi
|
||
.draw_s:
|
||
|
||
if use_but eq 1
|
||
; *** à¨á®¢ ¨¥ ª®¯®ª ***
|
||
push esi
|
||
mov eax,8
|
||
xor ebx,ebx
|
||
mov bx,buf2d_l
|
||
add ebx,buf2d_w
|
||
add ebx,BUT1_L
|
||
shl ebx,16
|
||
mov bx,BUT1_W
|
||
mov ecx,BUT1_T*65536+BUT1_H
|
||
mov edx,5
|
||
;or edx,0x40000000
|
||
mov esi,dword[color_but_sm]
|
||
int 0x40
|
||
|
||
inc edx
|
||
add ecx,BUT1_NEXT_TOP
|
||
int 0x40
|
||
pop esi
|
||
|
||
mov eax,4 ; ð¡R÷ÿ-ð? ¢?ò¡¢ÿ
|
||
mov bx,BUT1_H
|
||
add ebx,3*65536;+3
|
||
mov ecx,dword[color_but_te]
|
||
or ecx,0x80000000
|
||
mov edx,txt_game_a
|
||
int 0x40
|
||
|
||
ror ebx,16
|
||
add ebx,BUT1_NEXT_TOP
|
||
ror ebx,16
|
||
mov edx,txt_game_b
|
||
int 0x40
|
||
|
||
; *** ¢®ááâ ®¢«¥¨¥ ¯ à ¬¥â஢ ***
|
||
mov eax,13 ;à¨á®¢ ¨¥ ¯àאַ㣮«ì¨ª
|
||
mov edx,[sc.work]
|
||
end if
|
||
|
||
mov ebx,esi
|
||
mov ecx,dword[procinfo.client_box.height]
|
||
inc ecx
|
||
mov esi,dword[displ_h]
|
||
cmp esi,ebx
|
||
jge @f
|
||
sub ecx,esi
|
||
rol ecx,16
|
||
mov cx,si
|
||
rol ecx,16
|
||
int 0x40 ;à¨á®¢ ¨¥ ¨¦¥£® ¯®«ï
|
||
@@:
|
||
|
||
xor ebx,ebx
|
||
mov bx,buf2d_l
|
||
mov ecx,dword[displ_h]
|
||
int 0x40 ;à¨á®¢ ¨¥ «¥¢®£® ¡®ª®¢®£® ¯®«ï
|
||
|
||
mcall 12,2
|
||
popad
|
||
ret
|
||
|
||
align 4
|
||
draw_display:
|
||
|
||
stdcall mem_copy, dword[buf_fon],dword[buf_displ],315*210*3;dword[displ_bytes] ;ª®¯¨à®¢ ¨¥ ¨§®¡à ¦¥¨ï ¨§ ä®®¢®£® ¡ãä¥à
|
||
call DrawZaac ;à¨á㥬 § ©æ
|
||
call DrawWolf ;à¨á㥬 ¢®«ª
|
||
call DrawEggs ;à¨á㥬 ï©æ
|
||
|
||
push eax
|
||
mov eax,dword[displ_w]
|
||
shr eax,1
|
||
stdcall [buf2d_draw_text], buf_displ, buf_font,game_text,eax,OFFS_SHADOW_X,[color_curici] ;à¨á㥬 áâபã á ⥪á⮬
|
||
pop eax
|
||
stdcall [buf2d_draw], buf_displ
|
||
ret
|
||
|
||
align 4
|
||
button:
|
||
mcall 17 ;¯®«ãç¨âì ª®¤ ¦ ⮩ ª®¯ª¨
|
||
if use_but eq 1
|
||
cmp ah,5
|
||
jne @f
|
||
stdcall InitGame,0
|
||
@@:
|
||
cmp ah,6
|
||
jne @f
|
||
stdcall InitGame,1
|
||
@@: end if
|
||
cmp ah,1
|
||
jne still
|
||
.exit:
|
||
stdcall [buf2d_delete],buf_fon ;㤠«ï¥¬ ¡ãä¥à
|
||
stdcall [buf2d_delete],buf_displ ;㤠«ï¥¬ ¡ãä¥à
|
||
|
||
stdcall [buf2d_delete],buf_font
|
||
|
||
cld
|
||
mov ecx,3
|
||
mov edi,buf_decor
|
||
@@: ;㤠«ï¥¬ 3 ¡ãä¥à
|
||
stdcall [buf2d_delete],edi
|
||
add edi,BUF_STRUCT_SIZE
|
||
loop @b
|
||
mov ecx,9
|
||
mov edi,buf_wolf
|
||
@@: ;㤠«ï¥¬ 9 ¡ãä¥à®¢ á ¢®«ª®¬ ¨ § ©æ¥¬
|
||
stdcall [buf2d_delete],edi
|
||
add edi,BUF_STRUCT_SIZE
|
||
loop @b
|
||
mov ecx,13
|
||
mov edi,buf_chi
|
||
@@: ;㤠«ï¥¬ 13 ¡ãä¥à®¢
|
||
stdcall [buf2d_delete],edi
|
||
add edi,BUF_STRUCT_SIZE
|
||
loop @b
|
||
mov ecx,22
|
||
mov edi,buf_egg
|
||
@@: ;㤠«ï¥¬ 22 ¡ãä¥à
|
||
stdcall [buf2d_delete],edi
|
||
add edi,BUF_STRUCT_SIZE
|
||
loop @b
|
||
|
||
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
|
||
|
||
head_f_i:
|
||
head_f_l db '‘¨á⥬ ï ®è¨¡ª ',0
|
||
|
||
system_dir0 db '/sys/lib/'
|
||
name_buf2d db 'buf2d.obj',0
|
||
err_message_found_lib0 db '<27>¥ 㤠«®áì ©â¨ ¡¨¡«¨®â¥ªã buf2d.obj',0
|
||
err_message_import0 db 'Žè¨¡ª ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ buf2d.obj',0
|
||
|
||
system_dir1 db '/sys/lib/'
|
||
name_libimg db 'libimg.obj',0
|
||
err_message_found_lib1 db '<27>¥ 㤠«®áì ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
|
||
err_message_import1 db 'Žè¨¡ª ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
|
||
|
||
system_dir2 db '/sys/lib/'
|
||
libini_name db 'libini.obj',0
|
||
err_message_found_lib2 db '<27>¥ 㤠«®áì ©â¨ ¡¨¡«¨®â¥ªã libini.obj',0
|
||
err_message_import2 db 'Žè¨¡ª ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.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
|
||
load_lib_end:
|
||
|
||
align 4
|
||
proc mem_copy, source:dword, destination:dword, len:dword
|
||
push ecx esi edi
|
||
cld
|
||
mov esi, dword[source]
|
||
mov edi, dword[destination]
|
||
mov ecx, dword[len]
|
||
rep movsb
|
||
pop edi esi ecx
|
||
ret
|
||
endp
|
||
|
||
align 4
|
||
convert_to_str:
|
||
pushad
|
||
;mov eax,dword[value]
|
||
;mov edi,dword[text]
|
||
mov dword[edi+1],0
|
||
cld
|
||
call .str
|
||
popad
|
||
ret
|
||
|
||
|
||
align 4
|
||
.str:
|
||
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬ áç¨á«¥¨ï ¨§¬¥ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤ë¥ ¯ à ¬¥âàë eax - ç¨á«®
|
||
;¯à¥à¥¢®¤ ç¨á« ¢ ASCII áâப㠢§®¤ë¥ ¤ ë¥ ecx=á¨á⥬ áç¨á«¥ï edi ¤à¥á ªã¤ § ¯¨áë¢ âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®¥æ ¯¥à¥¬¥®©
|
||
cmp eax,ecx ;áà ¢¨âì ¥á«¨ ¢ eax ¬¥ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ @@-1 â.¥. pop eax
|
||
jb @f
|
||
xor edx,edx ;®ç¨áâ¨âì edx
|
||
div ecx ;à §¤¥«¨âì - ®áâ ⮪ ¢ edx
|
||
push edx ;¯®«®¦¨âì ¢ á⥪
|
||
;dec edi ;ᬥ饨¥ ¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®æ áâப¨
|
||
call .str;¯¥à¥©â¨ á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥â ¯®ª ¢ eax ¥ á⠥⠬¥ìè¥ ç¥¬ ¢ ecx
|
||
pop eax
|
||
@@: ;cmp al,10 ;¯à®¢¥à¨âì ¥ ¬¥ìè¥ «¨ § 票¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥ï 10 ¤ ï ª®¬ ¤ - «¨è ï))
|
||
;sbb al,$69 ;- ç¥áâ® ¤ ï ¨áâàãªæ¨ï ¬¥ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ¥ § î ª ª íâ® à ¡®â ¥â
|
||
;das ;¯®á«¥ ¤ ®© ª®¬ ¤ë ª ª ¡ë ¯à®¨á室¨â 㬥ì襨¥ al 66h (¢ ª¨£¥ ¯¨á ® ¤à㣮¥)
|
||
or al,0x30 ;¤ ï ª®¬ ¤ ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
|
||
stosb ;§ ¯¨á âì í«¥¬¥â ¨§ ॣ¨áâà al ¢ ï祪㠯 ¬ï⨠es:edi
|
||
ret ;¢¥àãâìáï ç¥ì ¨â¥à¥áë© å®¤ â.ª. ¯®ª ¢ á⥪¥ åà ¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
|
||
|
||
|
||
last_time dd ?
|
||
image_data dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ¨ï ª à⨪¨ äãªæ¨ï¬¨ libimg
|
||
image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥ë¬¨ á¥à묨 ¨§®¡à ¦¥¨ï¬¨ ¢ ä®à¬ ⥠24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
|
||
|
||
run_file_70 FileInfoBlock
|
||
hed db 'Nu pogodi 03.08.10',0 ;¯®¤¯¨áì ®ª
|
||
sc system_colors ;á¨áâ¥¬ë¥ æ¢¥â
|
||
|
||
align 4
|
||
buf_font: ;¡ãä¥à á® èà¨ä⮬
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 25 ;+4 left
|
||
dw 25 ;+6 top
|
||
dd 128 ;+8 w
|
||
dd 144 ;+12 h
|
||
dd 0 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_displ:
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 25,0
|
||
dd ? ;+8 w
|
||
dd ? ;+12 h
|
||
dd 0 ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_fon: ;ä®®¢ë© ¡ãä¥à
|
||
dd 0 ;㪠§ â¥«ì ¡ãä¥à ¨§®¡à ¦¥¨ï
|
||
dw 0 ;+4 left
|
||
dw 0 ;+6 top
|
||
dd ? ;+8 w
|
||
dd ? ;+12 h
|
||
dd 0xffffff ;+16 color
|
||
db 24 ;+20 bit in pixel
|
||
|
||
align 4
|
||
buf_decor: ;¡ãä¥à á ¤¥ª®à æ¨ï¬¨: ¤®¬¨ª ¬¨ ¨ ३ª ¬¨; á ªãà¨æ ¬¨; á à á⥨ﬨ
|
||
rb 3*BUF_STRUCT_SIZE
|
||
|
||
align 4
|
||
buf_wolf:
|
||
rb 9*BUF_STRUCT_SIZE
|
||
|
||
align 4
|
||
buf_egg:
|
||
rb 22*BUF_STRUCT_SIZE
|
||
|
||
align 4
|
||
buf_chi:
|
||
rb 13*BUF_STRUCT_SIZE
|
||
|
||
|
||
|
||
align 4
|
||
libini_import:
|
||
dd alib_init0
|
||
ini_get_str dd aini_get_str
|
||
ini_get_int dd aini_get_int
|
||
ini_get_color dd aini_get_color
|
||
dd 0,0
|
||
alib_init0 db 'lib_init',0
|
||
aini_get_str db 'ini_get_str',0
|
||
aini_get_int db 'ini_get_int',0
|
||
aini_get_color db 'ini_get_color',0
|
||
|
||
align 4
|
||
import_libimg:
|
||
dd alib_init1
|
||
img_is_img dd aimg_is_img
|
||
img_info dd aimg_info
|
||
img_from_file dd aimg_from_file
|
||
img_to_file dd aimg_to_file
|
||
img_from_rgb dd aimg_from_rgb
|
||
img_to_rgb dd aimg_to_rgb
|
||
img_to_rgb2 dd aimg_to_rgb2
|
||
img_decode dd aimg_decode
|
||
img_encode dd aimg_encode
|
||
img_create dd aimg_create
|
||
img_destroy dd aimg_destroy
|
||
img_destroy_layer dd aimg_destroy_layer
|
||
img_count dd aimg_count
|
||
img_lock_bits dd aimg_lock_bits
|
||
img_unlock_bits dd aimg_unlock_bits
|
||
img_flip dd aimg_flip
|
||
img_flip_layer dd aimg_flip_layer
|
||
img_rotate dd aimg_rotate
|
||
img_rotate_layer dd aimg_rotate_layer
|
||
img_draw dd aimg_draw
|
||
|
||
dd 0,0
|
||
alib_init1 db 'lib_init',0
|
||
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª ᤥ« âì ¨§ ¨å ¨§®¡à ¦¥¨¥
|
||
aimg_info db 'img_info',0
|
||
aimg_from_file db 'img_from_file',0
|
||
aimg_to_file db 'img_to_file',0
|
||
aimg_from_rgb db 'img_from_rgb',0
|
||
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ¨¥ ¨§®¡à ¦¥¨ï ¢ ¤ ë¥ RGB
|
||
aimg_to_rgb2 db 'img_to_rgb2',0
|
||
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ëå
|
||
aimg_encode db 'img_encode',0
|
||
aimg_create db 'img_create',0
|
||
aimg_destroy db 'img_destroy',0
|
||
aimg_destroy_layer db 'img_destroy_layer',0
|
||
aimg_count db 'img_count',0
|
||
aimg_lock_bits db 'img_lock_bits',0
|
||
aimg_unlock_bits db 'img_unlock_bits',0
|
||
aimg_flip db 'img_flip',0
|
||
aimg_flip_layer db 'img_flip_layer',0
|
||
aimg_rotate db 'img_rotate',0
|
||
aimg_rotate_layer db 'img_rotate_layer',0
|
||
aimg_draw db 'img_draw',0
|
||
|
||
align 4
|
||
import_buf2d_lib:
|
||
dd sz_lib_init
|
||
buf2d_create dd sz_buf2d_create
|
||
buf2d_create_f_img dd sz_buf2d_create_f_img
|
||
buf2d_clear dd sz_buf2d_clear
|
||
buf2d_draw dd sz_buf2d_draw
|
||
buf2d_delete dd sz_buf2d_delete
|
||
buf2d_line dd sz_buf2d_line
|
||
buf2d_circle dd sz_buf2d_circle
|
||
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
|
||
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
|
||
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
|
||
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
|
||
buf2d_bit_blt dd sz_buf2d_bit_blt
|
||
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
|
||
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
|
||
buf2d_cruve_bezier dd sz_buf2d_cruve_bezier
|
||
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
|
||
buf2d_draw_text dd sz_buf2d_draw_text
|
||
buf2d_crop_color dd sz_buf2d_crop_color
|
||
buf2d_offset_h dd sz_buf2d_offset_h
|
||
dd 0,0
|
||
sz_lib_init db 'lib_init',0
|
||
sz_buf2d_create db 'buf2d_create',0
|
||
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
|
||
sz_buf2d_clear db 'buf2d_clear',0
|
||
sz_buf2d_draw db 'buf2d_draw',0
|
||
sz_buf2d_delete db 'buf2d_delete',0
|
||
sz_buf2d_line db 'buf2d_line',0
|
||
sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮áâ¨
|
||
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
|
||
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
|
||
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
|
||
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
|
||
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
|
||
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
|
||
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
|
||
sz_buf2d_cruve_bezier db 'buf2d_cruve_bezier',0
|
||
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
|
||
sz_buf2d_draw_text db 'buf2d_draw_text',0
|
||
sz_buf2d_crop_color db 'buf2d_crop_color',0
|
||
sz_buf2d_offset_h db 'buf2d_offset_h',0
|
||
|
||
i_end:
|
||
rb 1024
|
||
align 16
|
||
procinfo process_information
|
||
stacktop:
|
||
sys_path rb 4096
|
||
file_name:
|
||
rb 4096
|
||
plugin_path:
|
||
rb 4096
|
||
openfile_path:
|
||
rb 4096
|
||
filename_area:
|
||
rb 256
|
||
mem: |