Downloads containing xlmweed.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Pot PlantFeatured Download Loon Battle 9.1 Download file

File preview

  1. #include "MLLE-Include-1.5.asc" ///@MLLE-Generated
  2. #pragma require "xlmweed-MLLE-Data-2.j2l" ///@MLLE-Generated
  3. const bool MLLESetupSuccessful = MLLE::Setup();
  4. #pragma require "xlmweed-MLLE-Data-1.j2l"
  5. #pragma require "xlmweed.j2l"
  6.  
  7. void onLevelLoad() {
  8.         jjTexturedBGFadePositionY = 0.45;
  9.         jjUseLayer8Speeds = true;
  10.        
  11.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 64, 88});
  12.         turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.f, false);
  13.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 22.25f, false);
  14.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 26.8f, false);
  15.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.8f, false);
  16.        
  17.         jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
  18.        
  19.         jjDelayGeneratedCrateOrigins = true;
  20. }
  21.  
  22. jjANIMSET@ customSpringSprite;
  23. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  24. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  25.     int length = colors.length();
  26.     bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  27.     if (success) {
  28.         uint srcSet = jjAnimSets[ANIM::SPRING];
  29.         for (int i = 0; i < length; i++) {
  30.             uint color = colors[i];
  31.             uint destAnimOffset = anim + i * 3;
  32.             for (int j = 0; j < 3; j++) {
  33.                 uint srcAnim = jjAnimations[srcSet + j];
  34.                 uint destAnim = jjAnimations[destAnimOffset + j];
  35.                 for (int k = 0; k < 5; k++) {
  36.                     jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  37.                     int width = image.width;
  38.                     int height = image.height;
  39.                     for (int l = 0; l < height; l++) {
  40.                         for (int m = 0; m < width; m++) {
  41.                             int pixel = image[m, l];
  42.                             if (pixel >= 32 && pixel < 40)
  43.                                 image[m, l] = color + (pixel & 7);
  44.                         }
  45.                     }
  46.                     if (!image.save(jjAnimFrames[destAnim + k]))
  47.                         return false;
  48.                 }
  49.             }
  50.         }
  51.     }
  52.     return success;
  53. }
  54. void initializeCustomSpring(jjOBJ@ obj) {
  55.     int anim = obj.curAnim;
  56.     obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  57.     if (obj.curAnim != anim) {
  58.         obj.curAnim = anim + 2;
  59.         obj.determineCurFrame();
  60.     }
  61.     obj.draw();
  62. }
  63.  
  64. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  65.     if (horizontal) {
  66.         obj.xSpeed = power;
  67.         obj.ySpeed = 0.f;
  68.     } else {
  69.         obj.xSpeed = 0.f;
  70.         obj.ySpeed = -power;
  71.         if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  72.             int x = int(obj.xPos) >> 5;
  73.             int y = int(obj.yPos) >> 5;
  74.             if (jjParameterGet(x, y, 0, 1) != 0) {
  75.                 jjParameterSet(x, y, 0, 1, 0);
  76.                 obj.yPos -= 4.f;
  77.                 obj.ySpeed = power;
  78.             }
  79.         }
  80.     }
  81.     obj.behavior = initializeCustomSpring;
  82.     obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  83.     obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  84.     obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  85.     obj.deactivates = obj.isFreezable = true;
  86.     obj.bulletHandling = HANDLING::IGNOREBULLET;
  87.     obj.playerHandling = HANDLING::SPECIAL;
  88.     obj.lightType = LIGHT::NORMAL;
  89.     obj.determineCurFrame();
  90. }
  91.  
  92. void handleFastCustomSpringSpeeds(jjPLAYER@ play) {
  93.         if (play.ySpeed < -32.f) {
  94.                 fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
  95.         } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
  96.                 if (play.ySpeed < -31.f) {
  97.                         fastCustomSpringSpeeds[play.localPlayerID]--;
  98.                         play.ySpeed = -32.f;
  99.                 } else {
  100.                         fastCustomSpringSpeeds[play.localPlayerID] = 0;
  101.                 }
  102.         }
  103. }
  104.  
  105. void onPlayer(jjPLAYER@ player) {
  106.         handleFastCustomSpringSpeeds(player);
  107. }
  108.  
  109. void onMain() {
  110.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  111.     jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
  112. }