Downloads containing ab22ctf08.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(array<MLLEWeaponApply@> = {null, null, BubbleGun::Weapon(), null, null, SuperToaster::Weapon(), null, null, null}); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  3. #pragma require "ab22ctf08-MLLE-Data-5.j2l" ///@MLLE-Generated
  4. #pragma require "ab22ctf08-MLLE-Data-4.j2l" ///@MLLE-Generated
  5. #pragma require "ab22ctf08-MLLE-Data-3.j2l" ///@MLLE-Generated
  6. #pragma require "ab22ctf08-MLLE-Data-2.j2l" ///@MLLE-Generated
  7. #pragma require "ab22ctf08-MLLE-Data-1.j2l" ///@MLLE-Generated
  8. #pragma require "ab22ctf08.j2l" ///@MLLE-Generated
  9. #include "SuperToaster.asc" ///@MLLE-Generated
  10. #pragma require "SuperToaster.asc" ///@MLLE-Generated
  11. #include "BubbleGun.asc" ///@MLLE-Generated
  12. #pragma require "BubbleGun.asc" ///@MLLE-Generated
  13.  
  14. void onPlayer(jjPLAYER@ player){
  15.         player.lightType = LIGHT::NONE;
  16.        
  17.         handleFastCustomSpringSpeeds(player);
  18.        
  19.          for (int i = 1; i < jjObjectCount; i++) {
  20.         if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::COPTER && jjObjects[i].state == STATE::FLY) {
  21.             //Only set the counter if it's available to take
  22.             jjObjects[i].counter = 0;
  23.             if (jjObjects[i].var[4] == 0)
  24.                 jjObjects[i].state = STATE::DONE;
  25.         }
  26.         }
  27.        
  28.        
  29. }
  30.  
  31. void onLevelLoad() {
  32.         jjUseLayer8Speeds = true;
  33.        
  34.         /* jjWaterLayer = 16;
  35.         jjSetWaterGradient(0,22,44, 0,44,22);
  36.         jjWaterLighting = (WATERLIGHT::GLOBAL); */
  37.        
  38.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 64, 88});
  39.     turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
  40.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 26.55f, false);
  41.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 17.75f, false);
  42.     turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
  43.        
  44.         jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
  45.        
  46.         jjDelayGeneratedCrateOrigins = true;
  47.        
  48.     jjObjectPresets[OBJECT::GUN9POWERUP].direction = -1;
  49.        
  50.                 jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
  51.         jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
  52.        
  53.           jjPIXELMAP rain(32,32);
  54.   for (uint x = 0; x < rain.width; ++x) {
  55.     for (uint y = 0; y < rain.height; ++y) {
  56.       if (x == 16) { //draw in the middle of the tile, xPixel 16
  57.         if (y <= 24) rain[x,y] = 75; //if at yPixel 24 or less, use color 75
  58.         else rain[x,y] = 74; //use color 74 for yPixels 25-32
  59.       } else {
  60.         rain[x,y] = 0;
  61.       }
  62.     }
  63.   }
  64.  
  65.   jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
  66.   for (uint frameID = 0; frameID < anim.frameCount; ++frameID) {
  67.     jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame + frameID];
  68.     rain.save(frame);
  69.     frame.hotSpotX = -frame.width/2;
  70.     frame.hotSpotY = -frame.height;
  71.   }
  72.  
  73.   jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
  74.  
  75.   jjObjectPresets[OBJECT::BOMBCRATE].bulletHandling = HANDLING::IGNOREBULLET;
  76.   jjObjectPresets[OBJECT::BOMBCRATE].behavior = DarkCrate;
  77. }
  78.  
  79. void onMain() {
  80.         jjWeapons[WEAPON::TNT].comesFromGunCrates = true;      
  81.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  82.     jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
  83.        
  84.         array<jjLAYER@> layers = jjLayerOrderGet();
  85.         layers[31].xOffset += .5f;
  86.         layers[35].xOffset += .4f;
  87.         layers[38].xOffset += .2f;
  88.        
  89.         for (int i = 0; i < 1024; i++) { //loop through the global array jjParticles[1024]
  90.     jjPARTICLE@ particle = jjParticles[i];
  91.     if (particle.type == PARTICLE::RAIN) {
  92.       particle.xSpeed = 0; //make rain fall straight down
  93.       particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed); //the rain speed accounts for differences in the player speed, and so won't appear to fall more slowly when the player is falling
  94.     }
  95.         }
  96.         for (int i = 1; i < jjObjectCount; i++) {
  97.         if (jjObjects[i].eventID == OBJECT::FULLENERGY) {
  98.                jjObjects[i].xPos = jjObjects[i].xOrg - 16;
  99.         }
  100.         }
  101.         for (int i = 1; i < jjObjectCount; i++) {
  102.         jjOBJ@ obj = jjObjects[i];
  103.         if (obj.eventID == OBJECT::RFPOWERUP) {
  104.             obj.direction = obj.xPos < (jjLayerWidth[4]*32)/2? -1:0;
  105.         }
  106.     }
  107.         for (int i = 1; i < jjObjectCount; i++) {
  108.         jjOBJ@ obj = jjObjects[i];
  109.         if (obj.eventID == OBJECT::ICEBULLETPU && obj.xSpeed > -0.5 && obj.xSpeed < 0.5) {
  110.             obj.xSpeed = 0;
  111.         }
  112.     }
  113.  
  114. }
  115.  
  116.  
  117. jjANIMSET@ customSpringSprite;
  118. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  119. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  120.     int length = colors.length();
  121.     bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  122.     if (success) {
  123.         uint srcSet = jjAnimSets[ANIM::SPRING];
  124.         for (int i = 0; i < length; i++) {
  125.             uint color = colors[i];
  126.             uint destAnimOffset = anim + i * 3;
  127.             for (int j = 0; j < 3; j++) {
  128.                 uint srcAnim = jjAnimations[srcSet + j];
  129.                 uint destAnim = jjAnimations[destAnimOffset + j];
  130.                 for (int k = 0; k < 5; k++) {
  131.                     jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  132.                     int width = image.width;
  133.                     int height = image.height;
  134.                     for (int l = 0; l < height; l++) {
  135.                         for (int m = 0; m < width; m++) {
  136.                             int pixel = image[m, l];
  137.                             if (pixel >= 32 && pixel < 40)
  138.                                 image[m, l] = color + (pixel & 7);
  139.                         }
  140.                     }
  141.                     if (!image.save(jjAnimFrames[destAnim + k]))
  142.                         return false;
  143.                 }
  144.             }
  145.         }
  146.     }
  147.     return success;
  148. }
  149. void initializeCustomSpring(jjOBJ@ obj) {
  150.     int anim = obj.curAnim;
  151.     obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  152.     if (obj.curAnim != anim) {
  153.         obj.curAnim = anim + 2;
  154.         obj.determineCurFrame();
  155.     }
  156.     obj.draw();
  157. }
  158.  
  159. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  160.     if (horizontal) {
  161.         obj.xSpeed = power;
  162.         obj.ySpeed = 0.f;
  163.     } else {
  164.         obj.xSpeed = 0.f;
  165.         obj.ySpeed = -power;
  166.         if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  167.             int x = int(obj.xPos) >> 5;
  168.             int y = int(obj.yPos) >> 5;
  169.             if (jjParameterGet(x, y, 0, 1) != 0) {
  170.                 jjParameterSet(x, y, 0, 1, 0);
  171.                 obj.yPos -= 4.f;
  172.                 obj.ySpeed = power;
  173.             }
  174.         }
  175.     }
  176.     obj.behavior = initializeCustomSpring;
  177.     obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  178.     obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  179.     obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  180.     obj.deactivates = obj.isFreezable = true;
  181.     obj.bulletHandling = HANDLING::IGNOREBULLET;
  182.     obj.playerHandling = HANDLING::SPECIAL;
  183.     obj.lightType = LIGHT::NORMAL;
  184.     obj.determineCurFrame();
  185. }
  186.  
  187. void handleFastCustomSpringSpeeds(jjPLAYER@ play) {
  188.         if (play.ySpeed < -32.f) {
  189.                 fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
  190.         } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
  191.                 if (play.ySpeed < -31.f) {
  192.                         fastCustomSpringSpeeds[play.localPlayerID]--;
  193.                         play.ySpeed = -32.f;
  194.                 } else {
  195.                         fastCustomSpringSpeeds[play.localPlayerID] = 0;
  196.                 }
  197.         }
  198. }
  199.  
  200. /* void onDrawLayer7(jjPLAYER@ play, jjCANVAS@ screen) {
  201.         jjSetWaterLevel((play.cameraY - jjLayers[16].getYPosition(play)) + 368, true);
  202. }
  203. void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) {
  204.   jjSetWaterLevel(16000, true);
  205. } */
  206.        
  207. void onFunction0(jjPLAYER@ play) {
  208.         jjIsSnowing = true;
  209. }
  210.  
  211. void onFunction1(jjPLAYER@ play) {
  212.         jjIsSnowing = false;
  213. }
  214.  
  215. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  216.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  217. }
  218.  
  219. void onFunction2(jjPLAYER@ play) {
  220.         jjObjects[play.fly - 1].counter = 0;
  221. }
  222.  
  223. void DarkCrate(jjOBJ@ obj) {
  224.   obj.behave(BEHAVIOR::CRATE, false);
  225.   jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BRIGHTNESS, 69);
  226. }
  227.  
  228. /* void DarkCrate(jjOBJ@ obj) {
  229.   obj.behave(BEHAVIOR::CRATE, false);
  230.   jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 48);
  231. } */