Downloads containing jjnetAmmo_retroic.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Retroic FireSworD Battle N/A Download file
TSF with JJ2+ Only: Anniversary Bash 24 Battle Jazz2Online Battle N/A Download file

File preview

/*Information about the weapons and objects*/
const array<int> nonPUs = {0, 0, 24, 30, 33, 48, 56, 0, 0, 0, 0, 0, 0, 0};	//[1] = blaster, [2] = bnc , ...
const array<int> PUs 	= {0, 0, 25, 29, 34, 49, 57, 0, 0, 0, 0, 0, 0, 0};	//idem

int objectToWeapon(int eventID) {
	int weaponID = 0;
	switch(eventID)	{
		case OBJECT::BOUNCERAMMO15	: 	weaponID = WEAPON::BOUNCER; 	break;
		case OBJECT::ICEAMMO15		: 	weaponID = WEAPON::ICE; 		break;
		case OBJECT::SEEKERAMMO15	:	weaponID = WEAPON::SEEKER; 		break;
		case OBJECT::RFAMMO15		:	weaponID = WEAPON::RF; 			break;
		case OBJECT::TOASTERAMMO15	: 	weaponID = WEAPON::TOASTER; 	break;
	}
	return weaponID;
}

/*The rest!*/
void setOnlyBncFromGunCrates () {
	for (uint j=0; j < 10;j++) {
		if (j != WEAPON::BOUNCER) jjWeapons[j].comesFromGunCrates = false;
	}
}

void setAmmoPresets(int Object) {
	jjObjectPresets[Object].scriptedCollisions = true;
	jjObjectPresets[Object].behavior = ammoBehaviour;
	jjObjectPresets[Object].determineCurFrame();
	jjObjectPresets[Object].state = STATE::FLOATFALL;
	jjObjectPresets[Object].bulletHandling = HANDLING::IGNOREBULLET;
	jjObjectPresets[Object].playerHandling = HANDLING::SPECIAL;
}

void ammoBehaviour(jjOBJ@ obj) {
	int ammoType = objectToWeapon(obj.eventID);
	obj.behave(BEHAVIOR::PICKUP, false);
	obj.xPos = obj.xOrg;
	obj.yPos = obj.yOrg;
	if (obj.justHit == 0) {
		jjDrawResizedSprite(obj.xPos, obj.yPos,	ANIM::AMMO,
			jjLocalPlayers[0].powerup[ammoType] == true? nonPUs[ammoType]:PUs[ammoType],
			jjGameTicks >> 2, 2, 2,	SPRITE::NORMAL);
	}
}

void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
	int ammoType = objectToWeapon(obj.eventID);
	if (ammoType>0 && play.isLocal) {
		if (play.ammo[ammoType] == 0 && jjAutoWeaponChange) play.currWeapon = ammoType;
		if (play.ammo[ammoType] < 30) {
			play.ammo[ammoType] = 30;
			jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUPW1);
		}
	}
}