Downloads containing hh17_level04.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Holiday Hare '17Featured Download ShadowGPW Single player 8.8 Download file

File preview

#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "hh17_level04-MLLE-Data-2.j2l"
#pragma require "hh17_level04-MLLE-Data-1.j2l"
#pragma require "hh17_level04.j2l"
#pragma require "cksigil.j2t"
#pragma require "eyes.j2t"
#pragma require "DiambXmas.j2t"
#include "Jazz1Enemies v03.asc"
#include "hh17enemies.asc"
#pragma require "Dreamland.j2t"
#pragma require "ICInfernoI.j2t"
#pragma require "EasterWinter.j2t"
#pragma offer "Underground.ogg"


 //Sir Ementaler's Xmas Replacers
class Imitation : jjBEHAVIORINTERFACE {
	private uint8 eventID;
	private jjBEHAVIOR behavior;
	Imitation(uint8 realEventID, uint8 fakeEventID) {
		jjOBJ@ obj = jjObjectPresets[realEventID];
		eventID = obj.eventID;
		behavior = obj.behavior;
		obj.eventID = fakeEventID;
		obj.behavior = this;
	}
	void onBehave(jjOBJ@ obj) override {
		if (obj.state == STATE::DEACTIVATE)
			obj.eventID = eventID;
		obj.behave(behavior);
	}
}

//Sir Ementaler's Gift Boxes
class GiftBox : jjBEHAVIORINTERFACE {
	void destroy(jjOBJ@ obj) {
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_WOOD1);
		{
			int id = jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				other.determineCurAnim(ANIM::PICKUPS, 4);
			}
		}
		for (int i = jjRandom() & 7 | 8; i-- != 0;) {
			int id = jjAddObject(OBJECT::SHARD, obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				other.determineCurAnim(ANIM::PICKUPS, 93 + (jjRandom() & 1));
			}
		}
		obj.yPos -= 8.f;
		for (int i = obj.var[1]; i-- != 0;) {
			int id = jjAddObject(obj.var[0], obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				if (other.playerHandling == HANDLING::PICKUP) {
					int angle = (jjRandom() & 255) + 128;
					other.xSpeed = jjCos(angle) * 5.f;
					other.ySpeed = jjSin(angle) * -3.f;
				} else if (other.playerHandling == HANDLING::SPECIAL) {
					other.deactivates = false;
				}
			}
		}
		obj.clearPlatform();
		obj.delete();
	}
	void onBehave(jjOBJ@ obj) override {
		switch (obj.state) {
			case STATE::START:
				{
					uint16 x = int(obj.xOrg) >>> 5;
					uint16 y = int(obj.yOrg) >>> 5;
					obj.var[0] = jjParameterGet(x, y, 0, 8);
					obj.var[1] = jjParameterGet(x, y, 8, 4);
					obj.curAnim += jjParameterGet(x, y, 12, 2);
					obj.determineCurFrame();
					obj.bulletHandling = HANDLING::DESTROYBULLET;
					obj.scriptedCollisions = true;
				}
				break;
			case STATE::FALL:
				obj.var[2] = 1;
				break;
			case STATE::FREEZE:
			case STATE::SLEEP:
				if (obj.var[2] != 0) {
					destroy(obj);
					return;
				}
		}
		obj.behave(BEHAVIOR::MONITOR);
	}
	bool onObjectHit(jjOBJ@, jjOBJ@, jjPLAYER@, int) {
		return true;
	}
	bool onIsSolid(jjOBJ@) {
		return true;
	}
}


void onLevelLoad() {
	jjObjectPresets[OBJECT::DEMON].determineCurFrame();
	jjObjectPresets[OBJECT::DEMON].energy = 3;
	jjObjectPresets[OBJECT::DEMON].behavior = IceDaemon;
	jjObjectPresets[OBJECT::DEMON].xSpeed = 2.5;
	jjObjectPresets[OBJECT::DEMON].isFreezable = false;
	Jazz1::MakeEnemy(OBJECT::DRAGONFLY, Jazz1::Enemies::Holidaius_Devil);
	jjObjectPresets[OBJECT::DRAGONFLY].behavior = BlackDaemon;
	jjObjectPresets[OBJECT::DRAGONFLY].determineCurFrame();
	jjObjectPresets[OBJECT::DRAGONFLY].energy = 2;
	jjObjectPresets[OBJECT::DRAGONFLY].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::DRAGONFLY].playerHandling = HANDLING::ENEMY;
	jjObjectPresets[OBJECT::DRAGONFLY].isTarget = true;
	jjObjectPresets[OBJECT::BEEBOY].determineCurFrame();
	jjObjectPresets[OBJECT::BEEBOY].behavior = Locust;
	jjObjectPresets[OBJECT::RAPIER].determineCurFrame();
	jjObjectPresets[OBJECT::RAPIER].behavior = Revenant;
	//jjObjectPresets[OBJECT::BEE].determineCurFrame();
	//jjObjectPresets[OBJECT::BEE].behavior = SnowBee;
	jjObjectPresets[OBJECT::BUTTERFLY].determineCurFrame();
	jjObjectPresets[OBJECT::BUTTERFLY].bulletHandling = HANDLING::IGNOREBULLET;
	//jjObjectPresets[OBJECT::BUTTERFLY].playerHandling = HANDLING::ENEMYBULLET;
	jjObjectPresets[OBJECT::BUTTERFLY].scriptedCollisions = true;
	jjObjectPresets[OBJECT::BUTTERFLY].isTarget = false;
	jjObjectPresets[OBJECT::BUTTERFLY].determineCurAnim(ANIM::ROCK,0);
	jjObjectPresets[OBJECT::BUTTERFLY].frameID = 1;
	jjObjectPresets[OBJECT::BUTTERFLY].energy = 999; //It's supposed to be invincible to melee attacks but I got lazy and couldn't get it to work in time...
	jjObjectPresets[OBJECT::BUTTERFLY].behavior = RockyB;
	jjObjectPresets[OBJECT::FASTFIRE].behavior = FastFire;
	HH17::setEnemy(OBJECT::DRAGON);
	HH17::setEnemy(OBJECT::TUFTURT);
	HH17::setEnemy(OBJECT::RAVEN);
	HH17::setEnemy(OBJECT::LABRAT);
	HH17::setEnemy(OBJECT::SKELETON);
	HH17::setEnemy(OBJECT::FLOATSUCKER);
	HH17::setEnemy(OBJECT::SUCKER);
	HH17::setEnemy(OBJECT::MONKEY);
	HH17::setEnemy(OBJECT::STANDMONKEY);
	if (jjDifficulty >= 2) HH17::setEnemy(OBJECT::DEMON);
	jjAnimSets[ANIM::SKELETON].load();
	jjEnforceLighting = LIGHT::COMPLETE;
	//Sir Ementaler's Xmas Replacers
	Imitation(OBJECT::TACO, OBJECT::MILK);
	uint src = jjAnimSets[ANIM::CUSTOM[255]].load(0, "SExmas.j2a");
	uint dest = jjAnimSets[ANIM::PICKUPS];
	for (int i = 0; i < 95; i++) {
		const jjANIMATION@ anim = jjAnimations[src + i];
		if (anim.frameCount != 0)
			jjAnimations[dest + i] = anim;
	}
	jjAnimSets[ANIM::BRIDGE].load(1, "SExmas.j2a");
	jjAnimSets[ANIM::CUSTOM[0]].load(2, "SExmas.j2a");
	jjObjectPresets[OBJECT::BOMBCRATE].behavior = GiftBox();
	jjObjectPresets[OBJECT::BOMBCRATE].determineCurAnim(ANIM::CUSTOM[0], 0);

	jjAnimSets[ANIM::SPIKEBOLL].load(3, "SExmas.j2a");
	jjAnimSets[ANIM::SPIKEBOLL3D].load(3, "SExmas.j2a");
	jjAnimSets[ANIM::SPIKEPLAT].load(4, "SExmas.j2a");
	jjObjectPresets[OBJECT::SPIKEBOLL].killAnim = jjObjectPresets[OBJECT::SPIKEBOLL].determineCurAnim(ANIM::SPIKEBOLL, 0) + 1;
	jjObjectPresets[OBJECT::SPIKEBOLL3D].killAnim = jjObjectPresets[OBJECT::SPIKEBOLL3D].determineCurAnim(ANIM::SPIKEBOLL3D, 0) + 1;
	jjObjectPresets[OBJECT::SPIKEPLATFORM].killAnim = jjObjectPresets[OBJECT::SPIKEPLATFORM].determineCurAnim(ANIM::SPIKEPLAT, 0) + 1;

	Jazz1::MakeEnemy(OBJECT::DOGGYDOGG, Jazz1::Enemies::Holidaius_BlueDog);
	jjObjectPresets[OBJECT::DOGGYDOGG].xSpeed = 2.5;
}

void onLevelReload() {
	HH17::processEnemyColors();
	jjEnforceLighting = LIGHT::COMPLETE;
	if (jjDifficulty >= 2) HH17::setEnemy(OBJECT::DEMON);
}


void onMain() {
    HH17::handleEnemyProjectiles(); //this is required to handle the modifications to enemy bullets from the Monkeys and Dragons [PJ]
}



void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ canvas) {
	canvas.drawSprite(363*32, 161*32, ANIM::SKELETON, 2, 12, -1, SPRITE::NORMAL, 1);
	canvas.drawSprite(48*32, 95*32, ANIM::SKELETON, 2, 4, 0, SPRITE::NORMAL, 1);
	canvas.drawSprite(51*32, 95*32, ANIM::SKELETON, 1, 2, 0, SPRITE::NORMAL, 1);
	canvas.drawSprite(60*32, 71*32, ANIM::SKELETON, 1, 2, 0, SPRITE::NORMAL, 1);
	canvas.drawSprite(52*32, 118*32, ANIM::SKELETON, 1, 2, -1, SPRITE::NORMAL, 1);
}


void onFunction13(jjPLAYER@ player) {
		player.showText("@@@@*splat*");
		jjSamplePriority(SOUND::MONKEY_SPLUT);
}

void RockyB(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BUTTERFLY,false);
		jjDrawResizedSprite(obj.xPos, obj.yPos, ANIM::ROCK, 0, 0, 1, 1, SPRITE::NORMAL,1);
		}

void Locust(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BEEBOY,false);
		//jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NEONGLOW, 6); //Ghostly White
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NEONGLOW, 9);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLECOLOR, obj.justHit > 0? 24 : 1);
}

void Revenant(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::RAPIER,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NEONGLOW, 0);
}

void IceDaemon(jjOBJ@ obj) {
		if (jjDifficulty == 2) {
		
		} else {
		obj.behave(BEHAVIOR::DEMON,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::TINTED, 14);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::FROZEN, 1);
}
}

/*void SnowBee(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BEE,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 231);  Meh.
}*/

void BlackDaemon(jjOBJ@ obj) {
		if (obj.state == STATE::KILL) {
		obj.delete();
		} else {
		obj.behave(BEHAVIOR::DRAGONFLY,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NEONGLOW, 14, obj.justHit > 0? 24 : 6);	
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NEONGLOW, 14);
		if (obj.state == STATE::KILL) {
		obj.delete();
		}
		
		}
}

void FastFire(jjOBJ@ obj) {
		 obj.delete();
		}

void onFunction20(jjPLAYER@ player) {
	player.showText("@@@Someone once said that time is a flat circle@@and everything that transpires, @@all of the horrible and wondrous things@@will happen over and over again in an eternal recurrence.@@A tunnel without end...");
}

void onFunction12(jjPLAYER@ player) {
	jjMusicLoad("night18.xm");
}

void onFunction14(jjPLAYER@ player) {
	p.lighting = 0;
	p.warpToID(42);
	jjMusicLoad("Underground.ogg");
}

void onFunction30(jjPLAYER@ player) {
	jjMusicLoad("night18.xm");
}

void onFunction31(jjPLAYER@ player) {
	if (jjDifficulty == 2) {
	jjMusicLoad("Underground.ogg");
	}
	else if (jjDifficulty == 3) {
	jjMusicLoad("Underground.ogg");
	}
	else {
	player.showText("I dreamt about falling in a vast abyss...");
	if (!jjTriggers[13]) {
	p.lighting = 95;
	p.warpToID(56);
	}
	else {
	p.lighting = 95;
	p.warpToID(55);
}	
}

}

void onFunction32(jjPLAYER@ player) {
	player.showText("@@@@This map survived: 3x Level Corruption, 1x Tileset Corruption@And a computer fire!@@Happy Holidays! ~Blacky");
}