; ; Phenix Dynamic Game Created by Pavlushin Evgeni for ASCL ; ; 100% Full relase! ; ; www.waptap@mail.ru ; ;****************************************************************************** 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' include '..\..\..\macros.inc' include 'ascl.inc' include 'ascgl.inc' include 'ascml.inc' 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 START: ; start of execution massize = 400 elemsize = 20 mov [massive],dword massize mov [massive+4],dword elemsize omassize = 100 oelemsize = 20 mov [objmas],dword omassize mov [objmas+4],dword oelemsize mov eax,66 mov ebx,1 mov ecx,1 mcall mov eax,26 mov ebx,2 mov ecx,1 mov edx,keymap mcall startgame: gif_hash_offset = gif_hash_area giftoimg gif_file_area2,canvas gif_hash_offset = gif_hash_area 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 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 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 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,'<',5,0x990000,cl_Black drawlbut 380,260,80,14,'RESTART',7,0x990000,cl_Black label 280,200,' GAME OVER ',cl_Black endwd 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 next_lev: mov [pathtime],0 inc [levelpart] ;ship reset mov [energy],100 mov [shipx],300 mov [shipy],400 mov [lazer],1000 mov [plazma],500 ;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 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 ;********************** ; End of game process ;********************** end_gm: mov [pathtime],0 call draw_window label 200 ,8,'YOU WIN PRESS ANY KEY TO EXIT',cl_White+font_Big stilleg2: ; scevent redeg2,keyeg2,buttoneg2 timeevent 1,no_event2,redeg2,keyeg2,buttoneg2 no_event2: setimg 5,21,canvas ;clear scrbuf mov edi,canvas+8 cld mov ecx,640*440*3/4 mov eax,0 rep stosd aimgtoimg ship,320,220,canvas,0x0 readmas massive,endshowmas readmas massive,endmovemas readmas massive,delfarshoot ; findmas massive,findzero ;in edi off to free element ; jc close_app 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 mov eax,[temp2] ;[shipx] mov [edi],eax mov eax,[temp3] ;[shipy] mov [edi+4],eax mov [edi+8],dword 2 ;show hstar rerand: random 5,eax sub eax,2 cmp eax,0 je rerand mov [edi+12],eax ;show hstar rerand2: random 7,eax sub eax,3 cmp eax,0 je rerand2 mov [edi+16],eax ;show hstar dec [temp] jnz xloox no_firework: jmp stilleg2 redeg2: jmp end_gm ;stilleg2 keyeg2: mov eax,2 mcall jmp main_menu buttoneg2: mov eax,17 ; get id mcall jmp stilleg2 ; DATA AREA IM_END: ;global 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 ;gif_file_area ~21500 gif_file_area2: file 'phenix.gif' rb 50 gif_file_area: file 'star2.gif';include gif file rb 50 ;50 bytes temp back zone 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 gif_hash_area: rd 4096+1 ;hash area size for unpacking GIF massive: rd massize ;elements num rd elemsize ;size of element in bytes rb massize*elemsize objmas: rd omassize ;elements num rd oelemsize ;size of element in bytes rb omassize*oelemsize canvas: canvas_x: rd 1 canvas_y: rd 1 rb (640*440*3)+2000 I_END: