Downloads containing ab24btl01.j2as

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

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, BubbleGun::Weapon(), null, null, SuperToaster::Weapon(), se::FireworkMLLEWrapper(), null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-6.j2l" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-5.j2l" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-4.j2l" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab24btl01-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab24btl01.j2l" ///@MLLE-Generated
#include "SEfirework-mlle.asc" ///@MLLE-Generated
#pragma require "SEfirework-mlle.asc" ///@MLLE-Generated
#include "SuperToaster.asc" ///@MLLE-Generated
#pragma require "SuperToaster.asc" ///@MLLE-Generated
#include "BubbleGun.asc" ///@MLLE-Generated
#pragma require "BubbleGun.asc" ///@MLLE-Generated
#pragma require "spelunky_ignite.wav"

bool isSnowing = true;

void onLevelBegin() {
    jjSetModPosition(1,0,true);
	
	    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) == 37) {
                jjEventSet(x, y, AREA::ONEWAY);
            }
        }
    }
}

void onLevelReload() {
    jjSetModPosition(1,0,true);
}

void onLevelLoad() {
	jjANIMATION@ animBubble = jjAnimations[jjAnimSets[ANIM::COMMON] + 1];
		for (uint i = 0; i < animBubble.frameCount; ++i) {
			jjANIMFRAME@ frame = jjAnimFrames[animBubble + i];
			jjPIXELMAP sprite(frame);
			for (uint x = 0; x < sprite.width; ++x)
				for (uint y = 0; y < sprite.height; ++y)
				if (sprite[x,y] != 0) sprite[x,y] += 115;
			sprite.save(frame);
		}
		
	jjPIXELMAP rain(32,32);
	for (uint x = 0; x < rain.width; ++x) {
		for (uint y = 0; y < rain.height; ++y) {
			if (x == 16) {
				if (y <= 16) rain[x,y] = 74;
				else if (y > 16 && y <= 24) rain[x,y] = 73;
				else rain[x,y] = 0;
			} else {
				rain[x,y] = 0;
			}
		}
	}
	
	jjSampleLoad(SOUND::P2_POEP, "spelunky_ignite.wav");
	
	jjLayers[1].spriteMode = SPRITE::BLEND_NORMAL;
	jjLayers[1].spriteParam = 255;
	
	jjTexturedBGFadePositionY = 0.25;
	
	jjANIMATION@ animRain = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
	for (uint frameID = 0; frameID < animRain.frameCount; ++frameID) {
		jjANIMFRAME@ frame = jjAnimFrames[animRain.firstFrame + frameID];
		rain.save(frame);
		frame.hotSpotX = -frame.width/2;
		frame.hotSpotY = -frame.height;
	}
	
	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, 33.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::BOUNCERPOWERUP].direction = -1;
	jjObjectPresets[OBJECT::ICEPOWERUP].direction = -1;
	
	jjObjectPresets[OBJECT::CHERRY].direction = SPRITE::FLIPH;
	jjObjectPresets[OBJECT::BANANA].direction = SPRITE::FLIPH;
	jjObjectPresets[OBJECT::SEEKERAMMO15].direction = SPRITE::FLIPH;
}

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 onMain() {
	jjPLAYER @play = jjLocalPlayers[0];

	jjSnowingType = jjGameTicks % 18 == 0? SNOWING::LEAF : SNOWING::RAIN;
	jjSnowingIntensity = jjRandom()%1;
	jjIsSnowingOutdoorsOnly = true;
	for (int i = 0; i < 1024; i++) {
        jjPARTICLE@ particle = jjParticles[i];
        if (particle.type == PARTICLE::RAIN) {
            particle.xSpeed = 0;
            particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed);
            
            if (jjTileGet(6, int(particle.xPos/32), int(particle.yPos/32)) != 0) {
                particle.type = PARTICLE::INACTIVE;
            }
        }
		/* if (particle.type == PARTICLE::LEAF) {
			if (jjTileGet(6, int(particle.xPos/32), int(particle.yPos/32)) != 0) {
                particle.type = PARTICLE::INACTIVE;
            }
		} */
    }
	
	
	if (!isSnowing || jjLowDetail) jjIsSnowing = false;
    else jjIsSnowing = true;
	
	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;
        }
        if (obj.eventID == OBJECT::SEEKERAMMO15) {
            if (obj.xOrg > 120*32 && obj.xOrg < 122*32) {
                obj.xPos = obj.xOrg - 7;
				obj.direction = 0;
			}
			if (obj.xOrg > 12*32 && obj.xOrg < 14*32) {
                obj.direction = -1;
			}
		}
		if (obj.eventID == OBJECT::BOUNCERAMMO3){
			if (obj.xOrg > 13*32 && obj.xOrg < 15*32) {
			    obj.xPos = obj.xOrg + 16;
			}
		}
		if (obj.eventID == OBJECT::BOUNCERPOWERUP) {
			obj.yPos = 53.3*32;
			obj.ySpeed = 0;
			obj.xPos = obj.xOrg + 16;
		}
		if (obj.eventID == OBJECT::GUN8POWERUP){
			obj.xPos = obj.xOrg + 16;
		}
        if (obj.eventID == OBJECT::CARROT && obj.state == STATE::FLOAT) {
            if (obj.xOrg > 180*32 && obj.xOrg < 185*32) {
                obj.xPos = obj.xOrg - 16;
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 6*32 && obj.xOrg < 8*32) {
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 108*32 && obj.xOrg < 109*32) {
				obj.yPos = obj.yOrg + 16;
			}
		}
		if (obj.eventID == OBJECT::HORGREENSPRING) {
			if (obj.xOrg > 16*32 && obj.xOrg < 18*32) {
			obj.ySpeed=-27.95f;
			}
		}
		
		if (obj.eventID == OBJECT::CHERRY) {
			if (obj.xOrg > 24*32 && obj.xOrg < 34*32) {
			obj.xPos = obj.xOrg - 12;
			}
		}
		if (obj.eventID == OBJECT::GUN8AMMO3){
			if (obj.xOrg > 1*32 && obj.xOrg < 3*32) {
				obj.xPos = obj.xOrg + 1329;
				obj.yPos = obj.yOrg + 992;
			}
			if (obj.xOrg > 91*32 && obj.xOrg < 99*32 && obj.yOrg > 20*32 && obj.yOrg < 21*32) {
				obj.yPos = obj.yOrg - 16;
			}
		}
		if (obj.eventID == OBJECT::GUN9AMMO3){
			if (obj.xOrg > 72*32 && obj.xOrg < 73*32) {
				obj.xPos = obj.xOrg + 16;
			}
		}
		if (obj.eventID == OBJECT::HORGREENSPRING){
			if (obj.xOrg > 66*32 && obj.xOrg < 69*32) {
				obj.ySpeed=-28.0f;
			}
		}
		if (obj.eventID == OBJECT::HORREDSPRING){
			if (obj.xOrg > 132*32 && obj.xOrg < 134*32) {
				obj.ySpeed=-18.8f;
			}
		}
		if (obj.eventID == OBJECT::FROZENSPRING){
			if (obj.xOrg > 148*32 && obj.xOrg < 149*32) {
				obj.ySpeed=-21.8f;
			}
		}
		if (obj.eventID == OBJECT::TOASTERAMMO3){
			if (obj.xOrg > 112*32 && obj.xOrg < 119*32 && obj.yOrg > 38*32 && obj.yOrg < 39*32){
				obj.yPos = obj.yOrg + 10;
			}
			if (obj.xOrg > 111*32 && obj.xOrg < 116*32 && obj.yOrg > 40*32 && obj.yOrg < 41*32){
				obj.yPos = obj.yOrg + 10;
			}
			if (obj.xOrg > 110*32 && obj.xOrg < 117*32 && obj.yOrg > 71*32 && obj.yOrg < 72*32){
				obj.yPos = obj.yOrg + 10;
			}
		}
		if (obj.eventID == OBJECT::SEEKERAMMO3){
			if (obj.xOrg > 130*32 && obj.xOrg < 134*32 && obj.yOrg > 27*32 && obj.yOrg < 28*32){
				obj.xPos = obj.xOrg - 6;
			}
			if (obj.xOrg > 130*32 && obj.xOrg < 134*32 && obj.yOrg > 28*32 && obj.yOrg < 29*32){
				obj.xPos = obj.xOrg + 0;
			}
			if (obj.xOrg > 130*32 && obj.xOrg < 134*32 && obj.yOrg > 29*32 && obj.yOrg < 30*32){
				obj.xPos = obj.xOrg + 6;
			}
		}
	}
}

void onFunction0(jjPLAYER@ play) {
    jjSamplePriority(SOUND::COMMON_DAMPED1);
}

void onFunction1(jjPLAYER@ play) {
    isSnowing = false;
}

void onPlayer(jjPLAYER@ play) {
	play.lightType = LIGHT::NONE;
	
	handleFastCustomSpringSpeeds(play);
	
	for (int i = 0; i < 1024; i++) {
		jjPARTICLE@ particle = jjParticles[i];
		if (particle.type == PARTICLE::LEAF) {
			particle.xSpeed = -0.75;
			particle.ySpeed = 0.25;
		}
		if (particle.type == PARTICLE::RAIN) {
			particle.xSpeed = 0;
			particle.ySpeed = play.ySpeed < 0? 10 : int(10 + play.ySpeed);
		}
	}
	
	if (play.yPos >= 0) {
		//Wherein "skill 3" means "MP Only"
		int skill = jjParameterGet(uint16(play.xPos/32), uint16(play.yPos/32), -4, 2);	
		if (skill == 2) {
			if (jjLayers[1].spriteParam > 96) {
				if (jjLayers[1].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP);
				jjLayers[1].spriteParam = jjLayers[1].spriteParam - 10;
			}
		}
		else if (jjLayers[1].spriteParam != 255) {
			jjLayers[1].spriteParam = jjLayers[1].spriteParam + 10;
		}
	}
}

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