Downloads containing weaponMega8.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: Weapon MegaFeatured Download Violet CLM Mutator 8.7 Download file

File preview

#pragma name "Weapon Mega: Voranj"
#pragma require "weaponMega8.mut"
#include "weaponMega.asc"

bool LoadWeaponMega8() {
	if (!SafeToReplaceWeapon(WEAPON::GUN8))
		return false;
		
	jjWeapons[WEAPON::GUN8].style = WEAPON::NORMAL;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].maximum = 25;
	
	Preset1.behavior = Voranj;
	Preset2.behavior = Voranj;
	Preset1.special = Preset1.determineCurAnim(AnimSet, 0);
	Preset2.special = Preset2.determineCurAnim(AnimSet, 1);
	Preset1.determineCurFrame(); Preset2.determineCurFrame();
	Preset1.xSpeed = 3.2; Preset1.xAcc = 0.05f;
	Preset2.xSpeed = 3.6; Preset2.xAcc = 0.1f;
	Preset1.state = Preset2.state = STATE::FLY;
	Preset1.age = 2; Preset2.age = 3; //number of splits
	Preset1.var[6] = 0; Preset2.var[6] = 8; //not fireballs
	Preset1.animSpeed = 1; Preset2.animSpeed = 2;
	
	return true;
}
const bool WeaponMega8Loaded = LoadWeaponMega8();

void Voranj(jjOBJ@ obj) {
	obj.frameID = ++obj.counter / 6;
	if (obj.counter == 6 * 3) {
		obj.state = STATE::EXPLODE;
		if (obj.age > 0) {
			createVoranj(obj, 1);
			createVoranj(obj, -1);
		}
	}
	if (obj.state == STATE::EXPLODE || jjMaskedPixel(int(obj.xPos), int(obj.yPos))) 
	{
		obj.counter = 0;
		obj.playerHandling = HANDLING::EXPLOSION;
		obj.behavior = BEHAVIOR::EXPLOSION;
	} else {
		obj.xPos += (obj.xSpeed += obj.xAcc) + obj.var[7] / 65536.f;
		obj.yPos += (obj.ySpeed += obj.yAcc);
		if (obj.var[7] > 0x8000)
			obj.var[7] = obj.var[7] - 0x2000;
		else if (obj.var[7] < -0x8000)
			obj.var[7] = obj.var[7] + 0x2000;
	}
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame = jjAnimations[obj.curAnim] + obj.frameID, obj.direction);
}
void createVoranj(const jjOBJ@ creator, int direction) {
	const float angle = atan2(creator.ySpeed, creator.xSpeed);
	const float speed = sqrt(creator.xSpeed * creator.xSpeed + creator.ySpeed * creator.ySpeed);
	const float acc = sqrt(creator.xAcc * creator.xAcc + creator.yAcc * creator.yAcc);
	const float angleDifference = direction * 0.78539816339 / 1.5;
	jjOBJ@ obj = jjObjects[jjAddObject(creator.eventID, creator.xPos, creator.yPos, creator.creatorID, creator.creatorType, BEHAVIOR::INACTIVE)];
	obj.xSpeed = cos(angle + angleDifference) * speed;
	obj.ySpeed = sin(angle + angleDifference) * speed;
	obj.xAcc = cos(angle + angleDifference) * acc;
	obj.yAcc = sin(angle + angleDifference) * acc;
	obj.var[7] = creator.var[7];
	obj.age = creator.age - 1;
	obj.behavior = Voranj;
}