Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 89.93 KB | None | 0 0
  1. global vertRepeater, r, gEEprops, solidMtrx, gLEprops, colr, gdLayer, gLOProps, gLevel, gEffectProps, gViewRender, keepLooping, gRenderCameraTilePos, effectSeed
  2. global effectIn3D, gAnyDecals
  3.  
  4. on exitFrame me
  5. if gViewRender then
  6. if _key.keyPressed(48) then
  7. _movie.go(9)
  8. end if
  9. me.newFrame()
  10. if keepLooping then
  11. go the frame
  12. end if
  13. else
  14. repeat while keepLooping
  15. me.newFrame()
  16. end repeat
  17. end if
  18. end
  19.  
  20.  
  21. on newFrame me
  22.  
  23. vertRepeater = vertRepeater + 1
  24.  
  25.  
  26. if (gEEprops.effects.count = 0)then
  27. keepLooping = 0
  28. exit
  29. else if (r=0)then
  30. vertRepeater = 1
  31. r = 1
  32. me.initEffect()
  33. end if
  34.  
  35. if ((vertRepeater > 60)and(gEEprops.effects[r].crossScreen = 0))or((vertRepeater > gLOprops.size.locV)and(gEEprops.effects[r].crossScreen = 1)) then
  36. me.exitEffect()
  37. r = r + 1
  38.  
  39. if r > gEEprops.effects.count then
  40. keepLooping = 0
  41. exit
  42. else
  43. me.initEffect()
  44. vertRepeater = 1
  45. end if
  46. end if
  47.  
  48.  
  49.  
  50.  
  51. if (gEEprops.effects[r].crossScreen = 0) then
  52. sprite(59).locV = vertRepeater*20
  53. repeat with q = 1 to 100 then
  54. q2 = q + gRenderCameraTilePos.locH
  55. c2 = vertRepeater + gRenderCameraTilePos.locV
  56. if(q2 > 0)and(q2 <= gLOprops.size.locH)and(c2 > 0)and(c2 <= gLOprops.size.locV)then
  57. me.effectOnTile(q, vertRepeater, q2, c2)
  58. end if
  59. end repeat
  60. else
  61. sprite(59).locV = (vertRepeater-gRenderCameraTilePos.locV)*20
  62. repeat with q2 = 1 to gLOprops.size.locH then
  63. me.effectOnTile(q2-gRenderCameraTilePos.locH, vertRepeater-gRenderCameraTilePos.locV, q2, vertRepeater)
  64. end repeat
  65. end if
  66.  
  67.  
  68. end
  69.  
  70.  
  71. on effectOnTile me, q, c, q2, c2
  72. if gEEprops.effects[r].mtrx[q2][c2] > 0 then
  73.  
  74. savSeed = the randomSeed
  75. the randomSeed = seedForTile(point(q2, c2), effectSeed)
  76.  
  77. case gEEprops.effects[r].nm of
  78. "Slime", "rust", "barnacles", "erode", "melt", "Roughen", "SlimeX3", "Destructive Melt", "Super Melt", "Super Erode", "DecalsOnlySlime":
  79. me.applyStandardErosion(q,c,0, gEEprops.effects[r].nm)
  80. "Root Grass", "Cacti", "Rubble", "Rain Moss", "Seed Pods", "Grass", "Horse Tails", "Circuit Plants", "Feather Plants":
  81. me.applyStandardPlant(q,c,0, gEEprops.effects[r].nm)
  82. "Growers":
  83. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(2)=1) then
  84. me.applyhugeflower(q,c,0)
  85. end if
  86. "Arm Growers":
  87. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(2)=1) then
  88. me.ApplyArmGrower(q,c,0)
  89. end if
  90. "Fungi Flowers":
  91. if gEEprops.effects[r].mtrx[q2][c2] > 0 then
  92. me.applyFungiFlower(q,c)
  93. end if
  94. "Lighthouse Flowers":
  95. if gEEprops.effects[r].mtrx[q2][c2] > 0 then
  96. me.applyLHFlower(q,c)
  97. end if
  98. "Fern", "Giant Mushroom":
  99. if gEEprops.effects[r].mtrx[q2][c2] > 0 then
  100. me.applyBigPlant(q,c)
  101. end if
  102. "sprawlbush", "featherFern", "Fungus Tree":
  103. if gEEprops.effects[r].mtrx[q2][c2] > 0 then
  104. me.apply3Dsprawler(q,c, gEEprops.effects[r].nm)
  105. end if
  106. "hang roots":
  107. repeat with r2 = 1 to 3 then
  108. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) then
  109. me.applyHangRoots(q,c,0)
  110. end if
  111. end repeat
  112. "wires":
  113. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(2)=1) then
  114. me.applyWire(q,c,0)
  115. end if
  116. "chains":
  117. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(2)=1) then
  118. me.applyChain(q,c,0)
  119. end if
  120. "blackGoo":
  121. me.applyBlackGoo(q,c,0)
  122. "DarkSlime":
  123. me.applyDarkSlime(q,c, gEEprops.effects[r].nm)
  124. "Restore As Scaffolding", "Restore as Pipes":
  125. me.applyRestoreEffect(q,c, q2, c2, gEEprops.effects[r].nm)
  126. "Rollers":
  127. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(5)=1) then
  128. me.ApplyRoller(q,c,0)
  129. end if
  130. "Thorn Growers":
  131. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(3)>1) then
  132. me.ApplyThornGrower(q,c,0)
  133. end if
  134. "Garbage Spirals":
  135. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(6)=1) then
  136. me.ApplyGarbageSpiral(q,c,0)
  137. end if
  138. "Thick Roots":
  139. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) then
  140. me.applyThickRoots(q,c,0)
  141. end if
  142. "Shadow Plants":
  143. if (random(100)<gEEprops.effects[r].mtrx[q2][c2]) and (random(3)=1) then
  144. me.applyShadowPlants(q,c,0)
  145. end if
  146. "DaddyCorruption":
  147. me.applyDaddyCorruption(q,c,gEEprops.effects[r].mtrx[q2][c2])
  148. end if
  149. "HeartCorruption":
  150. me.applyHeartCorruption(q,c,gEEprops.effects[r].mtrx[q2][c2])
  151.  
  152. end case
  153.  
  154. the randomSeed = savSeed
  155.  
  156. end if
  157. end
  158.  
  159.  
  160. on initEffect me
  161. effectSeed = 0
  162. repeat with a = 1 to gEEprops.effects[r].Options.count then
  163. if(gEEprops.effects[r].Options[a][1] = "Seed")then
  164. effectSeed = gEEprops.effects[r].Options[a][3]
  165. exit repeat
  166. end if
  167. end repeat
  168.  
  169. effectIn3D = false
  170. repeat with op in gEEprops.effects[r].options then
  171. case op[1] of
  172. "Color":
  173. colr = [color(255, 0, 255), color(0, 255, 255), color(0, 255, 0)][["Color1", "Color2", "Dead"].getPos(op[3])]
  174. gdLayer = ["A", "B", "C"][["Color1", "Color2", "Dead"].getPos(op[3])]
  175. "Seed":
  176. the randomSeed = op[3]
  177. "3D":
  178. effectIn3D = (op[3] = "On")
  179. end case
  180. end repeat
  181.  
  182. case gEEprops.effects[r].nm of
  183. "blackGoo":
  184. cols = 100
  185. rows = 60
  186.  
  187. member("blackOutImg1").image = image(cols*20, rows*20, 32)
  188. member("blackOutImg1").image.copyPixels(member("pxl").image, rect(0,0,cols*20, rows*20), rect(0,0,1,1), {#color:255})
  189. member("blackOutImg2").image = image(cols*20, rows*20, 32)
  190. member("blackOutImg2").image.copyPixels(member("pxl").image, rect(0,0,cols*20, rows*20), rect(0,0,1,1), {#color:255})
  191. sprite(57).visibility = 1
  192. sprite(58).visibility = 1
  193.  
  194. global gRenderCameraTilePos, gRenderCameraPixelPos
  195.  
  196. repeat with q = 1 to 100 then
  197. repeat with c = 1 to 60 then
  198. q2 = q + gRenderCameraTilePos.locH
  199. c2 = c + gRenderCameraTilePos.locV
  200. if(q2 < 1)or(q2 > gLOprops.size.locH)or(c2 < 1)or(c2 > gLOprops.size.locV)then
  201. member("blackOutImg1").image.copyPixels(member("pxl").image, rect((q-1)*20, (c-1)*20, q*20, c*20), rect(0,0,1,1), {#color:color(255, 255, 255)})
  202. member("blackOutImg2").image.copyPixels(member("pxl").image, rect((q-1)*20, (c-1)*20, q*20, c*20), rect(0,0,1,1), {#color:color(255, 255, 255)})
  203. end if
  204. end repeat
  205. end repeat
  206.  
  207.  
  208. rct = member("blob").image.rect
  209. repeat with q2 = 1 to cols then
  210. repeat with c2 = 1 to rows then
  211. if(q2+gRenderCameraTilePos.locH > 0)and(q2+gRenderCameraTilePos.locH <= gLOprops.size.locH)and(c2+gRenderCameraTilePos.locV > 0)and(c2+gRenderCameraTilePos.locV <= gLOprops.size.locV)then
  212. tile = point(q2,c2)+gRenderCameraTilePos
  213.  
  214. if (gEEprops.effects[r].mtrx[tile.locH][tile.locV] = 0) then
  215. sPnt = giveMiddleOfTile(point(q2,c2))+point(-10,-10)--+gRenderCameraPixelPos--gRenderCameraTilePos-gRenderCameraPixelPos
  216.  
  217. repeat with d = 1 to 10 then
  218. repeat with e = 1 to 10 then
  219. ps = point(sPnt.locH + d*2, sPnt.locV + e*2)
  220. -- if member("layer0").image.getPixel(ps) = color(255, 255, 255) then
  221. member("blackOutImg1").image.copyPixels(member("blob").image, rect(ps.locH-6-random(random(11)),ps.locV-6-random(random(11)),ps.locH+6+random(random(11)),ps.locV+6+random(random(11))), rct, {#color:0, #ink:36})
  222. member("blackOutImg2").image.copyPixels(member("blob").image, rect(ps.locH-7-random(random(14)),ps.locV-7-random(random(14)),ps.locH+7+random(random(14)),ps.locV+7+random(random(14))), rct, {#color:0, #ink:36})
  223. -- end if
  224. end repeat
  225. end repeat
  226. else if ((gLEProps.matrix[tile.locH][tile.locV][1][2].getPos(5) > 0)or(gLEProps.matrix[tile.locH][tile.locV][1][2].getPos(4) > 0))and(gLEProps.matrix[tile.locH][tile.locV][2][1]=1) then
  227. ps = giveMiddleOfTile(point(q2,c2))--+gRenderCameraPixelPos--gRenderCameraTilePos-gRenderCameraPixelPos
  228. member("blackOutImg1").image.copyPixels(member("blob").image, rect(ps.locH-4-random(random(9)),ps.locV-4-random(random(9)),ps.locH+4+random(random(9)),ps.locV+4+random(random(9))), rct, {#color:0, #ink:36})
  229. member("blackOutImg2").image.copyPixels(member("blob").image, rect(ps.locH-7-random(random(9)),ps.locV-7-random(random(9)),ps.locH+7+random(random(9)),ps.locV+7+random(random(9))), rct, {#color:0, #ink:36})
  230. member("blackOutImg1").image.copyPixels(member("blob").image, rect(ps.locH-4-random(random(9)),ps.locV-4-random(random(9)),ps.locH+4+random(random(9)),ps.locV+4+random(random(9))), rct, {#color:0, #ink:36})
  231. member("blackOutImg2").image.copyPixels(member("blob").image, rect(ps.locH-7-random(random(9)),ps.locV-7-random(random(9)),ps.locH+7+random(random(9)),ps.locV+7+random(random(9))), rct, {#color:0, #ink:36})
  232. end if
  233. end if
  234. end repeat
  235. end repeat
  236.  
  237. "fungi flowers":
  238.  
  239. l = [2,3,4,5]
  240. l2 = []
  241. repeat with a = 1 to 4 then
  242. val = l[random(l.count)]
  243. l2.add(val)
  244. l.deleteOne(val)
  245. end repeat
  246. gEffectProps = [#list:l2, #listPos:1]
  247.  
  248. "lighthouse flowers":
  249.  
  250. l = [1,2,3,4,5,6,7,8]
  251. l2 = []
  252. repeat with a = 1 to 8 then
  253. val = l[random(l.count)]
  254. l2.add(val)
  255. l.deleteOne(val)
  256. end repeat
  257. gEffectProps = [#list:l2, #listPos:1]
  258.  
  259. "Fern", "Giant Mushroom":
  260. l = [1,2,3,4,5,6,7]
  261. l2 = []
  262. repeat with a = 1 to 7 then
  263. val = l[random(l.count)]
  264. l2.add(val)
  265. l.deleteOne(val)
  266. end repeat
  267. gEffectProps = [#list:l2, #listPos:1]
  268.  
  269. "DaddyCorruption":
  270. global daddyCorruptionHoles
  271. daddyCorruptionHoles = []
  272.  
  273. "HeartCorruption":
  274. global HeartCorruptionHoles
  275. HeartCorruptionHoles = []
  276. end case
  277.  
  278.  
  279. txt = ""
  280. put "<APPLYING EFFECTS> Press TAB to abort" after txt
  281. put RETURN after txt
  282.  
  283. repeat with ef = 1 to gEEprops.effects.count then
  284.  
  285. if ef = r then
  286. put string(ef)&". ->"&gEEprops.effects[ef].nm after txt
  287. else
  288. put string(ef)&". "&gEEprops.effects[ef].nm after txt
  289. end if
  290. put RETURN after txt
  291. end repeat
  292.  
  293. member("effectsL").text = txt
  294. end
  295.  
  296. on exitEffect me
  297. case gEEprops.effects[r].nm of
  298. "blackGoo":
  299.  
  300.  
  301. member("layer0").image.copyPixels(member("blackOutImg1").image, rect(0,0,100*20, 60*20), rect(0,0,100*20, 60*20), {#ink:36, #color:color(0, 255, 0)})
  302. member("layer0").image.copyPixels(member("blackOutImg2").image, rect(0,0,100*20, 60*20), rect(0,0,100*20, 60*20), {#ink:36, #color:color(255, 0, 0)})
  303.  
  304.  
  305. member("blackOutImg1").image = image(1, 1, 1)
  306. -- member("blackOutImg2").image = image(1, 1, 1)
  307. sprite(58).visibility = 0
  308. sprite(57).visibility = 0
  309.  
  310. "daddyCorruption":
  311. global daddyCorruptionHoles
  312. repeat with i = 1 to daddyCorruptionHoles.count then
  313. qd = rotateToQuad(rect(daddyCorruptionHoles[i][1], daddyCorruptionHoles[i][1])+rect(-daddyCorruptionHoles[i][2],-daddyCorruptionHoles[i][2],daddyCorruptionHoles[i][2],daddyCorruptionHoles[i][2]), daddyCorruptionHoles[i][3])
  314. repeat with d = 0 to 1 then
  315. member("layer"&string(daddyCorruptionHoles[i][4]+d)).image.copyPixels(member("DaddyBulb").image, qd, rect(60, 1, 134, 74), {#color:color(255, 255, 255), #ink:36})
  316. end repeat
  317. if(random(2)=1)and(random(100)>daddyCorruptionHoles[i][5])then
  318. member("layer"&string(daddyCorruptionHoles[i][4]+2)).image.copyPixels(member("DaddyBulb").image, qd, rect(60, 1, 134, 74), {#color:color(255, 0, 0), #ink:36})
  319. else
  320. member("layer"&string(daddyCorruptionHoles[i][4]+2)).image.copyPixels(member("DaddyBulb").image, qd, rect(60, 1, 134, 74), {#color:color(0, 255, 255), #ink:36})
  321. copyPixelsToEffectColor("B", daddyCorruptionHoles[i][4]+2, rect(daddyCorruptionHoles[i][1], daddyCorruptionHoles[i][1])+rect(-daddyCorruptionHoles[i][2]*1.5,-daddyCorruptionHoles[i][2]*1.5,daddyCorruptionHoles[i][2]*1.5,daddyCorruptionHoles[i][2]*1.5), "softBrush1", member("softBrush1").rect, 0.5, lerp(random(50)*0.01, 1.0, random(daddyCorruptionHoles[i][5])*0.01))
  322. end if
  323. end repeat
  324. daddyCorruptionHoles = []
  325.  
  326. "HeartCorruption":
  327. global HeartCorruptionHoles
  328. repeat with i = 1 to HeartCorruptionHoles.count then
  329. qd = rotateToQuad(rect(HeartCorruptionHoles[i][1], HeartCorruptionHoles[i][1])+rect(-HeartCorruptionHoles[i][2],-HeartCorruptionHoles[i][2],HeartCorruptionHoles[i][2],HeartCorruptionHoles[i][2]), HeartCorruptionHoles[i][3])
  330. repeat with d = 0 to 1 then
  331. member("layer"&string(HeartCorruptionHoles[i][4]+d)).image.copyPixels(member("HeartRust").image, qd, rect(60, 1, 134, 74), {#color:color(255, 255, 255), #ink:36})
  332. end repeat
  333. if(random(2)=1)and(random(100)>HeartCorruptionHoles[i][5])then
  334. member("layer"&string(HeartCorruptionHoles[i][4]+2)).image.copyPixels(member("HeartRust").image, qd, rect(60, 1, 134, 74), {#color:color(255, 0, 0), #ink:36})
  335. else
  336. member("layer"&string(HeartCorruptionHoles[i][4]+2)).image.copyPixels(member("HeartRust").image, qd, rect(60, 1, 134, 74), {#color:color(0, 255, 255), #ink:36})
  337. copyPixelsToEffectColor("B", HeartCorruptionHoles[i][4]+2, rect(HeartCorruptionHoles[i][1], HeartCorruptionHoles[i][1])+rect(-HeartCorruptionHoles[i][2]*1.5,-HeartCorruptionHoles[i][2]*1.5,HeartCorruptionHoles[i][2]*1.5,HeartCorruptionHoles[i][2]*1.5), "softBrush1", member("softBrush1").rect, 0.5, lerp(random(50)*0.01, 1.0, random(HeartCorruptionHoles[i][5])*0.01))
  338. end if
  339. end repeat
  340. HeartCorruptionHoles = []
  341.  
  342. end case
  343. end
  344.  
  345.  
  346.  
  347.  
  348. on applyStandardErosion me, q, c, eftc, tp
  349. q2 = q + gRenderCameraTilePos.locH
  350. c2 = c + gRenderCameraTilePos.locV
  351.  
  352. fc = gEEprops.effects[r].affectOpenAreas + (1.0-gEEprops.effects[r].affectOpenAreas)* ( solidAfaMv(point(q2,c2), 3) )
  353.  
  354.  
  355. repeat with d = 1 to 30 then
  356. lr = 30-d
  357. if (lr = 9)or(lr=19) then
  358. sld = (solidMtrx[q2][c2][ 1+(d>9)+(d>19) ])
  359. fc = gEEprops.effects[r].affectOpenAreas + (1.0-gEEprops.effects[r].affectOpenAreas)* ( solidAfaMv(point(q2,c2), 1+(d>9)+(d>19)) )
  360. end if
  361. deepEffect = 0
  362.  
  363. if (lr = 0)or(lr=10)or(lr=20)or(sld=0)then
  364. deepEffect = 1
  365. end if
  366.  
  367. repeat with cntr = 1 to gEEprops.effects[r].mtrx[q2][c2]*(0.2 + (0.8*deepEffect))*0.01*gEEprops.effects[r].repeats*fc then
  368. if deepEffect then
  369. pnt = (point(q-1, c-1)*20)+point(random(20), random(20))
  370. else
  371. if random(2)=1 then
  372. pnt = (point(q-1, c-1)*20)+point(1 + 19*(random(2)-1), random(20))
  373. else
  374. pnt = (point(q-1, c-1)*20)+point(random(20), 1 + 19*(random(2)-1))
  375. end if
  376. end if
  377.  
  378. case tp of
  379. "rust", "barnacles":
  380. pnt = pnt+degToVec(random(360))*4
  381. cl = member("layer"&string(lr)).image.getPixel(pnt)
  382. "erode", "Super Erode":
  383. pnt = pnt+degToVec(random(360))*2
  384. if (member("layer"&string(lr)).image.getPixel(pnt) = color(255, 255, 255)) or ((random(108)=1) and (tp <> "Super Erode")) then
  385. cl = "GOTHROUGH"
  386. else
  387. cl = color(255, 255, 255)
  388. end if
  389. "Destructive Melt":
  390. cl = member("layer"&string(lr)).image.getPixel(pnt)
  391. if(cl = color(255, 255, 255))then
  392. cl = "WHITE"
  393. end if
  394. otherwise:
  395. cl = member("layer"&string(lr)).image.getPixel(pnt)
  396. end case
  397.  
  398.  
  399. if cl <> color(255, 255, 255) then
  400. case tp of
  401. "slime", "slimeX3":
  402. if (cl <> color(255, 255, 255))then
  403. ofst = random(2)-1
  404. lgt = 3 + random(random(random(6)))
  405. if effectIn3D then
  406. nwLr = get3DLr(lr)
  407. else
  408. nwLr = restrict(lr -1 + random(2), 0, 29)
  409. end if
  410. member("layer"&string(nwLr)).image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst,0,1+ofst,lgt), member("pxl").image.rect, {#color:cl})
  411. if(gAnyDecals)then
  412. dcCol = member("layer"&string(nwLr)&"dc").image.getPixel(pnt)
  413. member("layer"&string(nwLr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst,0,1+ofst,lgt), member("pxl").image.rect, {#color:dcCol})
  414. end if
  415. if random(2)=1 then
  416. member("layer"&string(nwLr)).image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst+1,1,1+ofst+1,lgt-1), member("pxl").image.rect, {#color:cl})
  417. if(gAnyDecals)then
  418. member("layer"&string(nwLr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst+1,1,1+ofst+1,lgt-1), member("pxl").image.rect, {#color:dcCol})
  419. end if
  420. else
  421. member("layer"&string(nwLr)).image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst-1,1,1+ofst-1,lgt-1), member("pxl").image.rect, {#color:cl})
  422. if(gAnyDecals)then
  423. member("layer"&string(nwLr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst-1,1,1+ofst-1,lgt-1), member("pxl").image.rect, {#color:dcCol})
  424. end if
  425. end if
  426. end if
  427.  
  428. "DecalsOnlySlime":
  429. ofst = random(2)-1
  430. lgt = 3 + random(random(random(6)))
  431.  
  432. if(gAnyDecals)then
  433. dcCol = member("layer"&string(lr)&"dc").image.getPixel(pnt)
  434. member("layer"&string(lr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst,0,1+ofst,lgt), member("pxl").image.rect, {#color:dcCol})
  435.  
  436. if random(2)=1 then
  437. member("layer"&string(lr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst+1,1,1+ofst+1,lgt-1), member("pxl").image.rect, {#color:dcCol})
  438. else
  439. member("layer"&string(lr)&"dc").image.copyPixels(member("pxl").image, rect(pnt, pnt)+rect(0+ofst-1,1,1+ofst-1,lgt-1), member("pxl").image.rect, {#color:dcCol})
  440. end if
  441. end if
  442.  
  443. "rust":
  444. ofst = random(2)-1
  445. if effectIn3D then
  446. nwLr = get3DLr(lr)
  447. else
  448. nwLr = lr
  449. end if
  450. member("layer"&string(nwLr)).image.copyPixels(member("rustDot").image, rect(pnt, pnt)+rect(-2+ofst,-2,2+ofst,2), member("rustDot").image.rect, {#color:cl, #ink:36})
  451.  
  452. "barnacles":
  453. if effectIn3D then
  454. nwLr = get3DLr(lr)
  455. else
  456. nwLr = restrict(lr -1 + random(2), 0, 29)
  457. end if
  458. if random(2)-1 then
  459. member("layer"&string(nwLr)).image.copyPixels(member("barnacle1").image, rect(pnt, pnt)+rect(-3,-3,4,4), member("barnacle1").image.rect, {#color:cl, #ink:36})
  460. member("layer"&string(nwLr)).image.copyPixels(member("barnacle2").image, rect(pnt, pnt)+rect(-2,-2,3,3), member("barnacle2").image.rect, {#color:color(255,0,0), #ink:36})
  461. else
  462. ofst = random(2)-1
  463. member("layer"&string(nwLr)).image.copyPixels(member("rustDot").image, rect(pnt, pnt)+rect(-2+ofst,-2,2+ofst,2), member("rustDot").image.rect, {#color:[color(255,0,0),cl][random(2)], #ink:36})
  464. end if
  465. "erode":
  466. if(random(6)>1)then
  467. nwLr = lr
  468. else
  469. nwLr = restrict(lr + 1, 0, 29)
  470. end if
  471.  
  472. repeat with a = 1 to 6 then
  473. pnt = pnt + point(-3+random(5), -3+random(5))
  474. ofst = random(2)-1
  475. member("layer"&string(nwLr)).image.copyPixels(member("rustDot").image, rect(pnt, pnt)+rect(-2+ofst,-2,2+ofst,2), member("rustDot").image.rect, {#color:color(255, 255, 255), #ink:36})
  476. end repeat
  477. "Super Erode":
  478. if(random(40 + 4 * lr * (lr > 19))>1)then
  479. nwLr = lr
  480. else
  481. nwLr = restrict(lr -2 + random(3), 0, 29)
  482. end if
  483.  
  484. repeat with a = 1 to 6 then
  485. pnt = pnt + point(-4+random(7), -4+random(7))
  486. member("layer"&string(nwLr)).image.copyPixels(member("SuperErodeMask").image, rect(pnt, pnt)+rect(-4, -4, 4, 4), member("SuperErodeMask").image.rect, {#color:color(255, 255, 255), #ink:36})
  487. end repeat
  488. "melt":
  489. cp = image(4,4,32)
  490. rct = rect(pnt,pnt)+rect(-2,-2,2,2)
  491. cp.copyPixels(member("layer"&string(lr)).image, rect(0,0,4,4), rct)
  492. cp.setPixel(point(0,0), color(255,255,255))
  493. cp.setPixel(point(3,0), color(255,255,255))
  494. cp.setPixel(point(0,3), color(255,255,255))
  495. cp.setPixel(point(3,3), color(255,255,255))
  496. member("layer"&string(lr)).image.copyPixels(cp, rct+rect(0,1,0,1), rect(0,0,4,4), {#ink:36})
  497. member("tst").image = cp
  498.  
  499. "roughen":
  500. if(cl = color(0, 255, 0))then
  501. var = random(20)
  502. --member("layer"&string(lr)).image.copyPixels(member("roughenTexture").image, rect(pnt, pnt)+rect(-3, -3, 4, 4), rect((var-1)*7, 0, var*7, 7), {#ink:36})
  503. repeat with lch = 0 to 6 then
  504. repeat with lcv = 0 to 6 then
  505. if(member("layer"&string(lr)).image.getPixel(pnt.locH-3+lch, pnt.locV-3+lcv) = color(0, 255, 0))then
  506. gtCl = member("roughenTexture").image.getPixel(lch+(var-1)*7, lcv)
  507. if gtCl <> color(255, 255, 255) then
  508. member("layer"&string(lr)).image.setPixel(pnt.locH-3+lch, pnt.locV-3+lcv, gtCl)
  509. end if
  510. end if
  511. end repeat
  512. end repeat
  513. end if
  514.  
  515. "Super Melt":
  516. maskImg = member("destructiveMeltMask").image
  517. cpImg = image(maskImg.width,maskImg.height,32)
  518. rct = rect(pnt-point(maskImg.width,maskImg.height)/2.0, pnt+point(maskImg.width,maskImg.height)/2.0)
  519. cpImg.copyPixels(member("layer"&string(lr)).image, cpImg.rect, rct)
  520. cpImg.copyPixels(maskImg, cpImg.rect, maskImg.rect, {#ink:36, #color:color(255, 255, 255)})
  521. mvDown = random(7)*(gEEprops.effects[r].mtrx[q2][c2]/100.0)
  522. if effectIn3D then
  523. nwLr = get3DLr(lr)
  524. else
  525. nwLr = restrict(lr -1 + random(2), 0, 29)
  526. end if
  527. if((lr > 6)and(nwLr <= 6))or((nwLr > 6)and(lr <= 6))then
  528. nwLr = lr
  529. end if
  530. member("layer"&string(nwLr)).image.copyPixels(cpImg, rct + rect(0, 0, 0, mvDown), cpImg.rect, {#ink:36})
  531.  
  532. "Destructive Melt":
  533. maskImg = member("destructiveMeltMask").image
  534. cpImg = image(maskImg.width,maskImg.height,32)
  535. rct = rect(pnt-point(maskImg.width,maskImg.height)/2.0, pnt+point(maskImg.width,maskImg.height)/2.0)
  536.  
  537. cpImg.copyPixels(member("layer"&string(lr)).image, cpImg.rect, rct)
  538. pnt = point(-2+random(3), -2+random(3))
  539. rct = rct + rect(pnt, pnt)
  540. -- cpImg.copyPixels(maskImg, cpImg.rect, maskImg.rect, {#ink:36, #color:color(255, 255, 255)})
  541. mvDown = random(7)*(gEEprops.effects[r].mtrx[q2][c2]/100.0)
  542. if effectIn3D then
  543. nwLr = get3DLr(lr)
  544. else
  545. nwLr = restrict(lr -1 + random(2), 0, 29)
  546. end if
  547. if((lr > 6)and(nwLr <= 6))or((nwLr > 6)and(lr <= 6))then
  548. nwLr = lr
  549. end if
  550. member("layer"&string(lr)).image.copyPixels(cpImg, rct + rect(0, 0, 0, mvDown), cpImg.rect, {#mask:member("destructiveMeltDestroy").image.createMask()})
  551. -- if(cl = "WHITE")then
  552. member("layer"&string(nwLr)).image.copyPixels(cpImg, rct + rect(0, 0, 0, mvDown*0.5), cpImg.rect, {#mask:member("destructiveMeltDestroy").image.createMask(), #ink:36})
  553. -- end if
  554. if(cl = "WHITE")then
  555. member("layer"&string(lr)).image.copyPixels(member("destructiveMeltDestroy").image, rect(rct.left, rct.top, rct.right, rct.bottom+mvDown), member("destructiveMeltDestroy").image.rect, {#ink:36, #color: color(255, 255, 255)})
  556. end if
  557. end case
  558. end if
  559. end repeat
  560. end repeat
  561.  
  562.  
  563. --reDrawPoles(point(q2, c2), layer, q, c, drawLayer)
  564.  
  565. end
  566.  
  567. on get3DLr(lr)
  568. nwLr = restrict(lr - 2 + random(3), 0, 29)
  569. if(lr = 6)and(nwLr=5)then
  570. nwLr = 6
  571. else if(lr = 5)and(nwLr=6)then
  572. nwLr = 5
  573. end if
  574. return nwLr
  575. end
  576.  
  577. on applyDarkSlime me, q, c
  578. q2 = q + gRenderCameraTilePos.locH
  579. c2 = c + gRenderCameraTilePos.locV
  580.  
  581. --gEEprops.effects[r].mtrx[q][c]
  582. cls = [color(255, 0,0), color(0,255, 0), color(0,0,255)]
  583.  
  584. fc = 0 + (1.0-0)* ( solidAfaMv(point(q2,c2), 1) )
  585. --lr =
  586. repeat with d = 0 to 29 then
  587. lr = d--29-d+1
  588. if (lr=0)or(lr = 10)or(lr=20) then
  589. sld = (solidMtrx[q2][c2][ 1+(lr>9)+(lr>19) ])
  590. fc = 0 + (1.0-0)* ( solidAfaMv(point(q2,c2)+gRenderCameraTilePos, 1+(lr>9)+(lr>19)) )
  591. end if
  592. deepEffect = 0
  593.  
  594. if (lr = 0)or(lr=10)or(lr=20)or(sld=0)then
  595. deepEffect = 1
  596. end if
  597.  
  598. repeat with cntr = 1 to gEEprops.effects[r].mtrx[q2][c2]*(0.2 + (0.8*deepEffect))*0.01*80*fc then
  599. if deepEffect then
  600. pnt = (point(q-1, c-1)*20)+point(random(20), random(20))
  601. else
  602. if random(2)=1 then
  603. pnt = (point(q-1, c-1)*20)+point(1 + 19*(random(2)-1), random(20))
  604. else
  605. pnt = (point(q-1, c-1)*20)+point(random(20), 1 + 19*(random(2)-1))
  606. end if
  607. end if
  608. if member("layer"&string(lr)).image.getPixel(pnt) <> color(255,255,255) then
  609. lgt = random(40)
  610. if member("layer"&string(lr)).image.getPixel(pnt+point(0,lgt)) <> color(255,255,255) then
  611. clr = cls[random(3)]
  612. member("layer"&string(lr)).image.copyPixels(member("pxl").image, rect(pnt, pnt+point(1, lgt)), rect(0,0,1,1), {#color:clr})
  613. if random(2)=1 then
  614. member("layer"&string(lr)).image.copyPixels(member("pxl").image, rect(pnt, pnt+point(1, lgt))+rect(-1, 1, -1, -1), rect(0,0,1,1), {#color:clr})
  615. else
  616. member("layer"&string(lr)).image.copyPixels(member("pxl").image, rect(pnt, pnt+point(1, lgt))+rect(1, 1, 1, -1), rect(0,0,1,1), {#color:clr})
  617. end if
  618. end if
  619. end if
  620. end repeat
  621. end repeat
  622.  
  623.  
  624. -- repeat with cnt = 1 to gEEprops.effects[r].mtrx[q][c] then
  625. -- lr = random(30)-1
  626. -- pnt = (point(q-1, c-1)*20)+point(random(20), random(20))
  627. -- if member("layer"&string(lr)).image.getPixel(pnt) <> color(255,255,255) then
  628. -- lgt = random(40)
  629. -- if member("layer"&string(lr)).image.getPixel(pnt) <> color(255,255,255) then
  630. -- member("layer"&string(lr)).image.copyPixels(member("pxl").image, rect(pnt, pnt+point(1, lgt)), rect(0,0,1,1), {#color:cls[random(3)]})
  631. -- end if
  632. -- end if
  633. -- end repeat
  634. end
  635.  
  636.  
  637. on giveAnEffectPos me, q, c, d, sld
  638. pnt = point(0,0)
  639. l = 1+(d>9)+(d>19)
  640. if (d = 0)or(d=9)or(d=19)or(sld)then--solidMtrx[q][c][l]=0) then
  641. pnt = (point(q-1, c-1)*20)+point(random(20), random(20))
  642. else
  643. if random(2)=1 then
  644. pnt = (point(q-1, c-1)*20)+point(1 + 19*(random(2)-1), random(20))
  645. else
  646. pnt = (point(q-1, c-1)*20)+point(random(20), 1 + 19*(random(2)-1))
  647. end if
  648. end if
  649.  
  650. return pnt
  651. end
  652.  
  653.  
  654.  
  655. on applyStandardPlant me, q, c, eftc, tp
  656. q2 = q + gRenderCameraTilePos.locH
  657. c2 = c + gRenderCameraTilePos.locV
  658.  
  659. amount = 17
  660. case tp of
  661. "Root Grass":
  662. amount = 12
  663. "Grass":
  664. amount = 10
  665. "Seed Pods":
  666. amount = random(5)
  667. "Cacti":
  668. amount = 3
  669. "Rain Moss":
  670. amount = 9
  671. "rubble":
  672. amount = 11
  673. "Horse Tails":
  674. amount = 1 + random(3)
  675. "Circuit Plants":
  676. amount = 2
  677. "Feather Plants":
  678. amount = 4
  679. end case
  680.  
  681.  
  682. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  683. "All":
  684. lsL = [1,2,3]
  685. "1":
  686. lsL = [1]
  687. "2":
  688. lsL = [2]
  689. "3":
  690. lsL = [3]
  691. "1:st and 2:nd":
  692. lsL = [1,2]
  693. "2:nd and 3:rd":
  694. lsL = [2,3]
  695. end case
  696.  
  697. -- gradImg = image(10,30,16)
  698. -- mskImg = image(10,30,16)
  699.  
  700. repeat with layer in lsL then
  701. if (solidMtrx[q2][c2][layer]<>1)and(solidAfaMv(point(q2,c2+1), layer)=1) then
  702. -- mdPnt = giveMiddleOfTile(point(q,c))
  703.  
  704. repeat with cntr = 1 to gEEprops.effects[r].mtrx[q2][c2]*0.01*amount then
  705. pnt = me.giveGroundPos(q,c,layer)
  706. lr = random(9) + (layer-1)*10
  707.  
  708.  
  709. case tp of
  710. "Grass":
  711. freeSides = 0
  712. if (solidAfaMv(point(q2-1,c2+1), layer)=0)then--or(afaMvLvlEdit(point(q,c), layer)=3) then
  713. --freeSides = freeSides + 1
  714. amount = amount/2
  715. end if
  716. if (solidAfaMv(point(q2+1,c2+1), layer)=0)then--or(afaMvLvlEdit(point(q,c), layer)=2) then
  717. -- freeSides = freeSides + 1
  718. amount = amount/2
  719. end if
  720.  
  721. rct = rect(pnt, pnt) + rect(-10,-20,10, 10)
  722.  
  723. rnd = random(20)
  724.  
  725. flp = random(2)-1
  726. if flp then
  727. rct = vertFlipRect(rct)
  728. end if
  729.  
  730. gtRect = rect((rnd-1)*20, 0, rnd*20, 30)+rect(1,0,1,0)
  731. member("layer"&string(lr)).image.copyPixels(member("GrassGraf").image, rct, gtRect, {#color:colr, #ink:36})
  732. if colr <> color(0,255,0) then
  733. -- pnt = depthPnt(pnt, lr-5)
  734. rct = rect(pnt, pnt) + rect(-10,-20,10, 10)
  735. if flp then
  736. rct = vertFlipRect(rct)
  737. end if
  738.  
  739. copyPixelsToEffectColor(gdLayer, lr, rct, "GrassGrad", gtRect, 0.5)
  740. -- member("gradImgMask").image.copyPixels(member("GrassGrad").image, rect(0,0,20,30), gtRect)
  741. -- member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("gradImg").image, rct, rect(0,0,20,30), {#maskImage: member("gradImgMask").image.createMask()})
  742. end if
  743.  
  744. "Root Grass":
  745. freeSides = 0
  746. if (solidAfaMv(point(q2-1,c2+1), layer)=0)then--or(afaMvLvlEdit(point(q,c), layer)=3) then
  747. freeSides = freeSides + 1
  748. end if
  749. if (solidAfaMv(point(q2+1,c2+1), layer)=0)then--or(afaMvLvlEdit(point(q,c), layer)=2) then
  750. freeSides = freeSides + 1
  751. end if
  752.  
  753. rct = rect(pnt, pnt) + rect(-5,-17,5, 3)
  754. if (freeSides > 0) or (amount<0.5) then
  755. rnd = 10+random(5)
  756. else
  757. rnd = random(10)
  758. end if
  759.  
  760. flp = random(2)-1
  761. if flp then
  762. rct = vertFlipRect(rct)
  763. end if
  764.  
  765. gtRect = rect((rnd-1)*10, 0, rnd*10, 30)+rect(1,0,1,0)
  766. member("layer"&string(lr)).image.copyPixels(member("RootGrassGraf").image, rct, gtRect, {#color:colr, #ink:36})
  767. if colr <> color(0,255,0) then
  768. -- pnt = depthPnt(pnt, lr-5)
  769. rct = rect(pnt, pnt) + rect(-5,-17,5, 3)
  770. if flp then
  771. rct = vertFlipRect(rct)
  772. end if
  773. copyPixelsToEffectColor(gdLayer, lr, rct, "RootGrassGrad", gtRect, 0.5)
  774. --member("gradImgMask").image.copyPixels(member("RootGrassGrad").image, rect(0,0,10,30), gtRect)
  775. --member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("gradImg").image, rct, rect(0,0,10,30), {#maskImage: member("gradImgMask").image.createMask()})
  776. end if
  777.  
  778. "Seed Pods":
  779. rnd = random(7)
  780. rct = rect(pnt, pnt) + rect(-10,-77,10, 3)
  781. flp = random(2)-1
  782. gtRect = rect((rnd-1)*20, 0, rnd*20, 80)+rect(1,0,1,0)
  783. if flp then
  784. rct = vertFlipRect(rct)
  785. end if
  786. member("layer"&string(lr)).image.copyPixels(member("SeedPodsGraf").image, rct, gtRect, {#color:colr, #ink:36})
  787. if colr <> color(0,255,0) then
  788. -- pnt = depthPnt(pnt, lr-5)
  789. rct = rect(pnt, pnt) + rect(-10,-77,10, 3)
  790. if flp then
  791. rct = vertFlipRect(rct)
  792. end if
  793. -- member("gradImgMask").image.copyPixels(member("SeedPodsGrad").image, rect(0,0,20,80), gtRect)
  794. -- member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("gradImg").image, rct, rect(0,0,20,80), {#maskImage: member("gradImgMask").image.createMask()})
  795. copyPixelsToEffectColor(gdLayer, lr, rct, "SeedPodsGrad", gtRect, 0.5)
  796. end if
  797.  
  798. "Circuit Plants":
  799. if(random(300) > gEEprops.effects[r].mtrx[q2][c2])then
  800. rnd = random(restrict((20*(gEEprops.effects[r].mtrx[q2][c2]-11+random(21))*0.01).integer, 1, 16))
  801. sz = 0.15+0.85*power(gEEprops.effects[r].mtrx[q2][c2]*0.01, 0.85)
  802. rct = rect(pnt, pnt) + rect(-20*sz,-95*sz,20*sz, 5)
  803. flp = random(2)-1
  804. gtRect = rect((rnd-1)*40, 0, rnd*40, 100)+rect(1,0,1,0)
  805. if flp then
  806. rct = vertFlipRect(rct)
  807. end if
  808. member("layer"&string(lr)).image.copyPixels(member("CircuitPlantGraf").image, rct, gtRect, {#color:colr, #ink:36})
  809. if(sz < 0.75)then
  810. member("layer"&string(lr)).image.copyPixels(member("CircuitPlantGraf").image, rct+rect(1,0,1,0), gtRect, {#color:colr, #ink:36})
  811. member("layer"&string(lr)).image.copyPixels(member("CircuitPlantGraf").image, rct+rect(0,1,0,1), gtRect, {#color:colr, #ink:36})
  812. end if
  813. if colr <> color(0,255,0) then
  814. rct = rect(pnt, pnt) + rect(-20*sz,-95*sz,20*sz, 5)
  815. if flp then
  816. rct = vertFlipRect(rct)
  817. end if
  818. copyPixelsToEffectColor(gdLayer, lr, rct, "CircuitPlantGrad", gtRect, 0.5)
  819. end if
  820. end if
  821.  
  822. "Feather Plants":
  823. if(random(300) > gEEprops.effects[r].mtrx[q2][c2])then
  824. leanDir = 0
  825. if(q2 > 1)then
  826. if(afaMvLvlEdit(point(q2-1,c2), layer)=0)and(afaMvLvlEdit(point(q2-1,c2+1), layer)=1)then
  827. leanDir = leanDir + gEEprops.effects[r].mtrx[q2-1][c2]
  828. else if (afaMvLvlEdit(point(q2-1,c2), layer)=1) then
  829. leanDir = leanDir - 90
  830. end if
  831. end if
  832. if(q2 < gLOprops.size.locH-1)then
  833. if(afaMvLvlEdit(point(q2+1,c2), layer)=0)and(afaMvLvlEdit(point(q2+1,c2+1), layer)=1)then
  834. leanDir = leanDir - gEEprops.effects[r].mtrx[q2+1][c2]
  835. else if (afaMvLvlEdit(point(q2+1,c2), layer)=1) then
  836. leanDir = leanDir + 90
  837. end if
  838. end if
  839.  
  840. rnd = random(restrict((20*(gEEprops.effects[r].mtrx[q2][c2]-11+random(21))*0.01).integer, 1, 16))
  841. sz = 1--0.2+0.8*power(gEEprops.effects[r].mtrx[q2][c2]*0.01, 0.85)
  842. rct = rect(pnt, pnt) + rect(-20*sz,-90*sz,20*sz, 100*sz)
  843. gtRect = rect((rnd-1)*40, 0, rnd*40, 190)+rect(1,0,1,0)
  844.  
  845. rct = rotateToQuad(rct, (65.0*((leanDir - 11 + random(21))/100.0))+0.1)
  846.  
  847. checkForSolid = (rct[1]+rct[2]+rct[3]+rct[4])/4.0
  848. if( member("layer"&string(lr)).image.getPixel(checkForSolid.locH, checkForSolid.locV) <> color(255, 255, 255))then
  849.  
  850. if(leanDir - 11 + random(21) > 0) then
  851. rct = flipQuadH(rct)
  852. end if
  853.  
  854. member("layer"&string(lr)).image.copyPixels(member("FeatherPlantGraf").image, rct, gtRect, {#color:colr, #ink:36})
  855. if colr <> color(0,255,0) then
  856. copyPixelsToEffectColor(gdLayer, lr, rct, "FeatherPlantGrad", gtRect, 0.5)
  857. end if
  858. end if
  859. end if
  860.  
  861. "Horse Tails":
  862. rnd = restrict(random(3+(20*gEEprops.effects[r].mtrx[q2][c2]*0.01).integer), 1, 14)
  863. rct = rect(pnt, pnt) + rect(-10,-48,10, 2)
  864. flp = random(2)-1
  865. gtRect = rect((rnd-1)*20, 0, rnd*20, 50)+rect(1,0,1,0)
  866. if flp then
  867. rct = vertFlipRect(rct)
  868. end if
  869. member("layer"&string(lr)).image.copyPixels(member("HorseTailGraf").image, rct, gtRect, {#color:colr, #ink:36})
  870. if colr <> color(0,255,0) then
  871. rct = rect(pnt, pnt) + rect(-10,-48,10, 2)
  872. if flp then
  873. rct = vertFlipRect(rct)
  874. end if
  875. copyPixelsToEffectColor(gdLayer, lr, rct, "HorseTailGrad", gtRect, 0.5)
  876. end if
  877.  
  878. "Cacti":
  879. repeat with rep = 1 to random(random(3)) then
  880. sz = 0.5+(random(gEEprops.effects[r].mtrx[q2][c2]*0.7)*0.01)
  881. rotat = -45+random(90)
  882. if (solidAfaMv(point(q2-1,c2+1), layer)=0)or(afaMvLvlEdit(point(q2,c2), layer)=3) then
  883. rotat = rotat - 10-random(30)
  884. end if
  885. if (solidAfaMv(point(q2+1,c2+1), layer)=0)or(afaMvLvlEdit(point(q2,c2), layer)=2) then
  886. rotat = rotat + 10+random(30)
  887. end if
  888. tpPnt = pnt + degToVec(rotat)*15*sz
  889.  
  890. rct = rotateToQuad( rect((pnt+tpPnt)*0.5,(pnt+tpPnt)*0.5)+rect(-4*sz,-7*sz,4*sz,8*sz) ,lookAtPoint(pnt, tpPnt))
  891. member("layer"&string(lr)).image.copyPixels(member("bigCircle").image, rct, member("bigCircle").image.rect, {#color:colr, #ink:36})
  892. if colr <> color(0,255,0) then
  893. -- tpPnt = depthPnt(tpPnt, lr-5)
  894. rct = rect(tpPnt,tpPnt)+rect(-9*sz,-6*sz,9*sz,13*sz)+rect(-3,-3,3,3)
  895. -- member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("softBrush1").image, rct, member("softBrush1").image.rect, {#maskImage:member("mask").image.createMask()})
  896. copyPixelsToEffectColor(gdLayer, lr, rct, "softBrush1", member("softBrush1").image.rect, 0.5)
  897. end if
  898. end repeat
  899. "Rubble":
  900. rct = rect(pnt,pnt)+rect(-3,-3,3,3)+rect(-random(3),-random(3), random(3), random(3))
  901. rct = rotateToQuad(rct,random(360))
  902. rubbl = random(4)
  903. repeat with rep = 1 to 4 then
  904. if lr+rep-1 > 29 then
  905. exit repeat
  906. else
  907. member("layer"&string(lr+rep-1)).image.copyPixels(member("rubbleGraf"&string(rubbl)).image, rct, member("rubbleGraf"&string(rubbl)).image.rect, {#color:color(0,255,0), #ink:36})
  908. end if
  909. end repeat
  910. "Rain Moss":
  911. pnt = pnt + degToVec(random(360))*random(random(100))*0.04
  912. rct = rect(pnt,pnt)+rect(-12,-12,13,13)--+rect(-random(3),-random(3), random(3), random(3))
  913. rct = rotateToQuad(rct,((random(4)-1)*90)+1)
  914. gtRect = random(4)
  915. gtRect = rect((gtRect-1)*25, 0, gtRect*25, 25)
  916. -- repeat with rep = 1 to 4 then
  917. -- if lr+rep-1 > 29 then
  918. -- exit repeat
  919. -- else
  920. member("layer"&string(lr)).image.copyPixels(member("rainMossGraf").image, rct, gtRect, {#color:colr, #ink:36})
  921. -- end if
  922. -- end repeat
  923. if (colr <> color(0,255,0)) then
  924. tpPnt = depthPnt(pnt, lr-5)+degToVec(random(360))*random(6)
  925. rct = rect(tpPnt,tpPnt)+rect(-20,-20,20,20)+rect(0,0,-15,-15)
  926. -- member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("softBrush1").image, rct, member("softBrush1").image.rect, {#maskImage:member("mask").image.createMask(), #blend:random(50)+50})
  927. copyPixelsToEffectColor(gdLayer, lr, rct, "softBrush1", member("softBrush1").image.rect, 0.5)
  928. end if
  929.  
  930. end case
  931. end repeat
  932. end if
  933. end repeat
  934. end
  935.  
  936. on giveGroundPos me, q, c,l
  937. q2 = q + gRenderCameraTilePos.locH
  938. c2 = c + gRenderCameraTilePos.locV
  939.  
  940. mdPnt = giveMiddleOfTile(point(q,c))
  941. pnt = mdPnt + point(-11+random(21), 10)
  942. --if (gLEprops.matrix[q][c][l][1]=0) then
  943. -- end if
  944. if (gLEprops.matrix[q2][c2][l][1]=3) then
  945. pnt.locV = pnt.locv - (pnt.locH-mdPnt.locH) - 5
  946. else if (gLEprops.matrix[q2][c2][l][1]=2) then
  947. pnt.locV = pnt.locv - (mdPnt.locH-pnt.locH) - 5
  948. end if
  949. return pnt
  950. end
  951.  
  952. on applyHugeFlower me, q, c, eftc
  953. q2 = q + gRenderCameraTilePos.locH
  954. c2 = c + gRenderCameraTilePos.locV
  955.  
  956. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  957. "All":
  958. d = random(30)-1
  959. "1":
  960. d = random(10)-1
  961. "2":
  962. d = random(10)-1 + 10
  963. "3":
  964. d = random(10)-1 + 20
  965. "1:st and 2:nd":
  966. d = random(20)-1
  967. "2:nd and 3:rd":
  968. d = random(20)-1 + 10
  969. end case
  970. lr = 1+(d>9)+(d>19)
  971.  
  972. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  973. mdPnt = giveMiddleOfTile(point(q,c))
  974. headPos = mdPnt+point(-11+random(21), -11+random(21))
  975. pnt = point(headPos.locH, headPos.locV)
  976.  
  977. member("layer"&string(d)).image.copyPixels(member("flowerhead").image, rect(pnt.locH-3, pnt.locV-3, pnt.locH+3, mdPnt.locV+3), member("flowerhead").image.rect, {#color:colr, #ink:36})
  978.  
  979. h = pnt.locV
  980.  
  981. repeat while h < 30000 then
  982. h = h + 1
  983. pnt.locH = pnt.locH -2 + random(3)
  984. member("layer"&string(d)).image.copyPixels(member("pxl").image, rect(pnt.locH-1, h, pnt.locH+2, h+2), member("pxl").image.rect, {#color:colr})
  985. tlPos = giveGridPos(point(pnt.locH, h)) + gRenderCameraTilePos
  986. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  987. exit repeat
  988. else if solidAfaMv(tlPos, lr) = 1 then
  989. exit repeat
  990. end if
  991.  
  992. end repeat
  993.  
  994.  
  995. -- member("gradient"&gdLayer&string(giveDpFromLr(d))).image.copyPixels(member("hugeFlowerMask").image, rect(headPos.locH-37, headPos.locV-37, headPos.locH+37, h+10), member("hugeFlowerMask").image.rect, {#maskImage:member("hugeFlowerMaskMask").image.createMask()})
  996.  
  997. copyPixelsToEffectColor(gdLayer, d, rect(headPos.locH-37, headPos.locV-37, headPos.locH+37, h+10), "hugeFlowerMaskMask", member("hugeFlowerMask").image.rect, 0.8)
  998.  
  999.  
  1000. --
  1001. --
  1002.  
  1003. -- repeat with cntr = 1 to gEEprops.effects[r].mtrx[q][c]*0.01*17 then
  1004. -- pnt = mdPnt + point(-11+random(21), -4+random(7))
  1005. -- lr = random(10)-1
  1006. -- member("layer"&string(lr)).image.copyPixels(member("pxl").image, rect(pnt.locH-1, pnt.locV, pnt.locH+2, mdPnt.locV+11), member("pxl").image.rect, {#color:color(255,255,0), #ink:36})
  1007. --
  1008. -- pnt = depthPnt(pnt, lr-5)
  1009. -- pnt2 = depthPnt(point(pnt.locH, mdPnt.locV+11), lr-5)
  1010. -- member("gradientA"&string(giveDpFromLr(lr))).image.copyPixels(member("softBrush1").image, rect(pnt pnt)+rect(-6, -6, 6, pnt2.locV-pnt.locV), member("softBrush1").image.rect, {#maskImage:member("mask").image.createMask()})
  1011. --
  1012. -- end repeat
  1013. end if
  1014. end
  1015.  
  1016. on ApplyArmGrower me, q, c, eftc
  1017. q2 = q + gRenderCameraTilePos.locH
  1018. c2 = c + gRenderCameraTilePos.locV
  1019.  
  1020. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1021. "All":
  1022. d = random(29)
  1023. "1":
  1024. d = random(9)
  1025. "2":
  1026. d = random(10)-1 + 10
  1027. "3":
  1028. d = random(10)-1 + 20
  1029. "1:st and 2:nd":
  1030. d = random(19)
  1031. "2:nd and 3:rd":
  1032. d = random(20)-1 + 10
  1033. end case
  1034. lr = 1+(d>9)+(d>19)
  1035.  
  1036.  
  1037.  
  1038. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1039. mdPnt = giveMiddleOfTile(point(q,c))
  1040. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1041. pnt = point(headPos.locH, headPos.locV)
  1042.  
  1043. lastDir = 180 - 101 + random(201)
  1044.  
  1045. points = [pnt]
  1046.  
  1047. repeat while pnt.locV < 30000 then
  1048. dir = 180 - 31 + random(61)
  1049. dir = lerp(lastDir, dir, 0.75)
  1050. lastPnt = pnt
  1051. pnt = pnt + degToVec(dir)*30.0
  1052. lastDir = dir
  1053.  
  1054. rct = (lastPnt + pnt)/2.0
  1055. rct = rect(rct, rct)
  1056. rct = rct + rect(-10, -25, 10, 25)
  1057. qd = rotateToQuad(rct, lookAtPoint(lastPnt, pnt))
  1058. if(random(2)=1)then
  1059. qd = flipQuadH(qd)
  1060. end if
  1061.  
  1062. points.add(pnt)
  1063.  
  1064. var = random(13)
  1065.  
  1066. member("layer"&string(d)).image.copyPixels(member("ArmGrowerGraf").image, qd, rect((var-1)*20, 1, var*20, 50+1), {#color:colr, #ink:36} )
  1067. tlPos = giveGridPos(pnt) + gRenderCameraTilePos
  1068. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  1069. exit repeat
  1070. else if solidAfaMv(tlPos, lr) = 1 then
  1071. exit repeat
  1072. end if
  1073.  
  1074. end repeat
  1075.  
  1076. if(points.count > 2)then
  1077. repeat with p = 1 to points.count-1 then
  1078. rct = (points[p] + points[p+1])/2.0
  1079. rct = rect(rct, rct)
  1080. rct = rct + rect(-12, -36, 12, 36)
  1081. qd = rotateToQuad(rct, lookAtPoint(points[p], points[p+1]))
  1082.  
  1083. copyPixelsToEffectColor(gdLayer, d, qd, "softBrush1", member("softBrush1").image.rect, 0.5, power((points.count-p.float+1)/points.count.float, 1.5))
  1084. end repeat
  1085. end if
  1086.  
  1087.  
  1088. -- copyPixelsToEffectColor(gdLayer, d, rect(headPos.locH-37, headPos.locV-37, headPos.locH+37, h+10), "hugeFlowerMaskMask", member("hugeFlowerMask").image.rect, 0.8)
  1089.  
  1090. end if
  1091. end
  1092.  
  1093.  
  1094. on ApplyThornGrower me, q, c, eftc
  1095. q2 = q + gRenderCameraTilePos.locH
  1096. c2 = c + gRenderCameraTilePos.locV
  1097.  
  1098. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1099. "All":
  1100. d = random(29)
  1101. "1":
  1102. d = random(9)
  1103. "2":
  1104. d = random(10)-1 + 10
  1105. "3":
  1106. d = random(10)-1 + 20
  1107. "1:st and 2:nd":
  1108. d = random(19)
  1109. "2:nd and 3:rd":
  1110. d = random(20)-1 + 10
  1111. end case
  1112. lr = 1+(d>9)+(d>19)
  1113.  
  1114.  
  1115.  
  1116. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1117. mdPnt = giveMiddleOfTile(point(q,c))
  1118. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1119. pnt = point(headPos.locH, headPos.locV)
  1120.  
  1121. lastDir = 180 - 61 + random(121)
  1122. blnd = 1
  1123. blnd2 = 1
  1124.  
  1125. wdth = 0.5
  1126.  
  1127. searchBase = 50
  1128.  
  1129. repeat while pnt.locV < 30000 then
  1130. dir = 180 - 61 + random(121)
  1131. dir = lerp(lastDir, dir, 0.35)
  1132. lastPnt = pnt
  1133. pnt = pnt + degToVec(dir)*30.0
  1134.  
  1135. if(searchBase > 0)then
  1136. moveDir = point(0,0)
  1137. repeat with tst in [point(-1,0), point(1,0), point(1,1), point(0,1), point(-1, 1)] then
  1138. tstPnt = giveGridPos(lastPnt) + gRenderCameraTilePos + tst
  1139. if(tstPnt.locH > 0)and(tstPnt.locH < gLOprops.size.locH-1)and(tstPnt.locV > 0)and(tstPnt.locV < gLOprops.size.locV-1)then
  1140. moveDir = moveDir + tst*gEEprops.effects[r].mtrx[tstPnt.locH][tstPnt.locV]
  1141. end if
  1142. end repeat
  1143. pnt = pnt + (moveDir/100.0)*searchBase
  1144. searchBase = searchBase - 1.5
  1145. pnt = lastPnt + moveToPoint(lastPnt, pnt, 30.0)
  1146. end if
  1147.  
  1148. lastDir = dir
  1149.  
  1150. rct = (lastPnt + pnt)/2.0
  1151. rct = rect(rct, rct)
  1152. rct = rct + rect(-10*wdth, -25, 10*wdth, 25)
  1153. qd = rotateToQuad(rct, lookAtPoint(lastPnt, pnt))
  1154. if(random(2)=1)then
  1155. qd = flipQuadH(qd)
  1156. end if
  1157.  
  1158. wdth = wdth + (random(1000)/1000.0)/5.0
  1159. if(wdth > 1)then
  1160. wdth = 1
  1161. end if
  1162.  
  1163. var = random(13)
  1164.  
  1165. member("layer"&string(d)).image.copyPixels(member("thornBushGraf").image, qd, rect((var-1)*20, 1, var*20, 50+1), {#color:colr, #ink:36} )
  1166. copyPixelsToEffectColor(gdLayer, d, qd, "thornBushGrad", rect((var-1)*20, 1, var*20, 50+1), 0.5, blnd)
  1167. blnd = blnd * 0.85
  1168.  
  1169. if(blnd2 > 0)then
  1170. rct = (lastPnt + pnt)/2.0
  1171. rct = rect(rct, rct)
  1172. rct = rct + rect(-12, -36, 12, 36)
  1173. qd = rotateToQuad(rct, lookAtPoint(lastPnt, pnt))
  1174.  
  1175. copyPixelsToEffectColor(gdLayer, d, qd, "softBrush1", member("softBrush1").image.rect, 0.5, blnd2)
  1176.  
  1177. blnd2 = blnd2 - 0.15
  1178. end if
  1179.  
  1180. tlPos = giveGridPos(pnt) + gRenderCameraTilePos
  1181. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  1182. exit repeat
  1183. else if solidAfaMv(tlPos, lr) = 1 then
  1184. exit repeat
  1185. end if
  1186.  
  1187. end repeat
  1188.  
  1189.  
  1190.  
  1191. -- copyPixelsToEffectColor(gdLayer, d, rect(headPos.locH-37, headPos.locV-37, headPos.locH+37, h+10), "hugeFlowerMaskMask", member("hugeFlowerMask").image.rect, 0.8)
  1192.  
  1193. end if
  1194. end
  1195.  
  1196. on ApplyGarbageSpiral me, q, c, eftc
  1197. q2 = q + gRenderCameraTilePos.locH
  1198. c2 = c + gRenderCameraTilePos.locV
  1199.  
  1200. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1201. "All":
  1202. d = random(29)
  1203. frontWall = 1
  1204. backWall = 29
  1205. if(d <= 5)then
  1206. backWall = 5
  1207. else if (d >= 6)then
  1208. frontWall = 6
  1209. end if
  1210. "1":
  1211. d = random(9)
  1212. if(d <= 5)then
  1213. backWall = 5
  1214. else if (d >= 6)then
  1215. frontWall = 6
  1216. end if
  1217. "2":
  1218. d = random(10)-1 + 10
  1219. "3":
  1220. d = random(10)-1 + 20
  1221. "1:st and 2:nd":
  1222. d = random(19)
  1223. if(d <= 5)then
  1224. backWall = 5
  1225. else if (d >= 6)then
  1226. frontWall = 6
  1227. end if
  1228. "2:nd and 3:rd":
  1229. d = random(20)-1 + 10
  1230. end case
  1231. lr = 1+(d>9)+(d>19)
  1232.  
  1233.  
  1234.  
  1235. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1236. mdPnt = giveMiddleOfTile(point(q,c))
  1237. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1238. pnt = point(headPos.locH, headPos.locV)
  1239.  
  1240. dir = random(360)
  1241. dirAdd = 40+random(20)
  1242. if(random(2)=1)then
  1243. dirAdd = -dirAdd
  1244. end if
  1245.  
  1246. grav = -0.7
  1247.  
  1248. spiralWait = 15 + random(15)
  1249. spiral = 1.0
  1250. searchBase = -8--12
  1251.  
  1252. loseSpiralTime = 60 + random(300)
  1253.  
  1254. spiralFac = lerp(0.95, 0.91, (gEEprops.effects[r].mtrx[q2][c2]/100.0) * (random(1000)/1000.0))
  1255.  
  1256. dpthSpeed = lerp(-1.0, 1.0, random(1000)/1000.0)/20.0
  1257.  
  1258. conPoints = [[pnt, d, 0]]
  1259. points = [[pnt, d, 1]]
  1260.  
  1261. cntr = 0
  1262. repeat while pnt.locV < 30000 then
  1263. cntr = cntr + 1
  1264. dir = dir + dirAdd
  1265.  
  1266. dirAdd = dirAdd * spiralFac
  1267. spiralFac = spiralFac + 0.0013
  1268. if(spiralFac > 0.993)then
  1269. spiralFac = 0.993
  1270. end if
  1271.  
  1272. lastPnt = pnt
  1273. pnt = pnt + degToVec(dir)*3.0*power(spiral, 0.5)
  1274.  
  1275. spiralWait = spiralWait - 1
  1276. if(spiralWait < 0)then
  1277. moveDir = point(0,0)
  1278. repeat with dst = 1 to 7 then
  1279. repeat with tst in [point(-1,0), point(1,0), point(1,1), point(0,1), point(-1, 1)] then
  1280. tstPnt = giveGridPos(lastPnt) + gRenderCameraTilePos + tst*dst
  1281. if(tstPnt.locH > 0)and(tstPnt.locH < gLOprops.size.locH-1)and(tstPnt.locV > 0)and(tstPnt.locV < gLOprops.size.locV-1)then
  1282. moveDir = moveDir + (tst*gEEprops.effects[r].mtrx[tstPnt.locH][tstPnt.locV])
  1283. end if
  1284. end repeat
  1285. end repeat
  1286. pnt = pnt + (moveDir/4600.0)*searchBase*(1.0-power(spiral, 0.5))
  1287. searchBase = searchBase + 0.15
  1288. if(searchBase > 12)then
  1289. searchBase = 12
  1290. end if
  1291.  
  1292.  
  1293. pnt.locV = pnt.locV + grav * (1.0-power(spiral, 0.5))
  1294. grav = grav + 0.2 * (1.0-power(spiral, 0.5))--(abs(grav) + 0.8) * 0.009 * (1.0-power(spiral, 0.5))
  1295.  
  1296.  
  1297. spiral = spiral - (1.0/loseSpiralTime.float)
  1298. if(spiral < 0)then
  1299. spiral = 0
  1300. d = d + dpthSpeed
  1301. if(d < frontWall)then
  1302. d = frontWall
  1303. else if (d > backWall) then
  1304. d = backWall
  1305. end if
  1306.  
  1307. end if
  1308. end if
  1309.  
  1310. if(random(1000) < power(spiral, 4.0)*1000)then
  1311. conPoints.add([pnt, d, cntr])
  1312. end if
  1313.  
  1314. pnt = lastPnt + moveToPoint(lastPnt, pnt, 3.0)
  1315.  
  1316. points.add([pnt, d, spiral])
  1317.  
  1318.  
  1319.  
  1320.  
  1321. tlPos = giveGridPos(pnt) + gRenderCameraTilePos
  1322. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  1323. exit repeat
  1324. else if solidAfaMv(tlPos, lr) = 1 then
  1325. exit repeat
  1326. end if
  1327.  
  1328. end repeat
  1329.  
  1330. repeat with cntr = 1 to conPoints.count then
  1331. a = conPoints[random(conPoints.count)][1]
  1332. blnd = (1.0-power(restrict(conPoints[cntr][3].float / points.count, 0, 1), 1.3))
  1333. useD = restrict(conPoints[cntr][2].integer, frontWall, backWall)
  1334. if(random(10)=1)then
  1335. qd = rect(a.locH, a.locV, a.locH+1, a.locv+random(random(100)))
  1336. member("layer"&string(points[1][2])).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr, #ink:36} )
  1337. copyPixelsToEffectColor(gdLayer, useD, qd, "pxl", rect(0,0,1,1), 0.5, blnd)
  1338. else
  1339. b = conPoints[random(conPoints.count)][1]
  1340. dir = moveToPoint(a, b, 1.0)
  1341. perp = giveDirFor90degrToLine(-dir, dir)*0.5
  1342. qd = [a - perp, a + perp, b + perp, b-perp]
  1343. member("layer"&string(points[1][2])).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr, #ink:36} )
  1344. copyPixelsToEffectColor(gdLayer, useD, qd, "pxl", rect(0,0,1,1), 0.5, blnd)
  1345. end if
  1346. end repeat
  1347.  
  1348. lastPnt = points[1][1]
  1349. lastUseD = points[1][2]
  1350. repeat with q = 1 to points.count then
  1351. pnt = points[q][1]
  1352. rct = (lastPnt + pnt)/2.0
  1353. rct = rect(rct, rct)
  1354. rct = rct + rect(-1, -2, 1, 2)
  1355. qd = rotateToQuad(rct, lookAtPoint(lastPnt, pnt))
  1356.  
  1357. useD = restrict(points[q][2].integer, frontWall, backWall)
  1358. blnd = 1.0-power(restrict(q.float / points.count, 0, 1), 1.3)
  1359. blnd = lerp(blnd, 0.5, points[q][3])
  1360. member("layer"&string(useD)).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr, #ink:36} )
  1361. copyPixelsToEffectColor(gdLayer, useD, qd, "pxl", rect(0,0,1,1), 0.5, blnd)
  1362.  
  1363. if(lastUseD <> useD)then
  1364. member("layer"&string(lastUseD)).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr, #ink:36} )
  1365. copyPixelsToEffectColor(gdLayer, lastUseD, qd, "pxl", rect(0,0,1,1), 0.5, blnd)
  1366. end if
  1367.  
  1368. lastUseD = useD
  1369. lastPnt = pnt
  1370. end repeat
  1371.  
  1372.  
  1373.  
  1374. -- copyPixelsToEffectColor(gdLayer, d, rect(headPos.locH-37, headPos.locV-37, headPos.locH+37, h+10), "hugeFlowerMaskMask", member("hugeFlowerMask").image.rect, 0.8)
  1375.  
  1376. end if
  1377. end
  1378.  
  1379.  
  1380.  
  1381.  
  1382. on ApplyRoller me, q, c, eftc
  1383. q2 = q + gRenderCameraTilePos.locH
  1384. c2 = c + gRenderCameraTilePos.locV
  1385.  
  1386.  
  1387.  
  1388. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1389. "All":
  1390. d = random(29)
  1391. frontWall = 1
  1392. backWall = 29
  1393. if(d <= 5)then
  1394. backWall = 5
  1395. else if (d >= 6)then
  1396. frontWall = 6
  1397. end if
  1398. "1":
  1399. d = random(9)
  1400. if(d <= 5)then
  1401. backWall = 5
  1402. else if (d >= 6)then
  1403. frontWall = 6
  1404. end if
  1405. "2":
  1406. d = random(10)-1 + 10
  1407. "3":
  1408. d = random(10)-1 + 20
  1409. "1:st and 2:nd":
  1410. d = random(19)
  1411. if(d <= 5)then
  1412. backWall = 5
  1413. else if (d >= 6)then
  1414. frontWall = 6
  1415. end if
  1416. "2:nd and 3:rd":
  1417. d = random(20)-1 + 10
  1418. end case
  1419. lr = 1+(d>9)+(d>19)
  1420.  
  1421.  
  1422.  
  1423. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1424. mdPnt = giveMiddleOfTile(point(q,c))
  1425. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1426. pnt = point(headPos.locH, headPos.locV)
  1427.  
  1428. dir = random(360)
  1429. dirAdd = (10+random(30))*0.3
  1430. if(random(2)=1)then
  1431. dirAdd = -dirAdd
  1432. end if
  1433.  
  1434. dspeed = (-11+random(21))/100.0
  1435.  
  1436. lastUseD = d
  1437.  
  1438. grav = 0.7
  1439.  
  1440. points = [[pnt, d]]
  1441.  
  1442. seedChance = 1.0
  1443.  
  1444. repeat while pnt.locV < 30000 then
  1445. dir = dir - 11 + random(21) + dirAdd
  1446.  
  1447. dspeed = restrict(dspeed + (-11+random(21))/1000.0, -0.1, 0.1)
  1448.  
  1449. d = d + dspeed
  1450. if(d < frontWall)then
  1451. d = frontWall
  1452. dspeed = random(10)/100.0
  1453. else if (d > backWall)then
  1454. d = backWall
  1455. dspeed = -random(10)/100.0
  1456. end if
  1457.  
  1458. lastPnt = pnt
  1459. pnt = pnt + degToVec(dir)*5.0
  1460. pnt.locV = pnt.locV + grav
  1461.  
  1462. grav = grav + 0.001
  1463.  
  1464.  
  1465.  
  1466. rct = (lastPnt + pnt)/2.0
  1467. rct = rect(rct, rct)
  1468. rct = rct + rect(-1.5, -3.5, 1.5, 3.5)
  1469. qd = rotateToQuad(rct, lookAtPoint(lastPnt, pnt))
  1470. -- if(random(2)=1)then
  1471. -- qd = flipQuadH(qd)
  1472. -- end if
  1473.  
  1474.  
  1475. -- var = random(13)
  1476.  
  1477. useD = restrict(d.integer, frontWall, backWall)
  1478.  
  1479. if(seedChance > 0)then
  1480. repeat with a = 1 to 8 then
  1481. if(random(1000)<power(seedChance, 1.5)*1000)then
  1482. seedPos = pnt + MoveToPoint(pnt, lastPnt, (diag(pnt, lastPnt)*random(1000)).float/1000.0) + degToVec(random(360))*random(3)
  1483. seedLr = restrict(useD - 2 + random(3), frontWall, backWall)
  1484. member("layer"&string(seedLr)).image.copyPixels(member("rustDot").image, rect(seedPos,seedPos)+rect(-2, -2, 2, 2), member("rustDot").image.rect, {#color:colr, #ink:36} )
  1485. copyPixelsToEffectColor(gdLayer, seedLr, rect(seedPos,seedPos)+rect(-2, -2, 2, 2), "rustDot", member("rustDot").image.rect, 0.8, 1)
  1486.  
  1487. if(random(3) > 1)then
  1488. seedLr = restrict(seedLr - 1, frontWall, backWall)
  1489. member("layer"&string(seedLr)).image.copyPixels(member("pxl").image, rect(seedPos,seedPos)+rect(-1, -1, 1, 1), member("pxl").image.rect, {#color:colr} )
  1490. copyPixelsToEffectColor(gdLayer, seedLr, rect(seedPos,seedPos)+rect(-1, -1, 1, 1), "pxl", member("pxl").image.rect, 0.8, 1)
  1491. else
  1492. member("layer"&string(seedLr)).image.copyPixels(member("pxl").image, rect(seedPos,seedPos)+rect(-1, -1, 1, 1), member("pxl").image.rect, {#color:color(255, 0, 0)} )
  1493. end if
  1494. end if
  1495. end repeat
  1496. end if
  1497. seedChance = seedChance - random(100).float/2200.0
  1498.  
  1499. points.add([pnt, useD])
  1500.  
  1501. member("layer"&string(useD)).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr} )
  1502.  
  1503.  
  1504. if(lastUseD <> useD)then
  1505. member("layer"&string(lastUseD)).image.copyPixels(member("pxl").image, qd, rect(0,0,1,1), {#color:colr} )
  1506. end if
  1507.  
  1508. lastUseD = useD
  1509.  
  1510. tlPos = giveGridPos(pnt) + gRenderCameraTilePos
  1511. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  1512. exit repeat
  1513. else if solidAfaMv(tlPos, 1 + (useD > 9) + (useD > 19)) = 1 then
  1514. exit repeat
  1515. end if
  1516.  
  1517. end repeat
  1518.  
  1519.  
  1520. if(points.count > 2)then
  1521. repeat with p = 1 to points.count-1 then
  1522. rct = (points[p][1] + points[p+1][1])/2.0
  1523. rct = rect(rct, rct)
  1524. rct = rct + rect(-1.5, -3.5, 1.5, 3.5)
  1525. qd = rotateToQuad(rct, lookAtPoint(points[p][1], points[p+1][1]))
  1526. -- copyPixelsToEffectColor(gdLayer, useD, qd, "pxl", rect(0,0,1,1), 0.8)
  1527. copyPixelsToEffectColor(gdLayer, points[p][2], qd, "pxl", rect(0,0,1,1), 0.8, power((points.count-p.float+1)/points.count.float, 1.5))
  1528. end repeat
  1529. end if
  1530.  
  1531.  
  1532. end if
  1533. end
  1534.  
  1535.  
  1536.  
  1537.  
  1538. on applyHangRoots me, q, c, eftc
  1539. q2 = q + gRenderCameraTilePos.locH
  1540. c2 = c + gRenderCameraTilePos.locV
  1541.  
  1542. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1543. "All":
  1544. d = random(30)-1
  1545. "1":
  1546. d = random(10)-1
  1547. "2":
  1548. d = random(10)-1 + 10
  1549. "3":
  1550. d = random(10)-1 + 20
  1551. "1:st and 2:nd":
  1552. d = random(20)-1
  1553. "2:nd and 3:rd":
  1554. d = random(20)-1 + 10
  1555. end case
  1556. lr = 1+(d>9)+(d>19)
  1557.  
  1558. if (gLEprops.matrix[q2][c2][lr][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1559. mdPnt = giveMiddleOfTile(point(q,c))
  1560. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1561. pnt = point(headPos.locH, headPos.locV)
  1562.  
  1563. -- member("layer"&string(d)).image.copyPixels(member("flowerhead").image, rect(pnt.locH-3, pnt.locV-3, pnt.locH+3, mdPnt.locV+3), member("flowerhead").image.rect, {#color:colr, #ink:36})
  1564. lftBorder = mdPnt.locH-10
  1565. rgthBorder = mdPnt.locH+10
  1566.  
  1567.  
  1568. repeat while pnt.locV+gRenderCameraTilePos.locV*20 > -100 then
  1569.  
  1570. -- member("layer"&string(d)).image.copyPixels(member("pxl").image, rect(pnt.locH-1, h, pnt.locH+2, h+2), member("pxl").image.rect, {#color:colr})
  1571. lstPos = pnt
  1572. pnt = pnt + degToVec(-45+random(90))*(2+random(6))
  1573. pnt.locH = restrict(pnt.locH, lftBorder, rgthBorder)
  1574. dir = moveToPoint(pnt, lstPos, 1.0)
  1575. crossDir = giveDirFor90degrToLine(-dir, dir)
  1576. qd = [pnt-crossDir, pnt+crossDir, lstPos+crossDir, lstPos-crossDir]
  1577. member("layer"&string(d)).image.copyPixels(member("pxl").image, qd, member("pxl").image.rect, {#color:gLOProps.pals[gLOProps.pal].detCol})
  1578.  
  1579. if solidAfaMv(giveGridPos(lstPos) + gRenderCameraTilePos, lr) = 1 then
  1580. exit repeat
  1581. end if
  1582.  
  1583. end repeat
  1584.  
  1585.  
  1586.  
  1587. end if
  1588. end
  1589.  
  1590.  
  1591. on applyThickRoots me, q, c, eftc
  1592. q2 = q + gRenderCameraTilePos.locH
  1593. c2 = c + gRenderCameraTilePos.locV
  1594.  
  1595. frontWall = 0
  1596. backWall = 29
  1597.  
  1598. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1599. "All":
  1600. d = random(30)-1
  1601. "1":
  1602. d = random(10)-1
  1603. backWall = 9
  1604. "2":
  1605. d = random(10)-1 + 10
  1606. frontWall = 10
  1607. backWall = 19
  1608. "3":
  1609. d = random(10)-1 + 20
  1610. frontWall = 20
  1611. "1:st and 2:nd":
  1612. d = random(20)-1
  1613. backWall = 19
  1614. "2:nd and 3:rd":
  1615. d = random(20)-1 + 10
  1616. frontWall = 10
  1617. end case
  1618.  
  1619. if(d > 5)then
  1620. frontWall = 5+3
  1621. d = restrict(d, frontWall, 29)
  1622. else
  1623. backWall = 5
  1624. end if
  1625.  
  1626.  
  1627. if (gLEprops.matrix[q2][c2][(1+(d>9)+(d>19))][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1628. mdPnt = giveMiddleOfTile(point(q,c))
  1629. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1630. pnt = point(headPos.locH, headPos.locV)
  1631.  
  1632. health = 6
  1633. points = [[pnt, d, health]]
  1634.  
  1635. dir = 0
  1636.  
  1637. floatDpth = d
  1638.  
  1639. thickness = (gEEprops.effects[r].mtrx[q2][c2]/100.0)*power(random(10000)/10000.0, 0.3)
  1640.  
  1641.  
  1642. repeat while pnt.locV+gRenderCameraTilePos.locV*20 > -100 then
  1643.  
  1644. floatDpth = floatDpth + lerp(-0.3, 0.3, random(1000)/1000.0)
  1645. if(floatDpth < frontWall)then
  1646. floatDpth = frontWall
  1647. else if(floatDpth > backWall)then
  1648. floatDpth = backWall
  1649. end if
  1650. d = restrict(floatDpth.integer, frontWall, backWall)
  1651.  
  1652. lstPos = pnt
  1653. dir = lerp(dir, -45+random(90), 0.5)
  1654. pnt = pnt + degToVec(dir)*(2+random(6))
  1655.  
  1656. lstGridPos = giveGridPos(lstPos) + gRenderCameraTilePos
  1657. gridPos = giveGridPos(pnt) + gRenderCameraTilePos
  1658.  
  1659.  
  1660. tlt = 0
  1661. repeat with q = -1 to 1 then
  1662. if (q<>0)and (gridPos.locH + q > 0)and(gridPos.locH + q < gEEprops.effects[r].mtrx.count)and(gridPos.locV-1 > 0)and(gridPos.locV-1 < gEEprops.effects[r].mtrx[1].count) then
  1663. tlt = tlt + gEEprops.effects[r].mtrx[lstGridPos.locH+q][lstGridPos.locV-1]*q
  1664. end if
  1665. end repeat
  1666. pnt.locH = pnt.locH + (tlt/100.0)*2.0
  1667. gridPos = giveGridPos(pnt) + gRenderCameraTilePos
  1668.  
  1669.  
  1670. if(lstGridPos.locH <> gridPos.locH) then
  1671. if (gridPos.locH > 0)and(gridPos.locH < gEEprops.effects[r].mtrx.count)and(gridPos.locV > 0)and(gridPos.locV < gEEprops.effects[r].mtrx[1].count) then
  1672. if (gEEprops.effects[r].mtrx[gridPos.locH][gridPos.locV] = 0)and(gEEprops.effects[r].mtrx[lstGridPos.locH][lstGridPos.locV] > 0) then
  1673. pnt.locH = restrict(pnt.locH, giveMiddleOfTile(giveGridPos(lstPos)).locH-9, giveMiddleOfTile(giveGridPos(lstPos)).locH+9)
  1674. end if
  1675. end if
  1676. end if
  1677.  
  1678.  
  1679. points.add([pnt, d, health])
  1680.  
  1681. if solidAfaMv(lstGridPos, (1+(d>9)+(d>19))) = 1 then
  1682. health = health - 1
  1683. if(health < 1) then
  1684. exit repeat
  1685. end if
  1686. else
  1687. health = restrict(health+1, 0, 6)
  1688. end if
  1689.  
  1690. end repeat
  1691.  
  1692. lstPos = points[1][1] + point(0,1)
  1693. lastRad = 0
  1694. lastPerp = point(0,0)
  1695. repeat with q = 1 to points.count then
  1696. f = q.float / points.count.float
  1697. pnt = points[q][1]
  1698. d = points[q][2]
  1699. dir = moveToPoint(pnt, lstPos, 1.0)
  1700. perp = giveDirFor90degrToLine(-dir, dir)
  1701. rad = 0.6 + f*8.0*(points[q][3].float/6.0)*lerp(0.8, 1.2, random(1000)/1000.0)*lerp(thickness, 0.5, 0.2)
  1702.  
  1703. repeat with c in [[0, 1.0], [1, 0.7], [2, 0.3]] then
  1704. if(d - c[1] >= 0)and((rad*c[2] > 0.8)or(c[1]=0))then
  1705. qd = [pnt-perp*rad*c[2], pnt+perp*rad*c[2], lstPos+dir+lastPerp*lastRad*c[2], lstPos+dir-lastPerp*lastRad*c[2]]
  1706. member("layer"&string(d - c[1])).image.copyPixels(member("pxl").image, qd, member("pxl").image.rect, {#color:color(0,255,0)})
  1707. end if
  1708. end repeat
  1709.  
  1710. lstPos = pnt
  1711. lastPerp = perp
  1712. lastRad = rad
  1713. end repeat
  1714.  
  1715.  
  1716.  
  1717. end if
  1718. end
  1719.  
  1720.  
  1721.  
  1722. on applyShadowPlants me, q, c, eftc
  1723. q2 = q + gRenderCameraTilePos.locH
  1724. c2 = c + gRenderCameraTilePos.locV
  1725.  
  1726. frontWall = 0
  1727. backWall = 29
  1728.  
  1729. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  1730. "All":
  1731. d = random(30)-1
  1732. "1":
  1733. d = random(10)-1
  1734. backWall = 9
  1735. "2":
  1736. d = random(10)-1 + 10
  1737. frontWall = 10
  1738. backWall = 19
  1739. "3":
  1740. d = random(10)-1 + 20
  1741. frontWall = 20
  1742. "1:st and 2:nd":
  1743. d = random(20)-1
  1744. backWall = 19
  1745. "2:nd and 3:rd":
  1746. d = random(20)-1 + 10
  1747. frontWall = 10
  1748. end case
  1749.  
  1750. if(d > 5)then
  1751. frontWall = 5+3
  1752. d = restrict(d, frontWall, 29)
  1753. else
  1754. backWall = 5
  1755. end if
  1756.  
  1757.  
  1758. if (gLEprops.matrix[q2][c2][(1+(d>9)+(d>19))][1]=0)then--and(afaMvLvlEdit(point(q,c+1), 1)=1) then
  1759. mdPnt = giveMiddleOfTile(point(q,c))
  1760. headPos = mdPnt+point(-11+random(21), -11+random(21))
  1761. pnt = point(headPos.locH, headPos.locV)
  1762.  
  1763. health = 6
  1764. points = [[pnt, d, health]]
  1765.  
  1766. dir = 180
  1767.  
  1768. -- floatDpth = d
  1769.  
  1770.  
  1771.  
  1772. cycle = lerp(6.0, 12.0, random(10000)/10000.0)
  1773. cntr = random(50)
  1774.  
  1775. tltFac = 0.0
  1776.  
  1777. repeat while pnt.locV+gRenderCameraTilePos.locV*20 > -100 then
  1778. cntr = cntr + 1
  1779. -- floatDpth = floatDpth + lerp(-0.3, 0.3, random(1000)/1000.0)
  1780. -- if(floatDpth < frontWall)then
  1781. -- floatDpth = frontWall
  1782. -- else if(floatDpth > backWall)then
  1783. -- floatDpth = backWall
  1784. -- end if
  1785. -- d = restrict(floatDpth.integer, frontWall, backWall)
  1786.  
  1787. lstPos = pnt
  1788. dir = lerp(dir, 180-45+random(90), 0.1)
  1789. dir = dir + sin((cntr/cycle)*PI*2.0)*8
  1790. cycle = cycle + 0.1
  1791. if(cycle > 35) then cycle = 35
  1792. pnt = pnt + degToVec(dir)*3
  1793.  
  1794. lstGridPos = giveGridPos(lstPos) + gRenderCameraTilePos
  1795. gridPos = giveGridPos(pnt) + gRenderCameraTilePos
  1796.  
  1797.  
  1798. tlt = 0
  1799. repeat with q = -1 to 1 then
  1800. if (q<>0)and (lstGridPos.locH + q > 0)and(lstGridPos.locH + q < gEEprops.effects[r].mtrx.count)and(lstGridPos.locV+1 > 0)and(lstGridPos.locV-1 < gEEprops.effects[r].mtrx[1].count) then
  1801. tlt = tlt + gEEprops.effects[r].mtrx[lstGridPos.locH+q][lstGridPos.locV+1]*q
  1802. end if
  1803. end repeat
  1804. pnt.locH = pnt.locH + (tlt/100.0)*lerp(-2.0, 1.0, power(tltFac, 0.85))
  1805. gridPos = giveGridPos(pnt) + gRenderCameraTilePos
  1806.  
  1807. tltFac = tltFac + 0.002
  1808. if(tltFac > 1.0)then tltFac = 1.0
  1809. --
  1810. --
  1811. -- if(lstGridPos.locH <> gridPos.locH) then
  1812. -- if (gridPos.locH > 0)and(gridPos.locH < gEEprops.effects[r].mtrx.count)and(gridPos.locV > 0)and(gridPos.locV < gEEprops.effects[r].mtrx[1].count) then
  1813. -- if (lstGridPos.locH > 0)and(lstGridPos.locH < gEEprops.effects[r].mtrx.count)and(lstGridPos.locV > 0)and(lstGridPos.locV < gEEprops.effects[r].mtrx[1].count) then
  1814. -- if (gEEprops.effects[r].mtrx[gridPos.locH][gridPos.locV] = 0)and(gEEprops.effects[r].mtrx[lstGridPos.locH][lstGridPos.locV] > 0) then
  1815. -- pnt.locH = restrict(pnt.locH, giveMiddleOfTile(giveGridPos(lstPos)).locH-9, giveMiddleOfTile(giveGridPos(lstPos)).locH+9)
  1816. -- end if
  1817. -- end if
  1818. -- end if
  1819. -- end if
  1820.  
  1821.  
  1822. points.add([pnt, d, health])
  1823.  
  1824. if solidAfaMv(lstGridPos, (1+(d>9)+(d>19))) = 1 then
  1825. health = health - 1
  1826. if(health < 1) then
  1827. exit repeat
  1828. end if
  1829. else
  1830. health = restrict(health+1, 0, 6)
  1831. end if
  1832.  
  1833. end repeat
  1834.  
  1835. fuzzLength = 20+random(50)
  1836.  
  1837. thickness = (gEEprops.effects[r].mtrx[q2][c2]/100.0)*power(random(10000)/10000.0, 0.3)
  1838. thickness = lerp(thickness, restrict(points.count.float, 20.0, 180.0)/180.0, 0.5)
  1839.  
  1840. lstPos = points[1][1] + point(0,1)
  1841. lastRad = 0
  1842. lastPerp = point(0,0)
  1843. repeat with q = 1 to points.count then
  1844. f = q.float / points.count.float
  1845. pnt = points[q][1]
  1846. d = points[q][2]
  1847. dir = moveToPoint(pnt, lstPos, 1.0)
  1848. perp = giveDirFor90degrToLine(-dir, dir)
  1849. --rad = 0.6 + f*8.0*(points[q][3].float/6.0)*lerp(0.8, 1.2, random(1000)/1000.0)*lerp(thickness, 0.5, 0.2)
  1850. f = sin(f*PI*0.5)
  1851. rad = 1.1 + f*7.0*(points[q][3].float/6.0)*lerp(thickness, 0.5, 0.2)
  1852.  
  1853.  
  1854.  
  1855.  
  1856. repeat with c in [[0, 1.0], [1, 0.7], [2, 0.3]] then
  1857. if(d - c[1] >= 0)and((rad*c[2] > 0.8)or(c[1]=0))then
  1858. qd = [pnt-perp*rad*c[2], pnt+perp*rad*c[2], lstPos+dir+lastPerp*lastRad*c[2], lstPos+dir-lastPerp*lastRad*c[2]]
  1859. member("layer"&string(d - c[1])).image.copyPixels(member("pxl").image, qd, member("pxl").image.rect, {#color:color(0,0,255)})
  1860.  
  1861. if(random(30) = 1)then
  1862. me.sporeGrower(pnt + MoveToPoint(pnt, lstPos, diag(pnt, lstPos)*random(10000)/10000.0), 15 + random(50) * (1.0-f), d - c[1], color(0,0,255))
  1863. end if
  1864.  
  1865. if(q < fuzzLength) and(random(fuzzLength) > q)and(random(6)=1) then
  1866. f2 = q.float / fuzzLength.float
  1867. me.sporeGrower(pnt + MoveToPoint(pnt, lstPos, diag(pnt, lstPos)*random(10000)/10000.0), 65 + random(50) * (1.0-f2), d - c[1], color(0,0,255))
  1868. end if
  1869. end if
  1870. end repeat
  1871.  
  1872. lstPos = pnt
  1873. lastPerp = perp
  1874. lastRad = rad
  1875. end repeat
  1876.  
  1877.  
  1878.  
  1879. end if
  1880. end
  1881.  
  1882. on sporeGrower me, pos, lngth, layer, col
  1883. dir = point(0, -1)
  1884.  
  1885. repeat with q = 1 to lngth then
  1886. otherCol = member("layer"&layer).image.getPixel(pos.locH-1, pos.locV-1)
  1887. if(otherCol <> col)and(otherCol <> color(255, 255, 255))then
  1888. exit repeat
  1889. else
  1890. member("layer"&layer).image.setPixel(pos.locH-1, pos.locV-1, col)
  1891. pos = pos + dir
  1892.  
  1893. if(dir.locV = -1)and(random(2)=1)then
  1894. if(random(2)=1)then
  1895. dir = point(-1, 0)
  1896. else
  1897. dir = point(1, 0)
  1898. end if
  1899. else
  1900. dir = point(0, -1)
  1901. end if
  1902. end if
  1903. end repeat
  1904. end
  1905.  
  1906.  
  1907. on applyDaddyCorruption me, q, c, amount
  1908. q2 = q + gRenderCameraTilePos.locH
  1909. c2 = c + gRenderCameraTilePos.locV
  1910.  
  1911. mdPnt = giveMiddleOfTile(point(q,c))
  1912. global daddyCorruptionHoles
  1913.  
  1914. extraHoleChance = 1
  1915.  
  1916. repeat with a = 1 to amount/2 then
  1917. dp = random(28)-1
  1918. if(dp > 3)then
  1919. dp = dp + 2
  1920. end if
  1921.  
  1922. lr = 3
  1923. rad = random(100)*0.2*lerp(0.2, 1.0, amount/100)
  1924.  
  1925. if(dp < 10)then
  1926. lr = 1
  1927. else if (dp < 20) then
  1928. lr = 2
  1929. end if
  1930.  
  1931. startPos = mdPnt+point(-11+random(21), -11+random(21))
  1932.  
  1933.  
  1934. solid = 0
  1935.  
  1936. if(solidAfaMv(point(q2,c2), lr) = 1)then
  1937. solid = 1
  1938. end if
  1939.  
  1940. if(solid = 0)and(lr < 3)and(dp - (lr-1)*10 > 6)then
  1941. if(solidAfaMv(point(q2,c2), lr+1) = 1)then
  1942. solid = 1
  1943. end if
  1944. end if
  1945.  
  1946. if(solid = 0)then
  1947. repeat with dr in [point(-1,0), point(0,-1), point(0,1), point(1,0)]then
  1948. if(solidAfaMv(giveGridPos(startPos + dr*rad)+gRenderCameraTilePos, lr) = 1)then
  1949. solid = 1
  1950. exit repeat
  1951. end if
  1952. end repeat
  1953. end if
  1954.  
  1955. if(solid = 0)and(dp < 27)and(rad > 1.2)then
  1956. repeat with dr in [point(0,0), point(-1,0), point(0,-1), point(0,1), point(1,0)]then
  1957. if( member("layer"&string(dp+2)).getPixel(startPos.locH + dr.locH*rad*0.5, startPos.locV + dr.locV*rad*0.5) <> -1)then
  1958. rad = rad / 2
  1959. solid = 1
  1960. exit repeat
  1961. end if
  1962. end repeat
  1963. end if
  1964.  
  1965. if(solid = 1)then
  1966. repeat with d = 0 to 2 then
  1967. if(dp+d < 30)then
  1968. if(rad <= 10)then
  1969. member("layer"&string(dp+d)).image.copyPixels(member("DaddyBulb").image, rect(startPos, startPos)+rect(-rad,-rad,rad,rad), rect(0, 1+d*20, 20, 1+(d+1)*20), {#ink:36})
  1970. else
  1971. member("layer"&string(dp+d)).image.copyPixels(member("DaddyBulb").image, rect(startPos, startPos)+rect(-rad,-rad,rad,rad), rect(20, 1+d*40, 60, 1+(d+1)*40), {#ink:36})
  1972. end if
  1973. else
  1974. exit repeat
  1975. end if
  1976. end repeat
  1977.  
  1978. if((random(3) = 1)or(extraHoleChance=1))and(dp<27)then
  1979. daddyCorruptionHoles.add([startPos, rad * (50+random(50))*0.01, random(360), dp, amount])
  1980. extraHoleChance = 0
  1981. end if
  1982. end if
  1983.  
  1984. end repeat
  1985.  
  1986.  
  1987. on applyHeartCorruption me, q, c, amount
  1988. q2 = q + gRenderCameraTilePos.locH
  1989. c2 = c + gRenderCameraTilePos.locV
  1990.  
  1991. mdPnt = giveMiddleOfTile(point(q,c))
  1992. global HeartCorruptionHoles
  1993.  
  1994. extraHoleChance = 1
  1995.  
  1996. repeat with a = 1 to amount/2 then
  1997. dp = random(28)-1
  1998. if(dp > 3)then
  1999. dp = dp + 2
  2000. end if
  2001.  
  2002. lr = 3
  2003. rad = random(100)*0.2*lerp(0.2, 1.0, amount/100)
  2004.  
  2005. if(dp < 10)then
  2006. lr = 1
  2007. else if (dp < 20) then
  2008. lr = 2
  2009. end if
  2010.  
  2011. startPos = mdPnt+point(-11+random(21), -11+random(21))
  2012.  
  2013.  
  2014. solid = 0
  2015.  
  2016. if(solidAfaMv(point(q2,c2), lr) = 1)then
  2017. solid = 1
  2018. end if
  2019.  
  2020. if(solid = 0)and(lr < 3)and(dp - (lr-1)*10 > 6)then
  2021. if(solidAfaMv(point(q2,c2), lr+1) = 1)then
  2022. solid = 1
  2023. end if
  2024. end if
  2025.  
  2026. if(solid = 0)then
  2027. repeat with dr in [point(-1,0), point(0,-1), point(0,1), point(1,0)]then
  2028. if(solidAfaMv(giveGridPos(startPos + dr*rad)+gRenderCameraTilePos, lr) = 1)then
  2029. solid = 1
  2030. exit repeat
  2031. end if
  2032. end repeat
  2033. end if
  2034.  
  2035. if(solid = 0)and(dp < 27)and(rad > 1.2)then
  2036. repeat with dr in [point(0,0), point(-1,0), point(0,-1), point(0,1), point(1,0)]then
  2037. if( member("layer"&string(dp+2)).getPixel(startPos.locH + dr.locH*rad*0.5, startPos.locV + dr.locV*rad*0.5) <> -1)then
  2038. rad = rad / 2
  2039. solid = 1
  2040. exit repeat
  2041. end if
  2042. end repeat
  2043. end if
  2044.  
  2045. if(solid = 1)then
  2046. repeat with d = 0 to 2 then
  2047. if(dp+d < 30)then
  2048. if(rad <= 10)then
  2049. member("layer"&string(dp+d)).image.copyPixels(member("HeartRust").image, rect(startPos, startPos)+rect(-rad,-rad,rad,rad), rect(0, 1+d*20, 20, 1+(d+1)*20), {#ink:36})
  2050. else
  2051. member("layer"&string(dp+d)).image.copyPixels(member("HeartRust").image, rect(startPos, startPos)+rect(-rad,-rad,rad,rad), rect(20, 1+d*40, 60, 1+(d+1)*40), {#ink:36})
  2052. end if
  2053. else
  2054. exit repeat
  2055. end if
  2056. end repeat
  2057.  
  2058. if((random(3) = 1)or(extraHoleChance=1))and(dp<27)then
  2059. HeartCorruptionHoles.add([startPos, rad * (50+random(50))*0.01, random(360), dp, amount])
  2060. extraHoleChance = 0
  2061. end if
  2062. end if
  2063.  
  2064. end repeat
  2065.  
  2066.  
  2067.  
  2068. end
  2069.  
  2070.  
  2071. on applyWire me, q, c, eftc
  2072. q2 = q + gRenderCameraTilePos.locH
  2073. c2 = c + gRenderCameraTilePos.locV
  2074.  
  2075. global gCurrentRenderCamera
  2076.  
  2077. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  2078. "All":
  2079. d = random(30)-1
  2080. "1":
  2081. d = random(10)-1
  2082. "2":
  2083. d = random(10)-1 + 10
  2084. "3":
  2085. d = random(10)-1 + 20
  2086. "1:st and 2:nd":
  2087. d = random(20)-1
  2088. "2:nd and 3:rd":
  2089. d = random(20)-1 + 10
  2090. end case
  2091. lr = 1+(d>9)+(d>19)
  2092.  
  2093. if (gLEprops.matrix[q2][c2][lr][1]=0)then
  2094. member("wireImage").image = image(member("layer"&string(d)).image.width, member("layer"&string(d)).image.height, 1)
  2095.  
  2096. mdPnt = giveMiddleOfTile(point(q,c))
  2097. startPos = mdPnt+point(-11+random(21), -11+random(21))
  2098.  
  2099. myCamera = me.closestCamera(startPos+gRenderCameraTilePos*20)
  2100. if(myCamera = 0)then
  2101. exit
  2102. end if
  2103.  
  2104. fatness = 1
  2105. case gEEprops.effects[r].options[3][3] of
  2106. "2px":
  2107. fatness = 2
  2108. "3px":
  2109. fatness = 3
  2110. "random":
  2111. fatness = random(3)
  2112. end case
  2113.  
  2114. a = 1.0+random(100)+random(random(random(900)))
  2115. keepItFromToForty = random(30)
  2116. a = ((a*keepItFromToForty)+40.0)/(keepItFromToForty+1.0)
  2117.  
  2118. member("wireImage").image.copypixels(member("pxl").image, rect(startPos.locH, startPos.locV-1, startPos.locH+1, startPos.locV+1)+rect(-(fatness>1), -(fatness>1), (fatness=3), (fatness=3)), rect(0,0,1,1), {#color:color(0,0,0)})
  2119. -- member("layer"&string(d)).image.copypixels(member("pxl").image, rect(startPos.locH, startPos.locV-1, startPos.locH+1, startPos.locV+1)+rect(-(fatness>1), -(fatness>1), (fatness=3), (fatness=3)), rect(0,0,1,1), {#color:color(0,255,0)})
  2120. goodStops = 0
  2121.  
  2122. repeat with dir = 0 to 1 then
  2123. pnt = point(startPos.locH, startPos.locV)
  2124. lastPnt = point(startPos.locH, startPos.locV)
  2125. repeat with rep = 1 to 1000 then
  2126.  
  2127. pnt.locH = startPos.locH +(-1 + 2*dir)*rep
  2128. pnt.locV = startPos.locV + a - (power(2.71828183, rep/a)+power(2.71828183, -rep/a))*(a/2.0)
  2129.  
  2130. dr = moveToPoint(lastPnt, pnt, fatness.float)
  2131.  
  2132. member("wireImage").image.copypixels(member("pxl").image, rect(pnt.locH, pnt.locV, pnt.locH+1, lastPnt.locV+1)+rect(-(fatness>1), -(fatness>1), (fatness=3), (fatness=3)), rect(0,0,1,1), {#color:color(0,0,0)})
  2133.  
  2134. -- member("layer"&string(d)).image.copypixels(member("pxl").image, rect(pnt.locH, pnt.locV, pnt.locH+1, lastPnt.locV+1)+rect(-(fatness>1), -(fatness>1), (fatness=3), (fatness=3)), rect(0,0,1,1), {#color:gLOProps.pals[gLOProps.pal].detCol})
  2135.  
  2136.  
  2137. lastPnt = point(pnt.locH, pnt.locV)
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143. tlPos = giveGridPos(point(pnt.locH, pnt.locV)) + gRenderCameraTilePos
  2144. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  2145. exit repeat
  2146. else
  2147. if(myCamera = gCurrentRenderCamera)and(me.seenByCamera(myCamera, pnt + gRenderCameraTilePos)=1) then
  2148. if gLEprops.matrix[tlPos.locH][tlPos.locV][lr][1] = 1 then
  2149. if member("layer"&string(d)).image.getPixel(pnt) <> color(255,255,255) then
  2150. goodStops = goodStops + 1
  2151. exit repeat
  2152. end if
  2153. end if
  2154. else
  2155. if solidAfaMv(tlPos, lr) then
  2156. goodStops = goodStops + 1
  2157. exit repeat
  2158. end if
  2159. end if
  2160. end if
  2161.  
  2162. end repeat
  2163. end repeat
  2164.  
  2165. if goodStops = 2 then
  2166. member("layer"&string(d)).image.copyPixels(member("wireImage").image, member("wireImage").image.rect, member("wireImage").image.rect, {#color:gLOProps.pals[gLOProps.pal].detCol, #ink:36})
  2167. end if
  2168. end if
  2169. end
  2170.  
  2171. on applyChain me, q, c, eftc
  2172. q2 = q + gRenderCameraTilePos.locH
  2173. c2 = c + gRenderCameraTilePos.locV
  2174.  
  2175. global gCurrentRenderCamera
  2176.  
  2177. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  2178. "All":
  2179. d = random(30)-1
  2180. "1":
  2181. d = random(10)-1
  2182. "2":
  2183. d = random(10)-1 + 10
  2184. "3":
  2185. d = random(10)-1 + 20
  2186. "1:st and 2:nd":
  2187. d = random(20)-1
  2188. "2:nd and 3:rd":
  2189. d = random(20)-1 + 10
  2190. end case
  2191.  
  2192.  
  2193. lr = 1+(d>9)+(d>19)
  2194.  
  2195. big = 0
  2196.  
  2197. case gEEprops.effects[r].options[3][3] of
  2198. "FAT":
  2199. big = 1
  2200. end case
  2201.  
  2202.  
  2203.  
  2204. if (gLEprops.matrix[q2][c2][lr][1]=0)then
  2205. member("wireImage").image = image(member("layer"&string(d)).image.width, member("layer"&string(d)).image.height, 1)
  2206. mdPnt = giveMiddleOfTile(point(q,c))
  2207. startPos = mdPnt+point(-11+random(21), -11+random(21))
  2208.  
  2209. myCamera = me.closestCamera(startPos+gRenderCameraTilePos*20)
  2210. if(myCamera = 0)then
  2211. exit
  2212. end if
  2213.  
  2214.  
  2215. a = 1.0+random(100)+random(random(random(900)))
  2216. keepItFromToForty = random(30)
  2217. a = ((a*keepItFromToForty)+40.0)/(keepItFromToForty+1.0)
  2218.  
  2219. if big then
  2220. a = a + 10
  2221. end if
  2222.  
  2223. origOrnt = random(2)-1
  2224.  
  2225. goodStops = 0
  2226. repeat with dir = 0 to 1 then
  2227. pnt = point(startPos.locH, startPos.locV)
  2228. lastPnt = point(startPos.locH, startPos.locV)
  2229. if dir = 0 then
  2230. ornt = origOrnt
  2231. else
  2232. ornt = 1-origOrnt
  2233. end if
  2234. repeat with rep = 1 to 4000 then
  2235. checkterrain = 0
  2236.  
  2237. pnt.locH = startPos.locH +(-1 + 2*dir)*rep*0.25
  2238. pnt.locV = startPos.locV + a - (power(2.71828183, (rep*0.25)/a)+power(2.71828183, -(rep*0.25)/a))*(a/2.0)
  2239.  
  2240. if big = 0 then
  2241. if diag(pnt, lastPnt)>=7 then
  2242. if ornt then
  2243. pos = (pnt+lastPnt)*0.5
  2244. rct = rect(pos,pos)+rect(-3,-5,3,5)
  2245. gtRect = rect(0,0,6,10)
  2246. ornt = 0
  2247. else
  2248. pos = (pnt+lastPnt)*0.5
  2249. rct = rect(pos,pos)+rect(-1,-5,1,5)
  2250. gtRect = rect(7,0,8,10)
  2251. ornt = 1
  2252. end if
  2253. member("wireImage").image.copypixels(member("chainSegment").image, rotateToQuad(rct, lookAtPoint(lastPnt,pnt)), gtRect, {#color:color(0,0,0), #ink:36})
  2254. lastPnt = point(pnt.locH, pnt.locV)
  2255. checkterrain = 1
  2256. end if
  2257. else
  2258. if diag(pnt, lastPnt)>=12 then
  2259. if ornt then
  2260. pos = (pnt+lastPnt)*0.5
  2261. rct = rect(pos,pos)+rect(-6,-10,6,10)
  2262. gtRect = rect(0,0,12,20)
  2263. ornt = 0
  2264. else
  2265. pos = (pnt+lastPnt)*0.5
  2266. rct = rect(pos,pos)+rect(-2,-10,2,10)
  2267. gtRect = rect(13,0,16,20)
  2268. ornt = 1
  2269. end if
  2270. member("wireImage").image.copypixels(member("bigChainSegment").image, rotateToQuad(rct, lookAtPoint(lastPnt,pnt)), gtRect, {#color:color(0,0,0), #ink:36})
  2271. lastPnt = point(pnt.locH, pnt.locV)
  2272. checkterrain = 1
  2273. end if
  2274. end if
  2275.  
  2276. if checkterrain then
  2277. tlPos = giveGridPos(point(pnt.locH, pnt.locV)) + gRenderCameraTilePos
  2278. if tlPos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) = 0 then
  2279. exit repeat
  2280. else
  2281. if(myCamera = gCurrentRenderCamera)and(me.seenByCamera(myCamera, pnt + gRenderCameraTilePos)=1) then
  2282. if gLEprops.matrix[tlPos.locH][tlPos.locV][lr][1] = 1 then
  2283. if member("layer"&string(d)).image.getPixel(pnt) <> color(255,255,255) then
  2284. goodStops = goodStops + 1
  2285. exit repeat
  2286. end if
  2287. end if
  2288. else
  2289. if solidAfaMv(tlPos, lr) then
  2290. goodStops = goodStops + 1
  2291. exit repeat
  2292. end if
  2293. end if
  2294. end if
  2295. end if
  2296.  
  2297.  
  2298. end repeat
  2299. end repeat
  2300.  
  2301.  
  2302. if goodStops = 2 then
  2303. member("layer"&string(d)).image.copyPixels(member("wireImage").image, member("wireImage").image.rect, member("wireImage").image.rect, {#color:gLOProps.pals[gLOProps.pal].detCol, #ink:36})
  2304. end if
  2305. end if
  2306. end
  2307.  
  2308. on applyFungiFlower me, q, c
  2309. q2 = q + gRenderCameraTilePos.locH
  2310. c2 = c + gRenderCameraTilePos.locV
  2311.  
  2312. lr = 1
  2313. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  2314. "1":
  2315. layer = 1
  2316. "2":
  2317. layer = 2
  2318. "3":
  2319. layer = 3
  2320. end case
  2321.  
  2322. lr = ((layer-1)*10) + random(9) - 1
  2323.  
  2324.  
  2325.  
  2326. if (afaMvLvlEdit(point(q2,c2), layer)=0) then
  2327. rnd = 0
  2328. if (afaMvLvlEdit(point(q2,c2+1), layer)=1) then
  2329. rnd = gEffectProps.list[gEffectProps.listPos]
  2330. flp = random(2)-1
  2331. closestEdge = 1000
  2332. repeat with a = - 5 to 5 then
  2333. if (afaMvLvlEdit(point(q2+a,c2+1), layer)<>1) then
  2334. if abs(a) <= abs(closestEdge) then
  2335. flp = (a>0)
  2336. closestEdge = a
  2337. if a = 0 then
  2338. flp = random(2)-1
  2339. end if
  2340. end if
  2341. end if
  2342. end repeat
  2343.  
  2344. pnt = giveMiddleOfTile(point(q,c))+point(-10+random(20), 10)
  2345. else if (afaMvLvlEdit(point(q2+1,c2), layer)=1) then
  2346. rnd = 1
  2347. flp = 0
  2348. pnt = giveMiddleOfTile(point(q,c))+point(10, -random(10))
  2349. else if (afaMvLvlEdit(point(q2-1,c2), layer)=1) then
  2350. rnd = 1
  2351. flp = 1
  2352. pnt = giveMiddleOfTile(point(q2,c2))+point(-10, -random(10))
  2353. end if
  2354.  
  2355.  
  2356. if rnd <> 0 then
  2357. rct = rect(pnt, pnt) + rect(-80, -80, 80, 80)
  2358. gtRect = rect((rnd-1)*160, 0, rnd*160, 160)+rect(1,0,1,0)
  2359. if flp then
  2360. rct = vertFlipRect(rct)
  2361. end if
  2362. member("layer"&string(lr)).image.copyPixels(member("fungiFlowersGraf").image, rct, gtRect, {#ink:36})
  2363. end if
  2364. end if
  2365.  
  2366.  
  2367. gEffectProps.listPos = gEffectProps.listPos + 1
  2368. if gEffectProps.listPos > gEffectProps.list.count then
  2369. l = [2,3,4,5]
  2370. l2 = []
  2371. repeat with a = 1 to 4 then
  2372. val = l[random(l.count)]
  2373. l2.add(val)
  2374. l.deleteOne(val)
  2375. end repeat
  2376. gEffectProps = [#list:l2, #listPos:1]
  2377. end if
  2378. end
  2379.  
  2380.  
  2381. on applyLHFlower me, q, c
  2382. q2 = q + gRenderCameraTilePos.locH
  2383. c2 = c + gRenderCameraTilePos.locV
  2384.  
  2385. lr = 1
  2386. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  2387. "1":
  2388. layer = 1
  2389. "2":
  2390. layer = 2
  2391. "3":
  2392. layer = 3
  2393. end case
  2394. lr = ((layer-1)*10) + random(9) - 1
  2395. if (afaMvLvlEdit(point(q2,c2), layer)=0) then
  2396.  
  2397. rnd = gEffectProps.list[gEffectProps.listPos]
  2398. flp = random(2)-1
  2399. pnt = giveMiddleOfTile(point(q,c))+point(-10+random(20), 10)
  2400.  
  2401. rct = rect(pnt, pnt) + rect(-40, -160, 40, 20)
  2402. gtRect = rect((rnd-1)*80, 0, rnd*80, 180)+rect(1,0,1,0)
  2403. if flp then
  2404. rct = vertFlipRect(rct)
  2405. end if
  2406. member("layer"&string(lr)).image.copyPixels(member("lightHouseFlowersGraf").image, rct, gtRect, {#ink:36})
  2407. end if
  2408.  
  2409.  
  2410. gEffectProps.listPos = gEffectProps.listPos + 1
  2411. if gEffectProps.listPos > gEffectProps.list.count then
  2412. l = [1,2,3,4,5,6,7,8]
  2413. l2 = []
  2414. repeat with a = 1 to 8 then
  2415. val = l[random(l.count)]
  2416. l2.add(val)
  2417. l.deleteOne(val)
  2418. end repeat
  2419. gEffectProps = [#list:l2, #listPos:1]
  2420. end if
  2421. end
  2422.  
  2423. on applyBigPlant me, q, c
  2424. q2 = q + gRenderCameraTilePos.locH
  2425. c2 = c + gRenderCameraTilePos.locV
  2426.  
  2427. lr = 1
  2428. case gEEprops.effects[r].options[2][3] of
  2429. "1":
  2430. layer = 1
  2431. "2":
  2432. layer = 2
  2433. "3":
  2434. layer = 3
  2435. end case
  2436.  
  2437. mem = "fern"
  2438. case gEEprops.effects[r].nm of
  2439. "Fern":
  2440. "Giant Mushroom":
  2441. mem = "giantMushroom"
  2442. end case
  2443.  
  2444. lr = ((layer-1)*10) + random(9) - 1
  2445. if (afaMvLvlEdit(point(q2,c2), layer)=0) then
  2446.  
  2447. rnd = gEffectProps.list[gEffectProps.listPos]
  2448. flp = random(2)-1
  2449. pnt = giveMiddleOfTile(point(q,c))+point(-10+random(20), 10)
  2450.  
  2451. rct = rect(pnt, pnt) + rect(-50, -80, 50, 20)
  2452. gtRect = rect((rnd-1)*100, 0, rnd*100, 100)+rect(1,1,1,1)
  2453. if flp then
  2454. rct = vertFlipRect(rct)
  2455. end if
  2456. member("layer"&string(lr)).image.copyPixels(member(mem&"Graf").image, rct, gtRect, {#ink:36, #color:colr})
  2457.  
  2458. pnt = depthPnt(pnt, lr-5)
  2459. rct = rect(pnt, pnt) + rect(-50, -80, 50, 20)
  2460. if flp then
  2461. rct = vertFlipRect(rct)
  2462. end if
  2463. -- member("gradient"&gdLayer&string(giveDpFromLr(lr))).image.copyPixels(member("bigPlantBlack").image, rct, rect((rnd-1)*100, 0, rnd*100, 100)+rect(1,1,1,1), {#maskImage:member(mem&"Grad").image.createMask()})
  2464. copyPixelsToEffectColor(gdLayer, lr, rct, mem&"Grad",rect((rnd-1)*100, 0, rnd*100, 100)+rect(1,1,1,1), 0.5)
  2465.  
  2466.  
  2467. end if
  2468.  
  2469.  
  2470. gEffectProps.listPos = gEffectProps.listPos + 1
  2471. if gEffectProps.listPos > gEffectProps.list.count then
  2472. l = [1,2,3,4,5,6,7,8]
  2473. l2 = []
  2474. repeat with a = 1 to 8 then
  2475. val = l[random(l.count)]
  2476. l2.add(val)
  2477. l.deleteOne(val)
  2478. end repeat
  2479. gEffectProps = [#list:l2, #listPos:1]
  2480. end if
  2481. end
  2482.  
  2483.  
  2484. on apply3Dsprawler me, q, c, effc
  2485. q2 = q + gRenderCameraTilePos.locH
  2486. c2 = c + gRenderCameraTilePos.locV
  2487.  
  2488. big = 0
  2489. if c > 1 then
  2490. big = (gEEprops.effects[r].mtrx[q2][c2-1] > 0)
  2491. end if
  2492.  
  2493. lr = 1
  2494. case gEEprops.effects[r].options[2][3] of
  2495. "1":
  2496. layer = 1
  2497. "2":
  2498. layer = 2
  2499. lrRange = [6, 29]
  2500. "3":
  2501.  
  2502. layer = 3
  2503. lrRange = [6, 29]
  2504. end case
  2505.  
  2506. lr = ((layer-1)*10) + random(9) - 1
  2507.  
  2508. if layer = 1 then
  2509. if lr < 5 then
  2510. lrRange = [0, 5]
  2511. else
  2512. lrRange = [6, 29]
  2513. end if
  2514. end if
  2515.  
  2516. case effc of
  2517. "sprawlBush":
  2518. sts = [#branches:10+random(10)+15*big, #expectedBranchLife:[#small:20, #big:35, #smallRandom:30, #bigRandom:70], #startTired:0, #avoidWalls:1.0, #generalDir:0.6, #randomDir:1.2, #step:6.0]
  2519. "featherFern":
  2520. sts = [#branches:3+random(3)+3*big, #expectedBranchLife:[#small:130, #big:200, #smallRandom:50, #bigRandom:100], #startTired:-77 - (77*big), #avoidWalls:0.6, #generalDir:1.2, #randomDir:0.6, #step:2.0, #featherCounter:0, #airRoots:0]
  2521. "Fungus Tree":
  2522. sts = [#branches:10+random(10)+15*big, #expectedBranchLife:[#small:30, #big:60, #smallRandom:15, #bigRandom:30], #startTired:0, #avoidWalls:0.8, #generalDir:0.8, #randomDir:1.0, #step:3.0, thickness:(6+random(3))*(1+big*0.4), #branchPoints:[]]
  2523.  
  2524. end case
  2525.  
  2526.  
  2527. if (afaMvLvlEdit(point(q2,c2), layer)=0)and(afaMvLvlEdit(point(q2,c2+1), layer)=1) then
  2528.  
  2529. pnt = giveMiddleOfTile(point(q,c))+point(-10+random(20), 10)
  2530.  
  2531. case effc of
  2532. "Fungus Tree":
  2533.  
  2534. if big then
  2535. expectedLife = sts.expectedBranchLife.big+random(sts.expectedBranchLife.bigRandom)
  2536. else
  2537. expectedLife = sts.expectedBranchLife.small+random(sts.expectedBranchLife.smallRandom)
  2538. end if
  2539. sts.branchPoints = [[#pos:pnt, #dir:point(0,-1), #thickness:sts.thickness, #layer:lr, #lifeLeft:expectedLife, #tired:sts.startTired]]
  2540.  
  2541. end case
  2542.  
  2543. repeat with branches = 1 to sts.branches then
  2544. pos = point(pnt.loch, pnt.locv)
  2545. lstPos = point(pnt.loch, pnt.locv)
  2546. generalDir = degToVec(-60+random(120))
  2547. lstAimPnt = generalDir
  2548. brLr = lr
  2549.  
  2550. brLrDir = 101 + random(201)
  2551. avoidWalls = 2.0
  2552.  
  2553. tiredNess = sts.startTired
  2554.  
  2555. if big then
  2556. expectedLife = sts.expectedBranchLife.big+random(sts.expectedBranchLife.bigRandom)
  2557. else
  2558. expectedLife = sts.expectedBranchLife.small+random(sts.expectedBranchLife.smallRandom)
  2559. end if
  2560.  
  2561. case effc of
  2562. "featherFern":
  2563. sts.airRoots = 25+15*big
  2564. "Fungus Tree":
  2565. branch = sts.branchPoints[random(sts.branchPoints.count)]
  2566. sts.branchPoints.deleteOne(branch)
  2567.  
  2568. baseThickness = branch.thickness
  2569. pos = branch.pos
  2570. lstPos = branch.pos
  2571. brLr = branch.layer
  2572. generalDir = branch.dir
  2573. lstAimPnt = branch.dir
  2574. tiredNess = branch.tired
  2575. expectedLife = restrict(branch.lifeLeft - 11 + random(21), 5, 200)
  2576. startLifeTime = expectedLife
  2577. end case
  2578.  
  2579. repeat with step = 1 to expectedLife then
  2580. lstPos = pos
  2581.  
  2582. case effc of
  2583. "featherFern":
  2584. tiredNess = tiredNess + 0.5 + abs(tiredNess*0.05) - 0.3*big
  2585. "Fungus Tree":
  2586. tiredNess = -90*(1.0-((startLifeTime-step)/startLifeTime.float))
  2587. end case
  2588.  
  2589. aimPnt = generalDir*sts.generalDir+degToVec(random(360))*sts.randomDir + point(0, tiredNess*0.01)
  2590.  
  2591. repeat with dir in [point(-1,0), point(-1,-1), point(0,-1), point(1,-1), point(1,0), point(1,1), point(0,1), point(-1,1)] then
  2592. if (afaMvLvlEdit(giveGridPos(lstPos)+dir+gRenderCameraTilePos, ((brLr/10.0)-0.4999).integer+1)=1) then
  2593. aimPnt = aimPnt - dir*avoidWalls
  2594. avoidWalls = restrict(avoidWalls - 0.06, 0.2, 2)
  2595. step = step + (effc <> "Fungus Tree")
  2596. else
  2597. aimPnt = aimPnt + dir*0.1
  2598. end if
  2599. end repeat
  2600.  
  2601. avoidWalls = restrict(avoidWalls + 0.03, 0.2, 2)
  2602.  
  2603. lstLayer = brLr
  2604.  
  2605.  
  2606. brLr = brLr + brLrDir*0.01
  2607.  
  2608. smllst = lrRange[1]
  2609. if ((lstLayer/10.0)-0.4999).integer+1 > 1 then
  2610. if (afaMvLvlEdit(giveGridPos(pos)+gRenderCameraTilePos, ((lstLayer/10.0)-0.4999).integer+1-1)=1) then
  2611. wall = ((lstLayer/10.0)-0.4999).integer*10
  2612. if wall > 0 then
  2613. wall = wall - 1
  2614. end if
  2615. smllst = restrict(smllst, wall, 0)
  2616. end if
  2617. end if
  2618.  
  2619. bggst = lrRange[2]
  2620. if ((lstLayer/10.0)-0.4999).integer+1 < 3 then
  2621. if (afaMvLvlEdit(giveGridPos(pos)+gRenderCameraTilePos, ((lstLayer/10.0)-0.4999).integer+1+1)=1) then
  2622. wall = ((restrict(lstLayer, 1, 29)/10.0)+0.4999).integer*10 -1
  2623. bggst = restrict(bggst, 0, wall)
  2624. end if
  2625. end if
  2626.  
  2627. if brLr < smllst then
  2628. brLr = smllst
  2629. brLrDir = random(41)
  2630. end if
  2631. if brLr > bggst then
  2632. brLr = bggst
  2633. brLrDir = -random(41)
  2634. end if
  2635.  
  2636.  
  2637. -- aimPnt = aimPnt + point(0, tiredNess*0.01)
  2638.  
  2639. aimPnt = (aimPnt + lstAimPnt + lstAimPnt)/3.0
  2640.  
  2641. lstAimPnt = aimPnt
  2642.  
  2643. pos = pos + moveToPoint(point(0,0), aimPnt, sts.step)
  2644.  
  2645. pstColor = 0
  2646.  
  2647. case effc of
  2648. "featherFern":
  2649. if sts.airRoots > 0 then
  2650. sts.featherCounter = 20
  2651. sts.airRoots = sts.airRoots - 1
  2652. end if
  2653.  
  2654.  
  2655. sts.featherCounter = sts.featherCounter + diag(pos, lstPos)*0.5 + abs(pos.locH - lstPos.locH) + abs(lstLayer-brLr)
  2656. if sts.featherCounter > 8 + ((expectedLife-step)/expectedLife.float)*12 then
  2657. sts.featherCounter = sts.featherCounter - (8 + ((expectedLife-step)/expectedLife.float)*12)
  2658.  
  2659. fc = ((expectedLife-step)/expectedLife.float)
  2660. fc = 1.0-fc
  2661. fc = fc*fc
  2662. fc = 1.0-fc
  2663.  
  2664. lngth = sin(fc*PI)* (abs(pos.locV-pnt.locV) + 120)/3.0
  2665.  
  2666.  
  2667. repeat with cntr = 1 to sts.airRoots then
  2668. lngth = (lngth*6.0 + (abs(pos.locV-pnt.locV)+4))/7.0
  2669. end repeat
  2670. -- put (expectedLife-step)/expectedLife.float && lngth
  2671.  
  2672. repeat with rct in [rect(pos, pos) + rect(0, 0, 1, lngth), rect(pos, pos) + rect(1, 0, 2, lngth-random(random(random(lngth.integer+1))))] then
  2673. member("layer"&string(brLr.integer)).image.copyPixels(member("pxl").image, rct, member("pxl").image.rect, {#ink:36, #color:colr})
  2674. end repeat
  2675.  
  2676. copyPixelsToEffectColor(gdLayer, brLr, rect(pos, pos) + rect(-6, 0, 6, lngth+2), "featherFernGradient", member("featherFernGradient").rect, 0.5)
  2677.  
  2678. pstColor = 1
  2679. end if
  2680.  
  2681. fc = ((expectedLife-step)/expectedLife.float)
  2682. fc = fc*fc
  2683.  
  2684. ftness = sin(fc*PI)*(4+1*big)
  2685. rct = rect(pos, pos) + rect(-1, -3, 1, 3)+rect(-ftness, -ftness, ftness, ftness)
  2686.  
  2687.  
  2688. rct = rotateToQuad( rct ,lookAtPoint(pos, lstPos))
  2689.  
  2690.  
  2691. brLrDir = brLrDir -4 + random(7)
  2692. "sprawlBush":
  2693. rct = rect(pos, pos) + rect(-2, -5, 2, 5)
  2694. rct = rotateToQuad( rct ,lookAtPoint(pos, lstPos))
  2695.  
  2696. brLrDir = brLrDir -11 + random(21)
  2697.  
  2698. pstColor = 1
  2699.  
  2700. "Fungus Tree":
  2701.  
  2702. thickness = ((startLifeTime-step)/startLifeTime.float)*baseThickness
  2703.  
  2704. sts.branchPoints.add([#pos:pos, #dir:moveToPoint(point(0,0), aimPnt, 1.0), #thickness:thickness, #layer:brLr, #lifeLeft:startLifeTime-step, #tired:tiredNess])
  2705.  
  2706.  
  2707. if step = expectedLife then
  2708. rnd = random(5)
  2709. rct = rect(pos, pos)+rect(-5, -19, 5, 1)
  2710. if random(2)=1 then
  2711. rct = vertFlipRect(rct)
  2712. end if
  2713. member("layer"&string(brLr.integer)).image.copyPixels(member("fungusTreeTops").image, rct, rect((rnd-1)*10, 1, rnd*10, 21), {#ink:36, #color:colr})
  2714. copyPixelsToEffectColor(gdLayer, brLr, rect(pos, pos)+rect(-7, -11, 7, 3), "softBrush1", member("softBrush1").rect, 0.5)
  2715. end if
  2716.  
  2717. rct = rect(pos, pos) + rect(-1, -3, 1, 3)+rect(-thickness, -thickness, thickness, thickness)
  2718. rct = rotateToQuad( rct ,lookAtPoint(pos, lstPos))
  2719.  
  2720. brLrDir = brLrDir -11 + random(21)
  2721.  
  2722. pstColor = 1
  2723.  
  2724.  
  2725. end case
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731. member("layer"&string(brLr.integer)).image.copyPixels(member("blob").image, rct, member("blob").image.rect, {#ink:36, #color:colr})
  2732. member("layer"&string(lstLayer.integer)).image.copyPixels(member("blob").image, rct, member("blob").image.rect, {#ink:36, #color:colr})
  2733.  
  2734. if pstColor then
  2735. blnd = (1.0-((expectedLife - step)/expectedLife.float))*25 + random((1.0-((expectedLife - step)/expectedLife.float))*75)
  2736. if effc = "Fungus Tree" then
  2737. blnd = (1.0-((expectedLife - step)/expectedLife.float))*100
  2738. end if
  2739. member("softbrush2").image.copypixels(member("pxl").image, member("softbrush2").image.rect, rect(0,0,1,1), {#color:color(255,255,255)})
  2740. member("softbrush2").image.copypixels(member("softbrush1").image, member("softbrush2").image.rect, member("softbrush1").image.rect, {#blend:blnd})
  2741. copyPixelsToEffectColor(gdLayer, brLr, rotateToQuad(rect(pos, pos) + rect(-17, -25, 17, 25),lookAtPoint(pos, lstPos)), "softBrush2", member("softBrush1").rect, 0.5)
  2742. end if
  2743.  
  2744. end repeat
  2745. end repeat
  2746.  
  2747.  
  2748. end if
  2749. end
  2750.  
  2751.  
  2752. on applyBlackGoo me, q, c, eftc
  2753. sPnt = giveMiddleOfTile(point(q,c))+point(-10,-10)
  2754. rct = member("blob").image.rect
  2755. repeat with d = 1 to 10 then
  2756. repeat with e = 1 to 10 then
  2757. ps = point(sPnt.locH + d*2, sPnt.locV + e*2)
  2758. if member("layer0").image.getPixel(ps) = color(255, 255, 255) then
  2759. member("blackOutImg1").image.copyPixels(member("blob").image, rect(ps.locH-6-random(random(11)),ps.locV-6-random(random(11)),ps.locH+6+random(random(11)),ps.locV+6+random(random(11))), rct, {#color:0, #ink:36})
  2760. member("blackOutImg2").image.copyPixels(member("blob").image, rect(ps.locH-7-random(random(14)),ps.locV-7-random(random(14)),ps.locH+7+random(random(14)),ps.locV+7+random(random(14))), rct, {#color:0, #ink:36})
  2761. end if
  2762. end repeat
  2763. end repeat
  2764. end
  2765.  
  2766. on applyRestoreEffect me, q, c, q2, c2, eftc
  2767.  
  2768. case gEEprops.effects[r].options[2][3] of--["All", "1", "2", "3", "1:st and 2:nd", "2:nd and 3:rd"]
  2769. "All":
  2770. layers = [1,2,3]
  2771. "1":
  2772. layers = [1]
  2773. "2":
  2774. layers = [2]
  2775. "3":
  2776. layers = [3]
  2777. "1:st and 2:nd":
  2778. layers = [1,2]
  2779. "2:nd and 3:rd":
  2780. layers = [2,3]
  2781. end case
  2782.  
  2783. repeat with layer in layers then
  2784. if(afaMvLvlEdit(point(q2, c2), layer)=1)then
  2785. mdPoint = giveMiddleOfTile(point(q,c))
  2786. tlRct = rect(mdPoint+point(-10, -10), mdPoint+point(10,10))
  2787.  
  2788. -- member("layer" & lr).image.copyPixels(member("pxl").image, rect(mdPoint-point(10, 10), mdPoint+point(10,10)), rect(0,0,1,1), {#color:color(255, 0, 0)})
  2789. --
  2790.  
  2791. A = 2
  2792. B = 1
  2793.  
  2794. U = A
  2795. if(me.isTileSolidAndAffected(point(q2-1, c2), layer) = 1)then
  2796. U = B
  2797. end if
  2798. repeat with lr = ((layer-1)*10) + 4 to ((layer-1)*10) + 6 then
  2799. member("layer" & lr).image.copyPixels(member("pxl").image, rect(mdPoint+point(-10, -10), mdPoint+point(-10+U,10)), rect(0,0,1,1), {#color:color(255, 0, 0)})
  2800. end repeat
  2801. me.draw3DBeams(q2, c2, layer, tlRct, [1,4], U)
  2802.  
  2803. U = A
  2804. if(me.isTileSolidAndAffected(point(q2+1, c2), layer) = 1)then
  2805. U = B
  2806. end if
  2807. repeat with lr = ((layer-1)*10) + 4 to ((layer-1)*10) + 6 then
  2808. member("layer" & lr).image.copyPixels(member("pxl").image, rect(mdPoint+point(10-U, -10), mdPoint+point(10,10)), rect(0,0,1,1), {#color:color(255, 0, 0)})
  2809. end repeat
  2810. me.draw3DBeams(q2, c2, layer, tlRct, [2,3], U)
  2811.  
  2812. U = A
  2813. if(me.isTileSolidAndAffected(point(q2, c2-1), layer) = 1)then
  2814. U = B
  2815. end if
  2816. repeat with lr = ((layer-1)*10) + 4 to ((layer-1)*10) + 6 then
  2817. member("layer" & lr).image.copyPixels(member("pxl").image, rect(mdPoint+point(-10, -10), mdPoint+point(10,-10+U)), rect(0,0,1,1), {#color:color(255, 0, 0)})
  2818. end repeat
  2819. me.draw3DBeams(q2, c2, layer, tlRct, [1,2], U)
  2820.  
  2821. U = A
  2822. if(me.isTileSolidAndAffected(point(q2, c2+1), layer) = 1)then
  2823. U = B
  2824. end if
  2825. repeat with lr = ((layer-1)*10) + 4 to ((layer-1)*10) + 6 then
  2826. member("layer" & lr).image.copyPixels(member("pxl").image, rect(mdPoint+point(-10, 10-U), mdPoint+point(10,10)), rect(0,0,1,1), {#color:color(255, 0, 0)})
  2827. end repeat
  2828. me.draw3DBeams(q2, c2, layer, tlRct, [3,4], U)
  2829.  
  2830. end if
  2831. reDrawPoles(point(q2,c2), layer, q, c, ((layer-1)*10) + 4)
  2832. end repeat
  2833. end
  2834.  
  2835. on draw3DBeams me, q2, c2, layer, tlRct, crnrs, U
  2836. if(layer > 1) then
  2837. if(me.isTileSolidAndAffected(point(q2, c2), layer-1) = 1)then
  2838. repeat with crnr in crnrs then
  2839. rct = CornerRect(tlRct, crnr, U)
  2840. repeat with lr = ((layer-1)*10) - 5 to ((layer-1)*10) + 5 then
  2841. member("layer" & lr).image.copyPixels(member("pxl").image, rct, rect(0,0,1,1), {#color:color(255, 0, 0)})
  2842. end repeat
  2843. end repeat
  2844. end if
  2845. end if
  2846. if(layer < 3) then
  2847. if(me.isTileSolidAndAffected(point(q2, c2), layer+1) = 1)then
  2848. rct = CornerRect(tlRct, crnr, U)
  2849. repeat with crnr in crnrs then
  2850. repeat with lr = ((layer-1)*10) + 5 to ((layer-1)*10) + 15 then
  2851. member("layer" & lr).image.copyPixels(member("pxl").image, rct, rect(0,0,1,1), {#color:color(255, 0, 0)})
  2852. end repeat
  2853. end repeat
  2854. end if
  2855. end if
  2856. end
  2857.  
  2858.  
  2859. on CornerRect(tlRct, crnr, U)
  2860. -- tlRct = tlRct+rect(1,1,-1,-1)
  2861. case crnr of
  2862. 1:
  2863. return rect(tlRct.left, tlRct.top, tlRct.left+U, tlRct.top+U)
  2864. 2:
  2865. return rect(tlRct.right-U, tlRct.top, tlRct.right, tlRct.top+U)
  2866. 3:
  2867. return rect(tlRct.right-U, tlRct.bottom-U, tlRct.right, tlRct.bottom)
  2868. 4:
  2869. return rect(tlRct.left, tlRct.bottom-U, tlRct.left+U, tlRct.bottom)
  2870. end case
  2871. end
  2872.  
  2873. on isTileSolidAndAffected me, tl, layer
  2874. if(afaMvLvlEdit(point(tl.locH, tl.locV), layer)<>1)or(tl.locH<1)or(tl.locV<1)or(tl.locH > gLOprops.size.locH)or(tl.locV > gLOprops.size.locV)then
  2875. return 0
  2876. else if (gEEprops.effects[r].mtrx[tl.locH][tl.locV] > 0)then
  2877. return 1
  2878. else
  2879. return 0
  2880. end if
  2881. end
  2882.  
  2883.  
  2884.  
  2885. on reDrawPoles(pos, layer, q, c, drawLayer)
  2886. global gLEProps, gLOprops
  2887. if pos.inside(rect(1,1,gLOprops.size.loch+1,gLOprops.size.locv+1)) then
  2888. repeat with t in gLEProps.matrix[pos.locH][pos.locV][layer][2] then
  2889. case t of
  2890. 1:
  2891. rct = rect((q-1)*20, (c-1)*20, q*20, c*20)+rect(0, 8, 0, -8)--rect(gRenderCameraTilePos,gRenderCameraTilePos)*20
  2892. member("layer" & drawLayer).image.copyPixels(member("pxl").image, rct, member("pxl").image.rect, {color:color(255, 0, 0)})
  2893. 2:
  2894. rct = rect((q-1)*20, (c-1)*20, q*20, c*20)+rect(8, 0, -8, 0)--rect(gRenderCameraTilePos,gRenderCameraTilePos)*20
  2895. member("layer" & drawLayer).image.copyPixels(member("pxl").image, rct, member("pxl").image.rect, {color:color(255, 0, 0)})
  2896. end case
  2897. end repeat
  2898. end if
  2899. end
  2900.  
  2901.  
  2902.  
  2903. on closestCamera me, pos
  2904. global gCameraProps
  2905. closest = 1000
  2906. bestCam = 0
  2907. repeat with camNum = 1 to gCameraProps.cameras.count then
  2908. if(me.seenByCamera(camNum, pos) = 1)and(diag(pos, gCameraProps.cameras[camNum]+point(1400/2, 800/2)) < closest )then
  2909. closest = diag(pos, gCameraProps.cameras[camNum]+point(1400/2, 800/2))
  2910. bestCam = camNum
  2911. end if
  2912. end repeat
  2913.  
  2914. return bestCam
  2915. end
  2916.  
  2917. on seenByCamera me, camNum, pos
  2918. global gCameraProps
  2919.  
  2920. cameraPos = gCameraProps.cameras[camNum]
  2921.  
  2922. if pos.inside(rect(cameraPos.locH, cameraPos.locV, cameraPos.locH+1400, cameraPos.locV+800)+(rect(-15, -10, 15, 10)*20))then
  2923. return 1
  2924. else
  2925. return 0
  2926. end if
  2927.  
  2928. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement