Downloads containing xlmscrapyard.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file
JJ2+ Only: ScrapyardFeatured Download PurpleJazz Capture the flag 9.5 Download file

File preview

const array<uint16> tilesToVFlip = {
	40, 41, 42, 43, 44,
	55, 56, 57, 58, 59
};

const array<uint16> tilesToGiveBlackBGs = {
	33, 45, 49, 69
};

const array<uint16> tilesToReplace1 = {
	340, 341, 342, 343, 344, 345, 346, 347, 348, 349
};

const array<uint16> tilesToReplace2 = {
	360, 361, 362, 363, 364, 365, 366, 367, 368, 369
};

const array<uint16> tilesToReplace3 = {
	380, 381, 382, 383, 384, 385, 386, 387, 388, 389
};

const array<uint16> tilesToReplace4 = {
	390, 391, 392, 393
};

void onLevelLoad() {
	for (int i = 0; i < 10; ++i) {
		jjPIXELMAP VFlippedCaves1(tilesToVFlip[i]);
		VFlippedCaves1.save(tilesToReplace1[i] | TILE::VFLIPPED, true);
		
		jjPIXELMAP VFlippedCaves2(tilesToVFlip[i]);
			for (uint x = 0; x < VFlippedCaves2.width; ++x)
				for (uint y = 0; y < VFlippedCaves2.height; ++y)
					if (VFlippedCaves2[x,y] == 0)
						VFlippedCaves2[x,y] = 95; //black background
		VFlippedCaves2.save(tilesToReplace2[i] | TILE::VFLIPPED, true);
		
		jjPIXELMAP cavesBlackBG(tilesToVFlip[i]);
			for (uint x = 0; x < cavesBlackBG.width; ++x)
				for (uint y = 0; y < cavesBlackBG.height; ++y)
					if (cavesBlackBG[x,y] == 0)
						cavesBlackBG[x,y] = 95;
		cavesBlackBG.save(tilesToReplace3[i], true);	
	}
	
	for (int i = 0; i < 4; ++i) {
		jjPIXELMAP cavesBlackBG(tilesToGiveBlackBGs[i]);
			for (uint x = 0; x < cavesBlackBG.width; ++x)
				for (uint y = 0; y < cavesBlackBG.height; ++y)
					if (cavesBlackBG[x,y] == 0)
						cavesBlackBG[x,y] = 95;
		cavesBlackBG.save(tilesToReplace4[i], true);		
	}

	jjPIXELMAP blackTile(759);
		for (uint x = 0; x < blackTile.width; ++x)
			for (uint y = 0; y < blackTile.height; ++y)
				if (blackTile[x,y] != 254)
					blackTile[x,y] = 95;
	blackTile.save(759, true);
	
	for (int i = 1; i < 255; i++) {
		if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP) {
			jjObjectPresets[i].behavior = CannotBeBuried();
		}
	}
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.f, false);
	
	darkenLayer(jjLayers[6]);
	darkenLayer(jjLayers[7]);
	
	jjDelayGeneratedCrateOrigins = true;
	jjUseLayer8Speeds = true;
}

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();
}

void darkenLayer(jjLAYER@ layer) {
	array<int> tileIDs, uniqueTileIDs;
	for (int i = 0; i < layer.height; i++) {
		for (int j = 0; j < layer.width; j++) {
			int tileID = layer.tileGet(j, i);
			if (tileID != 0)
				tileIDs.insertLast(tileID);
		}
	}
	int prev = 0;
	tileIDs.sortAsc();
	for (uint i = 0; i < tileIDs.length(); i++) {
		if (tileIDs[i] != prev)
			uniqueTileIDs.insertLast(prev = tileIDs[i]);
	}
	uint firstNewTile = jjTileCount;
	jjTilesFromTileset(jjTilesetFileName, 1, uniqueTileIDs.length());
	array<uint8> mapping(256);
	for (uint i = 0; i < uniqueTileIDs.length(); i++) {
		jjPIXELMAP tile(uniqueTileIDs[i]);
		for (int j = 0; j < 32; j++) {
			for (int k = 0; k < 32; k++) {
				uint8 pixel = tile[k, j];
				if (pixel != 0) {
					if (mapping[pixel] == 0) {
						jjPALCOLOR color = jjPalette.color[pixel];
						color.red = color.red / 2;
						color.green = color.green / 4;
						color.blue = color.blue / 4;
						mapping[pixel] = jjPalette.findNearestColor(color);
					}
					tile[k, j] = mapping[pixel];
				}
			}
		}
		tile.save(firstNewTile + i);
	}
	layer.generateSettableTileArea();
	for (int i = 0; i < layer.height; i++) {
		for (int j = 0; j < layer.widthReal; j++) {
			int tileID = layer.tileGet(j, i);
			if (tileID != 0)
				layer.tileSet(j, i, firstNewTile + uniqueTileIDs.find(tileID));
		}
	}
}

class CannotBeBuried : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP);
		if (jjMaskedPixel(int(obj.xPos), int(obj.yPos) + 8)) {
			obj.state = STATE::FLOAT;
		}
		if (obj.ySpeed < 0) obj.ySpeed = 0.25;
	}
}

void onMain() {
	jjLayerHasTiles[6] = !jjLowDetail;
}

void onFunction0(jjPLAYER@ play) {
	play.showText("@@@@@Scrapyard@Created by PurpleJazz of XLM (2015-2016)@Tileset conversion by NOKA, edited by PurpleJazz@np: Michiel van den Bos - Botpack 9 [4:49]");
}

void onFunction1(jjPLAYER@ play) {
	play.showText("@@@@Spawn Times@Ammo: 16@Full NRG: 28@Powerups: 28");
}

void onFunction2(jjPLAYER@ play) {
	play.showText("@@@@jazz 4 over online ? what online@@jazz jack rabbit 4 is new@@edit boss dog@@jazz 4, jazz 5, jazz 6, jazz 7, jazz 8,@@jazz news and jazz jack rabbit kill.");
}