;
; §¤¥áì á®¡à ­ë ¤ ­­ë¥ ¯® ¡«®ª ¬ *.3ds
;

MAX_FILE_LEVEL equ 20 ;¬ ªá¨¬ «ì­ë© ã஢¥­ì ¢«®¦¥­­®á⨠¡«®ª®¢ ¤«ï  ­ «¨§ 

sizeof.block_3ds equ 9
can_save db 0 ;¨§¬¥­ï«áï «¨ ä ©«

macro block_3ds id,icon,par,caption
{
	dw id ;+0 ¨¤¥­â¨ä¨ª â®à ¡«®ª  ¢ ä ©«¥ 3ds
	dw icon ;+2 ­®¬¥à ¨ª®­ª¨ ¤«ï ¡«®ª 
	db par ;+4 ᮤ¥à¦¨â «¨ ¡«®ª ¯®¤¡«®ª¨ (0-¤  1-­¥â)
	dd caption+0 ;+5 ®¯¨á ­¨¥ ¡«®ª 
}

CHUNK_MAIN equ 0x4D4D ; [-] á業 
CHUNK_ambient_color	  equ 0x2100 ; [-] ambient color
  CHUNK_OBJMESH 	  equ 0x3D3D ; [-] ­ ¡®à ®¡ê¥ªâ®¢
    CHUNK_OBJBLOCK	  equ 0x4000 ; [+] ®¡ê¥ªâ
      CHUNK_TRIMESH	  equ 0x4100 ; [-] trimesh-®¡ê¥ªâ
	CHUNK_VERTLIST	  equ 0x4110 ; [+] ᯨ᮪ ¢¥à設
	CHUNK_FACELIST	  equ 0x4120 ; [+] ᯨ᮪ £à ­¥©
	CHUNK_FACEMAT	  equ 0x4130 ; [+] ¬ â¥à¨ «ë £à ­¥©
	CHUNK_MAPLIST	  equ 0x4140 ; [+] ⥪áâãà­ë¥ ª®®à¤¨­ âë
	CHUNK_TRMATRIX	  equ 0x4160 ; [+] ¬ âà¨æ  ¯¥à¥¢®¤ 
      CHUNK_CAMERA	  equ 0x4700 ; [+] ®¡ê¥ªâ-ª ¬¥à 
  CHUNK_MATERIAL	  equ 0xAFFF ; [-] ¬ â¥à¨ «
    CHUNK_MATNAME	  equ 0xA000 ; [+] ­ §¢ ­¨¥ ¬ â¥à¨ « 
    CHUNK_TEXTURE	  equ 0xA200 ; [-] ⥪áâãà  ¬ â¥à¨ « 
      CHUNK_MAPFILE	  equ 0xA300 ; [+] ¨¬ï ä ©«  ⥪áâãàë
  CHUNK_KEYFRAMER	  equ 0xB000 ; [-] ¨­ä®à¬ æ¨ï ®¡  ­¨¬ æ¨¨
  CHUNK_TRACKINFO	  equ 0xB002 ; [-] ¯®¢¥¤¥­¨¥ ®¡ê¥ªâ 
    CHUNK_TRACKOBJNAME	  equ 0xB010 ; [+] ­ §¢ ­¨¥ í⮣® ®¡ê¥ªâ 
    CHUNK_TRACKPIVOT	  equ 0xB013 ; [+] 業âà ¢à é¥­¨ï ®¡ê¥ªâ 
    CHUNK_TRACKPOS	  equ 0xB020 ; [+] âà ¥ªâ®à¨ï ®¡ê¥ªâ 
    CHUNK_TRACKROTATE	  equ 0xB021 ; [+] âà ¥ªâ®à¨ï ¢à é¥­¨ï ®¡ê¥ªâ 
  CHUNK_TRACKCAMERA	  equ 0xB003 ; [-] ¯®¢¥¤¥­¨¥ ª ¬¥àë
    CHUNK_TRACKFOV	  equ 0xB023 ; [+] ¯®¢¥¤¥­¨¥ fov ª ¬¥àë
    CHUNK_TRACKROLL	  equ 0xB024 ; [+] ¯®¢¥¤¥­¨¥ roll ª ¬¥àë
  CHUNK_TRACKCAMTGT	  equ 0xB004 ; [-] ¯®¢¥¤¥­¨¥ "楫¨" ª ¬¥àë

;¤ ­­ë¥ ᮤ¥à¦ â «¨èì ¡«®ª¨, ®â¬¥ç¥­­ë¥ ¯«îᮬ, ®áâ «ì­ë¥ ¡«®ª¨
; á®áâ®ïâ «¨èì ¨§ ¯®¤¡«®ª®¢

align 4
type_bloks:
block_3ds 0x0002,5,1,txt_0002
block_3ds 0x3d3e,5,1 ; [+] mesh version
block_3ds 0x0011,4,1,txt_0011
block_3ds 0x0100,3,1,txt_0100
block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color
block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d
block_3ds CHUNK_OBJBLOCK,11,1,txt_4000
block_3ds CHUNK_TRIMESH, 3,0,txt_4100
block_3ds CHUNK_VERTLIST,8,1,txt_4110
block_3ds CHUNK_FACELIST,3,1,txt_4120
block_3ds CHUNK_FACEMAT,10,1,txt_4130
block_3ds CHUNK_MAPLIST, 3,1,txt_4140
block_3ds CHUNK_TRMATRIX,3,1,txt_4160
block_3ds 0x4600,3,1,txt_4600
block_3ds CHUNK_CAMERA,  3,1,txt_4700
block_3ds CHUNK_MATERIAL,10,0,txt_afff
block_3ds CHUNK_MATNAME, 3,1,txt_a000
block_3ds 0xa010,4,0,txt_a010
block_3ds 0xa020,4,0,txt_a020
block_3ds 0xa030,4,0,txt_a030
block_3ds 0xa100,5,1,txt_a100
block_3ds CHUNK_TEXTURE, 3,0,txt_a200
block_3ds CHUNK_MAPFILE, 6,1,txt_a300
block_3ds CHUNK_KEYFRAMER,   7,0,txt_b000
block_3ds CHUNK_TRACKINFO,   3,0,txt_b002
block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010
block_3ds 0xb011,3,1,txt_b011
block_3ds CHUNK_TRACKPIVOT,  3,1,txt_b013
block_3ds 0xb014,3,1,txt_b014
block_3ds CHUNK_TRACKPOS,    3,1,txt_b020
block_3ds CHUNK_TRACKROTATE, 3,1,txt_b021
block_3ds CHUNK_TRACKCAMERA, 7,0,txt_b003
block_3ds CHUNK_TRACKFOV,    7,1,txt_b023
block_3ds CHUNK_TRACKROLL,   7,1,txt_b024
block_3ds CHUNK_TRACKCAMTGT, 7,0,txt_b004

;--- ¤ «¥¥ ­¥ ¢® ¢á¥å ¡«®ª å ᬮ£ ­ ©â¨ ®¯¨á ­¨¥ ­  àãá᪮¬ ï§ëª¥
block_3ds 0x4111, 3,1,txt_4111
block_3ds 0x4150, 3,1,txt_4150
block_3ds 0x4165, 3,1,txt_4165
block_3ds 0x4610, 3,1,txt_4610
block_3ds 0x4627, 3,1,txt_4627
block_3ds 0x4630, 3,1,txt_4630
block_3ds 0x4641, 3,1,txt_4641
block_3ds 0x4650, 3,1,txt_4650
block_3ds 0x4651, 3,1,txt_4651
block_3ds 0x4652, 3,1,txt_4652
block_3ds 0x4653, 3,1,txt_4653
block_3ds 0x4656, 3,1,txt_4656
block_3ds 0x4658, 3,1,txt_4658
block_3ds 0x4620, 3,1,txt_4620
block_3ds 0x4625, 3,1,txt_4625
block_3ds 0x4659, 3,1,txt_4659
block_3ds 0x465a, 3,1,txt_465a
block_3ds 0x465b, 3,1,txt_465b
block_3ds 0xa230, 3,1,txt_a230
block_3ds 0xa220, 3,1,txt_a220
block_3ds 0xa351, 3,1,txt_a351
block_3ds 0xb007, 3,1,txt_b007
block_3ds 0xb008, 3,1,txt_b008
block_3ds 0xb022, 3,1,txt_b022
block_3ds 0xb030, 3,1,txt_b030
block_3ds 0xa040, 3,1,txt_a040
block_3ds 0xa041, 3,1,txt_a041
block_3ds 0xa050, 3,1,txt_a050
block_3ds 0xa052, 3,1,txt_a052
block_3ds 0xa053, 3,1,txt_a053
block_3ds 0xa081, 3,1,txt_a081
block_3ds 0xa083, 3,1,txt_a083
block_3ds 0xa084, 3,1,txt_a084
block_3ds 0xa085, 3,1,txt_a085
block_3ds 0xa087, 3,1,txt_a087
block_3ds 0xa088, 3,1,txt_a088
block_3ds 0xa08a, 3,1,txt_a08a
block_3ds 0xa08c, 3,1,txt_a08c
block_3ds 0xa08e, 3,1,txt_a08e
.end:

if lang eq ru
txt_0002 db '3ds ¢¥àá¨ï',0
txt_0011 db '–¢¥â rgb (¡ ©â®¢ë© ä®à¬ â)',0
;txt_0012 db 'LIN_COLOR_24',0
;txt_0030 db 'Percentage value (int)',0
;txt_0031 db 'Percentage value (float)',0
txt_0100 db 'Master scale',0
txt_2100 db '–¢¥â ®ªà㦠î饩 á।ë',0
txt_3d3d db ' ¡®à ®¡ê¥ªâ®¢',0
txt_4000 db 'Ž¡ê¥ªâ (á ¨¬¥­¥¬)',0
txt_4100 db '’à¥ã£®«ì­ë¥ á¥âª¨',0
txt_4110 db '‘¯¨á®ª ¢¥à設',0
txt_4120 db '‘¯¨á®ª £à ­¥©',0
txt_4130 db 'Œ â¥à¨ «ë £à ­¥©',0
txt_4140 db '’¥ªáâãà­ë¥ ª®®à¤¨­ âë',0
txt_4160 db 'Œ âà¨æ  ¯¥à¥¢®¤ ',0
txt_4600 db '‘¢¥â',0
txt_4700 db 'Š ¬¥à ',0
txt_a000 db ' §¢ ­¨¥ ¬ â¥à¨ « ',0
txt_a010 db 'Žªà㦠î騩 梥â',0
txt_a020 db '„¨ääã§­ë© æ¢¥â',0
txt_a030 db '‡¥àª «ì­ë© 梥â',0
txt_a100 db '’¨¯ ¬ â¥à¨ «  [1=flat 2=gouraud 3=phong 4=metal]',0
txt_a200 db '’¥ªáâãà  ¬ â¥à¨ «  1',0
txt_a300 db 'ˆ¬ï ä ©«  ⥪áâãàë',0
;txt_a353 db 'MAT_MAP_TEXBLUR',0
txt_afff db 'Œ â¥à¨ «',0
txt_b000 db 'ˆ­ä®à¬ æ¨ï ®¡  ­¨¬ æ¨¨',0
txt_b002 db '®¢¥¤¥­¨¥ ®¡ê¥ªâ ',0
;txt_b009 db 'KFCURTIME',0
;txt_b00a db 'KFHDR',0
txt_b010 db ' §¢ ­¨¥ ®¡ê¥ªâ ',0
txt_b011 db 'ˆ¬ï íª§¥¬¯«ïà ',0
txt_b013 db '–¥­âà ¢à é¥­¨ï ®¡ê¥ªâ ',0
txt_b014 db 'Bound box',0
txt_b020 db '’à ¥ªâ®à¨ï ¤¢¨¦¥­¨ï',0
txt_b021 db '’à ¥ªâ®à¨ï ¢à é¥­¨ï',0
txt_b003 db '®¢¥¤¥­¨¥ ª ¬¥àë',0
txt_b023 db '®¢¥¤¥­¨¥ fov ª ¬¥àë',0
txt_b024 db '®¢¥¤¥­¨¥ roll ª ¬¥àë',0
txt_b004 db '®¢¥¤¥­¨¥ "楫¨" ª ¬¥àë',0

;--- ¤ «¥¥ ­¥ ¢® ¢á¥å ¡«®ª å ᬮ£ ­ ©â¨ ®¯¨á ­¨¥ ­  àãá᪮¬ ï§ëª¥
txt_4111 db '”« £¨ ¢¥à設',0
txt_4150 db 'Smoothing group list',0
txt_4165 db 'Object color in editor',0
txt_4610 db ' ¯à ¢«¥­­ë© ᢥâ',0
txt_4627 db 'Spot raytrace',0
txt_4630 db 'Light shadowed',0
txt_4641 db 'Spot shadow map',0
txt_4650 db 'Spot show cone',0
txt_4651 db 'Spot is rectangular',0
txt_4652 db 'Spot overshoot',0
txt_4653 db 'Spot map',0
txt_4656 db 'Spot roll',0
txt_4658 db 'Spot ray trace bias',0
txt_4620 db 'Light off',0
txt_4625 db 'Attenuation on',0
txt_4659 db 'Range start',0
txt_465a db 'Range end',0
txt_465b db 'Multiplier',0
txt_a230 db ' §¬¥âª  ५ì¥ä ',0
txt_a220 db ' §¬¥âª  ®âà ¦¥­¨ï',0
txt_a351 db ' à ¬¥âàë à §¬¥âª¨',0
txt_b007 db 'ˆ­ä®à¬ æ¨ï ® ­ ¯à ¢«¥­®¬ ®á¢¥é¥­¨¨',0
txt_b008 db 'Š ¤àë (­ ç «ì­ë© ¨ ª®­¥ç­ë©)',0
txt_b022 db 'Œ áèâ ¡¨à®¢ ­¨¥',0
txt_b030 db '®§¨æ¨ï ¢ ¨¥à à娨',0
txt_a040 db 'Shininess percent',0
txt_a041 db 'Shininess strength percent',0
txt_a050 db 'Transparency percent',0
txt_a052 db 'Transparency falloff percent',0
txt_a053 db 'Reflection blur percent',0
txt_a081 db '2 sided',0
txt_a083 db 'Add trans',0
txt_a084 db 'Self illum',0
txt_a085 db 'Wire frame on',0
txt_a087 db 'Wire thickness',0
txt_a088 db 'Face map',0
txt_a08a db 'In tranc',0
txt_a08c db 'Soften',0
txt_a08e db 'Wire in units',0

txt_not_delete db '¥ ¬®£ã 㤠«¨âì ¢ë¡à ­­ë© ¡«®ª. Ž­ § é¨é¥­.',0
else

txt_0002 db '3ds version',0
txt_0011 db 'Color rgb (byte format)',0
txt_0100 db 'Master scale',0
txt_2100 db 'Ambient color',0
txt_3d3d db 'Editor chunk',0
txt_4000 db 'Object (with name)',0
txt_4100 db 'Triangular mesh',0
txt_4110 db 'Vertices list',0
txt_4120 db 'Faces description',0
txt_4130 db 'Faces material',0
txt_4140 db 'Mapping coordinates list',0
txt_4160 db 'Local coordinate system',0
txt_4600 db 'Light',0
txt_4700 db 'Camera',0
txt_a000 db 'Material name',0
txt_a010 db 'Ambient color',0
txt_a020 db 'Diffuse color',0
txt_a030 db 'Specular color',0
txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',0
txt_a200 db 'Texture map 1',0
txt_a300 db 'Mapping filename',0
txt_afff db 'Meterial',0
txt_b000 db 'Keyframer',0
txt_b002 db 'Mesh information',0
txt_b010 db 'Object name',0
txt_b011 db 'Instance name',0
txt_b013 db 'Object pivot point',0
txt_b014 db 'Bound box',0
txt_b020 db 'Position track',0
txt_b021 db 'Rotation track',0
txt_b003 db 'Camera information',0
txt_b023 db 'Fov track',0
txt_b024 db 'Roll track',0
txt_b004 db 'Camera target information',0

;---
txt_4111 db 'Vertex flags',0
txt_4150 db 'Smoothing group list',0
txt_4165 db 'Object color in editor',0
txt_4610 db 'Spotlight',0
txt_4627 db 'Spot raytrace',0
txt_4630 db 'Light shadowed',0
txt_4641 db 'Spot shadow map',0
txt_4650 db 'Spot show cone',0
txt_4651 db 'Spot is rectangular',0
txt_4652 db 'Spot overshoot',0
txt_4653 db 'Spot map',0
txt_4656 db 'Spot roll',0
txt_4658 db 'Spot ray trace bias',0
txt_4620 db 'Light off',0
txt_4625 db 'Attenuation on',0
txt_4659 db 'Range start',0
txt_465a db 'Range end',0
txt_465b db 'Multiplier',0
txt_a230 db 'Bump map',0
txt_a220 db 'Reflection map',0
txt_a351 db 'Mapping parameters',0
txt_b007 db 'Spot light information',0
txt_b008 db 'Frames (Start and End)',0
txt_b022 db 'Scale track',0
txt_b030 db 'Hierarchy position',0
txt_a040 db 'Shininess percent',0
txt_a041 db 'Shininess strength percent',0
txt_a050 db 'Transparency percent',0
txt_a052 db 'Transparency falloff percent',0
txt_a053 db 'Reflection blur percent',0
txt_a081 db '2 sided',0
txt_a083 db 'Add trans',0
txt_a084 db 'Self illum',0
txt_a085 db 'Wire frame on',0
txt_a087 db 'Wire thickness',0
txt_a088 db 'Face map',0
txt_a08a db 'In tranc',0
txt_a08c db 'Soften',0
txt_a08e db 'Wire in units',0

txt_not_delete db 'I can not delete the selected chunk. It is protected.',0
end if

if lang eq ru
txt_open_3ds db 'Žâªàëâ ä ©«:',0
txt_no_3ds: db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds ',39
	.zag: rb 8
	db 39,0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_count db 'Š®«¨ç¥á⢮',0
txt_3ds_offs:
	db '‘¬¥é¥­¨¥: '
	.dig: rb 8
	db '   §¬¥à: '
	.siz: rb 8
	db 0
txt_mat_null db 'Œ â¥à¨ «ë ­¥ ­ ©¤¥­ë',0
else
txt_open_3ds db 'Open file:',0
txt_no_3ds: db 'Open file not in format *.3ds ',39
	.zag: rb 8
	db 39,0
txt_3ds_err_sizes db 'File may be corrupted',0
txt_count db 'Count',0
txt_3ds_offs:
	db 'Offset: '
	.dig: rb 8
	db '  Size: '
	.siz: rb 8
	db 0
txt_mat_null db 'No materials found',0
end if