Downloads containing ab21ctf09.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 "ab21ctf09-MLLE-Data-1.j2l"
  4. #pragma require "ab21ctf09.j2l"
  5. #pragma require "SEroller.asc"
  6. #include "SEroller.asc"
  7.  
  8. se::DefaultWeaponHook weaponHook;
  9.  
  10. bool isSnowing = true;
  11. jjPAL pal;
  12. int hue, sat, light;
  13.  
  14. void onLevelLoad() {
  15.         pal.load("Psych3V.j2t");
  16.  
  17.         jjUseLayer8Speeds = true;
  18.         jjTexturedBGTexture = TEXTURE::DIAMONDUSBETA;
  19.        
  20.         for (int i = 880; i <= 1299; i++) {
  21.                 jjPIXELMAP hills(i);
  22.                         for (uint x = 0; x < hills.width; ++x) {
  23.                                 for (uint y = 0; y < hills.height; ++y) {
  24.                                         if (hills[x,y] == 73) hills[x,y] = 236;
  25.                                 }
  26.                         }
  27.                 hills.save(i, true);
  28.         }
  29.        
  30.         for (int i = 1330; i <= 1389; i++) {
  31.                 jjPIXELMAP trees(i);
  32.                         for (uint x = 0; x < trees.width; ++x) {
  33.                                 for (uint y = 0; y < trees.height; ++y) {
  34.                                         if (trees[x,y] == 20) trees[x,y] = 122;
  35.                                         if (trees[x,y] == 21) trees[x,y] = 124;
  36.                                         if (trees[x,y] == 73) trees[x,y] = 234;
  37.                                         if (trees[x,y] == 160) trees[x,y] = 232;
  38.                                         if (trees[x,y] == 239) trees[x,y] = 214;
  39.                                         if (trees[x,y] == 241) trees[x,y] = 230;
  40.                                         if (trees[x,y] == 242) trees[x,y] = 231;
  41.                                         if (trees[x,y] == 243) trees[x,y] = 234;
  42.                                 }
  43.                         }
  44.                 trees.save(i, true);
  45.         }
  46.        
  47.         se::roller.loadAnims(jjAnimSets[ANIM::CUSTOM[99]]);
  48.         se::roller.loadSamples(array<SOUND::Sample> = {SOUND::P2_FART});
  49.         se::roller.setAsWeapon(3, weaponHook);
  50.        
  51.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 32, 56});
  52.         turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
  53.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 21.75f, false);
  54.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 28.f, false);
  55.         turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 18.5f, false);
  56.        
  57.         jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
  58.        
  59.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
  60.         jjObjectPresets[OBJECT::RFPOWERUP].direction = 0;
  61.        
  62.  
  63.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  64.         jjWeapons[WEAPON::ICE].comesFromGunCrates = jjWeapons[WEAPON::SEEKER].comesFromGunCrates = false;
  65. }
  66.  
  67. void onLevelBegin() {
  68.         for (int i = 1; i < jjObjectCount; i++) {
  69.                 if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 16;
  70.         }
  71.        
  72.         for (int n = 96; n <= 239; n++) {
  73.                 hue = jjPalette.color[n].getHue();
  74.                 sat = jjPalette.color[n].getSat();
  75.                 light = jjPalette.color[n].getLight();
  76.                
  77.                 if (n <= 104 || n >= 120) pal.color[n].setHSL(hue, sat * 4 / 5, light * 3 / 4);
  78.         }
  79.         pal.apply();
  80. }
  81.  
  82. jjANIMSET@ customSpringSprite;
  83. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  84. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  85.         int length = colors.length();
  86.         bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  87.         if (success) {
  88.                 uint srcSet = jjAnimSets[ANIM::SPRING];
  89.                 for (int i = 0; i < length; i++) {
  90.                         uint color = colors[i];
  91.                         uint destAnimOffset = anim + i * 3;
  92.                         for (int j = 0; j < 3; j++) {
  93.                                 uint srcAnim = jjAnimations[srcSet + j];
  94.                                 uint destAnim = jjAnimations[destAnimOffset + j];
  95.                                 for (int k = 0; k < 5; k++) {
  96.                                         jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  97.                                         int width = image.width;
  98.                                         int height = image.height;
  99.                                         for (int l = 0; l < height; l++) {
  100.                                                 for (int m = 0; m < width; m++) {
  101.                                                         int pixel = image[m, l];
  102.                                                         if (pixel >= 32 && pixel < 40)
  103.                                                                 image[m, l] = color + (pixel & 7);
  104.                                                 }
  105.                                         }
  106.                                         if (!image.save(jjAnimFrames[destAnim + k]))
  107.                                                 return false;
  108.                                 }
  109.                         }
  110.                 }
  111.         }
  112.         return success;
  113. }
  114. void initializeCustomSpring(jjOBJ@ obj) {
  115.         int anim = obj.curAnim;
  116.         obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  117.         if (obj.curAnim != anim) {
  118.                 obj.curAnim = anim + 2;
  119.                 obj.determineCurFrame();
  120.         }
  121.         obj.draw();
  122. }
  123. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  124.         if (horizontal) {
  125.                 obj.xSpeed = power;
  126.                 obj.ySpeed = 0.f;
  127.         } else {
  128.                 obj.xSpeed = 0.f;
  129.                 obj.ySpeed = -power;
  130.                 if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  131.                         int x = int(obj.xPos) >> 5;
  132.                         int y = int(obj.yPos) >> 5;
  133.                         if (jjParameterGet(x, y, 0, 1) != 0) {
  134.                                 jjParameterSet(x, y, 0, 1, 0);
  135.                                 obj.yPos -= 4.f;
  136.                                 obj.ySpeed = power;
  137.                         }
  138.                 }
  139.         }
  140.         obj.behavior = initializeCustomSpring;
  141.         obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  142.         obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  143.         obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  144.         obj.deactivates = obj.isFreezable = true;
  145.         obj.bulletHandling = HANDLING::IGNOREBULLET;
  146.         obj.playerHandling = HANDLING::SPECIAL;
  147.         obj.lightType = LIGHT::NORMAL;
  148.         obj.determineCurFrame();
  149. }
  150.  
  151. void onPlayer(jjPLAYER@ play) {
  152.         weaponHook.processPlayer(play);
  153. }
  154.  
  155. void onPlayerInput(jjPLAYER@ play) {
  156.         weaponHook.processPlayerInput(play);
  157. }
  158.  
  159. void onMain() {
  160.         for (int i = 0; i < 1024; i++) {
  161.                 jjPARTICLE@ particle = jjParticles[i];
  162.                 if (particle.type == PARTICLE::FLOWER) {
  163.                         particle.xSpeed = -0.25;
  164.                         particle.ySpeed = 2;
  165.                         particle.flower.petals = 1;
  166.                         particle.flower.color = 96;
  167.                         if (particle.flower.size > 64) particle.flower.size = 64;
  168.                 }
  169.         }
  170.        
  171.         for (int i = 1; i < jjObjectCount; i++) {
  172.                 jjOBJ@ obj = jjObjects[i];
  173.                 if (obj.eventID == OBJECT::FROZENSPRING || obj.eventID == OBJECT::REDSPRING || obj.eventID == OBJECT::HORREDSPRING) {
  174.                         if (obj.xOrg > 43.5*32 && obj.xOrg < 47.5*32) obj.xPos = obj.xOrg - 12;
  175.                         if ((obj.xOrg > 32*32 && obj.xOrg < 35*32 && obj.yOrg < 17*32) || (obj.xOrg > 45*32 && obj.xOrg < 48*32 && obj.yOrg > 41*32) || (obj.xOrg > 52*32 && obj.xOrg < 55*32) || (obj.xOrg > 60*32 && obj.xOrg < 63*32) || (obj.xOrg > 79*32 && obj.xOrg < 82*32)) {
  176.                                 obj.xPos = obj.xOrg - 12;
  177.                                 if (obj.xOrg < 64*32 && obj.yOrg < 42*32) obj.yPos = obj.yOrg + (obj.xPos % 64 > 32? 10:16);
  178.                                 else obj.yPos = obj.yOrg + (obj.xPos % 64 > 32? 16:10);
  179.                         }
  180.                 }
  181.                 if (obj.eventID == OBJECT::RFPOWERUP) {
  182.                         obj.yPos = obj.yOrg;
  183.                 }
  184.                 if (obj.eventID == OBJECT::GUNCRATE) {
  185.                         if (obj.xOrg > (jjLayerWidth[4]*32/2)) obj.xPos = obj.xOrg - 8;
  186.                         else obj.xPos = obj.xOrg + 8;
  187.                 }
  188.         }
  189.        
  190.         if (!isSnowing || jjLowDetail) jjIsSnowing = false;
  191.         else jjIsSnowing = true;
  192.        
  193.         weaponHook.processMain();
  194. }
  195.  
  196. void onReceive(jjSTREAM &in packet, int clientID) {
  197.         weaponHook.processPacket(packet, clientID);
  198. }
  199.  
  200. bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) {
  201.         return weaponHook.drawAmmo(play, canvas);
  202. }
  203.  
  204. void onFunction0(jjPLAYER@ play) {
  205.         isSnowing = true;
  206. }
  207.  
  208. void onFunction1(jjPLAYER@ play) {
  209.         isSnowing = false;
  210. }