const bool MLLESetupSuccessful = MLLE::Setup(array = {null, null, NapsWeapons::AntiGravityBouncer(), null, null, null, null, null, null}); ///@MLLE-Generated #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated #pragma require "ab24ctf01-MLLE-Data-1.j2l" ///@MLLE-Generated #pragma require "ab24ctf01.j2l" ///@MLLE-Generated #include "AntiGravBouncers.asc" ///@MLLE-Generated #pragma require "AntiGravBouncers.asc" ///@MLLE-Generated #pragma require "lavaflow.wav" int sample; void onLevelLoad() { generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[1]], array = {40}); turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.f, false); jjUseLayer8Speeds = true; jjTexturedBGFadePositionY = 0.5; jjSetWaterLevel(70.5*32, true); jjSetWaterGradient(136,55,155, 18,4,32); jjWaterLighting = WATERLIGHT::GLOBAL; jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::BRIDGE] + 3]; for (uint j = 0; j < anim.frameCount; j++) { jjANIMFRAME@ frame = jjAnimFrames[anim + j]; jjPIXELMAP sprite(frame); for (uint x = 0; x < sprite.width; ++x) { for (uint y = 0; y < sprite.height; ++y) { if (sprite[x,y] >= 40 && sprite[x,y] <= 47) sprite[x,y] = 96 + (sprite[x,y]&7)*2; } } sprite.save(frame); } if (jjGameMode == GAME::SP) { jjLocalPlayers[0].warpToTile(14,54); } jjObjectPresets[OBJECT::STEAM].behavior = Steam(); jjSampleLoad(SOUND::WIND_WIND2A, "lavaflow.wav"); jjPAL standard; //we need to declare an instance of jjPAL before we can load any new palettes standard.load("Diam2.j2t"); //since everyone most likely has this tileset in their JJ2 folder jjPalette.copyFrom(16, 40, 16, standard, 1); jjPalette.copyFrom(59, 37, 59, standard, 1); //don't copy over entries 56-58 as they are unused by the JJ2 sprite palette, and replacing them could have unwanted side effects if they are utilised in the tileset jjPalette.apply(); } void onLevelReload() { if (jjGameMode == GAME::SP) { jjLocalPlayers[0].warpToTile(14,54); } jjPalette.apply(); } class Steam : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ obj) { obj.behave(jjLowDetail && jjGameTicks > 1? BEHAVIOR::INACTIVE : BEHAVIOR::STEAM); } } jjANIMSET@ customSpringSprite; array fastCustomSpringSpeeds(jjLocalPlayerCount); bool generateCustomSpringSprites(jjANIMSET@ anim, const array &in colors) { int length = colors.length(); bool success = (@customSpringSprite = anim).allocate(array(length * 3, 5)) !is null; if (success) { uint srcSet = jjAnimSets[ANIM::SPRING]; for (int i = 0; i < length; i++) { uint color = colors[i]; uint destAnimOffset = anim + i * 3; for (int j = 0; j < 3; j++) { uint srcAnim = jjAnimations[srcSet + j]; uint destAnim = jjAnimations[destAnimOffset + j]; for (int k = 0; k < 5; k++) { jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]); int width = image.width; int height = image.height; for (int l = 0; l < height; l++) { for (int m = 0; m < width; m++) { int pixel = image[m, l]; if (pixel >= 32 && pixel < 40) image[m, l] = color + (pixel & 7); } } if (!image.save(jjAnimFrames[destAnim + k])) return false; } } } } return success; } void initializeCustomSpring(jjOBJ@ obj) { int anim = obj.curAnim; obj.behave(obj.behavior = BEHAVIOR::SPRING, false); if (obj.curAnim != anim) { obj.curAnim = anim + 2; obj.determineCurFrame(); } obj.draw(); } void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) { if (horizontal) { obj.xSpeed = power; obj.ySpeed = 0.f; } else { obj.xSpeed = 0.f; obj.ySpeed = -power; if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) { int x = int(obj.xPos) >> 5; int y = int(obj.yPos) >> 5; if (jjParameterGet(x, y, 0, 1) != 0) { jjParameterSet(x, y, 0, 1, 0); obj.yPos -= 4.f; obj.ySpeed = power; } } } obj.behavior = initializeCustomSpring; obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0); obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0; obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false; obj.deactivates = obj.isFreezable = true; obj.bulletHandling = HANDLING::IGNOREBULLET; obj.playerHandling = HANDLING::SPECIAL; obj.lightType = LIGHT::NORMAL; obj.determineCurFrame(); } void onPlayer(jjPLAYER@ play) { play.lightType = LIGHT::FLICKER; } void offsetObj(jjOBJ@ obj, float x_Org, float y_Org, float x_Offset, float y_Offset) { if ((obj.xOrg/32) > (x_Org - 1) && (obj.xOrg/32) < (x_Org + 1) && (obj.yOrg/32) > (y_Org - 1) && (obj.yOrg/32) < (y_Org + 1)) { obj.xPos = obj.xOrg + x_Offset; obj.yPos = obj.yOrg + y_Offset; } } void onMain() { for (int i = 1; i < jjObjectCount; i++) { jjOBJ@ obj = jjObjects[i]; if (obj.isActive && obj.eventID == OBJECT::COPTER && obj.state == STATE::FLY) { obj.counter = 0; if (obj.var[4] == 0) obj.state = STATE::DONE; } if (obj.eventID == OBJECT::FROZENSPRING) { offsetObj(obj, 29, 25, 8, 16); offsetObj(obj, 49, 34, -8, 16); offsetObj(obj, 81, 34, 8, 16); offsetObj(obj, 101, 25, -8, 16); } } if (!jjLowDetail) { jjPARTICLE@ cinders = jjAddParticle(PARTICLE::SMOKE); cinders.xPos = (jjRandom()% 32) * jjLayerWidth[4]; cinders.yPos = jjWaterLevel - (jjRandom()% 256); cinders.ySpeed = -1; sample = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::WIND_WIND2A, sample, 52, 0); } jjLayers[1].yOffset = (71*32) - jjWaterLevel; jjLayers[1].hasTiles = jjLowDetail; jjWaterLayer = jjLowDetail? 99:1; } bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) { return MLLE::WeaponHook.drawAmmo(player, canvas); }