Downloads containing ab25ctf27.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, BubbleGun::Weapon(), null, null, SuperToaster::Weapon(), null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "ab25ctf27-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab25ctf27-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "DiambKarstV2.j2t" ///@MLLE-Generated
#pragma require "medwoods.j2t" ///@MLLE-Generated
#pragma require "salem2.j2t" ///@MLLE-Generated
#pragma require "LOONJUNGLEFINALIZED.j2t" ///@MLLE-Generated
#pragma require "medivowoods.j2t" ///@MLLE-Generated
#pragma require "HauntedH1.j2t" ///@MLLE-Generated
#pragma require "ab25ctf27.j2l" ///@MLLE-Generated
#include "SuperToaster.asc" ///@MLLE-Generated
#pragma require "SuperToaster.asc" ///@MLLE-Generated
#include "BubbleGun.asc" ///@MLLE-Generated
#pragma require "BubbleGun.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture ///@MLLE-Generated

void onLevelBegin() {
	if(!jjSampleIsLoaded(SOUND::ZDOG_WAF3)) {
		jjSampleLoad(SOUND::ZDOG_WAF3,"Bell.wav");
	}
	MLLE::SpawnOffgrids();
	
	for (int i = 1; i < 255; i++) {
		jjOBJ@ preset = jjObjectPresets[i];
		if (preset.playerHandling == HANDLING::PICKUP) {
			preset.behavior = CannotBeShotDown(preset.behavior);
		}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg -= 12;
	}
}

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

void onLevelLoad() {
	jjUseLayer8Speeds = true;
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 48, 16, 64});
    turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 17.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 26.55f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 34.3f, false);
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
	
	jjDelayGeneratedCrateOrigins = true;
	
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	
	jjObjectPresets[OBJECT::ICEPOWERUP].direction = 0;
	jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = 0;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = -1;
}

void onMain() {	
/*	if (!jjLowDetail) {
	
		if (lightning && lightningDelay > 0) lightningDelay--;
	
		if (jjGameTicks % 600 >= 575 && jjGameTicks % 600 <= 579) jjSetFadeColors(255,255,255);
		else if (jjGameTicks % 600 >= 580) {
			int timer = 600 - jjGameTicks % 600;
			jjSetFadeColors(15 + timer * 195 / 20, 30 + timer * 180 / 20, 45 + timer * 165 / 20);
			lightning = true;
			lightningDelay = 250;
		}
	
		if (lightning && lightningDelay == 0) {
			jjSample(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos < jjWaterLevel? jjLocalPlayers[0].yPos : jjWaterLevel, SOUND::BILSBOSS_THUNDER, jjTriggers[30] && jjLocalPlayerCount == 1? 12:42, 0);
			lightning = false;
		}
	}
*/

	array<jjLAYER@> layers = jjLayerOrderGet();
	layers[16].xOffset += .25f;
	layers[14].xOffset += .4f;
		
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
    jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
	
	for (int i = 1; i < jjObjectCount; i++) {
        jjOBJ@ obj = jjObjects[i];
        if (obj.eventID == OBJECT::ICEBULLETPU && obj.xSpeed > -0.5 && obj.xSpeed < 0.5) {
            obj.xSpeed = 0;
        }
    }
}
	
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 handleFastCustomSpringSpeeds(jjPLAYER@ play) {
        if (play.ySpeed < -32.f) {
                fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
        } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
                if (play.ySpeed < -31.f) {
                        fastCustomSpringSpeeds[play.localPlayerID]--;
                        play.ySpeed = -32.f;
                } else {
                        fastCustomSpringSpeeds[play.localPlayerID] = 0;
                }
        }
}

void onPlayer(jjPLAYER@ play) {
	play.lightType = LIGHT::NONE;
	
	if (!jjLowDetail && jjGameTicks % 1400 == 0) {
		jjSample(play.xPos, play.yPos, SOUND::ZDOG_WAF3, 25, 0);
	}
	
	handleFastCustomSpringSpeeds(play);
	
	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;
		if (direction > 1) {
			if (play.xSpeed > 1) play.xSpeed = -2;
		} else if (direction == 0) {
			if (play.xSpeed < 1) play.xSpeed = 2;
		}
	}
}

void onLevelReload() {
	MLLE::SpawnOffgridsLocal();
}


bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}