Bonjour

j'aurais, j'espère, une dernière question : pour retirer les lignes, je fais une erreur dans le code suivant mais je ne sais pas laquelle. Donc je m'en remets encore à vous.
La logique que j'utilise : je regarde si dans la ligne toutes les couleurs sont différentes de zéro (255 dans mon cas) ; si c'est le cas ben je retourne une valeur dans eax ...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
PROC checkremovelines
	uses edi, ecx , ebx
 
	mov esi, offset blockarray
 
	mov ebx, 20       ; row
	checkline:
			mov ecx,10  ;position in row  
			checkpixel:
				lodsb			;load in al esi
				cmp al, 255    ;check if pixel is 255 (nothing)
				je checknextrow ;check next pixel
				cmp ecx, 1		; check if we are in the last pixel of the row 
				jne checknextpixel 
				mov eax, ebx           ;if row is full return the row in eax ( we have to do 20 - row later becaus if we are on the last row it will return 20)
				ret
				checknextpixel:
					dec ecx
					jmp checkecx;
				checknextrow:
					mov ecx, 0
					checkecx:
					cmp ecx,0
				jne checkpixel
			dec ebx
			jnz checkline
	mov eax, ebx ; return value of ebx if the loop is done (return normaly 0)
	ret
 
ENDP checkremovelines
 
 
PROC removelines
ARG rowoffset: dword
	uses eax, edi, ecx
 
	mov eax, [rowoffset]
	mov edi, offset blockarray
 
	imul eax, 10
	add edi, eax
 
	mov esi, 255
	mov ch, 10
	removeline:
		lodsb
		stosb
		dec ch
		jnz removeline
	ret
 
ENDP removelines
 
PROC gamelogic
	uses eax, ebx, edx
 
	inc [dword ptr counter]   ; eerste deel voor senlheid van het vallen van een block
	mov eax, [dword ptr counter]
	mov edx, 0
	mov ebx, 10 
	idiv ebx
 
	cmp edx, 0
	je falling
	ret
 
	falling:
		call fall
		cmp eax,1
		je insert
		ret
 
		insert:
			call returnBlockOffset	
			call inserblockinarray, eax, [dword ptr current_position]
			checkifwecanremoveline:
				call checkremovelines   ;check if a row is full
				cmp eax, 0              ; if eax zero wil say that there is no full rows we can call a next random block
				je donextstep
				mov ebx, 19			;delete 20 to the row 
				sub ebx, eax
				call removelines, ebx
				cmp ebx,0
				jne checkifwecanremoveline
 
			donextstep:
				call randomblok
	ret
ENDP gamelogic