Subversion Repositories Kolibri OS

Rev

Rev 2883 | Rev 2974 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2883 Rev 2933
Line 15... Line 15...
15
include 'mem.inc'
15
include 'mem.inc'
16
include 'dll.inc'
16
include 'dll.inc'
17
include 'vox_draw.inc'
17
include 'vox_draw.inc'
Line 18... Line 18...
18
 
18
 
19
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
19
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
Line 20... Line 20...
20
caption db 'Voxel editor 19.07.12',0 ;¯®¤¯¨áì ®ª­ 
20
caption db 'Voxel editor 23.08.12',0 ;¯®¤¯¨áì ®ª­ 
21
 
21
 
22
struct FileInfoBlock
22
struct FileInfoBlock
23
	Function dd ?
23
	Function dd ?
Line 34... Line 34...
34
 
34
 
35
fn_toolbar db 'toolbar.png',0
35
fn_toolbar db 'toolbar.png',0
36
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
36
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
37
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*21
37
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*21
-
 
38
image_data_toolbar dd 0
-
 
39
cursors_count equ 4
Line 38... Line 40...
38
image_data_toolbar dd 0
40
IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨭ª¨ á ªãàá®à ¬¨
39
 
41
 
40
;§­ ç¥­¨ï § ¤ ¢ ¥¬ë¥ ¯® 㬮«ç ­¨î, ¡¥§ ini ä ©« 
42
;§­ ç¥­¨ï § ¤ ¢ ¥¬ë¥ ¯® 㬮«ç ­¨î, ¡¥§ ini ä ©« 
41
ini_def_window_t equ 10
43
ini_def_window_t equ 10
Line 103... Line 105...
103
 
105
 
104
OT_MAP_X  equ  0
106
OT_MAP_X  equ  0
105
OT_MAP_Y  equ  0
107
OT_MAP_Y  equ  0
106
OT_CAPT_X_COLOR equ  5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â 
108
OT_CAPT_X_COLOR equ  5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â 
-
 
109
OT_CAPT_Y_COLOR equ 30
-
 
110
PEN_MODE_NONE equ -1
107
OT_CAPT_Y_COLOR equ 30
111
PEN_MODE_CLEAR equ 0 ;०¨¬ áâ¨à ­¨ï
Line 108... Line 112...
108
PEN_MODE_SELECT_COLOR equ 2 ;०¨¬ ¢ë¡®à  梥â 
112
PEN_MODE_SELECT_COLOR equ 2 ;०¨¬ ¢ë¡®à  梥â 
109
 
113
 
110
align 4
114
align 4
Line 163... Line 167...
163
	imul eax,[tile_size]
167
	imul eax,[tile_size]
164
	mov [buf_pl.w],eax
168
	mov [buf_pl.w],eax
165
	add eax,[tile_size]
169
	add eax,[tile_size]
166
	mov [buf_pl.h],eax
170
	mov [buf_pl.h],eax
Line -... Line 171...
-
 
171
 
-
 
172
	;*** § £à㧪  ªãàá®à®¢
-
 
173
	load_image_file 'cursors_gr.png',image_data_toolbar,IMAGE_CURSORS_SIZE
-
 
174
	stdcall [buf2d_create_f_img], buf_curs_8,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
-
 
175
	stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
-
 
176
 
-
 
177
	load_image_file 'cursors.png',image_data_toolbar, IMAGE_CURSORS_SIZE
-
 
178
	stdcall [buf2d_create_f_img], buf_curs,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
-
 
179
	stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
-
 
180
 
-
 
181
	stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8¡¨â
-
 
182
	stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;¤¥« ¥¬ ¡ãä¥à rgba 32¡¨â
-
 
183
 
167
 
184
 
168
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
185
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
169
	stdcall [buf2d_create], buf_0z ;ᮧ¤ ­¨¥ ¡ãä¥à  £«ã¡¨­ë
186
	stdcall [buf2d_create], buf_0z ;ᮧ¤ ­¨¥ ¡ãä¥à  £«ã¡¨­ë
Line 170... Line 187...
170
	stdcall [buf2d_create], buf_pl ;ᮧ¤ ­¨¥ ¡ãä¥à  ¤«ï á¥ç¥­¨ï
187
	stdcall [buf2d_create], buf_pl ;ᮧ¤ ­¨¥ ¡ãä¥à  ¤«ï á¥ç¥­¨ï
Line 176... Line 193...
176
	stdcall mem.Alloc,[max_open_file_size]
193
	stdcall mem.Alloc,[max_open_file_size]
177
	mov dword[open_file_vox],eax
194
	mov dword[open_file_vox],eax
Line 178... Line 195...
178
 
195
 
Line -... Line 196...
-
 
196
	call but_new_file
-
 
197
 
-
 
198
	;¯¥à¢®­ ç «ì­ ï ãáâ ­®¢ª  ªãàá®à 
179
	call but_new_file
199
	stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen
180
 
200
 
181
align 4
201
align 4
Line 182... Line 202...
182
red_win:
202
red_win:
Line 292... Line 312...
292
			xor edx,edx
312
			xor edx,edx
293
			mov ecx,[tile_size] ;W
313
			mov ecx,[tile_size] ;W
294
			div ecx
314
			div ecx
295
			mov [v_cur_x],eax ;X-coord
315
			mov [v_cur_x],eax ;X-coord
Line 296... Line 316...
296
 
316
 
297
			cmp dword[v_pen_mode],0
317
			cmp dword[v_pen_mode],PEN_MODE_CLEAR
298
			jl .end_1
318
			jl .end_1
299
			cmp dword[v_pen_mode],1
319
			cmp dword[v_pen_mode],1
300
			jg .end_1
320
			jg .end_1
301
				mov eax,[v_cur_x]
321
				mov eax,[v_cur_x]
Line 695... Line 715...
695
	jne @f
715
	jne @f
696
		call but_mode_clear
716
		call but_mode_clear
697
	@@:
717
	@@:
698
	cmp ah,15
718
	cmp ah,15
699
	jne @f
719
	jne @f
700
		mov dword[v_pen_mode],PEN_MODE_SELECT_COLOR
720
		stdcall set_pen_mode,PEN_MODE_SELECT_COLOR,3,((9 shl 8)+9) shl 16
701
		call draw_palete
721
		call draw_palete
702
	@@:
722
	@@:
703
	cmp ah,16
723
	cmp ah,16
704
	jne @f
724
	jne @f
705
		call but_light
725
		call but_light
Line 741... Line 761...
741
	je @f
761
	je @f
742
		stdcall [buf2d_delete],buf_r_img
762
		stdcall [buf2d_delete],buf_r_img
743
		stdcall [buf2d_delete],buf_r_z
763
		stdcall [buf2d_delete],buf_r_z
744
	@@:
764
	@@:
745
	stdcall [buf2d_vox_brush_delete], buf_vox
765
	stdcall [buf2d_vox_brush_delete], buf_vox
-
 
766
	stdcall [buf2d_delete],buf_curs
-
 
767
	stdcall [buf2d_delete],buf_curs_8
746
	stdcall mem.Free,[image_data_toolbar]
768
	stdcall mem.Free,[image_data_toolbar]
747
	stdcall mem.Free,[open_file_vox]
769
	stdcall mem.Free,[open_file_vox]
748
	mcall -1
770
	mcall -1
Line 749... Line 771...
749
 
771
 
Line 998... Line 1020...
998
 
1020
 
999
align 4
1021
align 4
1000
but_mode_pen:
1022
but_mode_pen:
1001
	push eax
1023
	push eax
1002
	mov eax,dword[v_pen_mode]
1024
	mov eax,dword[v_pen_mode]
1003
	mov dword[v_pen_mode],1 ;pen
1025
	stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen
1004
	cmp eax,PEN_MODE_SELECT_COLOR
1026
	cmp eax,PEN_MODE_SELECT_COLOR
1005
	jne @f
1027
	jne @f
1006
		call draw_objects
1028
		call draw_objects
1007
	@@:
1029
	@@:
Line 1010... Line 1032...
1010
 
1032
 
1011
align 4
1033
align 4
1012
but_mode_brush:
1034
but_mode_brush:
1013
	push eax
1035
	push eax
1014
	mov eax,dword[v_pen_mode]
1036
	mov eax,dword[v_pen_mode]
1015
	mov dword[v_pen_mode],3 ;brush
1037
	stdcall set_pen_mode,3,1,((9 shl 8)+9) shl 16 ;brush
1016
	cmp eax,PEN_MODE_SELECT_COLOR
1038
	cmp eax,PEN_MODE_SELECT_COLOR
1017
	jne @f
1039
	jne @f
1018
		call draw_objects
1040
		call draw_objects
1019
	@@:
1041
	@@:
Line 1022... Line 1044...
1022
 
1044
 
1023
align 4
1045
align 4
1024
but_mode_clear:
1046
but_mode_clear:
1025
	push eax
1047
	push eax
1026
	mov eax,dword[v_pen_mode]
1048
	mov eax,dword[v_pen_mode]
1027
	mov dword[v_pen_mode],0 ;clear
1049
	stdcall set_pen_mode,PEN_MODE_CLEAR,2,((15 shl 8)+9) shl 16
1028
	cmp eax,PEN_MODE_SELECT_COLOR
1050
	cmp eax,PEN_MODE_SELECT_COLOR
1029
	jne @f
1051
	jne @f
1030
		call draw_objects
1052
		call draw_objects
1031
	@@:
1053
	@@:
Line 1306... Line 1328...
1306
v_zoom dd 3 ;⥪ã騩 ¬ áèâ ¡
1328
v_zoom dd 3 ;⥪ã騩 ¬ áèâ ¡
1307
v_cur_x dd 0 ;ª®®à¤¨­ â  ªãàá®à  x
1329
v_cur_x dd 0 ;ª®®à¤¨­ â  ªãàá®à  x
1308
v_cur_y dd 0 ;ª®®à¤¨­ â  ªãàá®à  y (­® ®áì ¢ ®¡ê¥ªâ¥ z)
1330
v_cur_y dd 0 ;ª®®à¤¨­ â  ªãàá®à  y (­® ®áì ¢ ®¡ê¥ªâ¥ z)
1309
n_plane dd 0 ;¯«®áª®áâì á¥ç¥­¨ï
1331
n_plane dd 0 ;¯«®áª®áâì á¥ç¥­¨ï
1310
v_color dd 0xff ;梥⠪ à ­¤ è 
1332
v_color dd 0xff ;梥⠪ à ­¤ è 
1311
v_pen_mode dd 1 ;०¨¬: 0-áâ¨à ­¨ï, 1-à¨á®¢ ­¨ï
1333
v_pen_mode dd PEN_MODE_NONE ;०¨¬ à ¡®âë ªãàá®à  (á¬. ª®­áâ ­âë PEN_MODE_...)
1312
mode_light dd 1 ;०¨¬ ®á¢¥é¥­¨ï
1334
mode_light dd 1 ;०¨¬ ®á¢¥é¥­¨ï
1313
cam_x dd 0
1335
cam_x dd 0
1314
cam_y dd 0
1336
cam_y dd 0
1315
cam_z dd 0
1337
cam_z dd 0
1316
scaled_zoom dd 5 ;¬ áèâ ¡ ¯®á«¥ ª®â®à®£® ­ ç¨­ ¥âáï à¨á®¢ ­¨¥ ç á⨠¨§®¡à ¦¥­¨ï
1338
scaled_zoom dd 5 ;¬ áèâ ¡ ¯®á«¥ ª®â®à®£® ­ ç¨­ ¥âáï à¨á®¢ ­¨¥ ç á⨠¨§®¡à ¦¥­¨ï
Line 1462... Line 1484...
1462
 
1484
 
1463
	.end_f:
1485
	.end_f:
1464
popad
1486
popad
Line -... Line 1487...
-
 
1487
	ret
-
 
1488
 
-
 
1489
;hot_p - ª®®à¤¨­ âë £®àï祩 â®çª¨ ªãàá®à , ᬥ饭­ë¥ ­  ¡¨â 16 ((cx shl 8) + cy) shl 16
-
 
1490
align 4
-
 
1491
proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword
-
 
1492
	mov eax,[mode]
-
 
1493
	cmp [v_pen_mode],eax
-
 
1494
	je @f
-
 
1495
		mov [v_pen_mode],eax
-
 
1496
		mov edx,[hot_p]
-
 
1497
		mov dx,2 ;LOAD_INDIRECT
-
 
1498
		mov ecx,[icon]
-
 
1499
		shl ecx,12 ;㬭®¦ ¥¬ ­  4 ª¡
-
 
1500
		add ecx,[buf_curs.data]
-
 
1501
		mcall 37,4
-
 
1502
 
-
 
1503
		cmp eax,0
-
 
1504
		je @f
-
 
1505
			mov [cursor_pointer],eax
-
 
1506
			mcall 37,5,[cursor_pointer]
-
 
1507
	@@:
-
 
1508
	ret
1465
	ret
1509
endp
1466
 
1510
 
1467
if 0
1511
if 0
1468
;input:
1512
;input:
1469
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
1513
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
Line 1858... Line 1902...
1858
	rb BUF_STRUCT_SIZE
1902
	rb BUF_STRUCT_SIZE
1859
align 4
1903
align 4
1860
buf_r_z:
1904
buf_r_z:
1861
	rb BUF_STRUCT_SIZE
1905
	rb BUF_STRUCT_SIZE
Line -... Line 1906...
-
 
1906
 
-
 
1907
align 4
-
 
1908
cursor_pointer dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï ªãàá®à 
-
 
1909
 
-
 
1910
buf_curs: ;¡ãä¥à á ªãàá®à ¬¨
-
 
1911
.data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
-
 
1912
	dw 0 ;+4 left
-
 
1913
	dw 0 ;+6 top
-
 
1914
	dd 32 ;+8 w
-
 
1915
	dd 32*cursors_count ;+12 h
-
 
1916
	dd 0 ;+16 color
-
 
1917
	db 24 ;+20 bit in pixel
-
 
1918
 
-
 
1919
align 4
-
 
1920
buf_curs_8: ;¡ãä¥à á ¯à®§à ç­®áâìî ¤«ï ªãàá®à®¢
-
 
1921
.data: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
-
 
1922
	dw 0 ;+4 left
-
 
1923
	dw 0 ;+6 top
-
 
1924
	dd 32 ;+8 w
-
 
1925
	dd 32*cursors_count ;+12 h
-
 
1926
	dd 0 ;+16 color
-
 
1927
	db 24 ;+20 bit in pixel
1862
 
1928
 
1863
;¤ ­­ë¥ ¤«ï ᮧ¤ ­¨ï ¬¨­¨¬ «ì­®£® ¥¤¨­¨ç­®£® ¢®ªá¥«ï
1929
;¤ ­­ë¥ ¤«ï ᮧ¤ ­¨ï ¬¨­¨¬ «ì­®£® ¥¤¨­¨ç­®£® ¢®ªá¥«ï
1864
align 4
1930
align 4
1865
vox_6_7_z:
1931
vox_6_7_z:
1866
dd 0,0,1,1,0,0,\
1932
dd 0,0,1,1,0,0,\