Downloads containing academy_init.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Academy Superjazz Battle N/A Download file

File preview

namespace acInit {

	array<string> filterSpellsByTiers(uint lowestTier, uint highestTier) {
		array<string> spellKeys = spells.getKeys();
		array<string> filteredSpells;
		
		for (uint i = 0; i < spellKeys.length; i++) {
			string key = spellKeys[i];
			Spell@ spell = cast<Spell@>(spells[key]);
			
			if (spell.tier >= lowestTier && spell.tier <= highestTier) {
				filteredSpells.insertLast(key);
			}
		}
		
		return filteredSpells;
	}

	void loadHotKeysFromFile() {
		jjSTREAM file(HOTKEY_FILENAME);
		while (!file.isEmpty()) {
			int selection;
			uint keyIndex;
			file.pop(selection);
			file.pop(keyIndex);
			acUtils::setHotkey(selection, keyIndex, true);
		}
	}

	void loadChunks() {
		chunks = array<array<Chunk>>(int(ceil(float(jjLayerHeight[4]) / 4)), array<Chunk>(int(ceil(float(jjLayerWidth[4]) / 4))));
		if (debugModeOn) jjAlert("height: " + chunks.length);
		if (debugModeOn) jjAlert("width: " + chunks[0].length);
	}

	void loadPlayerIDs() {
		for (int8 i = 0; i < 32; i++) {
			players[i].playerID = i;
		}
	}

	void loadKeys() {
		keys[65] = Key(65, "A");
		keys[66] = Key(66, "B");
		keys[67] = Key(67, "C");
		keys[68] = Key(68, "D");
		keys[69] = Key(69, "E");
		keys[70] = Key(70, "F");
		keys[71] = Key(71, "G");
		keys[72] = Key(72, "H");
		keys[73] = Key(73, "I");
		keys[74] = Key(74, "J");
		keys[75] = Key(75, "K");
		keys[76] = Key(76, "L");
		keys[77] = Key(77, "M");
		keys[78] = Key(78, "N");
		keys[79] = Key(79, "O");
		keys[80] = Key(80, "P");
		keys[81] = Key(81, "Q");
		keys[82] = Key(82, "R");
		keys[83] = Key(83, "S");
		keys[84] = Key(84, "T");
		keys[85] = Key(85, "U");
		keys[86] = Key(86, "V");
		keys[87] = Key(87, "W");
		keys[88] = Key(88, "X");
		keys[89] = Key(89, "Y");
		keys[90] = Key(90, "Z");
		
		loadKeyBindings();
		loadHotKeysFromFile();
		
		jjAlert("The current hotkeys are:");
		for (uint i = 0; i < keyBindings.length; i++) {
			jjAlert(keyBindings[i]);
		}
		jjAlert("Open Key menu to change them.");
		jjAlert("NEW:");
		jjAlert("-Multiple spells have been rebalanced and their behaviors and documentations tweaked");
		jjAlert("-Spells are now learned automatically when collecting coins");
		jjAlert("-Secondary skills are now learned automatically when collecting purple gems");
		jjAlert("-Spell store has been replaced by RF crates");
		jjAlert("-Tree of knowledge has been replaced by another gem mine");
		jjAlert("-Gems/Coins required for the next asset are now displayed in parenthesis");
		jjAlert("-Magic well now regenerates mana four times as fast, instead of twice as fast");
		jjAlert("-New spell: Magic Mirror (reflects hostile spells on enemies)");
	}

	void loadKeyBindings() {
		keyBindings.removeRange(0, keyBindings.length);
		keyBindings.insertLast("Information: " + getNameByKeyCode(hotkeyInfo));
		keyBindings.insertLast("Skills: " + getNameByKeyCode(hotkeySkills));
		keyBindings.insertLast("Cycle spell: " + getNameByKeyCode(hotkeyCycleSpells));
		keyBindings.insertLast("Spellbook: " + getNameByKeyCode(hotkeySpellbook));
		keyBindings.insertLast("Key menu: " + getNameByKeyCode(hotkeyKeyMenu));
		keyBindings.insertLast("Hide resources: " + getNameByKeyCode(hotkeyResources));
	}

	void loadSprites() {
		jjAnimSets[ANIM::BIGROCK].load();
		jjAnimSets[ANIM::BOLLPLAT].load();
		jjAnimSets[ANIM::BRIDGE].load();
		jjAnimSets[ANIM::FLARE].load();
		jjAnimSets[ANIM::ROCK].load();
		jjAnimSets[ANIM::SKELETON].load();
		jjAnimSets[ANIM::SONCSHIP].load();
		jjAnimSets[ANIM::TURTLE].load();
		jjAnimSets[ANIM::VINE].load();
		jjAnimSets[ANIM::WITCH].load();
	}

	void loadBullets() {
		if (fullFeatures) {
			for (uint i = OBJECT::BLASTERBULLET; i < OBJECT::BULLET; i++) {
				jjObjectPresets[i].behavior = AbstractBullet(
						jjObjectPresets[i].behavior,
						jjObjectPresets[i].bulletHandling,
						jjObjectPresets[i].playerHandling);
			}
		} else {
			jjObjectPresets[OBJECT::BLASTERBULLET].behavior = AbstractBullet(
					jjObjectPresets[OBJECT::BLASTERBULLET].behavior,
					jjObjectPresets[OBJECT::BLASTERBULLET].bulletHandling,
					jjObjectPresets[OBJECT::BLASTERBULLET].playerHandling);
			jjObjectPresets[OBJECT::BLASTERBULLETPU].behavior = AbstractBullet(
					jjObjectPresets[OBJECT::BLASTERBULLETPU].behavior,
					jjObjectPresets[OBJECT::BLASTERBULLETPU].bulletHandling,
					jjObjectPresets[OBJECT::BLASTERBULLETPU].playerHandling);
		}
	}

	array<string> loadSpells(uint lowestTier = LOWEST_TIER, uint highestTier = HIGHEST_TIER) {
		array<string> spellKeys = filterSpellsByTiers(lowestTier, highestTier);
		return acUtils::sortSpellKeys(spellKeys);
	}

	void loadOthers() {
		jjUseLayer8Speeds = true;
	}
}