#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated #pragma require "ab24btl17-MLLE-Data-1.j2l" ///@MLLE-Generated #pragma require "ab24btl17.j2l" ///@MLLE-Generated #include "BubbleGun.asc" ///@MLLE-Generated #pragma require "BubbleGun.asc" ///@MLLE-Generated #include "invisibilitycarrot.asc" const bool MLLESetupSuccessful = MLLE::Setup(array = {null, null, BubbleGun::Weapon(), null, null, null, null, null, null}); #pragma require "caveambience3.wav" #pragma require "fan_sm4.wav" #pragma require "mloop2.wav" #pragma require "amb_puls.wav" int sample = 0; bool createFish = true; array fishObjects = { OBJECT::APPLE, //0, OBJECT::BANANA, //1 OBJECT::BURGER, //2 OBJECT::CAKE, //3 OBJECT::CANDY, //4 OBJECT::CHERRY, //5 OBJECT::CUPCAKE, //6 OBJECT::DONUT, //7 OBJECT::FRIES, //8 OBJECT::GRAPES, //9 OBJECT::HAM, //10 OBJECT::THING //11 }; array fishToSpawn = { 2,3,4,1,2,2,1,7,3,1,2,1 }; void onLevelLoad() { jjWaterLayer = 8; jjSetWaterGradient(0, 15, 45, 0, 15, 45); jjWaterLighting = WATERLIGHT::GLOBAL; jjTexturedBGTexture = TEXTURE::XARGON; jjUseLayer8Speeds = true; jjTexturedBGFadePositionY = 0.65; for (uint i = 0; i < fishObjects.length(); i++) { jjObjectPresets[fishObjects[i]].behavior = AmbientFish(); jjObjectPresets[fishObjects[i]].special = i; } jjAnimSets[ANIM::FISH].load(); jjObjectPresets[OBJECT::WEENIE].behavior = AmbientFish(); jjObjectPresets[OBJECT::LEMON].behavior = FishSpawner(); jjObjectPresets[OBJECT::LEMON].playerHandling = HANDLING::PARTICLE; jjObjectPresets[OBJECT::LEMON].bulletHandling = HANDLING::IGNOREBULLET; jjObjectPresets[OBJECT::LEMON].isBlastable = false; jjObjectPresets[OBJECT::CRAB].behavior = AmbientCrab(); jjAnimSets[ANIM::UTERUS].load(); InvisibilityCarrot::loadPresets(OBJECT::FASTFEET); InvisibilityCarrot::invisibilityTime = 30*70; jjObjectPresets[OBJECT::BLASTERPOWERUP].direction = 0; jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = jjObjectPresets[OBJECT::ICEPOWERUP].direction = -1; jjSampleLoad(SOUND::WIND_WIND2A, "fan_sm4.wav"); jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "caveambience3.wav"); jjSampleLoad(SOUND::COMMON_DRINKSPAZZ1, "amb_puls.wav"); jjSampleLoad(SOUND::COMMON_DRINKSPAZZ3, "mloop2.wav"); generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array = {40, 88, 48}); generateFishSprites(jjAnimSets[ANIM::CUSTOM[1]]); colorFishSprites(0, array = {32, 80, 48}); colorFishSprites(1, array = {16, 40, 88}); colorFishSprites(2, array = {24, 72, 40}); colorFishSprites(3, array = {31, 56, 80}); colorFishSprites(4, array = {40, 32, 48}); colorFishSprites(5, array = {88, 32, 16}); colorFishSprites(6, array = {72, 24, 40}); colorFishSprites(7, array = {71, 64, 48}); colorFishSprites(8, array = {48, 32, 88}); colorFishSprites(10, array = {80, 16, 56}); colorFishSprites(11, array = {56, 56, 56}); turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false); jjObjectPresets[OBJECT::REDSPRING].ySpeed = jjObjectPresets[OBJECT::REDSPRING].ySpeed - 0.5; jjWeapons[WEAPON::GUN8].comesFromGunCrates = jjWeapons[WEAPON::GUN9].comesFromGunCrates = true; jjWeapons[WEAPON::SEEKER].comesFromGunCrates = false; jjWeapons[WEAPON::ICE].gradualAim = true; jjObjectPresets[OBJECT::AMBIENTSOUND].behavior = AmbientSound(); } void onLevelBegin() { uint a, b, c, d; jjLocalPlayers[0].furGet(a, b, c, d); switch (jjLocalPlayers[0].charCurr) { case CHAR::JAZZ: colorFishSprites(9, array = {a, b, d}); break; case CHAR::SPAZ: colorFishSprites(9, array = {b, d, c}); break; case CHAR::LORI: colorFishSprites(9, array = {d, a, c}); break; default: colorFishSprites(9, array = {a, b, c}); break; } jjANIMATION@ animDopefish = jjAnimations[jjObjectPresets[OBJECT::WEENIE].curAnim]; animDopefish.frameCount = 1; jjANIMFRAME@ frameDopefish = jjAnimFrames[animDopefish.firstFrame]; jjPIXELMAP dopefish(114*32, 95*32, 32, 32, 4); dopefish.save(frameDopefish); frameDopefish.hotSpotX = -frameDopefish.width / 2; frameDopefish.hotSpotY = -frameDopefish.height / 2; } 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(); } class AmbientSound : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ sound) { sound.behave(jjLowDetail && jjGameTicks >= 2? BEHAVIOR::INACTIVE : BEHAVIOR::AMBIENTSOUND, false); } } bool inView(const jjOBJ@ obj) { for (int i = 0; i < jjLocalPlayerCount; i++) { const jjPLAYER@ play = jjLocalPlayers[i]; if (obj.xPos > play.cameraX - 512 && obj.yPos > play.cameraY - 256 && obj.xPos < play.cameraX + jjSubscreenWidth + 512 && obj.yPos < play.cameraY + jjSubscreenHeight + 256) return true; } return false; } void generateFishSprites(jjANIMSET@ anim) { uint srcSet = jjAnimSets[ANIM::FISH]; anim.allocate(array(fishObjects.length(), 6)); for (uint i = 0; i < fishObjects.length(); i++) { uint srcAnim = jjAnimations[srcSet + 1]; uint destAnim = jjAnimations[anim + i]; for (int j = 0; j < 6; j++) { jjPIXELMAP image(jjAnimFrames[destAnim + j] = jjAnimFrames[srcAnim + j]); image.save(jjAnimFrames[destAnim + j]); } } } void colorFishSprites(uint src, const array &in colors) { int length = colors.length(); jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::CUSTOM[1]] + src]; for (int i = 0; i < 6; i++) { jjPIXELMAP image(jjAnimFrames[anim + i]); int width = image.width; int height = image.height; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int pixel = image[x, y]; if (pixel >= 32 && pixel < 40) { image[x, y] = colors[0] + (pixel & 7); } if (pixel >= 80 && pixel < 88) { image[x, y] = colors[1] + (pixel & 7); } if (pixel >= 48 && pixel < 56) { image[x, y] = colors[2] + (pixel & 7); } } image.save(jjAnimFrames[anim + i]); } } } class AmbientFish : jjBEHAVIORINTERFACE { float size, xOffset, yOffset; bool cosine; void onBehave(jjOBJ@ obj) { switch (obj.eventID) { case OBJECT::APPLE: obj.xSpeed = 1; obj.ySpeed = 60; size = 1; xOffset = 48; yOffset = 24; cosine = true; break; case OBJECT::BANANA: obj.xSpeed = 1.25; obj.ySpeed = 80; size = 0.85; xOffset = 24; yOffset = 16; cosine = false; break; case OBJECT::BURGER: obj.xSpeed = 1.5; obj.ySpeed = 15; size = 0.75; xOffset = 48; yOffset = 24; cosine = true; break; case OBJECT::CAKE: obj.xSpeed = 0.75; obj.ySpeed = 25; size = 2; xOffset = 48; yOffset = 24; cosine = false; break; case OBJECT::CANDY: obj.xSpeed = 1.2; obj.ySpeed = 100; size = 1.5; xOffset = 48; yOffset = 24; cosine = true; break; case OBJECT::CHERRY: obj.xSpeed = 1.25; obj.ySpeed = 70; size = 1.33; xOffset = 48; yOffset = 24; cosine = false; break; case OBJECT::CUPCAKE: obj.xSpeed = 0.45; obj.ySpeed = 15; size = 2.25; xOffset = 88; yOffset = 64; cosine = true; break; case OBJECT::DONUT: obj.xSpeed = 2.5; obj.ySpeed = 140; size = 0.5; xOffset = 16; yOffset = 8; cosine = true; break; case OBJECT::FRIES: obj.xSpeed = 0.9; obj.ySpeed = 75; size = 1; xOffset = 48; yOffset = 24; cosine = true; break; case OBJECT::GRAPES: obj.xSpeed = 1; obj.ySpeed = 60; size = 1; xOffset = 48; yOffset = 24; cosine = false; break; case OBJECT::HAM: obj.xSpeed = 0.9; obj.ySpeed = 50; size = 1.2; xOffset = 56; yOffset = 32; cosine = true; break; case OBJECT::THING: obj.xSpeed = 0.5; obj.ySpeed = 10; size = 2; xOffset = 0; yOffset = 0; cosine = false; obj.lightType = LIGHT::LASER; obj.light = 15; break; case OBJECT::WEENIE: obj.xSpeed = 0.5; obj.ySpeed = 30; size = 1; xOffset = 0; yOffset = 0; cosine = false; break; } if (jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::PATH) { obj.direction *= -1; } if (obj.counter == 0) { obj.xPos = obj.xPos + (jjRandom()%2 == 0? xOffset:-xOffset); obj.yPos = obj.yPos + (jjRandom()%2 == 0? yOffset:-yOffset); if (jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::PATH) { obj.delete(); } obj.direction = jjRandom()%2 == 0? 1:-1; obj.age = jjRandom()%6; obj.counter = 1; } obj.xPos = obj.xPos + (obj.age * 0.15 * obj.direction) + (obj.xSpeed * obj.direction); obj.bulletHandling = HANDLING::IGNOREBULLET; obj.playerHandling = HANDLING::PARTICLE; obj.deactivates = obj.triggersTNT = obj.isTarget = obj.isBlastable = obj.isFreezable = false; if (!inView(obj) || !createFish) { obj.delete(); } } void onDraw(jjOBJ@ obj) { if (!jjLowDetail && createFish && inView(obj)) { jjDrawResizedSprite( int(obj.xPos), int(obj.yPos + (cosine? jjCos(jjGameTicks) * obj.ySpeed : jjSin(jjGameTicks) * obj.ySpeed)), obj.eventID == OBJECT::WEENIE? ANIM::PICKUPS : ANIM::CUSTOM[1], obj.eventID == OBJECT::WEENIE? 91 : obj.special, jjGameTicks / 10 % 6, size * obj.direction * (obj.eventID == OBJECT::WEENIE? -1:1), size, obj.eventID == OBJECT::THING || obj.eventID == OBJECT::WEENIE || jjColorDepth == 8? SPRITE::NORMAL : SPRITE::TINTED, 152, 10, 10 ); } } } class FishSpawner : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ obj) { if (obj.state == STATE::START && inView(obj) && createFish) { if (jjRandom()%300 == 0) { spawnFish(obj, (jjRandom()%3 == 0? OBJECT::WEENIE : OBJECT::THING), 1); } else { uint rand = jjRandom()%(fishObjects.length() - 1); if (rand == 6) { if (jjRandom()% 2 == 0) spawnFish(obj, fishObjects[rand], fishToSpawn[rand]); } else { spawnFish(obj, fishObjects[rand], fishToSpawn[rand]); } obj.state = STATE::DONE; } } if (!inView(obj) || !createFish) { obj.state = STATE::START; } } void spawnFish(jjOBJ@ obj, OBJECT::Object fishEvent, uint num) { for (uint i = 0; i < num; i++) { uint randX = int(obj.xPos - 192) + ((jjRandom()%32)*12); uint randY = int(obj.yPos - 64 + ((jjRandom()%32)*4)); if (jjEventGet((randX/32), (randY/32)) != AREA::PATH) { jjOBJ@ fish = jjObjects[jjAddObject(fishEvent, randX, randY, obj.creatorID, CREATOR::OBJECT)]; } } } } class AmbientCrab : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ obj) { obj.behave(BEHAVIOR::WALKINGENEMY, false); obj.bulletHandling = HANDLING::IGNOREBULLET; obj.playerHandling = HANDLING::PARTICLE; if (!jjLowDetail && createFish && inView(obj)) { jjDrawResizedSpriteFromCurFrame(obj.xPos, int(obj.yPos + 8), obj.curFrame, 1 * obj.direction, 1, SPRITE::SINGLECOLOR, 152, 10, 10); jjDrawResizedSpriteFromCurFrame(obj.xPos, int(obj.yPos + 8), obj.curFrame, 1 * obj.direction, 1, SPRITE::TRANSLUCENTSINGLEHUE, 72, 10, 10); } } } void onDrawLayer4(jjPLAYER@, jjCANVAS@ canvas) { jjSetWaterLevel(16000, true); InvisibilityCarrot::drawPlayers(); } void onDrawLayer5(jjPLAYER@ play, jjCANVAS@ canvas) { jjSetWaterLevel(-32, true); } void onPlayer(jjPLAYER@ play) { if (!jjLowDetail) { if (jjGameTicks > 7) { sample = jjSampleLooped(play.xPos, play.yPos, SOUND::SCIENCE_PLOPKAOS, sample, 40, 0); } } InvisibilityCarrot::playerSettings(play); play.lighting = jjColorDepth == 8? 110:100; jjEnforceLighting = jjColorDepth == 8? LIGHT::COMPLETE : LIGHT::OPTIONAL; } void onMain() { for (int i = 1; i < jjObjectCount; i++) { jjOBJ@ obj = jjObjects[i]; if (obj.eventID == OBJECT::ICEBULLETPU && obj.xSpeed > -0.5 && obj.xSpeed < 0.5) { obj.xSpeed = 0; } } array layers = jjLayerOrderGet(); layers[6].hasTiles = jjColorDepth == 8? true:false; jjWaterLayer = jjColorDepth == 16? 9:99; jjTexturedBGFadePositionY = jjLowDetail? 0.5 : jjColorDepth == 16? 0.65:0.9; } bool onLocalChat(string &in text, CHAT::Type type) { if (type == CHAT::NORMAL && text == "!fish on") { if (!createFish) createFish = true; jjAlert("|||Fish have been |||||ENABLED"); return true; } else if (type == CHAT::NORMAL && text == "!fish off") { if (createFish) createFish = false; jjAlert("|||Fish have been ||||||DISABLED"); return true; } else return false; } bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) { return MLLE::WeaponHook.drawAmmo(player, canvas); } bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) { InvisibilityCarrot::drawTimer(play, canvas); return true; }