Downloads containing ab23btl02.j2as

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

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, null, null, null, ArcaneWeapons::SanguineSpear::Weapon(), null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab23btl02-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "ab23btl02-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab23btl02-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab23btl02.j2l" ///@MLLE-Generated
#include "ArcaneWeapon8.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon8.asc" ///@MLLE-Generated

array<Witch> Witches;


void onLevelLoad() {
	jjTexturedBGTexture = TEXTURE::MEDIVO;

	jjTexturedBGFadePositionY = 0.40;
	jjUseLayer8Speeds = true;
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 64, 88});
    turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 28.50f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 17.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
	
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	
	jjObjectPresets[OBJECT::RFPOWERUP].direction = 0;
	
	jjAnimSets[ANIM::WITCH].load();
	for (uint i = 35; i <= 39; ++i)
                jjAnimations[jjAnimSets[ANIM::AMMO] + i] = jjAnimations[jjAnimSets[ANIM::WITCH] + 3];
        jjAnimations[jjAnimSets[ANIM::AMMO] + 34] = jjAnimations[jjAnimSets[ANIM::WITCH] + 3];
//        jjObjectPresets[OBJECT::SEEKERBULLET].playerHandling = HANDLING::SPECIAL;
//        jjObjectPresets[OBJECT::SEEKERBULLET].scriptedCollisions = true;
        jjObjectPresets[OBJECT::SEEKERBULLET].behavior = WitchSeeker();

}

void onLevelBegin() {
    for (int x = 0; x < jjLayerWidth[4]; x++) {
        for (int y = 0; y < jjLayerHeight[4]; y++) {
            if (jjEventGet(x, y) == OBJECT::GENERATOR && jjParameterGet(x, y, 0, 8) == 188) {
                jjEventSet(x, y, AREA::ONEWAY);
            }
        }
    }
	
	Witch newWitch;
	newWitch.setParameters(newWitch, 0, 5*32, 1, 2, 20);
	Witches.insertLast(newWitch);
}

void onMain() {	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
    jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
		/* for (int i = 1; i < jjObjectCount; i++) {
        jjOBJ@ obj = jjObjects[i];
			if (jjObjects[i].eventID == OBJECT::RFPOWERUP) {
				jjObjects[i].yPos = 45.8*32;
				jjObjects[i].ySpeed = 0;
		}
	} */
}
	
void onPlayer(jjPLAYER@ player){
	player.lightType = LIGHT::NONE;
	
	handleFastCustomSpringSpeeds(player);
	
	if (!jjLowDetail && jjGameTicks % 1400 == 0) {
		jjSample(player.xPos, player.yPos, SOUND::WITCH_LAUGH, 25, 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 onPlayerInput(jjPLAYER@ player) {
	MLLE::WeaponHook.processPlayerInput(player);
}

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

class WitchSeeker : jjBEHAVIORINTERFACE {
        void onBehave(jjOBJ@ obj) {
                if (obj.state == STATE::START)
                        jjSample(obj.xPos, obj.yPos, SOUND::WITCH_MAGIC);
                obj.behave(BEHAVIOR::SEEKERBULLET);
        }
}

class Witch {
    private float xPos, yPos, xOrg, yOrg, xSpeed;
    private int direction, newDirection, param;
    
    void setParameters(Witch@ witch, float xOrg, float yOrg, int direction, float xSpeed, int param) {
        witch.xOrg = xOrg;
        witch.yOrg = yOrg;
        witch.direction = direction;
		witch.xSpeed = xSpeed;
        witch.param = param;
    }
    
    void getPosition(Witch@ witch) {
		witch.xPos = witch.xPos + witch.xSpeed * witch.direction;
		
		if (witch.xPos > 48*32) { // jjLayerWidth[7]*32) {
			witch.direction = -1;
		} else if (witch.xPos < 0) {
			witch.direction = 1;
		}
        witch.yPos = (jjCos(jjGameTicks*4)*64*witch.direction) + witch.yOrg;
    }
    
    void draw(Witch@ witch, jjCANVAS@ canvas) {
        canvas.drawResizedSprite(int(witch.xPos), int(witch.yPos), ANIM::WITCH, 2, jjGameTicks >> 2, witch.direction, 1, SPRITE::BRIGHTNESS, param);
    }
}

void onDrawLayer7(jjPLAYER@ play, jjCANVAS@ canvas) {
	Witch@ witch = Witches[0];
    witch.getPosition(witch);
	witch.draw(witch, canvas);
}