Downloads containing ab25ctf26.j2as

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

File preview

#include "MLLE-Include-1.6.asc" ///@MLLE-Generated
#pragma require "ab25ctf26-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab25ctf26-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab25ctf26.j2l" ///@MLLE-Generated
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "Diamondus - Garden.j2t"
#pragma require "xlmbeach1.j2t"
#pragma require "Aztec2.j2t"
#include "SEroller.asc"
#pragma require "SEroller.asc"

se::DefaultWeaponHook weaponHook;



void onLevelLoad() {
	jjTexturedBGTexture = TEXTURE::PSYCH;
	jjUseLayer8Speeds = true;
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {40, 16, 64});
	turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 22.25f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 28.f, false);
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
	
	se::roller.loadAnims(jjAnimSets[ANIM::CUSTOM[99]]);
	se::roller.loadSamples(array<SOUND::Sample> = {SOUND::P2_FART});
	se::roller.setAsWeapon(3, weaponHook);
	
	jjDelayGeneratedCrateOrigins = true;
}
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() {
	weaponHook.processMain();
}

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

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