Downloads containing ab21ctf09.j2as

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

File preview

#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "ab21ctf09-MLLE-Data-1.j2l"
#pragma require "ab21ctf09.j2l"
#pragma require "SEroller.asc"
#include "SEroller.asc"

se::DefaultWeaponHook weaponHook;

bool isSnowing = true;
jjPAL pal;
int hue, sat, light;

void onLevelLoad() {
	pal.load("Psych3V.j2t");

	jjUseLayer8Speeds = true;
	jjTexturedBGTexture = TEXTURE::DIAMONDUSBETA;
	
	for (int i = 880; i <= 1299; i++) {
		jjPIXELMAP hills(i);
			for (uint x = 0; x < hills.width; ++x) {
				for (uint y = 0; y < hills.height; ++y) {
					if (hills[x,y] == 73) hills[x,y] = 236;
				}
			}
		hills.save(i, true);
	}
	
	for (int i = 1330; i <= 1389; i++) {
		jjPIXELMAP trees(i);
			for (uint x = 0; x < trees.width; ++x) {
				for (uint y = 0; y < trees.height; ++y) {
					if (trees[x,y] == 20) trees[x,y] = 122;
					if (trees[x,y] == 21) trees[x,y] = 124;
					if (trees[x,y] == 73) trees[x,y] = 234;
					if (trees[x,y] == 160) trees[x,y] = 232;
					if (trees[x,y] == 239) trees[x,y] = 214;
					if (trees[x,y] == 241) trees[x,y] = 230;
					if (trees[x,y] == 242) trees[x,y] = 231;
					if (trees[x,y] == 243) trees[x,y] = 234;
				}
			}
		trees.save(i, true);
	}
	
	se::roller.loadAnims(jjAnimSets[ANIM::CUSTOM[99]]);
	se::roller.loadSamples(array<SOUND::Sample> = {SOUND::P2_FART});
	se::roller.setAsWeapon(3, weaponHook);
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 32, 56});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 21.75f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 28.f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 18.5f, false);
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
	
	jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
	jjObjectPresets[OBJECT::RFPOWERUP].direction = 0;
	

	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
	jjWeapons[WEAPON::ICE].comesFromGunCrates = jjWeapons[WEAPON::SEEKER].comesFromGunCrates = false;
}

void onLevelBegin() {
	for (int i = 1; i < jjObjectCount; i++) {
		if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 16;
	}
	
	for (int n = 96; n <= 239; n++) {
		hue = jjPalette.color[n].getHue();
		sat = jjPalette.color[n].getSat();
		light = jjPalette.color[n].getLight();
		
		if (n <= 104 || n >= 120) pal.color[n].setHSL(hue, sat * 4 / 5, light * 3 / 4);
	}
	pal.apply();
}

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 onPlayer(jjPLAYER@ play) {
	weaponHook.processPlayer(play);
}

void onPlayerInput(jjPLAYER@ play) {
	weaponHook.processPlayerInput(play);
}

void onMain() {
	for (int i = 0; i < 1024; i++) {
		jjPARTICLE@ particle = jjParticles[i];
		if (particle.type == PARTICLE::FLOWER) {
			particle.xSpeed = -0.25;
			particle.ySpeed = 2;
			particle.flower.petals = 1;
			particle.flower.color = 96;
			if (particle.flower.size > 64) particle.flower.size = 64;
		}
	}
	
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ obj = jjObjects[i];
		if (obj.eventID == OBJECT::FROZENSPRING || obj.eventID == OBJECT::REDSPRING || obj.eventID == OBJECT::HORREDSPRING) {
			if (obj.xOrg > 43.5*32 && obj.xOrg < 47.5*32) obj.xPos = obj.xOrg - 12;
			if ((obj.xOrg > 32*32 && obj.xOrg < 35*32 && obj.yOrg < 17*32) || (obj.xOrg > 45*32 && obj.xOrg < 48*32 && obj.yOrg > 41*32) || (obj.xOrg > 52*32 && obj.xOrg < 55*32) || (obj.xOrg > 60*32 && obj.xOrg < 63*32) || (obj.xOrg > 79*32 && obj.xOrg < 82*32)) {
				obj.xPos = obj.xOrg - 12;
				if (obj.xOrg < 64*32 && obj.yOrg < 42*32) obj.yPos = obj.yOrg + (obj.xPos % 64 > 32? 10:16);
				else obj.yPos = obj.yOrg + (obj.xPos % 64 > 32? 16:10);
			}
		}
		if (obj.eventID == OBJECT::RFPOWERUP) {
			obj.yPos = obj.yOrg;
		}
		if (obj.eventID == OBJECT::GUNCRATE) {
			if (obj.xOrg > (jjLayerWidth[4]*32/2)) obj.xPos = obj.xOrg - 8;
			else obj.xPos = obj.xOrg + 8;
		}
	}
	
	if (!isSnowing || jjLowDetail) jjIsSnowing = false;
	else jjIsSnowing = true;
	
	weaponHook.processMain();
}

void onReceive(jjSTREAM &in packet, int clientID) {
	weaponHook.processPacket(packet, clientID);
}

bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) {
	return weaponHook.drawAmmo(play, canvas);
}

void onFunction0(jjPLAYER@ play) {
	isSnowing = true;
}

void onFunction1(jjPLAYER@ play) {
	isSnowing = false;
}