Downloads containing VDom2.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: violetclm DOM Episodes I...Featured Download Violet CLM Custom / Concept 9 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, null, null, ArcaneWeapons::FusionCannon::Weapon(), null, null, WeaponVMega::Voranj::Weapon(), null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "vdom.j2t" ///@MLLE-Generated
#pragma require "Labrat1.j2t" ///@MLLE-Generated
#pragma require "VDom2.j2l" ///@MLLE-Generated
#include "WeaponVMega8.asc" ///@MLLE-Generated
#pragma require "WeaponVMega8.asc" ///@MLLE-Generated
#include "ArcaneWeapon9.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon9.asc" ///@MLLE-Generated

///@saveandrunargs -dom -server


array<int> ControlPointsX = {jjControlPoints[0].xTile}, ControlPointsY = {jjControlPoints[0].yTile};

uint LeftmostTile = jjLayerWidth[4], RightmostTile = 0, TopmostTile = jjLayerHeight[4], BottommostTile = 0;
void onLevelLoad() {
	uint LeftmostCP = jjLayerWidth[4], RightmostCP = 0, TopmostCP = jjLayerHeight[4], BottommostCP = 0;
	for (uint x = 0; x < uint(jjLayerWidth[4]); ++x)
		for (uint y = 0; y < uint(jjLayerHeight[4]); ++y) {
			if (jjEventGet(x,y) == AREA::TEXT) {
				if (jjParameterGet(x,y,-4,4) == 0) {
					ControlPointsX.insertLast(x);
					ControlPointsY.insertLast(y);
				}
				if (x < LeftmostCP) LeftmostCP = x;
				if (x > RightmostCP) RightmostCP = x;
				if (y < TopmostCP) TopmostCP = y;
				if (y > BottommostCP) BottommostCP = y;
				jjEventSet(x,y, 0);
			}
			else //?
			if (jjTileGet(4,x,y) != 0 || jjEventGet(x,y) != 0) {
				if (x < LeftmostTile) LeftmostTile = x;
				if (x > RightmostTile) RightmostTile = x;
				if (y < TopmostTile) TopmostTile = y;
				if (y > BottommostTile) BottommostTile = y;
			}
		}
		
	const uint LeftmostPossibleTile = LeftmostTile + ControlPointsX[0] - RightmostCP;
	const uint RightmostPossibleTile = RightmostTile + ControlPointsX[0] - LeftmostCP;
	const uint TopmostPossibleTile = TopmostTile + ControlPointsY[0] - BottommostCP;
	const uint BottommostPossibleTile = BottommostTile + ControlPointsY[0] - TopmostCP;
	//jjDebug("Current:  " + LeftmostTile + "," + RightmostTile + "   " + TopmostTile + "," + BottommostTile);
	//jjDebug("Possible: " + LeftmostPossibleTile + "," + RightmostPossibleTile + "   " + TopmostPossibleTile + "," + BottommostPossibleTile);
	jjGenerateSettableTileArea(4, LeftmostPossibleTile, TopmostPossibleTile, RightmostPossibleTile - LeftmostPossibleTile + 1, BottommostPossibleTile - TopmostPossibleTile + 1);
	
	for (int eventID = OBJECT::BOUNCERPOWERUP; eventID <= OBJECT::GUN8POWERUP; ++eventID)
		if (jjObjectPresets[eventID].behavior == BEHAVIOR::MONITOR)
			jjObjectPresets[eventID].behavior = NoFallMonitor;
			
	jjObjectPresets[OBJECT::BLUESPRING].ySpeed -= 4.9;
	jjANIMATION@ blueSpring = jjAnimations[jjObjectPresets[OBJECT::BLUESPRING].curAnim];
	for (uint i = 0; i < blueSpring.frameCount; ++i) {
		jjANIMFRAME@ frame = jjAnimFrames[blueSpring + i];
		jjPIXELMAP image(frame);
		for (uint x = 0; x < image.width; ++x)
			for (uint y = 0; y < image.height; ++y)
				if (image[x,y] & ~7 == 32)
					image[x,y] += 40;
		image.save(frame);
	}
	
	jjObjectPresets[OBJECT::FRUITPLATFORM].bulletHandling = HANDLING::IGNOREBULLET;
}

TEAM::Color LastControlPointColor = TEAM::NEUTRAL;
uint LastControlPointChoice = 0; //first is always the Real one
void onMain() {
	if ((jjIsServer || jjGameConnection == GAME::LOCAL) && jjControlPoints[0].controlTeam != LastControlPointColor) {
		LastControlPointColor = jjControlPoints[0].controlTeam;
		
		uint newControlPointChoice;
		do {
			newControlPointChoice = jjRandom() % ControlPointsX.length;
		} while (newControlPointChoice == LastControlPointChoice);
		
		MoveControlPoint(newControlPointChoice);
		SendCurrentControlPoint(0);
	}
}

void SendCurrentControlPoint(int toClientID) {
	jjSTREAM packet;
	packet.push(uint8(LastControlPointChoice));
	jjSendPacket(packet, toClientID);
}
void MoveControlPoint(uint newControlPointChoice) {
//jjAlert("" + newControlPointChoice + ",  " + LastControlPointChoice);
	if (newControlPointChoice == LastControlPointChoice) return;
	
	const int xDiff = ControlPointsX[LastControlPointChoice] - ControlPointsX[newControlPointChoice];
	const int yDiff = ControlPointsY[LastControlPointChoice] - ControlPointsY[newControlPointChoice];
	const float xdf = xDiff * 32, ydf = yDiff * 32;
	
	const array<uint8> explosionColors = {32, 24, 16, 40};
	if (jjControlPoints[0].controlTeam != TEAM::NEUTRAL)
		jjAddParticlePixelExplosion(jjControlPoints[0].xPos, jjControlPoints[0].yPos, jjObjectPresets[OBJECT::SUPERGEM].curFrame, jjControlPoints[0].direction, explosionColors[jjControlPoints[0].controlTeam]);
	
	{
		const int xSign = xDiff != 0 ? (xDiff / int(abs(xDiff))) : 1;
		const int ySign = yDiff != 0 ? (yDiff / int(abs(yDiff))) : 1;
		const uint xStart = xSign == -1 ? LeftmostTile : RightmostTile;
		const uint yStart = ySign == -1 ? TopmostTile  : BottommostTile;
		const uint xEnd = xSign == -1 ? (RightmostTile  + 1) : (LeftmostTile - 1);
		const uint yEnd = ySign == -1 ? (BottommostTile + 1) : (TopmostTile  - 1);
		
		for (uint x = xStart; x != xEnd; x -= xSign)
			for (uint y = yStart; y != yEnd; y -= ySign) {
				jjTileSet(4, x + xDiff, y + yDiff, jjTileGet(4,x,y));
				jjTileSet(4,x,y, 0);
				jjParameterSet(x + xDiff, y + yDiff, -12, 32, jjParameterGet(x, y, -12, 32));
				jjParameterSet(x, y, -12, 32, 0);
			}
	}
	
	LeftmostTile += xDiff;
	RightmostTile += xDiff;
	TopmostTile += yDiff;
	BottommostTile += yDiff;
		
	for (uint i = 0; i < 32; ++i)
		jjPlayers[i].offsetPosition(int(xdf),int(ydf));
	for (uint i = 0; i < 1024; ++i) {
		jjPARTICLE@ part = jjParticles[i];
		part.xPos += xdf;
		part.yPos += ydf;
	}
	for (uint i = jjObjectCount; --i != 0;) {
		jjOBJ@ obj = jjObjects[i];
		obj.xPos += xdf;
		obj.yPos += ydf;
		obj.xOrg += xdf;
		obj.yOrg += ydf;
		if (obj.behavior == BEHAVIOR::SPRING) {
			obj.var[3] = obj.var[3] + int(xdf * 65536);
			obj.var[4] = obj.var[4] + int(ydf * 65536);
		}
	}
	jjLayerXOffset[3] = jjLayerXOffset[3] - xdf;
	jjLayerYOffset[3] = jjLayerYOffset[3] - ydf;
	jjLayerXOffset[5] = jjLayerXOffset[5] - xdf;
	jjLayerYOffset[5] = jjLayerYOffset[5] - ydf;
	
	LastControlPointChoice = newControlPointChoice;
	
	jjSamplePriority(SOUND::CATERPIL_RIDOE);
}

void onReceive(jjSTREAM &in packet, int fromClientID) {
	if (jjIsServer) {
		SendCurrentControlPoint(fromClientID);
	} else {
		uint8 newControlPointChoice;
		packet.pop(newControlPointChoice);
		MoveControlPoint(newControlPointChoice);
	}
}
void onLevelBegin() {
	if (!jjIsServer && jjGameConnection != GAME::LOCAL)
		jjSendPacket(jjSTREAM());
	if (jjGameCustom == GAME::DOM)
		jjLocalPlayers[0].showText("@@@@The control point moves@@whenever it gets captured!", STRING::MEDIUM);
}

void NoFallMonitor(jjOBJ@ obj) {
	obj.direction = SPRITE::FLIPV;
	obj.behavior = BEHAVIOR::MONITOR;
	obj.behave();
	obj.direction = (jjRandom() & 1) == 1 ? SPRITE::FLIPV : SPRITE::FLIPHV;
}

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

array<int> fastCustomSpringSpeeds(jjLocalPlayerCount, 0);
void onPlayer(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;
		}
	}
}