Downloads containing xlmsyri.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Syri i KaltërFeatured Download Loon Capture the flag 9 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "xlmsyri-MLLE-Data-4.j2l" ///@MLLE-Generated
#pragma require "xlmsyri-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "xlmsyri-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmsyri-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "xlmsyri.j2l" ///@MLLE-Generated

#include "limitedoxygen.asc"

void onLevelLoad() {
	jjTexturedBGTexture = TEXTURE::MEDIVO;
	jjUseLayer8Speeds = true;
	
	jjObjectPresets[OBJECT::RFPOWERUP].direction = -1;
	
	water::maxOxygen = 1500;
	
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;
}

void onLevelBegin() {
	for (int i = 1; i < jjObjectCount; i++) {
		if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 10;
		if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].xOrg += 16;
	}
}

void onMain (){
	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::TOASTERAMMO15) {
            if (obj.xOrg > 59*32 && obj.xOrg < 62*32) {
                obj.direction = -1;
			}
		}
		if (obj.eventID == OBJECT::RFAMMO3 && obj.state == STATE::FLOAT){
			if (obj.xOrg > 62*32 && obj.xOrg < 63*32) {
			    obj.xPos = obj.xOrg + 64;
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 86*32 && obj.xOrg < 93*32 && obj.yOrg > 69*32 && obj.yOrg < 75*32) {
			    obj.xPos = obj.xOrg + 6;
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 1*32 && obj.xOrg < 3*32) {
			    obj.xPos = obj.xOrg - 20;
			}
			if (obj.xOrg > 88*32 && obj.xOrg < 89*32 && obj.yOrg > 35*32 && obj.yOrg < 40*32) {
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 87*32 && obj.xOrg < 88*32 && obj.yOrg > 37*32 && obj.yOrg < 38*32) {
				obj.yPos = obj.yOrg + 16;
			}
			if (obj.xOrg > 78*32 && obj.xOrg < 83*32 && obj.yOrg > 18*32 && obj.yOrg < 19*32) {
			    obj.xPos = obj.xOrg + 16;
				obj.yPos = obj.yOrg - 16;
			}
			if (obj.xOrg > 80*32 && obj.xOrg < 81*32 && obj.yOrg > 17*32 && obj.yOrg < 18*32) {
			    obj.xPos = obj.xOrg + 16;
			}
		}
		if (obj.eventID == OBJECT::BOUNCERAMMO3 && obj.state == STATE::FLOAT) {
			if (obj.xOrg > 89*32 && obj.xOrg < 97*32 && obj.yOrg > 63*32 && obj.yOrg < 64*32) {
                obj.xPos = obj.xOrg + 16;
				obj.yPos = obj.yOrg + 13;
			}
            if (obj.xOrg > 89*32 && obj.xOrg < 97*32 && obj.yOrg > 64*32 && obj.yOrg < 65*32) {
                obj.xPos = obj.xOrg + 16;
				obj.yPos = obj.yOrg + 4;
			}
			if (obj.xOrg > 36*32 && obj.xOrg < 37*32) {
				obj.xPos = obj.xOrg - 22;
			}
			if (obj.xOrg > 35*32 && obj.xOrg < 36*32) {
				obj.xPos = obj.xOrg - 6;
			}
			if (obj.xOrg > 112*32 && obj.xOrg < 119*32 && obj.yOrg > 49*32 && obj.yOrg < 51*32) {
				obj.yPos = obj.yOrg + 16;
			}
		}
		
		if (obj.eventID == OBJECT::GREENSPRING) {
		   /* if (obj.xOrg > 14*32 && obj.xOrg < 15*32) {
			    obj.xPos = obj.xOrg - 6;
			} */
		}
		if (obj.eventID == OBJECT::TOASTERAMMO3 && obj.state == STATE::FLOAT) {
			if (obj.xOrg > 30*32 && obj.xOrg < 38*32 && obj.yOrg > 47*32 && obj.yOrg < 48*32) {
				obj.yPos = obj.yOrg + 13;
			}
			if (obj.xOrg > 48*32 && obj.xOrg < 49*32) {
			    obj.yPos = obj.yOrg -16;
			}
			if (obj.xOrg > 50*32 && obj.xOrg < 51*32) {
			    obj.yPos = obj.yOrg -16;
			}
		}
		if (obj.eventID == OBJECT::GUN8AMMO3 && obj.state == STATE::FLOAT){
			if (obj.xOrg > 53*32 && obj.xOrg < 54*32) {
			    obj.xPos = obj.xOrg + -16;
			}
			if (obj.xOrg > 149*32 && obj.xOrg < 150*32) {
			    obj.xPos = obj.xOrg + 16;
			}
			if (obj.xOrg > 148*32 && obj.xOrg < 149*32 && obj.yOrg > 25*32 && obj.yOrg < 26*32) {
			    obj.xPos = obj.xOrg + 24;
			}
			if (obj.xOrg > 148*32 && obj.xOrg < 149*32 && obj.yOrg > 29*32 && obj.yOrg < 30*32) {
			    obj.xPos = obj.xOrg + 8;
			}
			if (obj.xOrg > 148*32 && obj.xOrg < 149*32 && obj.yOrg > 27*32 && obj.yOrg < 28*32) {
			    obj.xPos = obj.xOrg + 16;
			}
			if (obj.xOrg > 97*32 && obj.xOrg < 98*32 && obj.yOrg > 40*32 && obj.yOrg < 43*32) {
			    obj.xPos = obj.xOrg - 16;
			}
		}
		if (obj.eventID == OBJECT::GUN9POWERUP){
			if (obj.xOrg > 56*32 && obj.xOrg < 57*32) {
			    obj.xPos = obj.xOrg + 16;
				obj.direction = 0;
			}
		}
		if (obj.eventID == OBJECT::GUN8POWERUP){
			if (obj.xOrg > 145*32 && obj.xOrg < 146*32) {
				obj.direction = 0;
			}
		}
		if (obj.eventID == OBJECT::SEEKERAMMO3 && obj.state == STATE::FLOAT){
			if (obj.xOrg > 42*32 && obj.xOrg < 43*32 && obj.yOrg > 50*32 && obj.yOrg < 51*32) {
			    obj.yPos = obj.yOrg + 14;
			}
			if (obj.xOrg > 44*32 && obj.xOrg < 45*32 && obj.yOrg > 50*32 && obj.yOrg < 51*32) {
			    obj.yPos = obj.yOrg + 14;
			}
			if (obj.xOrg > 46*32 && obj.xOrg < 48*32 && obj.yOrg > 50*32 && obj.yOrg < 51*32) {
			    obj.yPos = obj.yOrg + 14;
			}
		}
	}
}

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) {
	water::limitedOxygen(play);
	play.lightType = LIGHT::NONE;
	
	handleFastCustomSpringSpeeds(play);
}

bool onDrawHealth(jjPLAYER@ play, jjCANVAS@ canvas) {
	water::drawOxygenTimer(play, canvas);
	return false;	
}