const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated #include "MLLE-Include-1.6.asc" ///@MLLE-Generated #pragma require "ezgale-MLLE-Data-3.j2l" ///@MLLE-Generated #pragma require "ezgale-MLLE-Data-2.j2l" ///@MLLE-Generated #pragma require "ezgale-MLLE-Data-1.j2l" ///@MLLE-Generated #pragma require "ezgale.j2l" ///@MLLE-Generated ///@SaveAndRunArgs -server -capture ///@MLLE-Generated #pragma require "rain9.ogg" #pragma require "ezscarlet_leafsound.ogg" int sample, sample2; void onLevelLoad() { jjTexturedBGTexture = TEXTURE::MEDIVO; jjUseLayer8Speeds = true; /*jjSetWaterGradient(120,185,250, 120,185,250); jjWaterChangeSpeed = 0; jjWaterLayer = 15;*/ jjANIMATION@ animBubble = jjAnimations[jjAnimSets[ANIM::COMMON] + 1]; for (uint i = 0; i < animBubble.frameCount; ++i) { jjANIMFRAME@ frame = jjAnimFrames[animBubble + i]; jjPIXELMAP sprite(frame); for (uint x = 0; x < sprite.width; ++x) for (uint y = 0; y < sprite.height; ++y) if (sprite[x,y] != 0) sprite[x,y] += 115; sprite.save(frame); } jjPIXELMAP rain(32,32); for (uint x = 0; x < rain.width; ++x) { for (uint y = 0; y < rain.height; ++y) { if (x == 16) { if (y <= 16) rain[x,y] = 74; else if (y > 16 && y <= 24) rain[x,y] = 73; else rain[x,y] = 0; } else { rain[x,y] = 0; } } } jjANIMATION@ animRain = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2]; for (uint frameID = 0; frameID < animRain.frameCount; ++frameID) { jjANIMFRAME@ frame = jjAnimFrames[animRain.firstFrame + frameID]; rain.save(frame); frame.hotSpotX = -frame.width/2; frame.hotSpotY = -frame.height; } generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array = {40}); turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 18.75f, false); jjDelayGeneratedCrateOrigins = true; } void onLevelBegin() { for (int i = 1; i < jjObjectCount; i++) { if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 10; } jjObjectPresets[OBJECT::TOASTERBULLET].lightType = LIGHT::BRIGHT; jjObjectPresets[OBJECT::TOASTERBULLET].light = 8; jjObjectPresets[OBJECT::FIREBALLBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::BRIGHT; jjObjectPresets[OBJECT::FIREBALLBULLET].light = jjObjectPresets[OBJECT::FIREBALLBULLETPU].light = 8; if (jjGameMode == GAME::SP || jjGameMode == GAME::COOP) { for (int i = 0; i < jjLocalPlayerCount; i++) { jjPlayers[i].warpToTile(17,33,true); } } jjSampleLoad(SOUND::WIND_WIND2A, "rain9.ogg"); jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "ezscarlet_leafsound.ogg"); } 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) { if (jjEventGet(int(play.xPos/32), int(play.yPos/32)) == AREA::PATH) { int direction = jjParameterGet(int(play.xPos/32), int(play.yPos/32), 6, 3); play.buttstomp = 100; if (direction > 1) { if (play.xSpeed > 1) play.xSpeed = -2; } else if (direction == 0) { if (play.xSpeed < 1) play.xSpeed = 2; } } for (int i = 0; i < 1024; i++) { jjPARTICLE@ particle = jjParticles[i]; if (particle.type == PARTICLE::LEAF) { particle.xSpeed = -1.5; particle.ySpeed = 0.25; } if (particle.type == PARTICLE::RAIN) { particle.xSpeed = 0; particle.ySpeed = play.ySpeed < 0? 10 : int(10 + play.ySpeed); } } } void onMain() { jjSnowingType = jjGameTicks % 18 == 0? SNOWING::LEAF : SNOWING::RAIN; jjSnowingIntensity = jjRandom()%4; jjIsSnowingOutdoorsOnly = true; jjIsSnowing = !jjLowDetail; array layers = jjLayerOrderGet(); layers[0].hasTiles = layers[2].hasTiles = layers[3].hasTiles = !jjLowDetail; if (jjColorDepth == 16) { layers[7].hasTiles = true; layers[7].yOffset = 200; } else { layers[7].hasTiles = true; layers[7].yOffset = 1200; } jjTexturedBGFadePositionY = jjLowDetail? 0.5 : 0.25; for (int i = 1; i < jjObjectCount; i++) { jjOBJ@ obj = jjObjects[i]; if (obj.eventID == OBJECT::RFPOWERUP) { obj.xPos = obj.xOrg + 16; } if (obj.eventID == OBJECT::GUN8POWERUP) { obj.xPos = obj.xOrg - 16; } if (obj.eventID == OBJECT::REDSPRING) { obj.yPos = obj.yOrg + 20; } if (obj.eventID == OBJECT::FROZENSPRING) { obj.xPos = obj.xOrg - 16; obj.yPos = obj.yOrg + 20; } if (obj.eventID == OBJECT::GREENSPRING && (obj.xPos > 79*32 && obj.xPos < 81*32)) { obj.yPos = obj.yOrg + 20; } if (obj.eventID == OBJECT::CARROT) { obj.direction = obj.xPos > 80*32? 1:-1; } } if (!jjLowDetail) { sample = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::WIND_WIND2A, sample, 16, 0); sample2 = jjSampleLooped(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::SCIENCE_PLOPKAOS, sample2, 42, 0); } } /*void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) { jjSetWaterLevel(16000, true); } void onDrawLayer6(jjPLAYER@ play, jjCANVAS@ screen) { jjSetWaterLevel((play.cameraY - jjLayers[6].getYPosition(play)) + 328, true); }*/