Downloads containing fio2_e.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Find It Out (Single Player)Featured Download Superjazz Single player 8.7 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.6.asc" ///@MLLE-Generated
#pragma require "Fio2_e-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "Fio2_e.j2l" ///@MLLE-Generated
#include "Fio_common.asc"
#include "Fio_cutscene.asc"
#include "Fio_entities.asc"
#include "Fio_globals.asc"

const float CAMERA_FINAL_X = TILE * 123;
const float CAMERA_FINAL_Y = TILE * 12;
const float CAMERA_INITIAL_X = TILE * 68;
const float CAMERA_INITIAL_Y = TILE * 12;
const float CAMERA_SCROLL_DURATION = CUTSCENE_SECOND * 10;
const float CAMERA_STILL_DURATION = CUTSCENE_SECOND * 4;
const float FADE_MID_DURATION_TOTAL = CUTSCENE_SECOND * 5;
const float FADE_MID_DURATION_BLACKOUT = CUTSCENE_SECOND * 3;

const string NEXT_LEVEL_FILENAME = "Fio2_f.j2l";

bool isRabbitFacingLeft = false;

array<string> cutsceneTexts = {
	"|||So, my savior. You wanted to know how you ended up here, didn't you?",
	"|||Well, my minions have been watching you for a while. They have seen your potential in you and the weapons you carry.",
	"|||They also saw how you fell victim to a band of lizards, who captured you near your home. The lizards took you to a place called the Grey Jail.",
	"|||Now, a loyal servant of mine freed you from the lizards in hopes that you could also assist me.",
	"|||Once you made it out from the Grey Fort, the demons were tricked to summon you to the dark lands, and onwards here.",
	"|And you had to get me this far to tell me all of this? Why and how should I be assisting you?",
	"|||Yes. I needed to see if you could make it this far alive.",
	"|Also, someone tried to bury me inside the Grey Fort with explosives. Was that also done by the demons?",
	"|||I do not know exactly, but one could guess that it was a trap set by the lizards, when they realized that you had escaped the Grey Jail.",
	"|So after leaving my friend's birthday party, I have made many enemies on the way. Lizards, demons and now you too?",
	"|||I am not your enemy, nor are you mine. I need a savior to get me out of here, because that is no simple task.",
	"|Even if I could do that, what will happen once I set you free? Are you pulling tricks on me?",
	"|||Good questions! I can say that I am no deceiver. Unfortunately I cannot prove you anything at this point, since my powers are too weak.",
	"|||On the other hand, you'll require my assistance to find a way out of this place too, don't you?",
	"|I believe so. What exactly do I need to do?",
	"|||So, to set me free, you have to first get out of here back to our home world...",
	"|||...and then you will have to tear down the Statue of Curses that lies in the city of Rine, in the holy land of Zyrus. My cursed soul is bound to the statue.",
	"|||When that is done, I should have enough powers to get you back here, for I cannot get out of my ethereal form alone.",
	"|Right. Sounds tricky. What if I simply forget about you once I'm out of here?",
	"|||Maybe for a little extra motivation, once you set me free, I will summon us both out from here...",
	"|||...and I will reward you handsomely at my tower with the riches I have there. How does that sound?",
	"|I suppose I do not have much better options at the moment. I will help you in any way I can, I guess.",
	"|||Good! Perhaps if my servants find you running away from your duties, they will hand you back to the demons.",
	"|||Anyway, since as a cursed soul I do not have enough power to summon you out from here, you'll have to take the longer way.",
	"|||The legends speak of a route called The Path of Mortals, that lets demons travel between worlds when they are out of summoning power.",
	"|||I believe I have seen the beginning of it nearby. It has fragile stairs and you will certainly face a lot of guards on your way.",
	"|||Now, one more thing; Take this smaller mindstone to carry with yourself.",
	"|||It has enough of my magic bound to it, so that you'll be able to communicate with me from our home world.",
	"|||Now, allow me to show the way for you."
};

void createRabbitAnimations() {
	const ANIM::Set playerAnimSet = fio::getAnimSetForPlayer(jjLocalPlayers[0]);
	
	// Duration, xOrigin, yOrigin, xDestination, yDestination, angle, scaleX, scaleY, animSet, animationId,
	// startingFrame, finalFrame, frameRate, repetitions (optional)
	// REMINDER: DON'T FORGET TO REMOVE THE TRAILING COMMA, SINCE OTHERWISE AS WILL INSERT A NULL HANDLE AFTER THE LAST ACTUAL OBJECT ELEMENT
	
	const array<fioCut::Animation@> animationsRunningRabbit = {
		fioCut::Animation(CUTSCENE_SECOND * 2, TILE * 108, TILE * 12.5, TILE * 114, TILE * 12.5,
				0, 1, 1, playerAnimSet, RABBIT::RUN1, 0, 7, 2)
	};
	fioCut::createAnimationChain(animationsRunningRabbit);
}

// Required for each level
bool onCheat(string &in cheat) {
	return fio::handleCheat(cheat, NEXT_LEVEL_FILENAME);
}

bool onDrawHealth(jjPLAYER@ play, jjCANVAS@ canvas) {
	fioCut::drawCutscene(canvas, centeredText);
	return true;
}

void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ canvas) {
	fioCut::renderAnimations(canvas);
	canvas.drawSprite(TILE * 67.5, TILE * 13, fio::getAnimSetForPlayer(play), RABBIT::REV1, 0, isRabbitFacingLeft ? -1 : 0);
}

void onDrawLayer5(jjPLAYER@ play, jjCANVAS@ canvas) {
	canvas.drawResizedSprite(TILE * 61, TILE * 9.5, ANIM::AMMO, 10, 0, 2, 2);
}

bool onDrawLives(jjPLAYER@ play, jjCANVAS@ canvas) {
	return true;
}

bool onDrawScore(jjPLAYER@ play, jjCANVAS@ canvas) {
	return true;
}

void onLevelBegin() {
	fioCut::initializeCutscene(@processTickEvents, cutsceneTexts);
	fioCut::createEventFade(CUTSCENE_SECOND * 2, CUTSCENE_SECOND, false, true);
	play.lighting = LIGHTING_DARK;
}

void onLevelLoad() {
	initializeGlobals(array<Checkpoint@> = {});
	fioCut::clearAnimationChains();
	jjAnimSets[ANIM::DEMON].load();
}

void onPlayer(jjPLAYER@ play) {
	fioCut::run();
	fio::controlPressedKeys();

	if (jjGameTicks == 1) {
		play.noFire = true;
		play.cameraFreeze(CAMERA_INITIAL_X, CAMERA_INITIAL_Y, true, true);
	}
	
	if (!fioCut::isTickEventsProcessed()) {
		processTickEvents(play);
		fioCut::setTickEventsProcessed(true);
	}
}

void onPlayerInput(jjPLAYER@ play) {
	fioCut::controlPlayerInput(play);
	if (fioCut::isCutsceneSkipInitiatedAfterDelay(play)) {
		fioCut::setCutsceneSkipInitiated();
		fio::handleLevelCycle(NEXT_LEVEL_FILENAME, false, true);
	}
}

void processTickEvents(jjPLAYER@ play) {
	switch(uint(fioCut::getElapsedCutscene())) {
		case CUTSCENE_SECOND * 1:
			fioCut::startTextSliding();
			break;
		case CUTSCENE_SECOND * 176:
			isRabbitFacingLeft = true;
			break;
		case CUTSCENE_SECOND * 177:
			jjTileSet(2, 66, 12, 0);
			jjTileSet(2, 66, 13, 0);
			break;
		case CUTSCENE_SECOND * 186:
			isRabbitFacingLeft = false;
			break;
		case CUTSCENE_SECOND * 187:
			fioCut::createEventCameraScroll(CAMERA_SCROLL_DURATION, CAMERA_INITIAL_X, CAMERA_INITIAL_Y,
					CAMERA_FINAL_X, CAMERA_FINAL_Y);
			break;
		case CUTSCENE_SECOND * 190:
			play.lighting = LIGHTING_TWILIGHT;
			break;
		case CUTSCENE_SECOND * 191:
			fioCut::createEventFade(FADE_MID_DURATION_TOTAL, FADE_MID_DURATION_BLACKOUT, true, true);
			break;
		case CUTSCENE_SECOND * 194:
			play.warpToID(0, true);
			break;
		case CUTSCENE_SECOND * 197:
			fioCut::createEventCameraScroll(CAMERA_STILL_DURATION, CAMERA_FINAL_X, CAMERA_INITIAL_Y,
					CAMERA_FINAL_X, CAMERA_FINAL_Y);
			break;
		case CUTSCENE_SECOND * 198:
			createRabbitAnimations();
			break;
		case CUTSCENE_SECOND * 199:
			play.xPos = TILE * 114;
			play.yPos = TILE * 22;
			play.ballTime = 0;
			break;
		case CUTSCENE_SECOND * 200:
			fio::increaseCutscenesWatchedIfFastForwardWasNotUsed(fioCut::wasFastForwardUsed);
			fio::handleLevelCycle(NEXT_LEVEL_FILENAME, false, true);
			break;
	}
}

void onLevelReload() {
	MLLE::ReapplyPalette();
}