Downloads containing xlmsommer.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: SommerdammFeatured Download Loon Capture the flag 9 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.5w.asc" ///@MLLE-Generated
#pragma require "xlmsommer-MLLE-Data-5.j2l" ///@MLLE-Generated
#pragma require "xlmsommer-MLLE-Data-4.j2l" ///@MLLE-Generated
#pragma require "xlmsommer-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "xlmsommer-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmsommer-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "xlmsommer.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

void onPlayer(jjPLAYER@ player){
	player.lightType = LIGHT::NONE;
	
	handleFastCustomSpringSpeeds(player);
	
	 for (int i = 1; i < jjObjectCount; i++) {
        if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::COPTER && jjObjects[i].state == STATE::FLY) {
            //Only set the counter if it's available to take
            jjObjects[i].counter = 0;
            if (jjObjects[i].var[4] == 0)
                jjObjects[i].state = STATE::DONE;
        }
	}
	
	
}

void onLevelLoad() {
	jjUseLayer8Speeds = true;
	
	/* jjWaterLayer = 16;
	jjSetWaterGradient(0,22,44, 0,44,22);
	jjWaterLighting = (WATERLIGHT::GLOBAL); */
	
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 64, 88});
    turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 26.55f, 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 = false;
	
	jjDelayGeneratedCrateOrigins = true;
       
    jjObjectPresets[OBJECT::GUN9POWERUP].direction = -1;
	
		jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	
	  jjPIXELMAP rain(32,32);
  for (uint x = 0; x < rain.width; ++x) {
    for (uint y = 0; y < rain.height; ++y) {
      if (x == 16) { //draw in the middle of the tile, xPixel 16
        if (y <= 24) rain[x,y] = 75; //if at yPixel 24 or less, use color 75
        else rain[x,y] = 74; //use color 74 for yPixels 25-32
      } else {
        rain[x,y] = 0;
      }
    }
  }
 
  jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
  for (uint frameID = 0; frameID < anim.frameCount; ++frameID) {
    jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame + frameID];
    rain.save(frame);
    frame.hotSpotX = -frame.width/2;
    frame.hotSpotY = -frame.height;
  }
  
  jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
  
  jjObjectPresets[OBJECT::BOMBCRATE].bulletHandling = HANDLING::IGNOREBULLET;
  jjObjectPresets[OBJECT::BOMBCRATE].behavior = DarkCrate;
}

void onMain() {
	jjWeapons[WEAPON::TNT].comesFromGunCrates = true;	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
    jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
	
	array<jjLAYER@> layers = jjLayerOrderGet();
	layers[31].xOffset += .5f;
	layers[35].xOffset += .4f;
	layers[38].xOffset += .2f;
	
	for (int i = 0; i < 1024; i++) { //loop through the global array jjParticles[1024]
    jjPARTICLE@ particle = jjParticles[i];
    if (particle.type == PARTICLE::RAIN) {
      particle.xSpeed = 0; //make rain fall straight down
      particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed); //the rain speed accounts for differences in the player speed, and so won't appear to fall more slowly when the player is falling
    }
	}
	for (int i = 1; i < jjObjectCount; i++) {
        if (jjObjects[i].eventID == OBJECT::FULLENERGY) {
               jjObjects[i].xPos = jjObjects[i].xOrg - 16;
        }
	}
	for (int i = 1; i < jjObjectCount; i++) {
        jjOBJ@ obj = jjObjects[i];
        if (obj.eventID == OBJECT::RFPOWERUP) {
            obj.direction = obj.xPos < (jjLayerWidth[4]*32)/2? -1:0;
        }
    }
	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 onDrawLayer7(jjPLAYER@ play, jjCANVAS@ screen) {
	jjSetWaterLevel((play.cameraY - jjLayers[16].getYPosition(play)) + 368, true);
}
void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) {
  jjSetWaterLevel(16000, true);
} */
	
void onFunction0(jjPLAYER@ play) {
	jjIsSnowing = true;
}

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

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

void onFunction2(jjPLAYER@ play) {
	jjObjects[play.fly - 1].counter = 0;
}

void DarkCrate(jjOBJ@ obj) {
  obj.behave(BEHAVIOR::CRATE, false);
  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BRIGHTNESS, 69);
}

/* void DarkCrate(jjOBJ@ obj) {
  obj.behave(BEHAVIOR::CRATE, false);
  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 48);
} */