Downloads containing ab21btl09.j2as

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

File preview

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