Downloads containing weaponMega5.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: Backfire"
#pragma require "weaponMega5.mut"
#include "weaponMega.asc"

bool LoadWeaponMega5() {
	if (!SafeToReplaceWeapon(WEAPON::RF))
		return false;
		
	jjWeapons[WEAPON::RF].defaultSample = false;
	//jjWeapons[WEAPON::RF].spread = SPREAD::NORMAL;
	jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
	jjWeapons[WEAPON::RF].replacedByBubbles = true;
	
	Preset1.behavior = Backfire;
	Preset2.behavior = Backfire;
	Preset2.special = Preset2.curAnim = Preset1.special = Preset1.determineCurAnim(AnimSet, 0);
	Preset1.determineCurFrame(); Preset2.determineCurFrame();
	Preset1.xAcc /= 3; Preset1.xSpeed *= 4;
	Preset2.xSpeed *= 3;
	Preset1.killAnim = Preset2.killAnim = Preset1.curAnim + 1;
	
	return true;
}
const bool WeaponMega5Loaded = LoadWeaponMega5();

void Backfire(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		if (obj.creatorType == CREATOR::PLAYER) {
			jjAddObject(obj.eventID, obj.xPos, obj.yPos, obj.objectID, CREATOR::OBJECT);
			jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PISTOL1);
		} else {
			const jjOBJ@ creator = jjObjects[obj.creatorID];
			if (creator.eventID == obj.eventID) {
				obj.xSpeed = -creator.xSpeed;
				obj.ySpeed = -creator.ySpeed;
				obj.xAcc = -creator.xAcc;
				obj.yAcc = -creator.yAcc;
				obj.var[7] = -creator.var[7];
				obj.counterEnd = creator.counterEnd;
				obj.creator = creator.creator;
			}
		}
	}
	
	const bool dying = obj.state == STATE::EXPLODE;
	obj.behave(BEHAVIOR::BULLET, dying);
	
	const float speedAdjustment = /*((obj.var[6] & 8) == 0) ? 1.04f :*/ 0.95f;
	if (abs(obj.xSpeed) > abs(obj.ySpeed))
		obj.ySpeed *= speedAdjustment;
	else
		obj.xSpeed *= speedAdjustment;
		
	if (!dying)
		jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, int(atan2(
				(obj.xSpeed >= 0) ? obj.ySpeed : -obj.ySpeed,
				abs(obj.xSpeed)
		) * -512.0 * 0.318309886142228), obj.direction = int((obj.xSpeed >= 0) ? 1 : -1), 1, SPRITE::SINGLEHUE, ((obj.var[6] & 8) == 0) ? 40 : 32);
}