Downloads containing ezindigo.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Indigo FallsFeatured Download FawFul Capture the flag 9.3 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.6.asc" ///@MLLE-Generated
#pragma require "ezindigo-MLLE-Data-4.j2l" ///@MLLE-Generated
#pragma require "ezindigo-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "ezindigo-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ezindigo-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "carjungrock2.j2t" ///@MLLE-Generated
#pragma require "SwampsN.j2t" ///@MLLE-Generated
#pragma require "CarrFixEve.j2t" ///@MLLE-Generated
#pragma require "ezindigo.j2l" ///@MLLE-Generated

bool toggleLayers = true;
bool warping = false;

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

void onLevelLoad() {
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40});	
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 21.5f, false);
}

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

void onPlayer(jjPLAYER@ player) {
	handleFastCustomSpringSpeeds(player);

	array<jjLAYER@> layers = jjLayerOrderGet();
	if (player.yPos < 76*32) warping = false;
  
	if (!jjLowDetail) {
		if (player.cameraY >= 22*32) {
			toggleLayers = true;
		} else {
			toggleLayers = false;
		}
	} else {
		layers[18].hasTiles = false;
	}
	if (jjLayers[2].hasTiles) {
		for (uint i = 5; i <= layers.length() - 1; i++) {
			layers[i].hasTiles = true;
		}
		layers[13].hasTiles = 
		layers[14].hasTiles = 
		layers[15].hasTiles = 
		layers[16].hasTiles = 
		layers[17].hasTiles = 
		layers[18].hasTiles = 
		layers[19].hasTiles = 
		layers[20].hasTiles = toggleLayers; 

		layers[21].hasTiles = 	
		layers[22].hasTiles = 
		layers[23].hasTiles = 
		layers[24].hasTiles = 
		layers[25].hasTiles = 
		layers[26].hasTiles = 		
		layers[27].hasTiles = 
		layers[28].hasTiles = 
		layers[29].hasTiles = 
		layers[30].hasTiles = 
		layers[31].hasTiles = 
		layers[32].hasTiles = !toggleLayers;
	} else {
		for (uint i = 5; i <= layers.length() - 1; i++) {
			layers[i].hasTiles = false;
		}
	}
}

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.causesRicochet = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
	obj.isBlastable = false;
	obj.deactivates = true;
	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;
		}
	}
}

int id() {
	if (!jjTriggers[2] && !jjTriggers[4]) return 1;
	else if (jjTriggers[2] && !jjTriggers[4]) return 2;
	else if (!jjTriggers[3] && jjTriggers[4]) return 3;
	else if (jjTriggers[3] && jjTriggers[4]) return 4;
	else return 6;
}

void onFunction0(jjPLAYER@ player) {
	if (!warping) {
		player.warpToID(id());
		warping = true;
	}
}