jackitch

Untitled

Jun 8th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.47 KB | None | 0 0
  1. // TEST LOADER FOR ADDITIONAL PNG COLOURS
  2.  
  3. #include "BasePNGLoader.as";
  4.  
  5. #include "WARPNGLoader.as";
  6.  
  7.  
  8. const SColor color_stone_door_blue(255, 80, 90, 160);
  9. const SColor color_stone_door_red(255, 160, 90, 80);
  10. const SColor color_stone_door_noteam(255, 160, 160, 160);
  11. const SColor color_ladder_vert(255, 150, 110, 30);
  12. //const SColor color_ladder_hor(255, 150, 110, 30);
  13. const SColor color_trap_block_blue(255, 0, 0, 100);
  14. const SColor color_trap_block_red(255, 100, 0, 0);
  15. const SColor color_trap_block_noteam(255, 126, 204, 102);
  16. /*const SColor color_platform_up(255, 153, 0, 51);
  17. const SColor color_platform_down(255, 153, 2, 51);
  18. const SColor color_platform_left(255, 153, 3, 51);
  19. const SColor color_platform_right(255, 153, 1, 51);*/
  20. const SColor color_workbench(255, 0, 255, 0);
  21. const SColor color_storage_blue(255, 217, 255, 239);
  22. const SColor color_storage_red(255, 217, 255, 239);
  23. const SColor color_storage_noteam(255, 217, 255, 239);
  24. const SColor color_barracks_blue(255, 217, 218, 255);
  25. const SColor color_barracks_red(255, 217, 218, 255);
  26. const SColor color_barracks_noteam(255, 217, 218, 255);
  27. const SColor color_drill(255, 210, 120, 0);
  28. const SColor color_factory(255, 255, 217, 237);
  29. const SColor color_flowers(255, 255, 102, 255);
  30. /*const SColor color_rubble(255, 153, 51, 153);
  31. const SColor color_mossy(255, 0, 153, 153);
  32. const SColor color_mossy_wall(255, 0, 51, 51);*/
  33. const SColor color_fireplace(255, 255, 51, 51);
  34. const SColor color_sign(255, 196, 207, 161);
  35. const SColor color_kitchen(255, 255, 217, 217);
  36. const SColor color_nursery(255, 217, 255, 223);
  37. const SColor color_quarters(255, 240, 217, 255);
  38. const SColor color_tunnel_blue(255, 243, 217, 254);
  39. const SColor color_tunnel_red(255, 243, 217, 254);
  40. const SColor color_tunnel_noteam(255, 243, 217, 254);
  41. //const SColor color_bat(255, 34, 39, 96); //only sprites for now
  42. //const SColor color_chicken(255, 148, 27, 27); //only sprites for now
  43. const SColor color_ruin(255, 34, 51, 0);
  44. const SColor color_tent(255, 0, 14, 51);
  45. const SColor color_chest(255, 255, 201, 0);
  46. const SColor color_crate(255, 102, 0, 0);
  47. const SColor color_heart(255, r, g, b);
  48. const SColor color_longboat_blue(255, 0, 51, 255);
  49. const SColor color_longboat_red(255, 0, 51, 255);
  50. const SColor color_longboat_noteam(255, 0, 51, 255);
  51. const SColor color_warboat_blue(255, 50, 140, 255);
  52. const SColor color_warboat_red(255, 50, 140, 255);
  53. const SColor color_warboat_noteam(255, 50, 140, 255);
  54. const SColor color_dinghy_blue(255, 90, 160, 255);
  55. const SColor color_dinghy_red(255, 90, 160, 255);
  56. const SColor color_dinghy_noteam(255, 90, 160, 255);
  57. const SColor color_bucket(255, 255, 220, 120);
  58. const SColor color_boulder(255, r, g, b);
  59. const SColor color_catapult(255, r, g, b);
  60. const SColor color_ballista(255, r, g, b);
  61. const SColor color_mounted_bow(255, r, g, b);
  62. const SColor color_arrows(255, r, g, b);
  63. const SColor color_fire_arrows(255, r, g, b);
  64. const SColor color_ballista_bolts(255, r, g, b);
  65. const SColor color_minikeg(255, r, g, b);
  66. const SColor color_keg(255, r, g, b);
  67. const SColor color_airship(255, r, g, b);
  68. const SColor color_gold_mat(255, r, g, b);
  69. const SColor color_stone_mat(255, r, g, b);
  70. const SColor color_wood_mat(255, r, g, b);
  71. const SColor color_logs(255, r, g, b);
  72. const SColor color_saw(255, r, g, b);
  73. const SColor color_migrant(255, r, g, b);
  74. /*const SColor color_zombie(255, r, g, b);
  75. const SColor color_skeleton(255, r, g, b);
  76. const SColor color_wraith(255, r, g, b);
  77. const SColor color_greg(255, r, g, b);
  78. const SColor color_zknght(255, r, g, b);*/
  79. const SColor color_steak(255, r, g, b);
  80. /*const SColor color_x(255, r, g, b);
  81. */
  82.  
  83.  
  84. //the loader
  85.  
  86. class TestPNGLoader : PNGLoader
  87. {
  88.  
  89. TestPNGLoader()
  90. {
  91. //super();
  92.  
  93. //scrolls_Setup();
  94.  
  95. //add missing offset arrays
  96. int count = war_offsets_count - offsets_count;
  97. while (count --> 0)
  98. {
  99. offsets.push_back(array<int>(0));
  100. }
  101. }
  102.  
  103. //override this to extend functionality per-pixel.
  104. void handlePixel(SColor pixel, int offset)
  105. {
  106. PNGLoader::handlePixel(pixel, offset);
  107.  
  108. //ADDON PIXEL LOADDERS
  109. if (pixel == color_stone_door_blue)
  110. {
  111. spawnBlob( map, "stone_door", offset, 0, true );
  112. offsets[autotile_offset].push_back( offset );
  113. }
  114. else if (pixel == color_stone_door_red)
  115. {
  116. spawnBlob( map, "stone_door", offset, 1, true );
  117. offsets[autotile_offset].push_back( offset );
  118. }
  119. else if (pixel == color_stone_door_noteam)
  120. {
  121. spawnBlob( map, "stone_door", offset, 255, true );
  122. offsets[autotile_offset].push_back( offset );
  123. }
  124. else if (pixel == color_trap_block_blue)
  125. {
  126. spawnBlob( map, "trap_block", offset, 0, true );
  127. offsets[autotile_offset].push_back( offset );
  128. }
  129. else if (pixel == color_trap_block_red)
  130. {
  131. spawnBlob( map, "trap_block", offset, 1, true );
  132. offsets[autotile_offset].push_back( offset );
  133. }
  134. else if (pixel == color_trap_block_noteam)
  135. {
  136. spawnBlob( map, "trap_block", offset, 255, true );
  137. offsets[autotile_offset].push_back( offset );
  138. }
  139. /*else if (pixel == color_platform_up)
  140. {
  141. spawnBlob( map, "wooden_platform", offset, -1, true );
  142. offsets[autotile_offset].push_back( offset );
  143. }
  144. else if (pixel == color_platform_down)
  145. {
  146. spawnBlob( map, "wooden_platform", offset, -1, true );
  147. offsets[autotile_offset].push_back( offset );
  148. }
  149. else if (pixel == color_platform_left)
  150. {
  151. spawnBlob( map, "wooden_platform", offset, -1, true );
  152. offsets[autotile_offset].push_back( offset );
  153. }
  154. else if (pixel == color_platform_right)
  155. {
  156. spawnBlob( map, "wooden_platform", offset, -1, true );
  157. offsets[autotile_offset].push_back( offset );
  158. }*/
  159. else if (pixel == color_ladder_vert)
  160. {
  161. spawnBlob( map, "ladder", offset, -1, true);
  162. offsets[autotile_offset].push_back( offset );
  163. }
  164. /*else if (pixel == color_ladder_hor)
  165. {
  166. spawnBlob( map, "ladder", offset, -1, true);
  167. offsets[autotile_offset].push_back( offset );
  168. }*/
  169. /*EXAMPLE FOR LOADING TILES:
  170. else if (pixel == color_x)
  171. {
  172. spawnBlob( map, "$name", offset, int, bool );
  173. offsets[autotile_offset].push_back( offset );
  174. }*/
  175. else if (pixel == color_workbench)
  176. {
  177. CBlob@ workbench = server_CreateBlobNoInit( "workbench" );
  178. if (workbench !is null)
  179. {
  180. workbench.setPosition( map.getTileWorldPosition(offset));
  181. workbench.Init();
  182. }
  183. }
  184. else if (pixel == color_storage_blue)
  185. {
  186. spawnBlob( map, "storage", offset, 0);
  187. offsets[autotile_offset].push_back( offset );
  188. }
  189. else if (pixel == color_storage_red)
  190. {
  191. spawnBlob( map, "storage", offset, 1);
  192. offsets[autotile_offset].push_back( offset );
  193. }
  194. else if (pixel == color_storage_noteam)
  195. {
  196. spawnBlob( map, "storage", offset, 255);
  197. offsets[autotile_offset].push_back( offset );
  198. }
  199. else if (pixel == color_barracks_blue)
  200. {
  201. spawnBlob( map, "barracks", offset, 0);
  202. offsets[autotile_offset].push_back( offset );
  203. }
  204. else if (pixel == color_barracks_red)
  205. {
  206. spawnBlob( map, "barracks", offset, 1);
  207. offsets[autotile_offset].push_back( offset );
  208. }
  209. else if (pixel == color_barracks_noteam)
  210. {
  211. spawnBlob( map, "barracks", offset, 255);
  212. offsets[autotile_offset].push_back( offset );
  213. }
  214. else if (pixel == color_drill)
  215. {
  216. spawnBlob( map, "drill", offset, -1);
  217. offsets[autotile_offset].push_back( offset );
  218. }
  219. else if (pixel == color_factory_blue)
  220. {
  221. spawnBlob( map, "factory", offset, 0);
  222. offsets[autotile_offset].push_back( offset );
  223. }
  224. else if (pixel == color_factory_red)
  225. {
  226. spawnBlob( map, "factory", offset, 1);
  227. offsets[autotile_offset].push_back( offset );
  228. }
  229. else if (pixel == color_factory_noteam)
  230. {
  231. spawnBlob( map, "factory", offset, 255);
  232. offsets[autotile_offset].push_back( offset );
  233. }
  234. else if (pixel == color_flowers)
  235. {
  236. spawnBlob( map, "flowers", offset, -1);
  237. offsets[autotile_offset].push_back( offset );
  238.  
  239. }
  240. else if (pixel == color_fireplace)
  241. {
  242. spawnBlob( map, "fireplace", offset, -1);
  243. offsets[autotile_offset].push_back( offset );
  244.  
  245. }
  246. else if (pixel == color_sign)
  247. {
  248. spawnBlob( map, "sign", offset, -1);
  249. offsets[autotile_offset].push_back( offset );
  250.  
  251. }
  252. else if (pixel == color_kitchen)
  253. {
  254. spawnBlob( map, "kitchen", offset, 255);
  255. offsets[autotile_offset].push_back( offset );
  256.  
  257. }
  258. else if (pixel == color_nursery)
  259. {
  260. spawnBlob( map, "quarters", offset, 255);
  261. offsets[autotile_offset].push_back( offset );
  262.  
  263. }
  264. else if (pixel == color_tunnel_blue)
  265. {
  266. spawnBlob( map, "tunnel", offset, 0);
  267. offsets[autotile_offset].push_back( offset );
  268.  
  269. }
  270. else if (pixel == color_tunnel_red)
  271. {
  272. spawnBlob( map, "tunnel", offset, 1);
  273. offsets[autotile_offset].push_back( offset );
  274.  
  275. }
  276. else if (pixel == color_tunnel_noteam)
  277. {
  278. spawnBlob( map, "tunnel", offset, 255);
  279. offsets[autotile_offset].push_back( offset );
  280.  
  281. }
  282. else if (pixel == color_ruin)
  283. {
  284. spawnBlob( map, "ruin", offset, -1);
  285. offsets[autotile_offset].push_back( offset );
  286.  
  287. }
  288. else if (pixel == color_tent)
  289. {
  290. spawnBlob( map, "tent", offset, -1);
  291. offsets[autotile_offset].push_back( offset );
  292.  
  293. }
  294. else if (pixel == color_chest)
  295. {
  296. spawnBlob( map, "chest", offset, -1);
  297. offsets[autotile_offset].push_back( offset );
  298.  
  299. }
  300. else if (pixel == color_crate)
  301. {
  302. spawnBlob( map, "crate", offset, -1);
  303. offsets[autotile_offset].push_back( offset );
  304.  
  305. }
  306. else if (pixel == color_heart)
  307. {
  308. spawnBlob( map, "heart", offset, -1);
  309. offsets[autotile_offset].push_back( offset );
  310.  
  311. }
  312. else if (pixel == color_longboat_blue)
  313. {
  314. spawnBlob( map, "longboat", offset, 0);
  315. offsets[autotile_offset].push_back( offset );
  316.  
  317. }
  318. else if (pixel == color_longboat_red)
  319. {
  320. spawnBlob( map, "longboat", offset, 1);
  321. offsets[autotile_offset].push_back( offset );
  322.  
  323. }
  324. else if (pixel == color_longboat_noteam)
  325. {
  326. spawnBlob( map, "longboat", offset, 255);
  327. offsets[autotile_offset].push_back( offset );
  328.  
  329. }
  330. else if (pixel == color_warboat_blue)
  331. {
  332. spawnBlob( map, "warboat", offset, 0);
  333. offsets[autotile_offset].push_back( offset );
  334.  
  335. }
  336. else if (pixel == color_warboat_red)
  337. {
  338. spawnBlob( map, "warboat", offset, 1);
  339. offsets[autotile_offset].push_back( offset );
  340.  
  341. }
  342. else if (pixel == color_warboat_noteam)
  343. {
  344. spawnBlob( map, "warboat", offset, 255);
  345. offsets[autotile_offset].push_back( offset );
  346.  
  347. }
  348. else if (pixel == color_dinghy_blue)
  349. {
  350. spawnBlob( map, "dinghy", offset, 0);
  351. offsets[autotile_offset].push_back( offset );
  352.  
  353. }
  354. else if (pixel == color_dinghy_red)
  355. {
  356. spawnBlob( map, "dinghy", offset, 1);
  357. offsets[autotile_offset].push_back( offset );
  358.  
  359. }
  360. else if (pixel == color_dinghy_noteam)
  361. {
  362. spawnBlob( map, "dinghy", offset, 255);
  363. offsets[autotile_offset].push_back( offset );
  364.  
  365. }
  366. else if (pixel == color_bucket)
  367. {
  368. spawnBlob( map, "bucket", offset, -1);
  369. offsets[autotile_offset].push_back( offset );
  370.  
  371. }
  372. else if (pixel == color_boulder)
  373. {
  374. spawnBlob( map, "boulder", offset, -1);
  375. offsets[autotile_offset].push_back( offset );
  376.  
  377. }
  378. else if (pixel == color_catapult)
  379. {
  380. spawnBlob( map, "catapult", offset, -1);
  381. offsets[autotile_offset].push_back( offset );
  382.  
  383. }
  384. else if (pixel == color_ballista)
  385. {
  386. spawnBlob( map, "ballista", offset, -1);
  387. offsets[autotile_offset].push_back( offset );
  388.  
  389. }
  390. else if (pixel == color_mounted_bow)
  391. {
  392. spawnBlob( map, "mounted_bow", offset, -1);
  393. offsets[autotile_offset].push_back( offset );
  394.  
  395. }
  396. /*else if (pixel == color_arrows)
  397. {
  398. spawnBlob( map, "arrows", offset, -1);
  399. offsets[autotile_offset].push_back( offset );
  400.  
  401. }
  402. else if (pixel == color_fire_arrows)
  403. {
  404. spawnBlob( map, "fire_arrows", offset, -1);
  405. offsets[autotile_offset].push_back( offset );
  406.  
  407. }
  408. else if (pixel == color_ballista_bolts)
  409. {
  410. spawnBlob( map, "ballista_bolts", offset, -1);
  411. offsets[autotile_offset].push_back( offset );
  412.  
  413. }*/
  414. else if (pixel == color_minikeg)
  415. {
  416. spawnBlob( map, "minikeg", offset, -1);
  417. offsets[autotile_offset].push_back( offset );
  418.  
  419. }
  420. else if (pixel == color_keg)
  421. {
  422. spawnBlob( map, "keg", offset, -1);
  423. offsets[autotile_offset].push_back( offset );
  424.  
  425. }
  426. else if (pixel == color_airship)
  427. {
  428. spawnBlob( map, "airship", offset, -1);
  429. offsets[autotile_offset].push_back( offset );
  430.  
  431. }
  432. /*else if (pixel == color_gold_mat)
  433. {
  434. spawnBlob( map, "gold_mat", offset, -1);
  435. offsets[autotile_offset].push_back( offset );
  436.  
  437. }
  438. else if (pixel == color_stone_mat)
  439. {
  440. spawnBlob( map, "stone_mat", offset, -1);
  441. offsets[autotile_offset].push_back( offset );
  442.  
  443. }
  444. else if (pixel == color_wood_mat)
  445. {
  446. spawnBlob( map, "wood_mat", offset, -1);
  447. offsets[autotile_offset].push_back( offset );
  448.  
  449. }*/
  450. else if (pixel == color_log)
  451. {
  452. spawnBlob( map, "log", offset, -1);
  453. offsets[autotile_offset].push_back( offset );
  454.  
  455. }
  456. else if (pixel == color_saw)
  457. {
  458. spawnBlob( map, "saw", offset, -1);
  459. offsets[autotile_offset].push_back( offset );
  460.  
  461. }
  462. /*else if (pixel == color_migrant)
  463. {
  464. spawnBlob( map, "migrant", offset, -1);
  465. offsets[autotile_offset].push_back( offset );
  466.  
  467. }
  468. else if (pixel == color_zombie)
  469. {
  470. spawnBlob( map, "zombie", offset, -1);
  471. offsets[autotile_offset].push_back( offset );
  472.  
  473. }
  474. else if (pixel == color_skeleton)
  475. {
  476. spawnBlob( map, "skeleton", offset, -1);
  477. offsets[autotile_offset].push_back( offset );
  478.  
  479. }
  480. else if (pixel == color_wraith)
  481. {
  482. spawnBlob( map, "wraith", offset, -1);
  483. offsets[autotile_offset].push_back( offset );
  484.  
  485. }
  486. else if (pixel == color_greg)
  487. {
  488. spawnBlob( map, "greg", offset, -1);
  489. offsets[autotile_offset].push_back( offset );
  490.  
  491. }
  492. else if (pixel == color_zknight)
  493. {
  494. spawnBlob( map, "zknight", offset, -1);
  495. offsets[autotile_offset].push_back( offset );
  496.  
  497. }
  498. else if (pixel == color_steak)
  499. {
  500. spawnBlob( map, "steak", offset, -1);
  501. offsets[autotile_offset].push_back( offset );
  502.  
  503. }*/
  504. /*EXAMPLE:
  505. else if (pixel == color_x)
  506. {
  507. spawnBlob( map, "$name", offset, int);
  508. offsets[autotile_offset].push_back( offset );
  509.  
  510. }*/
  511. }
  512.  
  513. //override this to add post-load offset types.
  514. void handleOffset(int type, int offset, int position, int count)
  515. {
  516. PNGLoader::handleOffset(type, offset, position, count);
  517.  
  518.  
  519. }
  520. }
Advertisement
Add Comment
Please, Sign In to add comment