Added sources of the following games: mario2, megamaze, MSquare, pig, soko.
git-svn-id: svn://kolibrios.org@1806 a494cfbc-eb01-0410-851d-a64ba20cac60
725
programs/games/MSquare/trunk/MSquare.asm
Normal file
@ -0,0 +1,725 @@
|
||||
; 10.06.2010 staper@inbox.ru
|
||||
|
||||
;Œ £¨ç¥áª¨© ª¢ ¤à â - íâ® ¡®à â ª¨å 楫ëå ç¨á¥«, çâ® ¨å á㬬ë
|
||||
;¢ áâப å, á⮫¡æ å (०¥ ¢ ¤¨ £® «ïå) à ¢ë.
|
||||
|
||||
;<3B>ਬ¥à:
|
||||
|
||||
; 16 3 2 13
|
||||
; 5 10 11 8
|
||||
; 9 6 7 12
|
||||
; 4 15 14 1
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
db 'MENUET01'
|
||||
dd 0x1, START, I_END, (D_END+100) and not 3, (D_END+100) and not 3, 0, 0
|
||||
|
||||
;–¢¥â :
|
||||
Bckgrd_clr equ 0xffffff ;ä®
|
||||
Brdr_line_clr equ 0xb0b0b0 ;«¨¨¨ ¯® £à ¨æ ¬
|
||||
Inter_line_clr equ 0xb0b0b0 ;¢ãâ२¥ «¨¨¨
|
||||
Square_clr equ 0xdddddd ;梥⠪ãàá®à
|
||||
Fix_nmb_clr equ 0x83459 ;áâ â¨ç®¥ § 票¥
|
||||
Chg_nmb_clr equ 0;x008d8d ;¯¥à¥¬¥®¥ § 票¥
|
||||
Text_clr equ 0x000000 ;⥪áâ
|
||||
Message_clr equ 0x0000ff ;á®®¡é¥¨ï
|
||||
|
||||
max_dif equ 10
|
||||
min_dif equ 2
|
||||
len_kub equ 30 ;¤«¨ áâ®à®ë ª¢ ¤à ⨪
|
||||
beg_x equ 40 ;ª®®à¤¨ â • «¥¢®£® ¢¥à奣® 㣫
|
||||
beg_y equ 50 ;ª®®à¤¨ â Y «¥¢®£® ¢¥à奣® 㣫
|
||||
sym_x equ 20
|
||||
sym_y equ 20
|
||||
win_x equ 400 ;è¨à¨ ®ª
|
||||
win_y equ 400 ;¢ëá®â ®ª
|
||||
|
||||
|
||||
DEBUG equ 0
|
||||
|
||||
macro dbg_dec num
|
||||
{pushad
|
||||
newline
|
||||
debug_print_dec num
|
||||
popad
|
||||
}
|
||||
|
||||
include 'macros.inc'
|
||||
;include 'debug.inc'
|
||||
include 'editbox_ex.mac'
|
||||
include 'lang.inc'
|
||||
|
||||
|
||||
START:
|
||||
;mcall 40,7
|
||||
|
||||
redraw_all:
|
||||
mcall 12,1
|
||||
mcall 48,4
|
||||
add eax,100*65536+win_x
|
||||
mov ecx,eax
|
||||
mcall 0,100*65536+win_y,,(0x34000000+Bckgrd_clr),,title
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
add eax,beg_x*65536+beg_x
|
||||
xchg eax,ebx
|
||||
mcall 38,,beg_y*65536+beg_y,Brdr_line_clr
|
||||
mov edx,Inter_line_clr
|
||||
movzx esi,[Difficult]
|
||||
dec esi
|
||||
@@: add ecx,len_kub*65536+len_kub
|
||||
mcall
|
||||
dec esi
|
||||
jnz @b
|
||||
add ecx,len_kub*65536+len_kub
|
||||
mcall ,,,Brdr_line_clr
|
||||
|
||||
movzx eax,[Difficult]
|
||||
mov ecx,len_kub
|
||||
xor edx,edx
|
||||
mul ecx
|
||||
add eax,(beg_y+1)*65536+beg_y-1
|
||||
xchg eax,ecx
|
||||
mov ebx,beg_x*65536+beg_x
|
||||
mcall 38,,,Brdr_line_clr
|
||||
mov edx,Inter_line_clr
|
||||
movzx esi,[Difficult]
|
||||
dec esi
|
||||
|
||||
@@: add ebx,len_kub*65536+len_kub
|
||||
mcall
|
||||
dec esi
|
||||
jnz @b
|
||||
add ebx,len_kub*65536+len_kub
|
||||
mcall ,,,Brdr_line_clr
|
||||
|
||||
mcall 8,<3,78>,<3,13>,2,0xbbbbbb
|
||||
mcall 4,<7,5>,(0x80000000+Text_clr),txt.clear
|
||||
mcall ,<105,5>,,txt.dif
|
||||
|
||||
|
||||
call show_level
|
||||
|
||||
push dword Map;esi; mov esi,Map
|
||||
mcall 12,2
|
||||
draw_pole:
|
||||
if DEBUG
|
||||
call SysMsgBoardNum ;show esp
|
||||
endf
|
||||
|
||||
movzx eax,[Y]
|
||||
dec al
|
||||
movzx ebx,[Difficult]
|
||||
mul bl
|
||||
mov bl,[X]
|
||||
add al,bl
|
||||
pop esi ; mov esi,Map
|
||||
push eax ;ªãàá®à稪
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,eax
|
||||
mul eax
|
||||
sub eax,ebx
|
||||
mov edi,eax
|
||||
pop eax
|
||||
push eax
|
||||
; mov edi,81-9
|
||||
movzx ebp,[Difficult]
|
||||
mov ebx,beg_x*65536+beg_x+sym_x
|
||||
mov ecx,beg_y*65536+beg_y+sym_y
|
||||
call out_numbers
|
||||
pop eax
|
||||
call out_sum
|
||||
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
dec al
|
||||
jz redraw_all
|
||||
dec al
|
||||
jz key
|
||||
dec al
|
||||
jnz still
|
||||
;button:
|
||||
mcall 17
|
||||
cmp ah,1
|
||||
jne @f
|
||||
mcall -1
|
||||
.clear:
|
||||
@@: mov ecx,max_dif*max_dif
|
||||
mov esi,Map
|
||||
@@: mov byte [esi+ecx-1],0
|
||||
loop @b
|
||||
jmp redraw_all
|
||||
|
||||
key:
|
||||
mcall 2
|
||||
|
||||
.43: cmp ah,43 ;+
|
||||
jne .45
|
||||
cmp [Difficult],max_dif
|
||||
je still
|
||||
inc [Difficult]
|
||||
jmp redraw_all
|
||||
jmp still
|
||||
.45: ;-
|
||||
cmp ah,45
|
||||
jne .99
|
||||
cmp [Difficult],min_dif
|
||||
je still
|
||||
dec [Difficult]
|
||||
jmp redraw_all
|
||||
jmp still
|
||||
|
||||
.99: cmp ah,0x58
|
||||
je @f
|
||||
cmp ah,0x78
|
||||
jne .39
|
||||
@@: jmp still.clear
|
||||
|
||||
.39: cmp ah,0x39
|
||||
ja .110
|
||||
cmp ah,0x30
|
||||
jb still
|
||||
sub ah,0x30
|
||||
mov cl,ah
|
||||
|
||||
movzx eax,[Y]
|
||||
dec al
|
||||
mov ebx,max_dif;[Difficult]
|
||||
mul bl
|
||||
mov bl,[X]
|
||||
dec bl
|
||||
add al,bl
|
||||
|
||||
mov esi,Map
|
||||
bt [flags],9
|
||||
jnc @f
|
||||
mov bl,[esi+eax]
|
||||
push eax
|
||||
mov ax,10
|
||||
xor dl,dl
|
||||
mul bl
|
||||
add cl,al
|
||||
pop eax
|
||||
mov [esi+eax],cl
|
||||
btr [flags],9
|
||||
jmp .onedraw
|
||||
@@: mov [esi+eax],cl
|
||||
bts [flags],9
|
||||
jmp .onedraw
|
||||
|
||||
|
||||
.110: cmp ah,110 ;n
|
||||
jne .176
|
||||
.new_game:
|
||||
jmp redraw_all
|
||||
|
||||
.176: cmp ah,176 ;ªãàá®àë
|
||||
jne .177
|
||||
call draw_one_symbol
|
||||
dec [X]
|
||||
cmp [X],1
|
||||
jge @f
|
||||
push eax
|
||||
movzx eax,[Difficult]
|
||||
mov [X],al
|
||||
pop eax
|
||||
@@: btr [flags],9
|
||||
jmp .onedraw
|
||||
.177: cmp ah,177
|
||||
jne .178
|
||||
call draw_one_symbol
|
||||
inc [Y]
|
||||
push eax
|
||||
movzx eax,[Difficult]
|
||||
cmp [Y],al
|
||||
jbe @f
|
||||
mov [Y],1
|
||||
@@: pop eax
|
||||
btr [flags],9
|
||||
jmp .onedraw
|
||||
.178: cmp ah,178
|
||||
jne .179
|
||||
call draw_one_symbol
|
||||
dec [Y]
|
||||
cmp [Y],1
|
||||
jge @f
|
||||
push eax
|
||||
movzx eax,[Difficult]
|
||||
mov [Y],al
|
||||
pop eax
|
||||
@@: btr [flags],9
|
||||
jmp .onedraw
|
||||
.179: cmp ah,179
|
||||
jne still
|
||||
call draw_one_symbol
|
||||
inc [X]
|
||||
push eax
|
||||
movzx eax,[Difficult]
|
||||
cmp [X],al
|
||||
jbe @f
|
||||
mov [X],1
|
||||
@@: btr [flags],9
|
||||
pop eax
|
||||
.onedraw:
|
||||
bts [flags],4
|
||||
call draw_one_symbol
|
||||
call out_one_sum
|
||||
jmp still ;.todraw
|
||||
|
||||
show_level:
|
||||
movzx ecx,[Difficult]
|
||||
mcall 47,0x10000,,<205,5>,(0x50000000+Text_clr),Bckgrd_clr
|
||||
ret
|
||||
|
||||
|
||||
draw_one_symbol:
|
||||
movzx eax,[X]
|
||||
mov ebx,len_kub*65536+len_kub
|
||||
mul ebx
|
||||
xchg eax,ebx
|
||||
add ebx,(beg_x*65536+beg_y-len_kub*65536+len_kub)
|
||||
movzx eax,[Y]
|
||||
mov ecx,len_kub*65536+len_kub
|
||||
mul ecx
|
||||
xchg eax,ecx
|
||||
add ecx,(beg_y*65536+beg_y+sym_y-len_kub*65536+len_kub)
|
||||
movzx eax,[Y]
|
||||
dec al
|
||||
push ebx
|
||||
movzx ebx,[Difficult]
|
||||
mul bl
|
||||
mov bl,[X]
|
||||
add al,bl
|
||||
dec al
|
||||
pop ebx
|
||||
mov esi,Map
|
||||
add esi,eax
|
||||
push dword 0 ;¥ ªãàá®à
|
||||
bt [flags],4
|
||||
jnc @f
|
||||
mov dword [esp],1 ;ªãàá®à
|
||||
btr [flags],4
|
||||
@@: mov edi,0
|
||||
mov ebp,1
|
||||
call out_numbers
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
out_numbers:
|
||||
push ebx ecx esi
|
||||
shr ebx,16
|
||||
inc bx
|
||||
shl ebx,16
|
||||
add ebx,len_kub-1
|
||||
shr ecx,16
|
||||
inc cx
|
||||
shl ecx,16
|
||||
add ecx,len_kub-1
|
||||
mov edx,Bckgrd_clr
|
||||
push ebp
|
||||
dec dword [esp+4*5]
|
||||
jnz @f
|
||||
mov edx,Square_clr
|
||||
@@: mcall 13
|
||||
pop ebp
|
||||
pop esi
|
||||
|
||||
push ebx edx
|
||||
mov eax,esi
|
||||
sub eax,Map-1
|
||||
xor edx,edx
|
||||
movzx ebx,[Difficult]
|
||||
div ebx
|
||||
push edx
|
||||
xor edx,edx
|
||||
mov ebx,max_dif
|
||||
mul ebx
|
||||
pop edx
|
||||
test edx,edx
|
||||
jnz @f
|
||||
movzx edx,[Difficult]
|
||||
sub eax,max_dif
|
||||
@@: add eax,edx
|
||||
mov al,[eax+Map-1]
|
||||
pop edx ebx
|
||||
test al,al
|
||||
|
||||
; cmp byte [esi],0
|
||||
jnz .changeable_number
|
||||
jmp .null
|
||||
.end:
|
||||
inc esi
|
||||
dec ebp
|
||||
jnz out_numbers
|
||||
test edi,edi
|
||||
jz @f
|
||||
push ebx edx
|
||||
movzx eax,[Difficult]
|
||||
sub edi,eax
|
||||
mov ebp,eax
|
||||
mov ebx,len_kub*65536
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
push eax
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub
|
||||
mul ebx
|
||||
pop ebx
|
||||
add eax,ebx
|
||||
pop edx
|
||||
pop ebx
|
||||
sub ebx,eax
|
||||
; add ebx,-9*24*65536-9*24
|
||||
add ecx,len_kub*65536+len_kub
|
||||
jmp out_numbers
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
.null:
|
||||
pop ecx ebx
|
||||
add ebx,len_kub*65536+len_kub
|
||||
jmp .end
|
||||
.changeable_number:
|
||||
push esi
|
||||
shr ebx,16
|
||||
shr ecx,16
|
||||
mov dx,bx
|
||||
shl edx,16
|
||||
mov dx,cx
|
||||
add edx,8*65536+4
|
||||
|
||||
push ebx edx
|
||||
mov eax,esi
|
||||
sub eax,Map-1
|
||||
xor edx,edx
|
||||
movzx ebx,[Difficult]
|
||||
div ebx
|
||||
push edx
|
||||
xor edx,edx
|
||||
mov ebx,max_dif
|
||||
mul ebx
|
||||
pop edx
|
||||
test edx,edx
|
||||
jnz @f
|
||||
movzx edx,[Difficult]
|
||||
sub eax,max_dif
|
||||
@@: add eax,edx
|
||||
pop edx ebx
|
||||
|
||||
movzx ebx,byte [eax+Map-1];[esi]
|
||||
|
||||
|
||||
push esi ebp edi edx
|
||||
sub edx,2*65536-3
|
||||
push edx
|
||||
xchg eax,ebx
|
||||
mov ebx,10
|
||||
xor edx,edx
|
||||
div ebx
|
||||
mov ebx,edx
|
||||
pop edx
|
||||
|
||||
push ebx
|
||||
|
||||
test eax,eax
|
||||
jz .only_first_num
|
||||
|
||||
; bt [flags],9
|
||||
; jc .only_first_num
|
||||
|
||||
xchg eax,ebx
|
||||
|
||||
shl bx,4
|
||||
add ebx,FONT
|
||||
mov ecx,8*65536+16
|
||||
|
||||
mov edi,Pltr.ch
|
||||
cmp dword [esp+4*9],0
|
||||
jne @f
|
||||
mov edi,Pltr.chk
|
||||
@@: mov esi,1
|
||||
mov ebp,0
|
||||
mcall 65
|
||||
|
||||
.only_first_num:
|
||||
pop ebx
|
||||
shl bl,4
|
||||
|
||||
add ebx,FONT
|
||||
mov ecx,8*65536+16
|
||||
add edx,8*65536
|
||||
mov edi,Pltr.ch
|
||||
cmp dword [esp+4*8],0
|
||||
jne @f
|
||||
mov edi,Pltr.chk
|
||||
@@: mov esi,1
|
||||
mov ebp,0
|
||||
mcall 65
|
||||
pop edx edi ebp esi
|
||||
pop esi ecx ebx
|
||||
add ebx,len_kub*65536+len_kub
|
||||
jmp .end
|
||||
|
||||
out_sum:
|
||||
movzx eax,[Difficult]
|
||||
push eax
|
||||
mov esi,Map
|
||||
mov edi,out_sum_buf
|
||||
.1: xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
.2: mov dl,[ebx+esi]
|
||||
add ecx,edx
|
||||
inc ebx
|
||||
cmp ebx,[esp]
|
||||
jne .2
|
||||
mov word [edi],cx
|
||||
add edi,2
|
||||
add esi,max_dif
|
||||
dec eax
|
||||
jnz .1
|
||||
|
||||
push out_sum_buf
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub*65536
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
add eax,40*65536
|
||||
push eax
|
||||
mov edx,(beg_x-30)*65536+beg_y+10
|
||||
mov ebx,0x30000
|
||||
mov esi,0x50000000+Fix_nmb_clr
|
||||
mov edi,Bckgrd_clr
|
||||
|
||||
.3: mov ecx,[esp+4]
|
||||
mov cx,[ecx]
|
||||
shl ecx,16
|
||||
shr ecx,16
|
||||
mcall 47
|
||||
push edx
|
||||
add edx,[esp+4]
|
||||
mcall
|
||||
pop edx
|
||||
add edx,len_kub
|
||||
add dword [esp+4],2
|
||||
dec dword [esp+8]
|
||||
jnz .3
|
||||
pop eax
|
||||
pop eax
|
||||
pop eax
|
||||
|
||||
|
||||
movzx eax,[Difficult]
|
||||
push eax
|
||||
mov esi,Map
|
||||
mov edi,out_sum_buf
|
||||
xor ebx,ebx
|
||||
.4: xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov ebx,[esp]
|
||||
.5: mov dl,[esi]
|
||||
add ecx,edx
|
||||
add esi,max_dif
|
||||
dec ebx
|
||||
jnz .5
|
||||
mov word [edi],cx
|
||||
add edi,2
|
||||
push eax
|
||||
mov eax,max_dif
|
||||
xor edx,edx
|
||||
mul dword [esp+4]
|
||||
dec eax
|
||||
sub esi,eax
|
||||
pop eax
|
||||
dec eax
|
||||
jnz .4
|
||||
|
||||
push out_sum_buf
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
add eax,35
|
||||
push eax
|
||||
mov edx,(beg_x+5)*65536+beg_y-20
|
||||
mov ebx,0x30000
|
||||
mov esi,0x50000000+Fix_nmb_clr
|
||||
mov edi,Bckgrd_clr
|
||||
|
||||
.6: mov ecx,[esp+4]
|
||||
mov ecx,[ecx]
|
||||
shl ecx,16
|
||||
shr ecx,16
|
||||
mcall 47
|
||||
push edx
|
||||
add edx,[esp+4]
|
||||
mcall
|
||||
pop edx
|
||||
add edx,len_kub*65536;[esp]
|
||||
add dword [esp+4],2
|
||||
dec dword [esp+8]
|
||||
jnz .6
|
||||
pop eax
|
||||
pop eax
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
out_one_sum:
|
||||
movzx ecx,[Difficult]
|
||||
mov esi,Map
|
||||
xor edx,edx
|
||||
|
||||
movzx eax,[Y]
|
||||
dec al
|
||||
mov ebx,max_dif
|
||||
mul bl
|
||||
add esi,eax
|
||||
@@: mov al,[esi]
|
||||
inc esi
|
||||
add edx,eax
|
||||
loop @b
|
||||
|
||||
mov ecx,edx
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub*65536
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
add eax,40*65536
|
||||
push eax
|
||||
movzx eax,[Y]
|
||||
dec eax
|
||||
mov ebx,len_kub
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
mov edx,(beg_x-30)*65536+beg_y+10
|
||||
add edx,eax
|
||||
mov ebx,0x30000
|
||||
mov esi,0x50000000+Fix_nmb_clr
|
||||
mov edi,Bckgrd_clr
|
||||
|
||||
mcall 47
|
||||
add edx,[esp]
|
||||
mcall
|
||||
pop eax
|
||||
|
||||
|
||||
|
||||
|
||||
movzx ecx,[Difficult]
|
||||
mov esi,Map
|
||||
xor edx,edx
|
||||
|
||||
movzx eax,[X]
|
||||
dec al
|
||||
add esi,eax
|
||||
@@: mov al,[esi]
|
||||
add esi,max_dif
|
||||
add edx,eax
|
||||
loop @b
|
||||
|
||||
mov ecx,edx
|
||||
movzx eax,[Difficult]
|
||||
mov ebx,len_kub
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
add eax,35
|
||||
push eax
|
||||
movzx eax,[X]
|
||||
dec eax
|
||||
mov ebx,len_kub*65536
|
||||
xor edx,edx
|
||||
mul ebx
|
||||
mov edx,eax
|
||||
add edx,(beg_x+5)*65536+beg_y-20
|
||||
mov ebx,0x30000
|
||||
mov esi,0x50000000+Fix_nmb_clr
|
||||
mov edi,Bckgrd_clr
|
||||
|
||||
mcall 47
|
||||
add edx,[esp]
|
||||
mcall
|
||||
|
||||
pop edx
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
if DEBUG
|
||||
SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi
|
||||
mov ebx,esp
|
||||
mov ecx,8
|
||||
mov esi,(number_to_out+1)
|
||||
.1:
|
||||
mov eax,ebx
|
||||
and eax,0xF
|
||||
add al,'0'
|
||||
cmp al,(10+'0')
|
||||
jb @f
|
||||
add al,('A'-'0'-10)
|
||||
@@:
|
||||
mov [esi+ecx],al
|
||||
shr ebx,4
|
||||
loop .1
|
||||
dec esi
|
||||
mcall 71,1,number_to_out
|
||||
ret
|
||||
|
||||
number_to_out db '0x00000000',13,10,0
|
||||
endf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if lang eq ru
|
||||
title db 'Œ £¨ç¥áª¨© ª¢ ¤à â',0
|
||||
txt:
|
||||
.dif db "‘«®¦®áâì (+/-):",0
|
||||
.clear db 'Žç¨áâ¨âì (x)',0
|
||||
else
|
||||
title db 'Magical square',0
|
||||
txt:
|
||||
.dif db "Difficult (+/-)",0
|
||||
.clear db 'Clear (x)',0
|
||||
endf
|
||||
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
;<3B> «¨âàë:
|
||||
Pltr:
|
||||
.ch dd Bckgrd_clr,Chg_nmb_clr
|
||||
.chk dd Square_clr,Chg_nmb_clr
|
||||
.fx dd Bckgrd_clr,Fix_nmb_clr
|
||||
.fxk dd Square_clr,Fix_nmb_clr
|
||||
|
||||
FONT file "MSquare.fnt"
|
||||
|
||||
X db 1
|
||||
Y db 1
|
||||
|
||||
Difficult db 3
|
||||
|
||||
I_END:
|
||||
align 16
|
||||
Map rb max_dif*max_dif
|
||||
out_sum_buf rw max_dif
|
||||
|
||||
flags rw 1
|
||||
|
||||
D_END:
|
||||
;¡¨â 0: á¬. ¯¥à¥¤ draw_pole
|
||||
;2: ¢ draw_pole ¨ key
|
||||
;4: in draw_one_symbol
|
||||
;9: ¢¢¥¤ñ ¯¥à¢ ï æ¨äà ç¨á«
|
BIN
programs/games/MSquare/trunk/MSquare.fnt
Normal file
194
programs/games/MSquare/trunk/editbox_ex.mac
Normal file
@ -0,0 +1,194 @@
|
||||
|
||||
ch_struc_size=36
|
||||
ed_struc_size=76
|
||||
ch_flag_en=10b
|
||||
|
||||
ch_left equ [edi] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å
|
||||
ch_top equ [edi+2] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã
|
||||
ch_text_margin equ [edi+4] ;=4 à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
ch_size equ [edi+8] ;12 à §¬¥à ª¢ ¤à â 祪 ¡®ªá
|
||||
ch_color equ [edi+12] ;梥⠢ãâਠcheckbox
|
||||
ch_border_color equ [edi+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦® § ¤ âì á ¬®áâ®ï⥫ì®
|
||||
ch_text_color equ [edi+20];[edi+4] ;梥â ⥪áâ
|
||||
ch_text_ptr equ [edi+24] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨
|
||||
ch_text_length equ [edi+28]
|
||||
ch_flags equ [edi+32] ;ä« £¨
|
||||
|
||||
ed_width equ [edi] ;è¨à¨ ª®¬¯®¥â
|
||||
ed_left equ [edi+4] ;¯®«®¦¥¨¥ ¯® ®á¨ å
|
||||
ed_top equ [edi+8] ;¯®«®¦¥¨¥ ¯® ®á¨ ã
|
||||
ed_color equ [edi+12] ;梥â ä® ª®¬¯®¥â
|
||||
shift_color equ [edi+16] ;=0x6a9480 ¤«ï ¯à¨¬¥à ¢®§ì¥¬ ¦¥«¥ë© 梥⠡®ªá
|
||||
ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®¥â
|
||||
ed_blur_border_color equ [edi+24] ;梥⠥ ªâ¨¢®£® ª®¬¯®¥â
|
||||
ed_text_color equ [edi+28] ;梥â ⥪áâ
|
||||
ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦® ¬ ªá¨¬ «ì® ¢¢¥áâ¨
|
||||
ed_text equ [edi+36] ;㪠§ â¥«ì ¡ãä¥à
|
||||
ed_mouse_variable equ [edi+40] ; 㪠§ â¥«ì ¯¥à¥¬¥ãî ¤«ï ¡®ªá /£à㯯ë
|
||||
ed_flags equ [edi+44] ;ä« £¨
|
||||
bp_flags equ [ebp+44] ;¢ ¥ª®â®àëå ¯à®æ¥¤ãà å edi ¨á¯®«ì§ã¥âáï, ¢§ ¬¥ 㪠§ ⥫ì åà ¨âìáï ¢ ebp
|
||||
ed_size equ [edi+48] ;ª®«-¢® ᨬ¢®«®¢
|
||||
bp_size equ [ebp+48] ;ª®«-¢® ᨬ¢¯®«®¢, ¤«ï ¤à¥á 樨 ¨á¯«ì§ã¥âáï ebp¡ edi § ïâ
|
||||
ed_pos equ [edi+52] ;¯®§¨æ¨ï ªãàá®à
|
||||
ed_offset equ [edi+56] ;ᬥ饨¥
|
||||
cl_curs_x equ [edi+60] ;¯à¥¤ë¤ã饥 ª®®à¤¨ â ªãàá®à ¯® å
|
||||
cl_curs_y equ [edi+64] ;¯à¥¤ë¤ã饥 ª®®à¤¨ â ªãàá®à ¯® ã
|
||||
ed_shift_pos equ [edi+68] ;¯®«®¦¥¨¥ ªãàá®à
|
||||
ed_shift_pos_old equ [edi+72] ;áâ ஥ ¯®«®¦¥¨¥ ªãàá®à
|
||||
|
||||
ed_struc_size=76
|
||||
struc edit_box width,left,top,color,shift_color,focus_border_color,\
|
||||
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
|
||||
{
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Bit mask from editbox
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë
|
||||
ed_always_focus= 100000000000000b
|
||||
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï
|
||||
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
|
||||
ed_shift_on_off=1111111111110111b
|
||||
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î
|
||||
ed_shift_off= 1111111111111011b
|
||||
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥
|
||||
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï
|
||||
ed_shift_cl= 1111111111100011b
|
||||
ed_shift_mcl= 1111111111111011b
|
||||
ed_left_fl= 100000b
|
||||
ed_right_fl= 1111111111011111b
|
||||
ed_offset_fl= 1000000b
|
||||
ed_offset_cl= 1111111110111111b
|
||||
ed_insert= 10000000b
|
||||
ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_height=14 ; ¢ëá®â
|
||||
|
||||
.width dd width
|
||||
.left dd left
|
||||
.top dd top
|
||||
.color dd color
|
||||
.shift_color dd shift_color
|
||||
.focus_border_color dd focus_border_color
|
||||
.blur_border_color dd blur_border_color
|
||||
.text_color dd text_color
|
||||
.max dd max
|
||||
.text dd text
|
||||
.mouse_variable dd mouse_variable
|
||||
.flags dd flags+0
|
||||
.size dd size+0
|
||||
.pos dd pos+0
|
||||
.offset dd 0
|
||||
.cl_curs_x dd 0
|
||||
.cl_curs_y dd 0
|
||||
.shift dd 0
|
||||
.shift_old dd 0
|
||||
}
|
||||
macro edit_boxes_set_sys_color start,end,color_table
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ed_struc_size)
|
||||
mov esi,color_table
|
||||
@@:
|
||||
mov eax,dword [esi+36]
|
||||
mov ebx,dword [esi+20]
|
||||
push dword eax
|
||||
pop dword ed_focus_border_color
|
||||
shr bh,1
|
||||
shr bl,1
|
||||
shr ah,1
|
||||
shr al,1
|
||||
add ah,bh
|
||||
add al,bl
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
shr bl,1
|
||||
shr al,1
|
||||
add al,bl
|
||||
ror eax,16
|
||||
mov dword ed_blur_border_color,eax
|
||||
mov dword shift_color,eax
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
macro get_sys_colors col_buf
|
||||
{
|
||||
;mov eax,48
|
||||
push 48
|
||||
pop eax
|
||||
;mov ebx,3
|
||||
push 3
|
||||
pop ebx
|
||||
;mov ecx,col_buf
|
||||
push col_buf
|
||||
pop ecx
|
||||
;mov edx,40
|
||||
push 40
|
||||
pop edx
|
||||
mcall
|
||||
}
|
||||
macro check_boxes_set_sys_color start,end,color_table
|
||||
{
|
||||
ch_left equ [edi] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å
|
||||
ch_top equ [edi+2] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã
|
||||
ch_text_margin equ [edi+4] ;=4 à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
ch_size equ [edi+8] ;12 à §¬¥à ª¢ ¤à â 祪 ¡®ªá
|
||||
ch_color equ [edi+12] ;梥⠢ãâਠcheckbox
|
||||
ch_border_color equ [edi+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦® § ¤ âì á ¬®áâ®ï⥫ì®
|
||||
ch_text_color equ [edi+20];[edi+4] ;梥â ⥪áâ
|
||||
ch_text_ptr equ [edi+24] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨
|
||||
ch_text_length equ [edi+28]
|
||||
ch_flags equ [edi+32] ;ä« £¨
|
||||
|
||||
|
||||
;ch_left equ [edi] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å
|
||||
;ch_top equ [edi+2] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã
|
||||
;ch_color equ [edi+4] ;梥⠢ãâਠcheckbox
|
||||
;ch_border_color equ [edi+8] ;梥â à ¬ª¨ checkbox
|
||||
;ch_text_color equ [edi+12] ;梥â ⥪áâ
|
||||
;ch_text_ptr equ [edi+16] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨
|
||||
;ch_text_length equ [edi+20] ;¤«¨ ¤¯¨á¨ (2^64 â ª®© ¤«¨ë ¬®¦¥â ¡ëâì ⥪áâ)
|
||||
;ch_flags equ [edi+24] ;ä« £¨
|
||||
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ch_struc_size)
|
||||
mov esi,color_table
|
||||
@@:
|
||||
push dword [esi+32]
|
||||
pop dword ch_text_color
|
||||
push dword [esi+36]
|
||||
pop dword ch_border_color
|
||||
add edi,ch_struc_size
|
||||
loop @b
|
||||
}
|
||||
struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags
|
||||
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá
|
||||
ch_flag_en=10b
|
||||
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å
|
||||
.top: dw top ;¯®«®¦¥¨¥ ¯® ã
|
||||
.ch_text_margin: dd ch_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
.ch_size: dd ch_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12
|
||||
.color: dd color ;梥⠢ãâਠ祪¡®ªá
|
||||
.border_color: dd border_color ;梥â à ¬ª¨
|
||||
.text_color: dd text_color ;梥⠤¯¨á¨
|
||||
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ
|
||||
.ch_text_length: dd ch_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨
|
||||
.flags: dd flags+0 ; ä« £¨
|
||||
}
|
||||
struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags
|
||||
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá
|
||||
op_flag_en=10b
|
||||
.option_group: dd point_gr
|
||||
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å
|
||||
.top: dw top ;¯®«®¦¥¨¥ ¯® ã
|
||||
.ch_text_margin: dd op_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
.ch_size: dd op_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12
|
||||
.color: dd color ;梥⠢ãâਠ祪¡®ªá
|
||||
.border_color: dd border_color ;梥â à ¬ª¨
|
||||
.text_color: dd text_color ;梥⠤¯¨á¨
|
||||
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ
|
||||
.ch_text_length: dd op_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨
|
||||
.flags: dd flags+0 ; ä« £¨
|
||||
}
|
||||
|
813
programs/games/mario2/trunk/MARIO.ASM
Normal file
@ -0,0 +1,813 @@
|
||||
;
|
||||
; MARIO for MENUET
|
||||
;
|
||||
; Compile with fasm
|
||||
;
|
||||
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET00' ; 8 byte id
|
||||
dd 38 ; required os
|
||||
dd START ; program start
|
||||
dd I_END ; image size
|
||||
dd 0x100000 ; reguired amount of memory
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
|
||||
empty equ 0x80000 + 0*3*40*40
|
||||
build_1 equ 0x80000 + 1*3*40*40
|
||||
build_2 equ 0x80000 + 2*3*40*40
|
||||
build_3 equ 0x80000 + 3*3*40*40
|
||||
|
||||
mario_1 equ 0x90000 + 0*3*70*51
|
||||
mario_2 equ 0x90000 + 1*3*70*51
|
||||
mario_3 equ 0x90000 + 2*3*70*51
|
||||
mario_4 equ 0x90000 + 3*3*70*51
|
||||
mario_5 equ 0x90000 + 4*3*70*51
|
||||
mario_6 equ 0x90000 + 5*3*70*51
|
||||
mario_green equ 0x90000 + 6*3*70*51
|
||||
loadp equ 0x90000 + 7*3*70*51
|
||||
|
||||
|
||||
START:
|
||||
|
||||
|
||||
call load_graph
|
||||
|
||||
mov [marioxy], dword 300*65536+270
|
||||
mov [leftright], dword 1
|
||||
mov [velocity], dword 0xff
|
||||
|
||||
call draw_window
|
||||
|
||||
|
||||
sta:
|
||||
|
||||
mov eax,field
|
||||
mov edx,1*65526+30
|
||||
mov [xxyy],dword 1*65536+22
|
||||
|
||||
stl:
|
||||
|
||||
cmp [eax],byte ' '
|
||||
jnz noempty
|
||||
mov ebx,empty
|
||||
noempty:
|
||||
|
||||
cmp [eax],byte '1'
|
||||
jnz no1
|
||||
mov ebx,build_1
|
||||
no1:
|
||||
|
||||
cmp [eax],byte '2'
|
||||
jnz no2
|
||||
mov ebx,build_2
|
||||
no2:
|
||||
|
||||
cmp [eax],byte '3'
|
||||
jnz no3
|
||||
mov ebx,build_3
|
||||
no3:
|
||||
|
||||
pusha
|
||||
|
||||
mov edx,[xxyy]
|
||||
|
||||
mov eax,7 ; display image
|
||||
mov ecx,40*65536+40
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
|
||||
add word [xxyy+2],word 40
|
||||
cmp word [xxyy+2],word 40*12+1
|
||||
jnz nonewline
|
||||
mov word [xxyy+2],word 1
|
||||
add word [xxyy+0],word 40
|
||||
nonewline:
|
||||
|
||||
add eax,1
|
||||
cmp eax,field+12*9
|
||||
jz nodraw
|
||||
jmp stl
|
||||
|
||||
nodraw:
|
||||
|
||||
|
||||
; ********* MAIN LOOP ***********
|
||||
|
||||
|
||||
wait_for_event:
|
||||
|
||||
call draw_mario
|
||||
|
||||
mov eax,11 ; check if os wants to say something
|
||||
int 0x40
|
||||
cmp eax,1
|
||||
jz red
|
||||
cmp eax,2
|
||||
jz key
|
||||
cmp eax,3
|
||||
jnz wait_for_event
|
||||
|
||||
jmp button
|
||||
|
||||
red:
|
||||
|
||||
mov [mariomem],dword 0x0
|
||||
|
||||
call draw_window
|
||||
jmp sta
|
||||
|
||||
key:
|
||||
|
||||
mov [mariomem],dword 0x0
|
||||
|
||||
mov eax,2 ; ah <- key
|
||||
int 0x40
|
||||
|
||||
cmp ah,176
|
||||
jnz key1
|
||||
mov byte [leftright],byte 1
|
||||
key1:
|
||||
|
||||
cmp ah,179
|
||||
jnz key2
|
||||
mov byte [leftright],byte 4
|
||||
key2:
|
||||
|
||||
cmp ah,177
|
||||
jnz key3
|
||||
mov al,byte [leftright]
|
||||
mov bl,al
|
||||
cmp al,1
|
||||
jnz key31
|
||||
mov bl,2
|
||||
key31:
|
||||
cmp al,4
|
||||
jnz key32
|
||||
mov bl,3
|
||||
key32:
|
||||
mov byte [leftright],bl
|
||||
key3:
|
||||
|
||||
cmp ah,178
|
||||
jnz key4
|
||||
cmp [velocity],dword 0xff
|
||||
jnz key4
|
||||
mov [velocity],dword 0x110
|
||||
key4:
|
||||
|
||||
|
||||
|
||||
jmp wait_for_event
|
||||
|
||||
button:
|
||||
|
||||
mov eax,0xffffffff ; close this program
|
||||
int 0x40
|
||||
|
||||
; end of program
|
||||
|
||||
|
||||
load_graph:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,6 ; 6 = open file
|
||||
mov ebx,filename
|
||||
mov ecx,0
|
||||
mov edx,0xFFFFFF
|
||||
mov esi,loadp
|
||||
mov edi,0 ; floppy
|
||||
int 0x40
|
||||
|
||||
; empty
|
||||
|
||||
mov edi,empty
|
||||
mov ecx,40*40
|
||||
mov eax,0x00500f
|
||||
cld
|
||||
emptyl:
|
||||
mov [edi],eax
|
||||
add edi,3
|
||||
loop emptyl
|
||||
|
||||
mov [width],40*3
|
||||
mov [width_move],20
|
||||
mov [sub_esi],150*3+2
|
||||
mov [add_edi],40*3*2
|
||||
mov [imul_esi],20*3
|
||||
mov [base],loadp+18*3+3*150*34+3*98-1
|
||||
|
||||
mov esi,0
|
||||
mov edi,build_1
|
||||
call convert
|
||||
|
||||
mov esi,1
|
||||
mov edi,build_2
|
||||
call convert
|
||||
|
||||
|
||||
|
||||
; build_3
|
||||
|
||||
mov edi,build_3
|
||||
mov esi,loadp+18*3+230*3+3*300*69
|
||||
mov ecx,40
|
||||
build_3l:
|
||||
pusha
|
||||
mov ecx,3*40
|
||||
cld
|
||||
rep movsb
|
||||
popa
|
||||
sub esi,300*3
|
||||
add edi,40*3
|
||||
loop build_3l
|
||||
|
||||
mov [width],50*3
|
||||
mov [width_move],25
|
||||
mov [sub_esi],150*3+2
|
||||
mov [add_edi],50*3*2
|
||||
mov [imul_esi],25*3
|
||||
mov [base],loadp+18*3+3*150*34+68
|
||||
|
||||
mov esi,0
|
||||
mov edi,mario_1
|
||||
call convert
|
||||
|
||||
mov esi,1
|
||||
mov edi,mario_2
|
||||
call convert
|
||||
|
||||
mov esi,2
|
||||
mov edi,mario_3
|
||||
call convert
|
||||
|
||||
jmp mario_mirror
|
||||
|
||||
|
||||
convert:
|
||||
|
||||
imul esi,[imul_esi]
|
||||
add esi,[base] ; loadp+18*3+3*150*34+68
|
||||
|
||||
mov ecx,70
|
||||
mario_1l:
|
||||
pusha
|
||||
mov ecx,[width_move]
|
||||
putpix:
|
||||
mov eax,[esi]
|
||||
mov [edi+00],ax
|
||||
mov [edi+03],ax
|
||||
mov ebx,[width]
|
||||
mov [edi+ebx],ax
|
||||
add ebx,3
|
||||
mov [edi+ebx],ax
|
||||
shr eax,16
|
||||
mov [edi+02],al
|
||||
dec ebx
|
||||
mov [edi+ebx],al
|
||||
mov [edi+05],al
|
||||
add ebx,3
|
||||
mov [edi+ebx],al
|
||||
add esi,3
|
||||
add edi,6
|
||||
loop putpix
|
||||
popa
|
||||
sub esi,[sub_esi]
|
||||
add edi,[add_edi]
|
||||
loop mario_1l
|
||||
|
||||
ret
|
||||
|
||||
sub_esi dd 0x0
|
||||
add_edi dd 0x0
|
||||
imul_esi dd 0x0
|
||||
base dd 0x0
|
||||
width dd 0x0
|
||||
width_move dd 0x0
|
||||
|
||||
|
||||
|
||||
mario_mirror:
|
||||
|
||||
|
||||
; mario_green
|
||||
|
||||
mov edi,mario_green
|
||||
mov ecx,70*50
|
||||
mario_greenl:
|
||||
mov [edi],dword 0x00500f
|
||||
add edi,3
|
||||
loop mario_greenl
|
||||
|
||||
|
||||
|
||||
; mario_4
|
||||
|
||||
mov edi,mario_4
|
||||
mov esi,mario_1+49*3
|
||||
mov ecx,70
|
||||
m4l1:
|
||||
pusha
|
||||
mov ecx,50
|
||||
m4l2:
|
||||
mov eax,[esi]
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add edi,3
|
||||
sub esi,3
|
||||
loop m4l2
|
||||
popa
|
||||
add esi,50*3
|
||||
add edi,50*3
|
||||
loop m4l1
|
||||
|
||||
|
||||
; mario_5
|
||||
|
||||
mov edi,mario_5
|
||||
mov esi,mario_2+49*3
|
||||
mov ecx,70
|
||||
m5l1:
|
||||
pusha
|
||||
mov ecx,50
|
||||
m5l2:
|
||||
mov eax,[esi]
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add edi,3
|
||||
sub esi,3
|
||||
loop m5l2
|
||||
popa
|
||||
add esi,50*3
|
||||
add edi,50*3
|
||||
loop m5l1
|
||||
|
||||
|
||||
; mario_6
|
||||
|
||||
mov edi,mario_6
|
||||
mov esi,mario_3+49*3
|
||||
mov ecx,70
|
||||
m6l1:
|
||||
pusha
|
||||
mov ecx,50
|
||||
m6l2:
|
||||
mov eax,[esi]
|
||||
mov [edi],ax
|
||||
shr eax,16
|
||||
mov [edi+2],al
|
||||
add edi,3
|
||||
sub esi,3
|
||||
loop m6l2
|
||||
popa
|
||||
add esi,50*3
|
||||
add edi,50*3
|
||||
loop m6l1
|
||||
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
advance_mario:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,[marioxy] ; wherey ?
|
||||
and eax,65535
|
||||
add eax,40+21
|
||||
xor edx,edx
|
||||
mov ebx,40
|
||||
div ebx
|
||||
mov [marioy],eax
|
||||
|
||||
mov eax,[marioxy] ; wherex ?
|
||||
shr eax,16
|
||||
add eax,20
|
||||
xor edx,edx
|
||||
mov ebx,40
|
||||
div ebx
|
||||
mov [mariox],eax
|
||||
|
||||
|
||||
|
||||
cmp byte [leftright],byte 1 ; go left
|
||||
jnz noleft
|
||||
mov eax,[marioxy]
|
||||
xor edx,edx
|
||||
shr eax,16
|
||||
sub eax,7
|
||||
mov ebx,40
|
||||
div ebx
|
||||
add eax,field+7*12
|
||||
cmp [eax],byte ' '
|
||||
jz mgoleft
|
||||
mov byte [leftright],byte 2
|
||||
jmp noleft
|
||||
mgoleft:
|
||||
mov eax,[marioxy]
|
||||
sub eax,6*65536
|
||||
mov [marioxy],eax
|
||||
noleft:
|
||||
|
||||
|
||||
|
||||
cmp byte [leftright],byte 4 ; go right
|
||||
jnz noright
|
||||
mov eax,[marioxy]
|
||||
xor edx,edx
|
||||
shr eax,16
|
||||
add eax,54
|
||||
mov ebx,40
|
||||
div ebx
|
||||
add eax,field+7*12
|
||||
cmp byte [eax],byte ' '
|
||||
jz mgoright
|
||||
mov byte [leftright],byte 3
|
||||
jmp noright
|
||||
mgoright:
|
||||
mov eax,[marioxy]
|
||||
add eax,6*65536
|
||||
mov [marioxy],eax
|
||||
noright:
|
||||
|
||||
|
||||
|
||||
|
||||
cmp [velocity],dword 0x100 ; jump up ?
|
||||
jbe nojumpup
|
||||
mov ebx,[velocity]
|
||||
sub ebx,1
|
||||
cmp ebx,0x100
|
||||
jnz no0x100
|
||||
mov [velocity],dword 0xff
|
||||
jmp nojumpup
|
||||
no0x100:
|
||||
mov [velocity],ebx
|
||||
sub ebx,0x100-1
|
||||
mov eax,[marioxy]
|
||||
sub ax,bx
|
||||
mov [marioxy],eax
|
||||
nojumpup:
|
||||
|
||||
call mario_environment
|
||||
|
||||
cmp [velocity],dword 0x100 ; jump -> down ?
|
||||
jge nojumpdown
|
||||
mov eax,[marioy]
|
||||
cmp eax,[mario_below]
|
||||
jb yesgd
|
||||
mov [velocity],dword 0xff
|
||||
mov eax,[marioxy]
|
||||
mov eax,[mario_below]
|
||||
sub eax,1
|
||||
mov ebx,40
|
||||
mul ebx
|
||||
sub eax,10
|
||||
mov word [marioxy],ax
|
||||
jmp nojumpdown
|
||||
yesgd:
|
||||
mov ebx,[velocity]
|
||||
sub ebx,1
|
||||
mov [velocity],ebx
|
||||
mov eax,[marioxy]
|
||||
add ax,0xff
|
||||
sub ax,bx
|
||||
mov [marioxy],eax
|
||||
nojumpdown:
|
||||
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
marioy dd 0x0
|
||||
|
||||
mariox dd 0x0
|
||||
|
||||
mario_below dd 5
|
||||
|
||||
|
||||
mario_environment:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,[marioy]
|
||||
mov ebx,12
|
||||
mul ebx
|
||||
add eax,[mariox]
|
||||
add eax,field
|
||||
|
||||
cmp [eax],byte ' '
|
||||
jz me_ok
|
||||
|
||||
mov eax,[marioy]
|
||||
mov [mario_below],eax
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
me_ok:
|
||||
|
||||
mov [mario_below],dword 100
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
mario_delay:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,5
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
draw_mario:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,[mariomem]
|
||||
cmp eax,[marioxy]
|
||||
jnz dm1
|
||||
|
||||
call mario_delay
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
dm1:
|
||||
|
||||
mov eax,[marioxy]
|
||||
mov [mariomem],eax
|
||||
|
||||
|
||||
cmp byte [leftright],byte 1 ; go left
|
||||
jnz no_m_left
|
||||
jmp m_left
|
||||
no_m_left:
|
||||
|
||||
cmp byte [leftright],byte 4 ; go right
|
||||
jnz no_m_right
|
||||
jmp m_right
|
||||
no_m_right:
|
||||
|
||||
cmp byte [leftright],byte 2 ; stand left
|
||||
jnz no_r_still
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_1
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
popa
|
||||
ret
|
||||
no_r_still:
|
||||
|
||||
cmp byte [leftright],byte 3 ; stand right
|
||||
jnz no_l_still
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_4
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
popa
|
||||
ret
|
||||
no_l_still:
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
m_left:
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_1
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_2
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_3
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_2
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
m_right:
|
||||
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_4
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_5
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_6
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
mov eax,7
|
||||
mov ebx,mario_green
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call advance_mario
|
||||
mov eax,7
|
||||
mov ebx,mario_5
|
||||
mov ecx,50*65536+70
|
||||
mov edx,[marioxy]
|
||||
int 0x40
|
||||
call mario_delay
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,12 ; tell os about redraw
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
|
||||
mov eax,0 ; define and draw window
|
||||
mov ebx,80*65536+480+1
|
||||
mov ecx,20*65536+382
|
||||
mov edx,0x0000500f
|
||||
mov esi,0x8066AA88
|
||||
mov edi,0x00559977
|
||||
int 0x40
|
||||
|
||||
mov eax,dword 0x00000004
|
||||
mov ebx,8*65536+8
|
||||
mov ecx,dword 0x00cccccc
|
||||
mov edx,text
|
||||
mov esi,textlen-text
|
||||
int 0x40
|
||||
|
||||
mov eax,8
|
||||
mov ebx,(481-19)*65536+12 ; button start x & size
|
||||
mov ecx,5*65536+12 ; button start y & size
|
||||
mov edx,1 ; button number
|
||||
mov esi,0x00229911 ; button color
|
||||
int 0x40
|
||||
|
||||
mov eax,12 ; tell os about redraw end
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
; DATA SECTION
|
||||
|
||||
|
||||
filename:
|
||||
db 'MARIOALLBMP'
|
||||
|
||||
text:
|
||||
db 'SUPER MARIO - USE ARROW KEYS'
|
||||
textlen:
|
||||
|
||||
xx db 'x'
|
||||
|
||||
field:
|
||||
|
||||
db '1 1'
|
||||
db '1 1'
|
||||
db '111 111'
|
||||
db '1 1'
|
||||
db '1 1'
|
||||
db '1 111111 1'
|
||||
db '1 1'
|
||||
db '1 1'
|
||||
db '222222222222'
|
||||
|
||||
xxyy dd 0x0
|
||||
|
||||
marioxy dd 0x0
|
||||
|
||||
mariomem dd 0x0
|
||||
|
||||
leftright dd 0x0
|
||||
|
||||
velocity dd 0x0
|
||||
|
||||
|
||||
I_END:
|
||||
|
||||
|
||||
|
||||
|
BIN
programs/games/mario2/trunk/MARIOALL.BMP
Normal file
After Width: | Height: | Size: 16 KiB |
318
programs/games/megamaze/trunk/GIF_LITE.INC
Normal file
@ -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
|
264
programs/games/megamaze/trunk/MACROS.INC
Normal file
@ -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
|
300
programs/games/megamaze/trunk/blackbox.inc
Normal file
@ -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. <20>ïâì áªàëâëå ⮬®¢ ¡ã¤ãâ ¯®ª § ë ªà á묨',\
|
||||
'ª¢ ¤à ⨪ ¬¨.',\
|
||||
' ‹ãç ¯®£«®é¥ - ᨨ© ª¢ ¤à â;',\
|
||||
' ‹ãç ®âà ¦¥ - §¥«¥ë© ª¢ ¤à â.',\
|
||||
' —¨á« ¬¨ ®â¬¥ç¥ë â®çª¨ ¢å®¤ ¨ ¢ë室 «ã祩.','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/colzone.bin
Normal file
140
programs/games/megamaze/trunk/colzone.inc
Normal file
@ -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 ªã¡¨ª®¢ á⮨â à áªà 襮©',\
|
||||
'ª«¥âç ⮩ ¤®áª¥. ‚ è § ¤ ç - ¯¥à¥ª â¨âì ¥£® ',\
|
||||
'ª«¥âªã á ¡¥«ë¬ ª¢ ¤à ⨪®¬. <20>«®ª ç¨ ¥â áâ®ï ¨',\
|
||||
'¤®«¦¥ § ª®ç¨âì ⮦¥ ¢ ¢¥à⨪ «ì®¬ ¯®«®¦¥¨¨.',\
|
||||
'<27>¥«ì§ï ¢ëª âë¢ âì ¥£® § ¯à¥¤¥«ë á¥âª¨ ¨ ᢥàå',\
|
||||
'⮣® - ªã¡¨ª¨ ¡«®ª ¤®«¦ë ¢á¥£¤ «®¦¨âìáï ',\
|
||||
'ª«¥âª¨ ®¤¨ ª®¢®£® 梥â . <20>«®ª ¥ ®â®¡à ¦¥ ¢ 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
|
BIN
programs/games/megamaze/trunk/cstep.bin
Normal file
66
programs/games/megamaze/trunk/cstep.inc
Normal file
@ -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
|
137
programs/games/megamaze/trunk/debug.inc
Normal file
@ -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'
|
BIN
programs/games/megamaze/trunk/fhouse.bin
Normal file
197
programs/games/megamaze/trunk/fhouse.inc
Normal file
@ -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
|
BIN
programs/games/megamaze/trunk/loops.bin
Normal file
245
programs/games/megamaze/trunk/loops.inc
Normal file
@ -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 \
|
||||
'—¥à¥§ ¢á¥ ª«¥âª¨ ¯àאַ㣮«ì¨ª ¥®¡å®¤¨¬®',\
|
||||
'¯à®¢¥á⨠§ ¬ªãâãî «®¬ ãî. <20>à®å®¤ï ç¥à¥§ ç¥àë©',\
|
||||
'ªà㦮ª, «®¬ ï ®¡ï§ ¯®¢¥àãâì, ¯à®å®¤ï',\
|
||||
'ç¥à¥§ ¡¥«ë© ªà㦮ª, «®¬ ï ¯®¢®à 稢 âì ¥',\
|
||||
'¬®¦¥â. ‚ ¯ãáâëå ¦¥ ª«¥âª å «®¬ ï ¢¥¤¥â á¥¡ï ª ª',\
|
||||
'§ å®ç¥â.','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/marble.bin
Normal file
138
programs/games/megamaze/trunk/marble.inc
Normal file
@ -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 \
|
||||
'<27>¥áª®«ìª® ªà áëå ¨ ç¥àëå ¯« 襪 «¥¦ â ¤®áª¥,',\
|
||||
'¤ëઠ®¡®§ ç¥ á¥à®© ª«¥âª®©. Š®£¤ ¯« èª ',\
|
||||
'¯à®å®¤¨â ¤ ¤ëમ©, ® ¯ ¤ ¥â â㤠¨ ¨á祧 ¥â.',\
|
||||
'ˆá¯®«ì§ã©â¥ áâ५ª¨ ¤«ï ª«® ¤®áª¨.',\
|
||||
' ‚ è § ¤ ç - á¡à®á¨âì ¢á¥ ªà áë¥ ¯« 誨.',\
|
||||
'Š®«¨ç¥á⢮ 㯠¢è¨å ç¥àëå ¯« 襪 ஫¨ ¥ ¨£à ¥â.','',\
|
||||
'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
|
855
programs/games/megamaze/trunk/megamaze.asm
Normal file
@ -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:
|
BIN
programs/games/megamaze/trunk/nolt.bin
Normal file
92
programs/games/megamaze/trunk/nolt.inc
Normal file
@ -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 \
|
||||
'‚ è § ¤ ç - ¯à®¢¥á⨠§¥«¥ë© ª¢ ¤à â ª ªà ᮬã',\
|
||||
'¡¥§ ¯®¢®à®â «¥¢® ¨ ¤¢¨¦¥¨ï § ¤. <20>â® âà㤥¥',\
|
||||
'祬 ª ¦¥âáï. ‚¨¬ ¨¥: ¥á«¨ ‚ë ¯à¨¬¥â¥ ¯«®å®¥',\
|
||||
'à¥è¥¨¥, ¬®¦¥â¥ ¯®¯ áâì ¢ â㯨ª ¨ ¡ã¤¥â¥',\
|
||||
'¢ë㦤¥ë ç âì á ç « .','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/omaze.bin
Normal file
BIN
programs/games/megamaze/trunk/or2.bin
Normal file
BIN
programs/games/megamaze/trunk/orient.bin
Normal file
227
programs/games/megamaze/trunk/orient.inc
Normal file
@ -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 \
|
||||
'™¥«ç®ª ¢ë¤¥«¥®© ª«¥âª¥ ¯¥à¥¤¢¨£ ¥â ¨«¨',\
|
||||
'¢à é ¥â ªà áãî áâ५ªã. ‘¨¨© ¡«®ª ¤¥©áâ¢ã¥â',\
|
||||
'ª ª ¯à¥¯ïâá⢨¥, áªàë¢ ï ®¤ã ª«¥âªã. <20>à¨',\
|
||||
'¯¥à¥å®¤¥ áâ५ª¨ ª«¥âªã ᨥ£® ¡«®ª ®¨',\
|
||||
'¯®¬¥ïîâáï ¬¥áâ ¬¨. ‡ ¤ ç - ¯à®¢¥á⨠ªà áãî',\
|
||||
'áâ५ªã ¨§ ¨¦¥© ª«¥âª¨ ¢ ¢¥àåîî.','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/orientg2.gif
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
programs/games/megamaze/trunk/smz.bin
Normal file
94
programs/games/megamaze/trunk/smz.inc
Normal file
@ -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 \
|
||||
'𧎚T桌鴭漭 祚嶉奶恥罱市鴙桑碪 摰亢<E691B0>, 丐見𩤃',\
|
||||
'坏咱卿<E592B1> 炎𨸹<E7828E><F0A8B8B9> <20> 祚戶╞蟡限恭 狙咧蟡摵╳ 物乒悚',\
|
||||
'祚 能麍悟, 祚<> 郊 亢摵見郊漭 芹<>陋ㄝ 炎𨸹<E7828E><F0A8B8B9>.','',\
|
||||
'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
|
164
programs/games/megamaze/trunk/tam.INC
Normal file
@ -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 \
|
||||
' ’¥á¥© (§¥«¥ë© ª¢ ¤à â) ¤®«¦¥ ã¡¥¦ âì ¨§',\
|
||||
'« ¡¨à¨â . ‡ ¨¬ £®¨âáï ¬¥å ¨ç¥áª¨© Œ¨®â ¢à',\
|
||||
'(ªà áë© ª¢ ¤à â). <20> ª ¦¤ë© 室 ’¥á¥© Œ¨®â ¢à',\
|
||||
'¤¥« ¥â 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
|
BIN
programs/games/megamaze/trunk/tam.bin
Normal file
BIN
programs/games/megamaze/trunk/tilt.bin
Normal file
93
programs/games/megamaze/trunk/tilt.inc
Normal file
@ -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 \
|
||||
'<27>« èª (§¥«¥ë© ª¢ ¤à â) «¥¦¨â ¤®áª¥, ª®â®àãî',\
|
||||
'¬®¦® ª«®ïâì ¯® £®à¨§®â «¨ ¨ ¢¥à⨪ «¨',\
|
||||
' <20>®á«¥ ª«® ¯« èª áª®«ì§¨â, ¯®ª ¥ ⪥âáï',\
|
||||
' á⥪ã. <20>¥«ì§ï ®áâ ®¢¨âì ¯« èªã ¢® á¥à¥¤¨¥',\
|
||||
'¯ãâ¨.',\
|
||||
' ‚ è § ¤ ç - § áâ ¢¨âì ¯« èªã ¯®á¥â¨âì ª«¥âª¨',\
|
||||
'á ªà á묨 ª¢ ¤à â ¬¨.','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/tilt2.bin
Normal file
105
programs/games/megamaze/trunk/tilt2.inc
Normal file
@ -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 \
|
||||
'Šà áë© ¨ ᨨ© ¡«®ª¨ ¤®«¦ë ¤®áâ¨çì ª«¥â®ª',\
|
||||
'ᮮ⢥âáâ¢ãî饣® 梥â . ‚¨¬ ¨¥! <20>«®ª¨ ᤥ« ë',\
|
||||
'¨§ £à¥áᨢ®£® ¬ â¥à¨ « , ¨ ¯à¨ á⮫ª®¢¥¨¨',\
|
||||
'¬£®¢¥® ¨á¯ àïîâáï. ‚ í⮬ á«ãç ¥ ‚ ¬ ¯à¨¤¥âáï',\
|
||||
' ç âì ã஢¥ì á ç « .','',\
|
||||
'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
|
BIN
programs/games/megamaze/trunk/wriggle.bin
Normal file
251
programs/games/megamaze/trunk/wriggle.inc
Normal file
@ -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
|
1
programs/games/pig/trunk/AUTHORS
Normal file
@ -0,0 +1 @@
|
||||
David Olofson <david@olofson.net>
|
340
programs/games/pig/trunk/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
2
programs/games/pig/trunk/ChangeLog
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
20040124: First release.
|
182
programs/games/pig/trunk/INSTALL
Normal file
@ -0,0 +1,182 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
54
programs/games/pig/trunk/INSTRUCTIONS
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
Fixed Rate Pig
|
||||
--------------
|
||||
Instructions
|
||||
|
||||
The Story
|
||||
---------
|
||||
Aw, come on! Like anyone actually cares... :-) Oh
|
||||
well, here it is, anyway:
|
||||
You're a cute, bouncy rubber pig, caught in some
|
||||
weird toy world in a parallel universe. As always,
|
||||
the only way out is through. Or at least, that's
|
||||
your best bet, as you can't seem to figure out any
|
||||
other way - and you probably don't want to be a toy
|
||||
rubber pig for the rest of your life. (How long do
|
||||
toy rubber pigs live, anyway?)
|
||||
So, off you go, to run, jump and stomp your way
|
||||
through this strange looking toy world. Hopefully,
|
||||
you will find a portal back to your universe or
|
||||
something eventually.
|
||||
Or maybe you'll just wake up, have a big cup of
|
||||
black coffee, and realize that the layer of toys
|
||||
covering the floor reminds a great deal of
|
||||
something you dreamt.
|
||||
Better not waste your limited supply of lives
|
||||
until you know for sure, tough. What if it *isn't*
|
||||
a dream...?
|
||||
|
||||
|
||||
The Game
|
||||
--------
|
||||
Well, Fixed Rate Pig is just another retro style
|
||||
platform game, inspired by the 8 bit generation.
|
||||
Controls are very simple: Left and right arrows to
|
||||
move left/right, and the up arrow to jump.
|
||||
The enemies are the evil looking spinning heads.
|
||||
Some bounce around, just to be a bit more annoying.
|
||||
Jump and stomp'em all in the head! When all enemies
|
||||
are gone, the level is clear.
|
||||
Jumping when stomping an enemy gives you an
|
||||
extra high jump from the point of impact. Note that
|
||||
you get knocked if you're hit by an enemy while
|
||||
standing or walking on a platform - even if the
|
||||
enemy hits you from below. You need to be falling
|
||||
downwards with some speed to stomp someone.
|
||||
Watch out for the holes in the floor! Falling
|
||||
off the map means you lose one life. Avoid running
|
||||
into enemies or getting stomped, as that knocks you
|
||||
out and has you falling past platforms for a brief
|
||||
moment. That's actually no big deal - provided you
|
||||
wake up before you fall off the screen...
|
||||
At certain score intervals, powerups icons are
|
||||
dropped into the level. Pick these up before they
|
||||
fall off the screen! (No need to stomp them.)
|
6
programs/games/pig/trunk/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = pig
|
||||
pig_SOURCES = pig.c engine.c dirty.c
|
||||
|
||||
EXTRA_DIST = *.h *.txt *.png INSTRUCTIONS pig-linux-x86 pig-win32.exe
|
494
programs/games/pig/trunk/Makefile.in
Normal file
@ -0,0 +1,494 @@
|
||||
# Makefile.in generated by automake 1.7.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_triplet = @host@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = pig
|
||||
pig_SOURCES = pig.c engine.c dirty.c
|
||||
|
||||
EXTRA_DIST = *.h *.txt *.png INSTRUCTIONS pig-linux-x86 pig-win32.exe
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = pig$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
am_pig_OBJECTS = pig.$(OBJEXT) engine.$(OBJEXT) dirty.$(OBJEXT)
|
||||
pig_OBJECTS = $(am_pig_OBJECTS)
|
||||
pig_LDADD = $(LDADD)
|
||||
pig_DEPENDENCIES =
|
||||
pig_LDFLAGS =
|
||||
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dirty.Po ./$(DEPDIR)/engine.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/pig.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(pig_SOURCES)
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS aclocal.m4 config.guess config.sub configure \
|
||||
configure.in depcomp install-sh missing mkinstalldirs
|
||||
SOURCES = $(pig_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
|
||||
|
||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
; then \
|
||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(bindir)/$$f; \
|
||||
done
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
pig$(EXEEXT): $(pig_OBJECTS) $(pig_DEPENDENCIES)
|
||||
@rm -f pig$(EXEEXT)
|
||||
$(LINK) $(pig_LDFLAGS) $(pig_OBJECTS) $(pig_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirty.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/engine.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pig.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
am__remove_distdir = \
|
||||
{ test ! -d $(distdir) \
|
||||
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr $(distdir); }; }
|
||||
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
$(am__remove_distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
distuninstallcheck:
|
||||
cd $(distuninstallcheck_dir) \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf autom4te.cache
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic ctags dist dist-all dist-gzip distcheck distclean \
|
||||
distclean-compile distclean-depend distclean-generic \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-exec install-exec-am \
|
||||
install-info install-info-am install-man install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
0
programs/games/pig/trunk/NEWS
Normal file
269
programs/games/pig/trunk/README
Normal file
@ -0,0 +1,269 @@
|
||||
|
||||
Fixed Rate Pig - a fixed logic frame rate demo
|
||||
----------------------------------------------
|
||||
|
||||
This SDL programming example - a simple
|
||||
platform game - demonstrates the use of
|
||||
a fixed virtual logic frame rate
|
||||
together with interpolation, for smooth
|
||||
and accurate game logic that is
|
||||
independent of the rendering frame rate.
|
||||
|
||||
The example also demonstrates sprite
|
||||
animation and partial display updating
|
||||
techniques, suitable for games and
|
||||
applications that need high frame rates
|
||||
but can do without updating the whole
|
||||
screen every frame.
|
||||
|
||||
|
||||
Fixed Logic Frame Rate
|
||||
----------------------
|
||||
Having a fixed logic frame rate means that the game
|
||||
logic (that is, what defines the gameplay in terms
|
||||
of object behavior and user input handling) runs a
|
||||
fixed number of times per unit of time. This makes
|
||||
it possible to use "frame count" as a unit of time.
|
||||
More interestingly, since the logic frame rate
|
||||
can be set at any sufficient value (say, 20 Hz for
|
||||
a slow turn based game, or 100 Hz for fast action)
|
||||
the logic code will run exactly once per frame.
|
||||
Thus, there is no need to take delta times in
|
||||
account, solving equations, making calculations on
|
||||
velocity, acceleration, jerk and stuff like that.
|
||||
You can just deal with hardcoded "step" values and
|
||||
simple tests.
|
||||
Perhaps most importantly, you can *still* rely
|
||||
on the game behaving *exactly* the same way,
|
||||
regardless of the rendering frame rate or other
|
||||
system dependent parameters - something that is
|
||||
virtually impossible with delta times, since you
|
||||
cannot have infinite accuracy in the calculations.
|
||||
|
||||
|
||||
Virtual Logic Frame Rate
|
||||
------------------------
|
||||
By "virtual", I mean that the actual frame rate is
|
||||
not necessarily stable at the nominal value at all
|
||||
times. Rather, the *average* logic frame rate is
|
||||
kept at the nominal value by means of controlling
|
||||
the number of logic frames processed for each
|
||||
rendered frame.
|
||||
That is, if the rendering frame rate is lower
|
||||
than the nominal logic frame rate, the engine will
|
||||
run the game logic several times before rendering
|
||||
each frame. Thus, the game logic may actually be
|
||||
running at tens of kHz for a few frames at a time,
|
||||
but this doesn't matter, as long as the game logic
|
||||
code relies entirely on logic time.
|
||||
So, do not try to read time using SDL_GetTicks()
|
||||
or similar in the game logic code! Instead, just
|
||||
count logic frames, like we did back in the C64 and
|
||||
Amiga days, where video frames were actually a
|
||||
reliable time unit. It really works!
|
||||
|
||||
|
||||
Resampling Distortion
|
||||
---------------------
|
||||
Now, there is one problem with fixed logic frame
|
||||
rates: Resampling distortion. (The same phenomena
|
||||
that cause poor audio engines to squeal and feep
|
||||
when playing back waveforms at certain pitches.)
|
||||
The object coordinates generated by the game
|
||||
logic engine can be thought of as streams of values
|
||||
describing signals (in electrical engineering/DSP
|
||||
terms) with a fixed sample rate. Each coordinate
|
||||
value is one stream.
|
||||
Since the logic frame rate is fixed, and the
|
||||
game logic runs an integer number of times per
|
||||
rendered frame, what we get is a "nearest point"
|
||||
resampling from the logic frame rate to the
|
||||
rendering frame rate. That's not very nice, since
|
||||
only the last set of coordinates after each run of
|
||||
logic frames is actually used - the rest are thrown
|
||||
away!
|
||||
What's maybe even worse, especially if the logic
|
||||
frame rate is low, is that you get new coordinates
|
||||
only every now and then, when the rendering frame
|
||||
rate is higher than the logic frame rate.
|
||||
|
||||
|
||||
Getting Smooth Animation
|
||||
------------------------
|
||||
So, what do we do? Well, given my hint above, the
|
||||
answer is probably obvious: interpolation! We just
|
||||
need to replace the basic "nearest sample" method
|
||||
with something better.
|
||||
Resampling is a science and an art in the audio
|
||||
field, and countless papers have been written on
|
||||
the subject, most of which are probably totally
|
||||
incomprehensible for anyone who hasn't got a degree
|
||||
in maths.
|
||||
However, our requirements for the resampling can
|
||||
be kept reasonably low by keeping the logic frame
|
||||
rate reatively high (ie in the same order of
|
||||
magnitude as the expected rendering frame rate) -
|
||||
and we generally want to do that anyway, to reduce
|
||||
the game's control latency.
|
||||
|
||||
|
||||
Chosing An Interpolator
|
||||
-----------------------
|
||||
Since the rendering frame rate can vary constantly
|
||||
in unpredictable ways, we will have to recalculate
|
||||
the input/output ratio of the resampling filter for
|
||||
every rendered frame.
|
||||
However, using a polynomial interpolator (as
|
||||
opposed to a FIR resampling filter), we can get
|
||||
away without actually doing anything special. We
|
||||
just feed the interpolator the coordinates and the
|
||||
desired fractional frame time, and get the
|
||||
coordinates calculated.
|
||||
DSP people will complain that a polynomial
|
||||
resampler (that is, without a brickwall filter, or
|
||||
oversampling + bandlimited downsampling) doesn't
|
||||
really solve the whole problem. Right, it doesn't
|
||||
remove frequencies above Nyqvist of the rendering
|
||||
frame rate, so those can cause aliasing distortion.
|
||||
But let's consider this:
|
||||
Do we actually *have* significant amounts of
|
||||
energy at such frequencies in the data from the
|
||||
game logic? Most probably not! You would have to
|
||||
have objects bounce around or oscillate at insane
|
||||
speed to get anywhere near Nyqvist of (that is, 50%
|
||||
of) any reasonable (ie playable) rendering frame
|
||||
rate. In fact, we can probably assume that we're
|
||||
dealing with signals in the range 0..10 Hz. Not
|
||||
even the transients caused by abrupt changes in
|
||||
speed and direction will cause visible side
|
||||
effects.
|
||||
So, in this programming example, I'm just using
|
||||
a simple linear interpolator. No filters, no
|
||||
oversampling or anything like that. As simple as it
|
||||
gets, but still an incredible improvement over
|
||||
"nearest sample" resampling. You can enable/disable
|
||||
interpolation with the F1 key when running the
|
||||
example.
|
||||
|
||||
|
||||
Rendering Sprites
|
||||
-----------------
|
||||
In order to cover another animation related FAQ,
|
||||
this example includes "smart" partial updates of
|
||||
the screen. Only areas that are affected by moving
|
||||
and/or animated sprites are updated.
|
||||
To keep things simple and not annoyingly non-
|
||||
deterministic, updates are done by removing all
|
||||
sprites, updating their positions and animation
|
||||
frames, and then rendering all sprites. This is
|
||||
done every frame, and includes all sprites, whether
|
||||
they move or not.
|
||||
So, why not update only the sprites that
|
||||
actually moved? That would allow for cheap but
|
||||
powerful animated "backgrounds" and the like.
|
||||
Well, the problem is that sprites can overlap,
|
||||
and when they do, they start dragging each other
|
||||
into the update loop, leading to recursion and
|
||||
potentially circular dependencies. A non-recursive
|
||||
two-pass (mark + render) algorithm is probably a
|
||||
better idea than actual recursion. It's quite
|
||||
doable and neat, if the updates are restricted by
|
||||
clipping - but I'll leave that for another example.
|
||||
Pretty much all sprites in Fixed Rate Pig move all
|
||||
the time, so there's nothing to gain by using a
|
||||
smarter algorithm.
|
||||
|
||||
|
||||
Efficient Software Rendering
|
||||
----------------------------
|
||||
To make it a bit more interesting, I also added
|
||||
alpha blending for sprite anti-aliasing and effects.
|
||||
Most 2D graphics APIs and drivers (and as a result,
|
||||
most SDL backends) lack h/w acceleration of alpha
|
||||
blended blits, which means the CPU has to perform
|
||||
the blending. That's relatively expensive, but
|
||||
SDL's software blitters are pretty fast, and it
|
||||
turns out *that's* usually not a problem.
|
||||
However, there is one problem: Alpha blending
|
||||
requires that data is read from the target surface,
|
||||
modified, and then written back. Unfortunately,
|
||||
modern video cards handle CPU reads from VRAM very
|
||||
poorly. The bandwidth for CPU reads - even on the
|
||||
latest monster AGP 8x card - is on par with that of
|
||||
an old hard drive. (I'm not kidding!)
|
||||
This is why I wanted to demonstrate how to avoid
|
||||
this problem, by rendering into a s/w back buffer
|
||||
instead of the h/w display surface. If you're on a
|
||||
system that supports hardware display surfaces, you
|
||||
can see the difference by hitting F2 in the game,
|
||||
to enable/disable rendering directly into VRAM.
|
||||
Indeed, SDL can set that up for you, but *only*
|
||||
if you ask for a single buffered display - and we
|
||||
do NOT want that! Single buffered displays cannot
|
||||
sync animation with the retrace, and as a result,
|
||||
we end up hogging the CPU (since we never block,
|
||||
but just pump out new frames) and still getting
|
||||
unsmooth animation.
|
||||
Accidentally, this approach of using a s/w back
|
||||
buffer for rendering mixes very well with partial
|
||||
update strategies, so it fits right in.
|
||||
|
||||
|
||||
Smart Dirty Rectangle Management
|
||||
--------------------------------
|
||||
The most complicated part of this implementation
|
||||
is keeping track of the exact areas of the screen
|
||||
that need updating. Just maintaining one rectangle
|
||||
per sprite would not be sufficient. A moving sprite
|
||||
has to be removed, animated and then re-rendered.
|
||||
That's two rectangles that need to be pushed to the
|
||||
screen; one to remove the old sprite image, and one
|
||||
for the new position.
|
||||
On a double buffered display, it gets even worse,
|
||||
as the rendering is done into two alternating
|
||||
buffers. When we update a buffer, the old sprites
|
||||
in it are actually *two* frames old - not one.
|
||||
I've chosen to implement a "smart" rectangle
|
||||
merging algorithm that can deal with all of this
|
||||
with a minimum of support from higher levels. The
|
||||
algorithm merges rectangles in order to minimize
|
||||
overdraw and rectangle count when blitting to and
|
||||
updating the screen. See the file dirtyrects.txt for
|
||||
details. You can (sort of) see what's going on by
|
||||
hitting F3 in the game. Here's what's going on:
|
||||
|
||||
1. All sprites are removed from the rendering
|
||||
buffer. The required information is found
|
||||
in the variables that store the results of
|
||||
the interpolation.
|
||||
2. The dirtyrect table for the display surface
|
||||
is swapped into a work dirtyrect table. The
|
||||
display surface dirtyrect table is cleared.
|
||||
3. New graphic coordinates are calculated, and
|
||||
all sprites are rendered into the rendering
|
||||
buffer. The bounding rectangles are fed
|
||||
into the display surface dirtyrect table.
|
||||
4. The dirtyrect table compiled in step 3 is
|
||||
merged into the work dirtyrect table. The
|
||||
result covers all areas that need to be
|
||||
updated to remove old sprites and make the
|
||||
new ones visible.
|
||||
5. The dirtyrect table compiled in step 4 is
|
||||
used to blit from the rendering buffer to
|
||||
the display surface.
|
||||
|
||||
On a double buffered display, there is one
|
||||
dirtyrect table for each display page, and there
|
||||
is (obviously) a page flip operation after step 5,
|
||||
but other than that, the algorithm is the same.
|
||||
|
||||
|
||||
Command Line Options
|
||||
--------------------
|
||||
|
||||
-f Fullscreen
|
||||
-s Single buffer
|
||||
<n> Depth = <n> bits
|
||||
|
||||
|
||||
//David Olofson <david@olofson.net>
|
961
programs/games/pig/trunk/aclocal.m4
vendored
Normal file
@ -0,0 +1,961 @@
|
||||
# generated automatically by aclocal 1.7.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# This macro actually does too much some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 8
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
AC_PREREQ([2.54])
|
||||
|
||||
# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
|
||||
# the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
|
||||
AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_MISSING_PROG(AMTAR, tar)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.7.1])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# -*- Autoconf -*-
|
||||
|
||||
|
||||
# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# AM_AUX_DIR_EXPAND
|
||||
|
||||
# Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
# Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND], [
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
|
||||
# Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
|
||||
# Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# serial 4 -*- Autoconf -*-
|
||||
|
||||
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
echo '#include "conftest.h"' > conftest.c
|
||||
echo 'int i;' > conftest.h
|
||||
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=conftest.c object=conftest.o \
|
||||
depfile=conftest.Po tmpdepfile=conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 &&
|
||||
grep conftest.h conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[rm -f .deps 2>/dev/null
|
||||
mkdir .deps 2>/dev/null
|
||||
if test -d .deps; then
|
||||
DEPDIR=.deps
|
||||
else
|
||||
# MS-DOS does not allow filenames that begin with a dot.
|
||||
DEPDIR=_deps
|
||||
fi
|
||||
rmdir .deps 2>/dev/null
|
||||
AC_SUBST([DEPDIR])
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking Speeds up one-time builds
|
||||
--enable-dependency-tracking Do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
#serial 2
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
|
||||
# Extract the definition of DEP_FILES from the Makefile without
|
||||
# running `make'.
|
||||
DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n -e '/^U = / s///p' < "$mf"`
|
||||
test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
|
||||
# We invoke sed twice because it is the simplest approach to
|
||||
# changing $(DEPDIR) to its actual value in the expansion.
|
||||
for file in `sed -n -e '
|
||||
/^DEP_FILES = .*\\\\$/ {
|
||||
s/^DEP_FILES = //
|
||||
:loop
|
||||
s/\\\\$//
|
||||
p
|
||||
n
|
||||
/\\\\$/ b loop
|
||||
p
|
||||
}
|
||||
/^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 2
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
doit:
|
||||
@echo done
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(am__include)
|
||||
AC_SUBST(am__quote)
|
||||
AC_MSG_RESULT($_am_result)
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 5
|
||||
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])
|
||||
AC_SUBST([$1_FALSE])
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.])
|
||||
fi])])
|
||||
|
||||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_SDL,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
|
||||
, enable_sdltest=yes)
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_args="$sdl_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
||||
|
1363
programs/games/pig/trunk/config.guess
vendored
Normal file
1470
programs/games/pig/trunk/config.sub
vendored
Normal file
4713
programs/games/pig/trunk/configure
vendored
Normal file
43
programs/games/pig/trunk/configure.in
Normal file
@ -0,0 +1,43 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
dnl Simple Automake init
|
||||
AC_INIT(pig.c)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AM_INIT_AUTOMAKE(pig, 1.0)
|
||||
|
||||
dnl Check for various tools
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
||||
dnl Check some compiler/platform stuff
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
dnl-------------------------------------------------------
|
||||
dnl Checks for SDL
|
||||
dnl-------------------------------------------------------
|
||||
SDL_VERSION=1.2.0
|
||||
AM_PATH_SDL($SDL_VERSION,:,
|
||||
AC_MSG_ERROR([*** SDL version $SDL_VERSION required!])
|
||||
)
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
|
||||
dnl-------------------------------------------------------
|
||||
dnl Checks for SDL_image
|
||||
dnl-------------------------------------------------------
|
||||
AC_CHECK_LIB(SDL_image, IMG_Load,,
|
||||
AC_MSG_ERROR([You need the SDL_image library to compile this software.
|
||||
Get it at http://www.libsdl.org/projects/SDL_image/]),
|
||||
-lSDL
|
||||
)
|
||||
LIBS="$LIBS -lSDL_image"
|
||||
|
||||
dnl Get compile and linking flags
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
|
||||
dnl Generate Makefile
|
||||
AC_OUTPUT(Makefile)
|
411
programs/games/pig/trunk/depcomp
Normal file
@ -0,0 +1,411 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. This file always lives in the current directory.
|
||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||
# $object doesn't have directory information.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
|
||||
tmpdepfile1="$object.d"
|
||||
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case "$arg" in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
# X makedepend
|
||||
(
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in no)
|
||||
set ""; shift
|
||||
cleared=yes
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tail +3 "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
176
programs/games/pig/trunk/dirty.c
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
------------------------------------------------------------
|
||||
Fixed Rate Pig - a fixed logic frame rate demo
|
||||
------------------------------------------------------------
|
||||
* Copyright (C) 2004 David Olofson <david@olofson.net>
|
||||
*
|
||||
* This software is released under the terms of the GPL.
|
||||
*
|
||||
* Contact author for permission if you want to use this
|
||||
* software, or work derived from it, under other terms.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "engine.h"
|
||||
|
||||
/* Approximate worth of one dirtyrect in pixels. */
|
||||
#define PIG_WORST_MERGE 300
|
||||
|
||||
/*
|
||||
* If the merged result gets at most this many percent
|
||||
* bigger than the larger of the two input rects,
|
||||
* accept it as Perfect.
|
||||
*/
|
||||
#define PIG_INSTANT_MERGE 10
|
||||
|
||||
|
||||
PIG_dirtytable *pig_dirty_open(int size)
|
||||
{
|
||||
PIG_dirtytable *pdt = (PIG_dirtytable *)malloc(sizeof(PIG_dirtytable));
|
||||
if(!pdt)
|
||||
return NULL;
|
||||
|
||||
pdt->size = size;
|
||||
pdt->rects = (SDL_Rect *)calloc(size, sizeof(SDL_Rect));
|
||||
if(!pdt->rects)
|
||||
{
|
||||
free(pdt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdt->count = 0;
|
||||
pdt->best = 0;
|
||||
return pdt;
|
||||
}
|
||||
|
||||
|
||||
void pig_dirty_close(PIG_dirtytable *pdt)
|
||||
{
|
||||
free(pdt->rects);
|
||||
free(pdt);
|
||||
}
|
||||
|
||||
|
||||
void pig_mergerect(SDL_Rect *from, SDL_Rect *to)
|
||||
{
|
||||
int x1 = from->x;
|
||||
int y1 = from->y;
|
||||
int x2 = from->x + from->w;
|
||||
int y2 = from->y + from->h;
|
||||
if(to->x < x1)
|
||||
x1 = to->x;
|
||||
if(to->y < y1)
|
||||
y1 = to->y;
|
||||
if(to->x + to->w > x2)
|
||||
x2 = to->x + to->w;
|
||||
if(to->y + to->h > y2)
|
||||
y2 = to->y + to->h;
|
||||
to->x = x1;
|
||||
to->y = y1;
|
||||
to->w = x2 - x1;
|
||||
to->h = y2 - y1;
|
||||
}
|
||||
|
||||
|
||||
void pig_intersectrect(SDL_Rect *from, SDL_Rect *to)
|
||||
{
|
||||
int Amin, Amax, Bmin, Bmax;
|
||||
Amin = to->x;
|
||||
Amax = Amin + to->w;
|
||||
Bmin = from->x;
|
||||
Bmax = Bmin + from->w;
|
||||
if(Bmin > Amin)
|
||||
Amin = Bmin;
|
||||
to->x = Amin;
|
||||
if(Bmax < Amax)
|
||||
Amax = Bmax;
|
||||
to->w = Amax - Amin > 0 ? Amax - Amin : 0;
|
||||
|
||||
Amin = to->y;
|
||||
Amax = Amin + to->h;
|
||||
Bmin = from->y;
|
||||
Bmax = Bmin + from->h;
|
||||
if(Bmin > Amin)
|
||||
Amin = Bmin;
|
||||
to->y = Amin;
|
||||
if(Bmax < Amax)
|
||||
Amax = Bmax;
|
||||
to->h = Amax - Amin > 0 ? Amax - Amin : 0;
|
||||
}
|
||||
|
||||
|
||||
void pig_dirty_add(PIG_dirtytable *pdt, SDL_Rect *dr)
|
||||
{
|
||||
int i, j, best_i, best_loss;
|
||||
/*
|
||||
* Look for merger candidates.
|
||||
*
|
||||
* We start right before the best match we
|
||||
* had the last time around. This can give
|
||||
* us large numbers of direct or quick hits
|
||||
* when dealing with old/new rects for moving
|
||||
* objects and the like.
|
||||
*/
|
||||
best_i = -1;
|
||||
best_loss = 100000000;
|
||||
if(pdt->count)
|
||||
i = (pdt->best + pdt->count - 1) % pdt->count;
|
||||
for(j = 0; j < pdt->count; ++j)
|
||||
{
|
||||
int a1, a2, am, ratio, loss;
|
||||
SDL_Rect testr;
|
||||
|
||||
a1 = dr->w * dr->h;
|
||||
|
||||
testr = pdt->rects[i];
|
||||
a2 = testr.w * testr.h;
|
||||
|
||||
pig_mergerect(dr, &testr);
|
||||
am = testr.w * testr.h;
|
||||
|
||||
/* Perfect or Instant Pick? */
|
||||
ratio = 100 * am / (a1 > a2 ? a1 : a2);
|
||||
if(ratio < PIG_INSTANT_MERGE)
|
||||
{
|
||||
/* Ok, this is good enough! Stop searching. */
|
||||
pig_mergerect(dr, &pdt->rects[i]);
|
||||
pdt->best = i;
|
||||
return;
|
||||
}
|
||||
|
||||
loss = am - a1 - a2;
|
||||
if(loss < best_loss)
|
||||
{
|
||||
best_i = i;
|
||||
best_loss = loss;
|
||||
pdt->best = i;
|
||||
}
|
||||
|
||||
++i;
|
||||
i %= pdt->count;
|
||||
}
|
||||
/* ...and if the best result is good enough, merge! */
|
||||
if((best_i >= 0) && (best_loss < PIG_WORST_MERGE))
|
||||
{
|
||||
pig_mergerect(dr, &pdt->rects[best_i]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try to add to table... */
|
||||
if(pdt->count < pdt->size)
|
||||
{
|
||||
pdt->rects[pdt->count++] = *dr;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Emergency: Table full! Grab best candidate... */
|
||||
pig_mergerect(dr, &pdt->rects[best_i]);
|
||||
}
|
||||
|
||||
|
||||
void pig_dirty_merge(PIG_dirtytable *pdt, PIG_dirtytable *from)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < from->count; ++i)
|
||||
pig_dirty_add(pdt, from->rects + i);
|
||||
}
|
41
programs/games/pig/trunk/dirty.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
------------------------------------------------------------
|
||||
Fixed Rate Pig - a fixed logic frame rate demo
|
||||
------------------------------------------------------------
|
||||
* Copyright (C) 2004 David Olofson <david@olofson.net>
|
||||
*
|
||||
* This software is released under the terms of the GPL.
|
||||
*
|
||||
* Contact author for permission if you want to use this
|
||||
* software, or work derived from it, under other terms.
|
||||
*/
|
||||
|
||||
#ifndef PIG_DIRTY_H
|
||||
#define PIG_DIRTY_H
|
||||
|
||||
/* A table of dirtyrects for one display page */
|
||||
typedef struct PIG_dirtytable
|
||||
{
|
||||
int size; /* Table size */
|
||||
SDL_Rect *rects; /* Table of rects */
|
||||
int count; /* # of rects currently used */
|
||||
int best; /* Merge testing starts here! */
|
||||
} PIG_dirtytable;
|
||||
|
||||
|
||||
PIG_dirtytable *pig_dirty_open(int size);
|
||||
void pig_dirty_close(PIG_dirtytable *pdt);
|
||||
|
||||
/* Add rectangle 'dr' to table 'pdt' */
|
||||
void pig_dirty_add(PIG_dirtytable *pdt, SDL_Rect *dr);
|
||||
|
||||
/* Merge table 'from' into 'pdt' */
|
||||
void pig_dirty_merge(PIG_dirtytable *pdt, PIG_dirtytable *from);
|
||||
|
||||
/* Extend 'to' to a new rect that includes both 'from' and 'to' */
|
||||
void pig_mergerect(SDL_Rect *from, SDL_Rect *to);
|
||||
|
||||
/* Clip 'to' into a rect that is the intersection of 'from' and 'to' */
|
||||
void pig_intersectrect(SDL_Rect *from, SDL_Rect *to);
|
||||
|
||||
#endif /* PIG_DIRTY_H */
|
83
programs/games/pig/trunk/dirtyrects.txt
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
Smart Dirty Rectangle Management
|
||||
--------------------------------
|
||||
|
||||
pig_dirty() contains an algorithm that tries to find
|
||||
the the best dirtyrect candidates for merging. While
|
||||
searching, it looks out for perfect or sufficiently
|
||||
good candidates.
|
||||
|
||||
(Perfect candidate:)
|
||||
The merged rectangle is of the same size
|
||||
as the largest of the two input rectangles:
|
||||
|
||||
Amerged <= MAX(A1, A2)
|
||||
|
||||
We don't actually test for this, but rather for...
|
||||
|
||||
Instant Pick candidate:
|
||||
Not Perfect, but good enough to be treated
|
||||
as such, considering the cost of going on
|
||||
searching for a better candidate:
|
||||
Amerged 100 / MAX(A1, A2) - 100 <= PIG_INSTANT_MERGE
|
||||
|
||||
(That is, the area of the merged rect must be
|
||||
no more than PIG_INSTANT_MERGE % bigger than
|
||||
the area of the larger of the two input rects.)
|
||||
|
||||
Note that this is also about how likely it is
|
||||
that thereis* a better candidate. Assuming
|
||||
that PIG_INSTANT_MERGE is set to a sensible
|
||||
value, it is not very likely at all. There
|
||||
would have to be another dirtyrect nearby, and
|
||||
the chance of that being a better match is
|
||||
rather low, since that would most likely have
|
||||
caused it to be merged with the tested dirtyrect
|
||||
long before our new rect came in.
|
||||
|
||||
(Good candidate:)
|
||||
The area of the merged rectangle is smaller
|
||||
than the total area of the two input rectangles:
|
||||
|
||||
(Amerged - A1 - A2) < 0
|
||||
|
||||
We don't actually test for this, but rather for...
|
||||
|
||||
Acceptable candidate:
|
||||
The area of the merged rectangle is larger
|
||||
than the total of the two input rectangles, but
|
||||
since there is some per-rectangle overhead,
|
||||
merging is still a win:
|
||||
|
||||
(Amerged - A1 - A2) <= PIG_WORST_MERGE
|
||||
|
||||
The default setting assumes that the cost of a
|
||||
rectangle is in the range of 300 pixels. One
|
||||
should probably benchmark a few different systems
|
||||
to see if that's reasonable.
|
||||
|
||||
Unacceptable candidate:
|
||||
The area of the merged rectangle is larger than
|
||||
the total of the input rectangles to the degree
|
||||
that merging is a definite loss:
|
||||
|
||||
(Amerged - A1 - A2) > PIG_WORST_MERGE
|
||||
|
||||
The algorithm instantly returns Perfect candidates as
|
||||
solutions. If there are only Good and Acceptable
|
||||
candidates, the best one (lowest number of wasted
|
||||
pixels) is the solution.
|
||||
|
||||
If there are only Unacceptable candidates, there is no
|
||||
sensible merger solution, so pig_dirty() will try to add
|
||||
a new dirtyrect.
|
||||
|
||||
If that fails (table full), the best candidate is used,
|
||||
even though it would have been Unacceptable under normal
|
||||
circumstances.
|
||||
|
||||
|
||||
TODO: Thereare* more alternatives than just "merge" or
|
||||
TODO: "don't merge"! For example, it might pay off to
|
||||
TODO: detect overlapping and clip dirtyrects to avoid
|
||||
TODO: it, when merging is not a viable option.
|
1156
programs/games/pig/trunk/engine.c
Normal file
404
programs/games/pig/trunk/engine.h
Normal file
@ -0,0 +1,404 @@
|
||||
/*
|
||||
------------------------------------------------------------
|
||||
Fixed Rate Pig - a fixed logic frame rate demo
|
||||
------------------------------------------------------------
|
||||
* Copyright (C) 2004 David Olofson <david@olofson.net>
|
||||
*
|
||||
* This software is released under the terms of the GPL.
|
||||
*
|
||||
* Contact author for permission if you want to use this
|
||||
* software, or work derived from it, under other terms.
|
||||
*/
|
||||
|
||||
#ifndef PIG_ENGINE_H
|
||||
#define PIG_ENGINE_H
|
||||
|
||||
#include "SDL.h"
|
||||
#include <math.h>
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846 /* pi */
|
||||
#endif
|
||||
#include "dirty.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------
|
||||
Game Engine
|
||||
----------------------------------------------------------*/
|
||||
|
||||
typedef struct PIG_object PIG_object;
|
||||
typedef struct PIG_engine PIG_engine;
|
||||
|
||||
|
||||
/* Interpolated point */
|
||||
typedef struct PIG_ipoint
|
||||
{
|
||||
/* From the last logic frame: */
|
||||
float ox, oy; /* Position */
|
||||
|
||||
/* From the last/current rendered frame: */
|
||||
int gimage; /* Sprite frame index */
|
||||
float gx, gy; /* Interpolated position */
|
||||
} PIG_ipoint;
|
||||
|
||||
|
||||
/*
|
||||
* Game logic events
|
||||
*
|
||||
* PREFRAME:
|
||||
* Occurs once per logic frame, before collision and
|
||||
* off-screen detection, and before timer handlers.
|
||||
*
|
||||
* TIMERx:
|
||||
* Occurs whenever timer x expires. Timers are one-
|
||||
* shot, but can be reloaded by the handler for
|
||||
* periodic action. Timer events are handled before
|
||||
* before collision and off-screen detection.
|
||||
*
|
||||
* HIT_TILE:
|
||||
* Occurs when the hot-spot of an object hits a
|
||||
* marked side of a tile, and the corresponding bit
|
||||
* in 'tilemask' is set.
|
||||
*
|
||||
* HIT_OBJECT:
|
||||
* Occurs when the collision circle of an object
|
||||
* intersects the collision circle of another object,
|
||||
* provided one or more bits in 'hitgroup' of the
|
||||
* other object matches bits in 'hitmask'.
|
||||
*
|
||||
* OFFSCREEN:
|
||||
* Occurs when an object is off-screen. This takes
|
||||
* in account the hot-spot and bounding rectangle of
|
||||
* the current sprite frame.
|
||||
*
|
||||
* POSTFRAME:
|
||||
* Occurs once per logic frame, after collision
|
||||
* detection, off-screen detection and all other
|
||||
* events.
|
||||
*
|
||||
*/
|
||||
#define PIG_TIMERS 3
|
||||
typedef enum
|
||||
{
|
||||
PIG_PREFRAME,
|
||||
PIG_TIMER0,
|
||||
PIG_TIMER1,
|
||||
PIG_TIMER2,
|
||||
PIG_HIT_TILE,
|
||||
PIG_HIT_OBJECT,
|
||||
PIG_OFFSCREEN,
|
||||
PIG_POSTFRAME
|
||||
} PIG_events;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PIG_NONE = 0,
|
||||
|
||||
/* Bit positions */
|
||||
PIG_TOP_B = 0,
|
||||
PIG_BOTTOM_B = 1,
|
||||
PIG_LEFT_B = 2,
|
||||
PIG_RIGHT_B = 3,
|
||||
|
||||
/* Masks */
|
||||
PIG_TOP = 1 << PIG_TOP_B,
|
||||
PIG_BOTTOM = 1 << PIG_BOTTOM_B,
|
||||
PIG_LEFT = 1 << PIG_LEFT_B,
|
||||
PIG_RIGHT = 1 << PIG_RIGHT_B,
|
||||
|
||||
/* Combined masks */
|
||||
PIG_TL = PIG_TOP | PIG_LEFT,
|
||||
PIG_TR = PIG_TOP | PIG_RIGHT,
|
||||
PIG_BL = PIG_BOTTOM | PIG_LEFT,
|
||||
PIG_BR = PIG_BOTTOM | PIG_RIGHT,
|
||||
PIG_ALL = 0xf,
|
||||
} PIG_sides;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PIG_UNCHANGED = -10000000,
|
||||
PIG_MIN = -10000001,
|
||||
PIG_CENTER = -10000002,
|
||||
PIG_MAX = -10000003
|
||||
} PIG_values;
|
||||
|
||||
|
||||
/* Collision info */
|
||||
typedef struct
|
||||
{
|
||||
float ff; /* Fractional frame */
|
||||
int x, y; /* Exact position */
|
||||
PIG_sides sides; /* Side of tile hit */
|
||||
} PIG_cinfo;
|
||||
|
||||
|
||||
typedef struct PIG_event
|
||||
{
|
||||
PIG_events type;
|
||||
|
||||
/* For HIT_TILE, HIT_OBJECT and OFFSCREEN: */
|
||||
PIG_cinfo cinfo; /* Detailed collision info */
|
||||
|
||||
/* For HIT_OBJECT: */
|
||||
PIG_object *obj; /* Which object? */
|
||||
} PIG_event;
|
||||
|
||||
|
||||
/* Logic object */
|
||||
struct PIG_object
|
||||
{
|
||||
PIG_engine *owner;
|
||||
PIG_object *next, *prev;
|
||||
|
||||
int id; /* Unique ID. 0 means "free". */
|
||||
|
||||
int ibase; /* Sprite frame base index */
|
||||
int image; /* Sprite frame offset */
|
||||
float x, y; /* Position */
|
||||
float vx, vy; /* Speed */
|
||||
float ax, ay; /* Acceleration */
|
||||
PIG_ipoint ip;
|
||||
int tilemask; /* Sprite/tile mask [PIG_ALL] */
|
||||
|
||||
int hitmask; /* Sprite/sprite mask [0] */
|
||||
int hitgroup; /* Sprite/sprite group [0] */
|
||||
|
||||
int timer[PIG_TIMERS]; /* Down-counting timers */
|
||||
int age; /* Age timer (logic frames) */
|
||||
|
||||
int score;
|
||||
int power;
|
||||
int target;
|
||||
int state;
|
||||
|
||||
void (*handler)(PIG_object *po, const PIG_event *ev);
|
||||
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
|
||||
/* Level map */
|
||||
typedef struct PIG_map
|
||||
{
|
||||
PIG_engine *owner;
|
||||
|
||||
int w, h; /* Size of map (tiles) */
|
||||
unsigned char *map; /* 2D aray of tile indices */
|
||||
unsigned char *hit; /* 2D aray of collision flags */
|
||||
|
||||
int tw, th; /* Size of one tile (pixels) */
|
||||
SDL_Surface *tiles; /* Tile palette image */
|
||||
unsigned char hitinfo[256]; /* Collision info for the tiles */
|
||||
} PIG_map;
|
||||
|
||||
|
||||
/* Sprite frame */
|
||||
typedef struct PIG_sprite
|
||||
{
|
||||
int w, h; /* Size of sprite (pixels) */
|
||||
int hotx, hoty; /* Hot-spot offset (pixels) */
|
||||
int radius; /* Collision zone radius (pixels) */
|
||||
SDL_Surface *surface;
|
||||
} PIG_sprite;
|
||||
|
||||
/* Engine */
|
||||
struct PIG_engine
|
||||
{
|
||||
/* Video stuff */
|
||||
SDL_Surface *screen;
|
||||
SDL_Surface *buffer; /* For h/w surface displays */
|
||||
SDL_Surface *surface; /* Where to render to */
|
||||
int pages; /* # of display VRAM buffers */
|
||||
SDL_Rect view; /* Viewport pos & size (pixels) */
|
||||
int page; /* Current page (double buffer) */
|
||||
PIG_dirtytable *pagedirty[2]; /* One table for each page */
|
||||
PIG_dirtytable *workdirty; /* The work dirtytable */
|
||||
|
||||
/* "Live" switches */
|
||||
int interpolation;
|
||||
int direct; /* 1 ==> render directly to screen */
|
||||
int show_dirtyrects;
|
||||
|
||||
/* Time */
|
||||
double time; /* Logic time (frames) */
|
||||
int frame; /* Logic time; integer part */
|
||||
|
||||
/* Background graphics */
|
||||
PIG_map *map;
|
||||
|
||||
/* Sprites and stuff */
|
||||
PIG_object *objects;
|
||||
PIG_object *object_pool;
|
||||
int object_id_counter;
|
||||
int nsprites;
|
||||
PIG_sprite **sprites;
|
||||
|
||||
/* Logic frame global handlers */
|
||||
void (*before_objects)(PIG_engine *pe);
|
||||
void (*after_objects)(PIG_engine *pe);
|
||||
|
||||
/* Space for user data */
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Engine
|
||||
*/
|
||||
PIG_engine *pig_open(SDL_Surface *screen);
|
||||
void pig_close(PIG_engine *pe);
|
||||
|
||||
/* Set viewport size and position */
|
||||
void pig_viewport(PIG_engine *pe, int x, int y, int w, int h);
|
||||
|
||||
/* Start engine at logic time 'frame' */
|
||||
void pig_start(PIG_engine *pe, int frame);
|
||||
|
||||
/*
|
||||
* Load a sprite palette image. The image is chopped up into
|
||||
* sprites, based on 'sw' and 'sh', and added as new frames
|
||||
* in the sprite bank. Default values:
|
||||
* Hot-spot: (sw/2, sh/2)
|
||||
* Collision radius: 0.2 * (sw + sh)
|
||||
*
|
||||
* Passing 0 for 'sw' and/or 'sh' makes pig_sprites() take
|
||||
* the respective value from the image width and/or height.
|
||||
*
|
||||
* Returns the index of the first frame loaded.
|
||||
*/
|
||||
int pig_sprites(PIG_engine *pe, const char *filename, int sw, int sh);
|
||||
|
||||
/* Set hot-spot of sprite 'frame' to (hotx, hoty) */
|
||||
int pig_hotspot(PIG_engine *pe, int frame, int hotx, int hoty);
|
||||
|
||||
/* Set sprite/sprite collision zone radius of 'frame' */
|
||||
int pig_radius(PIG_engine *pe, int frame, int radius);
|
||||
|
||||
/* Advance logic time by 'frames' logic frames */
|
||||
void pig_animate(PIG_engine *pe, float frames);
|
||||
|
||||
/*
|
||||
* Manually add a dirtyrect for pig_refresh().
|
||||
* 'dr' can be outside the engine viewport.
|
||||
*/
|
||||
void pig_dirty(PIG_engine *pe, SDL_Rect *dr);
|
||||
|
||||
/*
|
||||
* Do what's needed to deal with the dirtyrects
|
||||
* and then make the new frame visible.
|
||||
*/
|
||||
void pig_flip(PIG_engine *pe);
|
||||
|
||||
/*
|
||||
* Refresh the viewport and any additional dirtyrects.
|
||||
*
|
||||
* Note that this does not refresh the entire viewport;
|
||||
* only the areas that have actually changed!
|
||||
*/
|
||||
void pig_refresh(PIG_engine *pe);
|
||||
|
||||
/*
|
||||
* Refresh the whole viewport, including sprites.
|
||||
*/
|
||||
void pig_refresh_all(PIG_engine *pe);
|
||||
|
||||
/* Render a sprite "manually", bypassing the engine */
|
||||
void pig_draw_sprite(PIG_engine *pe, int frame, int x, int y);
|
||||
|
||||
/*
|
||||
* Get the collision flags for the tile at (x, y),
|
||||
* where the unit of x and y is pixels. The return
|
||||
* is the PIG_sides flags for the tile, or PIG_NONE
|
||||
* if (x, y) is outside the map.
|
||||
*/
|
||||
int pig_test_map(PIG_engine *pe, int x, int y);
|
||||
|
||||
/*
|
||||
* Find the first "collidable" tile side when going from
|
||||
* (x1, y1) to (x2, y2). 'mask' determines which tile sides
|
||||
* are considered for collisions.
|
||||
*
|
||||
* Returns the side(s) hit, if any tile was hit. If the return
|
||||
* is non-zero, the PIG_cinfo struct at 'ci' contains detailed
|
||||
* information about the collision.
|
||||
*/
|
||||
int pig_test_map_vector(PIG_engine *pe, int x1, int y1, int x2, int y2,
|
||||
int mask, PIG_cinfo *ci);
|
||||
|
||||
|
||||
/*
|
||||
* Map
|
||||
*/
|
||||
PIG_map *pig_map_open(PIG_engine *pe, int w, int h);
|
||||
void pig_map_close(PIG_map *pm);
|
||||
|
||||
/* Load a tile palette image */
|
||||
int pig_map_tiles(PIG_map *pm, const char *filename, int tw, int th);
|
||||
|
||||
/*
|
||||
* Set tile collision info for 'count' tiles, starting at
|
||||
* 'first'. Each tile in the tile palette has a set of
|
||||
* PIG_sides flags that determine which sides the tile are
|
||||
* considered for sprite/map collisions.
|
||||
*/
|
||||
void pig_map_collisions(PIG_map *pm, unsigned first, unsigned count,
|
||||
PIG_sides sides);
|
||||
|
||||
/*
|
||||
* Load a map from a string (one byte/tile). 'trans'
|
||||
* is a string used for translating 'data' into integer
|
||||
* tile indices. Each position in 'trans' corresponds
|
||||
* to one tile in the tile palette.
|
||||
*/
|
||||
int pig_map_from_string(PIG_map *pm, const char *trans, const char *data);
|
||||
|
||||
|
||||
/*
|
||||
* Object
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create an object with the initial position (x, y). If
|
||||
* 'last' is 1, the object will end up last in the
|
||||
* processing and rendering order, otherwise, first.
|
||||
*
|
||||
* Note that relative processing order is very important
|
||||
* to objects that chase each other and stuff like that!
|
||||
* If they're placed in the "wrong" order, the tracking
|
||||
* objects get an extra frame of reaction time, which is
|
||||
* annoying if it's not what you intend.
|
||||
*/
|
||||
PIG_object *pig_object_open(PIG_engine *pe, int x, int y, int last);
|
||||
|
||||
/*
|
||||
* Delete an object.
|
||||
*
|
||||
* Note that objects are never actually deleted. Instead,
|
||||
* they are placed in a free pool, where pig_object_open()
|
||||
* looks for objects to recycle.
|
||||
*
|
||||
* In fact, they are not even freed when you ask for it,
|
||||
* but rather kept around until the next rendered frame,
|
||||
* so they can be removed from the screen correctly.
|
||||
*/
|
||||
void pig_object_close(PIG_object *po);
|
||||
|
||||
/*
|
||||
* Close all objects.
|
||||
*/
|
||||
void pig_object_close_all(PIG_engine *pe);
|
||||
|
||||
/*
|
||||
* Find object by 'id', starting at object 'start'.
|
||||
*
|
||||
* The search starts at 'start' and is done in both
|
||||
* directions in parallel, assuming that the matching
|
||||
* object is near 'start' in the list. (It usually is
|
||||
* when dealing with linked objects.)
|
||||
*
|
||||
* Returns NULL if the object was not found.
|
||||
*/
|
||||
PIG_object *pig_object_find(PIG_object *start, int id);
|
||||
|
||||
#endif /* PIG_ENGINE_H */
|
BIN
programs/games/pig/trunk/evil.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
programs/games/pig/trunk/font.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
programs/games/pig/trunk/glassfont.png
Normal file
After Width: | Height: | Size: 156 KiB |
BIN
programs/games/pig/trunk/icons.png
Normal file
After Width: | Height: | Size: 117 KiB |
251
programs/games/pig/trunk/install-sh
Normal file
@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
BIN
programs/games/pig/trunk/lifepig.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
190
programs/games/pig/trunk/missing
Normal file
@ -0,0 +1,190 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing - GNU libit 0.0"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`configure.in'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`configure.in'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`configure.in'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
40
programs/games/pig/trunk/mkinstalldirs
Normal file
@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
BIN
programs/games/pig/trunk/pig-linux-x86
Normal file
1332
programs/games/pig/trunk/pig.c
Normal file
BIN
programs/games/pig/trunk/pigframes.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
programs/games/pig/trunk/slime.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
programs/games/pig/trunk/stars.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
programs/games/pig/trunk/tiles.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
programs/games/soko/trunk/100BOXES.LEV
Normal file
BIN
programs/games/soko/trunk/990602.LEV
Normal file
BIN
programs/games/soko/trunk/AENIGMA.LEV
Normal file
BIN
programs/games/soko/trunk/ALBG-BST.LEV
Normal file
BIN
programs/games/soko/trunk/ALBG1-1.LEV
Normal file
BIN
programs/games/soko/trunk/ALBG1-2.LEV
Normal file
BIN
programs/games/soko/trunk/ALBG1-3.LEV
Normal file
BIN
programs/games/soko/trunk/AUTOGEN.LEV
Normal file
BIN
programs/games/soko/trunk/BAGLE.LEV
Normal file
BIN
programs/games/soko/trunk/BAGLE2.LEV
Normal file
BIN
programs/games/soko/trunk/BOXXLE1.LEV
Normal file
BIN
programs/games/soko/trunk/BOXXLE2.LEV
Normal file
BIN
programs/games/soko/trunk/CANTRIP.LEV
Normal file
BIN
programs/games/soko/trunk/CANTRIP2.LEV
Normal file
28
programs/games/soko/trunk/CELLTYPE.INC
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
EOF equ 0xf0 ; image index:
|
||||
macro EndConf {db 0xff}
|
||||
tEmpty equ 0000b ; (0xf) - missing
|
||||
tPlace equ 0001b ; 9
|
||||
tPlayer equ 0010b ; 0
|
||||
tWall equ 0100b ; 1
|
||||
tBlock equ 0110b ; 5
|
||||
|
||||
tHole equ 0111b ; 2
|
||||
tConnect equ 1000b ; 7
|
||||
tStConnect equ 1001b ; 8
|
||||
tPlate equ 1010b ; 3
|
||||
tBroken equ 1011b ; 4
|
||||
|
||||
tLaserW equ 1100b ; 0xa
|
||||
tLaserS equ 1101b ; 0xa
|
||||
tLaserN equ 1110b ; 0xa
|
||||
tLaserE equ 1111b ; 0xa
|
||||
|
||||
tRedB equ 1000b ; 0xc
|
||||
tBluB equ 1001b ; 0xb
|
||||
tGrnB equ 1010b ; 0xd
|
||||
tYelB equ 1011b ; 0xe
|
||||
|
||||
sSokoban equ 0xf1
|
||||
sSokolor equ 0xf2
|
||||
sSokonex equ 0xf3
|
BIN
programs/games/soko/trunk/CNF
Normal file
102
programs/games/soko/trunk/CNF.ASM
Normal file
@ -0,0 +1,102 @@
|
||||
include "celltype.inc"
|
||||
|
||||
macro Header name, game_type, x, y
|
||||
{
|
||||
db game_type,x,y
|
||||
local ..label
|
||||
db ..label-$-1
|
||||
db name
|
||||
..label:
|
||||
}
|
||||
|
||||
macro C cell,cnt
|
||||
{
|
||||
if cnt eq
|
||||
db (cell shl 4)
|
||||
else
|
||||
db (cell shl 4)+cnt-1
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
Header 'Sokonex test', sSokonex, 6, 6
|
||||
|
||||
; # Wall; + Connector; * Player; B Block
|
||||
|
||||
; ######
|
||||
; # + #
|
||||
; # #
|
||||
; # ++ #
|
||||
; #* #
|
||||
; ######
|
||||
|
||||
C tWall,7
|
||||
|
||||
C tEmpty,2
|
||||
C tConnect
|
||||
C tEmpty
|
||||
|
||||
C tWall,2
|
||||
C tEmpty,4
|
||||
C tWall,2
|
||||
C tEmpty
|
||||
|
||||
C tConnect,2
|
||||
C tEmpty
|
||||
C tWall,2
|
||||
C tPlayer
|
||||
|
||||
C tEmpty,3
|
||||
C tWall,7
|
||||
|
||||
EndConf
|
||||
|
||||
Header 'Just push!', sSokoban, 9, 8
|
||||
|
||||
; #####
|
||||
; ### ###
|
||||
; # @@@ #
|
||||
; # # # #
|
||||
; ## #B# ##
|
||||
; # B * B #
|
||||
; # # #
|
||||
; #########
|
||||
|
||||
C tEmpty,2
|
||||
C tWall,5
|
||||
C tEmpty,2
|
||||
|
||||
C tWall,3
|
||||
C tEmpty,3
|
||||
C tWall,4
|
||||
C tEmpty,2
|
||||
C tPlace,3
|
||||
C tEmpty,2
|
||||
C tWall,2
|
||||
C tEmpty,2
|
||||
|
||||
C tWall
|
||||
C tEmpty
|
||||
C tWall
|
||||
C tEmpty,2
|
||||
C tWall,3
|
||||
C tEmpty
|
||||
C tWall
|
||||
C tBlock
|
||||
C tWall
|
||||
C tEmpty
|
||||
C tWall,3
|
||||
C tEmpty
|
||||
C tBlock
|
||||
C tEmpty
|
||||
C tPlayer
|
||||
C tEmpty
|
||||
C tBlock
|
||||
C tEmpty
|
||||
C tWall,2
|
||||
C tEmpty,3
|
||||
C tWall
|
||||
C tEmpty,3
|
||||
C tWall,10
|
||||
|
||||
EndConf
|