Downloads containing LHtoaa.j2as

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

File preview

const array<array<jjPALCOLOR>> paletteChanges = {
	{
		jjPALCOLOR(165, 18, 18),
		jjPALCOLOR(190, 21, 21),
		jjPALCOLOR(226, 25, 25),
		jjPALCOLOR(136, 15, 15),
		jjPALCOLOR(193, 50, 50),
		jjPALCOLOR(111, 12, 12),
		jjPALCOLOR(86, 9, 9)
	},
	{
		jjPALCOLOR(23, 79, 255),
		jjPALCOLOR(35, 110, 255),
		jjPALCOLOR(89, 125, 255),
		jjPALCOLOR(0, 72, 255),
		jjPALCOLOR(65, 101, 255),
		jjPALCOLOR(0, 49, 152),
		jjPALCOLOR(0, 23, 47)
	}
};
array<jjPAL> teamPalette(17);
uint paletteCurrent = 8, paletteTarget = 8;
array<array<int>> previousTiles(jjLocalPlayerCount, array<int>(2, -1));
bool isTileSpecialTube(int tile, int &out speed, int &out delay, bool rejectSpeed = true) {
	int x = tile & 0xFFFF;
	int y = tile >> 16;
	return jjEventGet(x, y) == 255 && jjParameterGet(x, y, -4, 2) == 2 && (rejectSpeed || uint(speed = jjParameterGet(x, y, 0, 8)) >= 0 && uint(delay = jjParameterGet(x, y, 8, 8)) >= 0);
}
void coloredSpring(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::SPRING, false);
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 216);
}
bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@) {
	if (jjLocalPlayerCount == 1 && jjRenderFrame & 3 == 0) {
		if (play.xPos > 1920.f && play.yPos < 704.f || play.xPos > 2176.f && play.yPos < 1248.f)
			paletteTarget = 0;
		else if (play.xPos < 832.f && play.yPos < 704.f || play.xPos < 576.f && play.yPos < 1280.f)
			paletteTarget = 16;
		else
			paletteTarget = 8;
		if (paletteCurrent != paletteTarget) {
			if (paletteCurrent < paletteTarget)
				paletteCurrent++;
			else
				paletteCurrent--;
			teamPalette[paletteCurrent].apply();
		}
	}
	return false;
}
void onLevelLoad() {
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL; // They made me write this line.
	jjOBJ@ preset = jjObjectPresets[OBJECT::FROZENSPRING];
	preset.behavior = coloredSpring;
	preset.bulletHandling = HANDLING::IGNOREBULLET;
	preset.freeze = 0;
	preset.ySpeed = -18.f;
	for (int i = 0; i < 2; i++) {
		jjPAL@ palette = teamPalette[i * 16];
		palette = jjPalette;
		for (int j = 0; j < 7; j++) {
			palette.color[138 + j] = paletteChanges[i][j];
		}
	}
	for (int i = 1; i < 8; i++) {
		jjPAL@ palette = teamPalette[i];
		palette = teamPalette[0];
		palette.copyFrom(138, 6, 138, jjPalette, i / 8.f);
	}
	teamPalette[8] = jjPalette;
	for (int i = 9; i < 16; i++) {
		jjPAL@ palette = teamPalette[i];
		palette = teamPalette[16];
		palette.copyFrom(138, 6, 138, jjPalette, (16 - i) / 8.f);
	}
}
void onPlayer(jjPLAYER@ play) {
	array<int>@ tileHistory = previousTiles[play.localPlayerID];
	int currTile = play.currTile;
	if (currTile != tileHistory[0]) {
		tileHistory[1] = tileHistory[0];
		tileHistory[0] = currTile;
	}
	int speed, delay;
	if (isTileSpecialTube(currTile, speed, delay, false)) {
		int dummy, previousTile = tileHistory[1];
		play.ballTime = 30;
		play.keyDown = play.keyFire = play.keyJump = play.keyRun = false;
		play.buttstomp = 121;
		if ((dummy = currTile + 1) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
			play.xSpeed = speed;
			play.ySpeed = 0.f;
			play.yPos = currTile >> 16 << 5 | 16;
		} else if ((dummy = currTile - 1) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
			play.xSpeed = -speed;
			play.ySpeed = 0.f;
			play.yPos = currTile >> 16 << 5 | 16;
		} else if ((dummy = currTile + 0x10000) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
			play.xSpeed = 0.f;
			play.ySpeed = speed;
			play.xPos = (currTile & 0xFFFF) << 5 | 16;
		} else if ((dummy = currTile - 0x10000) != previousTile && isTileSpecialTube(dummy, dummy, dummy)) {
			play.xSpeed = 0.f;
			play.ySpeed = -speed;
			play.xPos = (currTile & 0xFFFF) << 5 | 16;
		} else if (abs(play.xSpeed) > abs(play.ySpeed)) {
			play.xSpeed = play.xSpeed < 0.f ? -delay : delay;
			play.ySpeed = 0.f;
			play.yPos = currTile >> 16 << 5 | 16;
		} else {
			play.xSpeed = 0.f;
			play.ySpeed = play.ySpeed < 0.f ? -delay : delay;
			play.xPos = (currTile & 0xFFFF) << 5 | 16;
		}
	}
}