Downloads containing ab21ctf03.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 "ab21ctf03-MLLE-Data-1.j2l"
#pragma require "Waz18.j2t"
#pragma require "ab21ctf03.j2l"

jjPAL blank;
jjOBJ@ extrapiece;
bool noDetail;
const string filename = "ezspark-pal.asdat";
const uint8 EXTRAAMMOPIECES = 5;
const int VANISHTIME = 560;
uint currHue, currSat;
array<uint8> ids = {80, 81, 82, 83, 84, 85, 96, 101, 102, 103, 104, 105, 106, 107, 111, 112, 113, 117, 123, 124, 125, 126, 127, 128, 132
};

void onLevelLoad () {
	
	jjObjectPresets[OBJECT::GEMSTOMP].behavior = NoSprite;
	jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd;
	jjObjectPresets[OBJECT::ICEAMMO15].var[2] = OBJECT::GUN8AMMO3;
	jjObjectPresets[OBJECT::ICEAMMO15].behavior = ExtraAmmoFrom15Crate;
	jjObjectPresets[OBJECT::BOUNCERAMMO15].behavior = ExtraAmmoFrom15Crate;
	jjTexturedBGTexture = TEXTURE::PSYCH;
	jjPalette.copyFrom(176, 32, 176, blank, 1);
	jjPalette.apply();
	
	jjMASKMAP asd(6);
	jjMASKMAP TFV(false);
	jjMASKMAP FULL(true);
	for (uint x = 0; x < 32; ++x) {
		for (uint y = 15; y < 17; ++y) { 
		  TFV[x,y] = true;
		} 
	} 
	
	FULL.save(8, true);
	FULL.save(15, true);
	asd.save(7, true);
	asd.save(9, true);
	TFV.save(163, true);
	TFV.save(162, true);
	TFV.save(149, true);
}

void onLevelBegin() {
	
	jjSTREAM pal(filename);
	if (!pal.isEmpty()) {
	   pal.pop(currHue);
       pal.pop(currSat);
	   pal.pop(noDetail);
	   PaletteSetting(currHue, currSat);
	}
	jjWeapons[WEAPON::ICE].allowed = false;
}

void onMain() {
	
	jjLayers[7].hasTiles = !noDetail;
	jjLayers[1].hasTiles = !noDetail;
	
	for (int i = 1; i < jjObjectCount; i++) { 
	   jjOBJ@ o = jjObjects[i];
	   if (o.isActive) {
	       if (o.behavior == BEHAVIOR::PICKUP && o.state == STATE::FLOATFALL)
		     o.state = STATE::FLOAT;
		     
           if (o.var[9] > 0 && o.doesHurt == 0) {
			   o.xSpeed = (o.xSpeed < 0) ? -15 : 15;
		       o.ySpeed = -((jjRandom() % 10) + 3);
			   o.doesHurt++;
		    }    
			if (o.eventID == OBJECT::BOUNCERPOWERUP)
				o.direction = -1;
	    }
	}
	if (jjGetModOrder() == 19 && jjMusicFileName == "sunlight.xm")
		jjSetModPosition(0, 0, false);
	
	if (jjGameTicks == 210)
		jjConsole("|You can use the following command to alter the level's palette:||!palette [hue] [sat]");
	if (jjGameTicks == 560)
		jjConsole("|You may now use ||!dark|||||| to toggle the visibility of darkened layers");
}

void onFunction0(jjPLAYER@ player) {
	if (p.charCurr == CHAR::JAZZ) {
		p.xPos = 80<<5;
		p.yPos = 26<<5;
	}
}

void NoSprite(jjOBJ@ obj) {
    obj.behave(BEHAVIOR::GEMSTOMP);
    obj.curFrame = 0;
    obj.behavior = BEHAVIOR::GEMSTOMP;
}

void ExtraAmmoFrom15Crate(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		obj.doesHurt = EXTRAAMMOPIECES;
		obj.var[10] = obj.var[2];
	}	
	if (obj.state == STATE::ACTION) {
		while (obj.doesHurt > 0) {	
			@extrapiece = jjObjects[jjAddObject(obj.var[10], obj.xPos + jjRandom()%24, obj.yPos)];
			extrapiece.behavior = BEHAVIOR::FLICKERGEM;
			extrapiece.counter = VANISHTIME;
			extrapiece.state = STATE::FLOATFALL;
			
			obj.doesHurt--;
		}
	}
	if (obj.eventID == OBJECT::ICEAMMO15 || obj.eventID == OBJECT::BOUNCERAMMO15) {
		obj.behave(BEHAVIOR::AMMO15, false);
		jjDrawTile(int(obj.xPos) - 12, int(obj.yPos) - 22, 156);
		jjDrawSprite(obj.xPos + 1, obj.yPos - 6, ANIM::AMMO, (obj.eventID == OBJECT::BOUNCERAMMO15) ? 25 : 62, 0, 0, SPRITE::BRIGHTNESS, 64);
	}
	else obj.behave(BEHAVIOR::AMMO15);
}

bool onLocalChat(string &in stringReceived, CHAT::Type chatType) {
	
    array<string> results;
	if (jjRegexMatch(stringReceived,"!palette\\s(\\d+)\\s(\\d+)",results,true)) {
		int hue = int(abs(parseInt(results[1])));
		int sat = int(abs(parseInt(results[2])));
		if (hue <= 255 && sat <= 255) {
		    currHue = hue;
		    currSat = sat;
		    PaletteSetting(hue, sat);
		    saveSettings();
		} else jjAlert("|>> Both parameters must not exceed 255");
		return true;
	}
	
	if (jjRegexMatch(stringReceived,"!dark",results,true)) {
		noDetail = !noDetail;
		saveSettings();
		return true;
	}
	return false;
}
	
void PaletteSetting(uint hue, uint sat) {
	for (uint i = 0; i < ids.length; i++) 
		       jjPalette.color[ids[i]].setHSL(hue, sat, jjPalette.color[ids[i]].getLight());
		   
    jjPalette.apply();
    jjPALCOLOR color = jjPalette.color[ids[5]];
    jjSetFadeColors(color.red, color.green, color.blue);
}

void saveSettings() {
	jjSTREAM pal;
	pal.push(currHue);
	pal.push(currSat);
	pal.push(noDetail);
	pal.save(filename);
}