Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5253 mario79 1
;---------------------------------------------------------------------
2
show_tiles_one_iteration:
3
	mov	[show_tiles_iterations],1
4
	call	copy_plan_level_to_plan_level_old
5
	call	show_tiles_1
6
	call	clear_show_flags_to_plan_level
7
	call	copy_plan_level_to_plan_level_old
8
	ret
9
;---------------------------------------------------------------------
10
show_tiles:
11
	mov	[show_tiles_iterations],SPRITE_SIZE_X
12
;--------------------------------------
13
.loop:
14
	call	show_tiles_1
15
	mcall	5,1
16
	dec	[show_tiles_iterations]
17
	jnz	.loop
18
 
19
	call	clear_show_flags_to_plan_level
20
	call	copy_plan_level_to_plan_level_old
21
	ret
22
;---------------------------------------------------------------------
23
show_tiles_1:
24
;	DEBUGF	1, "show_tiles_1\n"
25
	; set start coordinates
26
	xor	edx,edx
27
	mov	ebx,LEVEL_MAP_SIZE_Y
28
	mov	ecx,plan_level
29
;--------------------------------------
30
.new_y:
31
	mov	eax,LEVEL_MAP_SIZE_X
32
	ror	edx,16
33
	xor	dx,dx
34
	rol	edx,16
35
;--------------------------------------
36
.new_x:
37
	push	eax ebx ecx
38
 
39
	mov	ebp,[ecx]
40
 
41
	cmp	[draw_all_level],1
42
	je	.draw_all_level
43
;;	DEBUGF	1, "Y : %x X: %x cell: %x ebp: %x\n",ebx,eax,ecx,ebp
44
	mov	eax,ebp
45
	rol	eax,8
46
	test	al,al
47
	jz	.end_show_buffer
48
 
49
;	cmp	[show_tiles_iterations],1
50
;	jne	.not_clear
51
 
52
;	mov	al,0
53
;--------------------------------------
54
;.not_clear:
55
;	ror	eax,8
56
;	mov	[ecx],eax
57
;;	DEBUGF	1, "new cell: %x eax: %x\n",ecx,eax
58
;--------------------------------------
59
.draw_all_level:
60
	and	ebp,0xff
61
	mov	eax,[base_icons]
62
	imul	ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y ; 8bpp
63
;	imul	ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*3 ; 24bpp
64
	call	copy_base_8bpp
65
 
66
	mov	eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
67
	mov	ebp,ecx
68
	sub	ebp,plan_level
69
	add	ebp,plan_level_old
70
	cmp	[ebp+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
71
	jne	@f
72
 
73
	push	dword [show_tiles_iterations]
74
	mov	[show_tiles_iterations],1
75
	call	calculate_new_characters_offsets_and_sizes
76
	call	analize_and_copy_object
77
	pop	dword [show_tiles_iterations]
78
	jmp	.draw_cell
79
;--------------------------------------
80
@@:
81
 
82
	call	calculate_new_characters_offsets_and_sizes
83
	call	analize_and_copy_object ; new object moves into the cell.
84
	cmp	[show_tiles_iterations],1
85
	je	.draw_cell
86
;	mov	eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
87
;	DEBUGF	1, "object id new: %x\n",eax
88
	sub	ecx,plan_level
89
	add	ecx,plan_level_old
90
 
91
	mov	eax,[ecx]
92
	shr	eax,16
93
	test	al,al	; route or static?
94
	jz	.draw_cell
95
;	mov	eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
96
;	DEBUGF	1, "object id old: %x\n",eax
97
;	cmp	[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
98
;	je	@f	; old and new state of the cell is equal
99
 
100
;	DEBUGF	1, "old object moves out of the cell\n"
101
	call	calculate_old_characters_offsets_and_sizes
102
	call	analize_and_copy_object	; old object moves out of the cell
103
;--------------------------------------
104
.draw_cell:
105
	xor	ebp,ebp
106
	mcall	65,buffer_area,,,32	; 32bpp
107
;--------------------------------------
108
.end_show_buffer:
109
	pop	ecx ebx eax
110
 
111
	add	ecx,4
112
	add	edx,SPRITE_SIZE_X shl 16
113
	dec	eax
114
	jnz	.new_x
115
 
116
	add	edx,SPRITE_SIZE_Y
117
	dec	ebx
118
	jnz	.new_y
119
;	DEBUGF	1, "show_tiles_1 END\n"
120
	ret
121
;---------------------------------------------------------------------
122
map_level_to_plan_level:
123
;	mov	esi,map_level_0
124
;	mov	esi,map_level_game_over
125
	mov	edi,plan_level
126
	mov	ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
127
	cld
128
	rep	movsd
129
	ret
130
;---------------------------------------------------------------------
131
generate_objects_id:
132
	mov	esi,plan_level
133
	mov	edi,objects_id
134
	mov	ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
135
	mov	edx,1
136
	cld
137
;--------------------------------------
138
.loop:
139
	lodsd
140
	mov	ebx,eax
141
	xor	eax,eax
142
	test	bh,bh
143
	jz	@f
144
 
145
	mov	eax,edx
146
	inc	edx	; next object
147
;--------------------------------------
148
@@:
149
	stosd
150
	dec	ecx
151
	jnz	.loop
152
 
153
;	DEBUGF	1, "object id max: %x\n",edx
154
	ret
155
;---------------------------------------------------------------------
156
copy_plan_level_to_plan_level_old:
157
	mov	esi,plan_level
158
	mov	edi,plan_level_old
159
	mov	ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*2	; plan_level + objects_id
160
	cld
161
	rep	movsd
162
	ret
163
;---------------------------------------------------------------------
164
clear_show_flags_to_plan_level:
165
	mov	esi,plan_level
166
	mov	edi,plan_level
167
	mov	ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
168
	cld
169
;--------------------------------------
170
@@:
171
	lodsd
172
	ror	eax,24
173
	mov	al,0
174
	ror	eax,8
175
	stosd
176
	dec	ecx
177
	jnz	@b
178
 
179
	ret
180
;---------------------------------------------------------------------