Downloads containing ab23ctf10.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 23 levels Jazz2Online Multiple N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, WeaponVMega::IceCloud::Weapon(), se::RollerMLLEWrapper(), null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab23ctf10-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab23ctf10-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab23ctf10.j2l" ///@MLLE-Generated
#include "SEroller-mlle.asc" ///@MLLE-Generated
#pragma require "SEroller-mlle.asc" ///@MLLE-Generated
#include "WeaponVMega3.asc" ///@MLLE-Generated
#pragma require "WeaponVMega3.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture
#pragma require "HH17_lowind.wav"

array<bool> isSnowing(4, true);
array<uint>lightValue(4, 100);

class vector2i {
	int x, y;
}

array<vector2i> oneWays;

int sample = 0;

void onLevelLoad() {
	jjUseLayer8Speeds = true;

	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {16, 88, 40});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 22.f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 27.25f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 18.75f, false);
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = 
	jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;

	jjObjectPresets[OBJECT::BOUNCERBULLET].behavior = FixedBouncer();
	
	jjANIMFRAME@ bridgeFrame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::BRIDGE].firstAnim + 5].firstFrame];
    jjPIXELMAP(0, 94*32, 16, 16, 5).save(bridgeFrame);
	bridgeFrame.hotSpotX = -bridgeFrame.width/2;
	bridgeFrame.hotSpotY = -bridgeFrame.height + 8;
	
	jjDelayGeneratedCrateOrigins = 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 onLevelBegin() {
	for (int i = 1; i < 255; i++) {
		jjOBJ@ preset = jjObjectPresets[i];
		if (preset.playerHandling == HANDLING::PICKUP) {
			preset.behavior = CannotBeShotDown(preset.behavior);
		}
	}
	jjSampleLoad(SOUND::WIND_WIND2A, "HH17_lowind.wav");
	
	jjPalette.fill(92,146,140, 140, 1, 1);
	jjPalette.fill(77,130,141, 141, 1, 1);
	jjPalette.fill(65,80,120, 142, 1, 1);
	jjPalette.fill(43,54,65, 143, 1, 1);
	jjPalette.apply();
	
	for (uint i = 1610; i < 1794; i++) {
		jjPIXELMAP recolor(i);
		for (uint x = 0; x < recolor.width; ++x)
			for (uint y = 0; y < recolor.height; ++y)
				if (recolor[x,y] == 12) recolor[x,y] = 142;
		recolor.save(i, true);
	}
	
	for (uint i = 1742; i < 2272; i++) {
		jjPIXELMAP recolor(i);
		for (uint x = 0; x < recolor.width; ++x)
			for (uint y = 0; y < recolor.height; ++y)
				if (recolor[x,y] == 75) recolor[x,y] = 143;
		recolor.save(i, true);
	}
	
	for (uint i = 2232; i < 2314; i++) {
		jjPIXELMAP recolor(i);
		for (uint x = 0; x < recolor.width; ++x)
			for (uint y = 0; y < recolor.height; ++y)
				if (recolor[x,y] == 206) recolor[x,y] = 141;
		recolor.save(i, true);
	}
	
	for (uint i = 2902; i < 2918; i++) {
		jjPIXELMAP recolor(i);
		for (uint x = 0; x < recolor.width; ++x)
			for (uint y = 0; y < recolor.height; ++y)
				if (recolor[x,y] == 206) recolor[x,y] = 140;
		recolor.save(i, true);
	}
}

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

class FixedBouncer : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BOUNCERBULLET);
		float xSpeed = obj.xSpeed;
		float ySpeed = obj.ySpeed;
		if (xSpeed * obj.xSpeed < 0.f && ySpeed * obj.ySpeed < 0.f) {
			if (!jjMaskedPixel(int(obj.xPos + obj.xSpeed), int(obj.yPos + ySpeed))) {
				obj.var[0] = obj.var[0] - 1;
				obj.ySpeed = ySpeed;
				if (ySpeed > 0.f)
					obj.yPos += ySpeed;
			}
		}
	}
}

void onPlayer(jjPLAYER@ play) {
	const int bounds = 16;
	if (play.xPos > ((jjLayerWidth[4]*32) - bounds) || play.xPos < bounds) {
		play.xPos = play.xPos < (bounds+1)? bounds : (jjLayerWidth[4]*32) - bounds;
		play.xSpeed = 0;
		play.specialMove = 0;
	}
	if (jjEventGet(int(play.xPos/32), int(play.yPos/32)) == AREA::PATH) {
		int direction = jjParameterGet(int(play.xPos/32), int(play.yPos/32), 6, 3);
		play.buttstomp = 100;
		play.keyJump = false;
		if (direction > 1) {
			if (play.xSpeed > 1) play.xSpeed = -2;
		} else if (direction == 0) {
			if (play.xSpeed < 1) play.xSpeed = 2;
		}
	}
	for (uint i = 0; i < oneWays.length(); i++) {
		jjEventSet(oneWays[i].x, oneWays[i].y, AREA::ONEWAY);
	}
	oneWays.resize(0);
	int px = int(play.xPos), py = int(play.yPos);
	bool masked;
	for (int i = -11 + int(play.ySpeed); i <= 14; i++) {
		if (masked = jjMaskedHLine(px - 14, 28, py + i))
			break;
	}
	if (!masked) {
		for (int i = 8; i <= 16; i += 8) {
			for (int j = 12; j <= 20; j += 8) {
				int x = (px + play.direction * j) >>> 5, y = (py + i) >>> 5;
				if (x >= 0 && y >= 0 && x < jjLayerWidth[4] && y < jjLayerHeight[4] && jjEventGet(x, y) == AREA::ONEWAY) {
					vector2i point;
					jjEventSet(point.x = x, point.y = y, 0);
					oneWays.insertLast(point);
				}
			}
		}
	}
	
	jjIsSnowing = (isSnowing[play.localPlayerID] && !jjLowDetail)? true:false;
	
	if (!jjLowDetail) {
		if (jjGameTicks > 7 && isSnowing[play.localPlayerID]) {
			sample = jjSampleLooped(play.xPos, (play.cameraY < 32*32? play.yPos : 38*32), SOUND::WIND_WIND2A, sample, 40, 0);
		}
	}
	
	for (int i = 0; i < 1024; i++) {
		jjPARTICLE@ particle = jjParticles[i];
		if (particle.type == PARTICLE::SNOW) {
			if (play.cameraY < 32*32 && particle.xSpeed > -3) particle.xSpeed -= 0.2;
		}
	}
}

void onMain() {
	array<jjLAYER@> layers = jjLayerOrderGet();
	
	if (jjColorDepth == 16) {
		layers[7].yOffset = 200;
		jjLayers[8].hasTiles = true;
	} else {
		layers[7].yOffset = 1200;
		jjLayers[8].hasTiles = false;
	}
	
	jjWeapons[WEAPON::GUN8].gradualAim = true;
	jjWeapons[WEAPON::GUN8].spread = jjAllowsFireball? SPREAD::NORMAL : SPREAD::PEPPERSPRAY;
	
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ obj = jjObjects[i];
		if (obj.isActive && obj.eventID == OBJECT::COPTER && obj.state == STATE::FLY) {
			obj.counter = 45;
			if (obj.var[4] == 0)
				obj.state = STATE::DONE;
		}
		if (obj.eventID == OBJECT::FULLENERGY) {
			obj.yPos = obj.yOrg + 16;
		}
	}
	
}

void onFunction0(jjPLAYER@ play, bool offset) {
	isSnowing[play.localPlayerID] = offset;
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}