Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 1805 → Rev 1806

/programs/games/megamaze/trunk/GIF_LITE.INC
0,0 → 1,318
; GIF LITE v2.0 by Willow
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: September 9, 2004
 
; Change COLOR_ORDER in your program
; if colors are displayed improperly
 
if ~ (COLOR_ORDER in <MENUETOS,OTHER>)
; This message may not appear under MenuetOS, so watch...
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10
end if
 
struc GIF_info
{
; .NextImg rd 1 ; used internally
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
 
_null fix 0x1000
 
; ****************************************
; FUNCTION GetGIFinfo - retrieve Nth image info
; ****************************************
; in:
; esi - pointer to image list header
; ecx - image_index (0...img_count-1)
; edi - pointer to GIF_info structure to be filled
 
; out:
; eax - pointer to RAW data, or 0, if error
 
GetGIFinfo:
push esi ecx edi
xor eax,eax
jecxz .eloop
.lp:
mov esi,[esi]
test esi,esi
jz .error
loop .lp
.eloop:
add esi,4
movsd
movsd
mov eax,esi
.error:
pop edi ecx esi
ret
 
; ****************************************
; FUNCTION ReadGIF - unpacks GIF image
; ****************************************
; in:
; esi - pointer to GIF file in memory
; edi - pointer to output image list
; eax - pointer to work area (MIN 16 KB!)
 
; out:
; eax - 0, all OK;
; eax - 1, invalid signature;
; eax >=8, unsupported image attributes
;
; ecx - number of images
 
ReadGIF:
push esi edi
mov [.table_ptr],eax
mov [.cur_info],edi
xor eax,eax
mov [.globalColor],eax
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc .nextblock
mov [.globalColor],esi
call .Gif_skipmap
.nextblock:
cmp byte[edi],0x21
jne .noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne .no_gc
add edi,7
jmp .nextblock
.no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne .no_comm
inc edi
.block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz .block_skip
inc edi
jmp .nextblock
.no_comm:
cmp byte[edi],0xff ; Application Ext
jne .nextblock
add edi,13
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
add esi,4
xchg esi,edi
movsd
movsd
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc .uselocal
push [.globalColor]
mov edi,esi
jmp .setPal
.uselocal:
call .Gif_skipmap
push esi
.setPal:
movzx ecx,byte[edi]
inc ecx
mov [.codesize],ecx
dec ecx
pop [.Palette]
lea esi,[edi+1]
mov edi,[.table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [.block_ofs],eax
mov [.bit_count],8
mov eax,1
shl eax,cl
mov [.CC],eax
inc eax
mov [.EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
.filltable:
stosd
inc eax
loop .filltable
pop edi
mov [.img_start],edi
.reinit:
mov edx,[.EOI]
inc edx
push [.codesize]
pop [.compsize]
call .Gif_get_sym
cmp eax,[.CC]
je .reinit
call .Gif_output
.cycle:
movzx ebx,ax
call .Gif_get_sym
cmp eax,edx
jae .notintable
cmp eax,[.CC]
je .reinit
cmp eax,[.EOI]
je .end
call .Gif_output
.add:
push eax
mov eax,[.table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae .cycle
inc edx
bsr ebx,edx
cmp ebx,[.compsize]
jne .noinc
inc [.compsize]
.noinc:
jmp .cycle
.notintable:
push eax
mov eax,ebx
call .Gif_output
push ebx
movzx eax,bx
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
mov [.cur_info],edi
add esi,2
xchg esi,edi
.nxt:
cmp byte[edi],0
jnz .continue
inc edi
jmp .nxt
.continue:
cmp byte[edi],0x3b
jne .nextblock
xor eax,eax
stosd
mov ecx,[.img_count]
.ex:
pop edi esi
ret
 
.Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
.Gif_get_sym:
mov ecx,[.compsize]
push ecx
xor eax,eax
.shift:
ror byte[esi],1
rcr eax,1
dec [.bit_count]
jnz .loop1
inc esi
cmp esi,[.block_ofs]
jb .noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz .nextbl
mov eax,[.EOI]
sub esi,2
add esp,8
jmp .exx
.nextbl:
add eax,esi
mov [.block_ofs],eax
pop eax
.noblock:
mov [.bit_count],8
.loop1:
loop .shift
pop ecx
rol eax,cl
.exx:
xor ecx,ecx
ret
 
.Gif_output:
push esi eax edx
mov edx,[.table_ptr]
.next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz .next
shl ebx,16
mov bx,[esp]
.loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[.Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop .loop2
pop edx eax esi
ret
 
.globalColor rd 1
.img_count rd 1
.cur_info rd 1 ; image table pointer
.img_start rd 1
.codesize rd 1
.compsize rd 1
.bit_count rd 1
.CC rd 1
.EOI rd 1
.Palette rd 1
.block_ofs rd 1
.table_ptr rd 1
/programs/games/megamaze/trunk/MACROS.INC
0,0 → 1,264
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; language for programs
;lang fix ru ; ru en fr ge fi
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/programs/games/megamaze/trunk/blackbox.inc
0,0 → 1,300
RAY_NUM equ 100000b
RAY_ABS equ 1000000b
RAY_REF equ 10000000b
BBSIZE equ 10
ATOM_COUNT equ BBSIZE/2
 
CELL_EMPTY_CENTER equ 10100000b
CELL_ABSORBED equ 10000000b
CELL_REFLECTED equ 01000000b
CELL_EMPTY_EDGE equ 11000000b
CELL_FULL_EDGE equ 00100000b
MASK_ATOM equ 00000001b
MASK_GUESS equ 00000010b
MASK_ALL equ 11100000b
MASK_DIR equ 00000011b
 
BB_levelp:
mcall 40,100111b
mov byte[fx],BBSIZE
mov byte[fy],BBSIZE
and [cur_step],0
and [pause_time],0
call get_xy_sf.count
call erase_field
mov edi,field+1
mov ecx,BBSIZE-2
mov eax,CELL_EMPTY_EDGE+1
rep stosb
mov eax,CELL_EMPTY_CENTER
mov ecx,BBSIZE-2
.lp:
push ecx
mov word[edi],(CELL_EMPTY_EDGE+3) shl 8+CELL_EMPTY_EDGE
add edi,2
mov ecx,BBSIZE-2
rep stosb
pop ecx
loop .lp
mov word[edi],(CELL_EMPTY_EDGE+3) shl 8+CELL_EMPTY_EDGE
add edi,2
mov eax,CELL_EMPTY_EDGE+2
mov ecx,BBSIZE-2
rep stosb
 
mov ecx,BBSIZE/2
mov ebx,BBSIZE*BBSIZE
.again:
call get_rnd
xor edx,edx
div ebx
cmp byte[field+edx],CELL_EMPTY_CENTER
jne .again
or byte[field+edx],MASK_ATOM
loop .again
mov [win_flag],5
ret
 
BB_key:
cmp eax,-1
je BB_mouse
cmp eax,9
jne .ex
xor edx,edx
xor edi,edi
mov esi,field
mov ecx,BBSIZE*BBSIZE
.lp:
lodsb
mov ebx,eax
and eax,MASK_ALL;+MASK_ATOM
cmp eax,CELL_EMPTY_CENTER
jne .nxt
cmp ebx,CELL_EMPTY_CENTER+MASK_ATOM+MASK_GUESS
jne .nomatch
add dx,0x101
jmp .nxt
.nomatch:
test ebx,MASK_GUESS
jz .nxt
inc dh
.nxt:
loop .lp
cmp dh,ATOM_COUNT
je .chk
mov [win_flag],9
jmp .ex
.chk:
mov [win_flag],10
mov ebx,(BBSIZE-2)*4
mov ecx,ATOM_COUNT
sub cl,dl
imul ecx,ATOM_COUNT
sub ebx,ecx
sub ebx,[pause_time]
mov [score],ebx
.ex:
ret
 
BB_drawm:
mov eax,47
mov esi,0x100000ff
cmp [win_flag],5
jne .no5
mcall ,0x10000,ATOM_COUNT,<XFOFS+MSGXO,42>
.no5:
cmp [win_flag],10
jne .no10
mcall ,0x20000,[score],<XFOFS+MSGXO+12*8,42>
.no10:
cmp [win_flag],9
jne .no9
mcall ,0x10000,ATOM_COUNT,<XFOFS+MSGXO+11*8,42>
.no9:
mov ecx,[cell_count]
.lp:
push ecx
lea eax,[ecx-1]
movzx ebx,byte[field+eax]
call get_xy
mov eax,ebx
and eax,MASK_ALL
cmp eax,CELL_EMPTY_CENTER
jne .nocenter
test ebx,MASK_ATOM
jz .noatom
cmp [win_flag],10
jne .noatom
mov edx,0xff0000
push ebx
mcall 13,[lx],[ly]
pop ebx
.noatom:
test ebx,MASK_GUESS
jz .nxtlp
add [lx],2 shl 16-4
add [ly],2 shl 16-4
mov edx,0xffff00
.bar:
mcall 13,[lx],[ly]
.nxtlp:
pop ecx
loop .lp
.ex2:
ret
.nocenter:
mov edx,0xff
cmp eax,CELL_ABSORBED
je .bar
mov edx,0x8000
cmp eax,CELL_REFLECTED
je .bar
cmp eax,CELL_FULL_EDGE
jne .nxtlp
and ebx,11111b
mov ecx,ebx
push word[ly+2]
pop word[lx]
mov eax,[Ces]
shr eax,1
add word[lx],ax
add word[lx+2],ax
sub [lx],8 shl 16+6
mcall 47,0x20000,,[lx],0x10000000
jmp .nxtlp
 
corners db 0,BBSIZE-1,BBSIZE*BBSIZE-1,BBSIZE*(BBSIZE-1)
 
BB_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
mov eax,ebx
mov edi,corners
mov ecx,4
repne scasb
je .ex
movzx ebx,byte[field+eax]
mov ecx,ebx
and ecx,MASK_ALL
cmp ecx,CELL_EMPTY_CENTER
jne .nocenter
xor byte[field+eax],MASK_GUESS
mov [win_flag],11
jmp .red
.nocenter:
cmp ecx,CELL_EMPTY_EDGE
jne .ex
 
mov [player],eax
and ebx,MASK_DIR
.step:
mov [finish],eax
add eax,[dirs+ebx*4] ; 1 step
mov [stepptr],eax
movzx edx,byte[field+eax] ; cell ahead - edx
and edx,MASK_ALL+MASK_ATOM
cmp edx,CELL_EMPTY_CENTER+MASK_ATOM
jne .noabsorb
mov eax,[player]
mov byte[field+eax],CELL_ABSORBED
inc [pause_time]
mov [win_flag],7
jmp .red
.noabsorb:
lea ecx,[ebx-2]
and ecx,MASK_DIR
add eax,[dirs+ecx*4]
movzx edx,byte[field+eax] ; cell aside - edx
xor ecx,11b
and edx,MASK_ALL+MASK_ATOM
cmp edx,CELL_EMPTY_CENTER+MASK_ATOM
jne .noreflect1
.reflect:
mov eax,[finish]
cmp eax,[player]
je .endref
mov ebx,ecx ;new direction
jmp .nextstep
.noreflect1:
mov eax,[stepptr]
add eax,[dirs+ecx*4]
movzx edx,byte[field+eax] ; cell aside - edx
xor ecx,11b
and edx,MASK_ALL+MASK_ATOM
cmp edx,CELL_EMPTY_CENTER+MASK_ATOM
je .reflect
.noreflect2:
mov eax,[stepptr]
movzx edx,byte[field+eax]
and edx,MASK_ALL
cmp edx,CELL_EMPTY_CENTER
je .nextstep
 
cmp eax,[player]
je .endref
mov ebx,[cur_step]
add ebx,CELL_FULL_EDGE
mov byte[field+eax],bl
mov eax,[player]
mov byte[field+eax],bl
inc [cur_step]
mov [win_flag],6
add [pause_time],2
jmp .red
.endref:
mov eax,[player]
mov byte[field+eax],CELL_REFLECTED
mov [win_flag],8
inc [pause_time]
jmp .red
.nextstep:
jmp .step
 
.red:
mov [jump],drw
.ex:
ret
 
BB_level:
db 0
 
if lang eq ru
BB_help mstr \
'‚ è  楫ì á®á⮨⠢ ⮬, çâ®¡ë ®¡­ à㦨âì',\
'¯®«®¦¥­¨¥ ¯ï⨠ â®¬®¢ ¢ ç¥à­®¬ ï騪¥, ¯®áë« ï',\
'«ãç¨ á¢¥â  ¢ ª®à®¡ªã ¨ ­ ¡«î¤ ï, £¤¥ «ãç¨',\
'¯®ï¢«ïîâáï. €â®¬ ¨«¨ ¯®£«®â¨â «ãç, ¥á«¨ «ãç',\
'㯠¤¥â ­  ­¥£® ¢ 㯮à, ¨«¨ ®âª«®­¨â «ãç ­  90',\
'£à ¤ãᮢ, ¥á«¨ ®­ ¯à®©¤¥â ¯® ᬥ¦­®¬ã àï¤ã ¨«¨',\
'ª®«®­ª¥). Œ®£ã⠯ந§®©â¨ 2 ®âª«®­¥­¨ï, ¢ë­ã¦¤ ï',\
'«ãç ¢®§¢à â¨âìáï ¢® ¢å®¤­®© â®çª¥,- íâ® áç¨â ¥âáï',\
'®âà ¦¥­¨¥¬. …᫨ ¦¥« ¥â¥ ¯à®¢¥à¨âì á¥¡ï ¨ 㧭 âì',\
'áç¥â, ®â¬¥âì⥠5 ª«¥â®ª ¦¥«âë¬ æ¢¥â®¬ ¨ ­ ¦¬¨â¥',\
'TAB. ïâì áªàëâëå  â®¬®¢ ¡ã¤ãâ ¯®ª § ­ë ªà á­ë¬¨',\
'ª¢ ¤à â¨ª ¬¨.',\
' ‹ãç ¯®£«®é¥­ - ᨭ¨© ª¢ ¤à â;',\
' ‹ãç ®âà ¦¥­ - §¥«¥­ë© ª¢ ¤à â.',\
' —¨á« ¬¨ ®â¬¥ç¥­ë â®çª¨ ¢å®¤  ¨ ¢ë室  «ã祩.','',\
'http://puzzleprograms.narod.ru'
else
BB_help mstr \
'Your goal is to discover the whereabouts of five',\
'atoms in a black box by sending rays of light',\
'into the box and observing if and where the rays',\
'emerge. An atom will either absorb a ray if the',\
'ray hits it head on, or deflect a ray through 90',\
'if it comes close (passes through an adjacent row',\
'or column). Two deflections can occur at the same',\
'time forcing a ray to return and emerge at its',\
'entry point, this is referred to as reflection.','',\
'The challenge is to pin point the location of all',\
'atoms using the least number of rays. If you wish',\
'to commit your solution and to discover your',\
'score you must have exactly five guesses marked,',\
'then press TAB. The five hidden atoms will appear',\
'as red squares.','',\
'http://puzzleprograms.narod.ru'
end if
/programs/games/megamaze/trunk/colzone.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/colzone.inc
0,0 → 1,140
; level format
; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
 
; internal format
; [stepptr]= worms #
; area: [worm_len][start_cell #][end_cell #]..[dirs]..
; [cur_step]: dragged worm pointer
; [finish]: 0 - if head dragged, 1- if tail
CZ_levelp:
call get_xy_sf
call LP_levelp.bit2
mov dword[area],5;0
ret
 
CZ_key:
mov [jump],still
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov ecx,dword[area]
lea ebx,[eax-176]
mov eax,[player]
call check_bounds
je .ex
cmp ecx,5
jne .novert
.vert:
add eax,[dirs+ebx*4]
call check_bounds
je .ex
mov ecx,eax
add ecx,[dirs+ebx*4]
mov cl,[field+ecx]
cmp cl,[field+eax]
jne .ex
mov dword[area],ebx
.ok:
mov [player],eax
cmp eax,[finish]
jne .jm
cmp dword[area],5
jne .jm
mov [win_flag],1
.jm:
mov [jump],drw
.ex:
ret
.novert:
mov edx,ebx
cmp edx,ecx ; the same dir
jne .nosame
add eax,[dirs+ebx*4]
call check_bounds
je .ex
.set5:
mov dword[area],5
add eax,[dirs+ebx*4]
jmp .ok
.nosame:
xor edx,11b
cmp edx,ecx ; the opposite dir
je .set5
add eax,[dirs+ebx*4]
mov ebx,ecx
xor ecx,11b
add eax,[dirs+ecx*4]
jmp .vert
 
CZ_drawm:
mov ecx,[cell_count]
mov esi,field
mov [sq_size],3
.lp:
push ecx
movzx ebx,byte[field+ecx-1]
shr ebx,6
lea eax,[ecx-1]
call get_xy
add [lx],5-2 shl 16
add [ly],5-2 shl 16
mov edx,[f_colors+ebx*4]
mcall 13,[lx],[ly]
.no:
pop ecx
loop .lp
 
inc [sq_size]
mov eax,[player]
call get_xy
xor edx,edx
cmp dword[area],5
je .vert
push [lx]
push [ly]
mov edx,dword[area]
add eax,[dirs+edx*4]
call get_xy
mcall 13,[lx],[ly]
pop [ly]
pop [lx]
.vert:
mcall 13,[lx],[ly]
add [sq_size],5
mov eax,[finish]
call get_xy
mcall 13,[lx],[ly],0xffffff
 
ret
 
 
CZ_level:
file 'colzone.bin'
 
if lang eq ru
CZ_help mstr \
'—¥à­ë© ¡«®ª ¨§ 2 ªã¡¨ª®¢ á⮨⠭  à áªà è¥­­®©',\
'ª«¥âç â®© ¤®áª¥. ‚ è  § ¤ ç  - ¯¥à¥ª â¨âì ¥£® ­ ',\
'ª«¥âªã á ¡¥«ë¬ ª¢ ¤à â¨ª®¬. «®ª ­ ç¨­ ¥â áâ®ï ¨',\
'¤®«¦¥­ § ª®­ç¨âì ⮦¥ ¢ ¢¥à⨪ «ì­®¬ ¯®«®¦¥­¨¨.',\
'¥«ì§ï ¢ëª â뢠âì ¥£® §  ¯à¥¤¥«ë á¥âª¨ ¨ ᢥàå',\
'⮣® - ªã¡¨ª¨ ¡«®ª  ¤®«¦­ë ¢á¥£¤  «®¦¨âìáï ­ ',\
'ª«¥âª¨ ®¤¨­ ª®¢®£® 梥â . «®ª ­¥ ®â®¡à ¦¥­ ¢ 3D,',\
'¯®íâ®¬ã ‚ë ¢¨¤¨â¥ «¨èì ¥£® ¯à®¥ªæ¨î.','',\
'http://www.clickmazes.com'
else
CZ_help mstr \
'A black block, made of two black cubes stuck',\
'together, sits on a coloured grid. Your challenge',\
'is to roll the black block to its target',\
'position, which is marked with a small white',\
'square. The block starts on one end (vertical)',\
'and must also finish in this position. The block',\
'is not permitted to roll off the grid and, in',\
'addition, the block must always lie entirely',\
'within one colour-zone. Note the block is not',\
'displayed in 3D, in effect you see only its',\
'shadow.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/cstep.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/cstep.inc
0,0 → 1,66
; level format
; [fx|fy][blue xy][red xy]..[maze walls]
 
; internal format
; [player]= blue
; [finish]= red
 
 
CSTEP_key:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov esi,area
inc esi
lea ebx,[eax-176]
mov [jump],still
mov eax,[player]
call check_move
jc .ex
add eax,[dirs+ebx*4]
mov edx,eax
.nom1:
mov eax,[finish]
xor ebx,11b
call check_move
jc .ex
add eax,[dirs+ebx*4]
mov [finish],eax
mov [player],edx
mov [jump],drw
cmp eax,edx
jnz .ex
mov [win_flag],1
.ex:
ret
 
CSTEP_drawm:
mov eax,[player]
call get_xy
mcall 13,[lx],[ly],0xff0000
mov eax,[finish]
call get_xy
mcall 13,[lx],[ly],0xff
ret
 
CSTEP_level:
file 'cstep.bin'
 
if lang eq ru
CSTEP_help mstr \
'‘®¥¤¨­¨â¥ ªà á­ë© ¨ ᨭ¨© ¡«®ª¨ ¯ã⥬ ã¯à ¢«¥­¨ï',\
'®¤­¨¬ ªà á­ë¬ ¡«®ª®¬. ‘¨­¨© ¡«®ª á«¥¤ã¥â § ',\
'ªà á­ë¬, ­® ¤¢¨¦¥âáï ¢ ¯àאַ ¯à®â¨¢®¯®«®¦­®¬',\
'­ ¯à ¢«¥­¨¨. •®¤ à §à¥è¥­ ⮫쪮 ¢ á«ãç ¥',\
'®âáãâáâ¢¨ï ¯à¥¯ïâá⢨© ¤«ï ®¡®¨å ¡«®ª®¢.','',\
'http://www.clickmazes.com'
else
CSTEP_help mstr \
'Unite the red and blue dots by moving just the',\
'red dot. The blue dot follows the red dot, but',\
'moves in exactly in the opposite direction. A',\
'move is only permitted if the path is clear for',\
'both dots.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/debug.inc
0,0 → 1,137
macro debug_print str
{
local ..string, ..label
 
jmp ..label
..string db str,0
..label:
 
pushf
pushad
mov edx,..string
call debug_outstr
popad
popf
}
 
dps fix debug_print
 
macro debug_print_dec arg
{
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
call debug_outdec
popad
popf
}
 
dpd fix debug_print_dec
 
;---------------------------------
debug_outdec: ;(eax - num, edi-str)
push 10 ;2
pop ecx ;1
push -'0' ;2
.l0:
xor edx,edx ;2
div ecx ;2
push edx ;1
test eax,eax ;2
jnz .l0 ;2
.l1:
pop eax ;1
add al,'0' ;2
call debug_outchar ; stosb
jnz .l1 ;2
ret ;1
;---------------------------------
 
debug_outchar: ; al - char
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
 
debug_outstr:
mov eax,63
mov ebx,1
@@:
mov cl,[edx]
test cl,cl
jz @f
int 40h
inc edx
jmp @b
@@:
ret
 
_debug_crlf db 13, 10, 0
 
macro newline
{
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
 
macro print message
{
dps message
newline
}
 
macro pregs
{
dps "EAX: "
dpd eax
dps " EBX: "
dpd ebx
newline
dps "ECX: "
dpd ecx
dps " EDX: "
dpd edx
newline
}
 
macro debug_print_hex arg
{
pushf
pushad
if ~arg eq eax
mov eax, arg
end if
call debug_outhex
popad
popf
}
dph fix debug_print_hex
 
debug_outhex:
; eax - number
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mcall 63, 1
popad
dec edx
jnz .new_char
ret
 
__hexdigits:
db '0123456789ABCDEF'
/programs/games/megamaze/trunk/fhouse.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/fhouse.inc
0,0 → 1,197
FH_levelp:
mcall 40,100111b
call get_xy_sf
call erase_field
sub esi,2
mov [levptr],esi
movzx ecx,byte[esi-2]
sub ecx,2
xor eax,eax
.lp:
lodsb
mov byte[field+eax],-1
loop .lp
mov dword[player],-1
mov [win_flag],3
ret
 
FH_key:
cmp eax,-1
je FH_mouse
cmp eax,8
jne .nobsp
cmp [stepptr],0
jne .no1st
mov [jump],run.game
ret
.no1st:
mov [win_flag],0
sub [cur_step],2
mov esi,[cur_step]
mov edi,[finish]
mov eax,3
movzx ebx,byte[esi]
sub eax,ebx
movzx ecx,byte[esi+1]
.lp0:
and byte[field+edi],0
add edi,[dirs+eax*4]
loop .lp0
mov [finish],edi
dec [stepptr]
ret
.nobsp:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
sub eax,176
jmp FH_mouse.fromkey
.ex:
ret
 
FH_drawm:
mov ecx,[cell_count]
.lp:
push ecx
movzx ebx,byte[field+ecx-1]
test ebx,ebx
jz .no
lea eax,[ecx-1]
call get_xy
mov edx,0
cmp ebx,0xf
jne .stable
mov edx,0x909090
.stable:
mcall 13,[lx],[ly]
.no:
pop ecx
loop .lp
 
mov eax,[player]
cmp eax,-1
je .ex
call get_xy
mcall 13,[lx],[ly],0xff00
mov eax,[finish]
call get_xy
mcall 13,[lx],[ly],0xff0000
 
mov ecx,[stepptr]
jecxz .ex
mov ebx,area
mov edi,[player]
mov edx,0xffffff
.lp3:
push ecx
mov esi,edi
movzx eax,byte[ebx]
movzx ecx,byte[ebx+1]
add ebx,2
.lp2:
add edi,[dirs+eax*4]
loop .lp2
call getline
pop ecx
loop .lp3
.ex:
ret
 
FH_mouse:
mov [jump],drw;red
call get_last_mclick
cmp byte[field+ebx],0
jne .ex
cmp dword[player],-1
jne .nostart
mov dword[player],ebx
mov byte[field+ebx],0xf
mov [finish],ebx
and [win_flag],0
mov [cur_step],area
and [stepptr],0
ret
.nostart:
mov eax,[finish]
call get_offset
cmp eax,-1
je .ex
.fromkey:
xor ecx,ecx
mov edx,eax
mov esi,[finish]
.lp:
add esi,[dirs+edx*4]
cmp byte[field+esi],0
jnz .exlp
mov eax,[finish]
mov ebx,esi
call get_offset
cmp eax,edx
jne .exlp
mov byte[field+esi],0xf
inc ecx
mov [finish],esi
jmp .lp
 
.exlp:
jecxz .ex
mov eax,edx
mov edi,[cur_step]
stosb
mov [edi],cl
inc edi
mov [cur_step],edi
inc [stepptr]
mov edi,field
mov ecx,[cell_count]
xor eax,eax
repne scasb
je .ch_deadend
mov [win_flag],1
.ex:
ret
.ch_deadend:
mov ecx,4
mov edx,dirs
.lpp:
mov eax,[finish]
mov ebx,[edx]
add ebx,eax
push ebx
call get_offset
pop ebx
cmp eax,-1
je .nxtlp
cmp byte[field+ebx],0
jz .ex
.nxtlp:
add edx,4
loop .lpp
mov [win_flag],4
ret
 
FH_level:
file 'fhouse.bin'
 
if lang eq ru
FH_help mstr \
'‚ § ¤ ­¨¨ ­ ©¤¨â¥ ­ ç «ì­ãî ª«¥âªã ¨ ¯à®¢¥¤¨â¥',\
'«¨­¨î, ª®â®à ï ¯à®å®¤¨â ç¥à¥§ ¯ãáâë¥ ª«¥âª¨ ¯®',\
'®¤­®¬ã à §ã.',\
' Š ¦¤ë© à § ªà á­ë© ª¢ ¤à â ¤¢¨£ ¥âáï ¯àאַ,',\
'®áâ ­ ¢«¨¢ ïáì ⮫쪮 ã ªà ï, ¯¥à¥¤ ç¥à­ë¬¨',\
'ª¢ ¤à â ¬¨ ¨«¨ 㦥 ¯®á¥é¥­­ë¬¨ ª«¥âª ¬¨.','',\
'http://www.clickmazes.com'
else
FH_help mstr \
'For each puzzle find the starting square and draw',\
'a path moving horizontally and vertically that',\
'passes through each open square exactly once.','',\
'At each move the red runner will always run',\
'straight, as far as possible, stopping only when',\
"blocked by the grid's edge, a black square, or a",\
'square already visited.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/loops.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/loops.inc
0,0 → 1,245
LP_levelp:
mcall 40,100111b
inc [drag_flag]
lodsb
lodsw
mov byte[fx],al
mov byte[fy],ah
and dword[player],0
and dword[finish],0
call get_xy_sf.count
call erase_field
; mov [levptr],esi
.bit2:
mov edx,8/2
mov edi,field
lodsb
mov ecx,[cell_count]
.lp:
mov bl,al
rol al,2
and bl,11000000b
mov [edi],bl
inc edi
dec edx
test edx,edx
jnz .nxt
mov edx,8/2
lodsb
.nxt:
loop .lp
ret
 
LP_key:
cmp eax,0
jl LP_mouse
cmp eax,8
jne .nobsp
cmp [stepptr],0
jne .no1st
mov [jump],run.game
ret
.no1st:
mov [win_flag],0
sub [cur_step],2
mov esi,[cur_step]
mov edi,[finish]
mov eax,3
movzx ebx,byte[esi]
sub eax,ebx
movzx ecx,byte[esi+1]
.lp0:
and byte[field+edi],0
add edi,[dirs+eax*4]
loop .lp0
mov [finish],edi
dec [stepptr]
ret
.nobsp:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
sub eax,176
.ex:
ret
 
LP_drawm:
and [pause_time],0
mov ecx,[cell_count]
.lp:
push ecx
mov bl,byte[field+ecx-1]
push ebx
lea eax,[ecx-1]
mov ecx,eax
call get_xy
 
mov al,bl
and al,0xf
test bl,11000000b
jnz .noempty
mov esi,LP_aw
mov ecx,11
call LP_draw_alert
jmp .no
.noempty:
mov edx,0
test bl,10000000b
je .stable
mov edx,0xffffff
mov esi,LP_aw
mov ecx,7
jmp .d13
.stable:
mov esi,LP_em
mov ecx,9
.d13:
call LP_draw_alert
mcall 13,[lx],[ly]
.no:
mov esi,[esp+4]
dec esi
mov edi,esi
mov edx,0x0000FF
; ecx - cell #
test byte[esp],10b
je .no_dn
add edi,[dirs+4*1]
call getline
.no_dn:
test byte[esp],1000b
je .no_right
mov edi,esi
add edi,[dirs+4*3]
call getline
.no_right:
pop ebx
pop ecx
.valid:
loop .lp2
jmp .exlp
.lp2:
jmp .lp
.exlp:
 
mov esi,[player]
mov edi,[finish]
cmp esi,edi
je .ex
mov edx,0x7777FF
call getline
.ex:
cmp [pause_time],0
jne .ex2
xor ecx,ecx
xor ebx,ebx
mov edx,5
; eax - cur cell content, ebx - cell #, ecx - cell counter, edx - dir
.chwin:
movzx eax,byte[field+ebx]
and eax,0xf
btr eax,edx
bsf edx,eax
je .ex3
inc ecx
add ebx,[dirs+edx*4]
jz .ex3
xor edx,11b
jmp .chwin
.ex3:
cmp ecx,[cell_count]
jne .ex2
mov [win_flag],1
.ex2:
ret
 
LP_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
cmp edx,-2
jne .no1st
test eax,eax
jnz .noempty
mov eax,[player]
mov ebx,[finish]
call get_offset
mov ecx,eax
mov edx,0x101
shl dl,cl
xor ecx,11b
shl dh,cl
mov ecx,ebx
jecxz LP_drawm.ex2
mov esi,[player]
.lp:
xor [field+esi],dl
add esi,[dirs+eax*4]
xor [field+esi],dh
loop .lp
xor ebx,ebx
.noempty:
mov [player],ebx
jmp .exx
.no1st:
test eax,eax
jz .ex
mov eax,[player]
push ebx
call get_offset
pop ebx
cmp eax,-1
je .ex
.exx:
mov [finish],ebx
mov [jump],drw
; ud2
.ex:
ret
 
 
LP_aw db 1001b,0110b
LP_em db 0000b,0001b,0010b,0100b,1000b
LP_ab db 0011b,0101b,1100b,1010b,1001b,0110b
 
LP_draw_alert:
; al-cell, esi - ptr,ecx - len
.lp:
cmp al,[esi]
je .ex
inc esi
loop .lp
pusha
mov ebx,[lx]
mov ecx,[ly]
add ebx,4-2 shl 16
add ecx,4-2 shl 16
mcall 13,,,0xFFAAAA
mov [pause_time],eax
popa
.ex:
ret
 
LP_level:
file 'loops.bin'
 
if lang eq ru
LP_help mstr \
'—¥à¥§ ¢á¥ ª«¥âª¨ ¯àאַ㣮«ì­¨ª  ­¥®¡å®¤¨¬®',\
'¯à®¢¥á⨠§ ¬ª­ãâãî «®¬ ­ãî. à®å®¤ï ç¥à¥§ ç¥à­ë©',\
'ªà㦮ª, «®¬ ­ ï ®¡ï§ ­  ¯®¢¥à­ãâì,   ¯à®å®¤ï',\
'ç¥à¥§ ¡¥«ë© ªà㦮ª, «®¬ ­ ï ¯®¢®à ç¨¢ âì ­¥',\
'¬®¦¥â. ‚ ¯ãáâëå ¦¥ ª«¥âª å «®¬ ­ ï ¢¥¤¥â á¥¡ï ª ª',\
'§ å®ç¥â.','',\
'http://puzzleprograms.narod.ru'
else
LP_help mstr \
'You have to draw closed line over every grid',\
'cell. On black square line must turn, and it must',\
'go straight when over white square. The line may',\
'behave anyhow elsewhere.','',\
'http://puzzleprograms.narod.ru'
end if
/programs/games/megamaze/trunk/marble.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/marble.inc
0,0 → 1,138
; level format
; [fx|fy][hole xy][balls #]..[1-red,0-black xy]..[maze walls]
 
; internal format
; [stepptr]= balls #
; [finish]= hole cell
; area: ..[1-red,0-black xy].. ( -1 if empty)
 
MAR_levelp:
call get_xy_sf
movzx eax,byte[esi-2]
mov [finish],eax
movzx ecx,byte[esi-1]
mov [stepptr],ecx
mov edi,area
rep movsb
mov [pause_time],10
call unpack_level
ret
 
MAR_key:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov esi,area-1
lea ebx,[eax-176]
.again:
and [cur_step],0
mov ecx,[stepptr]
.lp:
movzx eax,byte[esi+ecx]
cmp al,-1
je .ex1
mov byte[player],al
and byte[player],0x80
and eax,0x7f
call check_move
jc .ex1
add eax,[dirs+ebx*4]
cmp eax,[finish]
jne .nohole
mov byte[esi+ecx],-1
jmp .ex2
.nohole:
push ecx
mov ecx,[stepptr]
mov edi,area
.lp2:
mov dl,[edi]
and dl,0x7f
cmp al,dl
je .exlp2
inc edi
loop .lp2
.exlp2:
pop ecx
je .ex1
or al,byte[player]
mov [esi+ecx],al
.ex2:
inc [cur_step]
.ex1:
loop .lp
cmp [cur_step],0
je .exx
call delay
call drwfld
jmp .again
.exx:
mov ecx,[stepptr]
inc esi
.lp3:
lodsb
cmp al,-1
je .nxt
test al,0x80
jne .ex
.nxt:
loop .lp3
mov [win_flag],1
.ex:
ret
 
MAR_drawm:
shl [sq_size],1
mov eax,[finish]
call get_xy
shr [sq_size],1
mcall 13,[lx],[ly],0xa0a0a0
movzx ecx,byte[stepptr]
mov edi,area
.lp:
push ecx
movzx eax,byte[edi]
mov edx,0x0
cmp al,-1
je .exlp
test eax,0x80
je .no
mov edx,0xff00000
.no:
and eax,0x7f
call get_xy
mcall 13,[lx],[ly]
.exlp:
pop ecx
inc edi
loop .lp
.ex:
ret
 
MAR_level:
file 'marble.bin'
 
if lang eq ru
MAR_help mstr \
'¥áª®«ìª® ªà á­ëå ¨ ç¥à­ëå ¯« è¥ª «¥¦ â ­  ¤®áª¥,',\
'¤ëઠ ®¡®§­ ç¥­  á¥à®© ª«¥âª®©. Š®£¤  ¯« èª ',\
'¯à®å®¤¨â ­ ¤ ¤ëમ©, ®­  ¯ ¤ ¥â â㤠 ¨ ¨á祧 ¥â.',\
'ˆá¯®«ì§ã©â¥ áâ५ª¨ ¤«ï ­ ª«®­  ¤®áª¨.',\
' ‚ è  § ¤ ç  - á¡à®á¨âì ¢á¥ ªà á­ë¥ ¯« èª¨.',\
'Š®«¨ç¥á⢮ 㯠¢è¨å ç¥à­ëå ¯« è¥ª ஫¨ ­¥ ¨£à ¥â.','',\
'http://www.clickmazes.com'
else
MAR_help mstr \
'Several red and black marbles sit on a flat tray,',\
'a grey square indicate a hole in the tray. If a',\
'marble rolls onto or over the hole it drops',\
'through and disappears. Use the cursor keys to',\
'tilt the tray and start the marbles rolling, the',\
'marbles roll in a straight line until they come',\
'to rest, you can then roll again. Your challenge',\
'is to drop all the red marbles, it does not',\
'matter how many black marbles you lose in the',\
'process.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/megamaze.asm
0,0 → 1,855
IDA equ 1 ; We're running debugida.exe
 
STRIP equ 40
LEVNUM equ 500
XFOFS equ 10
YFOFS equ 55
MSGXO equ 32
GAMES_ALL equ 12
WNDCOLOR equ 0x03c0c0c0;0x03f6f6f6;
MINCS equ 40
MAXCS equ 80
macro icall lbl
{
call [lbl+ebp*4]
}
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd run ; start of code
dd I_END ; size of image
dd end_mem ; memory for app
dd stack_end ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
lang fix ru
include "MACROS.INC"
purge mov
;include "DEBUG.INC"
COLOR_ORDER equ MENUETOS
 
include 'gif_lite.inc'
 
include 'tam.inc'
include 'smz.inc'
include 'tilt.inc'
include 'tilt2.inc'
include 'fhouse.inc'
include 'loops.inc'
include 'wriggle.inc'
include 'blackbox.inc'
include 'marble.inc'
include 'cstep.inc'
include 'orient.inc'
include 'nolt.inc'
include 'colzone.inc'
 
run:
mov [Ces],STRIP;20
mcall 3
mov cl,16
ror eax,cl
mov [generator],eax ; random generator from Tetris
 
and [mpress_flag],0
and [gif_unp],0
xor ebp,ebp ; game_t
; mov ebp,10
mcall 64,1,end_mem
mov [pause_time],40
call resize
.game1:
mov [levnum],LEVNUM
.game:
and [win_flag],0
and [drag_flag],0
mov ecx,[levnum]
mov esi,[levels+ebp*4]
jecxz .skip
.nxt:
movzx eax,byte[esi]
add esi,eax
xor eax,eax
cmp al,byte[esi]
jne .noz
mov esi,LEVNUM;500
sub esi,ecx
mov [levcount],esi
and [levnum],0
jmp .game
.noz:
loop .nxt
.skip:
mcall 40,111b
mov [mouse_processed],1
xor eax,eax
icall prepare_level
wnd_size:
mov eax,[Ces]
shr eax,2
sub eax,2
mov [sq_size],eax
if ~ IDA eq 1
mov edx,[fx]
imul edx,[Ces]
add edx,XFOFS*2+20
mov esi,[fy]
imul esi,[Ces]
add esi,YFOFS+30
mov ecx,-1
mcall 67,ecx
end if
red:
call draw_window
 
drw:
call drwfld
 
still:
mcall 2
test al,al
jz still
mcall 10
cmp eax,2
je key
cmp eax,1 ; redraw request ?
je red
cmp eax,3 ; button in buffer ?
je button
cmp eax,6 ; mouse event ?
je mouse
key:
mcall 2
; movzx ebx,ah
; dpd ebx
cmp ebp,10
je .noplus
mov ebx,5
cmp ah,184
jne .nomin
cmp [Ces],MINCS
je still
.ces:
sub [Ces],ebx
call resize
jmp wnd_size
.nomin:
cmp ah,183
jne .noplus
cmp [Ces],MAXCS
je still
neg ebx
jmp .ces
.noplus:
cmp ah,'h'
jne .nohlp
; if IDA eq 1
; cmp [child],0
; jne still
; else
call kill_help
; end if
mov [pack],ebp
mcall 51,1,show_help,chs_end
; dpd eax
mov [child],eax
jmp still
.nohlp:
cmp [win_flag],10
je .levover
cmp [win_flag],2
je .no_win
cmp [win_flag],1
jne .now
.levover:
call lev_next
.no_win:
and [win_flag],al
jmp run.game
.now:
shr eax,8
mov [jump],drw;red
cmp eax,13
je run.game
icall key_handler
jmp [jump]
 
button:
mcall 17
cmp ah,1
je close
cmp ah,2
je .game_type
cmp ah,4
je .inclev
cmp ah,3
je .declev
jmp still
.declev:
dec [levnum]
cmp [levnum],0
jge run.game
push [levcount]
pop [levnum]
jmp run.game
.inclev:
call lev_next
jmp run.game
.game_type:
inc ebp
cmp ebp,GAMES_ALL
jbe run.game1
xor ebp,ebp
jmp run.game1
close:
if ~ IDA eq 1
call kill_help
end if
mcall -1
 
;if ~ IDA eq 1
 
kill_help:
mcall 9,prc_info2,-1
mov edx,[child]
mov ecx,eax
.lp:
mcall 9
cmp edx,[ebx+30]
jne .nochild
mcall 18,2
and [child],0
ret
.nochild:
loop .lp
ret
 
;end if
 
mouse:
cmp [mouse_processed],1
jne .ex
mcall 37,1
sub eax,XFOFS shl 16+YFOFS
xor edx,edx
mov ebx,[Ces]
mov ecx,eax
and eax,0xffff
div ebx
xor edx,edx
mov [mouse_y],eax
cmp eax,[fy]
jae .ex
mov eax,ecx
shr eax,16
div ebx
mov [mouse_x],eax
cmp eax,[fx]
jae .ex
mcall 37,2 ; get buttons
cmp [drag_flag],0
je .nodrag
mov ebx,eax
cmp eax,[mpress_flag]
mov eax,-1
je .nochg
dec eax
.nochg:
mov [mpress_flag],ebx
jmp .call_hnd
.nodrag:
test eax,eax
jz .ex1
cmp eax,[mpress_flag]
je .ex
mov [mpress_flag],eax
mov eax,-1
.call_hnd:
mov [mouse_processed],0
icall key_handler
jmp [jump]
.ex1:
mov [mpress_flag],0
.ex:
jmp still
 
lev_next:
push eax
inc [levnum]
mov eax,[levnum]
cmp eax,[levcount]
jbe .ex
and [levnum],0
.ex:
pop eax
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
pusha
mcall 12,1
mov ebx,[fx]
imul ebx,[Ces]
push ebx
add ebx,50 shl 16+XFOFS*2+20
mov ecx,[fy]
imul ecx,[Ces]
add ecx,10 shl 16+YFOFS+30
mcall 0,,,WNDCOLOR
mov esi,edx
and esi,0xffffff
mcall 9,prc_info,-1
mov ebx,[esp]
pop ebx
add ebx,XFOFS shl 16+XFOFS*2
 
mcall 8,,<25,12>,2
 
mcall 8,<XFOFS,11>,<40,12>,3
add ebx,14 shl 16
inc edx
mcall
mcall 4,<8,8>,0x10ffffff,header,header.size
mov ecx,ebp
mov edx,game_names+4
call get_mstr
mcall ,<XFOFS+2,28>,0x8000
imul esi,6
add esi,3
shl esi,16
lea edx,[ebx+esi]
mcall 47,0x020001,levnum,,0x8000
 
mcall 4,<XFOFS+3,43>,0x108000,next_msg,3
mcall 12,2
popa
ret
 
unpack_level:
mov ecx,[cell_count]
mov edi,field
.lp:
movzx eax,byte[esi]
inc esi
shl ax,4
shr al,4
stosw
loop .lp
ret
 
get_xy:
; eax-coord
; out: [lx]-[x+2][CS-4],[ly]-[y+2][CS-4]
pusha
xor edx,edx
mov esi,[sq_size]
lea edi,[esi*2]
neg edi
add edi,[Ces]
mov [lx],edi
mov [ly],edi
mov ebx,[fx]
div bx
imul eax,[Ces]
imul edx,[Ces]
lea edx,[edx+XFOFS+esi]
lea eax,[eax+YFOFS+esi]
mov word[ly+2],ax
mov word[lx+2],dx
popa
ret
 
check_move:
; eax-coord, ebx-direction
; CF=0 if move is valid
bt dword[field+eax],ebx
ret
 
delay:
pusha
mcall 5,[pause_time]
popa
ret
 
get_mstr:
; in: edx,ecx
; out: edx,esi
mov esi,[edx-4]
jecxz .ex
lea edx,[edx+esi+4]
dec ecx
jmp get_mstr
.ex:
ret
 
maze_field:
mov edi,field
mov [ly],YFOFS shl 16+YFOFS
mov eax,38
mov ecx,[fy]
.lp1:
push ecx
mov [lx],XFOFS shl 16+XFOFS
mov ecx,[fx]
.lp2:
push ecx
xor esi,esi
.lp3:
mov edx,0xd0d0d0
bt dword[edi],esi
jnc .gray
mov edx,0
.gray:
mov ebx,[lx]
add ebx,[dir_ofs+esi*4]
mov ecx,[ly]
add ecx,[dir_ofs+esi*4+8]
mcall
inc esi
cmp esi,4
jb .lp3
inc edi
mov ecx,[Ces]
add word[lx],cx
add word[lx+2],cx
pop ecx
loop .lp2
mov ecx,[Ces]
add word[ly],cx
add word[ly+2],cx
pop ecx
loop .lp1
ret
 
grid_field:
mov edx,0xa0a0a0
mov eax,38
 
mov ecx,[fy]
mov ebx,[fx]
imul ebx,[Ces]
add ebx,XFOFS shl 16+XFOFS
mov esi,YFOFS shl 16+YFOFS
inc ecx
.lp1:
push ecx
mov ecx,esi
mcall
mov ecx,[Ces]
add esi,ecx
shl ecx,16
add esi,ecx
pop ecx
loop .lp1
 
mov ecx,[fx]
mov esi,[fy]
imul esi,[Ces]
add esi,YFOFS shl 16+YFOFS
mov ebx,XFOFS shl 16+XFOFS
inc ecx
.lp2:
push ecx
mov ecx,esi
mcall
mov ecx,[Ces]
add ebx,ecx
shl ecx,16
add ebx,ecx
pop ecx
loop .lp2
ret
 
get_xy_sf:
xor eax,eax
and [player],eax
mov [fx],eax
mov [fy],eax
lodsb
lodsb
mov ah,al
shr ah,4
and al,0xf
mov byte[fx],ah
mov byte[fy],al
lodsb
mov byte[player],al
lodsb
mov byte[finish],al
.count:
mov eax,[fx]
mov [dirs+4],eax
neg eax
mov [dirs+8],eax
mov eax,[fx]
imul eax,[fy]
mov [cell_count],eax
 
ret
 
get_last_mclick:
; out - eax=0 no click or outside field
; eax>0 button pressed, ebx=[xy]
mov [mouse_processed],1
mov eax,[mpress_flag]
mov ebx,[mouse_y]
imul ebx,[fx]
add ebx,[mouse_x]
ret
 
erase_field:
pusha
mov ecx,[cell_count]
xor eax,eax
mov edi,field
rep stosb
popa
ret
 
get_pxy:
; in: [pack] - cell#, out: word[pack] - packed [xy]
pusha
mov eax,[pack]
cdq
mov ebx,[fx]
div ebx
shl edx,8
add eax,edx
mov [pack],eax
popa
ret
 
check_bounds:
; in: eax - cell, ebx - dir
; out: ebx=-1 if bounds crossed
push eax ecx
mov ecx,eax
add ecx,[dirs+ebx*4]
mov ebx,ecx
call get_offset
mov ebx,eax
pop ecx eax
cmp ebx,-1
ret
 
get_offset:
; in: eax - start, ebx-end
; out: eax - dir or -1 if not straight
; ebx - distance
push ecx edx
mov ecx,-1
mov edx,[cell_count]
cmp eax,edx
jae .ex
cmp ebx,edx
jae .ex
mov [pack],eax
call get_pxy
mov eax,[pack]
mov [pack],ebx
call get_pxy
mov ebx,[pack]
cmp ah,bh ; compare X
jne .noX
mov ecx,1
sub bl,al
ja .ok
inc ecx
.ok2:
neg bl
jmp .ok
.noX:
cmp al,bl ; compare Y
jne .ex
inc ecx
sub bh,ah
mov bl,bh
jb .ok2
add ecx,3
.ok:
movzx ebx,bl
.ex:
mov eax,ecx
pop edx ecx
ret
 
show_help:
mov ebp,[pack]
.red:
mcall 12,1
mov ebx,[prc_info.x_start]
add ebx,[prc_info.x_size]
shl ebx,16
add ebx,310
mov ecx,[prc_info.y_start]
shl ecx,16
add ecx,220
mcall 0,,,0x03c0c0c0
mcall 4,<8,8>,0x00ffffff,help_hdr,help_hdr.size
mov ecx,ebp
mov edx,game_names+4
call get_mstr
sub esi,2
mcall 4,<6*help_hdr.size+15,8>,0x00ffffff
 
mov edx,[help_msg+ebp*4]
add edx,4
xor ecx,ecx
mov ebx,10 shl 16+30
.nxt:
mov esi,[edx-4]
jecxz .drw
dec ecx
lea edx,[edx+esi+4]
jmp .nxt
.drw:
cmp esi,-1
je .edraw
mcall ,,0x000000ff
mov ecx,1
add ebx,12
jmp .nxt
.edraw:
mcall 12,2
.still:
mcall 10
cmp eax,2
jne .nokey
mcall
jmp .close
.nokey:
cmp eax,1 ; redraw request ?
je .red
cmp eax,3 ; button in buffer ?
jne .still
mcall 17
cmp ah,1
jne .still
.close:
and [child],0
mcall -1
 
getline:
; in: esi,edi
pusha
mov eax,esi
call get_xy
mov ebx,[lx]
mov ecx,[ly]
mov eax,edi
call get_xy
mov bx,word[lx+2]
mov cx,word[ly+2]
mov eax,[Ces]
shr eax,1
sub eax,[sq_size]
add ebx,eax
add ecx,eax
shl eax,16
add ebx,eax
add ecx,eax
mov [lx],ebx
mov [ly],ecx
mcall 38
popa
ret
 
bold_line:
WGSPC equ 1
pusha
mov edi,WGSPC shl 16+WGSPC
add [lx],edi
add [ly],edi
mcall 38,[lx],[ly]
shl edi,1
sub ebx,edi
sub ecx,edi
mcall
popa
ret
 
get_rnd:
mov eax, [generator]
sub eax,0x43ab45b5 ; next random number
ror eax,1
xor eax,0x32c4324f
ror eax,1
mov [generator],eax
ret
 
drwfld:
pusha
mov ebx,[fx]
imul ebx,[Ces]
add ebx,XFOFS shl 16
mov ecx,[fy]
imul ecx,[Ces]
add ecx,YFOFS shl 16
mcall 13,,,WNDCOLOR
add ebx,26 shl 16-26
sub ecx,16 shl 16
mov cx,16
mcall
icall draw_field
icall draw_more
cmp [win_flag],0
jz .edraw
movzx ecx,[win_flag]
mov edx,msgs+4
call get_mstr
mcall 4,<XFOFS+MSGXO,42>,0x100000ff
.edraw:
popa
ret
 
resize:
mov eax,[Ces]
mov edi,dir_ofs+4
stosd
stosd
stosw
stosw
mov [edi+4],eax
ret
 
need_image:
; in: eax - gif pointer
cmp [gif_unp],0
jne .skip
push esi edi
mov esi,eax
mov eax,field
mov edi,raw_area
call ReadGIF
mov [gif_unp],1
pop edi esi
.skip:
ret
 
out_image:
; in: eax - coord, ebx - image #
 
STRIP2 = STRIP-2
pusha
call get_xy
mov edx,[lx]
mov dx,word[ly+2]
add edx,1 shl 16+1
imul ebx,STRIP2*STRIP2*3
add ebx,raw_area+12
mcall 7,,STRIP2 shl 16+STRIP2
popa
ret
 
OR_strip:
;file 'orient2.gif'
file 'orientg2.gif'
rd 2
gif_unp dd 0
 
; DATA AREA
help_hdr db 'MegaMaze Help -'
.size=$-help_hdr
 
dirs dd -1,0,0,1
dir_ofs dd 0, 1, 1, 1 shl 16+1, 0, 1
 
dir_rotate db 2,0,3,1,1,3,0,2
 
w_colors dd 0x0404CA,0xCC0404,0x00CC00
f_colors dd 0x9494FC,0xFC9494,0x99FF99,0xFFFF00
 
levnum dd LEVNUM
 
prepare_level dd TM_levelp,SMZ_levelp,TILT_levelp,TILT2_levelp,FH_levelp,\
LP_levelp,WG_levelp,BB_levelp,MAR_levelp,TM_levelp,OR_levelp,NLT_levelp,\
CZ_levelp
key_handler dd TM_key,SMZ_key,TILT_key,TILT2_key,FH_key,LP_key,WG_key,BB_key,\
MAR_key,CSTEP_key,OR_key,NLT_key,CZ_key
draw_more dd TM_drawm,SMZ_drawm,TILT_drawm,TILT2_drawm,FH_drawm,LP_drawm,\
WG_drawm,BB_drawm,MAR_drawm,CSTEP_drawm,OR_drawm,NLT_drawm,CZ_drawm
draw_field dd maze_field,maze_field,maze_field,maze_field,grid_field,\
grid_field,grid_field,grid_field,maze_field,maze_field,OR_drawf,maze_field,\
grid_field
levels dd TM_level,SMZ_level,TILT_level,TILT2_level,FH_level,LP_level,\
WG_level,BB_level,MAR_level,CSTEP_level,OR_level,NLT_level,CZ_level
help_msg dd TM_help,SMZ_help,TILT_help,TILT2_help,FH_help,LP_help,WG_help,\
BB_help,MAR_help,CSTEP_help,OR_help,NLT_help,CZ_help
 
if lang eq ru
header db 'Mega Maze'
else
header db 'Mega Maze'
end if
.size = $ - header
 
next_msg db '< >'
 
game_names mstr \
'Teseus & Minotaur #',\
'1-2-3 Maze #',\
'Tilt Maze #',\
'Double Tilt #',\
'Full-house #',\
'Loops #',\
'Wriggle #',\
'BlackBox #',\
'Marble #',\
'Counter Step #',\
'Orientation #',\
'No left turn #',\
'Colour-zone #'
 
msgs mstr ' ','You win!!!','Game over.','Start cell?','Dead end!',\
" atoms hidden.",'Ray emerged.','Ray absorbed.','Ray reflected.',\
'Mark exactly guesses','Your score is','Guess mark toggled'
 
I_END:
main_pid dd ?
child_stack rb 256
chs_end:
drag_flag db ?
sq_size dd ?
mouse_processed dd ?
mpress_flag dd ?
mouse_x dd ?
mouse_y dd ?
 
Ces dd ?
pack dd ?
fy dd ?
fx dd ?
lx dd ?
ly dd ?
generator dd ?
cell_count dd ?
levptr dd ?
levcount dd ?
 
score dd ?
player:
teseus dd ?
finish:
minotaur dd ?
 
stepptr dd ?
cur_step dd ?
 
win_flag db ?
jump dd ?
pause_time dd ?
child dd ?
area rb 1024
stak rb 1024
stack_end:
prc_info process_information
prc_info2 process_information
field:
rb 128*128
raw_area:
rb STRIP*STRIP*12*3+16
end_mem:
/programs/games/megamaze/trunk/nolt.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/nolt.inc
0,0 → 1,92
NLT_levelp:
mov eax,OR_strip
call need_image
xor eax,eax
lodsb
lodsb
mov [fx],eax
lodsb
mov [fy],eax
lodsw
mov [player],eax
mov dword[area],5
lodsw
mov [finish],eax
call get_xy_sf.count
mov [levptr],esi
call unpack_level
ret
 
NLT_key:
mov [jump],still
cmp eax,176
jb .ex
cmp eax,179
ja .ex
lea ebx,[eax-176]
mov eax,[player]
call check_move
jc .ex
mov ecx,ebx
mov edx,ebx
movzx ecx,byte[dir_rotate+ecx]
cmp ecx,dword[area]
je .ex
xor edx,11b
cmp edx,dword[area]
je .ex
add eax,[dirs+ebx*4]
mov dword[area],ebx
mov [player],eax
cmp eax,[finish]
jne .nowin
mov [win_flag],1
.nowin:
mov [jump],drw
.ex:
ret
 
NLT_drawm:
push [sq_size]
mov [sq_size],0
mov eax,[finish]
mov ebx,6
call out_image
; mcall 13,[lx],[ly],0xff0000
mov ebx,dword[area]
cmp ebx,5
jne .skip
mov eax,[player]
mov edi,eax
pop [sq_size]
call get_xy
mcall 13,[lx],[ly],0x8000
jmp .ex
.skip:
add ebx,8
mov eax,[player]
call out_image
pop [sq_size]
.ex:
ret
 
NLT_level:
file 'nolt.bin'
 
if lang eq ru
NLT_help mstr \
'‚ è  § ¤ ç  - ¯à®¢¥á⨠§¥«¥­ë© ª¢ ¤à â ª ªà á­®¬ã',\
'¡¥§ ¯®¢®à®â  ­ «¥¢® ¨ ¤¢¨¦¥­¨ï ­ § ¤. â® âà㤭¥¥',\
'祬 ª ¦¥âáï. ‚­¨¬ ­¨¥: ¥á«¨ ‚ë ¯à¨¬¥â¥ ¯«®å®¥',\
'à¥è¥­¨¥, ¬®¦¥â¥ ¯®¯ áâì ¢ â㯨ª ¨ ¡ã¤¥â¥',\
'¢ë­ã¦¤¥­ë ­ ç âì á­ ç « .','',\
'http://puzzleprograms.narod.ru'
else
NLT_help mstr \
'Your challenge is to manouvre the green dot to',\
'the red square without ever turning left, or',\
'making a U-turn. Harder than it looks. Beware, if',\
'you make a bad decision in this maze you may get',\
'completely stuck and have to restart.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/omaze.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/or2.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/orient.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/orient.inc
0,0 → 1,227
; level format
; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
 
; internal format
; [stepptr]= worms #
; area: [worm_len][start_cell #][end_cell #]..[dirs]..
; [cur_step]: dragged worm pointer
; [finish]: 0 - if head dragged, 1- if tail
 
OR_levelp:
mov [Ces],40
mcall 40,100111b
inc [drag_flag]
mov eax,OR_strip
call need_image
inc esi
movzx ecx,byte[esi]
inc esi
push esi
mov esi,OR_maze
jecxz .sk
.nxtmz:
movzx eax,byte[esi]
add esi,eax
loop .nxtmz
.sk:
call get_xy_sf
call unpack_level
pop esi
movzx ecx,byte[esi]
inc esi
mov [cur_step],ecx
jecxz .sk2
mov edi,area
rep movsb
.sk2:
mov ecx,[cell_count]
mov edi,area+16
rep movsb
mov [stepptr],2
; call erase_field
; ud2
ret
 
OR_key:
cmp eax,0
jl OR_mouse
ret
 
OR_drawf:
mov ecx,[cell_count]
push [sq_size]
mov [sq_size],0
.lp:
push ecx
movzx ebx,byte[area+16+ecx-1]
cmp bl,0xf
je .no
lea eax,[ecx-1]
call out_image
.no:
pop ecx
loop .lp
pop [sq_size]
ret
 
OR_drawm:
push [sq_size]
mov [sq_size],0
mov eax,[player]
mov ebx,[stepptr]
add ebx,8
call out_image
mov ecx,[cur_step]
jecxz .skipb
mov ebx,7
mov esi,area
xor eax,eax
.nxtb:
lodsb
call out_image
loop .nxtb
.skipb:
mov eax,[player]
.again:
mov ebx,[stepptr]
call check_move
jc .ex
add eax,[dirs+ebx*4]
cmp byte[area+16+eax],6
je .ex
mov ecx,[cur_step]
jecxz .skbchk
mov edi,area
repne scasb
je .again
.skbchk:
mov [sq_size],1
push eax
call get_xy
mov ebx,[lx]
sub bx,2
mov ecx,[ly]
mov cx,3
mcall 13,,,0xFFC633
xchg bx,cx
mcall
mov esi,[Ces]
sub esi,3+2
shl esi,16
push ebx
add ebx,esi
mcall
pop ebx
add ecx,esi
xchg bx,cx
add bx,2
mcall
pop eax
jmp .again
.ex:
pop [sq_size]
ret
 
OR_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
cmp edx,-2
jne .ex
test eax,eax
jnz .noempty
.drw:
mov [jump],drw
ret
.noempty:
 
; First Click at ebx cell
mov eax,[player]
cmp eax,ebx
je OR_drawf
mov ecx,[cur_step]
jecxz .skbchk
mov edi,area
xchg eax,ebx
repne scasb
xchg eax,ebx
je OR_drawf
.skbchk:
cmp byte[area+16+ebx],0xf
je .ex
cmp byte[area+16+ebx],6
je .ex
push eax
mov edx,ebx
call get_offset
mov ebx,eax
pop eax
cmp ebx,[stepptr]
jne .ex
 
call check_move
jc .ex
movzx ecx,byte[area+16+edx]
cmp ecx,4
jae .noarr
mov ebx,ecx
call check_move
jc .ex
mov edx,eax
add eax,[dirs+ebx*4]
mov [player],eax
mov ecx,[cur_step]
jecxz .skbchk2
mov edi,area
repne scasb
jne .skbchk2
mov [edi-1],dl
.skbchk2:
cmp eax,[finish]
jne .drw
mov [win_flag],1
jmp .drw
.noarr:
mov edx,[stepptr]
cmp ecx,4
jne .nocw
movzx edx,byte[dir_rotate+edx]
jmp .ex2
.nocw:
cmp ecx,5
jne .ex
movzx edx,byte[dir_rotate+4+edx]
.ex2:
mov [stepptr],edx
jmp .drw
.ex:
ret
 
OR_maze:
file 'omaze.bin'
 
OR_level:
file 'or2.bin'
 
if lang eq ru
OR_help mstr \
'™¥«ç®ª ­  ¢ë¤¥«¥­­®© ª«¥âª¥ ¯¥à¥¤¢¨£ ¥â ¨«¨',\
'¢à é ¥â ªà á­ãî áâ५ªã. ‘¨­¨© ¡«®ª ¤¥©áâ¢ã¥â',\
'ª ª ¯à¥¯ïâá⢨¥, áªàë¢ ï ®¤­ã ª«¥âªã. à¨',\
'¯¥à¥å®¤¥ áâ५ª¨ ­  ª«¥âªã ᨭ¥£® ¡«®ª  ®­¨',\
'¯®¬¥­ïîâáï ¬¥áâ ¬¨. ‡ ¤ ç  - ¯à®¢¥á⨠ªà á­ãî',\
'áâ५ªã ¨§ ­¨¦­¥© ª«¥âª¨ ¢ ¢¥àå­îî.','',\
'http://www.clickmazes.com'
else
OR_help mstr \
'Click on a highlighted square to move or rotate',\
'the red pointer. The blue switcher acts as an',\
'obstacle, hiding one square. The red pointer and',\
'blue switcher will swap places if the red pointer',\
'is pushed onto a square occupied by a blue',\
'switcher. Your challenge is to negotiate the red',\
'arrow from the bottom to the top square.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/orientg2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/smz.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/smz.inc
0,0 → 1,94
SMZ_levelp:
call get_xy_sf
xor eax,eax
mov [stepptr],esi
lodsb
mov [cur_step],esi
add esi,eax
mov [levptr],esi
call unpack_level
ret
 
SMZ_key:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov ecx,[cur_step]
movzx ecx,byte[ecx]
lea ebx,[eax-176]
mov eax,[player]
.lp:
call check_move
jc .exl
add eax,[dirs+ebx*4]
loop .lp
.exl:
test ecx,ecx
jne .ex
mov [player],eax
cmp eax,[finish]
jne .nowin
mov [win_flag],1
.nowin:
mov esi,[stepptr]
movzx eax,byte[esi]
inc esi
lea ebx,[esi+eax]
inc [cur_step]
cmp [cur_step],ebx
jb .ex
mov [cur_step],esi
.ex:
ret
 
SMZ_drawm:
mov eax,[player]
call get_xy
mcall 13,[lx],[ly],0xff00
mov eax,[finish]
call get_xy
mcall 13,[lx],[ly],0xff0000
cmp [win_flag],1
je .ex
mov edi,[stepptr]
movzx ecx,byte[edi]
inc edi
mov edx,(XFOFS+MSGXO) shl 16+42
mov ebx,0x010000
mov eax,47
.lp:
push ecx
mov esi,0x10000000
movzx ecx,byte[edi]
cmp edi,[cur_step]
jne .nocur
mov esi,0x100000ff
mcall
add edx,1 shl 16
.nocur:
mcall
pop ecx
add edx,10 shl 16
inc edi
loop .lp
.ex:
ret
 
SMZ_level:
file 'smz.bin'
 
if lang eq ru
SMZ_help mstr \
'®¢â®àï©â¥ ¯®á«¥¤®¢ â¥«ì­®áâì 室®¢, ¤¢¨£ ï',\
'§¥«¥­ë© ª¢ ¤à â ­  ¯®¤á¢¥ç¥­­®¥ ª®«¨ç¥á⢮ ª«¥â®ª',\
'¯® ¯àאַ©, ¯®ª  ­¥ ¤®á⨣­¥â¥ ªà á­®£® ª¢ ¤à â .','',\
'http://puzzleprograms.narod.ru'
else
SMZ_help mstr \
'Repeat sequence shown above the field moving the',\
'green square by highlighted count of spaces as',\
'many times as you like, until you finish at the',\
'red square.','',\
'http://puzzleprograms.narod.ru'
end if
/programs/games/megamaze/trunk/tam.INC
0,0 → 1,164
TM_levelp:
call get_xy_sf
mov [levptr],esi
call unpack_level
ret
 
TM_key:
cmp eax,' '
je .mm
cmp eax,176
jb .still
cmp eax,179
ja .still
lea ebx,[eax-176]
mov eax,[teseus]
call check_move
jc .still
call move_teseus
cmp [win_flag],0
jne .ex
.nowin:
call drwfld
.mm:
call move_minotaur
cmp eax,[teseus]
jne .still
mov [win_flag],2
jmp .ex
.still:
mov [jump],still
.ex:
ret
 
move_minotaur:
xor esi,esi
mov eax,[teseus]
mov ebx,[fx]
div bl
mov ecx,eax ;teseus: ch-x, cl-y
mov eax,[minotaur]
.again:
call mino_xy
xor ebx,ebx
cmp dh,ch
je .stand2
ja .ok1
add ebx,3
.ok1:
call check_move
jc .stand2
add eax,[dirs+ebx*4]
mov [minotaur],eax
inc esi
call delay
call drwfld
cmp esi,2
jb .again
jmp .ex
.stand1:
call mino_xy
.stand2:
mov ebx,2
cmp dl,cl
je .ex
ja .ok2
dec ebx
.ok2:
call check_move
jc .ex
add eax,[dirs+ebx*4]
mov [minotaur],eax
inc esi
call delay
call drwfld
cmp esi,2
jb .again
.ex:
ret
 
mino_xy:
push eax
div byte[fx]
mov edx,eax ;minotaur: dh-x, dl-y
pop eax
ret
 
move_teseus:
pusha
cdq
mov ecx,[fx]
div cl
add ax,1 shl 8+1
test ebx,ebx
jne .no0
cmp ah,1
jne .move
.win:
inc [win_flag]
jmp .ex
.no0:
cmp ebx,1
jne .no1
cmp al,byte[fy]
je .win
jmp .move
.no1:
cmp ebx,2
jne .no2
cmp al,1
je .win
jmp .move
.no2:
cmp ebx,3
jne .move
cmp ah,byte[fx]
je .win
.move:
mov eax,[esp+28]
add eax,[dirs+ebx*4]
mov [teseus],eax
.ex:
popa
ret
 
TM_drawm:
mov eax,[teseus]
call get_xy
mcall 13,[lx],[ly],0xff00
mov eax,[minotaur]
call get_xy
mcall 13,[lx],[ly],0xff0000
ret
 
TM_level:
file 'tam.bin'
 
if lang eq ru
TM_help mstr \
' ’¥á¥© (§¥«¥­ë© ª¢ ¤à â) ¤®«¦¥­ ã¡¥¦ âì ¨§',\
'« ¡¨à¨­â . ‡  ­¨¬ £®­¨âáï ¬¥å ­¨ç¥áª¨© Œ¨­®â ¢à',\
'(ªà á­ë© ª¢ ¤à â).   ª ¦¤ë© 室 ’¥á¥© Œ¨­®â ¢à',\
'¤¥« ¥â 2 室  ¯® â ª®© á奬¥:',\
' ‘­ ç «  ®­ ¯ëâ ¥âáï ¯à¨¡«¨§¨âìáï ª ’¥á¥î ¯®',\
'£®à¨§®­â «¨ ­  1 ª¢ ¤à â. …᫨ íâ® ­¥¢®§¬®¦­®,',\
'®­ ¯ëâ ¥âáï ¯®¤®©â¨ ¯® ¢¥à⨪ «¨ ­  1 ª¢ ¤à â.',\
'…᫨ ­¥¢®§¬®¦­® ᤥ« âì ­¨ ⮣®, ­¨ ¤à㣮£®,',\
'Œ¨­®â ¢à ¯à®¯ã᪠¥â ¤ ­­ë© 室.','',\
'http://puzzleprograms.narod.ru'
else
TM_help mstr \
' Theseus (the green dot) must escape from a maze.',\
'There is also a mechanical Minotaur (the red',\
'dot) in each maze. For every turn that Theseus',\
'takes, the Minotaur takes two turns.',\
' Each turn he decides following:',\
'First he tests if he can move horizontally and',\
'get closer to Theseus. If he can, he will move',\
"one square horizontally. If he can't, he will",\
'test if he could move vertically and get closer',\
'to Theseus. If he can, he will move one square',\
"vertically. If he can't move either horizontally",\
'or vertically, then he just skips that turn.','',\
'http://puzzleprograms.narod.ru'
end if
/programs/games/megamaze/trunk/tam.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/tilt.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/tilt.inc
0,0 → 1,93
TILT_levelp:
call SMZ_levelp
mov esi,[stepptr]
movzx ecx,byte[esi]
mov [finish],ecx
inc ecx
mov edi,area
rep movsb
mov [pause_time],10
ret
 
TILT_key:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov esi,area
inc esi
lea ebx,[eax-176]
mov eax,[player]
.lp:
call check_move
jc .ex1
add eax,[dirs+ebx*4]
movzx ecx,byte[esi-1]
mov edi,esi
repne scasb
jne .notfound
mov byte[edi-1],0xff
dec dword[finish]
.notfound:
mov [player],eax
call delay
call drwfld
jmp .lp
.ex1:
cmp dword[finish],0
jnz .ex
mov [win_flag],1
.ex:
ret
 
TILT_drawm:
mov eax,[player]
call get_xy
mcall 13,[lx],[ly],0xff00
cmp [win_flag],1
je .ex
mov edi,area
movzx ecx,byte[edi]
jecxz .ex
inc edi
.lp:
push ecx
movzx eax,byte[edi]
cmp eax,0xff
je .no
call get_xy
mcall 13,[lx],[ly],0xff0000
.no:
pop ecx
inc edi
loop .lp
.ex:
ret
 
TILT_level:
file 'tilt.bin'
 
if lang eq ru
TILT_help mstr \
'« èª  (§¥«¥­ë© ª¢ ¤à â) «¥¦¨â ­  ¤®áª¥, ª®â®àãî',\
'¬®¦­® ­ ª«®­ïâì ¯® £®à¨§®­â «¨ ¨ ¢¥à⨪ «¨',\
' ®á«¥ ­ ª«®­  ¯« èª  ᪮«ì§¨â, ¯®ª  ­¥ ­ âª­¥âáï',\
'­  á⥭ªã. ¥«ì§ï ®áâ ­®¢¨âì ¯« èªã ¢® á¥à¥¤¨­¥',\
'¯ãâ¨.',\
' ‚ è  § ¤ ç  - § áâ ¢¨âì ¯« èªã ¯®á¥â¨âì ª«¥âª¨',\
'á ªà á­ë¬¨ ª¢ ¤à â ¬¨.','',\
'http://www.clickmazes.com'
else
TILT_help mstr \
'You are to imagine that a marble (shown here as a',\
'green square) is on a board that you can tilt',\
'only to the north, south, east, or west. (You',\
"can't do anything tricky like tilt it southeast.)",\
' Once you tilt the board, the marble will roll',\
'(horizontally or vertically) until it hits a',\
"barrier. There's no way you can stop the marble",\
'in the middle of its roll.',\
' The object is to roll the marble onto or over',\
'every red square in the maze.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/tilt2.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/tilt2.inc
0,0 → 1,105
; level format
; [fx|fy][blue xy][red xy][blue point xy][red point xy]..[maze walls]
 
; internal format
; points db=[stepptr]
; [player]= blue
; [finish]= red
; area: ..[1-red,0-black xy].. ( -1 if empty)
 
TILT2_levelp:
call get_xy_sf
mov [stepptr],esi
add esi,2
call unpack_level
mov [pause_time],10
ret
 
TILT2_key:
cmp eax,176
jb .ex
cmp eax,179
ja .ex
mov esi,area
inc esi
lea ebx,[eax-176]
.lp:
xor edx,edx
mov eax,[player]
call check_move
jc .nom1
inc edx
add eax,[dirs+ebx*4]
mov [player],eax
.nom1:
mov eax,[finish]
call check_move
jc .nom2
inc edx
add eax,[dirs+ebx*4]
mov [finish],eax
.nom2:
test edx,edx
jz .ex1
call delay
call drwfld
jmp .lp
.ex1:
mov eax,[finish]
cmp eax,[player]
jnz .ex2
mov [win_flag],2
jmp TILT2_drawm.skip
.ex2:
mov esi,[stepptr]
cmp al,[esi+1]
jne .ex
mov eax,[player]
cmp al,[esi]
jne .ex
mov [win_flag],1
.ex:
ret
 
TILT2_drawm:
cmp [win_flag],2
je .skip
; mov [sq_size],3
mov eax,[player]
call get_xy
mcall 13,[lx],[ly],0xff
mov eax,[finish]
call get_xy
mcall 13,[lx],[ly],0xff0000
.skip:
shl [sq_size],1
mov esi,[stepptr]
lodsb
call get_xy
mcall 13,[lx],[ly],0xff
lodsb
call get_xy
shr [sq_size],1
mcall 13,[lx],[ly],0xff0000
ret
 
TILT2_level:
file 'tilt2.bin'
 
if lang eq ru
TILT2_help mstr \
'Šà á­ë© ¨ ᨭ¨© ¡«®ª¨ ¤®«¦­ë ¤®áâ¨çì ª«¥â®ª',\
'ᮮ⢥âáâ¢ãî饣® 梥â . ‚­¨¬ ­¨¥! «®ª¨ ᤥ« ­ë',\
'¨§  £à¥áᨢ­®£® ¬ â¥à¨ « , ¨ ¯à¨ á⮫ª­®¢¥­¨¨',\
'¬£­®¢¥­­® ¨á¯ àïîâáï. ‚ í⮬ á«ãç ¥ ‚ ¬ ¯à¨¤¥âáï',\
'­ ç âì ã஢¥­ì á­ ç « .','',\
'http://www.clickmazes.com'
else
TILT2_help mstr \
'The red block must reach the red target and the',\
'blue block the blue target. Beware! The two',\
'blocks are made of highly reactive material and,',\
'if they collide, will instantly evaporate. At',\
'this point you must start all over again.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk/wriggle.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/megamaze/trunk/wriggle.inc
0,0 → 1,251
; level format
; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
 
; internal format
; [stepptr]= worms #
; area: [worm_len][start_cell #][end_cell #]..[dirs]..
; [cur_step]: dragged worm pointer
; [finish]: 0 - if head dragged, 1- if tail
WG_levelp:
mcall 40,100111b
inc [drag_flag]
call get_xy_sf
sub esi,2
call LP_levelp.bit2
cmp edx,4
jne .ok
dec esi
.ok:
movzx ecx,byte[esi]
mov [stepptr],ecx
inc esi
xor eax,eax
mov edi,area
.lp1:
push ecx
movzx ecx,byte[esi]
inc esi
mov [edi],cl
inc edi
lodsb
dec ecx
movzx ebx,al
stosb
push edi
inc edi
mov edx,8/2
lodsb
.lp:
rol al,2
push ecx
mov cl,al
and ecx,11b
add ebx,[dirs+ecx*4]
mov [edi],cl
pop ecx
inc edi
dec edx
test edx,edx
jnz .nxt
mov edx,8/2
lodsb
.nxt:
loop .lp
cmp edx,4
jne .ok2
dec esi
.ok2:
pop ecx
mov [ecx],bl
pop ecx
loop .lp1
mov esi,[stepptr]
ret
 
WG_key:
cmp eax,0
jl WG_mouse
ret
 
WG_drawm:
mov [win_flag],1
mov ecx,[cell_count]
; mov [sq_size],3
.lp:
push ecx
movzx ebx,byte[field+ecx-1]
and byte[field+ecx-1],11000000b
shr ebx,6
test ebx,ebx
jz .no
dec ebx
lea eax,[ecx-1]
call get_xy
add [lx],5-2 shl 16
add [ly],5-2 shl 16
mov edx,[f_colors+ebx*4]
mcall 13,[lx],[ly]
.no:
pop ecx
loop .lp
 
add [sq_size],3
 
mov ecx,[stepptr]
xor eax,eax
mov esi,area
push ebp
mov edi,w_colors
mov dword[player],1
.lp2:
push ecx
movzx ecx,byte[esi]
inc esi
xor eax,eax
lodsb
mov ebp,esi
.lp1:
inc esi
push ecx eax
call get_xy
mcall 13,[lx],[ly],[edi]
pop eax
mov ecx,[player]
mov bl,[field+eax]
shr bl,6
add [field+eax],cl
cmp bl,cl
je .match
and [win_flag],0
.match:
pop ecx
push esi edi
movzx ebx,byte[esi]
mov esi,eax
mov [ebp],al
add eax,[dirs+ebx*4]
 
cmp ecx,1
je .skip
mov edi,eax
call getline
call bold_line
.skip:
pop edi esi
loop .lp1
pop ecx
add edi,4
inc dword[player]
loop .lp2
pop ebp
sub [sq_size],3
 
ret
 
WG_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
cmp edx,-2
jne .no1st
test eax,eax
jz .ex
.noempty:
 
; First Click at ebx cell
; dpd ebx
mov [cur_step],0
mov dword[finish],0
mov esi,area
mov ecx,[stepptr]
.fndlp:
movzx edx,byte[esi]
cmp bl,[esi+1]
je .fnd
cmp bl,[esi+2]
jne .nxt
inc dword[finish]
.fnd:
mov [cur_step],esi
mov [jump],drw;red
jmp .ex
.nxt:
lea esi,[esi+edx+2]
loop .fndlp
jmp .ex
 
.no1st:
test eax,eax
jz .ex
; While dragging
mov esi,[cur_step]
test esi,esi
jz .ex
lea edi,[esi+1]
add edi,[finish]
movzx eax,byte[edi]
cmp eax,ebx
je .ex
push ebx
cmp dword[finish],0
jne .noswap
xchg eax,ebx
.noswap:
call get_offset
cmp ebx,1
pop ebx
jne .ex
cmp eax,-1
je .ex
test byte[field+ebx],11b
jnz .ex
movzx ecx,byte[esi]
cmp dword[finish],0
jne .tail
mov [esi+1],bl
mov [esi+2],al
add esi,ecx
std
lea edi,[esi+1]
rep movsb
jmp .redex
 
.tail:
mov [esi+2],bl
movzx ebx,byte[esi+3]
movzx edx,byte[esi+1]
add edx,[dirs+ebx*4]
mov [esi+1],dl
add esi,3
lea edi,[esi-1]
rep movsb
mov [edi-1],al
; ud2
.redex:
cld
mov [jump],drw;red
mov esi,area
.ex:
ret
 
WG_level:
file 'wriggle.bin'
 
if lang eq ru
WG_help mstr \
'‚ è  § ¤ ç  - âï­ãâì ç¥à¢ïª®¢ §  £®«®¢ã ¨«¨',\
'墮áâ, ¯®ª  ª ¦¤ë© ¨§ ­¨å ­¥ ¯®ªà®¥â ª«¥âª¨',\
'᢮¥£® 梥â , ®áâ ¢¨¢ ­¥§ ªàëâ묨 ¡¥«ë¥ ª¢ ¤à âë.',\
'—¥à¢ïª¨ ­¥ ¬®£ãâ ¯¥à¥ªà뢠âì ¨ ¯¥à¥á¥ª âì ¤àã£',\
'¤à㣠.','',\
'http://www.clickmazes.com'
else
WG_help mstr \
'Your aim is to drag the wriggley worms by head or',\
'tail until each worm covers the squares of its',\
'own colour leaving only white squares exposed.',\
'Worms cannot cross or overlap.','',\
'http://www.clickmazes.com'
end if
/programs/games/megamaze/trunk
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property
/programs/games/megamaze/.
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property