2008-12-09 02:58:40 +03:00
|
|
|
|
use32
|
|
|
|
|
org 0x0
|
|
|
|
|
db 'MENUET01'
|
|
|
|
|
dd 0x01
|
|
|
|
|
dd _preSTART
|
|
|
|
|
dd I_END
|
|
|
|
|
dd 0x4000
|
|
|
|
|
dd 0x4000
|
|
|
|
|
dd 0x0,0x0
|
|
|
|
|
|
2009-02-01 15:55:05 +03:00
|
|
|
|
include 'macros.inc'
|
2008-12-09 02:58:40 +03:00
|
|
|
|
include 'lang.inc'
|
|
|
|
|
include 'draw_window.inc'
|
|
|
|
|
include 'ball_operations.inc'
|
|
|
|
|
include 'basic_alg.inc'
|
|
|
|
|
|
|
|
|
|
_preSTART:
|
|
|
|
|
mcall 66, 1, 1 ;<3B>ਭ<EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD> ᪠<>-<2D><><EFBFBD><EFBFBD>
|
|
|
|
|
mcall 3 ;randomize
|
|
|
|
|
ror eax, 16
|
|
|
|
|
mov [TC_U_SYSTEM_RANDSEED], eax ;from PPro "system.inc"
|
|
|
|
|
|
|
|
|
|
new_game:
|
|
|
|
|
;<3B><><EFBFBD>㫥<EFBFBD><E3ABA5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov eax, 0
|
|
|
|
|
mov ecx, 81 / 4
|
|
|
|
|
mov edi, lineBall
|
|
|
|
|
rep stosd
|
|
|
|
|
stosb
|
|
|
|
|
|
|
|
|
|
mov [score], 0
|
|
|
|
|
mov [countAllBall], 0
|
|
|
|
|
mov [current], 0
|
|
|
|
|
@@:
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
call random
|
|
|
|
|
inc dl
|
|
|
|
|
call add_new_ball
|
2009-02-01 15:55:05 +03:00
|
|
|
|
call test_new_ball
|
|
|
|
|
cmp [countAllBall], 5
|
|
|
|
|
jb @b
|
2008-12-09 02:58:40 +03:00
|
|
|
|
call generate_new___new_color
|
|
|
|
|
|
|
|
|
|
START:
|
|
|
|
|
draw_window
|
|
|
|
|
still:
|
|
|
|
|
mcall 10
|
|
|
|
|
|
|
|
|
|
dec eax
|
|
|
|
|
jz START ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ<EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
dec eax
|
|
|
|
|
jnz button ;<3B> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
key: ; <20><><EFBFBD><EFBFBD>⨥ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mcall 2 ; <20><><EFBFBD><EFBFBD>砥<EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp ah, 60
|
|
|
|
|
je new_game
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
button: ; <20><><EFBFBD><EFBFBD>⨥ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mcall 17
|
|
|
|
|
shr eax, 8
|
|
|
|
|
cmp ax, 1 ; <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>室<EFBFBD>?
|
|
|
|
|
je .exit
|
|
|
|
|
|
|
|
|
|
;<3B><EFBFBD>ਬ, <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>⪠
|
|
|
|
|
mov edx, [current]
|
|
|
|
|
test byte [eax + lineBall - 2], 0x7
|
|
|
|
|
jz .blank
|
|
|
|
|
|
|
|
|
|
;<3B><EFBFBD>ਬ <20><> <20>뫠 <20><> <20><><EFBFBD> <20><><EFBFBD>⪠ 㦥 <20><><EFBFBD>࠭<EFBFBD>
|
|
|
|
|
cmp eax, edx
|
|
|
|
|
je .double_choice
|
|
|
|
|
|
|
|
|
|
mov [current], eax
|
|
|
|
|
call choice_ball
|
|
|
|
|
call paint_ball ;᭠砫<E1ADA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥬 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> <20><>ਪ
|
|
|
|
|
|
|
|
|
|
test edx, edx ;cmp [current], 0
|
|
|
|
|
jz still
|
|
|
|
|
mov eax, edx
|
|
|
|
|
|
|
|
|
|
@@:
|
|
|
|
|
call redraw_cell ;<3B> 㦥 <20><>⮬ 㡥६ ࠬ<><E0A0AC> <20><> <20><><EFBFBD>ண<EFBFBD>
|
|
|
|
|
call paint_ball
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
.double_choice:
|
|
|
|
|
mov [current], 0
|
|
|
|
|
jmp @B
|
|
|
|
|
|
|
|
|
|
.blank: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
test edx, edx ;cmp [current], 0
|
|
|
|
|
jz still
|
|
|
|
|
mov [dest], eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD> -> <20> [dest]
|
|
|
|
|
mov eax, edx ;<3B><>ࠬ<EFBFBD><E0A0AC><EFBFBD> <20> eax
|
|
|
|
|
call test_path ;<3B><><EFBFBD>뢠<EFBFBD><EBA2A0> ४<><E0A5AA><EFBFBD><EFBFBD><EFBFBD> test_path
|
|
|
|
|
call zero_cheked
|
|
|
|
|
jnc still
|
|
|
|
|
|
|
|
|
|
;^^^^^^^^^^^^^^^^^ move_ball proc
|
|
|
|
|
mov eax, [current]
|
|
|
|
|
mov cl, byte [eax + lineBall - 2]
|
|
|
|
|
mov byte [eax + lineBall - 2], 0
|
|
|
|
|
mov eax, [dest]
|
|
|
|
|
mov byte [eax + lineBall - 2], cl
|
|
|
|
|
|
|
|
|
|
mov eax, [current]
|
|
|
|
|
call redraw_cell
|
|
|
|
|
mov eax, [dest]
|
|
|
|
|
call paint_ball
|
|
|
|
|
mov [current], 0
|
|
|
|
|
;^^^^^^^^^^^^^^^^^ move_ball endp
|
|
|
|
|
|
|
|
|
|
call find_line
|
|
|
|
|
call vanish_balls
|
|
|
|
|
call zero_cheked
|
|
|
|
|
|
|
|
|
|
cmp [countVanishBall], 0
|
|
|
|
|
je new_3_balls
|
|
|
|
|
movzx eax, [countVanishBall]
|
|
|
|
|
inc eax
|
|
|
|
|
add [score], eax
|
|
|
|
|
sub [countAllBall], al
|
|
|
|
|
call redraw_score
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
.exit:
|
|
|
|
|
mcall -1 ;<3B><>室<EFBFBD><E5AEA4>
|
|
|
|
|
|
|
|
|
|
new_3_balls:
|
|
|
|
|
|
|
|
|
|
rept 3 num
|
|
|
|
|
{
|
|
|
|
|
mov dl, [newColor#num]
|
|
|
|
|
call add_new_ball
|
|
|
|
|
call test_new_ball
|
|
|
|
|
cmp [countAllBall],81
|
|
|
|
|
je .record_li
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
call generate_new___new_color
|
|
|
|
|
call paint_new_color
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
.record_li:
|
|
|
|
|
mov eax, [score]
|
|
|
|
|
cmp eax, [record]
|
|
|
|
|
jbe still
|
|
|
|
|
mov [record], eax
|
|
|
|
|
jmp START
|
|
|
|
|
|
|
|
|
|
zero_cheked: ;<3B><><EFBFBD>㫥<EFBFBD><E3ABA5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cheked
|
|
|
|
|
pushfd
|
|
|
|
|
mov eax, lineBall
|
|
|
|
|
mov ecx, 81
|
|
|
|
|
@@:
|
|
|
|
|
and byte [eax], 0x7
|
|
|
|
|
inc eax
|
|
|
|
|
loop @B
|
|
|
|
|
popfd
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
random: ; edx := random [0..(ebx-1)]
|
|
|
|
|
mov eax, 134775813
|
|
|
|
|
mul [TC_U_SYSTEM_RANDSEED]
|
|
|
|
|
inc eax
|
|
|
|
|
mov [ TC_U_SYSTEM_RANDSEED], eax
|
|
|
|
|
xor edx, edx
|
|
|
|
|
div ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
generate_new___new_color:
|
|
|
|
|
rept 3 num
|
|
|
|
|
{
|
|
|
|
|
mov ebx, 7
|
|
|
|
|
call random
|
|
|
|
|
inc dl
|
|
|
|
|
mov [newColor#num], dl
|
|
|
|
|
}
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
add_new_ball: ;<3B> dl - 梥<> <20><>ਪ<EFBFBD>
|
|
|
|
|
mov ebp, edx
|
|
|
|
|
mov ebx, 81
|
|
|
|
|
sub bl, [countAllBall]
|
|
|
|
|
call random
|
|
|
|
|
mov ecx, edx
|
|
|
|
|
mov eax, lineBall-1
|
|
|
|
|
inc ecx
|
|
|
|
|
@@:
|
|
|
|
|
inc eax
|
|
|
|
|
test byte [eax], 0x7
|
|
|
|
|
jnz @B
|
|
|
|
|
loop @B
|
|
|
|
|
|
|
|
|
|
;⥯<><E2A5AF><EFBFBD> <20> <20><><EFBFBD> <20> eax - <20><><EFBFBD><EFBFBD><EFBFBD> <20><>襣<EFBFBD> <20><>ਪ<EFBFBD>
|
|
|
|
|
mov edx, ebp
|
|
|
|
|
or byte [eax], dl
|
|
|
|
|
inc [countAllBall]
|
2009-02-01 15:55:05 +03:00
|
|
|
|
;<3B><><EFBFBD><EFBFBD>稬 ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
sub eax, lineBall-2
|
|
|
|
|
mov [dest], eax
|
2008-12-09 02:58:40 +03:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
test_new_ball:
|
|
|
|
|
call paint_ball
|
|
|
|
|
|
|
|
|
|
call find_line
|
|
|
|
|
call vanish_balls
|
|
|
|
|
call zero_cheked
|
|
|
|
|
|
|
|
|
|
cmp [countVanishBall], 0
|
|
|
|
|
je @F
|
|
|
|
|
movzx eax, [countVanishBall]
|
|
|
|
|
inc eax
|
|
|
|
|
add [score], eax
|
|
|
|
|
sub [countAllBall], al
|
|
|
|
|
call redraw_score
|
|
|
|
|
@@:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
if lang eq ru
|
2009-02-01 15:55:05 +03:00
|
|
|
|
szTitle db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> v 0.3',0
|
2008-12-09 02:58:40 +03:00
|
|
|
|
szNewGame db 'F2 - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>',0
|
|
|
|
|
szRecord db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0
|
|
|
|
|
szScore db '<27>窨',0
|
|
|
|
|
else
|
2009-02-01 15:55:05 +03:00
|
|
|
|
szTitle db 'Color lines v 0.3',0
|
2008-12-09 02:58:40 +03:00
|
|
|
|
szNewGame db 'F2 - new game',0
|
|
|
|
|
szRecord db 'Record',0
|
|
|
|
|
szScore db 'Score',0
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blank = 0xB8C2D3
|
|
|
|
|
brown = 0x804000
|
|
|
|
|
red = 0xff0000
|
|
|
|
|
yellow = 0xffff00
|
|
|
|
|
green = 0x008000
|
|
|
|
|
cyan = 0x00ffff
|
|
|
|
|
blue = 0x0000ff
|
|
|
|
|
purple = 0x800080
|
|
|
|
|
|
|
|
|
|
tableColor dd blank,brown,red,yellow,green,cyan,blue,purple
|
|
|
|
|
|
|
|
|
|
lineCoord:
|
|
|
|
|
rept 9 coory:0
|
|
|
|
|
{
|
|
|
|
|
rept 9 coorx:0
|
|
|
|
|
\{
|
|
|
|
|
dw coorx*256+coory
|
|
|
|
|
|
|
|
|
|
\}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
record dd 25
|
|
|
|
|
|
|
|
|
|
lineBall db 81 dup ?
|
|
|
|
|
score dd ?
|
|
|
|
|
baseAddr dd ?
|
|
|
|
|
current dd ?
|
|
|
|
|
dest dd ?
|
|
|
|
|
|
|
|
|
|
newColor1 db ?
|
|
|
|
|
newColor2 db ?
|
|
|
|
|
newColor3 db ?
|
|
|
|
|
|
|
|
|
|
countVanishBall db ?
|
|
|
|
|
countAllBall db ?
|
|
|
|
|
|
|
|
|
|
TC_U_SYSTEM_RANDSEED dd ?
|
|
|
|
|
bitID dd ?
|
|
|
|
|
|
|
|
|
|
I_END:
|