Downloads containing cpd.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 24 CTF Jazz2Online Capture the flag N/A Download file
TSF with JJ2+ Only: Anniversary Bash 20 Levels Jazz2Online Multiple N/A Download file
TSF with JJ2+ Only: Complete Pipe DreamFeatured Download FireSworD Capture the flag 9.1 Download file
TSF with JJ2+ Only: Complete Pipe DreamFeatured Download FireSworD Capture the flag 9.1 Download file

File preview

#pragma require "SEfirework.asc"
#include "SEfirework.asc"
se::DefaultWeaponHook weaponHook;
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return weaponHook.drawAmmo(player, canvas);
}
void onMain() {
	weaponHook.processMain();
	for (int i = 1; i < jjObjectCount; i++) {
		if ((jjObjects[i].eventID == OBJECT::FULLENERGY || jjObjects[i].eventID == OBJECT::COPTER || jjObjects[i].eventID == OBJECT::TOASTERPOWERUP || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD) && (jjObjects[i].state == STATE::FLY || jjObjects[i].behavior == BEHAVIOR::MONITOR || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD)) {
			jjObjects[i].xPos = jjObjects[i].xOrg - 16;
		}
	}
}
void onPlayer(jjPLAYER@ player) {
	weaponHook.processPlayer(player);
}
void onPlayerInput(jjPLAYER@ player) {
	weaponHook.processPlayerInput(player);
}
void onReceive(jjSTREAM &in packet, int clientID) {
	weaponHook.processPacket(packet, clientID);
}
void onLevelLoad() {
	jjUseLayer8Speeds = true;
	jjLayerXSpeed[8] = 0.1;
	se::firework.loadAnims(jjAnimSets[ANIM::CUSTOM[1]]);
	se::firework.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BOEM1, SOUND::INTRO_BOEM2});
	se::firework.setAsWeapon(6, weaponHook);
	for (int i = 1; i < 255; i++) {
		if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP) {
			jjObjectPresets[i].behavior = CannotBeShotDown(jjObjectPresets[i].behavior);
		}
	}
	jjObjectPresets[OBJECT::LIGHTNINGSHIELD].behavior = Shield(SHIELD::LIGHTNING);
	jjObjectPresets[OBJECT::LIGHTNINGSHIELD].scriptedCollisions = true;
}
class CannotBeShotDown : jjBEHAVIORINTERFACE {
	jjBEHAVIOR originalBehavior;
	CannotBeShotDown(jjBEHAVIOR behavior) {
		originalBehavior = behavior;
	}
	void onBehave(jjOBJ@ obj) override {
		obj.behave(originalBehavior);
		if (obj.state == STATE::FLOATFALL)
			obj.state = STATE::FLOAT;
		if (obj.eventID == OBJECT::FULLENERGY)
			obj.xPos = obj.xOrg - 16;
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		obj.behavior = originalBehavior;
		if (bullet is null)
			player.objectHit(obj, force, obj.playerHandling);
		else
			bullet.objectHit(obj, obj.playerHandling);
		obj.behavior = CannotBeShotDown(obj.behavior);
		return true;
	}
}
class Shield : jjBEHAVIORINTERFACE {
	SHIELD::Shield shieldType;
	Shield(SHIELD::Shield type) {
		shieldType = type;
	}
	void onBehave(jjOBJ@ obj) override {
		obj.behave(BEHAVIOR::MONITOR);
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		const int timeWhenKicked = 20 * 70;
		const int timeWhenShot = 20 * 70;
		const int timeBonusForLosingTeam = 20 * 70;
		bool granted = false, burn = false;
		if (bullet is null) {
			if (force != 0) {
				granted = true;
				player.shieldTime = timeWhenKicked;
				obj.particlePixelExplosion(2);
			}
		} else {
			if (player !is null) {
				granted = true;
				player.shieldTime = timeWhenShot;
				burn = bullet.var[6] & 2 != 0;
				obj.particlePixelExplosion(burn ? 1 : 0);
				if (bullet.var[6] & 16 == 0)
					bullet.state = STATE::EXPLODE;
			}
		}
		if (granted) {
			if (jjGameMode == GAME::CTF && jjTeamScore[player.team] < jjTeamScore[TEAM::Color(player.team ^ 1)]) {
				player.shieldTime += timeBonusForLosingTeam;
				player.showText("@@@@@20 seconds are added, because your team is behind in scores.");
			}
			player.shieldType = shieldType;
			player.currWeapon = WEAPON::BLASTER;
			obj.energy = 0;
			obj.state = STATE::KILL;
			jjSample(player.xPos, player.yPos, SOUND::COMMON_GLASS2);
			jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SHIELD1);
			if (burn)
				jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BURN);
		}
		return true;
	}
}