Downloads containing xlmprovance.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Provance Loon Capture the flag N/A Download file

File preview

  1. const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, se::RollerMLLEWrapper(), null, null, null, null, null, null}); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  3. #pragma require "xlmprovance-MLLE-Data-2.j2l" ///@MLLE-Generated
  4. #pragma require "xlmprovance-MLLE-Data-1.j2l" ///@MLLE-Generated
  5. #pragma require "xlmprovance.j2l" ///@MLLE-Generated
  6. #include "SEroller-mlle.asc" ///@MLLE-Generated
  7. #pragma require "SEroller-mlle.asc" ///@MLLE-Generated
  8.  
  9. void onLevelLoad() {
  10.         jjAnimSets[ANIM::SKELETON].load();
  11.  
  12.         jjUseLayer8Speeds = true;
  13.  
  14.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 48, 88, 32});
  15.     turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
  16.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 26.55f, false);
  17.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 17.75f, false);
  18.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
  19.         turnIntoCustomSpring(jjObjectPresets[OBJECT::BLUESPRING], 4, 32.3f, false);
  20.        
  21.        
  22.         jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
  23.        
  24.         jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
  25.         jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 53;
  26.         jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
  27.        
  28.         jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 85;
  29.         jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = 105;
  30.        
  31.         jjObjectPresets[OBJECT::SEEKERPOWERUP].direction = SPRITE::FLIPH;
  32.        
  33.         jjObjectPresets[OBJECT::GUNCRATE].behavior = ColoredCrate();
  34.         jjObjectPresets[OBJECT::SHARD].behavior = ColoredCrate();
  35. }
  36.        
  37. void onMain() {
  38.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  39.     jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
  40.        
  41.         for (int i = 1; i < jjObjectCount; i++) {
  42.         jjOBJ@ obj = jjObjects[i];
  43.         if (obj.eventID == OBJECT::RFPOWERUP) {
  44.             obj.direction = obj.xPos < (jjLayerWidth[4]*32)/2? -1:0;
  45.         }
  46.     }
  47.        
  48. }
  49.  
  50. void onLevelBegin() {
  51.         for (int i = 1; i < jjObjectCount; i++) {
  52.                 if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 9;
  53.         }
  54. }
  55.  
  56. void onPlayer(jjPLAYER@ player){
  57.         player.lightType = LIGHT::NONE;
  58.        
  59.         handleFastCustomSpringSpeeds(player);
  60.        
  61.         if (player.yPos >= 0) {
  62.                 //Wherein "skill 3" means "MP Only"
  63.                 int skill = jjParameterGet(uint16(player.xPos/32), uint16(player.yPos/32), -4, 2);     
  64.                 if (skill == 3) {
  65.                         if (jjLayers[1].spriteParam > 96) {
  66.                                 if (jjLayers[1].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP);
  67.                                 jjLayers[1].spriteParam = jjLayers[1].spriteParam - 10;
  68.                         }
  69.                 }
  70.                 else if (jjLayers[1].spriteParam != 255) {
  71.                         jjLayers[1].spriteParam = jjLayers[1].spriteParam + 10;
  72.                 }
  73.         }
  74. }
  75.  
  76. jjANIMSET@ customSpringSprite;
  77. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  78. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  79.     int length = colors.length();
  80.     bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  81.     if (success) {
  82.         uint srcSet = jjAnimSets[ANIM::SPRING];
  83.         for (int i = 0; i < length; i++) {
  84.             uint color = colors[i];
  85.             uint destAnimOffset = anim + i * 3;
  86.             for (int j = 0; j < 3; j++) {
  87.                 uint srcAnim = jjAnimations[srcSet + j];
  88.                 uint destAnim = jjAnimations[destAnimOffset + j];
  89.                 for (int k = 0; k < 5; k++) {
  90.                     jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  91.                     int width = image.width;
  92.                     int height = image.height;
  93.                     for (int l = 0; l < height; l++) {
  94.                         for (int m = 0; m < width; m++) {
  95.                             int pixel = image[m, l];
  96.                             if (pixel >= 32 && pixel < 40)
  97.                                 image[m, l] = color + (pixel & 7);
  98.                         }
  99.                     }
  100.                     if (!image.save(jjAnimFrames[destAnim + k]))
  101.                         return false;
  102.                 }
  103.             }
  104.         }
  105.     }
  106.     return success;
  107. }
  108. void initializeCustomSpring(jjOBJ@ obj) {
  109.     int anim = obj.curAnim;
  110.     obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  111.     if (obj.curAnim != anim) {
  112.         obj.curAnim = anim + 2;
  113.         obj.determineCurFrame();
  114.     }
  115.     obj.draw();
  116. }
  117.  
  118. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  119.     if (horizontal) {
  120.         obj.xSpeed = power;
  121.         obj.ySpeed = 0.f;
  122.     } else {
  123.         obj.xSpeed = 0.f;
  124.         obj.ySpeed = -power;
  125.         if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  126.             int x = int(obj.xPos) >> 5;
  127.             int y = int(obj.yPos) >> 5;
  128.             if (jjParameterGet(x, y, 0, 1) != 0) {
  129.                 jjParameterSet(x, y, 0, 1, 0);
  130.                 obj.yPos -= 4.f;
  131.                 obj.ySpeed = power;
  132.             }
  133.         }
  134.     }
  135.     obj.behavior = initializeCustomSpring;
  136.     obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  137.     obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  138.     obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  139.     obj.deactivates = obj.isFreezable = true;
  140.     obj.bulletHandling = HANDLING::IGNOREBULLET;
  141.     obj.playerHandling = HANDLING::SPECIAL;
  142.     obj.lightType = LIGHT::NORMAL;
  143.     obj.determineCurFrame();
  144. }
  145.  
  146. void handleFastCustomSpringSpeeds(jjPLAYER@ play) {
  147.         if (play.ySpeed < -32.f) {
  148.                 fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
  149.         } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
  150.                 if (play.ySpeed < -31.f) {
  151.                         fastCustomSpringSpeeds[play.localPlayerID]--;
  152.                         play.ySpeed = -32.f;
  153.                 } else {
  154.                         fastCustomSpringSpeeds[play.localPlayerID] = 0;
  155.                 }
  156.         }
  157. }
  158. void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ canvas) {
  159.         canvas.drawSprite(((36*32) + 22), ((53*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  160.         canvas.drawSprite(((39*32) + 8), ((55*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  161.         canvas.drawSprite(((24*32) + 8), ((18*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  162.         canvas.drawSprite(((34*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  163.         canvas.drawSprite(((28*32) + 22), ((20*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  164.         canvas.drawSprite(((37*32) + 22), ((35*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  165.         canvas.drawSprite(((58*32) + 8), ((30*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  166.         canvas.drawSprite(((62*32) + 22), ((56*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  167.         canvas.drawSprite(((56*32) + 22), ((32*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  168.         canvas.drawSprite(((51*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  169.         canvas.drawSprite(((60*32) + 22), ((17*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  170.         canvas.drawSprite(((62*32) + 8), ((19*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  171.         canvas.drawSprite(((68*32) + 22), ((18*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  172.        
  173.         canvas.drawSprite(((68*32) + 22), ((43*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  174.         canvas.drawSprite(((84*32) + 22), ((44*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  175.         canvas.drawSprite(((87*32) + 22), ((57*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  176.         canvas.drawSprite(((100*32) + 22), ((15*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  177.         canvas.drawSprite(((121*32) + 22), ((64*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  178.         canvas.drawSprite(((130*32) + 22), ((22*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  179.         canvas.drawSprite(((132*32) + 22), ((28*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  180.         canvas.drawSprite(((135*32) + 22), ((53*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  181.         canvas.drawSprite(((114*32) + 22), ((54*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  182.         canvas.drawSprite(((97*32) + 22), ((60*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  183.         canvas.drawSprite(((93*32) + 22), ((37*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  184.         canvas.drawSprite(((122*32) + 22), ((34*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
  185.        
  186.         canvas.drawSprite(((71*32) + 8), ((42*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  187.         canvas.drawSprite(((79*32) + 8), ((25*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  188.         canvas.drawSprite(((103*32) + 8), ((49*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  189.         canvas.drawSprite(((101*32) + 8), ((36*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  190.         canvas.drawSprite(((102*32) + 8), ((16*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  191.         canvas.drawSprite(((128*32) + 8), ((66*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64); //RIGHT
  192.         canvas.drawSprite(((89*32) + 8), ((58*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  193.         canvas.drawSprite(((125*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  194.         canvas.drawSprite(((112*32) + 8), ((52*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  195.         canvas.drawSprite(((120*32) + 8), ((33*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
  196.        
  197.         canvas.drawSprite(((124*32) + 32), ((74*32) - 10), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  198.         canvas.drawSprite(((94*32) + 32), ((71*32) + 3), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  199.        
  200. }
  201. void onDrawLayer3(jjPLAYER@ play, jjCANVAS@ canvas) {
  202. // GROUND ONES
  203.         canvas.drawSprite(((22*32) + 32), ((37*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64); // RIGHT
  204.         canvas.drawSprite(((44*32) + 32), ((69*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64); // LEFT
  205.         canvas.drawSprite(((49*32) + 32), ((70*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  206.         canvas.drawSprite(((61*32) + 32), ((72*32) + 11), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  207.         canvas.drawSprite(((27*32) + 32), ((73*32) + 7), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  208.        
  209.         canvas.drawSprite(((108*32) + 38), ((20*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  210.  
  211.        
  212.         canvas.drawSprite(((112*32) + 32), ((26*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  213.         canvas.drawSprite(((137*32) + 32), ((56*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  214.         canvas.drawSprite(((44*32) + 32), ((69*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  215.        
  216. // DAMN ONES
  217.         canvas.drawSprite(((50*32) + 16), ((40*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  218.         canvas.drawSprite(((57*32) + 16), ((66*32) - 13), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  219.         canvas.drawSprite(((65*32) + 16), ((51*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  220.        
  221.         canvas.drawSprite(((58*32) + 11), ((27*32) - 26), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  222.        
  223.         canvas.drawSprite(((84*32) + 16), ((30*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  224.         canvas.drawSprite(((101*32) + 16), ((30*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  225.         canvas.drawSprite(((104*32) + 16), ((67*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  226.         canvas.drawSprite(((129*32) + 16), ((60*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  227.         canvas.drawSprite(((85*32) + 16), ((52*32) - 6), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
  228.  
  229.        
  230.         canvas.drawSprite(((72*32) + 16), ((34*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  231.         canvas.drawSprite(((109*32) + 16), ((40*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  232.         canvas.drawSprite(((114*32) + 16), ((70*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  233.         canvas.drawSprite(((74*32) + 16), ((62*32) - 6), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
  234.  
  235. }
  236.  
  237. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  238.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  239. }
  240.  
  241. class ColoredCrate : jjBEHAVIORINTERFACE {
  242.     int color;
  243.     void onBehave(jjOBJ@ obj) {
  244.         obj.behave(obj.eventID == OBJECT::GUNCRATE? BEHAVIOR::CRATE : BEHAVIOR::SHARD);
  245.        
  246.         if (obj.state == STATE::KILL) {
  247.             obj.delete();
  248.         }
  249.     }
  250.     void onDraw(jjOBJ@ obj) {
  251.         color = jjParameterGet(int(obj.xOrg/32), int(obj.yOrg/32)+ (jjEventGet(int(obj.xOrg/32), int(obj.yOrg/32)) == 255? 0:1), 0, 8);
  252.         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, color == 0? SPRITE::NORMAL : SPRITE::SINGLEHUE, color);
  253.                
  254.     }
  255. }
  256.