const bool MLLESetupSuccessful = MLLE::Setup(array = {null, null, BubbleGun::Weapon(), null, null, null, SpikeBomb::Weapon(), null, null}); ///@MLLE-Generated #include "MLLE-Include-1.8w.asc" ///@MLLE-Generated #pragma require "xlmlush-MLLE-Data-3.j2l" ///@MLLE-Generated #pragma require "xlmlush-MLLE-Data-2.j2l" ///@MLLE-Generated #pragma require "xlmlush-MLLE-Data-1.j2l" ///@MLLE-Generated #pragma require "Lomat.j2t" ///@MLLE-Generated #pragma require "PsychSunset.j2t" ///@MLLE-Generated #pragma require "CarrFix.j2t" ///@MLLE-Generated #pragma require "xlmlush.j2l" ///@MLLE-Generated #include "SpikeBomb.asc" ///@MLLE-Generated #pragma require "SpikeBomb.asc" ///@MLLE-Generated #include "BubbleGun.asc" ///@MLLE-Generated #pragma require "BubbleGun.asc" ///@MLLE-Generated ///@SaveAndRunArgs -server -capture ///@MLLE-Generated void onLevelLoad() { jjUseLayer8Speeds = true; jjDelayGeneratedCrateOrigins = true; jjWeapons[WEAPON::GUN8].comesFromGunCrates = true; jjWeapons[WEAPON::GUN9].comesFromGunCrates = true; jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL; generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array = {40, 64, 16, 88}); turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false); turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 17.75f, false); turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 27.45f, false); turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.0f, false); jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false; jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16; jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2; jjObjectPresets[OBJECT::GUNCRATE].behavior = GreyCrate(); jjObjectPresets[OBJECT::BOUNCERAMMO15].behavior = GreyCrate(); jjObjectPresets[OBJECT::TOASTERAMMO15].behavior = GreyCrate(); jjObjectPresets[OBJECT::ICEAMMO15].behavior = GreyCrate(); jjObjectPresets[OBJECT::RFAMMO15].behavior = GreyCrate(); jjObjectPresets[OBJECT::SEEKERAMMO15].behavior = GreyCrate(); jjObjectPresets[OBJECT::BOMBCRATE].behavior = GreenCrate(); jjAnimSets[ANIM::FROG].load(); jjAnimSets[ANIM::DRAGFLY].load(); jjSampleLoad(SOUND::P2_POEP, "spelunky_ignite.wav"); jjLayers[1].spriteMode = SPRITE::BLEND_NORMAL; jjLayers[1].spriteParam = 255; jjSetWaterLevel(58*32, true); } class GreyCrate : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ obj) { obj.behave(BEHAVIOR::CRATE, false); } void onDraw(jjOBJ@ obj) { jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 64); } } class GreenCrate : jjBEHAVIORINTERFACE { void onBehave(jjOBJ@ obj) { obj.behave(BEHAVIOR::CRATE, false); } void onDraw(jjOBJ@ obj) { jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 16); } } void setWaterProperties() { jjSetWaterLevel(waterHeight,true); } int waterHeight = 58*32; 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 handleFastCustomSpringSpeeds(jjPLAYER@ play) { if (play.ySpeed < -32.f) { fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f)); } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) { if (play.ySpeed < -31.f) { fastCustomSpringSpeeds[play.localPlayerID]--; play.ySpeed = -32.f; } else { fastCustomSpringSpeeds[play.localPlayerID] = 0; } } } void onLevelReload() { MLLE::ReapplyPalette(); MLLE::SpawnOffgridsLocal(); } void onPlayer(jjPLAYER@ player) { player.lightType = LIGHT::NONE; if (player.yPos >= 0) { int skill = jjParameterGet(uint16(player.xPos/32), uint16(player.yPos/32), -4, 2); if (skill == 2) { if (jjLayers[1].spriteParam > 96) { if (jjLayers[1].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP); jjLayers[1].spriteParam = jjLayers[1].spriteParam - 10; } } else if (jjLayers[1].spriteParam != 255) { jjLayers[1].spriteParam = jjLayers[1].spriteParam + 10; } } } void onLevelBegin() { MLLE::SpawnOffgrids(); for (int i = 1; i < 255; i++) { jjOBJ@ preset = jjObjectPresets[i]; if (preset.playerHandling == HANDLING::PICKUP) { preset.behavior = CannotBeShotDown(preset.behavior); } } } class CannotBeShotDown : jjBEHAVIORINTERFACE { CannotBeShotDown(const jjBEHAVIOR &in behavior) { originalBehavior = behavior; } void onBehave(jjOBJ@ obj) { obj.behave(originalBehavior); if (obj.state == STATE::FLOATFALL) obj.state = STATE::FLOAT; } bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { if (bullet is null) { obj.behavior = originalBehavior; if (player.objectHit(obj, force, obj.playerHandling)) return true; obj.behavior = this; } return false; } private jjBEHAVIOR originalBehavior; } bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) { return MLLE::WeaponHook.drawAmmo(player, canvas); }