Subversion Repositories Kolibri OS

Rev

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

Rev 2758 Rev 2759
Line 7... Line 7...
7
	dd mem
7
	dd mem
8
	dd stacktop
8
	dd stacktop
9
	dd 0
9
	dd 0
10
	dd sys_path
10
	dd sys_path
Line 11... Line 11...
11
 
11
 
12
include 'd:/kolibri/svn/programs/macros.inc'
12
include '../../../../programs/macros.inc'
13
include 'd:/kolibri/svn/programs/proc32.inc'
13
include '../../../../programs/proc32.inc'
14
include 'd:/kolibri/svn/programs/develop/libraries/box_lib/load_lib.mac'
14
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
15
include 'mem.inc'
15
include 'mem.inc'
16
include 'dll.inc'
16
include 'dll.inc'
Line 17... Line 17...
17
include 'vox_draw.inc'
17
include 'vox_draw.inc'
18
 
18
 
Line 19... Line 19...
19
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
19
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
20
caption db 'Voxel editor 11.06.12',0 ;¯®¤¯¨áì ®ª­ 
20
caption db 'Voxel editor 12.06.12',0 ;¯®¤¯¨áì ®ª­ 
21
 
21
 
22
struct FileInfoBlock
22
struct FileInfoBlock
Line 300... Line 300...
300
	sub bx,buf2d_l
300
	sub bx,buf2d_l
301
	cmp ebx,buf2d_w
301
	cmp ebx,buf2d_w
302
	jg .end_f
302
	jg .end_f
303
		stdcall [buf2d_get_pixel], edi,ebx,eax
303
		stdcall [buf2d_get_pixel], edi,ebx,eax
304
		mov [v_color],eax
304
		mov [v_color],eax
305
		;stdcall [buf2d_filled_rect_by_size], buf_0, 5,3, 8,8,eax
-
 
306
		;stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
305
		call on_change_color ;®â®¡à ¦ ¥¬ ¨§¬¥­¥­¨ï 梥â 
307
		mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
-
 
308
		mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
-
 
309
		mov edx,[v_color]
-
 
310
		mcall 13
-
 
311
	.end_f:
306
	.end_f:
312
popad
307
popad
313
	ret
308
	ret
314
endp
309
endp
Line 470... Line 465...
470
	mov edx,txt_n_plane
465
	mov edx,txt_n_plane
471
	int 0x40
466
	int 0x40
Line 472... Line 467...
472
 
467
 
473
	mov eax,47
468
	mov eax,47
474
	mov ecx,[v_zoom]
469
	mov ecx,[v_zoom]
475
	mov ebx,(2 shl 16)
470
	mov ebx,(3 shl 16)+(1 shl 31)
476
	mov edx,((365+6*9) shl 16)+5
471
	mov edx,((365+6*9) shl 16)+5
477
	mov esi,[sc.work_button_text]
472
	mov esi,[sc.work_button_text]
478
	or  esi,(1 shl 30)
473
	or  esi,(1 shl 30)
479
	mov edi,[sc.work_button]
474
	mov edi,[sc.work_button]
480
	int 0x40 ;¬ áèâ ¡
-
 
481
	mov ebx,(5 shl 16)
475
	int 0x40 ;¬ áèâ ¡
482
	mov ecx,[v_cur_x]
476
	mov ecx,[v_cur_x]
483
	add edx,(6*2)*65536+9
477
	add edx,(6*2)*65536+9
484
	int 0x40 ;
-
 
485
	mov ebx,(5 shl 16)
478
	int 0x40 ;
486
	mov ecx,[v_cur_y]
479
	mov ecx,[v_cur_y]
487
	add edx,(6*0)*65536+9
480
	add edx,(6*0)*65536+9
488
	int 0x40 ;
-
 
489
	mov ebx,(5 shl 16)
481
	int 0x40 ;
490
	mov ecx,[n_plane]
482
	mov ecx,[n_plane]
491
	add edx,(6*0)*65536+9
483
	add edx,(6*0)*65536+9
Line 492... Line 484...
492
	int 0x40 ;
484
	int 0x40 ;­®¬¥à á¥ç¥­¨ï
493
 
485
 
494
	mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
486
	mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
495
	mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2
487
	mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2
496
	mov ecx,[sc.work_text]
488
	mov ecx,[sc.work_text]
497
	or  ecx,0x80000000 ;or (1 shl 30)
489
	or  ecx,0x80000000 ;or (1 shl 30)
Line -... Line 490...
-
 
490
	mov edx,txt_color
-
 
491
	int 0x40
-
 
492
 
-
 
493
	call on_change_color
-
 
494
	ret
-
 
495
 
498
	mov edx,txt_color
496
align 4
499
	int 0x40
497
on_change_color:
500
 
498
pushad
501
	mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
499
	mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
-
 
500
	mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
-
 
501
	mov edx,[v_color]
-
 
502
	mcall 13
-
 
503
 
-
 
504
	mov ebx,(1 shl 8)+(6 shl 16)
-
 
505
	mov ecx,edx
-
 
506
	mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2
-
 
507
	mov esi,[sc.work_text]
-
 
508
	add esi,(1 shl 30)
502
	mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
509
	mov edi,[sc.work]
Line 503... Line 510...
503
	mov edx,[v_color]
510
	mcall 47
504
	mcall 13
511
popad
505
	ret
512
	ret
Line 527... Line 534...
527
	jne @f
534
	jne @f
528
		call but_save_file
535
		call but_save_file
529
	@@:
536
	@@:
530
	cmp ah,6
537
	cmp ah,6
531
	jne @f
538
	jne @f
532
		call but_1
539
		call but_zoom_p
533
	@@:
540
	@@:
534
	cmp ah,7
541
	cmp ah,7
535
	jne @f
542
	jne @f
536
		call but_2
543
		call but_zoom_m
537
	@@:
544
	@@:
538
	cmp ah,8
545
	cmp ah,8
539
	jne @f
546
	jne @f
540
		call but_3
547
		call but_3
541
	@@:
548
	@@:
Line 637... Line 644...
637
	;
644
	;
638
	mov eax,[open_file_vox]
645
	mov eax,[open_file_vox]
639
	movzx eax,byte[eax]
646
	movzx eax,byte[eax]
640
	and eax,0xff ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
647
	and eax,0xff ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
641
	mov dword[v_zoom],eax ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
648
	mov dword[v_zoom],eax ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
-
 
649
	mov dword[cam_x],0
-
 
650
	mov dword[cam_y],0
-
 
651
	mov dword[cam_z],0
642
	call draw_objects
652
	call draw_objects
643
	.end_open_file:
653
	.end_open_file:
644
	popad
654
	popad
645
	ret
655
	ret
Line 677... Line 687...
677
	popad
687
	popad
678
	ret
688
	ret
Line 679... Line 689...
679
 
689
 
680
;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
690
;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
681
align 4
691
align 4
682
but_1:
692
but_zoom_p:
683
	cmp dword[v_zoom],10 ;¬ ªá¨¬ «ì­ë© à §¬¥à, ¤® ª®â®à®£® ¬®¦­® 㢥«¨ç¨âì 2^10=1024
693
	cmp dword[v_zoom],10 ;¬ ªá¨¬ «ì­ë© à §¬¥à, ¤® ª®â®à®£® ¬®¦­® 㢥«¨ç¨âì 2^10=1024
684
	jge @f
694
	jge @f
685
		inc dword[v_zoom]
695
		inc dword[v_zoom]
686
		shl dword[n_plane],1
696
		shl dword[n_plane],1
687
		push eax
697
		push eax
688
		mov eax,[v_zoom]
698
		mov eax,[v_zoom]
689
		cmp eax,[scaled_zoom]
699
		cmp eax,[scaled_zoom]
-
 
700
		jl .end_0
-
 
701
			push ecx
-
 
702
			mov ecx,[scaled_zoom]
-
 
703
			xor eax,eax
-
 
704
			inc eax
690
		jl .end_0
705
			shl eax,cl
691
			shl dword[cam_x],1
706
			shl dword[cam_x],1
692
			shl dword[cam_y],1
707
			shl dword[cam_y],1
-
 
708
			shl dword[cam_z],1
-
 
709
			cmp eax,[n_plane]
-
 
710
			jg .end_1
-
 
711
				;ª®à¥ªâ¨à®¢ª  ¯®«§ã­ª 
-
 
712
				sub [n_plane],eax
-
 
713
				inc dword[cam_y]
-
 
714
			.end_1:
693
			shl dword[cam_z],1
715
			pop ecx
694
		.end_0:
716
		.end_0:
695
		pop eax
717
		pop eax
696
		call draw_objects
718
		call draw_objects
697
		call draw_pok
719
		call draw_pok
698
	@@:
720
	@@:
Line 699... Line 721...
699
	ret
721
	ret
700
 
722
 
701
;㬥­ì襭¨¥ ¬ áèâ ¡ 
723
;㬥­ì襭¨¥ ¬ áèâ ¡ 
702
align 4
724
align 4
703
but_2:
725
but_zoom_m:
704
	cmp dword[v_zoom],-1
726
	cmp dword[v_zoom],1
705
	jl @f
727
	jl @f
706
		dec dword[v_zoom]
728
		dec dword[v_zoom]
707
		shr dword[n_plane],1
729
		shr dword[n_plane],1
708
		push eax
730
		push eax
709
		mov eax,[v_zoom]
731
		mov eax,[v_zoom]
710
		cmp eax,[scaled_zoom]
732
		cmp eax,[scaled_zoom]
711
		jl .end_0
733
		jl .end_0
-
 
734
			shr dword[cam_x],1
-
 
735
			shr dword[cam_y],1
-
 
736
			jnc .end_1
-
 
737
				;ª®à¥ªâ¨à®¢ª  ¯®«§ã­ª 
-
 
738
				push ecx
-
 
739
				mov ecx,[scaled_zoom]
-
 
740
				dec ecx
-
 
741
				xor eax,eax
-
 
742
				inc eax
-
 
743
				shl eax,cl
-
 
744
				add [n_plane],eax
712
			shr dword[cam_x],1
745
				pop ecx
713
			shr dword[cam_y],1
746
			.end_1:
714
			shr dword[cam_z],1
747
			shr dword[cam_z],1
715
		.end_0:
748
		.end_0:
716
		pop eax
749
		pop eax
Line 729... Line 762...
729
but_4:
762
but_4:
730
	stdcall vox_obj_rot_x, [open_file_vox]
763
	stdcall vox_obj_rot_x, [open_file_vox]
731
	call draw_objects
764
	call draw_objects
732
	ret
765
	ret
Line -... Line 766...
-
 
766
 
733
 
767
;ᤢ¨£ ¥¬ ¯«®áª®áâì á१ 
734
align 4
768
align 4
-
 
769
but_5:
735
but_5:
770
push eax ecx
-
 
771
	inc dword[n_plane]
-
 
772
	mov eax,[v_zoom]
-
 
773
	cmp eax,[scaled_zoom]
-
 
774
	jle .end_0
-
 
775
		;¯à®¨á室¨â ¬ áèâ ¡¨à®¢ ­¨¥
-
 
776
		mov ecx,[scaled_zoom]
-
 
777
		xor eax,eax
-
 
778
		inc eax
-
 
779
		shl eax,cl
-
 
780
		cmp eax,[n_plane]
-
 
781
		jg @f
-
 
782
			mov dword[n_plane],0
-
 
783
			inc dword[cam_y] ;¯¥à¥å®¤¨¬ ¢ á®á¥¤­¨© ªã¡
-
 
784
			neg ecx
-
 
785
			;inc ecx
-
 
786
			add ecx,[v_zoom]
-
 
787
			xor eax,eax
-
 
788
			inc eax
-
 
789
			shl eax,cl
-
 
790
			cmp eax,[cam_y]
-
 
791
			jg @f
-
 
792
				mov dword[cam_y],0 ;§ æ¨ª«¨¢ ¥¬ ¥á«¨ ¢ë«¥§«¨ §  ¯à¥¤¥«ë ¯®á«¥¤­¥£® ªã¡ 
-
 
793
		@@:
-
 
794
		jmp .end_1
-
 
795
	.end_0:
-
 
796
		;¬ áèâ ¡¨à®¢ ­¨¥ ­¥ ¯à®¨á室¨â
-
 
797
		mov ecx,eax
-
 
798
		xor eax,eax
-
 
799
		inc eax
-
 
800
		shl eax,cl
-
 
801
		cmp eax,[n_plane]
-
 
802
		jg .end_1
-
 
803
			mov dword[n_plane],0
736
	inc dword[n_plane]
804
	.end_1:
737
	call draw_objects
805
	call draw_objects
-
 
806
	call draw_pok
738
	call draw_pok
807
pop ecx eax
Line -... Line 808...
-
 
808
	ret
739
	ret
809
 
740
 
810
;ᤢ¨£ ¥¬ ¯«®áª®áâì á१ 
741
align 4
-
 
742
but_6:
-
 
743
	cmp dword[n_plane],0
811
align 4
-
 
812
but_6:
-
 
813
	dec dword[n_plane]
-
 
814
	cmp dword[n_plane],0
-
 
815
	jge .end_f
-
 
816
push eax ecx
-
 
817
	mov ecx,[scaled_zoom]
-
 
818
	xor eax,eax
-
 
819
	inc eax
-
 
820
	shl eax,cl
-
 
821
	dec eax
-
 
822
	mov dword[n_plane],eax
-
 
823
 
-
 
824
	mov eax,[v_zoom]
-
 
825
	cmp eax,[scaled_zoom]
-
 
826
	jle .end_0
-
 
827
		;¯à®¨á室¨â ¬ áèâ ¡¨à®¢ ­¨¥
-
 
828
		dec dword[cam_y] ;¯¥à¥å®¤¨¬ ¢ á®á¥¤­¨© ªã¡
-
 
829
		cmp dword[cam_y],0
-
 
830
		jge .end_0
-
 
831
 
-
 
832
		mov ecx,eax
-
 
833
		sub ecx,[scaled_zoom]
-
 
834
		xor eax,eax
-
 
835
		inc eax
-
 
836
		shl eax,cl
-
 
837
		dec eax
-
 
838
		mov dword[cam_y],eax ;¥á«¨ ­®¬¥à ªã¡  ®ª § «áï ¬¥­ìè¥ 0 ¨á¯à ¢«ï¥¬ ­  ¬ ªá¨¬ «ì­®¥ §­ ç¥­¨¥
-
 
839
	.end_0:
744
	jle @f
840
pop ecx eax
745
		dec dword[n_plane]
841
	.end_f:
746
		call draw_objects
-
 
747
		call draw_pok
842
	call draw_objects
Line 748... Line 843...
748
	@@:
843
	call draw_pok
749
	ret
844
	ret
750
 
845
 
Line 920... Line 1015...
920
 
1015
 
921
	mov eax,[v_zoom]
1016
	mov eax,[v_zoom]
922
	cmp eax,[scaled_zoom]
1017
	cmp eax,[scaled_zoom]
923
	jg @f
1018
	jg @f
924
		;®¡ëç­ë© ०¨¬ ¨§®¡à ¦¥­¨ï
1019
		;®¡ëç­ë© ०¨¬ ¨§®¡à ¦¥­¨ï
-
 
1020
		stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox,\
925
		stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox, [open_file_vox], ebx,ecx, 0, eax
1021
			[open_file_vox], ebx,ecx, 0, eax
-
 
1022
		stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox],\
926
		stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox], OT_MAP_X,OT_MAP_Y,TILE_SIZE, [v_zoom], [n_plane], 0xd0d0d0
1023
			OT_MAP_X,OT_MAP_Y,TILE_SIZE, [v_zoom], [n_plane], [sc.work_graph]
927
		bt dword[mode_light],0
1024
		bt dword[mode_light],0
928
		jnc .end_1
1025
		jnc .end_1
929
			stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3
1026
			stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3
930
		.end_1:
1027
		.end_1:
Line 1177... Line 1274...
1177
	buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete
1274
	buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete
1178
	buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g
1275
	buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g
1179
	buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g
1276
	buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g
1180
	buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g
1277
	buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g
1181
	buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled
1278
	buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled
-
 
1279
	buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows
1182
	buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl
1280
	buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl
1183
	buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled
1281
	buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled
1184
	buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows
-
 
-
 
1282
 
1185
	dd 0,0
1283
	dd 0,0
1186
	sz_init db 'lib_init',0
1284
	sz_init db 'lib_init',0
1187
	sz_buf2d_create db 'buf2d_create',0
1285
	sz_buf2d_create db 'buf2d_create',0
1188
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
1286
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
1189
	sz_buf2d_clear db 'buf2d_clear',0
1287
	sz_buf2d_clear db 'buf2d_clear',0
Line 1212... Line 1310...
1212
	sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0
1310
	sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0
1213
	sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0
1311
	sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0
1214
	sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0
1312
	sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0
1215
	sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0
1313
	sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0
1216
	sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0
1314
	sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0
-
 
1315
	sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0
1217
	sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0
1316
	sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0
1218
	sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0
1317
	sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0
1219
	sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0
-
 
Line 1220... Line 1318...
1220
 
1318
 
1221
mouse_dd dd 0x0
1319
mouse_dd dd 0x0
Line 1222... Line 1320...
1222
sc system_colors 
1320
sc system_colors