From 251d03d5f0aa8e0e8031df3290d98648b52d54df Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 3 Nov 2021 18:23:06 +0000 Subject: [PATCH] Upload optimized Phoenix and ASCL by Kolibrius git-svn-id: svn://kolibrios.org@9241 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/phenix/trunk/ascgl.inc | 1131 +++++------ programs/games/phenix/trunk/ascgml.inc | 78 +- programs/games/phenix/trunk/ascguil.inc | 120 ++ programs/games/phenix/trunk/ascl.inc | 1327 +++++------- programs/games/phenix/trunk/ascpoal.inc | 161 ++ programs/games/phenix/trunk/objects.gif | Bin 0 -> 1052 bytes programs/games/phenix/trunk/phenix.asm | 2438 +++++++++++------------ programs/games/phenix/trunk/phenix.gif | Bin 10732 -> 9444 bytes programs/games/phenix/trunk/star2.gif | Bin 1346 -> 0 bytes 9 files changed, 2545 insertions(+), 2710 deletions(-) create mode 100644 programs/games/phenix/trunk/ascguil.inc create mode 100644 programs/games/phenix/trunk/ascpoal.inc create mode 100644 programs/games/phenix/trunk/objects.gif delete mode 100644 programs/games/phenix/trunk/star2.gif diff --git a/programs/games/phenix/trunk/ascgl.inc b/programs/games/phenix/trunk/ascgl.inc index 5a5b06aeb7..79f36526b3 100644 --- a/programs/games/phenix/trunk/ascgl.inc +++ b/programs/games/phenix/trunk/ascgl.inc @@ -7,28 +7,160 @@ lang equ ru ; Graphics ; Libary ; -; Ver 0.18 By Pavlushin Evgeni (RUSSIA) -; www.waptap@mail.ru +; Ver 0.18 +; -;InfoList -;0.01 LoadImage -;0.02 SetBmp -;0.03 Bmptoimg, Setimg ~01.03.2004 -;0.04 Bug deleted, copyimg ~03.05.2004 -;0.05 fullimg, collimg ~05.05.2004 -;0.06 getimg ~09.05.2004 -;0.07 convbmp ~13.05.2004 -;0.08 fps ~14.05.2004 -;0.09 drawfbox ~03.06.2004 -;0.10 all macros optimized by halyavin, add at ~07.06.2004 -;0.11 many macros optimized by halyavin, add at ~30.08.2004 -;0.12 bmptoimg ~07.09.2004 -;0.13 imgtoimg ~08.09.2004 -;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 -;0.15 giftoimg, giftoani ~10.09.2004 -;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 -;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 -;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 +; draw image into image with alpha color mask +; image_draw_acimage dest, source, x, y, alpha_color +; +macro image_draw_acimage dest, source, x, y, alpha_color +{ +local next_pix,next_line,skip_pix,no_skip + push dest + push source + push x + push y + push alpha_color + pop ebp ; alpha color + pop eax ; y + pop ebx ; x + pop esi ; src + pop edi ; dest + call image_draw_acimage_proc + +if ~ defined image_draw_acimage_used +image_draw_acimage_used equ 1 + + jmp end_image_draw_acimage_proc +image_draw_acimage_proc: + mov ecx,dword [edi] ; ecx = canvas width + mul ecx ; edx:eax = ypos * canvas width + add eax,ebx ; eax = (ypos * canvas width) + xpos + lea eax,[eax+eax*2+8] ; eax=(y*xsize+x)*3+8 (8=skip xy size dwords) + + mov edx,[esi] ; edx = img width + sub ecx,edx ; ecx = canvas width - img width + lea ebx,[ecx*2+ecx] ; ebx = how many pixels skip for new line + mov ecx,[esi+4] ; ecx = img height + add esi,8 ; esi + 8 for skip xy size dwords + add edi,eax ; edi = dest position + shl ebp,8 ; for fast compare with alpha color + cld ; set movs direction flag +next_line: + push edx +next_pix: + mov eax,[esi] + shl eax,8 + cmp eax,ebp + je skip_pix + movsw + movsb + jmp no_skip +skip_pix: + add esi,3 + add edi,3 +no_skip: + dec edx + jnz next_pix + pop edx + add edi,ebx + dec ecx + jnz next_line + ret +end_image_draw_acimage_proc : +end if + +} + +macro image_set_size image,width,height +{ + mov dword [image],width + mov dword [image+4],height +} + +; label - draw label on window +; example: +; label 10,12,'Hello World!',cl_Green+font_size_x4+utf16 + +macro image_draw_label image,x,y,text,color +{ +local label_text + draw_to_buffer equ 00001000b shl 24 + jmp @f +label_text db text +@@: + words2reg ebx,x,y ; ebx - position + dword2reg ecx,color+draw_to_buffer ; ecx - color + mov edi,image + mov edx,label_text ; edx - address of label text + mov esi,@b-label_text ; esi - size of libel in bytes + mov eax,4 + mcall +} + +; draw_frect - draw filled rect +macro draw_frect x,y,xs,ys,color +{ + wordstoreg ebx,x,xs ;x*65536+xs + wordstoreg ecx,y,ys ;y*65536+ys + mov edx,color + mov eax,13 + mcall +} + +; draw_label - Draw label in window +; example: +; draw_label 10,12,'Hello World!',cl_Green+font_size_x4+utf16 + +macro draw_label x,y,text,color +{ +local label_text + words2reg ebx,x,y ; ebx - position +if text eqtype 123 | text eqtype eax + movt edx,text + mov ecx,color+(1 shl 31) ; ecx - color +else + mov edx,label_text ; edx - address of label text + jmp @f +label_text db text +@@: + mov esi,@b-label_text ; esi - size of libel in bytes + movt ecx,color ; ecx - color +end if + mov eax,4 + mcall +} + +hide_zeros equ (1 shl 31) +use_bg_color equ (1 shl 30) +use_big_font equ (1 shl 28) + +macro draw_number data, x, y, color, numtype, bg_color +{ + movt ecx,data + movt ebx,numtype + mov bl,0 ; if bl = 0, ecx is contain number + words2reg edx,x,y +if bg_color eq + movt esi,color +else + movt esi,color+use_bg_color + movt edi,bg_color +end if + mov eax,47 + mcall +} + +; draw_image - macro for draw image on window area +macro draw_image x, y, image +{ + mov ecx,[image-2] ; -2 for except shl ecx,16 + mov cx,[image+4] ; ecx = xsize*65536+ysize + wordstoreg edx, x, y ; edx = x*65536+y + lea ebx,[image+8] ; ebx = image data address + mov eax,7 ; eax = 7 is draw image function + mcall +} aframetoimg_use_count=0 macro aframetoimg img, x, y, canvas,acol @@ -37,92 +169,91 @@ local loo,loo2,acolor aframetoimg_use_count=aframetoimg_use_count+1 if aframetoimg_use_count = 1 - jmp end_aframetoimg_proc + jmp end_aframetoimg_proc acolor dd 0 aframetoimg_proc: ;getout coord - mov [acolor],ebp + mov [acolor],ebp - mov edx,ebx ;img ;xsize - movzx eax,word [edx] - add eax,esi ;y cor + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor ; mov eax,esi ;y cor - mul dword [ecx] ;canvas xsize - add eax,edi ;x cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor - mov ebp,ebx ;img ;xsize - movzx edx,word [ebp] - add eax,edx + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx - mov ebp,eax - shl eax,1 - add ebp,eax - add ebp,ecx ;canvas+8;start - add ebp,8 + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 ;get img size - add ebx,4 - mov eax,ebx ;img ;xsize - movzx esi,word [eax] - movzx edi,word [eax+2] - add ebx,4 - mov edx,ebx ;img+8 + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 loo2: push esi loo: ;test on alpha color - mov eax,[edx] - shl eax,8 - shr eax,8 - cmp eax,[acolor] - jne yx - add edx,3 - add ebp,3 - jmp nx + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx yx: - - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx nx: - dec esi - jnz loo + dec esi + jnz loo pop esi - sub ebp,3 - mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) - sub eax,esi - add ebp,eax - shl eax,1 - add ebp,eax + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax - add ebp,3 + add ebp,3 - dec edi - jnz loo2 - ret + dec edi + jnz loo2 + ret end_aframetoimg_proc: end if - push img - push canvas - push x - push y - push acol - pop ebp - pop esi - pop edi - pop ecx - pop ebx - call aframetoimg_proc + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aframetoimg_proc } frametoimg_use_count=0 @@ -132,170 +263,79 @@ local loo,loo2 frametoimg_use_count=frametoimg_use_count+1 if frametoimg_use_count = 1 - jmp end_frametoimg_proc + jmp end_frametoimg_proc frametoimg_proc: ;getout coord - mov edx,ebx ;img ;xsize - movzx eax,word [edx] - add eax,esi ;y cor + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor ; mov eax,esi ;y cor - mul dword [ecx] ;canvas xsize - add eax,edi ;x cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor - mov ebp,ebx ;img ;xsize - movzx edx,word [ebp] - add eax,edx + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx - mov ebp,eax - shl eax,1 - add ebp,eax - add ebp,ecx ;canvas+8;start - add ebp,8 + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 ;get img size - add ebx,4 - mov eax,ebx ;img ;xsize - movzx esi,word [eax] - movzx edi,word [eax+2] - add ebx,4 - mov edx,ebx ;img+8 + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 loo2: push esi loo: - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx - dec esi - jnz loo + dec esi + jnz loo pop esi - sub ebp,3 - mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) - sub eax,esi - add ebp,eax - shl eax,1 - add ebp,eax + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax - add ebp,3 + add ebp,3 - dec edi - jnz loo2 - ret + dec edi + jnz loo2 + ret end_frametoimg_proc: end if - push img - push canvas - push x - push y - pop esi - pop edi - pop ecx - pop ebx - call frametoimg_proc + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call frametoimg_proc } -aimgtoimg_use_count=0 -macro aimgtoimg img, x, y, canvas,acol -{ -local loo,loo2,acolor -aimgtoimg_use_count=aimgtoimg_use_count+1 -if aimgtoimg_use_count = 1 - - jmp end_aimgtoimg_proc - -acolor dd 0 -aimgtoimg_proc: -;getout coord - mov [acolor],ebp - - mov eax,esi ;y cor - mul dword [ecx] ;canvas xsize - add eax,edi ;x cor - mov ebp,eax - shl eax,1 - add ebp,eax - add ebp,ecx ;canvas+8;start - add ebp,8 -;get img size - mov eax,ebx ;img ;xsize - mov esi,[eax] - add ebx,4 - mov eax,ebx ; img+4 ;ysize - mov edi,[eax] - add ebx,4 - mov edx,ebx ;img+8 -loo2: -push esi -loo: - -;test on alpha color - mov eax,[edx] - shl eax,8 - shr eax,8 - cmp eax,[acolor] - jne yx - add edx,3 - add ebp,3 - jmp nx -yx: - - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx -nx: - dec esi - jnz loo -pop esi - sub ebp,3 - mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) - sub eax,esi - add ebp,eax - shl eax,1 - add ebp,eax - - add ebp,3 - - dec edi - jnz loo2 - ret -end_aimgtoimg_proc: -end if - push img - push canvas - push x - push y - push acol - pop ebp - pop esi - pop edi - pop ecx - pop ebx - call aimgtoimg_proc -} - - - - imgtoimg_use_count=0 macro imgtoimg img, x, y, canvas { @@ -303,77 +343,64 @@ local loo,loo2 imgtoimg_use_count=imgtoimg_use_count+1 if imgtoimg_use_count = 1 - jmp end_imgtoimg_proc + jmp end_imgtoimg_proc imgtoimg_proc: ;getout coord - mov eax,esi ;y cor - mul dword [ecx] ;canvas xsize - add eax,edi ;x cor - mov ebp,eax - shl eax,1 - add ebp,eax - add ebp,ecx ;canvas+8;start - add ebp,8 + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 ;get img size - mov eax,ebx ;img ;xsize - mov esi,[eax] - add ebx,4 - mov eax,ebx ; img+4 ;ysize - mov edi,[eax] - add ebx,4 - mov edx,ebx ;img+8 + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 loo2: push esi loo: - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - mov al,byte [edx] - mov byte [ebp],al - inc ebp - inc edx - dec esi - jnz loo + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + dec esi + jnz loo pop esi - sub ebp,3 - mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) - sub eax,esi - add ebp,eax - shl eax,1 - add ebp,eax - - add ebp,3 - - dec edi - jnz loo2 - ret + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + add ebp,3 + dec edi + jnz loo2 + ret end_imgtoimg_proc: end if - push img - push canvas - push x - push y - pop esi - pop edi - pop ecx - pop ebx - call imgtoimg_proc -} - - -;DrawBox -macro drawfbox x,y,xs,ys,color -{ - wordstoreg ebx,x,xs ;x*65536+xs - wordstoreg ecx,y,ys ;y*65536+ys - mov edx,color - mov eax,13 - mcall + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call imgtoimg_proc } ; FPS - Set Frame Per Second Display @@ -382,232 +409,159 @@ macro fps x,y,color,delcolor { local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt local no_out_fps - jmp spdat + jmp spdat savetime dd 0 fps_cntr dd 0 fps dd 0 ttt dd 0 spdat: get_time: - mov eax,3 - mcall - cmp eax,[savetime] - jne new_time - inc [fps_cntr] - cmp dword [ttt],0 - je out_fps - dec dword [ttt] - jmp no_out_fps + mov eax,3 + mcall + cmp eax,[savetime] + jne new_time + inc [fps_cntr] + cmp dword [ttt],0 + je out_fps + dec dword [ttt] + jmp no_out_fps new_time: - mov [savetime],eax - mov ebx,[fps_cntr] - mov [fps],ebx - mov [fps_cntr],0 + mov [savetime],eax + mov ebx,[fps_cntr] + mov [fps],ebx + mov [fps_cntr],0 out_fps: if ~(delcolor eq ) - mov ebx,x*65536+30 - mov ecx,y*65536+7 - mov edx,delcolor - mov eax,13 - mcall + mov ebx,x*65536+30 + mov ecx,y*65536+7 + mov edx,delcolor + mov eax,13 + mcall end if - mov dword [ttt],fps_show_frequency - mov eax,47 - mov ebx,5*65536 -; mov bl,0 - mov edx,x*65536+y - mov esi,color - mov ecx,[fps] - mcall + mov dword [ttt],fps_show_frequency + mov eax,47 + mov ebx,5*65536 + ; mov bl,0 + mov edx,x*65536+y + mov esi,color + mov ecx,[fps] + mcall no_out_fps: } -; COLLIMG - Collusion image's -_1dbounce_count=0; -macro collimg img1_off,x1,y1,img2_off,x2,y2,otv -{ -local bounce,exit,anot,bc,nbc - mov esi,[img1_off] ;xs1 - mov edi,[img2_off] ;ys2 - mov eax,x1 ; - mov ebx,x2 ; - call _1dbounce - mov edx,ecx - mov esi,[img1_off+4] ;ys1 - mov edi,[img2_off+4] ;ys2 - mov eax,y1 ; - mov ebx,y2 ; - call _1dbounce - add edx,ecx - cmp edx,2 - je bounce - mov otv,0 - jmp exit -_1dbounce_count=_1dbounce_count+1 -if _1dbounce_count = 1 -_1dbounce: - cmp ebx,eax - jb anot - add eax,esi - cmp eax,ebx - jbe nbc -bc: - mov ecx,1 - ret -anot: - add ebx,edi - cmp ebx,eax - ja bc -nbc: - xor ecx,ecx - ret -end if -bounce: - mov otv,1 -exit: -} - macro rgbtobgr image { -local loo - mov eax,[image] - mul dword [image+4] - mov ecx,eax - mov esi,image+8 -; add esi,8 -loo: + mov eax,[image] + mul dword [image+4] + mov ecx,eax + mov esi,image+8 +@@: mov al,[esi] mov bl,[esi+2] mov [esi],bl mov [esi+2],al add esi,3 dec ecx - jnz loo -} - - -macro setimg x , y ,arg3 -{ - mov eax,7 - mov ebx,arg3 - add ebx,8 - mov cx,[arg3] - shl ecx,16 - add cx,[arg3+4] -; wordstoreg ecx,[arg3],[arg3+4] - wordstoreg edx, x , y ;arg1*65536+arg2 - mcall + jnz @b } macro setframe x , y ,arg3 { - mov eax,7 - mov ebx,arg3 - add ebx,8 - wordstoreg edx, x , y ;arg1*65536+arg2 - add edx,dword [arg3] - mov ecx,dword [arg3+4] - mcall + mov eax,7 + mov ebx,arg3 + add ebx,8 + wordstoreg edx, x , y ;arg1*65536+arg2 + add edx,dword [arg3] + mov ecx,dword [arg3+4] + mcall } macro getimg imgsrc,x,y,xs,ys,imgdest { -local cyc -if xs eqtype 0 - mov dword [imgdest],xs +local next_pixel,next_line +; store image size +if xs eqtype 0 | xs eqtype eax + mov dword [imgdest],xs else - mov eax,xs - mov dword [imgdest],eax + mov eax,xs + mov dword [imgdest],eax end if -if ys eqtype 0 - mov dword [imgdest+4],ys +if ys eqtype 0 | ys eqtype eax + mov dword [imgdest+4],ys else - mov eax,ys - mov dword [imgdest+4],eax + ;push ys + ;pop dword [imgdest+4] + mov eax,ys + mov dword [imgdest+4],eax end if - mov eax,dword [imgsrc] ;getx size -; lea ecx,[eax+2*eax] - mov ecx,eax - shl ecx,1 - add ecx,eax + lea edi,[8+imgdest] ; edi = destinaton address + mov eax,dword [imgsrc] ; eax = xsize of source image in pixels + push eax ; store eax before mul operation + mov edx,y + mul edx ; edx:eax = eax*edx + add eax,x + lea esi,[imgsrc+8+eax+2*eax] ; esi = start offset on img src + pop eax ; restore eax + sub eax,xs ; eax = src image xsize - crop fragment xsize + lea eax,[eax+eax*2] ; eax = eax * 3 (bytes per pixel) - mov ebx,y - mul ebx - add eax,x - mov edx,ecx - lea eax,[eax+2*eax] ;eax=offset on imsrc -; mov ebp,eax -; shl eax,1 -; add eax,ebp - - mov ecx,xs - mov ebx,ys - - mov edi,8+imgdest - lea esi,[eax+8+imgsrc] -; mov esi,eax -; add esi,8 -; add esi,imgsrc - - cld -cyc: - movsw - movsb - dec ecx - jne cyc - add esi,edx - mov ecx,xs - sub esi,ecx - sub esi,ecx - sub esi,ecx - dec ebx - jne cyc + ; this loop used esi,edi,ecx,edx,eax registers + mov edx,ys ; edx = ysize in pixels + cld ; set direction +next_line: + mov ecx,xs ; ecx = xsize in pixels +next_pixel: + movsw + movsb ; write 3 bytes pixel + dec ecx + jnz next_pixel + add esi,eax + dec edx + jnz next_line } macro copyimg img2_off,img1_off { - mov eax,dword [img1_off] - mov ebx,dword [img1_off+4] - mul ebx - lea ecx,[eax+2*eax] - lea esi,[img1_off+8] - lea edi,[img2_off+8] - cld - rep movsb + mov eax,dword [img1_off] + mov ebx,dword [img1_off+4] + mul ebx + lea ecx,[eax+2*eax] + lea esi,[img1_off+8] + lea edi,[img2_off+8] + cld + rep movsb } macro fullimg img_off,xs,ys,color { local cop - mov eax,xs - mov ebx,ys - mov dword [img_off],eax - mov dword [img_off+4],ebx - mul ebx - lea ebp,[eax+2*eax] - mov esi,color + mov eax,xs + mov ebx,ys + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ebp,[eax+2*eax] + mov esi,color if color eqtype 0 - mov ecx,color/65536 + mov ecx,color/65536 else - mov ecx,esi - shr ecx,16 + mov ecx,esi + shr ecx,16 end if - xor edi,edi + xor edi,edi cop: - mov word [img_off+8+edi],si - add edi,2 - mov byte [img_off+8+edi],cl - inc edi - cmp edi,ebp - jne cop + mov word [img_off+8+edi],si + add edi,2 + mov byte [img_off+8+edi],cl + inc edi + cmp edi,ebp + jne cop } - - - ; number of frame in ecx - ; callculatin offset of raw data +; number of frame in ecx +; callculatin offset of raw data macro getframeoff num_of_frame,offset_of_animation,offset_of_frame { @@ -630,12 +584,10 @@ setpic: mov dword offset_of_frame,esi } - ; BMPTOIMG -Convert BMP format TO IMG format ; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset ; (SAMPLE) View BMPLS.ASM sample. -; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits - +; ( NOTE ) This is macro is not brake bmp structure! Tested in 32,8,4 bits bmptoimg_data_area_count=0 macro bmptoimg bmp_load_area,img_dest_area @@ -646,132 +598,125 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize ;local qwe,bmpfn ; convert: - movzx eax,word [bmp_load_area+28] - mul dword [bmp_load_area+18] - add eax,31 - shr eax,5 - mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string - shl eax,2 - mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + add eax,31 + shr eax,5 + mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string - cmp dword [bmp_load_area+34],0 - jne yespicsize ;if picture size is defined - mul dword [bmp_load_area+22] - mov dword [bmp_load_area+34],eax + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax - yespicsize: - mov ebp,img_dest_area+8 +yespicsize: + mov ebp,img_dest_area+8 - mov eax,bmp_load_area - mov ebx,eax - add ebx, [bmp_load_area+2];file size - inc ebx - mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing + mov eax,bmp_load_area + mov ebx,eax + add ebx, [bmp_load_area+2];file size + inc ebx + mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing - add eax, [bmp_load_area+10] - mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file - add eax, [bmp_load_area+34] - mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file - mov eax, [bmp_load_area+18] - lea eax,[eax+2*eax] ;3x pixels in eax + add eax, [bmp_load_area+10] + mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + lea eax,[eax+2*eax] ;3x pixels in eax - mov edi,dword [bmptoimg_soi] ;initializing - mov esi,dword [bmptoimg_data_area_eop] - sub esi,dword [bmptoimg_data_area_bps] + mov edi,dword [bmptoimg_soi] ;initializing + mov esi,dword [bmptoimg_data_area_eop] + sub esi,dword [bmptoimg_data_area_bps] - nextstring: - push edi - push ebp - cmp word [bmp_load_area+28],24 - jne convertno32 +nextstring: + push edi + push ebp + cmp word [bmp_load_area+28],24 + jne convertno32 - mov edi,ebp - mov ecx,[bmptoimg_data_area_dwps] - cld - rep movsd + mov edi,ebp + mov ecx,[bmptoimg_data_area_dwps] + cld + rep movsd - convert1: - pop ebp - pop edi - sub esi,dword [bmptoimg_data_area_bps] - sub esi,dword [bmptoimg_data_area_bps] - cmp esi,dword [bmptoimg_data_area_sop] - jb end_bmp - add edi,eax - add ebp,eax - jmp nextstring +convert1: + pop ebp + pop edi + sub esi,dword [bmptoimg_data_area_bps] + sub esi,dword [bmptoimg_data_area_bps] + cmp esi,dword [bmptoimg_data_area_sop] + jb end_bmp + add edi,eax + add ebp,eax + jmp nextstring - convertno32: - mov ebx,bmp_load_area - add ebx, [bmp_load_area+14] - add ebx,14 ;start of color table - push esi - add esi,dword [bmptoimg_data_area_bps] - mov dword [bmptoimg_data_area_eos],esi - pop esi - nextelem: - push eax - movzx eax,byte [esi] - cmp word [bmp_load_area+28],4 - je convert4bpp - cmp word [bmp_load_area+28],1 - je convert1bpp - call converttable +convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bmptoimg_data_area_bps] + mov dword [bmptoimg_data_area_eos],esi + pop esi +nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable - convert2: - pop eax - inc esi - cmp esi,dword [bmptoimg_data_area_eos] - jae convert1 - add edi,3 +convert2: + pop eax + inc esi + cmp esi,dword [bmptoimg_data_area_eos] + jae convert1 + add edi,3 + add ebp,3 + jmp nextelem - add ebp,3 +convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + add ebp,3 + pop ax + movzx eax,al + call converttable + jmp convert2 - jmp nextelem - - convert4bpp: - shl ax,4 - shr al,4 - push ax - movzx eax,ah - call converttable - add edi,3 - - add ebp,3 - - pop ax - movzx eax,al - call converttable - jmp convert2 - - convert1bpp: - mov ecx,eax - mov edx,7 - nextbit: - xor eax,eax - bt ecx,edx - jnc noaddelem - inc eax - noaddelem: - push edx - call converttable - pop edx - dec edx - js convert2 - add edi,3 - - add ebp,3 - - jmp nextbit - - converttable: - shl eax,2 - add eax,ebx - mov edx, dword [eax] -; mov dword [edi],edx - mov [ebp],edx - ret +convert1bpp: + mov ecx,eax + mov edx,7 +nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax +noaddelem: + push edx + call converttable + pop edx + dec edx + js convert2 + add edi,3 + add ebp,3 + jmp nextbit +converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] + ; mov dword [edi],edx + mov [ebp],edx + ret bmptoimg_data_area_count=bmptoimg_data_area_count+1 if bmptoimg_data_area_count = 1 @@ -785,10 +730,10 @@ bmptoimg_data_area_eos dd 0 end if end_bmp: - mov eax,dword [bmp_load_area+18] - mov ebx,dword [bmp_load_area+22] - mov dword [img_dest_area],eax - mov dword [img_dest_area+4],ebx + mov eax,dword [bmp_load_area+18] + mov ebx,dword [bmp_load_area+22] + mov dword [img_dest_area],eax + mov dword [img_dest_area+4],ebx } if used ReadGIF @@ -800,9 +745,9 @@ end if macro giftoani gifsrc,imgsrc,num_of_frames { gif_img_count = num_of_frames - mov esi, gifsrc - mov edi, imgsrc - call ReadGIF + mov esi, gifsrc + mov edi, imgsrc + call ReadGIF } macro giftoimg gifsrc,imgsrc @@ -810,7 +755,7 @@ macro giftoimg gifsrc,imgsrc if defined gif_img_count error 'giftoimg cannot be used in GIF multiple images mode. Use giftoani instead.' end if - mov esi, gifsrc - mov edi, imgsrc - call ReadGIF + mov esi, gifsrc + mov edi, imgsrc + call ReadGIF } diff --git a/programs/games/phenix/trunk/ascgml.inc b/programs/games/phenix/trunk/ascgml.inc index e1d3107b6d..a1b4f92aaa 100644 --- a/programs/games/phenix/trunk/ascgml.inc +++ b/programs/games/phenix/trunk/ascgml.inc @@ -7,33 +7,83 @@ lang equ ru ; GaMe ; Libary ; -; Ver 0.03 By Pavlushin Evgeni (RUSSIA) -; www.waptap@mail.ru +; Ver 0.05 +; -;InfoList -;0.01 correct -;0.02 control ~14.05.2004 -;0.03 all macros optimized by halyavin, add at ~07.06.2004 +; game_collision_2d - get collision of two 2d rectangles +; result of collision test placed in CF. +; if CF = 1, objects is collided +_1dbounce_count=0; +macro game_collision_2d xy1,wh1,xy2,wh2 ;img1_off,x1,y1,img2_off,x2,y2 ;,otv +{ + movt eax,xy1 + movt ebx,wh1 + movt ecx,xy2 + movt edx,wh2 + call game_collision_proc +if ~ defined game_collision_used +game_collision_used equ 1 + jmp exit + ; eax = x1*65536+y1 + ; ebx = w1*65536+h1 + ; ecx = x2*65536+y2 + ; edx = w2*65536+h2 +game_collision_proc: + ; y h test + call _1dbounce + jnc @f + ; x w test + shr eax,16 ;eax,y1 ; + shr ebx,16 ;mov ebx,[img1_off+4] ;h1 + shr ecx,16 ;mov ecx,y2 ; + shr edx,16 ;mov edx,[img2_off+4] ;h2 + call _1dbounce +@@: + ret +; ax - x1, bx - w1, cx - x2, dx - w2 +; or +; ax - y1, bx - h1, cx - y2, dx - h2 +; if collision ecx is incremented +_1dbounce: + cmp cx,ax ; if x2 < x1 jmp anot + jb anot + add ax,bx + cmp ax,cx ; if x1+xs <= x2 not coll + jbe not_coll +coll: + stc ; CF = 1 + ret +anot: + add cx,dx + cmp cx,ax ; x2 + xs2 > x1 + ja coll +not_coll: + clc ; CF = 0 + ret +exit: -; corectiryemoe,corectnoe,step -macro correct arg1,arg2,arg3 +end if +} + +; approxto +macro approxto value,target_value,step { local plus,minus,equal - mov eax,arg2 - cmp arg1,eax + mov eax,target_value + cmp value,eax je equal - mov eax,arg3 + mov eax,step ja minus plus: - add arg1,eax + add value,eax jmp equal minus: - sub arg1,eax + sub value,eax equal: } -macro control min,max,arg +macro clamp min,max,arg { local gr,low,norm mov eax,max diff --git a/programs/games/phenix/trunk/ascguil.inc b/programs/games/phenix/trunk/ascguil.inc new file mode 100644 index 0000000000..48431a379f --- /dev/null +++ b/programs/games/phenix/trunk/ascguil.inc @@ -0,0 +1,120 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; GUI +; Libary +; +; Ver 0.01 +; + +macro gui_text x,y,color,font_size,text { + db 4 ; type of gui element 4 - text + dw y, x + dd (1 shl 31)+color+((font_size-1) shl 24) + db text, 0 +} + +macro gui_button id,x,y,w,h,bcolor,tcolor,text { + db 8 ; type of gui element 8 - button with text + dw id, w, x, h, y + dd bcolor + dd (1 shl 31)+tcolor + db text, 0 +} + +macro gui_end { + db 255 ; type of gui element 255 - end of gui marker +} + +macro draw_gui address +{ + mov esi,address + call draw_gui_proc + +if ~ defined draw_gui_used +draw_gui_used equ 1 + jmp end_draw_gui_proc +draw_gui_proc: +next_element: + xor eax,eax + mov al,byte [esi] +; eax =4 draw label + cmp eax,4 + jne no_label + mov ebx,[esi+1] ; x,y + mov ecx,[esi+1+4] ; color + lea edx,[esi+1+4+4] ; text offset + add esi,9 + mcall + jmp skip_string +no_label: +; eax = 8 draw button + cmp eax,8 + jne no_draw_button + xor edx,edx + mov dx,[esi+1] ; id + mov ebx,[esi+3] ; x,xs + mov ecx,[esi+7] ; y,ys + push esi + mov esi,[esi+11] ; button color + mcall + pop esi + + lea ebp,[esi+19] ; start of text + call get_size_of_string + mov ebx,6 + mul ebx + + mov bx,[esi+3] + sub bx,ax + shr bx,1 + add bx,[esi+5] + + mov dx,[esi+7] + sub dx,7 + shr dx,1 + add dx,[esi+9] + + shl ebx,16 + mov bx,dx + + mov ecx,[esi+15] ; text color + lea edx,[esi+19] ; text offset + mov eax,4 + add esi,19 + mcall + jmp skip_string +no_draw_button: + cmp eax,255 + je end_of_gui +; unknown gui element + int3 +end_of_gui: + ret + +get_size_of_string: + xor eax,eax +next_bt: + cmp byte [ebp],0 + jne no_en + ret +no_en: + inc ebp + inc eax + jmp next_bt +; function for skip string of text +next_byte: + inc esi +skip_string: + cmp byte [esi],0 + jne next_byte + inc esi + jmp next_element +end_draw_gui_proc: + +end if + +} \ No newline at end of file diff --git a/programs/games/phenix/trunk/ascl.inc b/programs/games/phenix/trunk/ascl.inc index 0342768ede..f79aa0d3b6 100644 --- a/programs/games/phenix/trunk/ascl.inc +++ b/programs/games/phenix/trunk/ascl.inc @@ -6,60 +6,503 @@ ; CODE ; Libary ; -; Ver 0.14 By Pavlushin Evgeni (RUSSIA) -; www.waptap@mail.ru +; Ver 0.17 (for FASM v1.54 or higer) +; -;Please compile aplications on FASM ver1.54 or higer!!! - -;InfoList -;0.01 scank,putpix,puttxt -;0.02 label,random,colors -;0.03 window,startwd,endwd,attributes -;0.04 close,delay,scevent ~30.04.2004 -;0.05 small random, ~04.05.2004 -;0.06 wtevent ~09.05.2004 -;0.07 timeevent ~23.05.2004 -;0.08 txtput ~14.06.2004 -;0.09 opendialog,savedialog ~20.06.2004 -;0.10 wordstoreg by halyavin, add at ~30.08.2004 -; random bug deleted eax is use. -;0.11 loadfile from me +puttxt bug del ~07.09.2004 -;0.12 open/save dialog ~13.09.2004 -;0.13 dialogs bugs deleted -;0.14 drawlbut ~03.10.2004 -;0.15 extendet label! - -; LOADFILE -; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area -; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area - - -macro loadfile file_name,file_load_area,file_temp_area +macro movt op1,op2 { -local open,fileinfo,string - jmp open -fileinfo: - dd 0 - dd 0 - dd 1 - dd file_load_area - dd file_temp_area -string: - db file_name,0 -open: - mov dword [fileinfo+8],1 ; how many blocks to read (1) - mov eax,58 - mov ebx,fileinfo - mcall - mov eax,[file_load_area+2] - shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков - inc eax - mov dword [fileinfo+8],eax - mov eax,58 - mov ebx,fileinfo - mcall + if op2 eq + ;display 'not set' + else + if op1 eq op2 + display '+' + ;display 'skip mov ' # `op1 # ',' # `op2 , 10,13 + else + mov op1,op2 + end if + end if } +macro clear_buffer buffer, buf_size, value +{ + movt edi,buffer ; edi = buffer adress + movt ecx,buf_size ; ecx = buffer size + movt al,value + call clear_buffer_proc + +if ~ defined clear_buffer_used +clear_buffer_used equ 1 + jmp @f +clear_buffer_proc: + mov ah,al + push ax + shl eax,16 + pop ax ; eax = al:al:al:al + push ecx + shr ecx,2 ; ecx = ecx/4 when we use stosd + cld ; set direction flag + rep stosd + pop ecx + and ecx,011b ; last two bits + rep stosb + ret +@@: +end if +} + +; draw_button - function for draw button with label placed at center + +macro draw_button button_id,x,y,xs,ys,text,button_color,text_color +{ +local end_of_data,label + jmp end_of_data +label db text ;arg label +end_of_data: + words2reg ebx,x,xs ; ebx = x * 65536 + xsize + words2reg ecx,y,ys ; ecx = y * 65536 + ysize + mov edx,button_id + mov esi,button_color + push dword end_of_data-label + push dword text_color + push dword label + call draw_button_proc +if ~ defined draw_button_used +draw_button_used equ 1 + jmp @f +draw_button_proc: + mov eax,8 ; eax = 8 add button function + mcall + + mov esi,[esp+12] ; esi = lenght of label + mov eax,esi + mov edx,6 ; 6 - width of one char + mul edx ; eax = size of label in pixels (chars number * 6) + + sub bx,ax + shr bx,1 + mov edi,ebx + shr edi,16 + add bx,di + + sub cx,7 + shr cx,1 + mov edi,ecx + shr edi,16 + add cx,di + + shl ebx,16 + mov bx,cx ; ebx = bx * 65536 + edx + + mov ecx,[esp+8] ; text color + mov edx,[esp+4] ; set address of label + mov eax,4 ; eax = 4 draw label function + mcall + ret 3*4 +@@: +end if +} + +; scan_event - Scan event without wait +macro scan_event redraw,key,button +{ + mov eax,11 + mcall + dec eax + jz redraw + dec eax + jz key + dec eax + jz button +} + +; wait_event - Wait for event +macro wait_event redraw,key,button +{ + mov eax,10 + mcall + dec eax + jz redraw + dec eax + jz key + dec eax + jz button +} + +; time_event - Wait for event with timeout +macro time_event xfps,noevent,redraw,key,button +{ + mov eax,23 + mov ebx,xfps + mcall + ;cmp eax,0 + ;je noevent + dec eax + js noevent + jz redraw + dec eax + jz key + dec eax + jz button +} + +; function for set ascii or scan code keyboard input mode +macro keyboard_set_input_mode mode +{ + mov eax,66 ; eax = 66 - keyboard service function + mov ebx,1 ; ebx = 1 - sub function for set input mode for keyboard + mov ecx,mode ; ecx = mode 0 - ASCII; 1 - scan codes; + mcall +} + +; function for read layout to 128 byte array +macro keyboard_get_layout layout_type, layout_array +{ + mov eax,26 ; eax = 26 - hardware service function + mov ebx,2 ; ebx = 2 - subfunction for get keyboard layout + mov ecx,layout_type ; ecx = layout type: 1 - for normal layout + mov edx,layout_array ; edx = address to 128 byte array + mcall +} + +; function for get key from keyboard buffer +macro window_get_key output +{ + mov eax,2 ; eax = 2 - get keyboard pressed key function + mcall + if ~output eq + mov output,eax + end if +} + +; function for get id of button pressed in window +macro window_get_button output +{ + mov eax,17 ; eax = 17 - get id of pressed button function + mcall + if ~output eq + mov output,eax + end if +} + +macro draw_pixel x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + mcall +} + +macro puttxt x,y,offs,size,color +{ + words2reg ebx,x,y + mov ecx,color + mov edx,offs + mov esi,size + mov eax,4 + mcall +} + +; window_begin_draw - Begin of draw window +macro window_begin_draw +{ + mov eax,12 + mov ebx,1 + mcall +} + +; window_end_draw - End draw of window +macro window_end_draw +{ + mov eax,12 + mov ebx,2 + mcall +} + +; fs_read_file - read file from file system and save it to array +; example: +; fs_read_file '/rd/1/clock.bmp',load_area,temp_area + +macro fs_read_file file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + mcall + mov eax,[file_load_area+2] + shr eax,9 ; div to 512 and add 1 - for get number of blocks + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + mcall +} + +; random - generate random count (small) +; example: +; random 10000,eax ; generate random value from 0 to 10000 and save it in eax +; note: +; max_value<65536 +; only modificate eax register + +randomuse = 0 +macro random max_value,result +{ +local rxproc +randomuse = randomuse + 1 + jmp rxproc + +if defined randomuse & randomuse = 1 + randomproc: + ;int3 + ;push bx + ;push cx + ;push dx + ;push si + ;push di + pushad + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx + nodiv: + mov [rnd_result],dx + popad + mov eax,dword [rnd_result] + ret + ; data block after ret + rsx1 dw 0x4321 + rsx2 dw 0x1234 + rnd_result dw 0 + dw 0 +end if + +rxproc: + movt eax,max_value + call randomproc + movt result,eax ;dword [rnd_result] +} + +; close - Close application + +macro close +{ + mov eax,-1 + mcall +} + +; delay - Create delay 1/100 sec +; example: +; delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + mcall +} + +; window - Draw window +; window Xstart,Ystart,'Text',Color +; example: +; window 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ + words2reg ebx,arg1,arg3 + words2reg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + mcall +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + mcall +} + +;Key's scan codes + +ErrorCode equ 0 ; 0x00 +key_Esc equ 1 ; 0x01 +key_1 equ 2 ; 0x02 ! +key_2 equ 3 ; 0x03 @ +key_3 equ 4 ; 0x04 # +key_4 equ 5 ; 0x05 $ +key_5 equ 6 ; 0x06 % +key_6 equ 7 ; 0x07 " +key_7 equ 8 ; 0x08 & +key_8 equ 9 ; 0x09 * +key_9 equ 10 ; 0x0A ( +key_0 equ 11 ; 0x0B ) + +key_Backspace equ 14 ; 0x0E +key_Q equ 16 ; 0x10 +key_W equ 17 ; 0x11 +key_E equ 18 ; 0x12 +key_R equ 19 ; 0x13 +key_T equ 20 ; 0x14 +key_Y equ 21 ; 0x15 +key_U equ 22 ; 0x16 +key_I equ 23 ; 0x17 +key_O equ 24 ; 0x18 +key_P equ 25 ; 0x19 + +key_Enter equ 28 ; 0x1C +key_A equ 30 ; 0x1E +key_S equ 31 ; 0x1F +key_D equ 32 ; 0x20 +key_F equ 33 ; 0x21 +key_G equ 34 ; 0x22 +key_H equ 35 ; 0x23 +key_J equ 36 ; 0x24 +key_K equ 37 ; 0x25 +key_L equ 38 ; 0x26 +key_Colon equ 39 ; 0x27 ':;' +key_DQuotes equ 0x28 ; 40 '"'' +key_Tilda equ 0x29 ; 41 '~`' +key_LShift equ 0x2A ; 42 +key_Z equ 0x2C ; 44 +key_X equ 0x2D ; 45 +key_C equ 0x2E ; 46 +key_V equ 0x2F ; 47 +key_B equ 0x30 ; 48 +key_N equ 0x31 ; 49 +key_M equ 0x32 ; 50 +key_Comma equ 0x33 ; 51 ',<' +key_Dot equ 0x34 ; 52 '.>' +key_Question equ 0x35 ; 53 '?/' +key_RShift equ 0x36 ; 54 +key_NumStar equ 0x37 ; 55 '*' +key_LAlt equ 0x38 ; 56 +key_Space equ 0x39 ; 57 +key_CapsLock equ 0x3A ; 58 +key_F1 equ 0x3B ; 59 +key_F2 equ 0x3C ; 60 +key_F3 equ 0x3D ; 61 +key_F4 equ 62 +key_F5 equ 63 +key_F6 equ 64 +key_F7 equ 65 +key_F8 equ 66 +key_F9 equ 67 +key_F10 equ 0x44 ; 68 +key_NumLock equ 0x45 ; 69 +key_ScrollLock equ 0x46 ; 70 +key_Up equ 0x48 ; 72 +key_Num8 equ 0x48 ; 72 +key_PageUp equ 0x49 ; 73 +key_Num9 equ 0x49 ; 73 +key_NumMinus equ 0x4A ; 74 +key_Left equ 0x4B ; 75 +key_Num4 equ 0x4B ; 75 +key_Num5 equ 0x4C ; 76 +key_Right equ 0x4D ; 77 +key_Down equ 0x50 ; 80 +key_Num2 equ 0x50 ; 80 +key_F11 equ 0x57 ; 87 +key_F12 equ 0x58 ; 88 +key_PA1 equ 90 ; 0x5A +key_Lwin equ 91 ; 0x5B +key_F13 equ 91 ; 0x5B +key_Rwin equ 92 ; 0x5C +key_F14 equ 92 ; 0x5C +key_Menu equ 93 ; 0x5D +key_F15 equ 93 ; 0x5D +key_F16 equ 99 ; 0x63 +key_F17 equ 100 ; 0x64 +key_F18 equ 101 ; 0x65 +key_F19 equ 102 ; 0x66 +key_F20 equ 103 ; 0x67 +key_F21 equ 104 ; 0x68 +key_F22 equ 105 ; 0x69 +key_F23 equ 106 ; 0x6A +key_F24 equ 107 ; 0x6B +key_EraseEOF equ 109 ; 0x6D +key_CopyPlay equ 111 ; 0x6F +key_CrSel equ 114 ; 0x72 +key_Delta equ 115 ; 0x73 +key_ExSel equ 116 ; 0x74 +key_Clear equ 118 ; 0x76 + + + +;Attributes + +;Window Attributes +window_Skinned equ 0x04000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Label Attributes +ends_by_zero equ 10000000b shl 24 +fill_background equ 01000000b shl 24 +cp866_small equ 00000000b shl 24 +cp866 equ 00010000b shl 24 +utf16 equ 00100000b shl 24 +utf8 equ 00110000b shl 24 +font_size_x1 equ 00000000b shl 24 +font_size_x2 equ 00000001b shl 24 +font_size_x3 equ 00000010b shl 24 +font_size_x4 equ 00000011b shl 24 +font_size_x5 equ 00000100b shl 24 +font_size_x6 equ 00000101b shl 24 +font_size_x7 equ 00000110b shl 24 +font_size_x8 equ 00000111b shl 24 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Blue equ 0x000000ff +cl_Yellow equ 0x00ffff00 +cl_Cyan equ 0x0000ffff +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +;cl_Cyan equ 0x0040e0ff macro wordstoreg reg,hiword,loword { @@ -78,8 +521,6 @@ else end if } - - macro dword2reg reg,doubleword { if doubleword eq @@ -93,9 +534,9 @@ macro words2reg reg,hiword,lowword { if hiword eq if lowword eq - ; not changes + ; if operators empty nothing do else - if lowword eqtype 12 + if lowword eqtype 12/4 and reg,dword 0xffff0000 add reg,dword lowword else @@ -105,7 +546,7 @@ if hiword eq end if else if lowword eq - if hiword eqtype 12 + if hiword eqtype 12/4 and reg,dword 0x0000ffff add reg,dword hiword*65536 else @@ -114,11 +555,12 @@ else ror reg,16 end if else - if lowword eqtype 12 & hiword eqtype 12 - if lowword eq 0 & hiword eq 0 - xor reg,reg - else - mov reg,dword hiword*65536+lowword + if lowword eqtype 12/4 & hiword eqtype 12/4 + if lowword = 0 & hiword = 0 + xor reg,reg + else + ; use brackets for calcualtion without error!!! + mov reg,dword (hiword)*65536+(lowword) end if else mov reg,dword hiword @@ -128,768 +570,3 @@ else end if end if } - - - - -; DRAW BUTTON with label - -macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor -{ -local asd,lab - jmp asd -lab db text ;arg label -asd: - words2reg ebx,x,xs - words2reg ecx,y,ys - mov edx,id - mov esi,bcolor - mov eax,8 - mcall - - mov eax,asd-lab ;calc size - mov ebx,6 - mul ebx - mov esi,eax - - mov eax,xs - sub eax,esi - shr eax,1 - add eax,x - - mov edx,ys - sub edx,7 - shr edx,1 - add edx,y - - mov ebx,eax - shl ebx,16 - add ebx,edx - - mov ecx,tcolor ;arg4 color - mov edx,lab - mov esi,asd-lab ;calc size - mov eax,4 - mcall -} - - -macro opendialog redproc,openoff,erroff,path -{ -local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc -local run_fileinfo, param -local getmesloop, loox, mred, mkey, mbutton, mgetmes -local dlg_is_work, ready, procinfo -; -; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, -; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) -; - - cld -;; mov esi,path - mov edi,path - mov eax,0 - mov ecx,200 - rep stosb - -;mov [get_loops],0 -mov [dlg_pid_get],0 - -; Get my PID in dec format 4 bytes - mov eax,9 - mov ebx,procinfo - mov ecx,-1 - mcall - -; convert eax bin to param dec - mov eax,dword [procinfo+30] ;offset of myPID - mov edi,param+4-1 ;offset to 4 bytes - mov ecx,4 - mov ebx,10 - cld -new_d: - xor edx,edx - div ebx - add dl,'0' - mov [edi],dl - dec edi - loop new_d - -; wirite 1 byte space to param - mov [param+4],byte 32 ;Space for next parametr -; and 1 byte type of dialog to param - mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) - -; -; STEP2 prepare IPC area for get messages -; - -; prepare IPC area - mov [path],dword 0 - mov [path+4],dword 8 - -; define IPC memory - mov eax,60 - mov ebx,1 ; define IPC - mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes - mcall - -; change wanted events list 7-bit IPC event - mov eax,40 - mov ebx,01000111b - mcall - -; -; STEP 3 run SYSTEM XTREE with parameters -; - - mov eax,58 - mov ebx,run_fileinfo - mcall - - call redproc - - mov [get_loops],0 -getmesloop: - mov eax,23 - mov ebx,50 ;0.5 sec - mcall - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes - -; Get number of procces - mov ebx,procinfo - mov ecx,-1 - mov eax,9 - mcall - mov ebp,eax - -loox: - mov eax,9 - mov ebx,procinfo - mov ecx,ebp - mcall - mov eax,[DLGPID] - cmp [procinfo+30],eax ;IF Dialog find - je dlg_is_work ;jmp to dlg_is_work - dec ebp - jnz loox - - jmp erroff - -dlg_is_work: - cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated - je erroff ;TESTODP2 terminated too - - cmp [dlg_pid_get],dword 1 - je getmesloop - inc [get_loops] - cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated - jae erroff - jmp getmesloop - -mred: - call redproc - jmp getmesloop -mkey: - mov eax,2 - mcall ; read (eax=2) - jmp getmesloop -mbutton: - mov eax,17 ; get id - mcall - cmp ah,1 ; button id=1 ? - jne getmesloop - mov eax,-1 ; close this program - mcall -mgetmes: - -; If dlg_pid_get then second message get jmp to still - cmp [dlg_pid_get],dword 1 - je ready - -; First message is number of PID SYSXTREE dialog - -; convert PID dec to PID bin - movzx eax,byte [path+16] - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+1] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+2] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+3] - add eax,ebx - sub eax,48 - mov [DLGPID],eax - -; Claear and prepare IPC area for next message - mov [path],dword 0 - mov [path+4],dword 8 - mov [path+8],dword 0 - mov [path+12],dword 0 - mov [path+16],dword 0 - -; Set dlg_pid_get for get next message - mov [dlg_pid_get],dword 1 - call redproc ;show DLG_PID - jmp getmesloop - -ready: -; -; The second message get -; Second message is 100 bytes path to SAVE/OPEN file -; shl path string on 16 bytes -; - cld - mov esi,path+16 - mov edi,path - mov ecx,200 - rep movsb - mov [edi],byte 0 - - jmp openoff - - -; DATA AREA -get_loops dd 0 -dlg_pid_get dd 0 -DLGPID dd 0 - -param: - dd 0 ; My dec PID - dd 0,0 ; Type of dialog - -run_fileinfo: - dd 16 - dd 0 - dd param - dd 0 - dd procinfo ; 0x10000 -;run_filepath - db '/sys/SYSXTREE',0 - -procinfo: -times 256 db 0 -} - - -macro savedialog redproc,openoff,erroff,path -{ -local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc -local run_fileinfo, run_filepath, param -local getmesloop, loox, mred, mkey, mbutton, mgetmes -local dlg_is_work, ready, procinfo -; -; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, -; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) -; - - cld -;; mov esi,path - mov edi,path - mov eax,0 - mov ecx,200 - rep stosb - -;mov [get_loops],0 -mov [dlg_pid_get],0 - -; Get my PID in dec format 4 bytes - mov eax,9 - mov ebx,procinfo - mov ecx,-1 - mcall - -; convert eax bin to param dec - mov eax,dword [procinfo+30] ;offset of myPID - mov edi,param+4-1 ;offset to 4 bytes - mov ecx,4 - mov ebx,10 - cld -new_d: - xor edx,edx - div ebx - add dl,'0' - mov [edi],dl - dec edi - loop new_d - -; wirite 1 byte space to param - mov [param+4],byte 32 ;Space for next parametr -; and 1 byte type of dialog to param - mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) - -; -; STEP2 prepare IPC area for get messages -; - -; prepare IPC area - mov [path],dword 0 - mov [path+4],dword 8 - -; define IPC memory - mov eax,60 - mov ebx,1 ; define IPC - mov ecx,path ; offset of area - mov edx,120 ; size 150 bytes - mcall - -; change wanted events list 7-bit IPC event - mov eax,40 - mov ebx,01000111b - mcall - -; -; STEP 3 run SYSTEM XTREE with parameters -; - - mov eax,58 - mov ebx,run_fileinfo - mcall - - call redproc - - mov [get_loops],0 -getmesloop: - mov eax,23 - mov ebx,50 ;0.5 sec - mcall - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes - -; Get number of procces - mov ebx,procinfo - mov ecx,-1 - mov eax,9 - mcall - mov ebp,eax - -loox: - mov eax,9 - mov ebx,procinfo - mov ecx,ebp - mcall - mov eax,[DLGPID] - cmp [procinfo+30],eax ;IF Dialog find - je dlg_is_work ;jmp to dlg_is_work - dec ebp - jnz loox - - jmp erroff - -dlg_is_work: - cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated - je erroff ;TESTODP2 terminated too - - cmp [dlg_pid_get],dword 1 - je getmesloop - inc [get_loops] - cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated - jae erroff - jmp getmesloop - -mred: - call redproc - jmp getmesloop -mkey: - mcall ; read (eax=2) - jmp getmesloop -mbutton: - mov eax,17 ; get id - mcall - cmp ah,1 ; button id=1 ? - jne getmesloop - mov eax,-1 ; close this program - mcall -mgetmes: - -; If dlg_pid_get then second message get jmp to still - cmp [dlg_pid_get],dword 1 - je ready - -; First message is number of PID SYSXTREE dialog - -; convert PID dec to PID bin - movzx eax,byte [path+16] - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+1] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+2] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+3] - add eax,ebx - sub eax,48 - mov [DLGPID],eax - -; Claear and prepare IPC area for next message - mov [path],dword 0 - mov [path+4],dword 8 - mov [path+8],dword 0 - mov [path+12],dword 0 - mov [path+16],dword 0 - -; Set dlg_pid_get for get next message - mov [dlg_pid_get],dword 1 - call redproc ;show DLG_PID - jmp getmesloop - -ready: -; -; The second message get -; Second message is 100 bytes path to SAVE/OPEN file -; shl path string on 16 bytes -; - cld - mov esi,path+16 - mov edi,path - mov ecx,200 - rep movsb - mov [edi],byte 0 - - jmp openoff - - -; DATA AREA -get_loops dd 0 -dlg_pid_get dd 0 -DLGPID dd 0 - -param: - rb 4 ; My dec PID - rb 6 ; Type of dialog - -run_fileinfo: - dd 16 - dd 0 - dd param - dd 0 - dd procinfo -run_filepath: - db '/sys/SYSXTREE',0 - -procinfo: -times 256 db 0 -} - - - - -; RANDOM - generate random count (small) -; (SYNTAX) RANDOM MaxCount,OutArgument -; (SAMPLE) RANDOM 10000,eax -; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations - -randomuse = 0 - -macro random arg1,arg2 -{ -local rxproc -randomuse = randomuse + 1 - - jmp rxproc - -if defined randomuse & randomuse = 1 -randomproc: - jmp rnj -rsx1 dw 0x4321 -rsx2 dw 0x1234 -rnj: -; mov eax,arg1 - push bx - push cx - push dx - push si - push di - mov cx,ax - mov ax,word ptr rsx1 - mov bx,word ptr rsx2 - mov si,ax - mov di,bx - mov dl,ah - mov ah,al - mov al,bh - mov bh,bl - xor bl,bl - rcr dl,1 - rcr ax,1 - rcr bx,1 - add bx,di - adc ax,si - add bx,0x62e9 - adc ax,0x3619 - mov word ptr rsx1,bx - mov word ptr rsx2,ax - xor dx,dx - cmp ax,0 - je nodiv - cmp cx,0 - je nodiv - div cx -nodiv: - mov ax,dx - pop di - pop si - pop dx - pop cx - pop bx - and eax,0000ffffh -; mov arg2,0 -; mov arg2,eax - ret -end if - -rxproc: - mov eax,arg1 - call randomproc - mov arg2,eax -} - -macro scank -{ - mov eax,10 - mcall -} - -macro putpix x,y,color -{ - mov ebx,x - mov ecx,y - mov edx,color - mov eax,1 - mcall -} - -macro puttxt x,y,offs,size,color -{ -; mov ebx,x -; shl ebx,16 -; add ebx,y - words2reg ebx,x,y - mov ecx,color - mov edx,offs - mov esi,size - mov eax,4 - mcall -} - -macro outcount data, x, y, color, numtype -{ - mov ecx,data - mov ebx,numtype - mov bl,0 -; mov edx,x*65536+y - words2reg edx,x,y - mov esi,color - mov eax,47 - mcall -} - -; SCEVENT - Scan event - -macro scevent red,key,but -{ - mov eax,11 - mcall - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - -; WTEVENT - Wait event - -macro wtevent red,key,but -{ - mov eax,10 - mcall - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - -; TIMEEVENT - Wite for event with timeout - -macro timeevent xfps,noevent,red,key,but -{ - mov eax,23 - mov ebx,xfps - mcall - cmp eax,0 - je noevent - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - - -; CLOSE - Close program - -macro close -{ - mov eax,-1 - mcall -} - -; DELAY - Create delay 1/100 sec -; (SYNTAX) Delay time -; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec - -macro delay arg1 -{ - mov eax,5 - mov ebx,arg1 - mcall -} - -; WINDOW - Draw window -; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color -; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned - -macro window arg1,arg2,arg3,arg4,arg5 -{ -; mov ebx,arg1*65536+arg3 -; mov ecx,arg2*65536+arg4 - words2reg ebx,arg1,arg3 - words2reg ecx,arg2,arg4 - mov edx,arg5 - mov eax,0 - mcall -} - -macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 -{ - mov ebx,arg1*65536+arg3 - mov ecx,arg2*65536+arg4 - mov edx,arg5 - mov esi,arg6 - mov edi,arg7 - mov eax,0 - mcall -} - - -; STARTWD - Start of window draw - -macro startwd -{ - mov eax,12 - mov ebx,1 - mcall -} - -; ENDWD - End window draw - -macro endwd -{ - mov eax,12 - mov ebx,2 - mcall -} - -; LABEL - Put text to frame -; (SYNTAX) LABEL Xstart,Ystart,'Text',Color -; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big - -macro label arg1,arg2,arg3,arg4 -{ -local asd,lab - jmp asd -lab db arg3 ;arg label -asd: -; mov ebx,arg1 ;arg1=y arg2=x -; shl ebx,16 -; add ebx,arg2 - - - words2reg ebx,arg1,arg2 - - dword2reg ecx,arg4 - - - mov edx,lab - mov esi,asd-lab ;calc size - mov eax,4 - mcall -} - -;Key's -key_Up equ 178 -key_Down equ 177 -key_Right equ 179 -key_Left equ 176 -key_Esc equ 27 -key_Space equ 32 -key_Enter equ 13 -key_Bspace equ 8 -key_F1 equ 50 -key_F2 equ 51 -key_F3 equ 52 -key_F4 equ 53 -key_F5 equ 54 -key_F6 equ 55 -key_F7 equ 56 -key_F8 equ 57 -key_F9 equ 48 -key_F10 equ 49 -key_F11 equ 68 -key_F12 equ 255 -key_Home equ 180 -key_End equ 181 -key_PgUp equ 184 -key_PgDown equ 183 - -;Attributes - -;Window Attributes -window_Skinned equ 0x04000000 -window_Type2 equ 0x02000000 -window_Type1 equ 0x00000000 -window_Reserve equ 0x01000000 - -;Font Attributes -font_Big equ 0x10000000 - -;Colors -cl_White equ 0x00ffffff -cl_Black equ 0x00000000 -cl_Grey equ 0x00888888 -cl_Red equ 0x00ff0000 -cl_Lime equ 0x0000ff00 -cl_Green equ 0x0000af00 -cl_Blue equ 0x000000ff -cl_Purple equ 0x008080ff -cl_Violet equ 0x008040ff -cl_Cyan equ 0x0040e0ff diff --git a/programs/games/phenix/trunk/ascpoal.inc b/programs/games/phenix/trunk/ascpoal.inc new file mode 100644 index 0000000000..2944287fee --- /dev/null +++ b/programs/games/phenix/trunk/ascpoal.inc @@ -0,0 +1,161 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; Arrays +; Processing +; Libary +; +; Ver 0.04 +; + +; This macro iterates through an array of elements, +; processing each element using the specified process. +; modificate eax,{ebx},{ecx},edx,esi,[edi],[ebp] + +macro array_processing object_array,process +{ + + movt edi,object_array + movt ebp,process + call array_processing_proc + +if ~ defined array_processing_used +array_processing_used equ 1 + jmp end_ap +array_processing_proc: + push ecx + push ebx + mov ecx,[edi] ; dword contain quantity of elements + mov ebx,[edi+4] ; dword contain size of each element + add edi,8 +ap_read_next: + ;pop ebx + ;pop ecx + pushad + call ebp ;eax ;process + popad + ;push ecx + ;push ebx + add edi,ebx + dec ecx + jnz ap_read_next + pop ebx + pop ecx + ret +end_ap: +end if +} + +; This macro iterates through an array of elements, +; processing each element using the specified process +; if object finded ina array macro returned +; with CF=0 and address of element in edi. +; if object not finded macro return CF=1 +; process must be return CF=0 if value euqal finded value +; and CF=1 if value not equal +; modificate eax,{ebx},{ecx},edx,esi,[edi],[ebp] + +macro array_find object_array,process +{ + + movt edi,object_array + movt ebp,process + call array_find_proc + +if ~ defined array_find_used +array_find_used equ 1 + jmp end_af +array_find_proc: + push ecx + push ebx + mov ecx,[edi] ; dword contain quantity of elements + mov ebx,[edi+4] ; dword contain size of each element + add edi,8 +af_read_next: + pushad + call ebp ;eax ;process + popad + jnc af_finded + add edi,ebx + dec ecx + jnz af_read_next +; not finded + stc ; if not finded CF = 1 +af_finded: ; if finded CF = 0 + pop ebx + pop ecx + ret +end_af: +end if +} + +; +; process may get offests of elements from registers. + +macro compmas object_array_1,object_array_2,process +{ +local loo,loo2 + ;lea,[oa+8] + mov esi,object_array_2 ; current position + add esi,8 + mov ecx,[object_array_2] ; dword contain quantity of elements + mov ebx,[object_array_2+4] ; dword contain size of each element + mov eax,0 +loo2: + push eax + mov edi,object_array_1 ; current position + add edi,8 + mov ebp,[object_array_1] ; dword contain quantity of elements + mov edx,[object_array_1+4] ; dword contain size of each element + mov eax,0 ;count +loo: + pushad + call process + popad + add edi,edx + inc eax + cmp eax,ebp + jne loo + add esi,ebx + pop eax + inc eax + cmp eax,ecx + jne loo2 +} + + + +macro array_processing_nocall object_array,process +{ +local read_next + lea edi,[object_array+8] + mov ecx,[object_array] ; dword contain quantity of elements +read_next: + pushad + call process + popad + add edi,[object_array+4] ; edi = edi + size of one element + dec ecx + jnz read_next +} + +macro array_find_nocall object_array,process +{ +local read_next,finded + lea edi,[object_array+8] ; edi = current position + mov ecx,[object_array] ; dword contain quantity of elements +read_next: + pushad + call process + popad + jnc finded + add edi,[object_array+4] ; dword contain size of each element + dec ecx + jnz read_next +; not finded + stc ; if not finded CF = 1 +finded: ; if finded CF = 0 +} \ No newline at end of file diff --git a/programs/games/phenix/trunk/objects.gif b/programs/games/phenix/trunk/objects.gif new file mode 100644 index 0000000000000000000000000000000000000000..c6eda6930ef1b7730f138d134328efb80947be0c GIT binary patch literal 1052 zcmV+%1mpWhNk%w1VITn@0J8u90001hfPetN0RI300095sfItBM|KQ+2prE9HKmfqN z!2kdM0Dyo10000000000A^8LV00000EC2ui03ZP%00RX75XecZy*TU5yZ>M)j$~<` z=rp7(K$Pz$2*5nowVk(o@Bcu{Di|UdW1l1PqRY{qHz#pQty(3+YesqOaE%z-a|gwV zc>%3@%^SGcmhWp>nSYt*+qf*Ik{nmmZq6nj{9Ga0$FEqN5@Q!WqJ+8*<2y6|&6Cv;hd5 z(3_mnfFZfMTD%3_y(qsY#l*v2$;n~O>a!c0n$^~vA_nx@RovbA1>YpUZzba}1T=Rp zRk}O^6gWAfz|t8G)G}3*NCx~ur%BF_|G zJtYVVR3A5?Acz_$`fr3%32!klWwoj)on=+2O1;!j;e?qQ1X;5sxKq~!h{Kkkr?}8q zZ;wAlM*ATVW22$M@Ef$#I z?fbX4-~)z_^bnV`h1C)WFn*3b%u@l3<(1w4Ywk!B4Qv@OCf7TMf3=H3=%%;DjS6$QTdmm4Kl) z8eRa*Y91N@Vu)CnQX*VSda>UJF22%YbQr{F(@oyZHlBqZc(v1d8U`uEeFJppMs*;T zIi?2nHHpfT9z==Plo`l5!Hk9B$<<+rX@s6GKkg%D1;Dsr=9!|Hxh6Tr9M@Q2$oWZ5n%3IOr0Ffgix)QbYS_-a+F zVd(Zt#aTghU~o8?4Plf&1bd1e`&s1RLD(#VvEZNV4`e`vGhR zo~&~TEW_+`%-tIDF~}?k7R|#uCq2}!q=w>h#)k&G$PYGSa<0-?Bf@ltK)<|k)Th!* Wb=G8;EwQU+r>*wdY`0Bz1OPiW)z=XK literal 0 HcmV?d00001 diff --git a/programs/games/phenix/trunk/phenix.asm b/programs/games/phenix/trunk/phenix.asm index 4dbd6e6e68..e2f4372227 100644 --- a/programs/games/phenix/trunk/phenix.asm +++ b/programs/games/phenix/trunk/phenix.asm @@ -1,1350 +1,1232 @@ ; -; Phenix Dynamic Game Created by Pavlushin Evgeni for ASCL -; -; 100% Full relase! -; -; www.waptap@mail.ru +; Phoenix Game. Based on ASCL Library ; +;********************************************************************** + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd IM_END ; size of image + dd I_END ; memory for app + dd I_END ; esp stack position + dd 0x0 , 0x0 ; I_Param , I_Icon +;********************************************************************** -;****************************************************************************** - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd IM_END ; size of image - dd I_END ; memory for app - dd I_END ; esp - dd 0x0 , 0x0 ; I_Param , I_Icon +include 'lang.inc' ; for SVN 'lang.inc' +include '../../../macros.inc' ; for SVN '..\..\..\macros.inc;' +include 'ascl.inc' ; main +include 'ascgl.inc' ; graphics +include 'ascpoal.inc' ; processing object array +include 'ascgml.inc' ; game library for collision detection -;****************************************************************************** +; debug flags +keyboard_debug=0 ; Set to 1 to view all keyboard keys state in game +light_space=0 ; May used for check canvas position in window +debug_scenario=0 ; May used for fast test of gameplay +stack_leak_debug=0 ; Show stack size on screen +debug_mode=1 ; Support keys: +; A - set player hp = 10000. Make player ship undestructible +; E - player hp / 2 +; W - view final screen after game begin +screen_w equ 640 +screen_h equ 440 +;screen_w equ 1014 +;screen_h equ 739 -include 'lang.inc' -include '../../../macros.inc' -include 'ascl.inc' -include 'ascgl.inc' -include 'ascml.inc' +; Define special colors +cl_DarkRed equ 0x990000 +cl_Orange equ 0xbbbb00 +; Define objects type id +EmptyObject equ 0 +; This numbers not possible for modify because draw_objects: +BlueWarShip equ 1 +GreenWarShip equ 2 +Asteroid equ 3 +Box equ 4 -showmas: - cmp [edi+8],dword 0 - je noshow - cmp [edi+8],dword 1 - jne no_gun - mov eax,shoot - jmp outp -no_gun: - push edi - random 3,ebx - pop edi - cmp ebx,0 - jne no_star - mov eax,star - jmp outp -no_star: - cmp ebx,1 - jne no_star2 - mov eax,star2 - jmp outp -no_star2: - mov eax,star3 -outp: - aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0 -noshow: - ret - -showobjmas: - cmp [edi+8],dword 0 - je noshow1 - cmp [edi+4],dword 380 - jg noshow1 - cmp [edi+4],dword 0 - jl noshow1 - cmp [edi+8],dword 1 - jne no_warship1 - mov eax,warship1 - jmp outws -no_warship1: - cmp [edi+8],dword 2 - jne no_warship2 - mov eax,warship2 - jmp outws -no_warship2: - cmp [edi+8],dword 3 - jne no_meteor - mov eax,meteor - jmp outws -no_meteor: - cmp [edi+8],dword 4 - jne no_box - mov eax,box - jmp outws -no_box: -outws: - aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0 -noshow1: - ret - - -moveobjmas: - cmp [edi+8],dword 0 - je no_ws - mov eax,[edi+12] - add [edi],eax - mov eax,[edi+16] - add [edi+4],eax - - cmp dword [edi],600 - jng xok1 - sub dword [edi],20 - neg dword [edi+12] - jmp xok2 -xok1: - cmp dword [edi],0 - jnl xok2 - add dword [edi],20 - neg dword [edi+12] -xok2: - cmp dword [edi+4],400 - jng yok - mov dword [edi+8],0 - ret -yok: - cmp dword [edi+8],2 ;green ship - jne no_grs - cmp dword [edi+4],100 - jna no_grs - cmp dword [edi+4],103 - jna grs - cmp dword [edi+4],200 - jna no_grs - cmp dword [edi+4],203 - jna grs - cmp dword [edi+4],300 - jna no_grs - cmp dword [edi+4],303 - ja no_grs -grs: - neg dword [edi+12] - mov [temp],edi - findmas massive,findzero -;in edi off to free element - jc close_app - mov esi,edi - mov edi,[temp] - mov eax,[edi] - mov [esi],eax - mov eax,[edi+4] - mov [esi+4],eax - mov [esi+8],dword 1 - mov [esi+12],dword 0 - mov [esi+16],dword 10 -no_grs: - - cmp dword [edi+8],1 ;blue ship - jne no_bls - cmp dword [edi+4],50 - jna no_bls - cmp dword [edi+4],64 - jna bls - cmp dword [edi+4],100 - jna no_bls - cmp dword [edi+4],114 - jna bls - cmp dword [edi+4],150 - jna no_bls - cmp dword [edi+4],164 - ja no_bls -bls: - mov [temp],edi - findmas massive,findzero - jc close_app - mov esi,edi - mov edi,[temp] - mov eax,[edi] - mov [esi],eax - mov eax,[edi+4] - mov [esi+4],eax - mov [esi+8],dword 2 - mov [esi+12],dword 0 - mov [esi+16],dword 5 -no_bls: - -no_ws: - ret - - -delfarshoot: - cmp [edi+4],dword 40 - jb del - cmp [edi+4],dword 400 - ja del - cmp [edi],dword 40 - jb del - cmp [edi],dword 600 - ja del - jmp nodel -del: - mov [edi+8],dword 0 -nodel: - ret - - -movemas: - cmp [edi+8],dword 0 - jne no_freeel - ret -no_freeel: - mov eax,[edi+12] - add [edi],eax - mov eax,[edi+16] - add [edi+4],eax - ret - - - -endshowmas: - cmp [edi+8],dword 0 - je noshowem - mov eax,star2 - aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0 -noshowem: - ret - - - -endmovemas: - cmp [edi+8],dword 0 - jne no_fr - ret -no_fr: - mov eax,[edi+12] - add [edi],eax - mov eax,[edi+16] - add [edi+4],eax - ret - - -findzero: - cmp [edi+8],dword 0 - je iz_zero - xor eax,eax - ret -iz_zero: - mov eax,1 - ret - -compobr: - cmp [esi+8],dword 0 - je no_crsh - cmp [edi+8],dword 0 - je no_crsh - cmp [esi+16],dword 0 - jg no_crsh - - mov eax,[esi] - mov [temp],eax - mov eax,[esi+4] - mov [temp2],eax - mov eax,[edi] - mov [temp3],eax - mov eax,[edi+4] - mov [temp4],eax - - pushad - collimg imgsize,[temp],[temp2],imgsize,[temp3],[temp4],[otv] - popad - cmp [otv],dword 0 - je no_crsh - - cmp [edi+8],dword 2 - jne no_grship - inc [gship] - add [score],30 - jmp setzero -no_grship: - cmp [edi+8],dword 1 - jne no_blship - inc [bship] - add [score],20 - jmp setzero -no_blship: - cmp [edi+8],dword 3 - jne no_metr - dec dword [edi+16] - cmp dword [edi+16],0 - jne mok - mov dword [edi+16],1 -mok: - mov [esi+8],dword 0 - ret -no_metr: - -setzero: - mov [esi+8],dword 0 - mov [edi+8],dword 0 -no_crsh: - ret - -shipobjtest: - cmp [edi+8],dword 0 - je no_obj - mov eax,[edi] - mov [temp3],eax - mov eax,[edi+4] - mov [temp4],eax - pushad - collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv] - popad - cmp [otv],dword 0 - je no_obj - cmp [edi+8],dword 4 ;if box - jne no_fbox - add [energy],5 - add [score],50 - mov [edi+8],dword 0 - inc [boxget] - ret -no_fbox: - sub [energy],16 - mov [edi+8],dword 0 -no_obj: - ret - -shipguntest: - cmp [edi+8],dword 0 - je no_gobj - cmp [edi+16],dword 0 - jl no_gobj - mov eax,[edi] - mov [temp3],eax - mov eax,[edi+4] - mov [temp4],eax - pushad - collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv] - popad - cmp [otv],dword 0 - je no_gobj - sub [energy],4 - mov [edi+8],dword 0 -no_gobj: - ret +Laser equ 1 +Plasma equ 2 +StaticPlasma equ 3 +;************************************************************** +; Start of programm +;************************************************************** START: ; start of execution -massize = 400 -elemsize = 20 + max_particles = 400 + particle_size = 20 - mov [massive],dword massize - mov [massive+4],dword elemsize + mov [particles],dword max_particles + mov [particles+4],dword particle_size -omassize = 100 -oelemsize = 20 + max_objects = 100 + object_size = 20 - mov [objmas],dword omassize - mov [objmas+4],dword oelemsize + mov [objects],dword max_objects + mov [objects+4],dword object_size + keyboard_set_input_mode 1 ; 0 - ASCII; 1 - scancodes; - mov eax,66 - mov ebx,1 - mov ecx,1 - mcall - - mov eax,26 - mov ebx,2 - mov ecx,1 - mov edx,keymap - mcall - -startgame: - giftoimg gif_file_area2,canvas - giftoimg gif_file_area,img_area - - getimg img_area,0,0,32,32,ship - getimg img_area,32,0,32,32,shoot - getimg img_area,64,0,32,32,warship1 - getimg img_area,96,0,32,32,warship2 - getimg img_area,128,0,32,32,meteor - getimg img_area,160,0,32,32,star - getimg img_area,192,0,32,32,star2 - getimg img_area,224,0,32,32,star3 - getimg img_area,0,32,32,32,box - + ;giftoimg gif_file_area2,canvas + giftoimg gif_file_area,objects_image + ; load sprites + mov cl,9 ; cl - counter + xor esi,esi ; esi = 0 + lea edi,[ship_img] ; address of first sprite +load_sprite: + pushad + getimg objects_image,esi,0,32,32,edi + popad + add edi,8+32*32*3 ; incrase offest of image data + add esi,32 ; incrase x position + dec cl + jnz load_sprite +set_main_menu: + mov ebx,-1 ; at start event_mode = -1 + lea ecx,[draw_main_window] + lea edx,[menu_keyboard] +set_draw_proc: + ; assembler extract command ; for use only bl + mov [event_mode],ebx + mov [draw_proc],ecx + mov [keyboard_proc],edx + ; at first draw window main_menu: - call draw_logowindow - -stillm: - wtevent redm,keym,buttonm - jmp stillm -redm: - call draw_logowindow - jmp stillm -keym: - mov eax,2 - mcall - jmp stillm -buttonm: - mov eax,17 ; get id - mcall - cmp ah,1 ; button id=1 ? - je close_app - cmp ah,2 ; button id=1 ? - je start_game - cmp ah,3 ; button id=1 ? - je help - cmp ah,4 ; button id=1 ? - je close_app - jmp stillm - -draw_logowindow: - call draw_window - mcall 9,proc_info,-1 - test [proc_info+process_information.wnd_state], 0x04 - jz @f - ret - @@: - setimg 5,21,canvas - drawlbut 300,300,60,14,'START',2,0x990000,cl_Black - drawlbut 300,320,60,14,'HELP',3,0x990000,cl_Black - drawlbut 300,340,60,14,'EXIT',4,0x990000,cl_Black - ret - -;*********************** -; Draw help menu -;*********************** - -help: - call draw_helpwindow - -stillh: - wtevent redh,keyh,buttonh - jmp stillh -redh: - call draw_helpwindow - jmp stillh -keyh: - mov eax,2 - mcall - jmp stillh -buttonh: - mov eax,17 ; get id - mcall - cmp ah,1 ; button id=1 ? - je close_app - cmp ah,2 ; button id=1 ? - je start_game - cmp ah,3 ; button id=1 ? - je help - cmp ah,4 ; button id=1 ? - je close_app - cmp ah,5 ; button id=1 ? - je main_menu - jmp stillh - -draw_helpwindow: - call draw_window - mcall 9,proc_info,-1 - test [proc_info+process_information.wnd_state], 0x04 - jnz stillh - setimg 5,21,canvas - - drawfbox 40,50,580,380,cl_Grey - - mov ebp,4*7 - mov ebx,180*65536+90 - mov edx,helptext - mov esi,50 - mov ecx,cl_White - dec ebp -looht: - mov eax,4 - mcall - add edx,esi - add ebx,10 - dec ebp - jnz looht - - setimg 90,90,ship - setimg 90,130,shoot - setimg 90,170,star - setimg 90,210,warship1 - setimg 90,250,warship2 - setimg 90,290,meteor - setimg 90,330,box - - drawlbut 500,400,80,14,'<, <40, 440+26>, 0x14000000,, wtitle - mcall 12,2 ;end window redraw - ; setimg 5,22,img_area +menu_keyboard: + ; nothing do + window_get_key + ret - ret - -;********************** -; Game Over process -;********************** - -game_over: -; close - call draw_gowindow -stillgo: - wtevent redgo,keygo,buttongo - jmp stillgo -redgo: - call draw_gowindow - jmp stillgo -keygo: - mov eax,2 - mcall - jmp stillgo -buttongo: - mov eax,17 ; get id - mcall - cmp ah,1 - je close_app - cmp ah,4 - je close_app - cmp ah,5 - je main_menu - cmp ah,7 - je restart_lev - jmp stillgo - -restart_lev: - mov [pathtime],0 - -prevpart: - mov ebp,[levelpart] - shl ebp,5 - add ebp,levels - mov eax,[ebp] - cmp eax,dword 1 - je rest ;end of level - dec [levelpart] - jmp prevpart - - -rest: -;massives reset - clear massives - mov edi,massive+8 - cld - mov ecx,massize*elemsize/4 - mov eax,0 - rep stosd - - mov edi,objmas+8 - cld - mov ecx,omassize*oelemsize/4 - mov eax,0 - rep stosd - -;counters reset - mov [boxget],0 - mov [gship],0 - mov [bship],0 - -;ship reset - mov [energy],100 - mov [shipx],300 - mov [shipy],400 - mov [lazer],1000 - mov [plazma],500 - - -; reset keyboard - mov [num1],0 - mov [num5],0 - mov [num3],0 - mov [num2],0 - mov [num8],0 - jmp start_game - -draw_gowindow: - startwd - call draw_window - mcall 9,proc_info,-1 - test [proc_info+process_information.wnd_state], 0x04 - jz @f - ret - @@: - drawfbox 170,160,300,120,cl_Grey - drawlbut 180,260,80,14,'EXIT',4,0x990000,cl_Black - drawlbut 280,260,80,14,'MENU',5,0x990000,cl_Black - drawlbut 380,260,80,14,'RESTART',7,0x990000,cl_Black - - label 280,200,' GAME OVER ',cl_Black - endwd - ret +;*********************** +; Main screen menu +;*********************** +draw_main_window: + draw_label 160,160,'Phoenix',cl_Red+font_size_x8 + draw_button 3,300,320,60,14,'START',cl_DarkRed,cl_Yellow + draw_button 4,300,340,60,14,'HELP',cl_DarkRed,cl_Yellow + draw_button 2,300,360,60,14,'EXIT',cl_DarkRed,cl_Yellow + ret ;********************** ; End level process ;********************** -end_lev: -; close - call draw_scorewindow -stilleg: - wtevent redeg,keyeg,buttoneg - jmp stilleg -redeg: - call draw_scorewindow - jmp stilleg -keyeg: - mov eax,2 - mcall - jmp stilleg -buttoneg: - mov eax,17 ; get id - mcall - cmp ah,1 - je close_app - cmp ah,2 - je next_lev - cmp ah,3 - je help - cmp ah,4 - je close_app - cmp ah,5 - je main_menu - jmp stilleg +set_end_level_window_from_call: + add esp,4 ; remove call address from stack +set_end_level_window: + lea edx,[menu_keyboard] + mov ebx,-1 + lea ecx,[draw_end_level_window] + jmp set_draw_proc -next_lev: - mov [pathtime],0 - inc [levelpart] +draw_end_level_window: + draw_frect 170,130,300,190,cl_Grey + draw_label 280,150,'LEVEL COMPLETE',cl_Black + draw_button 2,180,300,80,14,'EXIT',cl_DarkRed,cl_Black + draw_button 5,280,300,80,14,'',cl_DarkRed,cl_Black + draw_button 6,380,300,80,14,'NEXT >',cl_DarkRed,cl_Black -;ship reset - mov [energy],100 - mov [shipx],300 - mov [shipy],400 - mov [lazer],1000 - mov [plazma],500 + draw_image 180,170,bwarship_img + draw_number [bships_destroyed],240,185,cl_Blue,3*65536 -;counters reset - mov [boxget],0 - mov [gship],0 - mov [bship],0 - -; reset keyboard - mov [num1],0 - mov [num5],0 - mov [num3],0 - mov [num2],0 - mov [num8],0 - jmp start_game - -draw_scorewindow: - call draw_window - mcall 9,proc_info,-1 - test [proc_info+process_information.wnd_state], 0x04 - jz @f - ret - @@: - startwd - drawfbox 170,130,300,190,cl_Grey - drawlbut 180,300,80,14,'(X) EXIT',4,0x990000,cl_Black - drawlbut 280,300,80,14,'',5,0x990000,cl_Black - drawlbut 380,300,80,14,'NEXT >>',2,0x990000,cl_Black - - setimg 180,140,warship1 - outcount [bship],241,151,cl_Blue,5*65536 - - setimg 180,180,warship2 - outcount [gship],241,191,cl_Green,5*65536 - - setimg 180,220,meteor - setimg 180,260,box - outcount [boxget],241,271,0xbbbb00,5*65536 - endwd - ret + draw_image 180,210,gwarship_img + draw_number [gships_destroyed],240,225,cl_Green,3*65536 + draw_image 180,250,box_img + draw_number [boxes_taken],240,265,cl_Orange,3*65536 + ret ;********************** -; End of game process +; Game Over process ;********************** -end_gm: - mov [pathtime],0 - call draw_window - label 200 ,8,'YOU WIN PRESS ANY KEY TO EXIT',cl_White+font_Big +restart_lev: + mov [next_wave_timer],0 ; Reset new wave timer +prevpart: + call get_wave_info_offset + xor eax,eax + mov ax,[ebp] + dec eax ; If eax = 0 then start of level finded + jz reset_all_varibles_and_restart_level + dec [level_wave] + jmp prevpart -stilleg2: -; scevent redeg2,keyeg2,buttoneg2 - timeevent 1,no_event2,redeg2,keyeg2,buttoneg2 +set_game_over_window_from_call: + add esp,4 +set_game_over_window: + lea edx,[menu_keyboard] + mov ebx,-1 + lea ecx,[draw_game_over_window] + jmp set_draw_proc -no_event2: - setimg 5,21,canvas +draw_game_over_window: + draw_frect 170,160,300,120,cl_Grey + draw_label 292,200,'GAME OVER',cl_Black + draw_button 2,180,260,80,14,'EXIT',cl_DarkRed,cl_Black + draw_button 5,280,260,80,14,'MENU',cl_DarkRed,cl_Black + draw_button 7,380,260,80,14,'RESTART',cl_DarkRed,cl_Black + ret -;clear scrbuf - mov edi,canvas+8 - cld - mov ecx,640*440*3/4 - mov eax,0 - rep stosd +;*********************** +; Main game loop +;*********************** - aimgtoimg ship,320,220,canvas,0x0 +next_level: + mov [next_wave_timer],0 ; Reset next wave timer + inc [level_wave] ; Next wave +start_game: + ; Set canvas size before logo is showed + image_set_size canvas,screen_w,screen_h - readmas massive,endshowmas - readmas massive,endmovemas - readmas massive,delfarshoot -; findmas massive,findzero -;in edi off to free element -; jc close_app +; Clear all, and prepeare varibles before start +reset_all_varibles_and_restart_level: - inc [pathtime] - cmp [pathtime],30 - jne no_firework - mov [pathtime],0 - random 400,eax - mov [temp3],eax - random 600,eax - mov [temp2],eax - mov [temp],dword 8;10 -xloox: - findmas massive,findzero -;in edi off to free element - jc close_app + ; Clear objects arrays + mov eax,0 + cld + mov edi,particles+8 + mov ecx,max_particles*particle_size/4 + rep stosd + mov edi,objects+8 + mov ecx,max_objects*object_size/4 + rep stosd - mov eax,[temp2] ;[shipx] - mov [edi],eax - mov eax,[temp3] ;[shipy] - mov [edi+4],eax - mov [edi+8],dword 2 ;show hstar + ; Reset keyboard state array + clear_buffer keymap, 128, 0 + + ; Reset player ship state + mov [player_hp],100 + mov [shipx],screen_w/2-16 ; Player ship x start position + mov [shipy],screen_h-40 ; Player ship y start position + mov [laser_shoots],1000 ; Laser projectiles at start + mov [plasma_shoots],500 ; Plasma projectiles at start + + ; Reset counters and gun charge values + xor eax,eax + mov [boxes_taken],eax + mov [gships_destroyed],eax + mov [bships_destroyed],eax + mov [laser_charge],eax + mov [plasma_charge],eax + +set_game_window: + lea edx,[ingame_keyboard] + lea ecx,[draw_game_window] + mov ebx,2 ; time_event ebx = 2 ms + jmp set_draw_proc + +draw_game_window: + draw_image 5,24,canvas + + xor eax,eax ; Use eax as zero for compare + cmp [pause_on],eax ; If pause = 0 nothing do + je no_pause + ret +no_pause: + + cmp [player_hp],eax ; If player_hp < 0 game over + jl set_game_over_window_from_call + + cmp [laser_charge],eax + je no_dec_laser_charge + dec dword [laser_charge] ; If laser_charge > 0 decrase it +no_dec_laser_charge: + cmp [plasma_charge],eax + je no_dec_plasma_charge + dec dword [plasma_charge] ; If plasma_charge > 0 decrase it +no_dec_plasma_charge: + + ; new wave test + inc dword [next_wave_timer] + call get_wave_info_offset + mov ax,[ebp] ; [ebp] = time to activate string + cwde ; extend ax to eax + cmp [next_wave_timer],eax + jne no_next_wave + +add_new_wave_of_objects: + mov cl,[ebp+4+0] ; cl = count of ships + mov ch,GreenWarShip ; ch = type of object + mov ebx,0x09040302 ; ebx = [xmoving]:[xaccel]:[ymoving]:[yaccel] + call add_objects ; add objects + + mov cl,[ebp+4+1] ; cl = count of ships + mov ch,BlueWarShip ; ch = type of object + mov ebx,0x03010306 ; ebx = random ranges : x = -1..1 y = -6..-4 + call add_objects ; add objects + + mov cl,[ebp+4+2] ; cl = count of asteroids + mov ch,Asteroid ; ch = type of object + mov ebx,0x05020502 ; ebx = [xmoving]:[xaccel]:[ymoving]:[yaccel] + call add_objects ; add objects + + mov cl,[ebp+4+3] ; cl = count of boxes + mov ch,Box ; ch = type of object + mov ebx,0x05020401 ; ebx = [xmoving]:[xaccel]:[ymoving]:[yaccel] + call add_objects ; add objects + + mov [next_wave_timer],0 ; Reset next wave timer + inc [level_wave] ; Next wave +no_next_wave: + + ; Calculate all active objects on screen + xor eax,eax ; Use eax as zero + mov [objects_num],eax + array_processing objects,endtest ; ar_proc not modify eax, ebx + xor eax,eax ; Use eax as zero + cmp [objects_num],eax ; If [objects_num] != 0, level is not complete + jnz level_not_complete + + call get_wave_info_offset + mov ax,[ebp+2] ; ax = maxyrange + cwde ; extend ax to eax + xor ebx,ebx ; Use ebx as zero for compare + cmp eax,ebx ; If [ebp+2] of level = 0, this is end of level + je set_end_level_window_from_call ; Show player score + dec ebx ; Use ebx as -1 for compare + cmp eax,ebx + je set_final_screen_window_from_call ; Show final animation +level_not_complete: + +no_end_lev: + +; Key state processing + cmp byte [keymap+key_Right],0 + je no_key_right + add dword [shipx],6 +no_key_right: + cmp byte [keymap+key_Left],0 + je no_key_left + sub dword [shipx],6 +no_key_left: + cmp byte [keymap+key_Space],0 + je no_key_lshoot + call try_to_make_laser_shoot + ;call try_to_make_plasma_shoot +no_key_lshoot: + cmp byte [keymap+key_Up],0 + je no_key_pshoot + ;call try_to_make_plasma_nuke + call try_to_make_plasma_shoot +no_key_pshoot: + cmp byte [keymap+key_Down],0 + je no_key_pnuke + call try_to_make_plasma_nuke + ;call try_to_make_laser_shoot +no_key_pnuke: + +; Ship position correction (clamp macro) + cmp [shipx],5 + jnl @f + mov [shipx],5 +@@: + cmp [shipx],screen_w-32-5 + jng @f + mov [shipx],screen_w-32-5 +@@: + + mov al,7 +if light_space = 1 + mov al,255 +end if + clear_buffer canvas+8,canvas_end-canvas-8,al + + compmas objects,particles,objects_and_particles_hit_handling + ; move objects and particles + array_processing objects,move_objects + array_processing particles,move_particles + ; remove particles out of screen + array_processing particles,remove_outofscr_particles + ; objects and particles collision test + array_processing objects,player_and_objects_collision_handling + array_processing particles,player_and_particles_collision_handling + ; draw objects and particles + array_processing objects,draw_objects + array_processing particles,draw_particles + ; draw player ship + image_draw_acimage canvas,ship_img,[shipx],[shipy],cl_Black + + ; Draw info indicators + draw_frect 150,5,64,5,cl_Black + mov eax,[plasma_charge] + sub eax,256 + neg eax + shr eax,2 + draw_frect 150,5,eax,5,cl_Cyan + + draw_frect 150,12,64,5,cl_Black + mov eax,[laser_charge] + sub eax,8 + neg eax + shl eax,3 + draw_frect 150,12,eax,5,cl_Yellow + + draw_frect 220,2,6*5+2 ,9,cl_Grey + draw_number [plasma_shoots],221,3,cl_Cyan,5*65536 + draw_frect 220,11,6*5+2 ,9,cl_Grey + draw_number [laser_shoots],221,12,cl_Yellow,5*65536 + + draw_frect 280,6,6*5+2 ,9,cl_Grey + draw_number [gships_destroyed],281,7,cl_Green,5*65536 + draw_frect 320,6,6*5+2 ,9,cl_Grey + draw_number [bships_destroyed],321,7,cl_Blue,5*65536 + draw_frect 360,6,6*5+2 ,9,cl_Grey + draw_number [boxes_taken],361,7,0xffaa00,5*65536 + + ; number of objects in scene + draw_frect 400,2,6*5+2 ,9,cl_Grey + draw_number [objects_num],401,2,cl_Lime,5*65536 + + draw_frect 400,11,6*5+2 ,9,cl_Grey + draw_number [player_hp],401,12,cl_Red,5*65536 + + draw_frect 450,11,6*5+2 ,9,cl_Grey + draw_number [score],451,12,cl_Yellow,5*65536 ;+hide_zeros + + ; print keyboard keys state as string for debug +if keyboard_debug = 1 + mov ebx,10*65536+40 + mov edx,keymap + mov esi,128 + mov ecx,cl_White + mov eax,4 + mcall +end if + ret + +; Proc for calculate active objects on screen +; eax - empty object type = 0 +endtest: + xor eax,eax + cmp dword [edi+8],eax ; object is empty ? + je is_free + inc [objects_num] +is_free: + ret + +; Proc for get offest to current level wave information +get_wave_info_offset: + mov ebp,[level_wave] + shl ebp,3 ; ebp = ebp*8; 8 - lenght of one string in levels array + add ebp,levels ; ebp = offset to string in levels array + ret + +; time_bwns - time before next wave start +; yrmax - y random position maximum value +macro objects_wave time_bnws, yrmax, gships, bships, asteroids, boxes{ + dw time_bnws, yrmax + db gships, bships, asteroids, boxes +} + +level_wave dd 0 +; this array may optimized +levels: +; for game not ended at start, each level must have objects set at start (1) + ; test pattern +if debug_scenario = 1 + ; two levels for debug game + objects_wave 1, 10, 1, 2, 4, 8 ; objset at start + objects_wave 0, 0, 0, 0, 0, 0 + objects_wave 1, 10, 3, 3, 3, 3 ; objset at start + objects_wave 0, -1, 0, 0, 0, 0 +else + ; level 1 + objects_wave 1, 4000, 3, 10, 10, 0 ; objset at start + objects_wave 800, 2000, 5, 3, 5, 3 + objects_wave 400, 2000, 3, 7, 5, 3 + objects_wave 400, 800, 3, 5, 3, 0 + objects_wave 0, 0, 0, 0, 0, 0 ; end of level + ; level 2 + objects_wave 1, 4000, 10, 40, 0, 8 ; objset at start + objects_wave 400, 4000, 10, 10, 20, 6 + objects_wave 400, 2000, 0, 20, 10, 2 + objects_wave 400, 400, 10, 10, 20, 0 + objects_wave 0, 0, 0, 0, 0, 0 ; end of game + ; level 3 + objects_wave 1, 800, 0, 0, 5, 5 ; objset at start + objects_wave 500, 2000, 4, 20, 30, 0 + objects_wave 500, 2000, 4, 20, 0, 8 + objects_wave 500, 2000, 10, 0, 0, 4 + objects_wave 500, 4000, 0, 30, 0, 0 + objects_wave 400, 400, 3, 5, 15, 0 + objects_wave 400, 400, 0, 0, 10, 0 + objects_wave 0, -1, 0, 0, 0, 0 ; end of level +end if + +;*********************************** +; In game keyboard +;*********************************** + +ingame_keyboard: + window_get_key ; read key (eax=2) + cmp al,0 + jne this_is_hotkey + ; ah - contain scan code, al = 0 + shl eax,16 + shr eax,24 ; equal shr eax,8 + and eax,0x0FF + ; eax - contain scan code + + cmp al,key_P+128 + jne not_P_key_up_scan_code + not [pause_on] +not_P_key_up_scan_code: + +if debug_mode = 1 + cmp al,key_E ; player hp = player hp / 2 + jne no_hp_test + shr [player_hp],1 +no_hp_test: + cmp al,key_A ; player hp = 10000 + jne no_hp_up + mov [player_hp],10000 +no_hp_up: + cmp al,key_W ; Run final screen + je set_final_screen_window_from_call +end if + + ; Keyboard array update, needs sub state + cmp al,01111111b + ja key_released + mov byte [keymap+eax],'1' ; If scan code of key down + jmp key_pressed +key_released: + and al,01111111b + mov byte [keymap+eax],0 ; If scan code of key up +key_pressed: +this_is_hotkey: + ret + +;********************** +; Final screen process +;********************** + +set_final_screen_window_from_call: + add esp,4 ; Remove call address from stack +set_final_screen_window: + lea edx,[menu_keyboard] + mov ebx,1 + lea ecx,[draw_final_screen_window] + jmp set_draw_proc + +you_won_text: db 'YOU WON!',0 + +draw_final_screen_window: + draw_image 5,24,canvas + logo_font_size equ 5 + logo_x = 5+(screen_w/2)-(6*logo_font_size*8/2) + logo_y = screen_h/16*5 + draw_label logo_x,logo_y,you_won_text,cl_White+((logo_font_size-1) shl 24) + ;image_draw_label canvas,200,8,'YOU WON!',cl_White + draw_button 5,(screen_w/2)-40+5,300,80,14,'BACK TO MENU',cl_DarkRed,cl_Black + + clear_buffer canvas+8,canvas_end-canvas-8,7 + + image_draw_acimage canvas,ship_img,(screen_w/2)-16,220,cl_Black + array_processing particles,draw_particles + array_processing particles,move_particles ; move particles + array_processing particles,remove_outofscr_particles ; del_outscreen_particles + +try_to_make_firework: + inc [next_wave_timer] + cmp [next_wave_timer],30 + jna no_firework + mov [next_wave_timer],0 ; reset firework timer before make firework + random screen_w-60,eax + mov ebx,eax + random screen_h-60,eax + mov edx,eax + mov ecx,8 ; how much particles make in one fire explode +next_star: + array_find particles,find_empty_object + jc close_app + mov [edi],ebx ; random x position + mov [edi+4],edx ; random y position + mov [edi+8],dword 3 ; type of partice = 3. final screen particle rerand: - random 5,eax - sub eax,2 - cmp eax,0 - je rerand - mov [edi+12],eax ;show hstar + random 5,eax + sub eax,2 + jz rerand ; eax = -2...2 exclude 0 + mov [edi+12],eax ; x velocity rerand2: - random 7,eax - sub eax,3 - cmp eax,0 - je rerand2 - mov [edi+16],eax ;show hstar - dec [temp] - jnz xloox + random 7,eax + sub eax,3 + jz rerand2 ; eax = -3...3 exclude 0 + mov [edi+16],eax ; y velocity + dec ecx + jnz next_star no_firework: - jmp stilleg2 + ret -redeg2: - jmp end_gm ;stilleg2 -keyeg2: - mov eax,2 - mcall - jmp main_menu -buttoneg2: - mov eax,17 ; get id - mcall - jmp stilleg2 +;*********************** +; Help menu +;*********************** +set_help_window: + lea edx,[menu_keyboard] + mov ebx,-1 + lea ecx,[draw_help_window] + jmp set_draw_proc +draw_help_window: + ; draw background and gray rectangle for label + ;draw_frect canvas size cl_Black + draw_frect 40,50,580,380,cl_Grey + ; draw labels + mov ebp,4*7+3 ; Set value to labels counter + mov ebx,180*65536+90 + mov edx,helptext + mov esi,50 + mov ecx,cl_White+(10000000b shl 24) +draw_next_string: + mov eax,4 + mcall ; Draw label +@@: + mov al,[edx] ; Loop for find next zero + inc edx + cmp al,0 + jne @b + add ebx,10 ; Incrase y position of label + dec ebp ; Decrase labels counter + jnz draw_next_string + ; draw images of space objects + mov eax,90 + mov ecx,7 +@@: + mov esi,[(img_offset-4)+ecx*4] + pushad + draw_image 90,eax,esi + popad + add eax,40 + dec ecx + jnz @b + + draw_button 5,500,400,80,14,'< BACK',cl_DarkRed,cl_Black + ret + +; Offset to images showed in help screen in reverse sequence +img_offset: +dd box_img,asteroid_img,gwarship_img,bwarship_img +dd plasma1_img,laser_img,ship_img + +helptext: + db 'Phoenix - player ship',0 + db 'Controls:',0 + db 'Left or Right Arrows for move ship, P - button for pause',0 + db 0 + db 'Laser gun',0 + db 'Recharge fast, speed fast. Projectile speed is medium',0 + db 'Press Space button for shoot',0 + db 0 + db 'Plasma gun',0 + db 'Recharge slow, reload fast. Projectile speed is fast',0 + db 'Press Up button for shoot or Down button for make Nuke',0 + db 0 + db 'Blue warship',0 + db 'Moving speed is fast',0 + db 'Armed with plasma bombs',0 + db 0 + db 'Green warship',0 + db 'Moving speed is medium',0 + db 'Armed with laser gun',0 + db 0 + db 'Asteroid',0 + db 'Is not destructable dangeros object!',0 + db 'Collision with asteroid damage ship to much',0 + db 0 + db 'Repear Box',0 + db 'Shield pack. Shield +5, Score +30',0 + db 'Take on board for shield level up!',0 + db 0,0,0 + db 'Developed by Pavlushin Evgeni 2004',0 + +; **************************************** +; GLOBAL DRAW WINDOW +; **************************************** + +draw_window: + window_begin_draw + mcall 0, <40, screen_w+9>, <40, screen_h+24+4>, 0x14000000,, wtitle + window_end_draw + ret + +; **************************************** +; GAME PROCEDURE AREA +; **************************************** + +; Procedure for add ships to scene +; cl - number of ships which need to add 0..255 +; ebp - offset to level string +add_objects: + ; unpack values from ebx + xor eax,eax + mov al,ch + mov [shiptype],eax + mov al,bl + mov [yaccel],eax + mov al,bh + mov [ymoving],eax + shr ebx,16 + mov al,bl + mov [xaccel],eax + mov al,bh + mov [xmoving],eax +next_ship: + cmp cl,0 + je no_ships ; if ships quantity = 0, exit from proc + push ecx + push ebp + ; find empty slot in space objects array + array_find objects,find_empty_object + jc close_app + ; edi = offset to empty place in array + mov eax,[shiptype] + mov dword [edi+8],eax ; store ship type + ; Randomize x position + random screen_w-32,eax + mov [edi],eax + ; Randomize y position + pop ebp + mov ax,[ebp+2] ; get max range + cwde ; extend ax to eax + random eax,eax + neg eax + mov [edi+4],eax + ; Randomize x moving + random [xmoving],eax + sub eax,[xaccel] + mov [edi+12],eax + ; Randomize y moving + random [ymoving],eax + add eax,[yaccel] + mov [edi+16],eax + pop ecx + dec cl + jnz next_ship +no_ships: + ret + +; search empty slot in object array +find_empty_object: + cmp [edi+8],dword 0 ; if object type == 0 then it empty + je is_finded ; empty object is finded set CF = 0 +; find_next + stc ; CF = 1 + ret +is_finded: + clc ; CF = 0 + ret + +; Try to draw particle from particle array +draw_particles: + mov ecx,[edi+8] ; ecx - type of particle + cmp ecx,0 ; if type == 0 then do not draw object + je return + mov eax,laser_img + cmp ecx,Laser ; this is laser particle + je draw_space_object + mov eax,plasma2_img + cmp ecx,StaticPlasma ; particle type for final screen animation + je draw_space_object + random 3,ebx ; if else this is Plasma particle + mov eax,plasma1_img + dec ebx + jz draw_space_object + mov eax,plasma2_img + dec ebx + jz draw_space_object + mov eax,plasma3_img + jmp draw_space_object + +; Draw space objects from array +draw_objects: + mov ecx,[edi+8] ; ecx = [edi+8] - type of ship + cmp ecx,0 ; if type of ship == 0 then not draw it + je return + cmp ecx,(ot_end-object_type)/4+1 + jae return ; if type out of range ignore it + mov edx,[edi+4] ; edx = [edi+4] - y position of ship + cmp edx,screen_h-40 + jg return + cmp edx,0 ; do not draw object if it y position is out of screen + jl return + mov eax,[(object_type-4)+ecx*4] ; -4 when types starts from 1 instead 0 +draw_space_object: + image_draw_acimage canvas,eax,dword [edi],dword [edi+4],cl_Black +return: + ret + +object_type: dd bwarship_img,gwarship_img,asteroid_img,box_img +ot_end: + +; Update (move) particles (laser,plasma) +move_particles: + xor eax,eax + cmp [edi+8],eax ; Is object not empty ? + je this_is_empty_particle +move_particle: + mov eax,[edi+12] + add [edi],eax ; objectx + [edi+12] + mov eax,[edi+16] + add [edi+4],eax ; objecty + [edi+16] +this_is_empty_particle: + ret + +; update (move) space objects (ships,asteroids,boxes) +move_objects: + xor eax,eax + cmp [edi+8],eax + je object_is_empty + ;call move_particle + mov eax,[edi+12] + add [edi],eax + mov eax,[edi+16] + add [edi+4],eax + + ; Do not allow object to go out of screen from right side + mov eax,screen_w-32 ; eax = right side of screen + cmp dword [edi],eax + jng right_side_ok + mov dword [edi],eax + neg dword [edi+12] + jmp left_side_ok +right_side_ok: + ; Do not allow object to go out of screen from left side + xor eax,eax ; eax = 0 - left side of screen + cmp dword [edi],eax + jnl left_side_ok + mov dword [edi],eax + neg dword [edi+12] +left_side_ok: + ; If object out of screen remove it + cmp dword [edi+4],screen_h;-40 + jng y_ok + mov dword [edi+8],0 ; Delete object + ret +y_ok: + cmp dword [edi+8],GreenWarShip ; Object is green enemy ship? + jne no_grs + mov eax,dword [edi+4] ; eax = y position of enemy ship + ; alternative way is use random for shoot + cmp eax,100 + jna no_grs + cmp eax,103 + jna grs + cmp eax,200 + jna no_grs + cmp eax,203 + jna grs + cmp eax,300 + jna no_grs + cmp eax,303 + ja no_grs +grs: + ; invert y moving direction and make shoot + neg dword [edi+12] + mov [temp],edi + array_find particles,find_empty_object + jc close_app + mov esi,[temp] ; edi contains address to free element + mov [edi+8],dword 1 + mov [edi+12],dword 0 + mov [edi+16],dword 10 + jmp set_particle_position +no_grs: + cmp dword [edi+8],BlueWarShip ; object is blue enemy ship ? + jne no_bls + mov ecx,dword [edi+4] + cmp ecx,50 + jna no_bls + cmp ecx,64 + jna bls + cmp ecx,100 + jna no_bls + cmp ecx,114 + jna bls + cmp ecx,150 + jna no_bls + cmp ecx,164 + ja no_bls +bls: + ; drop plasma mine + mov [temp],edi + array_find particles,find_empty_object + jc close_app + mov esi,[temp] + mov [edi+8],dword 2 + mov [edi+12],dword 0 + mov [edi+16],dword 5 +set_particle_position: + mov eax,[esi] + mov [edi],eax ; Particle x = Ship x + mov eax,[esi+4] + mov [edi+4],eax ; Partcle y = Ship y +no_bls: +object_is_empty: + ret + +; Remove particles that have gone out off screen +remove_outofscr_particles: + cmp dword [edi+4],40 ; test y position + jl del + cmp dword [edi+4],screen_h-40 + jg del + cmp dword [edi],0 ; x test used for plasma shoots + jl del + cmp dword [edi],screen_w-32 + jg del + ret ; do not delete +del: + xor eax,eax + mov [edi+8],eax ; [edi+8] = 0 +not_del: + ret + +objects_and_particles_hit_handling: + xor eax,eax + cmp [esi+8],eax + je no_hit + cmp [edi+8],eax ; If object is empty skip crush test + je no_hit + cmp [esi+16],eax + jg no_hit + + mov eax,[esi] + shl eax,16 + mov ax,word [esi+4] + mov ebx,32*65536+32 + mov ecx,[edi] + shl ecx,16 + mov cx,word [edi+4] + mov edx,32*65536+32 + + game_collision_2d eax,ebx,ecx,edx + jnc no_hit + + cmp dword [edi+8],GreenWarShip + jne not_grship + inc [gships_destroyed] + add [score],30 + jmp remove_object_and_particle +not_grship: + cmp dword [edi+8],BlueWarShip + jne not_blship + inc [bships_destroyed] + add [score],20 + jmp remove_object_and_particle +not_blship: + cmp dword [edi+8],Asteroid + jne not_asteroid + cmp dword [edi+16],1 ; Asteroid have minimal speed? + je remove_only_particle + dec dword [edi+16] ; Decrase speed of asteroid + jmp remove_only_particle +not_asteroid: +remove_object_and_particle: ; When hit to ship or box + mov [edi+8],dword 0 +remove_only_particle: ; When hit to asteroid + mov [esi+8],dword 0 +no_hit: + ret + +player_and_objects_collision_handling: + cmp [edi+8],dword 0 + je no_obj_cr + + mov eax,[shipx] + shl eax,16 + mov ax,word [shipy] + mov ebx,32*65536+32 + mov ecx,[edi] + shl ecx,16 + mov cx,word [edi+4] + mov edx,32*65536+32 + + game_collision_2d eax,ebx,ecx,edx + jnc no_obj_cr + cmp dword [edi+8],Box ; if box + jne no_fbox + add [player_hp],5 + add [score],50 + mov [edi+8],dword 0 ; delete object + inc [boxes_taken] + ret +no_fbox: + sub [player_hp],16 + mov [edi+8],dword 0 ; delete object +no_obj_cr: + ret + +player_and_particles_collision_handling: + xor eax,eax ; use eax as zero + cmp [edi+8],eax ; empty object? + je no_gobj_cr + cmp [edi+16],eax ; is player ? + jl no_gobj_cr + + mov eax,[shipx] + shl eax,16 + mov ax,word [shipy] + mov ebx,32*65536+32 + mov ecx,[edi] + shl ecx,16 + mov cx,word [edi+4] + mov edx,32*65536+32 + + game_collision_2d eax,ebx,ecx,edx + jnc no_gobj_cr + sub [player_hp],4 + mov [edi+8],dword 0 ; delete object +no_gobj_cr: + ret + +;************************** +; Player ship shoot procs +;************************** + +; Try to make laser shoot +try_to_make_laser_shoot: + cmp [laser_charge],dword 0 + jne no_laser_shoot ; laser_shoots is heat, need time for recharge + cmp [laser_shoots],dword 0 + je no_laser_shoot ; Don't shoot when so many laser particles on screen + array_find particles,find_empty_object ; edi = offset to emppty object + jc close_app ; ? + mov eax,[shipx] + mov [edi],eax ; 0 = x position of shoot + mov eax,[shipy] + mov [edi+4],eax ; 4 = y position of shoot + mov [edi+8],dword 1 ; 8 = 1 - laser type + mov [edi+12],dword 0 ; 12 = 0 - x speed + mov [edi+16],dword -12 ; 16 = -12 - y speed + mov [laser_charge],dword 8 ; Reset shoot timer + dec [laser_shoots] ; Decrase number of laser projectiles +no_laser_shoot: + ret + +; Try to make plasma shoot +try_to_make_plasma_shoot: + cmp [plasma_charge],dword 256-16 + jae no_plasma_shoot + cmp [plasma_shoots],0 + je no_plasma_shoot + array_find particles,find_empty_object + ; edi = off to free element + jc close_app ;? + mov eax,[shipx] + mov [edi],eax + mov eax,[shipy] + mov [edi+4],eax + mov [edi+8],dword 2 ; 8 = 2 - plasma + mov [edi+12],dword 0 ; 12 = 0 - x speed + mov [edi+16],dword -8 ; 16 = -8 - y speed + dec [plasma_shoots] ; Decrase number of plasma projectiles + add [plasma_charge],dword 8 + cmp [plasma_charge],dword 256 + jna no_plasma_shoot + mov [plasma_charge],256 +no_plasma_shoot: + ret + +; Try to make plasma nuke +try_to_make_plasma_nuke: + xor eax,eax ; Use eax as zero + cmp [plasma_charge],eax + jne no_plasma_nuke + cmp [plasma_shoots],eax + je no_plasma_nuke + mov eax,[shipy] + mov [temp3],eax + mov [temp2],dword 5 +loopx2: + mov [temp],dword 10 +loopx: + array_find particles,find_empty_object ; edi = offset to empty element + jc close_app + random 25,eax + mov ebp,eax + sub ebp,12 + add ebp,[shipx] + mov [edi],ebp ; [edi] = random(0..25)-12+shipx + shr eax,3 + random eax,eax + neg eax + add eax,[temp3] + mov [edi+4],eax + mov [edi+8],dword 2 ; 8 = 2 - plasma + random 5,eax + sub eax,2 + mov [edi+12],eax + random 7,eax + sub eax,8 + mov [edi+16],eax + dec [temp] + jnz loopx + sub [temp3],30 ; shipy - 30 + dec [temp2] + jnz loopx2 + mov [plasma_charge],dword 256 ; Wait for cannon + sub [plasma_shoots],50 ; -50 plasma bullets after nuke +no_plasma_nuke: + ret ; DATA AREA IM_END: -;global +wtitle db 'Phoenix for KOS', 0 + +score dd 0 ; player score + +; Pause state, if != 0 then game on pause pause_on dd 0 -;massive -shipx dd 300 -shipy dd 400 - -;guns -lazer dd 1000 -plazma dd 500 - -;keys -num1 dd 0 -num5 dd 0 -num3 dd 0 -num2 dd 0 -num8 dd 0 - -;enemy countres -gship dd 0 -bship dd 0 -boxget dd 0 - -energy dd 100 -score dd 0 - -;delay for cannon -ctime dd 0 -;delay for nuke gun -xtime dd 0 -;path time -pathtime dd 0 -; -temp dd 0 -temp2 dd 0 -temp3 dd 0 -temp4 dd 0 -otv dd 0 - -;for collimg -imgsize: - dd 32 - dd 32 - -;massive: -;dd 400 ;elements num -;dd 20 ;size of element in bytes -;rb 400*20 - -keymap: -rb 1000 - -wtitle db 'Phenix for KolibriOS', 0 +; Frames countdown timer until start of next wave +; If = 0 then activate to next wave +; next_wave_timer +next_wave_timer dd 0 ;gif_file_area ~21500 -gif_file_area2: -file 'phenix.gif' +;gif_file_area2: +;file 'phoenix.gif' gif_file_area: -file 'star2.gif';include gif file -img_area: -rb 256*64*3+8 -ship: -rb 32*32*3+8 -shoot: -rb 32*32*3+8 -warship1: -rb 32*32*3+8 -warship2: -rb 32*32*3+8 -meteor: -rb 32*32*3+8 -star: -rb 32*32*3+8 -star2: -rb 32*32*3+8 -star3: -rb 32*32*3+8 -box: -rb 32*32*3+8 +file 'objects.gif' ; Include gif file to code IncludeUGlobals -massive: -rd massize ;elements num -rd elemsize ;size of element in bytes -rb massize*elemsize +; Window drawing function delegate (pointer) +draw_proc rd 1 +; Keyboard processing function delegate (pointer) +keyboard_proc rd 1 -objmas: -rd omassize ;elements num -rd oelemsize ;size of element in bytes -rb omassize*oelemsize +; Counter of objects on screen +objects_num rd 1 + +player_hp rd 1 ; Health points of player ship +shipx rd 1 ; Player ship x position +shipy rd 1 ; Player ship y position +; guns +laser_shoots rd 1 ; laser bullets quantity +plasma_shoots rd 1 ; plasma bullets quantity +; Counters of player statistics +gships_destroyed rd 1 ; Number of green ships destroyed by player +bships_destroyed rd 1 ; Number of blue ships destroyed by player +boxes_taken rd 1 ; Number of repair boxes taken by player +; Gun recharge counters +; 0 = fully charged +; 256 = fully uncharged +laser_charge rd 1 ; Laser gun recharge counter +plasma_charge rd 1 ; Plasma gun recharge counter + +; Tempory varibles +temp rd 1 +temp2 rd 1 +temp3 rd 1 + +event_mode rd 1 ; if -1 wait, 0 scan, n - n delay between events + +; Tempory varibles for add_objects proc +shiptype rd 1 +xmoving rd 1 +ymoving rd 1 +xaccel rd 1 +yaccel rd 1 + +; Memory for contain not splitted image +objects_image: rb 8+288*32*3 ;8+256*64*3 +; Images sequence extracted from objects_image +ship_img: rb 8+32*32*3 ; Player red space ship +laser_img: rb 8+32*32*3 ; Double laser beams +bwarship_img: rb 8+32*32*3 ; Blue enemy ship +gwarship_img: rb 8+32*32*3 ; Green enemy ship +asteroid_img: rb 8+32*32*3 ; Space asteroid +plasma1_img: rb 8+32*32*3 ; Plasma big flash +plasma2_img: rb 8+32*32*3 ; Plasma medium flash +plasma3_img: rb 8+32*32*3 ; Plasma small flash +box_img: rb 8+32*32*3 ; Repear kit box + +; array for storing state of keyboard keys +keymap: rb 128 + +particles: +rd max_particles ; dword = maximum number of particle objects +rd particle_size ; dword = size of each particle object in bytes +rb max_particles*particle_size + +objects: +rd max_objects ; dword = maximum number of particles +rd object_size ; dword = size of each object in bytes +rb max_objects*object_size canvas: -canvas_x: - rd 1 -canvas_y: - rd 1 -rb (640*440*3)+2000 +rb 8+(screen_w*screen_h*3) +canvas_end: -proc_info: -rb 1024 -I_END: +; application stack size +align 16 +stack_max: + rb 2048 +I_END: \ No newline at end of file diff --git a/programs/games/phenix/trunk/phenix.gif b/programs/games/phenix/trunk/phenix.gif index 84c411962eb46d64da21f21598c50981023d59b8..f515d95f6a57bfe75594ba70c1edbc097e307226 100644 GIT binary patch delta 9246 zcmV+(B;niaQ{+j1M@dFFIbnbTxB)W&04x9i004jjxB;WUz`y_i0H7cMfB*ph006)s z0Dypi0RR60fPer10000000000000000000000004|1ii&tGzhu&Ab0#D2`-lo@lCG zM(Y|tEYEap-*~R?d`}ZV;9y8B8jr`IZwUx0nb4?|xvE-`hcE#Hk+|xAvZ`I{YAae> zI!l!eOUHI3sGQxrXY4o=rC%O}q96$+CN(hAWWu%6YFvEzV8Mw(;Y*iJz-1 zD0rJ}@~qJvGF*9$&MEz{ciXdK}Vnebkk9TpAY*bSW|!8{pU$anbAdFeB;G-APov;2oi(D!DEg(5f;c2 zg#%uwgN7*P!=Z9xNfeK7B35Ica2A>fK#DkORho@~g;-!~(EP}M3y;O+Xk;ua5^0iv zLK^W7i6ttD;gM9blBAS5G1(-LGs1@DlvRc)$(3Ki2jiAblF}uOWy&Dto679iW<*V` zIhC4FMp-7De0o9VoN(D?=bfLRY2ciFCW^(MfCkFZpglPP=|G4oYAFhgHkzfOtBGf5 zb?sd$>Ij)?x+$lB0Z!U!rK7fbo1CV;rK(|hMq1;AuI9=DtVDsz#Y8b1!=3455 zEzSuneamWd>;Hkp8p|tM9x5wrlb)jLt98+idaNo1CHw2OTQ=(~vEB0dZ7Ky7;I4z` znTr{@E}@%lnCl{oMgc&$>o33Fu}H6w^8RM;y+-D1rW5{u_WSR@)iyYAjHo_$Fv2J* z%n3XXJN$6R@X9(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