Downloads containing academy_init.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 21 Levels Jazz2Online Multiple N/A Download file

File preview

  1. namespace acInit {
  2.  
  3.         array<string> filterSpellsByTiers(uint lowestTier, uint highestTier) {
  4.                 array<string> spellKeys = spells.getKeys();
  5.                 array<string> filteredSpells;
  6.                
  7.                 for (uint i = 0; i < spellKeys.length; i++) {
  8.                         string key = spellKeys[i];
  9.                         Spell@ spell = cast<Spell@>(spells[key]);
  10.                        
  11.                         if (spell.tier >= lowestTier && spell.tier <= highestTier) {
  12.                                 filteredSpells.insertLast(key);
  13.                         }
  14.                 }
  15.                
  16.                 return filteredSpells;
  17.         }
  18.  
  19.         void loadHotKeysFromFile() {
  20.                 jjSTREAM file(HOTKEY_FILENAME);
  21.                 while (!file.isEmpty()) {
  22.                         int selection;
  23.                         uint keyIndex;
  24.                         file.pop(selection);
  25.                         file.pop(keyIndex);
  26.                         acUtils::setHotkey(selection, keyIndex, true);
  27.                 }
  28.         }
  29.  
  30.         void loadChunks() {
  31.                 chunks = array<array<Chunk>>(int(ceil(float(jjLayerHeight[4]) / 4)), array<Chunk>(int(ceil(float(jjLayerWidth[4]) / 4))));
  32.                 if (debugModeOn) jjAlert("height: " + chunks.length);
  33.                 if (debugModeOn) jjAlert("width: " + chunks[0].length);
  34.         }
  35.  
  36.         void loadPlayerIDs() {
  37.                 for (int8 i = 0; i < 32; i++) {
  38.                         players[i].playerID = i;
  39.                 }
  40.         }
  41.  
  42.         void loadKeys() {
  43.                 keys[65] = Key(65, "A");
  44.                 keys[66] = Key(66, "B");
  45.                 keys[67] = Key(67, "C");
  46.                 keys[68] = Key(68, "D");
  47.                 keys[69] = Key(69, "E");
  48.                 keys[70] = Key(70, "F");
  49.                 keys[71] = Key(71, "G");
  50.                 keys[72] = Key(72, "H");
  51.                 keys[73] = Key(73, "I");
  52.                 keys[74] = Key(74, "J");
  53.                 keys[75] = Key(75, "K");
  54.                 keys[76] = Key(76, "L");
  55.                 keys[77] = Key(77, "M");
  56.                 keys[78] = Key(78, "N");
  57.                 keys[79] = Key(79, "O");
  58.                 keys[80] = Key(80, "P");
  59.                 keys[81] = Key(81, "Q");
  60.                 keys[82] = Key(82, "R");
  61.                 keys[83] = Key(83, "S");
  62.                 keys[84] = Key(84, "T");
  63.                 keys[85] = Key(85, "U");
  64.                 keys[86] = Key(86, "V");
  65.                 keys[87] = Key(87, "W");
  66.                 keys[88] = Key(88, "X");
  67.                 keys[89] = Key(89, "Y");
  68.                 keys[90] = Key(90, "Z");
  69.                
  70.                 loadKeyBindings();
  71.                 loadHotKeysFromFile();
  72.                
  73.                 jjAlert("The current hotkeys are:");
  74.                 for (uint i = 0; i < keyBindings.length; i++) {
  75.                         jjAlert(keyBindings[i]);
  76.                 }
  77.                 jjAlert("Open Key menu to change them.");
  78.         }
  79.  
  80.         void loadKeyBindings() {
  81.                 keyBindings.removeRange(0, keyBindings.length);
  82.                 keyBindings.insertLast("Information: " + getNameByKeyCode(hotkeyInfo));
  83.                 keyBindings.insertLast("Skills: " + getNameByKeyCode(hotkeySkills));
  84.                 keyBindings.insertLast("Cycle spell: " + getNameByKeyCode(hotkeyCycleSpells));
  85.                 keyBindings.insertLast("Spellbook: " + getNameByKeyCode(hotkeySpellbook));
  86.                 keyBindings.insertLast("Key menu: " + getNameByKeyCode(hotkeyKeyMenu));
  87.                 keyBindings.insertLast("Hide resources: " + getNameByKeyCode(hotkeyResources));
  88.         }
  89.  
  90.         void loadSprites() {
  91.                 jjAnimSets[ANIM::BIGROCK].load();
  92.                 jjAnimSets[ANIM::BOLLPLAT].load();
  93.                 jjAnimSets[ANIM::BRIDGE].load();
  94.                 jjAnimSets[ANIM::FLARE].load();
  95.                 jjAnimSets[ANIM::ROCK].load();
  96.                 jjAnimSets[ANIM::SKELETON].load();
  97.                 jjAnimSets[ANIM::SONCSHIP].load();
  98.                 jjAnimSets[ANIM::TURTLE].load();
  99.                 jjAnimSets[ANIM::VINE].load();
  100.                 jjAnimSets[ANIM::WITCH].load();
  101.         }
  102.  
  103.         void loadBullets() {
  104.                 if (fullFeatures) {
  105.                         for (uint i = OBJECT::BLASTERBULLET; i < OBJECT::BULLET; i++) {
  106.                                 jjObjectPresets[i].behavior = AbstractBullet(
  107.                                                 jjObjectPresets[i].behavior,
  108.                                                 jjObjectPresets[i].bulletHandling,
  109.                                                 jjObjectPresets[i].playerHandling);
  110.                         }
  111.                 } else {
  112.                         jjObjectPresets[OBJECT::BLASTERBULLET].behavior = AbstractBullet(
  113.                                         jjObjectPresets[OBJECT::BLASTERBULLET].behavior,
  114.                                         jjObjectPresets[OBJECT::BLASTERBULLET].bulletHandling,
  115.                                         jjObjectPresets[OBJECT::BLASTERBULLET].playerHandling);
  116.                         jjObjectPresets[OBJECT::BLASTERBULLETPU].behavior = AbstractBullet(
  117.                                         jjObjectPresets[OBJECT::BLASTERBULLETPU].behavior,
  118.                                         jjObjectPresets[OBJECT::BLASTERBULLETPU].bulletHandling,
  119.                                         jjObjectPresets[OBJECT::BLASTERBULLETPU].playerHandling);
  120.                 }
  121.         }
  122.  
  123.         array<string> loadSpells(uint lowestTier = LOWEST_TIER, uint highestTier = HIGHEST_TIER) {
  124.                 array<string> spellKeys = filterSpellsByTiers(lowestTier, highestTier);
  125.                 return acUtils::sortSpellKeys(spellKeys);
  126.         }
  127.  
  128.         void loadOthers() {
  129.                 jjUseLayer8Speeds = true;
  130.         }
  131. }