Downloads containing ab22btl07.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 22 levels Jazz2Online Multiple N/A Download file

File preview

  1. const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5.asc" ///@MLLE-Generated
  3. #pragma require "ab22btl07-MLLE-Data-3.j2l" ///@MLLE-Generated
  4. #pragma require "ab22btl07-MLLE-Data-2.j2l" ///@MLLE-Generated
  5. #pragma require "ab22btl07-MLLE-Data-1.j2l" ///@MLLE-Generated
  6. #pragma require "Islands.j2t" ///@MLLE-Generated
  7. #pragma require "CoralC_background.j2t" ///@MLLE-Generated
  8. #pragma require "ab22btl07.j2l" ///@MLLE-Generated
  9. #pragma require "SEfirework.asc"
  10. #include "SEfirework.asc"
  11.  
  12. se::DefaultWeaponHook weaponHook;
  13. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  14.         return weaponHook.drawAmmo(player, canvas);
  15. }
  16.  
  17. void onLevelLoad() {
  18.         jjTexturedBGFadePositionY = 0.6;
  19.        
  20.         jjSetWaterLevel(32*95, true);
  21.         jjWaterInteraction = WATERINTERACTION::SWIM;
  22.         jjSetWaterGradient(20, 140, 180, 0, 0, 190);
  23.         jjWaterChangeSpeed = 0;
  24.         jjWaterLighting = (WATERLIGHT::GLOBAL);
  25.         jjWaterLayer = 1;
  26.        
  27.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 64, 88});
  28.         turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
  29.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 22.25f, false);
  30.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 28.f, false);
  31.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 32.8f, false);
  32.        
  33.         jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
  34.        
  35.         se::firework.loadAnims(jjAnimSets[ANIM::CUSTOM[1]]);
  36.         se::firework.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BOEM1, SOUND::INTRO_BOEM2});
  37.         se::firework.setAsWeapon(3, weaponHook);
  38.        
  39.         jjDelayGeneratedCrateOrigins = true;
  40.        
  41.         jjObjectPresets[OBJECT::RFPOWERUP].direction = 0;
  42.         jjObjectPresets[OBJECT::GUN9POWERUP].direction = 0;
  43.         jjObjectPresets[OBJECT::GUN8POWERUP].direction = -1;
  44.         jjObjectPresets[OBJECT::BLASTERPOWERUP].direction = 0;
  45. }
  46.  
  47. jjANIMSET@ customSpringSprite;
  48. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  49. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  50.     int length = colors.length();
  51.     bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  52.     if (success) {
  53.         uint srcSet = jjAnimSets[ANIM::SPRING];
  54.         for (int i = 0; i < length; i++) {
  55.             uint color = colors[i];
  56.             uint destAnimOffset = anim + i * 3;
  57.             for (int j = 0; j < 3; j++) {
  58.                 uint srcAnim = jjAnimations[srcSet + j];
  59.                 uint destAnim = jjAnimations[destAnimOffset + j];
  60.                 for (int k = 0; k < 5; k++) {
  61.                     jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  62.                     int width = image.width;
  63.                     int height = image.height;
  64.                     for (int l = 0; l < height; l++) {
  65.                         for (int m = 0; m < width; m++) {
  66.                             int pixel = image[m, l];
  67.                             if (pixel >= 32 && pixel < 40)
  68.                                 image[m, l] = color + (pixel & 7);
  69.                         }
  70.                     }
  71.                     if (!image.save(jjAnimFrames[destAnim + k]))
  72.                         return false;
  73.                 }
  74.             }
  75.         }
  76.     }
  77.     return success;
  78. }
  79. void initializeCustomSpring(jjOBJ@ obj) {
  80.     int anim = obj.curAnim;
  81.     obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  82.     if (obj.curAnim != anim) {
  83.         obj.curAnim = anim + 2;
  84.         obj.determineCurFrame();
  85.     }
  86.     obj.draw();
  87. }
  88.  
  89. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  90.     if (horizontal) {
  91.         obj.xSpeed = power;
  92.         obj.ySpeed = 0.f;
  93.     } else {
  94.         obj.xSpeed = 0.f;
  95.         obj.ySpeed = -power;
  96.         if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  97.             int x = int(obj.xPos) >> 5;
  98.             int y = int(obj.yPos) >> 5;
  99.             if (jjParameterGet(x, y, 0, 1) != 0) {
  100.                 jjParameterSet(x, y, 0, 1, 0);
  101.                 obj.yPos -= 4.f;
  102.                 obj.ySpeed = power;
  103.             }
  104.         }
  105.     }
  106.     obj.behavior = initializeCustomSpring;
  107.     obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  108.     obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  109.     obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  110.     obj.deactivates = obj.isFreezable = true;
  111.     obj.bulletHandling = HANDLING::IGNOREBULLET;
  112.     obj.playerHandling = HANDLING::SPECIAL;
  113.     obj.lightType = LIGHT::NORMAL;
  114.     obj.determineCurFrame();
  115. }
  116.  
  117. void handleFastCustomSpringSpeeds(jjPLAYER@ play) {
  118.         if (play.ySpeed < -32.f) {
  119.                 fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
  120.         } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
  121.                 if (play.ySpeed < -31.f) {
  122.                         fastCustomSpringSpeeds[play.localPlayerID]--;
  123.                         play.ySpeed = -32.f;
  124.                 } else {
  125.                         fastCustomSpringSpeeds[play.localPlayerID] = 0;
  126.                 }
  127.         }
  128. }
  129.  
  130. void onMain() {
  131. array<jjLAYER@> layers = jjLayerOrderGet();
  132. layers[17].xOffset += .5f;
  133.         weaponHook.processMain();
  134.         for (int i = 1; i < jjObjectCount; i++) {
  135.                 if ((jjObjects[i].eventID == OBJECT::FULLENERGY || jjObjects[i].eventID == OBJECT::COPTER || jjObjects[i].eventID == OBJECT::TOASTERPOWERUP || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD) && (jjObjects[i].state == STATE::FLY || jjObjects[i].behavior == BEHAVIOR::MONITOR || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD)) {
  136.                         jjObjects[i].xPos = jjObjects[i].xOrg - 0;
  137.                 }
  138.         }
  139.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  140.     jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
  141. }
  142.  
  143. void onPlayer(jjPLAYER@ player) {
  144.         weaponHook.processPlayer(player);
  145.         handleFastCustomSpringSpeeds(player);
  146. }
  147.  
  148. void onPlayerInput(jjPLAYER@ player) {
  149.         weaponHook.processPlayerInput(player);
  150. }
  151. void onReceive(jjSTREAM &in packet, int clientID) {
  152.         weaponHook.processPacket(packet, clientID);
  153. }