home *** CD-ROM | disk | FTP | other *** search
/ Phenomenon / Phenomenon.iso / quake / utils / map / k3ds2map / k3ds2map.k3d < prev    next >
Encoding:
Text File  |  1996-09-04  |  28.2 KB  |  552 lines

  1. ;brought to you by Voltron, Defender of the Universe
  2. ;(aka PapaSmurf,aka Vanilla Express or Vanilla Espresso,aka Khyron)
  3. ;(aka Jason Zelsnack)
  4. ; MAP SAVER
  5. outdir$ = "c:\3ds2map"
  6. Ext$(0) = "map"
  7. er = 0.5
  8. message$ = "I must break you"
  9. plattarget$ = "A"
  10. monstertarget$ = "A"
  11. spawnflag = 0
  12. player3ds$   = "player"  : playerq$   = "info_player_start"
  13. dmatch3ds$   = "dmatch"  : dmatchq$   = "info_player_deathmatch"
  14. coop3ds$     = "coop"    : coopq$     = "info_player_coop"
  15. torch3ds$    = "torch"   : torchq$    = "light_torch_small_walltorch"
  16. flameLY3ds$  = "flameLY" : flameLYq$  = "light_flame_large_yellow"
  17. flameSY3ds$  = "flameSY" : flameSYq$  = "light_flame_small_yellow"
  18. flameSW3ds$  = "flameSW" : flameSWq$  = "light_flame_small_white"
  19. boombox3ds$  = "boombox" : boomboxq$  = "misc_explobox"
  20. army3ds$     = "army"    : armyq$     = "monster_army"
  21. dog3ds$      = "dog"     : dogq$      = "monster_dog"
  22. ogre3ds$     = "ogre"    : ogreq$     = "monster_ogre"
  23. knight3ds$   = "knight"  : knightq$   = "monster_knight"
  24. zombie3ds$   = "zombie"  : zombieq$   = "monster_zombie"
  25. zombiec3ds$  = "zombiec" : zombiecq$  = "monster_zombie"
  26. wizard3ds$   = "wizard"  : wizardq$   = "monster_wizard"
  27. demon3ds$    = "demon"   : demonq$    = "monster_demon1"
  28. shambler3ds$ ="shambler" : shamblerq$ = "monster_shambler"
  29. tarbaby3ds$  = "tarbaby" : tarbabyq$  = "monster_tarbaby"
  30. cthon3ds$    = "cthon"   : cthonq$    = "monster_boss"
  31. armorG3ds$   = "armorG"  : armorGq$   = "item_armor1"
  32. armorY3ds$   = "armorY"  : armorYq$   = "item_armor2"
  33. armorR3ds$   = "armorR"  : armorRq$   = "item_armorInv"
  34. shotgun3ds$  = "shotgun" : shotgunq$  = "weapon_supershotgun"
  35. nailgun3ds$  = "nailgun" : nailgunq$  = "weapon_nailgun"
  36. snailgun3ds$ ="snailgun" : snailgunq$ = "weapon_supernailgun"
  37. grenade3ds$  = "grenade" : grenadeq$  = "weapon_grenadelauncher"
  38. rocket3ds$   = "rocket"  : rocketq$   = "weapon_rocketlauncher"
  39. thunder3ds$  = "thunder" : thunderq$  = "weapon_lightning"
  40. shells3ds$   = "shells"  : shellsq$   = "item_shells"
  41. bshells3ds$  = "bshells" : bshellsq$  = "item_shells"
  42. nails3ds$    = "nails"   : nailsq$    = "item_spikes"
  43. bnails3ds$   = "bnails"  : bnailsq$   = "item_spikes"
  44. rockets3ds$  = "rockets" : rocketsq$  = "item_rockets"
  45. brockets3ds$ = "brockets": brocketsq$ = "item_rockets"
  46. cells3ds$    = "cells"   : cellsq$    = "item_cells"
  47. bcells3ds$   = "bcells"  : bcellsq$   = "item_cells"
  48. health3ds$   = "health"  : healthq$   = "item_health"
  49. bhealth3ds$  = "bhealth" : bhealthq$  = "item_health"
  50. suit3ds$     = "suit"    : suitq$     = "item_artifact_envirosuit"
  51. quake3ds$    = "quake"   : quakeq$    = "item_artifact_super_damage"
  52. star3ds$     = "star"    : starq$     = "item_artifact_invulnerability"
  53. invisible3ds$="invisible": invisibleq$= "item_artifact_invisibility"
  54. silverkey3ds$="silverkey": silverkeyq$= "item_key1" 
  55. goldkey3ds$  = "goldkey" : goldkeyq$  = "item_key2" 
  56. sigil3ds$    = "sigil"   : sigilq$    = "item_sigil"
  57. lift3ds$     = "lift"    : liftq$     = "func_plat"
  58. door3ds$     = "door"    : doorq$     = "func_door"
  59. sdoor3ds$    = "sdoor"   : sdoorq$    = "func_door_secret"
  60. button3ds$   = "butt"    : buttonq$   = "func_button"
  61. plat3ds$     = "plat"    : platq$     = "func_train"
  62. tport3ds$    = "tp"      : tportS$    = "trigger_teleport" : tportD$ = "info_teleport_destination"
  63. dmtport3ds$  = "dmtp"    : dmtportS$  = "func_dm_only" : dmtportD$ = "info_teleport_destination"
  64. spike3ds$    = "spike"   : spikeq$    = "trap_shooter"
  65. fireball3ds$ = "fireball": fireballq$ = "misc_fireball"
  66. wall3ds$     = "wall"
  67. changelevel3ds$ = "!CL"
  68. medieval3ds$ = "medieval"
  69.  
  70. Define Point(x,y,z)
  71. DefVertex Vert
  72. DefFace Face
  73. DefPoint cross,plane(20)
  74. DefRotate rot
  75. DefPosition pos,pos2
  76. DefBoundBox bbox
  77. DefXForm xform
  78. DefColor color
  79. Dim text$(100,16)
  80.  
  81. text$(0)="*04water2":text$(1)="*lava1":text$(2)="*teleport":text$(3)="+0button":text$(4)="+0floorsw"
  82. text$(5)="+1button":text$(6)="+1floorsw":text$(7)="+2button":text$(8)="+2floorsw":text$(9)="+3button"
  83. text$(10)="+3floorsw":text$(11)="+abutton":text$(12)="+afloorsw":text$(13)="adoor01_2":text$(14)="adoor02_2"
  84. text$(15)="adoor03_3":text$(16)="adoor03_6":text$(17)="afloor3_1":text$(18)="bodiesa2_1":text$(19)="bodiesa2_4"
  85. text$(20)="bodiesa3_1":text$(21)="bodiesa3_2":text$(22)="bodiesa3_3":text$(23)="bricka2_4":text$(24)="bricka2_6"
  86. text$(25)="carch03":text$(26)="carch04_2":text$(27)="city2_1":text$(28)="city2_7":text$(29)="city2_8"
  87. text$(30)="city4_7":text$(31)="city5_1":text$(32)="city5_3":text$(33)="city5_":text$(34)="city5_6"
  88. text$(35)="city5_7":text$(36)="city5_8":text$(37)="city6_4":text$(38)="citya1_1":text$(39)="clip"
  89. text$(40)="column1_2":text$(41)="column1_5":text$(42)="COP1_1":text$(43)="COP1_5":text$(44)="COP1_6"
  90. text$(45)="cop1_7":text$(46)="cop2_4":text$(47)="cop2_5":text$(48)="cop3_1":text$(49)="cop3_4"
  91. text$(50)="door05_3":text$(51)="dung01_1":text$(52)="dung01_2":text$(53)="dung01_3":text$(54)="dung01_4"
  92. text$(55)="dung01_5":text$(56)="dung02_1":text$(57)="dung02_5":text$(58)="enter01":text$(59)="exit02_2"
  93. text$(60)="ground1_6":text$(61)="key02_1":text$(62)="key02_2":text$(63)="metal1_3":text$(64)="metal1_7"
  94. text$(65)="metal1_8":text$(66)="metal2_2":text$(67)="metal2_4":text$(68)="metal4_4":text$(69)="metal5_6"
  95. text$(70)="metal6_3":text$(71)="metal6_4":text$(72)="mmetal1_1":text$(73)="plat_top1":text$(74)="rock4_2"
  96. text$(75)="sky4":text$(76)="trigger":text$(77)="window02_1":text$(78)="window1_3":text$(79)="woodflr1_2"
  97. text$(80)="z_exit"
  98.  
  99. @Main
  100.    Gosub OpenOutputFile
  101.    GetNodeCount
  102.    if RC < 1 Then End
  103.    print #1,"{"
  104.    print #1,chr$(34);"classname";chr$(34);" ";chr$(34);"worldspawn";chr$(34)
  105.    print #1,chr$(34);"wad";chr$(34);" ";chr$(34);"gfx\medieval.wad";chr$(34)
  106.    print #1,chr$(34);"message";chr$(34);" ";chr$(34);message$;chr$(34)      
  107.    print #1,
  108.    for i = 0 to NodeCount - 1
  109.       Gfx_ShowGas ""
  110.       Gfx_SetGas "Percentage Done Saving World Brushes",i,NodeCount - 1
  111.       GetNodeName i
  112.       Gosub FixName      
  113.       Gosub FixName2
  114.       Gosub CheckName
  115.    btemp = 0 : if (newname$ = "tp" or newname$ = "dmtp") and (subtype$ = "s" or subtype$ = "S") then btemp = 1
  116.    if newname$ = changelevel3ds$ then btemp = 1
  117.    if NodeType = 1 & namecheck = 0 or btemp = 1 then Gosub PrintBrush
  118.    Next i
  119.    print #1,"}"
  120.    print #1,
  121.    for i = 0 to NodeCount - 1
  122.       Gfx_ShowGas ""
  123.       Gfx_SetGas "Percentage Done Saving Entites",i,NodeCount - 1
  124.       GetNodeName i
  125.       Gosub FixName
  126.       if newname$ = player3ds$ then temp$ = playerq$ : Gosub PrintEntity
  127.       if newname$ = dmatch3ds$ then temp$ = dmatchq$ : Gosub PrintEntity
  128.       if newname$ = coop3ds$ then temp$ = coopq$ : Gosub PrintEntity
  129.       if newname$ = torch3ds$ then temp$ = torchq$ : Gosub PrintEntity
  130.       if newname$ = flameLY3ds$ then temp$ = flameLYq$ : Gosub PrintEntity
  131.       if newname$ = flameSY3ds$ then temp$ = flameSYq$ : Gosub PrintEntity      
  132.       if newname$ = flameSW3ds$ then temp$ = flameSWq$ : Gosub PrintEntity            
  133.       if newname$ = boombox3ds$ then temp$ = boomboxq$ : Gosub PrintEntity                  
  134.       if newname$ = army3ds$ then temp$ = armyq$ : Gosub PrintEntity
  135.       if newname$ = dog3ds$ then temp$ = dogq$ : Gosub PrintEntity
  136.       if newname$ = ogre3ds$ then temp$ = ogreq$ : Gosub PrintEntity
  137.       if newname$ = knight3ds$ then temp$ = knightq$ : Gosub PrintEntity
  138.       if newname$ = zombie3ds$ then temp$ = zombieq$ : Gosub PrintEntity
  139.       if newname$ = zombiec3ds$ then temp$ = zombiecq$ : spawnflag = 1 : Gosub PrintEntity
  140.       if newname$ = wizard3ds$ then temp$ = wizardq$ : Gosub PrintEntity
  141.       if newname$ = demon3ds$ then temp$ = demonq$ : Gosub PrintEntity
  142.       if newname$ = shambler3ds$ then temp$ = shamblerq$ : Gosub PrintEntity
  143.       if newname$ = tarbaby3ds$ then temp$ = tarbabyq$ : Gosub PrintEntity
  144.       if newname$ = cthon3ds$ then temp$ = cthonq$ : Gosub PrintEntity
  145.       if newname$ = armorG3ds$ then temp$ = armorGq$ : Gosub PrintEntity
  146.       if newname$ = armorY3ds$ then temp$ = armorYq$ : Gosub PrintEntity
  147.       if newname$ = armorR3ds$ then temp$ = armorRq$ : Gosub PrintEntity
  148.       if newname$ = shotgun3ds$ then temp$ = shotgunq$ : Gosub PrintEntity
  149.       if newname$ = nailgun3ds$ then temp$ = nailgunq$ : Gosub PrintEntity
  150.       if newname$ = snailgun3ds$ then temp$ = snailgunq$ : Gosub PrintEntity
  151.       if newname$ = grenade3ds$ then temp$ = grenadeq$ : Gosub PrintEntity
  152.       if newname$ = rocket3ds$ then temp$ = rocketq$ : Gosub PrintEntity
  153.       if newname$ = thunder3ds$ then temp$ = thunderq$ : Gosub PrintEntity
  154.       if newname$ = shells3ds$ then temp$ = shellsq$ : Gosub PrintEntity
  155.       if newname$ = bshells3ds$ then temp$ = bshellsq$ : spawnflag = 1 : Gosub PrintEntity      
  156.       if newname$ = nails3ds$ then temp$ = nailsq$ : Gosub PrintEntity
  157.       if newname$ = bnails3ds$ then temp$ = bnailsq$ : spawnflag = 1 : Gosub PrintEntity      
  158.       if newname$ = rockets3ds$ then temp$ = rocketsq$ : Gosub PrintEntity
  159.       if newname$ = brockets3ds$ then temp$ = brocketsq$ : spawnflag = 1 : Gosub PrintEntity      
  160.       if newname$ = cells3ds$ then temp$ = cellsq$ : Gosub PrintEntity
  161.       if newname$ = bcells3ds$ then temp$ = bcellsq$ : spawnflag = 1 : Gosub PrintEntity      
  162.       if newname$ = health3ds$ then temp$ = healthq$ : Gosub PrintEntity      
  163.       if newname$ = bhealth3ds$ then temp$ = bhealthq$ : spawnflag = 2 : Gosub PrintEntity            
  164.       if newname$ = suit3ds$ then temp$ = suitq$ : Gosub PrintEntity
  165.       if newname$ = quake3ds$ then temp$ = quakeq$ : Gosub PrintEntity
  166.       if newname$ = star3ds$ then temp$ = starq$ : Gosub PrintEntity
  167.       if newname$ = invisible3ds$ then temp$ = invisibleq$ : Gosub PrintEntity
  168.       if newname$ = silverkey3ds$ then temp$ = silverkeyq$ : Gosub PrintEntity
  169.       if newname$ = goldkey3ds$ then temp$ = goldkeyq$ : Gosub PrintEntity      
  170.       if newname$ = sigil3ds$ then temp$ = sigilq$ : Gosub PrintEntity            
  171.       if newname$ = lift3ds$ then Gosub FixName2 : temp$ = liftq$ : Gosub PrintLift
  172.       if newname$ = door3ds$ then Gosub FixName2 : temp$ = doorq$ : Gosub PrintDoor
  173.       if newname$ = sdoor3ds$ then Gosub FixName2 : temp$ = sdoorq$ : Gosub PrintDoor
  174.       if newname$ = button3ds$ then Gosub FixName2 : temp$ = buttonq$ : Gosub PrintButton
  175.       if newname$ = plat3ds$ then Gosub FixName2 : temp$ = platq$ : Gosub PrintPlat
  176.       if newname$ = tport3ds$ then Gosub FixName2 : tp = 0 : temp$ = subname$ : Gosub PrintTport
  177.       if newname$ = dmtport3ds$ then Gosub FixName2 : tp = 1 : temp$ = subname$ : Gosub PrintTport
  178.       if newname$ = spike3ds$ then temp$ = spikeq$ : spawnflag = 1024 : Gosub PrintSpikeShooter      
  179.       if newname$ = fireball3ds$ then temp$ = fireballq$ : Gosub PrintFireBall
  180.       if newname$ = wall3ds$ then Gosub PrintWall
  181.       if newname$ = changelevel3ds$ then Gosub FixName2 : Gosub PrintChangeLevel
  182.       if NodeType = 4 then Gosub FixName2 : Gosub PrintLight
  183.       if NodeType = 2 then Gosub PrintCamera
  184.    Next i
  185.    close #1
  186. End
  187.  
  188. @CheckName
  189.    namecheck = 0
  190.    if newname$ = player3ds$ or newname$ = dmatch3ds$ or newname$ = coop3ds$ then namecheck = -1
  191.    if newname$ = torch3ds$ or newname$ = flameLY3ds$ or newname$ = flameSY3ds$ or newname$ = flameSW3ds$ or newname$ = boombox3ds$ then namecheck = -1
  192.    if newname$ = army3ds$ or newname$ = dog3ds$ or newname$ = ogre3ds$ or newname$ = knight3ds$ then namecheck = -1
  193.    if newname$ = zombie3ds$ or newname$ = zombiec3ds$ or newname$ = wizard3ds$ or newname$ = demon3ds$ or newname$ = shambler3ds$ or newname$ = tarbaby3ds$ or newname$ = cthon3ds$ then namecheck = -1
  194.    if newname$ = armorG3ds$ or newname$ = armorY3ds$ or newname$ = armorR3ds$ then namecheck = -1
  195.    if newname$ = shotgun3ds$ or newname$ = nailgun3ds$ or newname$ = snailgun3ds$ or newname$ = grenade3ds$ or newname$ = rocket3ds$ or newname$ = thunder3ds$ then namecheck = -1
  196.    if newname$ = shells3ds$ or newname$ = nails3ds$ or newname$ = rockets3ds$ or newname$ = cells3ds$ or newname$ = health3ds$ then namecheck = -1
  197.    if newname$ = bshells3ds$ or newname$ = bnails3ds$ or newname$ = brockets3ds$ or newname$ = bcells3ds$ or newname$ = bhealth3ds$ then namecheck = -1   
  198.    if newname$ = star3ds$ or newname$ = quake3ds$ or newname$ = suit3ds$ or newname$ = invisible3ds$ then namecheck = -1
  199.    if newname$ = silverkey3ds$ or newname$ = goldkey3ds$ or newname$ = sigil3ds$ then namecheck = -1
  200.    if newname$ = lift3ds$ or newname$ = door3ds$ or newname$ = sdoor3ds$ or newname$ = button3ds$ or newname$ = plat3ds$ or newname$ = spike3ds$ or newname$ = fireball3ds$ then namecheck = -1
  201.    if newname$ = tport3ds$ or newname$ = dmtport3ds$ then namecheck = -1
  202.    if newname$ = wall3ds$ or newname$ = changelevel3ds$ or newname$ = medieval3ds$ then namecheck = -1
  203. Return
  204.  
  205. @FixName
  206.    newname$ = ""
  207.    length = len(NodeName$)
  208.    for z = 0 to length - 1     
  209.       char$ = (mid$(NodeName$,z,1))
  210.       if char$ <= "9" & char$ >= "0" or char$ = "-" then return 
  211.       newname$ = newname$ + char$ 
  212.    Next z 
  213. Return
  214.  
  215. @FixName2
  216.    subname$ = ""  :  subtype$ = ""
  217.    btemp = 0
  218.    fix2check = 0
  219.    z2 = z
  220.    for z2 = z to length - 1     
  221.       char$ = (mid$(NodeName$,z2,1))
  222.       if char$ = "-" then fix2check = fix2check + 1 : z2 = z2 + 1
  223.       char$ = (mid$(NodeName$,z2,1))      
  224.       if fix2check = 1 then subname$ = subname$ + char$      
  225.       if fix2check = 2 then subtype$ = char$ : return
  226.    Next z2 
  227. Return
  228.  
  229. @OpenOutputFile
  230.    Selectfile "Select animation file to output to", outdir$, guyname$ :'Selecting and opening ASC file to output to
  231.    If RC < 1 Then End
  232.    Open FileName$, OUTPUT, #1
  233. Return
  234.  
  235. @PrintBrush
  236.    GetFVCount NodeName$
  237.    GetVerts NodeName$,0,Verts,frame,1,Vert
  238.    GetFaces NodeName$,0,Faces,Face
  239.    print #1,"{"
  240.    print #1,"//";NodeName$
  241.    numplanes = 0
  242.    for j = 0 to Faces - 1
  243.       Gosub GetPlanes
  244.    Next j
  245.  
  246. ;   print NodeName$;":";numplanes
  247. ;   for j = 0 to numplanes
  248. ;      print "x:";plane(j).x,"y:";plane(j).y,"z:";plane(j).z,"d:";plane(j).d
  249. ;   Next j   
  250.  
  251.    print #1,"}"
  252. Return
  253.  
  254. @GetPlanes
  255.    Gosub CrossProduct
  256.    txn = Face.material(j)
  257.    if txn = 255 then txn = 23   
  258.    if numplanes = 0 then plane(0).x = cross.x : plane(0).y = cross.y : plane(0).z = cross.z : numplanes = 1 : texture$ = text$(txn) : Gosub PrintPlane : Return
  259.    for t = 0 to numplanes
  260.       if abs(cross.x-plane(t).x)<er & abs(cross.y-plane(t).y)<er & abs(cross.z-plane(t).z)<er then return
  261.    Next t
  262.    numplanes = numplanes + 1
  263.    plane(numplanes).x = cross.x : plane(numplanes).y = cross.y : plane(numplanes).z = cross.z
  264.    texture$ = text$(txn)
  265.    Gosub PrintPlane
  266. Return
  267.  
  268. @CrossProduct
  269.    ax = Vert.x(Face.a(j)) : ay = Vert.y(Face.a(j)) : az = Vert.z(Face.a(j))
  270.    bx = Vert.x(Face.b(j)) : by = Vert.y(Face.b(j)) : bz = Vert.z(Face.b(j))
  271.    cx = Vert.x(Face.c(j)) : cy = Vert.y(Face.c(j)) : cz = Vert.z(Face.c(j))
  272.    u1 = ax - bx : u2 = ay - by : u3 = az - bz
  273.    v1 = cx - bx : v2 = cy - by : v3 = cz - bz
  274.    cross.x = u2*v3 - u3*v2
  275.    cross.y = u3*v1 - u1*v3
  276.    cross.z = u1*v2 - u2*v1
  277.    length = sqr(cross.x*cross.x + cross.y*cross.y + cross.z*cross.z)
  278.    cross.x = cross.x/length
  279.    cross.y = cross.y/length
  280.    cross.z = cross.z/length
  281. Return
  282.  
  283. @PrintPlane
  284.    print #1,"( ";int(ax);", ";int(ay);", ";int(az);" ) ";
  285.    print #1,"( ";int(cx);", ";int(cy);", ";int(cz);" ) ";   
  286.    print #1,"( ";int(bx);", ";int(by);", ";int(bz);" ) ";      
  287.    print #1,texture$;" 0 0 0 1.0 1.0"
  288. Return
  289.  
  290. @PrintEntity
  291.    Gosub FixName2
  292.    GetXForm NodeName$,0,xform
  293.    GetKeyByNumber NodeName$,0,rot
  294.    GetKeyCount NodeName$,0
  295.    theta = (rot.angle+3870)%360
  296.    print #1,"{"
  297.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  298.    print #1,chr$(34);"origin";chr$(34),chr$(34);int(xform.tm(3,0));" ";int(xform.tm(3,1));" ";int(xform.tm(3,2));chr$(34)
  299.    print #1,chr$(34);"angle";chr$(34),chr$(34);theta;chr$(34)
  300.    if spawnflag > 0 then print #1,chr$(34);"spawnflags";chr$(34),chr$(34);spawnflag;chr$(34) : spawnflag = 0
  301.    if KeyCount > 1 then print #1,chr$(34);"target";chr$(34),chr$(34);newname$+monstertarget$+"0";chr$(34)
  302.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)
  303.    print #1,"}"
  304.    if KeyCount = 1 then Return
  305.    for p = 0 to KeyCount
  306.       GetKeyByNumber NodeName$,p,pos
  307.       print #1,"{"
  308.       print #1,chr$(34);"classname";chr$(34),chr$(34);"path_corner";chr$(34)
  309.       print #1,chr$(34);"origin";chr$(34),chr$(34);int(pos.x);" ";int(pos.y);" ";int(pos.z);chr$(34)
  310.       print #1,chr$(34);"targetname";chr$(34),chr$(34);newname$+monstertarget$+str$(p);chr$(34)
  311.       if p < KeyCount then print #1,chr$(34);"target";chr$(34),chr$(34);newname$+monstertarget$+str$(p+1);chr$(34)
  312.       if p = KeyCount then print #1,chr$(34);"target";chr$(34),chr$(34);newname$+monstertarget$+"0";chr$(34)
  313.       print #1,"}"
  314.    Next p
  315.    monstertarget$ = chr$(asc(plattarget$)+1)   
  316. Return
  317.  
  318. @PrintLight
  319.    style = 0
  320.    Gosub FixName2
  321.    GetKeyByNumber NodeName$,0,pos
  322.    GetKeyByNumber NodeName$,0,color
  323.    brightness = (color.r + color.g + color.b)
  324.    print #1,"{"
  325.    print #1,chr$(34);"classname";chr$(34),chr$(34);"light";chr$(34)
  326.    print #1,chr$(34);"origin";chr$(34),chr$(34);int(pos.x);" ";int(pos.y);" ";int(pos.z);chr$(34)
  327.    if subname$ = "p" or subname$ = "P" then style = 1
  328.    if subname$ = "f" or subname$ = "F" then style = 2
  329.    if style > 0 then print #1,chr$(34);"style";chr$(34),chr$(34);style;chr$(34)
  330.    if subtype$ = "n" or subtype$ = "N" or subtype$ = "f" or subtype$ = "F" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34) 
  331.    if subtype$ = "n" or subtype$ = "N" then print #1,chr$(34);"spawnflags";chr$(34),chr$(34);"0";chr$(34)
  332.    if subtype$ = "f" or subtype$ = "F" then print #1,chr$(34);"spawnflags";chr$(34),chr$(34);"1";chr$(34)
  333.    print #1,chr$(34);"light";chr$(34),chr$(34);brightness;chr$(34)
  334.    print #1,"}"
  335. Return
  336.  
  337. @PrintLift
  338.    speed = 0
  339.    GetKeyCount NodeName$,0
  340.    GetKeyByNumber NodeName$,0,pos : y0 = pos.z
  341.    GetKeyByNumber NodeName$,1,pos : y1 = pos.z
  342.    SetCurrentFrame 0
  343.    if KeyCount > 3 then wait = -1
  344.    height = int(abs(y1-y0))
  345.    if pos.time > 1 then speed = int(height/pos.time)*10 
  346.    print #1,"{"   
  347.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  348.    if subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"target";chr$(34),chr$(34);subname$;chr$(34)
  349.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)
  350.    if height != 0 then print #1,chr$(34);"height";chr$(34),chr$(34);height;chr$(34)
  351.    if speed != 0 then print #1,chr$(34);"speed";chr$(34),chr$(34);speed;chr$(34)   
  352.    Gosub PrintBrush
  353.    print #1,"}"
  354. Return
  355.  
  356. @PrintDoor
  357.    speed = 0 : wait = 0 : theta = -1
  358.    GetKeyCount NodeName$,0
  359.    GetKeyByNumber NodeName$,0,pos : x0 = pos.x : y0 = pos.z : z0 = pos.y
  360.    GetKeyByNumber NodeName$,1,pos : x1 = pos.x : y1 = pos.z : z1 = pos.y : time1 = pos.time
  361.    GetBoundBox NodeName$,0,0,bbox
  362.    SetCurrentFrame 0
  363.    if (x1-x0) > 0 then theta = (ATn((z1-z0)/(x1-x0))+360)%360
  364.    if (x1-x0) < 0 then theta = (ATn((z1-z0)/(x1-x0))+180)%360
  365.    if (x1-x0) = 0 & (z1-z0) > 0 then theta = 90
  366.    if (x1-x0) = 0 & (z1-z0) < 0 then theta = 270
  367.    if (y0-y1) > 1 then theta = -2
  368.    if (y0-y1) < -1 then theta = -1
  369.    length = int(sqr(((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)+(z0-z1)*(z0-z1))))
  370.    blength1 = abs(bbox.min(0)+bbox.min(0))
  371.    blength2 = abs(bbox.min(2)+bbox.min(2))
  372.    lip = blength1
  373.    if blength2 > blength1 then lip = blength2 
  374.    lip = length - lip
  375.    if theta = -1 or theta = -2 then lip = length - abs(bbox.min(1)+bbox.min(1))
  376.    if theta > 270 & theta < 360 then lip = length
  377.    if theta > 90 & theta < 180 then lip = length
  378.    if KeyCount > 2 then GetKeyByNumber NodeName$,2,pos : time2 = pos.time : wait = abs(time2 - time1)
  379.    if KeyCount > 3 then wait = -1
  380.    if time1 > 1 then speed = int(length/time1)*10
  381.    print #1,"{"
  382.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  383.    if subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"target";chr$(34),chr$(34);subname$;chr$(34)
  384.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)
  385.    print #1,chr$(34);"angle";chr$(34),chr$(34);theta;chr$(34)
  386.    if speed != 0 then print #1,chr$(34);"speed";chr$(34),chr$(34);speed;chr$(34)
  387.    if wait != 0 then print #1,chr$(34);"wait";chr$(34),chr$(34);wait;chr$(34)
  388.    if length != 0 then print #1,chr$(34);"lip";chr$(34),chr$(34);(lip*(-1));chr$(34)
  389.    Gosub PrintBrush
  390.    print #1,"}"
  391. Return
  392.  
  393. @PrintButton
  394.    speed = 0 : wait = 0 : theta = -2
  395.    GetKeyCount NodeName$,0
  396.    GetKeyByNumber NodeName$,0,pos : x0 = pos.x : y0 = pos.z : z0 = pos.y
  397.    GetKeyByNumber NodeName$,1,pos : x1 = pos.x : y1 = pos.z : z1 = pos.y : time1 = pos.time
  398.    GetBoundBox NodeName$,0,0,bbox
  399.    SetCurrentFrame 0
  400.    if (x1-x0) > 0 then theta = (ATn((z1-z0)/(x1-x0))+360)%360
  401.    if (x1-x0) < 0 then theta = (ATn((z1-z0)/(x1-x0))+180)%360
  402.    if (x1-x0) = 0 & (z1-z0) > 0 then theta = 90
  403.    if (x1-x0) = 0 & (z1-z0) < 0 then theta = 270
  404.    if (y0-y1) > 1 then theta = -2
  405.    if (y0-y1) < -1 then theta = -1
  406.    length = int(sqr(((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)+(z0-z1)*(z0-z1))))
  407.    blength1 = abs(bbox.min(0)+bbox.min(0))
  408.    blength2 = abs(bbox.min(2)+bbox.min(2))
  409.    lip = blength1
  410.    if blength2 < blength1 then lip = blength2 
  411.    lip = length - lip
  412.    if theta = -1 or theta = -2 then lip = length - abs(bbox.min(1)+bbox.min(1))
  413.    if theta > 270 & theta < 360 then lip = length
  414.    if theta > 90 & theta < 180 then lip = length   
  415.    if KeyCount > 2 then GetKeyByNumber NodeName$,2,pos : time2 = pos.time : wait = abs(time2 - time1)
  416.    if KeyCount > 3 then wait = -1
  417.    if time1 > 1 then speed = int(length/time1)*10
  418.    print #1,"{"
  419.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  420.    if subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"target";chr$(34),chr$(34);subname$;chr$(34)
  421.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)
  422.    print #1,chr$(34);"angle";chr$(34),chr$(34);theta;chr$(34)
  423.    if speed != 0 then print #1,chr$(34);"speed";chr$(34),chr$(34);speed;chr$(34)
  424.    if wait != 0 then print #1,chr$(34);"wait";chr$(34),chr$(34);wait;chr$(34)
  425.    if length != 0 then print #1,chr$(34);"lip";chr$(34),chr$(34);(lip*(-1));chr$(34)
  426.    Gosub PrintBrush
  427.    print #1,"}"
  428. Return
  429.  
  430. @PrintTport
  431.    GetXForm NodeName$,0,xform
  432.    GetKeyByNumber NodeName$,0,rot
  433.    if rot.axis(2) > 0 then rot.angle = rot.angle * (-1)
  434.    theta = ((rot.angle)+3870)%360
  435.    print #1,"{"
  436.    if tp=0 & subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"classname";chr$(34),chr$(34);tportS$;chr$(34)
  437.    if tp=0 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"classname";chr$(34),chr$(34);tportD$;chr$(34)
  438.    if tp=0 & subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"target";chr$(34),chr$(34);subname$;chr$(34)
  439.    if tp=0 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)   
  440.    if tp=0 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"origin";chr$(34),chr$(34);int(xform.tm(3,0));" ";int(xform.tm(3,1));" ";int(xform.tm(3,2));chr$(34)
  441.    if tp=1 & subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"classname";chr$(34),chr$(34);dmtportS$;chr$(34)
  442.    if tp=1 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"classname";chr$(34),chr$(34);dmtportD$;chr$(34)
  443.    if tp=1 & subtype$ = "s" or subtype$ = "S" then print #1,chr$(34);"target";chr$(34),chr$(34);subname$;chr$(34)
  444.    if tp=1 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)   
  445.    if tp=1 & subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"origin";chr$(34),chr$(34);int(xform.tm(3,0));" ";int(xform.tm(3,1));" ";int(xform.tm(3,2));chr$(34)
  446.    if tp=1 then print #1,chr$(34);"spawnflags";chr$(34),chr$(34);"1792";chr$(34)
  447.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"angle";chr$(34),chr$(34);theta;chr$(34)
  448.    if subtype$ = "s" or subtype$ = "S" then Gosub PrintBrush
  449.    print #1,"}"
  450. Return
  451.  
  452. @PrintWall
  453.    print #1,"{"
  454.    print #1,chr$(34);"classname";chr$(34),chr$(34);"func_wall";chr$(34)
  455.    Gosub PrintBrush  
  456.    print #1,"}"
  457. Return
  458.  
  459. @PrintChangeLevel
  460.    print #1,"{"
  461.    print #1,chr$(34);"classname";chr$(34),chr$(34);"trigger_changelevel";chr$(34)
  462.    print #1,chr$(34);"map";chr$(34),chr$(34);subname$;chr$(34)
  463.    Gosub PrintBrush  
  464.    print #1,"}"
  465. Return
  466.  
  467. @PrintCamera
  468.    GetKeyByNumber NodeName$,0,pos   
  469.    GetKeyByNumber NodeName$+".target",0,pos2
  470.    X0 = pos.x : Y0 = pos.y : Z0 = pos.z
  471.    X1 = pos2.x : Y1 = pos2.y : Z1 = pos2.z
  472.    if (X1-X0) > 0 then theta = (ATn((Y1-Y0)/(X1-X0))+360)%360
  473.    if (X1-X0) < 0 then theta = (ATn((Y1-Y0)/(X1-X0))+180)%360
  474.    if (X1-X0) = 0 & (Y1-Y0) > 0 then theta = 90
  475.    if (X1-X0) = 0 & (Y1-Y0) < 0 then theta = 270
  476.    length = int(sqr(((X0-X1)*(X0-X1)+(Y0-Y1)*(Y0-Y1))))
  477.    phi = (ATn((Z0-Z1)/length))
  478.    roll = 0  
  479.    print #1,"{"
  480.    print #1,chr$(34);"classname";chr$(34),chr$(34);"info_intermission";chr$(34)
  481.    print #1,chr$(34);"origin";chr$(34),chr$(34);int(X0);" ";int(Y0);" ";int(Z0);chr$(34)
  482.    print #1,chr$(34);"mangle";chr$(34),chr$(34);int(phi);" ";int(theta);" ";int(roll);chr$(34)
  483.    print #1,"}"   
  484. Return
  485.  
  486. @PrintPlat
  487.    speed = 0
  488.    GetKeyCount NodeName$,0
  489.    GetKeyByNumber NodeName$,0,pos
  490.    GetKeyByNumber NodeName$,1,pos2
  491.    GetBoundBox NodeName$,0,0,bbox
  492.    bwidth = abs(bbox.max(0))
  493.    bheight = abs(bbox.max(1))
  494.    bdepth = abs(bbox.max(2))
  495.    SetCurrentFrame 0   
  496.    length1 = sqr((pos.x-pos2.x)*(pos.x-pos2.x)+(pos.y-pos2.y)*(pos.y-pos2.y)+(pos.z-pos2.z)*(pos.z-pos2.z))
  497.    if KeyCount > 1 then speed = int(length1/pos2.time)*10 
  498.    print #1,"{"   
  499.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  500.    print #1,chr$(34);"target";chr$(34),chr$(34);"plat"+plattarget$+"0";chr$(34)
  501.    if subtype$ = "d" or subtype$ = "D" then print #1,chr$(34);"targetname";chr$(34),chr$(34);subname$;chr$(34)   
  502.    if speed != 0 then print #1,chr$(34);"speed";chr$(34),chr$(34);speed;chr$(34)   
  503.    Gosub PrintBrush
  504.    print #1,"}"
  505.    for p = 0 to KeyCount
  506.       GetKeyByNumber NodeName$,p,pos
  507.       print #1,"{"
  508.       print #1,chr$(34);"classname";chr$(34),chr$(34);"path_corner";chr$(34)
  509.       print #1,chr$(34);"origin";chr$(34),chr$(34);int(pos.x-bwidth);" ";int(pos.y-bdepth);" ";int(pos.z-bheight);chr$(34)
  510.       print #1,chr$(34);"targetname";chr$(34),chr$(34);"plat"+plattarget$+str$(p);chr$(34)
  511.       if p < KeyCount then print #1,chr$(34);"target";chr$(34),chr$(34);"plat"+plattarget$+str$(p+1);chr$(34)
  512.       if p = KeyCount then print #1,chr$(34);"target";chr$(34),chr$(34);"plat"+plattarget$+"0";chr$(34)
  513.       print #1,"}"
  514.    Next p
  515.    plattarget$ = chr$(asc(plattarget$)+1)
  516. Return
  517.  
  518. @PrintSpikeShooter
  519.    theta = -1
  520.    wait = 0
  521.    GetKeyByNumber NodeName$,0,pos : x0 = pos.x : y0 = pos.z : z0 = pos.y
  522.    GetKeyByNumber NodeName$,1,pos : x1 = pos.x : y1 = pos.z : z1 = pos.y : time1 = pos.time
  523.    if (x1-x0) > 0 then theta = (ATn((z1-z0)/(x1-x0))+360)%360
  524.    if (x1-x0) < 0 then theta = (ATn((z1-z0)/(x1-x0))+180)%360
  525.    if (x1-x0) = 0 & (z1-z0) > 0 then theta = 90
  526.    if (x1-x0) = 0 & (z1-z0) < 0 then theta = 270
  527.    if (y0-y1) > 1 then theta = -2
  528.    if (y0-y1) < -1 then theta = -1
  529.    length = int(sqr(((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)+(z0-z1)*(z0-z1))))
  530.    if time1 > 0 then wait = int(length)/500
  531.    print #1,"{"
  532.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  533.    print #1,chr$(34);"origin";chr$(34),chr$(34);int(x0);" ";int(z0);" ";int(y0);chr$(34)
  534.    print #1,chr$(34);"angle";chr$(34),chr$(34);theta;chr$(34)
  535.    if spawnflag > 0 then print #1,chr$(34);"spawnflags";chr$(34),chr$(34);spawnflag;chr$(34) : spawnflag = 0
  536.    if wait != 0 then print #1,chr$(34);"wait";chr$(34),chr$(34);wait;chr$(34)
  537.    print #1,"}"
  538. Return
  539.  
  540. @PrintFireBall
  541.    speed = 0
  542.    GetKeyByNumber NodeName$,0,pos : x0 = pos.x : y0 = pos.z : z0 = pos.y
  543.    GetKeyByNumber NodeName$,1,pos : x1 = pos.x : y1 = pos.z : z1 = pos.y : time1 = pos.time
  544.    length = int(sqr(((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)+(z0-z1)*(z0-z1))))
  545.    if time1 > 0 then speed = int(length*1.4)
  546.    print #1,"{"
  547.    print #1,chr$(34);"classname";chr$(34),chr$(34);temp$;chr$(34)
  548.    print #1,chr$(34);"origin";chr$(34),chr$(34);int(x0);" ";int(z0);" ";int(y0);chr$(34)
  549.    if speed > 0 then print #1,chr$(34);"speed";chr$(34),chr$(34);speed;chr$(34)
  550.    print #1,"}"
  551. Return
  552.