jackitch

TestPNGLoader.as

Jun 7th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.61 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_workbench(255, 0, 255, 0);
  17. const SColor color_storage_blue(255, 217, 255, 239);
  18. const SColor color_storage_red(255, 217, 255, 239);
  19. const SColor color_storage_noteam(255, 217, 255, 239);
  20. const SColor color_barracks_blue(255, 217, 218, 255);
  21. const SColor color_barracks_red(255, 217, 218, 255);
  22. const SColor color_barracks_noteam(255, 217, 218, 255);
  23. const SColor color_drill(255, 210, 120, 0);
  24. const SColor color_factory(255, 255, 217, 237);
  25. const SColor color_flowers(255, 255, 102, 255);
  26. const SColor color_rubble(255, 153, 51, 153);
  27. const SColor color_mossy(255, 0, 153, 153);
  28. const SColor color_mossy_wall(255, 0, 51, 51);
  29. const SColor color_campfire(255, 255, 51, 51);
  30. const SColor color_sign(255, 196, 207, 161);
  31. const SColor color_kitchen(255, 255, 217, 217);
  32. const SColor color_nursery(255, 217, 255, 223);
  33. const SColor color_quarters(255, 240, 217, 255);
  34. const SColor color_tunnel_blue(255, 243, 217, 254);
  35. const SColor color_tunnel_red(255, 243, 217, 254);
  36. const SColor color_tunnel_noteam(255, 243, 217, 254);
  37. const SColor color_bat(255, 34, 39, 96);
  38. const SColor color_chicken(255, 148, 27, 27);
  39. const SColor color_ruin(255, 34, 51, 0);
  40. const SColor color_tent(255, 0, 14, 51);
  41. const SColor color_chest(255, 255, 201, 0);
  42. const SColor color_crate(255, 102, 0, 0);
  43. const SColor color_heart(255, r, g, b);
  44. const SColor color_longboat_blue(255, 0, 51, 255);
  45. const SColor color_longboat_red(255, 0, 51, 255);
  46. const SColor color_longboat_noteam(255, 0, 51, 255);
  47. const SColor color_warboat_blue(255, 50, 140, 255);
  48. const SColor color_warboat_red(255, 50, 140, 255);
  49. const SColor color_warboat_noteam(255, 50, 140, 255);
  50. const SColor color_dinghy_blue(255, 90, 160, 255);
  51. const SColor color_dinghy_red(255, 90, 160, 255);
  52. const SColor color_dinghy_noteam(255, 90, 160, 255);
  53. const SColor color_bucket(255, 255, 220, 120);
  54. const SColor color_platform_up(255, 153, 0, 51);
  55. const SColor color_platform_down(255, 153, 2, 51);
  56. const SColor color_platform_left(255, 153, 3, 51);
  57. const SColor color_platform_right(255, 153, 1, 51);
  58. /*const SColor color_x(255, r, g, b);
  59. const SColor color_x(255, r, g, b);
  60. const SColor color_x(255, r, g, b);
  61. const SColor color_x(255, r, g, b);
  62. const SColor color_x(255, r, g, b);
  63. const SColor color_x(255, r, g, b);
  64. const SColor color_x(255, r, g, b);
  65. const SColor color_x(255, r, g, b);
  66. const SColor color_x(255, r, g, b);
  67. const SColor color_x(255, r, g, b);
  68. const SColor color_x(255, r, g, b);
  69. const SColor color_x(255, r, g, b);
  70. const SColor color_x(255, r, g, b);
  71. const SColor color_x(255, r, g, b);
  72. const SColor color_x(255, r, g, b);
  73. const SColor color_x(255, r, g, b);
  74. const SColor color_x(255, r, g, b);
  75. const SColor color_x(255, r, g, b);
  76. const SColor color_x(255, r, g, b);
  77. const SColor color_x(255, r, g, b);
  78. const SColor color_x(255, r, g, b);
  79. const SColor color_x(255, r, g, b);
  80. const SColor color_x(255, r, g, b);
  81. const SColor color_x(255, r, g, b);
  82. const SColor color_x(255, r, g, b);*/
  83.  
  84.  
  85. //the loader
  86.  
  87. class TestPNGLoader : PNGLoader
  88. {
  89.    
  90.     TestPNGLoader()
  91.     {
  92.         //super();
  93.        
  94.         //scrolls_Setup();
  95.        
  96.         //add missing offset arrays
  97.         int count = war_offsets_count - offsets_count;
  98.         while (count --> 0)
  99.         {
  100.             offsets.push_back(array<int>(0));
  101.         }
  102.     }
  103.    
  104.     //override this to extend functionality per-pixel.
  105.     void handlePixel(SColor pixel, int offset)
  106.     {
  107.         PNGLoader::handlePixel(pixel, offset);
  108.        
  109.             //ADDON PIXEL LOADDERS
  110.         if (pixel == color_stone_door_blue)
  111.         {
  112.             spawnBlob( map, "stone_door", offset, 0, true );
  113.             offsets[autotile_offset].push_back( offset );
  114.         }
  115.         else if (pixel == color_stone_door_red)
  116.         {
  117.             spawnBlob( map, "stone_door", offset, 1, true );
  118.             offsets[autotile_offset].push_back( offset );
  119.         }
  120.         else if (pixel == color_stone_door_noteam)
  121.         {
  122.             spawnBlob( map, "stone_door", offset, 255, true );
  123.             offsets[autotile_offset].push_back( offset );
  124.         }
  125.         else if (pixel == color_trap_block_blue)
  126.         {
  127.             spawnBlob( map, "trap_block", offset, 0, true );
  128.             offsets[autotile_offset].push_back( offset );
  129.         }
  130.         else if (pixel == color_trap_block_red)
  131.         {
  132.             spawnBlob( map, "trap_block", offset, 1, true );
  133.             offsets[autotile_offset].push_back( offset );
  134.         }
  135.         else if (pixel == color_trap_block_noteam)
  136.         {
  137.             spawnBlob( map, "trap_block", offset, 255, true );
  138.             offsets[autotile_offset].push_back( offset );
  139.         }
  140.         /*else if (pixel == color_platform_up)
  141.         {
  142.             spawnBlob( map, "wooden_platform", offset, -1, true );
  143.             offsets[autotile_offset].push_back( offset );
  144.         }
  145.         else if (pixel == color_platform_down)
  146.         {
  147.             spawnBlob( map, "wooden_platform", offset, -1, true );
  148.             offsets[autotile_offset].push_back( offset );
  149.         }
  150.         else if (pixel == color_platform_left)
  151.         {
  152.             spawnBlob( map, "wooden_platform", offset, -1, true );
  153.             offsets[autotile_offset].push_back( offset );
  154.         }
  155.         else if (pixel == color_platform_right)
  156.         {
  157.             spawnBlob( map, "wooden_platform", offset, -1, true );
  158.             offsets[autotile_offset].push_back( offset );
  159.         }*/
  160.         else if (pixel == color_ladder_vert)
  161.         {
  162.             spawnBlob( map, "ladder", offset, -1, true);
  163.             offsets[autotile_offset].push_back( offset );
  164.         }
  165.         /*else if (pixel == color_ladder_hor)
  166.         {
  167.             spawnBlob( map, "ladder", offset, -1, true);
  168.             offsets[autotile_offset].push_back( offset );
  169.         }*/
  170.         else if (pixel == color_workbench)
  171.         {
  172.             CBlob@ workbench = server_CreateBlobNoInit( "workbench" );
  173.             if (workbench !is null)
  174.             {
  175.                 workbench.setPosition( map.getTileWorldPosition(offset));
  176.                 workbench.Init();
  177.             }
  178.         }
  179.         else if (pixel == color_storage_blue)
  180.         {
  181.             spawnBlob( map, "storage", offset, 0);
  182.             offsets[autotile_offset].push_back( offset );
  183.         }
  184.         else if (pixel == color_storage_red)
  185.         {
  186.             spawnBlob( map, "storage", offset, 1);
  187.             offsets[autotile_offset].push_back( offset );
  188.         }
  189.         else if (pixel == color_storage_noteam)
  190.         {
  191.             spawnBlob( map, "storage", offset, 255);
  192.             offsets[autotile_offset].push_back( offset );
  193.         }
  194.         else if (pixel == color_barracks_blue)
  195.         {
  196.             spawnBlob( map, "barracks", offset, 0);
  197.             offsets[autotile_offset].push_back( offset );
  198.         }
  199.         else if (pixel == color_barracks_red)
  200.         {
  201.             spawnBlob( map, "barracks", offset, 1);
  202.             offsets[autotile_offset].push_back( offset );
  203.         }
  204.         else if (pixel == color_barracks_noteam)
  205.         {
  206.             spawnBlob( map, "barracks", offset, 255);
  207.             offsets[autotile_offset].push_back( offset );
  208.         }
  209.         else if (pixel == color_drill)
  210.         {
  211.             spawnBlob( map, "drill", offset, -1);
  212.             offsets[autotile_offset].push_back( offset );
  213.         }
  214.         else if (pixel == color_factory_blue)
  215.         {
  216.             spawnBlob( map, "factory", offset, 0);
  217.             offsets[autotile_offset].push_back( offset );
  218.         }
  219.         else if (pixel == color_factory_red)
  220.         {
  221.             spawnBlob( map, "factory", offset, 1);
  222.             offsets[autotile_offset].push_back( offset );
  223.         }
  224.         else if (pixel == color_factory_noteam)
  225.         {
  226.             spawnBlob( map, "factory", offset, 255);
  227.             offsets[autotile_offset].push_back( offset );
  228.         }
  229.     }
  230.    
  231.     //override this to add post-load offset types.
  232.     void handleOffset(int type, int offset, int position, int count)
  233.     {
  234.         PNGLoader::handleOffset(type, offset, position, count);
  235.  
  236.  
  237.     }
  238. }
Advertisement
Add Comment
Please, Sign In to add comment