Downloads containing mlovc.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Officially Timeless cooba Battle N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, BubbleGun::Weapon(), se::FireworkMLLEWrapper(), null, null, SpikeBomb::Weapon(), null, SmokeWopens::ElektrekShield::Wopen()}); ///@MLLE-Generated
#include "MLLE-Include-1.8w.asc" ///@MLLE-Generated
#pragma require "mlovc-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "mlovc-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "Qobmenu.j2t" ///@MLLE-Generated
#pragma require "brix32.j2t" ///@MLLE-Generated
#pragma require "JungUlt-Day.j2t" ///@MLLE-Generated
#pragma require "mlovc.j2l" ///@MLLE-Generated
#include "ElektrekShield.asc" ///@MLLE-Generated
#pragma require "ElektrekShield.asc" ///@MLLE-Generated
#include "SpikeBomb.asc" ///@MLLE-Generated
#pragma require "SpikeBomb.asc" ///@MLLE-Generated
#include "SEfirework-mlle.asc" ///@MLLE-Generated
#pragma require "SEfirework-mlle.asc" ///@MLLE-Generated
#include "BubbleGun.asc" ///@MLLE-Generated
#pragma require "BubbleGun.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -battle ///@MLLE-Generated

/*******************************
A 2026 Mystic Legends Release!
http://www.mysticlegends.org
/******************************/

#pragma require "SpringMushroom.j2a"
#pragma require "g2_launch.ogg"
#pragma require "g2_launch2.ogg"

#pragma require "LHIT.wav"
#pragma require "LSTART.wav"

array<SOUND::Sample> IceSamples = { SOUND::AMMO_ICEGUN, SOUND::AMMO_ICEGUN2, SOUND::AMMO_ICEGUNPU };
array<SOUND::Sample> IceSamples2 = { SOUND::AMMO_ICEPU1, SOUND::AMMO_ICEPU2, SOUND::AMMO_ICEPU3, SOUND::AMMO_ICEPU4 };

//thanks minmay
int nextCustomAnimSet() {
    for (int i = 0; i < 256; i++) {
        if (jjAnimSets[ANIM::CUSTOM[i]].firstAnim == 0) {
            return ANIM::CUSTOM[i];
        }
    }
    return -1;
}

///@Event 1=One Way Floor                     |+|Modifier  |One    |Way+    |Event:8|Delay Secs:8
void CustomGemRing(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		
		obj.animSpeed = 5;
		
		obj.counterEnd = uint8(jjParameterGet(int(obj.xOrg/32), int(obj.yOrg/32) + 1, 0, 8));
		obj.points = uint8(jjParameterGet(int(obj.xOrg/32), int(obj.yOrg/32) + 1, 8, 8));
		if (obj.points == 0) obj.points = 7;
		
		obj.curAnim = jjObjectPresets[obj.counterEnd].curAnim;
		
		obj.state = STATE::SLEEP;
	}
	obj.behave(BEHAVIOR::GEMRING);
}

//thanks PJ
jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
	int length = colors.length();
	bool success = (@customSpringSprite = anim).allocate(array<uint>(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 SpringMushroom : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::SPRING);
		if (obj.state == STATE::SPRING && !jjLowDetail) {
			jjPARTICLE@ spores = jjAddParticle(PARTICLE::FIRE);
			if (spores !is null) {
				spores.xPos = int(obj.xPos - 14) + (jjRandom()%14)*2;
				spores.yPos = int(obj.yPos - 14) + jjRandom()%14;
				if (jjRandom()%2 > 0)
					spores.ySpeed = -1;
				else spores.ySpeed = -0.6;
				spores.fire.color = 64;
				spores.fire.colorStop = 72;
			}
		}
	}
}

class CannotBeShotDown : jjBEHAVIORINTERFACE {
	jjBEHAVIOR originalBehavior;
	CannotBeShotDown(jjBEHAVIOR behavior) {
		originalBehavior = behavior;
	}
	void onBehave(jjOBJ@ obj) override {
		obj.behave(originalBehavior);
		if (obj.state == STATE::FLOATFALL)
			obj.state = STATE::FLOAT;
		if (obj.eventID == OBJECT::FULLENERGY)
			obj.xPos = obj.xOrg - 16;
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		obj.behavior = originalBehavior;
		if (bullet is null)
			player.objectHit(obj, force, obj.playerHandling);
		else
			bullet.objectHit(obj, obj.playerHandling);
		obj.behavior = CannotBeShotDown(obj.behavior);
		return true;
	}
}

///@Event 150=Colored Light                   |+|Light     |Color  |Light  |Sample:s8|Type:{Orange,Blue,Purple,tbd,tbd,tbd,tbd,tbd}3
//void ColoredTorch(jjOBJ@ obj) {
	//int color = color = jjParameterGet(int(obj.xPos/32), int(obj.yPos/32), 8, 3);
	//if (color > 2) color = 0;	
	
	//int index = 0;
	//switch (color) {
		//case 0:
			//index = 243;
			//break;
		//case 1:
			//index = 245;
			//break;
		//case 2:
			//index = 241;
			//break;
	//}
	
	//jjDrawSprite(obj.xPos, obj.yPos + 50, ANIM::PICKUPS, 15, 0, 0, SPRITE::NORMAL, 0, 12);
	//jjDrawSprite(obj.xPos, obj.yPos + 48, ANIM::PICKUPS, 15, 0, 0, SPRITE::SINGLECOLOR, index, 12);
	//jjDrawSprite(obj.xPos, obj.yPos + 32, ANIM::PICKUPS, 16, 0, 0, SPRITE::SINGLECOLOR, index-1, 12);
	//jjDrawTile(obj.xPos - 15, obj.yPos - 15, 13 + color + TILE::ANIMATED);
	
	//obj.lightType = LIGHT::NONE;
	//obj.light = 0;
	//obj.behave(BEHAVIOR::STEADYLIGHT, false);
//}

void onLevelLoad() {
	//jjWaterLayer = 0x7FFFFFFF;
	
	MLLE::GetLayer("Sprite Layer Chroma").hasTiles = true;
	
	int springAnimSet = nextCustomAnimSet();
	
	jjAnimSets[springAnimSet].load(0, "SpringMushroom.j2a");
	for (int i = 0; i < 8; i++) {
		jjAnimations[jjAnimSets[ANIM::SPRING] + i] = jjAnimations[jjAnimSets[springAnimSet] + i];
	}
	
	//jjObjectPresets[OBJECT::FLICKERLIGHT].behavior = ColoredTorch;
	
	jjObjectPresets[OBJECT::GEMRING].behavior = CustomGemRing;
	jjObjectPresets[OBJECT::GEMRING].triggersTNT = false;
	
	generateCustomSpringSprites(jjAnimSets[nextCustomAnimSet()], array<uint> = {40});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.5f, false);
	
	jjObjectPresets[OBJECT::REDSPRING].behavior =
	jjObjectPresets[OBJECT::GREENSPRING].behavior =
	jjObjectPresets[OBJECT::BLUESPRING].behavior =
	jjObjectPresets[OBJECT::FROZENSPRING].behavior = SpringMushroom();
	
	jjSampleLoad(SOUND::COMMON_SPRING1, "g2_launch.ogg");
	jjSampleLoad(SOUND::SPRING_BOING_DOWN, "g2_launch2.ogg");
	
	//thanks Violet
    array<uint8> recolor(256);
    for (uint i = 15; i < 88; ++i) //don't change most sprite colors
        recolor[i] = i;
    for (uint i = 80; i < 88; ++i) //teal to orange
        recolor[i] = i - 40;
    for (uint i = 88; i < 96; ++i) //purple to violet
        recolor[i] = i + 16;
    for (uint i = 32; i < 40; ++i) //blue to also violet
        recolor[i] = i + 72;
    
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::AMMO] + 63]); //bullet
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::AMMO] + 61]); //pickup
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 66]); //monitor   
    
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 3]); //barrel
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 6]); //barrel shards
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 7]);
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 8]);
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 9]);
    
	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
	
	jjObjectPresets[OBJECT::ICEPOWERUP].direction = SPRITE::FLIPHV;
	
	for (uint i = 0; i < IceSamples.length(); i++) {
		jjSampleLoad(IceSamples[i], "LHIT.wav");
	}
	
	for (uint i = 0; i < IceSamples2.length(); i++) {
		jjSampleLoad(IceSamples2[i], "LSTART.wav");
	}
	
	//jjObjectPresets[OBJECT::STOMPSCENERY].behavior = OnlyTNTScenery();
	//jjObjectPresets[OBJECT::STOMPSCENERY].playerHandling = HANDLING::SPECIAL;
	//jjObjectPresets[OBJECT::STOMPSCENERY].isBlastable = false;
	//jjObjectPresets[OBJECT::STOMPSCENERY].triggersTNT = false;
	//jjObjectPresets[OBJECT::STOMPSCENERY].scriptedCollisions = true;
	
	jjObjectPresets[OBJECT::ONEUP].behavior = jjObjectPresets[OBJECT::TNTAMMO3].behavior;
	jjObjectPresets[OBJECT::ONEUP].var[3] = WEAPON::TNT - 1;
	jjObjectPresets[OBJECT::ONEUP].eventID = OBJECT::TNTAMMO3;
	
	jjObjectPresets[OBJECT::FULLENERGY].behavior = CannotBeShotDown(jjObjectPresets[OBJECT::FULLENERGY].behavior);
}

//does the opposite of what it's called!
//class OnlyTNTScenery : jjBEHAVIORINTERFACE {
    //void onBehave(jjOBJ@ obj) {
        //obj.behavior = BEHAVIOR::DESTRUCTSCENERY;
    //}
    //bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
        //if (bullet is null) {
            //jjAlert("kek");
            //return true;
        //}
        //else return false;
    //}
//}

void onMain() {
	jjLAYER @bluefire = MLLE::GetLayer("blue torchlight anims");
	jjLAYER @bluecoronas = MLLE::GetLayer("blue torchlight special");
	
	if (jjTriggers[10] && bluefire.spriteParam < 255) {
		bluefire.spriteParam += 17;
		bluecoronas.spriteParam += 17;
	}
	
	jjLayerYOffset[1] = jjSin(jjGameTicks*4)*5;
	
	MLLE::GetLayer("Layer 3 offset bricks").hasTiles = MLLE::GetLayer("Layer 3 offset shadows").hasTiles = !jjLowDetail;
}


void recolorAnimation(const array<uint8>& recolor, jjANIMATION@ anim) {
    for (uint i = 0; i < anim.frameCount; ++i) {
        jjANIMFRAME@ frame = jjAnimFrames[anim + i];
        jjPIXELMAP(frame).recolor(recolor).save(frame);
    }
}

void onLevelReload() {
	MLLE::SpawnOffgridsLocal();
	MLLE::ReapplyPalette();
}


bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

void onLevelBegin() {
	MLLE::SpawnOffgrids();
}