Downloads containing xlmnecropolisrn.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Necropolis Superjazz Battle N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, se::RollerMLLEWrapper(), null, null, null, null, ArcaneWeapons::NailGun::Weapon(), null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "xlmnecropolisrn-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmnecropolisrn-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "Castle1.j2t" ///@MLLE-Generated
#pragma require "Inferno1.j2t" ///@MLLE-Generated
#pragma require "HauntedH1Lite.j2t" ///@MLLE-Generated
#pragma require "sanctuaryofthevampire.j2t" ///@MLLE-Generated
#pragma require "Egypt_Light.j2t" ///@MLLE-Generated
#pragma require "Moonrise.j2t" ///@MLLE-Generated
#pragma require "DamnBones.j2t" ///@MLLE-Generated
#pragma require "ICInfernoN.j2t" ///@MLLE-Generated
#pragma require "xlmnecropolisrn.j2l" ///@MLLE-Generated
#include "ArcaneWeapon5.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon5.asc" ///@MLLE-Generated
#include "SEroller-mlle.asc" ///@MLLE-Generated
#pragma require "SEroller-mlle.asc" ///@MLLE-Generated

void CantBeBuried(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::PICKUP);
	
	if (jjMaskedPixel(int(obj.xPos), int(obj.yPos) + 8)) {
		obj.state = STATE::FLOAT;
	}
}

class VisualSprite {
	int x;
	int y;
	int angle;
	uint8 frame;
	VisualSprite(int x, int y, uint8 frame, int angle) {
		this.x = x;
		this.y = y;
		this.frame = frame;
		this.angle = angle;
	}
}

class VisualSpriteAnimated {
	float x;
	float y;
	float xSpeed;
	uint8 animation;
	uint8 modeParam;
	bool hasShadow;
	ANIM::Set animSet;
	SPRITE::Mode mode;
	
	VisualSpriteAnimated(float x, float y, ANIM::Set animSet, uint8 animation, bool hasShadow, SPRITE::Mode mode, uint8 modeParam, float xSpeed = 0) {
		// Scrap ySpeed for now due to scaling issues, etc. Probably not practical like that anyway...
		this.x = x;
		this.y = y;
		this.animSet = animSet;
		this.animation = animation;
		this.hasShadow = hasShadow;
		this.mode = mode;
		this.modeParam = modeParam;
		this.xSpeed = xSpeed;
	}
}

const int8 TILE_SHIFT = 5;
const int8 LAYER_6_Y_OFFSET = -8;

const uint8 SPRITE_BRIGHTNESS = 64;

const float LAYER_6_X_BEGIN = -8 << TILE_SHIFT;
const float LAYER_6_Y_BEGIN = -8 << TILE_SHIFT;
const float LAYER_6_X_END = 38 << TILE_SHIFT;
const float LAYER_6_Y_END = 28 << TILE_SHIFT;

jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);

// 7 = last frame
const array<VisualSprite@> visualBones = {
	VisualSprite(-6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 14) << TILE_SHIFT, 0, 100), // 0
	VisualSprite(-3 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 1, 200),
	VisualSprite(1 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 2, 250),
	VisualSprite(8 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 3, 350),
	VisualSprite(11 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 4, 300), // 4
	VisualSprite(8 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 5, 400),
	VisualSprite(13 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 6, 500),
	VisualSprite(18 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 7, 650),
	VisualSprite(20 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 0, 700),
	VisualSprite(22 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 1, 800), // 9
	VisualSprite(30 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 2, 900),
	VisualSprite(29 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 3, 700),
	VisualSprite(33 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 4, 800),
	VisualSprite(34 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 5, 600),
	VisualSprite(41 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 25) << TILE_SHIFT, 6, 500), // 14
	VisualSprite(38 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 7, 400),
	VisualSprite(34 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 25) << TILE_SHIFT, 7, 350),
	VisualSprite(21 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 6, 200),
	VisualSprite(6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 5, 250),
	VisualSprite(-5 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 4, 150), // 19
	VisualSprite(16 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 3, 200),
	VisualSprite(26 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 2, 300),
	VisualSprite(41 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 1, 200),
	VisualSprite(1 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 0, 400),
	VisualSprite(14 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 1, 500), // 24
	VisualSprite(4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 17) << TILE_SHIFT, 3, 550),
	VisualSprite(20 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 7, 0)
};

// 14 = last frame
const array<VisualSprite@> visualSkeletons = {
	VisualSprite(-2 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 0, 100), // 0
	VisualSprite(1 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 1, 600),
	VisualSprite(-2 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 2, 250),
	VisualSprite(4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 3, 550),
	VisualSprite(8 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 4, 500), // 4
	VisualSprite(8 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 5, 400),
	VisualSprite(12 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 6, 400),
	VisualSprite(21 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 7, 700),
	VisualSprite(18 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 8, 200),
	VisualSprite(26 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 9, 200), // 9
	VisualSprite(28 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 10, 300),
	VisualSprite(27 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 11, 700),
	VisualSprite(34 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 12, 0),
	VisualSprite(35 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 13, 900),
	VisualSprite(38 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 14, 300), // 14
	VisualSprite(39 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 17) << TILE_SHIFT, 0, 700),
	VisualSprite(33 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 1, 250),
	VisualSprite(17 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 12, 500),
	VisualSprite(3 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 13, 450),
	VisualSprite(-6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 14, 500), // 19
	VisualSprite(15 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 11, 850),
	VisualSprite(26 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 10, 500),
	VisualSprite(42 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 9, 600),
	VisualSprite(3 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 8, 700),
	VisualSprite(13 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 7, 400), // 24
	VisualSprite(-1 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 26) << TILE_SHIFT, 6, 500),
	VisualSprite(6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 5, 500),
	VisualSprite(10 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 24) << TILE_SHIFT, 4, 600),
	VisualSprite(37 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 3, 600),
	VisualSprite(19 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 2, 250), // 29
	VisualSprite(24 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 14) << TILE_SHIFT, 1, 250),
	VisualSprite(23 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 21) << TILE_SHIFT, 6, 250),
	VisualSprite(4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 14, 250)
};

// 7 = last frame
const array<VisualSprite@> visualSkulls = {
	VisualSprite(-1 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 0, 650), // 0
	VisualSprite(5 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 1, 600),
	VisualSprite(0 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 2, 250),
	VisualSprite(6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 3, 550),
	VisualSprite(10 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 4, 300), // 4
	VisualSprite(10 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 5, 250),
	VisualSprite(15 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 6, 300),
	VisualSprite(22 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 7, 450),
	VisualSprite(22 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 0, 400),
	VisualSprite(24 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 1, 800), // 9
	VisualSprite(31 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 2, 300),
	VisualSprite(31 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 3, 700),
	VisualSprite(34 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 14) << TILE_SHIFT, 4, 0),
	VisualSprite(36 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 5, 900),
	VisualSprite(40 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, 6, 300), // 14
	VisualSprite(41 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 18) << TILE_SHIFT, 7, 500),
	VisualSprite(36 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 7, 250),
	VisualSprite(19 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 6, 400),
	VisualSprite(4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 14) << TILE_SHIFT, 5, 450),
	VisualSprite(-4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 23) << TILE_SHIFT, 4, 250), // 19
	VisualSprite(16 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 27) << TILE_SHIFT, 3, 500),
	VisualSprite(28 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 2, 500),
	VisualSprite(44 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 1, 600),
	VisualSprite(0 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 0, 400),
	VisualSprite(16 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 15) << TILE_SHIFT, 1, 400), // 24
	VisualSprite(11 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 19) << TILE_SHIFT, 4, 200),
	VisualSprite(-5 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 16) << TILE_SHIFT, 0, 350),
	VisualSprite(-4 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 20) << TILE_SHIFT, 6, 0)
};

const array<VisualSpriteAnimated@> visualSpritesAnimated = {
	VisualSpriteAnimated(6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 17) << TILE_SHIFT, ANIM::SKELETON, 2, true, SPRITE::BRIGHTNESS, SPRITE_BRIGHTNESS, 0.2),
	VisualSpriteAnimated(6 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 22) << TILE_SHIFT, ANIM::SKELETON, 2, true, SPRITE::BRIGHTNESS, SPRITE_BRIGHTNESS, 0.3),
	VisualSpriteAnimated(0, (LAYER_6_Y_OFFSET + 11) << TILE_SHIFT, ANIM::RAVEN, 1, false, SPRITE::SINGLECOLOR, 109, 0.4),
	VisualSpriteAnimated(20 << TILE_SHIFT, (LAYER_6_Y_OFFSET + 10) << TILE_SHIFT, ANIM::RAVEN, 1, false, SPRITE::SINGLECOLOR, 109, 0.3)
};

// yPos = scale
//   -16 = 0.4
// 16-17 = 0.5
// 18-19 = 0.6
// 20-21 = 0.7
// 22-23 = 0.8
// 24-25 = 0.9
// 26- = 1.0
float determineScaleByYPos(int yPos) {
	int yTile = yPos >> TILE_SHIFT;
	if (yTile < (LAYER_6_Y_OFFSET + 16)) {
		return 0.4;
	}
	if (yTile < (LAYER_6_Y_OFFSET + 18)) {
		return 0.5;
	}
	if (yTile < (LAYER_6_Y_OFFSET + 20)) {
		return 0.6;
	}
	if (yTile < (LAYER_6_Y_OFFSET + 22)) {
		return 0.7;
	}
	if (yTile < (LAYER_6_Y_OFFSET + 24)) {
		return 0.8;
	}
	if (yTile < (LAYER_6_Y_OFFSET + 26)) {
		return 0.9;
	}
	return 1.0;
}

void drawVisualSprites(jjCANVAS@ canvas, array<VisualSprite@> visualSprites, ANIM::Set animSet, uint8 animation) {
	for (uint i = 0; i < visualSprites.length(); i++) {
		VisualSprite@ sprite = visualSprites[i];
		float spriteScale = determineScaleByYPos(sprite.y);
		canvas.drawRotatedSprite(sprite.x + 1, sprite.y + 4, animSet, animation, sprite.frame,
				sprite.angle, spriteScale, spriteScale, SPRITE::SHADOW);
		canvas.drawRotatedSprite(sprite.x, sprite.y, animSet, animation, sprite.frame,
				sprite.angle, spriteScale, spriteScale, SPRITE::BRIGHTNESS, SPRITE_BRIGHTNESS);
		// For position tweaking
		// canvas.drawString(sprite.x + 4, sprite.y + 4, "" + i);
	}
}

void drawVisualSpritesAnimated(jjCANVAS@ canvas) {
	for (uint i = 0; i < visualSpritesAnimated.length(); i++) {
		VisualSpriteAnimated@ sprite = visualSpritesAnimated[i];
		float spriteScale = determineScaleByYPos(int(sprite.y));
		
		if (sprite.hasShadow) {
			canvas.drawRotatedSprite(int(sprite.x + 1), int(sprite.y + 4), sprite.animSet, sprite.animation, jjGameTicks >> 3, // Constant animation speed for now...
					0, spriteScale, spriteScale, SPRITE::SHADOW);
		}
		
		canvas.drawRotatedSprite(int(sprite.x), int(sprite.y), sprite.animSet, sprite.animation, jjGameTicks >> 3, // Constant animation speed for now...
				0, spriteScale, spriteScale, sprite.mode, sprite.modeParam);
		
		if (sprite.xSpeed != 0) {
			sprite.x += sprite.xSpeed;
			
			if (sprite.xSpeed > 0 && sprite.x > LAYER_6_X_END) {
				sprite.x = LAYER_6_X_BEGIN;
			} else if (sprite.xSpeed < 0 && sprite.x < LAYER_6_X_BEGIN) {
				sprite.x = LAYER_6_X_END;
			}
		}
	}
}

bool generateCustomSpringSprites(const array<uint> &in colors) {

	// Just to make sure we don't fiddle with MLLE's reserved custom anims
	jjANIMSET@ anim = getFirstFreeCustomAnimSet();
	
	if (@anim is null) {
		// Shouldn't really happen anyway but a good practice
		return false;
	}

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

jjANIMSET@ getFirstFreeCustomAnimSet() {
	for (int i = 0; i < 256; i++) {
		if (jjAnimSets[ANIM::CUSTOM[i]].firstAnim == 0) {
			return jjAnimSets[ANIM::CUSTOM[i]];
		}
	}
	return null;
}

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

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

void onDrawLayer6(jjPLAYER@ play, jjCANVAS@ canvas) {
	drawVisualSprites(canvas, visualSkeletons, ANIM::SKELETON, 2);
	drawVisualSprites(canvas, visualSkulls, ANIM::SKELETON, 1);
	drawVisualSprites(canvas, visualBones, ANIM::SKELETON, 0);
	drawVisualSpritesAnimated(canvas);
}

void onFunction0() {
	jjLocalPlayers[0].showText("@@@@@Dragon Vault");
}

void onFunction1() {
	jjLocalPlayers[0].showText("@@@@@Mausoleum");
}

void onFunction2() {
	jjLocalPlayers[0].showText("@@@@@Hall of Darkness");
}

void onLevelLoad() {
	jjUseLayer8Speeds = true;
	
	jjAnimSets[ANIM::RAPIER].load();
	jjAnimSets[ANIM::RAVEN].load();
	jjAnimSets[ANIM::SKELETON].load();
	jjAnimSets[ANIM::ZSPARK].load();
	
	jjObjectPresets[OBJECT::CARROT].behavior = CantBeBuried;
	jjObjectPresets[OBJECT::FULLENERGY].behavior = CantBeBuried;
	
	generateCustomSpringSprites(array<uint> = {16, 40});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 26.0f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 19.0f, false);
}

void onMain() {
	array<jjLAYER@> layers = jjLayerOrderGet();
	
	layers[9].xOffset += 0.3f;
	layers[11].xOffset -= 0.20f;
	layers[12].xOffset -= 0.15f;
}

void onPlayer(jjPLAYER@ play) {
	handleFastCustomSpringSpeeds(play);
}

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